Lines Matching +full:vdig +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0
3 * imx274.c - IMX274 CMOS Image Sensor driver
23 #include <linux/v4l2-mediabus.h>
26 #include <media/v4l2-ctrls.h>
27 #include <media/v4l2-device.h>
28 #include <media/v4l2-fwnode.h>
29 #include <media/v4l2-subdev.h>
49 #define IMX274_GAIN_SHIFT_MASK ((1 << IMX274_GAIN_SHIFT) - 1)
59 / (2048 - IMX274_GAIN_REG_MAX))
76 * register SHR is limited to (SVR value + 1) x VMAX value - 4
136 "vddl", /* IF (1.2V) supply */
137 "vdig", /* Digital Core (1.8V) supply */
138 "vana", /* Analog (2.8V) supply */
167 * Adjustment (CSI-2)" in the datasheet)
168 * @min_SHR: Minimum SHR register value (see "Shutter Setting (CSI-2)" in the
172 * in Each Readout Drive Mode (CSI-2)" in the datasheet)
220 * All-pixel scan mode (10-bit)
260 * Horizontal/vertical 2/2-line binning
261 * (Horizontal and vertical weightedbinning, 10-bit)
534 * struct imx274_ctrls - imx274 ctrl structure
550 * struct stim274 - imx274 device structure
562 * @supplies: List of analog and digital supply regulators
610 return &container_of(ctrl->handler, in ctrl_to_sd()
611 struct stimx274, ctrls.handler)->sd; in ctrl_to_sd()
631 struct regmap *regmap = priv->regmap; in imx274_write_table()
636 int range_start = -1; in imx274_write_table()
642 if ((next->addr != range_start + range_count) || in imx274_write_table()
643 (next->addr == IMX274_TABLE_END) || in imx274_write_table()
644 (next->addr == IMX274_TABLE_WAIT_MS) || in imx274_write_table()
659 range_start = -1; in imx274_write_table()
663 if (next->addr == IMX274_TABLE_END) in imx274_write_table()
666 if (next->addr == IMX274_TABLE_WAIT_MS) { in imx274_write_table()
667 msleep_range(next->val); in imx274_write_table()
672 val = next->val; in imx274_write_table()
674 if (range_start == -1) in imx274_write_table()
675 range_start = next->addr; in imx274_write_table()
686 err = regmap_write(priv->regmap, addr, val); in imx274_write_reg()
688 dev_err(&priv->client->dev, in imx274_write_reg()
692 dev_dbg(&priv->client->dev, in imx274_write_reg()
699 * imx274_read_mbreg - Read a multibyte register.
705 * consecutive, least-to-most significant.
718 err = regmap_bulk_read(priv->regmap, addr, &val_le, nbytes); in imx274_read_mbreg()
720 dev_err(&priv->client->dev, in imx274_read_mbreg()
725 dev_dbg(&priv->client->dev, in imx274_read_mbreg()
734 * imx274_write_mbreg - Write a multibyte register.
740 * consecutive, least-to-most significant.
750 err = regmap_bulk_write(priv->regmap, addr, &val_le, nbytes); in imx274_write_mbreg()
752 dev_err(&priv->client->dev, in imx274_write_mbreg()
756 dev_dbg(&priv->client->dev, in imx274_write_mbreg()
776 err = imx274_write_table(priv, priv->mode->init_regs); in imx274_mode_regs()
782 * imx274_start_stream - Function for starting stream per mode index
791 err = __v4l2_ctrl_handler_setup(&priv->ctrls.handler); in imx274_start_stream()
793 dev_err(&priv->client->dev, "Error %d setup controls\n", err); in imx274_start_stream()
798 * Refer to "Standby Cancel Sequence when using CSI-2" in in imx274_start_stream()
808 * Refer to "Standby Cancel Sequence when using CSI-2" in in imx274_start_stream()
821 * imx274_reset - Function called to reset the sensor
832 gpiod_set_value_cansleep(priv->reset_gpio, 0); in imx274_reset()
834 gpiod_set_value_cansleep(priv->reset_gpio, !!rst); in imx274_reset()
848 ret = clk_prepare_enable(imx274->inck); in imx274_power_on()
850 dev_err(&imx274->client->dev, in imx274_power_on()
855 ret = regulator_bulk_enable(IMX274_NUM_SUPPLIES, imx274->supplies); in imx274_power_on()
857 dev_err(&imx274->client->dev, in imx274_power_on()
868 clk_disable_unprepare(imx274->inck); in imx274_power_on()
880 regulator_bulk_disable(IMX274_NUM_SUPPLIES, imx274->supplies); in imx274_power_off()
882 clk_disable_unprepare(imx274->inck); in imx274_power_off()
892 imx274->supplies[i].supply = imx274_supply_names[i]; in imx274_regulators_get()
895 imx274->supplies); in imx274_regulators_get()
899 * imx274_s_ctrl - This is used to set the imx274 V4L2 controls
910 int ret = -EINVAL; in imx274_s_ctrl()
912 if (!pm_runtime_get_if_in_use(&imx274->client->dev)) in imx274_s_ctrl()
915 dev_dbg(&imx274->client->dev, in imx274_s_ctrl()
917 ctrl->name, ctrl->val); in imx274_s_ctrl()
919 switch (ctrl->id) { in imx274_s_ctrl()
921 dev_dbg(&imx274->client->dev, in imx274_s_ctrl()
923 ret = imx274_set_exposure(imx274, ctrl->val); in imx274_s_ctrl()
927 dev_dbg(&imx274->client->dev, in imx274_s_ctrl()
933 dev_dbg(&imx274->client->dev, in imx274_s_ctrl()
935 ret = imx274_set_vflip(imx274, ctrl->val); in imx274_s_ctrl()
939 dev_dbg(&imx274->client->dev, in imx274_s_ctrl()
941 ret = imx274_set_test_pattern(imx274, ctrl->val); in imx274_s_ctrl()
945 pm_runtime_put(&imx274->client->dev); in imx274_s_ctrl()
954 struct device *dev = &imx274->client->dev; in imx274_binning_goodness()
960 val -= goodness; in imx274_binning_goodness()
962 val -= goodness; in imx274_binning_goodness()
967 val -= goodness; in imx274_binning_goodness()
969 val -= goodness; in imx274_binning_goodness()
972 val -= abs(w - ask_w); in imx274_binning_goodness()
973 val -= abs(h - ask_h); in imx274_binning_goodness()
982 * __imx274_change_compose - Helper function to change binning and set both
995 * Must be called with imx274->lock locked.
1000 * @width: Input-output parameter: set to the desired width before
1002 * @height: Input-output parameter for height (see @width)
1013 struct device *dev = &imx274->client->dev; in __imx274_change_compose()
1021 cur_crop = &sd_state->pads->try_crop; in __imx274_change_compose()
1022 tgt_fmt = &sd_state->pads->try_fmt; in __imx274_change_compose()
1024 cur_crop = &imx274->crop; in __imx274_change_compose()
1025 tgt_fmt = &imx274->format; in __imx274_change_compose()
1034 cur_crop->width / wratio, *width, in __imx274_change_compose()
1035 cur_crop->height / hratio, *height, in __imx274_change_compose()
1044 *width = cur_crop->width / best_mode->wbin_ratio; in __imx274_change_compose()
1045 *height = cur_crop->height / best_mode->hbin_ratio; in __imx274_change_compose()
1048 imx274->mode = best_mode; in __imx274_change_compose()
1051 __func__, best_mode->wbin_ratio, best_mode->hbin_ratio); in __imx274_change_compose()
1053 tgt_fmt->width = *width; in __imx274_change_compose()
1054 tgt_fmt->height = *height; in __imx274_change_compose()
1055 tgt_fmt->field = V4L2_FIELD_NONE; in __imx274_change_compose()
1061 * imx274_get_fmt - Get the pad format
1076 mutex_lock(&imx274->lock); in imx274_get_fmt()
1077 fmt->format = imx274->format; in imx274_get_fmt()
1078 mutex_unlock(&imx274->lock); in imx274_get_fmt()
1083 * imx274_set_fmt - This is used to set the pad format
1096 struct v4l2_mbus_framefmt *fmt = &format->format; in imx274_set_fmt()
1100 mutex_lock(&imx274->lock); in imx274_set_fmt()
1102 err = __imx274_change_compose(imx274, sd_state, format->which, in imx274_set_fmt()
1103 &fmt->width, &fmt->height, 0); in imx274_set_fmt()
1113 fmt->field = V4L2_FIELD_NONE; in imx274_set_fmt()
1114 if (format->which == V4L2_SUBDEV_FORMAT_TRY) in imx274_set_fmt()
1115 sd_state->pads->try_fmt = *fmt; in imx274_set_fmt()
1117 imx274->format = *fmt; in imx274_set_fmt()
1120 mutex_unlock(&imx274->lock); in imx274_set_fmt()
1134 if (sel->pad != 0) in imx274_get_selection()
1135 return -EINVAL; in imx274_get_selection()
1137 if (sel->target == V4L2_SEL_TGT_CROP_BOUNDS) { in imx274_get_selection()
1138 sel->r.left = 0; in imx274_get_selection()
1139 sel->r.top = 0; in imx274_get_selection()
1140 sel->r.width = IMX274_MAX_WIDTH; in imx274_get_selection()
1141 sel->r.height = IMX274_MAX_HEIGHT; in imx274_get_selection()
1145 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { in imx274_get_selection()
1146 src_crop = &sd_state->pads->try_crop; in imx274_get_selection()
1147 src_fmt = &sd_state->pads->try_fmt; in imx274_get_selection()
1149 src_crop = &imx274->crop; in imx274_get_selection()
1150 src_fmt = &imx274->format; in imx274_get_selection()
1153 mutex_lock(&imx274->lock); in imx274_get_selection()
1155 switch (sel->target) { in imx274_get_selection()
1157 sel->r = *src_crop; in imx274_get_selection()
1160 sel->r.top = 0; in imx274_get_selection()
1161 sel->r.left = 0; in imx274_get_selection()
1162 sel->r.width = src_crop->width; in imx274_get_selection()
1163 sel->r.height = src_crop->height; in imx274_get_selection()
1166 sel->r.top = 0; in imx274_get_selection()
1167 sel->r.left = 0; in imx274_get_selection()
1168 sel->r.width = src_fmt->width; in imx274_get_selection()
1169 sel->r.height = src_fmt->height; in imx274_get_selection()
1172 ret = -EINVAL; in imx274_get_selection()
1175 mutex_unlock(&imx274->lock); in imx274_get_selection()
1197 IMX274_ROUND(sel->r.width, h_step, sel->flags), in imx274_set_selection_crop()
1200 /* Constraint: HTRIMMING_END - HTRIMMING_START >= 144 */ in imx274_set_selection_crop()
1205 IMX274_ROUND(sel->r.left, h_step, 0), in imx274_set_selection_crop()
1206 IMX274_MAX_WIDTH - new_crop.width); in imx274_set_selection_crop()
1209 IMX274_ROUND(sel->r.height, 2, sel->flags), in imx274_set_selection_crop()
1212 new_crop.top = min_t(u32, IMX274_ROUND(sel->r.top, 2, 0), in imx274_set_selection_crop()
1213 IMX274_MAX_HEIGHT - new_crop.height); in imx274_set_selection_crop()
1215 sel->r = new_crop; in imx274_set_selection_crop()
1217 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) in imx274_set_selection_crop()
1218 tgt_crop = &sd_state->pads->try_crop; in imx274_set_selection_crop()
1220 tgt_crop = &imx274->crop; in imx274_set_selection_crop()
1222 mutex_lock(&imx274->lock); in imx274_set_selection_crop()
1224 size_changed = (new_crop.width != tgt_crop->width || in imx274_set_selection_crop()
1225 new_crop.height != tgt_crop->height); in imx274_set_selection_crop()
1232 __imx274_change_compose(imx274, sd_state, sel->which, in imx274_set_selection_crop()
1234 sel->flags); in imx274_set_selection_crop()
1236 mutex_unlock(&imx274->lock); in imx274_set_selection_crop()
1247 if (sel->pad != 0) in imx274_set_selection()
1248 return -EINVAL; in imx274_set_selection()
1250 if (sel->target == V4L2_SEL_TGT_CROP) in imx274_set_selection()
1253 if (sel->target == V4L2_SEL_TGT_COMPOSE) { in imx274_set_selection()
1256 mutex_lock(&imx274->lock); in imx274_set_selection()
1257 err = __imx274_change_compose(imx274, sd_state, sel->which, in imx274_set_selection()
1258 &sel->r.width, &sel->r.height, in imx274_set_selection()
1259 sel->flags); in imx274_set_selection()
1260 mutex_unlock(&imx274->lock); in imx274_set_selection()
1264 * height in set->r, we still need to set top-left in imx274_set_selection()
1267 sel->r.top = 0; in imx274_set_selection()
1268 sel->r.left = 0; in imx274_set_selection()
1274 return -EINVAL; in imx274_set_selection()
1288 h_start = imx274->crop.left + 12; in imx274_apply_trimming()
1289 h_end = h_start + imx274->crop.width; in imx274_apply_trimming()
1294 hmax = max_t(u32, 260, (imx274->crop.width) / 16 + 23); in imx274_apply_trimming()
1297 v_pos = imx274->ctrls.vflip->cur.val ? in imx274_apply_trimming()
1298 (-imx274->crop.top / 2) : (imx274->crop.top / 2); in imx274_apply_trimming()
1299 v_cut = (IMX274_MAX_HEIGHT - imx274->crop.height) / 2; in imx274_apply_trimming()
1300 write_v_size = imx274->crop.height + 22; in imx274_apply_trimming()
1301 y_out_size = imx274->crop.height; in imx274_apply_trimming()
1331 * imx274_g_frame_interval - Get the frame interval
1344 fi->interval = imx274->frame_interval; in imx274_g_frame_interval()
1345 dev_dbg(&imx274->client->dev, "%s frame rate = %d / %d\n", in imx274_g_frame_interval()
1346 __func__, imx274->frame_interval.numerator, in imx274_g_frame_interval()
1347 imx274->frame_interval.denominator); in imx274_g_frame_interval()
1353 * imx274_s_frame_interval - Set the frame interval
1365 struct v4l2_ctrl *ctrl = imx274->ctrls.exposure; in imx274_s_frame_interval()
1369 ret = pm_runtime_resume_and_get(&imx274->client->dev); in imx274_s_frame_interval()
1373 mutex_lock(&imx274->lock); in imx274_s_frame_interval()
1374 ret = imx274_set_frame_interval(imx274, fi->interval); in imx274_s_frame_interval()
1377 fi->interval = imx274->frame_interval; in imx274_s_frame_interval()
1384 max = fi->interval.numerator * 1000000 in imx274_s_frame_interval()
1385 / fi->interval.denominator; in imx274_s_frame_interval()
1389 dev_err(&imx274->client->dev, in imx274_s_frame_interval()
1395 imx274_set_exposure(imx274, ctrl->val); in imx274_s_frame_interval()
1397 dev_dbg(&imx274->client->dev, "set frame interval to %uus\n", in imx274_s_frame_interval()
1398 fi->interval.numerator * 1000000 in imx274_s_frame_interval()
1399 / fi->interval.denominator); in imx274_s_frame_interval()
1403 mutex_unlock(&imx274->lock); in imx274_s_frame_interval()
1404 pm_runtime_put(&imx274->client->dev); in imx274_s_frame_interval()
1410 * imx274_load_default - load default control values
1418 priv->frame_interval.numerator = 1; in imx274_load_default()
1419 priv->frame_interval.denominator = IMX274_DEF_FRAME_RATE; in imx274_load_default()
1420 priv->ctrls.exposure->val = 1000000 / IMX274_DEF_FRAME_RATE; in imx274_load_default()
1421 priv->ctrls.gain->val = IMX274_DEF_GAIN; in imx274_load_default()
1422 priv->ctrls.vflip->val = 0; in imx274_load_default()
1423 priv->ctrls.test_pattern->val = TEST_PATTERN_DISABLED; in imx274_load_default()
1427 * imx274_s_stream - It is used to start/stop the streaming.
1441 dev_dbg(&imx274->client->dev, "%s : %s, mode index = %td\n", __func__, in imx274_s_stream()
1443 imx274->mode - &imx274_modes[0]); in imx274_s_stream()
1445 mutex_lock(&imx274->lock); in imx274_s_stream()
1448 ret = pm_runtime_resume_and_get(&imx274->client->dev); in imx274_s_stream()
1450 mutex_unlock(&imx274->lock); in imx274_s_stream()
1470 imx274->frame_interval); in imx274_s_stream()
1484 pm_runtime_put(&imx274->client->dev); in imx274_s_stream()
1487 mutex_unlock(&imx274->lock); in imx274_s_stream()
1488 dev_dbg(&imx274->client->dev, "%s : Done\n", __func__); in imx274_s_stream()
1492 pm_runtime_put(&imx274->client->dev); in imx274_s_stream()
1493 mutex_unlock(&imx274->lock); in imx274_s_stream()
1494 dev_err(&imx274->client->dev, "s_stream failed\n"); in imx274_s_stream()
1499 * imx274_get_frame_length - Function for obtaining current frame length
1526 dev_err(&priv->client->dev, "%s error = %d\n", __func__, err); in imx274_get_frame_length()
1539 if (*frame_length < priv->mode->min_frame_len) in imx274_clamp_coarse_time()
1540 *frame_length = priv->mode->min_frame_len; in imx274_clamp_coarse_time()
1542 *val = *frame_length - *val; /* convert to raw shr */ in imx274_clamp_coarse_time()
1543 if (*val > *frame_length - IMX274_SHR_LIMIT_CONST) in imx274_clamp_coarse_time()
1544 *val = *frame_length - IMX274_SHR_LIMIT_CONST; in imx274_clamp_coarse_time()
1545 else if (*val < priv->mode->min_SHR) in imx274_clamp_coarse_time()
1546 *val = priv->mode->min_SHR; in imx274_clamp_coarse_time()
1552 * imx274_set_digital gain - Function called when setting digital gain
1567 reg_val--; in imx274_set_digital_gain()
1576 * imx274_set_gain - Function called when setting gain
1582 * The caller should hold the mutex lock imx274->lock if necessary
1591 gain = (u32)(ctrl->val); in imx274_set_gain()
1593 dev_dbg(&priv->client->dev, in imx274_set_gain()
1614 dev_dbg(&priv->client->dev, in imx274_set_gain()
1625 gain_reg = (u32)IMX274_GAIN_CONST - in imx274_set_gain()
1635 if (IMX274_GAIN_CONST - gain_reg == 0) { in imx274_set_gain()
1636 err = -EINVAL; in imx274_set_gain()
1641 ctrl->val = (IMX274_GAIN_CONST << IMX274_GAIN_SHIFT) in imx274_set_gain()
1642 / (IMX274_GAIN_CONST - gain_reg) * digital_gain; in imx274_set_gain()
1644 dev_dbg(&priv->client->dev, in imx274_set_gain()
1646 __func__, gain_reg, ctrl->val); in imx274_set_gain()
1651 dev_err(&priv->client->dev, "%s error = %d\n", __func__, err); in imx274_set_gain()
1656 * imx274_set_coarse_time - Function called when setting SHR value
1680 *val = frame_length - coarse_time; in imx274_set_coarse_time()
1684 dev_err(&priv->client->dev, "%s error = %d\n", __func__, err); in imx274_set_coarse_time()
1689 * imx274_set_exposure - Function called when setting exposure time
1691 * @val: Variable for exposure time, in the unit of micro-second
1694 * The caller should hold the mutex lock imx274->lock if necessary
1704 dev_dbg(&priv->client->dev, in imx274_set_exposure()
1714 err = -EINVAL; in imx274_set_exposure()
1719 - priv->mode->nocpiop) / hmax; in imx274_set_exposure()
1728 priv->ctrls.exposure->val = in imx274_set_exposure()
1729 (coarse_time * hmax + priv->mode->nocpiop) in imx274_set_exposure()
1732 dev_dbg(&priv->client->dev, in imx274_set_exposure()
1737 dev_err(&priv->client->dev, "%s error = %d\n", __func__, err); in imx274_set_exposure()
1743 * imx274_set_vflip - Function called when setting vertical flip
1750 * The caller should hold the mutex lock imx274->lock if necessary
1760 dev_err(&priv->client->dev, "VFLIP control error\n"); in imx274_set_vflip()
1764 dev_dbg(&priv->client->dev, in imx274_set_vflip()
1771 * imx274_set_test_pattern - Function called when setting test pattern
1786 err = imx274_write_reg(priv, IMX274_TEST_PATTERN_REG, val - 1); in imx274_set_test_pattern()
1790 err = -EINVAL; in imx274_set_test_pattern()
1794 dev_dbg(&priv->client->dev, in imx274_set_test_pattern()
1797 dev_err(&priv->client->dev, "%s error = %d\n", __func__, err); in imx274_set_test_pattern()
1803 * imx274_set_frame_length - Function called when setting frame length
1816 dev_dbg(&priv->client->dev, "%s : input length = %d\n", in imx274_set_frame_length()
1828 dev_err(&priv->client->dev, "%s error = %d\n", __func__, err); in imx274_set_frame_length()
1833 * imx274_set_frame_interval - Function called when setting frame interval
1838 * The caller should hold the mutex lock imx274->lock if necessary
1850 dev_dbg(&priv->client->dev, "%s: input frame interval = %d / %d", in imx274_set_frame_interval()
1863 if (req_frame_rate > priv->mode->max_fps) { in imx274_set_frame_interval()
1865 frame_interval.denominator = priv->mode->max_fps; in imx274_set_frame_interval()
1880 dev_dbg(&priv->client->dev, in imx274_set_frame_interval()
1887 dev_dbg(&priv->client->dev, in imx274_set_frame_interval()
1891 err = -EINVAL; in imx274_set_frame_interval()
1903 priv->frame_interval = frame_interval; in imx274_set_frame_interval()
1907 dev_err(&priv->client->dev, "%s error = %d\n", __func__, err); in imx274_set_frame_interval()
1915 if (code->index > 0) in imx274_enum_mbus_code()
1916 return -EINVAL; in imx274_enum_mbus_code()
1919 code->code = MEDIA_BUS_FMT_SRGGB10_1X10; in imx274_enum_mbus_code()
1971 return -EINVAL; in imx274_fwnode_parse()
1976 if (ret == -ENXIO) { in imx274_fwnode_parse()
1988 return -EINVAL; in imx274_fwnode_parse()
1998 struct device *dev = &client->dev; in imx274_probe()
2004 return -ENOMEM; in imx274_probe()
2006 mutex_init(&imx274->lock); in imx274_probe()
2012 imx274->inck = devm_clk_get_optional(dev, "inck"); in imx274_probe()
2013 if (IS_ERR(imx274->inck)) in imx274_probe()
2014 return PTR_ERR(imx274->inck); in imx274_probe()
2023 imx274->mode = &imx274_modes[0]; in imx274_probe()
2024 imx274->crop.width = IMX274_MAX_WIDTH; in imx274_probe()
2025 imx274->crop.height = IMX274_MAX_HEIGHT; in imx274_probe()
2026 imx274->format.width = imx274->crop.width / imx274->mode->wbin_ratio; in imx274_probe()
2027 imx274->format.height = imx274->crop.height / imx274->mode->hbin_ratio; in imx274_probe()
2028 imx274->format.field = V4L2_FIELD_NONE; in imx274_probe()
2029 imx274->format.code = MEDIA_BUS_FMT_SRGGB10_1X10; in imx274_probe()
2030 imx274->format.colorspace = V4L2_COLORSPACE_SRGB; in imx274_probe()
2031 imx274->frame_interval.numerator = 1; in imx274_probe()
2032 imx274->frame_interval.denominator = IMX274_DEF_FRAME_RATE; in imx274_probe()
2035 imx274->regmap = devm_regmap_init_i2c(client, &imx274_regmap_config); in imx274_probe()
2036 if (IS_ERR(imx274->regmap)) { in imx274_probe()
2038 "regmap init failed: %ld\n", PTR_ERR(imx274->regmap)); in imx274_probe()
2039 ret = -ENODEV; in imx274_probe()
2044 imx274->client = client; in imx274_probe()
2045 sd = &imx274->sd; in imx274_probe()
2047 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; in imx274_probe()
2050 imx274->pad.flags = MEDIA_PAD_FL_SOURCE; in imx274_probe()
2051 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; in imx274_probe()
2052 ret = media_entity_pads_init(&sd->entity, 1, &imx274->pad); in imx274_probe()
2060 imx274->reset_gpio = devm_gpiod_get_optional(dev, "reset", in imx274_probe()
2062 if (IS_ERR(imx274->reset_gpio)) { in imx274_probe()
2063 ret = dev_err_probe(dev, PTR_ERR(imx274->reset_gpio), in imx274_probe()
2076 ret = v4l2_ctrl_handler_init(&imx274->ctrls.handler, 4); in imx274_probe()
2082 imx274->ctrls.handler.lock = &imx274->lock; in imx274_probe()
2085 imx274->ctrls.test_pattern = v4l2_ctrl_new_std_menu_items( in imx274_probe()
2086 &imx274->ctrls.handler, &imx274_ctrl_ops, in imx274_probe()
2088 ARRAY_SIZE(tp_qmenu) - 1, 0, 0, tp_qmenu); in imx274_probe()
2090 imx274->ctrls.gain = v4l2_ctrl_new_std( in imx274_probe()
2091 &imx274->ctrls.handler, in imx274_probe()
2097 imx274->ctrls.exposure = v4l2_ctrl_new_std( in imx274_probe()
2098 &imx274->ctrls.handler, in imx274_probe()
2104 imx274->ctrls.vflip = v4l2_ctrl_new_std( in imx274_probe()
2105 &imx274->ctrls.handler, in imx274_probe()
2109 imx274->sd.ctrl_handler = &imx274->ctrls.handler; in imx274_probe()
2110 if (imx274->ctrls.handler.error) { in imx274_probe()
2111 ret = imx274->ctrls.handler.error; in imx274_probe()
2134 v4l2_ctrl_handler_free(&imx274->ctrls.handler); in imx274_probe()
2138 media_entity_cleanup(&sd->entity); in imx274_probe()
2140 mutex_destroy(&imx274->lock); in imx274_probe()
2149 pm_runtime_disable(&client->dev); in imx274_remove()
2150 if (!pm_runtime_status_suspended(&client->dev)) in imx274_remove()
2151 imx274_power_off(&client->dev); in imx274_remove()
2152 pm_runtime_set_suspended(&client->dev); in imx274_remove()
2155 v4l2_ctrl_handler_free(&imx274->ctrls.handler); in imx274_remove()
2157 media_entity_cleanup(&sd->entity); in imx274_remove()
2158 mutex_destroy(&imx274->lock); in imx274_remove()