cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

sof_sdw_hdmi.c (1428B)


      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
     18struct hdmi_pcm {
     19	struct list_head head;
     20	struct snd_soc_dai *codec_dai;
     21	int device;
     22};
     23
     24int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd)
     25{
     26	struct mc_private *ctx = snd_soc_card_get_drvdata(rtd->card);
     27	struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
     28	struct hdmi_pcm *pcm;
     29
     30	pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
     31	if (!pcm)
     32		return -ENOMEM;
     33
     34	/* dai_link id is 1:1 mapped to the PCM device */
     35	pcm->device = rtd->dai_link->id;
     36	pcm->codec_dai = dai;
     37
     38	list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
     39
     40	return 0;
     41}
     42
     43#define NAME_SIZE	32
     44int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card)
     45{
     46	struct mc_private *ctx = snd_soc_card_get_drvdata(card);
     47	struct hdmi_pcm *pcm;
     48	struct snd_soc_component *component = NULL;
     49
     50	if (!ctx->idisp_codec)
     51		return 0;
     52
     53	if (list_empty(&ctx->hdmi_pcm_list))
     54		return -EINVAL;
     55
     56	pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm,
     57			       head);
     58	component = pcm->codec_dai->component;
     59
     60	return hda_dsp_hdmi_build_controls(card, component);
     61}