sof_sdw_hdmi.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. // Copyright (c) 2020 Intel Corporation
  3. /*
  4. * sof_sdw_hdmi - Helpers to handle HDMI from generic machine driver
  5. */
  6. #include <linux/acpi.h>
  7. #include <linux/device.h>
  8. #include <linux/errno.h>
  9. #include <linux/kernel.h>
  10. #include <linux/list.h>
  11. #include <linux/soundwire/sdw_intel.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. int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd)
  18. {
  19. struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(rtd->card);
  20. struct intel_mc_ctx *intel_ctx = (struct intel_mc_ctx *)ctx->private;
  21. struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0);
  22. intel_ctx->hdmi.hdmi_comp = dai->component;
  23. return 0;
  24. }
  25. int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card)
  26. {
  27. struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
  28. struct intel_mc_ctx *intel_ctx = (struct intel_mc_ctx *)ctx->private;
  29. if (!intel_ctx->hdmi.idisp_codec)
  30. return 0;
  31. if (!intel_ctx->hdmi.hdmi_comp)
  32. return -EINVAL;
  33. return hda_dsp_hdmi_build_controls(card, intel_ctx->hdmi.hdmi_comp);
  34. }