* [PATCH 0/4] ASoC: arizona: switch to generic device properties and clean up
@ 2026-11-06 5:39 Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 1/4] ASoC: arizona: convert audio pdata parsing to generic device properties Dmitry Torokhov
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-06 5:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Charles Keepax, Richard Fitzgerald, David Rhodes, Lee Jones
Cc: patches, linux-sound, linux-kernel, mfd
This series converts Arizona ASoC drivers to generic device properties
and cleans up dead code and formatting issues:
- Convert audio platform data parsing from OF-only APIs to generic
device property helpers and drop CONFIG_OF guards across the codec
drivers.
- Parse device properties unconditionally in the jack detection and codec
drivers even when platform data is supplied, preserving existing
channel settings and boolean flags when properties are absent.
- Drop unused hpdet_acc_id and hpdet_acc_id_line fields from struct
arizona_pdata along with the unreachable HPDET accessory ID logic in
the jack detection driver.
- Clean up coding style and argument alignment in arizona-jack.c.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
Dmitry Torokhov (4):
ASoC: arizona: convert audio pdata parsing to generic device properties
ASoC: arizona: always parse device properties regardless of platform data
ASoC: arizona: drop unused HPDET accessory ID support
ASoC: arizona: clean up coding style and formatting
include/linux/mfd/arizona/pdata.h | 21 ++--
sound/soc/codecs/arizona-jack.c | 225 +++++---------------------------------
sound/soc/codecs/arizona.c | 121 ++++++++++----------
sound/soc/codecs/arizona.h | 8 +-
sound/soc/codecs/cs47l24.c | 8 +-
sound/soc/codecs/wm5102.c | 8 +-
sound/soc/codecs/wm5110.c | 8 +-
sound/soc/codecs/wm8997.c | 8 +-
sound/soc/codecs/wm8998.c | 8 +-
9 files changed, 99 insertions(+), 316 deletions(-)
---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
change-id: 20261105-arizona-asoc-ca9bba7a3bb7
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] ASoC: arizona: convert audio pdata parsing to generic device properties
2026-11-06 5:39 [PATCH 0/4] ASoC: arizona: switch to generic device properties and clean up Dmitry Torokhov
@ 2026-11-06 5:39 ` Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 2/4] ASoC: arizona: always parse device properties regardless of platform data Dmitry Torokhov
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-06 5:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Charles Keepax, Richard Fitzgerald, David Rhodes, Lee Jones
Cc: patches, linux-sound, linux-kernel, mfd
Switch audio platform data parsing in the shared Arizona ASoC helper
from OF-only property APIs to generic device property APIs so audio
parameters can be provided via software nodes or ACPI in addition to
Device Tree.
Align the audio configuration array types in struct arizona_pdata with
generic property types so properties can be read directly into platform
data, using boolean storage for out-mono flags and bounded array reads
that preserve unspecified trailing elements. Drop the CONFIG_OF guards
and obsolete error checks around the audio property parsing calls in all
Arizona codec drivers.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
include/linux/mfd/arizona/pdata.h | 15 ++---
sound/soc/codecs/arizona.c | 121 +++++++++++++++++++-------------------
sound/soc/codecs/arizona.h | 2 +-
sound/soc/codecs/cs47l24.c | 9 +--
sound/soc/codecs/wm5102.c | 9 +--
sound/soc/codecs/wm5110.c | 9 +--
sound/soc/codecs/wm8997.c | 9 +--
sound/soc/codecs/wm8998.c | 9 +--
8 files changed, 79 insertions(+), 104 deletions(-)
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index d465dcd8c90a..984b2edfec07 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -11,6 +11,7 @@
#include <dt-bindings/mfd/arizona.h>
#include <linux/regulator/arizona-ldo1.h>
#include <linux/regulator/arizona-micsupp.h>
+#include <linux/types.h>
#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */
#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */
@@ -100,7 +101,7 @@ struct arizona_pdata {
* useful for systems where and I2S bus with multiple data
* lines is mastered.
*/
- unsigned int max_channels_clocked[ARIZONA_MAX_AIF];
+ u32 max_channels_clocked[ARIZONA_MAX_AIF];
/** GPIO5 is used for jack detection */
bool jd_gpio5;
@@ -150,7 +151,7 @@ struct arizona_pdata {
int num_micd_configs;
/** Reference voltage for DMIC inputs */
- int dmic_ref[ARIZONA_MAX_INPUT];
+ u32 dmic_ref[ARIZONA_MAX_INPUT];
/** MICBIAS configurations */
struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];
@@ -161,19 +162,19 @@ struct arizona_pdata {
* wm5102/wm5110/wm8280/wm8997: [0]=IN1 [1]=IN2 [2]=IN3 [3]=IN4
* wm8998: [0]=IN1A [1]=IN2A [2]=IN1B [3]=IN2B
*/
- int inmode[ARIZONA_MAX_INPUT];
+ u32 inmode[ARIZONA_MAX_INPUT];
/** Mode for outputs */
- int out_mono[ARIZONA_MAX_OUTPUT];
+ bool out_mono[ARIZONA_MAX_OUTPUT];
/** Limit output volumes */
- unsigned int out_vol_limit[2 * ARIZONA_MAX_OUTPUT];
+ u32 out_vol_limit[2 * ARIZONA_MAX_OUTPUT];
/** PDM speaker mute setting */
- unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
+ u32 spk_mute[ARIZONA_MAX_PDM_SPK];
/** PDM speaker format */
- unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
+ u32 spk_fmt[ARIZONA_MAX_PDM_SPK];
/** Haptic actuator type */
unsigned int hap_act;
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 7c296c5b24f7..46e2ca48e70f 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -11,8 +11,8 @@
#include <linux/delay.h>
#include <linux/gcd.h>
#include <linux/module.h>
-#include <linux/of.h>
#include <linux/pm_runtime.h>
+#include <linux/property.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
@@ -2799,77 +2799,76 @@ int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
}
EXPORT_SYMBOL_GPL(arizona_lhpf_coeff_put);
-int arizona_of_get_audio_pdata(struct arizona *arizona)
+static int arizona_get_variable_u32_array(struct device *dev,
+ const char *propname,
+ u32 *dest, size_t n_max)
{
- struct arizona_pdata *pdata = &arizona->pdata;
- struct device_node *np = arizona->dev->of_node;
- u32 val;
- u32 pdm_val[ARIZONA_MAX_PDM_SPK];
- int ret;
- int count = 0;
-
- count = 0;
- of_property_for_each_u32(np, "wlf,inmode", val) {
- if (count == ARRAY_SIZE(pdata->inmode))
- break;
-
- pdata->inmode[count] = val;
- count++;
- }
+ int n, ret;
- count = 0;
- of_property_for_each_u32(np, "wlf,dmic-ref", val) {
- if (count == ARRAY_SIZE(pdata->dmic_ref))
- break;
-
- pdata->dmic_ref[count] = val;
- count++;
- }
+ n = device_property_count_u32(dev, propname);
+ if (n < 0) {
+ if (n == -EINVAL)
+ return 0; /* missing, ignore */
- count = 0;
- of_property_for_each_u32(np, "wlf,out-mono", val) {
- if (count == ARRAY_SIZE(pdata->out_mono))
- break;
-
- pdata->out_mono[count] = !!val;
- count++;
+ dev_warn(dev, "%s malformed (%d)\n", propname, n);
+ return n;
}
- count = 0;
- of_property_for_each_u32(np, "wlf,max-channels-clocked", val) {
- if (count == ARRAY_SIZE(pdata->max_channels_clocked))
- break;
-
- pdata->max_channels_clocked[count] = val;
- count++;
- }
+ if (!n)
+ return 0;
- count = 0;
- of_property_for_each_u32(np, "wlf,out-volume-limit", val) {
- if (count == ARRAY_SIZE(pdata->out_vol_limit))
- break;
+ if (n > n_max)
+ n = n_max;
- pdata->out_vol_limit[count] = val;
- count++;
+ ret = device_property_read_u32_array(dev, propname, dest, n);
+ if (ret < 0) {
+ dev_warn(dev, "Failed to read %s (%d)\n", propname, ret);
+ return ret;
}
- ret = of_property_read_u32_array(np, "wlf,spk-fmt",
- pdm_val, ARRAY_SIZE(pdm_val));
-
- if (ret >= 0)
- for (count = 0; count < ARRAY_SIZE(pdata->spk_fmt); ++count)
- pdata->spk_fmt[count] = pdm_val[count];
-
- ret = of_property_read_u32_array(np, "wlf,spk-mute",
- pdm_val, ARRAY_SIZE(pdm_val));
-
- if (ret >= 0)
- for (count = 0; count < ARRAY_SIZE(pdata->spk_mute); ++count)
- pdata->spk_mute[count] = pdm_val[count];
+ return n;
+}
- return 0;
+void arizona_get_audio_pdata(struct arizona *arizona)
+{
+ struct arizona_pdata *pdata = &arizona->pdata;
+ u32 out_mono[ARRAY_SIZE(pdata->out_mono)];
+ int i, n, ret;
+
+ arizona_get_variable_u32_array(arizona->dev, "wlf,inmode",
+ pdata->inmode,
+ ARRAY_SIZE(pdata->inmode));
+
+ arizona_get_variable_u32_array(arizona->dev, "wlf,dmic-ref",
+ pdata->dmic_ref,
+ ARRAY_SIZE(pdata->dmic_ref));
+
+ n = arizona_get_variable_u32_array(arizona->dev, "wlf,out-mono",
+ out_mono, ARRAY_SIZE(out_mono));
+ for (i = 0; i < n; i++)
+ pdata->out_mono[i] = !!out_mono[i];
+
+ arizona_get_variable_u32_array(arizona->dev, "wlf,max-channels-clocked",
+ pdata->max_channels_clocked,
+ ARRAY_SIZE(pdata->max_channels_clocked));
+
+ arizona_get_variable_u32_array(arizona->dev, "wlf,out-volume-limit",
+ pdata->out_vol_limit,
+ ARRAY_SIZE(pdata->out_vol_limit));
+
+ ret = device_property_read_u32_array(arizona->dev, "wlf,spk-fmt",
+ pdata->spk_fmt,
+ ARRAY_SIZE(pdata->spk_fmt));
+ if (ret && ret != -EINVAL)
+ dev_warn(arizona->dev, "Failed to read wlf,spk-fmt (%d)\n", ret);
+
+ ret = device_property_read_u32_array(arizona->dev, "wlf,spk-mute",
+ pdata->spk_mute,
+ ARRAY_SIZE(pdata->spk_mute));
+ if (ret && ret != -EINVAL)
+ dev_warn(arizona->dev, "Failed to read wlf,spk-mute (%d)\n", ret);
}
-EXPORT_SYMBOL_GPL(arizona_of_get_audio_pdata);
+EXPORT_SYMBOL_GPL(arizona_get_audio_pdata);
MODULE_DESCRIPTION("ASoC Wolfson Arizona class device support");
MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index 0703182d87b3..499891e62183 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -388,7 +388,7 @@ static inline int arizona_unregister_notifier(struct snd_soc_component *componen
return blocking_notifier_chain_unregister(&arizona->notifier, nb);
}
-int arizona_of_get_audio_pdata(struct arizona *arizona);
+void arizona_get_audio_pdata(struct arizona *arizona);
int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev);
int arizona_jack_codec_dev_remove(struct arizona_priv *info);
diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c
index 5100b1aac902..09cef46f09fc 100644
--- a/sound/soc/codecs/cs47l24.c
+++ b/sound/soc/codecs/cs47l24.c
@@ -1222,13 +1222,8 @@ static int cs47l24_probe(struct platform_device *pdev)
if (!cs47l24)
return -ENOMEM;
- if (IS_ENABLED(CONFIG_OF)) {
- if (!dev_get_platdata(arizona->dev)) {
- ret = arizona_of_get_audio_pdata(arizona);
- if (ret < 0)
- return ret;
- }
- }
+ if (!dev_get_platdata(arizona->dev))
+ arizona_get_audio_pdata(arizona);
platform_set_drvdata(pdev, cs47l24);
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 74b775b95bfd..bd747171212e 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -2041,13 +2041,8 @@ static int wm5102_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, wm5102);
- if (IS_ENABLED(CONFIG_OF)) {
- if (!dev_get_platdata(arizona->dev)) {
- ret = arizona_of_get_audio_pdata(arizona);
- if (ret < 0)
- return ret;
- }
- }
+ if (!dev_get_platdata(arizona->dev))
+ arizona_get_audio_pdata(arizona);
mutex_init(&arizona->dac_comp_lock);
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index 7a311c869bd3..73c4ffabf4ec 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -2403,13 +2403,8 @@ static int wm5110_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, wm5110);
- if (IS_ENABLED(CONFIG_OF)) {
- if (!dev_get_platdata(arizona->dev)) {
- ret = arizona_of_get_audio_pdata(arizona);
- if (ret < 0)
- return ret;
- }
- }
+ if (!dev_get_platdata(arizona->dev))
+ arizona_get_audio_pdata(arizona);
wm5110->core.arizona = arizona;
wm5110->core.num_inputs = 8;
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
index 83106523385a..c126afb65928 100644
--- a/sound/soc/codecs/wm8997.c
+++ b/sound/soc/codecs/wm8997.c
@@ -1119,13 +1119,8 @@ static int wm8997_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, wm8997);
- if (IS_ENABLED(CONFIG_OF)) {
- if (!dev_get_platdata(arizona->dev)) {
- ret = arizona_of_get_audio_pdata(arizona);
- if (ret < 0)
- return ret;
- }
- }
+ if (!dev_get_platdata(arizona->dev))
+ arizona_get_audio_pdata(arizona);
wm8997->core.arizona = arizona;
wm8997->core.num_inputs = 4;
diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c
index 8e6f03d00c71..fdb2018e9367 100644
--- a/sound/soc/codecs/wm8998.c
+++ b/sound/soc/codecs/wm8998.c
@@ -1346,13 +1346,8 @@ static int wm8998_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, wm8998);
- if (IS_ENABLED(CONFIG_OF)) {
- if (!dev_get_platdata(arizona->dev)) {
- ret = arizona_of_get_audio_pdata(arizona);
- if (ret < 0)
- return ret;
- }
- }
+ if (!dev_get_platdata(arizona->dev))
+ arizona_get_audio_pdata(arizona);
wm8998->core.arizona = arizona;
wm8998->core.num_inputs = 3; /* IN1L, IN1R, IN2 */
--
2.56.0.506.g506a7eabc5-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] ASoC: arizona: always parse device properties regardless of platform data
2026-11-06 5:39 [PATCH 0/4] ASoC: arizona: switch to generic device properties and clean up Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 1/4] ASoC: arizona: convert audio pdata parsing to generic device properties Dmitry Torokhov
@ 2026-11-06 5:39 ` Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 3/4] ASoC: arizona: drop unused HPDET accessory ID support Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 4/4] ASoC: arizona: clean up coding style and formatting Dmitry Torokhov
3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-06 5:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Charles Keepax, Richard Fitzgerald, David Rhodes, Lee Jones
Cc: patches, linux-sound, linux-kernel, mfd
Always parse device properties in the Arizona jack detection driver and
codec drivers even when platform data is provided, allowing DT, ACPI,
or software node properties to augment platform data configurations.
In the jack detection driver, initialize the headphone detect channel
from existing platform data before querying device properties so an
absent property does not clobber it with the default channel. Preserve
existing boolean platform data flags using bitwise OR assignments.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
sound/soc/codecs/arizona-jack.c | 27 ++++++++++++++-------------
sound/soc/codecs/cs47l24.c | 3 +--
sound/soc/codecs/wm5102.c | 3 +--
sound/soc/codecs/wm5110.c | 3 +--
sound/soc/codecs/wm8997.c | 3 +--
sound/soc/codecs/wm8998.c | 3 +--
6 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/sound/soc/codecs/arizona-jack.c b/sound/soc/codecs/arizona-jack.c
index 6587d46a1867..d5f14fc8af7f 100644
--- a/sound/soc/codecs/arizona-jack.c
+++ b/sound/soc/codecs/arizona-jack.c
@@ -1184,7 +1184,7 @@ static int arizona_extcon_device_get_pdata(struct device *dev,
struct arizona *arizona)
{
struct arizona_pdata *pdata = &arizona->pdata;
- unsigned int val = ARIZONA_ACCDET_MODE_HPL;
+ unsigned int val = pdata->hpdet_channel ?: ARIZONA_ACCDET_MODE_HPL;
int ret;
device_property_read_u32(arizona->dev, "wlf,hpdet-channel", &val);
@@ -1213,21 +1213,23 @@ static int arizona_extcon_device_get_pdata(struct device *dev,
device_property_read_u32(arizona->dev, "wlf,micd-timeout-ms",
&pdata->micd_timeout);
- pdata->micd_force_micbias = device_property_read_bool(arizona->dev,
- "wlf,micd-force-micbias");
+ pdata->micd_force_micbias |=
+ device_property_read_bool(arizona->dev,
+ "wlf,micd-force-micbias");
- pdata->micd_software_compare = device_property_read_bool(arizona->dev,
- "wlf,micd-software-compare");
+ pdata->micd_software_compare |=
+ device_property_read_bool(arizona->dev,
+ "wlf,micd-software-compare");
- pdata->jd_invert = device_property_read_bool(arizona->dev,
- "wlf,jd-invert");
+ pdata->jd_invert |= device_property_read_bool(arizona->dev,
+ "wlf,jd-invert");
device_property_read_u32(arizona->dev, "wlf,gpsw", &pdata->gpsw);
- pdata->jd_gpio5 = device_property_read_bool(arizona->dev,
- "wlf,use-jd2");
- pdata->jd_gpio5_nopull = device_property_read_bool(arizona->dev,
- "wlf,use-jd2-nopull");
+ pdata->jd_gpio5 |= device_property_read_bool(arizona->dev,
+ "wlf,use-jd2");
+ pdata->jd_gpio5_nopull |=
+ device_property_read_bool(arizona->dev, "wlf,use-jd2-nopull");
ret = arizona_extcon_get_micd_configs(dev, arizona);
if (ret < 0)
@@ -1242,8 +1244,7 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
struct arizona_pdata *pdata = &arizona->pdata;
int ret, mode;
- if (!dev_get_platdata(arizona->dev))
- arizona_extcon_device_get_pdata(dev, arizona);
+ arizona_extcon_device_get_pdata(dev, arizona);
info->micvdd = devm_regulator_get(dev, "MICVDD");
if (IS_ERR(info->micvdd))
diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c
index 09cef46f09fc..6965a2ec7642 100644
--- a/sound/soc/codecs/cs47l24.c
+++ b/sound/soc/codecs/cs47l24.c
@@ -1222,8 +1222,7 @@ static int cs47l24_probe(struct platform_device *pdev)
if (!cs47l24)
return -ENOMEM;
- if (!dev_get_platdata(arizona->dev))
- arizona_get_audio_pdata(arizona);
+ arizona_get_audio_pdata(arizona);
platform_set_drvdata(pdev, cs47l24);
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index bd747171212e..f7aaf1433ad7 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -2041,8 +2041,7 @@ static int wm5102_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, wm5102);
- if (!dev_get_platdata(arizona->dev))
- arizona_get_audio_pdata(arizona);
+ arizona_get_audio_pdata(arizona);
mutex_init(&arizona->dac_comp_lock);
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index 73c4ffabf4ec..58bcd54aff11 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -2403,8 +2403,7 @@ static int wm5110_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, wm5110);
- if (!dev_get_platdata(arizona->dev))
- arizona_get_audio_pdata(arizona);
+ arizona_get_audio_pdata(arizona);
wm5110->core.arizona = arizona;
wm5110->core.num_inputs = 8;
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
index c126afb65928..877305a83283 100644
--- a/sound/soc/codecs/wm8997.c
+++ b/sound/soc/codecs/wm8997.c
@@ -1119,8 +1119,7 @@ static int wm8997_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, wm8997);
- if (!dev_get_platdata(arizona->dev))
- arizona_get_audio_pdata(arizona);
+ arizona_get_audio_pdata(arizona);
wm8997->core.arizona = arizona;
wm8997->core.num_inputs = 4;
diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c
index fdb2018e9367..28af93104201 100644
--- a/sound/soc/codecs/wm8998.c
+++ b/sound/soc/codecs/wm8998.c
@@ -1346,8 +1346,7 @@ static int wm8998_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, wm8998);
- if (!dev_get_platdata(arizona->dev))
- arizona_get_audio_pdata(arizona);
+ arizona_get_audio_pdata(arizona);
wm8998->core.arizona = arizona;
wm8998->core.num_inputs = 3; /* IN1L, IN1R, IN2 */
--
2.56.0.506.g506a7eabc5-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] ASoC: arizona: drop unused HPDET accessory ID support
2026-11-06 5:39 [PATCH 0/4] ASoC: arizona: switch to generic device properties and clean up Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 1/4] ASoC: arizona: convert audio pdata parsing to generic device properties Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 2/4] ASoC: arizona: always parse device properties regardless of platform data Dmitry Torokhov
@ 2026-11-06 5:39 ` Dmitry Torokhov
2026-11-06 9:36 ` Charles Keepax
2026-11-06 5:39 ` [PATCH 4/4] ASoC: arizona: clean up coding style and formatting Dmitry Torokhov
3 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-06 5:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Charles Keepax, Richard Fitzgerald, David Rhodes, Lee Jones
Cc: patches, linux-sound, linux-kernel, mfd
Nothing in the kernel sets hpdet_acc_id or hpdet_acc_id_line in
struct arizona_pdata, and neither has any Device Tree or ACPI bindings.
Remove both platform data fields and all exclusively connected HPDET
accessory identification logic, work items, GPIO lookup, and state from
the Arizona jack detection driver.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
include/linux/mfd/arizona/pdata.h | 6 --
sound/soc/codecs/arizona-jack.c | 181 +-------------------------------------
sound/soc/codecs/arizona.h | 6 --
3 files changed, 4 insertions(+), 189 deletions(-)
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 984b2edfec07..96ef9c97d4cc 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -112,12 +112,6 @@ struct arizona_pdata {
/** set to true if jackdet contact opens on insert */
bool jd_invert;
- /** Use the headphone detect circuit to identify the accessory */
- bool hpdet_acc_id;
-
- /** Check for line output with HPDET method */
- bool hpdet_acc_id_line;
-
/** Channel to use for headphone detection */
unsigned int hpdet_channel;
diff --git a/sound/soc/codecs/arizona-jack.c b/sound/soc/codecs/arizona-jack.c
index d5f14fc8af7f..737984c206a9 100644
--- a/sound/soc/codecs/arizona-jack.c
+++ b/sound/soc/codecs/arizona-jack.c
@@ -45,7 +45,6 @@
#define ARIZONA_HPDET_MAX 10000
-#define HPDET_DEBOUNCE 500
#define DEFAULT_MICD_TIMEOUT 2000
#define ARIZONA_HPDET_WAIT_COUNT 15
@@ -92,8 +91,6 @@ static const int arizona_micd_levels[] = {
1257, 30000,
};
-static void arizona_start_hpdet_acc_id(struct arizona_priv *info);
-
static void arizona_extcon_hp_clamp(struct arizona_priv *info,
bool clamp)
{
@@ -455,79 +452,11 @@ static int arizona_hpdet_read(struct arizona_priv *info)
return val;
}
-static int arizona_hpdet_do_id(struct arizona_priv *info, int *reading,
- bool *mic)
-{
- struct arizona *arizona = info->arizona;
-
- if (!arizona->pdata.hpdet_acc_id)
- return 0;
-
- /*
- * If we're using HPDET for accessory identification we need
- * to take multiple measurements, step through them in sequence.
- */
- info->hpdet_res[info->num_hpdet_res++] = *reading;
-
- /* Only check the mic directly if we didn't already ID it */
- if (info->hpdet_id_gpio && info->num_hpdet_res == 1) {
- dev_dbg(arizona->dev, "Measuring mic\n");
-
- regmap_update_bits(arizona->regmap,
- ARIZONA_ACCESSORY_DETECT_MODE_1,
- ARIZONA_ACCDET_MODE_MASK |
- ARIZONA_ACCDET_SRC,
- ARIZONA_ACCDET_MODE_HPR |
- info->micd_modes[0].src);
-
- gpiod_set_value_cansleep(info->hpdet_id_gpio, 1);
-
- regmap_update_bits(arizona->regmap, ARIZONA_HEADPHONE_DETECT_1,
- ARIZONA_HP_POLL, ARIZONA_HP_POLL);
- return -EAGAIN;
- }
-
- /* OK, got both. Now, compare... */
- dev_dbg(arizona->dev, "HPDET measured %d %d\n",
- info->hpdet_res[0], info->hpdet_res[1]);
-
- /* Take the headphone impedance for the main report */
- *reading = info->hpdet_res[0];
-
- /* Sometimes we get false readings due to slow insert */
- if (*reading >= ARIZONA_HPDET_MAX && !info->hpdet_retried) {
- dev_dbg(arizona->dev, "Retrying high impedance\n");
- info->num_hpdet_res = 0;
- info->hpdet_retried = true;
- arizona_start_hpdet_acc_id(info);
- pm_runtime_put(arizona->dev);
- return -EAGAIN;
- }
-
- /*
- * If we measure the mic as high impedance
- */
- if (!info->hpdet_id_gpio || info->hpdet_res[1] > 50) {
- dev_dbg(arizona->dev, "Detected mic\n");
- *mic = true;
- info->detecting = true;
- } else {
- dev_dbg(arizona->dev, "Detected headphone\n");
- }
-
- /* Make sure everything is reset back to the real polarity */
- regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1,
- ARIZONA_ACCDET_SRC, info->micd_modes[0].src);
-
- return 0;
-}
-
static irqreturn_t arizona_hpdet_irq(int irq, void *data)
{
struct arizona_priv *info = data;
struct arizona *arizona = info->arizona;
int ret, reading, state, report;
- bool mic = false;
mutex_lock(&info->lock);
@@ -552,18 +481,6 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
goto done;
reading = ret;
- /* Reset back to starting range */
- regmap_update_bits(arizona->regmap,
- ARIZONA_HEADPHONE_DETECT_1,
- ARIZONA_HP_IMPEDANCE_RANGE_MASK | ARIZONA_HP_POLL,
- 0);
-
- ret = arizona_hpdet_do_id(info, &reading, &mic);
- if (ret == -EAGAIN)
- goto out;
- else if (ret < 0)
- goto done;
-
/* Report high impedence cables as line outputs */
if (reading >= 5000)
report = SND_JACK_LINEOUT;
@@ -581,11 +498,8 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
arizona_extcon_hp_clamp(info, false);
- if (info->hpdet_id_gpio)
- gpiod_set_value_cansleep(info->hpdet_id_gpio, 0);
-
/* If we have a mic then reenable MICDET */
- if (state && (mic || info->mic))
+ if (state && info->mic)
arizona_start_mic(info);
if (info->hpdet_active) {
@@ -654,55 +568,6 @@ static void arizona_identify_headphone(struct arizona_priv *info)
info->hpdet_active = false;
}
-static void arizona_start_hpdet_acc_id(struct arizona_priv *info)
-{
- struct arizona *arizona = info->arizona;
- int hp_reading = 32;
- bool mic;
- int ret;
-
- dev_dbg(arizona->dev, "Starting identification via HPDET\n");
-
- /* Make sure we keep the device enabled during the measurement */
- pm_runtime_get_sync(arizona->dev);
-
- info->hpdet_active = true;
-
- arizona_extcon_hp_clamp(info, true);
-
- ret = regmap_update_bits(arizona->regmap,
- ARIZONA_ACCESSORY_DETECT_MODE_1,
- ARIZONA_ACCDET_SRC | ARIZONA_ACCDET_MODE_MASK,
- info->micd_modes[0].src |
- arizona->pdata.hpdet_channel);
- if (ret != 0) {
- dev_err(arizona->dev, "Failed to set HPDET mode: %d\n", ret);
- goto err;
- }
-
- if (arizona->pdata.hpdet_acc_id_line) {
- ret = regmap_update_bits(arizona->regmap,
- ARIZONA_HEADPHONE_DETECT_1,
- ARIZONA_HP_POLL, ARIZONA_HP_POLL);
- if (ret) {
- dev_err(arizona->dev, "Can't start HPDETL measurement: %d\n", ret);
- goto err;
- }
- } else {
- arizona_hpdet_do_id(info, &hp_reading, &mic);
- }
-
- return;
-
-err:
- /* Just report headphone */
- snd_soc_jack_report(info->jack, SND_JACK_HEADPHONE,
- SND_JACK_LINEOUT | SND_JACK_HEADPHONE);
-
- pm_runtime_put_autosuspend(arizona->dev);
- info->hpdet_active = false;
-}
-
static void arizona_micd_timeout_work(struct work_struct *work)
{
struct arizona_priv *info = container_of(work,
@@ -961,16 +826,6 @@ static irqreturn_t arizona_micdet(int irq, void *data)
return IRQ_HANDLED;
}
-static void arizona_hpdet_work(struct work_struct *work)
-{
- struct arizona_priv *info = container_of(work,
- struct arizona_priv,
- hpdet_work.work);
-
- guard(mutex)(&info->lock);
- arizona_start_hpdet_acc_id(info);
-}
-
static int arizona_hpdet_wait(struct arizona_priv *info)
{
struct arizona *arizona = info->arizona;
@@ -1009,10 +864,9 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
struct arizona_priv *info = data;
struct arizona *arizona = info->arizona;
unsigned int val, present, mask;
- bool cancelled_hp, cancelled_mic;
- int ret, i;
+ bool cancelled_mic;
+ int ret;
- cancelled_hp = cancel_delayed_work_sync(&info->hpdet_work);
cancelled_mic = cancel_delayed_work_sync(&info->micd_timeout_work);
guard(pm_runtime_active_auto)(arizona->dev);
@@ -1039,11 +893,6 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
val &= mask;
if (val == info->last_jackdet) {
dev_dbg(arizona->dev, "Suppressing duplicate JACKDET\n");
- if (cancelled_hp)
- queue_delayed_work(system_power_efficient_wq,
- &info->hpdet_work,
- msecs_to_jiffies(HPDET_DEBOUNCE));
-
if (cancelled_mic) {
int micd_timeout = arizona->pdata.micd_timeout;
@@ -1062,13 +911,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
info->mic = false;
info->jack_flips = 0;
- if (!arizona->pdata.hpdet_acc_id) {
- arizona_start_mic(info);
- } else {
- queue_delayed_work(system_power_efficient_wq,
- &info->hpdet_work,
- msecs_to_jiffies(HPDET_DEBOUNCE));
- }
+ arizona_start_mic(info);
if (info->micd_clamp || !arizona->pdata.jd_invert)
regmap_update_bits(arizona->regmap,
@@ -1080,12 +923,8 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
arizona_stop_mic(info);
- info->num_hpdet_res = 0;
- for (i = 0; i < ARRAY_SIZE(info->hpdet_res); i++)
- info->hpdet_res[i] = 0;
info->mic = false;
info->hpdet_done = false;
- info->hpdet_retried = false;
snd_soc_jack_report(info->jack, 0,
ARIZONA_JACK_MASK | info->micd_button_mask);
@@ -1252,7 +1091,6 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
mutex_init(&info->lock);
info->last_jackdet = ~(ARIZONA_MICD_CLAMP_STS | ARIZONA_JD1_STS);
- INIT_DELAYED_WORK(&info->hpdet_work, arizona_hpdet_work);
INIT_DELAYED_WORK(&info->micd_detect_work, arizona_micd_detect);
INIT_DELAYED_WORK(&info->micd_timeout_work, arizona_micd_timeout_work);
@@ -1322,15 +1160,6 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
return ret;
}
- info->hpdet_id_gpio = gpiod_get_optional(arizona->dev,
- "wlf,hpdet-id-gpio",
- mode);
- if (IS_ERR(info->hpdet_id_gpio)) {
- ret = PTR_ERR(info->hpdet_id_gpio);
- dev_err_probe(arizona->dev, ret, "getting headphone detect ID GPIO\n");
- return ret;
- }
-
return 0;
}
EXPORT_SYMBOL_GPL(arizona_jack_codec_dev_probe);
@@ -1338,7 +1167,6 @@ EXPORT_SYMBOL_GPL(arizona_jack_codec_dev_probe);
int arizona_jack_codec_dev_remove(struct arizona_priv *info)
{
gpiod_put(info->micd_pol_gpio);
- gpiod_put(info->hpdet_id_gpio);
return 0;
}
EXPORT_SYMBOL_GPL(arizona_jack_codec_dev_remove);
@@ -1584,7 +1412,6 @@ static int arizona_jack_disable_jack_detect(struct arizona_priv *info)
arizona_free_irq(arizona, ARIZONA_IRQ_MICDET, info);
arizona_free_irq(arizona, jack_irq_rise, info);
arizona_free_irq(arizona, jack_irq_fall, info);
- cancel_delayed_work_sync(&info->hpdet_work);
cancel_delayed_work_sync(&info->micd_detect_work);
cancel_delayed_work_sync(&info->micd_timeout_work);
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index 499891e62183..766a29a23893 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -94,13 +94,11 @@ struct arizona_priv {
/* Variables used by arizona-jack.c code */
struct mutex lock;
- struct delayed_work hpdet_work;
struct delayed_work micd_detect_work;
struct delayed_work micd_timeout_work;
struct snd_soc_jack *jack;
struct regulator *micvdd;
struct gpio_desc *micd_pol_gpio;
- struct gpio_desc *hpdet_id_gpio;
u16 last_jackdet;
@@ -117,14 +115,10 @@ struct arizona_priv {
bool hpdet_active;
bool hpdet_done;
- bool hpdet_retried;
bool mic;
bool detecting;
- int num_hpdet_res;
- unsigned int hpdet_res[3];
-
int jack_flips;
int hpdet_ip_version;
};
--
2.56.0.506.g506a7eabc5-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] ASoC: arizona: clean up coding style and formatting
2026-11-06 5:39 [PATCH 0/4] ASoC: arizona: switch to generic device properties and clean up Dmitry Torokhov
` (2 preceding siblings ...)
2026-11-06 5:39 ` [PATCH 3/4] ASoC: arizona: drop unused HPDET accessory ID support Dmitry Torokhov
@ 2026-11-06 5:39 ` Dmitry Torokhov
3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-06 5:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Charles Keepax, Richard Fitzgerald, David Rhodes, Lee Jones
Cc: patches, linux-sound, linux-kernel, mfd
Clean up minor coding style issues in the Arizona jack detection
driver, removing redundant parentheses and fixing argument continuation
alignment.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
sound/soc/codecs/arizona-jack.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/arizona-jack.c b/sound/soc/codecs/arizona-jack.c
index 737984c206a9..ba1701e79c9b 100644
--- a/sound/soc/codecs/arizona-jack.c
+++ b/sound/soc/codecs/arizona-jack.c
@@ -423,7 +423,7 @@ static int arizona_hpdet_read(struct arizona_priv *info)
/* Skip up a range, or report? */
if (range < ARRAY_SIZE(arizona_hpdet_c_ranges) - 1 &&
- (val >= arizona_hpdet_c_ranges[range].max)) {
+ val >= arizona_hpdet_c_ranges[range].max) {
range++;
dev_dbg(arizona->dev, "Moving to HPDET range %d-%d\n",
arizona_hpdet_c_ranges[range].min,
@@ -436,7 +436,7 @@ static int arizona_hpdet_read(struct arizona_priv *info)
return -EAGAIN;
}
- if (range && (val < arizona_hpdet_c_ranges[range].min)) {
+ if (range && val < arizona_hpdet_c_ranges[range].min) {
dev_dbg(arizona->dev, "Reporting range boundary %d\n",
arizona_hpdet_c_ranges[range].min);
val = arizona_hpdet_c_ranges[range].min;
@@ -833,8 +833,7 @@ static int arizona_hpdet_wait(struct arizona_priv *info)
int i, ret;
for (i = 0; i < ARIZONA_HPDET_WAIT_COUNT; i++) {
- ret = regmap_read(arizona->regmap, ARIZONA_HEADPHONE_DETECT_2,
- &val);
+ ret = regmap_read(arizona->regmap, ARIZONA_HEADPHONE_DETECT_2, &val);
if (ret) {
dev_err(arizona->dev, "Failed to read HPDET state: %d\n", ret);
return ret;
@@ -1139,7 +1138,7 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
if (arizona->pdata.gpsw > 0)
regmap_update_bits(arizona->regmap, ARIZONA_GP_SWITCH_1,
- ARIZONA_SW1_MODE_MASK, arizona->pdata.gpsw);
+ ARIZONA_SW1_MODE_MASK, arizona->pdata.gpsw);
if (info->micd_modes[0].gpio)
mode = GPIOD_OUT_HIGH;
@@ -1151,9 +1150,7 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
* will reside, but if we devm against that the GPIO
* will not be freed if the extcon driver is unloaded.
*/
- info->micd_pol_gpio = gpiod_get_optional(arizona->dev,
- "wlf,micd-pol",
- mode);
+ info->micd_pol_gpio = gpiod_get_optional(arizona->dev, "wlf,micd-pol", mode);
if (IS_ERR(info->micd_pol_gpio)) {
ret = PTR_ERR(info->micd_pol_gpio);
dev_err_probe(arizona->dev, ret, "getting microphone polarity GPIO\n");
@@ -1185,13 +1182,13 @@ static int arizona_jack_enable_jack_detect(struct arizona_priv *info,
regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
ARIZONA_MICD_BIAS_STARTTIME_MASK,
arizona->pdata.micd_bias_start_time
- << ARIZONA_MICD_BIAS_STARTTIME_SHIFT);
+ << ARIZONA_MICD_BIAS_STARTTIME_SHIFT);
if (arizona->pdata.micd_rate)
regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
ARIZONA_MICD_RATE_MASK,
arizona->pdata.micd_rate
- << ARIZONA_MICD_RATE_SHIFT);
+ << ARIZONA_MICD_RATE_SHIFT);
switch (arizona->pdata.micd_dbtime) {
case MICD_DBTIME_FOUR_READINGS:
--
2.56.0.506.g506a7eabc5-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/4] ASoC: arizona: drop unused HPDET accessory ID support
2026-11-06 5:39 ` [PATCH 3/4] ASoC: arizona: drop unused HPDET accessory ID support Dmitry Torokhov
@ 2026-11-06 9:36 ` Charles Keepax
0 siblings, 0 replies; 6+ messages in thread
From: Charles Keepax @ 2026-11-06 9:36 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Richard Fitzgerald, David Rhodes, Lee Jones, patches,
linux-sound, linux-kernel, mfd
On Thu, Nov 05, 2026 at 09:39:34PM -0800, Dmitry Torokhov wrote:
> Nothing in the kernel sets hpdet_acc_id or hpdet_acc_id_line in
> struct arizona_pdata, and neither has any Device Tree or ACPI bindings.
>
> Remove both platform data fields and all exclusively connected HPDET
> accessory identification logic, work items, GPIO lookup, and state from
> the Arizona jack detection driver.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
A little unsure how to proceed here. I certainly wouldn't object
to dropping the added complexity here, but I think this was used
on a couple out of tree systems. I am leaning towards we could
probably let it go?
Thanks,
Charles
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-06 9:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 5:39 [PATCH 0/4] ASoC: arizona: switch to generic device properties and clean up Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 1/4] ASoC: arizona: convert audio pdata parsing to generic device properties Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 2/4] ASoC: arizona: always parse device properties regardless of platform data Dmitry Torokhov
2026-11-06 5:39 ` [PATCH 3/4] ASoC: arizona: drop unused HPDET accessory ID support Dmitry Torokhov
2026-11-06 9:36 ` Charles Keepax
2026-11-06 5:39 ` [PATCH 4/4] ASoC: arizona: clean up coding style and formatting Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®