summaryrefslogtreecommitdiff
path: root/sound/soc/mediatek/common/mtk-soundcard-driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/mediatek/common/mtk-soundcard-driver.c')
-rw-r--r--sound/soc/mediatek/common/mtk-soundcard-driver.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/sound/soc/mediatek/common/mtk-soundcard-driver.c b/sound/soc/mediatek/common/mtk-soundcard-driver.c
index 3bbf42c42805..95a083939f3e 100644
--- a/sound/soc/mediatek/common/mtk-soundcard-driver.c
+++ b/sound/soc/mediatek/common/mtk-soundcard-driver.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_platform.h>
#include <sound/soc.h>
#include "mtk-dsp-sof-common.h"
@@ -192,7 +193,9 @@ EXPORT_SYMBOL_GPL(mtk_soundcard_common_capture_ops);
int mtk_soundcard_common_probe(struct platform_device *pdev)
{
- struct device_node *platform_node, *adsp_node;
+ struct device_node *platform_node, *adsp_node, *accdet_node;
+ struct snd_soc_component *accdet_comp;
+ struct platform_device *accdet_pdev;
const struct mtk_soundcard_pdata *pdata;
struct mtk_soc_card_data *soc_card_data;
struct snd_soc_dai_link *orig_dai_link, *dai_link;
@@ -221,7 +224,7 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
card->name = pdata->card_name;
}
- needs_legacy_probe = !of_property_read_bool(pdev->dev.of_node, "audio-routing");
+ needs_legacy_probe = !of_property_present(pdev->dev.of_node, "audio-routing");
if (needs_legacy_probe) {
/*
* If we have no .soc_probe() callback there's no way of using
@@ -250,6 +253,24 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
soc_card_data->card_data->jacks = jacks;
+ accdet_node = of_parse_phandle(pdev->dev.of_node, "mediatek,accdet", 0);
+ if (accdet_node) {
+ accdet_pdev = of_find_device_by_node(accdet_node);
+ if (accdet_pdev) {
+ accdet_comp = snd_soc_lookup_component(&accdet_pdev->dev, NULL);
+ if (accdet_comp)
+ soc_card_data->accdet = accdet_comp;
+ else
+ dev_err(&pdev->dev, "No sound component found from mediatek,accdet property\n");
+
+ put_device(&accdet_pdev->dev);
+ } else {
+ dev_err(&pdev->dev, "No device found from mediatek,accdet property\n");
+ }
+
+ of_node_put(accdet_node);
+ }
+
platform_node = of_parse_phandle(pdev->dev.of_node, "mediatek,platform", 0);
if (!platform_node)
return dev_err_probe(&pdev->dev, -EINVAL,
@@ -262,7 +283,7 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
adsp_node = NULL;
if (adsp_node) {
- if (of_property_read_bool(pdev->dev.of_node, "mediatek,dai-link")) {
+ if (of_property_present(pdev->dev.of_node, "mediatek,dai-link")) {
ret = mtk_sof_dailink_parse_of(card, pdev->dev.of_node,
"mediatek,dai-link",
card->dai_link, card->num_links);