drm/imx: various cleanups

- Use swap() instead of open-coding in ipu-image-convert.
 - Use devm_platform_ioremap_resource() helper in imx-tve.
 - Make static channel_offsets array const in ipu-dc.
 - Remove redundant zpos, color encoding and range initialization.
 -----BEGIN PGP SIGNATURE-----
 
 iI0EABYIADUWIQRRO6F6WdpH1R0vGibVhaclGDdiwAUCYnKREBcccC56YWJlbEBw
 ZW5ndXRyb25peC5kZQAKCRDVhaclGDdiwM1jAP98WGj68Z7KaMjnNwZAU4bbkjSP
 jovzuFviqvJVjS9jcgEAipvfXp8KVXhLDE6kTMfnHsIkvH+VwPf+0JdHooHxPwE=
 =UyNM
 -----END PGP SIGNATURE-----

Merge tag 'imx-drm-next-2022-05-04' of git://git.pengutronix.de/pza/linux into drm-next

drm/imx: various cleanups

- Use swap() instead of open-coding in ipu-image-convert.
- Use devm_platform_ioremap_resource() helper in imx-tve.
- Make static channel_offsets array const in ipu-dc.
- Remove redundant zpos, color encoding and range initialization.

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220504144628.3954620-1-p.zabel@pengutronix.de
This commit is contained in:
Dave Airlie 2022-05-06 15:07:07 +10:00
commit 97ab530870
4 changed files with 8 additions and 18 deletions

View File

@ -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);

View File

@ -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) {
@ -309,13 +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.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;
}
}
static struct drm_plane_state *

View File

@ -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);

View File

@ -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;