]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: v4l: mediabus: Recognise CSI-2 D-PHY and C-PHY
authorSakari Ailus <sakari.ailus@linux.intel.com>
Tue, 3 Jul 2018 21:19:27 +0000 (17:19 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 4 Oct 2018 20:06:15 +0000 (16:06 -0400)
The CSI-2 bus may use either D-PHY or C-PHY. Make this visible in media
bus enum.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
27 files changed:
drivers/gpu/ipu-v3/ipu-csi.c
drivers/media/i2c/adv7180.c
drivers/media/i2c/ov5640.c
drivers/media/i2c/ov5645.c
drivers/media/i2c/ov7251.c
drivers/media/i2c/s5c73m3/s5c73m3-core.c
drivers/media/i2c/s5k5baf.c
drivers/media/i2c/s5k6aa.c
drivers/media/i2c/smiapp/smiapp-core.c
drivers/media/i2c/soc_camera/ov5642.c
drivers/media/i2c/tc358743.c
drivers/media/pci/intel/ipu3/ipu3-cio2.c
drivers/media/platform/cadence/cdns-csi2rx.c
drivers/media/platform/cadence/cdns-csi2tx.c
drivers/media/platform/marvell-ccic/mcam-core.c
drivers/media/platform/marvell-ccic/mmp-driver.c
drivers/media/platform/omap3isp/isp.c
drivers/media/platform/pxa_camera.c
drivers/media/platform/rcar-vin/rcar-csi2.c
drivers/media/platform/soc_camera/soc_mediabus.c
drivers/media/platform/stm32/stm32-dcmi.c
drivers/media/platform/ti-vpe/cal.c
drivers/media/v4l2-core/v4l2-fwnode.c
drivers/staging/media/imx/imx-media-csi.c
drivers/staging/media/imx/imx6-mipi-csi2.c
drivers/staging/media/imx074/imx074.c
include/media/v4l2-mediabus.h

index 954eefe144e2d49764f9b345b2045738804c0e85..aa0e30a2ba18262573bc346f46bf2c5177812fd0 100644 (file)
@@ -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;
 
index 5a10ce31a1bd88146c06834fda5187813dd89573..99697baad2ea09d27f9b497def2d2226bfa2fb34 100644 (file)
@@ -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;
index 664ffacc8d66af6ef80ae8bd1bf3330336b29ddd..73a4bd7c0291ba8c7c4740367b5f0c7f02f66e56 100644 (file)
@@ -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);
index 1722cdab0daf2ae1b4a7c444ddb29cc48be5d3f0..5eba8dd7222bc5f405f5433e8f81aff6ea204000 100644 (file)
@@ -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;
        }
index d3ebb7529fca9e6b181e0365ce4efed903426cae..0c10203f822b128569811fb2dfe698ace925ff6b 100644 (file)
@@ -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;
        }
 
index c4145194251f83e8d6aa34d9b5a5b1ac7eb7e8b6..ed7348a8a01a0d888140175d6ccd39ce9c45b12f 100644 (file)
@@ -1644,7 +1644,7 @@ static int s5c73m3_get_platform_data(struct s5c73m3 *state)
        if (ret)
                return ret;
 
