@@ -859,6 +859,17 @@ static struct platform_device wm9712_device = {
.id = -1,
};
+static struct gpiod_lookup_table tosa_audio_gpio_table = {
+ .dev_id = "tosa-audio",
+ .table = {
+ GPIO_LOOKUP("tc6393xb",
+ TOSA_GPIO_L_MUTE - TOSA_TC6393XB_GPIO_BASE,
+ "l-mute", GPIO_ACTIVE_HIGH),
+ { },
+ },
+};
+
+
static struct platform_device tosa_audio_device = {
.name = "tosa-audio",
.id = -1,
@@ -916,6 +927,7 @@ static void __init tosa_init(void)
PMCR = 0x01;
gpiod_add_lookup_table(&tosa_mci_gpio_table);
+ gpiod_add_lookup_table(&tosa_audio_gpio_table);
pxa_set_mci_info(&tosa_mci_platform_data);
pxa_set_ficp_info(&tosa_ficp_platform_data);
pxa_set_i2c_info(NULL);
@@ -16,14 +16,13 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/device.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <asm/mach-types.h>
-#include <mach/tosa.h>
#include <linux/platform_data/asoc-pxa.h>
#define TOSA_HP 0
@@ -35,6 +34,7 @@
static int tosa_jack_func;
static int tosa_spk_func;
+static struct gpio_desc *l_mute_gpio;
static void tosa_ext_control(struct snd_soc_dapm_context *dapm)
{
@@ -128,7 +128,7 @@ static int tosa_set_spk(struct snd_kcontrol *kcontrol,
static int tosa_hp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- gpio_set_value(TOSA_GPIO_L_MUTE, SND_SOC_DAPM_EVENT_ON(event) ? 1 : 0);
+ gpiod_set_value(l_mute_gpio, SND_SOC_DAPM_EVENT_ON(event) ? 1 : 0);
return 0;
}
@@ -222,25 +222,23 @@ static int tosa_probe(struct platform_device *pdev)
struct snd_soc_card *card = ⤩
int ret;
- ret = gpio_request_one(TOSA_GPIO_L_MUTE, GPIOF_OUT_INIT_LOW,
- "Headphone Jack");
+ l_mute_gpio = devm_gpiod_get(&pdev->dev, "l-mute", GPIOD_OUT_LOW);
+ ret = PTR_ERR_OR_ZERO(l_mute_gpio);
if (ret)
return ret;
card->dev = &pdev->dev;
ret = devm_snd_soc_register_card(&pdev->dev, card);
- if (ret) {
+ if (ret)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
- gpio_free(TOSA_GPIO_L_MUTE);
- }
+
return ret;
}
static int tosa_remove(struct platform_device *pdev)
{
- gpio_free(TOSA_GPIO_L_MUTE);
return 0;
}
The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table. Cc: Mark Brown <broonie@kernel.org> Cc: alsa-devel@alsa-project.org Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- arch/arm/mach-pxa/tosa.c | 12 ++++++++++++ sound/soc/pxa/tosa.c | 16 +++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-)