ov8856 65 drivers/media/i2c/ov8856.c #define to_ov8856(_sd) container_of(_sd, struct ov8856, sd) ov8856 604 drivers/media/i2c/ov8856.c static int ov8856_read_reg(struct ov8856 *ov8856, u16 reg, u16 len, u32 *val) ov8856 606 drivers/media/i2c/ov8856.c struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd); ov8856 634 drivers/media/i2c/ov8856.c static int ov8856_write_reg(struct ov8856 *ov8856, u16 reg, u16 len, u32 val) ov8856 636 drivers/media/i2c/ov8856.c struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd); ov8856 650 drivers/media/i2c/ov8856.c static int ov8856_write_reg_list(struct ov8856 *ov8856, ov8856 653 drivers/media/i2c/ov8856.c struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd); ov8856 658 drivers/media/i2c/ov8856.c ret = ov8856_write_reg(ov8856, r_list->regs[i].address, 1, ov8856 671 drivers/media/i2c/ov8856.c static int ov8856_update_digital_gain(struct ov8856 *ov8856, u32 d_gain) ov8856 675 drivers/media/i2c/ov8856.c ret = ov8856_write_reg(ov8856, OV8856_REG_MWB_R_GAIN, ov8856 680 drivers/media/i2c/ov8856.c ret = ov8856_write_reg(ov8856, OV8856_REG_MWB_G_GAIN, ov8856 685 drivers/media/i2c/ov8856.c return ov8856_write_reg(ov8856, OV8856_REG_MWB_B_GAIN, ov8856 689 drivers/media/i2c/ov8856.c static int ov8856_test_pattern(struct ov8856 *ov8856, u32 pattern) ov8856 695 drivers/media/i2c/ov8856.c return ov8856_write_reg(ov8856, OV8856_REG_TEST_PATTERN, ov8856 701 drivers/media/i2c/ov8856.c struct ov8856 *ov8856 = container_of(ctrl->handler, ov8856 702 drivers/media/i2c/ov8856.c struct ov8856, ctrl_handler); ov8856 703 drivers/media/i2c/ov8856.c struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd); ov8856 710 drivers/media/i2c/ov8856.c exposure_max = ov8856->cur_mode->height + ctrl->val - ov8856 712 drivers/media/i2c/ov8856.c __v4l2_ctrl_modify_range(ov8856->exposure, ov8856 713 drivers/media/i2c/ov8856.c ov8856->exposure->minimum, ov8856 714 drivers/media/i2c/ov8856.c exposure_max, ov8856->exposure->step, ov8856 724 drivers/media/i2c/ov8856.c ret = ov8856_write_reg(ov8856, OV8856_REG_ANALOG_GAIN, ov8856 729 drivers/media/i2c/ov8856.c ret = ov8856_update_digital_gain(ov8856, ctrl->val); ov8856 734 drivers/media/i2c/ov8856.c ret = ov8856_write_reg(ov8856, OV8856_REG_EXPOSURE, ov8856 739 drivers/media/i2c/ov8856.c ret = ov8856_write_reg(ov8856, OV8856_REG_VTS, ov8856 741 drivers/media/i2c/ov8856.c ov8856->cur_mode->height + ctrl->val); ov8856 745 drivers/media/i2c/ov8856.c ret = ov8856_test_pattern(ov8856, ctrl->val); ov8856 762 drivers/media/i2c/ov8856.c static int ov8856_init_controls(struct ov8856 *ov8856) ov8856 768 drivers/media/i2c/ov8856.c ctrl_hdlr = &ov8856->ctrl_handler; ov8856 773 drivers/media/i2c/ov8856.c ctrl_hdlr->lock = &ov8856->mutex; ov8856 774 drivers/media/i2c/ov8856.c ov8856->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &ov8856_ctrl_ops, ov8856 778 drivers/media/i2c/ov8856.c if (ov8856->link_freq) ov8856 779 drivers/media/i2c/ov8856.c ov8856->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; ov8856 781 drivers/media/i2c/ov8856.c ov8856->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov8856_ctrl_ops, ov8856 786 drivers/media/i2c/ov8856.c ov8856->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &ov8856_ctrl_ops, ov8856 788 drivers/media/i2c/ov8856.c ov8856->cur_mode->vts_min - ov8856->cur_mode->height, ov8856 789 drivers/media/i2c/ov8856.c OV8856_VTS_MAX - ov8856->cur_mode->height, 1, ov8856 790 drivers/media/i2c/ov8856.c ov8856->cur_mode->vts_def - ov8856->cur_mode->height); ov8856 791 drivers/media/i2c/ov8856.c h_blank = to_pixels_per_line(ov8856->cur_mode->hts, ov8856 792 drivers/media/i2c/ov8856.c ov8856->cur_mode->link_freq_index) - ov8856->cur_mode->width; ov8856 793 drivers/media/i2c/ov8856.c ov8856->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &ov8856_ctrl_ops, ov8856 796 drivers/media/i2c/ov8856.c if (ov8856->hblank) ov8856 797 drivers/media/i2c/ov8856.c ov8856->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; ov8856 805 drivers/media/i2c/ov8856.c exposure_max = ov8856->cur_mode->vts_def - OV8856_EXPOSURE_MAX_MARGIN; ov8856 806 drivers/media/i2c/ov8856.c ov8856->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &ov8856_ctrl_ops, ov8856 818 drivers/media/i2c/ov8856.c ov8856->sd.ctrl_handler = ctrl_hdlr; ov8856 832 drivers/media/i2c/ov8856.c static int ov8856_start_streaming(struct ov8856 *ov8856) ov8856 834 drivers/media/i2c/ov8856.c struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd); ov8856 838 drivers/media/i2c/ov8856.c link_freq_index = ov8856->cur_mode->link_freq_index; ov8856 840 drivers/media/i2c/ov8856.c ret = ov8856_write_reg_list(ov8856, reg_list); ov8856 846 drivers/media/i2c/ov8856.c reg_list = &ov8856->cur_mode->reg_list; ov8856 847 drivers/media/i2c/ov8856.c ret = ov8856_write_reg_list(ov8856, reg_list); ov8856 853 drivers/media/i2c/ov8856.c ret = __v4l2_ctrl_handler_setup(ov8856->sd.ctrl_handler); ov8856 857 drivers/media/i2c/ov8856.c ret = ov8856_write_reg(ov8856, OV8856_REG_MODE_SELECT, ov8856 867 drivers/media/i2c/ov8856.c static void ov8856_stop_streaming(struct ov8856 *ov8856) ov8856 869 drivers/media/i2c/ov8856.c struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd); ov8856 871 drivers/media/i2c/ov8856.c if (ov8856_write_reg(ov8856, OV8856_REG_MODE_SELECT, ov8856 878 drivers/media/i2c/ov8856.c struct ov8856 *ov8856 = to_ov8856(sd); ov8856 882 drivers/media/i2c/ov8856.c if (ov8856->streaming == enable) ov8856 885 drivers/media/i2c/ov8856.c mutex_lock(&ov8856->mutex); ov8856 890 drivers/media/i2c/ov8856.c mutex_unlock(&ov8856->mutex); ov8856 894 drivers/media/i2c/ov8856.c ret = ov8856_start_streaming(ov8856); ov8856 897 drivers/media/i2c/ov8856.c ov8856_stop_streaming(ov8856); ov8856 901 drivers/media/i2c/ov8856.c ov8856_stop_streaming(ov8856); ov8856 905 drivers/media/i2c/ov8856.c ov8856->streaming = enable; ov8856 906 drivers/media/i2c/ov8856.c mutex_unlock(&ov8856->mutex); ov8856 915 drivers/media/i2c/ov8856.c struct ov8856 *ov8856 = to_ov8856(sd); ov8856 917 drivers/media/i2c/ov8856.c mutex_lock(&ov8856->mutex); ov8856 918 drivers/media/i2c/ov8856.c if (ov8856->streaming) ov8856 919 drivers/media/i2c/ov8856.c ov8856_stop_streaming(ov8856); ov8856 921 drivers/media/i2c/ov8856.c mutex_unlock(&ov8856->mutex); ov8856 930 drivers/media/i2c/ov8856.c struct ov8856 *ov8856 = to_ov8856(sd); ov8856 933 drivers/media/i2c/ov8856.c mutex_lock(&ov8856->mutex); ov8856 934 drivers/media/i2c/ov8856.c if (ov8856->streaming) { ov8856 935 drivers/media/i2c/ov8856.c ret = ov8856_start_streaming(ov8856); ov8856 937 drivers/media/i2c/ov8856.c ov8856->streaming = false; ov8856 938 drivers/media/i2c/ov8856.c ov8856_stop_streaming(ov8856); ov8856 939 drivers/media/i2c/ov8856.c mutex_unlock(&ov8856->mutex); ov8856 944 drivers/media/i2c/ov8856.c mutex_unlock(&ov8856->mutex); ov8856 953 drivers/media/i2c/ov8856.c struct ov8856 *ov8856 = to_ov8856(sd); ov8856 962 drivers/media/i2c/ov8856.c mutex_lock(&ov8856->mutex); ov8856 967 drivers/media/i2c/ov8856.c ov8856->cur_mode = mode; ov8856 968 drivers/media/i2c/ov8856.c __v4l2_ctrl_s_ctrl(ov8856->link_freq, mode->link_freq_index); ov8856 969 drivers/media/i2c/ov8856.c __v4l2_ctrl_s_ctrl_int64(ov8856->pixel_rate, ov8856 974 drivers/media/i2c/ov8856.c __v4l2_ctrl_modify_range(ov8856->vblank, ov8856 978 drivers/media/i2c/ov8856.c __v4l2_ctrl_s_ctrl(ov8856->vblank, vblank_def); ov8856 981 drivers/media/i2c/ov8856.c __v4l2_ctrl_modify_range(ov8856->hblank, h_blank, h_blank, 1, ov8856 985 drivers/media/i2c/ov8856.c mutex_unlock(&ov8856->mutex); ov8856 994 drivers/media/i2c/ov8856.c struct ov8856 *ov8856 = to_ov8856(sd); ov8856 996 drivers/media/i2c/ov8856.c mutex_lock(&ov8856->mutex); ov8856 998 drivers/media/i2c/ov8856.c fmt->format = *v4l2_subdev_get_try_format(&ov8856->sd, cfg, ov8856 1001 drivers/media/i2c/ov8856.c ov8856_update_pad_format(ov8856->cur_mode, &fmt->format); ov8856 1003 drivers/media/i2c/ov8856.c mutex_unlock(&ov8856->mutex); ov8856 1041 drivers/media/i2c/ov8856.c struct ov8856 *ov8856 = to_ov8856(sd); ov8856 1043 drivers/media/i2c/ov8856.c mutex_lock(&ov8856->mutex); ov8856 1046 drivers/media/i2c/ov8856.c mutex_unlock(&ov8856->mutex); ov8856 1075 drivers/media/i2c/ov8856.c static int ov8856_identify_module(struct ov8856 *ov8856) ov8856 1077 drivers/media/i2c/ov8856.c struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd); ov8856 1081 drivers/media/i2c/ov8856.c ret = ov8856_read_reg(ov8856, OV8856_REG_CHIP_ID, ov8856 1164 drivers/media/i2c/ov8856.c struct ov8856 *ov8856 = to_ov8856(sd); ov8856 1170 drivers/media/i2c/ov8856.c mutex_destroy(&ov8856->mutex); ov8856 1177 drivers/media/i2c/ov8856.c struct ov8856 *ov8856; ov8856 1187 drivers/media/i2c/ov8856.c ov8856 = devm_kzalloc(&client->dev, sizeof(*ov8856), GFP_KERNEL); ov8856 1188 drivers/media/i2c/ov8856.c if (!ov8856) ov8856 1191 drivers/media/i2c/ov8856.c v4l2_i2c_subdev_init(&ov8856->sd, client, &ov8856_subdev_ops); ov8856 1192 drivers/media/i2c/ov8856.c ret = ov8856_identify_module(ov8856); ov8856 1198 drivers/media/i2c/ov8856.c mutex_init(&ov8856->mutex); ov8856 1199 drivers/media/i2c/ov8856.c ov8856->cur_mode = &supported_modes[0]; ov8856 1200 drivers/media/i2c/ov8856.c ret = ov8856_init_controls(ov8856); ov8856 1206 drivers/media/i2c/ov8856.c ov8856->sd.internal_ops = &ov8856_internal_ops; ov8856 1207 drivers/media/i2c/ov8856.c ov8856->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ov8856 1208 drivers/media/i2c/ov8856.c ov8856->sd.entity.ops = &ov8856_subdev_entity_ops; ov8856 1209 drivers/media/i2c/ov8856.c ov8856->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; ov8856 1210 drivers/media/i2c/ov8856.c ov8856->pad.flags = MEDIA_PAD_FL_SOURCE; ov8856 1211 drivers/media/i2c/ov8856.c ret = media_entity_pads_init(&ov8856->sd.entity, 1, &ov8856->pad); ov8856 1217 drivers/media/i2c/ov8856.c ret = v4l2_async_register_subdev_sensor_common(&ov8856->sd); ov8856 1235 drivers/media/i2c/ov8856.c media_entity_cleanup(&ov8856->sd.entity); ov8856 1238 drivers/media/i2c/ov8856.c v4l2_ctrl_handler_free(ov8856->sd.ctrl_handler); ov8856 1239 drivers/media/i2c/ov8856.c mutex_destroy(&ov8856->mutex);