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