* [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device
@ 2014-10-21 21:15 Dmitry Eremin-Solenikov
2014-10-21 21:15 ` [PATCH V2 2/2] ASoC: pxa: Convert spitz to use snd_soc_register_card() Dmitry Eremin-Solenikov
2014-10-22 8:46 ` [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device Arnd Bergmann
0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-21 21:15 UTC (permalink / raw)
To: linux-arm-kernel
Register spitz-audio device to be used by ASoC driver.
[V2: Removed ifdefs around spitz_audio_init].
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
arch/arm/mach-pxa/spitz.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 840c3a4..af1dea3 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -924,6 +924,19 @@ static inline void spitz_i2c_init(void) {}
#endif
/******************************************************************************
+ * Audio devices
+ ******************************************************************************/
+static struct platform_device spitz_audio_device = {
+ .name = "spitz-audio",
+ .id = -1,
+};
+
+static inline void spitz_audio_init(void)
+{
+ platform_device_register(&spitz_audio_device);
+}
+
+/******************************************************************************
* Machine init
******************************************************************************/
static void spitz_poweroff(void)
@@ -970,6 +983,7 @@ static void __init spitz_init(void)
spitz_nor_init();
spitz_nand_init();
spitz_i2c_init();
+ spitz_audio_init();
}
static void __init spitz_fixup(struct tag *tags, char **cmdline)
--
2.1.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH V2 2/2] ASoC: pxa: Convert spitz to use snd_soc_register_card()
2014-10-21 21:15 [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device Dmitry Eremin-Solenikov
@ 2014-10-21 21:15 ` Dmitry Eremin-Solenikov
2014-10-22 8:46 ` [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device Arnd Bergmann
1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-21 21:15 UTC (permalink / raw)
To: linux-arm-kernel
Use snd_soc_register_card() instead of creating a "soc-audio" platform device.
[V2: mention spitz in commit message instead of poodle.]
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
sound/soc/pxa/spitz.c | 52 +++++++++++++++++++++++++++------------------------
1 file changed, 28 insertions(+), 24 deletions(-)
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
index 1373b01..d7d5fb2 100644
--- a/sound/soc/pxa/spitz.c
+++ b/sound/soc/pxa/spitz.c
@@ -305,19 +305,15 @@ static struct snd_soc_card snd_soc_spitz = {
.num_dapm_routes = ARRAY_SIZE(spitz_audio_map),
};
-static struct platform_device *spitz_snd_device;
-
-static int __init spitz_init(void)
+static int spitz_probe(struct platform_device *pdev)
{
+ struct snd_soc_card *card = &snd_soc_spitz;
int ret;
- if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita()))
- return -ENODEV;
-
- if (machine_is_borzoi() || machine_is_spitz())
- spitz_mic_gpio = SPITZ_GPIO_MIC_BIAS;
- else
+ if (machine_is_akita())
spitz_mic_gpio = AKITA_GPIO_MIC_BIAS;
+ else
+ spitz_mic_gpio = SPITZ_GPIO_MIC_BIAS;
ret = gpio_request(spitz_mic_gpio, "MIC GPIO");
if (ret)
@@ -327,37 +323,45 @@ static int __init spitz_init(void)
if (ret)
goto err2;
- spitz_snd_device = platform_device_alloc("soc-audio", -1);
- if (!spitz_snd_device) {
- ret = -ENOMEM;
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+ if (ret) {
+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
+ ret);
goto err2;
}
- platform_set_drvdata(spitz_snd_device, &snd_soc_spitz);
-
- ret = platform_device_add(spitz_snd_device);
- if (ret)
- goto err3;
-
return 0;
-err3:
- platform_device_put(spitz_snd_device);
err2:
gpio_free(spitz_mic_gpio);
err1:
return ret;
}
-static void __exit spitz_exit(void)
+static int spitz_remove(struct platform_device *pdev)
{
- platform_device_unregister(spitz_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
gpio_free(spitz_mic_gpio);
+ return 0;
}
-module_init(spitz_init);
-module_exit(spitz_exit);
+static struct platform_driver spitz_driver = {
+ .driver = {
+ .name = "spitz-audio",
+ .owner = THIS_MODULE,
+ .pm = &snd_soc_pm_ops,
+ },
+ .probe = spitz_probe,
+ .remove = spitz_remove,
+};
+
+module_platform_driver(spitz_driver);
MODULE_AUTHOR("Richard Purdie");
MODULE_DESCRIPTION("ALSA SoC Spitz");
MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:spitz-audio");
--
2.1.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device
2014-10-21 21:15 [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device Dmitry Eremin-Solenikov
2014-10-21 21:15 ` [PATCH V2 2/2] ASoC: pxa: Convert spitz to use snd_soc_register_card() Dmitry Eremin-Solenikov
@ 2014-10-22 8:46 ` Arnd Bergmann
2014-10-22 9:42 ` Dmitry Eremin-Solenikov
1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2014-10-22 8:46 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday 22 October 2014 01:15:32 Dmitry Eremin-Solenikov wrote:
> Register spitz-audio device to be used by ASoC driver.
>
> [V2: Removed ifdefs around spitz_audio_init].
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>
A more general note about your patch description above: when you
write about the changes between versions, put that below the ---
line under your Signed-off-by. Aside from that, your changelog
entry would actually benefit from more verbosity: explain what the
purpose of this is, not just what it does.
> /**************************************************************************
> ****>
> + * Audio devices
> +
> ***************************************************************************
> ***/ +static struct platform_device spitz_audio_device = {
> + .name = "spitz-audio",
> + .id = -1,
> +};
> +
> +static inline void spitz_audio_init(void)
> +{
> + platform_device_register(&spitz_audio_device);
> +}+
I realize that the file has more of these, but it would be better
for a number of reasons to use 'platform_device_register_simple'
instead of platform_device_register. statically defining platform
devices (or any other device) is not recommended.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device
2014-10-22 8:46 ` [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device Arnd Bergmann
@ 2014-10-22 9:42 ` Dmitry Eremin-Solenikov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-22 9:42 UTC (permalink / raw)
To: linux-arm-kernel
2014-10-22 12:46 GMT+04:00 Arnd Bergmann <arnd@arndb.de>:
> On Wednesday 22 October 2014 01:15:32 Dmitry Eremin-Solenikov wrote:
>> Register spitz-audio device to be used by ASoC driver.
>>
>> [V2: Removed ifdefs around spitz_audio_init].
>>
>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>> ---
>>
>
> A more general note about your patch description above: when you
> write about the changes between versions, put that below the ---
> line under your Signed-off-by. Aside from that, your changelog
> entry would actually benefit from more verbosity: explain what the
> purpose of this is, not just what it does.
Thanks. I understood your point regarding the changelog.
The commit message seemed pretty much obvious - due to
the second patch. I can redo it - I think those two patches should
go through different trees, so the connection will be lost.
>
>> /**************************************************************************
>> ****>
>> + * Audio devices
>> +
>> ***************************************************************************
>> ***/ +static struct platform_device spitz_audio_device = {
>> + .name = "spitz-audio",
>> + .id = -1,
>> +};
>> +
>> +static inline void spitz_audio_init(void)
>> +{
>> + platform_device_register(&spitz_audio_device);
>> +}+
>
> I realize that the file has more of these, but it would be better
> for a number of reasons to use 'platform_device_register_simple'
> instead of platform_device_register. statically defining platform
> devices (or any other device) is not recommended.
Ack. I did not want to use approach different from the rest of
spitz.c, but it looks it is time to change. Will send V3 later today,
after (hopefully) receiving feedback from ASoC team.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-22 9:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 21:15 [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device Dmitry Eremin-Solenikov
2014-10-21 21:15 ` [PATCH V2 2/2] ASoC: pxa: Convert spitz to use snd_soc_register_card() Dmitry Eremin-Solenikov
2014-10-22 8:46 ` [PATCH V2 1/2] ARM: pxa: spitz: register spitz-audio device Arnd Bergmann
2014-10-22 9:42 ` Dmitry Eremin-Solenikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox