diff --git a/fthd_isp.c b/fthd_isp.c index 58b84af..3a4c732 100644 --- a/fthd_isp.c +++ b/fthd_isp.c @@ -1100,6 +1100,20 @@ int fthd_isp_cmd_channel_hue_set(struct fthd_private *dev_priv, int channel, int return fthd_isp_cmd(dev_priv, CISP_CMD_CH_SCALER_HUE_SET, &cmd, sizeof(cmd), &len); } +int fthd_isp_cmd_channel_awb(struct fthd_private *dev_priv, int channel, int enable) +{ + struct isp_cmd_channel cmd; + enum fthd_isp_cmds op; + int len; + + pr_debug("set awb %s\n", enable ? "on" : "off"); + + cmd.channel = channel; + op = enable ? CISP_CMD_CH_AWB_START : CISP_CMD_CH_AWB_STOP; + len = sizeof(cmd); + return fthd_isp_cmd(dev_priv, op, &cmd, sizeof(cmd), &len); +} + int fthd_start_channel(struct fthd_private *dev_priv, int channel) { int ret, x1 = 0, x2 = 0, pixelformat; diff --git a/fthd_isp.h b/fthd_isp.h index a7c5136..acc944a 100644 --- a/fthd_isp.h +++ b/fthd_isp.h @@ -702,10 +702,15 @@ struct isp_cmd_channel_hue_set { u32 contrast; }; +struct isp_cmd_channel { + u32 channel; +}; + struct isp_cmd_channel_buffer_return { u32 channel; }; + struct fthd_isp_debug_cmd { u32 show_errors; u32 arg[64]; @@ -762,6 +767,7 @@ extern int fthd_isp_cmd_channel_brightness_set(struct fthd_private *dev_priv, in extern int fthd_isp_cmd_channel_contrast_set(struct fthd_private *dev_priv, int channel, int contrast); extern int fthd_isp_cmd_channel_saturation_set(struct fthd_private *dev_priv, int channel, int saturation); extern int fthd_isp_cmd_channel_hue_set(struct fthd_private *dev_priv, int channel, int hue); +extern int fthd_isp_cmd_channel_awb(struct fthd_private *dev_priv, int channel, int hue); extern int fthd_isp_cmd_channel_buffer_return(struct fthd_private *dev_priv, int channel); extern int fthd_start_channel(struct fthd_private *dev_priv, int channel); extern int fthd_stop_channel(struct fthd_private *dev_priv, int channel); diff --git a/fthd_v4l2.c b/fthd_v4l2.c index cc09501..367a297 100644 --- a/fthd_v4l2.c +++ b/fthd_v4l2.c @@ -626,6 +626,8 @@ static int fthd_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_HUE: ret = fthd_isp_cmd_channel_hue_set(dev_priv, 0, ctrl->val); break; + case V4L2_CID_AUTO_WHITE_BALANCE: + ret = fthd_isp_cmd_channel_awb(dev_priv, 0, ctrl->val); default: break; @@ -684,6 +686,8 @@ int fthd_v4l2_register(struct fthd_private *dev_priv) V4L2_CID_SATURATION, 0, 0xff, 1, 0x80); v4l2_ctrl_new_std(&dev_priv->v4l2_ctrl_handler, &fthd_ctrl_ops, V4L2_CID_HUE, 0, 0xff, 1, 0x80); + v4l2_ctrl_new_std(&dev_priv->v4l2_ctrl_handler, &fthd_ctrl_ops, + V4L2_CID_AUTO_WHITE_BALANCE, 0, 1, 1, 1); if (dev_priv->v4l2_ctrl_handler.error) { pr_err("failed to setup control handlers\n");