]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: wm8904: Don't touch GPIO configs set to 0xFFFF
authorErnest Van Hoecke <ernest.vanhoecke@toradex.com>
Wed, 19 Mar 2025 14:20:56 +0000 (15:20 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 20 Mar 2025 12:42:28 +0000 (12:42 +0000)
When updating the GPIO registers, do nothing for all fields of gpio_cfg
that are "0xFFFF".

This "do nothing" flag used to be 0 to easily check whether the gpio_cfg
field was actually set inside pdata or left empty (default).

However, 0 is a valid configuration for these registers, while 0xFFFF is
not.

With this change, users can explicitly set them to 0.
Not setting gpio_cfg in the platform data will now lead to setting all
GPIO registers to 0 instead of leaving them unset.

No one is using this platform data with this codec.

The change gets the driver ready to properly set gpio_cfg from the DT.

Datasheet: https://statics.cirrus.com/pubs/proDatasheet/WM8904_Rev4.1.pdf
Signed-off-by: Ernest Van Hoecke <ernest.vanhoecke@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250319142059.46692-3-francesco@dolcini.it
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wm8904.c

index aef82532f8cfe34300dc85fcfd6e313c9b5f741b..2082ff12d3367b3bb7bf5fbbed904ecd8077bd6c 100644 (file)
@@ -2270,7 +2270,8 @@ static int wm8904_i2c_probe(struct i2c_client *i2c)
        /* Apply configuration from the platform data. */
        if (wm8904->pdata) {
                for (i = 0; i < WM8904_GPIO_REGS; i++) {
-                       if (!wm8904->pdata->gpio_cfg[i])
+                       /* 0xFFFF in this config means "don't touch" */
+                       if (wm8904->pdata->gpio_cfg[i] == 0xffff)
                                continue;
 
                        regmap_update_bits(wm8904->regmap,