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 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 ) &
@@ -250,7 +256,8 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev)
250
256
bus -> remap_addr = hda -> regs + HDA_BAR0 ;
251
257
bus -> addr = res -> start + HDA_BAR0 ;
252
258
253
- hda_tegra_init (hda );
259
+ if (hda -> soc -> requires_init )
260
+ hda_tegra_init (hda );
254
261
255
262
return 0 ;
256
263
}
@@ -323,7 +330,7 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
323
330
* starts with offset 0 which is wrong as HW register for output stream
324
331
* offset starts with 4.
325
332
*/
326
- if (of_device_is_compatible ( np , "nvidia,tegra234- hda" ) )
333
+ if (! hda -> soc -> input_stream )
327
334
chip -> capture_streams = 4 ;
328
335
329
336
chip -> playback_streams = (gcap >> 12 ) & 0x0f ;
@@ -419,7 +426,6 @@ static int hda_tegra_create(struct snd_card *card,
419
426
chip -> driver_caps = driver_caps ;
420
427
chip -> driver_type = driver_caps & 0xff ;
421
428
chip -> dev_index = 0 ;
422
- chip -> jackpoll_interval = msecs_to_jiffies (5000 );
423
429
INIT_LIST_HEAD (& chip -> pcm_list );
424
430
425
431
chip -> codec_probe_mask = -1 ;
@@ -436,7 +442,16 @@ static int hda_tegra_create(struct snd_card *card,
436
442
chip -> bus .core .sync_write = 0 ;
437
443
chip -> bus .core .needs_damn_long_delay = 1 ;
438
444
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
+ }
440
455
441
456
err = snd_device_new (card , SNDRV_DEV_LOWLEVEL , chip , & ops );
442
457
if (err < 0 ) {
@@ -450,22 +465,44 @@ static int hda_tegra_create(struct snd_card *card,
450
465
static const struct hda_tegra_soc tegra30_data = {
451
466
.has_hda2codec_2x_reset = true,
452
467
.has_hda2hdmi = true,
468
+ .has_hda2codec_2x = true,
469
+ .input_stream = true,
470
+ .always_on = false,
471
+ .requires_init = true,
453
472
};
454
473
455
474
static const struct hda_tegra_soc tegra194_data = {
456
475
.has_hda2codec_2x_reset = false,
457
476
.has_hda2hdmi = true,
477
+ .has_hda2codec_2x = true,
478
+ .input_stream = true,
479
+ .always_on = false,
480
+ .requires_init = true,
458
481
};
459
482
460
483
static const struct hda_tegra_soc tegra234_data = {
461
484
.has_hda2codec_2x_reset = true,
462
485
.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,
463
499
};
464
500
465
501
static const struct of_device_id hda_tegra_match [] = {
466
502
{ .compatible = "nvidia,tegra30-hda" , .data = & tegra30_data },
467
503
{ .compatible = "nvidia,tegra194-hda" , .data = & tegra194_data },
468
504
{ .compatible = "nvidia,tegra234-hda" , .data = & tegra234_data },
505
+ { .compatible = "nvidia,tegra264-hda" , .data = & tegra264_data },
469
506
{},
470
507
};
471
508
MODULE_DEVICE_TABLE (of , hda_tegra_match );
@@ -520,7 +557,9 @@ static int hda_tegra_probe(struct platform_device *pdev)
520
557
hda -> clocks [hda -> nclocks ++ ].id = "hda" ;
521
558
if (hda -> soc -> has_hda2hdmi )
522
559
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" ;
524
563
525
564
err = devm_clk_bulk_get (& pdev -> dev , hda -> nclocks , hda -> clocks );
526
565
if (err < 0 )
0 commit comments