extend ad1938 codec/machine driver to ad193x supporting ad1936/7/8/9
Subsystems (3)
cover extend ad1938 codec/machine driver to ad193x supporting ad1936/7/8/9
Hi Mark,
The following patch series extends ad1938 codec/machine driver to support ad193x(including ad1936/ad1937/ad1938/ad1939). Some codecs use i2c bus and others use spi bus.
patch 1: extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
patch 2: change bf5xx-ad1938 machine driver to bf5xx-ad193x machine driver
patch 3: soc-cache: add i2c read entry for 8_8 mode
patch 4: soc-cache: let reg be AND'ed by 0xff instead of data buffer for 8_8 mode
Thanks
Barry
A message that is not in the archive (sent off-list or not yet received): 1268900221-6833-1-git-send-email-21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 1/4 extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
This patch extends ad1938 codec driver to support ad1936/7/8/9, ad1936/7 use i2c bus, ad1938/9 use spi bus.
The driver is splitted into three:ad193x.h and ad193x.c: common codec driver ad193x-spi.c: ad193x codec spi driverad193x-i2c.c: ad193x codec i2c driver
--- sound/soc/codecs/Kconfig | 12 +- sound/soc/codecs/Makefile | 8 +- sound/soc/codecs/ad1938.c | 521 ----------------------------------------- sound/soc/codecs/ad1938.h | 100 -------- sound/soc/codecs/ad193x-i2c.c | 56 +++++ sound/soc/codecs/ad193x-spi.c | 49 ++++ sound/soc/codecs/ad193x.c | 475 +++++++++++++++++++++++++++++++++++++ sound/soc/codecs/ad193x.h | 82 +++++++ 8 files changed, 678 insertions(+), 625 deletions(-) delete mode 100644 sound/soc/codecs/ad1938.c delete mode 100644 sound/soc/codecs/ad1938.h create mode 100644 sound/soc/codecs/ad193x-i2c.c create mode 100644 sound/soc/codecs/ad193x-spi.c create mode 100644 sound/soc/codecs/ad193x.c create mode 100644 sound/soc/codecs/ad193x.h
sound/soc/codecs/Kconfig +10 -2
@@ -13,7 +13,9 @@ config SND_SOC_ALL_CODECS select SND_SOC_L3 select SND_SOC_AC97_CODEC if SND_SOC_AC97_BUS select SND_SOC_AD1836 if SPI_MASTER - select SND_SOC_AD1938 if SPI_MASTER + select SND_SOC_AD193X + select SND_SOC_AD193X_SPI if SPI_MASTER + select SND_SOC_AD193X_I2C if I2C select SND_SOC_AD1980 if SND_SOC_AC97_BUS select SND_SOC_ADS117X select SND_SOC_AD73311 if I2C
@@ -91,7 +93,13 @@ config SND_SOC_AC97_CODEC config SND_SOC_AD1836 tristate -config SND_SOC_AD1938 +config SND_SOC_AD193X + tristate + +config SND_SOC_AD193X_SPI + tristate + +config SND_SOC_AD193X_I2C tristate config SND_SOC_AD1980
sound/soc/codecs/Makefile +6 -2
@@ -1,6 +1,8 @@ snd-soc-ac97-objs := ac97.o snd-soc-ad1836-objs := ad1836.o -snd-soc-ad1938-objs := ad1938.o +snd-soc-ad193x-objs := ad193x.o +snd-soc-ad193x-spi-objs := ad193x-spi.o +snd-soc-ad193x-i2c-objs := ad193x-i2c.o snd-soc-ad1980-objs := ad1980.o snd-soc-ad73311-objs := ad73311.o snd-soc-ads117x-objs := ads117x.o
@@ -63,7 +65,9 @@ snd-soc-wm2000-objs := wm2000.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_AD193X) += snd-soc-ad193x.o +obj-$(CONFIG_SND_SOC_AD193X_SPI)+= snd-soc-ad193x-spi.o +obj-$(CONFIG_SND_SOC_AD193X_I2C)+= snd-soc-ad193x-i2c.o obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o
sound/soc/codecs/ad1938.c deleted +0 -521
521 lines not on this page · raw message
sound/soc/codecs/ad1938.h deleted +0 -100
100 lines not on this page · raw message
sound/soc/codecs/ad193x-i2c.c new file +56 -0
56 lines not on this page · raw message
sound/soc/codecs/ad193x-spi.c new file +49 -0
49 lines not on this page · raw message
sound/soc/codecs/ad193x.c new file +475 -0
475 lines not on this page · raw message
sound/soc/codecs/ad193x.h new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
1.5.6.3
A message that is not in the archive (sent off-list or not yet received): 1268900221-6833-2-git-send-email-21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/4 change bf5xx-ad1938 machine driver to bf5xx-ad193x machine driver
--- sound/soc/blackfin/Kconfig | 13 ++- sound/soc/blackfin/Makefile | 4 +- sound/soc/blackfin/bf5xx-ad1938.c | 149 ------------------------------------- sound/soc/blackfin/bf5xx-ad193x.c | 149 +++++++++++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+), 156 deletions(-) delete mode 100644 sound/soc/blackfin/bf5xx-ad1938.c create mode 100644 sound/soc/blackfin/bf5xx-ad193x.c
sound/soc/blackfin/Kconfig +8 -5
@@ -49,13 +49,16 @@ config SND_BF5XX_SOC_AD1836 help Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. -config SND_BF5XX_SOC_AD1938 - tristate "SoC AD1938 Audio support for Blackfin" - depends on SND_BF5XX_TDM +config SND_BF5XX_SOC_AD193X + tristate "SoC AD193X Audio support for Blackfin" + depends on SND_BF5XX_TDM && (SPI_MASTER || I2C) select SND_BF5XX_SOC_TDM - select SND_SOC_AD1938 + select SND_SOC_AD193X + select SND_SOC_AD193X_SPI if SPI_MASTER + select SND_SOC_AD193X_I2C if I2C help - Say Y if you want to add support for AD1938 codec on Blackfin. + Say Y if you want to add support for AD193X codec on Blackfin. + This driver supports AD1936, AD1937, AD1938 and AD1939. config SND_BF5XX_AC97 tristate "SoC AC97 Audio for the ADI BF5xx chip"
sound/soc/blackfin/Makefile +2 -2
@@ -20,10 +20,10 @@ 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 +snd-ad193x-objs := bf5xx-ad193x.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 -obj-$(CONFIG_SND_BF5XX_SOC_AD1938) += snd-ad1938.o +obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o
sound/soc/blackfin/bf5xx-ad1938.c deleted +0 -149
149 lines not on this page · raw message
sound/soc/blackfin/bf5xx-ad193x.c new file +149 -0
149 lines not on this page · raw message
Signature · 1 line
1.5.6.3
A message that is not in the archive (sent off-list or not yet received): 1268900221-6833-3-git-send-email-21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 3/4 soc-cache: add i2c read entry for 8_8 mode
From: Cliff Cai <[email protected]>
--- sound/soc/soc-cache.c | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-)
sound/soc/soc-cache.c +35 -0
@@ -226,6 +226,40 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec, }#if defined(CONFIG_I2C ) || (defined(CONFIG_I2C_MODULE ) && defined(MODULE )) +static unsigned int snd_soc_8_8_read_i2c (struct snd_soc_codec *codec, +unsigned int r) +{ +struct i2c_msg xfer[2 ]; +u8 reg = r; +u8 data; +int ret; +struct i2c_client *client = codec->control_data; + +/* Write register */ + xfer[0 ].addr = client->addr; + xfer[0 ].flags =0 ; + xfer[0 ].len =1 ; + xfer[0 ].buf = ® + +/* Read data */ + xfer[1 ].addr = client->addr; + xfer[1 ].flags =I2C_M_RD ; + xfer[1 ].len =1 ; + xfer[1 ].buf = &data; + + ret =i2c_transfer (client->adapter, xfer,2 ); +if (ret !=2 ) { +dev_err (&client->dev,"i2c_transfer() returned %d\n" , ret); +return 0 ; + } + +return data; +} +#else +#define snd_soc_8_8_read_i2c NULL +#endif + +#if defined(CONFIG_I2C ) || (defined(CONFIG_I2C_MODULE ) && defined(MODULE ))static unsigned int snd_soc_8_16_read_i2c (struct snd_soc_codec *codec,unsigned int r) {
@@ -466,6 +500,7 @@ static struct { { .addr_bits = 8, .data_bits = 8, .write = snd_soc_8_8_write, .read = snd_soc_8_8_read, + .i2c_read = snd_soc_8_8_read_i2c, }, { .addr_bits = 8, .data_bits = 16,
Signature · 1 line
1.5.6.3
PATCH 4/4 soc-cache: let reg be AND'ed by 0xff instead of data buffer for 8_8 mode
The registers for AD193X are defined as 0x800-0x810 for spi which uses 16_8 mode, for i2c to support AD1937, we will use 8_8 mode, only the low byte of 0x800-0x810 is valid.
The patch will not destory other codecs, but make soc cache interface more useful.
--- sound/soc/soc-cache.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
sound/soc/soc-cache.c +3 -1
@@ -159,7 +159,8 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,BUG_ON (codec->volatile_register); - data[0 ] = reg &0xff ; + reg &=0xff ; + data[0 ] = reg; data[1 ] = value &0xff ;if (reg < codec->reg_cache_size)
@@ -180,6 +181,7 @@ static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec, unsigned int reg) {u8 *cache = codec->reg_cache; + reg &=0xff ;if (reg >= codec->reg_cache_size)return -1 ;return cache[reg];
Signature · 1 line
1.5.6.3
Re: [PATCH 4/4] soc-cache: let reg be AND'ed by 0xff instead of data buffer for 8_8 mode
Quoted 6 lines · Barry Song
The registers for AD193X are defined as 0x800-0x810 for spi which uses 16_8 mode, for i2c to support AD1937, we will use 8_8 mode, only the low byte of 0x800-0x810 is valid.
The patch will not destory other codecs, but make soc cache interface more useful.Signed-off-by Barry Song <[email protected]>
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
Mark Brown
AppliedRe: [PATCH 4/4] soc-cache: let reg be AND'ed by 0xff instead of data buffer for 8_8 mode
Quoted 9 lines · Liam Girdwood
Quoted 6 lines · Barry Song
The registers for AD193X are defined as 0x800-0x810 for spi which uses 16_8 mode, for i2c to support AD1937, we will use 8_8 mode, only the low byte of 0x800-0x810 is valid.
The patch will not destory other codecs, but make soc cache interface more useful.Signed-off-by Barry Song <[email protected]>Acked-by Liam Girdwood <[email protected]>
Applied, thanks.
Re: [PATCH 3/4] soc-cache: add i2c read entry for 8_8 mode
In reply to Barry SongQuoted 4 lines · Barry Song
From: Cliff Cai <[email protected]>
Signed-off-by Cliff Cai <[email protected]>Signed-off-by Barry Song <[email protected]>
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
Mark Brown
AppliedRe: [PATCH 3/4] soc-cache: add i2c read entry for 8_8 mode
Quoted 7 lines · Liam Girdwood
Quoted 4 lines · Barry Song
From: Cliff Cai <[email protected]>
Signed-off-by Cliff Cai <[email protected]>Signed-off-by Barry Song <[email protected]>Acked-by Liam Girdwood <[email protected]>
Applied, thanks.
Re: [PATCH 2/4] change bf5xx-ad1938 machine driver to bf5xx-ad193x machine driver
In reply to Barry SongQuoted 1 line · Barry Song
Signed-off-by Barry Song <[email protected]>
Might be worth trying to use 'git format-patch -M' to see if you can produce a more useful view of this.
Re: [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
In reply to Barry SongQuoted 6 lines · Barry Song
This patch extends ad1938 codec driver to support ad1936/7/8/9, ad1936/7 use i2c bus, ad1938/9 use spi bus.
The driver is splitted into three:ad193x.handad193x.c: common codec driverad193x-spi.c: ad193x codec spi driverad193x-i2c.c: ad193x codec i2c driver
Is the new common driver code the same as the original driver minus any I2C/SPI changes ? It's difficult to see if anything else has been changed.
Btw, have a look at wm8731.c. This driver supports both I2C and SPI and is less churn than splitting out the code into three files.
Thanks
Liam
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
Re: [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 11 lines · Liam Girdwood
Quoted 6 lines · Barry Song
This patch extends ad1938 codec driver to support ad1936/7/8/9, ad1936/7 use i2c bus, ad1938/9 use spi bus.
The driver is splitted into three:ad193x.handad193x.c: common codec driverad193x-spi.c: ad193x codec spi driverad193x-i2c.c: ad193x codec i2c driverIs the new common driver code the same as the original driver minus any I2C/SPI changes ? It's difficult to see if anything else has been changed.
Basically, the codes are same except renaming ad1938 to ad193x.
Quoted 3 lines
Btw, have a look at
wm8731.c. This driver supports both I2C and SPI and is less churn than splitting out the code into three files.
We have many discussion about a driver to support both spi and i2c in another device(ad714x). At the beginning, the way in wm8731.c is used, then after many comments, people agree splitting the driver to three modules is the best way. If you are interested in it, you may take a look at "input/misc: add Analog Devices AD714x captouch input driver" in linux-input maillist.
Quoted 11 lines
Thanks
Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
Re: [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 11 lines · Barry Song
Quoted 2 lines · Liam Girdwood
Btw, have a look at
wm8731.c. This driver supports both I2C and SPI and is less churn than splitting out the code into three files.We have many discussion about a driver to support both spi and i2c in another device(ad714x). At the beginning, the way in
wm8731.cis used, then after many comments, people agree splitting the driver to three modules is the best way. If you are interested in it, you may take a look at "input/misc: add Analog Devices AD714x captouch input driver" in linux-input maillist.
This was a discussion for the input subsystem and what makes sense here. For ASoC we've been using the approach that WM8731 and other similar drivers are using, please follow that approach with ASoC drivers. Adding files per driver per bus type isn't helpful here.
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 12 lines · Mark Brown
Quoted 10 lines · Barry Song
Quoted 2 lines · Liam Girdwood
Btw, have a look at
wm8731.c. This driver supports both I2C and SPI and is less churn than splitting out the code into three files.We have many discussion about a driver to support both spi and i2c in another device(ad714x). At the beginning, the way in
wm8731.cis used, then after many comments, people agree splitting the driver to three modules is the best way. If you are interested in it, you may take a look at "input/misc: add Analog Devices AD714x captouch input driver" in linux-input maillist.
Quoted 4 lines
This was a discussion for the input subsystem and what makes sense here. For ASoC we've been using the approach that WM8731 and other similar drivers are using, please follow that approach with ASoC drivers. Adding files per driver per bus type isn't helpful here.
that isnt really true. the tact taken in the input subsystem wrt multiple busses had nothing to do with the input subsystem. it was designed to provide flexibility -- the core is not tied to the busses, and any of the pieces could be loaded/unloaded on the fly instead of forcing the core to be rebuilt just because of bus changes.
i'm not suggesting the ASoC codecs shouldnt use the same style across the board (and thus we shouldnt change the AD193x driver), just pointing out your basic premise here is invalid and that there are pros/cons to each method and that they're independent of the subsystem. you simply selected a different solution. -mike
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 5 lines · Mike Frysinger
i'm not suggesting the ASoC codecs shouldnt use the same style across the board (and thus we shouldnt change the AD193x driver), just pointing out your basic premise here is invalid and that there are pros/cons to each method and that they're independent of the subsystem. you simply selected a different solution.
My point is that the fact that the input subsystem has made a choice is pretty much irrelevant for ASoC, which has different considerations and therefore made a different choice. Barry had simply said there had been a big discussion and this is what had been agreed, but that discussion was held for the input subsystem and when the equivalent discussion was held for ASoC a different conclusion was reached.
The subsystem dependency here come from the fact that ASoC has machine drivers and relies on them selecting the CODEC drivers to get them built in the first place so if you're trying to change something like this you'll most likely not only have to rebuild your kernel but also have to write code. This isn't something that the input layer has (input layer drivers are pretty much standalone, usually only need platform data for any per machine hookup and for I2C and SPI can even be registered from user space IIRC) and it changes the considerations noticably.
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 7 lines · Mark Brown
Quoted 5 lines · Mike Frysinger
i'm not suggesting the ASoC codecs shouldnt use the same style across the board (and thus we shouldnt change the AD193x driver), just pointing out your basic premise here is invalid and that there are pros/cons to each method and that they're independent of the subsystem. you simply selected a different solution.
Quoted 6 lines
My point is that the fact that the input subsystem has made a choice is pretty much irrelevant for ASoC, which has different considerations and therefore made a different choice. Barry had simply said there had been a big discussion and this is what had been agreed, but that discussion was held for the input subsystem and when the equivalent discussion was held for ASoC a different conclusion was reached.
i dont think that's entirely true ... one of the major points of getting drivers into mainline is so that when common paradigms are observed, they can be unified across everyone. subsystems rarely are special ... most of the time, people just think they're special and so can ignore the common behavior.
as devices get more complicated and hook up to more arbitrary busses, i'm sure something will arise in the future to address this.
Quoted 8 lines
The subsystem dependency here come from the fact that ASoC has machine drivers and relies on them selecting the CODEC drivers to get them built in the first place so if you're trying to change something like this you'll most likely not only have to rebuild your kernel but also have to write code. This isn't something that the input layer has (input layer drivers are pretty much standalone, usually only need platform data for any per machine hookup and for I2C and SPI can even be registered from user space IIRC) and it changes the considerations noticably.
the machine driver selects the codec, it doesnt select the bus. the codec worries about that. so i dont quite follow the logic here. -mike
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 3 lines · Mike Frysinger
observed, they can be unified across everyone. subsystems rarely are special ... most of the time, people just think they're special and so can ignore the common behavior.
I really don't see much of that, to be honest. Bitrot, lack of time and poor advertising of new core features seem to be more the issue.
Quoted 11 lines
Quoted 8 lines
The subsystem dependency here come from the fact that ASoC has machine drivers and relies on them selecting the CODEC drivers to get them built in the first place so if you're trying to change something like this you'll most likely not only have to rebuild your kernel but also have to write code. This isn't something that the input layer has (input layer drivers are pretty much standalone, usually only need platform data for any per machine hookup and for I2C and SPI can even be registered from user space IIRC) and it changes the considerations noticably.
the machine driver selects the codec, it doesnt select the bus. the codec worries about that. so i dont quite follow the logic here.
That's not the case, CODEC drivers do absolutely nothing to ensure that they have the buses they need. Multi bus CODECs should all be perfectly happy to build with no bus at all, though sparse and/or GCC will warn.
Kconfig will cheerfully ignore any dependencies of things that are selected - unless it's been updated recently all a select does is force the selected symbol on, it doesn't recurse through dependencies and selects of that symbol. Besides, multi bus CODEC drivers can't know which of their possible buses are actually needed on a given system - they just build support for any bus types that are configured and let something else worry about the resulting configuration actually being useful.
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 17 lines · Mark Brown
Quoted 11 lines · Mike Frysinger
Quoted 8 lines
The subsystem dependency here come from the fact that ASoC has machine drivers and relies on them selecting the CODEC drivers to get them built in the first place so if you're trying to change something like this you'll most likely not only have to rebuild your kernel but also have to write code. This isn't something that the input layer has (input layer drivers are pretty much standalone, usually only need platform data for any per machine hookup and for I2C and SPI can even be registered from user space IIRC) and it changes the considerations noticably.
the machine driver selects the codec, it doesnt select the bus. the codec worries about that. so i dont quite follow the logic here.
That's not the case, CODEC drivers do absolutely nothing to ensure that they have the buses they need. Multi bus CODECs should all be perfectly happy to build with no bus at all, though sparse and/or GCC will warn.
Quoted 8 lines
Kconfigwill cheerfully ignore any dependencies of things that are selected - unless it's been updated recently all a select does is force the selected symbol on, it doesn't recurse through dependencies and selects of that symbol. Besides, multi bus CODEC drivers can't know which of their possible buses are actually needed on a given system - they just build support for any bus types that are configured and let something else worry about the resulting configuration actually being useful.
sure, on the Kconfig side, i can see that. i was thinking the pure C drivers though. thanks for the clarification.
-mike
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
I think this issue has nothing to do with subsystems, anyway, both are acceptable to me. Since there has been an example in ASoC, I will follow it and send v2.
thanks
-barry
Quoted 27 lines · Mike Frysinger
Quoted 17 lines · Mark Brown
Quoted 11 lines · Mike Frysinger
Quoted 8 lines
The subsystem dependency here come from the fact that ASoC has machine drivers and relies on them selecting the CODEC drivers to get them built in the first place so if you're trying to change something like this you'll most likely not only have to rebuild your kernel but also have to write code. This isn't something that the input layer has (input layer drivers are pretty much standalone, usually only need platform data for any per machine hookup and for I2C and SPI can even be registered from user space IIRC) and it changes the considerations noticably.
the machine driver selects the codec, it doesnt select the bus. the codec worries about that. so i dont quite follow the logic here.
That's not the case, CODEC drivers do absolutely nothing to ensure that they have the buses they need. Multi bus CODECs should all be perfectly happy to build with no bus at all, though sparse and/or GCC will warn.
Quoted 8 lines
Kconfigwill cheerfully ignore any dependencies of things that are selected - unless it's been updated recently all a select does is force the selected symbol on, it doesn't recurse through dependencies and selects of that symbol. Besides, multi bus CODEC drivers can't know which of their possible buses are actually needed on a given system - they just build support for any bus types that are configured and let something else worry about the resulting configuration actually being useful.
Quoted 4 lines
sure, on the
Kconfigside, i can see that. i was thinking the pure C drivers though. thanks for the clarification.
-mike
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
It seems "git-format-patch -M" fails to detect this patch as a rename(maybe due to too many changed lines?), so I commit two times to get a readable patch and attach them.
1. rename ad1938 to ad193x
2. extend ad1938 codec driver to ad193x supporting ad1936/7/8/9 -barry
Quoted 6 lines · Barry Song
I think this issue has nothing to do with subsystems, anyway, both are acceptable to me. Since there has been an example in ASoC, I will follow it and send v2.
thanks
-barry
Quoted 33 lines
Quoted 31 lines · Mike Frysinger
Quoted 17 lines · Mark Brown
Quoted 11 lines · Mike Frysinger
Quoted 8 lines
The subsystem dependency here come from the fact that ASoC has machine drivers and relies on them selecting the CODEC drivers to get them built in the first place so if you're trying to change something like this you'll most likely not only have to rebuild your kernel but also have to write code. This isn't something that the input layer has (input layer drivers are pretty much standalone, usually only need platform data for any per machine hookup and for I2C and SPI can even be registered from user space IIRC) and it changes the considerations noticably.
the machine driver selects the codec, it doesnt select the bus. the codec worries about that. so i dont quite follow the logic here.
That's not the case, CODEC drivers do absolutely nothing to ensure that they have the buses they need. Multi bus CODECs should all be perfectly happy to build with no bus at all, though sparse and/or GCC will warn.
Quoted 8 lines
Kconfigwill cheerfully ignore any dependencies of things that are selected - unless it's been updated recently all a select does is force the selected symbol on, it doesn't recurse through dependencies and selects of that symbol. Besides, multi bus CODEC drivers can't know which of their possible buses are actually needed on a given system - they just build support for any bus types that are configured and let something else worry about the resulting configuration actually being useful.sure, on the
Kconfigside, i can see that. i was thinking the pure C drivers though. thanks for the clarification.
-mike
From 8082fb9af39926a4bf4fb663b14172acb291cb8c Mon Sep 17 00:00:00 2001
From: Barry Song <[email protected]>
Date: Fri, 19 Mar 2010 14:48:33 +0800
Subject: [PATCH 1/2] rename ad1938 to ad193x
---
sound/soc/codecs/{ad1938.c => ad193x.c} | 0
sound/soc/codecs/{ad1938.h => ad193x.h} | 0
2 files changed, 0 insertions(+), 0 deletions(-)
rename sound/soc/codecs/{ad1938.c => ad193x.c} (100%)
rename sound/soc/codecs/{ad1938.h => ad193x.h} (100%)sound/soc/codecs/ad193x.c renamed from sound/soc/codecs/ad1938.c +0 -0
sound/soc/codecs/ad193x.h renamed from sound/soc/codecs/ad1938.h +0 -0
Signature · 1 line
1.5.6.3
From dbfdf4c63056515c40d589799cf08c14e3962fef Mon Sep 17 00:00:00 2001
From: Barry Song <[email protected]>
Date: Fri, 19 Mar 2010 14:49:37 +0800
Subject: [PATCH 2/2] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
This patch extends ad1938 codec driver to support ad1936/7/8/9, ad1936/7 use i2c bus, ad1938/9 use spi bus.
--- sound/soc/codecs/Kconfig | 4 +- sound/soc/codecs/Makefile | 4 +- sound/soc/codecs/ad193x.c | 475 ++++++++++++++++++++++++--------------------- sound/soc/codecs/ad193x.h | 164 +++++++--------- 4 files changed, 334 insertions(+), 313 deletions(-)
sound/soc/codecs/Kconfig +2 -2
@@ -13,7 +13,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_L3 select SND_SOC_AC97_CODEC if SND_SOC_AC97_BUS select SND_SOC_AD1836 if SPI_MASTER - select SND_SOC_AD1938 if SPI_MASTER + select SND_SOC_AD193X if SND_SOC_I2C_AND_SPI select SND_SOC_AD1980 if SND_SOC_AC97_BUS select SND_SOC_ADS117X select SND_SOC_AD73311 if I2C
@@ -91,7 +91,7 @@ config SND_SOC_AC97_CODEC config SND_SOC_AD1836 tristate -config SND_SOC_AD1938 +config SND_SOC_AD193X tristate config SND_SOC_AD1980
sound/soc/codecs/Makefile +2 -2
@@ -1,6 +1,6 @@ snd-soc-ac97-objs := ac97.o snd-soc-ad1836-objs := ad1836.o -snd-soc-ad1938-objs := ad1938.o +snd-soc-ad193x-objs := ad193x.o snd-soc-ad1980-objs := ad1980.o snd-soc-ad73311-objs := ad73311.o snd-soc-ads117x-objs := ads117x.o
@@ -63,7 +63,7 @@ snd-soc-wm2000-objs := wm2000.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_AD193X) += snd-soc-ad193x.o obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o
sound/soc/codecs/ad193x.c +257 -218
724 lines not on this page · raw message
sound/soc/codecs/ad193x.h +73 -91
173 lines not on this page · raw message
Signature · 1 line
1.5.6.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Liam Girdwood
Acked-byRe: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 6 lines · Barry Song
It seems "git-format-patch -M" fails to detect this patch as a rename(maybe due to too many changed lines?), so I commit two times to get a readable patch and attach them.
1. rename ad1938 to ad193x
2. extend ad1938 codec driver to ad193x supporting ad1936/7/8/9 -barry
Attached patches look fine.
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
In reply to Barry SongQuoted 5 lines · Barry Song
It seems "git-format-patch -M" fails to detect this patch as a rename(maybe due to too many changed lines?), so I commit two times to get a readable patch and attach them.
1. rename ad1938 to ad193x
2. extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Please don't top post and please always follow the patch submission procedure documented in Documentation/SubmittingPatches. Even if problems with your MUA make it difficult to submit patches without using attachments you should always send one patch per message. Not following these rules makes your patches much more difficult to handle.
Since the patches aren't in line it's difficult to quote things when commenting but a few issues:
- Your rename patch didn't update the Makefile and Kconfig, which would cause build breakage if applied alone. You should always try to ensure that builds work even with a partially applied patch series since this allows things like bisection which step through the history to work.
- You've left the bus_probe() functions exported - now you've merged everything into one file this is no longer needed.
- The way you've factored out the bus probe and removal functions so that there's no code in the individual I2C and SPI functions means that the register() and unregister() functions could just be squashed into the bus_probe() and bus_remove() functions - all that the register and unregister functions are is the code that's shared between the bus
I've fixed the first issue by squashing the two patches together and the last one with a patch. The last issue isn't important, it's more for information.
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 13 lines · Mark Brown
Quoted 5 lines · Barry Song
It seems "git-format-patch -M" fails to detect this patch as a rename(maybe due to too many changed lines?), so I commit two times to get a readable patch and attach them.
1. rename ad1938 to ad193x
2. extend ad1938 codec driver to ad193x supporting ad1936/7/8/9Please don't top post and please always follow the patch submission procedure documented in
Documentation/SubmittingPatches. Even if problems with your MUA make it difficult to submit patches without using attachments you should always send one patch per message. Not following these rules makes your patches much more difficult to handle.
Quoted 8 lines
Since the patches aren't in line it's difficult to quote things when commenting but a few issues:
- Your rename patch didn't update the
MakefileandKconfig, which would cause build breakage if applied alone. You should always try to ensure that builds work even with a partially applied patch series since this allows things like bisection which step through the history to work.
Yes. if i split into two patches, i should change Makefile and Kconfig for the 1st one.
Quoted 3 lines
- You've left the
bus_probe()functions exported - now you've merged everything into one file this is no longer needed.
Yes. i noticed this too after i sent the patch.
Quoted 7 lines
- The way you've factored out the bus probe and removal functions so that there's no code in the individual I2C and SPI functions means that the
register()andunregister()functions could just be squashed into thebus_probe()andbus_remove()functions - all that the register and unregister functions are is the code that's shared between the bus
if so, it likes register/unregister should be moved into probe/remove even for codecs with single codec?
Quoted 5 lines
I've fixed the first issue by squashing the two patches together and the last one with a patch. The last issue isn't important, it's more for information.
Thanks for your help to fix issues.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [Uclinux-dist-devel] [PATCH 1/4] extend ad1938 codec driver to ad193x supporting ad1936/7/8/9
Quoted 11 lines · Barry Song
On Fri, Mar 19, 2010 at 8:24 PM, Mark Brown
Quoted 6 lines
- The way you've factored out the bus probe and removal functions so that there's no code in the individual I2C and SPI functions means that the
register()andunregister()functions could just be squashed into thebus_probe()andbus_remove()functions - all that the register and unregister functions are is the code that's shared between the busif so, it likes register/unregister should be moved into probe/remove even for codecs with single codec?
I'm assuming you mean single bus? If the code is structured like yours with nothing in the per-bus probe/remove then definitely. Note that sometimes drivers do keep a split for multiple buses since the hardware supports multiple buses but they've not all been implemented yet.