Describe the rest of register offsets in struct dc_fu { } and
use them throughout the driver. This is a preparatory change
for i.MX95 addition. No functional change.Signed-off-by: Marek Vasut <[email protected]> --- Cc: Abel Vesa <[email protected]> Cc: Conor Dooley <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Laurent Pinchart <[email protected]> Cc: Liu Ying <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Peng Fan <[email protected]> Cc: Pengutronix Kernel Team <[email protected]> Cc: Rob Herring <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] --- drivers/gpu/drm/imx/dc/dc-fl.c | 12 ++++++++---- drivers/gpu/drm/imx/dc/dc-fu.c | 6 +++--- drivers/gpu/drm/imx/dc/dc-fu.h | 4 ++++ drivers/gpu/drm/imx/dc/dc-fw.c | 10 +++++++--- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/imx/dc/dc-fl.c b/drivers/gpu/drm/imx/dc/dc-fl.c index d4e746f8c4297..8571871c6a683 100644 --- a/drivers/gpu/drm/imx/dc/dc-fl.c +++ b/drivers/gpu/drm/imx/dc/dc-fl.c @@ -63,20 +63,20 @@ static void dc_fl_set_fmt(struct dc_fu *fu, enum dc_fu_frac frac, dc_fu_set_src_bpp(fu, frac, format->cpp[0] * 8); - regmap_write_bits(fu->reg_cfg, LAYERPROPERTY(frac), + regmap_write_bits(fu->reg_cfg, fu->reg_layerproperty[frac], YUVCONVERSIONMODE_MASK, YUVCONVERSIONMODE(YUVCONVERSIONMODE_OFF)); dc_fu_get_pixel_format_bits(fu, format->format, &bits); dc_fu_get_pixel_format_shifts(fu, format->format, &shifts); - regmap_write(fu->reg_cfg, COLORCOMPONENTBITS(frac), bits); - regmap_write(fu->reg_cfg, COLORCOMPONENTSHIFT(frac), shifts); + regmap_write(fu->reg_cfg, fu->reg_colorcomponentbits[frac], bits); + regmap_write(fu->reg_cfg, fu->reg_colorcomponentshift[frac], shifts); } static void dc_fl_set_framedimensions(struct dc_fu *fu, int w, int h) { - regmap_write(fu->reg_cfg, FRAMEDIMENSIONS, + regmap_write(fu->reg_cfg, fu->reg_framedimensions, FRAMEWIDTH(w) | FRAMEHEIGHT(h)); } @@ -133,12 +133,16 @@ static int dc_fl_bind(struct device *dev, struct device *master, void *data) fu->reg_baseaddr[i] = BASEADDRESS(i); fu->reg_sourcebufferattributes[i] = SOURCEBUFFERATTRIBUTES(i); fu->reg_sourcebufferdimension[i] = SOURCEBUFFERDIMENSION(i); + fu->reg_colorcomponentbits[i] = COLORCOMPONENTBITS(i); + fu->reg_colorcomponentshift[i] = COLORCOMPONENTSHIFT(i); fu->reg_layeroffset[i] = LAYEROFFSET(i); fu->reg_clipwindowoffset[i] = CLIPWINDOWOFFSET(i); fu->reg_clipwindowdimensions[i] = CLIPWINDOWDIMENSIONS(i); fu->reg_constantcolor[i] = CONSTANTCOLOR(i); fu->reg_layerproperty[i] = LAYERPROPERTY(i); } + fu->reg_burstbuffermanagement = BURSTBUFFERMANAGEMENT; + fu->reg_framedimensions = FRAMEDIMENSIONS; snprintf(fu->name, sizeof(fu->name), "FetchLayer%d", id); dc_fl_set_ops(fu); diff --git a/drivers/gpu/drm/imx/dc/dc-fu.c b/drivers/gpu/drm/imx/dc/dc-fu.c index f94c591c81589..cc8b0d05891fd 100644 --- a/drivers/gpu/drm/imx/dc/dc-fu.c +++ b/drivers/gpu/drm/imx/dc/dc-fu.c @@ -113,13 +113,13 @@ void dc_fu_shdldreq_sticky(struct dc_fu *fu, u8 layer_mask) static inline void dc_fu_set_linemode(struct dc_fu *fu, enum dc_linemode mode) { - regmap_write_bits(fu->reg_cfg, BURSTBUFFERMANAGEMENT, LINEMODE_MASK, + regmap_write_bits(fu->reg_cfg, fu->reg_burstbuffermanagement, LINEMODE_MASK, mode); } static inline void dc_fu_set_numbuffers(struct dc_fu *fu, unsigned int num) { - regmap_write_bits(fu->reg_cfg, BURSTBUFFERMANAGEMENT, + regmap_write_bits(fu->reg_cfg, fu->reg_burstbuffermanagement, SETNUMBUFFERS_MASK, SETNUMBUFFERS(num)); } @@ -132,7 +132,7 @@ static void dc_fu_set_burstlength(struct dc_fu *fu, dma_addr_t baddr) burst_size = min(burst_size, 128U); burst_length = burst_size / 8; - regmap_write_bits(fu->reg_cfg, BURSTBUFFERMANAGEMENT, + regmap_write_bits(fu->reg_cfg, fu->reg_burstbuffermanagement, SETBURSTLENGTH_MASK, SETBURSTLENGTH(burst_length)); } diff --git a/drivers/gpu/drm/imx/dc/dc-fu.h b/drivers/gpu/drm/imx/dc/dc-fu.h index e016e1ea5b4e0..2a330c0abf6a1 100644 --- a/drivers/gpu/drm/imx/dc/dc-fu.h +++ b/drivers/gpu/drm/imx/dc/dc-fu.h @@ -105,11 +105,15 @@ struct dc_fu { u32 reg_baseaddr[DC_FETCHUNIT_FRAC_NUM]; u32 reg_sourcebufferattributes[DC_FETCHUNIT_FRAC_NUM]; u32 reg_sourcebufferdimension[DC_FETCHUNIT_FRAC_NUM]; + u32 reg_colorcomponentbits[DC_FETCHUNIT_FRAC_NUM]; + u32 reg_colorcomponentshift[DC_FETCHUNIT_FRAC_NUM]; u32 reg_layeroffset[DC_FETCHUNIT_FRAC_NUM]; u32 reg_clipwindowoffset[DC_FETCHUNIT_FRAC_NUM]; u32 reg_clipwindowdimensions[DC_FETCHUNIT_FRAC_NUM]; u32 reg_constantcolor[DC_FETCHUNIT_FRAC_NUM]; u32 reg_layerproperty[DC_FETCHUNIT_FRAC_NUM]; + u32 reg_burstbuffermanagement; + u32 reg_framedimensions; unsigned int id; enum dc_link_id link_id; struct dc_fu_ops ops; diff --git a/drivers/gpu/drm/imx/dc/dc-fw.c b/drivers/gpu/drm/imx/dc/dc-fw.c index c1131b7b17c2f..dc036121f0d23 100644 --- a/drivers/gpu/drm/imx/dc/dc-fw.c +++ b/drivers/gpu/drm/imx/dc/dc-fw.c @@ -91,15 +91,15 @@ static void dc_fw_set_fmt(struct dc_fu *fu, enum dc_fu_frac frac, regmap_write_bits(fu->reg_cfg, CONTROL, RASTERMODE_MASK, RASTERMODE(RASTERMODE_NORMAL)); - regmap_write_bits(fu->reg_cfg, LAYERPROPERTY(frac), + regmap_write_bits(fu->reg_cfg, fu->reg_layerproperty[frac], YUVCONVERSIONMODE_MASK, YUVCONVERSIONMODE(YUVCONVERSIONMODE_OFF)); dc_fu_get_pixel_format_bits(fu, format->format, &bits); dc_fu_get_pixel_format_shifts(fu, format->format, &shifts); - regmap_write(fu->reg_cfg, COLORCOMPONENTBITS(frac), bits); - regmap_write(fu->reg_cfg, COLORCOMPONENTSHIFT(frac), shifts); + regmap_write(fu->reg_cfg, fu->reg_colorcomponentbits[frac], bits); + regmap_write(fu->reg_cfg, fu->reg_colorcomponentshift[frac], shifts); } static void dc_fw_set_framedimensions(struct dc_fu *fu, int w, int h) @@ -170,12 +170,16 @@ static int dc_fw_bind(struct device *dev, struct device *master, void *data) fu->reg_baseaddr[i] = BASEADDRESS(i); fu->reg_sourcebufferattributes[i] = SOURCEBUFFERATTRIBUTES(i); fu->reg_sourcebufferdimension[i] = SOURCEBUFFERDIMENSION(i); + fu->reg_colorcomponentbits[i] = COLORCOMPONENTBITS(i); + fu->reg_colorcomponentshift[i] = COLORCOMPONENTSHIFT(i); fu->reg_layeroffset[i] = LAYEROFFSET(i); fu->reg_clipwindowoffset[i] = CLIPWINDOWOFFSET(i); fu->reg_clipwindowdimensions[i] = CLIPWINDOWDIMENSIONS(i); fu->reg_constantcolor[i] = CONSTANTCOLOR(i); fu->reg_layerproperty[i] = LAYERPROPERTY(i); } + fu->reg_burstbuffermanagement = BURSTBUFFERMANAGEMENT; + fu->reg_framedimensions = FRAMEDIMENSIONS; snprintf(fu->name, sizeof(fu->name), "FetchWarp%d", id); dc_fw_set_ops(fu); -- 2.51.0
