lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 19 Apr 2022 18:37:44 +0200
From:   Arnd Bergmann <arnd@...nel.org>
To:     robert.jarzmik@...e.fr, linux-arm-kernel@...ts.infradead.org
Cc:     Arnd Bergmann <arnd@...db.de>, Daniel Mack <daniel@...que.org>,
        Haojian Zhuang <haojian.zhuang@...il.com>,
        Marek Vasut <marek.vasut@...il.com>,
        Philipp Zabel <philipp.zabel@...il.com>,
        Lubomir Rintel <lkundrak@...sk>,
        Paul Parsons <lost.distance@...oo.com>,
        Tomas Cech <sleep_walker@...e.com>,
        Sergey Lapin <slapin@...fans.org>,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Dominik Brodowski <linux@...inikbrodowski.net>,
        Helge Deller <deller@....de>, Mark Brown <broonie@...nel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org,
        linux-ide@...r.kernel.org, linux-clk@...r.kernel.org,
        linux-pm@...r.kernel.org, linux-input@...r.kernel.org,
        patches@...nsource.cirrus.com, linux-leds@...r.kernel.org,
        linux-mmc@...r.kernel.org, linux-mtd@...ts.infradead.org,
        linux-rtc@...r.kernel.org, linux-usb@...r.kernel.org,
        linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        alsa-devel@...a-project.org
Subject: [PATCH 22/48] ARM: pxa: z2: use gpio lookup for audio device

From: Arnd Bergmann <arnd@...db.de>

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@...nel.org>
Cc: alsa-devel@...a-project.org
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Acked-by: Robert Jarzmik <robert.jarzmik@...e.fr>
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 arch/arm/mach-pxa/z2.c | 11 +++++++++++
 sound/soc/pxa/z2.c     |  5 ++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index 7eaeda269927..bb854e903c8f 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -651,6 +651,15 @@ static void __init z2_spi_init(void)
 static inline void z2_spi_init(void) {}
 #endif
 
+static struct gpiod_lookup_table z2_audio_gpio_table = {
+	.dev_id = "soc-audio",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", GPIO37_ZIPITZ2_HEADSET_DETECT,
+			    "hsdet-gpio", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 /******************************************************************************
  * Core power regulator
  ******************************************************************************/
@@ -755,6 +764,8 @@ static void __init z2_init(void)
 	z2_keys_init();
 	z2_pmic_init();
 
+	gpiod_add_lookup_table(&z2_audio_gpio_table);
+
 	pm_power_off = z2_power_off;
 }
 
diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c
index dc6c48e4738b..7f1c6bc69510 100644
--- a/sound/soc/pxa/z2.c
+++ b/sound/soc/pxa/z2.c
@@ -13,7 +13,7 @@
 #include <linux/timer.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -22,7 +22,6 @@
 
 #include <asm/mach-types.h>
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/z2.h>
 
 #include "../codecs/wm8750.h"
 #include "pxa2xx-i2s.h"
@@ -89,7 +88,6 @@ static struct snd_soc_jack_pin hs_jack_pins[] = {
 /* Headset jack detection gpios */
 static struct snd_soc_jack_gpio hs_jack_gpios[] = {
 	{
-		.gpio		= GPIO37_ZIPITZ2_HEADSET_DETECT,
 		.name		= "hsdet-gpio",
 		.report		= SND_JACK_HEADSET,
 		.debounce_time	= 200,
@@ -195,6 +193,7 @@ static int __init z2_init(void)
 	if (!z2_snd_device)
 		return -ENOMEM;
 
+	hs_jack_gpios[0].gpiod_dev = &z2_snd_device->dev;
 	platform_set_drvdata(z2_snd_device, &snd_soc_z2);
 	ret = platform_device_add(z2_snd_device);
 
-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