Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: pxa: z2: use gpio lookup for audio device

The audio device is allocated by the audio driver, and it uses a gpio
number from the mach/z2.h header file.

Change it to use a gpio lookup table for the device allocated by the
driver to keep the header file local to the machine.

Acked-by: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+13 -3
+11
arch/arm/mach-pxa/z2.c
··· 651 651 static inline void z2_spi_init(void) {} 652 652 #endif 653 653 654 + static struct gpiod_lookup_table z2_audio_gpio_table = { 655 + .dev_id = "soc-audio", 656 + .table = { 657 + GPIO_LOOKUP("gpio-pxa", GPIO37_ZIPITZ2_HEADSET_DETECT, 658 + "hsdet-gpio", GPIO_ACTIVE_HIGH), 659 + { }, 660 + }, 661 + }; 662 + 654 663 /****************************************************************************** 655 664 * Core power regulator 656 665 ******************************************************************************/ ··· 763 754 z2_leds_init(); 764 755 z2_keys_init(); 765 756 z2_pmic_init(); 757 + 758 + gpiod_add_lookup_table(&z2_audio_gpio_table); 766 759 767 760 pm_power_off = z2_power_off; 768 761 }
+2 -3
sound/soc/pxa/z2.c
··· 13 13 #include <linux/timer.h> 14 14 #include <linux/interrupt.h> 15 15 #include <linux/platform_device.h> 16 - #include <linux/gpio.h> 16 + #include <linux/gpio/consumer.h> 17 17 18 18 #include <sound/core.h> 19 19 #include <sound/pcm.h> ··· 22 22 23 23 #include <asm/mach-types.h> 24 24 #include <linux/platform_data/asoc-pxa.h> 25 - #include <mach/z2.h> 26 25 27 26 #include "../codecs/wm8750.h" 28 27 #include "pxa2xx-i2s.h" ··· 88 89 /* Headset jack detection gpios */ 89 90 static struct snd_soc_jack_gpio hs_jack_gpios[] = { 90 91 { 91 - .gpio = GPIO37_ZIPITZ2_HEADSET_DETECT, 92 92 .name = "hsdet-gpio", 93 93 .report = SND_JACK_HEADSET, 94 94 .debounce_time = 200, ··· 193 195 if (!z2_snd_device) 194 196 return -ENOMEM; 195 197 198 + hs_jack_gpios[0].gpiod_dev = &z2_snd_device->dev; 196 199 platform_set_drvdata(z2_snd_device, &snd_soc_z2); 197 200 ret = platform_device_add(z2_snd_device); 198 201