Lines Matching +full:lens +full:- +full:focus

1 // SPDX-License-Identifier: GPL-2.0
9 #include <media/v4l2-ctrls.h>
10 #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
36 struct v4l2_ctrl *focus; member
43 return container_of(ctrl->handler, struct ak7375_device, ctrls_vcm); in to_ak7375_vcm()
54 struct i2c_client *client = v4l2_get_subdevdata(&ak7375->sd); in ak7375_i2c_write()
59 return -EINVAL; in ak7375_i2c_write()
68 return -EIO; in ak7375_i2c_write()
77 if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE) in ak7375_set_ctrl()
79 ctrl->val << 4, 2); in ak7375_set_ctrl()
81 return -EINVAL; in ak7375_set_ctrl()
90 return pm_runtime_resume_and_get(sd->dev); in ak7375_open()
95 pm_runtime_put(sd->dev); in ak7375_close()
109 v4l2_async_unregister_subdev(&ak7375_dev->sd); in ak7375_subdev_cleanup()
110 v4l2_ctrl_handler_free(&ak7375_dev->ctrls_vcm); in ak7375_subdev_cleanup()
111 media_entity_cleanup(&ak7375_dev->sd.entity); in ak7375_subdev_cleanup()
116 struct v4l2_ctrl_handler *hdl = &dev_vcm->ctrls_vcm; in ak7375_init_controls()
121 dev_vcm->focus = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FOCUS_ABSOLUTE, in ak7375_init_controls()
124 if (hdl->error) in ak7375_init_controls()
125 dev_err(dev_vcm->sd.dev, "%s fail error: 0x%x\n", in ak7375_init_controls()
126 __func__, hdl->error); in ak7375_init_controls()
127 dev_vcm->sd.ctrl_handler = hdl; in ak7375_init_controls()
129 return hdl->error; in ak7375_init_controls()
137 ak7375_dev = devm_kzalloc(&client->dev, sizeof(*ak7375_dev), in ak7375_probe()
140 return -ENOMEM; in ak7375_probe()
142 v4l2_i2c_subdev_init(&ak7375_dev->sd, client, &ak7375_ops); in ak7375_probe()
143 ak7375_dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in ak7375_probe()
144 ak7375_dev->sd.internal_ops = &ak7375_int_ops; in ak7375_probe()
145 ak7375_dev->sd.entity.function = MEDIA_ENT_F_LENS; in ak7375_probe()
151 ret = media_entity_pads_init(&ak7375_dev->sd.entity, 0, NULL); in ak7375_probe()
155 ret = v4l2_async_register_subdev(&ak7375_dev->sd); in ak7375_probe()
159 pm_runtime_set_active(&client->dev); in ak7375_probe()
160 pm_runtime_enable(&client->dev); in ak7375_probe()
161 pm_runtime_idle(&client->dev); in ak7375_probe()
166 v4l2_ctrl_handler_free(&ak7375_dev->ctrls_vcm); in ak7375_probe()
167 media_entity_cleanup(&ak7375_dev->sd.entity); in ak7375_probe()
178 pm_runtime_disable(&client->dev); in ak7375_remove()
179 pm_runtime_set_suspended(&client->dev); in ak7375_remove()
184 * The lens position is gradually moved in units of AK7375_CTRL_STEPS,
193 if (!ak7375_dev->active) in ak7375_vcm_suspend()
196 for (val = ak7375_dev->focus->val & ~(AK7375_CTRL_STEPS - 1); in ak7375_vcm_suspend()
197 val >= 0; val -= AK7375_CTRL_STEPS) { in ak7375_vcm_suspend()
211 ak7375_dev->active = false; in ak7375_vcm_suspend()
219 * The lens position is gradually moved in units of AK7375_CTRL_STEPS,
228 if (ak7375_dev->active) in ak7375_vcm_resume()
238 for (val = ak7375_dev->focus->val % AK7375_CTRL_STEPS; in ak7375_vcm_resume()
239 val <= ak7375_dev->focus->val; in ak7375_vcm_resume()
249 ak7375_dev->active = true; in ak7375_vcm_resume()
255 { .compatible = "asahi-kasei,ak7375" },