* (no subject) @ 2008-11-18 8:18 Bryan Wu 2008-11-18 8:18 ` [PATCH 1/8] ASoC: Blackfin: updates Kconfig for SPORT Bryan Wu ` (8 more replies) 0 siblings, 9 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: alsa-devel, linux-kernel ^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 1/8] ASoC: Blackfin: updates Kconfig for SPORT 2008-11-18 8:18 Bryan Wu @ 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` Bryan Wu ` (7 subsequent siblings) 8 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: alsa-devel, linux-kernel, Mike Frysinger, Bryan Wu From: Mike Frysinger <vapier.adi@gmail.com> tweak SPORT range for non-BF54x so we get proper behavior for BF52x parts Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index dc00620..3fce187 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig @@ -80,7 +80,7 @@ config SND_BF5XX_SPORT_NUM int "Set a SPORT for Sound chip" depends on (SND_BF5XX_I2S || SND_BF5XX_AC97) range 0 3 if BF54x - range 0 1 if (BF53x || BF561) + range 0 1 if !BF54x default 0 help Set the correct SPORT for sound chip. -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 2/8] ASoC: AD1980 codec: add multi-channel function support 2008-11-18 8:18 Bryan Wu @ 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` Bryan Wu ` (7 subsequent siblings) 8 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: alsa-devel, linux-kernel, Cliff Cai, Bryan Wu From: Cliff Cai <cliff.cai@analog.com> We added multi-channel function to this codec driver and Blackfin ASoC driver as well. It was tested on Blackfin hardware. Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/codecs/ad1980.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 1397b8e..410fed9 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c @@ -85,6 +85,9 @@ SOC_DOUBLE("Line HP Swap Switch", AC97_AD_MISC, 10, 5, 1, 0), SOC_DOUBLE("Surround Playback Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1), SOC_DOUBLE("Surround Playback Switch", AC97_SURROUND_MASTER, 15, 7, 1, 1), +SOC_DOUBLE("Center/LFE Playback Volume", AC97_CENTER_LFE_MASTER, 8, 0, 31, 1), +SOC_DOUBLE("Center/LFE Playback Switch", AC97_CENTER_LFE_MASTER, 15, 7, 1, 1), + SOC_ENUM("Capture Source", ad1980_cap_src), SOC_SINGLE("Mic Boost Switch", AC97_MIC, 6, 1, 0), @@ -145,7 +148,7 @@ struct snd_soc_dai ad1980_dai = { .playback = { .stream_name = "Playback", .channels_min = 2, - .channels_max = 2, + .channels_max = 6, .rates = SNDRV_PCM_RATE_48000, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { @@ -192,6 +195,7 @@ static int ad1980_soc_probe(struct platform_device *pdev) struct snd_soc_codec *codec; int ret = 0; u16 vendor_id2; + u16 ext_status; printk(KERN_INFO "AD1980 SoC Audio Codec\n"); @@ -253,9 +257,16 @@ static int ad1980_soc_probe(struct platform_device *pdev) "supported\n"); } - ac97_write(codec, AC97_MASTER, 0x0000); /* unmute line out volume */ - ac97_write(codec, AC97_PCM, 0x0000); /* unmute PCM out volume */ - ac97_write(codec, AC97_REC_GAIN, 0x0000);/* unmute record volume */ + /* unmute captures and playbacks volume */ + ac97_write(codec, AC97_MASTER, 0x0000); + ac97_write(codec, AC97_PCM, 0x0000); + ac97_write(codec, AC97_REC_GAIN, 0x0000); + ac97_write(codec, AC97_CENTER_LFE_MASTER, 0x0000); + ac97_write(codec, AC97_SURROUND_MASTER, 0x0000); + + /*power on LFE/CENTER/Surround DACs*/ + ext_status = ac97_read(codec, AC97_EXTENDED_STATUS); + ac97_write(codec, AC97_EXTENDED_STATUS, ext_status&~0x3800); ad1980_add_controls(codec); ret = snd_soc_register_card(socdev); -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 2/8] ASoC: AD1980 codec: add multi-channel function support @ 2008-11-18 8:18 ` Bryan Wu 0 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: Cliff Cai, alsa-devel, linux-kernel, Bryan Wu From: Cliff Cai <cliff.cai@analog.com> We added multi-channel function to this codec driver and Blackfin ASoC driver as well. It was tested on Blackfin hardware. Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/codecs/ad1980.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 1397b8e..410fed9 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c @@ -85,6 +85,9 @@ SOC_DOUBLE("Line HP Swap Switch", AC97_AD_MISC, 10, 5, 1, 0), SOC_DOUBLE("Surround Playback Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1), SOC_DOUBLE("Surround Playback Switch", AC97_SURROUND_MASTER, 15, 7, 1, 1), +SOC_DOUBLE("Center/LFE Playback Volume", AC97_CENTER_LFE_MASTER, 8, 0, 31, 1), +SOC_DOUBLE("Center/LFE Playback Switch", AC97_CENTER_LFE_MASTER, 15, 7, 1, 1), + SOC_ENUM("Capture Source", ad1980_cap_src), SOC_SINGLE("Mic Boost Switch", AC97_MIC, 6, 1, 0), @@ -145,7 +148,7 @@ struct snd_soc_dai ad1980_dai = { .playback = { .stream_name = "Playback", .channels_min = 2, - .channels_max = 2, + .channels_max = 6, .rates = SNDRV_PCM_RATE_48000, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { @@ -192,6 +195,7 @@ static int ad1980_soc_probe(struct platform_device *pdev) struct snd_soc_codec *codec; int ret = 0; u16 vendor_id2; + u16 ext_status; printk(KERN_INFO "AD1980 SoC Audio Codec\n"); @@ -253,9 +257,16 @@ static int ad1980_soc_probe(struct platform_device *pdev) "supported\n"); } - ac97_write(codec, AC97_MASTER, 0x0000); /* unmute line out volume */ - ac97_write(codec, AC97_PCM, 0x0000); /* unmute PCM out volume */ - ac97_write(codec, AC97_REC_GAIN, 0x0000);/* unmute record volume */ + /* unmute captures and playbacks volume */ + ac97_write(codec, AC97_MASTER, 0x0000); + ac97_write(codec, AC97_PCM, 0x0000); + ac97_write(codec, AC97_REC_GAIN, 0x0000); + ac97_write(codec, AC97_CENTER_LFE_MASTER, 0x0000); + ac97_write(codec, AC97_SURROUND_MASTER, 0x0000); + + /*power on LFE/CENTER/Surround DACs*/ + ext_status = ac97_read(codec, AC97_EXTENDED_STATUS); + ac97_write(codec, AC97_EXTENDED_STATUS, ext_status&~0x3800); ad1980_add_controls(codec); ret = snd_soc_register_card(socdev); -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 3/8] ASoC: Blackfin: add multi-channel function support 2008-11-18 8:18 Bryan Wu @ 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` Bryan Wu ` (7 subsequent siblings) 8 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: alsa-devel, linux-kernel, Cliff Cai, Bryan Wu From: Cliff Cai <cliff.cai@analog.com> This patch provides a option for users to enable multi-channel function support in Blackfin ASoC driver. Because Blackfin is without MMU, it is easy for us and the user to enable this function at compiling stage not dynamically on the fly. Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/Kconfig | 14 +++- sound/soc/blackfin/bf5xx-ac97-pcm.c | 80 +++++++++++------- sound/soc/blackfin/bf5xx-ac97.c | 156 +++++++++++++++++++++-------------- sound/soc/blackfin/bf5xx-ac97.h | 35 +++++++- sound/soc/blackfin/bf5xx-sport.h | 2 +- 5 files changed, 184 insertions(+), 103 deletions(-) diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index 3fce187..43d89fc 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig @@ -47,7 +47,7 @@ config SND_BF5XX_AC97 properly with this driver. This driver is known to work with the Analog Devices line of AC97 codecs. -config SND_MMAP_SUPPORT +config SND_BF5XX_MMAP_SUPPORT bool "Enable MMAP Support" depends on SND_BF5XX_AC97 default y @@ -55,9 +55,17 @@ config SND_MMAP_SUPPORT Say y if you want AC97 driver to support mmap mode. We introduce an intermediate buffer to simulate mmap. +config SND_BF5XX_MULTICHAN_SUPPORT + bool "Enable Multichannel Support" + depends on SND_BF5XX_AC97 + default n + help + Say y if you want AC97 driver to support up to 5.1 channel audio. + this mode will consume much more memory for DMA. + config SND_BF5XX_SOC_SPORT tristate - + config SND_BF5XX_SOC_I2S tristate select SND_BF5XX_SOC_SPORT @@ -90,7 +98,7 @@ config SND_BF5XX_HAVE_COLD_RESET depends on SND_BF5XX_AC97 default y if BFIN548_EZKIT default n if !BFIN548_EZKIT - + config SND_BF5XX_RESET_GPIO_NUM int "Set a GPIO for cold reset" depends on SND_BF5XX_HAVE_COLD_RESET diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 25e50d2..4be1a49 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -43,24 +43,34 @@ #include "bf5xx-ac97.h" #include "bf5xx-sport.h" -#if defined(CONFIG_SND_MMAP_SUPPORT) +static unsigned int ac97_chan_mask[] = { + SP_FL, /* Mono */ + SP_STEREO, /* Stereo */ + SP_2DOT1, /* 2.1*/ + SP_QUAD,/*Quadraquic*/ + SP_FL | SP_FR | SP_FC | SP_SL | SP_SR,/*5 channels */ + SP_5DOT1, /* 5.1 */ +}; + +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static void bf5xx_mmap_copy(struct snd_pcm_substream *substream, snd_pcm_uframes_t count) { struct snd_pcm_runtime *runtime = substream->runtime; struct sport_device *sport = runtime->private_data; + unsigned int chan_mask = ac97_chan_mask[runtime->channels - 1]; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - bf5xx_pcm_to_ac97( - (struct ac97_frame *)sport->tx_dma_buf + sport->tx_pos, - (__u32 *)runtime->dma_area + sport->tx_pos, count); + bf5xx_pcm_to_ac97((struct ac97_frame *)sport->tx_dma_buf + + sport->tx_pos, (__u16 *)runtime->dma_area + sport->tx_pos * + runtime->channels, count, chan_mask); sport->tx_pos += runtime->period_size; if (sport->tx_pos >= runtime->buffer_size) sport->tx_pos %= runtime->buffer_size; sport->tx_delay_pos = sport->tx_pos; } else { - bf5xx_ac97_to_pcm( - (struct ac97_frame *)sport->rx_dma_buf + sport->rx_pos, - (__u32 *)runtime->dma_area + sport->rx_pos, count); + bf5xx_ac97_to_pcm((struct ac97_frame *)sport->rx_dma_buf + + sport->rx_pos, (__u16 *)runtime->dma_area + sport->rx_pos * + runtime->channels, count); sport->rx_pos += runtime->period_size; if (sport->rx_pos >= runtime->buffer_size) sport->rx_pos %= runtime->buffer_size; @@ -71,7 +81,7 @@ static void bf5xx_mmap_copy(struct snd_pcm_substream *substream, static void bf5xx_dma_irq(void *data) { struct snd_pcm_substream *pcm = data; -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) struct snd_pcm_runtime *runtime = pcm->runtime; struct sport_device *sport = runtime->private_data; bf5xx_mmap_copy(pcm, runtime->period_size); @@ -90,7 +100,7 @@ static void bf5xx_dma_irq(void *data) * The total rx/tx buffer is for ac97 frame to hold all pcm data * is 0x20000 * sizeof(struct ac97_frame) / 4. */ -#ifdef CONFIG_SND_MMAP_SUPPORT +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static const struct snd_pcm_hardware bf5xx_pcm_hardware = { .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP | @@ -123,10 +133,20 @@ static int bf5xx_pcm_hw_params(struct snd_pcm_substream *substream, static int bf5xx_pcm_hw_free(struct snd_pcm_substream *substream) { +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) struct snd_pcm_runtime *runtime = substream->runtime; + struct sport_device *sport = runtime->private_data; - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - memset(runtime->dma_area, 0, runtime->buffer_size); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + sport->once = 0; + if (runtime->dma_area) + memset(runtime->dma_area, 0, runtime->buffer_size); + memset(sport->tx_dma_buf, 0, runtime->buffer_size * + sizeof(struct ac97_frame)); + } else + memset(sport->rx_dma_buf, 0, runtime->buffer_size * + sizeof(struct ac97_frame)); +#endif snd_pcm_lib_free_pages(substream); return 0; } @@ -139,7 +159,7 @@ static int bf5xx_pcm_prepare(struct snd_pcm_substream *substream) /* An intermediate buffer is introduced for implementing mmap for * SPORT working in TMD mode(include AC97). */ -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { sport_set_tx_callback(sport, bf5xx_dma_irq, substream); sport_config_tx_dma(sport, sport->tx_dma_buf, runtime->periods, @@ -174,23 +194,21 @@ static int bf5xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_START: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { bf5xx_mmap_copy(substream, runtime->period_size); - snd_pcm_period_elapsed(substream); sport->tx_delay_pos = 0; sport_tx_start(sport); - } - else + } else sport_rx_start(sport); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) sport->tx_pos = 0; #endif sport_tx_stop(sport); } else { -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) sport->rx_pos = 0; #endif sport_rx_stop(sport); @@ -208,7 +226,7 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) struct sport_device *sport = runtime->private_data; unsigned int curr; -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) curr = sport->tx_delay_pos; else @@ -257,14 +275,16 @@ static int bf5xx_pcm_close(struct snd_pcm_substream *substream) pr_debug("%s enter\n", __func__); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { sport->once = 0; - memset(sport->tx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame)); + memset(sport->tx_dma_buf, 0, runtime->buffer_size * + sizeof(struct ac97_frame)); } else - memset(sport->rx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame)); + memset(sport->rx_dma_buf, 0, runtime->buffer_size * + sizeof(struct ac97_frame)); return 0; } -#ifdef CONFIG_SND_MMAP_SUPPORT +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static int bf5xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) { @@ -286,13 +306,11 @@ static int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel, substream->stream ? "Capture" : "Playback", pos, count); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - bf5xx_pcm_to_ac97( - (struct ac97_frame *)runtime->dma_area + pos, - buf, count); + bf5xx_pcm_to_ac97((struct ac97_frame *)runtime->dma_area + pos, + (__u16 *)buf, count, chan_mask); else - bf5xx_ac97_to_pcm( - (struct ac97_frame *)runtime->dma_area + pos, - buf, count); + bf5xx_ac97_to_pcm((struct ac97_frame *)runtime->dma_area + pos, + (__u16 *)buf, count); return 0; } #endif @@ -306,7 +324,7 @@ struct snd_pcm_ops bf5xx_pcm_ac97_ops = { .prepare = bf5xx_pcm_prepare, .trigger = bf5xx_pcm_trigger, .pointer = bf5xx_pcm_pointer, -#ifdef CONFIG_SND_MMAP_SUPPORT +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) .mmap = bf5xx_pcm_mmap, #else .copy = bf5xx_pcm_copy, @@ -344,7 +362,7 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) * Need to allocate local buffer when enable * MMAP for SPORT working in TMD mode (include AC97). */ -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (!sport_handle->tx_dma_buf) { sport_handle->tx_dma_buf = dma_alloc_coherent(NULL, \ @@ -381,7 +399,7 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) struct snd_pcm_substream *substream; struct snd_dma_buffer *buf; int stream; -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) size_t size = bf5xx_pcm_hardware.buffer_bytes_max * sizeof(struct ac97_frame) / 4; #endif @@ -395,7 +413,7 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) continue; dma_free_coherent(NULL, buf->bytes, buf->area, 0); buf->area = NULL; -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (sport_handle->tx_dma_buf) dma_free_coherent(NULL, size, \ diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index 5e5aafb..65c162c 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c @@ -54,71 +54,103 @@ static int *cmd_count; static int sport_num = CONFIG_SND_BF5XX_SPORT_NUM; -#if defined(CONFIG_BF54x) +static u16 sport_req[][7] = { + PIN_REQ_SPORT_0, +#ifdef PIN_REQ_SPORT_1 + PIN_REQ_SPORT_1, +#endif +#ifdef PIN_REQ_SPORT_2 + PIN_REQ_SPORT_2, +#endif +#ifdef PIN_REQ_SPORT_3 + PIN_REQ_SPORT_3, +#endif + }; + static struct sport_param sport_params[4] = { { .dma_rx_chan = CH_SPORT0_RX, .dma_tx_chan = CH_SPORT0_TX, - .err_irq = IRQ_SPORT0_ERR, + .err_irq = IRQ_SPORT0_ERROR, .regs = (struct sport_register *)SPORT0_TCR1, }, +#ifdef PIN_REQ_SPORT_1 { .dma_rx_chan = CH_SPORT1_RX, .dma_tx_chan = CH_SPORT1_TX, - .err_irq = IRQ_SPORT1_ERR, + .err_irq = IRQ_SPORT1_ERROR, .regs = (struct sport_register *)SPORT1_TCR1, }, +#endif +#ifdef PIN_REQ_SPORT_2 { .dma_rx_chan = CH_SPORT2_RX, .dma_tx_chan = CH_SPORT2_TX, - .err_irq = IRQ_SPORT2_ERR, + .err_irq = IRQ_SPORT2_ERROR, .regs = (struct sport_register *)SPORT2_TCR1, }, +#endif +#ifdef PIN_REQ_SPORT_3 { .dma_rx_chan = CH_SPORT3_RX, .dma_tx_chan = CH_SPORT3_TX, - .err_irq = IRQ_SPORT3_ERR, + .err_irq = IRQ_SPORT3_ERROR, .regs = (struct sport_register *)SPORT3_TCR1, } -}; -#else -static struct sport_param sport_params[2] = { - { - .dma_rx_chan = CH_SPORT0_RX, - .dma_tx_chan = CH_SPORT0_TX, - .err_irq = IRQ_SPORT0_ERROR, - .regs = (struct sport_register *)SPORT0_TCR1, - }, - { - .dma_rx_chan = CH_SPORT1_RX, - .dma_tx_chan = CH_SPORT1_TX, - .err_irq = IRQ_SPORT1_ERROR, - .regs = (struct sport_register *)SPORT1_TCR1, - } -}; #endif +}; -void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u32 *src, \ - size_t count) +void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, + size_t count, unsigned int chan_mask) { while (count--) { - dst->ac97_tag = TAG_VALID | TAG_PCM; - (dst++)->ac97_pcm = *src++; + dst->ac97_tag = TAG_VALID; + if (chan_mask & SP_FL) { + dst->ac97_pcm_r = *src++; + dst->ac97_tag |= TAG_PCM_RIGHT; + } + if (chan_mask & SP_FR) { + dst->ac97_pcm_l = *src++; + dst->ac97_tag |= TAG_PCM_LEFT; + + } +#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) + if (chan_mask & SP_SR) { + dst->ac97_sl = *src++; + dst->ac97_tag |= TAG_PCM_SL; + } + if (chan_mask & SP_SL) { + dst->ac97_sr = *src++; + dst->ac97_tag |= TAG_PCM_SR; + } + if (chan_mask & SP_LFE) { + dst->ac97_lfe = *src++; + dst->ac97_tag |= TAG_PCM_LFE; + } + if (chan_mask & SP_FC) { + dst->ac97_center = *src++; + dst->ac97_tag |= TAG_PCM_CENTER; + } +#endif + dst++; } } EXPORT_SYMBOL(bf5xx_pcm_to_ac97); -void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u32 *dst, \ +void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u16 *dst, size_t count) { - while (count--) - *(dst++) = (src++)->ac97_pcm; + while (count--) { + *(dst++) = src->ac97_pcm_l; + *(dst++) = src->ac97_pcm_r; + src++; + } } EXPORT_SYMBOL(bf5xx_ac97_to_pcm); static unsigned int sport_tx_curr_frag(struct sport_device *sport) { - return sport->tx_curr_frag = sport_curr_offset_tx(sport) / \ + return sport->tx_curr_frag = sport_curr_offset_tx(sport) / sport->tx_fragsize; } @@ -130,7 +162,7 @@ static void enqueue_cmd(struct snd_ac97 *ac97, __u16 addr, __u16 data) sport_incfrag(sport, &nextfrag, 1); - nextwrite = (struct ac97_frame *)(sport->tx_buf + \ + nextwrite = (struct ac97_frame *)(sport->tx_buf + nextfrag * sport->tx_fragsize); pr_debug("sport->tx_buf:%p, nextfrag:0x%x nextwrite:%p, cmd_count:%d\n", sport->tx_buf, nextfrag, nextwrite, cmd_count[nextfrag]); @@ -297,20 +329,15 @@ static int bf5xx_ac97_resume(struct platform_device *pdev, static int bf5xx_ac97_probe(struct platform_device *pdev, struct snd_soc_dai *dai) { - int ret; -#if defined(CONFIG_BF54x) - u16 sport_req[][7] = {PIN_REQ_SPORT_0, PIN_REQ_SPORT_1, - PIN_REQ_SPORT_2, PIN_REQ_SPORT_3}; -#else - u16 sport_req[][7] = {PIN_REQ_SPORT_0, PIN_REQ_SPORT_1}; -#endif + int ret = 0; cmd_count = (int *)get_zeroed_page(GFP_KERNEL); if (cmd_count == NULL) return -ENOMEM; if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) { pr_err("Requesting Peripherals failed\n"); - return -EFAULT; + ret = -EFAULT; + goto peripheral_err; } #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET @@ -318,54 +345,52 @@ static int bf5xx_ac97_probe(struct platform_device *pdev, if (gpio_request(CONFIG_SND_BF5XX_RESET_GPIO_NUM, "SND_AD198x RESET")) { pr_err("Failed to request GPIO_%d for reset\n", CONFIG_SND_BF5XX_RESET_GPIO_NUM); - peripheral_free_list(&sport_req[sport_num][0]); - return -1; + ret = -1; + goto gpio_err; } gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1); #endif sport_handle = sport_init(&sport_params[sport_num], 2, \ sizeof(struct ac97_frame), NULL); if (!sport_handle) { - peripheral_free_list(&sport_req[sport_num][0]); -#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET - gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); -#endif - return -ENODEV; + ret = -ENODEV; + goto sport_err; } /*SPORT works in TDM mode to simulate AC97 transfers*/ ret = sport_set_multichannel(sport_handle, 16, 0x1F, 1); if (ret) { pr_err("SPORT is busy!\n"); - kfree(sport_handle); - peripheral_free_list(&sport_req[sport_num][0]); -#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET - gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); -#endif - return -EBUSY; + ret = -EBUSY; + goto sport_config_err; } ret = sport_config_rx(sport_handle, IRFS, 0xF, 0, (16*16-1)); if (ret) { pr_err("SPORT is busy!\n"); - kfree(sport_handle); - peripheral_free_list(&sport_req[sport_num][0]); -#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET - gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); -#endif - return -EBUSY; + ret = -EBUSY; + goto sport_config_err; } ret = sport_config_tx(sport_handle, ITFS, 0xF, 0, (16*16-1)); if (ret) { pr_err("SPORT is busy!\n"); - kfree(sport_handle); - peripheral_free_list(&sport_req[sport_num][0]); + ret = -EBUSY; + goto sport_config_err; + } + +sport_config_err: + kfree(sport_handle); +sport_err: #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET - gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); + gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); #endif - return -EBUSY; - } - return 0; +gpio_err: + peripheral_free_list(&sport_req[sport_num][0]); +peripheral_err: + free_page((unsigned long)cmd_count); + cmd_count = NULL; + + return ret; } static void bf5xx_ac97_remove(struct platform_device *pdev, @@ -373,6 +398,7 @@ static void bf5xx_ac97_remove(struct platform_device *pdev, { free_page((unsigned long)cmd_count); cmd_count = NULL; + peripheral_free_list(&sport_req[sport_num][0]); #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); #endif @@ -389,7 +415,11 @@ struct snd_soc_dai bfin_ac97_dai = { .playback = { .stream_name = "AC97 Playback", .channels_min = 2, +#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) + .channels_max = 6, +#else .channels_max = 2, +#endif .rates = SNDRV_PCM_RATE_48000, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { diff --git a/sound/soc/blackfin/bf5xx-ac97.h b/sound/soc/blackfin/bf5xx-ac97.h index 3f77cc5..3f2a911 100644 --- a/sound/soc/blackfin/bf5xx-ac97.h +++ b/sound/soc/blackfin/bf5xx-ac97.h @@ -16,21 +16,46 @@ struct ac97_frame { u16 ac97_tag; /* slot 0 */ u16 ac97_addr; /* slot 1 */ u16 ac97_data; /* slot 2 */ - u32 ac97_pcm; /* slot 3 and 4: left and right pcm data */ + u16 ac97_pcm_l; /*slot 3:front left*/ + u16 ac97_pcm_r; /*slot 4:front left*/ +#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) + u16 ac97_mdm_l1; + u16 ac97_center; /*slot 6:center*/ + u16 ac97_sl; /*slot 7:surround left*/ + u16 ac97_sr; /*slot 8:surround right*/ + u16 ac97_lfe; /*slot 9:lfe*/ +#endif } __attribute__ ((packed)); +/* Speaker location */ +#define SP_FL 0x0001 +#define SP_FR 0x0010 +#define SP_FC 0x0002 +#define SP_LFE 0x0020 +#define SP_SL 0x0004 +#define SP_SR 0x0040 + +#define SP_STEREO (SP_FL | SP_FR) +#define SP_2DOT1 (SP_FL | SP_FR | SP_LFE) +#define SP_QUAD (SP_FL | SP_FR | SP_SL | SP_SR) +#define SP_5DOT1 (SP_FL | SP_FR | SP_FC | SP_LFE | SP_SL | SP_SR) + #define TAG_VALID 0x8000 #define TAG_CMD 0x6000 #define TAG_PCM_LEFT 0x1000 #define TAG_PCM_RIGHT 0x0800 -#define TAG_PCM (TAG_PCM_LEFT | TAG_PCM_RIGHT) +#define TAG_PCM_MDM_L1 0x0400 +#define TAG_PCM_CENTER 0x0200 +#define TAG_PCM_SL 0x0100 +#define TAG_PCM_SR 0x0080 +#define TAG_PCM_LFE 0x0040 extern struct snd_soc_dai bfin_ac97_dai; -void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u32 *src, \ - size_t count); +void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, \ + size_t count, unsigned int chan_mask); -void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u32 *dst, \ +void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u16 *dst, \ size_t count); #endif diff --git a/sound/soc/blackfin/bf5xx-sport.h b/sound/soc/blackfin/bf5xx-sport.h index fcadcc0..2e63dea 100644 --- a/sound/soc/blackfin/bf5xx-sport.h +++ b/sound/soc/blackfin/bf5xx-sport.h @@ -116,7 +116,7 @@ struct sport_device { void *err_data; unsigned char *tx_dma_buf; unsigned char *rx_dma_buf; -#ifdef CONFIG_SND_MMAP_SUPPORT +#ifdef CONFIG_SND_BF5XX_MMAP_SUPPORT dma_addr_t tx_dma_phy; dma_addr_t rx_dma_phy; int tx_pos;/*pcm sample count*/ -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 3/8] ASoC: Blackfin: add multi-channel function support @ 2008-11-18 8:18 ` Bryan Wu 0 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: Cliff Cai, alsa-devel, linux-kernel, Bryan Wu From: Cliff Cai <cliff.cai@analog.com> This patch provides a option for users to enable multi-channel function support in Blackfin ASoC driver. Because Blackfin is without MMU, it is easy for us and the user to enable this function at compiling stage not dynamically on the fly. Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/Kconfig | 14 +++- sound/soc/blackfin/bf5xx-ac97-pcm.c | 80 +++++++++++------- sound/soc/blackfin/bf5xx-ac97.c | 156 +++++++++++++++++++++-------------- sound/soc/blackfin/bf5xx-ac97.h | 35 +++++++- sound/soc/blackfin/bf5xx-sport.h | 2 +- 5 files changed, 184 insertions(+), 103 deletions(-) diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index 3fce187..43d89fc 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig @@ -47,7 +47,7 @@ config SND_BF5XX_AC97 properly with this driver. This driver is known to work with the Analog Devices line of AC97 codecs. -config SND_MMAP_SUPPORT +config SND_BF5XX_MMAP_SUPPORT bool "Enable MMAP Support" depends on SND_BF5XX_AC97 default y @@ -55,9 +55,17 @@ config SND_MMAP_SUPPORT Say y if you want AC97 driver to support mmap mode. We introduce an intermediate buffer to simulate mmap. +config SND_BF5XX_MULTICHAN_SUPPORT + bool "Enable Multichannel Support" + depends on SND_BF5XX_AC97 + default n + help + Say y if you want AC97 driver to support up to 5.1 channel audio. + this mode will consume much more memory for DMA. + config SND_BF5XX_SOC_SPORT tristate - + config SND_BF5XX_SOC_I2S tristate select SND_BF5XX_SOC_SPORT @@ -90,7 +98,7 @@ config SND_BF5XX_HAVE_COLD_RESET depends on SND_BF5XX_AC97 default y if BFIN548_EZKIT default n if !BFIN548_EZKIT - + config SND_BF5XX_RESET_GPIO_NUM int "Set a GPIO for cold reset" depends on SND_BF5XX_HAVE_COLD_RESET diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 25e50d2..4be1a49 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -43,24 +43,34 @@ #include "bf5xx-ac97.h" #include "bf5xx-sport.h" -#if defined(CONFIG_SND_MMAP_SUPPORT) +static unsigned int ac97_chan_mask[] = { + SP_FL, /* Mono */ + SP_STEREO, /* Stereo */ + SP_2DOT1, /* 2.1*/ + SP_QUAD,/*Quadraquic*/ + SP_FL | SP_FR | SP_FC | SP_SL | SP_SR,/*5 channels */ + SP_5DOT1, /* 5.1 */ +}; + +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static void bf5xx_mmap_copy(struct snd_pcm_substream *substream, snd_pcm_uframes_t count) { struct snd_pcm_runtime *runtime = substream->runtime; struct sport_device *sport = runtime->private_data; + unsigned int chan_mask = ac97_chan_mask[runtime->channels - 1]; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - bf5xx_pcm_to_ac97( - (struct ac97_frame *)sport->tx_dma_buf + sport->tx_pos, - (__u32 *)runtime->dma_area + sport->tx_pos, count); + bf5xx_pcm_to_ac97((struct ac97_frame *)sport->tx_dma_buf + + sport->tx_pos, (__u16 *)runtime->dma_area + sport->tx_pos * + runtime->channels, count, chan_mask); sport->tx_pos += runtime->period_size; if (sport->tx_pos >= runtime->buffer_size) sport->tx_pos %= runtime->buffer_size; sport->tx_delay_pos = sport->tx_pos; } else { - bf5xx_ac97_to_pcm( - (struct ac97_frame *)sport->rx_dma_buf + sport->rx_pos, - (__u32 *)runtime->dma_area + sport->rx_pos, count); + bf5xx_ac97_to_pcm((struct ac97_frame *)sport->rx_dma_buf + + sport->rx_pos, (__u16 *)runtime->dma_area + sport->rx_pos * + runtime->channels, count); sport->rx_pos += runtime->period_size; if (sport->rx_pos >= runtime->buffer_size) sport->rx_pos %= runtime->buffer_size; @@ -71,7 +81,7 @@ static void bf5xx_mmap_copy(struct snd_pcm_substream *substream, static void bf5xx_dma_irq(void *data) { struct snd_pcm_substream *pcm = data; -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) struct snd_pcm_runtime *runtime = pcm->runtime; struct sport_device *sport = runtime->private_data; bf5xx_mmap_copy(pcm, runtime->period_size); @@ -90,7 +100,7 @@ static void bf5xx_dma_irq(void *data) * The total rx/tx buffer is for ac97 frame to hold all pcm data * is 0x20000 * sizeof(struct ac97_frame) / 4. */ -#ifdef CONFIG_SND_MMAP_SUPPORT +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static const struct snd_pcm_hardware bf5xx_pcm_hardware = { .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP | @@ -123,10 +133,20 @@ static int bf5xx_pcm_hw_params(struct snd_pcm_substream *substream, static int bf5xx_pcm_hw_free(struct snd_pcm_substream *substream) { +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) struct snd_pcm_runtime *runtime = substream->runtime; + struct sport_device *sport = runtime->private_data; - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - memset(runtime->dma_area, 0, runtime->buffer_size); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + sport->once = 0; + if (runtime->dma_area) + memset(runtime->dma_area, 0, runtime->buffer_size); + memset(sport->tx_dma_buf, 0, runtime->buffer_size * + sizeof(struct ac97_frame)); + } else + memset(sport->rx_dma_buf, 0, runtime->buffer_size * + sizeof(struct ac97_frame)); +#endif snd_pcm_lib_free_pages(substream); return 0; } @@ -139,7 +159,7 @@ static int bf5xx_pcm_prepare(struct snd_pcm_substream *substream) /* An intermediate buffer is introduced for implementing mmap for * SPORT working in TMD mode(include AC97). */ -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { sport_set_tx_callback(sport, bf5xx_dma_irq, substream); sport_config_tx_dma(sport, sport->tx_dma_buf, runtime->periods, @@ -174,23 +194,21 @@ static int bf5xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_START: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { bf5xx_mmap_copy(substream, runtime->period_size); - snd_pcm_period_elapsed(substream); sport->tx_delay_pos = 0; sport_tx_start(sport); - } - else + } else sport_rx_start(sport); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) sport->tx_pos = 0; #endif sport_tx_stop(sport); } else { -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) sport->rx_pos = 0; #endif sport_rx_stop(sport); @@ -208,7 +226,7 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) struct sport_device *sport = runtime->private_data; unsigned int curr; -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) curr = sport->tx_delay_pos; else @@ -257,14 +275,16 @@ static int bf5xx_pcm_close(struct snd_pcm_substream *substream) pr_debug("%s enter\n", __func__); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { sport->once = 0; - memset(sport->tx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame)); + memset(sport->tx_dma_buf, 0, runtime->buffer_size * + sizeof(struct ac97_frame)); } else - memset(sport->rx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame)); + memset(sport->rx_dma_buf, 0, runtime->buffer_size * + sizeof(struct ac97_frame)); return 0; } -#ifdef CONFIG_SND_MMAP_SUPPORT +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static int bf5xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) { @@ -286,13 +306,11 @@ static int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel, substream->stream ? "Capture" : "Playback", pos, count); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - bf5xx_pcm_to_ac97( - (struct ac97_frame *)runtime->dma_area + pos, - buf, count); + bf5xx_pcm_to_ac97((struct ac97_frame *)runtime->dma_area + pos, + (__u16 *)buf, count, chan_mask); else - bf5xx_ac97_to_pcm( - (struct ac97_frame *)runtime->dma_area + pos, - buf, count); + bf5xx_ac97_to_pcm((struct ac97_frame *)runtime->dma_area + pos, + (__u16 *)buf, count); return 0; } #endif @@ -306,7 +324,7 @@ struct snd_pcm_ops bf5xx_pcm_ac97_ops = { .prepare = bf5xx_pcm_prepare, .trigger = bf5xx_pcm_trigger, .pointer = bf5xx_pcm_pointer, -#ifdef CONFIG_SND_MMAP_SUPPORT +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) .mmap = bf5xx_pcm_mmap, #else .copy = bf5xx_pcm_copy, @@ -344,7 +362,7 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) * Need to allocate local buffer when enable * MMAP for SPORT working in TMD mode (include AC97). */ -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (!sport_handle->tx_dma_buf) { sport_handle->tx_dma_buf = dma_alloc_coherent(NULL, \ @@ -381,7 +399,7 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) struct snd_pcm_substream *substream; struct snd_dma_buffer *buf; int stream; -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) size_t size = bf5xx_pcm_hardware.buffer_bytes_max * sizeof(struct ac97_frame) / 4; #endif @@ -395,7 +413,7 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) continue; dma_free_coherent(NULL, buf->bytes, buf->area, 0); buf->area = NULL; -#if defined(CONFIG_SND_MMAP_SUPPORT) +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (sport_handle->tx_dma_buf) dma_free_coherent(NULL, size, \ diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index 5e5aafb..65c162c 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c @@ -54,71 +54,103 @@ static int *cmd_count; static int sport_num = CONFIG_SND_BF5XX_SPORT_NUM; -#if defined(CONFIG_BF54x) +static u16 sport_req[][7] = { + PIN_REQ_SPORT_0, +#ifdef PIN_REQ_SPORT_1 + PIN_REQ_SPORT_1, +#endif +#ifdef PIN_REQ_SPORT_2 + PIN_REQ_SPORT_2, +#endif +#ifdef PIN_REQ_SPORT_3 + PIN_REQ_SPORT_3, +#endif + }; + static struct sport_param sport_params[4] = { { .dma_rx_chan = CH_SPORT0_RX, .dma_tx_chan = CH_SPORT0_TX, - .err_irq = IRQ_SPORT0_ERR, + .err_irq = IRQ_SPORT0_ERROR, .regs = (struct sport_register *)SPORT0_TCR1, }, +#ifdef PIN_REQ_SPORT_1 { .dma_rx_chan = CH_SPORT1_RX, .dma_tx_chan = CH_SPORT1_TX, - .err_irq = IRQ_SPORT1_ERR, + .err_irq = IRQ_SPORT1_ERROR, .regs = (struct sport_register *)SPORT1_TCR1, }, +#endif +#ifdef PIN_REQ_SPORT_2 { .dma_rx_chan = CH_SPORT2_RX, .dma_tx_chan = CH_SPORT2_TX, - .err_irq = IRQ_SPORT2_ERR, + .err_irq = IRQ_SPORT2_ERROR, .regs = (struct sport_register *)SPORT2_TCR1, }, +#endif +#ifdef PIN_REQ_SPORT_3 { .dma_rx_chan = CH_SPORT3_RX, .dma_tx_chan = CH_SPORT3_TX, - .err_irq = IRQ_SPORT3_ERR, + .err_irq = IRQ_SPORT3_ERROR, .regs = (struct sport_register *)SPORT3_TCR1, } -}; -#else -static struct sport_param sport_params[2] = { - { - .dma_rx_chan = CH_SPORT0_RX, - .dma_tx_chan = CH_SPORT0_TX, - .err_irq = IRQ_SPORT0_ERROR, - .regs = (struct sport_register *)SPORT0_TCR1, - }, - { - .dma_rx_chan = CH_SPORT1_RX, - .dma_tx_chan = CH_SPORT1_TX, - .err_irq = IRQ_SPORT1_ERROR, - .regs = (struct sport_register *)SPORT1_TCR1, - } -}; #endif +}; -void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u32 *src, \ - size_t count) +void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, + size_t count, unsigned int chan_mask) { while (count--) { - dst->ac97_tag = TAG_VALID | TAG_PCM; - (dst++)->ac97_pcm = *src++; + dst->ac97_tag = TAG_VALID; + if (chan_mask & SP_FL) { + dst->ac97_pcm_r = *src++; + dst->ac97_tag |= TAG_PCM_RIGHT; + } + if (chan_mask & SP_FR) { + dst->ac97_pcm_l = *src++; + dst->ac97_tag |= TAG_PCM_LEFT; + + } +#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) + if (chan_mask & SP_SR) { + dst->ac97_sl = *src++; + dst->ac97_tag |= TAG_PCM_SL; + } + if (chan_mask & SP_SL) { + dst->ac97_sr = *src++; + dst->ac97_tag |= TAG_PCM_SR; + } + if (chan_mask & SP_LFE) { + dst->ac97_lfe = *src++; + dst->ac97_tag |= TAG_PCM_LFE; + } + if (chan_mask & SP_FC) { + dst->ac97_center = *src++; + dst->ac97_tag |= TAG_PCM_CENTER; + } +#endif + dst++; } } EXPORT_SYMBOL(bf5xx_pcm_to_ac97); -void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u32 *dst, \ +void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u16 *dst, size_t count) { - while (count--) - *(dst++) = (src++)->ac97_pcm; + while (count--) { + *(dst++) = src->ac97_pcm_l; + *(dst++) = src->ac97_pcm_r; + src++; + } } EXPORT_SYMBOL(bf5xx_ac97_to_pcm); static unsigned int sport_tx_curr_frag(struct sport_device *sport) { - return sport->tx_curr_frag = sport_curr_offset_tx(sport) / \ + return sport->tx_curr_frag = sport_curr_offset_tx(sport) / sport->tx_fragsize; } @@ -130,7 +162,7 @@ static void enqueue_cmd(struct snd_ac97 *ac97, __u16 addr, __u16 data) sport_incfrag(sport, &nextfrag, 1); - nextwrite = (struct ac97_frame *)(sport->tx_buf + \ + nextwrite = (struct ac97_frame *)(sport->tx_buf + nextfrag * sport->tx_fragsize); pr_debug("sport->tx_buf:%p, nextfrag:0x%x nextwrite:%p, cmd_count:%d\n", sport->tx_buf, nextfrag, nextwrite, cmd_count[nextfrag]); @@ -297,20 +329,15 @@ static int bf5xx_ac97_resume(struct platform_device *pdev, static int bf5xx_ac97_probe(struct platform_device *pdev, struct snd_soc_dai *dai) { - int ret; -#if defined(CONFIG_BF54x) - u16 sport_req[][7] = {PIN_REQ_SPORT_0, PIN_REQ_SPORT_1, - PIN_REQ_SPORT_2, PIN_REQ_SPORT_3}; -#else - u16 sport_req[][7] = {PIN_REQ_SPORT_0, PIN_REQ_SPORT_1}; -#endif + int ret = 0; cmd_count = (int *)get_zeroed_page(GFP_KERNEL); if (cmd_count == NULL) return -ENOMEM; if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) { pr_err("Requesting Peripherals failed\n"); - return -EFAULT; + ret = -EFAULT; + goto peripheral_err; } #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET @@ -318,54 +345,52 @@ static int bf5xx_ac97_probe(struct platform_device *pdev, if (gpio_request(CONFIG_SND_BF5XX_RESET_GPIO_NUM, "SND_AD198x RESET")) { pr_err("Failed to request GPIO_%d for reset\n", CONFIG_SND_BF5XX_RESET_GPIO_NUM); - peripheral_free_list(&sport_req[sport_num][0]); - return -1; + ret = -1; + goto gpio_err; } gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1); #endif sport_handle = sport_init(&sport_params[sport_num], 2, \ sizeof(struct ac97_frame), NULL); if (!sport_handle) { - peripheral_free_list(&sport_req[sport_num][0]); -#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET - gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); -#endif - return -ENODEV; + ret = -ENODEV; + goto sport_err; } /*SPORT works in TDM mode to simulate AC97 transfers*/ ret = sport_set_multichannel(sport_handle, 16, 0x1F, 1); if (ret) { pr_err("SPORT is busy!\n"); - kfree(sport_handle); - peripheral_free_list(&sport_req[sport_num][0]); -#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET - gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); -#endif - return -EBUSY; + ret = -EBUSY; + goto sport_config_err; } ret = sport_config_rx(sport_handle, IRFS, 0xF, 0, (16*16-1)); if (ret) { pr_err("SPORT is busy!\n"); - kfree(sport_handle); - peripheral_free_list(&sport_req[sport_num][0]); -#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET - gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); -#endif - return -EBUSY; + ret = -EBUSY; + goto sport_config_err; } ret = sport_config_tx(sport_handle, ITFS, 0xF, 0, (16*16-1)); if (ret) { pr_err("SPORT is busy!\n"); - kfree(sport_handle); - peripheral_free_list(&sport_req[sport_num][0]); + ret = -EBUSY; + goto sport_config_err; + } + +sport_config_err: + kfree(sport_handle); +sport_err: #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET - gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); + gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); #endif - return -EBUSY; - } - return 0; +gpio_err: + peripheral_free_list(&sport_req[sport_num][0]); +peripheral_err: + free_page((unsigned long)cmd_count); + cmd_count = NULL; + + return ret; } static void bf5xx_ac97_remove(struct platform_device *pdev, @@ -373,6 +398,7 @@ static void bf5xx_ac97_remove(struct platform_device *pdev, { free_page((unsigned long)cmd_count); cmd_count = NULL; + peripheral_free_list(&sport_req[sport_num][0]); #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); #endif @@ -389,7 +415,11 @@ struct snd_soc_dai bfin_ac97_dai = { .playback = { .stream_name = "AC97 Playback", .channels_min = 2, +#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) + .channels_max = 6, +#else .channels_max = 2, +#endif .rates = SNDRV_PCM_RATE_48000, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { diff --git a/sound/soc/blackfin/bf5xx-ac97.h b/sound/soc/blackfin/bf5xx-ac97.h index 3f77cc5..3f2a911 100644 --- a/sound/soc/blackfin/bf5xx-ac97.h +++ b/sound/soc/blackfin/bf5xx-ac97.h @@ -16,21 +16,46 @@ struct ac97_frame { u16 ac97_tag; /* slot 0 */ u16 ac97_addr; /* slot 1 */ u16 ac97_data; /* slot 2 */ - u32 ac97_pcm; /* slot 3 and 4: left and right pcm data */ + u16 ac97_pcm_l; /*slot 3:front left*/ + u16 ac97_pcm_r; /*slot 4:front left*/ +#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) + u16 ac97_mdm_l1; + u16 ac97_center; /*slot 6:center*/ + u16 ac97_sl; /*slot 7:surround left*/ + u16 ac97_sr; /*slot 8:surround right*/ + u16 ac97_lfe; /*slot 9:lfe*/ +#endif } __attribute__ ((packed)); +/* Speaker location */ +#define SP_FL 0x0001 +#define SP_FR 0x0010 +#define SP_FC 0x0002 +#define SP_LFE 0x0020 +#define SP_SL 0x0004 +#define SP_SR 0x0040 + +#define SP_STEREO (SP_FL | SP_FR) +#define SP_2DOT1 (SP_FL | SP_FR | SP_LFE) +#define SP_QUAD (SP_FL | SP_FR | SP_SL | SP_SR) +#define SP_5DOT1 (SP_FL | SP_FR | SP_FC | SP_LFE | SP_SL | SP_SR) + #define TAG_VALID 0x8000 #define TAG_CMD 0x6000 #define TAG_PCM_LEFT 0x1000 #define TAG_PCM_RIGHT 0x0800 -#define TAG_PCM (TAG_PCM_LEFT | TAG_PCM_RIGHT) +#define TAG_PCM_MDM_L1 0x0400 +#define TAG_PCM_CENTER 0x0200 +#define TAG_PCM_SL 0x0100 +#define TAG_PCM_SR 0x0080 +#define TAG_PCM_LFE 0x0040 extern struct snd_soc_dai bfin_ac97_dai; -void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u32 *src, \ - size_t count); +void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, \ + size_t count, unsigned int chan_mask); -void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u32 *dst, \ +void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u16 *dst, \ size_t count); #endif diff --git a/sound/soc/blackfin/bf5xx-sport.h b/sound/soc/blackfin/bf5xx-sport.h index fcadcc0..2e63dea 100644 --- a/sound/soc/blackfin/bf5xx-sport.h +++ b/sound/soc/blackfin/bf5xx-sport.h @@ -116,7 +116,7 @@ struct sport_device { void *err_data; unsigned char *tx_dma_buf; unsigned char *rx_dma_buf; -#ifdef CONFIG_SND_MMAP_SUPPORT +#ifdef CONFIG_SND_BF5XX_MMAP_SUPPORT dma_addr_t tx_dma_phy; dma_addr_t rx_dma_phy; int tx_pos;/*pcm sample count*/ -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 4/8] ASoC: Blackfin: fix bug - AD1980/1 SOC Audio driver fails to build in case MMAP support is turned off 2008-11-18 8:18 Bryan Wu @ 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` Bryan Wu ` (7 subsequent siblings) 8 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: alsa-devel, linux-kernel, Cliff Cai, Bryan Wu From: Cliff Cai <cliff.cai@analog.com> clean up redudent code and correct building problem in non-mmap mode Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/bf5xx-ac97-pcm.c | 22 +++------------------- 1 files changed, 3 insertions(+), 19 deletions(-) diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 4be1a49..4d25f73 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -193,8 +193,10 @@ static int bf5xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) switch (cmd) { case SNDRV_PCM_TRIGGER_START: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) bf5xx_mmap_copy(substream, runtime->period_size); sport->tx_delay_pos = 0; +#endif sport_tx_start(sport); } else sport_rx_start(sport); @@ -267,23 +269,6 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream) return ret; } -static int bf5xx_pcm_close(struct snd_pcm_substream *substream) -{ - struct snd_pcm_runtime *runtime = substream->runtime; - struct sport_device *sport = runtime->private_data; - - pr_debug("%s enter\n", __func__); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - sport->once = 0; - memset(sport->tx_dma_buf, 0, runtime->buffer_size * - sizeof(struct ac97_frame)); - } else - memset(sport->rx_dma_buf, 0, runtime->buffer_size * - sizeof(struct ac97_frame)); - - return 0; -} - #if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static int bf5xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) @@ -301,7 +286,7 @@ static int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel, void __user *buf, snd_pcm_uframes_t count) { struct snd_pcm_runtime *runtime = substream->runtime; - + unsigned int chan_mask = ac97_chan_mask[runtime->channels - 1]; pr_debug("%s copy pos:0x%lx count:0x%lx\n", substream->stream ? "Capture" : "Playback", pos, count); @@ -317,7 +302,6 @@ static int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel, struct snd_pcm_ops bf5xx_pcm_ac97_ops = { .open = bf5xx_pcm_open, - .close = bf5xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = bf5xx_pcm_hw_params, .hw_free = bf5xx_pcm_hw_free, -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 4/8] ASoC: Blackfin: fix bug - AD1980/1 SOC Audio driver fails to build in case MMAP support is turned off @ 2008-11-18 8:18 ` Bryan Wu 0 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: Cliff Cai, alsa-devel, linux-kernel, Bryan Wu From: Cliff Cai <cliff.cai@analog.com> clean up redudent code and correct building problem in non-mmap mode Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/bf5xx-ac97-pcm.c | 22 +++------------------- 1 files changed, 3 insertions(+), 19 deletions(-) diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 4be1a49..4d25f73 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -193,8 +193,10 @@ static int bf5xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) switch (cmd) { case SNDRV_PCM_TRIGGER_START: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) bf5xx_mmap_copy(substream, runtime->period_size); sport->tx_delay_pos = 0; +#endif sport_tx_start(sport); } else sport_rx_start(sport); @@ -267,23 +269,6 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream) return ret; } -static int bf5xx_pcm_close(struct snd_pcm_substream *substream) -{ - struct snd_pcm_runtime *runtime = substream->runtime; - struct sport_device *sport = runtime->private_data; - - pr_debug("%s enter\n", __func__); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - sport->once = 0; - memset(sport->tx_dma_buf, 0, runtime->buffer_size * - sizeof(struct ac97_frame)); - } else - memset(sport->rx_dma_buf, 0, runtime->buffer_size * - sizeof(struct ac97_frame)); - - return 0; -} - #if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static int bf5xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) @@ -301,7 +286,7 @@ static int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel, void __user *buf, snd_pcm_uframes_t count) { struct snd_pcm_runtime *runtime = substream->runtime; - + unsigned int chan_mask = ac97_chan_mask[runtime->channels - 1]; pr_debug("%s copy pos:0x%lx count:0x%lx\n", substream->stream ? "Capture" : "Playback", pos, count); @@ -317,7 +302,6 @@ static int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel, struct snd_pcm_ops bf5xx_pcm_ac97_ops = { .open = bf5xx_pcm_open, - .close = bf5xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = bf5xx_pcm_hw_params, .hw_free = bf5xx_pcm_hw_free, -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [alsa-devel] [PATCH 4/8] ASoC: Blackfin: fix bug - AD1980/1 SOC Audio driver fails to build in case MMAP support is turned off 2008-11-18 8:18 ` Bryan Wu @ 2008-11-18 11:53 ` Mark Brown -1 siblings, 0 replies; 34+ messages in thread From: Mark Brown @ 2008-11-18 11:53 UTC (permalink / raw) To: Bryan Wu; +Cc: tiwai, Cliff Cai, alsa-devel, linux-kernel On Tue, Nov 18, 2008 at 04:18:18PM +0800, Bryan Wu wrote: > From: Cliff Cai <cliff.cai@analog.com> > > clean up redudent code and correct building problem in non-mmap mode This doesn't apply against 2.6.28 - does the same issue apply there? If so then a patch for 2.6.28 fixing *only* the build issue would probably be a good idea. Alos, please try to ensure that the short log for your patch is less than 80 characters (it should normally be much less). ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 4/8] ASoC: Blackfin: fix bug - AD1980/1 SOC Audio driver fails to build in case MMAP support is turned off @ 2008-11-18 11:53 ` Mark Brown 0 siblings, 0 replies; 34+ messages in thread From: Mark Brown @ 2008-11-18 11:53 UTC (permalink / raw) To: Bryan Wu; +Cc: tiwai, Cliff Cai, alsa-devel, linux-kernel On Tue, Nov 18, 2008 at 04:18:18PM +0800, Bryan Wu wrote: > From: Cliff Cai <cliff.cai@analog.com> > > clean up redudent code and correct building problem in non-mmap mode This doesn't apply against 2.6.28 - does the same issue apply there? If so then a patch for 2.6.28 fixing *only* the build issue would probably be a good idea. Alos, please try to ensure that the short log for your patch is less than 80 characters (it should normally be much less). ^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI 2008-11-18 8:18 Bryan Wu @ 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` Bryan Wu ` (7 subsequent siblings) 8 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai Cc: alsa-devel, linux-kernel, Michael Hennerich, Cliff Cai, Bryan Wu From: Michael Hennerich <michael.hennerich@analog.com> sport_handle is a global and not allocated my kmalloc. A probe function should have a clean return 0 path. Cc: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/bf5xx-ac97.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index 65c162c..5dcd3f6 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c @@ -378,6 +378,8 @@ static int bf5xx_ac97_probe(struct platform_device *pdev, goto sport_config_err; } + return 0; + sport_config_err: kfree(sport_handle); sport_err: -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI @ 2008-11-18 8:18 ` Bryan Wu 0 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai Cc: Cliff Cai, alsa-devel, linux-kernel, Michael Hennerich, Bryan Wu From: Michael Hennerich <michael.hennerich@analog.com> sport_handle is a global and not allocated my kmalloc. A probe function should have a clean return 0 path. Cc: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/bf5xx-ac97.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index 65c162c..5dcd3f6 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c @@ -378,6 +378,8 @@ static int bf5xx_ac97_probe(struct platform_device *pdev, goto sport_config_err; } + return 0; + sport_config_err: kfree(sport_handle); sport_err: -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [alsa-devel] [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI 2008-11-18 8:18 ` Bryan Wu @ 2008-11-18 11:54 ` Mark Brown -1 siblings, 0 replies; 34+ messages in thread From: Mark Brown @ 2008-11-18 11:54 UTC (permalink / raw) To: Bryan Wu; +Cc: tiwai, Cliff Cai, alsa-devel, linux-kernel, Michael Hennerich On Tue, Nov 18, 2008 at 04:18:19PM +0800, Bryan Wu wrote: > From: Michael Hennerich <michael.hennerich@analog.com> > sport_handle is a global and not allocated my kmalloc. There's no reference to sport_handle in the patch... > A probe function should have a clean return 0 path. ...only this. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI @ 2008-11-18 11:54 ` Mark Brown 0 siblings, 0 replies; 34+ messages in thread From: Mark Brown @ 2008-11-18 11:54 UTC (permalink / raw) To: Bryan Wu; +Cc: tiwai, Cliff Cai, alsa-devel, Michael Hennerich, linux-kernel On Tue, Nov 18, 2008 at 04:18:19PM +0800, Bryan Wu wrote: > From: Michael Hennerich <michael.hennerich@analog.com> > sport_handle is a global and not allocated my kmalloc. There's no reference to sport_handle in the patch... > A probe function should have a clean return 0 path. ...only this. ^ permalink raw reply [flat|nested] 34+ messages in thread
* RE: [alsa-devel] [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI 2008-11-18 11:54 ` Mark Brown @ 2008-11-18 11:58 ` Hennerich, Michael -1 siblings, 0 replies; 34+ messages in thread From: Hennerich, Michael @ 2008-11-18 11:58 UTC (permalink / raw) To: Mark Brown, Bryan Wu Cc: tiwai, Cliff Cai, alsa-devel, linux-kernel, Michael Hennerich >> sport_handle is a global and not allocated my kmalloc. > >There's no reference to sport_handle in the patch... Sorry - spurious comment please ignore. -Michael >-----Original Message----- >From: Mark Brown [mailto:broonie@sirena.org.uk] >Sent: Tuesday, November 18, 2008 12:54 PM >To: Bryan Wu >Cc: tiwai@suse.de; Cliff Cai; alsa-devel@alsa-project.org; linux- >kernel@vger.kernel.org; Michael Hennerich >Subject: Re: [alsa-devel] [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI > >On Tue, Nov 18, 2008 at 04:18:19PM +0800, Bryan Wu wrote: >> From: Michael Hennerich <michael.hennerich@analog.com> > >> sport_handle is a global and not allocated my kmalloc. > >There's no reference to sport_handle in the patch... > >> A probe function should have a clean return 0 path. > >...only this. ^ permalink raw reply [flat|nested] 34+ messages in thread
* RE: [alsa-devel] [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI @ 2008-11-18 11:58 ` Hennerich, Michael 0 siblings, 0 replies; 34+ messages in thread From: Hennerich, Michael @ 2008-11-18 11:58 UTC (permalink / raw) To: Mark Brown, Bryan Wu Cc: tiwai, Cliff Cai, alsa-devel, linux-kernel, Michael Hennerich >> sport_handle is a global and not allocated my kmalloc. > >There's no reference to sport_handle in the patch... Sorry - spurious comment please ignore. -Michael >-----Original Message----- >From: Mark Brown [mailto:broonie@sirena.org.uk] >Sent: Tuesday, November 18, 2008 12:54 PM >To: Bryan Wu >Cc: tiwai@suse.de; Cliff Cai; alsa-devel@alsa-project.org; linux- >kernel@vger.kernel.org; Michael Hennerich >Subject: Re: [alsa-devel] [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI > >On Tue, Nov 18, 2008 at 04:18:19PM +0800, Bryan Wu wrote: >> From: Michael Hennerich <michael.hennerich@analog.com> > >> sport_handle is a global and not allocated my kmalloc. > >There's no reference to sport_handle in the patch... > >> A probe function should have a clean return 0 path. > >...only this. ^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 6/8] ASoC: Blackfin: do not force TWI bus for ssm2602 codec 2008-11-18 8:18 Bryan Wu @ 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` Bryan Wu ` (7 subsequent siblings) 8 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai Cc: alsa-devel, linux-kernel, Mike Frysinger, Cliff Cai, Bryan Wu From: Mike Frysinger <vapier.adi@gmail.com> Cc: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/Kconfig | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index 43d89fc..f0fd235 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig @@ -13,7 +13,6 @@ config SND_BF5XX_SOC_SSM2602 select SND_BF5XX_SOC_I2S select SND_SOC_SSM2602 select I2C - select I2C_BLACKFIN_TWI help Say Y if you want to add support for SoC audio on BF527-EZKIT. -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6/8] ASoC: Blackfin: do not force TWI bus for ssm2602 codec @ 2008-11-18 8:18 ` Bryan Wu 0 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai Cc: Cliff Cai, alsa-devel, linux-kernel, Mike Frysinger, Bryan Wu From: Mike Frysinger <vapier.adi@gmail.com> Cc: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/Kconfig | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index 43d89fc..f0fd235 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig @@ -13,7 +13,6 @@ config SND_BF5XX_SOC_SSM2602 select SND_BF5XX_SOC_I2S select SND_SOC_SSM2602 select I2C - select I2C_BLACKFIN_TWI help Say Y if you want to add support for SoC audio on BF527-EZKIT. -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 7/8] ASoC: Blackfin: Simplify the MMAP_SUPPORT macros protected code 2008-11-18 8:18 Bryan Wu @ 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` Bryan Wu ` (7 subsequent siblings) 8 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: alsa-devel, linux-kernel, Bryan Wu, Cliff Cai Cc: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/bf5xx-ac97-pcm.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 4d25f73..d3d51bc 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -100,17 +100,14 @@ static void bf5xx_dma_irq(void *data) * The total rx/tx buffer is for ac97 frame to hold all pcm data * is 0x20000 * sizeof(struct ac97_frame) / 4. */ -#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static const struct snd_pcm_hardware bf5xx_pcm_hardware = { .info = SNDRV_PCM_INFO_INTERLEAVED | +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_BLOCK_TRANSFER, -#else -static const struct snd_pcm_hardware bf5xx_pcm_hardware = { - .info = SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER, #endif + SNDRV_PCM_INFO_BLOCK_TRANSFER, + .formats = SNDRV_PCM_FMTBIT_S16_LE, .period_bytes_min = 32, .period_bytes_max = 0x10000, -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 7/8] ASoC: Blackfin: Simplify the MMAP_SUPPORT macros protected code @ 2008-11-18 8:18 ` Bryan Wu 0 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai; +Cc: Cliff Cai, alsa-devel, linux-kernel, Bryan Wu Cc: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/bf5xx-ac97-pcm.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 4d25f73..d3d51bc 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -100,17 +100,14 @@ static void bf5xx_dma_irq(void *data) * The total rx/tx buffer is for ac97 frame to hold all pcm data * is 0x20000 * sizeof(struct ac97_frame) / 4. */ -#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) static const struct snd_pcm_hardware bf5xx_pcm_hardware = { .info = SNDRV_PCM_INFO_INTERLEAVED | +#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_BLOCK_TRANSFER, -#else -static const struct snd_pcm_hardware bf5xx_pcm_hardware = { - .info = SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER, #endif + SNDRV_PCM_INFO_BLOCK_TRANSFER, + .formats = SNDRV_PCM_FMTBIT_S16_LE, .period_bytes_min = 32, .period_bytes_max = 0x10000, -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 8/8] ASoC: Blackfin: always set a default value for that GPIO range 2008-11-18 8:18 Bryan Wu @ 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` Bryan Wu ` (7 subsequent siblings) 8 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai Cc: alsa-devel, linux-kernel, Mike Frysinger, Cliff Cai, Bryan Wu From: Mike Frysinger <vapier.adi@gmail.com> Cc: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index f0fd235..e162cbb 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig @@ -104,5 +104,6 @@ config SND_BF5XX_RESET_GPIO_NUM range 0 159 default 19 if BFIN548_EZKIT default 5 if BFIN537_STAMP + default 0 help Set the correct GPIO for RESET the sound chip. -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 8/8] ASoC: Blackfin: always set a default value for that GPIO range @ 2008-11-18 8:18 ` Bryan Wu 0 siblings, 0 replies; 34+ messages in thread From: Bryan Wu @ 2008-11-18 8:18 UTC (permalink / raw) To: broonie, tiwai Cc: Cliff Cai, alsa-devel, linux-kernel, Mike Frysinger, Bryan Wu From: Mike Frysinger <vapier.adi@gmail.com> Cc: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> --- sound/soc/blackfin/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index f0fd235..e162cbb 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig @@ -104,5 +104,6 @@ config SND_BF5XX_RESET_GPIO_NUM range 0 159 default 19 if BFIN548_EZKIT default 5 if BFIN537_STAMP + default 0 help Set the correct GPIO for RESET the sound chip. -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [alsa-devel] (no subject) 2008-11-18 8:18 Bryan Wu @ 2008-11-18 11:45 ` Mark Brown 2008-11-18 8:18 ` Bryan Wu ` (7 subsequent siblings) 8 siblings, 0 replies; 34+ messages in thread From: Mark Brown @ 2008-11-18 11:45 UTC (permalink / raw) To: Bryan Wu; +Cc: tiwai, alsa-devel, linux-kernel On Tue, Nov 18, 2008 at 04:18:14PM +0800, Bryan Wu wrote: ...nothing. :) All patches look OK, a couple of comments to follow. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: (no subject) @ 2008-11-18 11:45 ` Mark Brown 0 siblings, 0 replies; 34+ messages in thread From: Mark Brown @ 2008-11-18 11:45 UTC (permalink / raw) To: Bryan Wu; +Cc: tiwai, alsa-devel, linux-kernel On Tue, Nov 18, 2008 at 04:18:14PM +0800, Bryan Wu wrote: ...nothing. :) All patches look OK, a couple of comments to follow. ^ permalink raw reply [flat|nested] 34+ messages in thread
* (unknown), @ 2011-04-25 6:54 Sangbeom Kim 2011-04-26 8:26 ` [alsa-devel] (no subject) Liam Girdwood 0 siblings, 1 reply; 34+ messages in thread From: Sangbeom Kim @ 2011-04-25 6:54 UTC (permalink / raw) To: alsa-devel, linux-samsung-soc; +Cc: jassisinghbrar, lrg, broonie, kgene.kim [PATCH 0/2] Add WM8994 PCM Machine driver for Exynos4 Hi, This is patchset for WM8994 pcm machine driver that supports PCM audio on SMDKV310, SMDKC210 and test is done. Based on these patches WM8994 pcm machine driver supports followings: o Playback supports 8kHz sampling rates. o Capture supports 8kHz sampling rates. This patchset contains followings o To Kukjin Kim and Ben Dooks, [PATCH 1/2] ARM: EXYNOS4: Add PCM audio support for WM8994 o To Jassi Brar, Mark Brown and Liam Girdwood, [PATCH 2/2] ASoC: SAMSUNG: Add WM8580 PCM Machine driver Best Regards, SB Kim (Sangbeom Kim) ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] (no subject) 2011-04-25 6:54 (unknown), Sangbeom Kim @ 2011-04-26 8:26 ` Liam Girdwood 0 siblings, 0 replies; 34+ messages in thread From: Liam Girdwood @ 2011-04-26 8:26 UTC (permalink / raw) To: Sangbeom Kim Cc: alsa-devel, linux-samsung-soc, kgene.kim, jassisinghbrar, broonie On Mon, 2011-04-25 at 15:54 +0900, Sangbeom Kim wrote: > [PATCH 0/2] Add WM8994 PCM Machine driver for Exynos4 > > Hi, > > This is patchset for WM8994 pcm machine driver that supports > PCM audio on SMDKV310, SMDKC210 and test is done. > > Based on these patches WM8994 pcm machine driver supports followings: > o Playback supports 8kHz sampling rates. > o Capture supports 8kHz sampling rates. > > This patchset contains followings > > o To Kukjin Kim and Ben Dooks, > [PATCH 1/2] ARM: EXYNOS4: Add PCM audio support for WM8994 > > o To Jassi Brar, Mark Brown and Liam Girdwood, > [PATCH 2/2] ASoC: SAMSUNG: Add WM8580 PCM Machine driver > > Best Regards, > SB Kim (Sangbeom Kim) > Both Acked-by: Liam Girdwood <lrg@ti.com> ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 17:06 Ben Dooks
2019-12-22 17:08 ` Dmitry Osipenko
0 siblings, 1 reply; 34+ messages in thread
From: Ben Dooks @ 2019-12-20 17:06 UTC (permalink / raw)
To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel,
Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
Thierry Reding
Cc: linux-kernel, Edward Cragg
On 20/12/2019 16:40, Dmitry Osipenko wrote:
> 20.12.2019 18:25, Ben Dooks пишет:
>> On 20/12/2019 15:02, Dmitry Osipenko wrote:
>>> 20.12.2019 17:56, Ben Dooks пишет:
>>>> On 20/12/2019 14:43, Dmitry Osipenko wrote:
>>>>> 20.12.2019 16:57, Jon Hunter пишет:
>>>>>>
>>>>>> On 20/12/2019 11:38, Ben Dooks wrote:
>>>>>>> On 20/12/2019 11:30, Jon Hunter wrote:
>>>>>>>>
>>>>>>>> On 25/11/2019 17:28, Dmitry Osipenko wrote:
>>>>>>>>> 25.11.2019 20:22, Dmitry Osipenko пишет:
>>>>>>>>>> 25.11.2019 13:37, Ben Dooks пишет:
>>>>>>>>>>> On 23/11/2019 21:09, Dmitry Osipenko wrote:
>>>>>>>>>>>> 18.10.2019 18:48, Ben Dooks пишет:
>>>>>>>>>>>>> From: Edward Cragg <edward.cragg@codethink.co.uk>
>>>>>>>>>>>>>
>>>>>>>>>>>>> The tegra3 audio can support 24 and 32 bit sample sizes so add
>>>>>>>>>>>>> the
>>>>>>>>>>>>> option to the tegra30_i2s_hw_params to configure the S24_LE or
>>>>>>>>>>>>> S32_LE
>>>>>>>>>>>>> formats when requested.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Signed-off-by: Edward Cragg <edward.cragg@codethink.co.uk>
>>>>>>>>>>>>> [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit]
>>>>>>>>>>>>> [ben.dooks@codethink.co.uk: add pm calls around ytdm config]
>>>>>>>>>>>>> [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg]
>>>>>>>>>>>>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>>>>>>>>>>>>> ---
>>>>>>>>>>>>> squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is
>>>>>>>>>>>>> needed
>>>>>>>>>>>>> in tdm code
>>>>>>>>>>>>>
>>>>>>>>>>>>> ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
>>>>>>>>>>>>> ---
>>>>>>>>>>>>> sound/soc/tegra/tegra30_i2s.c | 25
>>>>>>>>>>>>> ++++++++++++++++++++-----
>>>>>>>>>>>>> 1 file changed, 20 insertions(+), 5 deletions(-)
>>>>>>>>>>>>>
>>>>>>>>>>>>> diff --git a/sound/soc/tegra/tegra30_i2s.c
>>>>>>>>>>>>> b/sound/soc/tegra/tegra30_i2s.c
>>>>>>>>>>>>> index 73f0dddeaef3..063f34c882af 100644
>>>>>>>>>>>>> --- a/sound/soc/tegra/tegra30_i2s.c
>>>>>>>>>>>>> +++ b/sound/soc/tegra/tegra30_i2s.c
>>>>>>>>>>>>> @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct
>>>>>>>>>>>>> snd_pcm_substream *substream,
>>>>>>>>>>>>> struct device *dev = dai->dev;
>>>>>>>>>>>>> struct tegra30_i2s *i2s =
>>>>>>>>>>>>> snd_soc_dai_get_drvdata(dai);
>>>>>>>>>>>>> unsigned int mask, val, reg;
>>>>>>>>>>>>> - int ret, sample_size, srate, i2sclock, bitcnt;
>>>>>>>>>>>>> + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits;
>>>>>>>>>>>>> struct tegra30_ahub_cif_conf cif_conf;
>>>>>>>>>>>>> if (params_channels(params) != 2)
>>>>>>>>>>>>> @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct
>>>>>>>>>>>>> snd_pcm_substream *substream,
>>>>>>>>>>>>> switch (params_format(params)) {
>>>>>>>>>>>>> case SNDRV_PCM_FORMAT_S16_LE:
>>>>>>>>>>>>> val = TEGRA30_I2S_CTRL_BIT_SIZE_16;
>>>>>>>>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_16;
>>>>>>>>>>>>> sample_size = 16;
>>>>>>>>>>>>> break;
>>>>>>>>>>>>> + case SNDRV_PCM_FORMAT_S24_LE:
>>>>>>>>>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_24;
>>>>>>>>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_24;
>>>>>>>>>>>>> + sample_size = 24;
>>>>>>>>>>>>> + break;
>>>>>>>>>>>>> + case SNDRV_PCM_FORMAT_S32_LE:
>>>>>>>>>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_32;
>>>>>>>>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_32;
>>>>>>>>>>>>> + sample_size = 32;
>>>>>>>>>>>>> + break;
>>>>>>>>>>>>> default:
>>>>>>>>>>>>> return -EINVAL;
>>>>>>>>>>>>> }
>>>>>>>>>>>>> @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct
>>>>>>>>>>>>> snd_pcm_substream *substream,
>>>>>>>>>>>>> cif_conf.threshold = 0;
>>>>>>>>>>>>> cif_conf.audio_channels = 2;
>>>>>>>>>>>>> cif_conf.client_channels = 2;
>>>>>>>>>>>>> - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16;
>>>>>>>>>>>>> - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16;
>>>>>>>>>>>>> + cif_conf.audio_bits = audio_bits;
>>>>>>>>>>>>> + cif_conf.client_bits = audio_bits;
>>>>>>>>>>>>> cif_conf.expand = 0;
>>>>>>>>>>>>> cif_conf.stereo_conv = 0;
>>>>>>>>>>>>> cif_conf.replicate = 0;
>>>>>>>>>>>>> @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver
>>>>>>>>>>>>> tegra30_i2s_dai_template = {
>>>>>>>>>>>>> .channels_min = 2,
>>>>>>>>>>>>> .channels_max = 2,
>>>>>>>>>>>>> .rates = SNDRV_PCM_RATE_8000_96000,
>>>>>>>>>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE,
>>>>>>>>>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE |
>>>>>>>>>>>>> + SNDRV_PCM_FMTBIT_S24_LE |
>>>>>>>>>>>>> + SNDRV_PCM_FMTBIT_S16_LE,
>>>>>>>>>>>>> },
>>>>>>>>>>>>> .capture = {
>>>>>>>>>>>>> .stream_name = "Capture",
>>>>>>>>>>>>> .channels_min = 2,
>>>>>>>>>>>>> .channels_max = 2,
>>>>>>>>>>>>> .rates = SNDRV_PCM_RATE_8000_96000,
>>>>>>>>>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE,
>>>>>>>>>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE |
>>>>>>>>>>>>> + SNDRV_PCM_FMTBIT_S24_LE |
>>>>>>>>>>>>> + SNDRV_PCM_FMTBIT_S16_LE,
>>>>>>>>>>>>> },
>>>>>>>>>>>>> .ops = &tegra30_i2s_dai_ops,
>>>>>>>>>>>>> .symmetric_rates = 1,
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Hello,
>>>>>>>>>>>>
>>>>>>>>>>>> This patch breaks audio on Tegra30. I don't see errors
>>>>>>>>>>>> anywhere, but
>>>>>>>>>>>> there is no audio and reverting this patch helps. Please fix it.
>>>>>>>>>>>
>>>>>>>>>>> What is the failure mode? I can try and take a look at this some
>>>>>>>>>>> time
>>>>>>>>>>> this week, but I am not sure if I have any boards with an actual
>>>>>>>>>>> useful
>>>>>>>>>>> audio output?
>>>>>>>>>>
>>>>>>>>>> The failure mode is that there no sound. I also noticed that video
>>>>>>>>>> playback stutters a lot if movie file has audio track, seems
>>>>>>>>>> something
>>>>>>>>>> times out during of the audio playback. For now I don't have any
>>>>>>>>>> more info.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Oh, I didn't say how to reproduce it.. for example simply playing
>>>>>>>>> big_buck_bunny_720p_h264.mov in MPV has the audio problem.
>>>>>>>>>
>>>>>>>>> https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h264.mov
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> Given that the audio drivers uses regmap, it could be good to
>>>>>>>> dump the
>>>>>>>> I2S/AHUB registers while the clip if playing with and without this
>>>>>>>> patch
>>>>>>>> to see the differences. I am curious if the audio is now being
>>>>>>>> played as
>>>>>>>> 24 or 32-bit instead of 16-bit now these are available.
>>>>>>>>
>>>>>>>> You could also dump the hw_params to see the format while playing as
>>>>>>>> well ...
>>>>>>>>
>>>>>>>> $ /proc/asound/<scard-name>/pcm0p/sub0/hw_params
>>>>>>>
>>>>>>> I suppose it is also possible that the codec isn't properly doing >16
>>>>>>> bits and the fact we now offer 24 and 32 could be an issue. I've not
>>>>>>> got anything with an audio output on it that would be easy to test.
>>>>>>
>>>>>> I thought I had tested on a Jetson TK1 (Tegra124) but it was sometime
>>>>>> back. However, admittedly I may have only done simple 16-bit testing
>>>>>> with speaker-test.
>>>>>>
>>>>>> We do verify that all soundcards are detected and registered as
>>>>>> expected
>>>>>> during daily testing, but at the moment we don't have anything that
>>>>>> verifies actual playback.
>>>>>
>>>>> Please take a look at the attached logs.
>>>>
>>>> I wonder if we are falling into FIFO configuration issues with the
>>>> non-16 bit case.
>>>>
>>>> Can you try adding the following two patches?
>>>
>>> It is much better now! There is no horrible noise and no stuttering, but
>>> audio still has a "robotic" effect, like freq isn't correct.
>>
>> I wonder if there's an issue with FIFO stoking? I should also possibly
>> add the correctly stop FIFOs patch as well.
>
> I'll be happy to try more patches.
>
> Meanwhile sound on v5.5+ is broken and thus the incomplete patches
> should be reverted.
Have you checked if just removing the 24/32 bits from .formats in
the dai template and see if the problem continues? I will try and
see if I can find the code that does the fifo level checking and
see if the problem is in the FIFO fill or something else in the
audio hub setup.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples 2019-12-20 17:06 [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples Ben Dooks @ 2019-12-22 17:08 ` Dmitry Osipenko 2020-01-05 0:04 ` Ben Dooks 0 siblings, 1 reply; 34+ messages in thread From: Dmitry Osipenko @ 2019-12-22 17:08 UTC (permalink / raw) To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding Cc: linux-kernel, Edward Cragg 20.12.2019 20:06, Ben Dooks пишет: > On 20/12/2019 16:40, Dmitry Osipenko wrote: >> 20.12.2019 18:25, Ben Dooks пишет: >>> On 20/12/2019 15:02, Dmitry Osipenko wrote: >>>> 20.12.2019 17:56, Ben Dooks пишет: >>>>> On 20/12/2019 14:43, Dmitry Osipenko wrote: >>>>>> 20.12.2019 16:57, Jon Hunter пишет: >>>>>>> >>>>>>> On 20/12/2019 11:38, Ben Dooks wrote: >>>>>>>> On 20/12/2019 11:30, Jon Hunter wrote: >>>>>>>>> >>>>>>>>> On 25/11/2019 17:28, Dmitry Osipenko wrote: >>>>>>>>>> 25.11.2019 20:22, Dmitry Osipenko пишет: >>>>>>>>>>> 25.11.2019 13:37, Ben Dooks пишет: >>>>>>>>>>>> On 23/11/2019 21:09, Dmitry Osipenko wrote: >>>>>>>>>>>>> 18.10.2019 18:48, Ben Dooks пишет: >>>>>>>>>>>>>> From: Edward Cragg <edward.cragg@codethink.co.uk> >>>>>>>>>>>>>> >>>>>>>>>>>>>> The tegra3 audio can support 24 and 32 bit sample sizes so >>>>>>>>>>>>>> add >>>>>>>>>>>>>> the >>>>>>>>>>>>>> option to the tegra30_i2s_hw_params to configure the >>>>>>>>>>>>>> S24_LE or >>>>>>>>>>>>>> S32_LE >>>>>>>>>>>>>> formats when requested. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Signed-off-by: Edward Cragg <edward.cragg@codethink.co.uk> >>>>>>>>>>>>>> [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] >>>>>>>>>>>>>> [ben.dooks@codethink.co.uk: add pm calls around ytdm config] >>>>>>>>>>>>>> [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] >>>>>>>>>>>>>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> >>>>>>>>>>>>>> --- >>>>>>>>>>>>>> squash 5aeca5a055fd ASoC: tegra: i2s: >>>>>>>>>>>>>> pm_runtime_get_sync() is >>>>>>>>>>>>>> needed >>>>>>>>>>>>>> in tdm code >>>>>>>>>>>>>> >>>>>>>>>>>>>> ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code >>>>>>>>>>>>>> --- >>>>>>>>>>>>>> sound/soc/tegra/tegra30_i2s.c | 25 >>>>>>>>>>>>>> ++++++++++++++++++++----- >>>>>>>>>>>>>> 1 file changed, 20 insertions(+), 5 deletions(-) >>>>>>>>>>>>>> >>>>>>>>>>>>>> diff --git a/sound/soc/tegra/tegra30_i2s.c >>>>>>>>>>>>>> b/sound/soc/tegra/tegra30_i2s.c >>>>>>>>>>>>>> index 73f0dddeaef3..063f34c882af 100644 >>>>>>>>>>>>>> --- a/sound/soc/tegra/tegra30_i2s.c >>>>>>>>>>>>>> +++ b/sound/soc/tegra/tegra30_i2s.c >>>>>>>>>>>>>> @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct >>>>>>>>>>>>>> snd_pcm_substream *substream, >>>>>>>>>>>>>> struct device *dev = dai->dev; >>>>>>>>>>>>>> struct tegra30_i2s *i2s = >>>>>>>>>>>>>> snd_soc_dai_get_drvdata(dai); >>>>>>>>>>>>>> unsigned int mask, val, reg; >>>>>>>>>>>>>> - int ret, sample_size, srate, i2sclock, bitcnt; >>>>>>>>>>>>>> + int ret, sample_size, srate, i2sclock, bitcnt, >>>>>>>>>>>>>> audio_bits; >>>>>>>>>>>>>> struct tegra30_ahub_cif_conf cif_conf; >>>>>>>>>>>>>> if (params_channels(params) != 2) >>>>>>>>>>>>>> @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct >>>>>>>>>>>>>> snd_pcm_substream *substream, >>>>>>>>>>>>>> switch (params_format(params)) { >>>>>>>>>>>>>> case SNDRV_PCM_FORMAT_S16_LE: >>>>>>>>>>>>>> val = TEGRA30_I2S_CTRL_BIT_SIZE_16; >>>>>>>>>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>>>>>>>>>> sample_size = 16; >>>>>>>>>>>>>> break; >>>>>>>>>>>>>> + case SNDRV_PCM_FORMAT_S24_LE: >>>>>>>>>>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; >>>>>>>>>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_24; >>>>>>>>>>>>>> + sample_size = 24; >>>>>>>>>>>>>> + break; >>>>>>>>>>>>>> + case SNDRV_PCM_FORMAT_S32_LE: >>>>>>>>>>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; >>>>>>>>>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_32; >>>>>>>>>>>>>> + sample_size = 32; >>>>>>>>>>>>>> + break; >>>>>>>>>>>>>> default: >>>>>>>>>>>>>> return -EINVAL; >>>>>>>>>>>>>> } >>>>>>>>>>>>>> @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct >>>>>>>>>>>>>> snd_pcm_substream *substream, >>>>>>>>>>>>>> cif_conf.threshold = 0; >>>>>>>>>>>>>> cif_conf.audio_channels = 2; >>>>>>>>>>>>>> cif_conf.client_channels = 2; >>>>>>>>>>>>>> - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>>>>>>>>>> - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>>>>>>>>>> + cif_conf.audio_bits = audio_bits; >>>>>>>>>>>>>> + cif_conf.client_bits = audio_bits; >>>>>>>>>>>>>> cif_conf.expand = 0; >>>>>>>>>>>>>> cif_conf.stereo_conv = 0; >>>>>>>>>>>>>> cif_conf.replicate = 0; >>>>>>>>>>>>>> @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver >>>>>>>>>>>>>> tegra30_i2s_dai_template = { >>>>>>>>>>>>>> .channels_min = 2, >>>>>>>>>>>>>> .channels_max = 2, >>>>>>>>>>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>>>>>>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>>>>>>>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>>>>>>>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>>>>>>>>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>>>>>>>>>>> }, >>>>>>>>>>>>>> .capture = { >>>>>>>>>>>>>> .stream_name = "Capture", >>>>>>>>>>>>>> .channels_min = 2, >>>>>>>>>>>>>> .channels_max = 2, >>>>>>>>>>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>>>>>>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>>>>>>>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>>>>>>>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>>>>>>>>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>>>>>>>>>>> }, >>>>>>>>>>>>>> .ops = &tegra30_i2s_dai_ops, >>>>>>>>>>>>>> .symmetric_rates = 1, >>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> Hello, >>>>>>>>>>>>> >>>>>>>>>>>>> This patch breaks audio on Tegra30. I don't see errors >>>>>>>>>>>>> anywhere, but >>>>>>>>>>>>> there is no audio and reverting this patch helps. Please >>>>>>>>>>>>> fix it. >>>>>>>>>>>> >>>>>>>>>>>> What is the failure mode? I can try and take a look at this >>>>>>>>>>>> some >>>>>>>>>>>> time >>>>>>>>>>>> this week, but I am not sure if I have any boards with an >>>>>>>>>>>> actual >>>>>>>>>>>> useful >>>>>>>>>>>> audio output? >>>>>>>>>>> >>>>>>>>>>> The failure mode is that there no sound. I also noticed that >>>>>>>>>>> video >>>>>>>>>>> playback stutters a lot if movie file has audio track, seems >>>>>>>>>>> something >>>>>>>>>>> times out during of the audio playback. For now I don't have any >>>>>>>>>>> more info. >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Oh, I didn't say how to reproduce it.. for example simply playing >>>>>>>>>> big_buck_bunny_720p_h264.mov in MPV has the audio problem. >>>>>>>>>> >>>>>>>>>> https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h264.mov >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> Given that the audio drivers uses regmap, it could be good to >>>>>>>>> dump the >>>>>>>>> I2S/AHUB registers while the clip if playing with and without this >>>>>>>>> patch >>>>>>>>> to see the differences. I am curious if the audio is now being >>>>>>>>> played as >>>>>>>>> 24 or 32-bit instead of 16-bit now these are available. >>>>>>>>> >>>>>>>>> You could also dump the hw_params to see the format while >>>>>>>>> playing as >>>>>>>>> well ... >>>>>>>>> >>>>>>>>> $ /proc/asound/<scard-name>/pcm0p/sub0/hw_params >>>>>>>> >>>>>>>> I suppose it is also possible that the codec isn't properly >>>>>>>> doing >16 >>>>>>>> bits and the fact we now offer 24 and 32 could be an issue. I've >>>>>>>> not >>>>>>>> got anything with an audio output on it that would be easy to test. >>>>>>> >>>>>>> I thought I had tested on a Jetson TK1 (Tegra124) but it was >>>>>>> sometime >>>>>>> back. However, admittedly I may have only done simple 16-bit testing >>>>>>> with speaker-test. >>>>>>> >>>>>>> We do verify that all soundcards are detected and registered as >>>>>>> expected >>>>>>> during daily testing, but at the moment we don't have anything that >>>>>>> verifies actual playback. >>>>>> >>>>>> Please take a look at the attached logs. >>>>> >>>>> I wonder if we are falling into FIFO configuration issues with the >>>>> non-16 bit case. >>>>> >>>>> Can you try adding the following two patches? >>>> >>>> It is much better now! There is no horrible noise and no stuttering, >>>> but >>>> audio still has a "robotic" effect, like freq isn't correct. >>> >>> I wonder if there's an issue with FIFO stoking? I should also possibly >>> add the correctly stop FIFOs patch as well. >> >> I'll be happy to try more patches. >> >> Meanwhile sound on v5.5+ is broken and thus the incomplete patches >> should be reverted. > > Have you checked if just removing the 24/32 bits from .formats in > the dai template and see if the problem continues? It works. > I will try and > see if I can find the code that does the fifo level checking and > see if the problem is in the FIFO fill or something else in the > audio hub setup. Ok _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples 2019-12-22 17:08 ` Dmitry Osipenko @ 2020-01-05 0:04 ` Ben Dooks 2020-01-05 1:48 ` Dmitry Osipenko 0 siblings, 1 reply; 34+ messages in thread From: Ben Dooks @ 2020-01-05 0:04 UTC (permalink / raw) To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding Cc: linux-kernel, Edward Cragg [snip] I've just gone through testing. Some simple data tests show 16 and 32-bits work. The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame) My preference is to remove the 24-bit support and keep the 32 bit in. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples 2020-01-05 0:04 ` Ben Dooks @ 2020-01-05 1:48 ` Dmitry Osipenko 2020-01-05 10:53 ` Ben Dooks 0 siblings, 1 reply; 34+ messages in thread From: Dmitry Osipenko @ 2020-01-05 1:48 UTC (permalink / raw) To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding Cc: linux-kernel, Edward Cragg 05.01.2020 03:04, Ben Dooks пишет: > [snip] > > I've just gone through testing. > > Some simple data tests show 16 and 32-bits work. > > The 24 bit case seems to be weird, it looks like the 24-bit expects > 24 bit samples in 32 bit words. I can't see any packing options to > do 24 bit in 24 bit, so we may have to remove 24 bit sample support > (which is a shame) > > My preference is to remove the 24-bit support and keep the 32 bit in. > Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30? _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples 2020-01-05 1:48 ` Dmitry Osipenko @ 2020-01-05 10:53 ` Ben Dooks 2020-01-06 19:00 ` [Linux-kernel] " Ben Dooks 0 siblings, 1 reply; 34+ messages in thread From: Ben Dooks @ 2020-01-05 10:53 UTC (permalink / raw) To: Dmitry Osipenko Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding, Edward Cragg, linux-tegra, Jon Hunter On 2020-01-05 01:48, Dmitry Osipenko wrote: > 05.01.2020 03:04, Ben Dooks пишет: >> [snip] >> >> I've just gone through testing. >> >> Some simple data tests show 16 and 32-bits work. >> >> The 24 bit case seems to be weird, it looks like the 24-bit expects >> 24 bit samples in 32 bit words. I can't see any packing options to >> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >> (which is a shame) >> >> My preference is to remove the 24-bit support and keep the 32 bit in. >> > > Interesting.. Jon, could you please confirm that 24bit format isn't > usable on T30? If there is an option of 24 packed into 32, then I think that would work. I can try testing that with raw data on Monday. -- Ben _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples 2020-01-05 10:53 ` Ben Dooks @ 2020-01-06 19:00 ` Ben Dooks 2020-01-07 1:39 ` Dmitry Osipenko 0 siblings, 1 reply; 34+ messages in thread From: Ben Dooks @ 2020-01-06 19:00 UTC (permalink / raw) To: Dmitry Osipenko Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Mark Brown, Thierry Reding, Edward Cragg, linux-tegra, Jon Hunter On 05/01/2020 10:53, Ben Dooks wrote: > > > On 2020-01-05 01:48, Dmitry Osipenko wrote: >> 05.01.2020 03:04, Ben Dooks пишет: >>> [snip] >>> >>> I've just gone through testing. >>> >>> Some simple data tests show 16 and 32-bits work. >>> >>> The 24 bit case seems to be weird, it looks like the 24-bit expects >>> 24 bit samples in 32 bit words. I can't see any packing options to >>> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >>> (which is a shame) >>> >>> My preference is to remove the 24-bit support and keep the 32 bit in. >>> >> >> Interesting.. Jon, could you please confirm that 24bit format isn't >> usable on T30? > > If there is an option of 24 packed into 32, then I think that would work. > > I can try testing that with raw data on Monday. I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE). I'll follow up later, -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples 2020-01-06 19:00 ` [Linux-kernel] " Ben Dooks @ 2020-01-07 1:39 ` Dmitry Osipenko 2020-01-23 19:38 ` [alsa-devel] " Ben Dooks 0 siblings, 1 reply; 34+ messages in thread From: Dmitry Osipenko @ 2020-01-07 1:39 UTC (permalink / raw) To: Ben Dooks Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Mark Brown, Thierry Reding, Edward Cragg, linux-tegra, Jon Hunter 06.01.2020 22:00, Ben Dooks пишет: > On 05/01/2020 10:53, Ben Dooks wrote: >> >> >> On 2020-01-05 01:48, Dmitry Osipenko wrote: >>> 05.01.2020 03:04, Ben Dooks пишет: >>>> [snip] >>>> >>>> I've just gone through testing. >>>> >>>> Some simple data tests show 16 and 32-bits work. >>>> >>>> The 24 bit case seems to be weird, it looks like the 24-bit expects >>>> 24 bit samples in 32 bit words. I can't see any packing options to >>>> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >>>> (which is a shame) >>>> >>>> My preference is to remove the 24-bit support and keep the 32 bit in. >>>> >>> >>> Interesting.. Jon, could you please confirm that 24bit format isn't >>> usable on T30? >> >> If there is an option of 24 packed into 32, then I think that would work. >> >> I can try testing that with raw data on Monday. > > I need to check some things, I assumed 24 was 24 packed bits, it looks > like the default is 24 in 32 bits so we may be ok. However I need to > re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE). > > I'll follow up later, Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples @ 2020-01-23 19:38 ` Ben Dooks 2020-01-24 16:50 ` Jon Hunter 0 siblings, 1 reply; 34+ messages in thread From: Ben Dooks @ 2020-01-23 19:38 UTC (permalink / raw) To: Dmitry Osipenko Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Mark Brown, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter On 07/01/2020 01:39, Dmitry Osipenko wrote: > 06.01.2020 22:00, Ben Dooks пишет: >> On 05/01/2020 10:53, Ben Dooks wrote: >>> >>> >>> On 2020-01-05 01:48, Dmitry Osipenko wrote: >>>> 05.01.2020 03:04, Ben Dooks пишет: >>>>> [snip] >>>>> >>>>> I've just gone through testing. >>>>> >>>>> Some simple data tests show 16 and 32-bits work. >>>>> >>>>> The 24 bit case seems to be weird, it looks like the 24-bit expects >>>>> 24 bit samples in 32 bit words. I can't see any packing options to >>>>> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >>>>> (which is a shame) >>>>> >>>>> My preference is to remove the 24-bit support and keep the 32 bit in. >>>>> >>>> >>>> Interesting.. Jon, could you please confirm that 24bit format isn't >>>> usable on T30? >>> >>> If there is an option of 24 packed into 32, then I think that would work. >>> >>> I can try testing that with raw data on Monday. >> >> I need to check some things, I assumed 24 was 24 packed bits, it looks >> like the default is 24 in 32 bits so we may be ok. However I need to >> re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE). >> >> I'll follow up later, > > Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly > looked through the TRM doc and got impression that AHUB could re-pack > data stream into something that codec supports, but maybe it's a wrong > impression. > _________________________________ I did a quick test with the following: sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on... -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples @ 2020-01-24 16:50 ` Jon Hunter 2020-01-27 19:20 ` Dmitry Osipenko 0 siblings, 1 reply; 34+ messages in thread From: Jon Hunter @ 2020-01-24 16:50 UTC (permalink / raw) To: Ben Dooks, Dmitry Osipenko Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Mark Brown, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA On 23/01/2020 19:38, Ben Dooks wrote: > On 07/01/2020 01:39, Dmitry Osipenko wrote: >> 06.01.2020 22:00, Ben Dooks пишет: >>> On 05/01/2020 10:53, Ben Dooks wrote: >>>> >>>> >>>> On 2020-01-05 01:48, Dmitry Osipenko wrote: >>>>> 05.01.2020 03:04, Ben Dooks пишет: >>>>>> [snip] >>>>>> >>>>>> I've just gone through testing. >>>>>> >>>>>> Some simple data tests show 16 and 32-bits work. >>>>>> >>>>>> The 24 bit case seems to be weird, it looks like the 24-bit expects >>>>>> 24 bit samples in 32 bit words. I can't see any packing options to >>>>>> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >>>>>> (which is a shame) >>>>>> >>>>>> My preference is to remove the 24-bit support and keep the 32 bit in. >>>>>> >>>>> >>>>> Interesting.. Jon, could you please confirm that 24bit format isn't >>>>> usable on T30? >>>> >>>> If there is an option of 24 packed into 32, then I think that would >>>> work. >>>> >>>> I can try testing that with raw data on Monday. >>> >>> I need to check some things, I assumed 24 was 24 packed bits, it looks >>> like the default is 24 in 32 bits so we may be ok. However I need to >>> re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE). >>> >>> I'll follow up later, >> >> Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly >> looked through the TRM doc and got impression that AHUB could re-pack >> data stream into something that codec supports, but maybe it's a wrong >> impression. >> _________________________________ > > I did a quick test with the following: > > sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 > sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 > sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 > > The 16 and 32 work fine, the 24 is showing a playback output freq > of 440Hz instead of 500Hz... this suggests the clock is off, or there > is something else weird going on... I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having. Ben is S24_3LE what you really need to support? Dmitry, does the following fix your problem? diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index dbed3c5408e7..92845c4b63f4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -140,7 +140,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; - case SNDRV_PCM_FORMAT_S24_LE: + case SNDRV_PCM_FORMAT_S24_3LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24; sample_size = 24; @@ -318,7 +318,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | - SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { @@ -327,7 +327,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | - SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, Jon -- nvpublic ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples @ 2020-01-27 19:20 ` Dmitry Osipenko 2020-01-28 12:13 ` Mark Brown 0 siblings, 1 reply; 34+ messages in thread From: Dmitry Osipenko @ 2020-01-27 19:20 UTC (permalink / raw) To: Jon Hunter, Ben Dooks Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Mark Brown, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA 24.01.2020 19:50, Jon Hunter пишет: > > On 23/01/2020 19:38, Ben Dooks wrote: >> On 07/01/2020 01:39, Dmitry Osipenko wrote: >>> 06.01.2020 22:00, Ben Dooks пишет: >>>> On 05/01/2020 10:53, Ben Dooks wrote: >>>>> >>>>> >>>>> On 2020-01-05 01:48, Dmitry Osipenko wrote: >>>>>> 05.01.2020 03:04, Ben Dooks пишет: >>>>>>> [snip] >>>>>>> >>>>>>> I've just gone through testing. >>>>>>> >>>>>>> Some simple data tests show 16 and 32-bits work. >>>>>>> >>>>>>> The 24 bit case seems to be weird, it looks like the 24-bit expects >>>>>>> 24 bit samples in 32 bit words. I can't see any packing options to >>>>>>> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >>>>>>> (which is a shame) >>>>>>> >>>>>>> My preference is to remove the 24-bit support and keep the 32 bit in. >>>>>>> >>>>>> >>>>>> Interesting.. Jon, could you please confirm that 24bit format isn't >>>>>> usable on T30? >>>>> >>>>> If there is an option of 24 packed into 32, then I think that would >>>>> work. >>>>> >>>>> I can try testing that with raw data on Monday. >>>> >>>> I need to check some things, I assumed 24 was 24 packed bits, it looks >>>> like the default is 24 in 32 bits so we may be ok. However I need to >>>> re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE). >>>> >>>> I'll follow up later, >>> >>> Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly >>> looked through the TRM doc and got impression that AHUB could re-pack >>> data stream into something that codec supports, but maybe it's a wrong >>> impression. >>> _________________________________ >> >> I did a quick test with the following: >> >> sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 >> sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 >> sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 >> >> The 16 and 32 work fine, the 24 is showing a playback output freq >> of 440Hz instead of 500Hz... this suggests the clock is off, or there >> is something else weird going on... > > I was looking at using sox to create such as file, but the above command > generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 > supports S24_LE but does not support S24_3LE and so I cannot test this. > Anyway, we really need to test S24_LE and not S24_3LE because this is > the problem that Dmitry is having. > > Ben is S24_3LE what you really need to support? > > Dmitry, does the following fix your problem? > > diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c > index dbed3c5408e7..92845c4b63f4 100644 > --- a/sound/soc/tegra/tegra30_i2s.c > +++ b/sound/soc/tegra/tegra30_i2s.c > @@ -140,7 +140,7 @@ static int tegra30_i2s_hw_params(struct > snd_pcm_substream *substream, > audio_bits = TEGRA30_AUDIOCIF_BITS_16; > sample_size = 16; > break; > - case SNDRV_PCM_FORMAT_S24_LE: > + case SNDRV_PCM_FORMAT_S24_3LE: > val = TEGRA30_I2S_CTRL_BIT_SIZE_24; > audio_bits = TEGRA30_AUDIOCIF_BITS_24; > sample_size = 24; > @@ -318,7 +318,7 @@ static const struct snd_soc_dai_driver > tegra30_i2s_dai_template = { > .channels_max = 2, > .rates = SNDRV_PCM_RATE_8000_96000, > .formats = SNDRV_PCM_FMTBIT_S32_LE | > - SNDRV_PCM_FMTBIT_S24_LE | > + SNDRV_PCM_FMTBIT_S24_3LE | > SNDRV_PCM_FMTBIT_S16_LE, > }, > .capture = { > @@ -327,7 +327,7 @@ static const struct snd_soc_dai_driver > tegra30_i2s_dai_template = { > .channels_max = 2, > .rates = SNDRV_PCM_RATE_8000_96000, > .formats = SNDRV_PCM_FMTBIT_S32_LE | > - SNDRV_PCM_FMTBIT_S24_LE | > + SNDRV_PCM_FMTBIT_S24_3LE | > SNDRV_PCM_FMTBIT_S16_LE, > }, > .ops = &tegra30_i2s_dai_ops, > > Jon > It should solve the problem in my particular case, but I'm not sure that the solution is correct. The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver? ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples @ 2020-01-28 12:13 ` Mark Brown 2020-01-28 17:42 ` Dmitry Osipenko 0 siblings, 1 reply; 34+ messages in thread From: Mark Brown @ 2020-01-28 12:13 UTC (permalink / raw) To: Dmitry Osipenko Cc: Jon Hunter, Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 1209 bytes --] On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote: > 24.01.2020 19:50, Jon Hunter пишет: > > .rates = SNDRV_PCM_RATE_8000_96000, > > .formats = SNDRV_PCM_FMTBIT_S32_LE | > > - SNDRV_PCM_FMTBIT_S24_LE | > > + SNDRV_PCM_FMTBIT_S24_3LE | > It should solve the problem in my particular case, but I'm not sure that > the solution is correct. If the format implemented by the driver is S24_3LE the driver should advertise S24_3LE. > The v5.5 kernel is released now with the broken audio and apparently > getting 24bit to work won't be trivial (if possible at all). Ben, could > you please send a patch to fix v5.5 by removing the S24 support > advertisement from the driver? Why is that the best fix rather than just advertising the format implemented by the driver? I really don't understand why this is all taking so long, this thread just seems to be going round in interminable circles long after it looked like the issue was understood. I have to admit I've not read every single message in the thread but it's difficult to see why it doesn't seem to be making any progress. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples @ 2020-01-28 17:42 ` Dmitry Osipenko 2020-01-28 18:19 ` Jon Hunter 0 siblings, 1 reply; 34+ messages in thread From: Dmitry Osipenko @ 2020-01-28 17:42 UTC (permalink / raw) To: Mark Brown Cc: Jon Hunter, Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA 28.01.2020 15:13, Mark Brown пишет: > On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote: >> 24.01.2020 19:50, Jon Hunter пишет: > >>> .rates = SNDRV_PCM_RATE_8000_96000, >>> .formats = SNDRV_PCM_FMTBIT_S32_LE | >>> - SNDRV_PCM_FMTBIT_S24_LE | >>> + SNDRV_PCM_FMTBIT_S24_3LE | > >> It should solve the problem in my particular case, but I'm not sure that >> the solution is correct. > > If the format implemented by the driver is S24_3LE the driver should > advertise S24_3LE. It should be S24_LE, but seems we still don't know for sure. >> The v5.5 kernel is released now with the broken audio and apparently >> getting 24bit to work won't be trivial (if possible at all). Ben, could >> you please send a patch to fix v5.5 by removing the S24 support >> advertisement from the driver? > > Why is that the best fix rather than just advertising the format > implemented by the driver? The currently supported format that is known to work well is S16_LE. I'm suggesting to drop the S24_LE and S32_LE that were added by the applied patches simply because this series wasn't tested properly before it was sent out and turned out that it doesn't work well. > I really don't understand why this is all taking so long, this thread > just seems to be going round in interminable circles long after it > looked like the issue was understood. I have to admit I've not read > every single message in the thread but it's difficult to see why it > doesn't seem to be making any progress. Ben was trying to make a fix for the introduced problem, but it's not easy as we see now. Perhaps the best solution should be to revert all of the three applied patches and try again later on, once all current problems will be resolved. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples @ 2020-01-28 18:19 ` Jon Hunter 2020-01-29 0:17 ` Dmitry Osipenko 0 siblings, 1 reply; 34+ messages in thread From: Jon Hunter @ 2020-01-28 18:19 UTC (permalink / raw) To: Dmitry Osipenko, Mark Brown Cc: Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA On 28/01/2020 17:42, Dmitry Osipenko wrote: > 28.01.2020 15:13, Mark Brown пишет: >> On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote: >>> 24.01.2020 19:50, Jon Hunter пишет: >> >>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>> .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>> - SNDRV_PCM_FMTBIT_S24_LE | >>>> + SNDRV_PCM_FMTBIT_S24_3LE | >> >>> It should solve the problem in my particular case, but I'm not sure that >>> the solution is correct. >> >> If the format implemented by the driver is S24_3LE the driver should >> advertise S24_3LE. > > It should be S24_LE, but seems we still don't know for sure. Why? >>> The v5.5 kernel is released now with the broken audio and apparently >>> getting 24bit to work won't be trivial (if possible at all). Ben, could >>> you please send a patch to fix v5.5 by removing the S24 support >>> advertisement from the driver? >> >> Why is that the best fix rather than just advertising the format >> implemented by the driver? > > The currently supported format that is known to work well is S16_LE. > > I'm suggesting to drop the S24_LE and S32_LE that were added by the > applied patches simply because this series wasn't tested properly before > it was sent out and turned out that it doesn't work well. S32_LE should be fine, however, I do have some concerns about S24_LE. Jon -- nvpublic ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples @ 2020-01-29 0:17 ` Dmitry Osipenko 2020-01-30 8:05 ` [alsa-devel] (no subject) Ben Dooks 0 siblings, 1 reply; 34+ messages in thread From: Dmitry Osipenko @ 2020-01-29 0:17 UTC (permalink / raw) To: Jon Hunter, Mark Brown Cc: Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA 28.01.2020 21:19, Jon Hunter пишет: > > On 28/01/2020 17:42, Dmitry Osipenko wrote: >> 28.01.2020 15:13, Mark Brown пишет: >>> On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote: >>>> 24.01.2020 19:50, Jon Hunter пишет: >>> >>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>> .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>> - SNDRV_PCM_FMTBIT_S24_LE | >>>>> + SNDRV_PCM_FMTBIT_S24_3LE | >>> >>>> It should solve the problem in my particular case, but I'm not sure that >>>> the solution is correct. >>> >>> If the format implemented by the driver is S24_3LE the driver should >>> advertise S24_3LE. >> >> It should be S24_LE, but seems we still don't know for sure. > > Why? /I think/ sound should be much more distorted if it was S24_3LE, but maybe I'm wrong. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] (no subject) 2020-01-29 0:17 ` Dmitry Osipenko @ 2020-01-30 8:05 ` Ben Dooks 2020-01-30 9:31 ` Clemens Ladisch 0 siblings, 1 reply; 34+ messages in thread From: Ben Dooks @ 2020-01-30 8:05 UTC (permalink / raw) To: Dmitry Osipenko, Jon Hunter, Mark Brown Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra On 29/01/2020 00:17, Dmitry Osipenko wrote: > 28.01.2020 21:19, Jon Hunter пишет: >> >> On 28/01/2020 17:42, Dmitry Osipenko wrote: >>> 28.01.2020 15:13, Mark Brown пишет: >>>> On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote: >>>>> 24.01.2020 19:50, Jon Hunter пишет: >>>> >>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>> .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>> - SNDRV_PCM_FMTBIT_S24_LE | >>>>>> + SNDRV_PCM_FMTBIT_S24_3LE | >>>> >>>>> It should solve the problem in my particular case, but I'm not sure that >>>>> the solution is correct. >>>> >>>> If the format implemented by the driver is S24_3LE the driver should >>>> advertise S24_3LE. >>> >>> It should be S24_LE, but seems we still don't know for sure. >> >> Why? > /I think/ sound should be much more distorted if it was S24_3LE, but > maybe I'm wrong. S24_3LE is IICC the wrong thing and we can't support it on the tegra3 -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] (no subject) 2020-01-30 8:05 ` [alsa-devel] (no subject) Ben Dooks @ 2020-01-30 9:31 ` Clemens Ladisch [not found] ` <96ed04cb-24ab-7e4d-bd44-6a4bb7c046ac-P6GI/4k7KOmELgA04lAiVw@public.gmane.org> 0 siblings, 1 reply; 34+ messages in thread From: Clemens Ladisch @ 2020-01-30 9:31 UTC (permalink / raw) To: Ben Dooks, Dmitry Osipenko, Jon Hunter, Mark Brown Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra Ben Dooks wrote: > On 29/01/2020 00:17, Dmitry Osipenko wrote: >> 28.01.2020 21:19, Jon Hunter пишет: >>> On 28/01/2020 17:42, Dmitry Osipenko wrote: >>>> 28.01.2020 15:13, Mark Brown пишет: >>>>> On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote: >>>>>> 24.01.2020 19:50, Jon Hunter пишет: >>>>> >>>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>>> .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>>> - SNDRV_PCM_FMTBIT_S24_LE | >>>>>>> + SNDRV_PCM_FMTBIT_S24_3LE | >>>>> >>>>>> It should solve the problem in my particular case, but I'm not sure that >>>>>> the solution is correct. >>>>> >>>>> If the format implemented by the driver is S24_3LE the driver should >>>>> advertise S24_3LE. >>>> >>>> It should be S24_LE, but seems we still don't know for sure. >>> >>> Why? >> /I think/ sound should be much more distorted if it was S24_3LE, but >> maybe I'm wrong. > > S24_3LE is IICC the wrong thing and we can't support it on the tegra3 There are three ways of arranging 24-bit samples in memory: S24_3LE: 24-bit samples in 24-bit words without padding S24_LE: 24-bit samples in 32-bit words, aligned to the LSB S32_LE: 24-bit samples in 32-bit words, aligned to the MSB It is very unlikely that your hardware implements S24_LE. If a S32_LE driver wants to describe how many bits are actually used, it should install a msbits constraint (snd_pcm_hw_constraint_msbits()). Regards, Clemens _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
[parent not found: <96ed04cb-24ab-7e4d-bd44-6a4bb7c046ac-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>]
* Re: [alsa-devel] (no subject) 2020-01-30 9:31 ` Clemens Ladisch @ 2020-01-30 9:39 ` Ben Dooks 0 siblings, 0 replies; 34+ messages in thread From: Ben Dooks @ 2020-01-30 9:39 UTC (permalink / raw) To: Clemens Ladisch, Dmitry Osipenko, Jon Hunter, Mark Brown Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA On 30/01/2020 09:31, Clemens Ladisch wrote: > Ben Dooks wrote: >> On 29/01/2020 00:17, Dmitry Osipenko wrote: >>> 28.01.2020 21:19, Jon Hunter пишет: >>>> On 28/01/2020 17:42, Dmitry Osipenko wrote: >>>>> 28.01.2020 15:13, Mark Brown пишет: >>>>>> On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote: >>>>>>> 24.01.2020 19:50, Jon Hunter пишет: >>>>>> >>>>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>>>> .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>>>> - SNDRV_PCM_FMTBIT_S24_LE | >>>>>>>> + SNDRV_PCM_FMTBIT_S24_3LE | >>>>>> >>>>>>> It should solve the problem in my particular case, but I'm not sure that >>>>>>> the solution is correct. >>>>>> >>>>>> If the format implemented by the driver is S24_3LE the driver should >>>>>> advertise S24_3LE. >>>>> >>>>> It should be S24_LE, but seems we still don't know for sure. >>>> >>>> Why? >>> /I think/ sound should be much more distorted if it was S24_3LE, but >>> maybe I'm wrong. >> >> S24_3LE is IICC the wrong thing and we can't support it on the tegra3 > > There are three ways of arranging 24-bit samples in memory: > > S24_3LE: 24-bit samples in 24-bit words without padding > S24_LE: 24-bit samples in 32-bit words, aligned to the LSB > S32_LE: 24-bit samples in 32-bit words, aligned to the MSB > > It is very unlikely that your hardware implements S24_LE. Which is wrong, since this is exactly what the hardware implements. The DMA fetches 32 bit words, and then the front end dispatches only 24 bits of these to the I2S/TDM > -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] (no subject) @ 2020-01-30 9:39 ` Ben Dooks 0 siblings, 0 replies; 34+ messages in thread From: Ben Dooks @ 2020-01-30 9:39 UTC (permalink / raw) To: Clemens Ladisch, Dmitry Osipenko, Jon Hunter, Mark Brown Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra On 30/01/2020 09:31, Clemens Ladisch wrote: > Ben Dooks wrote: >> On 29/01/2020 00:17, Dmitry Osipenko wrote: >>> 28.01.2020 21:19, Jon Hunter пишет: >>>> On 28/01/2020 17:42, Dmitry Osipenko wrote: >>>>> 28.01.2020 15:13, Mark Brown пишет: >>>>>> On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote: >>>>>>> 24.01.2020 19:50, Jon Hunter пишет: >>>>>> >>>>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>>>> .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>>>> - SNDRV_PCM_FMTBIT_S24_LE | >>>>>>>> + SNDRV_PCM_FMTBIT_S24_3LE | >>>>>> >>>>>>> It should solve the problem in my particular case, but I'm not sure that >>>>>>> the solution is correct. >>>>>> >>>>>> If the format implemented by the driver is S24_3LE the driver should >>>>>> advertise S24_3LE. >>>>> >>>>> It should be S24_LE, but seems we still don't know for sure. >>>> >>>> Why? >>> /I think/ sound should be much more distorted if it was S24_3LE, but >>> maybe I'm wrong. >> >> S24_3LE is IICC the wrong thing and we can't support it on the tegra3 > > There are three ways of arranging 24-bit samples in memory: > > S24_3LE: 24-bit samples in 24-bit words without padding > S24_LE: 24-bit samples in 32-bit words, aligned to the LSB > S32_LE: 24-bit samples in 32-bit words, aligned to the MSB > > It is very unlikely that your hardware implements S24_LE. Which is wrong, since this is exactly what the hardware implements. The DMA fetches 32 bit words, and then the front end dispatches only 24 bits of these to the I2S/TDM > -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
[parent not found: <8161fc88-fa8c-ec92-cc14-1caa5c6f2fe7-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>]
* Re: [alsa-devel] (no subject) 2020-01-30 9:39 ` Ben Dooks @ 2020-01-30 14:58 ` Clemens Ladisch -1 siblings, 0 replies; 34+ messages in thread From: Clemens Ladisch @ 2020-01-30 14:58 UTC (permalink / raw) To: Ben Dooks, Dmitry Osipenko, Jon Hunter, Mark Brown Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA Ben Dooks wrote: > On 30/01/2020 09:31, Clemens Ladisch wrote: >> S24_LE: 24-bit samples in 32-bit words, aligned to the LSB >> S32_LE: 24-bit samples in 32-bit words, aligned to the MSB >> >> It is very unlikely that your hardware implements S24_LE. > > Which is wrong, since this is exactly what the hardware implements. > > The DMA fetches 32 bit words, and then the front end dispatches only > 24 bits of these to the I2S/TDM Which 24 bits? Is the padding in the first byte (S32_LE) or in the last byte (S24_LE)? Regards, Clemens ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] (no subject) @ 2020-01-30 14:58 ` Clemens Ladisch 0 siblings, 0 replies; 34+ messages in thread From: Clemens Ladisch @ 2020-01-30 14:58 UTC (permalink / raw) To: Ben Dooks, Dmitry Osipenko, Jon Hunter, Mark Brown Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra Ben Dooks wrote: > On 30/01/2020 09:31, Clemens Ladisch wrote: >> S24_LE: 24-bit samples in 32-bit words, aligned to the LSB >> S32_LE: 24-bit samples in 32-bit words, aligned to the MSB >> >> It is very unlikely that your hardware implements S24_LE. > > Which is wrong, since this is exactly what the hardware implements. > > The DMA fetches 32 bit words, and then the front end dispatches only > 24 bits of these to the I2S/TDM Which 24 bits? Is the padding in the first byte (S32_LE) or in the last byte (S24_LE)? Regards, Clemens _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
[parent not found: <182fd434-f15a-f049-1ba1-83bd864b4590-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>]
* Re: [alsa-devel] (no subject) 2020-01-30 14:58 ` Clemens Ladisch @ 2020-01-31 10:50 ` Ben Dooks -1 siblings, 0 replies; 34+ messages in thread From: Ben Dooks @ 2020-01-31 10:50 UTC (permalink / raw) To: Clemens Ladisch Cc: Dmitry Osipenko, Jon Hunter, Mark Brown, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai, Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA On 2020-01-30 14:58, Clemens Ladisch wrote: > Ben Dooks wrote: >> On 30/01/2020 09:31, Clemens Ladisch wrote: >>> S24_LE: 24-bit samples in 32-bit words, aligned to the LSB >>> S32_LE: 24-bit samples in 32-bit words, aligned to the MSB >>> >>> It is very unlikely that your hardware implements S24_LE. >> >> Which is wrong, since this is exactly what the hardware implements. >> >> The DMA fetches 32 bit words, and then the front end dispatches only >> 24 bits of these to the I2S/TDM > > Which 24 bits? Is the padding in the first byte (S32_LE) or in the > last byte (S24_LE)? I think the low 24 bits are sent from the 32 bit word. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] (no subject) @ 2020-01-31 10:50 ` Ben Dooks 0 siblings, 0 replies; 34+ messages in thread From: Ben Dooks @ 2020-01-31 10:50 UTC (permalink / raw) To: Clemens Ladisch Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood, Jon Hunter, Mark Brown, Thierry Reding, Edward Cragg, linux-tegra, Dmitry Osipenko On 2020-01-30 14:58, Clemens Ladisch wrote: > Ben Dooks wrote: >> On 30/01/2020 09:31, Clemens Ladisch wrote: >>> S24_LE: 24-bit samples in 32-bit words, aligned to the LSB >>> S32_LE: 24-bit samples in 32-bit words, aligned to the MSB >>> >>> It is very unlikely that your hardware implements S24_LE. >> >> Which is wrong, since this is exactly what the hardware implements. >> >> The DMA fetches 32 bit words, and then the front end dispatches only >> 24 bits of these to the I2S/TDM > > Which 24 bits? Is the padding in the first byte (S32_LE) or in the > last byte (S24_LE)? I think the low 24 bits are sent from the 32 bit word. _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [alsa-devel] (no subject) 2020-01-31 10:50 ` Ben Dooks (?) @ 2020-01-31 11:03 ` Clemens Ladisch -1 siblings, 0 replies; 34+ messages in thread From: Clemens Ladisch @ 2020-01-31 11:03 UTC (permalink / raw) To: Ben Dooks Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood, Jon Hunter, Mark Brown, Thierry Reding, Edward Cragg, linux-tegra, Dmitry Osipenko Ben Dooks wrote: > On 2020-01-30 14:58, Clemens Ladisch wrote: >> Ben Dooks wrote: >>> On 30/01/2020 09:31, Clemens Ladisch wrote: >>>> S24_LE: 24-bit samples in 32-bit words, aligned to the LSB >>>> S32_LE: 24-bit samples in 32-bit words, aligned to the MSB >>>> >>>> It is very unlikely that your hardware implements S24_LE. >>> >>> Which is wrong, since this is exactly what the hardware implements. >>> >>> The DMA fetches 32 bit words, and then the front end dispatches only >>> 24 bits of these to the I2S/TDM >> >> Which 24 bits? Is the padding in the first byte (S32_LE) or in the >> last byte (S24_LE)? > > I think the low 24 bits are sent from the 32 bit word. This would indeed by S24_LE. If you change the driver to say that it supports _only_ S24_LE, is the data then played correctly? Regards, Clemens _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 34+ messages in thread
end of thread, other threads:[~2020-01-31 11:04 UTC | newest] Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-11-18 8:18 Bryan Wu 2008-11-18 8:18 ` [PATCH 1/8] ASoC: Blackfin: updates Kconfig for SPORT Bryan Wu 2008-11-18 8:18 ` [PATCH 2/8] ASoC: AD1980 codec: add multi-channel function support Bryan Wu 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` [PATCH 3/8] ASoC: Blackfin: " Bryan Wu 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` [PATCH 4/8] ASoC: Blackfin: fix bug - AD1980/1 SOC Audio driver fails to build in case MMAP support is turned off Bryan Wu 2008-11-18 8:18 ` Bryan Wu 2008-11-18 11:53 ` [alsa-devel] " Mark Brown 2008-11-18 11:53 ` Mark Brown 2008-11-18 8:18 ` [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI Bryan Wu 2008-11-18 8:18 ` Bryan Wu 2008-11-18 11:54 ` [alsa-devel] " Mark Brown 2008-11-18 11:54 ` Mark Brown 2008-11-18 11:58 ` [alsa-devel] " Hennerich, Michael 2008-11-18 11:58 ` Hennerich, Michael 2008-11-18 8:18 ` [PATCH 6/8] ASoC: Blackfin: do not force TWI bus for ssm2602 codec Bryan Wu 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` [PATCH 7/8] ASoC: Blackfin: Simplify the MMAP_SUPPORT macros protected code Bryan Wu 2008-11-18 8:18 ` Bryan Wu 2008-11-18 8:18 ` [PATCH 8/8] ASoC: Blackfin: always set a default value for that GPIO range Bryan Wu 2008-11-18 8:18 ` Bryan Wu 2008-11-18 11:45 ` [alsa-devel] (no subject) Mark Brown 2008-11-18 11:45 ` Mark Brown 2011-04-25 6:54 (unknown), Sangbeom Kim 2011-04-26 8:26 ` [alsa-devel] (no subject) Liam Girdwood 2019-12-20 17:06 [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples Ben Dooks 2019-12-22 17:08 ` Dmitry Osipenko 2020-01-05 0:04 ` Ben Dooks 2020-01-05 1:48 ` Dmitry Osipenko 2020-01-05 10:53 ` Ben Dooks 2020-01-06 19:00 ` [Linux-kernel] " Ben Dooks 2020-01-07 1:39 ` Dmitry Osipenko 2020-01-23 19:38 ` [alsa-devel] " Ben Dooks 2020-01-24 16:50 ` Jon Hunter 2020-01-27 19:20 ` Dmitry Osipenko 2020-01-28 12:13 ` Mark Brown 2020-01-28 17:42 ` Dmitry Osipenko 2020-01-28 18:19 ` Jon Hunter 2020-01-29 0:17 ` Dmitry Osipenko 2020-01-30 8:05 ` [alsa-devel] (no subject) Ben Dooks 2020-01-30 9:31 ` Clemens Ladisch [not found] ` <96ed04cb-24ab-7e4d-bd44-6a4bb7c046ac-P6GI/4k7KOmELgA04lAiVw@public.gmane.org> 2020-01-30 9:39 ` Ben Dooks 2020-01-30 9:39 ` Ben Dooks [not found] ` <8161fc88-fa8c-ec92-cc14-1caa5c6f2fe7-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org> 2020-01-30 14:58 ` Clemens Ladisch 2020-01-30 14:58 ` Clemens Ladisch [not found] ` <182fd434-f15a-f049-1ba1-83bd864b4590-P6GI/4k7KOmELgA04lAiVw@public.gmane.org> 2020-01-31 10:50 ` Ben Dooks 2020-01-31 10:50 ` Ben Dooks 2020-01-31 11:03 ` Clemens Ladisch
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.