[alsa-devel] [PATCH 0/5] fix SIU and Migo-R sound for 2.6.37
Conversion to the multi-component design has broken the SIU driver and its users. This patch series fixes the breakages. All patches against next/master, but one of them (#4) shall also go into 2.6.36.
Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/
The sh/siu ASoC driver doesn't compile because of a function defined static in the source and extern in a header. Remove the unneeded declaration in the header.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de --- sound/soc/sh/siu.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/sound/soc/sh/siu.h b/sound/soc/sh/siu.h index aa239ff..1c0e1f7 100644 --- a/sound/soc/sh/siu.h +++ b/sound/soc/sh/siu.h @@ -182,7 +182,6 @@ static inline u32 siu_read32(u32 __iomem *addr) #define SIU_BRRB (0x10c / sizeof(u32))
extern struct snd_soc_platform_driver siu_platform; -extern struct snd_soc_dai_driver siu_i2s_dai; extern struct siu_info *siu_i2s_data;
int siu_init_port(int port, struct siu_port **port_info, struct snd_card *card);
On Fri, Sep 17, 2010 at 12:29:46PM +0200, Guennadi Liakhovetski wrote:
The sh/siu ASoC driver doesn't compile because of a function defined static in the source and extern in a header. Remove the unneeded declaration in the header.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de
Applied, thanks.
Recent ASoC changes unified all PCM names, fix the platform code to match.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de --- arch/sh/kernel/cpu/sh4a/setup-sh7722.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c index 156ccc9..d551ed8 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c @@ -551,7 +551,7 @@ static struct resource siu_resources[] = { };
static struct platform_device siu_device = { - .name = "sh_siu", + .name = "siu-pcm-audio", .id = -1, .dev = { .platform_data = &siu_platform_data,
On Fri, Sep 17, 2010 at 12:30:00PM +0200, Guennadi Liakhovetski wrote:
Recent ASoC changes unified all PCM names, fix the platform code to match.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de
Applied, thanks.
All ASoC codecs are called in lower case, adjust wm8978 to match them and also to match its so far only user - the sh7722 migor board.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de --- sound/soc/codecs/wm8978.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index 676a430..a521678 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c @@ -1038,7 +1038,7 @@ MODULE_DEVICE_TABLE(i2c, wm8978_i2c_id);
static struct i2c_driver wm8978_i2c_driver = { .driver = { - .name = "WM8978-codec", + .name = "wm8978-codec", .owner = THIS_MODULE, }, .probe = wm8978_i2c_probe,
On Fri, Sep 17, 2010 at 12:30:05PM +0200, Guennadi Liakhovetski wrote:
All ASoC codecs are called in lower case, adjust wm8978 to match them and also to match its so far only user - the sh7722 migor board.
.driver = {
.name = "WM8978-codec",
.name = "wm8978-codec",
Better yet would be to rename this to wm8978 (and adjust the board).
On Fri, 17 Sep 2010, Mark Brown wrote:
On Fri, Sep 17, 2010 at 12:30:05PM +0200, Guennadi Liakhovetski wrote:
All ASoC codecs are called in lower case, adjust wm8978 to match them and also to match its so far only user - the sh7722 migor board.
.driver = {
.name = "WM8978-codec",
.name = "wm8978-codec",
Better yet would be to rename this to wm8978 (and adjust the board).
Well, what does "better" mean? That it's your suggestion or your requirement for this patch to be accepted? I grepped codecs/ and have found enough of both versions, so, maybe we can take it like this and then decide upon a unified naming?
Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/
On Sun, Sep 19, 2010 at 05:59:50PM +0200, Guennadi Liakhovetski wrote:
On Fri, 17 Sep 2010, Mark Brown wrote:
Better yet would be to rename this to wm8978 (and adjust the board).
Well, what does "better" mean? That it's your suggestion or your requirement for this patch to be accepted? I grepped codecs/ and have found enough of both versions, so, maybe we can take it like this and then decide upon a unified naming?
I mean I've already done a version that renames everything to wm8978. I don't like the other users for I2C devices terribly much either and will post patches for at least the drivers I'm responsible for soon.
On Fri, 2010-09-17 at 13:53 +0100, Mark Brown wrote:
On Fri, Sep 17, 2010 at 12:30:05PM +0200, Guennadi Liakhovetski wrote:
All ASoC codecs are called in lower case, adjust wm8978 to match them and also to match its so far only user - the sh7722 migor board.
.driver = {
.name = "WM8978-codec",
.name = "wm8978-codec",
Better yet would be to rename this to wm8978 (and adjust the board).
Fwiw, the reason for the "-codec" suffix was to distinguish codec devices from their other multi-function IC siblings. It also makes sense here to use convention with the device naming too (even if the device is single purpose).
Liam
On Mon, Sep 20, 2010 at 09:12:52AM +0100, Liam Girdwood wrote:
Fwiw, the reason for the "-codec" suffix was to distinguish codec devices from their other multi-function IC siblings. It also makes sense
Yes, MFDs do need something to distinguish them.
here to use convention with the device naming too (even if the device is single purpose).
I don't find it adds much more than making the name longer to type - we always use the name in a context where it's fairly obvious that the device is a CODEC.
The clkdev API doesn't use .name and .id members of struct clk for clock lookup. Instead clocks should be added to a lookup list. Without this patch audio om the Migo-R board fails silently.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de ---
As mentioned before - please also apply to 2.6.36.
sound/soc/sh/migor.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sh/migor.c b/sound/soc/sh/migor.c index 866d78f..f462017 100644 --- a/sound/soc/sh/migor.c +++ b/sound/soc/sh/migor.c @@ -12,6 +12,7 @@ #include <linux/firmware.h> #include <linux/module.h>
+#include <asm/clkdev.h> #include <asm/clock.h>
#include <cpu/sh7722.h> @@ -40,12 +41,12 @@ static struct clk_ops siumckb_clk_ops = { };
static struct clk siumckb_clk = { - .name = "siumckb_clk", - .id = -1, .ops = &siumckb_clk_ops, .rate = 0, /* initialised at run-time */ };
+static struct clk_lookup *siumckb_lookup; + static int migor_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -177,6 +178,13 @@ static int __init migor_init(void) if (ret < 0) return ret;
+ siumckb_lookup = clkdev_alloc(&siumckb_clk, "siumckb_clk", NULL); + if (!siumckb_lookup) { + ret = -ENOMEM; + goto eclkdevalloc; + } + clkdev_add(siumckb_lookup); + /* Port number used on this machine: port B */ migor_snd_device = platform_device_alloc("soc-audio", 1); if (!migor_snd_device) { @@ -195,12 +203,15 @@ static int __init migor_init(void) epdevadd: platform_device_put(migor_snd_device); epdevalloc: + clkdev_drop(siumckb_lookup); +eclkdevalloc: clk_unregister(&siumckb_clk); return ret; }
static void __exit migor_exit(void) { + clkdev_drop(siumckb_lookup); clk_unregister(&siumckb_clk); platform_device_unregister(migor_snd_device); }
On Fri, Sep 17, 2010 at 12:30:11PM +0200, Guennadi Liakhovetski wrote:
The clkdev API doesn't use .name and .id members of struct clk for clock lookup. Instead clocks should be added to a lookup list. Without this patch audio om the Migo-R board fails silently.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de
As mentioned before - please also apply to 2.6.36.
Applied and merge up to -next. As I said, please submit patches against the kernel version they should be applied to and please submit separate serieses for separate verisons.
This patch fixes multiple bugs and a typo, occurred during the multi- component transition.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de --- sound/soc/sh/siu.h | 2 ++ sound/soc/sh/siu_dai.c | 41 +++++++++++++++++++++++++++++------------ sound/soc/sh/siu_pcm.c | 2 +- 3 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/sound/soc/sh/siu.h b/sound/soc/sh/siu.h index 1c0e1f7..9f4dcb9 100644 --- a/sound/soc/sh/siu.h +++ b/sound/soc/sh/siu.h @@ -98,7 +98,9 @@ enum { SIU_CLKB_EXT };
+struct device; struct siu_info { + struct device *dev; int port_id; u32 __iomem *pram; u32 __iomem *xram; diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c index 827940a..af53b64 100644 --- a/sound/soc/sh/siu_dai.c +++ b/sound/soc/sh/siu_dai.c @@ -71,8 +71,7 @@ struct port_flag { struct format_flag capture; };
-struct siu_info *siu_i2s_data = NULL; -EXPORT_SYMBOL_GPL(siu_i2s_data); +struct siu_info *siu_i2s_data;
static struct port_flag siu_flags[SIU_PORT_NUM] = { [SIU_PORT_A] = { @@ -113,7 +112,7 @@ static void siu_dai_start(struct siu_port *port_info) dev_dbg(port_info->pcm->card->dev, "%s\n", __func__);
/* Turn on SIU clock */ - pm_runtime_get_sync(port_info->pcm->card->dev); + pm_runtime_get_sync(info->dev);
/* Issue software reset to siu */ siu_write32(base + SIU_SRCTL, 0); @@ -160,7 +159,7 @@ static void siu_dai_stop(struct siu_port *port_info) siu_write32(base + SIU_SRCTL, 0);
/* Turn off SIU clock */ - pm_runtime_put_sync(port_info->pcm->card->dev); + pm_runtime_put_sync(info->dev); }
static void siu_dai_spbAselect(struct siu_port *port_info) @@ -675,20 +674,36 @@ static int siu_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, }
siu_clk = clk_get(dai->dev, siu_name); - if (IS_ERR(siu_clk)) + if (IS_ERR(siu_clk)) { + dev_err(dai->dev, "%s: cannot get a SIU clock: %ld\n", __func__, + PTR_ERR(siu_clk)); return PTR_ERR(siu_clk); + }
parent_clk = clk_get(dai->dev, parent_name); - if (!IS_ERR(parent_clk)) { - ret = clk_set_parent(siu_clk, parent_clk); - if (!ret) - clk_set_rate(siu_clk, freq); - clk_put(parent_clk); + if (IS_ERR(parent_clk)) { + ret = PTR_ERR(parent_clk); + dev_err(dai->dev, "cannot get a SIU clock parent: %d\n", ret); + goto epclkget; + } + + ret = clk_set_parent(siu_clk, parent_clk); + if (ret < 0) { + dev_err(dai->dev, "cannot reparent the SIU clock: %d\n", ret); + goto eclksetp; }
+ ret = clk_set_rate(siu_clk, freq); + if (ret < 0) + dev_err(dai->dev, "cannot set SIU clock rate: %d\n", ret); + + /* TODO: when clkdev gets reference counting we'll move these to siu_dai_shutdown() */ +eclksetp: + clk_put(parent_clk); +epclkget: clk_put(siu_clk);
- return 0; + return ret; }
static struct snd_soc_dai_ops siu_dai_ops = { @@ -700,7 +715,7 @@ static struct snd_soc_dai_ops siu_dai_ops = { };
static struct snd_soc_dai_driver siu_i2s_dai = { - .name = "sui-i2s-dai", + .name = "siu-i2s-dai", .playback = { .channels_min = 2, .channels_max = 2, @@ -727,6 +742,7 @@ static int __devinit siu_probe(struct platform_device *pdev) if (!info) return -ENOMEM; siu_i2s_data = info; + info->dev = &pdev->dev;
ret = request_firmware(&fw_entry, "siu_spb.bin", &pdev->dev); if (ret) @@ -828,6 +844,7 @@ static int __devexit siu_remove(struct platform_device *pdev)
static struct platform_driver siu_driver = { .driver = { + .owner = THIS_MODULE, .name = "siu-pcm-audio", }, .probe = siu_probe, diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c index d8c6139..ed29c9e 100644 --- a/sound/soc/sh/siu_pcm.c +++ b/sound/soc/sh/siu_pcm.c @@ -343,7 +343,7 @@ static int siu_pcm_open(struct snd_pcm_substream *ss) { /* Playback / Capture */ struct snd_soc_pcm_runtime *rtd = ss->private_data; - struct siu_platform *pdata = snd_soc_platform_get_drvdata(rtd->platform); + struct siu_platform *pdata = rtd->platform->dev->platform_data; struct siu_info *info = siu_i2s_data; struct siu_port *port_info = siu_port_info(ss); struct siu_stream *siu_stream;
On Fri, Sep 17, 2010 at 12:30:18PM +0200, Guennadi Liakhovetski wrote:
This patch fixes multiple bugs and a typo, occurred during the multi- component transition.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de
Applied, thanks.
On Fri, Sep 17, 2010 at 12:29:41PM +0200, Guennadi Liakhovetski wrote:
Conversion to the multi-component design has broken the SIU driver and its users. This patch series fixes the breakages. All patches against next/master, but one of them (#4) shall also go into 2.6.36.
Please don't do this. If you want a patch to go to Linus send it separately. If you do feel the need to include the patch in another series not for Linus for some reason then please include it at the start of the series so that it can be easily split out.
On Fri, 17 Sep 2010, Mark Brown wrote:
On Fri, Sep 17, 2010 at 12:29:41PM +0200, Guennadi Liakhovetski wrote:
Conversion to the multi-component design has broken the SIU driver and its users. This patch series fixes the breakages. All patches against next/master, but one of them (#4) shall also go into 2.6.36.
Please don't do this. If you want a patch to go to Linus send it separately. If you do feel the need to include the patch in another series not for Linus for some reason then please include it at the start of the series so that it can be easily split out.
Ok, sorry, but in fact this patch and the rest of the series are independent, so, it should be no problem just to pick it up from here, or do I have to re-send anything?
Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/
On Fri, Sep 17, 2010 at 02:35:09PM +0200, Guennadi Liakhovetski wrote:
Ok, sorry, but in fact this patch and the rest of the series are independent, so, it should be no problem just to pick it up from here, or do I have to re-send anything?
I've not yet tried applying it but I'd anticipate some breakage trying to do so due to the multi-component changes in the file in for-2.6.37. I'll do so later today or tomorrow, if it applies fine there's no need to resubmit.
On Fri, 17 Sep 2010, Mark Brown wrote:
On Fri, Sep 17, 2010 at 02:35:09PM +0200, Guennadi Liakhovetski wrote:
Ok, sorry, but in fact this patch and the rest of the series are independent, so, it should be no problem just to pick it up from here, or do I have to re-send anything?
I've not yet tried applying it
I did, worked fine - only with offsets. Otherwise, I certainly wouldn't suggest to take it directly.
but I'd anticipate some breakage trying to do so due to the multi-component changes in the file in for-2.6.37. I'll do so later today or tomorrow, if it applies fine there's no need to resubmit.
Good, thanks! Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/
participants (3)
-
Guennadi Liakhovetski
-
Liam Girdwood
-
Mark Brown