Re: [linux-dvb] Looking for Linux drivers for AVerMedia tuner or Leadtek tuner
On Sat, Feb 20, 2010 at 1:44 AM, Michael Angeli wrote: > Hello, > > Looking for Linux drivers for Avermedia Tuners per the following URLs > > http://www.avermedia.com/AVerTV/Product/ProductDetail.aspx?Id=378 > > http://www.avermedia.com/AVerTV/Product/ProductDetail.aspx?Id=482&SI=true > > http://www.avermedia.com/avertv/Product/ProductDetail.aspx?Id=480&SI=true > > > > Or a linux driver for the Leadtek Mini PCI TV tuner LR6648 with PCI express > Bridge SAA7160ET > > Maybe this product might be interesting for you: http://sundtek.com/shop/Digital-TV-Sticks-oxid/Sundtek-MediaTV-MiniPCIe-DVB-CT-FM-AnalogTV.html * DVB-C / DVB-T (ATSC / ClearQAM is also available) * Analog TV * FM Radio * VBI * Standby support * MiniPCIe * Driver: ARM, MIPS, PPC, X86-32, X86-64 Best Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] saa7134: Fix IR support of some ASUS TV-FM 7135 variants
Am Montag, den 15.02.2010, 06:31 +0100 schrieb hermann pitton: > Am Donnerstag, den 11.02.2010, 01:58 +0100 schrieb hermann pitton: > > Hi, > > > > Am Mittwoch, den 10.02.2010, 20:36 +0100 schrieb Jean Delvare: > > > On Wed, 10 Feb 2010 16:40:03 -0200, Mauro Carvalho Chehab wrote: > > > > Jean Delvare wrote: > > > > > Under the assumption that saa7134_hwinit1() only touches GPIOs > > > > > connected to IR receivers (and it certainly looks like this to me) I > > > > > fail to see how these pins not being initialized could have any effect > > > > > on non-IR code. > > > > > > > > Now, i suspect that you're messing things again: are you referring to > > > > saa7134_hwinit1() or > > > > to saa7134_input_init1()? > > > > > > > > I suspect that you're talking about moving saa7134_input_init1(), since > > > > saa7134_hwinit1() > > > > has the muted and spinlock inits. It also has the setups for video, vbi > > > > and mpeg. > > > > So, moving it require more care. > > > > > > Err, you're right, I meant saa7134_input_init1() and not > > > saa7134_hwinit1(), copy-and-paste error. Sorry for adding more > > > confusion where it really wasn't needed... > > > > > > > both attempts of Jean will work. > > > > If we are only talking about moving input_init, only that Jean did > > suggest initially, it should work, since only some GPIOs for enabling > > remote chips are affected. > > > > I can give the crappy tester, but don't have such a remote, but should > > not be a problem to trigger the GPIOs later. > > > > Cheers, > > Hermann > > > > Hi Jean, > > I did test your patch, only following Roman's initial patch already > known, on eight different cards for now, also with three slightly > different remotes and it does not have any negative impact. > > Please consider, that it is only about that single card for now and a > per card solution is enough. > > I strongly remind, that we should not rely on unknown eeprom bytes, as > told previously and should not expand such into any direction. > > If we make progress there, we should change it for all cards, but again, > what had happened on the m$ drivers previously is not encouraging to do > it without any need. > > To do it per card in need for now seems enough "service" to me. > > If more such should come, unlikely on that driver, I would at first deny > auto detection support, since they are breaking rules. > > The problem likely will time out very soon. > > Cheers, > Hermann Jean, a slight ping. Are you still waiting for Daro's report? As said, I would prefer to see all OEMs _not_ following Philips/NXP eeprom rules running into their own trash on GNU/Linux too. Then we have facts. That is much better than to provide a golden cloud for them. At least I won't help to debug such later ... If you did not manage to decipher all OEM eeprom content already, just let's go with the per card solution for now. Are you aware, that my intention is _not_ to spread the use of random and potentially invalid eeprom content for some sort of such auto detection? The other solution is not lost and in mind, if we should need to come back to it and are in details. Preferably the OEMs should take the responsibility for such. We can see, that even those always doing best on it, can't provide the missing informations for different LNA stuff after the Hauppauge/Pinnacle merge until now. If you claim to know it better, please share with us. Cheers, Hermann -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mfd: Add timb-radio to the timberdale MFD
On 02/19/2010 03:56 PM, Randy Dunlap wrote: On 02/19/10 14:41, Richard Röjfors wrote: On 02/19/2010 04:52 AM, Mauro Carvalho Chehab wrote: Richard Röjfors wrote: This patch addes timb-radio to all configurations of the timberdale MFD. Connected to the FPGA is a TEF6862 tuner and a SAA7706H DSP, the I2C board info of these devices is passed via the timb-radio platform data. Hi Richard, I'm trying to apply it to my git tree (http://git.linuxtv.org/v4l-dvb.git), but it is failing: Hi Mauro, Right now my mail client, icedove, confuses me. Just upgraded to ver 3. It seem to add in an extra space to lines not starting with a plus in the patch. I had that problem with something called Thunderbird. Perhaps you could use the hints in Documentation/email-clients.txt but change Thunderbird to icedove. (?) icedove is debians fork of thunderbird, so I think it's basically the same client. So if people using it isn't aware of it I think we should change it to Thunderbird/Icedove in the documentation --Richard -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video_device: don't free_irq() an element past array vpif_obj.dev[] and fix test
The first loop ends when platform_get_resource() returns NULL. Can it occur that no platform_get_resource() succeeded? I think we should error return if that happens. Could k grow larger than VPIF_DISPLAY_MAX_DEVICES there? Should we err out in that case? In the loop `for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++)' if video_device_alloc() fails I think we correctly release the devices, but we have to do more before we reach label vpif_int_err. As mentioned, we left the first loop with a res of NULL, which is dereferenced at label vpif_int_err. So we have to get the resource again, however, k was incremented at the end of that loop as well. Also i used as index in the second loop as well should point to res->end before going to label vpif_int_err, to free all requested irqs. All this needs to be done for later error labels as well, so a new label is added where this occurs, alloc_vid_fail. Variable k can't be reused in the third for-loop and at label probe_out. As mentioned k is needed to get the resource in case a error and clean-up is required. If we reach label vpif_int_err, res shouldn't be NULL, since we dereference it. Previously we had: for (; k >= 0; k--) { for (m = i; m >= res->start; m--) free_irq(m, (void *)(&vpif_obj.dev[k]->channel_id)); res = platform_get_resource(pdev, IORESOURCE_IRQ, k-1); m = res->end; } In the last iteration k equals 0, so we call platform_get_resource() with -1 as a third argument. Since platform_get_resource() uses an unsigned it is converted to 0x. platform_get_resource() fails for every index and returns NULL. A test is lacking and we dereference NULL. The error "VPIF IRQ request failed" should only be displayed when request_irq() failed, not in the case of other errors. Also I changed some indexes, so a few could be removed. Signed-off-by: Roel Kluin --- > I think there were many more issues: > I must admit I did not compile test this, except with checkpatch.pl, but I > think the issues are real and should be fixed. Comments? I would like to compile test but cannot compile test these because of errors like drivers/net/davinci_emac.c:69:11: error: unable to open 'mach/dm646x.h' I found these three other functions in davinci code that have very similar problems. The changelog is about vpif_probe() in vpif_display.c. Since the functions are somewhat similar, maybe code should be shared, but where should one put that? Roel drivers/media/video/davinci/vpif_capture.c | 63 +-- drivers/media/video/davinci/vpif_display.c | 76 ++-- drivers/net/davinci_emac.c | 64 3 files changed, 129 insertions(+), 74 deletions(-) diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index 7813072..096e727 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c @@ -1915,7 +1915,7 @@ static __init int vpif_probe(struct platform_device *pdev) { struct vpif_subdev_info *subdevdata; struct vpif_capture_config *config; - int i, j, k, m, q, err; + int i, j, k, err; struct i2c_adapter *i2c_adap; struct channel_obj *ch; struct common_obj *common; @@ -1936,14 +1936,18 @@ static __init int vpif_probe(struct platform_device *pdev) for (i = res->start; i <= res->end; i++) { if (request_irq(i, vpif_channel_isr, IRQF_DISABLED, "DM646x_Capture", - (void *)(&vpif_obj.dev[k]->channel_id))) { - err = -EBUSY; + &vpif_obj.dev[k]->channel_id)) { i--; + err = -EBUSY; goto vpif_int_err; } } k++; + if (k >= VPIF_DISPLAY_MAX_DEVICES) + break; } + if (k == 0) + return -ENODEV; for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) { /* Get the pointer to the channel object */ @@ -1972,16 +1976,16 @@ static __init int vpif_probe(struct platform_device *pdev) ch->video_dev = vfd; } - for (j = 0; j < VPIF_CAPTURE_MAX_DEVICES; j++) { - ch = vpif_obj.dev[j]; - ch->channel_id = j; + for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) { + ch = vpif_obj.dev[i]; + ch->channel_id = i; common = &(ch->common[VPIF_VIDEO_INDEX]); spin_lock_init(&common->irqlock); mutex_init(&common->lock); /* Initialize prio member of channel object */ v4l2_prio_init(&ch->prio); err = video_register_device(ch->video_dev,
Re: [PATCH] mfd: Add timb-radio to the timberdale MFD
On 02/19/10 14:41, Richard Röjfors wrote: > On 02/19/2010 04:52 AM, Mauro Carvalho Chehab wrote: >> Richard Röjfors wrote: >>> This patch addes timb-radio to all configurations of the timberdale MFD. >>> >>> Connected to the FPGA is a TEF6862 tuner and a SAA7706H DSP, the I2C >>> board info of these devices is passed via the timb-radio platform data. >> >> Hi Richard, >> >> I'm trying to apply it to my git tree >> (http://git.linuxtv.org/v4l-dvb.git), >> but it is failing: > > Hi Mauro, > > Right now my mail client, icedove, confuses me. Just upgraded to ver 3. > It seem to add in an extra space to lines not starting with a plus in > the patch. I had that problem with something called Thunderbird. Perhaps you could use the hints in Documentation/email-clients.txt but change Thunderbird to icedove. (?) > I attached the patch. > > Sorry for the inconvenience. > > --Richard -- ~Randy -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v5 1/6] V4L: File handles
Laurent, > -Original Message- > From: Laurent Pinchart [mailto:laurent.pinch...@ideasonboard.com] > Sent: Friday, February 19, 2010 4:35 PM > To: Aguirre, Sergio > Cc: Sakari Ailus; linux-media@vger.kernel.org; hverk...@xs4all.nl; > iiva...@mm-sol.com; gururaj.nagen...@intel.com; david.co...@nokia.com > Subject: Re: [PATCH v5 1/6] V4L: File handles > > Hi Sergio, > > On Friday 19 February 2010 23:29:54 Aguirre, Sergio wrote: > > Heippa! > > > > > -Original Message- > > > From: linux-media-ow...@vger.kernel.org [mailto:linux-media- > > > ow...@vger.kernel.org] On Behalf Of Sakari Ailus > > > Sent: Friday, February 19, 2010 1:22 PM > > > To: linux-media@vger.kernel.org > > > Cc: hverk...@xs4all.nl; laurent.pinch...@ideasonboard.com; iiva...@mm- > > > sol.com; gururaj.nagen...@intel.com; david.co...@nokia.com; Sakari > Ailus > > > Subject: [PATCH v5 1/6] V4L: File handles > > > > > > This patch adds a list of v4l2_fh structures to every video_device. > > > It allows using file handle related information in V4L2. The event > > > interface > > > is one example of such use. > > > > > > Video device drivers should use the v4l2_fh pointer as their > > > file->private_data. > > > > > > Signed-off-by: Sakari Ailus > > > --- > > > > > > drivers/media/video/Makefile |2 +- > > > drivers/media/video/v4l2-dev.c |4 ++ > > > drivers/media/video/v4l2-fh.c | 64 > > > > > > > > > > > > include/media/v4l2-dev.h |5 +++ > > > include/media/v4l2-fh.h| 42 ++ > > > 5 files changed, 116 insertions(+), 1 deletions(-) > > > create mode 100644 drivers/media/video/v4l2-fh.c > > > create mode 100644 include/media/v4l2-fh.h > > [snip] > > > > diff --git a/drivers/media/video/v4l2-fh.c > > > b/drivers/media/video/v4l2-fh.c new file mode 100644 > > > index 000..c707930 > > > --- /dev/null > > > +++ b/drivers/media/video/v4l2-fh.c > > > @@ -0,0 +1,64 @@ > > > +/* > > > + * drivers/media/video/v4l2-fh.c > > > > [1] AFAIK, putting file paths is frowned upon. > > > > Makes maintenance harder if in the future, this files get moved > somewhere > > else. > > > > > + * > > > + * V4L2 file handles. > > > + * > > > + * Copyright (C) 2009 Nokia Corporation. > > > > [2] Shouldn't it be "(C) 2010" already? :) > > That shows how long the V4L2 events API review is taking ;-) :D > > [snip] > > > > diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h > > > new file mode 100644 > > > index 000..6b486aa > > > --- /dev/null > > > +++ b/include/media/v4l2-fh.h > > > @@ -0,0 +1,42 @@ > > > +/* > > > + * include/media/v4l2-fh.h > > > > Same as [1] > > > > > + * > > > + * V4L2 file handle. > > > + * > > > + * Copyright (C) 2009 Nokia Corporation. > > > > Same as [2] > > > > > + * > > > + * Contact: Sakari Ailus > > > + * > > > + * This program is free software; you can redistribute it and/or > > > + * modify it under the terms of the GNU General Public License > > > + * version 2 as published by the Free Software Foundation. > > > + * > > > + * This program is distributed in the hope that it will be useful, > but > > > + * WITHOUT ANY WARRANTY; without even the implied warranty of > > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + * General Public License for more details. > > > + * > > > + * You should have received a copy of the GNU General Public License > > > + * along with this program; if not, write to the Free Software > > > + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > > > + * 02110-1301 USA > > > + */ > > > + > > > +#ifndef V4L2_FH_H > > > +#define V4L2_FH_H > > > + > > > +#include > > > > Shouldn't you add one more header here?: > > > > #include > > > > (for struct video_device) > > This header only needs struct video_device *, not struct video_device, so > adding a forward definition will be more efficient (lower compilation time > for > compilation units that include v4l2-fh.h but not v4l2-dev.h). Ok, understood. Thanks for clarifying. Regards, Sergio > > > > + > > > +struct video_device; > > > + > > > +struct v4l2_fh { > > > + struct list_headlist; > > > + struct video_device *vdev; > > > +}; > > > + > > > +void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev); > > > +void v4l2_fh_add(struct v4l2_fh *fh); > > > +void v4l2_fh_del(struct v4l2_fh *fh); > > > +void v4l2_fh_exit(struct v4l2_fh *fh); > > > + > > > +#endif /* V4L2_EVENT_H */ > > -- > Regards, > > Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mfd: Add timb-radio to the timberdale MFD
On 02/19/2010 04:52 AM, Mauro Carvalho Chehab wrote: Richard Röjfors wrote: This patch addes timb-radio to all configurations of the timberdale MFD. Connected to the FPGA is a TEF6862 tuner and a SAA7706H DSP, the I2C board info of these devices is passed via the timb-radio platform data. Hi Richard, I'm trying to apply it to my git tree (http://git.linuxtv.org/v4l-dvb.git), but it is failing: Hi Mauro, Right now my mail client, icedove, confuses me. Just upgraded to ver 3. It seem to add in an extra space to lines not starting with a plus in the patch. I attached the patch. Sorry for the inconvenience. --Richard This patch addes timb-radio to all configurations of the timberdale MFD. Connected to the FPGA is a TEF6862 tuner and a SAA7706H DSP, the I2C board info of these devices is passed via the timb-radio platform data. Signed-off-by: Richard Röjfors --- diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c index 603cf06..1ed44d2 100644 --- a/drivers/mfd/timberdale.c +++ b/drivers/mfd/timberdale.c @@ -37,6 +37,8 @@ #include #include +#include + #include "timberdale.h" #define DRIVER_NAME "timberdale" @@ -213,6 +215,40 @@ const static __devinitconst struct resource timberdale_uartlite_resources[] = { }, }; +const static __devinitconst struct resource timberdale_radio_resources[] = { + { + .start = RDSOFFSET, + .end = RDSEND, + .flags = IORESOURCE_MEM, + }, + { + .start = IRQ_TIMBERDALE_RDS, + .end = IRQ_TIMBERDALE_RDS, + .flags = IORESOURCE_IRQ, + }, +}; + +static __devinitdata struct i2c_board_info timberdale_tef6868_i2c_board_info = { + I2C_BOARD_INFO("tef6862", 0x60) +}; + +static __devinitdata struct i2c_board_info timberdale_saa7706_i2c_board_info = { + I2C_BOARD_INFO("saa7706h", 0x1C) +}; + +static __devinitdata struct timb_radio_platform_data + timberdale_radio_platform_data = { + .i2c_adapter = 0, + .tuner = { + .module_name = "tef6862", + .info = &timberdale_tef6868_i2c_board_info + }, + .dsp = { + .module_name = "saa7706h", + .info = &timberdale_saa7706_i2c_board_info + } +}; + const static __devinitconst struct resource timberdale_dma_resources[] = { { .start = DMAOFFSET, @@ -240,6 +276,13 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg0[] = { .data_size = sizeof(timberdale_gpio_platform_data), }, { + .name = "timb-radio", + .num_resources = ARRAY_SIZE(timberdale_radio_resources), + .resources = timberdale_radio_resources, + .platform_data = &timberdale_radio_platform_data, + .data_size = sizeof(timberdale_radio_platform_data), + }, + { .name = "xilinx_spi", .num_resources = ARRAY_SIZE(timberdale_spi_resources), .resources = timberdale_spi_resources, @@ -282,6 +325,13 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg1[] = { .resources = timberdale_mlogicore_resources, }, { + .name = "timb-radio", + .num_resources = ARRAY_SIZE(timberdale_radio_resources), + .resources = timberdale_radio_resources, + .platform_data = &timberdale_radio_platform_data, + .data_size = sizeof(timberdale_radio_platform_data), + }, + { .name = "xilinx_spi", .num_resources = ARRAY_SIZE(timberdale_spi_resources), .resources = timberdale_spi_resources, @@ -314,6 +364,13 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg2[] = { .data_size = sizeof(timberdale_gpio_platform_data), }, { + .name = "timb-radio", + .num_resources = ARRAY_SIZE(timberdale_radio_resources), + .resources = timberdale_radio_resources, + .platform_data = &timberdale_radio_platform_data, + .data_size = sizeof(timberdale_radio_platform_data), + }, + { .name = "xilinx_spi", .num_resources = ARRAY_SIZE(timberdale_spi_resources), .resources = timberdale_spi_resources, @@ -348,6 +405,13 @@ static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg3[] = { .data_size = sizeof(timberdale_gpio_platform_data), }, { + .name = "timb-radio", + .num_resources = ARRAY_SIZE(timberdale_radio_resources), + .resources = timberdale_radio_resources, + .platform_data = &timberdale_radio_platform_data, + .data_size = sizeof(timberdale_radio_platform_data), + }, + { .name = "xilinx_spi", .num_resources = ARRAY_SIZE(timberdale_spi_resources), .resources = timberdale_spi_resources,
RE: [PATCH v5 4/6] V4L: Events: Add backend
Heippa! > -Original Message- > From: linux-media-ow...@vger.kernel.org [mailto:linux-media- > ow...@vger.kernel.org] On Behalf Of Sakari Ailus > Sent: Friday, February 19, 2010 1:22 PM > To: linux-media@vger.kernel.org > Cc: hverk...@xs4all.nl; laurent.pinch...@ideasonboard.com; iiva...@mm- > sol.com; gururaj.nagen...@intel.com; david.co...@nokia.com; Sakari Ailus > Subject: [PATCH v5 4/6] V4L: Events: Add backend > > Add event handling backend to V4L2. The backend handles event subscription > and delivery to file handles. Event subscriptions are based on file > handle. > Events may be delivered to all subscribed file handles on a device > independent of where they originate from. > > Signed-off-by: Sakari Ailus > --- > drivers/media/video/Makefile |3 +- > drivers/media/video/v4l2-event.c | 286 > ++ > drivers/media/video/v4l2-fh.c|4 + > include/media/v4l2-event.h | 65 + > include/media/v4l2-fh.h |2 + > 5 files changed, 359 insertions(+), 1 deletions(-) > create mode 100644 drivers/media/video/v4l2-event.c > create mode 100644 include/media/v4l2-event.h > > diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile > index 14bf69a..b84abfe 100644 > --- a/drivers/media/video/Makefile > +++ b/drivers/media/video/Makefile > @@ -10,7 +10,8 @@ stkwebcam-objs := stk-webcam.o stk-sensor.o > > omap2cam-objs:= omap24xxcam.o omap24xxcam-dma.o > > -videodev-objs:= v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o > +videodev-objs:= v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o > \ > + v4l2-event.o > > # V4L2 core modules > > diff --git a/drivers/media/video/v4l2-event.c b/drivers/media/video/v4l2- > event.c > new file mode 100644 > index 000..ab31cc6 > --- /dev/null > +++ b/drivers/media/video/v4l2-event.c > @@ -0,0 +1,286 @@ > +/* > + * drivers/media/video/v4l2-event.c No filepaths. > + * > + * V4L2 events. > + * > + * Copyright (C) 2009 Nokia Corporation. 2010 > + * > + * Contact: Sakari Ailus > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * version 2 as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > + * 02110-1301 USA > + */ > + > +#include > +#include > +#include > + > +#include > + > +static int v4l2_event_init(struct v4l2_fh *fh) > +{ > + fh->events = kzalloc(sizeof(*fh->events), GFP_KERNEL); > + if (fh->events == NULL) > + return -ENOMEM; > + > + init_waitqueue_head(&fh->events->wait); > + > + INIT_LIST_HEAD(&fh->events->free); > + INIT_LIST_HEAD(&fh->events->available); > + INIT_LIST_HEAD(&fh->events->subscribed); > + > + fh->events->sequence = -1; > + > + return 0; > +} > + > +int v4l2_event_alloc(struct v4l2_fh *fh, unsigned int n) > +{ > + struct v4l2_events *events; > + unsigned long flags; > + int ret; > + > + if (!fh->events) { > + ret = v4l2_event_init(fh); > + if (ret) > + return ret; > + } > + > + events = fh->events; > + > + while (events->nallocated < n) { > + struct v4l2_kevent *kev; > + > + kev = kzalloc(sizeof(*kev), GFP_KERNEL); > + if (kev == NULL) > + return -ENOMEM; > + > + spin_lock_irqsave(&fh->vdev->fh_lock, flags); > + list_add_tail(&kev->list, &events->free); > + events->nallocated++; > + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); > + } > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(v4l2_event_alloc); > + > +#define list_kfree(list, type, member) \ > + while (!list_empty(list)) { \ > + type *hi; \ > + hi = list_first_entry(list, type, member); \ > + list_del(&hi->member); \ > + kfree(hi); \ > + } > + > +void v4l2_event_free(struct v4l2_fh *fh) > +{ > + struct v4l2_events *events = fh->events; > + > + if (!events) > + return; > + > + list_kfree(&events->free, struct v4l2_kevent, list); > + list_kfree(&events->available, struct v4l2_kevent, list); > + list_kfree(&events->subscribed, struct v4l2_subscribed_event, list); > + > + kfree(events); > + fh-
Re: [PATCH v5 1/6] V4L: File handles
Hi Sergio, On Friday 19 February 2010 23:29:54 Aguirre, Sergio wrote: > Heippa! > > > -Original Message- > > From: linux-media-ow...@vger.kernel.org [mailto:linux-media- > > ow...@vger.kernel.org] On Behalf Of Sakari Ailus > > Sent: Friday, February 19, 2010 1:22 PM > > To: linux-media@vger.kernel.org > > Cc: hverk...@xs4all.nl; laurent.pinch...@ideasonboard.com; iiva...@mm- > > sol.com; gururaj.nagen...@intel.com; david.co...@nokia.com; Sakari Ailus > > Subject: [PATCH v5 1/6] V4L: File handles > > > > This patch adds a list of v4l2_fh structures to every video_device. > > It allows using file handle related information in V4L2. The event > > interface > > is one example of such use. > > > > Video device drivers should use the v4l2_fh pointer as their > > file->private_data. > > > > Signed-off-by: Sakari Ailus > > --- > > > > drivers/media/video/Makefile |2 +- > > drivers/media/video/v4l2-dev.c |4 ++ > > drivers/media/video/v4l2-fh.c | 64 > > > > > > > > include/media/v4l2-dev.h |5 +++ > > include/media/v4l2-fh.h| 42 ++ > > 5 files changed, 116 insertions(+), 1 deletions(-) > > create mode 100644 drivers/media/video/v4l2-fh.c > > create mode 100644 include/media/v4l2-fh.h [snip] > > diff --git a/drivers/media/video/v4l2-fh.c > > b/drivers/media/video/v4l2-fh.c new file mode 100644 > > index 000..c707930 > > --- /dev/null > > +++ b/drivers/media/video/v4l2-fh.c > > @@ -0,0 +1,64 @@ > > +/* > > + * drivers/media/video/v4l2-fh.c > > [1] AFAIK, putting file paths is frowned upon. > > Makes maintenance harder if in the future, this files get moved somewhere > else. > > > + * > > + * V4L2 file handles. > > + * > > + * Copyright (C) 2009 Nokia Corporation. > > [2] Shouldn't it be "(C) 2010" already? :) That shows how long the V4L2 events API review is taking ;-) [snip] > > diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h > > new file mode 100644 > > index 000..6b486aa > > --- /dev/null > > +++ b/include/media/v4l2-fh.h > > @@ -0,0 +1,42 @@ > > +/* > > + * include/media/v4l2-fh.h > > Same as [1] > > > + * > > + * V4L2 file handle. > > + * > > + * Copyright (C) 2009 Nokia Corporation. > > Same as [2] > > > + * > > + * Contact: Sakari Ailus > > + * > > + * This program is free software; you can redistribute it and/or > > + * modify it under the terms of the GNU General Public License > > + * version 2 as published by the Free Software Foundation. > > + * > > + * This program is distributed in the hope that it will be useful, but > > + * WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > + * General Public License for more details. > > + * > > + * You should have received a copy of the GNU General Public License > > + * along with this program; if not, write to the Free Software > > + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > > + * 02110-1301 USA > > + */ > > + > > +#ifndef V4L2_FH_H > > +#define V4L2_FH_H > > + > > +#include > > Shouldn't you add one more header here?: > > #include > > (for struct video_device) This header only needs struct video_device *, not struct video_device, so adding a forward definition will be more efficient (lower compilation time for compilation units that include v4l2-fh.h but not v4l2-dev.h). > > + > > +struct video_device; > > + > > +struct v4l2_fh { > > + struct list_headlist; > > + struct video_device *vdev; > > +}; > > + > > +void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev); > > +void v4l2_fh_add(struct v4l2_fh *fh); > > +void v4l2_fh_del(struct v4l2_fh *fh); > > +void v4l2_fh_exit(struct v4l2_fh *fh); > > + > > +#endif /* V4L2_EVENT_H */ -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v5 1/6] V4L: File handles
Heippa! > -Original Message- > From: linux-media-ow...@vger.kernel.org [mailto:linux-media- > ow...@vger.kernel.org] On Behalf Of Sakari Ailus > Sent: Friday, February 19, 2010 1:22 PM > To: linux-media@vger.kernel.org > Cc: hverk...@xs4all.nl; laurent.pinch...@ideasonboard.com; iiva...@mm- > sol.com; gururaj.nagen...@intel.com; david.co...@nokia.com; Sakari Ailus > Subject: [PATCH v5 1/6] V4L: File handles > > This patch adds a list of v4l2_fh structures to every video_device. > It allows using file handle related information in V4L2. The event > interface > is one example of such use. > > Video device drivers should use the v4l2_fh pointer as their > file->private_data. > > Signed-off-by: Sakari Ailus > --- > drivers/media/video/Makefile |2 +- > drivers/media/video/v4l2-dev.c |4 ++ > drivers/media/video/v4l2-fh.c | 64 > > include/media/v4l2-dev.h |5 +++ > include/media/v4l2-fh.h| 42 ++ > 5 files changed, 116 insertions(+), 1 deletions(-) > create mode 100644 drivers/media/video/v4l2-fh.c > create mode 100644 include/media/v4l2-fh.h > > diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile > index 5163289..14bf69a 100644 > --- a/drivers/media/video/Makefile > +++ b/drivers/media/video/Makefile > @@ -10,7 +10,7 @@ stkwebcam-objs := stk-webcam.o stk-sensor.o > > omap2cam-objs:= omap24xxcam.o omap24xxcam-dma.o > > -videodev-objs:= v4l2-dev.o v4l2-ioctl.o v4l2-device.o > +videodev-objs:= v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o > > # V4L2 core modules > > diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2- > dev.c > index 7090699..65a7b30 100644 > --- a/drivers/media/video/v4l2-dev.c > +++ b/drivers/media/video/v4l2-dev.c > @@ -421,6 +421,10 @@ static int __video_register_device(struct > video_device *vdev, int type, int nr, > if (!vdev->release) > return -EINVAL; > > + /* v4l2_fh support */ > + spin_lock_init(&vdev->fh_lock); > + INIT_LIST_HEAD(&vdev->fh_list); > + > /* Part 1: check device type */ > switch (type) { > case VFL_TYPE_GRABBER: > diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c > new file mode 100644 > index 000..c707930 > --- /dev/null > +++ b/drivers/media/video/v4l2-fh.c > @@ -0,0 +1,64 @@ > +/* > + * drivers/media/video/v4l2-fh.c [1] AFAIK, putting file paths is frowned upon. Makes maintenance harder if in the future, this files get moved somewhere else. > + * > + * V4L2 file handles. > + * > + * Copyright (C) 2009 Nokia Corporation. [2] Shouldn't it be "(C) 2010" already? :) > + * > + * Contact: Sakari Ailus > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * version 2 as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > + * 02110-1301 USA > + */ > + > +#include > +#include > +#include > + > +void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) > +{ > + fh->vdev = vdev; > + INIT_LIST_HEAD(&fh->list); > + set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags); > +} > +EXPORT_SYMBOL_GPL(v4l2_fh_init); > + > +void v4l2_fh_add(struct v4l2_fh *fh) > +{ > + unsigned long flags; > + > + spin_lock_irqsave(&fh->vdev->fh_lock, flags); > + list_add(&fh->list, &fh->vdev->fh_list); > + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); > +} > +EXPORT_SYMBOL_GPL(v4l2_fh_add); > + > +void v4l2_fh_del(struct v4l2_fh *fh) > +{ > + unsigned long flags; > + > + spin_lock_irqsave(&fh->vdev->fh_lock, flags); > + list_del_init(&fh->list); > + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); > +} > +EXPORT_SYMBOL_GPL(v4l2_fh_del); > + > +void v4l2_fh_exit(struct v4l2_fh *fh) > +{ > + if (fh->vdev == NULL) > + return; > + > + fh->vdev = NULL; > +} > +EXPORT_SYMBOL_GPL(v4l2_fh_exit); > diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h > index 2dee938..bebe44b 100644 > --- a/include/media/v4l2-dev.h > +++ b/include/media/v4l2-dev.h > @@ -32,6 +32,7 @@ struct v4l2_device; > Drivers can clear this flag if they want to block all future > device access. It is cleared by video_unregister_device. */ > #define V4L2_FL_REGISTERED (0) > +#define V4L2_FL_USES_V4L2_FH (1) > > struct v4l2_file_operations { > struct module *owner; > @@ -77,6 +78,10 @@ struct video_device
Re: [git:v4l-dvb/master] V4L/DVB: tuner-xc2028: fix tuning logic to solve a regression in Australia
Am 19.02.2010 21:51, schrieb Mauro Carvalho Chehab: > Stefan Ringel wrote: > >> Am 19.02.2010 17:07, schrieb Patch from Mauro Carvalho Chehab: >> >>> } >>> >>> div = (freq - offset + DIV / 2) / DIV; >>> @@ -1114,17 +1152,22 @@ static int xc2028_set_params(struct dvb_frontend >>> *fe, >>> >>> /* All S-code tables need a 200kHz shift */ >>> if (priv->ctrl.demod) { >>> - demod = priv->ctrl.demod + 200; >>> + /* >>> +* Newer firmwares require a 200 kHz offset only for ATSC >>> +*/ >>> + if (type == ATSC || priv->firm_version < 0x0302) >>> + demod = priv->ctrl.demod + 200; >>> /* >>> * The DTV7 S-code table needs a 700 kHz shift. >>> -* Thanks to Terry Wu for reporting this >>> * >>> * DTV7 is only used in Australia. Germany or Italy may also >>> * use this firmware after initialization, but a tune to a UHF >>> * channel should then cause DTV78 to be used. >>> +* >>> +* Unfortunately, on real-field tests, the s-code offset >>> +* didn't work as expected, as reported by >>> +* Robert Lowery >>> */ >>> - if (type & DTV7) >>> - demod += 500; >>> } >>> >>> return generic_set_freq(fe, p->frequency, >>> >>> >> Hi Mauro, >> >> your patch doesn't work. Here is not set demod for all others (demod=0). >> >> > For DVB to properly work, you need to fill ctrl.demod at tm6000, otherwise, > demod will be 0, and it will use some default that won't likely work. > > ctrl.demod is set in tm6000 since last month and doesn't work any more now! Stefan Ringel -- Stefan Ringel -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: soc-camera: pixclk polarity question
On Fri, 19 Feb 2010, Philipp Wiesner wrote: > Hi, > > I'm working with µCs (i.MX27) and cameras (Aptina) at the moment. > > Now I encountered a problem introduced by serializing and deserializing > (lvds) camera data on its way to the µC. > > The serializer expects a specific pixclk polarity which can be > configured in hardware. In most cases this is no problem as it is > permanently connected to only one sensor chip, but camera sensors with > configurable pixclk could negotiate the wrong polarity. > > The deserializer generates pixclk from data, its polarity again can be > configured in hardware. This leads to pixclk inversion depending on > wheter serdes is happening or not, so its not an attribute of the > platform (in opposition to what SOCAM_SENSOR_INVERT_PCLK is meant for) > > What would be the correct way to address this? > > Do we need another platform flag, e.g. SOCAM_PCLK_SAMPLE_RISING_FIXED? > The only solution coming to my mind is checking for the SerDes on boot > time and setting flags like SOCAM_PCLK_SAMPLE_RISING_FIXED and > SOCAM_SENSOR_INVERT_PCLK if necessary. Hm, how is any new flag better than the existing one? If it is just a static flag - it doesn't change anything, right? As far as I understand, on one and the same platform the signal polarity can be different, depending on some switch / jumper / hard-soldered pin, right? I think your boot-time verification is good then - just put it in your platform code and set the flag(s) accordingly. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [git:v4l-dvb/master] V4L/DVB: tuner-xc2028: fix tuning logic to solve a regression in Australia
Stefan Ringel wrote: > Am 19.02.2010 17:07, schrieb Patch from Mauro Carvalho Chehab: >> } >> >> div = (freq - offset + DIV / 2) / DIV; >> @@ -1114,17 +1152,22 @@ static int xc2028_set_params(struct dvb_frontend *fe, >> >> /* All S-code tables need a 200kHz shift */ >> if (priv->ctrl.demod) { >> -demod = priv->ctrl.demod + 200; >> +/* >> + * Newer firmwares require a 200 kHz offset only for ATSC >> + */ >> +if (type == ATSC || priv->firm_version < 0x0302) >> +demod = priv->ctrl.demod + 200; >> /* >> * The DTV7 S-code table needs a 700 kHz shift. >> - * Thanks to Terry Wu for reporting this >> * >> * DTV7 is only used in Australia. Germany or Italy may also >> * use this firmware after initialization, but a tune to a UHF >> * channel should then cause DTV78 to be used. >> + * >> + * Unfortunately, on real-field tests, the s-code offset >> + * didn't work as expected, as reported by >> + * Robert Lowery >> */ >> -if (type & DTV7) >> -demod += 500; >> } >> >> return generic_set_freq(fe, p->frequency, >> > Hi Mauro, > > your patch doesn't work. Here is not set demod for all others (demod=0). > For DVB to properly work, you need to fill ctrl.demod at tm6000, otherwise, demod will be 0, and it will use some default that won't likely work. -- Cheers, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [git:v4l-dvb/master] V4L/DVB: tuner-xc2028: fix tuning logic to solve a regression in Australia
Am 19.02.2010 17:07, schrieb Patch from Mauro Carvalho Chehab: > } > > div = (freq - offset + DIV / 2) / DIV; > @@ -1114,17 +1152,22 @@ static int xc2028_set_params(struct dvb_frontend *fe, > > /* All S-code tables need a 200kHz shift */ > if (priv->ctrl.demod) { > - demod = priv->ctrl.demod + 200; > + /* > + * Newer firmwares require a 200 kHz offset only for ATSC > + */ > + if (type == ATSC || priv->firm_version < 0x0302) > + demod = priv->ctrl.demod + 200; > /* >* The DTV7 S-code table needs a 700 kHz shift. > - * Thanks to Terry Wu for reporting this >* >* DTV7 is only used in Australia. Germany or Italy may also >* use this firmware after initialization, but a tune to a UHF >* channel should then cause DTV78 to be used. > + * > + * Unfortunately, on real-field tests, the s-code offset > + * didn't work as expected, as reported by > + * Robert Lowery >*/ > - if (type & DTV7) > - demod += 500; > } > > return generic_set_freq(fe, p->frequency, > Hi Mauro, your patch doesn't work. Here is not set demod for all others (demod=0). -- Stefan Ringel -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/5] go7007 staging changes
On Fri, 2010-02-19 at 00:54 -0200, Mauro Carvalho Chehab wrote: > Pete Eberlein wrote: > > Hello. > > > > This series moves most of the subdevice drivers used by the go7007 > > driver out of the staging directory. The sony-tuner, ov7640, tw2804 and > > tw9903 are converted to use the v4l2_subdev API, and the wis- versions > > are made obsolete. The wis-saa7113 and wis-saa7115 drivers are > > obsolete, and don't add anything not already in the existing saa7113 and > > saa7115 video decoder drivers. The audio chip driver wis-uda1342 > > doesn't belong in > > > > If these changes are accepted, it should be determined if the go7007 > > driver can be moved out of staging, or what work remains to be done. > > Hi Pete, > > Nice work! It seems that the driver is almost ready. > > Please work around the comments made by the others and submit us a new > version. > I think you may add a patch at the end of the series, moving all those > drivers to > drivers/media and drivers/media/go7007. Thanks for the feedback, Mauro. Other projects have been consuming my time, but I hope to soon resubmit the patches incorporating the comments from Hans, and adding the go7007 subdirectory. I also realized that the s2250 driver is actually two devices, one of which is tlv320aic23b, and should be using that driver instead. I also fixed up the patch for the ADS Tech DVD Xpress DX2 from Timothy Jones, and will get that submitted too. > Cheers, > Mauro Pete Eberlein -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] DTV2000 H Plus issues
Well, it is not really a problem, if it is not merged, so this updated version is only for those who want to test it: http://www.sharemation.com/IstvanV/v4l/xc4000-winfast-14021dfc00f3.patch - in xc4000.c, power management may default to on or off depending on the card type - autodetects and (hopefully) supports cards with the following PCI IDs, based on Windows INF files: 107D:6619 WinFast TV2000 XP Global (this is actually the same as 6618 and 6F18) 107D:6F36 WinFast TV2000 XP Global with XC4100 (analog-only XC4000 ?) tuner 107D:6F38 WinFast DTV1800 H with XC4000 tuner 107D:6F42 WinFast DTV2000 H Plus 107D:6F43 WinFast TV2000 XP Global with XC4100 tuner and different GPIOs Not all of these card versions may actually exist in practice, though, only 6F38 and 6F42 are confirmed so far. - added a new "sharpness" control to the CX88 driver On 02/18/2010 12:59 AM, Devin Heitmueller wrote: > I would hate to come across as a jerk here, but he cannot provide his > SOB for this patch, as I wrote about 95% of the code here. It's > derived from a tree I have been working on for the PCTV 340e: -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video_device: don't free_irq() an element past array vpif_obj.dev[] and fix test
The first loop ends when platform_get_resource() returns NULL. Can it occur that no platform_get_resource() succeeded? I think we should error return if that happens. Could k grow larger than VPIF_DISPLAY_MAX_DEVICES there? Should we err out in that case? In the loop `for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++)' if video_device_alloc() fails I think we correctly release the devices, but we have to do more before we reach label vpif_int_err. As mentioned, we left the first loop with a res of NULL, which is dereferenced at label vpif_int_err. So we have to get the resource again, however, k was incremented at the end of that loop as well. Also i used as index in the second loop as well should point to res->end before going to label vpif_int_err, to free all requested irqs. All this needs to be done for later error labels as well, so a new label is added where this occurs, alloc_vid_fail. Variable k can't be reused in the third for-loop and at label probe_out. As mentioned k is needed to get the resource in case a error and clean-up is required. If we reach label vpif_int_err, res shouldn't be NULL, since we dereference it. Previously we had: for (; k >= 0; k--) { for (m = i; m >= res->start; m--) free_irq(m, (void *)(&vpif_obj.dev[k]->channel_id)); res = platform_get_resource(pdev, IORESOURCE_IRQ, k-1); m = res->end; } In the last iteration k equals 0, so we call platform_get_resource() with -1 as a third argument. Since platform_get_resource() uses an unsigned it is converted to 0x. platform_get_resource() fails for every index and returns NULL. A test is lacking and we dereference NULL. The error "VPIF IRQ request failed" should only be displayed when request_irq() failed, not in the case of other errors. Also I changed some indexes, so a few could be removed. Signed-off-by: Roel Kluin --- There were some errors in the changelog and a signoff was missing. > Ok. You are right! The ch_params[] is a table for keeping the information > about different standards supported. For a given stdid in std_info, the > function matches the stdid with that in the table and get the corresponding > entry. + if (k == VPIF_DISPLAY_MAX_DEVICES) + k = VPIF_DISPLAY_MAX_DEVICES - 1; >> >> actually I think this is still not right. shouldn't it be be >> >> k = VPIF_DISPLAY_MAX_DEVICES - 1; > > What you mean here? What you suggest here is same as in your patch, right? I must admit I did not test this, except with checkpatch.pl, but I think the issues are real and should be fixed. Do you have comments? drivers/media/video/davinci/vpif_display.c | 61 +++- 1 files changed, 41 insertions(+), 20 deletions(-) diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index dfddef7..ae8ca94 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c @@ -383,7 +383,7 @@ static int vpif_get_std_info(struct channel_obj *ch) int index; std_info->stdid = vid_ch->stdid; - if (!std_info) + if (!std_info->stdid) return -1; for (index = 0; index < ARRAY_SIZE(ch_params); index++) { @@ -1423,7 +1423,7 @@ static __init int vpif_probe(struct platform_device *pdev) { struct vpif_subdev_info *subdevdata; struct vpif_display_config *config; - int i, j = 0, k, q, m, err = 0; + int i, j, k, err; struct i2c_adapter *i2c_adap; struct common_obj *common; struct channel_obj *ch; @@ -1452,12 +1452,18 @@ static __init int vpif_probe(struct platform_device *pdev) if (request_irq(i, vpif_channel_isr, IRQF_DISABLED, "DM646x_Display", (void *)(&vpif_obj.dev[k]->channel_id))) { + i--; err = -EBUSY; + vpif_err("VPIF IRQ request failed\n"); goto vpif_int_err; } } k++; + if (k >= VPIF_DISPLAY_MAX_DEVICES) + break; } + if (k == 0) + return -ENODEV; for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) { @@ -1472,7 +1478,7 @@ static __init int vpif_probe(struct platform_device *pdev) video_device_release(ch->video_dev); } err = -ENOMEM; - goto vpif_int_err; + goto alloc_vid_fail; } /* Initialize field of video device */ @@ -1489,13 +1495,13 @@ static __init int vpif_probe(struct platform_device *pdev) ch->video_dev = vfd; } - for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) { -
Re: adv7180 as SoC camera device
On Fri, 19 Feb 2010, Rodolfo Giometti wrote: > Hello, > > on my pxa27x based board I have a adv7180 connected with the CIF > interface. Due this fact I'm going to use the pxa_camera.c driver > which in turn registers a soc_camera_host. > > In the latest kernel I found your driver for the ADV7180, but it > registers the chip as a v4l sub device. > > I suppose these two interfaces are not compatible, aren't they? Congratulations! Thereby you're in a position to develop the first v4l2-subdev / soc-camera universal driver;) The answer to this your question is - they are... kinda. This means - yes, soc-camera is also using the v4l2-subdev API, but - with a couple of additions. Basically, there are two things you have to change in the adv7180 driver to make it compatible with soc-camera - (1) add bus-configuration methods, even if they don't do much (see .query_bus_param() and .set_bus_param() methods from struct soc_camera_ops), and (2) migrate the driver to the mediabus API. The latter one requires some care - in principle, mediabus should be the future API to negotiate parameters on the video bus between bridges (in your case PXA CIF) and clients, but for you this means you also have to migrate any other bridge drivers in the mainline to that API, and, if they also interface to some other subdevices - those too, and if those can also work with other bridges - those too...;) But, I think, that chain will terminate quite soon, in fact, I cannot find any users of that driver currently in the mainline, Richard? > In this situation, should I write a new driver for the > soc_camera_device? Which is The-Right-Thing(TM) to do? :) Please, have a look and try to convert the driver as described above. All the APIs and a few examples are in the mainline, so, you should have enough copy-paste sources;) Ask on the list (with me on cc) if anything is still unclear. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video_device: don't free_irq() an element past array vpif_obj.dev[] and fix test
> Ok. You are right! The ch_params[] is a table for keeping the information > about different standards supported. For a given stdid in std_info, the > function matches the stdid with that in the table and get the corresponding > entry. + if (k == VPIF_DISPLAY_MAX_DEVICES) + k = VPIF_DISPLAY_MAX_DEVICES - 1; >> >> actually I think this is still not right. shouldn't it be be >> >> k = VPIF_DISPLAY_MAX_DEVICES - 1; > > What you mean here? What you suggest here is same as in your patch, right? I think there were many more issues: The first loop ends when platform_get_resource() returns NULL. Can it occur that no platform_get_resource() succeeded? I think we should error return if that happens. Could k grow larger than VPIF_DISPLAY_MAX_DEVICES there? Should we err out in that case? In the loop `for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++)' if video_device_alloc() fails I think we correctly release the devices, but we have to do more before we reach label vpif_int_err. As mentioned, we left the first loop with a res of NULL, which is dereferenced at label vpif_int_err. So we have to get the resource again, however, k was incremented at the end of that loop as well. Also i used as index in the second loop as well should point to res->end before going to label vpif_int_err, to free all requested irqs. All this needs to be done for later error labels as well, so a new label should be added. Variable k can't be reused, it is needed to get the resource in case a error and cleanup is required. Also in label probe_out a loop with k as index is used, but k is already an index that is required to get the resource later. If we reach label vpif_int_err, res shouldn't be NULL, since we dereference it. Previously we had: for (; k >= 0; k--) { for (m = i; m >= res->start; m--) free_irq(m, (void *)(&vpif_obj.dev[k]->channel_id)); res = platform_get_resource(pdev, IORESOURCE_IRQ, k-1); m = res->end; } In the last iteration k equals 0, so we call platform_get_resource() with -1 as a third argument. Since platform_get_resource() uses an unsigned it is converted to 0x. platform_get_resource() fails for every index and returns NULL. A test is lacking and we dereference NULL. This all occurs at the new label alloc_vid_fail. The error "VPIF IRQ request failed" should only be displayed when request_irq() failed, not in the case of other errors. Also I changed some indexes, so a few could be removed. I must admit I did not test this, except with checkpatch.pl, but I think the issues are real and should be fixed. Do you have comments? drivers/media/video/davinci/vpif_display.c | 61 +++- 1 files changed, 41 insertions(+), 20 deletions(-) diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index dfddef7..ae8ca94 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c @@ -383,7 +383,7 @@ static int vpif_get_std_info(struct channel_obj *ch) int index; std_info->stdid = vid_ch->stdid; - if (!std_info) + if (!std_info->stdid) return -1; for (index = 0; index < ARRAY_SIZE(ch_params); index++) { @@ -1423,7 +1423,7 @@ static __init int vpif_probe(struct platform_device *pdev) { struct vpif_subdev_info *subdevdata; struct vpif_display_config *config; - int i, j = 0, k, q, m, err = 0; + int i, j, k, err; struct i2c_adapter *i2c_adap; struct common_obj *common; struct channel_obj *ch; @@ -1452,12 +1452,18 @@ static __init int vpif_probe(struct platform_device *pdev) if (request_irq(i, vpif_channel_isr, IRQF_DISABLED, "DM646x_Display", (void *)(&vpif_obj.dev[k]->channel_id))) { + i--; err = -EBUSY; + vpif_err("VPIF IRQ request failed\n"); goto vpif_int_err; } } k++; + if (k >= VPIF_DISPLAY_MAX_DEVICES) + break; } + if (k == 0) + return -ENODEV; for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) { @@ -1472,7 +1478,7 @@ static __init int vpif_probe(struct platform_device *pdev) video_device_release(ch->video_dev); } err = -ENOMEM; - goto vpif_int_err; + goto alloc_vid_fail; } /* Initialize field of video device */ @@ -1489,13 +1495,13 @@ static __init int vpif_probe(struct platform_device *pdev) ch->video_dev = vfd; } - for (j = 0; j < VPIF_DISP
[PATCH v5 5/6] V4L: Events: Support event handling in do_ioctl
Add support for event handling to do_ioctl. Signed-off-by: Sakari Ailus --- drivers/media/video/v4l2-ioctl.c | 58 ++ include/media/v4l2-ioctl.h |7 2 files changed, 65 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 34c7d6e..f7d6177 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -25,6 +25,8 @@ #endif #include #include +#include +#include #include #define dbgarg(cmd, fmt, arg...) \ @@ -1944,7 +1946,63 @@ static long __video_do_ioctl(struct file *file, } break; } + case VIDIOC_DQEVENT: + { + struct v4l2_event *ev = arg; + struct v4l2_fh *vfh = fh; + + if (!test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) + || vfh->events == NULL) + break; + + ret = v4l2_event_dequeue(fh, ev); + if (ret < 0) { + dbgarg(cmd, "no pending events?"); + break; + } + dbgarg(cmd, + "pending=%d, type=0x%8.8x, sequence=%d, " + "timestamp=%lu.%9.9lu ", + ev->pending, ev->type, ev->sequence, + ev->timestamp.tv_sec, ev->timestamp.tv_nsec); + break; + } + case VIDIOC_SUBSCRIBE_EVENT: + { + struct v4l2_event_subscription *sub = arg; + struct v4l2_fh *vfh = fh; + if (!test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) + || vfh->events == NULL + || !ops->vidioc_subscribe_event) + break; + + ret = ops->vidioc_subscribe_event(fh, sub); + if (ret < 0) { + dbgarg(cmd, "failed, ret=%ld", ret); + break; + } + dbgarg(cmd, "type=0x%8.8x", sub->type); + break; + } + case VIDIOC_UNSUBSCRIBE_EVENT: + { + struct v4l2_event_subscription *sub = arg; + struct v4l2_fh *vfh = fh; + + if (!test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) + || vfh->events == NULL + || !ops->vidioc_unsubscribe_event) + break; + + ret = ops->vidioc_unsubscribe_event(fh, sub); + if (ret < 0) { + dbgarg(cmd, "failed, ret=%ld", ret); + break; + } + dbgarg(cmd, "type=0x%8.8x", sub->type); + break; + } default: { if (!ops->vidioc_default) diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index e8ba0f2..06daa6e 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -21,6 +21,8 @@ #include #endif +struct v4l2_fh; + struct v4l2_ioctl_ops { /* ioctl callbacks */ @@ -254,6 +256,11 @@ struct v4l2_ioctl_ops { int (*vidioc_g_dv_timings) (struct file *file, void *fh, struct v4l2_dv_timings *timings); + int (*vidioc_subscribe_event) (struct v4l2_fh *fh, + struct v4l2_event_subscription *sub); + int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, + struct v4l2_event_subscription *sub); + /* For other private ioctls */ long (*vidioc_default) (struct file *file, void *fh, int cmd, void *arg); -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 6/6] V4L: Events: Add documentation
Add documentation on how to use V4L2 events, both for V4L2 drivers and for V4L2 applications. Signed-off-by: Sakari Ailus --- Documentation/DocBook/media-entities.tmpl |9 ++ Documentation/DocBook/v4l/dev-event.xml| 34 ++ Documentation/DocBook/v4l/v4l2.xml |3 + Documentation/DocBook/v4l/vidioc-dqevent.xml | 124 .../DocBook/v4l/vidioc-subscribe-event.xml | 109 + Documentation/video4linux/v4l2-framework.txt | 43 +++ 6 files changed, 322 insertions(+), 0 deletions(-) create mode 100644 Documentation/DocBook/v4l/dev-event.xml create mode 100644 Documentation/DocBook/v4l/vidioc-dqevent.xml create mode 100644 Documentation/DocBook/v4l/vidioc-subscribe-event.xml diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl index c725cb8..770be3c 100644 --- a/Documentation/DocBook/media-entities.tmpl +++ b/Documentation/DocBook/media-entities.tmpl @@ -17,6 +17,7 @@ VIDIOC_DBG_G_REGISTER"> VIDIOC_DBG_S_REGISTER"> VIDIOC_DQBUF"> +VIDIOC_DQEVENT"> VIDIOC_ENCODER_CMD"> VIDIOC_ENUMAUDIO"> VIDIOC_ENUMAUDOUT"> @@ -60,6 +61,7 @@ VIDIOC_REQBUFS"> VIDIOC_STREAMOFF"> VIDIOC_STREAMON"> +VIDIOC_SUBSCRIBE_EVENT"> VIDIOC_S_AUDIO"> VIDIOC_S_AUDOUT"> VIDIOC_S_CROP"> @@ -141,6 +143,8 @@ v4l2_enc_idx"> v4l2_enc_idx_entry"> v4l2_encoder_cmd"> +v4l2_event"> +v4l2_event_subscription"> v4l2_ext_control"> v4l2_ext_controls"> v4l2_fmtdesc"> @@ -200,6 +204,7 @@ + @@ -292,6 +297,8 @@ + + @@ -381,3 +388,5 @@ + + diff --git a/Documentation/DocBook/v4l/dev-event.xml b/Documentation/DocBook/v4l/dev-event.xml new file mode 100644 index 000..70a9895 --- /dev/null +++ b/Documentation/DocBook/v4l/dev-event.xml @@ -0,0 +1,34 @@ + Event Interface + + The V4L2 event interface provides means for user to get + immediately notified on certain conditions taking place on a device. + This might include start of frame or loss of signal events, for + example. + + + To receive events, the events the user is interested first + must be subscribed using the &VIDIOC-SUBSCRIBE-EVENT; ioctl. Once an + event is subscribed, the events of subscribed types are dequeueable + using the &VIDIOC-DQEVENT; ioctl. Events may be unsubscribed using + VIDIOC_UNSUBSCRIBE_EVENT ioctl. The special event type + V4L2_EVENT_ALL may be used to subscribe or unsubscribe all the + events the driver supports. + + The event subscriptions and event queues are specific to file + handles. Subscribing an event on one file handle does not affect + other file handles. + + + The information on dequeueable events are obtained by using + select or poll system calls on video devices. The V4L2 events use + POLLPRI events on poll system call and exceptions on select system + call. + + + diff --git a/Documentation/DocBook/v4l/v4l2.xml b/Documentation/DocBook/v4l/v4l2.xml index 060105a..9737243 100644 --- a/Documentation/DocBook/v4l/v4l2.xml +++ b/Documentation/DocBook/v4l/v4l2.xml @@ -401,6 +401,7 @@ and discussions on the V4L mailing list. &sub-dev-teletext; &sub-dev-radio; &sub-dev-rds; + &sub-dev-event; @@ -426,6 +427,7 @@ and discussions on the V4L mailing list. &sub-cropcap; &sub-dbg-g-chip-ident; &sub-dbg-g-register; +&sub-dqevent; &sub-encoder-cmd; &sub-enumaudio; &sub-enumaudioout; @@ -467,6 +469,7 @@ and discussions on the V4L mailing list. &sub-reqbufs; &sub-s-hw-freq-seek; &sub-streamon; +&sub-subscribe-event; &sub-mmap; &sub-munmap; diff --git a/Documentation/DocBook/v4l/vidioc-dqevent.xml b/Documentation/DocBook/v4l/vidioc-dqevent.xml new file mode 100644 index 000..eb45c16 --- /dev/null +++ b/Documentation/DocBook/v4l/vidioc-dqevent.xml @@ -0,0 +1,124 @@ + + +ioctl VIDIOC_DQEVENT +&manvol; + + + +VIDIOC_DQEVENT +Dequeue event + + + + + + int ioctl + int fd + int request + struct v4l2_event +*argp + + + + + +Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_DQEVENT + + + + argp + + + + + + + + +Description + +Dequeue an event from a video device. No input is required +for this ioctl. All the fields of the &v4l2-event; structure are +filled by the driver. The file handle will also receive exceptions +which the application may get by e.g. using the select system +call. + + + struct v4l2_event + + &cs-str; + + + __u32 + type + + Type of the event. + + + union + u + + + + + + __u8 +data[64] + Event data. Define
[PATCH v5 4/6] V4L: Events: Add backend
Add event handling backend to V4L2. The backend handles event subscription and delivery to file handles. Event subscriptions are based on file handle. Events may be delivered to all subscribed file handles on a device independent of where they originate from. Signed-off-by: Sakari Ailus --- drivers/media/video/Makefile |3 +- drivers/media/video/v4l2-event.c | 286 ++ drivers/media/video/v4l2-fh.c|4 + include/media/v4l2-event.h | 65 + include/media/v4l2-fh.h |2 + 5 files changed, 359 insertions(+), 1 deletions(-) create mode 100644 drivers/media/video/v4l2-event.c create mode 100644 include/media/v4l2-event.h diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 14bf69a..b84abfe 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -10,7 +10,8 @@ stkwebcam-objs:= stk-webcam.o stk-sensor.o omap2cam-objs := omap24xxcam.o omap24xxcam-dma.o -videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o +videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \ + v4l2-event.o # V4L2 core modules diff --git a/drivers/media/video/v4l2-event.c b/drivers/media/video/v4l2-event.c new file mode 100644 index 000..ab31cc6 --- /dev/null +++ b/drivers/media/video/v4l2-event.c @@ -0,0 +1,286 @@ +/* + * drivers/media/video/v4l2-event.c + * + * V4L2 events. + * + * Copyright (C) 2009 Nokia Corporation. + * + * Contact: Sakari Ailus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include +#include +#include + +#include + +static int v4l2_event_init(struct v4l2_fh *fh) +{ + fh->events = kzalloc(sizeof(*fh->events), GFP_KERNEL); + if (fh->events == NULL) + return -ENOMEM; + + init_waitqueue_head(&fh->events->wait); + + INIT_LIST_HEAD(&fh->events->free); + INIT_LIST_HEAD(&fh->events->available); + INIT_LIST_HEAD(&fh->events->subscribed); + + fh->events->sequence = -1; + + return 0; +} + +int v4l2_event_alloc(struct v4l2_fh *fh, unsigned int n) +{ + struct v4l2_events *events; + unsigned long flags; + int ret; + + if (!fh->events) { + ret = v4l2_event_init(fh); + if (ret) + return ret; + } + + events = fh->events; + + while (events->nallocated < n) { + struct v4l2_kevent *kev; + + kev = kzalloc(sizeof(*kev), GFP_KERNEL); + if (kev == NULL) + return -ENOMEM; + + spin_lock_irqsave(&fh->vdev->fh_lock, flags); + list_add_tail(&kev->list, &events->free); + events->nallocated++; + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); + } + + return 0; +} +EXPORT_SYMBOL_GPL(v4l2_event_alloc); + +#define list_kfree(list, type, member) \ + while (!list_empty(list)) { \ + type *hi; \ + hi = list_first_entry(list, type, member); \ + list_del(&hi->member); \ + kfree(hi); \ + } + +void v4l2_event_free(struct v4l2_fh *fh) +{ + struct v4l2_events *events = fh->events; + + if (!events) + return; + + list_kfree(&events->free, struct v4l2_kevent, list); + list_kfree(&events->available, struct v4l2_kevent, list); + list_kfree(&events->subscribed, struct v4l2_subscribed_event, list); + + kfree(events); + fh->events = NULL; +} +EXPORT_SYMBOL_GPL(v4l2_event_free); + +int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event) +{ + struct v4l2_events *events = fh->events; + struct v4l2_kevent *kev; + unsigned long flags; + + spin_lock_irqsave(&fh->vdev->fh_lock, flags); + + if (list_empty(&events->available)) { + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); + return -ENOENT; + } + + WARN_ON(events->navailable == 0); + + kev = list_first_entry(&events->available, struct v4l2_kevent, list); + list_move(&kev->list, &events->free); + events->navailable--; + +
[PATCH v5 3/6] V4L: Events: Add new ioctls for events
This patch adds a set of new ioctls to the V4L2 API. The ioctls conform to V4L2 Events RFC version 2.3: http://www.spinics.net/lists/linux-media/msg12033.html> Signed-off-by: Sakari Ailus --- drivers/media/video/v4l2-compat-ioctl32.c |3 +++ drivers/media/video/v4l2-ioctl.c |3 +++ include/linux/videodev2.h | 26 ++ 3 files changed, 32 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index f77f84b..9004a5f 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -1086,6 +1086,9 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) case VIDIOC_QUERY_DV_PRESET: case VIDIOC_S_DV_TIMINGS: case VIDIOC_G_DV_TIMINGS: + case VIDIOC_DQEVENT: + case VIDIOC_SUBSCRIBE_EVENT: + case VIDIOC_UNSUBSCRIBE_EVENT: ret = do_video_ioctl(file, cmd, arg); break; diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 4b11257..34c7d6e 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -290,6 +290,9 @@ static const char *v4l2_ioctls[] = { [_IOC_NR(VIDIOC_QUERY_DV_PRESET)] = "VIDIOC_QUERY_DV_PRESET", [_IOC_NR(VIDIOC_S_DV_TIMINGS)] = "VIDIOC_S_DV_TIMINGS", [_IOC_NR(VIDIOC_G_DV_TIMINGS)] = "VIDIOC_G_DV_TIMINGS", + [_IOC_NR(VIDIOC_DQEVENT)] = "VIDIOC_DQEVENT", + [_IOC_NR(VIDIOC_SUBSCRIBE_EVENT)] = "VIDIOC_SUBSCRIBE_EVENT", + [_IOC_NR(VIDIOC_UNSUBSCRIBE_EVENT)] = "VIDIOC_UNSUBSCRIBE_EVENT", }; #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 3c26560..f7237fc 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1622,6 +1622,29 @@ struct v4l2_streamparm { }; /* + * E V E N T S + */ + +struct v4l2_event { + __u32 type; + union { + __u8data[64]; + } u; + __u32 pending; + __u32 sequence; + struct timespec timestamp; + __u32 reserved[9]; +}; + +struct v4l2_event_subscription { + __u32 type; + __u32 reserved[7]; +}; + +#define V4L2_EVENT_ALL 0 +#define V4L2_EVENT_PRIVATE_START 0x0800 + +/* * A D V A N C E D D E B U G G I N G * * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! @@ -1743,6 +1766,9 @@ struct v4l2_dbg_chip_ident { #defineVIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) #defineVIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) #defineVIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) +#defineVIDIOC_DQEVENT _IOR('V', 83, struct v4l2_event) +#defineVIDIOC_SUBSCRIBE_EVENT _IOW('V', 84, struct v4l2_event_subscription) +#defineVIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 85, struct v4l2_event_subscription) /* Reminder: when adding new ioctls please add support for them to drivers/media/video/v4l2-compat-ioctl32.c as well! */ -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 1/6] V4L: File handles
This patch adds a list of v4l2_fh structures to every video_device. It allows using file handle related information in V4L2. The event interface is one example of such use. Video device drivers should use the v4l2_fh pointer as their file->private_data. Signed-off-by: Sakari Ailus --- drivers/media/video/Makefile |2 +- drivers/media/video/v4l2-dev.c |4 ++ drivers/media/video/v4l2-fh.c | 64 include/media/v4l2-dev.h |5 +++ include/media/v4l2-fh.h| 42 ++ 5 files changed, 116 insertions(+), 1 deletions(-) create mode 100644 drivers/media/video/v4l2-fh.c create mode 100644 include/media/v4l2-fh.h diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 5163289..14bf69a 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -10,7 +10,7 @@ stkwebcam-objs:= stk-webcam.o stk-sensor.o omap2cam-objs := omap24xxcam.o omap24xxcam-dma.o -videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o +videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o # V4L2 core modules diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 7090699..65a7b30 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -421,6 +421,10 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, if (!vdev->release) return -EINVAL; + /* v4l2_fh support */ + spin_lock_init(&vdev->fh_lock); + INIT_LIST_HEAD(&vdev->fh_list); + /* Part 1: check device type */ switch (type) { case VFL_TYPE_GRABBER: diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c new file mode 100644 index 000..c707930 --- /dev/null +++ b/drivers/media/video/v4l2-fh.c @@ -0,0 +1,64 @@ +/* + * drivers/media/video/v4l2-fh.c + * + * V4L2 file handles. + * + * Copyright (C) 2009 Nokia Corporation. + * + * Contact: Sakari Ailus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include +#include +#include + +void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) +{ + fh->vdev = vdev; + INIT_LIST_HEAD(&fh->list); + set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags); +} +EXPORT_SYMBOL_GPL(v4l2_fh_init); + +void v4l2_fh_add(struct v4l2_fh *fh) +{ + unsigned long flags; + + spin_lock_irqsave(&fh->vdev->fh_lock, flags); + list_add(&fh->list, &fh->vdev->fh_list); + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); +} +EXPORT_SYMBOL_GPL(v4l2_fh_add); + +void v4l2_fh_del(struct v4l2_fh *fh) +{ + unsigned long flags; + + spin_lock_irqsave(&fh->vdev->fh_lock, flags); + list_del_init(&fh->list); + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); +} +EXPORT_SYMBOL_GPL(v4l2_fh_del); + +void v4l2_fh_exit(struct v4l2_fh *fh) +{ + if (fh->vdev == NULL) + return; + + fh->vdev = NULL; +} +EXPORT_SYMBOL_GPL(v4l2_fh_exit); diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 2dee938..bebe44b 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -32,6 +32,7 @@ struct v4l2_device; Drivers can clear this flag if they want to block all future device access. It is cleared by video_unregister_device. */ #define V4L2_FL_REGISTERED (0) +#define V4L2_FL_USES_V4L2_FH (1) struct v4l2_file_operations { struct module *owner; @@ -77,6 +78,10 @@ struct video_device /* attribute to differentiate multiple indices on one physical device */ int index; + /* V4L2 file handles */ + spinlock_t fh_lock; /* Lock for all v4l2_fhs */ + struct list_headfh_list; /* List of struct v4l2_fh */ + int debug; /* Activates debug level*/ /* Video standard vars */ diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h new file mode 100644 index 000..6b486aa --- /dev/null +++ b/include/media/v4l2-fh.h @@ -0,0 +1,42 @@ +/* + * include/media/v4l2-fh.h + * + * V4L2 file handle. + * + * Copyright (C) 2009 Nokia Corporation. + * + * Contact: Sakari Ailus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * vers
[PATCH v5 2/6] V4L: File handles: Add documentation
Add documentation on using V4L2 file handles (v4l2_fh) in V4L2 drivers. Signed-off-by: Sakari Ailus --- Documentation/video4linux/v4l2-framework.txt | 36 ++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index 74d677c..08f9e59 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt @@ -695,3 +695,39 @@ The better way to understand it is to take a look at vivi driver. One of the main reasons for vivi is to be a videobuf usage example. the vivi_thread_tick() does the task that the IRQ callback would do on PCI drivers (or the irq callback on USB). + +struct v4l2_fh +-- + +struct v4l2_fh provides a way to easily keep file handle specific data +that is used by the V4L2 framework. + +struct v4l2_fh is allocated as a part of the driver's own file handle +structure and is set to file->private_data in the driver's open +function by the driver. Drivers can extract their own file handle +structure by using the container_of macro. + +Useful functions: + +- v4l2_fh_init() + + Initialise the file handle. + +- v4l2_fh_add() + + Add a v4l2_fh to video_device file handle list. May be called after + initialising the file handle. + +- v4l2_fh_del() + + Unassociate the file handle from video_device(). The file handle + exit function may now be called. + +- v4l2_fh_exit() + + Uninitialise the file handle. After uninitialisation the v4l2_fh + memory can be freed. + +The users of v4l2_fh know whether a driver uses v4l2_fh as its +file.private_data pointer by testing the V4L2_FL_USES_V4L2_FH bit in +video_device.flags. -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 0/6] V4L2 file handles and event interface
Hi, Here's the seventh version of the V4L2 file handle and event interface patchset. The patchset has been tested with the OMAP 3 ISP driver. Patches for OMAP 3 ISP are not part of this patchset but are available in Gitorious (branch is called event): git://gitorious.org/omap3camera/mainline.git event The patchset I'm posting now is against the v4l-dvb tree instead of linux-omap (ouch!). The omap3camera tree thus has a slightly different version of these patches. Some more comments from Hans and Laurent. What has changed: - Documentation for both file handles and events. - Sequence number and event queue length patches have been combined with the events backend patch. - Only VIDIOC_DQEVENT is now unconditionally handled by V4L2 without driver's involvement. - __video_do_ioctl() checks that events have been initialised when handling event ioctls. - There is a chance of being able to allocate a few more events to an event queue than intended. This is unlikely to be anyhow harmful, however. - v4l2_event_subscribe_all() is now v4l2_event_subscribe_many(). - V4L2_FL_USES_V4L2_FH is set on video_device.flags in v4l2_fh_init() when the driver initialises the first file handle. - Possibly something else I don't happen to remember just now. Comments are welcome as always. Cheers, -- Sakari Ailus sakari.ai...@maxwell.research.nokia.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 7/7] V4L: Events: Support all events
Hans Verkuil wrote: >> Then don't call it v4l2_event_subscribe_all if it only subscribes to a set >> of >> event :-) >> >>> For each event this function would then call: >>> >>> fh->vdev->ioctl_ops->vidioc_subscribe_event(fh, sub); >>> >>> The nice thing about that is that in the driver you have a minimum of >>> fuss. >>> >>> I'm leaning towards this second solution due to the simple driver >>> implementation. >>> >>> Handling EVENT_ALL will simplify things substantially IMHO. >> >> I'm wondering if subscribing to all events should be allowed. Do we have >> use >> cases for that ? I'm always a bit cautious when adding APIs with no users, >> as >> that means the API has often not been properly tested against possible use >> cases and mistakes will need to be supported forever (or at least for a >> long >> time). > > I think that is a good point. Supporting V4L2_EVENT_ALL makes sense for > unsubscribe, but does it makes sense for subscribe as well? I think it > does not. It just doesn't feel right when I tried to implement it in ivtv. I don't see any harm in supporting it there. We could also specify that drivers may support that. At least for testing purposes that could be quite useful. :-) Perhaps not for regular use, though. > I also wonder whether the unsubscribe API shouldn't just receive the event > type instead of the big subscription struct. Or get its own struct. I > don't think it makes much sense that they both have the same struct. So for unsubscribing the argument would be just event type as __u32? I don't see harm in having the struct there. There might be flags in future, perhaps telling that events of that type should be cleaned up from the event queue, for example. (I can't think of any other purposes now. :)) Cheers, -- Sakari Ailus sakari.ai...@maxwell.research.nokia.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
adv7180 as SoC camera device
Hello, on my pxa27x based board I have a adv7180 connected with the CIF interface. Due this fact I'm going to use the pxa_camera.c driver which in turn registers a soc_camera_host. In the latest kernel I found your driver for the ADV7180, but it registers the chip as a v4l sub device. I suppose these two interfaces are not compatible, aren't they? In this situation, should I write a new driver for the soc_camera_device? Which is The-Right-Thing(TM) to do? :) Thanks in advance, Rodolfo Giometti -- GNU/Linux Solutions e-mail: giome...@enneenne.com Linux Device Driver giome...@linux.it Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] v4l: soc_camera: fix bound checking of mbus_fmt[] index
On Thu, 18 Feb 2010, Baruch Siach wrote: Thanks for the patch, but I decided to improve it a bit. In fact, the only case my original version was missing was code == V4L2_MBUS_FMT_FIXED, the correct test would be (unsigned int)(code - V4L2_MBUS_FMT_FIXED -1) >= ARRAY_SIZE(mbus_fmt) but to make it simple we can indeed break this into two tests, the compiler will optimise it for us. So, if you agree, I'll push the version of your patch, attached at the bottom of this mail, for 2.6.33, so, please reply asap... Thanks Guennadi > When code <= V4L2_MBUS_FMT_FIXED soc_mbus_get_fmtdesc returns a pointer to > mbus_fmt[x], where x < 0. Fix this. > > Signed-off-by: Baruch Siach > --- > drivers/media/video/soc_mediabus.c |2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/media/video/soc_mediabus.c > b/drivers/media/video/soc_mediabus.c > index f8d5c87..a2808e2 100644 > --- a/drivers/media/video/soc_mediabus.c > +++ b/drivers/media/video/soc_mediabus.c > @@ -136,6 +136,8 @@ const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( > { > if ((unsigned int)(code - V4L2_MBUS_FMT_FIXED) > ARRAY_SIZE(mbus_fmt)) > return NULL; > + if ((unsigned int)code <= V4L2_MBUS_FMT_FIXED) > + return NULL; > return mbus_fmt + code - V4L2_MBUS_FMT_FIXED - 1; > } > EXPORT_SYMBOL(soc_mbus_get_fmtdesc); > -- > 1.6.6.1 > --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ >From 00109d655b4b8cf25bc68a215966be810e372e87 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Fri, 19 Feb 2010 18:09:25 +0100 Subject: [PATCH] v4l: soc_camera: fix bound checking of mbus_fmt[] index When code <= V4L2_MBUS_FMT_FIXED soc_mbus_get_fmtdesc returns a pointer to mbus_fmt[x], where x < 0. Fix this. Signed-off-by: Baruch Siach Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/soc_mediabus.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/soc_mediabus.c b/drivers/media/video/soc_mediabus.c index f8d5c87..a4c0ef4 100644 --- a/drivers/media/video/soc_mediabus.c +++ b/drivers/media/video/soc_mediabus.c @@ -134,7 +134,8 @@ EXPORT_SYMBOL(soc_mbus_bytes_per_line); const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( enum v4l2_mbus_pixelcode code) { - if ((unsigned int)(code - V4L2_MBUS_FMT_FIXED) > ARRAY_SIZE(mbus_fmt)) + if (code - V4L2_MBUS_FMT_FIXED > ARRAY_SIZE(mbus_fmt) || + code <= V4L2_MBUS_FMT_FIXED) return NULL; return mbus_fmt + code - V4L2_MBUS_FMT_FIXED - 1; } -- 1.6.2.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mfd: Add timb-radio to the timberdale MFD
On 02/19/2010 04:52 AM, Mauro Carvalho Chehab wrote: Richard Röjfors wrote: This patch addes timb-radio to all configurations of the timberdale MFD. Connected to the FPGA is a TEF6862 tuner and a SAA7706H DSP, the I2C board info of these devices is passed via the timb-radio platform data. Hi Richard, I'm trying to apply it to my git tree (http://git.linuxtv.org/v4l-dvb.git), but it is failing: Ah, this patch was against your linux-next.git at kernel.org. I will generate a new patch against the proper git. --Richard -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
soc-camera: pixclk polarity question
Hi, I'm working with µCs (i.MX27) and cameras (Aptina) at the moment. Now I encountered a problem introduced by serializing and deserializing (lvds) camera data on its way to the µC. The serializer expects a specific pixclk polarity which can be configured in hardware. In most cases this is no problem as it is permanently connected to only one sensor chip, but camera sensors with configurable pixclk could negotiate the wrong polarity. The deserializer generates pixclk from data, its polarity again can be configured in hardware. This leads to pixclk inversion depending on wheter serdes is happening or not, so its not an attribute of the platform (in opposition to what SOCAM_SENSOR_INVERT_PCLK is meant for) What would be the correct way to address this? Do we need another platform flag, e.g. SOCAM_PCLK_SAMPLE_RISING_FIXED? The only solution coming to my mind is checking for the SerDes on boot time and setting flags like SOCAM_PCLK_SAMPLE_RISING_FIXED and SOCAM_SENSOR_INVERT_PCLK if necessary. Any other ideas? Thanks, Philipp -- NEU: Mit GMX DSL über 1000,- ¿ sparen! http://portal.gmx.net/de/go/dsl02 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[libdvben50221] new cams, new errors
Hi I have a irdeto card and three cam modules for it. I'm using a netup card with the last revision of v4l-dvb driver and the last revision of dvb-apps. Using dvb-apps tools, I'm running the same descrambling test with the three cams but only one cam worked properly. With dvblast, the three cams work fine. $ cat mtv-networks.conf #for MTV on Astra 19.2e MTV:11739:v:0:27500:3021:3022:28652 $ To test them, I run `szap -a 0 -c mtv-networks.conf -rn 1' in a first terminal and `./test-app 0 312' in a second one. `test-app' is comming form the test folder of the dvb-apps package. Here are the outputs of `./test-app 0 312' for the three cams. *The first one* a cryptoworks cam $ ./test-app 0 312 Found a CAM on adapter0... waiting... slotid: 0 tcid: 1 Press a key to enter menu 00:Host originated transport connection 1 connected 00:Public resource lookup callback 1 1 1 00:CAM connecting to resource 00010041, session_number 1 00:CAM successfully connected to resource 00010041, session_number 1 00:test_rm_reply_callback 00:test_rm_enq_callback 00:Public resource lookup callback 2 1 1 00:CAM connecting to resource 00020041, session_number 2 00:CAM successfully connected to resource 00020041, session_number 2 00:test_ai_callback Application type: 01 Application manufacturer: Manufacturer code: 033d Menu string: TSD Crypt CW 00:Public resource lookup callback 3 1 1 00:CAM connecting to resource 00030041, session_number 3 00:CAM successfully connected to resource 00030041, session_number 3 00:test_ca_info_callback Supported CA ID: 0d00 and with a `cat /dev/dvb/adapter0/dvr0 | mplayer -', I checked that the stream were correctly descrambled. * The second one* a PowerCam PCam v4.3 $ ./test-app 0 312 Found a CAM on adapter0... waiting... slotid: 0 tcid: 1 Press a key to enter menu 00:Host originated transport connection 1 connected 00:Public resource lookup callback 1 1 1 00:CAM connecting to resource 00010041, session_number 1 00:CAM successfully connected to resource 00010041, session_number 1 00:test_rm_reply_callback 00:test_rm_enq_callback 00:Public resource lookup callback 2 1 1 00:CAM connecting to resource 00020041, session_number 2 00:CAM successfully connected to resource 00020041, session_number 2 00:test_ai_callback Application type: 01 Application manufacturer: 02ca Manufacturer code: 3000 Menu string: PCAM V4.3 00:Public resource lookup callback 3 1 1 00:CAM connecting to resource 00030041, session_number 3 00:CAM successfully connected to resource 00030041, session_number 3 00:test_ca_info_callback Supported CA ID: 4aa1 Supported CA ID: 0100 Supported CA ID: 0500 Supported CA ID: 0600 Supported CA ID: 0601 Supported CA ID: 0602 Supported CA ID: 0603 Supported CA ID: 0604 Supported CA ID: 0606 Supported CA ID: 0608 Supported CA ID: 0614 Supported CA ID: 0620 Supported CA ID: 0622 Supported CA ID: 0624 Supported CA ID: 0626 Supported CA ID: 0628 Supported CA ID: 0668 Supported CA ID: 0619 Supported CA ID: 1702 Supported CA ID: 1722 Supported CA ID: 1762 Supported CA ID: 0b00 Supported CA ID: 0b01 Supported CA ID: 0b02 Supported CA ID: 0d00 Supported CA ID: 4aa0 00:Connection to resource 00030041, session_number 3 closed Failed to send CA PMT object $ And sometimes I got this: $ ./test-app 0 312 Found a CAM on adapter0... waiting... slotid: 0 tcid: 1 Press a key to enter menu 00:Host originated transport connection 1 connected 00:Public resource lookup callback 1 1 1 00:CAM connecting to resource 00010041, session_number 1 00:CAM successfully connected to resource 00010041, session_number 1 00:test_rm_reply_callback 00:test_rm_enq_callback 00:Public resource lookup callback 2 1 1 00:CAM connecting to resource 00020041, session_number 2 00:CAM successfully connected to resource 00020041, session_number 2 00:test_ai_callback Application type: 01 Application manufacturer: 02ca Manufacturer code: 3000 Menu string: PCAM V4.3 00:Public resource lookup callback 3 1 1 00:CAM connecting to resource 00030041, session_number 3 00:CAM successfully connected to resource 00030041, session_number 3 00:test_ca_info_callback Supported CA ID: 4aa1 Supported CA ID: 0100 Supported CA ID: 0500 Supported CA ID: 0600 Supported CA ID: 0601 Supported CA ID: 0602 Supported CA ID: 0603 Supported CA ID: 0604 Supported CA ID: 0606 Supported CA ID: 0608 Supported CA ID: 0614 Supported CA ID: 0620 Supported CA ID: 0622 Supported CA ID: 0624 Supported CA ID: 0626 Supported CA ID: 0628 Supported CA ID: 0668 Supported CA ID: 0619 Supported CA ID: 1702 Supported CA ID: 1722 Supported CA ID: 1762 Supported CA ID: 0b00 Supported CA ID: 0b01 Supported CA ID: 0b02 Supported CA ID: 0d00 Supported CA ID: 4aa0 00:Connection to resource 00030041, session_number 3 closed 00:Public resource lookup callback 3 1 1 00:CAM connecting to resource 00030041, session_number 3 00:CAM successfully connected to resource 000
Re: [RESEND] Re: DViCO FusionHDTV DVB-T Dual Digital 4 (rev 1) tuning regression
> Robert Lowery wrote: >> Mauro, >> >> I had to make 2 changes to get the patch to work for me > > Ok. Please test this (hopefully) final revision. This version works for me > > -- > > commit bd8bb8798bb96136b6898186d505c9e154334b5d > Author: Mauro Carvalho Chehab > Date: Fri Feb 19 02:45:00 2010 -0200 > > V4L/DVB: tuner-xc2028: fix tuning logic > > There's one reported regression in Australia (DTV7) and some > reported troubles with newer firmwares. Rework the logic to improve > tuner on those cases. > > Thanks-to: Robert Lowery > Thanks-to: Stefan Ringel > Signed-off-by: Mauro Carvalho Chehab > > diff --git a/drivers/media/common/tuners/tuner-xc2028.c > b/drivers/media/common/tuners/tuner-xc2028.c > index ed50168..ef61815 100644 > --- a/drivers/media/common/tuners/tuner-xc2028.c > +++ b/drivers/media/common/tuners/tuner-xc2028.c > @@ -932,30 +932,52 @@ static int generic_set_freq(struct dvb_frontend *fe, > u32 freq /* in HZ */, >* that xc2028 will be in a safe state. >* Maybe this might also be needed for DTV. >*/ > - if (new_mode == T_ANALOG_TV) > + if (new_mode == T_ANALOG_TV) { > rc = send_seq(priv, {0x00, 0x00}); > > - /* > - * Digital modes require an offset to adjust to the > - * proper frequency. > - * Analog modes require offset = 0 > - */ > - if (new_mode == T_DIGITAL_TV) { > - /* Sets the offset according with firmware */ > + /* Analog modes require offset = 0 */ > + } else { > + /* > + * Digital modes require an offset to adjust to the > + * proper frequency. The offset depends on what > + * firmware version is used. > + */ > + > + /* > + * Adjust to the center frequency. This is calculated by the > + * formula: offset = 1.25MHz - BW/2 > + * For DTV 7/8, the firmware uses BW = 8000, so it needs a > + * further adjustment to get the frequency center on VHF > + */ > if (priv->cur_fw.type & DTV6) > offset = 175; > else if (priv->cur_fw.type & DTV7) > offset = 225; > else/* DTV8 or DTV78 */ > offset = 275; > + if ((priv->cur_fw.type & DTV78) && freq < 47000) > + offset -= 50; > > /* > - * We must adjust the offset by 500kHz when > - * tuning a 7MHz VHF channel with DTV78 firmware > - * (used in Australia, Italy and Germany) > + * xc3028 additional "magic" > + * Depending on the firmware version, it needs some adjustments > + * to properly centralize the frequency. This seems to be > + * needed to compensate the SCODE table adjustments made by > + * newer firmwares >*/ > - if ((priv->cur_fw.type & DTV78) && freq < 47000) > - offset -= 50; > + > + if (priv->firm_version < 0x0302) { > + if (priv->cur_fw.type & DTV7) > + offset += 50; > +#if 0 > + /* Still need some tests */ > + } else { > + if (priv->cur_fw.type & DTV7) > + offset -= 30; > + else if (type != ATSC) /* DVB @6MHz, DTV 8 and DTV 7/8 > */ > + offset += 20; > +#endif > + } > } > > div = (freq - offset + DIV / 2) / DIV; > @@ -1114,17 +1136,22 @@ static int xc2028_set_params(struct dvb_frontend > *fe, > > /* All S-code tables need a 200kHz shift */ > if (priv->ctrl.demod) { > - demod = priv->ctrl.demod + 200; > + /* > + * Newer firmwares require a 200 kHz offset only for ATSC > + */ > + if (type == ATSC || priv->firm_version < 0x0302) > + demod = priv->ctrl.demod + 200; > /* >* The DTV7 S-code table needs a 700 kHz shift. > - * Thanks to Terry Wu for reporting this >* >* DTV7 is only used in Australia. Germany or Italy may also >* use this firmware after initialization, but a tune to a UHF >* channel should then cause DTV78 to be used. > + * > + * Unfortunately, on real-field tests, the s-code offset > + * didn't work as expected, as reported by > + * Robert Lowery >*/ > - if (type & DTV7) > - demod += 500; > } > > return generic_set_freq(fe, p->frequency, > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majord...@vger.kernel.org > More majordomo info at
Re: [RESEND] Re: DViCO FusionHDTV DVB-T Dual Digital 4 (rev 1) tuning regression
Robert Lowery wrote: > Mauro, > > I had to make 2 changes to get the patch to work for me Ok. Please test this (hopefully) final revision. -- commit bd8bb8798bb96136b6898186d505c9e154334b5d Author: Mauro Carvalho Chehab Date: Fri Feb 19 02:45:00 2010 -0200 V4L/DVB: tuner-xc2028: fix tuning logic There's one reported regression in Australia (DTV7) and some reported troubles with newer firmwares. Rework the logic to improve tuner on those cases. Thanks-to: Robert Lowery Thanks-to: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index ed50168..ef61815 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c @@ -932,30 +932,52 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, * that xc2028 will be in a safe state. * Maybe this might also be needed for DTV. */ - if (new_mode == T_ANALOG_TV) + if (new_mode == T_ANALOG_TV) { rc = send_seq(priv, {0x00, 0x00}); - /* -* Digital modes require an offset to adjust to the -* proper frequency. -* Analog modes require offset = 0 -*/ - if (new_mode == T_DIGITAL_TV) { - /* Sets the offset according with firmware */ + /* Analog modes require offset = 0 */ + } else { + /* +* Digital modes require an offset to adjust to the +* proper frequency. The offset depends on what +* firmware version is used. +*/ + + /* +* Adjust to the center frequency. This is calculated by the +* formula: offset = 1.25MHz - BW/2 +* For DTV 7/8, the firmware uses BW = 8000, so it needs a +* further adjustment to get the frequency center on VHF +*/ if (priv->cur_fw.type & DTV6) offset = 175; else if (priv->cur_fw.type & DTV7) offset = 225; else/* DTV8 or DTV78 */ offset = 275; + if ((priv->cur_fw.type & DTV78) && freq < 47000) + offset -= 50; /* -* We must adjust the offset by 500kHz when -* tuning a 7MHz VHF channel with DTV78 firmware -* (used in Australia, Italy and Germany) +* xc3028 additional "magic" +* Depending on the firmware version, it needs some adjustments +* to properly centralize the frequency. This seems to be +* needed to compensate the SCODE table adjustments made by +* newer firmwares */ - if ((priv->cur_fw.type & DTV78) && freq < 47000) - offset -= 50; + + if (priv->firm_version < 0x0302) { + if (priv->cur_fw.type & DTV7) + offset += 50; +#if 0 + /* Still need some tests */ + } else { + if (priv->cur_fw.type & DTV7) + offset -= 30; + else if (type != ATSC) /* DVB @6MHz, DTV 8 and DTV 7/8 */ + offset += 20; +#endif + } } div = (freq - offset + DIV / 2) / DIV; @@ -1114,17 +1136,22 @@ static int xc2028_set_params(struct dvb_frontend *fe, /* All S-code tables need a 200kHz shift */ if (priv->ctrl.demod) { - demod = priv->ctrl.demod + 200; + /* +* Newer firmwares require a 200 kHz offset only for ATSC +*/ + if (type == ATSC || priv->firm_version < 0x0302) + demod = priv->ctrl.demod + 200; /* * The DTV7 S-code table needs a 700 kHz shift. -* Thanks to Terry Wu for reporting this * * DTV7 is only used in Australia. Germany or Italy may also * use this firmware after initialization, but a tune to a UHF * channel should then cause DTV78 to be used. +* +* Unfortunately, on real-field tests, the s-code offset +* didn't work as expected, as reported by +* Robert Lowery */ - if (type & DTV7) - demod += 500; } return generic_set_freq(fe, p->frequency, -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RESEND] Re: DViCO FusionHDTV DVB-T Dual Digital 4 (rev 1) tuning regression
Robert Lowery wrote: > Mauro, > > I had to make 2 changes to get the patch to work for me > > see below > > HTH > > -Rob > >> +if (priv->firm_version >= 0x0302) { >> +if (priv->cur_fw.type & DTV7) >> +offset -= 30; >> +else if (type != ATSC) /* DVB @6MHz, DTV 8 and DTV 7/8 >> */ >> +offset += 20; >> +} else { >> +if (priv->cur_fw.type & DTV7) >> +offset -= 50; > This should be offset += 50; > >> /* >> * The DTV7 S-code table needs a 700 kHz shift. >> * Thanks to Terry Wu for reporting this > I had to also delete the > if (type & DTV7) > demod += 500 > > I suspect this is no longer required due to the offset += 50 above Both lines should be doing the same thing, but IMO, the better is to keep the change at the demod. Could you please preserve the above and remove the offset +=50 ? Note: are you available for irc? if so, please join #linuxtv at freenode.net. Cheers, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mfd: Add timb-radio to the timberdale MFD
Richard Röjfors wrote: > This patch addes timb-radio to all configurations of the timberdale MFD. > > Connected to the FPGA is a TEF6862 tuner and a SAA7706H DSP, the I2C > board info of these devices is passed via the timb-radio platform data. Hi Richard, I'm trying to apply it to my git tree (http://git.linuxtv.org/v4l-dvb.git), but it is failing: patching file drivers/mfd/timberdale.c Hunk #1 FAILED at 37. Hunk #2 FAILED at 215. Hunk #3 FAILED at 276. Hunk #4 FAILED at 325. Hunk #5 FAILED at 364. Hunk #6 FAILED at 405. 6 out of 6 hunks FAILED -- saving rejects to file drivers/mfd/timberdale.c.rej Patch doesn't apply Could you please verify what's going wrong? > > Signed-off-by: Richard Röjfors > --- > diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c > index 603cf06..1ed44d2 100644 > --- a/drivers/mfd/timberdale.c > +++ b/drivers/mfd/timberdale.c > @@ -37,6 +37,8 @@ > #include > #include > > +#include > + > #include "timberdale.h" > > #define DRIVER_NAME "timberdale" > @@ -213,6 +215,40 @@ const static __devinitconst struct resource > timberdale_uartlite_resources[] = { > }, > }; > > +const static __devinitconst struct resource > timberdale_radio_resources[] = { > +{ > +.start= RDSOFFSET, > +.end= RDSEND, > +.flags= IORESOURCE_MEM, > +}, > +{ > +.start= IRQ_TIMBERDALE_RDS, > +.end= IRQ_TIMBERDALE_RDS, > +.flags= IORESOURCE_IRQ, > +}, > +}; > + > +static __devinitdata struct i2c_board_info > timberdale_tef6868_i2c_board_info = { > +I2C_BOARD_INFO("tef6862", 0x60) > +}; > + > +static __devinitdata struct i2c_board_info > timberdale_saa7706_i2c_board_info = { > +I2C_BOARD_INFO("saa7706h", 0x1C) > +}; > + > +static __devinitdata struct timb_radio_platform_data > +timberdale_radio_platform_data = { > +.i2c_adapter = 0, > +.tuner = { > +.module_name = "tef6862", > +.info = &timberdale_tef6868_i2c_board_info > +}, > +.dsp = { > +.module_name = "saa7706h", > +.info = &timberdale_saa7706_i2c_board_info > +} > +}; > + > const static __devinitconst struct resource timberdale_dma_resources[] = { > { > .start= DMAOFFSET, > @@ -240,6 +276,13 @@ static __devinitdata struct mfd_cell > timberdale_cells_bar0_cfg0[] = { > .data_size = sizeof(timberdale_gpio_platform_data), > }, > { > +.name = "timb-radio", > +.num_resources = ARRAY_SIZE(timberdale_radio_resources), > +.resources = timberdale_radio_resources, > +.platform_data = &timberdale_radio_platform_data, > +.data_size = sizeof(timberdale_radio_platform_data), > +}, > +{ > .name = "xilinx_spi", > .num_resources = ARRAY_SIZE(timberdale_spi_resources), > .resources = timberdale_spi_resources, > @@ -282,6 +325,13 @@ static __devinitdata struct mfd_cell > timberdale_cells_bar0_cfg1[] = { > .resources = timberdale_mlogicore_resources, > }, > { > +.name = "timb-radio", > +.num_resources = ARRAY_SIZE(timberdale_radio_resources), > +.resources = timberdale_radio_resources, > +.platform_data = &timberdale_radio_platform_data, > +.data_size = sizeof(timberdale_radio_platform_data), > +}, > +{ > .name = "xilinx_spi", > .num_resources = ARRAY_SIZE(timberdale_spi_resources), > .resources = timberdale_spi_resources, > @@ -314,6 +364,13 @@ static __devinitdata struct mfd_cell > timberdale_cells_bar0_cfg2[] = { > .data_size = sizeof(timberdale_gpio_platform_data), > }, > { > +.name = "timb-radio", > +.num_resources = ARRAY_SIZE(timberdale_radio_resources), > +.resources = timberdale_radio_resources, > +.platform_data = &timberdale_radio_platform_data, > +.data_size = sizeof(timberdale_radio_platform_data), > +}, > +{ > .name = "xilinx_spi", > .num_resources = ARRAY_SIZE(timberdale_spi_resources), > .resources = timberdale_spi_resources, > @@ -348,6 +405,13 @@ static __devinitdata struct mfd_cell > timberdale_cells_bar0_cfg3[] = { > .data_size = sizeof(timberdale_gpio_platform_data), > }, > { > +.name = "timb-radio", > +.num_resources = ARRAY_SIZE(timberdale_radio_resources), > +.resources = timberdale_radio_resources, > +.platform_data = &timberdale_radio_platform_data, > +.data_size = sizeof(timberdale_radio_platform_data), > +}, > +{ > .name = "xilinx_spi", > .num_resources = ARRAY_SIZE(timberdale_spi_resources), > .resources = timberdale_spi_resources, > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Cheers, Mauro -- To unsubscribe from this
Re: [RESEND] Re: DViCO FusionHDTV DVB-T Dual Digital 4 (rev 1) tuning regression
Mauro, I had to make 2 changes to get the patch to work for me see below HTH -Rob > Robert Lowery wrote: >> Mauro's new code does the 50 offset unconditionally for DTV7 by >> setting offset = 225, not just when the ZARLINK456 or DIBCOM52 >> tables >> were explicitly selected. This change is what appears to cause issues >> for >> me. > > I've reviewed all information and troubles we have with xc3028 tuning, > including the reports related to newer firmwares for XC3028L. I think > that the right fix is the one provided on this patch. > > Could you all please verify if this patch fixes the issues, without > causing > any regression? > > Cheers, > Mauro. > > --- > > V4L/DVB: tuner-xc2028: fix tuning logic > > There's one reported regression in Australia (DTV7) and some > reported troubles with newer firmwares. Rework the logic to improve > tuner on those cases. > > Thanks-to: Robert Lowery > Thanks-to: Stefan Ringel > Signed-off-by: Mauro Carvalho Chehab > --- > drivers/media/common/tuners/tuner-xc2028.c | 51 > > 1 files changed, 37 insertions(+), 14 deletions(-) > > diff --git a/drivers/media/common/tuners/tuner-xc2028.c > b/drivers/media/common/tuners/tuner-xc2028.c > index ed50168..eb782a0 100644 > --- a/drivers/media/common/tuners/tuner-xc2028.c > +++ b/drivers/media/common/tuners/tuner-xc2028.c > @@ -932,30 +932,49 @@ static int generic_set_freq(struct dvb_frontend *fe, > u32 freq /* in HZ */, >* that xc2028 will be in a safe state. >* Maybe this might also be needed for DTV. >*/ > - if (new_mode == T_ANALOG_TV) > + if (new_mode == T_ANALOG_TV) { > rc = send_seq(priv, {0x00, 0x00}); > > - /* > - * Digital modes require an offset to adjust to the > - * proper frequency. > - * Analog modes require offset = 0 > - */ > - if (new_mode == T_DIGITAL_TV) { > - /* Sets the offset according with firmware */ > + /* Analog modes require offset = 0 */ > + } else { > + /* > + * Digital modes require an offset to adjust to the > + * proper frequency. The offset depends on what > + * firmware version is used. > + */ > + > + /* > + * Adjust to the center frequency. This is calculated by the > + * formula: offset = 1.25MHz - BW/2 > + * For DTV 7/8, the firmware uses BW = 8000, so it needs a > + * further adjustment to get the frequency center on VHF > + */ > if (priv->cur_fw.type & DTV6) > offset = 175; > else if (priv->cur_fw.type & DTV7) > offset = 225; > else/* DTV8 or DTV78 */ > offset = 275; > + if ((priv->cur_fw.type & DTV78) && freq < 47000) > + offset -= 50; > > /* > - * We must adjust the offset by 500kHz when > - * tuning a 7MHz VHF channel with DTV78 firmware > - * (used in Australia, Italy and Germany) > + * xc3028 additional "magic" > + * Depending on the firmware version, it needs some adjustments > + * to properly centralize the frequency. This seems to be > + * needed to compensate the SCODE table adjustments made by > + * newer firmwares >*/ > - if ((priv->cur_fw.type & DTV78) && freq < 47000) > - offset -= 50; > + > + if (priv->firm_version >= 0x0302) { > + if (priv->cur_fw.type & DTV7) > + offset -= 30; > + else if (type != ATSC) /* DVB @6MHz, DTV 8 and DTV 7/8 > */ > + offset += 20; > + } else { > + if (priv->cur_fw.type & DTV7) > + offset -= 50; This should be offset += 50; > + } > } > > div = (freq - offset + DIV / 2) / DIV; > @@ -1114,7 +1133,11 @@ static int xc2028_set_params(struct dvb_frontend > *fe, > > /* All S-code tables need a 200kHz shift */ > if (priv->ctrl.demod) { > - demod = priv->ctrl.demod + 200; > + /* > + * Newer firmwares require a 200 kHz offset only for ATSC > + */ > + if (type == ATSC || priv->firm_version < 0x0302) > + demod = priv->ctrl.demod + 200; > /* >* The DTV7 S-code table needs a 700 kHz shift. >* Thanks to Terry Wu for reporting this I had to also delete the if (type & DTV7) demod += 500 I suspect this is no longer required due to the offset += 50 above > -- > 1.6.6.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majord...@vger.kernel