72
72
struct hda_tegra_soc {
73
73
bool has_hda2codec_2x_reset ;
74
74
bool has_hda2hdmi ;
75
+ bool has_hda2codec_2x ;
76
+ bool input_stream ;
77
+ bool always_on ;
78
+ bool requires_init ;
75
79
};
76
80
77
81
struct hda_tegra {
@@ -187,7 +191,9 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev)
187
191
if (rc != 0 )
188
192
return rc ;
189
193
if (chip -> running ) {
190
- hda_tegra_init (hda );
194
+ if (hda -> soc -> requires_init )
195
+ hda_tegra_init (hda );
196
+
191
197
azx_init_chip (chip , 1 );
192
198
/* disable controller wake up event*/
193
199
azx_writew (chip , WAKEEN , azx_readw (chip , WAKEEN ) &
@@ -252,7 +258,8 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev)
252
258
bus -> remap_addr = hda -> regs + HDA_BAR0 ;
253
259
bus -> addr = res -> start + HDA_BAR0 ;
254
260
255
- hda_tegra_init (hda );
261
+ if (hda -> soc -> requires_init )
262
+ hda_tegra_init (hda );
256
263
257
264
return 0 ;
258
265
}
@@ -325,7 +332,7 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
325
332
* starts with offset 0 which is wrong as HW register for output stream
326
333
* offset starts with 4.
327
334
*/
328
- if (of_device_is_compatible ( np , "nvidia,tegra234- hda" ) )
335
+ if (! hda -> soc -> input_stream )
329
336
chip -> capture_streams = 4 ;
330
337
331
338
chip -> playback_streams = (gcap >> 12 ) & 0x0f ;
@@ -421,7 +428,6 @@ static int hda_tegra_create(struct snd_card *card,
421
428
chip -> driver_caps = driver_caps ;
422
429
chip -> driver_type = driver_caps & 0xff ;
423
430
chip -> dev_index = 0 ;
424
- chip -> jackpoll_interval = msecs_to_jiffies (5000 );
425
431
INIT_LIST_HEAD (& chip -> pcm_list );
426
432
427
433
chip -> codec_probe_mask = -1 ;
@@ -438,7 +444,16 @@ static int hda_tegra_create(struct snd_card *card,
438
444
chip -> bus .core .sync_write = 0 ;
439
445
chip -> bus .core .needs_damn_long_delay = 1 ;
440
446
chip -> bus .core .aligned_mmio = 1 ;
441
- chip -> bus .jackpoll_in_suspend = 1 ;
447
+
448
+ /*
449
+ * HDA power domain and clocks are always on for Tegra264 and
450
+ * the jack detection logic would work always, so no need of
451
+ * jack polling mechanism running.
452
+ */
453
+ if (!hda -> soc -> always_on ) {
454
+ chip -> jackpoll_interval = msecs_to_jiffies (5000 );
455
+ chip -> bus .jackpoll_in_suspend = 1 ;
456
+ }
442
457
443
458
err = snd_device_new (card , SNDRV_DEV_LOWLEVEL , chip , & ops );
444
459
if (err < 0 ) {
@@ -452,22 +467,44 @@ static int hda_tegra_create(struct snd_card *card,
452
467
static const struct hda_tegra_soc tegra30_data = {
453
468
.has_hda2codec_2x_reset = true,
454
469
.has_hda2hdmi = true,
470
+ .has_hda2codec_2x = true,
471
+ .input_stream = true,
472
+ .always_on = false,
473
+ .requires_init = true,
455
474
};
456
475
457
476
static const struct hda_tegra_soc tegra194_data = {
458
477
.has_hda2codec_2x_reset = false,
459
478
.has_hda2hdmi = true,
479
+ .has_hda2codec_2x = true,
480
+ .input_stream = true,
481
+ .always_on = false,
482
+ .requires_init = true,
460
483
};
461
484
462
485
static const struct hda_tegra_soc tegra234_data = {
463
486
.has_hda2codec_2x_reset = true,
464
487
.has_hda2hdmi = false,
488
+ .has_hda2codec_2x = true,
489
+ .input_stream = false,
490
+ .always_on = false,
491
+ .requires_init = true,
492
+ };
493
+
494
+ static const struct hda_tegra_soc tegra264_data = {
495
+ .has_hda2codec_2x_reset = true,
496
+ .has_hda2hdmi = false,
497
+ .has_hda2codec_2x = false,
498
+ .input_stream = false,
499
+ .always_on = true,
500
+ .requires_init = false,
465
501
};
466
502
467
503
static const struct of_device_id hda_tegra_match [] = {
468
504
{ .compatible = "nvidia,tegra30-hda" , .data = & tegra30_data },
469
505
{ .compatible = "nvidia,tegra194-hda" , .data = & tegra194_data },
470
506
{ .compatible = "nvidia,tegra234-hda" , .data = & tegra234_data },
507
+ { .compatible = "nvidia,tegra264-hda" , .data = & tegra264_data },
471
508
{},
472
509
};
473
510
MODULE_DEVICE_TABLE (of , hda_tegra_match );
@@ -522,7 +559,9 @@ static int hda_tegra_probe(struct platform_device *pdev)
522
559
hda -> clocks [hda -> nclocks ++ ].id = "hda" ;
523
560
if (hda -> soc -> has_hda2hdmi )
524
561
hda -> clocks [hda -> nclocks ++ ].id = "hda2hdmi" ;
525
- hda -> clocks [hda -> nclocks ++ ].id = "hda2codec_2x" ;
562
+
563
+ if (hda -> soc -> has_hda2codec_2x )
564
+ hda -> clocks [hda -> nclocks ++ ].id = "hda2codec_2x" ;
526
565
527
566
err = devm_clk_bulk_get (& pdev -> dev , hda -> nclocks , hda -> clocks );
528
567
if (err < 0 )
0 commit comments