7272struct hda_tegra_soc {
7373 bool has_hda2codec_2x_reset ;
7474 bool has_hda2hdmi ;
75+ bool has_hda2codec_2x ;
76+ bool input_stream ;
77+ bool always_on ;
78+ bool requires_init ;
7579};
7680
7781struct hda_tegra {
@@ -187,7 +191,9 @@ static int hda_tegra_runtime_resume(struct device *dev)
187191 if (rc != 0 )
188192 return rc ;
189193 if (chip -> running ) {
190- hda_tegra_init (hda );
194+ if (hda -> soc -> requires_init )
195+ hda_tegra_init (hda );
196+
191197 azx_init_chip (chip , 1 );
192198 /* disable controller wake up event*/
193199 azx_writew (chip , WAKEEN , azx_readw (chip , WAKEEN ) &
@@ -250,7 +256,8 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev)
250256 bus -> remap_addr = hda -> regs + HDA_BAR0 ;
251257 bus -> addr = res -> start + HDA_BAR0 ;
252258
253- hda_tegra_init (hda );
259+ if (hda -> soc -> requires_init )
260+ hda_tegra_init (hda );
254261
255262 return 0 ;
256263}
@@ -323,7 +330,7 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
323330 * starts with offset 0 which is wrong as HW register for output stream
324331 * offset starts with 4.
325332 */
326- if (of_device_is_compatible ( np , "nvidia,tegra234- hda" ) )
333+ if (! hda -> soc -> input_stream )
327334 chip -> capture_streams = 4 ;
328335
329336 chip -> playback_streams = (gcap >> 12 ) & 0x0f ;
@@ -419,7 +426,6 @@ static int hda_tegra_create(struct snd_card *card,
419426 chip -> driver_caps = driver_caps ;
420427 chip -> driver_type = driver_caps & 0xff ;
421428 chip -> dev_index = 0 ;
422- chip -> jackpoll_interval = msecs_to_jiffies (5000 );
423429 INIT_LIST_HEAD (& chip -> pcm_list );
424430
425431 chip -> codec_probe_mask = -1 ;
@@ -436,7 +442,16 @@ static int hda_tegra_create(struct snd_card *card,
436442 chip -> bus .core .sync_write = 0 ;
437443 chip -> bus .core .needs_damn_long_delay = 1 ;
438444 chip -> bus .core .aligned_mmio = 1 ;
439- chip -> bus .jackpoll_in_suspend = 1 ;
445+
446+ /*
447+ * HDA power domain and clocks are always on for Tegra264 and
448+ * the jack detection logic would work always, so no need of
449+ * jack polling mechanism running.
450+ */
451+ if (!hda -> soc -> always_on ) {
452+ chip -> jackpoll_interval = msecs_to_jiffies (5000 );
453+ chip -> bus .jackpoll_in_suspend = 1 ;
454+ }
440455
441456 err = snd_device_new (card , SNDRV_DEV_LOWLEVEL , chip , & ops );
442457 if (err < 0 ) {
@@ -450,22 +465,44 @@ static int hda_tegra_create(struct snd_card *card,
450465static const struct hda_tegra_soc tegra30_data = {
451466 .has_hda2codec_2x_reset = true,
452467 .has_hda2hdmi = true,
468+ .has_hda2codec_2x = true,
469+ .input_stream = true,
470+ .always_on = false,
471+ .requires_init = true,
453472};
454473
455474static const struct hda_tegra_soc tegra194_data = {
456475 .has_hda2codec_2x_reset = false,
457476 .has_hda2hdmi = true,
477+ .has_hda2codec_2x = true,
478+ .input_stream = true,
479+ .always_on = false,
480+ .requires_init = true,
458481};
459482
460483static const struct hda_tegra_soc tegra234_data = {
461484 .has_hda2codec_2x_reset = true,
462485 .has_hda2hdmi = false,
486+ .has_hda2codec_2x = true,
487+ .input_stream = false,
488+ .always_on = false,
489+ .requires_init = true,
490+ };
491+
492+ static const struct hda_tegra_soc tegra264_data = {
493+ .has_hda2codec_2x_reset = true,
494+ .has_hda2hdmi = false,
495+ .has_hda2codec_2x = false,
496+ .input_stream = false,
497+ .always_on = true,
498+ .requires_init = false,
463499};
464500
465501static const struct of_device_id hda_tegra_match [] = {
466502 { .compatible = "nvidia,tegra30-hda" , .data = & tegra30_data },
467503 { .compatible = "nvidia,tegra194-hda" , .data = & tegra194_data },
468504 { .compatible = "nvidia,tegra234-hda" , .data = & tegra234_data },
505+ { .compatible = "nvidia,tegra264-hda" , .data = & tegra264_data },
469506 {},
470507};
471508MODULE_DEVICE_TABLE (of , hda_tegra_match );
@@ -520,7 +557,9 @@ static int hda_tegra_probe(struct platform_device *pdev)
520557 hda -> clocks [hda -> nclocks ++ ].id = "hda" ;
521558 if (hda -> soc -> has_hda2hdmi )
522559 hda -> clocks [hda -> nclocks ++ ].id = "hda2hdmi" ;
523- hda -> clocks [hda -> nclocks ++ ].id = "hda2codec_2x" ;
560+
561+ if (hda -> soc -> has_hda2codec_2x )
562+ hda -> clocks [hda -> nclocks ++ ].id = "hda2codec_2x" ;
524563
525564 err = devm_clk_bulk_get (& pdev -> dev , hda -> nclocks , hda -> clocks );
526565 if (err < 0 )
0 commit comments