diff options
author | Oder Chiou <oder_chiou@realtek.com> | 2015-06-12 02:47:36 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-06-12 06:30:07 -0400 |
commit | 48edaa4b4fb6e75b890942394f0d0c2571d5c90d (patch) | |
tree | 6016c540a7cb2b03e9bead4dbb62c2e8ae838d38 | |
parent | 0b0cefc8fd105f379989164f3ef7e5b4a0d44c1f (diff) |
ASoC: rt5645: Add the device tree parser
Modify the RT5645 driver to parse platform data from device tree. This is
missing from previous patch in sound/soc/codecs/rt5645.c, that was present
in v3.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/rt5645.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 7d04b1aa74f0..18842642a34e 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -3231,6 +3231,20 @@ static struct dmi_system_id dmi_platform_intel_braswell[] = { | |||
3231 | { } | 3231 | { } |
3232 | }; | 3232 | }; |
3233 | 3233 | ||
3234 | static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev) | ||
3235 | { | ||
3236 | rt5645->pdata.in2_diff = device_property_read_bool(dev, | ||
3237 | "realtek,in2-differential"); | ||
3238 | device_property_read_u32(dev, | ||
3239 | "realtek,dmic1-data-pin", &rt5645->pdata.dmic1_data_pin); | ||
3240 | device_property_read_u32(dev, | ||
3241 | "realtek,dmic2-data-pin", &rt5645->pdata.dmic2_data_pin); | ||
3242 | device_property_read_u32(dev, | ||
3243 | "realtek,jd-mode", &rt5645->pdata.jd_mode); | ||
3244 | |||
3245 | return 0; | ||
3246 | } | ||
3247 | |||
3234 | static int rt5645_i2c_probe(struct i2c_client *i2c, | 3248 | static int rt5645_i2c_probe(struct i2c_client *i2c, |
3235 | const struct i2c_device_id *id) | 3249 | const struct i2c_device_id *id) |
3236 | { | 3250 | { |
@@ -3247,13 +3261,12 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, | |||
3247 | rt5645->i2c = i2c; | 3261 | rt5645->i2c = i2c; |
3248 | i2c_set_clientdata(i2c, rt5645); | 3262 | i2c_set_clientdata(i2c, rt5645); |
3249 | 3263 | ||
3250 | if (pdata) { | 3264 | if (pdata) |
3251 | rt5645->pdata = *pdata; | 3265 | rt5645->pdata = *pdata; |
3252 | } else { | 3266 | else if (dmi_check_system(dmi_platform_intel_braswell)) |
3253 | if (dmi_check_system(dmi_platform_intel_braswell)) { | 3267 | rt5645->pdata = *rt5645_pdata; |
3254 | rt5645->pdata = *rt5645_pdata; | 3268 | else |
3255 | } | 3269 | rt5645_parse_dt(rt5645, &i2c->dev); |
3256 | } | ||
3257 | 3270 | ||
3258 | rt5645->gpiod_hp_det = devm_gpiod_get(&i2c->dev, "hp-detect", GPIOD_IN); | 3271 | rt5645->gpiod_hp_det = devm_gpiod_get(&i2c->dev, "hp-detect", GPIOD_IN); |
3259 | 3272 | ||