diff mbox series

ASoC: mt6359: fix failed to parse DT properties

Message ID 20200908070044.1142644-1-tzungbi@google.com
State Accepted
Commit 6835302853169441069e11bc4642300c22009c2e
Headers show
Series ASoC: mt6359: fix failed to parse DT properties | expand

Commit Message

Tzung-Bi Shih Sept. 8, 2020, 7 a.m. UTC
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>
---
Previous discussion: https://mailman.alsa-project.org/pipermail/alsa-devel/2020-September/173773.html

 sound/soc/codecs/mt6359.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Mark Brown Sept. 8, 2020, 5:20 p.m. UTC | #1
On Tue, 8 Sep 2020 15:00:44 +0800, Tzung-Bi Shih wrote:
> 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.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: mt6359: fix failed to parse DT properties
      commit: 6835302853169441069e11bc4642300c22009c2e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

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",