Skip to content

Commit 772c036

Browse files
MrVanbroonie
authored andcommitted
ASoC: codec: cs42l52: Drop cs42l52.h
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>
1 parent 2d70332 commit 772c036

2 files changed

Lines changed: 46 additions & 61 deletions

File tree

include/sound/cs42l52.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

sound/soc/codecs/cs42l52.c

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <linux/slab.h>
2323
#include <linux/workqueue.h>
2424
#include <sound/core.h>
25-
#include <sound/cs42l52.h>
2625
#include <sound/initval.h>
2726
#include <sound/pcm.h>
2827
#include <sound/pcm_params.h>
@@ -36,6 +35,24 @@ struct sp_config {
3635
u32 srate;
3736
};
3837

38+
struct cs42l52_platform_data {
39+
40+
/* MICBIAS Level. Check datasheet Pg48 */
41+
unsigned int micbias_lvl;
42+
43+
/* MICA mode selection Differential or Single-ended */
44+
bool mica_diff_cfg;
45+
46+
/* MICB mode selection Differential or Single-ended */
47+
bool micb_diff_cfg;
48+
49+
/* Charge Pump Freq. Check datasheet Pg73 */
50+
unsigned int chgfreq;
51+
52+
/* Reset GPIO */
53+
unsigned int reset_gpio;
54+
};
55+
3956
struct cs42l52_private {
4057
struct regmap *regmap;
4158
struct snd_soc_component *component;
@@ -1090,7 +1107,7 @@ static const struct regmap_config cs42l52_regmap = {
10901107
static int cs42l52_i2c_probe(struct i2c_client *i2c_client)
10911108
{
10921109
struct cs42l52_private *cs42l52;
1093-
struct cs42l52_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
1110+
struct cs42l52_platform_data *pdata;
10941111
int ret;
10951112
unsigned int devid;
10961113
unsigned int reg;
@@ -1107,38 +1124,35 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client)
11071124
dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
11081125
return ret;
11091126
}
1110-
if (pdata) {
1111-
cs42l52->pdata = *pdata;
1112-
} else {
1113-
pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
1114-
GFP_KERNEL);
1115-
if (!pdata)
1116-
return -ENOMEM;
1117-
1118-
if (i2c_client->dev.of_node) {
1119-
if (of_property_read_bool(i2c_client->dev.of_node,
1120-
"cirrus,mica-differential-cfg"))
1121-
pdata->mica_diff_cfg = true;
1122-
1123-
if (of_property_read_bool(i2c_client->dev.of_node,
1124-
"cirrus,micb-differential-cfg"))
1125-
pdata->micb_diff_cfg = true;
1126-
1127-
if (of_property_read_u32(i2c_client->dev.of_node,
1128-
"cirrus,micbias-lvl", &val32) >= 0)
1129-
pdata->micbias_lvl = val32;
1130-
1131-
if (of_property_read_u32(i2c_client->dev.of_node,
1132-
"cirrus,chgfreq-divisor", &val32) >= 0)
1133-
pdata->chgfreq = val32;
1134-
1135-
pdata->reset_gpio =
1136-
of_get_named_gpio(i2c_client->dev.of_node,
1137-
"cirrus,reset-gpio", 0);
1138-
}
1139-
cs42l52->pdata = *pdata;
1127+
1128+
pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), GFP_KERNEL);
1129+
if (!pdata)
1130+
return -ENOMEM;
1131+
1132+
if (i2c_client->dev.of_node) {
1133+
if (of_property_read_bool(i2c_client->dev.of_node,
1134+
"cirrus,mica-differential-cfg"))
1135+
pdata->mica_diff_cfg = true;
1136+
1137+
if (of_property_read_bool(i2c_client->dev.of_node,
1138+
"cirrus,micb-differential-cfg"))
1139+
pdata->micb_diff_cfg = true;
1140+
1141+
if (of_property_read_u32(i2c_client->dev.of_node,
1142+
"cirrus,micbias-lvl", &val32) >= 0)
1143+
pdata->micbias_lvl = val32;
1144+
1145+
if (of_property_read_u32(i2c_client->dev.of_node,
1146+
"cirrus,chgfreq-divisor", &val32) >= 0)
1147+
pdata->chgfreq = val32;
1148+
1149+
pdata->reset_gpio =
1150+
of_get_named_gpio(i2c_client->dev.of_node,
1151+
"cirrus,reset-gpio", 0);
11401152
}
11411153

1154+
cs42l52->pdata = *pdata;
1155+
11421156
if (cs42l52->pdata.reset_gpio) {
11431157
ret = devm_gpio_request_one(&i2c_client->dev,
11441158
cs42l52->pdata.reset_gpio,

0 commit comments

Comments
 (0)