[media] s5p-fimc: Derive camera bus width from mediabus pixelcode
Remove bus_width from s5p_fimc_isp_info data structure. Determine camera data bus width based on mediabus pixel format. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
df7e09a351
commit
3d0ce7ed03
@@ -561,37 +561,42 @@ int fimc_hw_set_camera_source(struct fimc_dev *fimc,
|
|||||||
{
|
{
|
||||||
struct fimc_frame *f = &fimc->vid_cap.ctx->s_frame;
|
struct fimc_frame *f = &fimc->vid_cap.ctx->s_frame;
|
||||||
u32 cfg = 0;
|
u32 cfg = 0;
|
||||||
|
u32 bus_width;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
u32 pixelcode;
|
||||||
|
u32 cisrcfmt;
|
||||||
|
u16 bus_width;
|
||||||
|
} pix_desc[] = {
|
||||||
|
{ V4L2_MBUS_FMT_YUYV8_2X8, S5P_CISRCFMT_ORDER422_YCBYCR, 8 },
|
||||||
|
{ V4L2_MBUS_FMT_YVYU8_2X8, S5P_CISRCFMT_ORDER422_YCRYCB, 8 },
|
||||||
|
{ V4L2_MBUS_FMT_VYUY8_2X8, S5P_CISRCFMT_ORDER422_CRYCBY, 8 },
|
||||||
|
{ V4L2_MBUS_FMT_UYVY8_2X8, S5P_CISRCFMT_ORDER422_CBYCRY, 8 },
|
||||||
|
/* TODO: Add pixel codes for 16-bit bus width */
|
||||||
|
};
|
||||||
|
|
||||||
if (cam->bus_type == FIMC_ITU_601 || cam->bus_type == FIMC_ITU_656) {
|
if (cam->bus_type == FIMC_ITU_601 || cam->bus_type == FIMC_ITU_656) {
|
||||||
|
for (i = 0; i < ARRAY_SIZE(pix_desc); i++) {
|
||||||
|
if (fimc->vid_cap.fmt.code == pix_desc[i].pixelcode) {
|
||||||
|
cfg = pix_desc[i].cisrcfmt;
|
||||||
|
bus_width = pix_desc[i].bus_width;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (fimc->vid_cap.fmt.code) {
|
if (i == ARRAY_SIZE(pix_desc)) {
|
||||||
case V4L2_MBUS_FMT_YUYV8_2X8:
|
v4l2_err(&fimc->vid_cap.v4l2_dev,
|
||||||
cfg = S5P_CISRCFMT_ORDER422_YCBYCR;
|
"Camera color format not supported: %d\n",
|
||||||
break;
|
fimc->vid_cap.fmt.code);
|
||||||
case V4L2_MBUS_FMT_YVYU8_2X8:
|
|
||||||
cfg = S5P_CISRCFMT_ORDER422_YCRYCB;
|
|
||||||
break;
|
|
||||||
case V4L2_MBUS_FMT_VYUY8_2X8:
|
|
||||||
cfg = S5P_CISRCFMT_ORDER422_CRYCBY;
|
|
||||||
break;
|
|
||||||
case V4L2_MBUS_FMT_UYVY8_2X8:
|
|
||||||
cfg = S5P_CISRCFMT_ORDER422_CBYCRY;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
err("camera image format not supported: %d",
|
|
||||||
fimc->vid_cap.fmt.code);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cam->bus_type == FIMC_ITU_601) {
|
if (cam->bus_type == FIMC_ITU_601) {
|
||||||
if (cam->bus_width == 8) {
|
if (bus_width == 8)
|
||||||
cfg |= S5P_CISRCFMT_ITU601_8BIT;
|
cfg |= S5P_CISRCFMT_ITU601_8BIT;
|
||||||
} else if (cam->bus_width == 16) {
|
else if (bus_width == 16)
|
||||||
cfg |= S5P_CISRCFMT_ITU601_16BIT;
|
cfg |= S5P_CISRCFMT_ITU601_16BIT;
|
||||||
} else {
|
|
||||||
err("invalid bus width: %d", cam->bus_width);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
} /* else defaults to ITU-R BT.656 8-bit */
|
} /* else defaults to ITU-R BT.656 8-bit */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,7 +34,6 @@ struct i2c_board_info;
|
|||||||
* @bus_type: determines bus type, MIPI, ITU-R BT.601 etc.
|
* @bus_type: determines bus type, MIPI, ITU-R BT.601 etc.
|
||||||
* @i2c_bus_num: i2c control bus id the sensor is attached to
|
* @i2c_bus_num: i2c control bus id the sensor is attached to
|
||||||
* @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
|
* @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
|
||||||
* @bus_width: camera data bus width in bits
|
|
||||||
* @flags: flags defining bus signals polarity inversion (High by default)
|
* @flags: flags defining bus signals polarity inversion (High by default)
|
||||||
*/
|
*/
|
||||||
struct s5p_fimc_isp_info {
|
struct s5p_fimc_isp_info {
|
||||||
@@ -42,7 +41,6 @@ struct s5p_fimc_isp_info {
|
|||||||
enum cam_bus_type bus_type;
|
enum cam_bus_type bus_type;
|
||||||
u16 i2c_bus_num;
|
u16 i2c_bus_num;
|
||||||
u16 mux_id;
|
u16 mux_id;
|
||||||
u16 bus_width;
|
|
||||||
u16 flags;
|
u16 flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user