facetimehd: Add control for auto white balance

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
This commit is contained in:
Patrik Jakobsson
2015-12-06 14:47:26 +01:00
parent eb3e43505d
commit 2b45fb581a
3 changed files with 24 additions and 0 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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");