ASoC Blackfin part updates
Subsystems (3)
cover ASoC Blackfin part updates
Hi Mark,
These are some updates from Cliff and Mike for ASoC Blackfin part. I generated these patches against Takashi Iwai's sound-2.6.git tree.
Thanks
-Bryan
PATCH 1/3 ASoC: Blackfin: tweak SPORT range for non-BF54x so we get proper behavior for BF52x parts
From: Mike Frysinger <[email protected]>
--- sound/soc/blackfin/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/blackfin/Kconfig +1 -1
@@ -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.
Signature · 1 line
1.5.6
Re: [PATCH 1/3] ASoC: Blackfin: tweak SPORT range for non-BF54x so we get proper behavior for BF52x parts
At Tue, 21 Oct 2008 11:36:11 +0800,
Quoted 5 lines · Bryan Wu
From: Mike Frysinger <[email protected]>
Signed-off-by Mike Frysinger <[email protected]>Signed-off-by Bryan Wu <[email protected]>
Please use a short summary line, and put more details in the changelog. An empty changelog is very bad in general.
thanks,
Takashi
Quoted 24 lines
--- sound/soc/blackfin/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)sound/soc/blackfin/Kconfig +1
-1@@ -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.Signature · 5 lines
1.5.6 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/3 ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
In reply to Bryan WuFrom: Cliff Cai <[email protected]>
--- sound/soc/blackfin/Kconfig | 8 ++ sound/soc/blackfin/bf5xx-ac97-pcm.c | 45 +++++++---- sound/soc/blackfin/bf5xx-ac97.c | 152 +++++++++++++++++++++-------------- sound/soc/blackfin/bf5xx-ac97.h | 35 +++++++- sound/soc/codecs/ad1980.c | 5 +- 5 files changed, 163 insertions(+), 82 deletions(-)
sound/soc/blackfin/Kconfig +8 -0
@@ -55,6 +55,14 @@ 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_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
sound/soc/blackfin/bf5xx-ac97-pcm.c +30 -15
84 lines not on this page · raw message
sound/soc/blackfin/bf5xx-ac97.c +91 -61
243 lines not on this page · raw message
sound/soc/blackfin/bf5xx-ac97.h +30 -5
@@ -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_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 0x0040extern 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
sound/soc/codecs/ad1980.c +4 -1
@@ -145,7 +145,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 = {
@@ -256,6 +256,9 @@ static int ad1980_soc_probe(struct platform_device *pdev)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 */ +ac97_write (codec,AC97_CENTER_LFE_MASTER ,0x0000 );/* unmute center and lfe volume */ +ac97_write (codec,AC97_SURROUND_MASTER ,0x0000 );/* unmute surround volume */ +ac97_write (codec,AC97_EXTENDED_STATUS ,0x0000 );/*power on LFE CENTER and Surround DACs*/ ad1980_add_controls (codec); ret =snd_soc_register_card (socdev);
Signature · 1 line
1.5.6
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
At Tue, 21 Oct 2008 11:36:12 +0800,
Quoted 18 lines · Bryan Wu
From: Cliff Cai <[email protected]>
Signed-off-by Cliff Cai <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- sound/soc/blackfin/Kconfig | 8 ++ sound/soc/blackfin/bf5xx-ac97-pcm.c | 45 +++++++---- sound/soc/blackfin/bf5xx-ac97.c | 152 +++++++++++++++++++++-------------- sound/soc/blackfin/bf5xx-ac97.h | 35 +++++++- sound/soc/codecs/ad1980.c | 5 +- 5 files changed, 163 insertions(+), 82 deletions(-)sound/soc/blackfin/Kconfig +0
-0
sound/soc/blackfin/Kconfig config SND_MMAP_SUPPORT · line 58
Quoted 4 lines
sound/soc/blackfin/Kconfig +1
-0@@ -55,6 +55,14 @@ 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_MULTICHAN_SUPPORT
SND_BF5XX_MULTICHAN_SUPPORT is preferred because it's pretty specific to bf5xx.
(Well, the same about SND_MMAP_SUPPORT, which I overlooked it...)
Quoted 24 lines
sound/soc/blackfin/Kconfig +7
-0+ 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 tristatesound/soc/blackfin/bf5xx-ac97-pcm.c +6
-0@@ -43,24 +43,34 @@#include "bf5xx-ac97.h" #include "bf5xx-sport.h" +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 */
sound/soc/blackfin/bf5xx-ac97-pcm.c line 61
Quoted 10 lines
sound/soc/blackfin/bf5xx-ac97-pcm.c +4
-0+ SP_5DOT1, /* 5.1 */ +}; +#if defined(CONFIG_SND_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[substream->runtime->channels -1 ];
"substream->" can be removed here. Ditto for the lines below.
sound/soc/blackfin/bf5xx-ac97-pcm.c static int bf5xx_pcm_hw_params(struct snd_pcm_substream *substream, · line 136
Quoted 3 lines
sound/soc/blackfin/bf5xx-ac97-pcm.c +1
-0static int bf5xx_pcm_hw_free (struct snd_pcm_substream *substream) { +#if defined(CONFIG_SND_MMAP_SUPPORT )
Put '#' at the beginning of the line.
Also, in general, I recommend you to run checkpatch.pl once before submitting patches.
thanks,
Takashi
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
In reply to Bryan Wusound/soc/blackfin/Kconfig config SND_MMAP_SUPPORT · line 65
Quoted 8 lines · Bryan Wu
sound/soc/blackfin/Kconfig +8
-0+config SND_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. +
Should this be a user visible option or selected by the machine drivers?
To be honest, I'm surprised that the multi-channel support can't only incur the extra memory consumpton when playing back a multi-channel stream - I'd have expected the hardware to work in the same way for a normal stereo stream even if multi-channel support is built in.
sound/soc/blackfin/bf5xx-ac97.c line 142
Quoted 4 lines
sound/soc/blackfin/bf5xx-ac97.c +1
-1-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) {
Separately please submit a patch removing the needless continuation character here.
sound/soc/codecs/ad1980.c
Quoted 4 lines
sound/soc/codecs/ad1980.c +0
-0
The codec driver changes should be submitted as a separate patch. They're good to go as-is.
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
Quoted 19 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 4:37 PM
To: Bryan Wu
Cc: [email protected]; Cliff Cai
Subject: Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driversound/soc/blackfin/Kconfig config SND_MMAP_SUPPORT
Quoted 6 lines · Bryan Wu
sound/soc/blackfin/Kconfig +6
-0+config SND_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.1channel audio.
Quoted 5 lines
sound/soc/blackfin/Kconfig config SND_MMAP_SUPPORT · line 65
Quoted 2 lines
sound/soc/blackfin/Kconfig +2
-0+ this mode will consume much more memory for DMA. +Should this be a user visible option or selected by the machine drivers?
I think people want to enable this feature
Only If they really want it,since it will consume much more memory To hold multi-channel data.
Quoted 5 lines
To be honest, I'm surprised that the multi-channel support can't only incur the extra memory consumpton when playing back a multi-channel stream - I'd have expected the hardware to work in the same way for a normal stereo stream even if multi-channel support is built in.
Yes,hardware almost works in the same way as playing a stereo stream,except
That it need to fill more data to DMA memory manually,since we just simulate AC97
Controller using serial port.
Quoted 16 lines
sound/soc/blackfin/bf5xx-ac97.c line 142
Quoted 4 lines
sound/soc/blackfin/bf5xx-ac97.c +1
-1-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) {Separately please submit a patch removing the needless continuation character here.
sound/soc/codecs/ad1980.c
Quoted 4 lines
sound/soc/codecs/ad1980.c +0
-0The codec driver changes should be submitted as a separate patch. They're good to go as-is.
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
Quoted 11 lines · Cliff
Quoted 5 lines
To be honest, I'm surprised that the multi-channel support can't only incur the extra memory consumpton when playing back a multi-channel stream - I'd have expected the hardware to work in the same way for a normal stereo stream even if multi-channel support is built in.
Yes,hardware almost works in the same way as playing a stereo stream,except
That it need to fill more data to DMA memory manually,since we just simulate AC97
Controller using serial port.
My point is that the configuration of the hardware for multi-channel playback only needs to be done when actually playing back multi-channel data. When playing back stereo data it should be possible to configure the hardware and do the simulation in the same way as when multi-channel support is not compiled in and avoid the additional costs which that incurs.
As well as saving memory I'd expect configuring this at runtime to also save some power when playing back two or four channel data.
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
Quoted 30 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:16 PM
To: Cai, Cliff
Cc: Bryan Wu; [email protected]
Subject: Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driverQuoted 1 line · Cliff
Quoted 1 line
To be honest, I'm surprised that the multi-channel support
can't only
Quoted 2 lines
Quoted 2 lines
incur the extra memory consumpton when playing back a multi-channel stream - I'd have expected the hardware to work in the same
way for a
Quoted 5 lines
Quoted 1 line
normal stereo stream even if multi-channel support is built in.
Yes,hardware almost works in the same way as playing a stereo stream,except That it need to fill more data to DMA memory manually,since we just simulate AC97 Controller using serial port.
My point is that the configuration of the hardware for multi-channel playback only needs to be done when actually playing back multi-channel data. When playing back stereo data it should be possible to configure the hardware and do the simulation in the same way as when multi-channel support is not compiled in and avoid the additional costs which that incurs.
Quoted 4 lines
As well as saving memory I'd expect configuring this at runtime to also save some power when playing back two or four channel data.
Yes, it's an ideal way,but it's not safe to allocate continuous memory dynamicly,
Since embedded system has limited uncached DMA memory.
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
At Tue, 21 Oct 2008 17:35:49 +0800,
Quoted 31 lines · Cliff
Quoted 31 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:16 PM
To: Cai, Cliff
Cc: Bryan Wu; [email protected]
Subject: Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driverQuoted 1 line · Cliff
Quoted 1 line
To be honest, I'm surprised that the multi-channel support
can't only
Quoted 2 lines
Quoted 2 lines
incur the extra memory consumpton when playing back a multi-channel stream - I'd have expected the hardware to work in the same
way for a
Quoted 5 lines
Quoted 1 line
normal stereo stream even if multi-channel support is built in.
Yes,hardware almost works in the same way as playing a stereo stream,except That it need to fill more data to DMA memory manually,since we just simulate AC97 Controller using serial port.
My point is that the configuration of the hardware for multi-channel playback only needs to be done when actually playing back multi-channel data. When playing back stereo data it should be possible to configure the hardware and do the simulation in the same way as when multi-channel support is not compiled in and avoid the additional costs which that incurs.
Quoted 8 lines
Quoted 4 lines
As well as saving memory I'd expect configuring this at runtime to also save some power when playing back two or four channel data.
Yes, it's an ideal way,but it's not safe to allocate continuous memory dynamicly,
Since embedded system has limited uncached DMA memory.
But, CONFIG_SND_MULTICHAN_SUPPORT would change any buffer allocation behavior? I don't find it...
Anyway, I agree with Mark. The setup can be ideally dynamically changed.
thanks,
Takashi
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
Quoted 52 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:39 PM
To: Cai, Cliff
Cc: Mark Brown; Bryan Wu; [email protected]
Subject: Re: [alsa-devel] [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driverAt Tue, 21 Oct 2008 17:35:49 +0800,
Quoted 9 lines · Cliff
Quoted 9 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:16 PM
To: Cai, Cliff
Cc: Bryan Wu; [email protected]
Subject: Re: [PATCH 2/3] ASoC: Blackfin: add multi-channelsupporting
Quoted 9 lines
Quoted 9 lines
in Blackfin ASoC driver and AD1980 codec driver
Quoted 1 line · Cliff
Quoted 1 line
To be honest, I'm surprised that the multi-channel support
can't only
Quoted 3 lines
Quoted 3 lines
incur the extra memory consumpton when playing back a multi-channel stream - I'd have expected the hardware to work in the same
Quoted 8 lines
Quoted 8 lines
way for a
Quoted 5 lines
Quoted 1 line
normal stereo stream even if multi-channel support is built in.
Yes,hardware almost works in the same way as playing a stereo stream,except That it need to fill more data to DMA memory manually,since we just simulate AC97 Controller using serial port.
My point is that the configuration of the hardware for
multi-channel
Quoted 3 lines
Quoted 3 lines
playback only needs to be done when actually playing back multi-channel data. When playing back stereo data it should be possible to configure the hardware and do the simulation in
the same
Quoted 7 lines
Quoted 6 lines
way as when multi-channel support is not compiled in and avoid the additional costs which that incurs.
As well as saving memory I'd expect configuring this at runtime to also save some power when playing back two or four channel data.
Quoted 6 lines
Quoted 1 line
Yes, it's an ideal way,but it's not safe to allocate
continuous memory
Quoted 1 line
dynamicly, Since embedded system has limited uncached DMA memory.
But,
CONFIG_SND_MULTICHAN_SUPPORTwould change any buffer allocation behavior? I don't find it...
It will change the ac97 frame size defined in bf5xx-ac97.h,the frame size the basic unit of the DMA buffer
Quoted 8 lines
Anyway, I agree with Mark. The setup can be ideally dynamically changed.
thanks,
Takashi
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
Quoted 7 lines · Cliff
Quoted 4 lines
From: Takashi Iwai [mailto:[email protected]]
But,
CONFIG_SND_MULTICHAN_SUPPORTwould change any buffer allocation behavior? I don't find it...It will change the ac97 frame size defined in bf5xx-ac97.h,the frame size the basic unit of the DMA buffer
So this is purely a restriction in the driver, rather than a property of the hardware - is there any reason why you can't change the size of buffer that you allocate at runtime?
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
At Tue, 21 Oct 2008 10:49:16 +0100,
Quoted 7 lines · Mark Brown
Quoted 4 lines · Cliff
Quoted 4 lines
From: Takashi Iwai [mailto:[email protected]]
But,
CONFIG_SND_MULTICHAN_SUPPORTwould change any buffer allocation behavior? I don't find it...
Quoted 6 lines
Quoted 2 lines
It will change the ac97 frame size defined in bf5xx-ac97.h,the frame size the basic unit of the DMA buffer
So this is purely a restriction in the driver, rather than a property of the hardware - is there any reason why you can't change the size of buffer that you allocate at runtime?
It'd be possible, as far as I understand. It's rather a design issue.
bf5xx driver preallocates the max size buffer. Otherwise you may get no large buffer at later fragmentation. And that size is different between with and without multi-channel support.
Takashi
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
In reply to Cai, CliffAt Tue, 21 Oct 2008 17:48:56 +0800,
Quoted 54 lines · Cliff
Quoted 54 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:39 PM
To: Cai, Cliff
Cc: Mark Brown; Bryan Wu; [email protected]
Subject: Re: [alsa-devel] [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driverAt Tue, 21 Oct 2008 17:35:49 +0800,
Quoted 9 lines · Cliff
Quoted 9 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:16 PM
To: Cai, Cliff
Cc: Bryan Wu; [email protected]
Subject: Re: [PATCH 2/3] ASoC: Blackfin: add multi-channelsupporting
Quoted 9 lines
Quoted 9 lines
in Blackfin ASoC driver and AD1980 codec driver
Quoted 1 line · Cliff
Quoted 1 line
To be honest, I'm surprised that the multi-channel support
can't only
Quoted 3 lines
Quoted 3 lines
incur the extra memory consumpton when playing back a multi-channel stream - I'd have expected the hardware to work in the same
Quoted 8 lines
Quoted 8 lines
way for a
Quoted 5 lines
Quoted 1 line
normal stereo stream even if multi-channel support is built in.
Yes,hardware almost works in the same way as playing a stereo stream,except That it need to fill more data to DMA memory manually,since we just simulate AC97 Controller using serial port.
My point is that the configuration of the hardware for
multi-channel
Quoted 3 lines
Quoted 3 lines
playback only needs to be done when actually playing back multi-channel data. When playing back stereo data it should be possible to configure the hardware and do the simulation in
the same
Quoted 8 lines
Quoted 6 lines
way as when multi-channel support is not compiled in and avoid the additional costs which that incurs.
As well as saving memory I'd expect configuring this at runtime to also save some power when playing back two or four channel data.
Yes, it's an ideal way,but it's not safe to allocate
Quoted 8 lines
Quoted 5 lines
continuous memory
Quoted 1 line
dynamicly, Since embedded system has limited uncached DMA memory.
But,
CONFIG_SND_MULTICHAN_SUPPORTwould change any buffer allocation behavior? I don't find it...It will change the ac97 frame size defined in bf5xx-ac97.h,the frame size the basic unit of the DMA buffer
Ah, I see. Then I find this patch OK, at least, changes for blackfin part.
Basically MULTICHAN_SUPPORT will require more resources, but it still provides the same functionality as without it.
BTW, are your changes to ad1980.c applicable unconditionally? For example,
sound/soc/codecs/ad1980.c struct snd_soc_dai ad1980_dai = { · line 148
Quoted 8 lines
sound/soc/codecs/ad1980.c +1
-1@@ -145,7 +145,7 @@ struct snd_soc_dai ad1980_dai = { .playback = { .stream_name = "Playback", .channels_min = 2, - .channels_max = 2, + .channels_max = 6,
This won't work if the machine side doesn't support the multi-channel. Right now, blackfin is the only one, but the codec driver should be generic.
Also, the below is dangerous:
sound/soc/codecs/ad1980.c static int ad1980_soc_probe(struct platform_device *pdev) · line 256
Quoted 2 lines
sound/soc/codecs/ad1980.c +1
-0@@ -256,6 +256,9 @@ static int ad1980_soc_probe(struct platform_device *pdev) +ac97_write (codec,AC97_EXTENDED_STATUS ,0x0000 );/*power on LFE CENTER and Surround DACs*/
This will disable all other features, too.
thanks,
Takashi
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
Quoted 4 lines · Takashi Iwai
Cai, Cliff wrote:
BTW, are your changes to
ad1980.capplicable unconditionally? For example,
Quoted 12 lines
sound/soc/codecs/ad1980.c struct snd_soc_dai ad1980_dai = { · line 148
Quoted 8 lines
sound/soc/codecs/ad1980.c +1
-1@@ -145,7 +145,7 @@ struct snd_soc_dai ad1980_dai = { .playback = { .stream_name = "Playback", .channels_min = 2, - .channels_max = 2, + .channels_max = 6,This won't work if the machine side doesn't support the multi-channel. Right now, blackfin is the only one, but the codec driver should be generic.
This is fine - the ASoC core does constraint checks so if the controller doesn't support the extra channels user space will never be told about them.
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
At Tue, 21 Oct 2008 11:19:39 +0100,
Quoted 19 lines · Mark Brown
Quoted 4 lines · Takashi Iwai
Cai, Cliff wrote:
BTW, are your changes to
ad1980.capplicable unconditionally? For example,Quoted 12 lines
sound/soc/codecs/ad1980.c struct snd_soc_dai ad1980_dai = { · line 148
Quoted 8 lines
sound/soc/codecs/ad1980.c +1
-1@@ -145,7 +145,7 @@ struct snd_soc_dai ad1980_dai = { .playback = { .stream_name = "Playback", .channels_min = 2, - .channels_max = 2, + .channels_max = 6,This won't work if the machine side doesn't support the multi-channel. Right now, blackfin is the only one, but the codec driver should be generic.
Quoted 3 lines
This is fine - the ASoC core does constraint checks so if the controller doesn't support the extra channels user space will never be told about them.
OK, then this change itself is fine. But there is no volume control for surrounds and CLFE, so always loudest outputs?
As a simple workaround, one can set bit 0x4000 to register 0x76 (AD_MISC), so that the master volume controls surrounds, too. Of course, creating corresponding volume controls would be an option, but then it'll be annoying if the machine driver supports only two channels.
Or am I missing anything else?
Takashi
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
Quoted 3 lines · Takashi Iwai
Of course, creating corresponding volume controls would be an option, but then it'll be annoying if the machine driver supports only two channels.
That's a bit of a general problem for ASoC. It'd be possible to deal with it by passing in configuration from the machine driver which selects which controls are registered or which uses the ability to disable controls that you've got in your unstable tree.
Normally it's not a big deal since end users never see the ALSA controls directly but interact with a device-specific UI instead.
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
In reply to Takashi IwaiQuoted 88 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 6:02 PM
To: Cai, Cliff
Cc: Mark Brown; Bryan Wu; [email protected]
Subject: Re: [alsa-devel] [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driverAt Tue, 21 Oct 2008 17:48:56 +0800,
Quoted 28 lines · Cliff
Quoted 28 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:39 PM
To: Cai, Cliff
Cc: Mark Brown; Bryan Wu; [email protected]
Subject: Re: [alsa-devel] [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driverAt Tue, 21 Oct 2008 17:35:49 +0800,
Quoted 9 lines · Cliff
Quoted 9 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:16 PM
To: Cai, Cliff
Cc: Bryan Wu; [email protected]
Subject: Re: [PATCH 2/3] ASoC: Blackfin: add multi-channelsupporting
Quoted 4 lines
Quoted 4 lines
in Blackfin ASoC driver and AD1980 codec driver
On Tue, Oct 21, 2008 at 05:08:31PM +0800, Cai, Cliff wrote:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
To be honest, I'm surprised that the multi-channel support
can't only
Quoted 3 lines
Quoted 3 lines
incur the extra memory consumpton when playing back a multi-channel stream - I'd have expected the hardware to work in the same
way for a
Quoted 1 line
Quoted 1 line
normal stereo stream even if multi-channel support is
built in.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Yes,hardware almost works in the same way as playing a stereo stream,except That it need to fill more data to DMA memory manually,since we just simulate AC97 Controller using
serial port.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
My point is that the configuration of the hardware for
multi-channel
Quoted 3 lines
Quoted 3 lines
playback only needs to be done when actually playing back multi-channel data. When playing back stereo data it should be possible to configure the hardware and do the simulation in
the same
Quoted 1 line
Quoted 1 line
way as when multi-channel support is not compiled in and
avoid the
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
additional costs which that incurs.
As well as saving memory I'd expect configuring this at
runtime to
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
also save some power when playing back two or four channel data.
Yes, it's an ideal way,but it's not safe to allocate
continuous memory
Quoted 1 line
dynamicly, Since embedded system has limited uncached DMA memory.
But,
CONFIG_SND_MULTICHAN_SUPPORTwould change any bufferallocation
Quoted 4 lines
Quoted 1 line
behavior? I don't find it...
It will change the ac97 frame size defined in bf5xx-ac97.h,the frame size the basic unit of the DMA buffer
Ah, I see. Then I find this patch OK, at least, changes for blackfin part.
BasicallyMULTICHAN_SUPPORTwill require more resources, but it still provides the same functionality as without it.BTW, are your changes to
ad1980.capplicable unconditionally? For example,
Quoted 12 lines
sound/soc/codecs/ad1980.c struct snd_soc_dai ad1980_dai = { · line 148
Quoted 8 lines
sound/soc/codecs/ad1980.c +1
-1@@ -145,7 +145,7 @@ struct snd_soc_dai ad1980_dai = { .playback = { .stream_name = "Playback", .channels_min = 2, - .channels_max = 2, + .channels_max = 6,This won't work if the machine side doesn't support the multi-channel. Right now, blackfin is the only one, but the codec driver should be generic.
This is a problem,what's your suggestion?
I think if the CPU DAI only supports stereo,alsa will omit the 6 channel support for codec,am I wrong?
It works for me,since I provide two choices for CPU DAI,2 or 6 channel(through CONFIG_SND_MULTICHAN_SUPPORT).
Quoted 9 lines
Also, the below is dangerous:
sound/soc/codecs/ad1980.c static int ad1980_soc_probe(struct
Quoted 1 line
sound/soc/codecs/ad1980.c +0
-0@@ -256,6 +256,9 @@ static int ad1980_soc_probe(struct
platform_devicesound/soc/codecs/ad1980.c static int ad1980_soc_probe(struct · line 258
Quoted 3 lines
sound/soc/codecs/ad1980.c +2
-0*pdev) +ac97_write (codec,AC97_EXTENDED_STATUS ,0x0000 );/*power on LFE +CENTER and Surround DACs*/ This will disable all other features, too.
OK, I will only enable the DACs needed.
Quoted 5 lines
thanks,
Takashi
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
In reply to Takashi IwaiQuoted 42 lines · Takashi Iwai
At Tue, 21 Oct 2008 17:35:49 +0800,
Quoted 31 lines · Cliff
Quoted 31 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:16 PM
To: Cai, Cliff
Cc: Bryan Wu; [email protected]
Subject: Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driverQuoted 1 line · Cliff
Quoted 1 line
To be honest, I'm surprised that the multi-channel support
can't only
Quoted 2 lines
Quoted 2 lines
incur the extra memory consumpton when playing back a multi-channel stream - I'd have expected the hardware to work in the same
way for a
Quoted 5 lines
Quoted 1 line
normal stereo stream even if multi-channel support is built in.
Yes,hardware almost works in the same way as playing a stereo stream,except That it need to fill more data to DMA memory manually,since we just simulate AC97 Controller using serial port.
My point is that the configuration of the hardware for multi-channel playback only needs to be done when actually playing back multi-channel data. When playing back stereo data it should be possible to configure the hardware and do the simulation in the same way as when multi-channel support is not compiled in and avoid the additional costs which that incurs.
Quoted 8 lines
Quoted 4 lines
As well as saving memory I'd expect configuring this at runtime to also save some power when playing back two or four channel data.
Yes, it's an ideal way,but it's not safe to allocate continuous memory dynamicly,
Since embedded system has limited uncached DMA memory.
Quoted 6 lines
But,
CONFIG_SND_MULTICHAN_SUPPORTwould change any buffer allocation behavior? I don't find it...Anyway, I agree with Mark. The setup can be ideally dynamically changed.
Basically, I like Mark's idea.
But you know, it is very difficult for us to allocate big buffer in an NOMMU machine (such as Blackfin) on the fly, So we prefer to allocate them at the beginning. And in the embedded world, when the user want to use multi-channel function, they will enable this option. If they don't, they won't do that. It is very simple for both us and our users, although it is less elegant than Mark's idea.
-Bryan
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
Quoted 6 lines · Bryan Wu
But you know, it is very difficult for us to allocate big buffer in an NOMMU machine (such as Blackfin) on the fly, So we prefer to allocate them at the beginning. And in the embedded world, when the user want to use multi-channel function, they will enable this option. If they don't, they won't do that. It is very simple for both us and our users, although it is less elegant than Mark's idea.
So the issue is that you want to force a static allocation at startup due to hardware limitations? That makes a bit more sense. I guess that's OK but I'd suggest changing the code to also allow the user to select four channels - not all multi-channel systems use six channels. Another option would be to select it at driver startup time.
I'm still not sure that this is something that should be selected via the kernel configuration rather than by the machine driver - I would expect the use of six channels to be a property of the system rather than of the particular kernel build.
Re: [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driver
Quoted 22 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 6:15 PM
To: Bryan Wu
Cc: Takashi Iwai; Cai, Cliff; [email protected]
Subject: Re: [alsa-devel] [PATCH 2/3] ASoC: Blackfin: add multi-channel supporting in Blackfin ASoC driver and AD1980 codec driverQuoted 1 line · Bryan Wu
But you know, it is very difficult for us to allocate big
buffer in an
Quoted 1 line
NOMMU machine (such as Blackfin) on the fly, So we prefer to
allocate
Quoted 4 lines
them at the beginning. And in the embedded world, when the user want to use multi-channel function, they will enable this option. If they don't, they won't do that. It is very simple for both us and our users, although it is less elegant than Mark's idea.
Quoted 5 lines
So the issue is that you want to force a static allocation at startup due to hardware limitations? That makes a bit more sense. I guess that's OK but I'd suggest changing the code to also allow the user to select four channels - not all multi-channel systems use six channels.
The buffer struct of ac97 frame for 4/6 channels only has one slot difference -- LFE slot,
6-channel mode does support 4-channel mode.
Quoted 7 lines
Another option would be to select it at driver startup time.
I'm still not sure that this is something that should be selected via the kernel configuration rather than by the machine driver - I would expect the use of six channels to be a property of the system rather than of the particular kernel build.
PATCH 3/3 ASoC: Blackfin I2S: Setting the TFS pin selector for SPORT 0 based on whether the selected port id F or G.
In reply to Bryan WuFrom: Cliff Cai <[email protected]>
Also include some small coding style cleanup.
--- sound/soc/blackfin/bf5xx-i2s.c | 33 +++++++++++++++++++++------------ 1 files changed, 21 insertions(+), 12 deletions(-)
sound/soc/blackfin/bf5xx-i2s.c +21 -12
@@ -70,12 +70,23 @@ static struct sport_param sport_params[2] = { } }; -static u16 sport_req[][7 ] = { - {P_SPORT0_DTPRI ,P_SPORT0_TSCLK ,P_SPORT0_RFS , -P_SPORT0_DRPRI ,P_SPORT0_RSCLK ,0 }, - {P_SPORT1_DTPRI ,P_SPORT1_TSCLK ,P_SPORT1_RFS , -P_SPORT1_DRPRI ,P_SPORT1_RSCLK ,0 }, -}; +/* +* Setting the TFS pin selector for SPORT 0 based on whether the selected port id F or G. If the port +* is F then no conflict should exist for the TFS. When Port G is selected and EMAC then there is a +* conflict between the PHY interrupt line and TFS. Current settings prevent the conflict by ignoring +* the TFS pin when Port G is selected. This allows both ssm2602 using Port G and EMAC concurrently. +*/ +#ifdef CONFIG_BF527_SPORT0_PORTF +#define LOCAL_SPORT0_TFS (P_SPORT0_TFS) +#endif + +#ifndef CONFIG_BF527_SPORT0_PORTF +#define LOCAL_SPORT0_TFS (0) +#endif + +static u16 sport_req[][7 ] = { {P_SPORT0_DTPRI ,P_SPORT0_TSCLK ,P_SPORT0_RFS , +P_SPORT0_DRPRI ,P_SPORT0_RSCLK ,LOCAL_SPORT0_TFS ,0 }, {P_SPORT1_DTPRI , +P_SPORT1_TSCLK ,P_SPORT1_RFS ,P_SPORT1_DRPRI ,P_SPORT1_RSCLK ,P_SPORT1_TFS ,0 } };static int bf5xx_i2s_set_dai_fmt (struct snd_soc_dai *cpu_dai,unsigned int fmt)
@@ -98,23 +109,21 @@ static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, ret = -EINVAL ;break ;default : +printk (KERN_ERR "Unknown SND_SOC_DAIFMT_FORMAT type\n" ); ret = -EINVAL ;break ; }switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { -case SND_SOC_DAIFMT_CBS_CFS : - ret = -EINVAL ; -break ; -case SND_SOC_DAIFMT_CBM_CFS : - ret = -EINVAL ; -break ;case SND_SOC_DAIFMT_CBM_CFM :break ; +case SND_SOC_DAIFMT_CBS_CFS : +case SND_SOC_DAIFMT_CBM_CFS :case SND_SOC_DAIFMT_CBS_CFM : ret = -EINVAL ;break ;default : +printk (KERN_ERR "Unknown SND_SOC_DAIFMT_MASTER type\n" ); ret = -EINVAL ;break ; }
Signature · 1 line
1.5.6
Re: [PATCH 3/3] ASoC: Blackfin I2S: Setting the TFS pin selector for SPORT 0 based on whether the selected port id F or G.
At Tue, 21 Oct 2008 11:36:13 +0800,
Quoted 4 lines · Bryan Wu
From: Cliff Cai <[email protected]>
Also include some small coding style cleanup.
Try checkpatch.pl to make sure that you really cleaned up, not added new warnings :)
sound/soc/blackfin/bf5xx-i2s.c static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, · line 112
Quoted 5 lines
sound/soc/blackfin/bf5xx-i2s.c +1
-0@@ -98,23 +109,21 @@ static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, ret = -EINVAL ;break ;default : +printk (KERN_ERR "Unknown SND_SOC_DAIFMT_FORMAT type\n" );
Put some prefix for error messages. Otherwise you don't know who tells it.
Quoted 10 lines
sound/soc/blackfin/bf5xx-i2s.c +0
-5ret = -EINVAL ;break ; }switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { -case SND_SOC_DAIFMT_CBS_CFS : - ret = -EINVAL ; -break ; -case SND_SOC_DAIFMT_CBM_CFS : - ret = -EINVAL ;
sound/soc/blackfin/bf5xx-i2s.c static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, · line 126
Quoted 10 lines
sound/soc/blackfin/bf5xx-i2s.c +3
-1-break ;case SND_SOC_DAIFMT_CBM_CFM :break ; +case SND_SOC_DAIFMT_CBS_CFS : +case SND_SOC_DAIFMT_CBM_CFS :case SND_SOC_DAIFMT_CBS_CFM : ret = -EINVAL ;break ;default : +printk (KERN_ERR "Unknown SND_SOC_DAIFMT_MASTER type\n" );
Ditto.
thanks,
Takashi
Re: [PATCH 3/3] ASoC: Blackfin I2S: Setting the TFS pin selector for SPORT 0 based on whether the selected port id F or G.
Quoted 9 lines · Takashi Iwai
At Tue, 21 Oct 2008 11:36:13 +0800,
Quoted 3 lines · Bryan Wu
From: Cliff Cai <[email protected]>
Also include some small coding style cleanup.
Try checkpatch.pl to make sure that you really cleaned up, not added new warnings :)
Also, your Subject: should probably be moved in here and a shorter version used for the Subject: line. In general the entire subject line should be shorter than 80 columns otherwise it doesn't work too well when viewing the logs.