118382eadSSubhransu S. Prusty /* 218382eadSSubhransu S. Prusty * hdac_hdmi.c - ASoc HDA-HDMI codec driver for Intel platforms 318382eadSSubhransu S. Prusty * 418382eadSSubhransu S. Prusty * Copyright (C) 2014-2015 Intel Corp 518382eadSSubhransu S. Prusty * Author: Samreen Nilofer <samreen.nilofer@intel.com> 618382eadSSubhransu S. Prusty * Subhransu S. Prusty <subhransu.s.prusty@intel.com> 718382eadSSubhransu S. Prusty * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818382eadSSubhransu S. Prusty * 918382eadSSubhransu S. Prusty * This program is free software; you can redistribute it and/or modify 1018382eadSSubhransu S. Prusty * it under the terms of the GNU General Public License as published by 1118382eadSSubhransu S. Prusty * the Free Software Foundation; version 2 of the License. 1218382eadSSubhransu S. Prusty * 1318382eadSSubhransu S. Prusty * This program is distributed in the hope that it will be useful, but 1418382eadSSubhransu S. Prusty * WITHOUT ANY WARRANTY; without even the implied warranty of 1518382eadSSubhransu S. Prusty * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1618382eadSSubhransu S. Prusty * General Public License for more details. 1718382eadSSubhransu S. Prusty * 1818382eadSSubhransu S. Prusty * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1918382eadSSubhransu S. Prusty */ 2018382eadSSubhransu S. Prusty #include <linux/init.h> 2118382eadSSubhransu S. Prusty #include <linux/delay.h> 2218382eadSSubhransu S. Prusty #include <linux/module.h> 2318382eadSSubhransu S. Prusty #include <linux/pm_runtime.h> 24a657f1d0SSubhransu S. Prusty #include <linux/hdmi.h> 2518382eadSSubhransu S. Prusty #include <sound/pcm_params.h> 2618382eadSSubhransu S. Prusty #include <sound/soc.h> 2718382eadSSubhransu S. Prusty #include <sound/hdaudio_ext.h> 2807f083abSSubhransu S. Prusty #include <sound/hda_i915.h> 2918382eadSSubhransu S. Prusty #include "../../hda/local.h" 3018382eadSSubhransu S. Prusty 31b0362adbSSubhransu S. Prusty #define AMP_OUT_MUTE 0xb080 32b0362adbSSubhransu S. Prusty #define AMP_OUT_UNMUTE 0xb000 3318382eadSSubhransu S. Prusty #define PIN_OUT (AC_PINCTL_OUT_EN) 34b0362adbSSubhransu S. Prusty 3518382eadSSubhransu S. Prusty #define HDA_MAX_CONNECTIONS 32 3618382eadSSubhransu S. Prusty 3718382eadSSubhransu S. Prusty struct hdac_hdmi_cvt_params { 3818382eadSSubhransu S. Prusty unsigned int channels_min; 3918382eadSSubhransu S. Prusty unsigned int channels_max; 4018382eadSSubhransu S. Prusty u32 rates; 4118382eadSSubhransu S. Prusty u64 formats; 4218382eadSSubhransu S. Prusty unsigned int maxbps; 4318382eadSSubhransu S. Prusty }; 4418382eadSSubhransu S. Prusty 4518382eadSSubhransu S. Prusty struct hdac_hdmi_cvt { 4618382eadSSubhransu S. Prusty hda_nid_t nid; 4718382eadSSubhransu S. Prusty struct hdac_hdmi_cvt_params params; 4818382eadSSubhransu S. Prusty }; 4918382eadSSubhransu S. Prusty 5018382eadSSubhransu S. Prusty struct hdac_hdmi_pin { 5118382eadSSubhransu S. Prusty hda_nid_t nid; 5218382eadSSubhransu S. Prusty int num_mux_nids; 5318382eadSSubhransu S. Prusty hda_nid_t mux_nids[HDA_MAX_CONNECTIONS]; 5418382eadSSubhransu S. Prusty }; 5518382eadSSubhransu S. Prusty 5618382eadSSubhransu S. Prusty struct hdac_hdmi_dai_pin_map { 5718382eadSSubhransu S. Prusty int dai_id; 5818382eadSSubhransu S. Prusty struct hdac_hdmi_pin pin; 5918382eadSSubhransu S. Prusty struct hdac_hdmi_cvt cvt; 6018382eadSSubhransu S. Prusty }; 6118382eadSSubhransu S. Prusty 6218382eadSSubhransu S. Prusty struct hdac_hdmi_priv { 6318382eadSSubhransu S. Prusty hda_nid_t pin_nid[3]; 6418382eadSSubhransu S. Prusty hda_nid_t cvt_nid[3]; 6518382eadSSubhransu S. Prusty struct hdac_hdmi_dai_pin_map dai_map[3]; 6618382eadSSubhransu S. Prusty }; 6718382eadSSubhransu S. Prusty 68e342ac08SSubhransu S. Prusty static inline struct hdac_ext_device *to_hda_ext_device(struct device *dev) 69e342ac08SSubhransu S. Prusty { 7051b2c425SGeliang Tang struct hdac_device *hdac = dev_to_hdac_dev(dev); 71e342ac08SSubhransu S. Prusty 7251b2c425SGeliang Tang return to_ehdac_device(hdac); 73e342ac08SSubhransu S. Prusty } 74e342ac08SSubhransu S. Prusty 75b0362adbSSubhransu S. Prusty static int hdac_hdmi_setup_stream(struct hdac_ext_device *hdac, 76b0362adbSSubhransu S. Prusty hda_nid_t cvt_nid, hda_nid_t pin_nid, 77b0362adbSSubhransu S. Prusty u32 stream_tag, int format) 78b0362adbSSubhransu S. Prusty { 79b0362adbSSubhransu S. Prusty unsigned int val; 80b0362adbSSubhransu S. Prusty 81b0362adbSSubhransu S. Prusty dev_dbg(&hdac->hdac.dev, "cvt nid %d pnid %d stream %d format 0x%x\n", 82b0362adbSSubhransu S. Prusty cvt_nid, pin_nid, stream_tag, format); 83b0362adbSSubhransu S. Prusty 84b0362adbSSubhransu S. Prusty val = (stream_tag << 4); 85b0362adbSSubhransu S. Prusty 86b0362adbSSubhransu S. Prusty snd_hdac_codec_write(&hdac->hdac, cvt_nid, 0, 87b0362adbSSubhransu S. Prusty AC_VERB_SET_CHANNEL_STREAMID, val); 88b0362adbSSubhransu S. Prusty snd_hdac_codec_write(&hdac->hdac, cvt_nid, 0, 89b0362adbSSubhransu S. Prusty AC_VERB_SET_STREAM_FORMAT, format); 90b0362adbSSubhransu S. Prusty 91b0362adbSSubhransu S. Prusty return 0; 92b0362adbSSubhransu S. Prusty } 93b0362adbSSubhransu S. Prusty 94a657f1d0SSubhransu S. Prusty static void 95a657f1d0SSubhransu S. Prusty hdac_hdmi_set_dip_index(struct hdac_ext_device *hdac, hda_nid_t pin_nid, 96a657f1d0SSubhransu S. Prusty int packet_index, int byte_index) 97a657f1d0SSubhransu S. Prusty { 98a657f1d0SSubhransu S. Prusty int val; 99a657f1d0SSubhransu S. Prusty 100a657f1d0SSubhransu S. Prusty val = (packet_index << 5) | (byte_index & 0x1f); 101a657f1d0SSubhransu S. Prusty 102a657f1d0SSubhransu S. Prusty snd_hdac_codec_write(&hdac->hdac, pin_nid, 0, 103a657f1d0SSubhransu S. Prusty AC_VERB_SET_HDMI_DIP_INDEX, val); 104a657f1d0SSubhransu S. Prusty } 105a657f1d0SSubhransu S. Prusty 106a657f1d0SSubhransu S. Prusty static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac, 107a657f1d0SSubhransu S. Prusty hda_nid_t cvt_nid, hda_nid_t pin_nid) 108a657f1d0SSubhransu S. Prusty { 109a657f1d0SSubhransu S. Prusty uint8_t buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE]; 110a657f1d0SSubhransu S. Prusty struct hdmi_audio_infoframe frame; 111a657f1d0SSubhransu S. Prusty u8 *dip = (u8 *)&frame; 112a657f1d0SSubhransu S. Prusty int ret; 113a657f1d0SSubhransu S. Prusty int i; 114a657f1d0SSubhransu S. Prusty 115a657f1d0SSubhransu S. Prusty hdmi_audio_infoframe_init(&frame); 116a657f1d0SSubhransu S. Prusty 117a657f1d0SSubhransu S. Prusty /* Default stereo for now */ 118a657f1d0SSubhransu S. Prusty frame.channels = 2; 119a657f1d0SSubhransu S. Prusty 120a657f1d0SSubhransu S. Prusty /* setup channel count */ 121a657f1d0SSubhransu S. Prusty snd_hdac_codec_write(&hdac->hdac, cvt_nid, 0, 122a657f1d0SSubhransu S. Prusty AC_VERB_SET_CVT_CHAN_COUNT, frame.channels - 1); 123a657f1d0SSubhransu S. Prusty 124a657f1d0SSubhransu S. Prusty ret = hdmi_audio_infoframe_pack(&frame, buffer, sizeof(buffer)); 125a657f1d0SSubhransu S. Prusty if (ret < 0) 126a657f1d0SSubhransu S. Prusty return ret; 127a657f1d0SSubhransu S. Prusty 128a657f1d0SSubhransu S. Prusty /* stop infoframe transmission */ 129a657f1d0SSubhransu S. Prusty hdac_hdmi_set_dip_index(hdac, pin_nid, 0x0, 0x0); 130a657f1d0SSubhransu S. Prusty snd_hdac_codec_write(&hdac->hdac, pin_nid, 0, 131a657f1d0SSubhransu S. Prusty AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_DISABLE); 132a657f1d0SSubhransu S. Prusty 133a657f1d0SSubhransu S. Prusty 134a657f1d0SSubhransu S. Prusty /* Fill infoframe. Index auto-incremented */ 135a657f1d0SSubhransu S. Prusty hdac_hdmi_set_dip_index(hdac, pin_nid, 0x0, 0x0); 136a657f1d0SSubhransu S. Prusty for (i = 0; i < sizeof(frame); i++) 137a657f1d0SSubhransu S. Prusty snd_hdac_codec_write(&hdac->hdac, pin_nid, 0, 138a657f1d0SSubhransu S. Prusty AC_VERB_SET_HDMI_DIP_DATA, dip[i]); 139a657f1d0SSubhransu S. Prusty 140a657f1d0SSubhransu S. Prusty /* Start infoframe */ 141a657f1d0SSubhransu S. Prusty hdac_hdmi_set_dip_index(hdac, pin_nid, 0x0, 0x0); 142a657f1d0SSubhransu S. Prusty snd_hdac_codec_write(&hdac->hdac, pin_nid, 0, 143a657f1d0SSubhransu S. Prusty AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_BEST); 144a657f1d0SSubhransu S. Prusty 145a657f1d0SSubhransu S. Prusty return 0; 146a657f1d0SSubhransu S. Prusty } 147a657f1d0SSubhransu S. Prusty 148b0362adbSSubhransu S. Prusty static void hdac_hdmi_set_power_state(struct hdac_ext_device *edev, 149b0362adbSSubhransu S. Prusty struct hdac_hdmi_dai_pin_map *dai_map, unsigned int pwr_state) 150b0362adbSSubhransu S. Prusty { 151b0362adbSSubhransu S. Prusty /* Power up pin widget */ 152b0362adbSSubhransu S. Prusty if (!snd_hdac_check_power_state(&edev->hdac, dai_map->pin.nid, pwr_state)) 153b0362adbSSubhransu S. Prusty snd_hdac_codec_write(&edev->hdac, dai_map->pin.nid, 0, 154b0362adbSSubhransu S. Prusty AC_VERB_SET_POWER_STATE, pwr_state); 155b0362adbSSubhransu S. Prusty 156b0362adbSSubhransu S. Prusty /* Power up converter */ 157b0362adbSSubhransu S. Prusty if (!snd_hdac_check_power_state(&edev->hdac, dai_map->cvt.nid, pwr_state)) 158b0362adbSSubhransu S. Prusty snd_hdac_codec_write(&edev->hdac, dai_map->cvt.nid, 0, 159b0362adbSSubhransu S. Prusty AC_VERB_SET_POWER_STATE, pwr_state); 160b0362adbSSubhransu S. Prusty } 161b0362adbSSubhransu S. Prusty 162b0362adbSSubhransu S. Prusty static int hdac_hdmi_playback_prepare(struct snd_pcm_substream *substream, 163b0362adbSSubhransu S. Prusty struct snd_soc_dai *dai) 164b0362adbSSubhransu S. Prusty { 165b0362adbSSubhransu S. Prusty struct hdac_ext_device *hdac = snd_soc_dai_get_drvdata(dai); 166b0362adbSSubhransu S. Prusty struct hdac_hdmi_priv *hdmi = hdac->private_data; 167b0362adbSSubhransu S. Prusty struct hdac_hdmi_dai_pin_map *dai_map; 168b0362adbSSubhransu S. Prusty struct hdac_ext_dma_params *dd; 169a657f1d0SSubhransu S. Prusty int ret; 170b0362adbSSubhransu S. Prusty 171b0362adbSSubhransu S. Prusty if (dai->id > 0) { 172b0362adbSSubhransu S. Prusty dev_err(&hdac->hdac.dev, "Only one dai supported as of now\n"); 173b0362adbSSubhransu S. Prusty return -ENODEV; 174b0362adbSSubhransu S. Prusty } 175b0362adbSSubhransu S. Prusty 176b0362adbSSubhransu S. Prusty dai_map = &hdmi->dai_map[dai->id]; 177b0362adbSSubhransu S. Prusty 178b0362adbSSubhransu S. Prusty dd = (struct hdac_ext_dma_params *)snd_soc_dai_get_dma_data(dai, substream); 179b0362adbSSubhransu S. Prusty dev_dbg(&hdac->hdac.dev, "stream tag from cpu dai %d format in cvt 0x%x\n", 180b0362adbSSubhransu S. Prusty dd->stream_tag, dd->format); 181b0362adbSSubhransu S. Prusty 182a657f1d0SSubhransu S. Prusty ret = hdac_hdmi_setup_audio_infoframe(hdac, dai_map->cvt.nid, 183a657f1d0SSubhransu S. Prusty dai_map->pin.nid); 184a657f1d0SSubhransu S. Prusty if (ret < 0) 185a657f1d0SSubhransu S. Prusty return ret; 186a657f1d0SSubhransu S. Prusty 187b0362adbSSubhransu S. Prusty return hdac_hdmi_setup_stream(hdac, dai_map->cvt.nid, dai_map->pin.nid, 188b0362adbSSubhransu S. Prusty dd->stream_tag, dd->format); 189b0362adbSSubhransu S. Prusty } 190b0362adbSSubhransu S. Prusty 191b0362adbSSubhransu S. Prusty static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream, 192b0362adbSSubhransu S. Prusty struct snd_pcm_hw_params *hparams, struct snd_soc_dai *dai) 193b0362adbSSubhransu S. Prusty { 194b0362adbSSubhransu S. Prusty struct hdac_ext_device *hdac = snd_soc_dai_get_drvdata(dai); 195b0362adbSSubhransu S. Prusty struct hdac_ext_dma_params *dd; 196b0362adbSSubhransu S. Prusty 197b0362adbSSubhransu S. Prusty if (dai->id > 0) { 198b0362adbSSubhransu S. Prusty dev_err(&hdac->hdac.dev, "Only one dai supported as of now\n"); 199b0362adbSSubhransu S. Prusty return -ENODEV; 200b0362adbSSubhransu S. Prusty } 201b0362adbSSubhransu S. Prusty 202b0362adbSSubhransu S. Prusty dd = kzalloc(sizeof(*dd), GFP_KERNEL); 2038d33ab24SSudip Mukherjee if (!dd) 2048d33ab24SSudip Mukherjee return -ENOMEM; 205b0362adbSSubhransu S. Prusty dd->format = snd_hdac_calc_stream_format(params_rate(hparams), 206b0362adbSSubhransu S. Prusty params_channels(hparams), params_format(hparams), 207b0362adbSSubhransu S. Prusty 24, 0); 208b0362adbSSubhransu S. Prusty 209b0362adbSSubhransu S. Prusty snd_soc_dai_set_dma_data(dai, substream, (void *)dd); 210b0362adbSSubhransu S. Prusty 211b0362adbSSubhransu S. Prusty return 0; 212b0362adbSSubhransu S. Prusty } 213b0362adbSSubhransu S. Prusty 214b0362adbSSubhransu S. Prusty static int hdac_hdmi_playback_cleanup(struct snd_pcm_substream *substream, 215b0362adbSSubhransu S. Prusty struct snd_soc_dai *dai) 216b0362adbSSubhransu S. Prusty { 217b0362adbSSubhransu S. Prusty struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai); 218b0362adbSSubhransu S. Prusty struct hdac_ext_dma_params *dd; 219b0362adbSSubhransu S. Prusty struct hdac_hdmi_priv *hdmi = edev->private_data; 220b0362adbSSubhransu S. Prusty struct hdac_hdmi_dai_pin_map *dai_map; 221b0362adbSSubhransu S. Prusty 222b0362adbSSubhransu S. Prusty dai_map = &hdmi->dai_map[dai->id]; 223b0362adbSSubhransu S. Prusty 224b0362adbSSubhransu S. Prusty snd_hdac_codec_write(&edev->hdac, dai_map->cvt.nid, 0, 225b0362adbSSubhransu S. Prusty AC_VERB_SET_CHANNEL_STREAMID, 0); 226b0362adbSSubhransu S. Prusty snd_hdac_codec_write(&edev->hdac, dai_map->cvt.nid, 0, 227b0362adbSSubhransu S. Prusty AC_VERB_SET_STREAM_FORMAT, 0); 228b0362adbSSubhransu S. Prusty 229b0362adbSSubhransu S. Prusty dd = (struct hdac_ext_dma_params *)snd_soc_dai_get_dma_data(dai, substream); 230b0362adbSSubhransu S. Prusty snd_soc_dai_set_dma_data(dai, substream, NULL); 231b0362adbSSubhransu S. Prusty 232b0362adbSSubhransu S. Prusty kfree(dd); 233b0362adbSSubhransu S. Prusty 234b0362adbSSubhransu S. Prusty return 0; 235b0362adbSSubhransu S. Prusty } 236b0362adbSSubhransu S. Prusty 237b0362adbSSubhransu S. Prusty static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream, 238b0362adbSSubhransu S. Prusty struct snd_soc_dai *dai) 239b0362adbSSubhransu S. Prusty { 240b0362adbSSubhransu S. Prusty struct hdac_ext_device *hdac = snd_soc_dai_get_drvdata(dai); 241b0362adbSSubhransu S. Prusty struct hdac_hdmi_priv *hdmi = hdac->private_data; 242b0362adbSSubhransu S. Prusty struct hdac_hdmi_dai_pin_map *dai_map; 243b0362adbSSubhransu S. Prusty int val; 244b0362adbSSubhransu S. Prusty 245b0362adbSSubhransu S. Prusty if (dai->id > 0) { 246b0362adbSSubhransu S. Prusty dev_err(&hdac->hdac.dev, "Only one dai supported as of now\n"); 247b0362adbSSubhransu S. Prusty return -ENODEV; 248b0362adbSSubhransu S. Prusty } 249b0362adbSSubhransu S. Prusty 250b0362adbSSubhransu S. Prusty dai_map = &hdmi->dai_map[dai->id]; 251b0362adbSSubhransu S. Prusty 252b0362adbSSubhransu S. Prusty val = snd_hdac_codec_read(&hdac->hdac, dai_map->pin.nid, 0, 253b0362adbSSubhransu S. Prusty AC_VERB_GET_PIN_SENSE, 0); 254b0362adbSSubhransu S. Prusty dev_info(&hdac->hdac.dev, "Val for AC_VERB_GET_PIN_SENSE: %x\n", val); 255b0362adbSSubhransu S. Prusty 256b0362adbSSubhransu S. Prusty if ((!(val & AC_PINSENSE_PRESENCE)) || (!(val & AC_PINSENSE_ELDV))) { 257b0362adbSSubhransu S. Prusty dev_err(&hdac->hdac.dev, "Monitor presence invalid with val: %x\n", val); 258b0362adbSSubhransu S. Prusty return -ENODEV; 259b0362adbSSubhransu S. Prusty } 260b0362adbSSubhransu S. Prusty 261b0362adbSSubhransu S. Prusty hdac_hdmi_set_power_state(hdac, dai_map, AC_PWRST_D0); 262b0362adbSSubhransu S. Prusty 263b0362adbSSubhransu S. Prusty snd_hdac_codec_write(&hdac->hdac, dai_map->pin.nid, 0, 264b0362adbSSubhransu S. Prusty AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 265b0362adbSSubhransu S. Prusty 266b0362adbSSubhransu S. Prusty snd_pcm_hw_constraint_step(substream->runtime, 0, 267b0362adbSSubhransu S. Prusty SNDRV_PCM_HW_PARAM_CHANNELS, 2); 268b0362adbSSubhransu S. Prusty 269b0362adbSSubhransu S. Prusty return 0; 270b0362adbSSubhransu S. Prusty } 271b0362adbSSubhransu S. Prusty 272b0362adbSSubhransu S. Prusty static void hdac_hdmi_pcm_close(struct snd_pcm_substream *substream, 273b0362adbSSubhransu S. Prusty struct snd_soc_dai *dai) 274b0362adbSSubhransu S. Prusty { 275b0362adbSSubhransu S. Prusty struct hdac_ext_device *hdac = snd_soc_dai_get_drvdata(dai); 276b0362adbSSubhransu S. Prusty struct hdac_hdmi_priv *hdmi = hdac->private_data; 277b0362adbSSubhransu S. Prusty struct hdac_hdmi_dai_pin_map *dai_map; 278b0362adbSSubhransu S. Prusty 279b0362adbSSubhransu S. Prusty dai_map = &hdmi->dai_map[dai->id]; 280b0362adbSSubhransu S. Prusty 281b0362adbSSubhransu S. Prusty hdac_hdmi_set_power_state(hdac, dai_map, AC_PWRST_D3); 282b0362adbSSubhransu S. Prusty 283b0362adbSSubhransu S. Prusty snd_hdac_codec_write(&hdac->hdac, dai_map->pin.nid, 0, 284b0362adbSSubhransu S. Prusty AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 285b0362adbSSubhransu S. Prusty } 286b0362adbSSubhransu S. Prusty 28718382eadSSubhransu S. Prusty static int 28818382eadSSubhransu S. Prusty hdac_hdmi_query_cvt_params(struct hdac_device *hdac, struct hdac_hdmi_cvt *cvt) 28918382eadSSubhransu S. Prusty { 29018382eadSSubhransu S. Prusty int err; 29118382eadSSubhransu S. Prusty 29218382eadSSubhransu S. Prusty /* Only stereo supported as of now */ 29318382eadSSubhransu S. Prusty cvt->params.channels_min = cvt->params.channels_max = 2; 29418382eadSSubhransu S. Prusty 29518382eadSSubhransu S. Prusty err = snd_hdac_query_supported_pcm(hdac, cvt->nid, 29618382eadSSubhransu S. Prusty &cvt->params.rates, 29718382eadSSubhransu S. Prusty &cvt->params.formats, 29818382eadSSubhransu S. Prusty &cvt->params.maxbps); 29918382eadSSubhransu S. Prusty if (err < 0) 30018382eadSSubhransu S. Prusty dev_err(&hdac->dev, 30118382eadSSubhransu S. Prusty "Failed to query pcm params for nid %d: %d\n", 30218382eadSSubhransu S. Prusty cvt->nid, err); 30318382eadSSubhransu S. Prusty 30418382eadSSubhransu S. Prusty return err; 30518382eadSSubhransu S. Prusty } 30618382eadSSubhransu S. Prusty 30718382eadSSubhransu S. Prusty static int hdac_hdmi_query_pin_connlist(struct hdac_ext_device *hdac, 30818382eadSSubhransu S. Prusty struct hdac_hdmi_pin *pin) 30918382eadSSubhransu S. Prusty { 31018382eadSSubhransu S. Prusty if (!(get_wcaps(&hdac->hdac, pin->nid) & AC_WCAP_CONN_LIST)) { 31118382eadSSubhransu S. Prusty dev_warn(&hdac->hdac.dev, 31218382eadSSubhransu S. Prusty "HDMI: pin %d wcaps %#x does not support connection list\n", 31318382eadSSubhransu S. Prusty pin->nid, get_wcaps(&hdac->hdac, pin->nid)); 31418382eadSSubhransu S. Prusty return -EINVAL; 31518382eadSSubhransu S. Prusty } 31618382eadSSubhransu S. Prusty 31718382eadSSubhransu S. Prusty pin->num_mux_nids = snd_hdac_get_connections(&hdac->hdac, pin->nid, 31818382eadSSubhransu S. Prusty pin->mux_nids, HDA_MAX_CONNECTIONS); 31918382eadSSubhransu S. Prusty if (pin->num_mux_nids == 0) { 32018382eadSSubhransu S. Prusty dev_err(&hdac->hdac.dev, "No connections found\n"); 32118382eadSSubhransu S. Prusty return -ENODEV; 32218382eadSSubhransu S. Prusty } 32318382eadSSubhransu S. Prusty 32418382eadSSubhransu S. Prusty return pin->num_mux_nids; 32518382eadSSubhransu S. Prusty } 32618382eadSSubhransu S. Prusty 32718382eadSSubhransu S. Prusty static void hdac_hdmi_fill_widget_info(struct snd_soc_dapm_widget *w, 32818382eadSSubhransu S. Prusty enum snd_soc_dapm_type id, 32918382eadSSubhransu S. Prusty const char *wname, const char *stream) 33018382eadSSubhransu S. Prusty { 33118382eadSSubhransu S. Prusty w->id = id; 33218382eadSSubhransu S. Prusty w->name = wname; 33318382eadSSubhransu S. Prusty w->sname = stream; 33418382eadSSubhransu S. Prusty w->reg = SND_SOC_NOPM; 33518382eadSSubhransu S. Prusty w->shift = 0; 33618382eadSSubhransu S. Prusty w->kcontrol_news = NULL; 33718382eadSSubhransu S. Prusty w->num_kcontrols = 0; 33818382eadSSubhransu S. Prusty w->priv = NULL; 33918382eadSSubhransu S. Prusty } 34018382eadSSubhransu S. Prusty 34118382eadSSubhransu S. Prusty static void hdac_hdmi_fill_route(struct snd_soc_dapm_route *route, 34218382eadSSubhransu S. Prusty const char *sink, const char *control, const char *src) 34318382eadSSubhransu S. Prusty { 34418382eadSSubhransu S. Prusty route->sink = sink; 34518382eadSSubhransu S. Prusty route->source = src; 34618382eadSSubhransu S. Prusty route->control = control; 34718382eadSSubhransu S. Prusty route->connected = NULL; 34818382eadSSubhransu S. Prusty } 34918382eadSSubhransu S. Prusty 35018382eadSSubhransu S. Prusty static void create_fill_widget_route_map(struct snd_soc_dapm_context *dapm, 35118382eadSSubhransu S. Prusty struct hdac_hdmi_dai_pin_map *dai_map) 35218382eadSSubhransu S. Prusty { 35318382eadSSubhransu S. Prusty struct snd_soc_dapm_route route[1]; 35418382eadSSubhransu S. Prusty struct snd_soc_dapm_widget widgets[2] = { {0} }; 35518382eadSSubhransu S. Prusty 35618382eadSSubhransu S. Prusty memset(&route, 0, sizeof(route)); 35718382eadSSubhransu S. Prusty 35818382eadSSubhransu S. Prusty hdac_hdmi_fill_widget_info(&widgets[0], snd_soc_dapm_output, 35918382eadSSubhransu S. Prusty "hif1 Output", NULL); 36018382eadSSubhransu S. Prusty hdac_hdmi_fill_widget_info(&widgets[1], snd_soc_dapm_aif_in, 36118382eadSSubhransu S. Prusty "Coverter 1", "hif1"); 36218382eadSSubhransu S. Prusty 36318382eadSSubhransu S. Prusty hdac_hdmi_fill_route(&route[0], "hif1 Output", NULL, "Coverter 1"); 36418382eadSSubhransu S. Prusty 36518382eadSSubhransu S. Prusty snd_soc_dapm_new_controls(dapm, widgets, ARRAY_SIZE(widgets)); 36618382eadSSubhransu S. Prusty snd_soc_dapm_add_routes(dapm, route, ARRAY_SIZE(route)); 36718382eadSSubhransu S. Prusty } 36818382eadSSubhransu S. Prusty 36918382eadSSubhransu S. Prusty static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev, 37018382eadSSubhransu S. Prusty struct hdac_hdmi_dai_pin_map *dai_map, 37118382eadSSubhransu S. Prusty hda_nid_t pin_nid, hda_nid_t cvt_nid, int dai_id) 37218382eadSSubhransu S. Prusty { 37318382eadSSubhransu S. Prusty int ret; 37418382eadSSubhransu S. Prusty 37518382eadSSubhransu S. Prusty dai_map->dai_id = dai_id; 37618382eadSSubhransu S. Prusty dai_map->pin.nid = pin_nid; 37718382eadSSubhransu S. Prusty 37818382eadSSubhransu S. Prusty ret = hdac_hdmi_query_pin_connlist(edev, &dai_map->pin); 37918382eadSSubhransu S. Prusty if (ret < 0) { 38018382eadSSubhransu S. Prusty dev_err(&edev->hdac.dev, 38118382eadSSubhransu S. Prusty "Error querying connection list: %d\n", ret); 38218382eadSSubhransu S. Prusty return ret; 38318382eadSSubhransu S. Prusty } 38418382eadSSubhransu S. Prusty 38518382eadSSubhransu S. Prusty dai_map->cvt.nid = cvt_nid; 38618382eadSSubhransu S. Prusty 38718382eadSSubhransu S. Prusty /* Enable out path for this pin widget */ 38818382eadSSubhransu S. Prusty snd_hdac_codec_write(&edev->hdac, pin_nid, 0, 38918382eadSSubhransu S. Prusty AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); 39018382eadSSubhransu S. Prusty 39118382eadSSubhransu S. Prusty /* Enable transmission */ 39218382eadSSubhransu S. Prusty snd_hdac_codec_write(&edev->hdac, cvt_nid, 0, 39318382eadSSubhransu S. Prusty AC_VERB_SET_DIGI_CONVERT_1, 1); 39418382eadSSubhransu S. Prusty 39518382eadSSubhransu S. Prusty /* Category Code (CC) to zero */ 39618382eadSSubhransu S. Prusty snd_hdac_codec_write(&edev->hdac, cvt_nid, 0, 39718382eadSSubhransu S. Prusty AC_VERB_SET_DIGI_CONVERT_2, 0); 39818382eadSSubhransu S. Prusty 39918382eadSSubhransu S. Prusty snd_hdac_codec_write(&edev->hdac, pin_nid, 0, 40018382eadSSubhransu S. Prusty AC_VERB_SET_CONNECT_SEL, 0); 40118382eadSSubhransu S. Prusty 40218382eadSSubhransu S. Prusty return hdac_hdmi_query_cvt_params(&edev->hdac, &dai_map->cvt); 40318382eadSSubhransu S. Prusty } 40418382eadSSubhransu S. Prusty 40518382eadSSubhransu S. Prusty /* 40618382eadSSubhransu S. Prusty * Parse all nodes and store the cvt/pin nids in array 40718382eadSSubhransu S. Prusty * Add one time initialization for pin and cvt widgets 40818382eadSSubhransu S. Prusty */ 40918382eadSSubhransu S. Prusty static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev) 41018382eadSSubhransu S. Prusty { 41118382eadSSubhransu S. Prusty hda_nid_t nid; 4123c83ac23SSudip Mukherjee int i, num_nodes; 41318382eadSSubhransu S. Prusty struct hdac_device *hdac = &edev->hdac; 41418382eadSSubhransu S. Prusty struct hdac_hdmi_priv *hdmi = edev->private_data; 41518382eadSSubhransu S. Prusty int cvt_nid = 0, pin_nid = 0; 41618382eadSSubhransu S. Prusty 4173c83ac23SSudip Mukherjee num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid); 418*541140d4SSubhransu S. Prusty if (!nid || num_nodes <= 0) { 41918382eadSSubhransu S. Prusty dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n"); 42018382eadSSubhransu S. Prusty return -EINVAL; 42118382eadSSubhransu S. Prusty } 42218382eadSSubhransu S. Prusty 4233c83ac23SSudip Mukherjee hdac->num_nodes = num_nodes; 42418382eadSSubhransu S. Prusty hdac->start_nid = nid; 42518382eadSSubhransu S. Prusty 42618382eadSSubhransu S. Prusty for (i = 0; i < hdac->num_nodes; i++, nid++) { 42718382eadSSubhransu S. Prusty unsigned int caps; 42818382eadSSubhransu S. Prusty unsigned int type; 42918382eadSSubhransu S. Prusty 43018382eadSSubhransu S. Prusty caps = get_wcaps(hdac, nid); 43118382eadSSubhransu S. Prusty type = get_wcaps_type(caps); 43218382eadSSubhransu S. Prusty 43318382eadSSubhransu S. Prusty if (!(caps & AC_WCAP_DIGITAL)) 43418382eadSSubhransu S. Prusty continue; 43518382eadSSubhransu S. Prusty 43618382eadSSubhransu S. Prusty switch (type) { 43718382eadSSubhransu S. Prusty 43818382eadSSubhransu S. Prusty case AC_WID_AUD_OUT: 43918382eadSSubhransu S. Prusty hdmi->cvt_nid[cvt_nid] = nid; 44018382eadSSubhransu S. Prusty cvt_nid++; 44118382eadSSubhransu S. Prusty break; 44218382eadSSubhransu S. Prusty 44318382eadSSubhransu S. Prusty case AC_WID_PIN: 44418382eadSSubhransu S. Prusty hdmi->pin_nid[pin_nid] = nid; 44518382eadSSubhransu S. Prusty pin_nid++; 44618382eadSSubhransu S. Prusty break; 44718382eadSSubhransu S. Prusty } 44818382eadSSubhransu S. Prusty } 44918382eadSSubhransu S. Prusty 45018382eadSSubhransu S. Prusty hdac->end_nid = nid; 45118382eadSSubhransu S. Prusty 45218382eadSSubhransu S. Prusty if (!pin_nid || !cvt_nid) 45318382eadSSubhransu S. Prusty return -EIO; 45418382eadSSubhransu S. Prusty 45518382eadSSubhransu S. Prusty /* 45618382eadSSubhransu S. Prusty * Currently on board only 1 pin and 1 converter is enabled for 45718382eadSSubhransu S. Prusty * simplification, more will be added eventually 45818382eadSSubhransu S. Prusty * So using fixed map for dai_id:pin:cvt 45918382eadSSubhransu S. Prusty */ 46018382eadSSubhransu S. Prusty return hdac_hdmi_init_dai_map(edev, &hdmi->dai_map[0], hdmi->pin_nid[0], 46118382eadSSubhransu S. Prusty hdmi->cvt_nid[0], 0); 46218382eadSSubhransu S. Prusty } 46318382eadSSubhransu S. Prusty 46418382eadSSubhransu S. Prusty static int hdmi_codec_probe(struct snd_soc_codec *codec) 46518382eadSSubhransu S. Prusty { 46618382eadSSubhransu S. Prusty struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); 46718382eadSSubhransu S. Prusty struct hdac_hdmi_priv *hdmi = edev->private_data; 46818382eadSSubhransu S. Prusty struct snd_soc_dapm_context *dapm = 46918382eadSSubhransu S. Prusty snd_soc_component_get_dapm(&codec->component); 47018382eadSSubhransu S. Prusty 47118382eadSSubhransu S. Prusty edev->scodec = codec; 47218382eadSSubhransu S. Prusty 47318382eadSSubhransu S. Prusty create_fill_widget_route_map(dapm, &hdmi->dai_map[0]); 47418382eadSSubhransu S. Prusty 47518382eadSSubhransu S. Prusty /* Imp: Store the card pointer in hda_codec */ 47618382eadSSubhransu S. Prusty edev->card = dapm->card->snd_card; 47718382eadSSubhransu S. Prusty 478e342ac08SSubhransu S. Prusty /* 479e342ac08SSubhransu S. Prusty * hdac_device core already sets the state to active and calls 480e342ac08SSubhransu S. Prusty * get_noresume. So enable runtime and set the device to suspend. 481e342ac08SSubhransu S. Prusty */ 482e342ac08SSubhransu S. Prusty pm_runtime_enable(&edev->hdac.dev); 483e342ac08SSubhransu S. Prusty pm_runtime_put(&edev->hdac.dev); 484e342ac08SSubhransu S. Prusty pm_runtime_suspend(&edev->hdac.dev); 485e342ac08SSubhransu S. Prusty 486e342ac08SSubhransu S. Prusty return 0; 487e342ac08SSubhransu S. Prusty } 488e342ac08SSubhransu S. Prusty 489e342ac08SSubhransu S. Prusty static int hdmi_codec_remove(struct snd_soc_codec *codec) 490e342ac08SSubhransu S. Prusty { 491e342ac08SSubhransu S. Prusty struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); 492e342ac08SSubhransu S. Prusty 493e342ac08SSubhransu S. Prusty pm_runtime_disable(&edev->hdac.dev); 49418382eadSSubhransu S. Prusty return 0; 49518382eadSSubhransu S. Prusty } 49618382eadSSubhransu S. Prusty 49718382eadSSubhransu S. Prusty static struct snd_soc_codec_driver hdmi_hda_codec = { 49818382eadSSubhransu S. Prusty .probe = hdmi_codec_probe, 499e342ac08SSubhransu S. Prusty .remove = hdmi_codec_remove, 50018382eadSSubhransu S. Prusty .idle_bias_off = true, 50118382eadSSubhransu S. Prusty }; 50218382eadSSubhransu S. Prusty 503b0362adbSSubhransu S. Prusty static struct snd_soc_dai_ops hdmi_dai_ops = { 504b0362adbSSubhransu S. Prusty .startup = hdac_hdmi_pcm_open, 505b0362adbSSubhransu S. Prusty .shutdown = hdac_hdmi_pcm_close, 506b0362adbSSubhransu S. Prusty .hw_params = hdac_hdmi_set_hw_params, 507b0362adbSSubhransu S. Prusty .prepare = hdac_hdmi_playback_prepare, 508b0362adbSSubhransu S. Prusty .hw_free = hdac_hdmi_playback_cleanup, 509b0362adbSSubhransu S. Prusty }; 510b0362adbSSubhransu S. Prusty 51118382eadSSubhransu S. Prusty static struct snd_soc_dai_driver hdmi_dais[] = { 51218382eadSSubhransu S. Prusty { .name = "intel-hdmi-hif1", 51318382eadSSubhransu S. Prusty .playback = { 51418382eadSSubhransu S. Prusty .stream_name = "hif1", 51518382eadSSubhransu S. Prusty .channels_min = 2, 51618382eadSSubhransu S. Prusty .channels_max = 2, 51718382eadSSubhransu S. Prusty .rates = SNDRV_PCM_RATE_32000 | 51818382eadSSubhransu S. Prusty SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | 51918382eadSSubhransu S. Prusty SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | 52018382eadSSubhransu S. Prusty SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000, 52118382eadSSubhransu S. Prusty .formats = SNDRV_PCM_FMTBIT_S16_LE | 52218382eadSSubhransu S. Prusty SNDRV_PCM_FMTBIT_S20_3LE | 52318382eadSSubhransu S. Prusty SNDRV_PCM_FMTBIT_S24_LE | 52418382eadSSubhransu S. Prusty SNDRV_PCM_FMTBIT_S32_LE, 52518382eadSSubhransu S. Prusty 52618382eadSSubhransu S. Prusty }, 527b0362adbSSubhransu S. Prusty .ops = &hdmi_dai_ops, 52818382eadSSubhransu S. Prusty }, 52918382eadSSubhransu S. Prusty }; 53018382eadSSubhransu S. Prusty 53118382eadSSubhransu S. Prusty static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev) 53218382eadSSubhransu S. Prusty { 53318382eadSSubhransu S. Prusty struct hdac_device *codec = &edev->hdac; 53418382eadSSubhransu S. Prusty struct hdac_hdmi_priv *hdmi_priv; 53518382eadSSubhransu S. Prusty int ret = 0; 53618382eadSSubhransu S. Prusty 53718382eadSSubhransu S. Prusty hdmi_priv = devm_kzalloc(&codec->dev, sizeof(*hdmi_priv), GFP_KERNEL); 53818382eadSSubhransu S. Prusty if (hdmi_priv == NULL) 53918382eadSSubhransu S. Prusty return -ENOMEM; 54018382eadSSubhransu S. Prusty 54118382eadSSubhransu S. Prusty edev->private_data = hdmi_priv; 54218382eadSSubhransu S. Prusty 54318382eadSSubhransu S. Prusty dev_set_drvdata(&codec->dev, edev); 54418382eadSSubhransu S. Prusty 54518382eadSSubhransu S. Prusty ret = hdac_hdmi_parse_and_map_nid(edev); 54618382eadSSubhransu S. Prusty if (ret < 0) 54718382eadSSubhransu S. Prusty return ret; 54818382eadSSubhransu S. Prusty 54918382eadSSubhransu S. Prusty /* ASoC specific initialization */ 55018382eadSSubhransu S. Prusty return snd_soc_register_codec(&codec->dev, &hdmi_hda_codec, 55118382eadSSubhransu S. Prusty hdmi_dais, ARRAY_SIZE(hdmi_dais)); 55218382eadSSubhransu S. Prusty } 55318382eadSSubhransu S. Prusty 55418382eadSSubhransu S. Prusty static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev) 55518382eadSSubhransu S. Prusty { 55618382eadSSubhransu S. Prusty snd_soc_unregister_codec(&edev->hdac.dev); 55718382eadSSubhransu S. Prusty 55818382eadSSubhransu S. Prusty return 0; 55918382eadSSubhransu S. Prusty } 56018382eadSSubhransu S. Prusty 561e342ac08SSubhransu S. Prusty #ifdef CONFIG_PM 562e342ac08SSubhransu S. Prusty static int hdac_hdmi_runtime_suspend(struct device *dev) 563e342ac08SSubhransu S. Prusty { 564e342ac08SSubhransu S. Prusty struct hdac_ext_device *edev = to_hda_ext_device(dev); 565e342ac08SSubhransu S. Prusty struct hdac_device *hdac = &edev->hdac; 56607f083abSSubhransu S. Prusty struct hdac_bus *bus = hdac->bus; 56707f083abSSubhransu S. Prusty int err; 568e342ac08SSubhransu S. Prusty 569e342ac08SSubhransu S. Prusty dev_dbg(dev, "Enter: %s\n", __func__); 570e342ac08SSubhransu S. Prusty 57107f083abSSubhransu S. Prusty /* controller may not have been initialized for the first time */ 57207f083abSSubhransu S. Prusty if (!bus) 57307f083abSSubhransu S. Prusty return 0; 57407f083abSSubhransu S. Prusty 575e342ac08SSubhransu S. Prusty /* Power down afg */ 576e342ac08SSubhransu S. Prusty if (!snd_hdac_check_power_state(hdac, hdac->afg, AC_PWRST_D3)) 577e342ac08SSubhransu S. Prusty snd_hdac_codec_write(hdac, hdac->afg, 0, 578e342ac08SSubhransu S. Prusty AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 579e342ac08SSubhransu S. Prusty 58007f083abSSubhransu S. Prusty err = snd_hdac_display_power(bus, false); 58107f083abSSubhransu S. Prusty if (err < 0) { 58207f083abSSubhransu S. Prusty dev_err(bus->dev, "Cannot turn on display power on i915\n"); 58307f083abSSubhransu S. Prusty return err; 58407f083abSSubhransu S. Prusty } 58507f083abSSubhransu S. Prusty 586e342ac08SSubhransu S. Prusty return 0; 587e342ac08SSubhransu S. Prusty } 588e342ac08SSubhransu S. Prusty 589e342ac08SSubhransu S. Prusty static int hdac_hdmi_runtime_resume(struct device *dev) 590e342ac08SSubhransu S. Prusty { 591e342ac08SSubhransu S. Prusty struct hdac_ext_device *edev = to_hda_ext_device(dev); 592e342ac08SSubhransu S. Prusty struct hdac_device *hdac = &edev->hdac; 59307f083abSSubhransu S. Prusty struct hdac_bus *bus = hdac->bus; 59407f083abSSubhransu S. Prusty int err; 595e342ac08SSubhransu S. Prusty 596e342ac08SSubhransu S. Prusty dev_dbg(dev, "Enter: %s\n", __func__); 597e342ac08SSubhransu S. Prusty 59807f083abSSubhransu S. Prusty /* controller may not have been initialized for the first time */ 59907f083abSSubhransu S. Prusty if (!bus) 60007f083abSSubhransu S. Prusty return 0; 60107f083abSSubhransu S. Prusty 60207f083abSSubhransu S. Prusty err = snd_hdac_display_power(bus, true); 60307f083abSSubhransu S. Prusty if (err < 0) { 60407f083abSSubhransu S. Prusty dev_err(bus->dev, "Cannot turn on display power on i915\n"); 60507f083abSSubhransu S. Prusty return err; 60607f083abSSubhransu S. Prusty } 60707f083abSSubhransu S. Prusty 608e342ac08SSubhransu S. Prusty /* Power up afg */ 609e342ac08SSubhransu S. Prusty if (!snd_hdac_check_power_state(hdac, hdac->afg, AC_PWRST_D0)) 610e342ac08SSubhransu S. Prusty snd_hdac_codec_write(hdac, hdac->afg, 0, 611e342ac08SSubhransu S. Prusty AC_VERB_SET_POWER_STATE, AC_PWRST_D0); 612e342ac08SSubhransu S. Prusty 613e342ac08SSubhransu S. Prusty return 0; 614e342ac08SSubhransu S. Prusty } 615e342ac08SSubhransu S. Prusty #else 616e342ac08SSubhransu S. Prusty #define hdac_hdmi_runtime_suspend NULL 617e342ac08SSubhransu S. Prusty #define hdac_hdmi_runtime_resume NULL 618e342ac08SSubhransu S. Prusty #endif 619e342ac08SSubhransu S. Prusty 620e342ac08SSubhransu S. Prusty static const struct dev_pm_ops hdac_hdmi_pm = { 621e342ac08SSubhransu S. Prusty SET_RUNTIME_PM_OPS(hdac_hdmi_runtime_suspend, hdac_hdmi_runtime_resume, NULL) 622e342ac08SSubhransu S. Prusty }; 623e342ac08SSubhransu S. Prusty 62418382eadSSubhransu S. Prusty static const struct hda_device_id hdmi_list[] = { 62518382eadSSubhransu S. Prusty HDA_CODEC_EXT_ENTRY(0x80862809, 0x100000, "Skylake HDMI", 0), 62618382eadSSubhransu S. Prusty {} 62718382eadSSubhransu S. Prusty }; 62818382eadSSubhransu S. Prusty 62918382eadSSubhransu S. Prusty MODULE_DEVICE_TABLE(hdaudio, hdmi_list); 63018382eadSSubhransu S. Prusty 63118382eadSSubhransu S. Prusty static struct hdac_ext_driver hdmi_driver = { 63218382eadSSubhransu S. Prusty . hdac = { 63318382eadSSubhransu S. Prusty .driver = { 63418382eadSSubhransu S. Prusty .name = "HDMI HDA Codec", 635e342ac08SSubhransu S. Prusty .pm = &hdac_hdmi_pm, 63618382eadSSubhransu S. Prusty }, 63718382eadSSubhransu S. Prusty .id_table = hdmi_list, 63818382eadSSubhransu S. Prusty }, 63918382eadSSubhransu S. Prusty .probe = hdac_hdmi_dev_probe, 64018382eadSSubhransu S. Prusty .remove = hdac_hdmi_dev_remove, 64118382eadSSubhransu S. Prusty }; 64218382eadSSubhransu S. Prusty 64318382eadSSubhransu S. Prusty static int __init hdmi_init(void) 64418382eadSSubhransu S. Prusty { 64518382eadSSubhransu S. Prusty return snd_hda_ext_driver_register(&hdmi_driver); 64618382eadSSubhransu S. Prusty } 64718382eadSSubhransu S. Prusty 64818382eadSSubhransu S. Prusty static void __exit hdmi_exit(void) 64918382eadSSubhransu S. Prusty { 65018382eadSSubhransu S. Prusty snd_hda_ext_driver_unregister(&hdmi_driver); 65118382eadSSubhransu S. Prusty } 65218382eadSSubhransu S. Prusty 65318382eadSSubhransu S. Prusty module_init(hdmi_init); 65418382eadSSubhransu S. Prusty module_exit(hdmi_exit); 65518382eadSSubhransu S. Prusty 65618382eadSSubhransu S. Prusty MODULE_LICENSE("GPL v2"); 65718382eadSSubhransu S. Prusty MODULE_DESCRIPTION("HDMI HD codec"); 65818382eadSSubhransu S. Prusty MODULE_AUTHOR("Samreen Nilofer<samreen.nilofer@intel.com>"); 65918382eadSSubhransu S. Prusty MODULE_AUTHOR("Subhransu S. Prusty<subhransu.s.prusty@intel.com>"); 660