]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: codec: cs42l52: Drop cs42l52.h
authorPeng Fan <peng.fan@nxp.com>
Tue, 6 May 2025 07:29:38 +0000 (15:29 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 6 May 2025 13:48:17 +0000 (22:48 +0900)
There is no in-tree user of "include/sound/cs42l52.h", so move
'struct cs42l52_platform_data ' to cs42l52.c and remove the header file.
And platform data is mostly for legacy platforms that create devices
non using device tree. So drop cs42l52.h to prepare using GPIOD API.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20250506-csl42x-v3-8-e9496db544c4@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/cs42l52.h [deleted file]
sound/soc/codecs/cs42l52.c

diff --git a/include/sound/cs42l52.h b/include/sound/cs42l52.h
deleted file mode 100644 (file)
index c206496..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * linux/sound/cs42l52.h -- Platform data for CS42L52
- *
- * Copyright (c) 2012 Cirrus Logic Inc.
- */
-
-#ifndef __CS42L52_H
-#define __CS42L52_H
-
-struct cs42l52_platform_data {
-
-       /* MICBIAS Level. Check datasheet Pg48 */
-       unsigned int micbias_lvl;
-
-       /* MICA mode selection Differential or Single-ended */
-       bool mica_diff_cfg;
-
-       /* MICB mode selection Differential or Single-ended */
-       bool micb_diff_cfg;
-
-       /* Charge Pump Freq. Check datasheet Pg73 */
-       unsigned int chgfreq;
-
-       /* Reset GPIO */
-       unsigned int reset_gpio;
-};
-
-#endif /* __CS42L52_H */
index ba2ccc818ba6cc1b5fbcfb38e07e9bc8f68c4a6e..aa8c001cce099e3c1dfc979678fe8000caed097f 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 #include <sound/core.h>
-#include <sound/cs42l52.h>
 #include <sound/initval.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -36,6 +35,24 @@ struct sp_config {
        u32 srate;
 };
 
+struct cs42l52_platform_data {
+
+       /* MICBIAS Level. Check datasheet Pg48 */
+       unsigned int micbias_lvl;
+
+       /* MICA mode selection Differential or Single-ended */
+       bool mica_diff_cfg;
+
+       /* MICB mode selection Differential or Single-ended */
+       bool micb_diff_cfg;
+
+       /* Charge Pump Freq. Check datasheet Pg73 */
+       unsigned int chgfreq;
+
+       /* Reset GPIO */
+       unsigned int reset_gpio;
+};
+
 struct  cs42l52_private {
        struct regmap *regmap;
        struct snd_soc_component *component;
@@ -1090,7 +1107,7 @@ static const struct regmap_config cs42l52_regmap = {
 static int cs42l52_i2c_probe(struct i2c_client *i2c_client)
 {
        struct cs42l52_private *cs42l52;
-       struct cs42l52_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
+       struct cs42l52_platform_data *pdata;
        int ret;
        unsigned int devid;
        unsigned int reg;
@@ -1107,38 +1124,35 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client)
                dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
                return ret;
        }
-       if (pdata) {
-               cs42l52->pdata = *pdata;
-       } else {
-               pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
-                                    GFP_KERNEL);
-               if (!pdata)
-                       return -ENOMEM;
-
-               if (i2c_client->dev.of_node) {
-                       if (of_property_read_bool(i2c_client->dev.of_node,
-                               "cirrus,mica-differential-cfg"))
-                               pdata->mica_diff_cfg = true;
-
-                       if (of_property_read_bool(i2c_client->dev.of_node,
-                               "cirrus,micb-differential-cfg"))
-                               pdata->micb_diff_cfg = true;
-
-                       if (of_property_read_u32(i2c_client->dev.of_node,
-                               "cirrus,micbias-lvl", &val32) >= 0)
-                               pdata->micbias_lvl = val32;
-
-                       if (of_property_read_u32(i2c_client->dev.of_node,
-                               "cirrus,chgfreq-divisor", &val32) >= 0)
-                               pdata->chgfreq = val32;
-
-                       pdata->reset_gpio =
-                               of_get_named_gpio(i2c_client->dev.of_node,
-                                               "cirrus,reset-gpio", 0);
-               }
-               cs42l52->pdata = *pdata;
+
+       pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), GFP_KERNEL);
+       if (!pdata)
+               return -ENOMEM;
+
+       if (i2c_client->dev.of_node) {
+               if (of_property_read_bool(i2c_client->dev.of_node,
+                       "cirrus,mica-differential-cfg"))
+                       pdata->mica_diff_cfg = true;
+
+               if (of_property_read_bool(i2c_client->dev.of_node,
+                       "cirrus,micb-differential-cfg"))
+                       pdata->micb_diff_cfg = true;
+
+               if (of_property_read_u32(i2c_client->dev.of_node,
+                       "cirrus,micbias-lvl", &val32) >= 0)
+                       pdata->micbias_lvl = val32;
+
+               if (of_property_read_u32(i2c_client->dev.of_node,
+                       "cirrus,chgfreq-divisor", &val32) >= 0)
+                       pdata->chgfreq = val32;
+
+               pdata->reset_gpio =
+                       of_get_named_gpio(i2c_client->dev.of_node,
+                                       "cirrus,reset-gpio", 0);
        }
 
+       cs42l52->pdata = *pdata;
+
        if (cs42l52->pdata.reset_gpio) {
                ret = devm_gpio_request_one(&i2c_client->dev,
                                            cs42l52->pdata.reset_gpio,