All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: alsa-devel@alsa-project.org, Kukjin Kim <kgene.kim@samsung.com>,
	t.figa@samsung.com, Maurus Cuelenaere <mcuelenaere@gmail.com>,
	lgirdwood@gmail.com, Mark Brown <broonie@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/4] ASoC: s3c64xx/smartq: use dynamic registration
Date: Mon, 14 Jul 2014 14:40:42 +0200	[thread overview]
Message-ID: <53C3CFCA.9050800@metafoo.de> (raw)
In-Reply-To: <4755712.cJmZ5fnaQH@wuerfel>

[...]
> 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 <arnd@arndb.de>
>
>   ./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 <linux/spi/spi_gpio.h>
>   #include <linux/usb/gpio_vbus.h>
>   #include <linux/platform_data/s3c-hsotg.h>
> -#include <linux/platform_data/asoc-s3c-smartq.h>

#include <linux/gpio/driver.h>

>
>   #include <asm/mach-types.h>
>   #include <asm/mach/map.h>
> @@ -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 <sound/soc.h>
>   #include <sound/jack.h>

#include <linux/gpio/consumer.h>

>
[..]
> -
> -	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);

WARNING: multiple messages have this Message-ID (diff)
From: lars@metafoo.de (Lars-Peter Clausen)
To: linux-arm-kernel@lists.infradead.org
Subject: [alsa-devel] [PATCH 2/4] ASoC: s3c64xx/smartq: use dynamic registration
Date: Mon, 14 Jul 2014 14:40:42 +0200	[thread overview]
Message-ID: <53C3CFCA.9050800@metafoo.de> (raw)
In-Reply-To: <4755712.cJmZ5fnaQH@wuerfel>

[...]
> 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 <arnd@arndb.de>
>
>   ./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 <linux/spi/spi_gpio.h>
>   #include <linux/usb/gpio_vbus.h>
>   #include <linux/platform_data/s3c-hsotg.h>
> -#include <linux/platform_data/asoc-s3c-smartq.h>

#include <linux/gpio/driver.h>

>
>   #include <asm/mach-types.h>
>   #include <asm/mach/map.h>
> @@ -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 <sound/soc.h>
>   #include <sound/jack.h>

#include <linux/gpio/consumer.h>

