Skip to content
Snippets Groups Projects
Unverified Commit cc0e8feb authored by Nícolas F. R. A. Prado's avatar Nícolas F. R. A. Prado Committed by AngeloGioacchino Del Regno
Browse files

ASoC: mediatek: common: Handle mediatek,accdet property


Handle the optional mediatek,accdet property. When present, retrieve the
sound component from its phandle, so the machine sound driver can use it
to register the audio jack and initialize the MT6359 ACCDET for jack
detection.

Signed-off-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
parent c0f1a35b
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ struct mtk_soc_card_data { ...@@ -16,6 +16,7 @@ struct mtk_soc_card_data {
const struct mtk_sof_priv *sof_priv; const struct mtk_sof_priv *sof_priv;
struct list_head sof_dai_link_list; struct list_head sof_dai_link_list;
struct mtk_platform_card_data *card_data; struct mtk_platform_card_data *card_data;
struct snd_soc_component *accdet;
void *mach_priv; void *mach_priv;
}; };
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_platform.h>
#include <sound/soc.h> #include <sound/soc.h>
#include "mtk-dsp-sof-common.h" #include "mtk-dsp-sof-common.h"
...@@ -192,7 +193,9 @@ EXPORT_SYMBOL_GPL(mtk_soundcard_common_capture_ops); ...@@ -192,7 +193,9 @@ EXPORT_SYMBOL_GPL(mtk_soundcard_common_capture_ops);
int mtk_soundcard_common_probe(struct platform_device *pdev) 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; const struct mtk_soundcard_pdata *pdata;
struct mtk_soc_card_data *soc_card_data; struct mtk_soc_card_data *soc_card_data;
struct snd_soc_dai_link *orig_dai_link, *dai_link; struct snd_soc_dai_link *orig_dai_link, *dai_link;
...@@ -250,6 +253,16 @@ int mtk_soundcard_common_probe(struct platform_device *pdev) ...@@ -250,6 +253,16 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
soc_card_data->card_data->jacks = jacks; soc_card_data->card_data->jacks = jacks;
accdet_node = of_parse_phandle(pdev->dev.of_node, "mediatek,accdet", 0);
if (!IS_ERR(accdet_node)) {
accdet_pdev = of_find_device_by_node(accdet_node);
if (!IS_ERR(accdet_pdev)) {
accdet_comp = snd_soc_lookup_component(&accdet_pdev->dev, NULL);
if (!IS_ERR(accdet_comp))
soc_card_data->accdet = accdet_comp;
}
}
platform_node = of_parse_phandle(pdev->dev.of_node, "mediatek,platform", 0); platform_node = of_parse_phandle(pdev->dev.of_node, "mediatek,platform", 0);
if (!platform_node) if (!platform_node)
return dev_err_probe(&pdev->dev, -EINVAL, return dev_err_probe(&pdev->dev, -EINVAL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment