mirror of
https://github.com/torvalds/linux.git
synced 2026-10-09 12:06:03 +02:00
media: rzg2l-cru: Refactor ICnDMR register configuration
Refactor the ICnDMR register configuration in `rzg2l_cru_initialize_image_conv()` by adding a new member `icndmr` in the `rzg2l_cru_ip_format` structure. Suggested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20241018133446.223516-21-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
parent
cd559c80dd
commit
c6ed80fd67
|
|
@ -31,6 +31,8 @@
|
|||
#define RZG2L_CRU_MIN_INPUT_HEIGHT 240
|
||||
#define RZG2L_CRU_MAX_INPUT_HEIGHT 4095
|
||||
|
||||
#define ICnDMR_YCMODE_UYVY (1 << 4)
|
||||
|
||||
enum rzg2l_csi2_pads {
|
||||
RZG2L_CRU_IP_SINK = 0,
|
||||
RZG2L_CRU_IP_SOURCE,
|
||||
|
|
@ -67,12 +69,14 @@ struct rzg2l_cru_ip {
|
|||
* @code: Media bus code
|
||||
* @datatype: MIPI CSI2 data type
|
||||
* @format: 4CC format identifier (V4L2_PIX_FMT_*)
|
||||
* @icndmr: ICnDMR register value
|
||||
* @bpp: bytes per pixel
|
||||
*/
|
||||
struct rzg2l_cru_ip_format {
|
||||
u32 code;
|
||||
u32 datatype;
|
||||
u32 format;
|
||||
u32 icndmr;
|
||||
u8 bpp;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
|
|||
.datatype = MIPI_CSI2_DT_YUV422_8B,
|
||||
.format = V4L2_PIX_FMT_UYVY,
|
||||
.bpp = 2,
|
||||
.icndmr = ICnDMR_YCMODE_UYVY,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@
|
|||
|
||||
/* CRU Data Output Mode Register */
|
||||
#define ICnDMR 0x26c
|
||||
#define ICnDMR_YCMODE_UYVY (1 << 4)
|
||||
|
||||
#define RZG2L_TIMEOUT_MS 100
|
||||
#define RZG2L_RETRIES 10
|
||||
|
|
@ -279,18 +278,15 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru,
|
|||
u8 csi_vc)
|
||||
{
|
||||
const struct v4l2_format_info *src_finfo, *dst_finfo;
|
||||
const struct rzg2l_cru_ip_format *cru_video_fmt;
|
||||
const struct rzg2l_cru_ip_format *cru_ip_fmt;
|
||||
u32 icndmr;
|
||||
|
||||
cru_ip_fmt = rzg2l_cru_ip_code_to_fmt(ip_sd_fmt->code);
|
||||
rzg2l_cru_csi2_setup(cru, cru_ip_fmt, csi_vc);
|
||||
|
||||
/* Output format */
|
||||
switch (cru->format.pixelformat) {
|
||||
case V4L2_PIX_FMT_UYVY:
|
||||
icndmr = ICnDMR_YCMODE_UYVY;
|
||||
break;
|
||||
default:
|
||||
cru_video_fmt = rzg2l_cru_ip_format_to_fmt(cru->format.pixelformat);
|
||||
if (!cru_video_fmt) {
|
||||
dev_err(cru->dev, "Invalid pixelformat (0x%x)\n",
|
||||
cru->format.pixelformat);
|
||||
return -EINVAL;
|
||||
|
|
@ -308,7 +304,7 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru,
|
|||
rzg2l_cru_read(cru, ICnMC) & (~ICnMC_CSCTHR));
|
||||
|
||||
/* Set output data format */
|
||||
rzg2l_cru_write(cru, ICnDMR, icndmr);
|
||||
rzg2l_cru_write(cru, ICnDMR, cru_video_fmt->icndmr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user