Lines Matching refs:encoder
45 static uint32_t nv42_tv_sample_load(struct drm_encoder *encoder) in nv42_tv_sample_load() argument
47 struct drm_device *dev = encoder->dev; in nv42_tv_sample_load()
50 uint32_t testval, regoffset = nv04_dac_output_offset(encoder); in nv42_tv_sample_load()
152 nv17_tv_detect(struct drm_encoder *encoder, struct drm_connector *connector) in nv17_tv_detect() argument
154 struct drm_device *dev = encoder->dev; in nv17_tv_detect()
157 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_detect()
161 if (nv04_dac_in_use(encoder)) in nv17_tv_detect()
168 nv42_tv_sample_load(encoder) >> 28 & 0xe; in nv17_tv_detect()
171 nv17_dac_sample_load(encoder) >> 28 & 0xe; in nv17_tv_detect()
208 static int nv17_tv_get_ld_modes(struct drm_encoder *encoder, in nv17_tv_get_ld_modes() argument
211 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_get_ld_modes()
218 mode = drm_mode_duplicate(encoder->dev, tv_mode); in nv17_tv_get_ld_modes()
238 static int nv17_tv_get_hd_modes(struct drm_encoder *encoder, in nv17_tv_get_hd_modes() argument
241 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_get_hd_modes()
267 mode = drm_mode_duplicate(encoder->dev, output_mode); in nv17_tv_get_hd_modes()
271 mode = drm_cvt_mode(encoder->dev, modes[i].hdisplay, in nv17_tv_get_hd_modes()
300 static int nv17_tv_get_modes(struct drm_encoder *encoder, in nv17_tv_get_modes() argument
303 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_get_modes()
306 return nv17_tv_get_hd_modes(encoder, connector); in nv17_tv_get_modes()
308 return nv17_tv_get_ld_modes(encoder, connector); in nv17_tv_get_modes()
311 static int nv17_tv_mode_valid(struct drm_encoder *encoder, in nv17_tv_mode_valid() argument
314 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_mode_valid()
352 static bool nv17_tv_mode_fixup(struct drm_encoder *encoder, in nv17_tv_mode_fixup() argument
356 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_mode_fixup()
358 if (nv04_dac_in_use(encoder)) in nv17_tv_mode_fixup()
369 static void nv17_tv_dpms(struct drm_encoder *encoder, int mode) in nv17_tv_dpms() argument
371 struct drm_device *dev = encoder->dev; in nv17_tv_dpms()
374 struct nv17_tv_state *regs = &to_tv_enc(encoder)->state; in nv17_tv_dpms()
375 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_dpms()
377 if (nouveau_encoder(encoder)->last_dpms == mode) in nv17_tv_dpms()
379 nouveau_encoder(encoder)->last_dpms = mode; in nv17_tv_dpms()
382 mode, nouveau_encoder(encoder)->dcb->index); in nv17_tv_dpms()
387 nv04_dfp_update_fp_control(encoder, mode); in nv17_tv_dpms()
390 nv04_dfp_update_fp_control(encoder, DRM_MODE_DPMS_OFF); in nv17_tv_dpms()
401 nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON); in nv17_tv_dpms()
404 static void nv17_tv_prepare(struct drm_encoder *encoder) in nv17_tv_prepare() argument
406 struct drm_device *dev = encoder->dev; in nv17_tv_prepare()
408 const struct drm_encoder_helper_funcs *helper = encoder->helper_private; in nv17_tv_prepare()
409 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_prepare()
410 int head = nouveau_crtc(encoder->crtc)->index; in nv17_tv_prepare()
414 nv04_dac_output_offset(encoder); in nv17_tv_prepare()
417 helper->dpms(encoder, DRM_MODE_DPMS_OFF); in nv17_tv_prepare()
465 static void nv17_tv_mode_set(struct drm_encoder *encoder, in nv17_tv_mode_set() argument
469 struct drm_device *dev = encoder->dev; in nv17_tv_mode_set()
471 int head = nouveau_crtc(encoder->crtc)->index; in nv17_tv_mode_set()
473 struct nv17_tv_state *tv_regs = &to_tv_enc(encoder)->state; in nv17_tv_mode_set()
474 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_mode_set()
580 static void nv17_tv_commit(struct drm_encoder *encoder) in nv17_tv_commit() argument
582 struct drm_device *dev = encoder->dev; in nv17_tv_commit()
584 struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc); in nv17_tv_commit()
585 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); in nv17_tv_commit()
586 const struct drm_encoder_helper_funcs *helper = encoder->helper_private; in nv17_tv_commit()
588 if (get_tv_norm(encoder)->kind == TV_ENC_MODE) { in nv17_tv_commit()
589 nv17_tv_update_rescaler(encoder); in nv17_tv_commit()
590 nv17_tv_update_properties(encoder); in nv17_tv_commit()
592 nv17_ctv_update_rescaler(encoder); in nv17_tv_commit()
595 nv17_tv_state_load(dev, &to_tv_enc(encoder)->state); in nv17_tv_commit()
600 nv04_dac_output_offset(encoder), in nv17_tv_commit()
604 nv04_dac_output_offset(encoder), in nv17_tv_commit()
607 helper->dpms(encoder, DRM_MODE_DPMS_ON); in nv17_tv_commit()
614 static void nv17_tv_save(struct drm_encoder *encoder) in nv17_tv_save() argument
616 struct drm_device *dev = encoder->dev; in nv17_tv_save()
617 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_save()
619 nouveau_encoder(encoder)->restore.output = in nv17_tv_save()
622 nv04_dac_output_offset(encoder)); in nv17_tv_save()
629 static void nv17_tv_restore(struct drm_encoder *encoder) in nv17_tv_restore() argument
631 struct drm_device *dev = encoder->dev; in nv17_tv_restore()
634 nv04_dac_output_offset(encoder), in nv17_tv_restore()
635 nouveau_encoder(encoder)->restore.output); in nv17_tv_restore()
637 nv17_tv_state_load(dev, &to_tv_enc(encoder)->saved_state); in nv17_tv_restore()
639 nouveau_encoder(encoder)->last_dpms = NV_DPMS_CLEARED; in nv17_tv_restore()
642 static int nv17_tv_create_resources(struct drm_encoder *encoder, in nv17_tv_create_resources() argument
645 struct drm_device *dev = encoder->dev; in nv17_tv_create_resources()
648 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_create_resources()
649 struct dcb_output *dcb = nouveau_encoder(encoder)->dcb; in nv17_tv_create_resources()
694 static int nv17_tv_set_property(struct drm_encoder *encoder, in nv17_tv_set_property() argument
699 struct drm_mode_config *conf = &encoder->dev->mode_config; in nv17_tv_set_property()
700 struct drm_crtc *crtc = encoder->crtc; in nv17_tv_set_property()
701 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_set_property()
702 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_set_property()
707 if (encoder->crtc) { in nv17_tv_set_property()
709 nv17_ctv_update_rescaler(encoder); in nv17_tv_set_property()
711 nv17_tv_update_rescaler(encoder); in nv17_tv_set_property()
719 nv17_tv_update_properties(encoder); in nv17_tv_set_property()
726 nv17_tv_update_properties(encoder); in nv17_tv_set_property()
733 if (encoder->crtc) in nv17_tv_set_property()
734 nv17_tv_update_rescaler(encoder); in nv17_tv_set_property()
749 nv17_tv_update_properties(encoder); in nv17_tv_set_property()
772 static void nv17_tv_destroy(struct drm_encoder *encoder) in nv17_tv_destroy() argument
774 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_destroy()
776 drm_encoder_cleanup(encoder); in nv17_tv_destroy()
806 struct drm_encoder *encoder; in nv17_tv_create() local
822 encoder = to_drm_encoder(&tv_enc->base); in nv17_tv_create()
827 drm_encoder_init(dev, encoder, &nv17_tv_funcs, DRM_MODE_ENCODER_TVDAC); in nv17_tv_create()
828 drm_encoder_helper_add(encoder, &nv17_tv_helper_funcs); in nv17_tv_create()
829 to_encoder_slave(encoder)->slave_funcs = &nv17_tv_slave_funcs; in nv17_tv_create()
831 encoder->possible_crtcs = entry->heads; in nv17_tv_create()
832 encoder->possible_clones = 0; in nv17_tv_create()
834 nv17_tv_create_resources(encoder, connector); in nv17_tv_create()
835 drm_mode_connector_attach_encoder(connector, encoder); in nv17_tv_create()