Lines Matching +full:lens +full:- +full:focus
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2015--2017 Intel Corporation.
8 #include <media/v4l2-ctrls.h>
9 #include <media/v4l2-device.h>
14 * This sets the minimum granularity for the focus positions.
15 * A value of 1 gives maximum accuracy for a desired focus position
19 * This acts as the minimum granularity of lens movement.
21 * uniformly adjusted for gradual lens movement, with desired
42 return container_of(ctrl->handler, struct dw9714_device, ctrls_vcm); in to_dw9714_vcm()
57 dev_err(&client->dev, "I2C write fail\n"); in dw9714_i2c_write()
58 return -EIO; in dw9714_i2c_write()
65 struct i2c_client *client = v4l2_get_subdevdata(&dw9714_dev->sd); in dw9714_t_focus_vcm()
67 dw9714_dev->current_val = val; in dw9714_t_focus_vcm()
76 if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE) in dw9714_set_ctrl()
77 return dw9714_t_focus_vcm(dev_vcm, ctrl->val); in dw9714_set_ctrl()
79 return -EINVAL; in dw9714_set_ctrl()
88 return pm_runtime_resume_and_get(sd->dev); in dw9714_open()
93 pm_runtime_put(sd->dev); in dw9714_close()
107 v4l2_async_unregister_subdev(&dw9714_dev->sd); in dw9714_subdev_cleanup()
108 v4l2_ctrl_handler_free(&dw9714_dev->ctrls_vcm); in dw9714_subdev_cleanup()
109 media_entity_cleanup(&dw9714_dev->sd.entity); in dw9714_subdev_cleanup()
114 struct v4l2_ctrl_handler *hdl = &dev_vcm->ctrls_vcm; in dw9714_init_controls()
122 if (hdl->error) in dw9714_init_controls()
123 dev_err(dev_vcm->sd.dev, "%s fail error: 0x%x\n", in dw9714_init_controls()
124 __func__, hdl->error); in dw9714_init_controls()
125 dev_vcm->sd.ctrl_handler = hdl; in dw9714_init_controls()
126 return hdl->error; in dw9714_init_controls()
134 dw9714_dev = devm_kzalloc(&client->dev, sizeof(*dw9714_dev), in dw9714_probe()
137 return -ENOMEM; in dw9714_probe()
139 v4l2_i2c_subdev_init(&dw9714_dev->sd, client, &dw9714_ops); in dw9714_probe()
140 dw9714_dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in dw9714_probe()
141 dw9714_dev->sd.internal_ops = &dw9714_int_ops; in dw9714_probe()
147 rval = media_entity_pads_init(&dw9714_dev->sd.entity, 0, NULL); in dw9714_probe()
151 dw9714_dev->sd.entity.function = MEDIA_ENT_F_LENS; in dw9714_probe()
153 rval = v4l2_async_register_subdev(&dw9714_dev->sd); in dw9714_probe()
157 pm_runtime_set_active(&client->dev); in dw9714_probe()
158 pm_runtime_enable(&client->dev); in dw9714_probe()
159 pm_runtime_idle(&client->dev); in dw9714_probe()
164 v4l2_ctrl_handler_free(&dw9714_dev->ctrls_vcm); in dw9714_probe()
165 media_entity_cleanup(&dw9714_dev->sd.entity); in dw9714_probe()
175 pm_runtime_disable(&client->dev); in dw9714_remove()
183 * The lens position is gradually moved in units of DW9714_CTRL_STEPS,
193 for (val = dw9714_dev->current_val & ~(DW9714_CTRL_STEPS - 1); in dw9714_vcm_suspend()
194 val >= 0; val -= DW9714_CTRL_STEPS) { in dw9714_vcm_suspend()
207 * The lens position is gradually moved in units of DW9714_CTRL_STEPS,
217 for (val = dw9714_dev->current_val % DW9714_CTRL_STEPS; in dw9714_vcm_resume()
218 val < dw9714_dev->current_val + DW9714_CTRL_STEPS - 1; in dw9714_vcm_resume()