Skip to contentSkip to conversation

ASoC: uda1380: Modernize the driver

PATCH Superseded Linus Walleij 2 participants 2 messages Apr 9

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Linus Walleij

author maintainer
#0 lore raw

PATCH v2 1/1 ASoC: uda1380: Modernize the driver

This codec driver depended on the legacy GPIO API, and nothing in the kernel is defining the platform data, so get rid of this.

Two in-kernel device trees are defining this codec using undocumented device tree properties, so support these for now. The same properties can be defined using software nodes if board files are desired. The device tree use the "-gpio" rather than "-gpios" suffix but the GPIO DT parser will deal with that.

Since there may be out of tree users, migrate to GPIO descriptors, drop the platform data that is unused, and assign the dac_clk the value that was used in all platforms found in a historical dig, and support setting the clock to the PLL using the undocumented device tree property.

Add some menuconfig so the codec can be selected and tested.

---
This makes the driver usable on contemporary Linux, maybe it will
even work, I can't test it.
---
Changes in v2:
- Update commit message referencing existing device trees.
- Make sure the (undocumented) DT properties will work.
- Add clk source handling for the undocumented DT property as
well while we're at it.
- Mention LPC32xx in the Kconfig.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 include/sound/uda1380.h    | 19 ---------------
 sound/soc/codecs/Kconfig   |  6 +++--
 sound/soc/codecs/uda1380.c | 61 ++++++++++++++++++++++++++--------------------
 3 files changed, 38 insertions(+), 48 deletions(-)
include/sound/uda1380.h deleted +0 -19
deleted file mode 100644
index 2e42ea2d0cfd..000000000000
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * UDA1380 ALSA SoC Codec driver
- *
- * Copyright 2009 Philipp Zabel
- */
-
-#ifndef __UDA1380_H
-#define __UDA1380_H
-
-struct uda1380_platform_data {
-	int gpio_power;
-	int gpio_reset;
-	int dac_clk;
-#define UDA1380_DAC_CLK_SYSCLK 0
-#define UDA1380_DAC_CLK_WSPLL  1
-};
-
-#endif /* __UDA1380_H */
sound/soc/codecs/Kconfig +4 -2
index adb3fb923be3..71fd4e219604 100644
@@ -2364,9 +2364,11 @@ config SND_SOC_UDA1342
 	  mic inputs), stereo audio DAC, with basic audio processing.
 
 config SND_SOC_UDA1380
-	tristate
+	tristate "Philips UDA1380 CODEC"
 	depends on I2C
-	depends on GPIOLIB_LEGACY
+	help
+	  The UDA1380 codec is used in the HTC Magician and on a number of
+	  Samsung reference boards, as well as the LPC32xx series.
 
 config SND_SOC_WCD_CLASSH
 	tristate
sound/soc/codecs/uda1380.c +34 -27

141 lines not on this page · raw message

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260327-asoc-uda1380-3fc67773249a

Best regards,

Signature · 1 line
Linus Walleij <[email protected]>
maintainer
#1 lore raw
Quoted 2 lines · Linus Walleij

This makes the driver usable on contemporary Linux, maybe it will even work, I can't test it.

Don't think so...

sound/soc/codecs/uda1380.c static const struct snd_soc_component_driver soc_component_dev_uda1380 = { · line 750

Quoted 7 lines
sound/soc/codecs/uda1380.c +1 -0
@@ -742,6 +745,7 @@ static const struct snd_soc_component_driver soc_component_dev_uda1380 = {
 static int uda1380_i2c_probe(struct i2c_client *i2c)
 {
 	struct uda1380_platform_data *pdata = i2c->dev.platform_data;
+	struct device *dev = &i2c->dev;
 	struct uda1380_priv *uda1380;
 	int ret;

We still have the platform data above, and just below this we have:

        if (!pdata)
                return -EINVAL;

so I'm not sure how the driver is going to instantiate, there's mandatory platform data still. Not that the driver would've instantiated before either with anyhing in mainline...