aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:44:15 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:18:41 -0400
commit4a6110bc50da9a1883bf45614ac1d591253f0457 (patch)
tree7f836e44406f8656ebbc920ed71a88dc9f729064 /drivers
parent2840d2497b912f25d2957477faa1c922ddd733e0 (diff)
V4L/DVB (12514): sh_mobile_ceu_camera: add a control for the camera low-pass filter
Use the V4L2_CID_SHARPNESS control to switch SH-mobile camera low-pass filter. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 5101fa7cdb2f..16fa56efaf99 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -495,7 +495,6 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd,
495 ceu_write(pcdev, CAPWR, (height << 16) | width); 495 ceu_write(pcdev, CAPWR, (height << 16) | width);
496 ceu_write(pcdev, CFLCR, 0); /* no scaling */ 496 ceu_write(pcdev, CFLCR, 0); /* no scaling */
497 ceu_write(pcdev, CFSZR, (height << 16) | cfszr_width); 497 ceu_write(pcdev, CFSZR, (height << 16) | cfszr_width);
498 ceu_write(pcdev, CLFCR, 0); /* no lowpass filter */
499 498
500 /* A few words about byte order (observed in Big Endian mode) 499 /* A few words about byte order (observed in Big Endian mode)
501 * 500 *
@@ -772,6 +771,55 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q,
772 icd); 771 icd);
773} 772}
774 773
774static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd,
775 struct v4l2_control *ctrl)
776{
777 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
778 struct sh_mobile_ceu_dev *pcdev = ici->priv;
779 u32 val;
780
781 switch (ctrl->id) {
782 case V4L2_CID_SHARPNESS:
783 val = ceu_read(pcdev, CLFCR);
784 ctrl->value = val ^ 1;
785 return 0;
786 }
787 return -ENOIOCTLCMD;
788}
789
790static int sh_mobile_ceu_set_ctrl(struct soc_camera_device *icd,
791 struct v4l2_control *ctrl)
792{
793 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
794 struct sh_mobile_ceu_dev *pcdev = ici->priv;
795
796 switch (ctrl->id) {
797 case V4L2_CID_SHARPNESS:
798 switch (icd->current_fmt->fourcc) {
799 case V4L2_PIX_FMT_NV12:
800 case V4L2_PIX_FMT_NV21:
801 case V4L2_PIX_FMT_NV16:
802 case V4L2_PIX_FMT_NV61:
803 ceu_write(pcdev, CLFCR, !ctrl->value);
804 return 0;
805 }
806 return -EINVAL;
807 }
808 return -ENOIOCTLCMD;
809}
810
811static const struct v4l2_queryctrl sh_mobile_ceu_controls[] = {
812 {
813 .id = V4L2_CID_SHARPNESS,
814 .type = V4L2_CTRL_TYPE_BOOLEAN,
815 .name = "Low-pass filter",
816 .minimum = 0,
817 .maximum = 1,
818 .step = 1,
819 .default_value = 0,
820 },
821};
822
775static struct soc_camera_host_ops sh_mobile_ceu_host_ops = { 823static struct soc_camera_host_ops sh_mobile_ceu_host_ops = {
776 .owner = THIS_MODULE, 824 .owner = THIS_MODULE,
777 .add = sh_mobile_ceu_add_device, 825 .add = sh_mobile_ceu_add_device,
@@ -780,11 +828,15 @@ static struct soc_camera_host_ops sh_mobile_ceu_host_ops = {
780 .set_crop = sh_mobile_ceu_set_crop, 828 .set_crop = sh_mobile_ceu_set_crop,
781 .set_fmt = sh_mobile_ceu_set_fmt, 829 .set_fmt = sh_mobile_ceu_set_fmt,
782 .try_fmt = sh_mobile_ceu_try_fmt, 830 .try_fmt = sh_mobile_ceu_try_fmt,
831 .set_ctrl = sh_mobile_ceu_set_ctrl,
832 .get_ctrl = sh_mobile_ceu_get_ctrl,
783 .reqbufs = sh_mobile_ceu_reqbufs, 833 .reqbufs = sh_mobile_ceu_reqbufs,
784 .poll = sh_mobile_ceu_poll, 834 .poll = sh_mobile_ceu_poll,
785 .querycap = sh_mobile_ceu_querycap, 835 .querycap = sh_mobile_ceu_querycap,
786 .set_bus_param = sh_mobile_ceu_set_bus_param, 836 .set_bus_param = sh_mobile_ceu_set_bus_param,
787 .init_videobuf = sh_mobile_ceu_init_videobuf, 837 .init_videobuf = sh_mobile_ceu_init_videobuf,
838 .controls = sh_mobile_ceu_controls,
839 .num_controls = ARRAY_SIZE(sh_mobile_ceu_controls),
788}; 840};
789 841
790static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev) 842static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev)