Commit d8bc1b05 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: Intel: Add KeemBay ASoC platform driver" from Sia Jee Heng...

Merge series "ASoC: Intel: Add KeemBay ASoC platform driver" from Sia Jee Heng <jee.heng.sia@intel.com>:

The below series of patches support the KeemBay ASoC platform driver.
The platform driver initialize the i2s to capture and playback the
pcm data on the ARM. The i2s is running in polling mode.

There is no DSP in the KeemBay SoC. Users are rely on the Gstreamer plugin
to perform Audio preprocessing.

Audio graph card is used to connect the platform driver with the
tlv320aic3204 codec.

Change History:
v5:
- Remove OF dependency from Kconfig as OF is shifted to audio graph card.

v4:
- Reduce if-otology at the tx/rx function.
- Fix indentation.
- specify .rate directly

v3:
- Adjusted header format.
- Use Audio graph card instead of custom sound card.
- Use if-else instead of conditional operator.
- Enabled .set_fmt to configure master clock.

v2:
- Corrected I2S naming for DT binding.

v1:
- Initial version.

Sia Jee Heng (3):
  ASoC: Intel: Add KeemBay platform driver
  ASoC: Intel: Add makefiles and kconfig changes for KeemBay
  dt-bindings: sound: Add documentation for KeemBay i2s

 .../bindings/sound/intel,keembay-i2s.yaml          |  68 +++
 sound/soc/intel/Kconfig                            |   7 +
 sound/soc/intel/Makefile                           |   1 +
 sound/soc/intel/keembay/Makefile                   |   4 +
 sound/soc/intel/keembay/kmb_platform.c             | 654 +++++++++++++++++++++
 sound/soc/intel/keembay/kmb_platform.h             | 145 +++++
 6 files changed, 879 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/intel,keembay-i2s.yaml
 create mode 100644 sound/soc/intel/keembay/Makefile
 create mode 100644 sound/soc/intel/keembay/kmb_platform.c
 create mode 100644 sound/soc/intel/keembay/kmb_platform.h

--
1.9.1
parents 674b9289 e16caedf
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
# Copyright 2020 Intel Corporation
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/intel,keembay-i2s.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Intel KeemBay I2S Device Tree Bindings
maintainers:
- Sia, Jee Heng <jee.heng.sia@intel.com>
description: |
Intel KeemBay I2S
properties:
compatible:
enum:
- intel,keembay-i2s
"#sound-dai-cells":
const: 0
reg:
items:
- description: I2S configuration
reg-names:
items:
- const: i2s-regs
- const: i2s_gen_cfg
interrupts:
maxItems: 1
clocks:
items:
- description: Bus Clock
- description: Module Clock
clock-names:
items:
- const: osc
- const: apb_clk
required:
- compatible
- "#sound-dai-cells"
- reg
- clocks
- clock-names
- interrupts
examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/interrupt-controller/irq.h>
#define KEEM_BAY_PSS_AUX_I2S3
#define KEEM_BAY_PSS_I2S3
i2s3: i2s@20140000 {
compatible = "intel,keembay-i2s";
#sound-dai-cells = <0>;
reg = <0x20140000 0x200 0x202a00a4 0x4>;
reg-names = "i2s-regs", "i2s_gen_cfg";
interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
clock-names = "osc", "apb_clk";
clocks = <&scmi_clk KEEM_BAY_PSS_AUX_I2S3>, <&scmi_clk KEEM_BAY_PSS_I2S3>;
};
......@@ -240,6 +240,13 @@ config SND_SOC_ACPI_INTEL_MATCH
endif ## SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLEVEL
config SND_SOC_INTEL_KEEMBAY
tristate "Keembay Platforms"
depends on ARM64 || COMPILE_TEST
depends on COMMON_CLK
help
If you have a Intel Keembay platform then enable this option
by saying Y or m.
# ASoC codec drivers
source "sound/soc/intel/boards/Kconfig"
......@@ -7,6 +7,7 @@ obj-$(CONFIG_SND_SOC_INTEL_HASWELL) += haswell/
obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL) += baytrail/
obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += atom/
obj-$(CONFIG_SND_SOC_INTEL_SKYLAKE) += skylake/
obj-$(CONFIG_SND_SOC_INTEL_KEEMBAY) += keembay/
# Machine support
obj-$(CONFIG_SND_SOC) += boards/
snd-soc-kmb_platform-objs := \
kmb_platform.o
obj-$(CONFIG_SND_SOC_INTEL_KEEMBAY) += snd-soc-kmb_platform.o
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Intel KeemBay Platform driver
*
* Copyright (C) 2020 Intel Corporation.
*
*/
#ifndef KMB_PLATFORM_H_
#define KMB_PLATFORMP_H_
#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/types.h>
/* Register values with reference to KMB databook v1.1 */
/* common register for all channel */
#define IER 0x000
#define IRER 0x004
#define ITER 0x008
#define CER 0x00C
#define CCR 0x010
#define RXFFR 0x014
#define TXFFR 0x018
/* Interrupt status register fields */
#define ISR_TXFO BIT(5)
#define ISR_TXFE BIT(4)
#define ISR_RXFO BIT(1)
#define ISR_RXDA BIT(0)
/* I2S Tx Rx Registers for all channels */
#define LRBR_LTHR(x) (0x40 * (x) + 0x020)
#define RRBR_RTHR(x) (0x40 * (x) + 0x024)
#define RER(x) (0x40 * (x) + 0x028)
#define TER(x) (0x40 * (x) + 0x02C)
#define RCR(x) (0x40 * (x) + 0x030)
#define TCR(x) (0x40 * (x) + 0x034)
#define ISR(x) (0x40 * (x) + 0x038)
#define IMR(x) (0x40 * (x) + 0x03C)
#define ROR(x) (0x40 * (x) + 0x040)
#define TOR(x) (0x40 * (x) + 0x044)
#define RFCR(x) (0x40 * (x) + 0x048)
#define TFCR(x) (0x40 * (x) + 0x04C)
#define RFF(x) (0x40 * (x) + 0x050)
#define TFF(x) (0x40 * (x) + 0x054)
/* I2S COMP Registers */
#define I2S_COMP_PARAM_2 0x01F0
#define I2S_COMP_PARAM_1 0x01F4
#define I2S_COMP_VERSION 0x01F8
#define I2S_COMP_TYPE 0x01FC
/* PSS_GEN_CTRL_I2S_GEN_CFG_0 Registers */
#define I2S_GEN_CFG_0 0x000
#define PSS_CPR_RST_EN 0x010
#define PSS_CPR_RST_SET 0x014
#define PSS_CPR_CLK_CLR 0x000
#define PSS_CPR_AUX_RST_EN 0x070
#define MASTER_MODE BIT(13)
/* Interrupt Flag */
#define TX_INT_FLAG GENMASK(5, 4)
#define RX_INT_FLAG GENMASK(1, 0)
/*
* Component parameter register fields - define the I2S block's
* configuration.
*/
#define COMP1_TX_WORDSIZE_3(r) FIELD_GET(GENMASK(27, 25), (r))
#define COMP1_TX_WORDSIZE_2(r) FIELD_GET(GENMASK(24, 22), (r))
#define COMP1_TX_WORDSIZE_1(r) FIELD_GET(GENMASK(21, 19), (r))
#define COMP1_TX_WORDSIZE_0(r) FIELD_GET(GENMASK(18, 16), (r))
#define COMP1_RX_ENABLED(r) FIELD_GET(BIT(6), (r))
#define COMP1_TX_ENABLED(r) FIELD_GET(BIT(5), (r))
#define COMP1_MODE_EN(r) FIELD_GET(BIT(4), (r))
#define COMP1_APB_DATA_WIDTH(r) FIELD_GET(GENMASK(1, 0), (r))
#define COMP2_RX_WORDSIZE_3(r) FIELD_GET(GENMASK(12, 10), (r))
#define COMP2_RX_WORDSIZE_2(r) FIELD_GET(GENMASK(9, 7), (r))
#define COMP2_RX_WORDSIZE_1(r) FIELD_GET(GENMASK(5, 3), (r))
#define COMP2_RX_WORDSIZE_0(r) FIELD_GET(GENMASK(2, 0), (r))
/* Add 1 to the below registers to indicate the actual size */
#define COMP1_TX_CHANNELS(r) (FIELD_GET(GENMASK(10, 9), (r)) + 1)
#define COMP1_RX_CHANNELS(r) (FIELD_GET(GENMASK(8, 7), (r)) + 1)
#define COMP1_FIFO_DEPTH(r) (FIELD_GET(GENMASK(3, 2), (r)) + 1)
/* Number of entries in WORDSIZE and DATA_WIDTH parameter registers */
#define COMP_MAX_WORDSIZE 8 /* 3 bits register width */
#define MAX_CHANNEL_NUM 8
#define MIN_CHANNEL_NUM 2
#define TWO_CHANNEL_SUPPORT 2 /* up to 2.0 */
#define FOUR_CHANNEL_SUPPORT 4 /* up to 3.1 */
#define SIX_CHANNEL_SUPPORT 6 /* up to 5.1 */
#define EIGHT_CHANNEL_SUPPORT 8 /* up to 7.1 */
#define DWC_I2S_PLAY BIT(0)
#define DWC_I2S_RECORD BIT(1)
#define DW_I2S_SLAVE BIT(2)
#define DW_I2S_MASTER BIT(3)
#define I2S_RXDMA 0x01C0
#define I2S_TXDMA 0x01C8
/*
* struct i2s_clk_config_data - represent i2s clk configuration data
* @chan_nr: number of channel
* @data_width: number of bits per sample (8/16/24/32 bit)
* @sample_rate: sampling frequency (8Khz, 16Khz, 48Khz)
*/
struct i2s_clk_config_data {
int chan_nr;
u32 data_width;
u32 sample_rate;
};
struct kmb_i2s_info {
void __iomem *i2s_base;
void __iomem *pss_base;
struct clk *clk_i2s;
struct clk *clk_apb;
int active;
unsigned int capability;
unsigned int i2s_reg_comp1;
unsigned int i2s_reg_comp2;
struct device *dev;
u32 ccr;
u32 xfer_resolution;
u32 fifo_th;
bool master;
struct i2s_clk_config_data config;
int (*i2s_clk_cfg)(struct i2s_clk_config_data *config);
/* data related to PIO transfers */
bool use_pio;
struct snd_pcm_substream *tx_substream;
struct snd_pcm_substream *rx_substream;
unsigned int tx_ptr;
unsigned int rx_ptr;
};
#endif /* KMB_PLATFORM_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment