Lines Matching +full:tegra194 +full:- +full:display
1 // SPDX-License-Identifier: GPL-2.0-only
11 #include <linux/dma-mapping.h>
66 * Tegra194 does not reflect correct number of SDO lines. Below macro
92 "Automatic power-saving timeout (in seconds, 0 = disable).");
104 v = readl(hda->regs + HDA_IPFS_CONFIG); in hda_tegra_init()
106 writel(v, hda->regs + HDA_IPFS_CONFIG); in hda_tegra_init()
109 v = readl(hda->regs + HDA_CFG_CMD); in hda_tegra_init()
113 writel(v, hda->regs + HDA_CFG_CMD); in hda_tegra_init()
115 writel(HDA_BAR0_INIT_PROGRAM, hda->regs + HDA_CFG_BAR0); in hda_tegra_init()
116 writel(HDA_BAR0_FINAL_PROGRAM, hda->regs + HDA_CFG_BAR0); in hda_tegra_init()
117 writel(HDA_FPCI_BAR0_START, hda->regs + HDA_IPFS_FPCI_BAR0); in hda_tegra_init()
119 v = readl(hda->regs + HDA_IPFS_INTR_MASK); in hda_tegra_init()
121 writel(v, hda->regs + HDA_IPFS_INTR_MASK); in hda_tegra_init()
156 struct azx *chip = card->private_data; in hda_tegra_runtime_suspend()
159 if (chip && chip->running) { in hda_tegra_runtime_suspend()
167 clk_bulk_disable_unprepare(hda->nclocks, hda->clocks); in hda_tegra_runtime_suspend()
175 struct azx *chip = card->private_data; in hda_tegra_runtime_resume()
179 if (!chip->running) { in hda_tegra_runtime_resume()
180 rc = reset_control_bulk_assert(hda->nresets, hda->resets); in hda_tegra_runtime_resume()
185 rc = clk_bulk_prepare_enable(hda->nclocks, hda->clocks); in hda_tegra_runtime_resume()
188 if (chip->running) { in hda_tegra_runtime_resume()
197 rc = reset_control_bulk_deassert(hda->nresets, hda->resets); in hda_tegra_runtime_resume()
214 struct azx *chip = device->device_data; in hda_tegra_dev_disconnect()
216 chip->bus.shutdown = 1; in hda_tegra_dev_disconnect()
225 struct azx *chip = device->device_data; in hda_tegra_dev_free()
228 cancel_work_sync(&hda->probe_work); in hda_tegra_dev_free()
229 if (azx_bus(chip)->chip_init) { in hda_tegra_dev_free()
247 hda->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in hda_tegra_init_chip()
248 if (IS_ERR(hda->regs)) in hda_tegra_init_chip()
249 return PTR_ERR(hda->regs); in hda_tegra_init_chip()
251 bus->remap_addr = hda->regs + HDA_BAR0; in hda_tegra_init_chip()
252 bus->addr = res->start + HDA_BAR0; in hda_tegra_init_chip()
263 struct snd_card *card = chip->card; in hda_tegra_first_init()
267 const char *sname, *drv_name = "tegra-hda"; in hda_tegra_first_init()
268 struct device_node *np = pdev->dev.of_node; in hda_tegra_first_init()
277 err = devm_request_irq(chip->card->dev, irq_id, azx_interrupt, in hda_tegra_first_init()
280 dev_err(chip->card->dev, in hda_tegra_first_init()
285 bus->irq = irq_id; in hda_tegra_first_init()
286 bus->dma_stop_delay = 100; in hda_tegra_first_init()
287 card->sync_irq = bus->irq; in hda_tegra_first_init()
290 * Tegra194 has 4 SDO lines and the STRIPE can be used to in hda_tegra_first_init()
298 if (of_device_is_compatible(np, "nvidia,tegra194-hda")) { in hda_tegra_first_init()
301 dev_info(card->dev, "Override SDO lines to %u\n", in hda_tegra_first_init()
304 val = readl(hda->regs + FPCI_DBG_CFG_2) & ~FPCI_GCAP_NSDO_MASK; in hda_tegra_first_init()
306 writel(val, hda->regs + FPCI_DBG_CFG_2); in hda_tegra_first_init()
310 dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); in hda_tegra_first_init()
312 chip->align_buffer_size = 1; in hda_tegra_first_init()
317 chip->capture_streams = (gcap >> 8) & 0x0f; in hda_tegra_first_init()
327 if (of_device_is_compatible(np, "nvidia,tegra234-hda")) in hda_tegra_first_init()
328 chip->capture_streams = 4; in hda_tegra_first_init()
330 chip->playback_streams = (gcap >> 12) & 0x0f; in hda_tegra_first_init()
331 if (!chip->playback_streams && !chip->capture_streams) { in hda_tegra_first_init()
333 chip->playback_streams = NUM_PLAYBACK_SD; in hda_tegra_first_init()
334 chip->capture_streams = NUM_CAPTURE_SD; in hda_tegra_first_init()
336 chip->capture_index_offset = 0; in hda_tegra_first_init()
337 chip->playback_index_offset = chip->capture_streams; in hda_tegra_first_init()
338 chip->num_streams = chip->playback_streams + chip->capture_streams; in hda_tegra_first_init()
343 dev_err(card->dev, "failed to initialize streams: %d\n", err); in hda_tegra_first_init()
349 dev_err(card->dev, "failed to allocate stream pages: %d\n", in hda_tegra_first_init()
358 * Playback (for 44.1K/48K, 2-channel, 16-bps) fails with in hda_tegra_first_init()
371 if (of_device_is_compatible(np, "nvidia,tegra30-hda")) in hda_tegra_first_init()
372 chip->bus.core.sdo_limit = 16; in hda_tegra_first_init()
375 if (!bus->codec_mask) { in hda_tegra_first_init()
376 dev_err(card->dev, "no codecs found!\n"); in hda_tegra_first_init()
377 return -ENODEV; in hda_tegra_first_init()
381 strncpy(card->driver, drv_name, sizeof(card->driver)); in hda_tegra_first_init()
386 if (strlen(sname) > sizeof(card->shortname)) in hda_tegra_first_init()
387 dev_info(card->dev, "truncating shortname for card\n"); in hda_tegra_first_init()
388 strncpy(card->shortname, sname, sizeof(card->shortname)); in hda_tegra_first_init()
391 snprintf(card->longname, sizeof(card->longname), in hda_tegra_first_init()
393 card->shortname, bus->addr, bus->irq); in hda_tegra_first_init()
415 chip = &hda->chip; in hda_tegra_create()
417 mutex_init(&chip->open_mutex); in hda_tegra_create()
418 chip->card = card; in hda_tegra_create()
419 chip->ops = &hda_tegra_ops; in hda_tegra_create()
420 chip->driver_caps = driver_caps; in hda_tegra_create()
421 chip->driver_type = driver_caps & 0xff; in hda_tegra_create()
422 chip->dev_index = 0; in hda_tegra_create()
423 chip->jackpoll_interval = msecs_to_jiffies(5000); in hda_tegra_create()
424 INIT_LIST_HEAD(&chip->pcm_list); in hda_tegra_create()
426 chip->codec_probe_mask = -1; in hda_tegra_create()
428 chip->single_cmd = false; in hda_tegra_create()
429 chip->snoop = true; in hda_tegra_create()
431 INIT_WORK(&hda->probe_work, hda_tegra_probe_work); in hda_tegra_create()
437 chip->bus.core.sync_write = 0; in hda_tegra_create()
438 chip->bus.core.needs_damn_long_delay = 1; in hda_tegra_create()
439 chip->bus.core.aligned_mmio = 1; in hda_tegra_create()
440 chip->bus.jackpoll_in_suspend = 1; in hda_tegra_create()
444 dev_err(card->dev, "Error creating device\n"); in hda_tegra_create()
467 { .compatible = "nvidia,tegra30-hda", .data = &tegra30_data },
468 { .compatible = "nvidia,tegra194-hda", .data = &tegra194_data },
469 { .compatible = "nvidia,tegra234-hda", .data = &tegra234_data },
484 hda = devm_kzalloc(&pdev->dev, sizeof(*hda), GFP_KERNEL); in hda_tegra_probe()
486 return -ENOMEM; in hda_tegra_probe()
487 hda->dev = &pdev->dev; in hda_tegra_probe()
488 chip = &hda->chip; in hda_tegra_probe()
490 hda->soc = of_device_get_match_data(&pdev->dev); in hda_tegra_probe()
492 err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, in hda_tegra_probe()
495 dev_err(&pdev->dev, "Error creating card!\n"); in hda_tegra_probe()
499 hda->resets[hda->nresets++].id = "hda"; in hda_tegra_probe()
503 * codec is separate IP and not under display SOR partition now. in hda_tegra_probe()
505 if (hda->soc->has_hda2hdmi) in hda_tegra_probe()
506 hda->resets[hda->nresets++].id = "hda2hdmi"; in hda_tegra_probe()
509 * "hda2codec_2x" reset is not present on Tegra194. Though DT would in hda_tegra_probe()
513 if (hda->soc->has_hda2codec_2x_reset) in hda_tegra_probe()
514 hda->resets[hda->nresets++].id = "hda2codec_2x"; in hda_tegra_probe()
516 err = devm_reset_control_bulk_get_exclusive(&pdev->dev, hda->nresets, in hda_tegra_probe()
517 hda->resets); in hda_tegra_probe()
521 hda->clocks[hda->nclocks++].id = "hda"; in hda_tegra_probe()
522 if (hda->soc->has_hda2hdmi) in hda_tegra_probe()
523 hda->clocks[hda->nclocks++].id = "hda2hdmi"; in hda_tegra_probe()
524 hda->clocks[hda->nclocks++].id = "hda2codec_2x"; in hda_tegra_probe()
526 err = devm_clk_bulk_get(&pdev->dev, hda->nclocks, hda->clocks); in hda_tegra_probe()
533 card->private_data = chip; in hda_tegra_probe()
535 dev_set_drvdata(&pdev->dev, card); in hda_tegra_probe()
537 pm_runtime_enable(hda->dev); in hda_tegra_probe()
539 pm_runtime_forbid(hda->dev); in hda_tegra_probe()
541 schedule_work(&hda->probe_work); in hda_tegra_probe()
553 struct azx *chip = &hda->chip; in hda_tegra_probe_work()
554 struct platform_device *pdev = to_platform_device(hda->dev); in hda_tegra_probe_work()
557 pm_runtime_get_sync(hda->dev); in hda_tegra_probe_work()
571 err = snd_card_register(chip->card); in hda_tegra_probe_work()
575 chip->running = 1; in hda_tegra_probe_work()
576 snd_hda_set_power_save(&chip->bus, power_save * 1000); in hda_tegra_probe_work()
579 pm_runtime_put(hda->dev); in hda_tegra_probe_work()
587 ret = snd_card_free(dev_get_drvdata(&pdev->dev)); in hda_tegra_remove()
588 pm_runtime_disable(&pdev->dev); in hda_tegra_remove()
595 struct snd_card *card = dev_get_drvdata(&pdev->dev); in hda_tegra_shutdown()
600 chip = card->private_data; in hda_tegra_shutdown()
601 if (chip && chip->running) in hda_tegra_shutdown()
607 .name = "tegra-hda",