From 180a49e32be29b0d0b26dcb3ac80fbf9e3b8bd9d Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Tue, 13 Jul 2021 15:05:21 +0100 Subject: gpu: ipu-v3: image-convert: use swap() Use swap() instead of implementing it since it makes code cleaner. Signed-off-by: Salah Triki Link: https://lore.kernel.org/r/20210713140521.GA1873885@pc [p.zabel@pengutronix.de: add "image-convert:" prefix to commit description] Signed-off-by: Philipp Zabel --- drivers/gpu/ipu-v3/ipu-image-convert.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index aa1d4b6d278f..af1612044eef 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -990,7 +990,7 @@ static int calc_tile_offsets_planar(struct ipu_image_convert_ctx *ctx, const struct ipu_image_pixfmt *fmt = image->fmt; unsigned int row, col, tile = 0; u32 H, top, y_stride, uv_stride; - u32 uv_row_off, uv_col_off, uv_off, u_off, v_off, tmp; + u32 uv_row_off, uv_col_off, uv_off, u_off, v_off; u32 y_row_off, y_col_off, y_off; u32 y_size, uv_size; @@ -1021,11 +1021,8 @@ static int calc_tile_offsets_planar(struct ipu_image_convert_ctx *ctx, u_off = y_size - y_off + uv_off; v_off = (fmt->uv_packed) ? 0 : u_off + uv_size; - if (fmt->uv_swapped) { - tmp = u_off; - u_off = v_off; - v_off = tmp; - } + if (fmt->uv_swapped) + swap(u_off, v_off); image->tile[tile].offset = y_off; image->tile[tile].u_off = u_off; -- cgit From 344c50dd4954e4592c0a17784a1b23b92796719f Mon Sep 17 00:00:00 2001 From: Cai Huoqing Date: Tue, 31 Aug 2021 21:55:52 +0800 Subject: drm/imx: imx-tve: Make use of the helper function devm_platform_ioremap_resource() Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource() and devm_ioremap_resource() separately Signed-off-by: Cai Huoqing Link: https://lore.kernel.org/r/20210831135553.4426-1-caihuoqing@baidu.com Signed-off-by: Philipp Zabel --- drivers/gpu/drm/imx/imx-tve.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c index bc8c3f802a15..2b1fdf2cbbce 100644 --- a/drivers/gpu/drm/imx/imx-tve.c +++ b/drivers/gpu/drm/imx/imx-tve.c @@ -526,7 +526,6 @@ static int imx_tve_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct device_node *ddc_node; struct imx_tve *tve; - struct resource *res; void __iomem *base; unsigned int val; int irq; @@ -568,8 +567,7 @@ static int imx_tve_probe(struct platform_device *pdev) } } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - base = devm_ioremap_resource(dev, res); + base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) return PTR_ERR(base); -- cgit From 090fd63d99f26eb0180f4152c7272085b6556886 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Sun, 23 Jan 2022 22:34:17 +0000 Subject: drm/imx: make static read-only array channel_offsets const The static array channel_offsets is read-only so it make sense to make it const. Signed-off-by: Colin Ian King Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20220123223417.6244-1-colin.i.king@gmail.com --- drivers/gpu/ipu-v3/ipu-dc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/ipu-v3/ipu-dc.c b/drivers/gpu/ipu-v3/ipu-dc.c index ca96b235491a..b038a6d7307b 100644 --- a/drivers/gpu/ipu-v3/ipu-dc.c +++ b/drivers/gpu/ipu-v3/ipu-dc.c @@ -344,8 +344,9 @@ int ipu_dc_init(struct ipu_soc *ipu, struct device *dev, unsigned long base, unsigned long template_base) { struct ipu_dc_priv *priv; - static int channel_offsets[] = { 0, 0x1c, 0x38, 0x54, 0x58, 0x5c, - 0x78, 0, 0x94, 0xb4}; + static const int channel_offsets[] = { + 0, 0x1c, 0x38, 0x54, 0x58, 0x5c, 0x78, 0, 0x94, 0xb4 + }; int i; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); -- cgit From aa72b0866a0375d3694dd929a366433b4f5ee2b5 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Mon, 21 Feb 2022 10:59:07 +0100 Subject: drm/imx: ipuv3-plane: Remove redundant zpos initialisation The imx KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane purpose. Since the initial value wasn't carried over in the state, the driver had to set it again in ipu_plane_state_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore. Cc: linux-arm-kernel@lists.infradead.org Cc: NXP Linux Team Cc: Fabio Estevam Cc: Pengutronix Kernel Team Cc: Philipp Zabel Cc: Sascha Hauer Cc: Shawn Guo Signed-off-by: Maxime Ripard Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20220221095918.18763-12-maxime@cerno.tech --- drivers/gpu/drm/imx/ipuv3-plane.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index 846c1aae69c8..414bdf08d0b0 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c @@ -297,7 +297,6 @@ void ipu_plane_disable_deferred(struct drm_plane *plane) static void ipu_plane_state_reset(struct drm_plane *plane) { - unsigned int zpos = (plane->type == DRM_PLANE_TYPE_PRIMARY) ? 0 : 1; struct ipu_plane_state *ipu_state; if (plane->state) { @@ -311,8 +310,6 @@ static void ipu_plane_state_reset(struct drm_plane *plane) if (ipu_state) { __drm_atomic_helper_plane_reset(plane, &ipu_state->base); - ipu_state->base.zpos = zpos; - ipu_state->base.normalized_zpos = zpos; ipu_state->base.color_encoding = DRM_COLOR_YCBCR_BT601; ipu_state->base.color_range = DRM_COLOR_YCBCR_LIMITED_RANGE; } -- cgit From 927d8fd465adbaaad6cce82f840d489d7c378f29 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Mon, 21 Feb 2022 10:59:17 +0100 Subject: drm/imx: ipuv3-plane: Remove redundant color encoding and range initialisation The imx KMS driver will call drm_plane_create_color_properties() with a default encoding and range values of BT601 and Limited Range, respectively. Since the initial value wasn't carried over in the state, the driver had to set it again in ipu_plane_state_reset(). However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore. Cc: linux-arm-kernel@lists.infradead.org Cc: NXP Linux Team Cc: Fabio Estevam Cc: Pengutronix Kernel Team Cc: Philipp Zabel Cc: Sascha Hauer Cc: Shawn Guo Signed-off-by: Maxime Ripard Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20220221095918.18763-22-maxime@cerno.tech --- drivers/gpu/drm/imx/ipuv3-plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index 414bdf08d0b0..36b32e8806e3 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c @@ -308,11 +308,8 @@ static void ipu_plane_state_reset(struct drm_plane *plane) ipu_state = kzalloc(sizeof(*ipu_state), GFP_KERNEL); - if (ipu_state) { + if (ipu_state) __drm_atomic_helper_plane_reset(plane, &ipu_state->base); - ipu_state->base.color_encoding = DRM_COLOR_YCBCR_BT601; - ipu_state->base.color_range = DRM_COLOR_YCBCR_LIMITED_RANGE; - } } static struct drm_plane_state * -- cgit