aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUghreja, Rakesh A <rakesh.a.ughreja@intel.com>2017-12-01 04:13:19 -0500
committerMark Brown <broonie@kernel.org>2017-12-01 07:48:16 -0500
commitf0c5ebebacf3cc246e51e8814f5d4b22179f37bd (patch)
tree2a8e3f8f2dde5a7d171b57e961ae685cc9a57cd7
parent72bc39cf53fabf56907f9d6c4b120fc49d9abc95 (diff)
ASoC: hdac_hdmi: clean up hdac_device variable names
This patch renames all the variable instances of hdac_device with hdev to prepare the code base to remove the usage of hdac_ext_device data structures done in the following patches. Existing code uses hdev and hdac as variable names for hdac_device as well as hdac_ext_device, which creates confusion. Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/sound/hdaudio_ext.h4
-rw-r--r--sound/hda/ext/hdac_ext_bus.c2
-rw-r--r--sound/soc/codecs/hdac_hdmi.c312
3 files changed, 159 insertions, 159 deletions
diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h
index ca00130cb028..9c14e21dda85 100644
--- a/include/sound/hdaudio_ext.h
+++ b/include/sound/hdaudio_ext.h
@@ -193,7 +193,7 @@ struct hda_dai_map {
193 * @pvt_data - private data, for asoc contains asoc codec object 193 * @pvt_data - private data, for asoc contains asoc codec object
194 */ 194 */
195struct hdac_ext_device { 195struct hdac_ext_device {
196 struct hdac_device hdac; 196 struct hdac_device hdev;
197 struct hdac_ext_bus *ebus; 197 struct hdac_ext_bus *ebus;
198 198
199 /* soc-dai to nid map */ 199 /* soc-dai to nid map */
@@ -213,7 +213,7 @@ struct hdac_ext_dma_params {
213 u8 stream_tag; 213 u8 stream_tag;
214}; 214};
215#define to_ehdac_device(dev) (container_of((dev), \ 215#define to_ehdac_device(dev) (container_of((dev), \
216 struct hdac_ext_device, hdac)) 216 struct hdac_ext_device, hdev))
217/* 217/*
218 * HD-audio codec base driver 218 * HD-audio codec base driver
219 */ 219 */
diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
index 31b510c5ca0b..0daf31383084 100644
--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -146,7 +146,7 @@ int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr)
146 edev = kzalloc(sizeof(*edev), GFP_KERNEL); 146 edev = kzalloc(sizeof(*edev), GFP_KERNEL);
147 if (!edev) 147 if (!edev)
148 return -ENOMEM; 148 return -ENOMEM;
149 hdev = &edev->hdac; 149 hdev = &edev->hdev;
150 edev->ebus = ebus; 150 edev->ebus = ebus;
151 151
152 snprintf(name, sizeof(name), "ehdaudio%dD%d", ebus->idx, addr); 152 snprintf(name, sizeof(name), "ehdaudio%dD%d", ebus->idx, addr);
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 98a695ba9373..3a35ede7027d 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -171,7 +171,7 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
171 * ports. 171 * ports.
172 */ 172 */
173 if (pcm->jack_event == 0) { 173 if (pcm->jack_event == 0) {
174 dev_dbg(&edev->hdac.dev, 174 dev_dbg(&edev->hdev.dev,
175 "jack report for pcm=%d\n", 175 "jack report for pcm=%d\n",
176 pcm->pcm_id); 176 pcm->pcm_id);
177 snd_soc_jack_report(pcm->jack, SND_JACK_AVOUT, 177 snd_soc_jack_report(pcm->jack, SND_JACK_AVOUT,
@@ -202,13 +202,13 @@ static int hdac_hdmi_get_port_len(struct hdac_ext_device *edev, hda_nid_t nid)
202 unsigned int caps; 202 unsigned int caps;
203 unsigned int type, param; 203 unsigned int type, param;
204 204
205 caps = get_wcaps(&edev->hdac, nid); 205 caps = get_wcaps(&edev->hdev, nid);
206 type = get_wcaps_type(caps); 206 type = get_wcaps_type(caps);
207 207
208 if (!(caps & AC_WCAP_DIGITAL) || (type != AC_WID_PIN)) 208 if (!(caps & AC_WCAP_DIGITAL) || (type != AC_WID_PIN))
209 return 0; 209 return 0;
210 210
211 param = snd_hdac_read_parm_uncached(&edev->hdac, nid, 211 param = snd_hdac_read_parm_uncached(&edev->hdev, nid,
212 AC_PAR_DEVLIST_LEN); 212 AC_PAR_DEVLIST_LEN);
213 if (param == -1) 213 if (param == -1)
214 return param; 214 return param;
@@ -224,7 +224,7 @@ static int hdac_hdmi_get_port_len(struct hdac_ext_device *edev, hda_nid_t nid)
224static int hdac_hdmi_port_select_get(struct hdac_ext_device *edev, 224static int hdac_hdmi_port_select_get(struct hdac_ext_device *edev,
225 struct hdac_hdmi_port *port) 225 struct hdac_hdmi_port *port)
226{ 226{
227 return snd_hdac_codec_read(&edev->hdac, port->pin->nid, 227 return snd_hdac_codec_read(&edev->hdev, port->pin->nid,
228 0, AC_VERB_GET_DEVICE_SEL, 0); 228 0, AC_VERB_GET_DEVICE_SEL, 0);
229} 229}
230 230
@@ -252,13 +252,13 @@ static int hdac_hdmi_port_select_set(struct hdac_ext_device *edev,
252 if (num_ports + 1 < port->id) 252 if (num_ports + 1 < port->id)
253 return 0; 253 return 0;
254 254
255 snd_hdac_codec_write(&edev->hdac, port->pin->nid, 0, 255 snd_hdac_codec_write(&edev->hdev, port->pin->nid, 0,
256 AC_VERB_SET_DEVICE_SEL, port->id); 256 AC_VERB_SET_DEVICE_SEL, port->id);
257 257
258 if (port->id != hdac_hdmi_port_select_get(edev, port)) 258 if (port->id != hdac_hdmi_port_select_get(edev, port))
259 return -EIO; 259 return -EIO;
260 260
261 dev_dbg(&edev->hdac.dev, "Selected the port=%d\n", port->id); 261 dev_dbg(&edev->hdev.dev, "Selected the port=%d\n", port->id);
262 262
263 return 0; 263 return 0;
264} 264}
@@ -278,9 +278,9 @@ static struct hdac_hdmi_pcm *get_hdmi_pcm_from_id(struct hdac_hdmi_priv *hdmi,
278 278
279static inline struct hdac_ext_device *to_hda_ext_device(struct device *dev) 279static inline struct hdac_ext_device *to_hda_ext_device(struct device *dev)
280{ 280{
281 struct hdac_device *hdac = dev_to_hdac_dev(dev); 281 struct hdac_device *hdev = dev_to_hdac_dev(dev);
282 282
283 return to_ehdac_device(hdac); 283 return to_ehdac_device(hdev);
284} 284}
285 285
286static unsigned int sad_format(const u8 *sad) 286static unsigned int sad_format(const u8 *sad)
@@ -330,7 +330,7 @@ hdac_hdmi_set_dip_index(struct hdac_ext_device *edev, hda_nid_t pin_nid,
330 330
331 val = (packet_index << 5) | (byte_index & 0x1f); 331 val = (packet_index << 5) | (byte_index & 0x1f);
332 332
333 snd_hdac_codec_write(&edev->hdac, pin_nid, 0, 333 snd_hdac_codec_write(&edev->hdev, pin_nid, 0,
334 AC_VERB_SET_HDMI_DIP_INDEX, val); 334 AC_VERB_SET_HDMI_DIP_INDEX, val);
335} 335}
336 336
@@ -353,7 +353,7 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *edev,
353 struct hdmi_audio_infoframe frame; 353 struct hdmi_audio_infoframe frame;
354 struct hdac_hdmi_pin *pin = port->pin; 354 struct hdac_hdmi_pin *pin = port->pin;
355 struct dp_audio_infoframe dp_ai; 355 struct dp_audio_infoframe dp_ai;
356 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 356 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
357 struct hdac_hdmi_cvt *cvt = pcm->cvt; 357 struct hdac_hdmi_cvt *cvt = pcm->cvt;
358 u8 *dip; 358 u8 *dip;
359 int ret; 359 int ret;
@@ -362,11 +362,11 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *edev,
362 u8 conn_type; 362 u8 conn_type;
363 int channels, ca; 363 int channels, ca;
364 364
365 ca = snd_hdac_channel_allocation(&edev->hdac, port->eld.info.spk_alloc, 365 ca = snd_hdac_channel_allocation(&edev->hdev, port->eld.info.spk_alloc,
366 pcm->channels, pcm->chmap_set, true, pcm->chmap); 366 pcm->channels, pcm->chmap_set, true, pcm->chmap);
367 367
368 channels = snd_hdac_get_active_channels(ca); 368 channels = snd_hdac_get_active_channels(ca);
369 hdmi->chmap.ops.set_channel_count(&edev->hdac, cvt->nid, channels); 369 hdmi->chmap.ops.set_channel_count(&edev->hdev, cvt->nid, channels);
370 370
371 snd_hdac_setup_channel_mapping(&hdmi->chmap, pin->nid, false, ca, 371 snd_hdac_setup_channel_mapping(&hdmi->chmap, pin->nid, false, ca,
372 pcm->channels, pcm->chmap, pcm->chmap_set); 372 pcm->channels, pcm->chmap, pcm->chmap_set);
@@ -399,14 +399,14 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *edev,
399 break; 399 break;
400 400
401 default: 401 default:
402 dev_err(&edev->hdac.dev, "Invalid connection type: %d\n", 402 dev_err(&edev->hdev.dev, "Invalid connection type: %d\n",
403 conn_type); 403 conn_type);
404 return -EIO; 404 return -EIO;
405 } 405 }
406 406
407 /* stop infoframe transmission */ 407 /* stop infoframe transmission */
408 hdac_hdmi_set_dip_index(edev, pin->nid, 0x0, 0x0); 408 hdac_hdmi_set_dip_index(edev, pin->nid, 0x0, 0x0);
409 snd_hdac_codec_write(&edev->hdac, pin->nid, 0, 409 snd_hdac_codec_write(&edev->hdev, pin->nid, 0,
410 AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_DISABLE); 410 AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_DISABLE);
411 411
412 412
@@ -414,17 +414,17 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *edev,
414 hdac_hdmi_set_dip_index(edev, pin->nid, 0x0, 0x0); 414 hdac_hdmi_set_dip_index(edev, pin->nid, 0x0, 0x0);
415 if (conn_type == DRM_ELD_CONN_TYPE_HDMI) { 415 if (conn_type == DRM_ELD_CONN_TYPE_HDMI) {
416 for (i = 0; i < sizeof(buffer); i++) 416 for (i = 0; i < sizeof(buffer); i++)
417 snd_hdac_codec_write(&edev->hdac, pin->nid, 0, 417 snd_hdac_codec_write(&edev->hdev, pin->nid, 0,
418 AC_VERB_SET_HDMI_DIP_DATA, buffer[i]); 418 AC_VERB_SET_HDMI_DIP_DATA, buffer[i]);
419 } else { 419 } else {
420 for (i = 0; i < sizeof(dp_ai); i++) 420 for (i = 0; i < sizeof(dp_ai); i++)
421 snd_hdac_codec_write(&edev->hdac, pin->nid, 0, 421 snd_hdac_codec_write(&edev->hdev, pin->nid, 0,
422 AC_VERB_SET_HDMI_DIP_DATA, dip[i]); 422 AC_VERB_SET_HDMI_DIP_DATA, dip[i]);
423 } 423 }
424 424
425 /* Start infoframe */ 425 /* Start infoframe */
426 hdac_hdmi_set_dip_index(edev, pin->nid, 0x0, 0x0); 426 hdac_hdmi_set_dip_index(edev, pin->nid, 0x0, 0x0);
427 snd_hdac_codec_write(&edev->hdac, pin->nid, 0, 427 snd_hdac_codec_write(&edev->hdev, pin->nid, 0,
428 AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_BEST); 428 AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_BEST);
429 429
430 return 0; 430 return 0;
@@ -435,11 +435,11 @@ static int hdac_hdmi_set_tdm_slot(struct snd_soc_dai *dai,
435 int slots, int slot_width) 435 int slots, int slot_width)
436{ 436{
437 struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai); 437 struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai);
438 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 438 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
439 struct hdac_hdmi_dai_port_map *dai_map; 439 struct hdac_hdmi_dai_port_map *dai_map;
440 struct hdac_hdmi_pcm *pcm; 440 struct hdac_hdmi_pcm *pcm;
441 441
442 dev_dbg(&edev->hdac.dev, "%s: strm_tag: %d\n", __func__, tx_mask); 442 dev_dbg(&edev->hdev.dev, "%s: strm_tag: %d\n", __func__, tx_mask);
443 443
444 dai_map = &hdmi->dai_map[dai->id]; 444 dai_map = &hdmi->dai_map[dai->id];
445 445
@@ -455,7 +455,7 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
455 struct snd_pcm_hw_params *hparams, struct snd_soc_dai *dai) 455 struct snd_pcm_hw_params *hparams, struct snd_soc_dai *dai)
456{ 456{
457 struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai); 457 struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai);
458 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 458 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
459 struct hdac_hdmi_dai_port_map *dai_map; 459 struct hdac_hdmi_dai_port_map *dai_map;
460 struct hdac_hdmi_port *port; 460 struct hdac_hdmi_port *port;
461 struct hdac_hdmi_pcm *pcm; 461 struct hdac_hdmi_pcm *pcm;
@@ -468,7 +468,7 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
468 return -ENODEV; 468 return -ENODEV;
469 469
470 if ((!port->eld.monitor_present) || (!port->eld.eld_valid)) { 470 if ((!port->eld.monitor_present) || (!port->eld.eld_valid)) {
471 dev_err(&edev->hdac.dev, 471 dev_err(&edev->hdev.dev,
472 "device is not configured for this pin:port%d:%d\n", 472 "device is not configured for this pin:port%d:%d\n",
473 port->pin->nid, port->id); 473 port->pin->nid, port->id);
474 return -ENODEV; 474 return -ENODEV;
@@ -492,24 +492,24 @@ static int hdac_hdmi_query_port_connlist(struct hdac_ext_device *edev,
492 struct hdac_hdmi_pin *pin, 492 struct hdac_hdmi_pin *pin,
493 struct hdac_hdmi_port *port) 493 struct hdac_hdmi_port *port)
494{ 494{
495 if (!(get_wcaps(&edev->hdac, pin->nid) & AC_WCAP_CONN_LIST)) { 495 if (!(get_wcaps(&edev->hdev, pin->nid) & AC_WCAP_CONN_LIST)) {
496 dev_warn(&edev->hdac.dev, 496 dev_warn(&edev->hdev.dev,
497 "HDMI: pin %d wcaps %#x does not support connection list\n", 497 "HDMI: pin %d wcaps %#x does not support connection list\n",
498 pin->nid, get_wcaps(&edev->hdac, pin->nid)); 498 pin->nid, get_wcaps(&edev->hdev, pin->nid));
499 return -EINVAL; 499 return -EINVAL;
500 } 500 }
501 501
502 if (hdac_hdmi_port_select_set(edev, port) < 0) 502 if (hdac_hdmi_port_select_set(edev, port) < 0)
503 return -EIO; 503 return -EIO;
504 504
505 port->num_mux_nids = snd_hdac_get_connections(&edev->hdac, pin->nid, 505 port->num_mux_nids = snd_hdac_get_connections(&edev->hdev, pin->nid,
506 port->mux_nids, HDA_MAX_CONNECTIONS); 506 port->mux_nids, HDA_MAX_CONNECTIONS);
507 if (port->num_mux_nids == 0) 507 if (port->num_mux_nids == 0)
508 dev_warn(&edev->hdac.dev, 508 dev_warn(&edev->hdev.dev,
509 "No connections found for pin:port %d:%d\n", 509 "No connections found for pin:port %d:%d\n",
510 pin->nid, port->id); 510 pin->nid, port->id);
511 511
512 dev_dbg(&edev->hdac.dev, "num_mux_nids %d for pin:port %d:%d\n", 512 dev_dbg(&edev->hdev.dev, "num_mux_nids %d for pin:port %d:%d\n",
513 port->num_mux_nids, pin->nid, port->id); 513 port->num_mux_nids, pin->nid, port->id);
514 514
515 return port->num_mux_nids; 515 return port->num_mux_nids;
@@ -568,7 +568,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
568 struct snd_soc_dai *dai) 568 struct snd_soc_dai *dai)
569{ 569{
570 struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai); 570 struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai);
571 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 571 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
572 struct hdac_hdmi_dai_port_map *dai_map; 572 struct hdac_hdmi_dai_port_map *dai_map;
573 struct hdac_hdmi_cvt *cvt; 573 struct hdac_hdmi_cvt *cvt;
574 struct hdac_hdmi_port *port; 574 struct hdac_hdmi_port *port;
@@ -588,7 +588,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
588 if ((!port->eld.monitor_present) || 588 if ((!port->eld.monitor_present) ||
589 (!port->eld.eld_valid)) { 589 (!port->eld.eld_valid)) {
590 590
591 dev_warn(&edev->hdac.dev, 591 dev_warn(&edev->hdev.dev,
592 "Failed: present?:%d ELD valid?:%d pin:port: %d:%d\n", 592 "Failed: present?:%d ELD valid?:%d pin:port: %d:%d\n",
593 port->eld.monitor_present, port->eld.eld_valid, 593 port->eld.monitor_present, port->eld.eld_valid,
594 port->pin->nid, port->id); 594 port->pin->nid, port->id);
@@ -611,7 +611,7 @@ static void hdac_hdmi_pcm_close(struct snd_pcm_substream *substream,
611 struct snd_soc_dai *dai) 611 struct snd_soc_dai *dai)
612{ 612{
613 struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai); 613 struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai);
614 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 614 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
615 struct hdac_hdmi_dai_port_map *dai_map; 615 struct hdac_hdmi_dai_port_map *dai_map;
616 struct hdac_hdmi_pcm *pcm; 616 struct hdac_hdmi_pcm *pcm;
617 617
@@ -632,13 +632,13 @@ static void hdac_hdmi_pcm_close(struct snd_pcm_substream *substream,
632} 632}
633 633
634static int 634static int
635hdac_hdmi_query_cvt_params(struct hdac_device *hdac, struct hdac_hdmi_cvt *cvt) 635hdac_hdmi_query_cvt_params(struct hdac_device *hdev, struct hdac_hdmi_cvt *cvt)
636{ 636{
637 unsigned int chans; 637 unsigned int chans;
638 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdac); 638 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
639 int err; 639 int err;
640 640
641 chans = get_wcaps(hdac, cvt->nid); 641 chans = get_wcaps(hdev, cvt->nid);
642 chans = get_wcaps_channels(chans); 642 chans = get_wcaps_channels(chans);
643 643
644 cvt->params.channels_min = 2; 644 cvt->params.channels_min = 2;
@@ -647,12 +647,12 @@ hdac_hdmi_query_cvt_params(struct hdac_device *hdac, struct hdac_hdmi_cvt *cvt)
647 if (chans > hdmi->chmap.channels_max) 647 if (chans > hdmi->chmap.channels_max)
648 hdmi->chmap.channels_max = chans; 648 hdmi->chmap.channels_max = chans;
649 649
650 err = snd_hdac_query_supported_pcm(hdac, cvt->nid, 650 err = snd_hdac_query_supported_pcm(hdev, cvt->nid,
651 &cvt->params.rates, 651 &cvt->params.rates,
652 &cvt->params.formats, 652 &cvt->params.formats,
653 &cvt->params.maxbps); 653 &cvt->params.maxbps);
654 if (err < 0) 654 if (err < 0)
655 dev_err(&hdac->dev, 655 dev_err(&hdev->dev,
656 "Failed to query pcm params for nid %d: %d\n", 656 "Failed to query pcm params for nid %d: %d\n",
657 cvt->nid, err); 657 cvt->nid, err);
658 658
@@ -697,7 +697,7 @@ static void hdac_hdmi_fill_route(struct snd_soc_dapm_route *route,
697static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev, 697static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev,
698 struct hdac_hdmi_port *port) 698 struct hdac_hdmi_port *port)
699{ 699{
700 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 700 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
701 struct hdac_hdmi_pcm *pcm = NULL; 701 struct hdac_hdmi_pcm *pcm = NULL;
702 struct hdac_hdmi_port *p; 702 struct hdac_hdmi_port *p;
703 703
@@ -717,9 +717,9 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev,
717static void hdac_hdmi_set_power_state(struct hdac_ext_device *edev, 717static void hdac_hdmi_set_power_state(struct hdac_ext_device *edev,
718 hda_nid_t nid, unsigned int pwr_state) 718 hda_nid_t nid, unsigned int pwr_state)
719{ 719{
720 if (get_wcaps(&edev->hdac, nid) & AC_WCAP_POWER) { 720 if (get_wcaps(&edev->hdev, nid) & AC_WCAP_POWER) {
721 if (!snd_hdac_check_power_state(&edev->hdac, nid, pwr_state)) 721 if (!snd_hdac_check_power_state(&edev->hdev, nid, pwr_state))
722 snd_hdac_codec_write(&edev->hdac, nid, 0, 722 snd_hdac_codec_write(&edev->hdev, nid, 0,
723 AC_VERB_SET_POWER_STATE, pwr_state); 723 AC_VERB_SET_POWER_STATE, pwr_state);
724 } 724 }
725} 725}
@@ -727,8 +727,8 @@ static void hdac_hdmi_set_power_state(struct hdac_ext_device *edev,
727static void hdac_hdmi_set_amp(struct hdac_ext_device *edev, 727static void hdac_hdmi_set_amp(struct hdac_ext_device *edev,
728 hda_nid_t nid, int val) 728 hda_nid_t nid, int val)
729{ 729{
730 if (get_wcaps(&edev->hdac, nid) & AC_WCAP_OUT_AMP) 730 if (get_wcaps(&edev->hdev, nid) & AC_WCAP_OUT_AMP)
731 snd_hdac_codec_write(&edev->hdac, nid, 0, 731 snd_hdac_codec_write(&edev->hdev, nid, 0,
732 AC_VERB_SET_AMP_GAIN_MUTE, val); 732 AC_VERB_SET_AMP_GAIN_MUTE, val);
733} 733}
734 734
@@ -740,7 +740,7 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w,
740 struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev); 740 struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev);
741 struct hdac_hdmi_pcm *pcm; 741 struct hdac_hdmi_pcm *pcm;
742 742
743 dev_dbg(&edev->hdac.dev, "%s: widget: %s event: %x\n", 743 dev_dbg(&edev->hdev.dev, "%s: widget: %s event: %x\n",
744 __func__, w->name, event); 744 __func__, w->name, event);
745 745
746 pcm = hdac_hdmi_get_pcm(edev, port); 746 pcm = hdac_hdmi_get_pcm(edev, port);
@@ -756,7 +756,7 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w,
756 hdac_hdmi_set_power_state(edev, port->pin->nid, AC_PWRST_D0); 756 hdac_hdmi_set_power_state(edev, port->pin->nid, AC_PWRST_D0);
757 757
758 /* Enable out path for this pin widget */ 758 /* Enable out path for this pin widget */
759 snd_hdac_codec_write(&edev->hdac, port->pin->nid, 0, 759 snd_hdac_codec_write(&edev->hdev, port->pin->nid, 0,
760 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); 760 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
761 761
762 hdac_hdmi_set_amp(edev, port->pin->nid, AMP_OUT_UNMUTE); 762 hdac_hdmi_set_amp(edev, port->pin->nid, AMP_OUT_UNMUTE);
@@ -767,7 +767,7 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w,
767 hdac_hdmi_set_amp(edev, port->pin->nid, AMP_OUT_MUTE); 767 hdac_hdmi_set_amp(edev, port->pin->nid, AMP_OUT_MUTE);
768 768
769 /* Disable out path for this pin widget */ 769 /* Disable out path for this pin widget */
770 snd_hdac_codec_write(&edev->hdac, port->pin->nid, 0, 770 snd_hdac_codec_write(&edev->hdev, port->pin->nid, 0,
771 AC_VERB_SET_PIN_WIDGET_CONTROL, 0); 771 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
772 772
773 hdac_hdmi_set_power_state(edev, port->pin->nid, AC_PWRST_D3); 773 hdac_hdmi_set_power_state(edev, port->pin->nid, AC_PWRST_D3);
@@ -783,10 +783,10 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w,
783{ 783{
784 struct hdac_hdmi_cvt *cvt = w->priv; 784 struct hdac_hdmi_cvt *cvt = w->priv;
785 struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev); 785 struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev);
786 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 786 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
787 struct hdac_hdmi_pcm *pcm; 787 struct hdac_hdmi_pcm *pcm;
788 788
789 dev_dbg(&edev->hdac.dev, "%s: widget: %s event: %x\n", 789 dev_dbg(&edev->hdev.dev, "%s: widget: %s event: %x\n",
790 __func__, w->name, event); 790 __func__, w->name, event);
791 791
792 pcm = hdac_hdmi_get_pcm_from_cvt(hdmi, cvt); 792 pcm = hdac_hdmi_get_pcm_from_cvt(hdmi, cvt);
@@ -798,23 +798,23 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w,
798 hdac_hdmi_set_power_state(edev, cvt->nid, AC_PWRST_D0); 798 hdac_hdmi_set_power_state(edev, cvt->nid, AC_PWRST_D0);
799 799
800 /* Enable transmission */ 800 /* Enable transmission */
801 snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, 801 snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
802 AC_VERB_SET_DIGI_CONVERT_1, 1); 802 AC_VERB_SET_DIGI_CONVERT_1, 1);
803 803
804 /* Category Code (CC) to zero */ 804 /* Category Code (CC) to zero */
805 snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, 805 snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
806 AC_VERB_SET_DIGI_CONVERT_2, 0); 806 AC_VERB_SET_DIGI_CONVERT_2, 0);
807 807
808 snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, 808 snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
809 AC_VERB_SET_CHANNEL_STREAMID, pcm->stream_tag); 809 AC_VERB_SET_CHANNEL_STREAMID, pcm->stream_tag);
810 snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, 810 snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
811 AC_VERB_SET_STREAM_FORMAT, pcm->format); 811 AC_VERB_SET_STREAM_FORMAT, pcm->format);
812 break; 812 break;
813 813
814 case SND_SOC_DAPM_POST_PMD: 814 case SND_SOC_DAPM_POST_PMD:
815 snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, 815 snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
816 AC_VERB_SET_CHANNEL_STREAMID, 0); 816 AC_VERB_SET_CHANNEL_STREAMID, 0);
817 snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, 817 snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
818 AC_VERB_SET_STREAM_FORMAT, 0); 818 AC_VERB_SET_STREAM_FORMAT, 0);
819 819
820 hdac_hdmi_set_power_state(edev, cvt->nid, AC_PWRST_D3); 820 hdac_hdmi_set_power_state(edev, cvt->nid, AC_PWRST_D3);
@@ -832,7 +832,7 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w,
832 struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev); 832 struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev);
833 int mux_idx; 833 int mux_idx;
834 834
835 dev_dbg(&edev->hdac.dev, "%s: widget: %s event: %x\n", 835 dev_dbg(&edev->hdev.dev, "%s: widget: %s event: %x\n",
836 __func__, w->name, event); 836 __func__, w->name, event);
837 837
838 if (!kc) 838 if (!kc)
@@ -845,7 +845,7 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w,
845 return -EIO; 845 return -EIO;
846 846
847 if (mux_idx > 0) { 847 if (mux_idx > 0) {
848 snd_hdac_codec_write(&edev->hdac, port->pin->nid, 0, 848 snd_hdac_codec_write(&edev->hdev, port->pin->nid, 0,
849 AC_VERB_SET_CONNECT_SEL, (mux_idx - 1)); 849 AC_VERB_SET_CONNECT_SEL, (mux_idx - 1));
850 } 850 }
851 851
@@ -865,7 +865,7 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
865 struct snd_soc_dapm_context *dapm = w->dapm; 865 struct snd_soc_dapm_context *dapm = w->dapm;
866 struct hdac_hdmi_port *port = w->priv; 866 struct hdac_hdmi_port *port = w->priv;
867 struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev); 867 struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev);
868 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 868 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
869 struct hdac_hdmi_pcm *pcm = NULL; 869 struct hdac_hdmi_pcm *pcm = NULL;
870 const char *cvt_name = e->texts[ucontrol->value.enumerated.item[0]]; 870 const char *cvt_name = e->texts[ucontrol->value.enumerated.item[0]];
871 871
@@ -923,7 +923,7 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
923 struct snd_soc_dapm_widget *widget, 923 struct snd_soc_dapm_widget *widget,
924 const char *widget_name) 924 const char *widget_name)
925{ 925{
926 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 926 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
927 struct hdac_hdmi_pin *pin = port->pin; 927 struct hdac_hdmi_pin *pin = port->pin;
928 struct snd_kcontrol_new *kc; 928 struct snd_kcontrol_new *kc;
929 struct hdac_hdmi_cvt *cvt; 929 struct hdac_hdmi_cvt *cvt;
@@ -935,17 +935,17 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
935 int i = 0; 935 int i = 0;
936 int num_items = hdmi->num_cvt + 1; 936 int num_items = hdmi->num_cvt + 1;
937 937
938 kc = devm_kzalloc(&edev->hdac.dev, sizeof(*kc), GFP_KERNEL); 938 kc = devm_kzalloc(&edev->hdev.dev, sizeof(*kc), GFP_KERNEL);
939 if (!kc) 939 if (!kc)
940 return -ENOMEM; 940 return -ENOMEM;
941 941
942 se = devm_kzalloc(&edev->hdac.dev, sizeof(*se), GFP_KERNEL); 942 se = devm_kzalloc(&edev->hdev.dev, sizeof(*se), GFP_KERNEL);
943 if (!se) 943 if (!se)
944 return -ENOMEM; 944 return -ENOMEM;
945 945
946 snprintf(kc_name, NAME_SIZE, "Pin %d port %d Input", 946 snprintf(kc_name, NAME_SIZE, "Pin %d port %d Input",
947 pin->nid, port->id); 947 pin->nid, port->id);
948 kc->name = devm_kstrdup(&edev->hdac.dev, kc_name, GFP_KERNEL); 948 kc->name = devm_kstrdup(&edev->hdev.dev, kc_name, GFP_KERNEL);
949 if (!kc->name) 949 if (!kc->name)
950 return -ENOMEM; 950 return -ENOMEM;
951 951
@@ -963,24 +963,24 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
963 se->mask = roundup_pow_of_two(se->items) - 1; 963 se->mask = roundup_pow_of_two(se->items) - 1;
964 964
965 sprintf(mux_items, "NONE"); 965 sprintf(mux_items, "NONE");
966 items[i] = devm_kstrdup(&edev->hdac.dev, mux_items, GFP_KERNEL); 966 items[i] = devm_kstrdup(&edev->hdev.dev, mux_items, GFP_KERNEL);
967 if (!items[i]) 967 if (!items[i])
968 return -ENOMEM; 968 return -ENOMEM;
969 969
970 list_for_each_entry(cvt, &hdmi->cvt_list, head) { 970 list_for_each_entry(cvt, &hdmi->cvt_list, head) {
971 i++; 971 i++;
972 sprintf(mux_items, "cvt %d", cvt->nid); 972 sprintf(mux_items, "cvt %d", cvt->nid);
973 items[i] = devm_kstrdup(&edev->hdac.dev, mux_items, GFP_KERNEL); 973 items[i] = devm_kstrdup(&edev->hdev.dev, mux_items, GFP_KERNEL);
974 if (!items[i]) 974 if (!items[i])
975 return -ENOMEM; 975 return -ENOMEM;
976 } 976 }
977 977
978 se->texts = devm_kmemdup(&edev->hdac.dev, items, 978 se->texts = devm_kmemdup(&edev->hdev.dev, items,
979 (num_items * sizeof(char *)), GFP_KERNEL); 979 (num_items * sizeof(char *)), GFP_KERNEL);
980 if (!se->texts) 980 if (!se->texts)
981 return -ENOMEM; 981 return -ENOMEM;
982 982
983 return hdac_hdmi_fill_widget_info(&edev->hdac.dev, widget, 983 return hdac_hdmi_fill_widget_info(&edev->hdev.dev, widget,
984 snd_soc_dapm_mux, port, widget_name, NULL, kc, 1, 984 snd_soc_dapm_mux, port, widget_name, NULL, kc, 1,
985 hdac_hdmi_pin_mux_widget_event, 985 hdac_hdmi_pin_mux_widget_event,
986 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_REG); 986 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_REG);
@@ -991,7 +991,7 @@ static void hdac_hdmi_add_pinmux_cvt_route(struct hdac_ext_device *edev,
991 struct snd_soc_dapm_widget *widgets, 991 struct snd_soc_dapm_widget *widgets,
992 struct snd_soc_dapm_route *route, int rindex) 992 struct snd_soc_dapm_route *route, int rindex)
993{ 993{
994 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 994 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
995 const struct snd_kcontrol_new *kc; 995 const struct snd_kcontrol_new *kc;
996 struct soc_enum *se; 996 struct soc_enum *se;
997 int mux_index = hdmi->num_cvt + hdmi->num_ports; 997 int mux_index = hdmi->num_cvt + hdmi->num_ports;
@@ -1034,7 +1034,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
1034 struct snd_soc_dapm_widget *widgets; 1034 struct snd_soc_dapm_widget *widgets;
1035 struct snd_soc_dapm_route *route; 1035 struct snd_soc_dapm_route *route;
1036 struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev); 1036 struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev);
1037 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1037 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1038 struct snd_soc_dai_driver *dai_drv = dapm->component->dai_drv; 1038 struct snd_soc_dai_driver *dai_drv = dapm->component->dai_drv;
1039 char widget_name[NAME_SIZE]; 1039 char widget_name[NAME_SIZE];
1040 struct hdac_hdmi_cvt *cvt; 1040 struct hdac_hdmi_cvt *cvt;
@@ -1135,7 +1135,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
1135 1135
1136static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev) 1136static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
1137{ 1137{
1138 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1138 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1139 struct hdac_hdmi_dai_port_map *dai_map; 1139 struct hdac_hdmi_dai_port_map *dai_map;
1140 struct hdac_hdmi_cvt *cvt; 1140 struct hdac_hdmi_cvt *cvt;
1141 int dai_id = 0; 1141 int dai_id = 0;
@@ -1151,7 +1151,7 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
1151 dai_id++; 1151 dai_id++;
1152 1152
1153 if (dai_id == HDA_MAX_CVTS) { 1153 if (dai_id == HDA_MAX_CVTS) {
1154 dev_warn(&edev->hdac.dev, 1154 dev_warn(&edev->hdev.dev,
1155 "Max dais supported: %d\n", dai_id); 1155 "Max dais supported: %d\n", dai_id);
1156 break; 1156 break;
1157 } 1157 }
@@ -1162,7 +1162,7 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
1162 1162
1163static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid) 1163static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid)
1164{ 1164{
1165 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1165 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1166 struct hdac_hdmi_cvt *cvt; 1166 struct hdac_hdmi_cvt *cvt;
1167 char name[NAME_SIZE]; 1167 char name[NAME_SIZE];
1168 1168
@@ -1177,7 +1177,7 @@ static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid)
1177 list_add_tail(&cvt->head, &hdmi->cvt_list); 1177 list_add_tail(&cvt->head, &hdmi->cvt_list);
1178 hdmi->num_cvt++; 1178 hdmi->num_cvt++;
1179 1179
1180 return hdac_hdmi_query_cvt_params(&edev->hdac, cvt); 1180 return hdac_hdmi_query_cvt_params(&edev->hdev, cvt);
1181} 1181}
1182 1182
1183static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev, 1183static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
@@ -1189,7 +1189,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
1189 >> DRM_ELD_VER_SHIFT; 1189 >> DRM_ELD_VER_SHIFT;
1190 1190
1191 if (ver != ELD_VER_CEA_861D && ver != ELD_VER_PARTIAL) { 1191 if (ver != ELD_VER_CEA_861D && ver != ELD_VER_PARTIAL) {
1192 dev_err(&edev->hdac.dev, "HDMI: Unknown ELD version %d\n", ver); 1192 dev_err(&edev->hdev.dev, "HDMI: Unknown ELD version %d\n", ver);
1193 return -EINVAL; 1193 return -EINVAL;
1194 } 1194 }
1195 1195
@@ -1197,7 +1197,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
1197 DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT; 1197 DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT;
1198 1198
1199 if (mnl > ELD_MAX_MNL) { 1199 if (mnl > ELD_MAX_MNL) {
1200 dev_err(&edev->hdac.dev, "HDMI: MNL Invalid %d\n", mnl); 1200 dev_err(&edev->hdev.dev, "HDMI: MNL Invalid %d\n", mnl);
1201 return -EINVAL; 1201 return -EINVAL;
1202 } 1202 }
1203 1203
@@ -1210,7 +1210,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
1210 struct hdac_hdmi_port *port) 1210 struct hdac_hdmi_port *port)
1211{ 1211{
1212 struct hdac_ext_device *edev = pin->edev; 1212 struct hdac_ext_device *edev = pin->edev;
1213 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1213 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1214 struct hdac_hdmi_pcm *pcm; 1214 struct hdac_hdmi_pcm *pcm;
1215 int size = 0; 1215 int size = 0;
1216 int port_id = -1; 1216 int port_id = -1;
@@ -1228,7 +1228,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
1228 if (pin->mst_capable) 1228 if (pin->mst_capable)
1229 port_id = port->id; 1229 port_id = port->id;
1230 1230
1231 size = snd_hdac_acomp_get_eld(&edev->hdac, pin->nid, port_id, 1231 size = snd_hdac_acomp_get_eld(&edev->hdev, pin->nid, port_id,
1232 &port->eld.monitor_present, 1232 &port->eld.monitor_present,
1233 port->eld.eld_buffer, 1233 port->eld.eld_buffer,
1234 ELD_MAX_SIZE); 1234 ELD_MAX_SIZE);
@@ -1251,7 +1251,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
1251 1251
1252 if (!port->eld.monitor_present || !port->eld.eld_valid) { 1252 if (!port->eld.monitor_present || !port->eld.eld_valid) {
1253 1253
1254 dev_err(&edev->hdac.dev, "%s: disconnect for pin:port %d:%d\n", 1254 dev_err(&edev->hdev.dev, "%s: disconnect for pin:port %d:%d\n",
1255 __func__, pin->nid, port->id); 1255 __func__, pin->nid, port->id);
1256 1256
1257 /* 1257 /*
@@ -1305,7 +1305,7 @@ static int hdac_hdmi_add_ports(struct hdac_hdmi_priv *hdmi,
1305 1305
1306static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid) 1306static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid)
1307{ 1307{
1308 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1308 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1309 struct hdac_hdmi_pin *pin; 1309 struct hdac_hdmi_pin *pin;
1310 int ret; 1310 int ret;
1311 1311
@@ -1334,38 +1334,38 @@ static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid)
1334#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */ 1334#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */
1335#define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */ 1335#define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */
1336 1336
1337static void hdac_hdmi_skl_enable_all_pins(struct hdac_device *hdac) 1337static void hdac_hdmi_skl_enable_all_pins(struct hdac_device *hdev)
1338{ 1338{
1339 unsigned int vendor_param; 1339 unsigned int vendor_param;
1340 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdac); 1340 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1341 unsigned int vendor_nid = hdmi->drv_data->vendor_nid; 1341 unsigned int vendor_nid = hdmi->drv_data->vendor_nid;
1342 1342
1343 vendor_param = snd_hdac_codec_read(hdac, vendor_nid, 0, 1343 vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
1344 INTEL_GET_VENDOR_VERB, 0); 1344 INTEL_GET_VENDOR_VERB, 0);
1345 if (vendor_param == -1 || vendor_param & INTEL_EN_ALL_PIN_CVTS) 1345 if (vendor_param == -1 || vendor_param & INTEL_EN_ALL_PIN_CVTS)
1346 return; 1346 return;
1347 1347
1348 vendor_param |= INTEL_EN_ALL_PIN_CVTS; 1348 vendor_param |= INTEL_EN_ALL_PIN_CVTS;
1349 vendor_param = snd_hdac_codec_read(hdac, vendor_nid, 0, 1349 vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
1350 INTEL_SET_VENDOR_VERB, vendor_param); 1350 INTEL_SET_VENDOR_VERB, vendor_param);
1351 if (vendor_param == -1) 1351 if (vendor_param == -1)
1352 return; 1352 return;
1353} 1353}
1354 1354
1355static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdac) 1355static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdev)
1356{ 1356{
1357 unsigned int vendor_param; 1357 unsigned int vendor_param;
1358 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdac); 1358 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1359 unsigned int vendor_nid = hdmi->drv_data->vendor_nid; 1359 unsigned int vendor_nid = hdmi->drv_data->vendor_nid;
1360 1360
1361 vendor_param = snd_hdac_codec_read(hdac, vendor_nid, 0, 1361 vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
1362 INTEL_GET_VENDOR_VERB, 0); 1362 INTEL_GET_VENDOR_VERB, 0);
1363 if (vendor_param == -1 || vendor_param & INTEL_EN_DP12) 1363 if (vendor_param == -1 || vendor_param & INTEL_EN_DP12)
1364 return; 1364 return;
1365 1365
1366 /* enable DP1.2 mode */ 1366 /* enable DP1.2 mode */
1367 vendor_param |= INTEL_EN_DP12; 1367 vendor_param |= INTEL_EN_DP12;
1368 vendor_param = snd_hdac_codec_read(hdac, vendor_nid, 0, 1368 vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
1369 INTEL_SET_VENDOR_VERB, vendor_param); 1369 INTEL_SET_VENDOR_VERB, vendor_param);
1370 if (vendor_param == -1) 1370 if (vendor_param == -1)
1371 return; 1371 return;
@@ -1383,7 +1383,7 @@ static const struct snd_soc_dai_ops hdmi_dai_ops = {
1383 * Each converter can support a stream independently. So a dai is created 1383 * Each converter can support a stream independently. So a dai is created
1384 * based on the number of converter queried. 1384 * based on the number of converter queried.
1385 */ 1385 */
1386static int hdac_hdmi_create_dais(struct hdac_device *hdac, 1386static int hdac_hdmi_create_dais(struct hdac_device *hdev,
1387 struct snd_soc_dai_driver **dais, 1387 struct snd_soc_dai_driver **dais,
1388 struct hdac_hdmi_priv *hdmi, int num_dais) 1388 struct hdac_hdmi_priv *hdmi, int num_dais)
1389{ 1389{
@@ -1396,20 +1396,20 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac,
1396 u64 formats; 1396 u64 formats;
1397 int ret; 1397 int ret;
1398 1398
1399 hdmi_dais = devm_kzalloc(&hdac->dev, 1399 hdmi_dais = devm_kzalloc(&hdev->dev,
1400 (sizeof(*hdmi_dais) * num_dais), 1400 (sizeof(*hdmi_dais) * num_dais),
1401 GFP_KERNEL); 1401 GFP_KERNEL);
1402 if (!hdmi_dais) 1402 if (!hdmi_dais)
1403 return -ENOMEM; 1403 return -ENOMEM;
1404 1404
1405 list_for_each_entry(cvt, &hdmi->cvt_list, head) { 1405 list_for_each_entry(cvt, &hdmi->cvt_list, head) {
1406 ret = snd_hdac_query_supported_pcm(hdac, cvt->nid, 1406 ret = snd_hdac_query_supported_pcm(hdev, cvt->nid,
1407 &rates, &formats, &bps); 1407 &rates, &formats, &bps);
1408 if (ret) 1408 if (ret)
1409 return ret; 1409 return ret;
1410 1410
1411 sprintf(dai_name, "intel-hdmi-hifi%d", i+1); 1411 sprintf(dai_name, "intel-hdmi-hifi%d", i+1);
1412 hdmi_dais[i].name = devm_kstrdup(&hdac->dev, 1412 hdmi_dais[i].name = devm_kstrdup(&hdev->dev,
1413 dai_name, GFP_KERNEL); 1413 dai_name, GFP_KERNEL);
1414 1414
1415 if (!hdmi_dais[i].name) 1415 if (!hdmi_dais[i].name)
@@ -1417,7 +1417,7 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac,
1417 1417
1418 snprintf(name, sizeof(name), "hifi%d", i+1); 1418 snprintf(name, sizeof(name), "hifi%d", i+1);
1419 hdmi_dais[i].playback.stream_name = 1419 hdmi_dais[i].playback.stream_name =
1420 devm_kstrdup(&hdac->dev, name, GFP_KERNEL); 1420 devm_kstrdup(&hdev->dev, name, GFP_KERNEL);
1421 if (!hdmi_dais[i].playback.stream_name) 1421 if (!hdmi_dais[i].playback.stream_name)
1422 return -ENOMEM; 1422 return -ENOMEM;
1423 1423
@@ -1450,29 +1450,29 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
1450{ 1450{
1451 hda_nid_t nid; 1451 hda_nid_t nid;
1452 int i, num_nodes; 1452 int i, num_nodes;
1453 struct hdac_device *hdac = &edev->hdac;
1454 struct hdac_hdmi_cvt *temp_cvt, *cvt_next; 1453 struct hdac_hdmi_cvt *temp_cvt, *cvt_next;
1455 struct hdac_hdmi_pin *temp_pin, *pin_next; 1454 struct hdac_hdmi_pin *temp_pin, *pin_next;
1456 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdac); 1455 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1456 struct hdac_device *hdev = &edev->hdev;
1457 int ret; 1457 int ret;
1458 1458
1459 hdac_hdmi_skl_enable_all_pins(hdac); 1459 hdac_hdmi_skl_enable_all_pins(hdev);
1460 hdac_hdmi_skl_enable_dp12(hdac); 1460 hdac_hdmi_skl_enable_dp12(hdev);
1461 1461
1462 num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid); 1462 num_nodes = snd_hdac_get_sub_nodes(hdev, hdev->afg, &nid);
1463 if (!nid || num_nodes <= 0) { 1463 if (!nid || num_nodes <= 0) {
1464 dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n"); 1464 dev_warn(&hdev->dev, "HDMI: failed to get afg sub nodes\n");
1465 return -EINVAL; 1465 return -EINVAL;
1466 } 1466 }
1467 1467
1468 hdac->num_nodes = num_nodes; 1468 hdev->num_nodes = num_nodes;
1469 hdac->start_nid = nid; 1469 hdev->start_nid = nid;
1470 1470
1471 for (i = 0; i < hdac->num_nodes; i++, nid++) { 1471 for (i = 0; i < hdev->num_nodes; i++, nid++) {
1472 unsigned int caps; 1472 unsigned int caps;
1473 unsigned int type; 1473 unsigned int type;
1474 1474
1475 caps = get_wcaps(hdac, nid); 1475 caps = get_wcaps(hdev, nid);
1476 type = get_wcaps_type(caps); 1476 type = get_wcaps_type(caps);
1477 1477
1478 if (!(caps & AC_WCAP_DIGITAL)) 1478 if (!(caps & AC_WCAP_DIGITAL))
@@ -1494,16 +1494,16 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
1494 } 1494 }
1495 } 1495 }
1496 1496
1497 hdac->end_nid = nid; 1497 hdev->end_nid = nid;
1498 1498
1499 if (!hdmi->num_pin || !hdmi->num_cvt) { 1499 if (!hdmi->num_pin || !hdmi->num_cvt) {
1500 ret = -EIO; 1500 ret = -EIO;
1501 goto free_widgets; 1501 goto free_widgets;
1502 } 1502 }
1503 1503
1504 ret = hdac_hdmi_create_dais(hdac, dais, hdmi, hdmi->num_cvt); 1504 ret = hdac_hdmi_create_dais(hdev, dais, hdmi, hdmi->num_cvt);
1505 if (ret) { 1505 if (ret) {
1506 dev_err(&hdac->dev, "Failed to create dais with err: %d\n", 1506 dev_err(&hdev->dev, "Failed to create dais with err: %d\n",
1507 ret); 1507 ret);
1508 goto free_widgets; 1508 goto free_widgets;
1509 } 1509 }
@@ -1536,7 +1536,7 @@ free_widgets:
1536static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe) 1536static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
1537{ 1537{
1538 struct hdac_ext_device *edev = aptr; 1538 struct hdac_ext_device *edev = aptr;
1539 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1539 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1540 struct hdac_hdmi_pin *pin = NULL; 1540 struct hdac_hdmi_pin *pin = NULL;
1541 struct hdac_hdmi_port *hport = NULL; 1541 struct hdac_hdmi_port *hport = NULL;
1542 struct snd_soc_codec *codec = edev->scodec; 1542 struct snd_soc_codec *codec = edev->scodec;
@@ -1545,7 +1545,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
1545 /* Don't know how this mapping is derived */ 1545 /* Don't know how this mapping is derived */
1546 hda_nid_t pin_nid = port + 0x04; 1546 hda_nid_t pin_nid = port + 0x04;
1547 1547
1548 dev_dbg(&edev->hdac.dev, "%s: for pin:%d port=%d\n", __func__, 1548 dev_dbg(&edev->hdev.dev, "%s: for pin:%d port=%d\n", __func__,
1549 pin_nid, pipe); 1549 pin_nid, pipe);
1550 1550
1551 /* 1551 /*
@@ -1558,7 +1558,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
1558 SNDRV_CTL_POWER_D0) 1558 SNDRV_CTL_POWER_D0)
1559 return; 1559 return;
1560 1560
1561 if (atomic_read(&edev->hdac.in_pm)) 1561 if (atomic_read(&edev->hdev.in_pm))
1562 return; 1562 return;
1563 1563
1564 list_for_each_entry(pin, &hdmi->pin_list, head) { 1564 list_for_each_entry(pin, &hdmi->pin_list, head) {
@@ -1613,7 +1613,7 @@ static int create_fill_jack_kcontrols(struct snd_soc_card *card,
1613 char *name; 1613 char *name;
1614 int i = 0, j; 1614 int i = 0, j;
1615 struct snd_soc_codec *codec = edev->scodec; 1615 struct snd_soc_codec *codec = edev->scodec;
1616 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1616 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1617 1617
1618 kc = devm_kcalloc(codec->dev, hdmi->num_ports, 1618 kc = devm_kcalloc(codec->dev, hdmi->num_ports,
1619 sizeof(*kc), GFP_KERNEL); 1619 sizeof(*kc), GFP_KERNEL);
@@ -1651,7 +1651,7 @@ int hdac_hdmi_jack_port_init(struct snd_soc_codec *codec,
1651 struct snd_soc_dapm_context *dapm) 1651 struct snd_soc_dapm_context *dapm)
1652{ 1652{
1653 struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); 1653 struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
1654 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1654 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1655 struct hdac_hdmi_pin *pin; 1655 struct hdac_hdmi_pin *pin;
1656 struct snd_soc_dapm_widget *widgets; 1656 struct snd_soc_dapm_widget *widgets;
1657 struct snd_soc_dapm_route *route; 1657 struct snd_soc_dapm_route *route;
@@ -1727,7 +1727,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
1727{ 1727{
1728 struct snd_soc_codec *codec = dai->codec; 1728 struct snd_soc_codec *codec = dai->codec;
1729 struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); 1729 struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
1730 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1730 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1731 struct hdac_hdmi_pcm *pcm; 1731 struct hdac_hdmi_pcm *pcm;
1732 struct snd_pcm *snd_pcm; 1732 struct snd_pcm *snd_pcm;
1733 int err; 1733 int err;
@@ -1749,7 +1749,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
1749 if (snd_pcm) { 1749 if (snd_pcm) {
1750 err = snd_hdac_add_chmap_ctls(snd_pcm, device, &hdmi->chmap); 1750 err = snd_hdac_add_chmap_ctls(snd_pcm, device, &hdmi->chmap);
1751 if (err < 0) { 1751 if (err < 0) {
1752 dev_err(&edev->hdac.dev, 1752 dev_err(&edev->hdev.dev,
1753 "chmap control add failed with err: %d for pcm: %d\n", 1753 "chmap control add failed with err: %d for pcm: %d\n",
1754 err, device); 1754 err, device);
1755 kfree(pcm); 1755 kfree(pcm);
@@ -1790,7 +1790,7 @@ static void hdac_hdmi_present_sense_all_pins(struct hdac_ext_device *edev,
1790static int hdmi_codec_probe(struct snd_soc_codec *codec) 1790static int hdmi_codec_probe(struct snd_soc_codec *codec)
1791{ 1791{
1792 struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); 1792 struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
1793 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1793 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1794 struct snd_soc_dapm_context *dapm = 1794 struct snd_soc_dapm_context *dapm =
1795 snd_soc_component_get_dapm(&codec->component); 1795 snd_soc_component_get_dapm(&codec->component);
1796 struct hdac_ext_link *hlink = NULL; 1796 struct hdac_ext_link *hlink = NULL;
@@ -1802,9 +1802,9 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec)
1802 * hold the ref while we probe, also no need to drop the ref on 1802 * hold the ref while we probe, also no need to drop the ref on
1803 * exit, we call pm_runtime_suspend() so that will do for us 1803 * exit, we call pm_runtime_suspend() so that will do for us
1804 */ 1804 */
1805 hlink = snd_hdac_ext_bus_get_link(edev->ebus, dev_name(&edev->hdac.dev)); 1805 hlink = snd_hdac_ext_bus_get_link(edev->ebus, dev_name(&edev->hdev.dev));
1806 if (!hlink) { 1806 if (!hlink) {
1807 dev_err(&edev->hdac.dev, "hdac link not found\n"); 1807 dev_err(&edev->hdev.dev, "hdac link not found\n");
1808 return -EIO; 1808 return -EIO;
1809 } 1809 }
1810 1810
@@ -1817,7 +1817,7 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec)
1817 aops.audio_ptr = edev; 1817 aops.audio_ptr = edev;
1818 ret = snd_hdac_i915_register_notifier(&aops); 1818 ret = snd_hdac_i915_register_notifier(&aops);
1819 if (ret < 0) { 1819 if (ret < 0) {
1820 dev_err(&edev->hdac.dev, "notifier register failed: err: %d\n", 1820 dev_err(&edev->hdev.dev, "notifier register failed: err: %d\n",
1821 ret); 1821 ret);
1822 return ret; 1822 return ret;
1823 } 1823 }
@@ -1830,9 +1830,9 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec)
1830 * hdac_device core already sets the state to active and calls 1830 * hdac_device core already sets the state to active and calls
1831 * get_noresume. So enable runtime and set the device to suspend. 1831 * get_noresume. So enable runtime and set the device to suspend.
1832 */ 1832 */
1833 pm_runtime_enable(&edev->hdac.dev); 1833 pm_runtime_enable(&edev->hdev.dev);
1834 pm_runtime_put(&edev->hdac.dev); 1834 pm_runtime_put(&edev->hdev.dev);
1835 pm_runtime_suspend(&edev->hdac.dev); 1835 pm_runtime_suspend(&edev->hdev.dev);
1836 1836
1837 return 0; 1837 return 0;
1838} 1838}
@@ -1841,7 +1841,7 @@ static int hdmi_codec_remove(struct snd_soc_codec *codec)
1841{ 1841{
1842 struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); 1842 struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
1843 1843
1844 pm_runtime_disable(&edev->hdac.dev); 1844 pm_runtime_disable(&edev->hdev.dev);
1845 return 0; 1845 return 0;
1846} 1846}
1847 1847
@@ -1849,9 +1849,9 @@ static int hdmi_codec_remove(struct snd_soc_codec *codec)
1849static int hdmi_codec_prepare(struct device *dev) 1849static int hdmi_codec_prepare(struct device *dev)
1850{ 1850{
1851 struct hdac_ext_device *edev = to_hda_ext_device(dev); 1851 struct hdac_ext_device *edev = to_hda_ext_device(dev);
1852 struct hdac_device *hdac = &edev->hdac; 1852 struct hdac_device *hdev = &edev->hdev;
1853 1853
1854 pm_runtime_get_sync(&edev->hdac.dev); 1854 pm_runtime_get_sync(&edev->hdev.dev);
1855 1855
1856 /* 1856 /*
1857 * Power down afg. 1857 * Power down afg.
@@ -1860,7 +1860,7 @@ static int hdmi_codec_prepare(struct device *dev)
1860 * is received. So setting power state is ensured without using loop 1860 * is received. So setting power state is ensured without using loop
1861 * to read the state. 1861 * to read the state.
1862 */ 1862 */
1863 snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, 1863 snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
1864 AC_PWRST_D3); 1864 AC_PWRST_D3);
1865 1865
1866 return 0; 1866 return 0;
@@ -1869,15 +1869,15 @@ static int hdmi_codec_prepare(struct device *dev)
1869static void hdmi_codec_complete(struct device *dev) 1869static void hdmi_codec_complete(struct device *dev)
1870{ 1870{
1871 struct hdac_ext_device *edev = to_hda_ext_device(dev); 1871 struct hdac_ext_device *edev = to_hda_ext_device(dev);
1872 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 1872 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
1873 struct hdac_device *hdac = &edev->hdac; 1873 struct hdac_device *hdev = &edev->hdev;
1874 1874
1875 /* Power up afg */ 1875 /* Power up afg */
1876 snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, 1876 snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
1877 AC_PWRST_D0); 1877 AC_PWRST_D0);
1878 1878
1879 hdac_hdmi_skl_enable_all_pins(&edev->hdac); 1879 hdac_hdmi_skl_enable_all_pins(&edev->hdev);
1880 hdac_hdmi_skl_enable_dp12(&edev->hdac); 1880 hdac_hdmi_skl_enable_dp12(&edev->hdev);
1881 1881
1882 /* 1882 /*
1883 * As the ELD notify callback request is not entertained while the 1883 * As the ELD notify callback request is not entertained while the
@@ -1887,7 +1887,7 @@ static void hdmi_codec_complete(struct device *dev)
1887 */ 1887 */
1888 hdac_hdmi_present_sense_all_pins(edev, hdmi, false); 1888 hdac_hdmi_present_sense_all_pins(edev, hdmi, false);
1889 1889
1890 pm_runtime_put_sync(&edev->hdac.dev); 1890 pm_runtime_put_sync(&edev->hdev.dev);
1891} 1891}
1892#else 1892#else
1893#define hdmi_codec_prepare NULL 1893#define hdmi_codec_prepare NULL
@@ -1900,20 +1900,20 @@ static const struct snd_soc_codec_driver hdmi_hda_codec = {
1900 .idle_bias_off = true, 1900 .idle_bias_off = true,
1901}; 1901};
1902 1902
1903static void hdac_hdmi_get_chmap(struct hdac_device *hdac, int pcm_idx, 1903static void hdac_hdmi_get_chmap(struct hdac_device *hdev, int pcm_idx,
1904 unsigned char *chmap) 1904 unsigned char *chmap)
1905{ 1905{
1906 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdac); 1906 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1907 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); 1907 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
1908 1908
1909 memcpy(chmap, pcm->chmap, ARRAY_SIZE(pcm->chmap)); 1909 memcpy(chmap, pcm->chmap, ARRAY_SIZE(pcm->chmap));
1910} 1910}
1911 1911
1912static void hdac_hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx, 1912static void hdac_hdmi_set_chmap(struct hdac_device *hdev, int pcm_idx,
1913 unsigned char *chmap, int prepared) 1913 unsigned char *chmap, int prepared)
1914{ 1914{
1915 struct hdac_ext_device *edev = to_ehdac_device(hdac); 1915 struct hdac_ext_device *edev = to_ehdac_device(hdev);
1916 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdac); 1916 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1917 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); 1917 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
1918 struct hdac_hdmi_port *port; 1918 struct hdac_hdmi_port *port;
1919 1919
@@ -1932,9 +1932,9 @@ static void hdac_hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx,
1932 mutex_unlock(&pcm->lock); 1932 mutex_unlock(&pcm->lock);
1933} 1933}
1934 1934
1935static bool is_hdac_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx) 1935static bool is_hdac_hdmi_pcm_attached(struct hdac_device *hdev, int pcm_idx)
1936{ 1936{
1937 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdac); 1937 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1938 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); 1938 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
1939 1939
1940 if (!pcm) 1940 if (!pcm)
@@ -1946,9 +1946,9 @@ static bool is_hdac_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx)
1946 return true; 1946 return true;
1947} 1947}
1948 1948
1949static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx) 1949static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdev, int pcm_idx)
1950{ 1950{
1951 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdac); 1951 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1952 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); 1952 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
1953 struct hdac_hdmi_port *port; 1953 struct hdac_hdmi_port *port;
1954 1954
@@ -1979,30 +1979,30 @@ static struct hdac_hdmi_drv_data intel_drv_data = {
1979 1979
1980static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev) 1980static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
1981{ 1981{
1982 struct hdac_device *codec = &edev->hdac; 1982 struct hdac_device *hdev = &edev->hdev;
1983 struct hdac_hdmi_priv *hdmi_priv; 1983 struct hdac_hdmi_priv *hdmi_priv;
1984 struct snd_soc_dai_driver *hdmi_dais = NULL; 1984 struct snd_soc_dai_driver *hdmi_dais = NULL;
1985 struct hdac_ext_link *hlink = NULL; 1985 struct hdac_ext_link *hlink = NULL;
1986 int num_dais = 0; 1986 int num_dais = 0;
1987 int ret = 0; 1987 int ret = 0;
1988 struct hdac_driver *hdrv = drv_to_hdac_driver(codec->dev.driver); 1988 struct hdac_driver *hdrv = drv_to_hdac_driver(hdev->dev.driver);
1989 const struct hda_device_id *hdac_id = hdac_get_device_id(codec, hdrv); 1989 const struct hda_device_id *hdac_id = hdac_get_device_id(hdev, hdrv);
1990 1990
1991 /* hold the ref while we probe */ 1991 /* hold the ref while we probe */
1992 hlink = snd_hdac_ext_bus_get_link(edev->ebus, dev_name(&edev->hdac.dev)); 1992 hlink = snd_hdac_ext_bus_get_link(edev->ebus, dev_name(&edev->hdev.dev));
1993 if (!hlink) { 1993 if (!hlink) {
1994 dev_err(&edev->hdac.dev, "hdac link not found\n"); 1994 dev_err(&edev->hdev.dev, "hdac link not found\n");
1995 return -EIO; 1995 return -EIO;
1996 } 1996 }
1997 1997
1998 snd_hdac_ext_bus_link_get(edev->ebus, hlink); 1998 snd_hdac_ext_bus_link_get(edev->ebus, hlink);
1999 1999
2000 hdmi_priv = devm_kzalloc(&codec->dev, sizeof(*hdmi_priv), GFP_KERNEL); 2000 hdmi_priv = devm_kzalloc(&hdev->dev, sizeof(*hdmi_priv), GFP_KERNEL);
2001 if (hdmi_priv == NULL) 2001 if (hdmi_priv == NULL)
2002 return -ENOMEM; 2002 return -ENOMEM;
2003 2003
2004 edev->private_data = hdmi_priv; 2004 edev->private_data = hdmi_priv;
2005 snd_hdac_register_chmap_ops(codec, &hdmi_priv->chmap); 2005 snd_hdac_register_chmap_ops(hdev, &hdmi_priv->chmap);
2006 hdmi_priv->chmap.ops.get_chmap = hdac_hdmi_get_chmap; 2006 hdmi_priv->chmap.ops.get_chmap = hdac_hdmi_get_chmap;
2007 hdmi_priv->chmap.ops.set_chmap = hdac_hdmi_set_chmap; 2007 hdmi_priv->chmap.ops.set_chmap = hdac_hdmi_set_chmap;
2008 hdmi_priv->chmap.ops.is_pcm_attached = is_hdac_hdmi_pcm_attached; 2008 hdmi_priv->chmap.ops.is_pcm_attached = is_hdac_hdmi_pcm_attached;
@@ -2017,7 +2017,7 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
2017 else 2017 else
2018 hdmi_priv->drv_data = &intel_drv_data; 2018 hdmi_priv->drv_data = &intel_drv_data;
2019 2019
2020 dev_set_drvdata(&codec->dev, edev); 2020 dev_set_drvdata(&hdev->dev, edev);
2021 2021
2022 INIT_LIST_HEAD(&hdmi_priv->pin_list); 2022 INIT_LIST_HEAD(&hdmi_priv->pin_list);
2023 INIT_LIST_HEAD(&hdmi_priv->cvt_list); 2023 INIT_LIST_HEAD(&hdmi_priv->cvt_list);
@@ -2028,9 +2028,9 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
2028 * Turned off in the runtime_suspend during the first explicit 2028 * Turned off in the runtime_suspend during the first explicit
2029 * pm_runtime_suspend call. 2029 * pm_runtime_suspend call.
2030 */ 2030 */
2031 ret = snd_hdac_display_power(edev->hdac.bus, true); 2031 ret = snd_hdac_display_power(edev->hdev.bus, true);
2032 if (ret < 0) { 2032 if (ret < 0) {
2033 dev_err(&edev->hdac.dev, 2033 dev_err(&edev->hdev.dev,
2034 "Cannot turn on display power on i915 err: %d\n", 2034 "Cannot turn on display power on i915 err: %d\n",
2035 ret); 2035 ret);
2036 return ret; 2036 return ret;
@@ -2038,13 +2038,13 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
2038 2038
2039 ret = hdac_hdmi_parse_and_map_nid(edev, &hdmi_dais, &num_dais); 2039 ret = hdac_hdmi_parse_and_map_nid(edev, &hdmi_dais, &num_dais);
2040 if (ret < 0) { 2040 if (ret < 0) {
2041 dev_err(&codec->dev, 2041 dev_err(&hdev->dev,
2042 "Failed in parse and map nid with err: %d\n", ret); 2042 "Failed in parse and map nid with err: %d\n", ret);
2043 return ret; 2043 return ret;
2044 } 2044 }
2045 2045
2046 /* ASoC specific initialization */ 2046 /* ASoC specific initialization */
2047 ret = snd_soc_register_codec(&codec->dev, &hdmi_hda_codec, 2047 ret = snd_soc_register_codec(&hdev->dev, &hdmi_hda_codec,
2048 hdmi_dais, num_dais); 2048 hdmi_dais, num_dais);
2049 2049
2050 snd_hdac_ext_bus_link_put(edev->ebus, hlink); 2050 snd_hdac_ext_bus_link_put(edev->ebus, hlink);
@@ -2054,14 +2054,14 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
2054 2054
2055static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev) 2055static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
2056{ 2056{
2057 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdac); 2057 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
2058 struct hdac_hdmi_pin *pin, *pin_next; 2058 struct hdac_hdmi_pin *pin, *pin_next;
2059 struct hdac_hdmi_cvt *cvt, *cvt_next; 2059 struct hdac_hdmi_cvt *cvt, *cvt_next;
2060 struct hdac_hdmi_pcm *pcm, *pcm_next; 2060 struct hdac_hdmi_pcm *pcm, *pcm_next;
2061 struct hdac_hdmi_port *port, *port_next; 2061 struct hdac_hdmi_port *port, *port_next;
2062 int i; 2062 int i;
2063 2063
2064 snd_soc_unregister_codec(&edev->hdac.dev); 2064 snd_soc_unregister_codec(&edev->hdev.dev);
2065 2065
2066 list_for_each_entry_safe(pcm, pcm_next, &hdmi->pcm_list, head) { 2066 list_for_each_entry_safe(pcm, pcm_next, &hdmi->pcm_list, head) {
2067 pcm->cvt = NULL; 2067 pcm->cvt = NULL;
@@ -2097,8 +2097,8 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
2097static int hdac_hdmi_runtime_suspend(struct device *dev) 2097static int hdac_hdmi_runtime_suspend(struct device *dev)
2098{ 2098{
2099 struct hdac_ext_device *edev = to_hda_ext_device(dev); 2099 struct hdac_ext_device *edev = to_hda_ext_device(dev);
2100 struct hdac_device *hdac = &edev->hdac; 2100 struct hdac_device *hdev = &edev->hdev;
2101 struct hdac_bus *bus = hdac->bus; 2101 struct hdac_bus *bus = hdev->bus;
2102 struct hdac_ext_bus *ebus = hbus_to_ebus(bus); 2102 struct hdac_ext_bus *ebus = hbus_to_ebus(bus);
2103 struct hdac_ext_link *hlink = NULL; 2103 struct hdac_ext_link *hlink = NULL;
2104 int err; 2104 int err;
@@ -2116,7 +2116,7 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
2116 * is received. So setting power state is ensured without using loop 2116 * is received. So setting power state is ensured without using loop
2117 * to read the state. 2117 * to read the state.
2118 */ 2118 */
2119 snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, 2119 snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
2120 AC_PWRST_D3); 2120 AC_PWRST_D3);
2121 err = snd_hdac_display_power(bus, false); 2121 err = snd_hdac_display_power(bus, false);
2122 if (err < 0) { 2122 if (err < 0) {
@@ -2138,8 +2138,8 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
2138static int hdac_hdmi_runtime_resume(struct device *dev) 2138static int hdac_hdmi_runtime_resume(struct device *dev)
2139{ 2139{
2140 struct hdac_ext_device *edev = to_hda_ext_device(dev); 2140 struct hdac_ext_device *edev = to_hda_ext_device(dev);
2141 struct hdac_device *hdac = &edev->hdac; 2141 struct hdac_device *hdev = &edev->hdev;
2142 struct hdac_bus *bus = hdac->bus; 2142 struct hdac_bus *bus = hdev->bus;
2143 struct hdac_ext_bus *ebus = hbus_to_ebus(bus); 2143 struct hdac_ext_bus *ebus = hbus_to_ebus(bus);
2144 struct hdac_ext_link *hlink = NULL; 2144 struct hdac_ext_link *hlink = NULL;
2145 int err; 2145 int err;
@@ -2164,11 +2164,11 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
2164 return err; 2164 return err;
2165 } 2165 }
2166 2166
2167 hdac_hdmi_skl_enable_all_pins(&edev->hdac); 2167 hdac_hdmi_skl_enable_all_pins(&edev->hdev);
2168 hdac_hdmi_skl_enable_dp12(&edev->hdac); 2168 hdac_hdmi_skl_enable_dp12(&edev->hdev);
2169 2169
2170 /* Power up afg */ 2170 /* Power up afg */
2171 snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, 2171 snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
2172 AC_PWRST_D0); 2172 AC_PWRST_D0);
2173 2173
2174 return 0; 2174 return 0;