Lines Matching full:encoder
46 static uint32_t nv42_tv_sample_load(struct drm_encoder *encoder) in nv42_tv_sample_load() argument
48 struct drm_device *dev = encoder->dev; in nv42_tv_sample_load()
51 uint32_t testval, regoffset = nv04_dac_output_offset(encoder); in nv42_tv_sample_load()
145 nv17_tv_detect(struct drm_encoder *encoder, struct drm_connector *connector) in nv17_tv_detect() argument
147 struct drm_device *dev = encoder->dev; in nv17_tv_detect()
150 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_detect()
154 if (nv04_dac_in_use(encoder)) in nv17_tv_detect()
161 nv42_tv_sample_load(encoder) >> 28 & 0xe; in nv17_tv_detect()
164 nv17_dac_sample_load(encoder) >> 28 & 0xe; in nv17_tv_detect()
201 static int nv17_tv_get_ld_modes(struct drm_encoder *encoder, in nv17_tv_get_ld_modes() argument
204 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_get_ld_modes()
211 mode = drm_mode_duplicate(encoder->dev, tv_mode); in nv17_tv_get_ld_modes()
233 static int nv17_tv_get_hd_modes(struct drm_encoder *encoder, in nv17_tv_get_hd_modes() argument
236 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_get_hd_modes()
262 mode = drm_mode_duplicate(encoder->dev, output_mode); in nv17_tv_get_hd_modes()
268 mode = drm_cvt_mode(encoder->dev, modes[i].hdisplay, in nv17_tv_get_hd_modes()
299 static int nv17_tv_get_modes(struct drm_encoder *encoder, in nv17_tv_get_modes() argument
302 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_get_modes()
305 return nv17_tv_get_hd_modes(encoder, connector); in nv17_tv_get_modes()
307 return nv17_tv_get_ld_modes(encoder, connector); in nv17_tv_get_modes()
310 static int nv17_tv_mode_valid(struct drm_encoder *encoder, in nv17_tv_mode_valid() argument
313 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_mode_valid()
343 /* The encoder takes care of the actual interlacing */ in nv17_tv_mode_valid()
351 static bool nv17_tv_mode_fixup(struct drm_encoder *encoder, in nv17_tv_mode_fixup() argument
355 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_mode_fixup()
357 if (nv04_dac_in_use(encoder)) in nv17_tv_mode_fixup()
368 static void nv17_tv_dpms(struct drm_encoder *encoder, int mode) in nv17_tv_dpms() argument
370 struct drm_device *dev = encoder->dev; in nv17_tv_dpms()
373 struct nv17_tv_state *regs = &to_tv_enc(encoder)->state; in nv17_tv_dpms()
374 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_dpms()
376 if (nouveau_encoder(encoder)->last_dpms == mode) in nv17_tv_dpms()
378 nouveau_encoder(encoder)->last_dpms = mode; in nv17_tv_dpms()
380 NV_INFO(drm, "Setting dpms mode %d on TV encoder (output %d)\n", in nv17_tv_dpms()
381 mode, nouveau_encoder(encoder)->dcb->index); in nv17_tv_dpms()
386 nv04_dfp_update_fp_control(encoder, mode); in nv17_tv_dpms()
389 nv04_dfp_update_fp_control(encoder, DRM_MODE_DPMS_OFF); in nv17_tv_dpms()
400 nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON); in nv17_tv_dpms()
403 static void nv17_tv_prepare(struct drm_encoder *encoder) in nv17_tv_prepare() argument
405 struct drm_device *dev = encoder->dev; in nv17_tv_prepare()
407 const struct drm_encoder_helper_funcs *helper = encoder->helper_private; in nv17_tv_prepare()
408 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_prepare()
409 int head = nouveau_crtc(encoder->crtc)->index; in nv17_tv_prepare()
413 nv04_dac_output_offset(encoder); in nv17_tv_prepare()
416 helper->dpms(encoder, DRM_MODE_DPMS_OFF); in nv17_tv_prepare()
464 static void nv17_tv_mode_set(struct drm_encoder *encoder, in nv17_tv_mode_set() argument
468 struct drm_device *dev = encoder->dev; in nv17_tv_mode_set()
470 int head = nouveau_crtc(encoder->crtc)->index; in nv17_tv_mode_set()
472 struct nv17_tv_state *tv_regs = &to_tv_enc(encoder)->state; in nv17_tv_mode_set()
473 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_mode_set()
530 * parameters for the CTV encoder (It's only used for "HD" TV in nv17_tv_mode_set()
533 * output of the FP encoder, but it also needs the analog in nv17_tv_mode_set()
534 * encoder in its OR enabled and routed to the head it's in nv17_tv_mode_set()
579 static void nv17_tv_commit(struct drm_encoder *encoder) in nv17_tv_commit() argument
581 struct drm_device *dev = encoder->dev; in nv17_tv_commit()
583 struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc); in nv17_tv_commit()
584 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); in nv17_tv_commit()
585 const struct drm_encoder_helper_funcs *helper = encoder->helper_private; in nv17_tv_commit()
587 if (get_tv_norm(encoder)->kind == TV_ENC_MODE) { in nv17_tv_commit()
588 nv17_tv_update_rescaler(encoder); in nv17_tv_commit()
589 nv17_tv_update_properties(encoder); in nv17_tv_commit()
591 nv17_ctv_update_rescaler(encoder); in nv17_tv_commit()
594 nv17_tv_state_load(dev, &to_tv_enc(encoder)->state); in nv17_tv_commit()
599 nv04_dac_output_offset(encoder), in nv17_tv_commit()
603 nv04_dac_output_offset(encoder), in nv17_tv_commit()
606 helper->dpms(encoder, DRM_MODE_DPMS_ON); in nv17_tv_commit()
613 static void nv17_tv_save(struct drm_encoder *encoder) in nv17_tv_save() argument
615 struct drm_device *dev = encoder->dev; in nv17_tv_save()
616 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_save()
618 nouveau_encoder(encoder)->restore.output = in nv17_tv_save()
621 nv04_dac_output_offset(encoder)); in nv17_tv_save()
628 static void nv17_tv_restore(struct drm_encoder *encoder) in nv17_tv_restore() argument
630 struct drm_device *dev = encoder->dev; in nv17_tv_restore()
633 nv04_dac_output_offset(encoder), in nv17_tv_restore()
634 nouveau_encoder(encoder)->restore.output); in nv17_tv_restore()
636 nv17_tv_state_load(dev, &to_tv_enc(encoder)->saved_state); in nv17_tv_restore()
638 nouveau_encoder(encoder)->last_dpms = NV_DPMS_CLEARED; in nv17_tv_restore()
641 static int nv17_tv_create_resources(struct drm_encoder *encoder, in nv17_tv_create_resources() argument
644 struct drm_device *dev = encoder->dev; in nv17_tv_create_resources()
647 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_create_resources()
648 struct dcb_output *dcb = nouveau_encoder(encoder)->dcb; in nv17_tv_create_resources()
690 static int nv17_tv_set_property(struct drm_encoder *encoder, in nv17_tv_set_property() argument
695 struct drm_mode_config *conf = &encoder->dev->mode_config; in nv17_tv_set_property()
696 struct drm_crtc *crtc = encoder->crtc; in nv17_tv_set_property()
697 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_set_property()
698 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); in nv17_tv_set_property()
703 if (encoder->crtc) { in nv17_tv_set_property()
705 nv17_ctv_update_rescaler(encoder); in nv17_tv_set_property()
707 nv17_tv_update_rescaler(encoder); in nv17_tv_set_property()
715 nv17_tv_update_properties(encoder); in nv17_tv_set_property()
722 nv17_tv_update_properties(encoder); in nv17_tv_set_property()
729 if (encoder->crtc) in nv17_tv_set_property()
730 nv17_tv_update_rescaler(encoder); in nv17_tv_set_property()
745 nv17_tv_update_properties(encoder); in nv17_tv_set_property()
765 static void nv17_tv_destroy(struct drm_encoder *encoder) in nv17_tv_destroy() argument
767 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); in nv17_tv_destroy()
769 drm_encoder_cleanup(encoder); in nv17_tv_destroy()
797 struct drm_encoder *encoder; in nv17_tv_create() local
813 encoder = to_drm_encoder(&tv_enc->base); in nv17_tv_create()
818 drm_encoder_init(dev, encoder, &nv17_tv_funcs, DRM_MODE_ENCODER_TVDAC, in nv17_tv_create()
820 drm_encoder_helper_add(encoder, &nv17_tv_helper_funcs); in nv17_tv_create()
821 to_encoder_slave(encoder)->slave_funcs = &nv17_tv_slave_funcs; in nv17_tv_create()
826 encoder->possible_crtcs = entry->heads; in nv17_tv_create()
827 encoder->possible_clones = 0; in nv17_tv_create()
829 nv17_tv_create_resources(encoder, connector); in nv17_tv_create()
830 drm_connector_attach_encoder(connector, encoder); in nv17_tv_create()