* [PATCH v2 1/6] ASoC: samsung: bells: Drop unused include
2025-03-05 7:39 [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion Linus Walleij
@ 2025-03-05 7:39 ` Linus Walleij
2025-03-05 7:39 ` [PATCH v2 2/6] ASoC: samsung: littlemill: " Linus Walleij
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-03-05 7:39 UTC (permalink / raw)
To: Sylwester Nawrocki, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Bartosz Golaszewski
Cc: linux-sound, linux-arm-kernel, linux-gpio, Linus Walleij,
Bartosz Golaszewski
This file does not use the symbols from the legacy
<linux/gpio.h> header, so let's drop it.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
sound/soc/samsung/bells.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/samsung/bells.c b/sound/soc/samsung/bells.c
index 365b1aca4855c885e0b59a1101475d8edb86374f..b4c0857ae35134b58a125b0746af07a5fff040fa 100644
--- a/sound/soc/samsung/bells.c
+++ b/sound/soc/samsung/bells.c
@@ -7,7 +7,6 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/jack.h>
-#include <linux/gpio.h>
#include <linux/module.h>
#include "../codecs/wm5102.h"
--
2.48.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 2/6] ASoC: samsung: littlemill: Drop unused include
2025-03-05 7:39 [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion Linus Walleij
2025-03-05 7:39 ` [PATCH v2 1/6] ASoC: samsung: bells: Drop unused include Linus Walleij
@ 2025-03-05 7:39 ` Linus Walleij
2025-03-05 7:39 ` [PATCH v2 3/6] ASoC: samsung: lowland: " Linus Walleij
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-03-05 7:39 UTC (permalink / raw)
To: Sylwester Nawrocki, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Bartosz Golaszewski
Cc: linux-sound, linux-arm-kernel, linux-gpio, Linus Walleij,
Bartosz Golaszewski
This file does not use the symbols from the legacy
<linux/gpio.h> header, so let's drop it.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
sound/soc/samsung/littlemill.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c
index c5260e101c2a136001c6273200fa35740e618829..9fa5e3ff9215164491839d6ffdf499a3eeadfbaa 100644
--- a/sound/soc/samsung/littlemill.c
+++ b/sound/soc/samsung/littlemill.c
@@ -7,7 +7,6 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/jack.h>
-#include <linux/gpio.h>
#include <linux/module.h>
#include "../codecs/wm8994.h"
--
2.48.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 3/6] ASoC: samsung: lowland: Drop unused include
2025-03-05 7:39 [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion Linus Walleij
2025-03-05 7:39 ` [PATCH v2 1/6] ASoC: samsung: bells: Drop unused include Linus Walleij
2025-03-05 7:39 ` [PATCH v2 2/6] ASoC: samsung: littlemill: " Linus Walleij
@ 2025-03-05 7:39 ` Linus Walleij
2025-03-05 7:39 ` [PATCH v2 4/6] ASoC: samsung: speyside: Convert to GPIO descriptor Linus Walleij
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-03-05 7:39 UTC (permalink / raw)
To: Sylwester Nawrocki, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Bartosz Golaszewski
Cc: linux-sound, linux-arm-kernel, linux-gpio, Linus Walleij,
Bartosz Golaszewski
This file does not use the symbols from the legacy
<linux/gpio.h> header, so let's drop it.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
sound/soc/samsung/lowland.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/samsung/lowland.c b/sound/soc/samsung/lowland.c
index 702cb4cc1ce9f07e55ddf9435b19c4691e0236e5..d4088b72d43c2295102d850197f8b9eac50d7120 100644
--- a/sound/soc/samsung/lowland.c
+++ b/sound/soc/samsung/lowland.c
@@ -7,7 +7,6 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/jack.h>
-#include <linux/gpio.h>
#include <linux/module.h>
#include "../codecs/wm5100.h"
--
2.48.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 4/6] ASoC: samsung: speyside: Convert to GPIO descriptor
2025-03-05 7:39 [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion Linus Walleij
` (2 preceding siblings ...)
2025-03-05 7:39 ` [PATCH v2 3/6] ASoC: samsung: lowland: " Linus Walleij
@ 2025-03-05 7:39 ` Linus Walleij
2025-03-05 7:39 ` [PATCH v2 5/6] ASoC: samsung: tobermory: Drop unused include Linus Walleij
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-03-05 7:39 UTC (permalink / raw)
To: Sylwester Nawrocki, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Bartosz Golaszewski
Cc: linux-sound, linux-arm-kernel, linux-gpio, Linus Walleij
The Speyside ASoC uses a single GPIO from the WM8996
that we can provide from the local offset on that chip
rather than from the global GPIO numberspace as is being
done currently.
The offset 2 was done by calculating the base offset
for the CODEC (i.e. wm8996) GPIOs to 212, by reading
arch/arm/mach-s3c/gpio-samsung-s3c64xx.h and
arch/arm/mach-s3c/crag6410.h and adding up all the
offsets that were occasionally adding a +1 blank GPIO
between each GPIO provider.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Patch in a devm action to drop the gpiod table.
---
sound/soc/samsung/speyside.c | 47 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 40 insertions(+), 7 deletions(-)
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index 79476e8eb680984434a1198ff691ddd4b9fe07c1..d6b8c62e015a3114c7a746e1f754217ffacb7044 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -7,13 +7,13 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/jack.h>
-#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include "../codecs/wm8996.h"
#include "../codecs/wm9081.h"
-#define WM8996_HPSEL_GPIO 214
#define MCLK_AUDIO_RATE (512 * 48000)
static int speyside_set_bias_level(struct snd_soc_card *card,
@@ -105,6 +105,7 @@ static struct snd_soc_jack_pin speyside_headset_pins[] = {
},
};
+static struct gpio_desc *speyside_hpsel_gpio;
/* Default the headphone selection to active high */
static int speyside_jack_polarity;
@@ -123,7 +124,7 @@ static void speyside_set_polarity(struct snd_soc_component *component,
int polarity)
{
speyside_jack_polarity = !polarity;
- gpio_direction_output(WM8996_HPSEL_GPIO, speyside_jack_polarity);
+ gpiod_direction_output(speyside_hpsel_gpio, speyside_jack_polarity);
/* Re-run DAPM to make sure we're using the correct mic bias */
snd_soc_dapm_sync(snd_soc_component_get_dapm(component));
@@ -145,16 +146,22 @@ static int speyside_wm8996_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0);
struct snd_soc_component *component = dai->component;
+ enum gpiod_flags flags;
int ret;
ret = snd_soc_dai_set_sysclk(dai, WM8996_SYSCLK_MCLK2, 32768, 0);
if (ret < 0)
return ret;
- ret = gpio_request(WM8996_HPSEL_GPIO, "HP_SEL");
- if (ret != 0)
- pr_err("Failed to request HP_SEL GPIO: %d\n", ret);
- gpio_direction_output(WM8996_HPSEL_GPIO, speyside_jack_polarity);
+ if (speyside_jack_polarity)
+ flags = GPIOD_OUT_HIGH;
+ else
+ flags = GPIOD_OUT_LOW;
+ speyside_hpsel_gpio = devm_gpiod_get(rtd->card->dev,
+ "hp-sel",
+ flags);
+ if (IS_ERR(speyside_hpsel_gpio))
+ return PTR_ERR(speyside_hpsel_gpio);
ret = snd_soc_card_jack_new_pins(rtd->card, "Headset",
SND_JACK_LINEOUT | SND_JACK_HEADSET |
@@ -325,6 +332,26 @@ static struct snd_soc_card speyside = {
.late_probe = speyside_late_probe,
};
+static struct gpiod_lookup_table wm8996_gpiod_table = {
+ /* Hardcoded device name in board file mach-crag6410.c */
+ .dev_id = "speyside",
+ .table = {
+ /*
+ * This line was hardcoded to 214 in the global GPIO
+ * number space, S3C GPIO macros seems top set the
+ * wm8996 codec GPIO start offset to 212, so this will
+ * be GPIO 214 - 212 = 2 on the wm8996.
+ */
+ GPIO_LOOKUP("wm8996", 2, "hp-sel", GPIO_ACTIVE_HIGH),
+ { },
+ },
+};
+
+static void speyside_gpiod_table_action(void *data)
+{
+ gpiod_remove_lookup_table(&wm8996_gpiod_table);
+}
+
static int speyside_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &speyside;
@@ -332,6 +359,12 @@ static int speyside_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
+ gpiod_add_lookup_table(&wm8996_gpiod_table);
+ ret = devm_add_action_or_reset(&pdev->dev, speyside_gpiod_table_action,
+ NULL);
+ if (ret)
+ return ret;
+
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret)
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
--
2.48.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 5/6] ASoC: samsung: tobermory: Drop unused include
2025-03-05 7:39 [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion Linus Walleij
` (3 preceding siblings ...)
2025-03-05 7:39 ` [PATCH v2 4/6] ASoC: samsung: speyside: Convert to GPIO descriptor Linus Walleij
@ 2025-03-05 7:39 ` Linus Walleij
2025-03-05 7:39 ` [PATCH v2 6/6] ASoC: samsung: tm2_wm5110: " Linus Walleij
2025-03-05 7:44 ` [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion Linus Walleij
6 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-03-05 7:39 UTC (permalink / raw)
To: Sylwester Nawrocki, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Bartosz Golaszewski
Cc: linux-sound, linux-arm-kernel, linux-gpio, Linus Walleij,
Bartosz Golaszewski
This file does not use the symbols from the legacy
<linux/gpio.h> header, so let's drop it.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
sound/soc/samsung/tobermory.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/samsung/tobermory.c b/sound/soc/samsung/tobermory.c
index 2bdd81bf821a5b9bdc56479bb2cd5d0089fab339..bc2608dbaddc4feeb9af77639699fed89540b44b 100644
--- a/sound/soc/samsung/tobermory.c
+++ b/sound/soc/samsung/tobermory.c
@@ -7,7 +7,6 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/jack.h>
-#include <linux/gpio.h>
#include <linux/module.h>
#include "../codecs/wm8962.h"
--
2.48.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 6/6] ASoC: samsung: tm2_wm5110: Drop unused include
2025-03-05 7:39 [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion Linus Walleij
` (4 preceding siblings ...)
2025-03-05 7:39 ` [PATCH v2 5/6] ASoC: samsung: tobermory: Drop unused include Linus Walleij
@ 2025-03-05 7:39 ` Linus Walleij
2025-03-05 7:44 ` [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion Linus Walleij
6 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-03-05 7:39 UTC (permalink / raw)
To: Sylwester Nawrocki, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Bartosz Golaszewski
Cc: linux-sound, linux-arm-kernel, linux-gpio, Linus Walleij,
Bartosz Golaszewski
This file does not use the symbols from the legacy
<linux/gpio.h> header, so let's drop it.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
sound/soc/samsung/tm2_wm5110.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c
index 2417b91a328f083f991af8505c5586d3b27d9bbd..cc76963105d9fa37fe0bc45acf9a28720fdde158 100644
--- a/sound/soc/samsung/tm2_wm5110.c
+++ b/sound/soc/samsung/tm2_wm5110.c
@@ -6,7 +6,6 @@
// Sylwester Nawrocki <s.nawrocki@samsung.com>
#include <linux/clk.h>
-#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/of.h>
--
2.48.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion
2025-03-05 7:39 [PATCH v2 0/6] ASoC: samsung: GPIO descriptor conversion Linus Walleij
` (5 preceding siblings ...)
2025-03-05 7:39 ` [PATCH v2 6/6] ASoC: samsung: tm2_wm5110: " Linus Walleij
@ 2025-03-05 7:44 ` Linus Walleij
6 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-03-05 7:44 UTC (permalink / raw)
To: Sylwester Nawrocki, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Bartosz Golaszewski
Cc: linux-sound, linux-arm-kernel, linux-gpio, Bartosz Golaszewski
On Wed, Mar 5, 2025 at 8:39 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> This drops unused includes and converts one Samsung
> codec to use GPIO descriptors.
Oh I see it was already applied (I don't read my mail fast enough
in the mornings), no worries I can send an incremental
fix instead.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread