mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 00:26:42 +07:00
V4L/DVB (12530): soc-camera: switch to using v4l2_subdev_call()
Use v4l2_subdev_call() instead of v4l2_device_call_until_err() in all host drivers and in soc-camera core. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
08590b9613
commit
c9c1f1c0db
@ -465,9 +465,7 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd)
|
||||
static int mx1_camera_set_crop(struct soc_camera_device *icd,
|
||||
struct v4l2_crop *a)
|
||||
{
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct device *control = to_soc_camera_control(icd);
|
||||
struct v4l2_subdev *sd = dev_get_drvdata(control);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
|
||||
return v4l2_subdev_call(sd, video, s_crop, a);
|
||||
}
|
||||
@ -539,7 +537,7 @@ static int mx1_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
|
||||
static int mx1_camera_set_fmt(struct soc_camera_device *icd,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
const struct soc_camera_format_xlate *xlate;
|
||||
struct v4l2_pix_format *pix = &f->fmt.pix;
|
||||
int ret;
|
||||
@ -550,7 +548,7 @@ static int mx1_camera_set_fmt(struct soc_camera_device *icd,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = v4l2_device_call_until_err(&ici->v4l2_dev, 0, video, s_fmt, f);
|
||||
ret = v4l2_subdev_call(sd, video, s_fmt, f);
|
||||
if (!ret) {
|
||||
icd->buswidth = xlate->buswidth;
|
||||
icd->current_fmt = xlate->host_fmt;
|
||||
@ -562,11 +560,11 @@ static int mx1_camera_set_fmt(struct soc_camera_device *icd,
|
||||
static int mx1_camera_try_fmt(struct soc_camera_device *icd,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
/* TODO: limit to mx1 hardware capabilities */
|
||||
|
||||
/* limit to sensor capabilities */
|
||||
return v4l2_device_call_until_err(&ici->v4l2_dev, 0, video, try_fmt, f);
|
||||
return v4l2_subdev_call(sd, video, try_fmt, f);
|
||||
}
|
||||
|
||||
static int mx1_camera_reqbufs(struct soc_camera_file *icf,
|
||||
|
@ -786,8 +786,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd,
|
||||
struct v4l2_rect *rect = &a->c;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct mx3_camera_dev *mx3_cam = ici->priv;
|
||||
struct device *control = to_soc_camera_control(icd);
|
||||
struct v4l2_subdev *sd = dev_get_drvdata(control);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
|
||||
/*
|
||||
* We now know pixel formats and can decide upon DMA-channel(s)
|
||||
@ -809,6 +808,7 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd,
|
||||
{
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct mx3_camera_dev *mx3_cam = ici->priv;
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
const struct soc_camera_format_xlate *xlate;
|
||||
struct v4l2_pix_format *pix = &f->fmt.pix;
|
||||
struct v4l2_rect rect = {
|
||||
@ -837,7 +837,7 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd,
|
||||
|
||||
configure_geometry(mx3_cam, &rect);
|
||||
|
||||
ret = v4l2_device_call_until_err(&ici->v4l2_dev, 0, video, s_fmt, f);
|
||||
ret = v4l2_subdev_call(sd, video, s_fmt, f);
|
||||
if (!ret) {
|
||||
icd->buswidth = xlate->buswidth;
|
||||
icd->current_fmt = xlate->host_fmt;
|
||||
@ -849,7 +849,7 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd,
|
||||
static int mx3_camera_try_fmt(struct soc_camera_device *icd,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
const struct soc_camera_format_xlate *xlate;
|
||||
struct v4l2_pix_format *pix = &f->fmt.pix;
|
||||
__u32 pixfmt = pix->pixelformat;
|
||||
@ -875,7 +875,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd,
|
||||
/* camera has to see its format, but the user the original one */
|
||||
pix->pixelformat = xlate->cam_fmt->fourcc;
|
||||
/* limit to sensor capabilities */
|
||||
ret = v4l2_device_call_until_err(&ici->v4l2_dev, 0, video, try_fmt, f);
|
||||
ret = v4l2_subdev_call(sd, video, try_fmt, f);
|
||||
pix->pixelformat = xlate->host_fmt->fourcc;
|
||||
|
||||
field = pix->field;
|
||||
|
@ -1286,8 +1286,7 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd,
|
||||
struct v4l2_rect *rect = &a->c;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct pxa_camera_dev *pcdev = ici->priv;
|
||||
struct device *control = to_soc_camera_control(icd);
|
||||
struct v4l2_subdev *sd = dev_get_drvdata(control);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
struct soc_camera_sense sense = {
|
||||
.master_clock = pcdev->mclk,
|
||||
.pixel_clock_max = pcdev->ciclk / 4,
|
||||
@ -1323,6 +1322,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd,
|
||||
{
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct pxa_camera_dev *pcdev = ici->priv;
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
const struct soc_camera_data_format *cam_fmt = NULL;
|
||||
const struct soc_camera_format_xlate *xlate = NULL;
|
||||
struct soc_camera_sense sense = {
|
||||
@ -1346,7 +1346,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd,
|
||||
icd->sense = &sense;
|
||||
|
||||
cam_f.fmt.pix.pixelformat = cam_fmt->fourcc;
|
||||
ret = v4l2_device_call_until_err(&ici->v4l2_dev, 0, video, s_fmt, f);
|
||||
ret = v4l2_subdev_call(sd, video, s_fmt, f);
|
||||
|
||||
icd->sense = NULL;
|
||||
|
||||
@ -1375,6 +1375,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
const struct soc_camera_format_xlate *xlate;
|
||||
struct v4l2_pix_format *pix = &f->fmt.pix;
|
||||
__u32 pixfmt = pix->pixelformat;
|
||||
@ -1404,7 +1405,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
|
||||
/* camera has to see its format, but the user the original one */
|
||||
pix->pixelformat = xlate->cam_fmt->fourcc;
|
||||
/* limit to sensor capabilities */
|
||||
ret = v4l2_device_call_until_err(&ici->v4l2_dev, 0, video, try_fmt, f);
|
||||
ret = v4l2_subdev_call(sd, video, try_fmt, f);
|
||||
pix->pixelformat = xlate->host_fmt->fourcc;
|
||||
|
||||
field = pix->field;
|
||||
|
@ -854,8 +854,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
|
||||
struct v4l2_crop cam_crop;
|
||||
struct v4l2_rect *cam_rect = &cam_crop.c, target, cam_max;
|
||||
struct sh_mobile_ceu_cam *cam = icd->host_priv;
|
||||
struct device *control = to_soc_camera_control(icd);
|
||||
struct v4l2_subdev *sd = dev_get_drvdata(control);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
unsigned int hscale = pcdev->cflcr & 0xffff;
|
||||
unsigned int vscale = (pcdev->cflcr >> 16) & 0xffff;
|
||||
unsigned short width, height;
|
||||
@ -1016,6 +1015,7 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
|
||||
struct sh_mobile_ceu_dev *pcdev = ici->priv;
|
||||
struct sh_mobile_ceu_cam *cam = icd->host_priv;
|
||||
struct v4l2_pix_format *pix = &f->fmt.pix;
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
__u32 pixfmt = pix->pixelformat;
|
||||
const struct soc_camera_format_xlate *xlate;
|
||||
unsigned int width = pix->width, height = pix->height, tmp_w, tmp_h;
|
||||
@ -1042,7 +1042,7 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
|
||||
}
|
||||
|
||||
pix->pixelformat = xlate->cam_fmt->fourcc;
|
||||
ret = v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, video, s_fmt, f);
|
||||
ret = v4l2_subdev_call(sd, video, s_fmt, f);
|
||||
pix->pixelformat = pixfmt;
|
||||
dev_dbg(&icd->dev, "Camera %d fmt %ux%u, requested %ux%u, max %ux%u\n",
|
||||
ret, pix->width, pix->height, width, height,
|
||||
@ -1082,8 +1082,7 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
|
||||
pix->width = tmp_w;
|
||||
pix->height = tmp_h;
|
||||
pix->pixelformat = xlate->cam_fmt->fourcc;
|
||||
ret = v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd,
|
||||
video, s_fmt, f);
|
||||
ret = v4l2_subdev_call(sd, video, s_fmt, f);
|
||||
pix->pixelformat = pixfmt;
|
||||
dev_dbg(&icd->dev, "Camera scaled to %ux%u\n",
|
||||
pix->width, pix->height);
|
||||
@ -1140,6 +1139,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
const struct soc_camera_format_xlate *xlate;
|
||||
struct v4l2_pix_format *pix = &f->fmt.pix;
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
__u32 pixfmt = pix->pixelformat;
|
||||
int width, height;
|
||||
int ret;
|
||||
@ -1165,8 +1165,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
|
||||
pix->pixelformat = xlate->cam_fmt->fourcc;
|
||||
|
||||
/* limit to sensor capabilities */
|
||||
ret = v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, video,
|
||||
try_fmt, f);
|
||||
ret = v4l2_subdev_call(sd, video, try_fmt, f);
|
||||
pix->pixelformat = pixfmt;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -1182,9 +1181,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
|
||||
int tmp_w = pix->width, tmp_h = pix->height;
|
||||
pix->width = 2560;
|
||||
pix->height = 1920;
|
||||
ret = v4l2_device_call_until_err(&ici->v4l2_dev,
|
||||
(__u32)icd, video,
|
||||
try_fmt, f);
|
||||
ret = v4l2_subdev_call(sd, video, try_fmt, f);
|
||||
if (ret < 0) {
|
||||
/* Shouldn't actually happen... */
|
||||
dev_err(&icd->dev,
|
||||
|
@ -152,9 +152,9 @@ static int soc_camera_s_std(struct file *file, void *priv, v4l2_std_id *a)
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
|
||||
return v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, core, s_std, *a);
|
||||
return v4l2_subdev_call(sd, core, s_std, *a);
|
||||
}
|
||||
|
||||
static int soc_camera_reqbufs(struct file *file, void *priv,
|
||||
@ -589,7 +589,7 @@ static int soc_camera_streamon(struct file *file, void *priv,
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
int ret;
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
@ -599,7 +599,7 @@ static int soc_camera_streamon(struct file *file, void *priv,
|
||||
|
||||
mutex_lock(&icd->video_lock);
|
||||
|
||||
v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, video, s_stream, 1);
|
||||
v4l2_subdev_call(sd, video, s_stream, 1);
|
||||
|
||||
/* This calls buf_queue from host driver's videobuf_queue_ops */
|
||||
ret = videobuf_streamon(&icf->vb_vidq);
|
||||
@ -614,7 +614,7 @@ static int soc_camera_streamoff(struct file *file, void *priv,
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
|
||||
@ -627,7 +627,7 @@ static int soc_camera_streamoff(struct file *file, void *priv,
|
||||
* remaining buffers. When the last buffer is freed, stop capture */
|
||||
videobuf_streamoff(&icf->vb_vidq);
|
||||
|
||||
v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, video, s_stream, 0);
|
||||
v4l2_subdev_call(sd, video, s_stream, 0);
|
||||
|
||||
mutex_unlock(&icd->video_lock);
|
||||
|
||||
@ -672,6 +672,7 @@ static int soc_camera_g_ctrl(struct file *file, void *priv,
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
int ret;
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
@ -695,7 +696,7 @@ static int soc_camera_g_ctrl(struct file *file, void *priv,
|
||||
return ret;
|
||||
}
|
||||
|
||||
return v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, core, g_ctrl, ctrl);
|
||||
return v4l2_subdev_call(sd, core, g_ctrl, ctrl);
|
||||
}
|
||||
|
||||
static int soc_camera_s_ctrl(struct file *file, void *priv,
|
||||
@ -704,6 +705,7 @@ static int soc_camera_s_ctrl(struct file *file, void *priv,
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
int ret;
|
||||
|
||||
WARN_ON(priv != file->private_data);
|
||||
@ -714,7 +716,7 @@ static int soc_camera_s_ctrl(struct file *file, void *priv,
|
||||
return ret;
|
||||
}
|
||||
|
||||
return v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, core, s_ctrl, ctrl);
|
||||
return v4l2_subdev_call(sd, core, s_ctrl, ctrl);
|
||||
}
|
||||
|
||||
static int soc_camera_cropcap(struct file *file, void *fh,
|
||||
@ -812,9 +814,9 @@ static int soc_camera_g_chip_ident(struct file *file, void *fh,
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
|
||||
return v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, core, g_chip_ident, id);
|
||||
return v4l2_subdev_call(sd, core, g_chip_ident, id);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
@ -823,9 +825,9 @@ static int soc_camera_g_register(struct file *file, void *fh,
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
|
||||
return v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, core, g_register, reg);
|
||||
return v4l2_subdev_call(sd, core, g_register, reg);
|
||||
}
|
||||
|
||||
static int soc_camera_s_register(struct file *file, void *fh,
|
||||
@ -833,9 +835,9 @@ static int soc_camera_s_register(struct file *file, void *fh,
|
||||
{
|
||||
struct soc_camera_file *icf = file->private_data;
|
||||
struct soc_camera_device *icd = icf->icd;
|
||||
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
|
||||
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
|
||||
|
||||
return v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, core, s_register, reg);
|
||||
return v4l2_subdev_call(sd, core, s_register, reg);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -126,28 +126,34 @@ struct soc_camera_link {
|
||||
void (*free_bus)(struct soc_camera_link *);
|
||||
};
|
||||
|
||||
static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
|
||||
static inline struct soc_camera_device *to_soc_camera_dev(const struct device *dev)
|
||||
{
|
||||
return container_of(dev, struct soc_camera_device, dev);
|
||||
}
|
||||
|
||||
static inline struct soc_camera_host *to_soc_camera_host(struct device *dev)
|
||||
static inline struct soc_camera_host *to_soc_camera_host(const struct device *dev)
|
||||
{
|
||||
struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
|
||||
|
||||
return container_of(v4l2_dev, struct soc_camera_host, v4l2_dev);
|
||||
}
|
||||
|
||||
static inline struct soc_camera_link *to_soc_camera_link(struct soc_camera_device *icd)
|
||||
static inline struct soc_camera_link *to_soc_camera_link(const struct soc_camera_device *icd)
|
||||
{
|
||||
return icd->dev.platform_data;
|
||||
}
|
||||
|
||||
static inline struct device *to_soc_camera_control(struct soc_camera_device *icd)
|
||||
static inline struct device *to_soc_camera_control(const struct soc_camera_device *icd)
|
||||
{
|
||||
return dev_get_drvdata(&icd->dev);
|
||||
}
|
||||
|
||||
static inline struct v4l2_subdev *soc_camera_to_subdev(const struct soc_camera_device *icd)
|
||||
{
|
||||
struct device *control = to_soc_camera_control(icd);
|
||||
return dev_get_drvdata(control);
|
||||
}
|
||||
|
||||
int soc_camera_host_register(struct soc_camera_host *ici);
|
||||
void soc_camera_host_unregister(struct soc_camera_host *ici);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user