root/sound/soc/intel/boards/skl_hda_dsp_common.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. skl_hda_hdmi_add_pcm
  2. skl_hda_hdmi_jack_init

   1 // SPDX-License-Identifier: GPL-2.0
   2 // Copyright(c) 2015-18 Intel Corporation.
   3 
   4 /*
   5  * Common functions used in different Intel machine drivers
   6  */
   7 #include <linux/module.h>
   8 #include <linux/platform_device.h>
   9 #include <sound/core.h>
  10 #include <sound/jack.h>
  11 #include <sound/pcm.h>
  12 #include <sound/pcm_params.h>
  13 #include <sound/soc.h>
  14 #include "../../codecs/hdac_hdmi.h"
  15 #include "skl_hda_dsp_common.h"
  16 
  17 #define NAME_SIZE       32
  18 
  19 int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device)
  20 {
  21         struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
  22         struct skl_hda_hdmi_pcm *pcm;
  23         char dai_name[NAME_SIZE];
  24 
  25         pcm = devm_kzalloc(card->dev, sizeof(*pcm), GFP_KERNEL);
  26         if (!pcm)
  27                 return -ENOMEM;
  28 
  29         snprintf(dai_name, sizeof(dai_name), "intel-hdmi-hifi%d",
  30                  ctx->dai_index);
  31         pcm->codec_dai = snd_soc_card_get_codec_dai(card, dai_name);
  32         if (!pcm->codec_dai)
  33                 return -EINVAL;
  34 
  35         pcm->device = device;
  36         list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
  37 
  38         return 0;
  39 }
  40 
  41 SND_SOC_DAILINK_DEF(idisp1_cpu,
  42         DAILINK_COMP_ARRAY(COMP_CPU("iDisp1 Pin")));
  43 SND_SOC_DAILINK_DEF(idisp1_codec,
  44         DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi1")));
  45 
  46 SND_SOC_DAILINK_DEF(idisp2_cpu,
  47         DAILINK_COMP_ARRAY(COMP_CPU("iDisp2 Pin")));
  48 SND_SOC_DAILINK_DEF(idisp2_codec,
  49         DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi2")));
  50 
  51 SND_SOC_DAILINK_DEF(idisp3_cpu,
  52         DAILINK_COMP_ARRAY(COMP_CPU("iDisp3 Pin")));
  53 SND_SOC_DAILINK_DEF(idisp3_codec,
  54         DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi3")));
  55 
  56 SND_SOC_DAILINK_DEF(analog_cpu,
  57         DAILINK_COMP_ARRAY(COMP_CPU("Analog CPU DAI")));
  58 SND_SOC_DAILINK_DEF(analog_codec,
  59         DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D0", "Analog Codec DAI")));
  60 
  61 SND_SOC_DAILINK_DEF(digital_cpu,
  62         DAILINK_COMP_ARRAY(COMP_CPU("Digital CPU DAI")));
  63 SND_SOC_DAILINK_DEF(digital_codec,
  64         DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D0", "Digital Codec DAI")));
  65 
  66 SND_SOC_DAILINK_DEF(dmic_pin,
  67         DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin")));
  68 
  69 SND_SOC_DAILINK_DEF(dmic_codec,
  70         DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
  71 
  72 SND_SOC_DAILINK_DEF(dmic16k,
  73         DAILINK_COMP_ARRAY(COMP_CPU("DMIC16k Pin")));
  74 
  75 SND_SOC_DAILINK_DEF(platform,
  76         DAILINK_COMP_ARRAY(COMP_PLATFORM("0000:00:1f.3")));
  77 
  78 /* skl_hda_digital audio interface glue - connects codec <--> CPU */
  79 struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = {
  80         /* Back End DAI links */
  81         {
  82                 .name = "iDisp1",
  83                 .id = 1,
  84                 .dpcm_playback = 1,
  85                 .no_pcm = 1,
  86                 SND_SOC_DAILINK_REG(idisp1_cpu, idisp1_codec, platform),
  87         },
  88         {
  89                 .name = "iDisp2",
  90                 .id = 2,
  91                 .dpcm_playback = 1,
  92                 .no_pcm = 1,
  93                 SND_SOC_DAILINK_REG(idisp2_cpu, idisp2_codec, platform),
  94         },
  95         {
  96                 .name = "iDisp3",
  97                 .id = 3,
  98                 .dpcm_playback = 1,
  99                 .no_pcm = 1,
 100                 SND_SOC_DAILINK_REG(idisp3_cpu, idisp3_codec, platform),
 101         },
 102         {
 103                 .name = "Analog Playback and Capture",
 104                 .id = 4,
 105                 .dpcm_playback = 1,
 106                 .dpcm_capture = 1,
 107                 .no_pcm = 1,
 108                 SND_SOC_DAILINK_REG(analog_cpu, analog_codec, platform),
 109         },
 110         {
 111                 .name = "Digital Playback and Capture",
 112                 .id = 5,
 113                 .dpcm_playback = 1,
 114                 .dpcm_capture = 1,
 115                 .no_pcm = 1,
 116                 SND_SOC_DAILINK_REG(digital_cpu, digital_codec, platform),
 117         },
 118         {
 119                 .name = "dmic01",
 120                 .id = 6,
 121                 .dpcm_capture = 1,
 122                 .no_pcm = 1,
 123                 SND_SOC_DAILINK_REG(dmic_pin, dmic_codec, platform),
 124         },
 125         {
 126                 .name = "dmic16k",
 127                 .id = 7,
 128                 .dpcm_capture = 1,
 129                 .no_pcm = 1,
 130                 SND_SOC_DAILINK_REG(dmic16k, dmic_codec, platform),
 131         },
 132 };
 133 
 134 int skl_hda_hdmi_jack_init(struct snd_soc_card *card)
 135 {
 136         struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
 137         struct snd_soc_component *component = NULL;
 138         struct skl_hda_hdmi_pcm *pcm;
 139         char jack_name[NAME_SIZE];
 140         int err;
 141 
 142         list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
 143                 component = pcm->codec_dai->component;
 144                 snprintf(jack_name, sizeof(jack_name),
 145                          "HDMI/DP, pcm=%d Jack", pcm->device);
 146                 err = snd_soc_card_jack_new(card, jack_name,
 147                                             SND_JACK_AVOUT, &pcm->hdmi_jack,
 148                                             NULL, 0);
 149 
 150                 if (err)
 151                         return err;
 152 
 153                 err = snd_jack_add_new_kctl(pcm->hdmi_jack.jack,
 154                                             jack_name, SND_JACK_AVOUT);
 155                 if (err)
 156                         dev_warn(component->dev, "failed creating Jack kctl\n");
 157 
 158                 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
 159                                           &pcm->hdmi_jack);
 160                 if (err < 0)
 161                         return err;
 162         }
 163 
 164         if (!component)
 165                 return -EINVAL;
 166 
 167         return hdac_hdmi_jack_port_init(component, &card->dapm);
 168 }

/* [<][>][^][v][top][bottom][index][help] */