Re: [PATCH 03/19] em28xx: start moving em28xx-v4l specific data to its own struct
On 05/11/2014 10:46 PM, Frank Schäfer wrote: > > Am 09.05.2014 11:17, schrieb Hans Verkuil: >> Some comments for future improvements: >> >> On 03/24/2014 08:33 PM, Frank Schäfer wrote: >>> Signed-off-by: Frank Schäfer >>> --- >>> drivers/media/usb/em28xx/em28xx-camera.c | 4 +- >>> drivers/media/usb/em28xx/em28xx-video.c | 160 >>> +-- >>> drivers/media/usb/em28xx/em28xx.h| 8 +- >>> 3 files changed, 116 insertions(+), 56 deletions(-) >>> >>> diff --git a/drivers/media/usb/em28xx/em28xx-camera.c >>> b/drivers/media/usb/em28xx/em28xx-camera.c >>> index 505e050..daebef3 100644 >>> --- a/drivers/media/usb/em28xx/em28xx-camera.c >>> +++ b/drivers/media/usb/em28xx/em28xx-camera.c >>> @@ -365,7 +365,7 @@ int em28xx_init_camera(struct em28xx *dev) >>> dev->sensor_xtal = 430; >>> pdata.xtal = dev->sensor_xtal; >>> if (NULL == >>> - v4l2_i2c_new_subdev_board(&dev->v4l2_dev, adap, >>> + v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, >>> &mt9v011_info, NULL)) { >>> ret = -ENODEV; >>> break; >>> @@ -422,7 +422,7 @@ int em28xx_init_camera(struct em28xx *dev) >>> dev->sensor_yres = 480; >>> >>> subdev = >>> -v4l2_i2c_new_subdev_board(&dev->v4l2_dev, adap, >>> +v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, >>>&ov2640_info, NULL); >>> if (NULL == subdev) { >>> ret = -ENODEV; >>> diff --git a/drivers/media/usb/em28xx/em28xx-video.c >>> b/drivers/media/usb/em28xx/em28xx-video.c >>> index 45ad471..89947db 100644 >>> --- a/drivers/media/usb/em28xx/em28xx-video.c >>> +++ b/drivers/media/usb/em28xx/em28xx-video.c >>> @@ -189,10 +189,11 @@ static int em28xx_vbi_supported(struct em28xx *dev) >>> */ >>> static void em28xx_wake_i2c(struct em28xx *dev) >>> { >>> - v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, 0); >>> - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, >>> + struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; >>> + v4l2_device_call_all(v4l2_dev, 0, core, reset, 0); >>> + v4l2_device_call_all(v4l2_dev, 0, video, s_routing, >>> INPUT(dev->ctl_input)->vmux, 0, 0); >>> - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); >>> + v4l2_device_call_all(v4l2_dev, 0, video, s_stream, 0); >>> } >>> >>> static int em28xx_colorlevels_set_default(struct em28xx *dev) >>> @@ -952,7 +953,8 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, >>> unsigned int count) >>> f.type = V4L2_TUNER_RADIO; >>> else >>> f.type = V4L2_TUNER_ANALOG_TV; >>> - v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); >>> + v4l2_device_call_all(&dev->v4l2->v4l2_dev, >>> +0, tuner, s_frequency, &f); >>> } >>> >>> dev->streaming_users++; >>> @@ -1083,6 +1085,7 @@ static int em28xx_vb2_setup(struct em28xx *dev) >>> >>> static void video_mux(struct em28xx *dev, int index) >>> { >>> + struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; >>> dev->ctl_input = index; >>> dev->ctl_ainput = INPUT(index)->amux; >>> dev->ctl_aoutput = INPUT(index)->aout; >>> @@ -1090,21 +1093,21 @@ static void video_mux(struct em28xx *dev, int index) >>> if (!dev->ctl_aoutput) >>> dev->ctl_aoutput = EM28XX_AOUT_MASTER; >>> >>> - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, >>> + v4l2_device_call_all(v4l2_dev, 0, video, s_routing, >>> INPUT(index)->vmux, 0, 0); >>> >>> if (dev->board.has_msp34xx) { >>> if (dev->i2s_speed) { >>> - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, >>> + v4l2_device_call_all(v4l2_dev, 0, audio, >>> s_i2s_clock_freq, dev->i2s_speed); >>> } >>> /* Note: this is msp3400 specific */ >>> - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, >>> + v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, >>> dev->ctl_ainput, MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0); >>> } >>> >>> if (dev->board.adecoder != EM28XX_NOADECODER) { >>> - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, >>> + v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, >>> dev->ctl_ainput, dev->ctl_aoutput, 0); >>> } >>> >>> @@ -1344,7 +1347,7 @@ static int vidioc_querystd(struct file *file, void >>> *priv, v4l2_std_id *norm) >>> struct em28xx_fh *fh = priv; >>> struct em28xx *dev = fh->dev; >>> >>> - v4l2_device_call_all(&dev->v4l2_dev, 0, video, querystd, norm); >>> + v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, video, querystd, norm); >>> >>> return
Re: [PATCH 03/19] em28xx: start moving em28xx-v4l specific data to its own struct
Am 09.05.2014 11:17, schrieb Hans Verkuil: > Some comments for future improvements: > > On 03/24/2014 08:33 PM, Frank Schäfer wrote: >> Signed-off-by: Frank Schäfer >> --- >> drivers/media/usb/em28xx/em28xx-camera.c | 4 +- >> drivers/media/usb/em28xx/em28xx-video.c | 160 >> +-- >> drivers/media/usb/em28xx/em28xx.h| 8 +- >> 3 files changed, 116 insertions(+), 56 deletions(-) >> >> diff --git a/drivers/media/usb/em28xx/em28xx-camera.c >> b/drivers/media/usb/em28xx/em28xx-camera.c >> index 505e050..daebef3 100644 >> --- a/drivers/media/usb/em28xx/em28xx-camera.c >> +++ b/drivers/media/usb/em28xx/em28xx-camera.c >> @@ -365,7 +365,7 @@ int em28xx_init_camera(struct em28xx *dev) >> dev->sensor_xtal = 430; >> pdata.xtal = dev->sensor_xtal; >> if (NULL == >> -v4l2_i2c_new_subdev_board(&dev->v4l2_dev, adap, >> +v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, >>&mt9v011_info, NULL)) { >> ret = -ENODEV; >> break; >> @@ -422,7 +422,7 @@ int em28xx_init_camera(struct em28xx *dev) >> dev->sensor_yres = 480; >> >> subdev = >> - v4l2_i2c_new_subdev_board(&dev->v4l2_dev, adap, >> + v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, >> &ov2640_info, NULL); >> if (NULL == subdev) { >> ret = -ENODEV; >> diff --git a/drivers/media/usb/em28xx/em28xx-video.c >> b/drivers/media/usb/em28xx/em28xx-video.c >> index 45ad471..89947db 100644 >> --- a/drivers/media/usb/em28xx/em28xx-video.c >> +++ b/drivers/media/usb/em28xx/em28xx-video.c >> @@ -189,10 +189,11 @@ static int em28xx_vbi_supported(struct em28xx *dev) >> */ >> static void em28xx_wake_i2c(struct em28xx *dev) >> { >> -v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, 0); >> -v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, >> +struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; >> +v4l2_device_call_all(v4l2_dev, 0, core, reset, 0); >> +v4l2_device_call_all(v4l2_dev, 0, video, s_routing, >> INPUT(dev->ctl_input)->vmux, 0, 0); >> -v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); >> +v4l2_device_call_all(v4l2_dev, 0, video, s_stream, 0); >> } >> >> static int em28xx_colorlevels_set_default(struct em28xx *dev) >> @@ -952,7 +953,8 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, >> unsigned int count) >> f.type = V4L2_TUNER_RADIO; >> else >> f.type = V4L2_TUNER_ANALOG_TV; >> -v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); >> +v4l2_device_call_all(&dev->v4l2->v4l2_dev, >> + 0, tuner, s_frequency, &f); >> } >> >> dev->streaming_users++; >> @@ -1083,6 +1085,7 @@ static int em28xx_vb2_setup(struct em28xx *dev) >> >> static void video_mux(struct em28xx *dev, int index) >> { >> +struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; >> dev->ctl_input = index; >> dev->ctl_ainput = INPUT(index)->amux; >> dev->ctl_aoutput = INPUT(index)->aout; >> @@ -1090,21 +1093,21 @@ static void video_mux(struct em28xx *dev, int index) >> if (!dev->ctl_aoutput) >> dev->ctl_aoutput = EM28XX_AOUT_MASTER; >> >> -v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, >> +v4l2_device_call_all(v4l2_dev, 0, video, s_routing, >> INPUT(index)->vmux, 0, 0); >> >> if (dev->board.has_msp34xx) { >> if (dev->i2s_speed) { >> -v4l2_device_call_all(&dev->v4l2_dev, 0, audio, >> +v4l2_device_call_all(v4l2_dev, 0, audio, >> s_i2s_clock_freq, dev->i2s_speed); >> } >> /* Note: this is msp3400 specific */ >> -v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, >> +v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, >> dev->ctl_ainput, MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0); >> } >> >> if (dev->board.adecoder != EM28XX_NOADECODER) { >> -v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, >> +v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, >> dev->ctl_ainput, dev->ctl_aoutput, 0); >> } >> >> @@ -1344,7 +1347,7 @@ static int vidioc_querystd(struct file *file, void >> *priv, v4l2_std_id *norm) >> struct em28xx_fh *fh = priv; >> struct em28xx *dev = fh->dev; >> >> -v4l2_device_call_all(&dev->v4l2_dev, 0, video, querystd, norm); >> +v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, video, querystd, norm); >> >> return 0; >> } >> @@ -1374,7 +1377,7 @@ static int vidioc_s_std(struct file *file, void *priv, >> v4
Re: [PATCH 03/19] em28xx: start moving em28xx-v4l specific data to its own struct
Some comments for future improvements: On 03/24/2014 08:33 PM, Frank Schäfer wrote: > Signed-off-by: Frank Schäfer > --- > drivers/media/usb/em28xx/em28xx-camera.c | 4 +- > drivers/media/usb/em28xx/em28xx-video.c | 160 > +-- > drivers/media/usb/em28xx/em28xx.h| 8 +- > 3 files changed, 116 insertions(+), 56 deletions(-) > > diff --git a/drivers/media/usb/em28xx/em28xx-camera.c > b/drivers/media/usb/em28xx/em28xx-camera.c > index 505e050..daebef3 100644 > --- a/drivers/media/usb/em28xx/em28xx-camera.c > +++ b/drivers/media/usb/em28xx/em28xx-camera.c > @@ -365,7 +365,7 @@ int em28xx_init_camera(struct em28xx *dev) > dev->sensor_xtal = 430; > pdata.xtal = dev->sensor_xtal; > if (NULL == > - v4l2_i2c_new_subdev_board(&dev->v4l2_dev, adap, > + v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, > &mt9v011_info, NULL)) { > ret = -ENODEV; > break; > @@ -422,7 +422,7 @@ int em28xx_init_camera(struct em28xx *dev) > dev->sensor_yres = 480; > > subdev = > - v4l2_i2c_new_subdev_board(&dev->v4l2_dev, adap, > + v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, > &ov2640_info, NULL); > if (NULL == subdev) { > ret = -ENODEV; > diff --git a/drivers/media/usb/em28xx/em28xx-video.c > b/drivers/media/usb/em28xx/em28xx-video.c > index 45ad471..89947db 100644 > --- a/drivers/media/usb/em28xx/em28xx-video.c > +++ b/drivers/media/usb/em28xx/em28xx-video.c > @@ -189,10 +189,11 @@ static int em28xx_vbi_supported(struct em28xx *dev) > */ > static void em28xx_wake_i2c(struct em28xx *dev) > { > - v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, 0); > - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, > + struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; > + v4l2_device_call_all(v4l2_dev, 0, core, reset, 0); > + v4l2_device_call_all(v4l2_dev, 0, video, s_routing, > INPUT(dev->ctl_input)->vmux, 0, 0); > - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); > + v4l2_device_call_all(v4l2_dev, 0, video, s_stream, 0); > } > > static int em28xx_colorlevels_set_default(struct em28xx *dev) > @@ -952,7 +953,8 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, > unsigned int count) > f.type = V4L2_TUNER_RADIO; > else > f.type = V4L2_TUNER_ANALOG_TV; > - v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); > + v4l2_device_call_all(&dev->v4l2->v4l2_dev, > + 0, tuner, s_frequency, &f); > } > > dev->streaming_users++; > @@ -1083,6 +1085,7 @@ static int em28xx_vb2_setup(struct em28xx *dev) > > static void video_mux(struct em28xx *dev, int index) > { > + struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; > dev->ctl_input = index; > dev->ctl_ainput = INPUT(index)->amux; > dev->ctl_aoutput = INPUT(index)->aout; > @@ -1090,21 +1093,21 @@ static void video_mux(struct em28xx *dev, int index) > if (!dev->ctl_aoutput) > dev->ctl_aoutput = EM28XX_AOUT_MASTER; > > - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, > + v4l2_device_call_all(v4l2_dev, 0, video, s_routing, > INPUT(index)->vmux, 0, 0); > > if (dev->board.has_msp34xx) { > if (dev->i2s_speed) { > - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, > + v4l2_device_call_all(v4l2_dev, 0, audio, > s_i2s_clock_freq, dev->i2s_speed); > } > /* Note: this is msp3400 specific */ > - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, > + v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, >dev->ctl_ainput, MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0); > } > > if (dev->board.adecoder != EM28XX_NOADECODER) { > - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, > + v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, > dev->ctl_ainput, dev->ctl_aoutput, 0); > } > > @@ -1344,7 +1347,7 @@ static int vidioc_querystd(struct file *file, void > *priv, v4l2_std_id *norm) > struct em28xx_fh *fh = priv; > struct em28xx *dev = fh->dev; > > - v4l2_device_call_all(&dev->v4l2_dev, 0, video, querystd, norm); > + v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, video, querystd, norm); > > return 0; > } > @@ -1374,7 +1377,7 @@ static int vidioc_s_std(struct file *file, void *priv, > v4l2_std_id norm) > size_to_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale)
[PATCH 03/19] em28xx: start moving em28xx-v4l specific data to its own struct
Signed-off-by: Frank Schäfer --- drivers/media/usb/em28xx/em28xx-camera.c | 4 +- drivers/media/usb/em28xx/em28xx-video.c | 160 +-- drivers/media/usb/em28xx/em28xx.h| 8 +- 3 files changed, 116 insertions(+), 56 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 505e050..daebef3 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -365,7 +365,7 @@ int em28xx_init_camera(struct em28xx *dev) dev->sensor_xtal = 430; pdata.xtal = dev->sensor_xtal; if (NULL == - v4l2_i2c_new_subdev_board(&dev->v4l2_dev, adap, + v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, &mt9v011_info, NULL)) { ret = -ENODEV; break; @@ -422,7 +422,7 @@ int em28xx_init_camera(struct em28xx *dev) dev->sensor_yres = 480; subdev = -v4l2_i2c_new_subdev_board(&dev->v4l2_dev, adap, +v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, &ov2640_info, NULL); if (NULL == subdev) { ret = -ENODEV; diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 45ad471..89947db 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -189,10 +189,11 @@ static int em28xx_vbi_supported(struct em28xx *dev) */ static void em28xx_wake_i2c(struct em28xx *dev) { - v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, 0); - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, + struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; + v4l2_device_call_all(v4l2_dev, 0, core, reset, 0); + v4l2_device_call_all(v4l2_dev, 0, video, s_routing, INPUT(dev->ctl_input)->vmux, 0, 0); - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); + v4l2_device_call_all(v4l2_dev, 0, video, s_stream, 0); } static int em28xx_colorlevels_set_default(struct em28xx *dev) @@ -952,7 +953,8 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count) f.type = V4L2_TUNER_RADIO; else f.type = V4L2_TUNER_ANALOG_TV; - v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); + v4l2_device_call_all(&dev->v4l2->v4l2_dev, +0, tuner, s_frequency, &f); } dev->streaming_users++; @@ -1083,6 +1085,7 @@ static int em28xx_vb2_setup(struct em28xx *dev) static void video_mux(struct em28xx *dev, int index) { + struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; dev->ctl_input = index; dev->ctl_ainput = INPUT(index)->amux; dev->ctl_aoutput = INPUT(index)->aout; @@ -1090,21 +1093,21 @@ static void video_mux(struct em28xx *dev, int index) if (!dev->ctl_aoutput) dev->ctl_aoutput = EM28XX_AOUT_MASTER; - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, + v4l2_device_call_all(v4l2_dev, 0, video, s_routing, INPUT(index)->vmux, 0, 0); if (dev->board.has_msp34xx) { if (dev->i2s_speed) { - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, + v4l2_device_call_all(v4l2_dev, 0, audio, s_i2s_clock_freq, dev->i2s_speed); } /* Note: this is msp3400 specific */ - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, + v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, dev->ctl_ainput, MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0); } if (dev->board.adecoder != EM28XX_NOADECODER) { - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, + v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, dev->ctl_ainput, dev->ctl_aoutput, 0); } @@ -1344,7 +1347,7 @@ static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *norm) struct em28xx_fh *fh = priv; struct em28xx *dev = fh->dev; - v4l2_device_call_all(&dev->v4l2_dev, 0, video, querystd, norm); + v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, video, querystd, norm); return 0; } @@ -1374,7 +1377,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) size_to_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); em28xx_resolution_set(dev); - v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm); + v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, core, s_std,