Lines Matching refs:hda
259 struct sti_hda *hda; member
265 static u32 hda_read(struct sti_hda *hda, int offset) in hda_read() argument
267 return readl(hda->regs + offset); in hda_read()
270 static void hda_write(struct sti_hda *hda, u32 val, int offset) in hda_write() argument
272 writel(val, hda->regs + offset); in hda_write()
301 static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable) in hda_enable_hd_dacs() argument
303 if (hda->video_dacs_ctrl) { in hda_enable_hd_dacs()
306 val = readl(hda->video_dacs_ctrl); in hda_enable_hd_dacs()
312 writel(val, hda->video_dacs_ctrl); in hda_enable_hd_dacs()
317 readl(hda->regs + reg))
349 struct sti_hda *hda = (struct sti_hda *)node->info_ent->data; in hda_dbg_show() local
351 seq_printf(s, "HD Analog: (vaddr = 0x%p)", hda->regs); in hda_dbg_show()
353 hda_dbg_cfg(s, readl(hda->regs + HDA_ANA_CFG)); in hda_dbg_show()
360 hda_dbg_awg_microcode(s, hda->regs + HDA_SYNC_AWGI); in hda_dbg_show()
361 if (hda->video_dacs_ctrl) in hda_dbg_show()
362 hda_dbg_video_dacs_ctrl(s, hda->video_dacs_ctrl); in hda_dbg_show()
371 static void hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor) in hda_debugfs_init() argument
376 hda_debugfs_files[i].data = hda; in hda_debugfs_init()
390 static void sti_hda_configure_awg(struct sti_hda *hda, u32 *awg_instr, int nb) in sti_hda_configure_awg() argument
397 hda_write(hda, awg_instr[i], HDA_SYNC_AWGI + i * 4); in sti_hda_configure_awg()
399 hda_write(hda, 0, HDA_SYNC_AWGI + i * 4); in sti_hda_configure_awg()
404 struct sti_hda *hda = bridge->driver_private; in sti_hda_disable() local
407 if (!hda->enabled) in sti_hda_disable()
413 val = hda_read(hda, HDA_ANA_CFG); in sti_hda_disable()
415 hda_write(hda, val, HDA_ANA_CFG); in sti_hda_disable()
416 hda_write(hda, 0, HDA_ANA_ANC_CTRL); in sti_hda_disable()
418 hda_enable_hd_dacs(hda, false); in sti_hda_disable()
421 clk_disable_unprepare(hda->clk_hddac); in sti_hda_disable()
422 clk_disable_unprepare(hda->clk_pix); in sti_hda_disable()
424 hda->enabled = false; in sti_hda_disable()
429 struct sti_hda *hda = bridge->driver_private; in sti_hda_pre_enable() local
437 if (hda->enabled) in sti_hda_pre_enable()
441 if (clk_prepare_enable(hda->clk_pix)) in sti_hda_pre_enable()
443 if (clk_prepare_enable(hda->clk_hddac)) in sti_hda_pre_enable()
446 if (!hda_get_mode_idx(hda->mode, &mode_idx)) { in sti_hda_pre_enable()
481 hda_enable_hd_dacs(hda, true); in sti_hda_pre_enable()
484 hda_write(hda, SCALE_CTRL_Y_DFLT, HDA_ANA_SCALE_CTRL_Y); in sti_hda_pre_enable()
485 hda_write(hda, SCALE_CTRL_CB_DFLT, HDA_ANA_SCALE_CTRL_CB); in sti_hda_pre_enable()
486 hda_write(hda, SCALE_CTRL_CR_DFLT, HDA_ANA_SCALE_CTRL_CR); in sti_hda_pre_enable()
489 hda_write(hda , src_filter_y, HDA_ANA_SRC_Y_CFG); in sti_hda_pre_enable()
490 hda_write(hda, src_filter_c, HDA_ANA_SRC_C_CFG); in sti_hda_pre_enable()
492 hda_write(hda, coef_y[i], HDA_COEFF_Y_PH1_TAP123 + i * 4); in sti_hda_pre_enable()
493 hda_write(hda, coef_c[i], HDA_COEFF_C_PH1_TAP123 + i * 4); in sti_hda_pre_enable()
498 val |= (hda->mode.flags & DRM_MODE_FLAG_INTERLACE) ? in sti_hda_pre_enable()
502 hda_write(hda, val, HDA_ANA_CFG); in sti_hda_pre_enable()
505 sti_hda_configure_awg(hda, hda_supported_modes[mode_idx].awg_instr, in sti_hda_pre_enable()
509 val = hda_read(hda, HDA_ANA_CFG); in sti_hda_pre_enable()
511 hda_write(hda, val, HDA_ANA_CFG); in sti_hda_pre_enable()
513 hda->enabled = true; in sti_hda_pre_enable()
520 struct sti_hda *hda = bridge->driver_private; in sti_hda_set_mode() local
527 drm_mode_copy(&hda->mode, mode); in sti_hda_set_mode()
529 if (!hda_get_mode_idx(hda->mode, &mode_idx)) { in sti_hda_set_mode()
549 ret = clk_set_rate(hda->clk_hddac, hddac_rate); in sti_hda_set_mode()
555 ret = clk_set_rate(hda->clk_pix, mode->clock * 1000); in sti_hda_set_mode()
580 struct sti_hda *hda = hda_connector->hda; in sti_hda_connector_get_modes() local
586 drm_mode_duplicate(hda->drm_dev, in sti_hda_connector_get_modes()
615 struct sti_hda *hda = hda_connector->hda; in sti_hda_connector_mode_valid() local
620 result = clk_round_rate(hda->clk_pix, target); in sti_hda_connector_mode_valid()
645 struct sti_hda *hda = hda_connector->hda; in sti_hda_late_register() local
647 hda_debugfs_init(hda, hda->drm_dev->primary); in sti_hda_late_register()
675 struct sti_hda *hda = dev_get_drvdata(dev); in sti_hda_bind() local
684 hda->drm_dev = drm_dev; in sti_hda_bind()
694 connector->hda = hda; in sti_hda_bind()
700 bridge->driver_private = hda; in sti_hda_bind()
722 hda_enable_hd_dacs(hda, false); in sti_hda_bind()
743 struct sti_hda *hda; in sti_hda_probe() local
748 hda = devm_kzalloc(dev, sizeof(*hda), GFP_KERNEL); in sti_hda_probe()
749 if (!hda) in sti_hda_probe()
752 hda->dev = pdev->dev; in sti_hda_probe()
760 hda->regs = devm_ioremap(dev, res->start, resource_size(res)); in sti_hda_probe()
761 if (!hda->regs) in sti_hda_probe()
767 hda->video_dacs_ctrl = devm_ioremap(dev, res->start, in sti_hda_probe()
769 if (!hda->video_dacs_ctrl) in sti_hda_probe()
774 hda->video_dacs_ctrl = NULL; in sti_hda_probe()
778 hda->clk_pix = devm_clk_get(dev, "pix"); in sti_hda_probe()
779 if (IS_ERR(hda->clk_pix)) { in sti_hda_probe()
781 return PTR_ERR(hda->clk_pix); in sti_hda_probe()
784 hda->clk_hddac = devm_clk_get(dev, "hddac"); in sti_hda_probe()
785 if (IS_ERR(hda->clk_hddac)) { in sti_hda_probe()
787 return PTR_ERR(hda->clk_hddac); in sti_hda_probe()
790 platform_set_drvdata(pdev, hda); in sti_hda_probe()