.. | .. |
---|
1187 | 1187 | struct imx307 *imx307 = to_imx307(sd); |
---|
1188 | 1188 | const struct imx307_mode *mode = imx307->cur_mode; |
---|
1189 | 1189 | |
---|
1190 | | - mutex_lock(&imx307->mutex); |
---|
1191 | 1190 | fi->interval = mode->max_fps; |
---|
1192 | | - mutex_unlock(&imx307->mutex); |
---|
1193 | 1191 | |
---|
1194 | 1192 | return 0; |
---|
1195 | 1193 | } |
---|
1196 | 1194 | |
---|
1197 | | -static int imx307_g_mbus_config(struct v4l2_subdev *sd, |
---|
| 1195 | +static int imx307_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, |
---|
1198 | 1196 | struct v4l2_mbus_config *config) |
---|
1199 | 1197 | { |
---|
1200 | 1198 | struct imx307 *imx307 = to_imx307(sd); |
---|
.. | .. |
---|
1203 | 1201 | val = 1 << (imx307->cur_mode->lanes - 1) | |
---|
1204 | 1202 | V4L2_MBUS_CSI2_CHANNEL_0 | |
---|
1205 | 1203 | V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; |
---|
1206 | | - if (imx307->bus_cfg.bus_type == 3) |
---|
1207 | | - config->type = V4L2_MBUS_CCP2; |
---|
1208 | | - else |
---|
1209 | | - config->type = V4L2_MBUS_CSI2; |
---|
| 1204 | + config->type = imx307->bus_cfg.bus_type; |
---|
1210 | 1205 | config->flags = val; |
---|
1211 | 1206 | |
---|
1212 | 1207 | return 0; |
---|
.. | .. |
---|
1259 | 1254 | } |
---|
1260 | 1255 | |
---|
1261 | 1256 | //long exposure and short exposure |
---|
1262 | | - if (imx307->cur_mode->lanes == 2 && imx307->bus_cfg.bus_type == 3) |
---|
| 1257 | + if (imx307->cur_mode->lanes == 2 && imx307->bus_cfg.bus_type == V4L2_MBUS_CCP2) |
---|
1263 | 1258 | rhs1 = RHS1; |
---|
1264 | 1259 | else |
---|
1265 | 1260 | rhs1 = 0xe1; |
---|
.. | .. |
---|
1467 | 1462 | break; |
---|
1468 | 1463 | case RKMODULE_GET_LVDS_CFG: |
---|
1469 | 1464 | lvds_cfg = (struct rkmodule_lvds_cfg *)arg; |
---|
1470 | | - if (imx307->bus_cfg.bus_type == 3) |
---|
| 1465 | + if (imx307->bus_cfg.bus_type == V4L2_MBUS_CCP2) |
---|
1471 | 1466 | memcpy(lvds_cfg, &imx307->cur_mode->lvds_cfg, |
---|
1472 | 1467 | sizeof(struct rkmodule_lvds_cfg)); |
---|
1473 | 1468 | else |
---|
.. | .. |
---|
1882 | 1877 | if (sel->target == V4L2_SEL_TGT_CROP_BOUNDS) { |
---|
1883 | 1878 | sel->r.left = CROP_START(imx307->cur_mode->width, DST_WIDTH); |
---|
1884 | 1879 | sel->r.width = DST_WIDTH; |
---|
1885 | | - if (imx307->bus_cfg.bus_type == 3) { |
---|
| 1880 | + if (imx307->bus_cfg.bus_type == V4L2_MBUS_CCP2) { |
---|
1886 | 1881 | if (imx307->cur_mode->hdr_mode == NO_HDR) |
---|
1887 | 1882 | sel->r.top = 21; |
---|
1888 | 1883 | else |
---|
.. | .. |
---|
1918 | 1913 | static const struct v4l2_subdev_video_ops imx307_video_ops = { |
---|
1919 | 1914 | .s_stream = imx307_s_stream, |
---|
1920 | 1915 | .g_frame_interval = imx307_g_frame_interval, |
---|
1921 | | - .g_mbus_config = imx307_g_mbus_config, |
---|
1922 | 1916 | }; |
---|
1923 | 1917 | |
---|
1924 | 1918 | static const struct v4l2_subdev_pad_ops imx307_pad_ops = { |
---|
.. | .. |
---|
1928 | 1922 | .get_fmt = imx307_get_fmt, |
---|
1929 | 1923 | .set_fmt = imx307_set_fmt, |
---|
1930 | 1924 | .get_selection = imx307_get_selection, |
---|
| 1925 | + .get_mbus_config = imx307_g_mbus_config, |
---|
1931 | 1926 | }; |
---|
1932 | 1927 | |
---|
1933 | 1928 | static const struct v4l2_subdev_ops imx307_subdev_ops = { |
---|
.. | .. |
---|
1964 | 1959 | |
---|
1965 | 1960 | switch (ctrl->id) { |
---|
1966 | 1961 | case V4L2_CID_EXPOSURE: |
---|
1967 | | - shs1 = imx307->cur_vts - (ctrl->val + 1); |
---|
1968 | | - ret = imx307_write_reg(imx307->client, |
---|
1969 | | - IMX307_REG_SHS1_H, |
---|
1970 | | - IMX307_REG_VALUE_08BIT, |
---|
1971 | | - IMX307_FETCH_HIGH_BYTE_EXP(shs1)); |
---|
1972 | | - ret |= imx307_write_reg(imx307->client, |
---|
1973 | | - IMX307_REG_SHS1_M, |
---|
1974 | | - IMX307_REG_VALUE_08BIT, |
---|
1975 | | - IMX307_FETCH_MID_BYTE_EXP(shs1)); |
---|
1976 | | - ret |= imx307_write_reg(imx307->client, |
---|
1977 | | - IMX307_REG_SHS1_L, |
---|
1978 | | - IMX307_REG_VALUE_08BIT, |
---|
1979 | | - IMX307_FETCH_LOW_BYTE_EXP(shs1)); |
---|
1980 | | - dev_dbg(&client->dev, "set exposure 0x%x, cur_vts 0x%x,shs1 0x%x\n", |
---|
1981 | | - ctrl->val, imx307->cur_vts, shs1); |
---|
| 1962 | + if (imx307->cur_mode->hdr_mode == NO_HDR) { |
---|
| 1963 | + shs1 = imx307->cur_vts - (ctrl->val + 1); |
---|
| 1964 | + ret = imx307_write_reg(imx307->client, |
---|
| 1965 | + IMX307_REG_SHS1_H, |
---|
| 1966 | + IMX307_REG_VALUE_08BIT, |
---|
| 1967 | + IMX307_FETCH_HIGH_BYTE_EXP(shs1)); |
---|
| 1968 | + ret |= imx307_write_reg(imx307->client, |
---|
| 1969 | + IMX307_REG_SHS1_M, |
---|
| 1970 | + IMX307_REG_VALUE_08BIT, |
---|
| 1971 | + IMX307_FETCH_MID_BYTE_EXP(shs1)); |
---|
| 1972 | + ret |= imx307_write_reg(imx307->client, |
---|
| 1973 | + IMX307_REG_SHS1_L, |
---|
| 1974 | + IMX307_REG_VALUE_08BIT, |
---|
| 1975 | + IMX307_FETCH_LOW_BYTE_EXP(shs1)); |
---|
| 1976 | + dev_dbg(&client->dev, "set exposure 0x%x, cur_vts 0x%x,shs1 0x%x\n", |
---|
| 1977 | + ctrl->val, imx307->cur_vts, shs1); |
---|
| 1978 | + } |
---|
1982 | 1979 | break; |
---|
1983 | 1980 | case V4L2_CID_ANALOGUE_GAIN: |
---|
1984 | | - ret = imx307_write_reg(imx307->client, |
---|
1985 | | - IMX307_REG_LF_GAIN, |
---|
1986 | | - IMX307_REG_VALUE_08BIT, |
---|
1987 | | - ctrl->val); |
---|
1988 | | - dev_dbg(&client->dev, "set analog gain 0x%x\n", |
---|
1989 | | - ctrl->val); |
---|
| 1981 | + if (imx307->cur_mode->hdr_mode == NO_HDR) { |
---|
| 1982 | + ret = imx307_write_reg(imx307->client, |
---|
| 1983 | + IMX307_REG_LF_GAIN, |
---|
| 1984 | + IMX307_REG_VALUE_08BIT, |
---|
| 1985 | + ctrl->val); |
---|
| 1986 | + dev_dbg(&client->dev, "set analog gain 0x%x\n", |
---|
| 1987 | + ctrl->val); |
---|
| 1988 | + } |
---|
1990 | 1989 | break; |
---|
1991 | 1990 | case V4L2_CID_VBLANK: |
---|
1992 | 1991 | vts = ctrl->val + imx307->cur_mode->height; |
---|
.. | .. |
---|
2214 | 2213 | &imx307->bus_cfg); |
---|
2215 | 2214 | if (ret) |
---|
2216 | 2215 | dev_warn(dev, "could not get bus config!\n"); |
---|
2217 | | - if (imx307->bus_cfg.bus_type == 3) { |
---|
| 2216 | + if (imx307->bus_cfg.bus_type == V4L2_MBUS_CCP2) { |
---|
2218 | 2217 | if (imx307->bus_cfg.bus.mipi_csi1.data_lane == 2) { |
---|
2219 | 2218 | imx307->support_modes = lvds_2lane_supported_modes; |
---|
2220 | 2219 | imx307->support_modes_num = ARRAY_SIZE(lvds_2lane_supported_modes); |
---|