Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright(c) 2015-18 Intel Corporation.
0004  */
0005 
0006 /*
0007  * This file defines data structures used in Machine Driver for Intel
0008  * platforms with HDA Codecs.
0009  */
0010 
0011 #ifndef __SKL_HDA_DSP_COMMON_H
0012 #define __SKL_HDA_DSP_COMMON_H
0013 #include <linux/module.h>
0014 #include <linux/platform_device.h>
0015 #include <sound/core.h>
0016 #include <sound/jack.h>
0017 #include <sound/hda_codec.h>
0018 #include "../../codecs/hdac_hda.h"
0019 #include "hda_dsp_common.h"
0020 
0021 #define HDA_DSP_MAX_BE_DAI_LINKS 7
0022 
0023 struct skl_hda_hdmi_pcm {
0024     struct list_head head;
0025     struct snd_soc_dai *codec_dai;
0026     struct snd_soc_jack hdmi_jack;
0027     int device;
0028 };
0029 
0030 struct skl_hda_private {
0031     struct list_head hdmi_pcm_list;
0032     int pcm_count;
0033     int dai_index;
0034     const char *platform_name;
0035     bool common_hdmi_codec_drv;
0036     bool idisp_codec;
0037 };
0038 
0039 extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS];
0040 int skl_hda_hdmi_jack_init(struct snd_soc_card *card);
0041 int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device);
0042 
0043 /*
0044  * Search card topology and register HDMI PCM related controls
0045  * to codec driver.
0046  */
0047 static inline int skl_hda_hdmi_build_controls(struct snd_soc_card *card)
0048 {
0049     struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
0050     struct snd_soc_component *component;
0051     struct skl_hda_hdmi_pcm *pcm;
0052 
0053     /* HDMI disabled, do not create controls */
0054     if (list_empty(&ctx->hdmi_pcm_list))
0055         return 0;
0056 
0057     pcm = list_first_entry(&ctx->hdmi_pcm_list, struct skl_hda_hdmi_pcm,
0058                    head);
0059     component = pcm->codec_dai->component;
0060     if (!component)
0061         return -EINVAL;
0062 
0063     return hda_dsp_hdmi_build_controls(card, component);
0064 }
0065 
0066 #endif /* __SOUND_SOC_HDA_DSP_COMMON_H */