-       if (ep.bus_type != V4L2_MBUS_CSI2) {
+       if (ep.bus_type != V4L2_MBUS_CSI2_DPHY) {
                dev_err(dev, "unsupported bus type\n");
                return -EINVAL;
        }
index 5007c9659342dbbd2b2e96c00453bf77163ee0ab..4c41a770b132dd75f8fae6c94367904bec98d4ad 100644 (file)
@@ -766,7 +766,7 @@ static int s5k5baf_hw_set_video_bus(struct s5k5baf *state)
 {
        u16 en_pkts;
 
-       if (state->bus_type == V4L2_MBUS_CSI2)
+       if (state->bus_type == V4L2_MBUS_CSI2_DPHY)
                en_pkts = EN_PACKETS_CSI2;
        else
                en_pkts = 0;
@@ -1875,7 +1875,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf *state, struct device *dev)
        state->bus_type = ep.bus_type;
 
        switch (state->bus_type) {
-       case V4L2_MBUS_CSI2:
+       case V4L2_MBUS_CSI2_DPHY:
                state->nlanes = ep.bus.mipi_csi2.num_data_lanes;
                break;
        case V4L2_MBUS_PARALLEL:
index 63cf8db82e7df772e449c2ab53a229708609b956..ab26f549d716de3a930a9d7db82f4ac3a715db3c 100644 (file)
@@ -688,7 +688,7 @@ static int s5k6aa_configure_video_bus(struct s5k6aa *s5k6aa,
         * but there is nothing indicating how to switch between both
         * in the datasheet. For now default BT.601 interface is assumed.
         */
-       if (bus_type == V4L2_MBUS_CSI2)
+       if (bus_type == V4L2_MBUS_CSI2_DPHY)
                cfg = nlanes;
        else if (bus_type != V4L2_MBUS_PARALLEL)
                return -EINVAL;
index bccbf4c841d6e2729554faa8cbf08aaab31ef0d9..69495c6dc228d4b3435d3c1bc0b6a10e664ce9bf 100644 (file)
@@ -2780,7 +2780,7 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
                goto out_err;
 
        switch (bus_cfg->bus_type) {
-       case V4L2_MBUS_CSI2:
+       case V4L2_MBUS_CSI2_DPHY:
                hwcfg->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2;
                hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes;
                break;
index c6c41b03c0ef385e1ee5bf7a13de5a94685c8387..0931898c79dd3f10eccdcbb39dec21cb4c632d16 100644 (file)
@@ -912,7 +912,7 @@ static int ov5642_get_selection(struct v4l2_subdev *sd,
 static int ov5642_g_mbus_config(struct v4l2_subdev *sd,
                                struct v4l2_mbus_config *cfg)
 {
-       cfg->type = V4L2_MBUS_CSI2;
+       cfg->type = V4L2_MBUS_CSI2_DPHY;
        cfg->flags = V4L2_MBUS_CSI2_2_LANE | V4L2_MBUS_CSI2_CHANNEL_0 |
                                        V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
 
index 74159153dfadb9e49bfe0bb3426cd9183c9f7e1d..0834f254f1c21fa2a3108ceaca5bd47c7a3a7a05 100644 (file)
@@ -1607,7 +1607,7 @@ static int tc358743_g_mbus_config(struct v4l2_subdev *sd,
 {
        struct tc358743_state *state = to_state(sd);
 
-       cfg->type = V4L2_MBUS_CSI2;
+       cfg->type = V4L2_MBUS_CSI2_DPHY;
 
        /* Support for non-continuous CSI-2 clock is missing in the driver */
        cfg->flags = V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
@@ -1922,7 +1922,7 @@ static int tc358743_probe_of(struct tc358743_state *state)
                goto put_node;
        }
 
-       if (endpoint->bus_type != V4L2_MBUS_CSI2 ||
+       if (endpoint->bus_type != V4L2_MBUS_CSI2_DPHY ||
            endpoint->bus.mipi_csi2.num_data_lanes == 0 ||
            endpoint->nr_of_link_frequencies == 0) {
                dev_err(dev, "missing CSI-2 properties in endpoint\n");
index 06b42223321534789adefbe776e901b380f1b422..452eb9b42140bb927e7af8287dcbe99b45ef51dd 100644 (file)
@@ -1482,7 +1482,7 @@ static int cio2_fwnode_parse(struct device *dev,
        struct sensor_async_subdev *s_asd =
                        container_of(asd, struct sensor_async_subdev, asd);
 
-       if (vep->bus_type != V4L2_MBUS_CSI2) {
+       if (vep->bus_type != V4L2_MBUS_CSI2_DPHY) {
                dev_err(dev, "Only CSI2 bus type is currently supported\n");
                return -EINVAL;
        }
index da3eb349716f9f7c4457d3eb723870e14e445ee9..0776a34f28eee6effdff847f730f3eeb28361c39 100644 (file)
@@ -378,7 +378,7 @@ static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx)
                return ret;
        }
 
-       if (v4l2_ep.bus_type != V4L2_MBUS_CSI2) {
+       if (v4l2_ep.bus_type != V4L2_MBUS_CSI2_DPHY) {
                dev_err(csi2rx->dev, "Unsupported media bus type: 0x%x\n",
                        v4l2_ep.bus_type);
                of_node_put(ep);
index 40d0de690ff4ae7896131d13bff644ad59648ace..6224daf891d7cc077f1d87c2fcacdee17eecf153 100644 (file)
@@ -446,7 +446,7 @@ static int csi2tx_check_lanes(struct csi2tx_priv *csi2tx)
                goto out;
        }
 
-       if (v4l2_ep.bus_type != V4L2_MBUS_CSI2) {
+       if (v4l2_ep.bus_type != V4L2_MBUS_CSI2_DPHY) {
                dev_err(csi2tx->dev, "Unsupported media bus type: 0x%x\n",
                        v4l2_ep.bus_type);
                ret = -EINVAL;
index f8e1af101817340df4c0ea1501925c54cf0009dd..f1b301810260a6fe602f276489c87e62e373b3d8 100644 (file)
@@ -794,7 +794,7 @@ static void mcam_ctlr_image(struct mcam_camera *cam)
        /*
         * This field controls the generation of EOF(DVP only)
         */
-       if (cam->bus_type != V4L2_MBUS_CSI2)
+       if (cam->bus_type != V4L2_MBUS_CSI2_DPHY)
                mcam_reg_set_bit(cam, REG_CTRL0,
                                C0_EOF_VSYNC | C0_VEDGE_CTRL);
 }
@@ -1023,7 +1023,7 @@ static int mcam_read_setup(struct mcam_camera *cam)
                cam->calc_dphy(cam);
        cam_dbg(cam, "camera: DPHY sets: dphy3=0x%x, dphy5=0x%x, dphy6=0x%x\n",
                        cam->dphy[0], cam->dphy[1], cam->dphy[2]);
-       if (cam->bus_type == V4L2_MBUS_CSI2)
+       if (cam->bus_type == V4L2_MBUS_CSI2_DPHY)
                mcam_enable_mipi(cam);
        else
                mcam_disable_mipi(cam);
index 41968cd388ac91b78c8bc8228478bdfa04dac471..70a2833db0d146338d27bdcf04db04ceb62e5599 100644 (file)
@@ -362,7 +362,7 @@ static int mmpcam_probe(struct platform_device *pdev)
        mcam->mclk_div = pdata->mclk_div;
        mcam->bus_type = pdata->bus_type;
        mcam->dphy = pdata->dphy;
-       if (mcam->bus_type == V4L2_MBUS_CSI2) {
+       if (mcam->bus_type == V4L2_MBUS_CSI2_DPHY) {
                cam->mipi_clk = devm_clk_get(mcam->dev, "mipi");
                if ((IS_ERR(cam->mipi_clk) && mcam->dphy[2] == 0))
                        return PTR_ERR(cam->mipi_clk);
index f5dde8774399f68c0eaf59696b10aa25e03c9a4b..77fb7987b42f33cda57dc8b6627d4befc2d7a83e 100644 (file)
@@ -2054,7 +2054,7 @@ static int isp_fwnode_parse(struct device *dev,
                        dev_dbg(dev, "CSI-1/CCP-2 configuration\n");
                        csi1 = true;
                        break;
-               case V4L2_MBUS_CSI2:
+               case V4L2_MBUS_CSI2_DPHY:
                        dev_dbg(dev, "CSI-2 configuration\n");
                        csi1 = false;
                        break;
index 2f083acdd26968758ad9f39a0ce6884e68c050fd..6f01d0986b59ec89d2404208b7fb0a602e15e3eb 100644 (file)
@@ -633,7 +633,7 @@ static unsigned int pxa_mbus_config_compatible(const struct v4l2_mbus_config *cf
                mode = common_flags & (V4L2_MBUS_MASTER | V4L2_MBUS_SLAVE);
                return (!hsync || !vsync || !pclk || !data || !mode) ?
                        0 : common_flags;
-       case V4L2_MBUS_CSI2:
+       case V4L2_MBUS_CSI2_DPHY:
                mipi_lanes = common_flags & V4L2_MBUS_CSI2_LANES;
                mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |
                                             V4L2_MBUS_CSI2_CONTINUOUS_CLOCK);
index 75ebd9c23813e36f9e313e10323eca0bd985cf5b..25edc2edd1974932b34e334f998e22721891ecf2 100644 (file)
@@ -714,7 +714,7 @@ static int rcsi2_parse_v4l2(struct rcar_csi2 *priv,
        if (vep->base.port || vep->base.id)
                return -ENOTCONN;
 
-       if (vep->bus_type != V4L2_MBUS_CSI2) {
+       if (vep->bus_type != V4L2_MBUS_CSI2_DPHY) {
                dev_err(priv->dev, "Unsupported bus: %u\n", vep->bus_type);
                return -EINVAL;
        }
index 0ad4b28266e4379f1a9a5932e809d100c84cede9..be74008ec0cae375b8fe0f9cd21f9d4ae2664958 100644 (file)
@@ -503,7 +503,7 @@ unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg,
                mode = common_flags & (V4L2_MBUS_MASTER | V4L2_MBUS_SLAVE);
                return (!hsync || !vsync || !pclk || !data || !mode) ?
                        0 : common_flags;
-       case V4L2_MBUS_CSI2:
+       case V4L2_MBUS_CSI2_DPHY:
                mipi_lanes = common_flags & V4L2_MBUS_CSI2_LANES;
                mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK |
                                             V4L2_MBUS_CSI2_CONTINUOUS_CLOCK);
index 48f514d7e34f6818d0403a41ba8bd5fe5c1177aa..9719a2e8de07153c9b25f29d1b21e3b6d2f84c0d 100644 (file)
@@ -1663,7 +1663,7 @@ static int dcmi_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       if (ep.bus_type == V4L2_MBUS_CSI2) {
+       if (ep.bus_type == V4L2_MBUS_CSI2_DPHY) {
                dev_err(&pdev->dev, "CSI bus not supported\n");
                return -ENODEV;
        }
index 51f604332eea6a3fc84c92b3d35d6c1f0ec631d9..95a093f41905d218f2fe746a637dfc0921d7559f 100644 (file)
@@ -1710,7 +1710,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, int inst)
        }
        v4l2_fwnode_endpoint_parse(of_fwnode_handle(remote_ep), endpoint);
 
-       if (endpoint->bus_type != V4L2_MBUS_CSI2) {
+       if (endpoint->bus_type != V4L2_MBUS_CSI2_DPHY) {
                ctx_err(ctx, "Port:%d sub-device %pOFn is not a CSI2 device\n",
                        inst, sensor_node);
                goto cleanup_exit;
index 104ef7f1754d3aa5cbf10b9582ae6d55bda27ece..54162217bb368f3c121923634e67e7a629c3aabb 100644 (file)
@@ -115,7 +115,7 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode,
        }
 
        bus->flags = flags;
-       vep->bus_type = V4L2_MBUS_CSI2;
+       vep->bus_type = V4L2_MBUS_CSI2_DPHY;
 
        return 0;
 }
index bca13846ce6d7fa84fe5ba6516a60b1f0075a8c2..beb7c120bf350bfc1ee0800955c75aaec0f0a799 100644 (file)
@@ -124,7 +124,7 @@ static inline struct csi_priv *sd_to_dev(struct v4l2_subdev *sdev)
 
 static inline bool is_parallel_bus(struct v4l2_fwnode_endpoint *ep)
 {
-       return ep->bus_type != V4L2_MBUS_CSI2;
+       return ep->bus_type != V4L2_MBUS_CSI2_DPHY;
 }
 
 static inline bool is_parallel_16bit_bus(struct v4l2_fwnode_endpoint *ep)
index d60a52cfc69c9d77fd781fb267d429e28006ca41..6a1cee55a49b68a09f8dbd7c8a5939e4b39f99d9 100644 (file)
@@ -563,7 +563,7 @@ static int csi2_parse_endpoint(struct device *dev,
                return -EINVAL;
        }
 
-       if (vep->bus_type != V4L2_MBUS_CSI2) {
+       if (vep->bus_type != V4L2_MBUS_CSI2_DPHY) {
                v4l2_err(&csi2->sd, "invalid bus type, must be MIPI CSI2\n");
                return -EINVAL;
        }
index c5256903e59ff91d58576070fc6f60a779590fb7..1676c166dc8394764cab449662e61239617c98d1 100644 (file)
@@ -262,7 +262,7 @@ static int imx074_s_power(struct v4l2_subdev *sd, int on)
 static int imx074_g_mbus_config(struct v4l2_subdev *sd,
                                struct v4l2_mbus_config *cfg)
 {
-       cfg->type = V4L2_MBUS_CSI2;
+       cfg->type = V4L2_MBUS_CSI2_DPHY;
        cfg->flags = V4L2_MBUS_CSI2_2_LANE |
                V4L2_MBUS_CSI2_CHANNEL_0 |
                V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
index 4bbb5f3d2b02572ef85504a5ab64b1b25a34b0aa..26e1c644ded6629a079f1a316600e5f832620173 100644 (file)
  *                     also be used for BT.1120
  * @V4L2_MBUS_CSI1:    MIPI CSI-1 serial interface
  * @V4L2_MBUS_CCP2:    CCP2 (Compact Camera Port 2)
- * @V4L2_MBUS_CSI2:    MIPI CSI-2 serial interface
+ * @V4L2_MBUS_CSI2_DPHY: MIPI CSI-2 serial interface, with D-PHY
+ * @V4L2_MBUS_CSI2_CPHY: MIPI CSI-2 serial interface, with C-PHY
  */
 enum v4l2_mbus_type {
        V4L2_MBUS_PARALLEL,
        V4L2_MBUS_BT656,
        V4L2_MBUS_CSI1,
        V4L2_MBUS_CCP2,
-       V4L2_MBUS_CSI2,
+       V4L2_MBUS_CSI2_DPHY,
+       V4L2_MBUS_CSI2_CPHY,
 };
 
 /**