• Home
  • Raw
  • Download

Lines Matching full:imx258

590 struct imx258 {  struct
615 static inline struct imx258 *to_imx258(struct v4l2_subdev *_sd) in to_imx258() argument
617 return container_of(_sd, struct imx258, sd); in to_imx258()
621 static int imx258_read_reg(struct imx258 *imx258, u16 reg, u32 len, u32 *val) in imx258_read_reg() argument
623 struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd); in imx258_read_reg()
654 static int imx258_write_reg(struct imx258 *imx258, u16 reg, u32 len, u32 val) in imx258_write_reg() argument
656 struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd); in imx258_write_reg()
671 static int imx258_write_regs(struct imx258 *imx258, in imx258_write_regs() argument
674 struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd); in imx258_write_regs()
679 ret = imx258_write_reg(imx258, regs[i].address, 1, in imx258_write_regs()
709 static int imx258_update_digital_gain(struct imx258 *imx258, u32 len, u32 val) in imx258_update_digital_gain() argument
713 ret = imx258_write_reg(imx258, IMX258_REG_GR_DIGITAL_GAIN, in imx258_update_digital_gain()
718 ret = imx258_write_reg(imx258, IMX258_REG_GB_DIGITAL_GAIN, in imx258_update_digital_gain()
723 ret = imx258_write_reg(imx258, IMX258_REG_R_DIGITAL_GAIN, in imx258_update_digital_gain()
728 ret = imx258_write_reg(imx258, IMX258_REG_B_DIGITAL_GAIN, in imx258_update_digital_gain()
738 struct imx258 *imx258 = in imx258_set_ctrl() local
739 container_of(ctrl->handler, struct imx258, ctrl_handler); in imx258_set_ctrl()
740 struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd); in imx258_set_ctrl()
752 ret = imx258_write_reg(imx258, IMX258_REG_ANALOG_GAIN, in imx258_set_ctrl()
757 ret = imx258_write_reg(imx258, IMX258_REG_EXPOSURE, in imx258_set_ctrl()
762 ret = imx258_update_digital_gain(imx258, IMX258_REG_VALUE_16BIT, in imx258_set_ctrl()
766 ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN, in imx258_set_ctrl()
769 ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL, in imx258_set_ctrl()
831 static int __imx258_get_pad_format(struct imx258 *imx258, in __imx258_get_pad_format() argument
836 fmt->format = *v4l2_subdev_get_try_format(&imx258->sd, cfg, in __imx258_get_pad_format()
839 imx258_update_pad_format(imx258->cur_mode, fmt); in __imx258_get_pad_format()
848 struct imx258 *imx258 = to_imx258(sd); in imx258_get_pad_format() local
851 mutex_lock(&imx258->mutex); in imx258_get_pad_format()
852 ret = __imx258_get_pad_format(imx258, cfg, fmt); in imx258_get_pad_format()
853 mutex_unlock(&imx258->mutex); in imx258_get_pad_format()
862 struct imx258 *imx258 = to_imx258(sd); in imx258_set_pad_format() local
871 mutex_lock(&imx258->mutex); in imx258_set_pad_format()
884 imx258->cur_mode = mode; in imx258_set_pad_format()
885 __v4l2_ctrl_s_ctrl(imx258->link_freq, mode->link_freq_index); in imx258_set_pad_format()
889 __v4l2_ctrl_s_ctrl_int64(imx258->pixel_rate, pixel_rate); in imx258_set_pad_format()
891 vblank_def = imx258->cur_mode->vts_def - in imx258_set_pad_format()
892 imx258->cur_mode->height; in imx258_set_pad_format()
893 vblank_min = imx258->cur_mode->vts_min - in imx258_set_pad_format()
894 imx258->cur_mode->height; in imx258_set_pad_format()
896 imx258->vblank, vblank_min, in imx258_set_pad_format()
897 IMX258_VTS_MAX - imx258->cur_mode->height, 1, in imx258_set_pad_format()
899 __v4l2_ctrl_s_ctrl(imx258->vblank, vblank_def); in imx258_set_pad_format()
902 - imx258->cur_mode->width; in imx258_set_pad_format()
903 __v4l2_ctrl_modify_range(imx258->hblank, h_blank, in imx258_set_pad_format()
907 mutex_unlock(&imx258->mutex); in imx258_set_pad_format()
913 static int imx258_start_streaming(struct imx258 *imx258) in imx258_start_streaming() argument
915 struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd); in imx258_start_streaming()
920 link_freq_index = imx258->cur_mode->link_freq_index; in imx258_start_streaming()
922 ret = imx258_write_regs(imx258, reg_list->regs, reg_list->num_of_regs); in imx258_start_streaming()
929 reg_list = &imx258->cur_mode->reg_list; in imx258_start_streaming()
930 ret = imx258_write_regs(imx258, reg_list->regs, reg_list->num_of_regs); in imx258_start_streaming()
937 ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL, in imx258_start_streaming()
946 ret = __v4l2_ctrl_handler_setup(imx258->sd.ctrl_handler); in imx258_start_streaming()
951 return imx258_write_reg(imx258, IMX258_REG_MODE_SELECT, in imx258_start_streaming()
957 static int imx258_stop_streaming(struct imx258 *imx258) in imx258_stop_streaming() argument
959 struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd); in imx258_stop_streaming()
963 ret = imx258_write_reg(imx258, IMX258_REG_MODE_SELECT, in imx258_stop_streaming()
977 struct imx258 *imx258 = to_imx258(sd); in imx258_set_stream() local
981 mutex_lock(&imx258->mutex); in imx258_set_stream()
982 if (imx258->streaming == enable) { in imx258_set_stream()
983 mutex_unlock(&imx258->mutex); in imx258_set_stream()
998 ret = imx258_start_streaming(imx258); in imx258_set_stream()
1002 imx258_stop_streaming(imx258); in imx258_set_stream()
1006 imx258->streaming = enable; in imx258_set_stream()
1007 mutex_unlock(&imx258->mutex); in imx258_set_stream()
1014 mutex_unlock(&imx258->mutex); in imx258_set_stream()
1023 struct imx258 *imx258 = to_imx258(sd); in imx258_suspend() local
1025 if (imx258->streaming) in imx258_suspend()
1026 imx258_stop_streaming(imx258); in imx258_suspend()
1035 struct imx258 *imx258 = to_imx258(sd); in imx258_resume() local
1038 if (imx258->streaming) { in imx258_resume()
1039 ret = imx258_start_streaming(imx258); in imx258_resume()
1047 imx258_stop_streaming(imx258); in imx258_resume()
1048 imx258->streaming = 0; in imx258_resume()
1053 static int imx258_identify_module(struct imx258 *imx258) in imx258_identify_module() argument
1055 struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd); in imx258_identify_module()
1059 ret = imx258_read_reg(imx258, IMX258_REG_CHIP_ID, in imx258_identify_module()
1097 static int imx258_init_controls(struct imx258 *imx258) in imx258_init_controls() argument
1099 struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd); in imx258_init_controls()
1107 ctrl_hdlr = &imx258->ctrl_handler; in imx258_init_controls()
1112 mutex_init(&imx258->mutex); in imx258_init_controls()
1113 ctrl_hdlr->lock = &imx258->mutex; in imx258_init_controls()
1114 imx258->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, in imx258_init_controls()
1121 if (imx258->link_freq) in imx258_init_controls()
1122 imx258->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; in imx258_init_controls()
1127 imx258->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &imx258_ctrl_ops, in imx258_init_controls()
1133 vblank_def = imx258->cur_mode->vts_def - imx258->cur_mode->height; in imx258_init_controls()
1134 vblank_min = imx258->cur_mode->vts_min - imx258->cur_mode->height; in imx258_init_controls()
1135 imx258->vblank = v4l2_ctrl_new_std( in imx258_init_controls()
1138 IMX258_VTS_MAX - imx258->cur_mode->height, 1, in imx258_init_controls()
1141 if (imx258->vblank) in imx258_init_controls()
1142 imx258->vblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; in imx258_init_controls()
1144 imx258->hblank = v4l2_ctrl_new_std( in imx258_init_controls()
1146 IMX258_PPL_DEFAULT - imx258->cur_mode->width, in imx258_init_controls()
1147 IMX258_PPL_DEFAULT - imx258->cur_mode->width, in imx258_init_controls()
1149 IMX258_PPL_DEFAULT - imx258->cur_mode->width); in imx258_init_controls()
1151 if (imx258->hblank) in imx258_init_controls()
1152 imx258->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; in imx258_init_controls()
1154 imx258->exposure = v4l2_ctrl_new_std( in imx258_init_controls()
1181 imx258->sd.ctrl_handler = ctrl_hdlr; in imx258_init_controls()
1187 mutex_destroy(&imx258->mutex); in imx258_init_controls()
1192 static void imx258_free_controls(struct imx258 *imx258) in imx258_free_controls() argument
1194 v4l2_ctrl_handler_free(imx258->sd.ctrl_handler); in imx258_free_controls()
1195 mutex_destroy(&imx258->mutex); in imx258_free_controls()
1200 struct imx258 *imx258; in imx258_probe() local
1216 imx258 = devm_kzalloc(&client->dev, sizeof(*imx258), GFP_KERNEL); in imx258_probe()
1217 if (!imx258) in imx258_probe()
1221 v4l2_i2c_subdev_init(&imx258->sd, client, &imx258_subdev_ops); in imx258_probe()
1224 ret = imx258_identify_module(imx258); in imx258_probe()
1229 imx258->cur_mode = &supported_modes[0]; in imx258_probe()
1231 ret = imx258_init_controls(imx258); in imx258_probe()
1236 imx258->sd.internal_ops = &imx258_internal_ops; in imx258_probe()
1237 imx258->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in imx258_probe()
1238 imx258->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; in imx258_probe()
1241 imx258->pad.flags = MEDIA_PAD_FL_SOURCE; in imx258_probe()
1243 ret = media_entity_pads_init(&imx258->sd.entity, 1, &imx258->pad); in imx258_probe()
1247 ret = v4l2_async_register_subdev_sensor_common(&imx258->sd); in imx258_probe()
1258 media_entity_cleanup(&imx258->sd.entity); in imx258_probe()
1261 imx258_free_controls(imx258); in imx258_probe()
1269 struct imx258 *imx258 = to_imx258(sd); in imx258_remove() local
1273 imx258_free_controls(imx258); in imx258_remove()
1296 .name = "imx258",
1309 MODULE_DESCRIPTION("Sony IMX258 sensor driver");