Lines Matching refs:hda
258 struct sti_hda *hda; member
264 static u32 hda_read(struct sti_hda *hda, int offset) in hda_read() argument
266 return readl(hda->regs + offset); in hda_read()
269 static void hda_write(struct sti_hda *hda, u32 val, int offset) in hda_write() argument
271 writel(val, hda->regs + offset); in hda_write()
300 static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable) in hda_enable_hd_dacs() argument
304 if (hda->video_dacs_ctrl) { in hda_enable_hd_dacs()
307 switch ((u32)hda->video_dacs_ctrl & VIDEO_DACS_CONTROL_MASK) { in hda_enable_hd_dacs()
319 val = readl(hda->video_dacs_ctrl); in hda_enable_hd_dacs()
325 writel(val, hda->video_dacs_ctrl); in hda_enable_hd_dacs()
336 static void sti_hda_configure_awg(struct sti_hda *hda, u32 *awg_instr, int nb) in sti_hda_configure_awg() argument
343 hda_write(hda, awg_instr[i], HDA_SYNC_AWGI + i * 4); in sti_hda_configure_awg()
345 hda_write(hda, 0, HDA_SYNC_AWGI + i * 4); in sti_hda_configure_awg()
350 struct sti_hda *hda = bridge->driver_private; in sti_hda_disable() local
353 if (!hda->enabled) in sti_hda_disable()
359 val = hda_read(hda, HDA_ANA_CFG); in sti_hda_disable()
361 hda_write(hda, val, HDA_ANA_CFG); in sti_hda_disable()
362 hda_write(hda, 0, HDA_ANA_ANC_CTRL); in sti_hda_disable()
364 hda_enable_hd_dacs(hda, false); in sti_hda_disable()
367 clk_disable_unprepare(hda->clk_hddac); in sti_hda_disable()
368 clk_disable_unprepare(hda->clk_pix); in sti_hda_disable()
370 hda->enabled = false; in sti_hda_disable()
375 struct sti_hda *hda = bridge->driver_private; in sti_hda_pre_enable() local
383 if (hda->enabled) in sti_hda_pre_enable()
387 if (clk_prepare_enable(hda->clk_pix)) in sti_hda_pre_enable()
389 if (clk_prepare_enable(hda->clk_hddac)) in sti_hda_pre_enable()
392 if (!hda_get_mode_idx(hda->mode, &mode_idx)) { in sti_hda_pre_enable()
427 hda_enable_hd_dacs(hda, true); in sti_hda_pre_enable()
430 hda_write(hda, SCALE_CTRL_Y_DFLT, HDA_ANA_SCALE_CTRL_Y); in sti_hda_pre_enable()
431 hda_write(hda, SCALE_CTRL_CB_DFLT, HDA_ANA_SCALE_CTRL_CB); in sti_hda_pre_enable()
432 hda_write(hda, SCALE_CTRL_CR_DFLT, HDA_ANA_SCALE_CTRL_CR); in sti_hda_pre_enable()
435 hda_write(hda , src_filter_y, HDA_ANA_SRC_Y_CFG); in sti_hda_pre_enable()
436 hda_write(hda, src_filter_c, HDA_ANA_SRC_C_CFG); in sti_hda_pre_enable()
438 hda_write(hda, coef_y[i], HDA_COEFF_Y_PH1_TAP123 + i * 4); in sti_hda_pre_enable()
439 hda_write(hda, coef_c[i], HDA_COEFF_C_PH1_TAP123 + i * 4); in sti_hda_pre_enable()
444 val |= (hda->mode.flags & DRM_MODE_FLAG_INTERLACE) ? in sti_hda_pre_enable()
448 hda_write(hda, val, HDA_ANA_CFG); in sti_hda_pre_enable()
451 sti_hda_configure_awg(hda, hda_supported_modes[mode_idx].awg_instr, in sti_hda_pre_enable()
455 val = hda_read(hda, HDA_ANA_CFG); in sti_hda_pre_enable()
457 hda_write(hda, val, HDA_ANA_CFG); in sti_hda_pre_enable()
459 hda->enabled = true; in sti_hda_pre_enable()
466 struct sti_hda *hda = bridge->driver_private; in sti_hda_set_mode() local
473 memcpy(&hda->mode, mode, sizeof(struct drm_display_mode)); in sti_hda_set_mode()
475 if (!hda_get_mode_idx(hda->mode, &mode_idx)) { in sti_hda_set_mode()
495 ret = clk_set_rate(hda->clk_hddac, hddac_rate); in sti_hda_set_mode()
501 ret = clk_set_rate(hda->clk_pix, mode->clock * 1000); in sti_hda_set_mode()
526 struct sti_hda *hda = hda_connector->hda; in sti_hda_connector_get_modes() local
532 drm_mode_duplicate(hda->drm_dev, in sti_hda_connector_get_modes()
563 struct sti_hda *hda = hda_connector->hda; in sti_hda_connector_mode_valid() local
568 result = clk_round_rate(hda->clk_pix, target); in sti_hda_connector_mode_valid()
639 struct sti_hda *hda = dev_get_drvdata(dev); in sti_hda_bind() local
648 hda->drm_dev = drm_dev; in sti_hda_bind()
658 connector->hda = hda; in sti_hda_bind()
664 bridge->driver_private = hda; in sti_hda_bind()
713 struct sti_hda *hda; in sti_hda_probe() local
718 hda = devm_kzalloc(dev, sizeof(*hda), GFP_KERNEL); in sti_hda_probe()
719 if (!hda) in sti_hda_probe()
722 hda->dev = pdev->dev; in sti_hda_probe()
730 hda->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); in sti_hda_probe()
731 if (!hda->regs) in sti_hda_probe()
737 hda->video_dacs_ctrl = devm_ioremap_nocache(dev, res->start, in sti_hda_probe()
739 if (!hda->video_dacs_ctrl) in sti_hda_probe()
744 hda->video_dacs_ctrl = NULL; in sti_hda_probe()
748 hda->clk_pix = devm_clk_get(dev, "pix"); in sti_hda_probe()
749 if (IS_ERR(hda->clk_pix)) { in sti_hda_probe()
751 return PTR_ERR(hda->clk_pix); in sti_hda_probe()
754 hda->clk_hddac = devm_clk_get(dev, "hddac"); in sti_hda_probe()
755 if (IS_ERR(hda->clk_hddac)) { in sti_hda_probe()
757 return PTR_ERR(hda->clk_hddac); in sti_hda_probe()
760 platform_set_drvdata(pdev, hda); in sti_hda_probe()