Lines Matching refs:tvout
125 struct sti_tvout *tvout; member
131 #define to_sti_tvout(x) to_sti_tvout_encoder(x)->tvout
145 static u32 tvout_read(struct sti_tvout *tvout, int offset) in tvout_read() argument
147 return readl(tvout->regs + offset); in tvout_read()
150 static void tvout_write(struct sti_tvout *tvout, u32 val, int offset) in tvout_write() argument
152 writel(val, tvout->regs + offset); in tvout_write()
164 static void tvout_vip_set_color_order(struct sti_tvout *tvout, int reg, in tvout_vip_set_color_order() argument
167 u32 val = tvout_read(tvout, reg); in tvout_vip_set_color_order()
176 tvout_write(tvout, val, reg); in tvout_vip_set_color_order()
186 static void tvout_vip_set_clip_mode(struct sti_tvout *tvout, int reg, u32 range) in tvout_vip_set_clip_mode() argument
188 u32 val = tvout_read(tvout, reg); in tvout_vip_set_clip_mode()
192 tvout_write(tvout, val, reg); in tvout_vip_set_clip_mode()
202 static void tvout_vip_set_rnd(struct sti_tvout *tvout, int reg, u32 rnd) in tvout_vip_set_rnd() argument
204 u32 val = tvout_read(tvout, reg); in tvout_vip_set_rnd()
208 tvout_write(tvout, val, reg); in tvout_vip_set_rnd()
219 static void tvout_vip_set_sel_input(struct sti_tvout *tvout, in tvout_vip_set_sel_input() argument
225 u32 val = tvout_read(tvout, reg); in tvout_vip_set_sel_input()
246 tvout_write(tvout, val, reg); in tvout_vip_set_sel_input()
256 static void tvout_vip_set_in_vid_fmt(struct sti_tvout *tvout, in tvout_vip_set_in_vid_fmt() argument
259 u32 val = tvout_read(tvout, reg); in tvout_vip_set_in_vid_fmt()
263 tvout_write(tvout, val, reg); in tvout_vip_set_in_vid_fmt()
272 static void tvout_preformatter_set_matrix(struct sti_tvout *tvout, in tvout_preformatter_set_matrix() argument
284 tvout_write(tvout, *(pf_matrix + i), in tvout_preformatter_set_matrix()
286 tvout_write(tvout, *(pf_matrix + i), in tvout_preformatter_set_matrix()
298 static void tvout_dvo_start(struct sti_tvout *tvout, bool main_path) in tvout_dvo_start() argument
303 dev_dbg(tvout->dev, "%s\n", __func__); in tvout_dvo_start()
312 tvout_write(tvout, val, TVO_DVO_SYNC_SEL); in tvout_dvo_start()
321 tvout_write(tvout, val, TVO_DVO_SYNC_SEL); in tvout_dvo_start()
326 tvout_vip_set_color_order(tvout, TVO_VIP_DVO, in tvout_dvo_start()
332 tvout_vip_set_clip_mode(tvout, TVO_VIP_DVO, TVO_VIP_CLIP_DISABLED); in tvout_dvo_start()
335 tvout_vip_set_rnd(tvout, TVO_VIP_DVO, TVO_VIP_RND_8BIT_ROUNDED); in tvout_dvo_start()
338 tvout_vip_set_in_vid_fmt(tvout, tvo_in_vid_format, TVO_IN_FMT_SIGNED); in tvout_dvo_start()
341 tvout_vip_set_sel_input(tvout, TVO_VIP_DVO, main_path, in tvout_dvo_start()
352 static void tvout_hdmi_start(struct sti_tvout *tvout, bool main_path) in tvout_hdmi_start() argument
356 dev_dbg(tvout->dev, "%s\n", __func__); in tvout_hdmi_start()
361 tvout_write(tvout, in tvout_hdmi_start()
368 tvout_write(tvout, in tvout_hdmi_start()
375 tvout_vip_set_color_order(tvout, TVO_VIP_HDMI, in tvout_hdmi_start()
381 tvout_vip_set_clip_mode(tvout, TVO_VIP_HDMI, TVO_VIP_CLIP_DISABLED); in tvout_hdmi_start()
384 tvout_vip_set_rnd(tvout, TVO_VIP_HDMI, TVO_VIP_RND_8BIT_ROUNDED); in tvout_hdmi_start()
387 tvout_vip_set_in_vid_fmt(tvout, tvo_in_vid_format, TVO_IN_FMT_SIGNED); in tvout_hdmi_start()
390 tvout_vip_set_sel_input(tvout, TVO_VIP_HDMI, main_path, in tvout_hdmi_start()
401 static void tvout_hda_start(struct sti_tvout *tvout, bool main_path) in tvout_hda_start() argument
406 dev_dbg(tvout->dev, "%s\n", __func__); in tvout_hda_start()
414 tvout_write(tvout, val, TVO_HD_SYNC_SEL); in tvout_hda_start()
422 tvout_write(tvout, val, TVO_HD_SYNC_SEL); in tvout_hda_start()
427 tvout_vip_set_color_order(tvout, TVO_VIP_HDF, in tvout_hda_start()
433 tvout_vip_set_clip_mode(tvout, TVO_VIP_HDF, TVO_VIP_CLIP_DISABLED); in tvout_hda_start()
436 tvout_vip_set_rnd(tvout, TVO_VIP_HDF, TVO_VIP_RND_10BIT_ROUNDED); in tvout_hda_start()
439 tvout_vip_set_in_vid_fmt(tvout, tvo_in_vid_format, TVO_IN_FMT_SIGNED); in tvout_hda_start()
442 tvout_vip_set_sel_input(tvout, TVO_VIP_HDF, main_path, in tvout_hda_start()
446 tvout_write(tvout, 0, TVO_HD_DAC_CFG_OFF); in tvout_hda_start()
450 readl(tvout->regs + reg))
500 struct sti_tvout *tvout = (struct sti_tvout *)node->info_ent->data; in tvout_dbg_show() local
503 seq_printf(s, "TVOUT: (vaddr = 0x%p)", tvout->regs); in tvout_dbg_show()
506 crtc = tvout->hdmi->crtc; in tvout_dbg_show()
512 tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDMI)); in tvout_dbg_show()
518 crtc = tvout->dvo->crtc; in tvout_dbg_show()
525 tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_DVO)); in tvout_dbg_show()
531 crtc = tvout->hda->crtc; in tvout_dbg_show()
538 readl(tvout->regs + TVO_HD_DAC_CFG_OFF)); in tvout_dbg_show()
540 tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDF)); in tvout_dbg_show()
573 static void tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor) in tvout_debugfs_init() argument
578 tvout_debugfs_files[i].data = tvout; in tvout_debugfs_init()
605 struct sti_tvout *tvout = to_sti_tvout(encoder); in sti_tvout_late_register() local
607 if (tvout->debugfs_registered) in sti_tvout_late_register()
610 tvout_debugfs_init(tvout, encoder->dev->primary); in sti_tvout_late_register()
612 tvout->debugfs_registered = true; in sti_tvout_late_register()
618 struct sti_tvout *tvout = to_sti_tvout(encoder); in sti_tvout_early_unregister() local
620 if (!tvout->debugfs_registered) in sti_tvout_early_unregister()
623 tvout->debugfs_registered = false; in sti_tvout_early_unregister()
634 struct sti_tvout *tvout = to_sti_tvout(encoder); in sti_dvo_encoder_enable() local
636 tvout_preformatter_set_matrix(tvout, &encoder->crtc->mode); in sti_dvo_encoder_enable()
638 tvout_dvo_start(tvout, sti_crtc_is_main(encoder->crtc)); in sti_dvo_encoder_enable()
643 struct sti_tvout *tvout = to_sti_tvout(encoder); in sti_dvo_encoder_disable() local
646 tvout_write(tvout, 0x0, TVO_VIP_DVO); in sti_dvo_encoder_disable()
658 struct sti_tvout *tvout) in sti_tvout_create_dvo_encoder() argument
663 encoder = devm_kzalloc(tvout->dev, sizeof(*encoder), GFP_KERNEL); in sti_tvout_create_dvo_encoder()
667 encoder->tvout = tvout; in sti_tvout_create_dvo_encoder()
684 struct sti_tvout *tvout = to_sti_tvout(encoder); in sti_hda_encoder_enable() local
686 tvout_preformatter_set_matrix(tvout, &encoder->crtc->mode); in sti_hda_encoder_enable()
688 tvout_hda_start(tvout, sti_crtc_is_main(encoder->crtc)); in sti_hda_encoder_enable()
693 struct sti_tvout *tvout = to_sti_tvout(encoder); in sti_hda_encoder_disable() local
696 tvout_write(tvout, 0x0, TVO_VIP_HDF); in sti_hda_encoder_disable()
699 tvout_write(tvout, 1, TVO_HD_DAC_CFG_OFF); in sti_hda_encoder_disable()
710 struct sti_tvout *tvout) in sti_tvout_create_hda_encoder() argument
715 encoder = devm_kzalloc(tvout->dev, sizeof(*encoder), GFP_KERNEL); in sti_tvout_create_hda_encoder()
719 encoder->tvout = tvout; in sti_tvout_create_hda_encoder()
735 struct sti_tvout *tvout = to_sti_tvout(encoder); in sti_hdmi_encoder_enable() local
737 tvout_preformatter_set_matrix(tvout, &encoder->crtc->mode); in sti_hdmi_encoder_enable()
739 tvout_hdmi_start(tvout, sti_crtc_is_main(encoder->crtc)); in sti_hdmi_encoder_enable()
744 struct sti_tvout *tvout = to_sti_tvout(encoder); in sti_hdmi_encoder_disable() local
747 tvout_write(tvout, 0x0, TVO_VIP_HDMI); in sti_hdmi_encoder_disable()
758 struct sti_tvout *tvout) in sti_tvout_create_hdmi_encoder() argument
763 encoder = devm_kzalloc(tvout->dev, sizeof(*encoder), GFP_KERNEL); in sti_tvout_create_hdmi_encoder()
767 encoder->tvout = tvout; in sti_tvout_create_hdmi_encoder()
782 struct sti_tvout *tvout) in sti_tvout_create_encoders() argument
784 tvout->hdmi = sti_tvout_create_hdmi_encoder(dev, tvout); in sti_tvout_create_encoders()
785 tvout->hda = sti_tvout_create_hda_encoder(dev, tvout); in sti_tvout_create_encoders()
786 tvout->dvo = sti_tvout_create_dvo_encoder(dev, tvout); in sti_tvout_create_encoders()
788 tvout->hdmi->possible_clones = drm_encoder_mask(tvout->hdmi) | in sti_tvout_create_encoders()
789 drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo); in sti_tvout_create_encoders()
790 tvout->hda->possible_clones = drm_encoder_mask(tvout->hdmi) | in sti_tvout_create_encoders()
791 drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo); in sti_tvout_create_encoders()
792 tvout->dvo->possible_clones = drm_encoder_mask(tvout->hdmi) | in sti_tvout_create_encoders()
793 drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo); in sti_tvout_create_encoders()
796 static void sti_tvout_destroy_encoders(struct sti_tvout *tvout) in sti_tvout_destroy_encoders() argument
798 if (tvout->hdmi) in sti_tvout_destroy_encoders()
799 drm_encoder_cleanup(tvout->hdmi); in sti_tvout_destroy_encoders()
800 tvout->hdmi = NULL; in sti_tvout_destroy_encoders()
802 if (tvout->hda) in sti_tvout_destroy_encoders()
803 drm_encoder_cleanup(tvout->hda); in sti_tvout_destroy_encoders()
804 tvout->hda = NULL; in sti_tvout_destroy_encoders()
806 if (tvout->dvo) in sti_tvout_destroy_encoders()
807 drm_encoder_cleanup(tvout->dvo); in sti_tvout_destroy_encoders()
808 tvout->dvo = NULL; in sti_tvout_destroy_encoders()
813 struct sti_tvout *tvout = dev_get_drvdata(dev); in sti_tvout_bind() local
816 tvout->drm_dev = drm_dev; in sti_tvout_bind()
818 sti_tvout_create_encoders(drm_dev, tvout); in sti_tvout_bind()
826 struct sti_tvout *tvout = dev_get_drvdata(dev); in sti_tvout_unbind() local
828 sti_tvout_destroy_encoders(tvout); in sti_tvout_unbind()
840 struct sti_tvout *tvout; in sti_tvout_probe() local
848 tvout = devm_kzalloc(dev, sizeof(*tvout), GFP_KERNEL); in sti_tvout_probe()
849 if (!tvout) in sti_tvout_probe()
852 tvout->dev = dev; in sti_tvout_probe()
860 tvout->regs = devm_ioremap(dev, res->start, resource_size(res)); in sti_tvout_probe()
861 if (!tvout->regs) in sti_tvout_probe()
865 tvout->reset = devm_reset_control_get(dev, "tvout"); in sti_tvout_probe()
867 if (!IS_ERR(tvout->reset)) in sti_tvout_probe()
868 reset_control_deassert(tvout->reset); in sti_tvout_probe()
870 platform_set_drvdata(pdev, tvout); in sti_tvout_probe()