{"id":2221592,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2221592/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260409-asoc-uda1380-v3-1-b3d5a53f31be@kernel.org/","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/1.1/projects/42/?format=json","name":"Linux GPIO development","link_name":"linux-gpio","list_id":"linux-gpio.vger.kernel.org","list_email":"linux-gpio@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260409-asoc-uda1380-v3-1-b3d5a53f31be@kernel.org>","date":"2026-04-09T21:39:31","name":"[v3] ASoC: uda1380: Modernize the driver","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"33554b7dda28341a79de6d68a26a710ccda155ab","submitter":{"id":92050,"url":"http://patchwork.ozlabs.org/api/1.1/people/92050/?format=json","name":"Linus Walleij","email":"linusw@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260409-asoc-uda1380-v3-1-b3d5a53f31be@kernel.org/mbox/","series":[{"id":499362,"url":"http://patchwork.ozlabs.org/api/1.1/series/499362/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/list/?series=499362","date":"2026-04-09T21:39:31","name":"[v3] ASoC: uda1380: Modernize the driver","version":3,"mbox":"http://patchwork.ozlabs.org/series/499362/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221592/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221592/checks/","tags":{},"headers":{"Return-Path":"\n <linux-gpio+bounces-34974-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-gpio@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=RX5o7PZF;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-gpio+bounces-34974-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"RX5o7PZF\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsCy91Tb9z1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 07:39:45 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id EC10C30125CE\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  9 Apr 2026 21:39:36 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id DA29D2FF66B;\n\tThu,  9 Apr 2026 21:39:35 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D95940855;\n\tThu,  9 Apr 2026 21:39:35 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 9D155C4CEF7;\n\tThu,  9 Apr 2026 21:39:33 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775770775; cv=none;\n b=j05KRNwJaqQKaRpQtnc/7nNXfnfWboD5bFIaMMK+WnjRO4xJ/fztJZ6i20Jzibzm7lSziwPBOYHSpTdt1/pFiSn4xZnUoljXZ3xDQmMRgVgxj3xBHVH0Z6tTLv+3NBtxuAbKjaBU7JyW223GRsbEfcJQMpUPcCegcQ6mXAc9jlI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775770775; c=relaxed/simple;\n\tbh=Mw3j+pn6gNDmP0jA4E9YsNWuK/Isk58FfQaD0/dB3eY=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc;\n b=BucCkjF0WYrNuo32Bl8wwNWrO1jmA2cuhAjBmLPd61miCfdgSlpEN+8IO6Hp0sFRrqJjR4XJe4T/Q+BkbZb50FVr5/NdJRd+V53IsyovXXqifhZZsg4lflLH5Ds3nEoVvZf7My1m1aVxVP3ebXIJ11Q2z4tGGQB9i0enRU2GTGo=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=RX5o7PZF; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1775770775;\n\tbh=Mw3j+pn6gNDmP0jA4E9YsNWuK/Isk58FfQaD0/dB3eY=;\n\th=From:Date:Subject:To:Cc:From;\n\tb=RX5o7PZFuGf8el3Ep97OQyc3dWMd4q7qQLCPEOfqjrEmrLj81zz7Y0KJXCR9GybQ9\n\t 54g/V9afYcBWky1d7AiJlmzE+36uINgcku1Eh9/drIHVGd8Ta/UNnrWlHKVsmhLTLs\n\t PzaXLK3DZnkPbLQxu+t/fJ+c6NRdd2iG+MHAGO16VcJEHVLt74chPqS4+aoSmci+cj\n\t WKFQ9j6kOXyYn5VGWdSzWAruDH4I8F7eth8rvYCZ63Lf3TLNUEYyYRuSKHhVz/Yjo4\n\t 8S/5wFj6ukaVXofwN8dR7BWbsSVberiF22oitzJfLSJC6/SwH4OQKwnvSB8HjWXFR/\n\t 9zZ0TnWkr4W3w==","From":"Linus Walleij <linusw@kernel.org>","Date":"Thu, 09 Apr 2026 23:39:31 +0200","Subject":"[PATCH v3] ASoC: uda1380: Modernize the driver","Precedence":"bulk","X-Mailing-List":"linux-gpio@vger.kernel.org","List-Id":"<linux-gpio.vger.kernel.org>","List-Subscribe":"<mailto:linux-gpio+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-gpio+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260409-asoc-uda1380-v3-1-b3d5a53f31be@kernel.org>","X-B4-Tracking":"v=1; b=H4sIAAAAAAAC/3XMQQ7CIBRF0a00jMXAp5biyH0YBxQ+LdGUBpRom\n u5d2onRxOF7ybkzSRg9JnKsZhIx++TDWIbYVcQMeuyRels2AQYNEyCpTsHQh9VctIwKZxoppYB\n aaVLIFNH555Y7X8oefLqH+Nrqma/vn1DmlFPXOMU7VJ107emKccTbPsSerKUMH10z9aOh6BosA\n yYVGnv40suyvAH7vEMH5wAAAA==","X-Change-ID":"20260327-asoc-uda1380-3fc67773249a","To":"Philipp Zabel <p.zabel@pengutronix.de>,\n Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,\n Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>,\n Bartosz Golaszewski <brgl@kernel.org>","Cc":"linux-sound@vger.kernel.org, linux-gpio@vger.kernel.org,\n Linus Walleij <linusw@kernel.org>","X-Mailer":"b4 0.14.3"},"content":"This codec driver depended on the legacy GPIO API, and nothing\nin the kernel is defining the platform data, so get rid of this.\n\nTwo in-kernel device trees are defining this codec using\nundocumented device tree properties, so support these for now.\nThe same properties can be defined using software nodes if board\nfiles are desired. The device tree use the \"-gpio\" rather than\n\"-gpios\" suffix but the GPIO DT parser will deal with that.\n\nSince there may be out of tree users, migrate to GPIO descriptors,\ndrop the platform data that is unused, and assign the dac_clk the\nvalue that was used in all platforms found in a historical dig,\nand support setting the clock to the PLL using the undocumented\ndevice tree property.\n\nAdd some menuconfig so the codec can be selected and tested.\n\nSigned-off-by: Linus Walleij <linusw@kernel.org>\n---\nThis makes the driver usable on contemporary Linux, maybe it will\neven work, I can't test it.\n---\nChanges in v3:\n- Drop dereference of platform data and check for its\n  presence from probe()\n- Scratch my head wondering why that compiled despite I had\n  deleted the platform data struct in the same commit... I guess\n  C thinks it's fine since it was just treating it as\n  \"some anonymous pointer\" without even a forward-declaration.\n- Link to v2: https://lore.kernel.org/r/20260409-asoc-uda1380-v2-1-42d02079ecd5@kernel.org\n\nChanges in v2:\n- Update commit message referencing existing device trees.\n- Make sure the (undocumented) DT properties will work.\n- Add clk source handling for the undocumented DT property as\n  well while we're at it.\n- Mention LPC32xx in the Kconfig.\n- Link to v1: https://lore.kernel.org/r/20260327-asoc-uda1380-v1-1-f6f91be9b7f8@kernel.org\n---\n include/sound/uda1380.h    | 19 --------------\n sound/soc/codecs/Kconfig   |  6 +++--\n sound/soc/codecs/uda1380.c | 65 ++++++++++++++++++++++++----------------------\n 3 files changed, 38 insertions(+), 52 deletions(-)\n\n\n---\nbase-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f\nchange-id: 20260327-asoc-uda1380-3fc67773249a\n\nBest regards,","diff":"diff --git a/include/sound/uda1380.h b/include/sound/uda1380.h\ndeleted file mode 100644\nindex 2e42ea2d0cfd..000000000000\n--- a/include/sound/uda1380.h\n+++ /dev/null\n@@ -1,19 +0,0 @@\n-/* SPDX-License-Identifier: GPL-2.0-only */\n-/*\n- * UDA1380 ALSA SoC Codec driver\n- *\n- * Copyright 2009 Philipp Zabel\n- */\n-\n-#ifndef __UDA1380_H\n-#define __UDA1380_H\n-\n-struct uda1380_platform_data {\n-\tint gpio_power;\n-\tint gpio_reset;\n-\tint dac_clk;\n-#define UDA1380_DAC_CLK_SYSCLK 0\n-#define UDA1380_DAC_CLK_WSPLL  1\n-};\n-\n-#endif /* __UDA1380_H */\ndiff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig\nindex adb3fb923be3..71fd4e219604 100644\n--- a/sound/soc/codecs/Kconfig\n+++ b/sound/soc/codecs/Kconfig\n@@ -2364,9 +2364,11 @@ config SND_SOC_UDA1342\n \t  mic inputs), stereo audio DAC, with basic audio processing.\n \n config SND_SOC_UDA1380\n-\ttristate\n+\ttristate \"Philips UDA1380 CODEC\"\n \tdepends on I2C\n-\tdepends on GPIOLIB_LEGACY\n+\thelp\n+\t  The UDA1380 codec is used in the HTC Magician and on a number of\n+\t  Samsung reference boards, as well as the LPC32xx series.\n \n config SND_SOC_WCD_CLASSH\n \ttristate\ndiff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c\nindex 9e9c540a45ca..d8a23a84b9e6 100644\n--- a/sound/soc/codecs/uda1380.c\n+++ b/sound/soc/codecs/uda1380.c\n@@ -16,16 +16,19 @@\n #include <linux/types.h>\n #include <linux/slab.h>\n #include <linux/errno.h>\n-#include <linux/gpio.h>\n+#include <linux/gpio/consumer.h>\n #include <linux/delay.h>\n #include <linux/i2c.h>\n+#include <linux/property.h>\n #include <linux/workqueue.h>\n #include <sound/core.h>\n #include <sound/control.h>\n #include <sound/initval.h>\n #include <sound/soc.h>\n #include <sound/tlv.h>\n-#include <sound/uda1380.h>\n+\n+#define UDA1380_DAC_CLK_SYSCLK 0\n+#define UDA1380_DAC_CLK_WSPLL  1\n \n #include \"uda1380.h\"\n \n@@ -36,6 +39,8 @@ struct uda1380_priv {\n \tstruct work_struct work;\n \tstruct i2c_client *i2c;\n \tu16 *reg_cache;\n+\tstruct gpio_desc *power;\n+\tstruct gpio_desc *reset;\n };\n \n /*\n@@ -150,13 +155,12 @@ static void uda1380_sync_cache(struct snd_soc_component *component)\n \n static int uda1380_reset(struct snd_soc_component *component)\n {\n-\tstruct uda1380_platform_data *pdata = component->dev->platform_data;\n \tstruct uda1380_priv *uda1380 = snd_soc_component_get_drvdata(component);\n \n-\tif (gpio_is_valid(pdata->gpio_reset)) {\n-\t\tgpio_set_value(pdata->gpio_reset, 1);\n+\tif (uda1380->reset) {\n+\t\tgpiod_set_value(uda1380->reset, 1);\n \t\tmdelay(1);\n-\t\tgpio_set_value(pdata->gpio_reset, 0);\n+\t\tgpiod_set_value(uda1380->reset, 0);\n \t} else {\n \t\tu8 data[3];\n \n@@ -589,9 +593,9 @@ static int uda1380_set_bias_level(struct snd_soc_component *component,\n \tenum snd_soc_bias_level level)\n {\n \tstruct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);\n+\tstruct uda1380_priv *uda1380 = snd_soc_component_get_drvdata(component);\n \tint pm = uda1380_read_reg_cache(component, UDA1380_PM);\n \tint reg;\n-\tstruct uda1380_platform_data *pdata = component->dev->platform_data;\n \n \tswitch (level) {\n \tcase SND_SOC_BIAS_ON:\n@@ -601,8 +605,8 @@ static int uda1380_set_bias_level(struct snd_soc_component *component,\n \t\tbreak;\n \tcase SND_SOC_BIAS_STANDBY:\n \t\tif (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {\n-\t\t\tif (gpio_is_valid(pdata->gpio_power)) {\n-\t\t\t\tgpio_set_value(pdata->gpio_power, 1);\n+\t\t\tif (uda1380->power) {\n+\t\t\t\tgpiod_set_value(uda1380->power, 1);\n \t\t\t\tmdelay(1);\n \t\t\t\tuda1380_reset(component);\n \t\t\t}\n@@ -612,10 +616,10 @@ static int uda1380_set_bias_level(struct snd_soc_component *component,\n \t\tuda1380_write(component, UDA1380_PM, 0x0);\n \t\tbreak;\n \tcase SND_SOC_BIAS_OFF:\n-\t\tif (!gpio_is_valid(pdata->gpio_power))\n+\t\tif (!uda1380->power)\n \t\t\tbreak;\n \n-\t\tgpio_set_value(pdata->gpio_power, 0);\n+\t\tgpiod_set_value(uda1380->power, 0);\n \n \t\t/* Mark mixer regs cache dirty to sync them with\n \t\t * codec regs on power on.\n@@ -694,13 +698,12 @@ static struct snd_soc_dai_driver uda1380_dai[] = {\n \n static int uda1380_probe(struct snd_soc_component *component)\n {\n-\tstruct uda1380_platform_data *pdata =component->dev->platform_data;\n \tstruct uda1380_priv *uda1380 = snd_soc_component_get_drvdata(component);\n \tint ret;\n \n \tuda1380->component = component;\n \n-\tif (!gpio_is_valid(pdata->gpio_power)) {\n+\tif (!uda1380->power) {\n \t\tret = uda1380_reset(component);\n \t\tif (ret)\n \t\t\treturn ret;\n@@ -709,7 +712,7 @@ static int uda1380_probe(struct snd_soc_component *component)\n \tINIT_WORK(&uda1380->work, uda1380_flush_work);\n \n \t/* set clock input */\n-\tswitch (pdata->dac_clk) {\n+\tswitch (uda1380->dac_clk) {\n \tcase UDA1380_DAC_CLK_SYSCLK:\n \t\tuda1380_write_reg_cache(component, UDA1380_CLK, 0);\n \t\tbreak;\n@@ -741,31 +744,31 @@ static const struct snd_soc_component_driver soc_component_dev_uda1380 = {\n \n static int uda1380_i2c_probe(struct i2c_client *i2c)\n {\n-\tstruct uda1380_platform_data *pdata = i2c->dev.platform_data;\n+\tstruct device *dev = &i2c->dev;\n \tstruct uda1380_priv *uda1380;\n \tint ret;\n \n-\tif (!pdata)\n-\t\treturn -EINVAL;\n-\n \tuda1380 = devm_kzalloc(&i2c->dev, sizeof(struct uda1380_priv),\n \t\t\t       GFP_KERNEL);\n \tif (uda1380 == NULL)\n \t\treturn -ENOMEM;\n \n-\tif (gpio_is_valid(pdata->gpio_reset)) {\n-\t\tret = devm_gpio_request_one(&i2c->dev, pdata->gpio_reset,\n-\t\t\tGPIOF_OUT_INIT_LOW, \"uda1380 reset\");\n-\t\tif (ret)\n-\t\t\treturn ret;\n-\t}\n-\n-\tif (gpio_is_valid(pdata->gpio_power)) {\n-\t\tret = devm_gpio_request_one(&i2c->dev, pdata->gpio_power,\n-\t\t\tGPIOF_OUT_INIT_LOW, \"uda1380 power\");\n-\t\tif (ret)\n-\t\t\treturn ret;\n-\t}\n+\tuda1380->reset = devm_gpiod_get_optional(dev, \"reset\", GPIOD_OUT_LOW);\n+\tif (IS_ERR(uda1380->reset))\n+\t\treturn dev_err_probe(dev, PTR_ERR(uda1380->reset),\n+\t\t\t\t     \"error obtaining reset GPIO\\n\");\n+\tgpiod_set_consumer_name(uda1380->reset, \"uda1380 reset\");\n+\n+\tuda1380->power = devm_gpiod_get_optional(dev, \"power\", GPIOD_OUT_LOW);\n+\tif (IS_ERR(uda1380->power))\n+\t\treturn dev_err_probe(dev, PTR_ERR(uda1380->power),\n+\t\t\t\t     \"error obtaining power GPIO\\n\");\n+\tgpiod_set_consumer_name(uda1380->power, \"uda1380 power\");\n+\n+\t/* This is just some default */\n+\tuda1380->dac_clk = UDA1380_DAC_CLK_SYSCLK;\n+\tif (device_property_match_string(dev, \"dac-clk\", \"wspll\") >= 0)\n+\t\tuda1380->dac_clk = UDA1380_DAC_CLK_WSPLL;\n \n \tuda1380->reg_cache = devm_kmemdup_array(&i2c->dev, uda1380_reg, ARRAY_SIZE(uda1380_reg),\n \t\t\t\t\t\tsizeof(uda1380_reg[0]), GFP_KERNEL);\n","prefixes":["v3"]}