media: rzg2l-cru: Replace has_stride with stride_align field

RZG2L_CRU_STRIDE_ALIGN hardcodes an alignment only RZ/G3E and RZ/V2H
need, as only they have an AMnIS register.

Store the alignment into rzg2l_cru_info instead: 128 on RZ/G3E, 1 on
RZ/G2L, and update the code accordingly.

No functional change intended.

Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This commit is contained in:
Tommaso Merciai 2026-08-19 12:28:09 +02:00 committed by Sakari Ailus
parent 4bcf502545
commit 3542921bd1
3 changed files with 6 additions and 6 deletions

View File

@ -360,7 +360,7 @@ static const struct rzg2l_cru_info rzg3e_cru_info = {
.max_width = 4095,
.max_height = 4095,
.image_conv = ICnIPMC_C0,
.has_stride = true,
.stride_align = 128,
.regs = rzg3e_cru_regs,
.irq_handler = rzg3e_cru_irq,
.enable_interrupts = rzg3e_cru_enable_interrupts,
@ -405,6 +405,7 @@ static const struct rzg2l_cru_info rzg2l_cru_info = {
.max_width = 2800,
.max_height = 4095,
.image_conv = ICnMC,
.stride_align = 1,
.regs = rzg2l_cru_regs,
.irq_handler = rzg2l_cru_irq,
.enable_interrupts = rzg2l_cru_enable_interrupts,

View File

@ -75,7 +75,7 @@ struct rzg2l_cru_info {
unsigned int max_height;
u16 image_conv;
const u16 *regs;
bool has_stride;
u8 stride_align;
irqreturn_t (*irq_handler)(int irq, void *data);
void (*enable_interrupts)(struct rzg2l_cru_dev *cru);
void (*disable_interrupts)(struct rzg2l_cru_dev *cru);

View File

@ -32,7 +32,6 @@
#define RZG2L_CRU_DEFAULT_COLORSPACE V4L2_COLORSPACE_SRGB
#define RZG2L_CRU_STRIDE_MAX 32640
#define RZG2L_CRU_STRIDE_ALIGN 128
struct rzg2l_cru_buffer {
struct vb2_v4l2_buffer vb;
@ -277,11 +276,11 @@ static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru)
rzg2l_cru_fill_hw_slot(cru, cru->num_buf - 1);
}
if (info->has_stride) {
if (info->stride_align > 1) {
u32 stride = cru->format.bytesperline;
u32 amnis;
stride /= RZG2L_CRU_STRIDE_ALIGN;
stride /= info->stride_align;
amnis = rzg2l_cru_read(cru, AMnIS) & ~AMnIS_IS_MASK;
rzg2l_cru_write(cru, AMnIS, amnis | AMnIS_IS(stride));
}
@ -850,7 +849,7 @@ static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru,
&pix->height, 240, info->max_height, 2, 0);
v4l2_fill_pixfmt_aligned(pix, pix->pixelformat, pix->width, pix->height,
info->has_stride ? RZG2L_CRU_STRIDE_ALIGN : 1);
info->stride_align);
dev_dbg(cru->dev, "Format %ux%u bpl: %u size: %u\n",
pix->width, pix->height, pix->bytesperline, pix->sizeimage);