16 #include <linux/i2c.h>
18 #include <linux/videodev2.h>
213 if (!info->
ver.af || !af_lock)
222 static int m5mols_set_metering_mode(
struct m5mols_info *info,
int mode)
241 static int m5mols_set_exposure(
struct m5mols_info *info,
int exposure)
249 m5mols_3a_lock(info, info->
lock_3a);
251 ret = m5mols_set_metering_mode(info, info->
metering->val);
256 "%s: exposure bias: %#x, metering: %#x\n",
279 static int m5mols_set_white_balance(
struct m5mols_info *info,
int val)
281 static const unsigned short wb[][2] = {
302 "Setting white balance to: %#x\n", wb[i][0]);
317 static int m5mols_set_saturation(
struct m5mols_info *info,
int val)
326 static int m5mols_set_color_effect(
struct m5mols_info *info,
int val)
330 unsigned int cfix_r = 0, cfix_b = 0;
362 "p_effect: %#x, m_effect: %#x, r: %#x, b: %#x (%d)\n",
363 p_effect, m_effect, cfix_r, cfix_b, ret);
368 static int m5mols_set_iso(
struct m5mols_info *info,
int auto_iso)
370 u32 iso = auto_iso ? 0 : info->
iso->val + 1;
375 static int m5mols_set_wdr(
struct m5mols_info *info,
int wdr)
390 static int m5mols_set_stabilization(
struct m5mols_info *info,
int val)
393 unsigned int evp = val ? 0xe : 0x0;
403 static int m5mols_g_volatile_ctrl(
struct v4l2_ctrl *ctrl)
422 info->
iso->val = status - 1;
449 static int m5mols_s_ctrl(
struct v4l2_ctrl *ctrl)
451 unsigned int ctrl_mode = m5mols_get_ctrl_mode(ctrl);
454 int last_mode = info->
mode;
469 if (ctrl_mode && ctrl_mode != info->
mode) {
477 ret = m5mols_3a_lock(info, ctrl);
485 ret = m5mols_set_exposure(info, ctrl->
val);
489 ret = m5mols_set_iso(info, ctrl->
val);
493 ret = m5mols_set_white_balance(info, ctrl->
val);
497 ret = m5mols_set_saturation(info, ctrl->
val);
501 ret = m5mols_set_color_effect(info, ctrl->
val);
505 ret = m5mols_set_wdr(info, ctrl->
val);
509 ret = m5mols_set_stabilization(info, ctrl->
val);
517 if (ret == 0 && info->
mode != last_mode)
524 .g_volatile_ctrl = m5mols_g_volatile_ctrl,
525 .s_ctrl = m5mols_s_ctrl,
529 static const s64 iso_qmenu[] = {
531 50000, 100000, 200000, 400000, 800000, 1600000, 3200000
535 static const s64 ev_bias_qmenu[] = {
537 -2000, -1500, -1000, -500, 0, 500, 1000, 1500, 2000
566 0, exposure_max, 1, exposure_max / 2);
608 int ret = info->
handle.error;
609 v4l2_err(sd,
"Failed to initialize controls: %d\n", ret);