Skip to content

Commit beb314a

Browse files
mkumardgregkh
authored andcommitted
ALSA: hda/tegra: Add Tegra264 support
commit 1c41939 upstream. 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] Stable-dep-of: e0a911a ("ALSA: hda: Add missing NVIDIA HDA codec IDs") Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c7f864d commit beb314a

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 __maybe_unused 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) &
@@ -252,7 +258,8 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev)
252258
bus->remap_addr = hda->regs + HDA_BAR0;
253259
bus->addr = res->start + HDA_BAR0;
254260

255-
hda_tegra_init(hda);
261+
if (hda->soc->requires_init)
262+
hda_tegra_init(hda);
256263

257264
return 0;
258265
}
@@ -325,7 +332,7 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
325332
* starts with offset 0 which is wrong as HW register for output stream
326333
* offset starts with 4.
327334
*/
328-
if (of_device_is_compatible(np, "nvidia,tegra234-hda"))
335+
if (!hda->soc->input_stream)
329336
chip->capture_streams = 4;
330337

331338
chip->playback_streams = (gcap >> 12) & 0x0f;
@@ -421,7 +428,6 @@ static int hda_tegra_create(struct snd_card *card,
421428
chip->driver_caps = driver_caps;
422429
chip->driver_type = driver_caps & 0xff;
423430
chip->dev_index = 0;
424-
chip->jackpoll_interval = msecs_to_jiffies(5000);
425431
INIT_LIST_HEAD(&chip->pcm_list);
426432

427433
chip->codec_probe_mask = -1;
@@ -438,7 +444,16 @@ static int hda_tegra_create(struct snd_card *card,
438444
chip->bus.core.sync_write = 0;
439445
chip->bus.core.needs_damn_long_delay = 1;
440446
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+
}
442457

443458
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
444459
if (err < 0) {
@@ -452,22 +467,44 @@ static int hda_tegra_create(struct snd_card *card,
452467
static const struct hda_tegra_soc tegra30_data = {
453468
.has_hda2codec_2x_reset = true,
454469
.has_hda2hdmi = true,
470+
.has_hda2codec_2x = true,
471+
.input_stream = true,
472+
.always_on = false,
473+
.requires_init = true,
455474
};
456475

457476
static const struct hda_tegra_soc tegra194_data = {
458477
.has_hda2codec_2x_reset = false,
459478
.has_hda2hdmi = true,
479+
.has_hda2codec_2x = true,
480+
.input_stream = true,
481+
.always_on = false,
482+
.requires_init = true,
460483
};
461484

462485
static const struct hda_tegra_soc tegra234_data = {
463486
.has_hda2codec_2x_reset = true,
464487
.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,
465501
};
466502

467503
static const struct of_device_id hda_tegra_match[] = {
468504
{ .compatible = "nvidia,tegra30-hda", .data = &tegra30_data },
469505
{ .compatible = "nvidia,tegra194-hda", .data = &tegra194_data },
470506
{ .compatible = "nvidia,tegra234-hda", .data = &tegra234_data },
507+
{ .compatible = "nvidia,tegra264-hda", .data = &tegra264_data },
471508
{},
472509
};
473510
MODULE_DEVICE_TABLE(of, hda_tegra_match);
@@ -522,7 +559,9 @@ static int hda_tegra_probe(struct platform_device *pdev)
522559
hda->clocks[hda->nclocks++].id = "hda";
523560
if (hda->soc->has_hda2hdmi)
524561
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";
526565

527566
err = devm_clk_bulk_get(&pdev->dev, hda->nclocks, hda->clocks);
528567
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)