2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

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.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://patch.msgid.link/20250306-mt8188-accdet-v3-2-7828e835ff4b@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Nícolas F. R. A. Prado 2025-03-06 16:52:16 -03:00 committed by Mark Brown
parent 3fec903f2c
commit cf536e2622
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 19 additions and 1 deletions

View File

@ -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;
}; };

View File

@ -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);
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,20 @@ 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 (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");
} else {
dev_err(&pdev->dev, "No device found from mediatek,accdet property\n");
}
}
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,