On Fri, 03 Jan 2025, Suraj Kandpal <suraj.kandpal@xxxxxxxxx> wrote: > A small optimization and cleanup for mtl_port_buf_ctl_program function > which lets use intel_de_rmw instead of a intel_de_read and > intel_de_write. > > Signed-off-by: Suraj Kandpal <suraj.kandpal@xxxxxxxxx> Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_ddi.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c > index 5e944cae116a..c3c8a1d255a1 100644 > --- a/drivers/gpu/drm/i915/display/intel_ddi.c > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c > @@ -2537,13 +2537,10 @@ static void mtl_port_buf_ctl_program(struct intel_encoder *encoder, > struct intel_display *display = to_intel_display(encoder); > struct intel_digital_port *dig_port = enc_to_dig_port(encoder); > enum port port = encoder->port; > - u32 val; > + u32 val = 0; > > - val = intel_de_read(display, XELPDP_PORT_BUF_CTL1(i915, port)); > - val &= ~XELPDP_PORT_WIDTH_MASK; > val |= XELPDP_PORT_WIDTH(mtl_get_port_width(crtc_state->lane_count)); > > - val &= ~XELPDP_PORT_BUF_PORT_DATA_WIDTH_MASK; > if (intel_dp_is_uhbr(crtc_state)) > val |= XELPDP_PORT_BUF_PORT_DATA_40BIT; > else > @@ -2552,7 +2549,9 @@ static void mtl_port_buf_ctl_program(struct intel_encoder *encoder, > if (dig_port->lane_reversal) > val |= XELPDP_PORT_REVERSAL; > > - intel_de_write(display, XELPDP_PORT_BUF_CTL1(display, port), val); > + intel_de_rmw(display, XELPDP_PORT_BUF_CTL1(display, port), > + XELPDP_PORT_WIDTH_MASK | XELPDP_PORT_BUF_PORT_DATA_WIDTH_MASK, > + val); > } > > static void mtl_port_buf_ctl_io_selection(struct intel_encoder *encoder) -- Jani Nikula, Intel