summaryrefslogtreecommitdiff
path: root/drivers/gpu/ipu-v3/ipu-csi.c
diff options
context:
space:
mode:
authorJan Luebbe <jlu@pengutronix.de>2018-05-03 19:29:37 +0300
committerPhilipp Zabel <p.zabel@pengutronix.de>2018-07-16 17:56:37 +0300
commit1e6a1495c66947b289de9ba92b569b62ce68a979 (patch)
tree1c278cab16a8990e6946c8dd5071a55c42978771 /drivers/gpu/ipu-v3/ipu-csi.c
parentd36d0e6309dd8137cf438cbb680e72eb63c81425 (diff)
downloadlinux-1e6a1495c66947b289de9ba92b569b62ce68a979.tar.xz
gpu: ipu-v3: csi: support RGB565 on parallel bus
The CSI_SENS_CONF_DATA_FMT_RGB565 configuration only works for MIPI CSI-2 sources. On the parallel bus, we need to use bayer (generic) mode instead. To handle this difference, we pass the mbus_type to mbus_code_to_bus_cfg(). Signed-off-by: Jan Luebbe <jlu@pengutronix.de> [p.zabel@pengutronix.de - renamed rc to ret for consistency] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/gpu/ipu-v3/ipu-csi.c')
-rw-r--r--drivers/gpu/ipu-v3/ipu-csi.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
index 27262748a549..954eefe144e2 100644
--- a/drivers/gpu/ipu-v3/ipu-csi.c
+++ b/drivers/gpu/ipu-v3/ipu-csi.c
@@ -224,14 +224,18 @@ static int ipu_csi_set_testgen_mclk(struct ipu_csi *csi, u32 pixel_clk,
* Find the CSI data format and data width for the given V4L2 media
* bus pixel format code.
*/
-static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code)
+static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code,
+ enum v4l2_mbus_type mbus_type)
{
switch (mbus_code) {
case MEDIA_BUS_FMT_BGR565_2X8_BE:
case MEDIA_BUS_FMT_BGR565_2X8_LE:
case MEDIA_BUS_FMT_RGB565_2X8_BE:
case MEDIA_BUS_FMT_RGB565_2X8_LE:
- cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_RGB565;
+ if (mbus_type == V4L2_MBUS_CSI2)
+ cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_RGB565;
+ else
+ cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER;
cfg->mipi_dt = MIPI_DT_RGB565;
cfg->data_width = IPU_CSI_DATA_WIDTH_8;
break;
@@ -332,7 +336,7 @@ static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
memset(csicfg, 0, sizeof(*csicfg));
- ret = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
+ ret = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code, mbus_cfg->type);
if (ret < 0)
return ret;
@@ -607,7 +611,7 @@ int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc,
if (vc > 3)
return -EINVAL;
- ret = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
+ ret = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code, V4L2_MBUS_CSI2);
if (ret < 0)
return ret;