|
8 | 8 |
|
9 | 9 | #include <linux/module.h>
|
10 | 10 | #include <linux/of.h>
|
| 11 | +#include <linux/of_platform.h> |
11 | 12 | #include <sound/soc.h>
|
12 | 13 |
|
13 | 14 | #include "mtk-dsp-sof-common.h"
|
@@ -192,7 +193,9 @@ EXPORT_SYMBOL_GPL(mtk_soundcard_common_capture_ops);
|
192 | 193 |
|
193 | 194 | int mtk_soundcard_common_probe(struct platform_device *pdev)
|
194 | 195 | {
|
195 |
| - struct device_node *platform_node, *adsp_node; |
| 196 | + struct device_node *platform_node, *adsp_node, *accdet_node; |
| 197 | + struct snd_soc_component *accdet_comp; |
| 198 | + struct platform_device *accdet_pdev; |
196 | 199 | const struct mtk_soundcard_pdata *pdata;
|
197 | 200 | struct mtk_soc_card_data *soc_card_data;
|
198 | 201 | struct snd_soc_dai_link *orig_dai_link, *dai_link;
|
@@ -250,6 +253,20 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
|
250 | 253 |
|
251 | 254 | soc_card_data->card_data->jacks = jacks;
|
252 | 255 |
|
| 256 | + accdet_node = of_parse_phandle(pdev->dev.of_node, "mediatek,accdet", 0); |
| 257 | + if (accdet_node) { |
| 258 | + accdet_pdev = of_find_device_by_node(accdet_node); |
| 259 | + if (accdet_pdev) { |
| 260 | + accdet_comp = snd_soc_lookup_component(&accdet_pdev->dev, NULL); |
| 261 | + if (accdet_comp) |
| 262 | + soc_card_data->accdet = accdet_comp; |
| 263 | + else |
| 264 | + dev_err(&pdev->dev, "No sound component found from mediatek,accdet property\n"); |
| 265 | + } else { |
| 266 | + dev_err(&pdev->dev, "No device found from mediatek,accdet property\n"); |
| 267 | + } |
| 268 | + } |
| 269 | + |
253 | 270 | platform_node = of_parse_phandle(pdev->dev.of_node, "mediatek,platform", 0);
|
254 | 271 | if (!platform_node)
|
255 | 272 | return dev_err_probe(&pdev->dev, -EINVAL,
|
|
0 commit comments