Lines Matching +full:tegra194 +full:- +full:display
1 // SPDX-License-Identifier: GPL-2.0-only
11 #include <linux/dma-mapping.h>
67 * Tegra194 does not reflect correct number of SDO lines. Below macro
97 "Automatic power-saving timeout (in seconds, 0 = disable).");
109 v = readl(hda->regs + HDA_IPFS_CONFIG); in hda_tegra_init()
111 writel(v, hda->regs + HDA_IPFS_CONFIG); in hda_tegra_init()
114 v = readl(hda->regs + HDA_CFG_CMD); in hda_tegra_init()
118 writel(v, hda->regs + HDA_CFG_CMD); in hda_tegra_init()
120 writel(HDA_BAR0_INIT_PROGRAM, hda->regs + HDA_CFG_BAR0); in hda_tegra_init()
121 writel(HDA_BAR0_FINAL_PROGRAM, hda->regs + HDA_CFG_BAR0); in hda_tegra_init()
122 writel(HDA_FPCI_BAR0_START, hda->regs + HDA_IPFS_FPCI_BAR0); in hda_tegra_init()
124 v = readl(hda->regs + HDA_IPFS_INTR_MASK); in hda_tegra_init()
126 writel(v, hda->regs + HDA_IPFS_INTR_MASK); in hda_tegra_init()
161 struct azx *chip = card->private_data; in hda_tegra_runtime_suspend()
164 if (chip && chip->running) { in hda_tegra_runtime_suspend()
172 clk_bulk_disable_unprepare(hda->nclocks, hda->clocks); in hda_tegra_runtime_suspend()
180 struct azx *chip = card->private_data; in hda_tegra_runtime_resume()
184 if (!chip->running) { in hda_tegra_runtime_resume()
185 rc = reset_control_bulk_assert(hda->nresets, hda->resets); in hda_tegra_runtime_resume()
190 rc = clk_bulk_prepare_enable(hda->nclocks, hda->clocks); in hda_tegra_runtime_resume()
193 if (chip->running) { in hda_tegra_runtime_resume()
194 if (hda->soc->requires_init) in hda_tegra_runtime_resume()
204 rc = reset_control_bulk_deassert(hda->nresets, hda->resets); in hda_tegra_runtime_resume()
221 struct azx *chip = device->device_data; in hda_tegra_dev_disconnect()
223 chip->bus.shutdown = 1; in hda_tegra_dev_disconnect()
232 struct azx *chip = device->device_data; in hda_tegra_dev_free()
235 cancel_work_sync(&hda->probe_work); in hda_tegra_dev_free()
236 if (azx_bus(chip)->chip_init) { in hda_tegra_dev_free()
254 hda->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in hda_tegra_init_chip()
255 if (IS_ERR(hda->regs)) in hda_tegra_init_chip()
256 return PTR_ERR(hda->regs); in hda_tegra_init_chip()
258 bus->remap_addr = hda->regs + HDA_BAR0; in hda_tegra_init_chip()
259 bus->addr = res->start + HDA_BAR0; in hda_tegra_init_chip()
261 if (hda->soc->requires_init) in hda_tegra_init_chip()
271 struct snd_card *card = chip->card; in hda_tegra_first_init()
275 const char *sname, *drv_name = "tegra-hda"; in hda_tegra_first_init()
276 struct device_node *np = pdev->dev.of_node; in hda_tegra_first_init()
285 err = devm_request_irq(chip->card->dev, irq_id, azx_interrupt, in hda_tegra_first_init()
288 dev_err(chip->card->dev, in hda_tegra_first_init()
293 bus->irq = irq_id; in hda_tegra_first_init()
294 bus->dma_stop_delay = 100; in hda_tegra_first_init()
295 card->sync_irq = bus->irq; in hda_tegra_first_init()
298 * Tegra194 has 4 SDO lines and the STRIPE can be used to in hda_tegra_first_init()
306 if (of_device_is_compatible(np, "nvidia,tegra194-hda")) { in hda_tegra_first_init()
309 dev_info(card->dev, "Override SDO lines to %u\n", in hda_tegra_first_init()
312 val = readl(hda->regs + FPCI_DBG_CFG_2) & ~FPCI_GCAP_NSDO_MASK; in hda_tegra_first_init()
314 writel(val, hda->regs + FPCI_DBG_CFG_2); in hda_tegra_first_init()
318 dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); in hda_tegra_first_init()
320 chip->align_buffer_size = 1; in hda_tegra_first_init()
325 chip->capture_streams = (gcap >> 8) & 0x0f; in hda_tegra_first_init()
335 if (!hda->soc->input_stream) in hda_tegra_first_init()
336 chip->capture_streams = 4; in hda_tegra_first_init()
338 chip->playback_streams = (gcap >> 12) & 0x0f; in hda_tegra_first_init()
339 if (!chip->playback_streams && !chip->capture_streams) { in hda_tegra_first_init()
341 chip->playback_streams = NUM_PLAYBACK_SD; in hda_tegra_first_init()
342 chip->capture_streams = NUM_CAPTURE_SD; in hda_tegra_first_init()
344 chip->capture_index_offset = 0; in hda_tegra_first_init()
345 chip->playback_index_offset = chip->capture_streams; in hda_tegra_first_init()
346 chip->num_streams = chip->playback_streams + chip->capture_streams; in hda_tegra_first_init()
351 dev_err(card->dev, "failed to initialize streams: %d\n", err); in hda_tegra_first_init()
357 dev_err(card->dev, "failed to allocate stream pages: %d\n", in hda_tegra_first_init()
366 * Playback (for 44.1K/48K, 2-channel, 16-bps) fails with in hda_tegra_first_init()
379 if (of_device_is_compatible(np, "nvidia,tegra30-hda")) in hda_tegra_first_init()
380 chip->bus.core.sdo_limit = 16; in hda_tegra_first_init()
383 if (!bus->codec_mask) { in hda_tegra_first_init()
384 dev_err(card->dev, "no codecs found!\n"); in hda_tegra_first_init()
385 return -ENODEV; in hda_tegra_first_init()
389 strscpy(card->driver, drv_name, sizeof(card->driver)); in hda_tegra_first_init()
394 if (strlen(sname) > sizeof(card->shortname)) in hda_tegra_first_init()
395 dev_info(card->dev, "truncating shortname for card\n"); in hda_tegra_first_init()
396 strscpy(card->shortname, sname, sizeof(card->shortname)); in hda_tegra_first_init()
399 snprintf(card->longname, sizeof(card->longname), in hda_tegra_first_init()
401 card->shortname, bus->addr, bus->irq); in hda_tegra_first_init()
423 chip = &hda->chip; in hda_tegra_create()
425 mutex_init(&chip->open_mutex); in hda_tegra_create()
426 chip->card = card; in hda_tegra_create()
427 chip->ops = &hda_tegra_ops; in hda_tegra_create()
428 chip->driver_caps = driver_caps; in hda_tegra_create()
429 chip->driver_type = driver_caps & 0xff; in hda_tegra_create()
430 chip->dev_index = 0; in hda_tegra_create()
431 INIT_LIST_HEAD(&chip->pcm_list); in hda_tegra_create()
433 chip->codec_probe_mask = -1; in hda_tegra_create()
435 chip->single_cmd = false; in hda_tegra_create()
436 chip->snoop = true; in hda_tegra_create()
438 INIT_WORK(&hda->probe_work, hda_tegra_probe_work); in hda_tegra_create()
444 chip->bus.core.sync_write = 0; in hda_tegra_create()
445 chip->bus.core.needs_damn_long_delay = 1; in hda_tegra_create()
446 chip->bus.core.aligned_mmio = 1; in hda_tegra_create()
453 if (!hda->soc->always_on) { in hda_tegra_create()
454 chip->jackpoll_interval = msecs_to_jiffies(5000); in hda_tegra_create()
455 chip->bus.jackpoll_in_suspend = 1; in hda_tegra_create()
460 dev_err(card->dev, "Error creating device\n"); in hda_tegra_create()
504 { .compatible = "nvidia,tegra30-hda", .data = &tegra30_data },
505 { .compatible = "nvidia,tegra194-hda", .data = &tegra194_data },
506 { .compatible = "nvidia,tegra234-hda", .data = &tegra234_data },
507 { .compatible = "nvidia,tegra264-hda", .data = &tegra264_data },
522 hda = devm_kzalloc(&pdev->dev, sizeof(*hda), GFP_KERNEL); in hda_tegra_probe()
524 return -ENOMEM; in hda_tegra_probe()
525 hda->dev = &pdev->dev; in hda_tegra_probe()
526 chip = &hda->chip; in hda_tegra_probe()
528 hda->soc = of_device_get_match_data(&pdev->dev); in hda_tegra_probe()
530 err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, in hda_tegra_probe()
533 dev_err(&pdev->dev, "Error creating card!\n"); in hda_tegra_probe()
537 hda->resets[hda->nresets++].id = "hda"; in hda_tegra_probe()
541 * codec is separate IP and not under display SOR partition now. in hda_tegra_probe()
543 if (hda->soc->has_hda2hdmi) in hda_tegra_probe()
544 hda->resets[hda->nresets++].id = "hda2hdmi"; in hda_tegra_probe()
547 * "hda2codec_2x" reset is not present on Tegra194. Though DT would in hda_tegra_probe()
551 if (hda->soc->has_hda2codec_2x_reset) in hda_tegra_probe()
552 hda->resets[hda->nresets++].id = "hda2codec_2x"; in hda_tegra_probe()
554 err = devm_reset_control_bulk_get_exclusive(&pdev->dev, hda->nresets, in hda_tegra_probe()
555 hda->resets); in hda_tegra_probe()
559 hda->clocks[hda->nclocks++].id = "hda"; in hda_tegra_probe()
560 if (hda->soc->has_hda2hdmi) in hda_tegra_probe()
561 hda->clocks[hda->nclocks++].id = "hda2hdmi"; in hda_tegra_probe()
563 if (hda->soc->has_hda2codec_2x) in hda_tegra_probe()
564 hda->clocks[hda->nclocks++].id = "hda2codec_2x"; in hda_tegra_probe()
566 err = devm_clk_bulk_get(&pdev->dev, hda->nclocks, hda->clocks); in hda_tegra_probe()
573 card->private_data = chip; in hda_tegra_probe()
575 dev_set_drvdata(&pdev->dev, card); in hda_tegra_probe()
577 pm_runtime_enable(hda->dev); in hda_tegra_probe()
579 pm_runtime_forbid(hda->dev); in hda_tegra_probe()
581 schedule_work(&hda->probe_work); in hda_tegra_probe()
593 struct azx *chip = &hda->chip; in hda_tegra_probe_work()
594 struct platform_device *pdev = to_platform_device(hda->dev); in hda_tegra_probe_work()
597 pm_runtime_get_sync(hda->dev); in hda_tegra_probe_work()
611 err = snd_card_register(chip->card); in hda_tegra_probe_work()
615 chip->running = 1; in hda_tegra_probe_work()
616 snd_hda_set_power_save(&chip->bus, power_save * 1000); in hda_tegra_probe_work()
619 pm_runtime_put(hda->dev); in hda_tegra_probe_work()
625 snd_card_free(dev_get_drvdata(&pdev->dev)); in hda_tegra_remove()
626 pm_runtime_disable(&pdev->dev); in hda_tegra_remove()
631 struct snd_card *card = dev_get_drvdata(&pdev->dev); in hda_tegra_shutdown()
636 chip = card->private_data; in hda_tegra_shutdown()
637 if (chip && chip->running) in hda_tegra_shutdown()
643 .name = "tegra-hda",