Skip to content

Commit 1c41939

Browse files
mkumardtiwai
authored andcommitted
ALSA: hda/tegra: Add Tegra264 support
Update HDA driver to support Tegra264 differences from legacy HDA, which includes: clocks/resets, always power on, and hardware-managed FPCI/IPFS initialization. The driver retrieves this chip-specific information from soc_data. Signed-off-by: Mohan Kumar D <[email protected]> Signed-off-by: Sheetal <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 3bc2f3b commit 1c41939

File tree

2 files changed

+46
-6
lines changed

2 files changed

+46
-6
lines changed

sound/pci/hda/hda_tegra.c

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@
7272
struct 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

7781
struct 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,
450465
static 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

455474
static 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

460483
static 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

465501
static 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
};
471508
MODULE_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)

sound/pci/hda/patch_hdmi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4551,6 +4551,7 @@ HDA_CODEC_ENTRY(0x10de002e, "Tegra186 HDMI/DP1", patch_tegra_hdmi),
45514551
HDA_CODEC_ENTRY(0x10de002f, "Tegra194 HDMI/DP2", patch_tegra_hdmi),
45524552
HDA_CODEC_ENTRY(0x10de0030, "Tegra194 HDMI/DP3", patch_tegra_hdmi),
45534553
HDA_CODEC_ENTRY(0x10de0031, "Tegra234 HDMI/DP", patch_tegra234_hdmi),
4554+
HDA_CODEC_ENTRY(0x10de0034, "Tegra264 HDMI/DP", patch_tegra234_hdmi),
45544555
HDA_CODEC_ENTRY(0x10de0040, "GPU 40 HDMI/DP", patch_nvhdmi),
45554556
HDA_CODEC_ENTRY(0x10de0041, "GPU 41 HDMI/DP", patch_nvhdmi),
45564557
HDA_CODEC_ENTRY(0x10de0042, "GPU 42 HDMI/DP", patch_nvhdmi),

0 commit comments

Comments
 (0)