.. | .. |
---|
10 | 10 | * V0.0X01.0X03 support enum sensor fmt |
---|
11 | 11 | */ |
---|
12 | 12 | |
---|
13 | | -//#define DEBUG |
---|
14 | 13 | #include <linux/clk.h> |
---|
15 | 14 | #include <linux/device.h> |
---|
16 | 15 | #include <linux/delay.h> |
---|
.. | .. |
---|
165 | 164 | struct regval { |
---|
166 | 165 | u16 addr; |
---|
167 | 166 | u8 val; |
---|
168 | | -}; |
---|
169 | | - |
---|
170 | | -enum IMX464_max_pad { |
---|
171 | | - PAD0, /* link to isp */ |
---|
172 | | - PAD1, /* link to csi wr0 | hdr x2:L x3:M */ |
---|
173 | | - PAD2, /* link to csi wr1 | hdr x3:L */ |
---|
174 | | - PAD3, /* link to csi wr2 | hdr x2:M x3:S */ |
---|
175 | | - PAD_MAX, |
---|
176 | 167 | }; |
---|
177 | 168 | |
---|
178 | 169 | struct IMX464_mode { |
---|
.. | .. |
---|
1695 | 1686 | struct IMX464 *IMX464 = to_IMX464(sd); |
---|
1696 | 1687 | const struct IMX464_mode *mode = IMX464->cur_mode; |
---|
1697 | 1688 | |
---|
1698 | | - mutex_lock(&IMX464->mutex); |
---|
1699 | 1689 | fi->interval = mode->max_fps; |
---|
1700 | | - mutex_unlock(&IMX464->mutex); |
---|
1701 | 1690 | |
---|
1702 | 1691 | return 0; |
---|
1703 | 1692 | } |
---|
1704 | 1693 | |
---|
1705 | | -static int IMX464_g_mbus_config(struct v4l2_subdev *sd, |
---|
| 1694 | +static int IMX464_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, |
---|
1706 | 1695 | struct v4l2_mbus_config *config) |
---|
1707 | 1696 | { |
---|
1708 | 1697 | struct IMX464 *IMX464 = to_IMX464(sd); |
---|
.. | .. |
---|
1727 | 1716 | V4L2_MBUS_CSI2_CHANNEL_1 | |
---|
1728 | 1717 | V4L2_MBUS_CSI2_CHANNEL_2; |
---|
1729 | 1718 | |
---|
1730 | | - config->type = V4L2_MBUS_CSI2; |
---|
| 1719 | + config->type = V4L2_MBUS_CSI2_DPHY; |
---|
1731 | 1720 | config->flags = val; |
---|
1732 | 1721 | |
---|
1733 | 1722 | return 0; |
---|
.. | .. |
---|
1865 | 1854 | __LINE__, rhs1, s_exp_time, rhs1_old, |
---|
1866 | 1855 | (rhs1_old + 2 * BRL - fsc + 2)); |
---|
1867 | 1856 | |
---|
1868 | | - rhs1 = (rhs1 >> 2) * 4 + 1; |
---|
| 1857 | + rhs1 = ((rhs1 + 3) >> 2) * 4 + 1; |
---|
1869 | 1858 | rhs1_old = rhs1; |
---|
1870 | 1859 | |
---|
1871 | 1860 | if (rhs1 - s_exp_time <= SHR1_MIN) { |
---|
.. | .. |
---|
2287 | 2276 | |
---|
2288 | 2277 | static int IMX464_get_channel_info(struct IMX464 *IMX464, struct rkmodule_channel_info *ch_info) |
---|
2289 | 2278 | { |
---|
2290 | | - if (ch_info->index >= PAD_MAX) |
---|
| 2279 | + if (ch_info->index < PAD0 || ch_info->index >= PAD_MAX) |
---|
2291 | 2280 | return -EINVAL; |
---|
2292 | 2281 | ch_info->vc = IMX464->cur_mode->vc[ch_info->index]; |
---|
2293 | 2282 | ch_info->width = IMX464->cur_mode->width; |
---|
.. | .. |
---|
2346 | 2335 | IMX464_VTS_MAX - IMX464->cur_mode->height, |
---|
2347 | 2336 | 1, h); |
---|
2348 | 2337 | IMX464->cur_vts = IMX464->cur_mode->vts_def; |
---|
2349 | | - pixel_rate = (u32)link_freq_menu_items[IMX464->cur_mode->mipi_freq_idx] / |
---|
2350 | | - IMX464->cur_mode->bpp * 2 * |
---|
| 2338 | + pixel_rate = (u32)link_freq_menu_items[IMX464->cur_mode->mipi_freq_idx] / IMX464->cur_mode->bpp * 2 * |
---|
2351 | 2339 | IMX464->bus_cfg.bus.mipi_csi2.num_data_lanes; |
---|
2352 | 2340 | __v4l2_ctrl_s_ctrl_int64(IMX464->pixel_rate, |
---|
2353 | 2341 | pixel_rate); |
---|
.. | .. |
---|
2875 | 2863 | static const struct v4l2_subdev_video_ops IMX464_video_ops = { |
---|
2876 | 2864 | .s_stream = IMX464_s_stream, |
---|
2877 | 2865 | .g_frame_interval = IMX464_g_frame_interval, |
---|
2878 | | - .g_mbus_config = IMX464_g_mbus_config, |
---|
2879 | 2866 | }; |
---|
2880 | 2867 | |
---|
2881 | 2868 | static const struct v4l2_subdev_pad_ops IMX464_pad_ops = { |
---|
.. | .. |
---|
2885 | 2872 | .get_fmt = IMX464_get_fmt, |
---|
2886 | 2873 | .set_fmt = IMX464_set_fmt, |
---|
2887 | 2874 | .get_selection = IMX464_get_selection, |
---|
| 2875 | + .get_mbus_config = IMX464_g_mbus_config, |
---|
2888 | 2876 | }; |
---|
2889 | 2877 | |
---|
2890 | 2878 | static const struct v4l2_subdev_ops IMX464_subdev_ops = { |
---|
.. | .. |
---|
2935 | 2923 | ret |= imx464_write_reg(IMX464->client, IMX464_LF_EXPO_REG_H, |
---|
2936 | 2924 | IMX464_REG_VALUE_08BIT, |
---|
2937 | 2925 | IMX464_FETCH_EXP_H(shr0)); |
---|
2938 | | - dev_dbg(&client->dev, "set exposure 0x%x\n", |
---|
| 2926 | + dev_err(&client->dev, "set exposure 0x%x\n", |
---|
2939 | 2927 | ctrl->val); |
---|
2940 | 2928 | } |
---|
2941 | 2929 | break; |
---|
.. | .. |
---|
2947 | 2935 | ret |= imx464_write_reg(IMX464->client, IMX464_LF_GAIN_REG_L, |
---|
2948 | 2936 | IMX464_REG_VALUE_08BIT, |
---|
2949 | 2937 | IMX464_FETCH_GAIN_L(ctrl->val)); |
---|
2950 | | - dev_dbg(&client->dev, "set analog gain 0x%x\n", |
---|
| 2938 | + dev_err(&client->dev, "set analog gain 0x%x\n", |
---|
2951 | 2939 | ctrl->val); |
---|
2952 | 2940 | } |
---|
2953 | 2941 | break; |
---|
.. | .. |
---|
2975 | 2963 | IMX464_REG_VALUE_08BIT, |
---|
2976 | 2964 | IMX464_FETCH_VTS_H(vts)); |
---|
2977 | 2965 | |
---|
2978 | | - dev_dbg(&client->dev, "set vts 0x%x\n", vts); |
---|
| 2966 | + dev_err(&client->dev, "set vts 0x%x\n", |
---|
| 2967 | + vts); |
---|
2979 | 2968 | break; |
---|
2980 | 2969 | case V4L2_CID_HFLIP: |
---|
2981 | 2970 | ret = imx464_write_reg(client, |
---|
.. | .. |
---|
3366 | 3355 | |
---|
3367 | 3356 | #if IS_ENABLED(CONFIG_OF) |
---|
3368 | 3357 | static const struct of_device_id IMX464_of_match[] = { |
---|
3369 | | - { .compatible = "sony,IMX464" }, |
---|
3370 | 3358 | { .compatible = "sony,imx464" }, |
---|
3371 | 3359 | {}, |
---|
3372 | 3360 | }; |
---|
.. | .. |
---|
3374 | 3362 | #endif |
---|
3375 | 3363 | |
---|
3376 | 3364 | static const struct i2c_device_id IMX464_match_id[] = { |
---|
3377 | | - { "sony,IMX464", 0 }, |
---|
3378 | 3365 | { "sony,imx464", 0 }, |
---|
3379 | 3366 | { }, |
---|
3380 | 3367 | }; |
---|