>
[..]
> -
> -	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);

  reply	other threads:[~2014-07-14 12:40 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 13:45 [PATCH] ASoC: s3c64xx/smartq: use dynamic registration Arnd Bergmann
2014-07-11 13:45 ` Arnd Bergmann
2014-07-11 13:45 ` [PATCH 0/4] ASoC: samsung updates from arm testing Arnd Bergmann
2014-07-11 13:45   ` Arnd Bergmann
2014-07-11 13:54   ` Mark Brown
2014-07-11 13:54     ` Mark Brown
2014-07-12 12:35     ` Arnd Bergmann
2014-07-12 12:35       ` Arnd Bergmann
2014-07-11 13:45 ` [PATCH 1/4] ASoC: samsung: add explicit i2c/spi dependencies Arnd Bergmann
2014-07-11 13:45   ` Arnd Bergmann
2014-07-14 18:51   ` Mark Brown
2014-07-14 18:51     ` Mark Brown
2014-07-11 13:45 ` [PATCH 2/4] ASoC: s3c64xx/smartq: use dynamic registration Arnd Bergmann
2014-07-11 13:45   ` Arnd Bergmann
2014-07-12 15:27   ` Lars-Peter Clausen
2014-07-12 15:27     ` [alsa-devel] " Lars-Peter Clausen
2014-07-12 19:49     ` Mark Brown
2014-07-12 19:49       ` [alsa-devel] " Mark Brown
2014-07-13 13:36       ` Lars-Peter Clausen
2014-07-13 13:36         ` [alsa-devel] " Lars-Peter Clausen
2014-07-14 12:15         ` Arnd Bergmann
2014-07-14 12:15           ` [alsa-devel] " Arnd Bergmann
2014-07-14 12:40           ` Lars-Peter Clausen [this message]
2014-07-14 12:40             ` Lars-Peter Clausen
2014-07-14 15:46             ` Arnd Bergmann
2014-07-14 15:46               ` [alsa-devel] " Arnd Bergmann
2014-07-14 16:18               ` Lars-Peter Clausen
2014-07-14 16:18                 ` [alsa-devel] " Lars-Peter Clausen
2014-07-14 18:23                 ` Arnd Bergmann
2014-07-14 18:23                   ` [alsa-devel] " Arnd Bergmann
2014-07-14 18:32                   ` Lars-Peter Clausen
2014-07-14 18:32                     ` [alsa-devel] " Lars-Peter Clausen
2014-07-14 18:36                   ` Mark Brown
2014-07-14 18:36                     ` [alsa-devel] " Mark Brown
2014-07-15  7:19                     ` Arnd Bergmann
2014-07-15  7:19                       ` Arnd Bergmann
2014-07-15  7:36                       ` Alexandre Courbot
2014-07-15  7:36                         ` Alexandre Courbot
2014-07-15  7:58                         ` Lars-Peter Clausen
2014-07-15  7:58                           ` [alsa-devel] " Lars-Peter Clausen
2014-07-15  9:14                           ` Alexandre Courbot
2014-07-15  9:14                             ` Alexandre Courbot
2014-07-16  3:00                             ` Alexandre Courbot
2014-07-16  3:00                               ` Alexandre Courbot
2014-07-16  7:12                               ` Thierry Reding
2014-07-16  7:12                                 ` Thierry Reding
2014-07-16  7:28                                 ` Alexandre Courbot
2014-07-16  7:28                                   ` Alexandre Courbot
2014-07-16  7:51                                   ` Thierry Reding
2014-07-16  7:51                                     ` Thierry Reding
2014-07-16  8:50                                     ` Rob Jones
2014-07-16  8:50                                       ` Rob Jones
2014-07-16 11:09                                       ` Thierry Reding
2014-07-16 11:09                                         ` Thierry Reding
2014-07-23 15:20                                         ` Linus Walleij
2014-07-23 15:20                                           ` Linus Walleij
2014-07-17  4:28                                       ` Alexandre Courbot
2014-07-17  4:28                                         ` Alexandre Courbot
2014-07-17  7:44                                         ` Thierry Reding
2014-07-17  7:44                                           ` Thierry Reding
2014-07-17  8:55                                           ` Alexandre Courbot
2014-07-17  8:55                                             ` Alexandre Courbot
2014-07-17 10:17                                             ` Mark Brown
2014-07-17 10:17                                               ` Mark Brown
2014-07-17 10:41                                               ` Thierry Reding
2014-07-17 10:41                                                 ` Thierry Reding
2014-07-17 10:58                                                 ` Lars-Peter Clausen
2014-07-17 10:58                                                   ` Lars-Peter Clausen
2014-07-17 11:05                                                 ` Mark Brown
2014-07-17 11:05                                                   ` Mark Brown
2014-07-21  3:36                                                   ` Alexandre Courbot
2014-07-21  3:36                                                     ` Alexandre Courbot
2014-07-21 10:04                                                     ` Mark Brown
2014-07-21 10:04                                                       ` [alsa-devel] " Mark Brown
2014-07-21 14:19                                                       ` Alexandre Courbot
2014-07-21 14:19                                                         ` Alexandre Courbot
2014-07-16  9:48                                   ` Mark Brown
2014-07-16  9:48                                     ` Mark Brown
2014-07-24 15:10                                   ` Alexandre Courbot
2014-07-24 15:10                                     ` Alexandre Courbot
2014-07-15 10:39                         ` Mark Brown
2014-07-15 10:39                           ` Mark Brown
2014-07-14 15:58         ` Mark Brown
2014-07-14 15:58           ` [alsa-devel] " Mark Brown
2014-07-11 13:45 ` [PATCH 2/4] ASoC: samsung/smartq: " Arnd Bergmann
2014-07-11 13:45   ` Arnd Bergmann
2014-07-11 13:45 ` [PATCH 3/4] ASoC: samsung: s3c24xx dmaengine follow-up Arnd Bergmann
2014-07-11 13:45   ` Arnd Bergmann
2014-07-14 18:51   ` Mark Brown
2014-07-14 18:51     ` Mark Brown
2014-07-11 13:45 ` [PATCH 4/4] ASoC: samsung: remove unused DMA data Arnd Bergmann
2014-07-11 13:45   ` Arnd Bergmann
2014-07-14 18:54   ` Mark Brown
2014-07-14 18:54     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53C3CFCA.9050800@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=kgene.kim@samsung.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mcuelenaere@gmail.com \
    --cc=t.figa@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.