summaryrefslogtreecommitdiff
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-11-26 22:40:20 +0100
committerMark Brown <broonie@kernel.org>2023-12-21 21:00:44 +0000
commitf72a9c2b8f1487181302d69fb82d5c76226be3fb (patch)
treed441442e2da2df7f7c036add1f00b7977c772683 /sound/soc/codecs
parent8f28e1996a786a7538d65e5258d3eecb92943673 (diff)
ASoC: rt5645: Refactor rt5645_parse_dt()
Refactor rt5645_parse_dt(), make it take a pointer to struct rt5645_platform_data as argument instead of passing in the complete rt5645_priv struct. While at it also make it void since it always succeeds. This is a preparation patch for factoring the code to get the platform-data out into a separate helper function. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://msgid.link/r/20231126214024.300505-4-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/rt5645.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 20bbdf76ffd7..7d0ad5650b44 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3869,18 +3869,12 @@ static bool rt5645_check_dp(struct device *dev)
return false;
}
-static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
+static void rt5645_parse_dt(struct device *dev, struct rt5645_platform_data *pdata)
{
- rt5645->pdata.in2_diff = device_property_read_bool(dev,
- "realtek,in2-differential");
- device_property_read_u32(dev,
- "realtek,dmic1-data-pin", &rt5645->pdata.dmic1_data_pin);
- device_property_read_u32(dev,
- "realtek,dmic2-data-pin", &rt5645->pdata.dmic2_data_pin);
- device_property_read_u32(dev,
- "realtek,jd-mode", &rt5645->pdata.jd_mode);
-
- return 0;
+ pdata->in2_diff = device_property_read_bool(dev, "realtek,in2-differential");
+ device_property_read_u32(dev, "realtek,dmic1-data-pin", &pdata->dmic1_data_pin);
+ device_property_read_u32(dev, "realtek,dmic2-data-pin", &pdata->dmic2_data_pin);
+ device_property_read_u32(dev, "realtek,jd-mode", &pdata->jd_mode);
}
static int rt5645_i2c_probe(struct i2c_client *i2c)
@@ -3909,7 +3903,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c)
if (pdata)
rt5645->pdata = *pdata;
else if (rt5645_check_dp(&i2c->dev))
- rt5645_parse_dt(rt5645, &i2c->dev);
+ rt5645_parse_dt(&i2c->dev, &rt5645->pdata);
else
rt5645->pdata = jd_mode3_platform_data;