patch sequence adds analog devices ad1836 asoc support
Subsystems (3)
cover patch sequence adds analog devices ad1836 asoc support
Hi Mark,
The patch sequence adds ad1836 support based on asoc
patch 1:
new ad1836 codec driver based on asoc
patch 2:
add set_tdm_slot entry in tdm-dai to define the relationship between audio channel and tdm slot number
patch 3:
new board driver to connect ad1836 codec and bf5xx
patch 3 depends on patch 2.
Thanks
Barry
PATCH 1/3 new ad1836 codec driver based on asoc
There has been an ad1836 driver in sound/blackfin based on traditional alsa. The new driver is based on asoc. The architecture of ad1836 codec driver is very much like ad1938.
--- sound/soc/codecs/Kconfig | 3 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/ad1836.c | 465 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/ad1836.h | 64 ++++++ 4 files changed, 534 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/ad1836.c create mode 100644 sound/soc/codecs/ad1836.h
sound/soc/codecs/Kconfig +3 -0
@@ -68,6 +68,9 @@ config SND_SOC_AC97_CODEC tristate select SND_AC97_CODEC +config SND_SOC_AD1836 + tristate + config SND_SOC_AD1938 tristate
sound/soc/codecs/Makefile +2 -0
@@ -1,4 +1,5 @@ snd-soc-ac97-objs := ac97.o +snd-soc-ad1836-objs := ad1836.o snd-soc-ad1938-objs := ad1938.o snd-soc-ad1980-objs := ad1980.o snd-soc-ad73311-objs := ad73311.o
@@ -45,6 +46,7 @@ snd-soc-wm9713-objs := wm9713.o snd-soc-max9877-objs := max9877.o obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o +obj-$(CONFIG_SND_SOC_AD1836) += snd-soc-ad1836.o obj-$(CONFIG_SND_SOC_AD1938) += snd-soc-ad1938.o obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
sound/soc/codecs/ad1836.c new file +465 -0
465 lines not on this page · raw message
sound/soc/codecs/ad1836.h new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
1.5.6.3
PATCH 2/3 add set_tdm_slot in tdm dai to define the relationship between audio channel and tdm slot
For ad1938, the audio channel n just uses slot n, but for ad1836, it's different, channel 0 uses slot 0, channel 1 uses slot 4, channels 2 uses slot1, ... So add set_tdm_slot entry and use the mask field to define the relationship between audio channel and slot number.
--- sound/soc/blackfin/bf5xx-ad1938.c | 5 +++++ sound/soc/blackfin/bf5xx-tdm-pcm.c | 12 +++++++++--- sound/soc/blackfin/bf5xx-tdm.c | 18 ++++++++++-------- sound/soc/blackfin/bf5xx-tdm.h | 10 ++++++++++ 4 files changed, 34 insertions(+), 11 deletions(-)
sound/soc/blackfin/bf5xx-ad1938.c +5 -0
@@ -73,6 +73,11 @@ static int bf5xx_ad1938_hw_params(struct snd_pcm_substream *substream, SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);if (ret <0 )return ret; + +/* set cpu DAI slots, 8 channels, mask is defined as slot seq */ + ret =snd_soc_dai_set_tdm_slot (codec_dai,0x76543210 ,8 ); +if (ret <0 ) +return ret;/* set codec DAI slots, 8 channels, all channels are enabled */ ret =snd_soc_dai_set_tdm_slot (codec_dai,0xFF ,8 );
sound/soc/blackfin/bf5xx-tdm-pcm.c +9 -3
@@ -43,7 +43,7 @@#include "bf5xx-tdm.h" #include "bf5xx-sport.h" -#define PCM_BUFFER_MAX 0x10000 +#define PCM_BUFFER_MAX 0x8000#define FRAGMENT_SIZE_MIN (4*1024)#define FRAGMENTS_MIN 2#define FRAGMENTS_MAX 32
@@ -177,6 +177,9 @@ out:static int bf5xx_pcm_copy (struct snd_pcm_substream *substream,int channel,snd_pcm_uframes_t pos,void *buf,snd_pcm_uframes_t count) { +struct snd_pcm_runtime *runtime = substream->runtime; +struct sport_device *sport = runtime->private_data; +struct bf5xx_tdm_port *tdm_port = sport->private_data;unsigned int *src;unsigned int *dst;int i;
@@ -186,9 +189,11 @@ static int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel, dst = (unsigned int *)substream->runtime->dma_area; dst += pos *8 ; +while (count--) {for (i =0 ; i < substream->runtime->channels; i++) - *(dst + i) = *src++; + *(dst + (((tdm_port->slot_seq >> + (4 * i)) &0xF ))) = *src++; dst +=8 ; } }else {
@@ -198,7 +203,8 @@ static int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel, src += pos *8 ;while (count--) {for (i =0 ; i < substream->runtime->channels; i++) - *dst++ = *(src+i); + *dst++ = *(src + (((tdm_port->slot_seq >> + (4 * i)) &0xF ))); src +=8 ; } }
sound/soc/blackfin/bf5xx-tdm.c +10 -8
@@ -46,14 +46,6 @@#include "bf5xx-sport.h" #include "bf5xx-tdm.h" -struct bf5xx_tdm_port { -u16 tcr1; -u16 rcr1; -u16 tcr2; -u16 rcr2; -int configured; -}; -static struct bf5xx_tdm_port bf5xx_tdm;static int sport_num =CONFIG_SND_BF5XX_SPORT_NUM ;
@@ -181,6 +173,13 @@ static void bf5xx_tdm_shutdown(struct snd_pcm_substream *substream, bf5xx_tdm.configured =0 ; } +static int bf5xx_tdm_set_tdm_slot (struct snd_soc_dai *dai, +unsigned int mask,int slots) +{ + bf5xx_tdm.slot_seq = mask; +return 0 ; +} +#ifdef CONFIG_PM static int bf5xx_tdm_suspend (struct snd_soc_dai *dai) {
@@ -235,6 +234,7 @@ static struct snd_soc_dai_ops bf5xx_tdm_dai_ops = { .hw_params = bf5xx_tdm_hw_params, .set_fmt = bf5xx_tdm_set_dai_fmt, .shutdown = bf5xx_tdm_shutdown, + .set_tdm_slot = bf5xx_tdm_set_tdm_slot, };struct snd_soc_dai bf5xx_tdm_dai = {
@@ -300,6 +300,8 @@ static int __devinit bfin_tdm_probe(struct platform_device *pdev)pr_err ("Failed to register DAI: %d\n" , ret); goto sport_config_err; } + + sport_handle->private_data = &bf5xx_tdm;return 0 ; sport_config_err:
sound/soc/blackfin/bf5xx-tdm.h +10 -0
@@ -9,6 +9,16 @@#ifndef _BF5XX_TDM_H#define _BF5XX_TDM_H +struct bf5xx_tdm_port { +u16 tcr1; +u16 rcr1; +u16 tcr2; +u16 rcr2; +/* which slot used for the corresponding audio channel? */ +int slot_seq; +int configured; +}; +extern struct snd_soc_dai bf5xx_tdm_dai;#endif
Signature · 1 line
1.5.6.3
PATCH 3/3 new board driver to connect bfin-5xx with ad1836 codec
--- sound/soc/blackfin/Kconfig | 8 ++ sound/soc/blackfin/Makefile | 2 + sound/soc/blackfin/bf5xx-ad1836.c | 138 +++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 0 deletions(-) create mode 100644 sound/soc/blackfin/bf5xx-ad1836.c
sound/soc/blackfin/Kconfig +8 -0
@@ -88,6 +88,14 @@ config SND_BF5XX_SOC_AC97 select SND_SOC_AC97_BUS select SND_BF5XX_SOC_SPORT +config SND_BF5XX_SOC_AD1836 + tristate "SoC AD1836 Audio support for BF5xx" + depends on SND_BF5XX_TDM + select SND_BF5XX_SOC_TDM + select SND_SOC_AD1836 + help + Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. + config SND_BF5XX_SOC_AD1980 tristate "SoC AD1980/1 Audio support for BF5xx" depends on SND_BF5XX_AC97
sound/soc/blackfin/Makefile +2 -0
@@ -16,11 +16,13 @@ obj-$(CONFIG_SND_BF5XX_SOC_I2S) += snd-soc-bf5xx-i2s.o obj-$(CONFIG_SND_BF5XX_SOC_TDM) += snd-soc-bf5xx-tdm.o # Blackfin Machine Support +snd-ad1836-objs := bf5xx-ad1836.o snd-ad1980-objs := bf5xx-ad1980.o snd-ssm2602-objs := bf5xx-ssm2602.o snd-ad73311-objs := bf5xx-ad73311.o snd-ad1938-objs := bf5xx-ad1938.o +obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o
sound/soc/blackfin/bf5xx-ad1836.c new file +138 -0
138 lines not on this page · raw message
Signature · 1 line
1.5.6.3
Re: [PATCH 3/3] new board driver to connect bfin-5xx with ad1836 codec
On Wed, Aug 12, 2009 at 12:32:54PM +0800, Barry Song wrote:
This is OK but...
sound/soc/blackfin/bf5xx-ad1836.c line 71
Quoted 4 lines
sound/soc/blackfin/bf5xx-ad1836.c new file +4
-0+/* set cpu DAI slots, 8 channels, mask is defined as slot seq */ + ret =snd_soc_dai_set_tdm_slot (cpu_dai,0x73625140 ,8 ); +if (ret <0 ) +return ret;
This suggests that there's something really odd going on with your set_tdm_slot() for the CPU which is likely to make it incompatible with other implementations and with any core support to handle things like multi-drop DAIs. The DAI driver side could certainly use more documenation explaining what's going on if nothing else...
Re: [PATCH 3/3] new board driver to connect bfin-5xx with ad1836 codec
Quoted 9 lines · Mark Brown
On Wed, Aug 12, 2009 at 12:32:54PM +0800, Barry Song wrote:
This is OK but...
Quoted 4 lines
+ /* set cpu DAI slots, 8 channels, mask is defined as slot seq */
+ ret =snd_soc_dai_set_tdm_slot(cpu_dai, 0x73625140, 8);
+ if (ret < 0)
+ return ret;
Quoted 6 lines
This suggests that there's something really odd going on with your
set_tdm_slot()for the CPU which is likely to make it incompatible with other implementations and with any core support to handle things like multi-drop DAIs. The DAI driver side could certainly use more documenation explaining what's going on if nothing else...
Fixed
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 2/3] add set_tdm_slot in tdm dai to define the relationship between audio channel and tdm slot
In reply to Barry SongQuoted 6 lines · Barry Song
For ad1938, the audio channel n just uses slot n, but for ad1836, it's different, channel 0 uses slot 0, channel 1 uses slot 4, channels 2 uses slot1, ... So add
set_tdm_slotentry and use the mask field to define the relationship between audio channel and slot number.Signed-off-by Barry Song <[email protected]>
OK but this needs updating to the new tdm_slot() API too.
Re: [PATCH 2/3] add set_tdm_slot in tdm dai to define the relationship between audio channel and tdm slot
Quoted 10 lines · Mark Brown
Quoted 6 lines · Barry Song
For ad1938, the audio channel n just uses slot n, but for ad1836, it's different, channel 0 uses slot 0, channel 1 uses slot 4, channels 2 uses slot1, ... So add
set_tdm_slotentry and use the mask field to define the relationship between audio channel and slot number.Signed-off-by Barry Song <[email protected]>OK but this needs updating to the new
tdm_slot()API too.
Fixed
Re: [PATCH 1/3] new ad1836 codec driver based on asoc
In reply to Barry SongQuoted 3 lines · Barry Song
There has been an ad1836 driver in
sound/blackfinbased on traditional alsa. The new driver is based on asoc. The architecture of ad1836 codec driver is very much like ad1938.
This is mostly good, a few relatively minor issues though.
sound/soc/codecs/ad1836.c line 60
Quoted 2 lines
sound/soc/codecs/ad1836.c new file +2
-0+SOC_DOUBLE_R ("DAC3 Volume" ,AD1836_DAC_L3_VOL , + AD1836_DAC_R3_VOL, 0, 0x3FF, 0),
You've got an extra space in the volume control names which I'd expect to confuse user space.
sound/soc/codecs/ad1836.c line 101
Quoted 2 lines
sound/soc/codecs/ad1836.c new file +2
-0+ { "DAC1OUT", "DAC1 Switch", "DAC" }, + { "DAC2OUT", "DAC2 Switch", "DAC" },
I'm surprised this works since the switches weren't declared as DAPM controls but if the core supports it that's OK.
sound/soc/codecs/ad1836.c line 113
Quoted 3 lines
sound/soc/codecs/ad1836.c new file +3
-0+static int ad1836_set_tdm_slot (struct snd_soc_dai *dai, +unsigned int mask,int slots) +{
This needs updating for the new set_tdm_slot() API but given that there's only one possible configuration I'd suggest just removing it - the function does nothing other than check its arguments.
sound/soc/codecs/ad1836.c line 181
Quoted 3 lines
sound/soc/codecs/ad1836.c new file +3
-0+ reg = codec->read (codec,AD1836_DAC_CTRL1 ); + reg = (reg & (~AD1836_DAC_WORD_LEN_MASK )) | word_len; + codec->write (codec,AD1836_DAC_CTRL1 , reg);
Not essential but snd_soc_update_bits() does the read/modify/write cycle for you.
sound/soc/codecs/ad1836.c line 270
Quoted 3 lines
sound/soc/codecs/ad1836.c new file +3
-0+static struct spi_driver ad1836_spi_driver = { + .driver = { + .name ="ad1836-spi" ,
Just "ad1836" - the fact that it's controlled via SPI is clear from the fact that this is a struct spi_driver.
sound/soc/codecs/ad1836.c line 365
Quoted 12 lines
sound/soc/codecs/ad1836.c new file +12
-0+ ret =snd_soc_register_codec (codec); +if (ret !=0 ) { +dev_err (codec->dev,"Failed to register codec: %d\n" , ret); +return ret; + } + + ret =snd_soc_register_dai (&ad1836_dai); +if (ret !=0 ) { +dev_err (codec->dev,"Failed to register DAI: %d\n" , ret); +snd_soc_unregister_codec (codec); +return ret; + }
Should also be freeing the private data structure on error.
sound/soc/codecs/ad1836.c line 439
Quoted 8 lines
sound/soc/codecs/ad1836.c new file +8
-0+struct snd_soc_codec_device soc_codec_dev_ad1836 = { + .probe = ad1836_probe, + .remove = ad1836_remove, +/* The power management of ad1836 is very simple. There are +* only adc&dac 2 components to control. Dapm handles them. +*/ + .suspend =NULL , + .resume =NULL ,
The power control will be handled by DAPM but your driver still needs to restore things like the volume settings - when the driver is powered off the register settings will be forgotten.
Re: [PATCH 1/3] new ad1836 codec driver based on asoc
Quoted 5 lines · Mark Brown
Quoted 3 lines · Barry Song
There has been an ad1836 driver in
sound/blackfinbased on traditional alsa. The new driver is based on asoc. The architecture of ad1836 codec driver is very much like ad1938.
Quoted 7 lines
This is mostly good, a few relatively minor issues though.
Quoted 2 lines
+ SOC_DOUBLE_R("DAC3 Volume",
AD1836_DAC_L3_VOL,
+AD1836_DAC_R3_VOL, 0,0x3FF, 0),You've got an extra space in the volume control names which I'd expect to confuse user space.
Fixed.
Quoted 7 lines
Quoted 3 lines
+ { "DAC1OUT", "DAC1 Switch", "DAC" },
+ { "DAC2OUT", "DAC2 Switch", "DAC" },I'm surprised this works since the switches weren't declared as DAPM controls but if the core supports it that's OK.
Quoted 8 lines
sound/soc/codecs/ad1836.c line 113
Quoted 3 lines
sound/soc/codecs/ad1836.c new file +3
-0+static int ad1836_set_tdm_slot (struct snd_soc_dai *dai, + unsigned int mask, int slots) +{This needs updating for the new
set_tdm_slot()API but given that there's only one possible configuration I'd suggest just removing it - the function does nothing other than check its arguments.
Fixed
Quoted 7 lines
Quoted 3 lines
+ reg =
codec->read(codec, AD1836_DAC_CTRL1);
+ reg = (reg & (~AD1836_DAC_WORD_LEN_MASK)) |word_len;
+codec->write(codec, AD1836_DAC_CTRL1, reg);Not essential but
snd_soc_update_bits()does the read/modify/write cycle for you.
Fixed
Quoted 7 lines
Quoted 3 lines
+static struct
spi_driverad1836_spi_driver= {
+ .driver = {
+ .name = "ad1836-spi",Just "ad1836" - the fact that it's controlled via SPI is clear from the fact that this is a struct
spi_driver.
I agree the spi structure implies the meaning of spi. But files in arch/blackfin/mach... are using names like "xxx-spi" for almost all spi devices. How about keeping the coherence?
Quoted 13 lines
Quoted 4 lines
+ ret =
snd_soc_register_codec(codec);
+ if (ret != 0) {
+dev_err(codec->dev, "Failed to register codec: %d\n", ret);
+ return ret;Quoted 8 lines
+ }
+
+ ret =snd_soc_register_dai(&ad1836_dai);
+ if (ret != 0) {
+dev_err(codec->dev, "Failed to register DAI: %d\n", ret);
+snd_soc_unregister_codec(codec);
+ return ret;
+ }
Quoted 2 lines
Should also be freeing the private data structure on error.
Fixed
Quoted 9 lines
Quoted 8 lines
+struct
snd_soc_codec_devicesoc_codec_dev_ad1836= {
+ .probe = ad1836_probe,
+ .remove =ad1836_remove,
+ /* The power management of ad1836 is very simple. There are
+ * only adc&dac 2 components to control. Dapm handles them.
+ */
+ .suspend = NULL,
+ .resume = NULL,
Quoted 4 lines
The power control will be handled by DAPM but your driver still needs to restore things like the volume settings - when the driver is powered off the register settings will be forgotten.
My test shows registers setting doesn't lose after dac/adc shutdown :-)
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 1/3] new ad1836 codec driver based on asoc
Quoted 9 lines · Barry Song
Quoted 2 lines · Mark Brown
Just "ad1836" - the fact that it's controlled via SPI is clear from the fact that this is a struct
spi_driver.I agree the spi structure implies the meaning of spi. But files in
arch/blackfin/mach... are using names like "xxx-spi" for almost all spi devices. How about keeping the coherence?
Oh dear. Looks like you've essentially got a choice between being consistent with the rest of the world and being consistent with what the blackfin stuff is doing.
Quoted 5 lines
Quoted 3 lines
The power control will be handled by DAPM but your driver still needs to restore things like the volume settings - when the driver is powered off the register settings will be forgotten.
My test shows registers setting doesn't lose after dac/adc shutdown :-)
Probably your board is maintaining power to the chip even during suspend.
Re: [Uclinux-dist-devel] [PATCH 1/3] new ad1836 codec driver based on asoc
Quoted 5 lines · Mark Brown
Quoted 4 lines · Barry Song
Quoted 2 lines · Mark Brown
Just "ad1836" - the fact that it's controlled via SPI is clear from the fact that this is a struct
spi_driver.
Quoted 7 lines
Quoted 3 lines
I agree the spi structure implies the meaning of spi. But files in
arch/blackfin/mach... are using names like "xxx-spi" for almost all spi devices. How about keeping the coherence?Oh dear. Looks like you've essentially got a choice between being consistent with the rest of the world and being consistent with what the blackfin stuff is doing.
it really isnt that bad. the drivers that use "-spi" suffix:
.modalias = "ad1836-spi", # audio
.modalias = "ad1938-spi", # audio
.modalias = "ad7147-spi", # input
.modalias = "ad9960-spi", # dead .modalias = "bfin-lq035q1-spi", # video
.modalias = "fxo-spi", # dead
.modalias = "fxs-spi", # dead
dropping the dead devices leaves us with 4 drivers to fix, two of which are audio. should be easy for us to fix.
-mike
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [Uclinux-dist-devel] [PATCH 1/3] new ad1836 codec driver based on asoc
Quoted 23 lines · Mike Frysinger
Quoted 5 lines · Mark Brown
Quoted 4 lines · Barry Song
Quoted 2 lines · Mark Brown
Just "ad1836" - the fact that it's controlled via SPI is clear from the fact that this is a struct
spi_driver.Quoted 7 lines
Quoted 3 lines
I agree the spi structure implies the meaning of spi. But files in
arch/blackfin/mach... are using names like "xxx-spi" for almost all spi devices. How about keeping the coherence?Oh dear. Looks like you've essentially got a choice between being consistent with the rest of the world and being consistent with what the blackfin stuff is doing.
it really isnt that bad. the drivers that use "-spi" suffix:
.modalias = "ad1836-spi", # audio .modalias = "ad1938-spi", # audio .modalias = "ad7147-spi", # input .modalias = "ad9960-spi", # dead .modalias = "bfin-lq035q1-spi", # video .modalias = "fxo-spi", # dead .modalias = "fxs-spi", # dead
Quoted 2 lines
dropping the dead devices leaves us with 4 drivers to fix, two of which are audio. should be easy for us to fix.
semi-scratch that. ive punted the dead devices from our tree, but the bfin-lq035q1-spi is correct as that device driver requires two things -- a platform driver named "bfin-lq035q1" and a spi driver named "bfin-lq035q1-spi".
i'll have to send a patch out for the ad7147-spi since it's been merged into the input tree iirc, but Barry can handle these two codecs.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 1/3] new ad1836 codec driver based on asoc
In reply to Mark BrownQuoted 7 lines · Mark Brown
Quoted 5 lines · Barry Song
Quoted 2 lines · Mark Brown
Just "ad1836" - the fact that it's controlled via SPI is clear from the fact that this is a struct
spi_driver.
Quoted 7 lines
Quoted 3 lines
I agree the spi structure implies the meaning of spi. But files in
arch/blackfin/mach... are using names like "xxx-spi" for almost all spi devices. How about keeping the coherence?Oh dear. Looks like you've essentially got a choice between being consistent with the rest of the world and being consistent with what the blackfin stuff is doing.
Looks like the rest world really doesn't define a spi device with modalias "xxx-spi" but just "xxx" in arch. So I agree we can change blackfin stuff as Mike.
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
The power control will be handled by DAPM but your driver still needs to restore things like the volume settings - when the driver is powered off the register settings will be forgotten.
My test shows registers setting doesn't lose after dac/adc shutdown :-)
Probably your board is maintaining power to the chip even during suspend.
If so, all codec drivers need to save setting then restore them when resume. The physical shutdown depends on boards great. If we get an individual programmable PMU/LDO to control the voltage input to this chip, I can shutdown power-input to codec physically and save the registers when suspend, then restore them when resume. If no this unit, should every codec driver handle this case?
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 1/3] new ad1836 codec driver based on asoc
Quoted 6 lines · Barry Song
If so, all codec drivers need to save setting then restore them when resume. The physical shutdown depends on boards great. If we get an individual programmable PMU/LDO to control the voltage input to this chip, I can shutdown power-input to codec physically and save the registers when suspend, then restore them when resume. If no this unit, should every codec driver handle this case?
Yes, every CODEC driver that supports suspend and resume needs to handle this. Since the CODEC drivers generally use a register cache it's normally just a case of writing the values in the cache back to the device at the start of resume.
Re: [PATCH 1/3] new ad1836 codec driver based on asoc
Quoted 9 lines · Mark Brown
Quoted 6 lines · Barry Song
If so, all codec drivers need to save setting then restore them when resume. The physical shutdown depends on boards great. If we get an individual programmable PMU/LDO to control the voltage input to this chip, I can shutdown power-input to codec physically and save the registers when suspend, then restore them when resume. If no this unit, should every codec driver handle this case?
Quoted 5 lines
Yes, every CODEC driver that supports suspend and resume needs to handle this. Since the CODEC drivers generally use a register cache it's normally just a case of writing the values in the cache back to the device at the start of resume.
Well. If all chips need this same operation, can it be abstracted to the soc core layer?
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 1/3] new ad1836 codec driver based on asoc
Quoted 2 lines · Barry Song
Well. If all chips need this same operation, can it be abstracted to the soc core layer?
The details of the register cache operation are entirely in the domain of the chip - it's not mandatory to have a register cache at all and some devices have complex register layouts which cause problems with doing this in a fully automated fashion. There are also issues with some devices having things like soft reset registers in the middle of their register map.
That said, there is some work in this direction - see soc-cache.c.