From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lars-Peter Clausen Subject: Re: [PATCH 2/4] ASoC: s3c64xx/smartq: use dynamic registration Date: Mon, 14 Jul 2014 14:40:42 +0200 Message-ID: <53C3CFCA.9050800@metafoo.de> References: <1405086308-1461192-1-git-send-email-arnd@arndb.de> <20140712194903.GB6800@sirena.org.uk> <53C28B74.6010401@metafoo.de> <4755712.cJmZ5fnaQH@wuerfel> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp-out-084.synserver.de (smtp-out-084.synserver.de [212.40.185.84]) by alsa0.perex.cz (Postfix) with ESMTP id 55572261A3D for ; Mon, 14 Jul 2014 14:40:40 +0200 (CEST) In-Reply-To: <4755712.cJmZ5fnaQH@wuerfel> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Arnd Bergmann Cc: alsa-devel@alsa-project.org, Kukjin Kim , t.figa@samsung.com, Maurus Cuelenaere , lgirdwood@gmail.com, Mark Brown , linux-arm-kernel@lists.infradead.org List-Id: alsa-devel@alsa-project.org [...] > I've given it a try now. Can you confirm that this is a valid transformation? > > If it's ok, I'll fold it into the original patch and re-send. > > Signed-off-by: Arnd Bergmann > > ./arch/arm/mach-s3c64xx/mach-smartq.c | 15 ++++++++------- > ./sound/soc/samsung/smartq_wm8987.c | 19 +++++++------------ > ./include/linux/platform_data/asoc-s3c-smartq.h | 10 ---------- > 3 files changed, 15 insertions(+), 29 deletions(-) > > diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c > index 4c111f60dbf2..dce449c0e855 100644 > --- a/arch/arm/mach-s3c64xx/mach-smartq.c > +++ b/arch/arm/mach-s3c64xx/mach-smartq.c > @@ -20,7 +20,6 @@ > #include > #include > #include > -#include #include > > #include > #include > @@ -380,9 +379,12 @@ void __init smartq_map_io(void) > smartq_lcd_mode_set(); > } > > -static const __initconst struct smartq_audio_pdata smartq_audio_pdata = { > - .gpio_jack = S3C64XX_GPL(12), > - .gpio_amp = S3C64XX_GPK(12), > +static struct gpiod_lookup_table smartq_audio_gpios = { > + .dev_id = "smartq-audio", > + .table = { > + GPIO_LOOKUP("GPL", 12, "headphone detect", 0), > + GPIO_LOOKUP("GPK", 12, "amplifiers shutdown", GPIO_ACTIVE_HIGH), There is no such thing as GPIO_ACTIVE_HIGH, just 0 for flags. This needs a { } terminating entry. > + }, > }; > > void __init smartq_machine_init(void) > @@ -404,7 +406,6 @@ void __init smartq_machine_init(void) > > platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices)); > > - platform_device_register_data(NULL, "smartq-audio", -1, > - &smartq_audio_pdata, > - sizeof (smartq_audio_pdata)); > + platform_device_register_simple("smartq-audio", -1, NULL, 0); > + gpiod_add_lookup_table(&smartq_audio_gpios); To avoid a extra round of -EPROBE_DEFER the lookup table should be registered before the device. > } [...] > diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c > index 8c4a0a285ce7..8da7c67903c6 100644 > --- a/sound/soc/samsung/smartq_wm8987.c > +++ b/sound/soc/samsung/smartq_wm8987.c > @@ -19,8 +19,6 @@ > #include > #include #include > [..] > - > - smartq_jack_gpios[0].gpio = pdata->gpio_jack; smartq_jack_gpios[0].gpiod_dev = &pdev->dev; > + platform_set_drvdata(pdev, gpio); This unfortunately wont work. snd_soc_register_card() will overwrite the devices drvdata. Use snd_soc_card_set_drvdata(card, gpio) and in the speaker event handler snd_soc_card_get_drvdata(w->dapm->card); From mboxrd@z Thu Jan 1 00:00:00 1970 From: lars@metafoo.de (Lars-Peter Clausen) Date: Mon, 14 Jul 2014 14:40:42 +0200 Subject: [alsa-devel] [PATCH 2/4] ASoC: s3c64xx/smartq: use dynamic registration In-Reply-To: <4755712.cJmZ5fnaQH@wuerfel> References: <1405086308-1461192-1-git-send-email-arnd@arndb.de> <20140712194903.GB6800@sirena.org.uk> <53C28B74.6010401@metafoo.de> <4755712.cJmZ5fnaQH@wuerfel> Message-ID: <53C3CFCA.9050800@metafoo.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org [...] > I've given it a try now. Can you confirm that this is a valid transformation? > > If it's ok, I'll fold it into the original patch and re-send. > > Signed-off-by: Arnd Bergmann > > ./arch/arm/mach-s3c64xx/mach-smartq.c | 15 ++++++++------- > ./sound/soc/samsung/smartq_wm8987.c | 19 +++++++------------ > ./include/linux/platform_data/asoc-s3c-smartq.h | 10 ---------- > 3 files changed, 15 insertions(+), 29 deletions(-) > > diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c > index 4c111f60dbf2..dce449c0e855 100644 > --- a/arch/arm/mach-s3c64xx/mach-smartq.c > +++ b/arch/arm/mach-s3c64xx/mach-smartq.c > @@ -20,7 +20,6 @@ > #include > #include > #include > -#include #include > > #include > #include > @@ -380,9 +379,12 @@ void __init smartq_map_io(void) > smartq_lcd_mode_set(); > } > > -static const __initconst struct smartq_audio_pdata smartq_audio_pdata = { > - .gpio_jack = S3C64XX_GPL(12), > - .gpio_amp = S3C64XX_GPK(12), > +static struct gpiod_lookup_table smartq_audio_gpios = { > + .dev_id = "smartq-audio", > + .table = { > + GPIO_LOOKUP("GPL", 12, "headphone detect", 0), > + GPIO_LOOKUP("GPK", 12, "amplifiers shutdown", GPIO_ACTIVE_HIGH), There is no such thing as GPIO_ACTIVE_HIGH, just 0 for flags. This needs a { } terminating entry. > + }, > }; > > void __init smartq_machine_init(void) > @@ -404,7 +406,6 @@ void __init smartq_machine_init(void) > > platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices)); > > - platform_device_register_data(NULL, "smartq-audio", -1, > - &smartq_audio_pdata, > - sizeof (smartq_audio_pdata)); > + platform_device_register_simple("smartq-audio", -1, NULL, 0); > + gpiod_add_lookup_table(&smartq_audio_gpios); To avoid a extra round of -EPROBE_DEFER the lookup table should be registered before the device. > } [...] > diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c > index 8c4a0a285ce7..8da7c67903c6 100644 > --- a/sound/soc/samsung/smartq_wm8987.c > +++ b/sound/soc/samsung/smartq_wm8987.c > @@ -19,8 +19,6 @@ > #include > #include #include > [..] > - > - smartq_jack_gpios[0].gpio = pdata->gpio_jack; smartq_jack_gpios[0].gpiod_dev = &pdev->dev; > + platform_set_drvdata(pdev, gpio); This unfortunately wont work. snd_soc_register_card() will overwrite the devices drvdata. Use snd_soc_card_set_drvdata(card, gpio) and in the speaker event handler snd_soc_card_get_drvdata(w->dapm->card);