diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-08-25 16:44:15 +0200 |
---|---|---|
committer | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-08-25 16:44:15 +0200 |
commit | cf579adf1e145c22f0c7178612e4781cc8b089cc (patch) | |
tree | e2587bfd0c5fe0bed915b31e959187de48b6ce59 | |
parent | ac97b8b24a867c8c2d3dd71d3c3d12b078b8091c (diff) | |
download | mediapointer-dvb-s2-cf579adf1e145c22f0c7178612e4781cc8b089cc.tar.gz mediapointer-dvb-s2-cf579adf1e145c22f0c7178612e4781cc8b089cc.tar.bz2 |
sh_mobile_ceu_camera: add a control for the camera low-pass filter
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Use the V4L2_CID_SHARPNESS control to switch SH-mobile camera low-pass filter.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Priority: low
---
drivers/media/video/sh_mobile_ceu_camera.c | 54 +++++++++++++++++++++++++++-
1 files changed, 53 insertions(+), 1 deletions(-)
-rw-r--r-- | linux/drivers/media/video/sh_mobile_ceu_camera.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/linux/drivers/media/video/sh_mobile_ceu_camera.c b/linux/drivers/media/video/sh_mobile_ceu_camera.c index f1ab7b690..99ea30896 100644 --- a/linux/drivers/media/video/sh_mobile_ceu_camera.c +++ b/linux/drivers/media/video/sh_mobile_ceu_camera.c @@ -497,7 +497,6 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, ceu_write(pcdev, CAPWR, (height << 16) | width); ceu_write(pcdev, CFLCR, 0); /* no scaling */ ceu_write(pcdev, CFSZR, (height << 16) | cfszr_width); - ceu_write(pcdev, CLFCR, 0); /* no lowpass filter */ /* A few words about byte order (observed in Big Endian mode) * @@ -774,6 +773,55 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q, icd); } +static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd, + struct v4l2_control *ctrl) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct sh_mobile_ceu_dev *pcdev = ici->priv; + u32 val; + + switch (ctrl->id) { + case V4L2_CID_SHARPNESS: + val = ceu_read(pcdev, CLFCR); + ctrl->value = val ^ 1; + return 0; + } + return -ENOIOCTLCMD; +} + +static int sh_mobile_ceu_set_ctrl(struct soc_camera_device *icd, + struct v4l2_control *ctrl) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct sh_mobile_ceu_dev *pcdev = ici->priv; + + switch (ctrl->id) { + case V4L2_CID_SHARPNESS: + switch (icd->current_fmt->fourcc) { + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + case V4L2_PIX_FMT_NV16: + case V4L2_PIX_FMT_NV61: + ceu_write(pcdev, CLFCR, !ctrl->value); + return 0; + } + return -EINVAL; + } + return -ENOIOCTLCMD; +} + +static const struct v4l2_queryctrl sh_mobile_ceu_controls[] = { + { + .id = V4L2_CID_SHARPNESS, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Low-pass filter", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0, + }, +}; + static struct soc_camera_host_ops sh_mobile_ceu_host_ops = { .owner = THIS_MODULE, .add = sh_mobile_ceu_add_device, @@ -782,11 +830,15 @@ static struct soc_camera_host_ops sh_mobile_ceu_host_ops = { .set_crop = sh_mobile_ceu_set_crop, .set_fmt = sh_mobile_ceu_set_fmt, .try_fmt = sh_mobile_ceu_try_fmt, + .set_ctrl = sh_mobile_ceu_set_ctrl, + .get_ctrl = sh_mobile_ceu_get_ctrl, .reqbufs = sh_mobile_ceu_reqbufs, .poll = sh_mobile_ceu_poll, .querycap = sh_mobile_ceu_querycap, .set_bus_param = sh_mobile_ceu_set_bus_param, .init_videobuf = sh_mobile_ceu_init_videobuf, + .controls = sh_mobile_ceu_controls, + .num_controls = ARRAY_SIZE(sh_mobile_ceu_controls), }; static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev) |