summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorTzung-Bi Shih <tzungbi@google.com>2020-09-08 15:00:44 +0800
committerMark Brown <broonie@kernel.org>2020-09-08 13:55:01 +0100
commit6835302853169441069e11bc4642300c22009c2e (patch)
treee8586a73a54c3dcc46e6dccbb4f52df92acbe0b4 /sound
parent783560d02dd61aee20d1d00c1c061bcafea30264 (diff)
ASoC: mt6359: fix failed to parse DT properties
Mt6359 platform device is instantiated by mfd_add_devices(). In the case, dev->of_node is NULL so that mt6359_parse_dt() always fails to parse the desired DT properties. Gets the DT properties via dev->parent->of_node. Fixes: 8061734ab654 ("ASoC: mediatek: mt6359: add codec driver") Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Link: https://lore.kernel.org/r/20200908070044.1142644-1-tzungbi@google.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/mt6359.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c
index 72f05335b420..81aafb553bdd 100644
--- a/sound/soc/codecs/mt6359.c
+++ b/sound/soc/codecs/mt6359.c
@@ -2636,8 +2636,13 @@ static int mt6359_parse_dt(struct mt6359_priv *priv)
{
int ret;
struct device *dev = priv->dev;
+ struct device_node *np;
- ret = of_property_read_u32(dev->of_node, "mediatek,dmic-mode",
+ np = of_get_child_by_name(dev->parent->of_node, "mt6359codec");
+ if (!np)
+ return -EINVAL;
+
+ ret = of_property_read_u32(np, "mediatek,dmic-mode",
&priv->dmic_one_wire_mode);
if (ret) {
dev_warn(priv->dev, "%s() failed to read dmic-mode\n",
@@ -2645,7 +2650,7 @@ static int mt6359_parse_dt(struct mt6359_priv *priv)
priv->dmic_one_wire_mode = 0;
}
- ret = of_property_read_u32(dev->of_node, "mediatek,mic-type-0",
+ ret = of_property_read_u32(np, "mediatek,mic-type-0",
&priv->mux_select[MUX_MIC_TYPE_0]);
if (ret) {
dev_warn(priv->dev, "%s() failed to read mic-type-0\n",
@@ -2653,7 +2658,7 @@ static int mt6359_parse_dt(struct mt6359_priv *priv)
priv->mux_select[MUX_MIC_TYPE_0] = MIC_TYPE_MUX_IDLE;
}
- ret = of_property_read_u32(dev->of_node, "mediatek,mic-type-1",
+ ret = of_property_read_u32(np, "mediatek,mic-type-1",
&priv->mux_select[MUX_MIC_TYPE_1]);
if (ret) {
dev_warn(priv->dev, "%s() failed to read mic-type-1\n",
@@ -2661,7 +2666,7 @@ static int mt6359_parse_dt(struct mt6359_priv *priv)
priv->mux_select[MUX_MIC_TYPE_1] = MIC_TYPE_MUX_IDLE;
}
- ret = of_property_read_u32(dev->of_node, "mediatek,mic-type-2",
+ ret = of_property_read_u32(np, "mediatek,mic-type-2",
&priv->mux_select[MUX_MIC_TYPE_2]);
if (ret) {
dev_warn(priv->dev, "%s() failed to read mic-type-2\n",