.. | .. |
---|
609 | 609 | struct gc5035 *gc5035 = to_gc5035(sd); |
---|
610 | 610 | const struct gc5035_mode *mode = gc5035->cur_mode; |
---|
611 | 611 | |
---|
612 | | - mutex_lock(&gc5035->mutex); |
---|
613 | 612 | fi->interval = mode->max_fps; |
---|
614 | | - mutex_unlock(&gc5035->mutex); |
---|
615 | 613 | |
---|
616 | 614 | return 0; |
---|
617 | 615 | } |
---|
.. | .. |
---|
698 | 696 | } |
---|
699 | 697 | |
---|
700 | 698 | ret = gc5035_ioctl(sd, cmd, inf); |
---|
701 | | - if (!ret) |
---|
| 699 | + if (!ret) { |
---|
702 | 700 | ret = copy_to_user(up, inf, sizeof(*inf)); |
---|
| 701 | + if (ret) |
---|
| 702 | + ret = -EFAULT; |
---|
| 703 | + } |
---|
703 | 704 | kfree(inf); |
---|
704 | 705 | break; |
---|
705 | 706 | case RKMODULE_AWB_CFG: |
---|
.. | .. |
---|
712 | 713 | ret = copy_from_user(cfg, up, sizeof(*cfg)); |
---|
713 | 714 | if (!ret) |
---|
714 | 715 | ret = gc5035_ioctl(sd, cmd, cfg); |
---|
| 716 | + else |
---|
| 717 | + ret = -EFAULT; |
---|
715 | 718 | kfree(cfg); |
---|
716 | 719 | break; |
---|
717 | 720 | case RKMODULE_SET_QUICK_STREAM: |
---|
718 | 721 | ret = copy_from_user(&stream, up, sizeof(u32)); |
---|
719 | 722 | if (!ret) |
---|
720 | 723 | ret = gc5035_ioctl(sd, cmd, &stream); |
---|
| 724 | + else |
---|
| 725 | + ret = -EFAULT; |
---|
| 726 | + |
---|
721 | 727 | break; |
---|
722 | 728 | default: |
---|
723 | 729 | ret = -ENOTTY; |
---|
.. | .. |
---|
956 | 962 | } |
---|
957 | 963 | #endif |
---|
958 | 964 | |
---|
959 | | -static int sensor_g_mbus_config(struct v4l2_subdev *sd, |
---|
960 | | - struct v4l2_mbus_config *config) |
---|
| 965 | +static int sensor_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, |
---|
| 966 | + struct v4l2_mbus_config *config) |
---|
961 | 967 | { |
---|
962 | 968 | struct gc5035 *sensor = to_gc5035(sd); |
---|
963 | 969 | struct device *dev = &sensor->client->dev; |
---|
.. | .. |
---|
965 | 971 | dev_info(dev, "%s(%d) enter!\n", __func__, __LINE__); |
---|
966 | 972 | |
---|
967 | 973 | if (2 == sensor->lane_num) { |
---|
968 | | - config->type = V4L2_MBUS_CSI2; |
---|
| 974 | + config->type = V4L2_MBUS_CSI2_DPHY; |
---|
969 | 975 | config->flags = V4L2_MBUS_CSI2_2_LANE | |
---|
970 | 976 | V4L2_MBUS_CSI2_CHANNEL_0 | |
---|
971 | 977 | V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; |
---|
.. | .. |
---|
985 | 991 | if (fie->index >= gc5035->cfg_num) |
---|
986 | 992 | return -EINVAL; |
---|
987 | 993 | |
---|
988 | | - if (fie->code != MEDIA_BUS_FMT_SRGGB10_1X10) |
---|
989 | | - return -EINVAL; |
---|
| 994 | + fie->code = MEDIA_BUS_FMT_SRGGB10_1X10; |
---|
990 | 995 | |
---|
991 | 996 | fie->width = supported_modes[fie->index].width; |
---|
992 | 997 | fie->height = supported_modes[fie->index].height; |
---|
.. | .. |
---|
1014 | 1019 | }; |
---|
1015 | 1020 | |
---|
1016 | 1021 | static const struct v4l2_subdev_video_ops gc5035_video_ops = { |
---|
1017 | | - .g_mbus_config = sensor_g_mbus_config, |
---|
1018 | 1022 | .s_stream = gc5035_s_stream, |
---|
1019 | 1023 | .g_frame_interval = gc5035_g_frame_interval, |
---|
1020 | 1024 | }; |
---|
.. | .. |
---|
1025 | 1029 | .enum_frame_interval = gc5035_enum_frame_interval, |
---|
1026 | 1030 | .get_fmt = gc5035_get_fmt, |
---|
1027 | 1031 | .set_fmt = gc5035_set_fmt, |
---|
| 1032 | + .get_mbus_config = sensor_g_mbus_config, |
---|
1028 | 1033 | }; |
---|
1029 | 1034 | |
---|
1030 | 1035 | static const struct v4l2_subdev_ops gc5035_subdev_ops = { |
---|
.. | .. |
---|
1039 | 1044 | |
---|
1040 | 1045 | dev_info(&gc5035->client->dev, "Test Pattern!!\n"); |
---|
1041 | 1046 | ret = gc5035_write_reg(gc5035->client, 0xfe, 0x01); |
---|
1042 | | - ret = gc5035_write_reg(gc5035->client, 0x8c, value); |
---|
1043 | | - ret = gc5035_write_reg(gc5035->client, 0xfe, 0x00); |
---|
| 1047 | + ret |= gc5035_write_reg(gc5035->client, 0x8c, value); |
---|
| 1048 | + ret |= gc5035_write_reg(gc5035->client, 0xfe, 0x00); |
---|
1044 | 1049 | return ret; |
---|
1045 | 1050 | } |
---|
1046 | 1051 | |
---|