Commit 33601db0 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

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: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c43c43c7
...@@ -496,7 +496,6 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, ...@@ -496,7 +496,6 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd,
ceu_write(pcdev, CAPWR, (height << 16) | width); ceu_write(pcdev, CAPWR, (height << 16) | width);
ceu_write(pcdev, CFLCR, 0); /* no scaling */ ceu_write(pcdev, CFLCR, 0); /* no scaling */
ceu_write(pcdev, CFSZR, (height << 16) | cfszr_width); 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) /* A few words about byte order (observed in Big Endian mode)
* *
...@@ -773,6 +772,55 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q, ...@@ -773,6 +772,55 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q,
icd); 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 = { static struct soc_camera_host_ops sh_mobile_ceu_host_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.add = sh_mobile_ceu_add_device, .add = sh_mobile_ceu_add_device,
...@@ -781,11 +829,15 @@ static struct soc_camera_host_ops sh_mobile_ceu_host_ops = { ...@@ -781,11 +829,15 @@ static struct soc_camera_host_ops sh_mobile_ceu_host_ops = {
.set_crop = sh_mobile_ceu_set_crop, .set_crop = sh_mobile_ceu_set_crop,
.set_fmt = sh_mobile_ceu_set_fmt, .set_fmt = sh_mobile_ceu_set_fmt,
.try_fmt = sh_mobile_ceu_try_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, .reqbufs = sh_mobile_ceu_reqbufs,
.poll = sh_mobile_ceu_poll, .poll = sh_mobile_ceu_poll,
.querycap = sh_mobile_ceu_querycap, .querycap = sh_mobile_ceu_querycap,
.set_bus_param = sh_mobile_ceu_set_bus_param, .set_bus_param = sh_mobile_ceu_set_bus_param,
.init_videobuf = sh_mobile_ceu_init_videobuf, .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) static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment