Commit 141dee78 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/wm8753' and 'asoc/topic/zte' into asoc-next

ZTE ZX296702 I2S controller ZTE ZX296702 I2S controller
Required properties: Required properties:
- compatible : Must be "zte,zx296702-i2s" - compatible : Must be one of:
"zte,zx296718-i2s", "zte,zx296702-i2s"
"zte,zx296702-i2s"
- reg : Must contain I2S core's registers location and length - reg : Must contain I2S core's registers location and length
- clocks : Pairs of phandle and specifier referencing the controller's clocks. - clocks : Pairs of phandle and specifier referencing the controller's clocks.
- clock-names: "tx" for the clock to the I2S interface. - clock-names: "wclk" for the wclk, "pclk" for the pclk to the I2S interface.
- dmas: Pairs of phandle and specifier for the DMA channel that is used by - dmas: Pairs of phandle and specifier for the DMA channel that is used by
the core. The core expects two dma channels for transmit. the core. The core expects two dma channels for transmit.
- dma-names : Must be "tx" and "rx" - dma-names : Must be "tx" and "rx"
...@@ -16,12 +18,12 @@ please check: ...@@ -16,12 +18,12 @@ please check:
* dma/dma.txt * dma/dma.txt
Example: Example:
i2s0: i2s0@0b005000 { i2s0: i2s@b005000 {
#sound-dai-cells = <0>; #sound-dai-cells = <0>;
compatible = "zte,zx296702-i2s"; compatible = "zte,zx296718-i2s", "zte,zx296702-i2s";
reg = <0x0b005000 0x1000>; reg = <0x0b005000 0x1000>;
clocks = <&lsp0clk ZX296702_I2S0_DIV>; clocks = <&audiocrm AUDIO_I2S0_WCLK>, <&audiocrm AUDIO_I2S0_PCLK>;
clock-names = "tx"; clock-names = "wclk", "pclk";
interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&dma 5>, <&dma 6>; dmas = <&dma 5>, <&dma 6>;
dma-names = "tx", "rx"; dma-names = "tx", "rx";
......
...@@ -280,6 +280,7 @@ static const DECLARE_TLV_DB_SCALE(voice_mix_tlv, -1200, 300, 0); ...@@ -280,6 +280,7 @@ static const DECLARE_TLV_DB_SCALE(voice_mix_tlv, -1200, 300, 0);
static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0); static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0);
static const struct snd_kcontrol_new wm8753_snd_controls[] = { static const struct snd_kcontrol_new wm8753_snd_controls[] = {
SOC_SINGLE("Hi-Fi DAC Left/Right channel Swap", WM8753_HIFI, 5, 1, 0),
SOC_DOUBLE_R_TLV("PCM Volume", WM8753_LDAC, WM8753_RDAC, 0, 255, 0, dac_tlv), SOC_DOUBLE_R_TLV("PCM Volume", WM8753_LDAC, WM8753_RDAC, 0, 255, 0, dac_tlv),
SOC_DOUBLE_R_TLV("ADC Capture Volume", WM8753_LADC, WM8753_RADC, 0, 255, 0, SOC_DOUBLE_R_TLV("ADC Capture Volume", WM8753_LADC, WM8753_RADC, 0, 255, 0,
...@@ -1087,7 +1088,7 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_codec *codec, ...@@ -1087,7 +1088,7 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_codec *codec,
{ {
u16 ioctl, hifi; u16 ioctl, hifi;
hifi = snd_soc_read(codec, WM8753_HIFI) & 0x011f; hifi = snd_soc_read(codec, WM8753_HIFI) & 0x013f;
ioctl = snd_soc_read(codec, WM8753_IOCTL) & 0x00ae; ioctl = snd_soc_read(codec, WM8753_IOCTL) & 0x00ae;
/* set master/slave audio interface */ /* set master/slave audio interface */
......
...@@ -95,7 +95,8 @@ ...@@ -95,7 +95,8 @@
struct zx_i2s_info { struct zx_i2s_info {
struct snd_dmaengine_dai_dma_data dma_playback; struct snd_dmaengine_dai_dma_data dma_playback;
struct snd_dmaengine_dai_dma_data dma_capture; struct snd_dmaengine_dai_dma_data dma_capture;
struct clk *dai_clk; struct clk *dai_wclk;
struct clk *dai_pclk;
void __iomem *reg_base; void __iomem *reg_base;
int master; int master;
resource_size_t mapbase; resource_size_t mapbase;
...@@ -225,7 +226,7 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -225,7 +226,7 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream,
struct zx_i2s_info *i2s = snd_soc_dai_get_drvdata(socdai); struct zx_i2s_info *i2s = snd_soc_dai_get_drvdata(socdai);
struct snd_dmaengine_dai_dma_data *dma_data; struct snd_dmaengine_dai_dma_data *dma_data;
unsigned int lane, ch_num, len, ret = 0; unsigned int lane, ch_num, len, ret = 0;
unsigned long val, format; unsigned long val;
unsigned long chn_cfg; unsigned long chn_cfg;
dma_data = snd_soc_dai_get_dma_data(socdai, substream); dma_data = snd_soc_dai_get_dma_data(socdai, substream);
...@@ -238,15 +239,12 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -238,15 +239,12 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream,
switch (params_format(params)) { switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_LE:
format = 0;
len = 16; len = 16;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S24_LE:
format = 1;
len = 24; len = 24;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S32_LE:
format = 2;
len = 32; len = 32;
break; break;
default: default:
...@@ -278,8 +276,9 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -278,8 +276,9 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream,
writel_relaxed(val, i2s->reg_base + ZX_I2S_TIMING_CTRL); writel_relaxed(val, i2s->reg_base + ZX_I2S_TIMING_CTRL);
if (i2s->master) if (i2s->master)
ret = clk_set_rate(i2s->dai_clk, ret = clk_set_rate(i2s->dai_wclk,
params_rate(params) * ch_num * CLK_RAT); params_rate(params) * ch_num * CLK_RAT);
return ret; return ret;
} }
...@@ -331,8 +330,19 @@ static int zx_i2s_startup(struct snd_pcm_substream *substream, ...@@ -331,8 +330,19 @@ static int zx_i2s_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev); struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev);
int ret;
return clk_prepare_enable(zx_i2s->dai_clk); ret = clk_prepare_enable(zx_i2s->dai_wclk);
if (ret)
return ret;
ret = clk_prepare_enable(zx_i2s->dai_pclk);
if (ret) {
clk_disable_unprepare(zx_i2s->dai_wclk);
return ret;
}
return ret;
} }
static void zx_i2s_shutdown(struct snd_pcm_substream *substream, static void zx_i2s_shutdown(struct snd_pcm_substream *substream,
...@@ -340,7 +350,8 @@ static void zx_i2s_shutdown(struct snd_pcm_substream *substream, ...@@ -340,7 +350,8 @@ static void zx_i2s_shutdown(struct snd_pcm_substream *substream,
{ {
struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev); struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev);
clk_disable_unprepare(zx_i2s->dai_clk); clk_disable_unprepare(zx_i2s->dai_wclk);
clk_disable_unprepare(zx_i2s->dai_pclk);
} }
static struct snd_soc_dai_ops zx_i2s_dai_ops = { static struct snd_soc_dai_ops zx_i2s_dai_ops = {
...@@ -384,10 +395,16 @@ static int zx_i2s_probe(struct platform_device *pdev) ...@@ -384,10 +395,16 @@ static int zx_i2s_probe(struct platform_device *pdev)
if (!zx_i2s) if (!zx_i2s)
return -ENOMEM; return -ENOMEM;
zx_i2s->dai_clk = devm_clk_get(&pdev->dev, "tx"); zx_i2s->dai_wclk = devm_clk_get(&pdev->dev, "wclk");
if (IS_ERR(zx_i2s->dai_clk)) { if (IS_ERR(zx_i2s->dai_wclk)) {
dev_err(&pdev->dev, "Fail to get clk\n"); dev_err(&pdev->dev, "Fail to get wclk\n");
return PTR_ERR(zx_i2s->dai_clk); return PTR_ERR(zx_i2s->dai_wclk);
}
zx_i2s->dai_pclk = devm_clk_get(&pdev->dev, "pclk");
if (IS_ERR(zx_i2s->dai_pclk)) {
dev_err(&pdev->dev, "Fail to get pclk\n");
return PTR_ERR(zx_i2s->dai_pclk);
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......
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