diff options
author | Hao Tang <htang@nvidia.com> | 2012-08-31 14:02:50 +0800 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-09-26 10:46:18 -0700 |
commit | 52d5650f888629b0318b4d7a182e51c1d2012d64 (patch) | |
tree | 00fc7a150e7bdd8499fe5b9e91737ebf5b1b2db4 /drivers/media/video/tegra | |
parent | 84b90281f1eed6c803636a2230d1cac435e2d5dd (diff) |
media:video:tegra: add mwb for ov5640
Add manual white balance setting for OV5640
Bug 1019408
Change-Id: If047d9692ba810435b7bf03e3934ec204e8f6ad9
Signed-off-by: Hao Tang <htang@nvidia.com>
Reviewed-on: http://git-master/r/135112
Reviewed-by: Philip Breczinski <pbreczinski@nvidia.com>
Reviewed-by: Dan Willemsen <dwillemsen@nvidia.com>
Diffstat (limited to 'drivers/media/video/tegra')
-rw-r--r-- | drivers/media/video/tegra/ov5640.c | 30 | ||||
-rw-r--r-- | drivers/media/video/tegra/ov5640_tables.h | 57 |
2 files changed, 87 insertions, 0 deletions
diff --git a/drivers/media/video/tegra/ov5640.c b/drivers/media/video/tegra/ov5640.c index 7bbd2971940b..c3a79ef72981 100644 --- a/drivers/media/video/tegra/ov5640.c +++ b/drivers/media/video/tegra/ov5640.c @@ -315,6 +315,34 @@ static int ov5640_set_power(struct ov5640_info *info, u32 level) return 0; } +static int ov5640_set_wb(struct ov5640_info *info, u8 val) +{ + int err = 0; + + switch (val) { + case OV5640_WB_AUTO: + err = ov5640_write_table(info, wb_table[OV5640_WB_AUTO], NULL, 0); + break; + case OV5640_WB_INCANDESCENT: + err = ov5640_write_table(info, wb_table[OV5640_WB_INCANDESCENT], NULL, 0); + break; + case OV5640_WB_DAYLIGHT: + err = ov5640_write_table(info, wb_table[OV5640_WB_DAYLIGHT], NULL, 0); + break; + case OV5640_WB_FLUORESCENT: + err = ov5640_write_table(info, wb_table[OV5640_WB_FLUORESCENT], NULL, 0); + break; + case OV5640_WB_CLOUDY: + err = ov5640_write_table(info, wb_table[OV5640_WB_CLOUDY], NULL, 0); + break; + default: + dev_err(info->dev, "this wb setting not supported!\n"); + return -EINVAL; + } + + return err; +} + static long ov5640_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { @@ -384,6 +412,8 @@ static long ov5640_ioctl(struct file *file, } return 0; } + case OV5640_IOCTL_SET_WB: + return ov5640_set_wb(info, (u8)arg); default: return -EINVAL; } diff --git a/drivers/media/video/tegra/ov5640_tables.h b/drivers/media/video/tegra/ov5640_tables.h index 94cf1da31ec2..4065bcd936b9 100644 --- a/drivers/media/video/tegra/ov5640_tables.h +++ b/drivers/media/video/tegra/ov5640_tables.h @@ -4579,4 +4579,61 @@ static struct ov5640_reg tbl_release_focus[] = { {OV5640_TABLE_END, 0x0000} }; +static struct ov5640_reg wb_auto[] = { + {0x3406, 0x00}, + {OV5640_TABLE_END, 0x0000} +}; + +static struct ov5640_reg wb_incandescent[] = { + {0x3406, 0x01}, + {0x3400, 0x04}, + {0x3401, 0x10}, + {0x3402, 0x04}, + {0x3403, 0x00}, + {0x3404, 0x08}, + {0x3405, 0x40}, + {OV5640_TABLE_END, 0x0000} +}; + +static struct ov5640_reg wb_daylight[] = { + {0x3406, 0x01}, + {0x3400, 0x06}, + {0x3401, 0x1c}, + {0x3402, 0x04}, + {0x3403, 0x00}, + {0x3404, 0x04}, + {0x3405, 0xf3}, + {OV5640_TABLE_END, 0x0000} +}; + +static struct ov5640_reg wb_fluorescent[] = { + {0x3406, 0x01}, + {0x3400, 0x05}, + {0x3401, 0x48}, + {0x3402, 0x04}, + {0x3403, 0x00}, + {0x3404, 0x07}, + {0x3405, 0xcf}, + {OV5640_TABLE_END, 0x0000} +}; + +static struct ov5640_reg wb_cloudy[] = { + {0x3406, 0x01}, + {0x3400, 0x06}, + {0x3401, 0x48}, + {0x3402, 0x04}, + {0x3403, 0x00}, + {0x3404, 0x04}, + {0x3405, 0xd3}, + {OV5640_TABLE_END, 0x0000} +}; + +static struct ov5640_reg *wb_table[] = { + [OV5640_WB_AUTO] = wb_auto, + [OV5640_WB_INCANDESCENT] = wb_incandescent, + [OV5640_WB_DAYLIGHT] = wb_daylight, + [OV5640_WB_FLUORESCENT] = wb_fluorescent, + [OV5640_WB_CLOUDY] = wb_cloudy, +}; + #endif |