Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: rzg2l-cru: Drop function pointer to configure CSI

Drop function pointer to configure CSI to avoid code duplication
by checking the presence of vc select register in rzg2l_cru_info.
After this change, limit the scope of the rzg2l_cru_csi2_setup()
to static.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Biju Das and committed by
Hans Verkuil
3c5ca0a4 6b4d0531

+9 -32
-2
drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
··· 367 367 .enable_interrupts = rzg3e_cru_enable_interrupts, 368 368 .disable_interrupts = rzg3e_cru_disable_interrupts, 369 369 .fifo_empty = rzg3e_fifo_empty, 370 - .csi_setup = rzg3e_cru_csi2_setup, 371 370 }; 372 371 373 372 static const u16 rzg2l_cru_regs[] = { ··· 411 412 .enable_interrupts = rzg2l_cru_enable_interrupts, 412 413 .disable_interrupts = rzg2l_cru_disable_interrupts, 413 414 .fifo_empty = rzg2l_fifo_empty, 414 - .csi_setup = rzg2l_cru_csi2_setup, 415 415 }; 416 416 417 417 static const struct of_device_id rzg2l_cru_of_id_table[] = {
-9
drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
··· 92 92 void (*enable_interrupts)(struct rzg2l_cru_dev *cru); 93 93 void (*disable_interrupts)(struct rzg2l_cru_dev *cru); 94 94 bool (*fifo_empty)(struct rzg2l_cru_dev *cru); 95 - void (*csi_setup)(struct rzg2l_cru_dev *cru, 96 - const struct rzg2l_cru_ip_format *ip_fmt, 97 - u8 csi_vc); 98 95 }; 99 96 100 97 /** ··· 201 204 202 205 bool rzg2l_fifo_empty(struct rzg2l_cru_dev *cru); 203 206 bool rzg3e_fifo_empty(struct rzg2l_cru_dev *cru); 204 - void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, 205 - const struct rzg2l_cru_ip_format *ip_fmt, 206 - u8 csi_vc); 207 - void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru, 208 - const struct rzg2l_cru_ip_format *ip_fmt, 209 - u8 csi_vc); 210 207 211 208 #endif
+9 -21
drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
··· 257 257 rzg2l_cru_write(cru, AMnAXIATTR, amnaxiattr); 258 258 } 259 259 260 - void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru, 261 - const struct rzg2l_cru_ip_format *ip_fmt, 262 - u8 csi_vc) 260 + static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, 261 + const struct rzg2l_cru_ip_format *ip_fmt, 262 + u8 csi_vc) 263 263 { 264 264 const struct rzg2l_cru_info *info = cru->info; 265 265 u32 icnmc = ICnMC_INF(ip_fmt->datatype); 266 266 267 - icnmc |= rzg2l_cru_read(cru, info->image_conv) & ~ICnMC_INF_MASK; 268 - 269 - /* Set virtual channel CSI2 */ 270 - icnmc |= ICnMC_VCSEL(csi_vc); 271 - 272 - rzg2l_cru_write(cru, ICnSVCNUM, csi_vc); 273 - rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) | 274 - ICnSVC_SVC2(2) | ICnSVC_SVC3(3)); 275 - rzg2l_cru_write(cru, info->image_conv, icnmc); 276 - } 277 - 278 - void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, 279 - const struct rzg2l_cru_ip_format *ip_fmt, 280 - u8 csi_vc) 281 - { 282 - const struct rzg2l_cru_info *info = cru->info; 283 - u32 icnmc = ICnMC_INF(ip_fmt->datatype); 267 + if (cru->info->regs[ICnSVC]) { 268 + rzg2l_cru_write(cru, ICnSVCNUM, csi_vc); 269 + rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) | 270 + ICnSVC_SVC2(2) | ICnSVC_SVC3(3)); 271 + } 284 272 285 273 icnmc |= rzg2l_cru_read(cru, info->image_conv) & ~ICnMC_INF_MASK; 286 274 ··· 287 299 const struct rzg2l_cru_ip_format *cru_ip_fmt; 288 300 289 301 cru_ip_fmt = rzg2l_cru_ip_code_to_fmt(ip_sd_fmt->code); 290 - info->csi_setup(cru, cru_ip_fmt, csi_vc); 302 + rzg2l_cru_csi2_setup(cru, cru_ip_fmt, csi_vc); 291 303 292 304 /* Output format */ 293 305 cru_video_fmt = rzg2l_cru_ip_format_to_fmt(cru->format.pixelformat);