]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
media: staging: rkisp1: remove mbus field from rkisp1_sensor_async
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tue, 17 Mar 2020 18:07:00 +0000 (19:07 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 21 Apr 2020 15:20:45 +0000 (17:20 +0200)
'struct v4l2_mbus_config' is a legacy struct that should not be used
in new drivers. So replace it with the fields:

enum v4l2_mbus_type mbus_type;
unsigned int mbus_flags;

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/rkisp1/rkisp1-common.h
drivers/staging/media/rkisp1/rkisp1-dev.c
drivers/staging/media/rkisp1/rkisp1-isp.c

index 5d2c3187871d77cdef9770110d5e03f36dcb5e25..0c4fe503adc901b814bdb1564e14d454aecee0f1 100644 (file)
@@ -73,8 +73,9 @@ enum rkisp1_isp_pad {
  */
 struct rkisp1_sensor_async {
        struct v4l2_async_subdev asd;
-       struct v4l2_mbus_config mbus;
        unsigned int lanes;
+       enum v4l2_mbus_type mbus_type;
+       unsigned int mbus_flags;
        struct v4l2_subdev *sd;
        struct v4l2_ctrl *pixel_rate_ctrl;
        struct phy *dphy;
index 92d4cd66d36ebc701372eca9320e7c98fdde885e..ec7d9cf291069eb8092b5c6961a2d08d2b6ff0e0 100644 (file)
@@ -250,26 +250,12 @@ static int rkisp1_fwnode_parse(struct device *dev,
                return -EINVAL;
        }
 
-       s_asd->mbus.type = vep->bus_type;
-       s_asd->mbus.flags = vep->bus.mipi_csi2.flags;
+       s_asd->mbus_type = vep->bus_type;
+       s_asd->mbus_flags = vep->bus.mipi_csi2.flags;
        s_asd->lanes = vep->bus.mipi_csi2.num_data_lanes;
 
-       switch (vep->bus.mipi_csi2.num_data_lanes) {
-       case 1:
-               s_asd->mbus.flags |= V4L2_MBUS_CSI2_1_LANE;
-               break;
-       case 2:
-               s_asd->mbus.flags |= V4L2_MBUS_CSI2_2_LANE;
-               break;
-       case 3:
-               s_asd->mbus.flags |= V4L2_MBUS_CSI2_3_LANE;
-               break;
-       case 4:
-               s_asd->mbus.flags |= V4L2_MBUS_CSI2_4_LANE;
-               break;
-       default:
+       if (s_asd->lanes < 1 || s_asd->lanes > 4)
                return -EINVAL;
-       }
 
        return 0;
 }
index 60f6b8d9004ba639e9cb58e67504a7999fff2855..61f159e59d07ad113a7cea3cc22b4507656758d5 100644 (file)
@@ -299,17 +299,17 @@ static int rkisp1_config_isp(struct rkisp1_device *rkisp1)
                        rkisp1_write(rkisp1, RKISP1_CIF_ISP_DEMOSAIC_TH(0xc),
                                     RKISP1_CIF_ISP_DEMOSAIC);
 
-                       if (sensor->mbus.type == V4L2_MBUS_BT656)
+                       if (sensor->mbus_type == V4L2_MBUS_BT656)
                                isp_ctrl = RKISP1_CIF_ISP_CTRL_ISP_MODE_BAYER_ITU656;
                        else
                                isp_ctrl = RKISP1_CIF_ISP_CTRL_ISP_MODE_BAYER_ITU601;
                }
        } else if (sink_fmt->pixel_enc == V4L2_PIXEL_ENC_YUV) {
                acq_mult = 2;
-               if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) {
+               if (sensor->mbus_type == V4L2_MBUS_CSI2_DPHY) {
                        isp_ctrl = RKISP1_CIF_ISP_CTRL_ISP_MODE_ITU601;
                } else {
-                       if (sensor->mbus.type == V4L2_MBUS_BT656)
+                       if (sensor->mbus_type == V4L2_MBUS_BT656)
                                isp_ctrl = RKISP1_CIF_ISP_CTRL_ISP_MODE_ITU656;
                        else
                                isp_ctrl = RKISP1_CIF_ISP_CTRL_ISP_MODE_ITU601;
@@ -319,17 +319,17 @@ static int rkisp1_config_isp(struct rkisp1_device *rkisp1)
        }
 
        /* Set up input acquisition properties */
-       if (sensor->mbus.type == V4L2_MBUS_BT656 ||
-           sensor->mbus.type == V4L2_MBUS_PARALLEL) {
-               if (sensor->mbus.flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
+       if (sensor->mbus_type == V4L2_MBUS_BT656 ||
+           sensor->mbus_type == V4L2_MBUS_PARALLEL) {
+               if (sensor->mbus_flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
                        signal = RKISP1_CIF_ISP_ACQ_PROP_POS_EDGE;
        }
 
-       if (sensor->mbus.type == V4L2_MBUS_PARALLEL) {
-               if (sensor->mbus.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
+       if (sensor->mbus_type == V4L2_MBUS_PARALLEL) {
+               if (sensor->mbus_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
                        signal |= RKISP1_CIF_ISP_ACQ_PROP_VSYNC_LOW;
 
-               if (sensor->mbus.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
+               if (sensor->mbus_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
                        signal |= RKISP1_CIF_ISP_ACQ_PROP_HSYNC_LOW;
        }
 
@@ -401,29 +401,11 @@ static int rkisp1_config_dvp(struct rkisp1_device *rkisp1)
 static int rkisp1_config_mipi(struct rkisp1_device *rkisp1)
 {
        const struct rkisp1_isp_mbus_info *sink_fmt = rkisp1->isp.sink_fmt;
-       unsigned int lanes;
+       unsigned int lanes = rkisp1->active_sensor->lanes;
        u32 mipi_ctrl;
 
-       /*
-        * rkisp1->active_sensor->mbus is set in isp or d-phy notifier_bound
-        * function
-        */
-       switch (rkisp1->active_sensor->mbus.flags & V4L2_MBUS_CSI2_LANES) {
-       case V4L2_MBUS_CSI2_4_LANE:
-               lanes = 4;
-               break;
-       case V4L2_MBUS_CSI2_3_LANE:
-               lanes = 3;
-               break;
-       case V4L2_MBUS_CSI2_2_LANE:
-               lanes = 2;
-               break;
-       case V4L2_MBUS_CSI2_1_LANE:
-               lanes = 1;
-               break;
-       default:
+       if (lanes < 1 || lanes > 4)
                return -EINVAL;
-       }
 
        mipi_ctrl = RKISP1_CIF_MIPI_CTRL_NUM_LANES(lanes - 1) |
                    RKISP1_CIF_MIPI_CTRL_SHUTDOWNLANES(0xf) |
@@ -470,11 +452,11 @@ static int rkisp1_config_path(struct rkisp1_device *rkisp1)
        u32 dpcl = rkisp1_read(rkisp1, RKISP1_CIF_VI_DPCL);
        int ret = 0;
 
-       if (sensor->mbus.type == V4L2_MBUS_BT656 ||
-           sensor->mbus.type == V4L2_MBUS_PARALLEL) {
+       if (sensor->mbus_type == V4L2_MBUS_BT656 ||
+           sensor->mbus_type == V4L2_MBUS_PARALLEL) {
                ret = rkisp1_config_dvp(rkisp1);
                dpcl |= RKISP1_CIF_VI_DPCL_IF_SEL_PARALLEL;
-       } else if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) {
+       } else if (sensor->mbus_type == V4L2_MBUS_CSI2_DPHY) {
                ret = rkisp1_config_mipi(rkisp1);
                dpcl |= RKISP1_CIF_VI_DPCL_IF_SEL_MIPI;
        }
@@ -561,7 +543,7 @@ static void rkisp1_isp_start(struct rkisp1_device *rkisp1)
        rkisp1_config_clk(rkisp1);
 
        /* Activate MIPI */
-       if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) {
+       if (sensor->mbus_type == V4L2_MBUS_CSI2_DPHY) {
                val = rkisp1_read(rkisp1, RKISP1_CIF_MIPI_CTRL);
                rkisp1_write(rkisp1, val | RKISP1_CIF_MIPI_CTRL_OUTPUT_ENA,
                             RKISP1_CIF_MIPI_CTRL);
@@ -956,7 +938,7 @@ static int rkisp1_isp_s_stream(struct v4l2_subdev *sd, int enable)
        rkisp1->active_sensor = container_of(sensor_sd->asd,
                                             struct rkisp1_sensor_async, asd);
 
-       if (rkisp1->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)
+       if (rkisp1->active_sensor->mbus_type != V4L2_MBUS_CSI2_DPHY)
                return -EINVAL;
 
        atomic_set(&rkisp1->isp.frame_sequence, -1);