Message ID | 20220728-rpi-analog-tv-properties-v2-27-459522d653a7@cerno.tech (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: Analog TV Improvements | expand |
Den 29.08.2022 15.11, skrev Maxime Ripard: > From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com> > > > > Let's remove the superfluous tv_mode field, which was redundant with the > > mode field in struct drm_tv_connector_state. > > > > Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com> > > Signed-off-by: Maxime Ripard <maxime@cerno.tech> > > > > diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c > > index 9a37c3fcc295..4d7bc7c20704 100644 > > --- a/drivers/gpu/drm/vc4/vc4_vec.c > > +++ b/drivers/gpu/drm/vc4/vc4_vec.c > > @@ -171,8 +171,6 @@ struct vc4_vec { > > > > struct clk *clock; > > > > - const struct vc4_vec_tv_mode *tv_mode; > > - > > struct debugfs_regset32 regset; > > }; > > > > @@ -316,7 +314,6 @@ static int vc4_vec_connector_init(struct drm_device *dev, struct vc4_vec *vec) > > drm_object_attach_property(&connector->base, > > dev->mode_config.legacy_tv_mode_property, > > VC4_VEC_TV_MODE_NTSC); > > - vec->tv_mode = &vc4_vec_tv_modes[VC4_VEC_TV_MODE_NTSC]; > > > > drm_connector_attach_encoder(connector, &vec->encoder.base); > > > > @@ -360,6 +357,11 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, > > { > > struct drm_device *drm = encoder->dev; > > struct vc4_vec *vec = encoder_to_vc4_vec(encoder); > > + struct drm_connector *connector = &vec->connector; > > + struct drm_connector_state *conn_state = > > + drm_atomic_get_new_connector_state(state, connector); > > + const struct vc4_vec_tv_mode *tv_mode = > > + &vc4_vec_tv_modes[conn_state->tv.mode]; > > int idx, ret; > > > > if (!drm_dev_enter(drm, &idx)) > > @@ -418,15 +420,14 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, > > /* Mask all interrupts. */ > > VEC_WRITE(VEC_MASK0, 0); > > > > - VEC_WRITE(VEC_CONFIG0, vec->tv_mode->config0); > > - VEC_WRITE(VEC_CONFIG1, vec->tv_mode->config1); > > + VEC_WRITE(VEC_CONFIG0, tv_mode->config0); > > + VEC_WRITE(VEC_CONFIG1, tv_mode->config1); > > > > - if (vec->tv_mode->custom_freq != 0) { > > + if (tv_mode->custom_freq != 0) { > > VEC_WRITE(VEC_FREQ3_2, > > - (vec->tv_mode->custom_freq >> 16) & > > - 0xffff); > > + (tv_mode->custom_freq >> 16) & 0xffff); > > VEC_WRITE(VEC_FREQ1_0, > > - vec->tv_mode->custom_freq & 0xffff); > > + tv_mode->custom_freq & 0xffff); > Nit: This patch will be smaller if you add the tv_mode variable to the previous patch. Reviewed-by: Noralf Trønnes <noralf@tronnes.org> > } > > > > VEC_WRITE(VEC_DAC_MISC, > > @@ -442,15 +443,6 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, > > drm_dev_exit(idx); > > } > > > > -static void vc4_vec_encoder_atomic_mode_set(struct drm_encoder *encoder, > > - struct drm_crtc_state *crtc_state, > > - struct drm_connector_state *conn_state) > > -{ > > - struct vc4_vec *vec = encoder_to_vc4_vec(encoder); > > - > > - vec->tv_mode = &vc4_vec_tv_modes[conn_state->tv.mode]; > > -} > > - > > static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder, > > struct drm_crtc_state *crtc_state, > > struct drm_connector_state *conn_state) > > @@ -470,7 +462,6 @@ static const struct drm_encoder_helper_funcs vc4_vec_encoder_helper_funcs = { > > .atomic_check = vc4_vec_encoder_atomic_check, > > .atomic_disable = vc4_vec_encoder_disable, > > .atomic_enable = vc4_vec_encoder_enable, > > - .atomic_mode_set = vc4_vec_encoder_atomic_mode_set, > > }; > > > > static int vc4_vec_late_register(struct drm_encoder *encoder) > > >
On Mon, 29 Aug 2022 15:11:41 +0200, Maxime Ripard wrote: > From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com> > > Let's remove the superfluous tv_mode field, which was redundant with the > mode field in struct drm_tv_connector_state. > > Applied to drm/drm-misc (drm-misc-next). Thanks! Maxime
diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 9a37c3fcc295..4d7bc7c20704 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -171,8 +171,6 @@ struct vc4_vec { struct clk *clock; - const struct vc4_vec_tv_mode *tv_mode; - struct debugfs_regset32 regset; }; @@ -316,7 +314,6 @@ static int vc4_vec_connector_init(struct drm_device *dev, struct vc4_vec *vec) drm_object_attach_property(&connector->base, dev->mode_config.legacy_tv_mode_property, VC4_VEC_TV_MODE_NTSC); - vec->tv_mode = &vc4_vec_tv_modes[VC4_VEC_TV_MODE_NTSC]; drm_connector_attach_encoder(connector, &vec->encoder.base); @@ -360,6 +357,11 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, { struct drm_device *drm = encoder->dev; struct vc4_vec *vec = encoder_to_vc4_vec(encoder); + struct drm_connector *connector = &vec->connector; + struct drm_connector_state *conn_state = + drm_atomic_get_new_connector_state(state, connector); + const struct vc4_vec_tv_mode *tv_mode = + &vc4_vec_tv_modes[conn_state->tv.mode]; int idx, ret; if (!drm_dev_enter(drm, &idx)) @@ -418,15 +420,14 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, /* Mask all interrupts. */ VEC_WRITE(VEC_MASK0, 0); - VEC_WRITE(VEC_CONFIG0, vec->tv_mode->config0); - VEC_WRITE(VEC_CONFIG1, vec->tv_mode->config1); + VEC_WRITE(VEC_CONFIG0, tv_mode->config0); + VEC_WRITE(VEC_CONFIG1, tv_mode->config1); - if (vec->tv_mode->custom_freq != 0) { + if (tv_mode->custom_freq != 0) { VEC_WRITE(VEC_FREQ3_2, - (vec->tv_mode->custom_freq >> 16) & - 0xffff); + (tv_mode->custom_freq >> 16) & 0xffff); VEC_WRITE(VEC_FREQ1_0, - vec->tv_mode->custom_freq & 0xffff); + tv_mode->custom_freq & 0xffff); } VEC_WRITE(VEC_DAC_MISC, @@ -442,15 +443,6 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, drm_dev_exit(idx); } -static void vc4_vec_encoder_atomic_mode_set(struct drm_encoder *encoder, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) -{ - struct vc4_vec *vec = encoder_to_vc4_vec(encoder); - - vec->tv_mode = &vc4_vec_tv_modes[conn_state->tv.mode]; -} - static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) @@ -470,7 +462,6 @@ static const struct drm_encoder_helper_funcs vc4_vec_encoder_helper_funcs = { .atomic_check = vc4_vec_encoder_atomic_check, .atomic_disable = vc4_vec_encoder_disable, .atomic_enable = vc4_vec_encoder_enable, - .atomic_mode_set = vc4_vec_encoder_atomic_mode_set, }; static int vc4_vec_late_register(struct drm_encoder *encoder)