Loading...
1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (c) 2020 Intel Corporation
3
4/*
5 * sof_sdw_hdmi - Helpers to handle HDMI from generic machine driver
6 */
7
8#include <linux/acpi.h>
9#include <linux/device.h>
10#include <linux/errno.h>
11#include <linux/kernel.h>
12#include <linux/list.h>
13#include <linux/soundwire/sdw_intel.h>
14#include <sound/soc.h>
15#include <sound/soc-acpi.h>
16#include <sound/jack.h>
17#include "sof_sdw_common.h"
18#include "hda_dsp_common.h"
19
20int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd)
21{
22 struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(rtd->card);
23 struct intel_mc_ctx *intel_ctx = (struct intel_mc_ctx *)ctx->private;
24 struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0);
25
26 intel_ctx->hdmi.hdmi_comp = dai->component;
27
28 return 0;
29}
30
31int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card)
32{
33 struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
34 struct intel_mc_ctx *intel_ctx = (struct intel_mc_ctx *)ctx->private;
35
36 if (!intel_ctx->hdmi.idisp_codec)
37 return 0;
38
39 if (!intel_ctx->hdmi.hdmi_comp)
40 return -EINVAL;
41
42 return hda_dsp_hdmi_build_controls(card, intel_ctx->hdmi.hdmi_comp);
43}
1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (c) 2020 Intel Corporation
3
4/*
5 * sof_sdw_hdmi - Helpers to handle HDMI from generic machine driver
6 */
7
8#include <linux/device.h>
9#include <linux/errno.h>
10#include <linux/kernel.h>
11#include <linux/list.h>
12#include <sound/soc.h>
13#include <sound/soc-acpi.h>
14#include <sound/jack.h>
15#include "sof_sdw_common.h"
16#include "hda_dsp_common.h"
17
18int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd)
19{
20 struct mc_private *ctx = snd_soc_card_get_drvdata(rtd->card);
21 struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0);
22
23 ctx->hdmi.hdmi_comp = dai->component;
24
25 return 0;
26}
27
28int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card)
29{
30 struct mc_private *ctx = snd_soc_card_get_drvdata(card);
31
32 if (!ctx->hdmi.idisp_codec)
33 return 0;
34
35 if (!ctx->hdmi.hdmi_comp)
36 return -EINVAL;
37
38 return hda_dsp_hdmi_build_controls(card, ctx->hdmi.hdmi_comp);
39}