From e2f748e06db389d9fd51413df23ff8d3615a47db Mon Sep 17 00:00:00 2001 From: Jose Abreu Date: Tue, 27 Dec 2016 14:00:53 +0000 Subject: ASoC: dwc: Add record capability in PIO mode Up until now PIO mode offered only playback support. With this patch we add support for record mode. The PCM was refactored so that we could reuse the existing infrastructure without many changes. We have support for 16 and 32 bits of sample size using only 2 channels. Tested in a x86_64 platform and in ARC AXS101 SDP platform. Signed-off-by: Jose Abreu Signed-off-by: Mark Brown --- sound/soc/dwc/designware_i2s.c | 9 +++- sound/soc/dwc/designware_pcm.c | 97 +++++++++++++++++++++++++++++++++--------- sound/soc/dwc/local.h | 9 +++- 3 files changed, 92 insertions(+), 23 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c index bdf8398cbc81..9c46e4112026 100644 --- a/sound/soc/dwc/designware_i2s.c +++ b/sound/soc/dwc/designware_i2s.c @@ -121,9 +121,14 @@ static irqreturn_t i2s_irq_handler(int irq, void *dev_id) irq_valid = true; } - /* Data available. Record mode not supported in PIO mode */ - if (isr[i] & ISR_RXDA) + /* + * Data available. Retrieve samples from FIFO + * NOTE: Only two channels supported + */ + if ((isr[i] & ISR_RXDA) && (i == 0) && dev->use_pio) { + dw_pcm_pop_rx(dev); irq_valid = true; + } /* Error Handling: TX */ if (isr[i] & ISR_TXFO) { diff --git a/sound/soc/dwc/designware_pcm.c b/sound/soc/dwc/designware_pcm.c index 4a83a22fa3cb..b063c8601569 100644 --- a/sound/soc/dwc/designware_pcm.c +++ b/sound/soc/dwc/designware_pcm.c @@ -41,10 +41,33 @@ static unsigned int dw_pcm_tx_##sample_bits(struct dw_i2s_dev *dev, \ return tx_ptr; \ } +#define dw_pcm_rx_fn(sample_bits) \ +static unsigned int dw_pcm_rx_##sample_bits(struct dw_i2s_dev *dev, \ + struct snd_pcm_runtime *runtime, unsigned int rx_ptr, \ + bool *period_elapsed) \ +{ \ + u##sample_bits (*p)[2] = (void *)runtime->dma_area; \ + unsigned int period_pos = rx_ptr % runtime->period_size; \ + int i; \ +\ + for (i = 0; i < dev->fifo_th; i++) { \ + p[rx_ptr][0] = ioread32(dev->i2s_base + LRBR_LTHR(0)); \ + p[rx_ptr][1] = ioread32(dev->i2s_base + RRBR_RTHR(0)); \ + period_pos++; \ + if (++rx_ptr >= runtime->buffer_size) \ + rx_ptr = 0; \ + } \ + *period_elapsed = period_pos >= runtime->period_size; \ + return rx_ptr; \ +} + dw_pcm_tx_fn(16); dw_pcm_tx_fn(32); +dw_pcm_rx_fn(16); +dw_pcm_rx_fn(32); #undef dw_pcm_tx_fn +#undef dw_pcm_rx_fn static const struct snd_pcm_hardware dw_pcm_hardware = { .info = SNDRV_PCM_INFO_INTERLEAVED | @@ -68,27 +91,51 @@ static const struct snd_pcm_hardware dw_pcm_hardware = { .fifo_size = 16, }; -void dw_pcm_push_tx(struct dw_i2s_dev *dev) +static void dw_pcm_transfer(struct dw_i2s_dev *dev, bool push) { - struct snd_pcm_substream *tx_substream; - bool tx_active, period_elapsed; + struct snd_pcm_substream *substream; + bool active, period_elapsed; rcu_read_lock(); - tx_substream = rcu_dereference(dev->tx_substream); - tx_active = tx_substream && snd_pcm_running(tx_substream); - if (tx_active) { - unsigned int tx_ptr = READ_ONCE(dev->tx_ptr); - unsigned int new_tx_ptr = dev->tx_fn(dev, tx_substream->runtime, - tx_ptr, &period_elapsed); - cmpxchg(&dev->tx_ptr, tx_ptr, new_tx_ptr); + if (push) + substream = rcu_dereference(dev->tx_substream); + else + substream = rcu_dereference(dev->rx_substream); + active = substream && snd_pcm_running(substream); + if (active) { + unsigned int ptr; + unsigned int new_ptr; + + if (push) { + ptr = READ_ONCE(dev->tx_ptr); + new_ptr = dev->tx_fn(dev, substream->runtime, ptr, + &period_elapsed); + cmpxchg(&dev->tx_ptr, ptr, new_ptr); + } else { + ptr = READ_ONCE(dev->rx_ptr); + new_ptr = dev->rx_fn(dev, substream->runtime, ptr, + &period_elapsed); + cmpxchg(&dev->rx_ptr, ptr, new_ptr); + } if (period_elapsed) - snd_pcm_period_elapsed(tx_substream); + snd_pcm_period_elapsed(substream); } rcu_read_unlock(); } + +void dw_pcm_push_tx(struct dw_i2s_dev *dev) +{ + dw_pcm_transfer(dev, true); +} EXPORT_SYMBOL_GPL(dw_pcm_push_tx); +void dw_pcm_pop_rx(struct dw_i2s_dev *dev) +{ + dw_pcm_transfer(dev, false); +} +EXPORT_SYMBOL_GPL(dw_pcm_pop_rx); + static int dw_pcm_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; @@ -126,20 +173,17 @@ static int dw_pcm_hw_params(struct snd_pcm_substream *substream, switch (params_format(hw_params)) { case SNDRV_PCM_FORMAT_S16_LE: dev->tx_fn = dw_pcm_tx_16; + dev->rx_fn = dw_pcm_rx_16; break; case SNDRV_PCM_FORMAT_S32_LE: dev->tx_fn = dw_pcm_tx_32; + dev->rx_fn = dw_pcm_rx_32; break; default: dev_err(dev->dev, "invalid format\n"); return -EINVAL; } - if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) { - dev_err(dev->dev, "only playback is available\n"); - return -EINVAL; - } - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); if (ret < 0) @@ -163,13 +207,21 @@ static int dw_pcm_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - WRITE_ONCE(dev->tx_ptr, 0); - rcu_assign_pointer(dev->tx_substream, substream); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + WRITE_ONCE(dev->tx_ptr, 0); + rcu_assign_pointer(dev->tx_substream, substream); + } else { + WRITE_ONCE(dev->rx_ptr, 0); + rcu_assign_pointer(dev->rx_substream, substream); + } break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - rcu_assign_pointer(dev->tx_substream, NULL); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + rcu_assign_pointer(dev->tx_substream, NULL); + else + rcu_assign_pointer(dev->rx_substream, NULL); break; default: ret = -EINVAL; @@ -183,7 +235,12 @@ static snd_pcm_uframes_t dw_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct dw_i2s_dev *dev = runtime->private_data; - snd_pcm_uframes_t pos = READ_ONCE(dev->tx_ptr); + snd_pcm_uframes_t pos; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + pos = READ_ONCE(dev->tx_ptr); + else + pos = READ_ONCE(dev->rx_ptr); return pos < runtime->buffer_size ? pos : 0; } diff --git a/sound/soc/dwc/local.h b/sound/soc/dwc/local.h index 68afd7577343..91dc70a826f8 100644 --- a/sound/soc/dwc/local.h +++ b/sound/soc/dwc/local.h @@ -105,20 +105,27 @@ struct dw_i2s_dev { struct i2s_clk_config_data config; int (*i2s_clk_cfg)(struct i2s_clk_config_data *config); - /* data related to PIO transfers (TX) */ + /* data related to PIO transfers */ bool use_pio; struct snd_pcm_substream __rcu *tx_substream; + struct snd_pcm_substream __rcu *rx_substream; unsigned int (*tx_fn)(struct dw_i2s_dev *dev, struct snd_pcm_runtime *runtime, unsigned int tx_ptr, bool *period_elapsed); + unsigned int (*rx_fn)(struct dw_i2s_dev *dev, + struct snd_pcm_runtime *runtime, unsigned int rx_ptr, + bool *period_elapsed); unsigned int tx_ptr; + unsigned int rx_ptr; }; #if IS_ENABLED(CONFIG_SND_DESIGNWARE_PCM) void dw_pcm_push_tx(struct dw_i2s_dev *dev); +void dw_pcm_pop_rx(struct dw_i2s_dev *dev); int dw_pcm_register(struct platform_device *pdev); #else void dw_pcm_push_tx(struct dw_i2s_dev *dev) { } +void dw_pcm_pop_rx(struct dw_i2s_dev *dev) { } int dw_pcm_register(struct platform_device *pdev) { return -EINVAL; -- cgit v1.2.3 From e21ab17904ff5c56bd6d6d062824ca584a42d89f Mon Sep 17 00:00:00 2001 From: Jose Abreu Date: Tue, 27 Dec 2016 14:00:54 +0000 Subject: ASoC: dwc: Enable 24 bit sample size in PIO mode Sample size of 24 bits use in reality 32 bits for storage. We can safelly enable this sample size and treat the data as 32 bits. Tested in a x86_64 platform and in ARC AXS101 SDP platform. Signed-off-by: Jose Abreu Signed-off-by: Mark Brown --- sound/soc/dwc/designware_pcm.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound/soc') diff --git a/sound/soc/dwc/designware_pcm.c b/sound/soc/dwc/designware_pcm.c index b063c8601569..459ec861e6b6 100644 --- a/sound/soc/dwc/designware_pcm.c +++ b/sound/soc/dwc/designware_pcm.c @@ -80,6 +80,7 @@ static const struct snd_pcm_hardware dw_pcm_hardware = { .rate_min = 32000, .rate_max = 48000, .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE, .channels_min = 2, .channels_max = 2, @@ -175,6 +176,7 @@ static int dw_pcm_hw_params(struct snd_pcm_substream *substream, dev->tx_fn = dw_pcm_tx_16; dev->rx_fn = dw_pcm_rx_16; break; + case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S32_LE: dev->tx_fn = dw_pcm_tx_32; dev->rx_fn = dw_pcm_rx_32; -- cgit v1.2.3 From d61b23daf0c6b5e0615b3b900c333d7dbd07816f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 10 Jan 2017 19:41:39 +0100 Subject: ASoC: mpc5200_psc_ac97: Remove unused DAI ID defines The DAI ID defines are back from the time when DAIs were referenced by a numerical ID. These days a string is used instead and the defines are unused. The last user of these defines was removed in commit f0fba2ad1b6b ("ASoC: multi-component - ASoC Multi-Component Support"). So remove the defines as well. This also means the mpc5200_psc_ac97.h file no longer has any content and can be removed. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/fsl/efika-audio-fabric.c | 1 - sound/soc/fsl/mpc5200_psc_ac97.c | 1 - sound/soc/fsl/mpc5200_psc_ac97.h | 13 ------------- 3 files changed, 15 deletions(-) delete mode 100644 sound/soc/fsl/mpc5200_psc_ac97.h (limited to 'sound/soc') diff --git a/sound/soc/fsl/efika-audio-fabric.c b/sound/soc/fsl/efika-audio-fabric.c index f200d1cfc4bd..667f4215dfc0 100644 --- a/sound/soc/fsl/efika-audio-fabric.c +++ b/sound/soc/fsl/efika-audio-fabric.c @@ -26,7 +26,6 @@ #include #include "mpc5200_dma.h" -#include "mpc5200_psc_ac97.h" #define DRV_NAME "efika-audio-fabric" diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index 243700cc29e6..07ee355ee385 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c @@ -25,7 +25,6 @@ #include #include "mpc5200_dma.h" -#include "mpc5200_psc_ac97.h" #define DRV_NAME "mpc5200-psc-ac97" diff --git a/sound/soc/fsl/mpc5200_psc_ac97.h b/sound/soc/fsl/mpc5200_psc_ac97.h deleted file mode 100644 index e881e784b270..000000000000 --- a/sound/soc/fsl/mpc5200_psc_ac97.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Freescale MPC5200 PSC in AC97 mode - * ALSA SoC Digital Audio Interface (DAI) driver - * - */ - -#ifndef __SOUND_SOC_FSL_MPC52xx_PSC_AC97_H__ -#define __SOUND_SOC_FSL_MPC52xx_PSC_AC97_H__ - -#define MPC5200_AC97_NORMAL 0 -#define MPC5200_AC97_SPDIF 1 - -#endif /* __SOUND_SOC_FSL_MPC52xx_PSC_AC97_H__ */ -- cgit v1.2.3 From 5f166156dbd4c0cf85632799ee7330d24deeec4e Mon Sep 17 00:00:00 2001 From: Romain Perier Date: Mon, 23 Jan 2017 11:41:46 +0100 Subject: ASoC: es8328-i2c: Add compatible for ES8388 This commit adds a compatible string for everest,es8388. This is an audio codec that is compatible with es8328. Signed-off-by: Romain Perier Signed-off-by: Mark Brown --- sound/soc/codecs/es8328-i2c.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound/soc') diff --git a/sound/soc/codecs/es8328-i2c.c b/sound/soc/codecs/es8328-i2c.c index 2d05b5d3a6ce..318ab28c5351 100644 --- a/sound/soc/codecs/es8328-i2c.c +++ b/sound/soc/codecs/es8328-i2c.c @@ -20,12 +20,14 @@ static const struct i2c_device_id es8328_id[] = { { "es8328", 0 }, + { "es8388", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, es8328_id); static const struct of_device_id es8328_of_match[] = { { .compatible = "everest,es8328", }, + { .compatible = "everest,es8388", }, { } }; MODULE_DEVICE_TABLE(of, es8328_of_match); -- cgit v1.2.3 From 2bc644af610f28d05812f224636a95a57c2631d1 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 27 Jan 2017 06:36:50 +0000 Subject: ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_routing Because prototype of OF-graph sound card support didn't have Sound Card node, commit 7364c8dc255232db33bcd1c5b19eb8f34cf6108a ("ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_routing") adjusted to it on each functions. But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound card has node. Thus, this commit became no longer needed. This reverts commit 7364c8dc255232db33bcd1c5b19eb8f34cf6108a. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index f1901bb1466e..e30984fd649b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3690,17 +3690,14 @@ void snd_soc_of_parse_audio_prefix_from_node(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_prefix_from_node); -int snd_soc_of_parse_audio_routing_from_node(struct snd_soc_card *card, - struct device_node *np, +int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, const char *propname) { + struct device_node *np = card->dev->of_node; int num_routes; struct snd_soc_dapm_route *routes; int i, ret; - if (!np) - np = card->dev->of_node; - num_routes = of_property_count_strings(np, propname); if (num_routes < 0 || num_routes & 1) { dev_err(card->dev, @@ -3747,7 +3744,7 @@ int snd_soc_of_parse_audio_routing_from_node(struct snd_soc_card *card, return 0; } -EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing_from_node); +EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing); unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, -- cgit v1.2.3 From 21efde50ca9cba9230d1b1ea54aadbf6d96c4157 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 27 Jan 2017 06:37:34 +0000 Subject: ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_simple_widgets Because prototype of OF-graph sound card support didn't have Sound Card node, commit 1ef5bcd57be5c8b31286b7b47828064be25f266b ("ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_simple_widgets") adjusted to it on each functions. But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound card has node. Thus, this commit became no longer needed. This reverts commit 1ef5bcd57be5c8b31286b7b47828064be25f266b. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e30984fd649b..656a981f6eb1 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3530,17 +3530,14 @@ static const struct snd_soc_dapm_widget simple_widgets[] = { SND_SOC_DAPM_SPK("Speaker", NULL), }; -int snd_soc_of_parse_audio_simple_widgets_from_node(struct snd_soc_card *card, - struct device_node *np, +int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, const char *propname) { + struct device_node *np = card->dev->of_node; struct snd_soc_dapm_widget *widgets; const char *template, *wname; int i, j, num_widgets, ret; - if (!np) - np = card->dev->of_node; - num_widgets = of_property_count_strings(np, propname); if (num_widgets < 0) { dev_err(card->dev, @@ -3611,7 +3608,7 @@ int snd_soc_of_parse_audio_simple_widgets_from_node(struct snd_soc_card *card, return 0; } -EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_simple_widgets_from_node); +EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_simple_widgets); static int snd_soc_of_get_slot_mask(struct device_node *np, const char *prop_name, -- cgit v1.2.3 From 440a3006f154a3aca4badf72841c61ac93a72110 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 27 Jan 2017 06:37:16 +0000 Subject: ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_prefix Because prototype of OF-graph sound card support didn't have Sound Card node, commit b6defcca0a604129155ae472b116a2e1688d8995 ("ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_prefix") adjusted to it on each functions. But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound card has node. Thus, this commit became no longer needed. This reverts commit b6defcca0a604129155ae472b116a2e1688d8995. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 656a981f6eb1..4ff2448f6023 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3664,18 +3664,15 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np, } EXPORT_SYMBOL_GPL(snd_soc_of_parse_tdm_slot); -void snd_soc_of_parse_audio_prefix_from_node(struct snd_soc_card *card, - struct device_node *np, +void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card, struct snd_soc_codec_conf *codec_conf, struct device_node *of_node, const char *propname) { + struct device_node *np = card->dev->of_node; const char *str; int ret; - if (!np) - np = card->dev->of_node; - ret = of_property_read_string(np, propname, &str); if (ret < 0) { /* no prefix is not error */ @@ -3685,7 +3682,7 @@ void snd_soc_of_parse_audio_prefix_from_node(struct snd_soc_card *card, codec_conf->of_node = of_node; codec_conf->name_prefix = str; } -EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_prefix_from_node); +EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_prefix); int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, const char *propname) -- cgit v1.2.3 From b07609cecaac6681a2fca3eebc1bae7b00282620 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 27 Jan 2017 06:37:51 +0000 Subject: ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_card_name Because prototype of OF-graph sound card support didn't have Sound Card node, commit 8f5ebb1bee15b5720741a98414767bb86f6c2b23 ("ASoC: soc-core: adjust for graph on snd_soc_of_parse_card_name") adjusted to it on each functions. But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound card has node. Thus, this commit became no longer needed. This reverts commit 8f5ebb1bee15b5720741a98414767bb86f6c2b23. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4ff2448f6023..ebaebc7c9699 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3492,10 +3492,10 @@ found: EXPORT_SYMBOL_GPL(snd_soc_unregister_codec); /* Retrieve a card's name from device tree */ -int snd_soc_of_parse_card_name_from_node(struct snd_soc_card *card, - struct device_node *np, - const char *propname) +int snd_soc_of_parse_card_name(struct snd_soc_card *card, + const char *propname) { + struct device_node *np; int ret; if (!card->dev) { @@ -3503,8 +3503,7 @@ int snd_soc_of_parse_card_name_from_node(struct snd_soc_card *card, return -EINVAL; } - if (!np) - np = card->dev->of_node; + np = card->dev->of_node; ret = of_property_read_string_index(np, propname, 0, &card->name); /* @@ -3521,7 +3520,7 @@ int snd_soc_of_parse_card_name_from_node(struct snd_soc_card *card, return 0; } -EXPORT_SYMBOL_GPL(snd_soc_of_parse_card_name_from_node); +EXPORT_SYMBOL_GPL(snd_soc_of_parse_card_name); static const struct snd_soc_dapm_widget simple_widgets[] = { SND_SOC_DAPM_MIC("Microphone", NULL), -- cgit v1.2.3 From b9b044e2967dd47f0ffe98b5a989fc99c684f6d2 Mon Sep 17 00:00:00 2001 From: Romain Perier Date: Fri, 3 Feb 2017 15:37:57 +0100 Subject: ASoC: es8328: Add support for slave mode Currently, the function that changes the DAI format only supports master mode. Trying to use a slave mode exits the function with -EINVAL and leave the codec misconfigured. This commits adds support for enabling the slave mode. Signed-off-by: Romain Perier Signed-off-by: Mark Brown --- sound/soc/codecs/es8328.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c index 37722194b107..3f84fbd071e2 100644 --- a/sound/soc/codecs/es8328.c +++ b/sound/soc/codecs/es8328.c @@ -589,9 +589,21 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai, u8 dac_mode = 0; u8 adc_mode = 0; - /* set master/slave audio interface */ - if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBM_CFM) + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBM_CFM: + /* Master serial port mode, with BCLK generated automatically */ + snd_soc_update_bits(codec, ES8328_MASTERMODE, + ES8328_MASTERMODE_MSC, + ES8328_MASTERMODE_MSC); + break; + case SND_SOC_DAIFMT_CBS_CFS: + /* Slave serial port mode */ + snd_soc_update_bits(codec, ES8328_MASTERMODE, + ES8328_MASTERMODE_MSC, 0); + break; + default: return -EINVAL; + } /* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { @@ -620,10 +632,6 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai, snd_soc_update_bits(codec, ES8328_ADCCONTROL4, ES8328_ADCCONTROL4_ADCFORMAT_MASK, adc_mode); - /* Master serial port mode, with BCLK generated automatically */ - snd_soc_update_bits(codec, ES8328_MASTERMODE, - ES8328_MASTERMODE_MSC, ES8328_MASTERMODE_MSC); - return 0; } -- cgit v1.2.3 From aa00f2c8aff7b85f882b6fd1706fc4241046aba7 Mon Sep 17 00:00:00 2001 From: Romain Perier Date: Fri, 3 Feb 2017 15:37:58 +0100 Subject: ASoC: Allow to select ES8328_I2C and ES8328_SPI directly Currently, we have to select these symbols explictly via Kconfig, from another entry. If we plan to use generic audio drivers like simple-audio-card, the user need to be able to enable these symbols directly via the menuconfig. This commit also fixes unmet dependencies to SND_SOC_IMX_ES8328 caused by these changes. Signed-off-by: Romain Perier Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 8 ++++---- sound/soc/fsl/Kconfig | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 9e1718a8cb1c..cfa423338963 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -528,12 +528,12 @@ config SND_SOC_ES8328 tristate "Everest Semi ES8328 CODEC" config SND_SOC_ES8328_I2C - tristate - select SND_SOC_ES8328 + depends on SND_SOC_ES8328 + tristate "I2C support for Everest Semi ES8328 CODEC" config SND_SOC_ES8328_SPI - tristate - select SND_SOC_ES8328 + depends on SND_SOC_ES8328 + tristate "SPI support for Everest Semi ES8328 CODEC" config SND_SOC_GTM601 tristate 'GTM601 UMTS modem audio codec' diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 37f9b6201918..0b914a1ca8d2 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig @@ -244,7 +244,7 @@ config SND_SOC_IMX_WM8962 config SND_SOC_IMX_ES8328 tristate "SoC Audio support for i.MX boards with the ES8328 codec" - depends on OF && (I2C || SPI) + depends on OF && (I2C || SPI) && SND_SOC_ES8328 select SND_SOC_ES8328_I2C if I2C select SND_SOC_ES8328_SPI if SPI_MASTER select SND_SOC_IMX_PCM_DMA -- cgit v1.2.3 From 245c5c7b0863eda23e8cb1907e74579a42185888 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 6 Feb 2017 13:27:11 +0100 Subject: ASoC: fix ES8328_I2C/SPI dependencies The two front-ends to the codec can now be selected individually, but fail to build when the bus support is missing: sound/built-in.o: In function `es8328_spi_probe': es8328-spi.c:(.text+0x125854): undefined reference to `__devm_regmap_init_spi' sound/built-in.o: In function `es8328_spi_driver_init': es8328-spi.c:(.init.text+0x3589): undefined reference to `__spi_register_driver' Related to this, the added dependency on SND_SOC_ES8328 breaks: warning: (SND_SOC_ALL_CODECS) selects SND_SOC_ES8328_I2C which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_ES8328 && I2C) This adds the respective Kconfig dependencies and changes SND_SOC_ES8328 to a hidden symbol that is selected implicitly by the two more specific options, as we do for some other codecs. We have to remove the 'depends on' for SND_SOC_IMX_ES8328 in the same step to avoid a recursive dependency. Fixes: aa00f2c8aff7 ("ASoC: Allow to select ES8328_I2C and ES8328_SPI directly") Signed-off-by: Arnd Bergmann Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 12 +++++++----- sound/soc/fsl/Kconfig | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index cfa423338963..0426e5c53829 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -525,15 +525,17 @@ config SND_SOC_HDMI_CODEC select HDMI config SND_SOC_ES8328 - tristate "Everest Semi ES8328 CODEC" + tristate config SND_SOC_ES8328_I2C - depends on SND_SOC_ES8328 - tristate "I2C support for Everest Semi ES8328 CODEC" + tristate "Everest Semi ES8328 CODEC (I2C)" + depends on I2C + select SND_SOC_ES8328 config SND_SOC_ES8328_SPI - depends on SND_SOC_ES8328 - tristate "SPI support for Everest Semi ES8328 CODEC" + tristate "Everest Semi ES8328 CODEC (SPI)" + depends on SPI_MASTER + select SND_SOC_ES8328 config SND_SOC_GTM601 tristate 'GTM601 UMTS modem audio codec' diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 0b914a1ca8d2..37f9b6201918 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig @@ -244,7 +244,7 @@ config SND_SOC_IMX_WM8962 config SND_SOC_IMX_ES8328 tristate "SoC Audio support for i.MX boards with the ES8328 codec" - depends on OF && (I2C || SPI) && SND_SOC_ES8328 + depends on OF && (I2C || SPI) select SND_SOC_ES8328_I2C if I2C select SND_SOC_ES8328_SPI if SPI_MASTER select SND_SOC_IMX_PCM_DMA -- cgit v1.2.3 From 4957b556f5e7ef9855d698b7ae2f0d4245c7ff50 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Fri, 10 Feb 2017 19:42:43 +0100 Subject: ASoC: fsl_sai: support more than 2 channels The FSL SAI can support up to 32 channels using TDM. Report that value so they can actually be used. Tested using 8 channels. Signed-off-by: Alexandre Belloni Acked-by: Nicolin Chen Signed-off-by: Mark Brown --- sound/soc/fsl/fsl_sai.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 9fadf7e31c5f..18e5ce81527d 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -668,7 +668,7 @@ static struct snd_soc_dai_driver fsl_sai_dai = { .playback = { .stream_name = "CPU-Playback", .channels_min = 1, - .channels_max = 2, + .channels_max = 32, .rate_min = 8000, .rate_max = 192000, .rates = SNDRV_PCM_RATE_KNOT, @@ -677,7 +677,7 @@ static struct snd_soc_dai_driver fsl_sai_dai = { .capture = { .stream_name = "CPU-Capture", .channels_min = 1, - .channels_max = 2, + .channels_max = 32, .rate_min = 8000, .rate_max = 192000, .rates = SNDRV_PCM_RATE_KNOT, -- cgit v1.2.3