Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d95e7ed authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab
Browse files

media: v4l: mediabus: Recognise CSI-2 D-PHY and C-PHY



The CSI-2 bus may use either D-PHY or C-PHY. Make this visible in media
bus enum.

Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: default avatarSteve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: default avatarJacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent bf63856a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code,
	case MEDIA_BUS_FMT_BGR565_2X8_LE:
	case MEDIA_BUS_FMT_RGB565_2X8_BE:
	case MEDIA_BUS_FMT_RGB565_2X8_LE:
		if (mbus_type == V4L2_MBUS_CSI2)
		if (mbus_type == V4L2_MBUS_CSI2_DPHY)
			cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_RGB565;
		else
			cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER;
@@ -359,7 +359,7 @@ static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
		else
			csicfg->clk_mode = IPU_CSI_CLK_MODE_CCIR656_PROGRESSIVE;
		break;
	case V4L2_MBUS_CSI2:
	case V4L2_MBUS_CSI2_DPHY:
		/*
		 * MIPI CSI-2 requires non gated clock mode, all other
		 * parameters are not applicable for MIPI CSI-2 bus.
@@ -611,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, V4L2_MBUS_CSI2);
	ret = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code, V4L2_MBUS_CSI2_DPHY);
	if (ret < 0)
		return ret;

+1 −1
Original line number Diff line number Diff line
@@ -752,7 +752,7 @@ static int adv7180_g_mbus_config(struct v4l2_subdev *sd,
	struct adv7180_state *state = to_state(sd);

	if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) {
		cfg->type = V4L2_MBUS_CSI2;
		cfg->type = V4L2_MBUS_CSI2_DPHY;
		cfg->flags = V4L2_MBUS_CSI2_1_LANE |
				V4L2_MBUS_CSI2_CHANNEL_0 |
				V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
+3 −3
Original line number Diff line number Diff line
@@ -1820,7 +1820,7 @@ static int ov5640_set_power(struct ov5640_dev *sensor, bool on)
			goto power_off;

		/* We're done here for DVP bus, while CSI-2 needs setup. */
		if (sensor->ep.bus_type != V4L2_MBUS_CSI2)
		if (sensor->ep.bus_type != V4L2_MBUS_CSI2_DPHY)
			return 0;

		/*
@@ -1867,7 +1867,7 @@ static int ov5640_set_power(struct ov5640_dev *sensor, bool on)
		usleep_range(500, 1000);

	} else {
		if (sensor->ep.bus_type == V4L2_MBUS_CSI2) {
		if (sensor->ep.bus_type == V4L2_MBUS_CSI2_DPHY) {
			/* Reset MIPI bus settings to their default values. */
			ov5640_write_reg(sensor,
					 OV5640_REG_IO_MIPI_CTRL00, 0x58);
@@ -2625,7 +2625,7 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable)
			sensor->pending_fmt_change = false;
		}

		if (sensor->ep.bus_type == V4L2_MBUS_CSI2)
		if (sensor->ep.bus_type == V4L2_MBUS_CSI2_DPHY)
			ret = ov5640_set_stream_mipi(sensor, enable);
		else
			ret = ov5640_set_stream_dvp(sensor, enable);
+1 −1
Original line number Diff line number Diff line
@@ -1127,7 +1127,7 @@ static int ov5645_probe(struct i2c_client *client,
		return ret;
	}

	if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) {
	if (ov5645->ep.bus_type != V4L2_MBUS_CSI2_DPHY) {
		dev_err(dev, "invalid bus type, must be CSI2\n");
		return -EINVAL;
	}
+2 −2
Original line number Diff line number Diff line
@@ -1279,9 +1279,9 @@ static int ov7251_probe(struct i2c_client *client)
		return ret;
	}

	if (ov7251->ep.bus_type != V4L2_MBUS_CSI2) {
	if (ov7251->ep.bus_type != V4L2_MBUS_CSI2_DPHY) {
		dev_err(dev, "invalid bus type (%u), must be CSI2 (%u)\n",
			ov7251->ep.bus_type, V4L2_MBUS_CSI2);
			ov7251->ep.bus_type, V4L2_MBUS_CSI2_DPHY);
		return -EINVAL;
	}

Loading