Re: [Linaro-mm-sig] [PATCH] dma-buf: add meta data attachment
Hi all, Adding piles more people. For the first case of caching the iommu mapping there's different answers, depening upon the exact case: 1) You need to fix your userspace to not constantly re-establish the sharing. 2) We need to add streaming dma support for real to dma-bufs so that the mapping can be kept while we transfer ownership around. Thus far no one really needed this though since usually you don't actually do cpu access. 3) You need opportunistic caching of imported/exported buffer objects and their mappings. For this you need a) subsystem import/export support which guarantees you to hand out the same dma-buf/native object again upon re-export or re-import (drm has it) b) some opportunistic caching of buffer objects (pretty much are real gpu drm drivers have it). No need of any metadata scheme, and given how much fun I've had implemented this for drm I don't you can make your metadata scheme work in a sane or correct way wrt lifetimes. For caching the iommu mapping if the iommu is the same for multiple devices: 1) We need some way to figure out which iommu serves which devices. 2) The exporter needs to consult this and might just hand out the same sg mapping out again if it wants to. No need for importers to do fancy stuff, or attach any importer-visible metadata to dma-bufs. Of course duplicating this code all over the place is a but uncool, so I expect that eventually we'll have a generic exporter implementation, at least for non-swappable buffers. drm/gem is a bit special here ... In general I don't like the idea of arbitrary metadata at all, sounds prone to abuse with crazy lifetime/refcounting rules for the objects involved. Also I think for a lot of your examples (like debugging) it would be much better if we have a standardized piece of metadata so that all drivers/platforms can use the same tooling. And it feels like I'm writing such a mail every few months ... Cheers, Daniel On Mon, Mar 24, 2014 at 7:20 AM, Bin Wang b...@marvell.com wrote: Hi Sumit, On 03/21/2014 07:26 PM, Sumit Semwal wrote: Hi Bin Wang, On 21 March 2014 10:34, Bin Wang b...@marvell.com wrote: we found there'd be varied specific data connected to a dmabuf, like the iommu mapping of buffer, the dma descriptors (that can be shared between several components). Though these info might be able to be generated every time before dma operations, for performance sake, it's better to be kept before really invalid. Thanks for your patch! I think we'd need to have more specific details on what does 'meta data' mean here; more specific comments inline. Change-Id: I89d43dc3fe1ee3da91c42074da5df71b968e6d3c Signed-off-by: Bin Wang b...@marvell.com --- drivers/base/dma-buf.c | 100 +++ include/linux/dma-buf.h | 22 ++ 2 files changed, 122 insertions(+), 0 deletions(-) diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index 08fe897..5c82e60 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c @@ -50,6 +50,7 @@ static int dma_buf_release(struct inode *inode, struct file *file) BUG_ON(dmabuf-vmapping_counter); + dma_buf_meta_release(dmabuf); dmabuf-ops-release(dmabuf); mutex_lock(db_list.lock); @@ -138,6 +139,7 @@ struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, mutex_init(dmabuf-lock); INIT_LIST_HEAD(dmabuf-attachments); + INIT_LIST_HEAD(dmabuf-metas); I am not sure I understand the relationship of 'meta data' with 'dma-buf', or 'attachments' - do you mean to have a list of some meta-data that is unrelated to the attachments to the dma-buf? I think it'd help to explain whether meta-data is specific to each dma-buf, and there's a list of them, or this meta-data is related to each importer device attachment? If it's related to each importer, it should really be added as part of the dma_buf_attachment, and not separately. The meta-data here can be any kind of data related to the dmabuf, , it's specific for each dmabuf. For example, we have iommu for a VPU device, VPU driver has to map the dmabuf to get an IOVA address before it can access the buffer. This dmabuf would be reused many times during the video playback, for performance concern we don't want this dmabuf be map/unmaped by iommu driver every time of VPU HW data transfer, since the physical pages not changed and iommu IOVA plenty. Another example, in our SoC, device A and device B use the same dma chain format, and these drivers share dmabuf between each other, thus the dma chain array doesn't need to be generated every timer for each device. So here, with the help from the meta-data, only the first time we need to generate the meta-data from scratch, and later we can just reuse it until the buffer freed. The meta-data is related to the importer, or importers. However, the dma_buf_attachment is per devices, holding
Re: DTV-Scan-tables tarballs not generated properly
On 03/23/2014 03:58 PM, Mauro Carvalho Chehab wrote: Em Sun, 23 Mar 2014 11:14:13 +0100 Olliver Schinagl oliver+l...@schinagl.nl escreveu: Hey Mauro, Hope everything is well. People have noticed that the tarballs for the dtv-scan-tables aren't being generated properly. The 'LATEST' appears to be correct, but there is only one dated one, no new ones. If you have a few minutes, can you see what's going on? Fixed. Basically, the logic that were getting the date were after the command that was moving to the repository. So, it was returning an empty date. So, the file was always named as: dtv-scan-tables-.tar.gz As dtv-scan-tables-LATEST.tar.gz is actually a link to the produced file, it was working. Now, it was properly generated, based on git last commit: dtv-scan-tables-2014-03-09-177b522.tar.bz2 The name there matches the latest changeset: http://git.linuxtv.org/dtv-scan-tables.git/commit/177b522e4c815d034cfda5d1a084ad074bc373b6 As usual, the produced files are at: http://linuxtv.org/downloads/dtv-scan-tables/ Please check it again the day after you add some new commit(s) there, for us to be sure that everything is working ok. Ah, you should never rebase the tree, as otherwise the script may fail. But will 'work' again a commit later? Just wondering how badly it would break ;) Secondly, I guess we are way past the year marker, how do you feel the dtv-scan-tables are handled? I hope it is all satisfactory still? Yes. I would add a few things on a TODO list: 1) Work with major distros for them to have a package for dtv-scan-tables; I know that debian and fedora allready package them. So that's a good thing, I'll see what I can do with regards to other major distro's (gentoo, arch come to mind) 2) Convert the files to the libdvbv5 format. On libdvbv5 format, all properties of a DVB channel/transponder are properly represented, as it uses the same definitions as found at DVBv5 API. I dunno if you are aware, but the current format is not compatible with some standards (like ISDB-T). Ok, there are tables there for ISDB-T, but that relies on the frontend to be able to auto-discover the properties, because the only thing that it is right there is the channel frequency. Even for DVB-T2/S2, there's a new property that is needed to tune a channel with is not represented with the current format (DTV_STREAM_ID). Thankfully, afaikt, there aren't many broadcasters using it. Of course, in order to preserve backward compat, we should still have the same format at /usr/share/dvb. So, my suggestion is to convert the files there to libdvbv5, and store them at /usr/share/dvbv5. Then, add a Makefile that will use dvb-format-convert to generate the current contents, and store them at /usr/share/dvb. I'll put this on my todo list for this year. Thanks Mauro! Olliver Regards, 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
EM2860 + SAA7113 + STAC9752 no have sound
Hi! I have the EasyCap device with EM2860 + SAA7113 + STAC9752 chips. Video from composite and from S-Video operate great. But I not have the sound. I do not see any errors in my logs. I tried VLC and gstreamer for open alsa device with any rates and options. I work on Ubuntu 12.04 and tried 3.2, 3.11 and 3.13 kernels. Mar 24 13:47:38 ip4tv-st2 kernel: [ 1125.942116] usb 3-2: new high-speed USB device number 4 using xhci_hcd Mar 24 13:47:38 ip4tv-st2 kernel: [ 1125.958937] em28xx: New device @ 480 Mbps (eb1a:2861, interface 0, class 0) Mar 24 13:47:38 ip4tv-st2 kernel: [ 1125.958984] em28xx #0: chip ID is em2860 Mar 24 13:47:38 ip4tv-st2 mtp-probe: checking bus 3, device 4: /sys/devices/pci:00/:00:14.0/usb3/3-2 Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.050300] em28xx #0: board has no eeprom Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.117043] em28xx #0: found i2c device @ 0x4a [saa7113h] Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132110] em28xx #0: Your board has no unique USB ID. Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132117] em28xx #0: A hint were successfully done, based on i2c devicelist hash. Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132120] em28xx #0: This method is not 100% failproof. Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132123] em28xx #0: If the board were missdetected, please email this log to: Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132126] em28xx #0: V4L Mailing List linux-media@vger.kernel.org Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132129] em28xx #0: Board detected as EM2860/SAA711X Reference Design Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.209810] em28xx #0: Identified as EM2860/SAA711X Reference Design (card=19) Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.209816] em28xx #0: Registering snapshot button... Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.209934] input: em28xx snapshot button as /devices/pci:00/:00:14.0/usb3/3-2/input/input13 Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.569889] em28xx #0: Config register raw data: 0x10 Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.593471] em28xx #0: AC97 vendor ID = 0x83847652 Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.605474] em28xx #0: AC97 features = 0x6a90 Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.605480] em28xx #0: Sigmatel audio processor detected(stac 9752) Mar 24 13:47:39 ip4tv-st2 kernel: [ 1127.016889] em28xx #0: v4l2 driver version 0.1.3 Mar 24 13:47:40 ip4tv-st2 mtp-probe: bus: 3, device: 4 was not an MTP device Mar 24 13:47:40 ip4tv-st2 kernel: [ 1127.944248] em28xx #0: V4L2 video device registered as video1 Mar 24 13:47:40 ip4tv-st2 kernel: [ 1127.944256] em28xx #0: V4L2 VBI device registered as vbi0 Mar 24 13:47:40 ip4tv-st2 kernel: [ 1127.944377] em28xx audio device (eb1a:2861): interface 1, class 1 0 [PCH]: HDA-Intel - HDA Intel PCH HDA Intel PCH at 0xf7e1 irq 45 1 [U0xeb1a0x2861 ]: USB-Audio - USB Device 0xeb1a:0x2861 USB Device 0xeb1a:0x2861 at usb-:00:14.0-2, high speed 1:: sequencer 2: [ 1- 0]: digital audio capture 3: [ 1] : control 4: [ 0- 3]: digital audio playback 5: [ 0- 0]: digital audio playback 6: [ 0- 0]: digital audio capture 7: [ 0- 3]: hardware dependent 8: [ 0- 0]: hardware dependent 9: [ 0] : control 33:: timer /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M |__ Port 1: Dev 2, If 0, Class=HID, Driver=usbhid, 1.5M |__ Port 2: Dev 4, If 0, Class=vend., Driver=em28xx, 480M |__ Port 2: Dev 4, If 1, Class=audio, Driver=snd-usb-audio, 480M |__ Port 2: Dev 4, If 2, Class=audio, Driver=snd-usb-audio, 480M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M |__ Port 1: Dev 3, If 0, Class='bInterfaceClass 0xe0 not yet handled', Driver=btusb, 12M |__ Port 1: Dev 3, If 1, Class='bInterfaceClass 0xe0 not yet handled', Driver=btusb, 12M |__ Port 3: Dev 4, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M |__ Port 3: Dev 4, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation
Re: DTV-Scan-tables tarballs not generated properly
Em Mon, 24 Mar 2014 10:21:46 +0100 Olliver Schinagl oliver+l...@schinagl.nl escreveu: On 03/23/2014 03:58 PM, Mauro Carvalho Chehab wrote: Em Sun, 23 Mar 2014 11:14:13 +0100 Olliver Schinagl oliver+l...@schinagl.nl escreveu: Hey Mauro, Hope everything is well. People have noticed that the tarballs for the dtv-scan-tables aren't being generated properly. The 'LATEST' appears to be correct, but there is only one dated one, no new ones. If you have a few minutes, can you see what's going on? Fixed. Basically, the logic that were getting the date were after the command that was moving to the repository. So, it was returning an empty date. So, the file was always named as: dtv-scan-tables-.tar.gz As dtv-scan-tables-LATEST.tar.gz is actually a link to the produced file, it was working. Now, it was properly generated, based on git last commit: dtv-scan-tables-2014-03-09-177b522.tar.bz2 The name there matches the latest changeset: http://git.linuxtv.org/dtv-scan-tables.git/commit/177b522e4c815d034cfda5d1a084ad074bc373b6 As usual, the produced files are at: http://linuxtv.org/downloads/dtv-scan-tables/ Please check it again the day after you add some new commit(s) there, for us to be sure that everything is working ok. Ah, you should never rebase the tree, as otherwise the script may fail. But will 'work' again a commit later? Just wondering how badly it would break ;) I hope not ;) The script is simple, but every time it created a file where via a manual call, and not via crontab. So, it would be good to follow what the script is doing on the next few commits. Btw, please never rebase. The script is not prepared for git rebases, as it uses git pull to update the history of the temp repository it uses to generate the tarball. Secondly, I guess we are way past the year marker, how do you feel the dtv-scan-tables are handled? I hope it is all satisfactory still? Yes. I would add a few things on a TODO list: 1) Work with major distros for them to have a package for dtv-scan-tables; I know that debian and fedora allready package them. Yeah, yesterday I requested grant to commit on Fedora. I also generated a new build for Fedora 20 (and next) repo with the latest tarball. Btw, for those using Fedora, it would be great if you could test it and provide a feedback: https://admin.fedoraproject.org/updates/dtv-scan-tables-0-5.20140309git177b522.fc20 Positive feedbacks will increase package Karma, and speedup the merge upstream. So that's a good thing, I'll see what I can do with regards to other major distro's (gentoo, arch come to mind) Yeah, adding it at Gentoo would be good. 2) Convert the files to the libdvbv5 format. On libdvbv5 format, all properties of a DVB channel/transponder are properly represented, as it uses the same definitions as found at DVBv5 API. I dunno if you are aware, but the current format is not compatible with some standards (like ISDB-T). Ok, there are tables there for ISDB-T, but that relies on the frontend to be able to auto-discover the properties, because the only thing that it is right there is the channel frequency. Even for DVB-T2/S2, there's a new property that is needed to tune a channel with is not represented with the current format (DTV_STREAM_ID). Thankfully, afaikt, there aren't many broadcasters using it. Of course, in order to preserve backward compat, we should still have the same format at /usr/share/dvb. So, my suggestion is to convert the files there to libdvbv5, and store them at /usr/share/dvbv5. Then, add a Makefile that will use dvb-format-convert to generate the current contents, and store them at /usr/share/dvb. I'll put this on my todo list for this year. Thanks! Mauro Thanks Mauro! Olliver Regards, 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 -- Regards, 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
[PATCH] next-20140324 drivers/staging/media/sn9c102/sn9c102_hv7131r.c fix style warnings flagged by checkpatch.pl.
Signed-off-by: Mike Sampson m...@sambodata.com --- drivers/staging/media/sn9c102/sn9c102_hv7131r.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/sn9c102/sn9c102_hv7131r.c b/drivers/staging/media/sn9c102/sn9c102_hv7131r.c index 26a9111..51b24e0 100644 --- a/drivers/staging/media/sn9c102/sn9c102_hv7131r.c +++ b/drivers/staging/media/sn9c102/sn9c102_hv7131r.c @@ -23,7 +23,7 @@ #include sn9c102_devtable.h -static int hv7131r_init(struct sn9c102_device* cam) +static int hv7131r_init(struct sn9c102_device *cam) { int err = 0; @@ -137,8 +137,8 @@ static int hv7131r_init(struct sn9c102_device* cam) } -static int hv7131r_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int hv7131r_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { switch (ctrl-id) { case V4L2_CID_GAIN: @@ -176,8 +176,8 @@ static int hv7131r_get_ctrl(struct sn9c102_device* cam, } -static int hv7131r_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int hv7131r_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -197,6 +197,7 @@ static int hv7131r_set_ctrl(struct sn9c102_device* cam, case V4L2_CID_BLACK_LEVEL: { int r = sn9c102_i2c_read(cam, 0x01); + if (r 0) return -EIO; err += sn9c102_i2c_write(cam, 0x01, @@ -211,10 +212,10 @@ static int hv7131r_set_ctrl(struct sn9c102_device* cam, } -static int hv7131r_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int hv7131r_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect-left - s-cropcap.bounds.left) + 1, v_start = (u8)(rect-top - s-cropcap.bounds.top) + 1; @@ -226,8 +227,8 @@ static int hv7131r_set_crop(struct sn9c102_device* cam, } -static int hv7131r_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int hv7131r_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -347,7 +348,7 @@ static const struct sn9c102_sensor hv7131r = { }; -int sn9c102_probe_hv7131r(struct sn9c102_device* cam) +int sn9c102_probe_hv7131r(struct sn9c102_device *cam) { int devid, err; -- 1.7.10.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
[PATCH] saa7134: automatic norm detection
saa7134: automatic norm detection switched on saa7134: vidioc_querystd added saa7134: notification about TV norm changes via V4L2 event interface added videodev2: new event type added Signed-off-by: Mikhail Domrachev mihail.domryc...@comexp.ru --- drivers/media/pci/saa7134/saa7134-empress.c | 1 + drivers/media/pci/saa7134/saa7134-reg.h | 7 + drivers/media/pci/saa7134/saa7134-tvaudio.c | 56 +++--- drivers/media/pci/saa7134/saa7134-video.c | 274 ++-- drivers/media/pci/saa7134/saa7134.h | 14 +- include/uapi/linux/videodev2.h | 2 + 6 files changed, 311 insertions(+), 43 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index 0a9047e..a150deb 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c @@ -262,6 +262,7 @@ static const struct v4l2_ioctl_ops ts_ioctl_ops = { .vidioc_s_input = saa7134_s_input, .vidioc_s_std = saa7134_s_std, .vidioc_g_std = saa7134_g_std, + .vidioc_querystd= saa7134_querystd, .vidioc_log_status = v4l2_ctrl_log_status, .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, .vidioc_unsubscribe_event = v4l2_event_unsubscribe, diff --git a/drivers/media/pci/saa7134/saa7134-reg.h b/drivers/media/pci/saa7134/saa7134-reg.h index e7e0af1..d3be05c 100644 --- a/drivers/media/pci/saa7134/saa7134-reg.h +++ b/drivers/media/pci/saa7134/saa7134-reg.h @@ -369,6 +369,13 @@ #define SAA7135_DSP_RWCLEAR_RERR 1 #define SAA7133_I2S_AUDIO_CONTROL 0x591 + +#define SAA7134_STDDETECT_AUFD (1 7) +#define SAA7134_STDDETECT_FCTC (1 2) +#define SAA7134_STDDETECT_LDEL (1 5) +#define SAA7134_STDDETECT_AUTO0 (1 1) +#define SAA7134_STDDETECT_AUTO1 (1 2) + /* -- */ /* * Local variables: diff --git a/drivers/media/pci/saa7134/saa7134-tvaudio.c b/drivers/media/pci/saa7134/saa7134-tvaudio.c index 0f34e09..6380e49 100644 --- a/drivers/media/pci/saa7134/saa7134-tvaudio.c +++ b/drivers/media/pci/saa7134/saa7134-tvaudio.c @@ -315,7 +315,7 @@ static void tvaudio_setmode(struct saa7134_dev *dev, static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) { - if (dev-thread.scan1 == dev-thread.scan2 + if (dev-audio_thread.scan1 == dev-audio_thread.scan2 !kthread_should_stop()) { if (timeout 0) { set_current_state(TASK_INTERRUPTIBLE); @@ -325,7 +325,7 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) (msecs_to_jiffies(timeout)); } } - return dev-thread.scan1 != dev-thread.scan2; + return dev-audio_thread.scan1 != dev-audio_thread.scan2; } static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan) @@ -488,8 +488,8 @@ static int tvaudio_thread(void *data) restart: try_to_freeze(); - dev-thread.scan1 = dev-thread.scan2; - dprintk(tvaudio thread scan start [%d]\n,dev-thread.scan1); + dev-audio_thread.scan1 = dev-audio_thread.scan2; + dprintk(tvaudio thread scan start [%d]\n,dev-audio_thread.scan1); dev-tvaudio = NULL; saa_writeb(SAA7134_MONITOR_SELECT, 0xa0); @@ -528,7 +528,7 @@ static int tvaudio_thread(void *data) tvaudio_setmode(dev,tvaudio[0],NULL); for (i = 0; i ARRAY_SIZE(mainscan); i++) { carr_vals[i] = tvaudio_checkcarrier(dev, mainscan+i); - if (dev-thread.scan1 != dev-thread.scan2) + if (dev-audio_thread.scan1 != dev-audio_thread.scan2) goto restart; } for (max1 = 0, max2 = 0, i = 0; i ARRAY_SIZE(mainscan); i++) { @@ -604,11 +604,11 @@ static int tvaudio_thread(void *data) goto restart; if (kthread_should_stop()) break; - if (UNSET == dev-thread.mode) { + if (UNSET == dev-audio_thread.mode) { rx = tvaudio_getstereo(dev, tvaudio[audio]); mode = saa7134_tvaudio_rx2mode(rx); } else { - mode = dev-thread.mode; + mode = dev-audio_thread.mode; } if (lastmode != mode) { tvaudio_setstereo(dev,tvaudio[audio],mode); @@
[PATCH] Documentation: media: Remove double 'struct'
The XML entities for media structures start with the 'struct' word. Remove duplicate 'struct' from the entity users. Reported-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- Documentation/DocBook/media/v4l/io.xml | 2 +- Documentation/DocBook/media/v4l/media-ioc-enum-links.xml | 8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml index 97a69bf..2955d13 100644 --- a/Documentation/DocBook/media/v4l/io.xml +++ b/Documentation/DocBook/media/v4l/io.xml @@ -125,7 +125,7 @@ location of the buffers in device memory can be determined with the structfieldm.offset/structfield and structfieldlength/structfield returned in a v4l2-buffer; are passed as sixth and second parameter to the functionmmap()/function function. When using the multi-planar API, -struct v4l2-buffer; contains an array of v4l2-plane; structures, each +v4l2-buffer; contains an array of v4l2-plane; structures, each containing its own structfieldm.offset/structfield and structfieldlength/structfield. When using the multi-planar API, every plane of every buffer has to be mapped separately, so the number of diff --git a/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml index cf85485..74fb394 100644 --- a/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml +++ b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml @@ -79,13 +79,13 @@ entryEntity id, set by the application./entry /row row - entrystruct media-pad-desc;/entry + entrymedia-pad-desc;/entry entry*structfieldpads/structfield/entry entryPointer to a pads array allocated by the application. Ignored if NULL./entry /row row - entrystruct media-link-desc;/entry + entrymedia-link-desc;/entry entry*structfieldlinks/structfield/entry entryPointer to a links array allocated by the application. Ignored if NULL./entry @@ -153,12 +153,12 @@ cs-str; tbody valign=top row - entrystruct media-pad-desc;/entry + entrymedia-pad-desc;/entry entrystructfieldsource/structfield/entry entryPad at the origin of this link./entry /row row - entrystruct media-pad-desc;/entry + entrymedia-pad-desc;/entry entrystructfieldsink/structfield/entry entryPad at the target of this link./entry /row -- 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: EM2860 + SAA7113 + STAC9752 no have sound
This is operate great if before connect devices I execute: sudo rmmod em28xx_rc sudo rmmod em28xx sudo modprobe em28xx card=2,2,2,2 24.03.2014, 13:54, Evgeny Sagatov saga...@ya.ru: Hi! I have the EasyCap device with EM2860 + SAA7113 + STAC9752 chips. Video from composite and from S-Video operate great. But I not have the sound. I do not see any errors in my logs. I tried VLC and gstreamer for open alsa device with any rates and options. I work on Ubuntu 12.04 and tried 3.2, 3.11 and 3.13 kernels. Mar 24 13:47:38 ip4tv-st2 kernel: [ 1125.942116] usb 3-2: new high-speed USB device number 4 using xhci_hcd Mar 24 13:47:38 ip4tv-st2 kernel: [ 1125.958937] em28xx: New device @ 480 Mbps (eb1a:2861, interface 0, class 0) Mar 24 13:47:38 ip4tv-st2 kernel: [ 1125.958984] em28xx #0: chip ID is em2860 Mar 24 13:47:38 ip4tv-st2 mtp-probe: checking bus 3, device 4: /sys/devices/pci:00/:00:14.0/usb3/3-2 Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.050300] em28xx #0: board has no eeprom Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.117043] em28xx #0: found i2c device @ 0x4a [saa7113h] Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132110] em28xx #0: Your board has no unique USB ID. Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132117] em28xx #0: A hint were successfully done, based on i2c devicelist hash. Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132120] em28xx #0: This method is not 100% failproof. Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132123] em28xx #0: If the board were missdetected, please email this log to: Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132126] em28xx #0: V4L Mailing List linux-media@vger.kernel.org Mar 24 13:47:38 ip4tv-st2 kernel: [ 1126.132129] em28xx #0: Board detected as EM2860/SAA711X Reference Design Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.209810] em28xx #0: Identified as EM2860/SAA711X Reference Design (card=19) Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.209816] em28xx #0: Registering snapshot button... Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.209934] input: em28xx snapshot button as /devices/pci:00/:00:14.0/usb3/3-2/input/input13 Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.569889] em28xx #0: Config register raw data: 0x10 Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.593471] em28xx #0: AC97 vendor ID = 0x83847652 Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.605474] em28xx #0: AC97 features = 0x6a90 Mar 24 13:47:39 ip4tv-st2 kernel: [ 1126.605480] em28xx #0: Sigmatel audio processor detected(stac 9752) Mar 24 13:47:39 ip4tv-st2 kernel: [ 1127.016889] em28xx #0: v4l2 driver version 0.1.3 Mar 24 13:47:40 ip4tv-st2 mtp-probe: bus: 3, device: 4 was not an MTP device Mar 24 13:47:40 ip4tv-st2 kernel: [ 1127.944248] em28xx #0: V4L2 video device registered as video1 Mar 24 13:47:40 ip4tv-st2 kernel: [ 1127.944256] em28xx #0: V4L2 VBI device registered as vbi0 Mar 24 13:47:40 ip4tv-st2 kernel: [ 1127.944377] em28xx audio device (eb1a:2861): interface 1, class 1 0 [PCH ]: HDA-Intel - HDA Intel PCH HDA Intel PCH at 0xf7e1 irq 45 1 [U0xeb1a0x2861 ]: USB-Audio - USB Device 0xeb1a:0x2861 USB Device 0xeb1a:0x2861 at usb-:00:14.0-2, high speed 1: : sequencer 2: [ 1- 0]: digital audio capture 3: [ 1] : control 4: [ 0- 3]: digital audio playback 5: [ 0- 0]: digital audio playback 6: [ 0- 0]: digital audio capture 7: [ 0- 3]: hardware dependent 8: [ 0- 0]: hardware dependent 9: [ 0] : control 33: : timer /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M |__ Port 1: Dev 2, If 0, Class=HID, Driver=usbhid, 1.5M |__ Port 2: Dev 4, If 0, Class=vend., Driver=em28xx, 480M |__ Port 2: Dev 4, If 1, Class=audio, Driver=snd-usb-audio, 480M |__ Port 2: Dev 4, If 2, Class=audio, Driver=snd-usb-audio, 480M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M |__ Port 1: Dev 3, If 0, Class='bInterfaceClass 0xe0 not yet handled', Driver=btusb, 12M |__ Port 1: Dev 3, If 1, Class='bInterfaceClass 0xe0 not yet handled', Driver=btusb, 12M |__ Port 3: Dev 4, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M |__ Port 3: Dev 4, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0024 Intel Corp.
Re: [PATCH] Documentation: media: Remove double 'struct'
On Mon, Mar 24, 2014 at 01:48:13PM +0100, Laurent Pinchart wrote: The XML entities for media structures start with the 'struct' word. Remove duplicate 'struct' from the entity users. Reported-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Sakari Ailus sakari.ai...@linux.intel.com -- Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk -- 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
Fwd: cx23885-dvb.c:undefined reference to `tda18271_attach'
Hi, I'm being blamed for some bugs for more than one year, and this weekend I was able to reproduce the error for the first time. I have the impression that the issue is related to Kconfig because when compiling the Kernel for x86(not x86_64), and when: CONFIG_VIDEO_CX23885=y and CONFIG_MEDIA_TUNER_TDA18271=m the build fails as the tuner code was compiled as a module when it should have been compiled as part of the Kernel. On the Kconfig file drivers/media/pci/cx23885/Kconfig: config VIDEO_CX23885 tristate Conexant cx23885 (2388x successor) support ... select MEDIA_TUNER_TDA18271 if MEDIA_SUBDRV_AUTOSELECT which I think is the problem. Can I just remove this 'if MEDIA_SUBDRV_AUTOSELECT'? Or what is the correct way of telling Kconfig to set CONFIG_MEDIA_TUNER_TDA18271 based on the value of CONFIG_VIDEO_CX23885? There are at least 6 similar cases which I'm willing to send patches. Thank you, Peter -- 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
why frameformat instead pixelformat?
Hello, while reading into the media-api issue I found out that for configuring the entity pads a frameformat is used. For that I found the negotiation rfc of that topic, but I don't really get the relevance of a frameformat. http://www.spinics.net/lists/linux-media/msg10006.html Can anyone explain why the media-api uses the frameformat instead of the pixelformat and what the main differences are? Thanks in advance. Best regards, Tom -- 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] v4l2-pci-skeleton: fix typo while retrieving the skel_buffer
From: Lad, Prabhakar prabhakar.cse...@gmail.com Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com --- Documentation/video4linux/v4l2-pci-skeleton.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/video4linux/v4l2-pci-skeleton.c b/Documentation/video4linux/v4l2-pci-skeleton.c index 3a1c0d2..61a56f4 100644 --- a/Documentation/video4linux/v4l2-pci-skeleton.c +++ b/Documentation/video4linux/v4l2-pci-skeleton.c @@ -87,7 +87,7 @@ struct skel_buffer { static inline struct skel_buffer *to_skel_buffer(struct vb2_buffer *vb2) { - return container_of(vb2, struct skel_buffer, vb); + return container_of(vb2, struct skel_buffer, vb2); } static const struct pci_device_id skeleton_pci_tbl[] = { -- 1.7.9.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
How to build I2C_MUX in media_build as rtl28xxu depends on it ?
After recent changes, I cannot build rtl28xxu on systems with linux 2.6.32 or 3.2.0. rtl28xxu is one of the few drivers depending on I2C_MUX. Kconfig.kern lists I2C_MUX (correctly) as not in the kernel of the system. I don't know if it is possible to load a new module for that. Who can help me with this ? Antti Palosaari wrote: We need depend on I2C_MUX as rtl2832 demod used requires it. All error/warnings: warning: (DVB_USB_RTL28XXU) selects DVB_RTL2832 which has unmet direct dependencies (MEDIA_SUPPORT DVB_CORE I2C I2C_MUX) ERROR: i2c_add_mux_adapter [drivers/media/dvb-frontends/rtl2832.ko] undefined! ERROR: i2c_del_mux_adapter [drivers/media/dvb-frontends/rtl2832.ko] undefined! Reported-by: kbuild test robot fengguang...@intel.com Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/media/usb/dvb-usb-v2/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index bfb7378..037e519 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -126,7 +126,7 @@ config DVB_USB_MXL111SF config DVB_USB_RTL28XXU tristate Realtek RTL28xxU DVB USB support - depends on DVB_USB_V2 + depends on DVB_USB_V2 I2C_MUX select DVB_RTL2830 select DVB_RTL2832 select MEDIA_TUNER_QT1010 if MEDIA_SUBDRV_AUTOSELECT -- Jan Hoogenraad Hoogenraad Interface Services Postbus 2717 3500 GS Utrecht -- 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: randconfig build error with next-20140324, in drivers/media/tuners/e4000.c
Already fixed https://patchwork.linuxtv.org/patch/23115/ On 24.03.2014 20:38, Jim Davis wrote: Building with the attached random configuration file, warning: (DVB_USB_RTL28XXU) selects MEDIA_TUNER_E4000 which has unmet direct dependencies ((MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || MEDIA_RADIO_SUPPORT) MEDIA_SUPPORT I2C VIDEO_V4L2) warning: (BRIDGE_NF_EBTABLES) selects NETFILTER_XTABLES which has unmet direct dependencies (NET INET NETFILTER) warning: (AHCI_XGENE) selects PHY_XGENE which has unmet direct dependencies (HAS_IOMEM OF (ARM64 || COMPILE_TEST)) drivers/built-in.o: In function `e4000_remove': e4000.c:(.text+0x30570f): undefined reference to `v4l2_ctrl_handler_free' drivers/built-in.o: In function `e4000_probe': e4000.c:(.text+0x306085): undefined reference to `v4l2_ctrl_handler_init_class' e4000.c:(.text+0x3060ae): undefined reference to `v4l2_ctrl_new_std' e4000.c:(.text+0x3060e1): undefined reference to `v4l2_ctrl_new_std' e4000.c:(.text+0x3060fd): undefined reference to `v4l2_ctrl_auto_cluster' e4000.c:(.text+0x306126): undefined reference to `v4l2_ctrl_new_std' e4000.c:(.text+0x306156): undefined reference to `v4l2_ctrl_new_std' e4000.c:(.text+0x306172): undefined reference to `v4l2_ctrl_auto_cluster' e4000.c:(.text+0x30619b): undefined reference to `v4l2_ctrl_new_std' e4000.c:(.text+0x3061cb): undefined reference to `v4l2_ctrl_new_std' e4000.c:(.text+0x3061e7): undefined reference to `v4l2_ctrl_auto_cluster' e4000.c:(.text+0x306210): undefined reference to `v4l2_ctrl_new_std' e4000.c:(.text+0x306240): undefined reference to `v4l2_ctrl_new_std' e4000.c:(.text+0x30625c): undefined reference to `v4l2_ctrl_auto_cluster' e4000.c:(.text+0x306285): undefined reference to `v4l2_ctrl_new_std' e4000.c:(.text+0x3062a0): undefined reference to `v4l2_ctrl_handler_free' make: *** [vmlinux] Error 1 -- http://palosaari.fi/ -- 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 4/5] em28xx: remove function em28xx_compression_disable() and its call
Am 22.03.2014 14:01, schrieb Frank Schäfer: em28xx_compression_disable() is a single line function which is called only one time and this call also isn't needed. Register 0x26 is always configured as part of the scaler configuration, which in turn is always done when the resolution changes. And the initial resolution setting is applied at first device open. Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 1 - drivers/media/usb/em28xx/em28xx.h | 6 -- 2 files changed, 7 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 0856e5d..e15ac75 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -2376,7 +2376,6 @@ static int em28xx_v4l2_init(struct em28xx *dev) (EM28XX_XCLK_AUDIO_UNMUTE | val)); em28xx_set_outfmt(dev); - em28xx_compression_disable(dev); /* Add image controls */ /* NOTE: at this point, the subdevices are already registered, so bridge diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index e95f4eb..dd6190c 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -793,12 +793,6 @@ int em28xx_init_camera(struct em28xx *dev); printk(KERN_WARNING %s: fmt,\ dev-name , ##arg); } while (0) -static inline int em28xx_compression_disable(struct em28xx *dev) -{ - /* side effect of disabling scaler and mixer */ - return em28xx_write_reg(dev, EM28XX_R26_COMPR, 0x00); -} - /*FIXME: maxw should be dependent of alt mode */ static inline unsigned int norm_maxw(struct em28xx *dev) { Please disregard this patch, I will send an updated version in a minute. -- 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 v2 4/5] em28xx: remove function em28xx_compression_disable() and its call
em28xx_compression_disable() is a single line function which is called only one time and this call also isn't needed. Register 0x26 is always configured as part of the scaler configuration, which in turn is always done when the resolution changes. And the initial resolution setting is applied at first device open. Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 5 ++--- drivers/media/usb/em28xx/em28xx.h | 6 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 0856e5d..a2133d5 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -274,7 +274,7 @@ static void em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) { - u8 mode; + u8 mode = 0x00; /* the em2800 scaler only supports scaling down to 50% */ if (dev-board.is_em2800) { @@ -293,7 +293,7 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) to work correctly */ mode = (h || v) ? 0x30 : 0x00; } - return em28xx_write_reg_bits(dev, EM28XX_R26_COMPR, mode, 0x30); + return em28xx_write_reg(dev, EM28XX_R26_COMPR, mode); } /* FIXME: this only function read values from dev */ @@ -2376,7 +2376,6 @@ static int em28xx_v4l2_init(struct em28xx *dev) (EM28XX_XCLK_AUDIO_UNMUTE | val)); em28xx_set_outfmt(dev); - em28xx_compression_disable(dev); /* Add image controls */ /* NOTE: at this point, the subdevices are already registered, so bridge diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index e95f4eb..dd6190c 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -793,12 +793,6 @@ int em28xx_init_camera(struct em28xx *dev); printk(KERN_WARNING %s: fmt,\ dev-name , ##arg); } while (0) -static inline int em28xx_compression_disable(struct em28xx *dev) -{ - /* side effect of disabling scaler and mixer */ - return em28xx_write_reg(dev, EM28XX_R26_COMPR, 0x00); -} - /*FIXME: maxw should be dependent of alt mode */ static inline unsigned int norm_maxw(struct em28xx *dev) { -- 1.8.4.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
Re: How to build I2C_MUX in media_build as rtl28xxu depends on it ?
On 24.03.2014 20:08, Jan Hoogenraad wrote: After recent changes, I cannot build rtl28xxu on systems with linux 2.6.32 or 3.2.0. rtl28xxu is one of the few drivers depending on I2C_MUX. Kconfig.kern lists I2C_MUX (correctly) as not in the kernel of the system. I don't know if it is possible to load a new module for that. Who can help me with this ? I think the correct way is to add that I2C_MUX to media-build backport. regards Antti -- http://palosaari.fi/ -- 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 00/19] em28xx: clean up the main device struct and move sub-module specific data to its own data structs
This patch series cleans up the main device struct of the em28xx driver. Most of the patches (patches 3-16) are about moving the em28xx-v4l specific data to it's own dynamically allocated data structure. Patch 19 moves two em28xx-alsa specific fields to the em28xx_audio struct. Patches 17 and 18 remove two fields which aren't needed. Frank Schäfer (19): em28xx: move sub-module data structs to a common place in the main struct em28xx-video: simplify usage of the pointer to struct v4l2_ctrl_handler in em28xx_v4l2_init() em28xx: start moving em28xx-v4l specific data to its own struct em28xx: move struct v4l2_ctrl_handler ctrl_handler from struct em28xx to struct v4l2 em28xx: move struct v4l2_clk *clk from struct em28xx to struct v4l2 em28xx: move video_device structs from struct em28xx to struct v4l2 em28xx: move videobuf2 related data from struct em28xx to struct v4l2 em28xx: move v4l2 frame resolutions and scale data from struct em28xx to struct v4l2 em28xx: move vinmode and vinctrl data from struct em28xx to struct v4l2 em28xx: move TV norm from struct em28xx to struct v4l2 em28xx: move struct em28xx_fmt *format from struct em28xx to struct v4l2 em28xx: move progressive/interlaced fields from struct em28xx to struct v4l2 em28xx: move sensor parameter fields from struct em28xx to struct v4l2 em28xx: move capture state tracking fields from struct em28xx to struct v4l2 em28xx: move v4l2 user counting fields from struct em28xx to struct v4l2 em28xx: move tuner frequency field from struct em28xx to struct v4l2 em28xx: remove field tda9887_conf from struct em28xx em28xx: remove field tuner_addr from struct em28xx em28xx: move fields wq_trigger and streaming_started from struct em28xx to struct em28xx_audio drivers/media/usb/em28xx/em28xx-audio.c | 39 +- drivers/media/usb/em28xx/em28xx-camera.c | 51 +-- drivers/media/usb/em28xx/em28xx-cards.c | 9 - drivers/media/usb/em28xx/em28xx-vbi.c| 10 +- drivers/media/usb/em28xx/em28xx-video.c | 592 +-- drivers/media/usb/em28xx/em28xx.h| 120 --- 6 files changed, 452 insertions(+), 369 deletions(-) -- 1.8.4.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 02/19] em28xx-video: simplify usage of the pointer to struct v4l2_ctrl_handler in em28xx_v4l2_init()
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 9df1826..45ad471 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -2403,35 +2403,35 @@ static int em28xx_v4l2_init(struct em28xx *dev) /* Add image controls */ /* NOTE: at this point, the subdevices are already registered, so bridge * controls are only added/enabled when no subdevice provides them */ - if (NULL == v4l2_ctrl_find(dev-ctrl_handler, V4L2_CID_CONTRAST)) - v4l2_ctrl_new_std(dev-ctrl_handler, em28xx_ctrl_ops, + if (NULL == v4l2_ctrl_find(hdl, V4L2_CID_CONTRAST)) + v4l2_ctrl_new_std(hdl, em28xx_ctrl_ops, V4L2_CID_CONTRAST, 0, 0x1f, 1, CONTRAST_DEFAULT); - if (NULL == v4l2_ctrl_find(dev-ctrl_handler, V4L2_CID_BRIGHTNESS)) - v4l2_ctrl_new_std(dev-ctrl_handler, em28xx_ctrl_ops, + if (NULL == v4l2_ctrl_find(hdl, V4L2_CID_BRIGHTNESS)) + v4l2_ctrl_new_std(hdl, em28xx_ctrl_ops, V4L2_CID_BRIGHTNESS, -0x80, 0x7f, 1, BRIGHTNESS_DEFAULT); - if (NULL == v4l2_ctrl_find(dev-ctrl_handler, V4L2_CID_SATURATION)) - v4l2_ctrl_new_std(dev-ctrl_handler, em28xx_ctrl_ops, + if (NULL == v4l2_ctrl_find(hdl, V4L2_CID_SATURATION)) + v4l2_ctrl_new_std(hdl, em28xx_ctrl_ops, V4L2_CID_SATURATION, 0, 0x1f, 1, SATURATION_DEFAULT); - if (NULL == v4l2_ctrl_find(dev-ctrl_handler, V4L2_CID_BLUE_BALANCE)) - v4l2_ctrl_new_std(dev-ctrl_handler, em28xx_ctrl_ops, + if (NULL == v4l2_ctrl_find(hdl, V4L2_CID_BLUE_BALANCE)) + v4l2_ctrl_new_std(hdl, em28xx_ctrl_ops, V4L2_CID_BLUE_BALANCE, -0x30, 0x30, 1, BLUE_BALANCE_DEFAULT); - if (NULL == v4l2_ctrl_find(dev-ctrl_handler, V4L2_CID_RED_BALANCE)) - v4l2_ctrl_new_std(dev-ctrl_handler, em28xx_ctrl_ops, + if (NULL == v4l2_ctrl_find(hdl, V4L2_CID_RED_BALANCE)) + v4l2_ctrl_new_std(hdl, em28xx_ctrl_ops, V4L2_CID_RED_BALANCE, -0x30, 0x30, 1, RED_BALANCE_DEFAULT); - if (NULL == v4l2_ctrl_find(dev-ctrl_handler, V4L2_CID_SHARPNESS)) - v4l2_ctrl_new_std(dev-ctrl_handler, em28xx_ctrl_ops, + if (NULL == v4l2_ctrl_find(hdl, V4L2_CID_SHARPNESS)) + v4l2_ctrl_new_std(hdl, em28xx_ctrl_ops, V4L2_CID_SHARPNESS, 0, 0x0f, 1, SHARPNESS_DEFAULT); /* Reset image controls */ em28xx_colorlevels_set_default(dev); - v4l2_ctrl_handler_setup(dev-ctrl_handler); - ret = dev-ctrl_handler.error; + v4l2_ctrl_handler_setup(hdl); + ret = hdl-error; if (ret) goto unregister_dev; -- 1.8.4.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 01/19] em28xx: move sub-module data structs to a common place in the main struct
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx.h | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 4beb1fa..9a3c496 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -541,6 +541,11 @@ struct em28xx_i2c_bus { struct em28xx { struct kref ref; + /* Sub-module data */ + struct em28xx_dvb *dvb; + struct em28xx_audio adev; + struct em28xx_IR *ir; + /* generic device properties */ char name[30]; /* name (including minor) of the device */ int model; /* index in the device_data struct */ @@ -576,8 +581,6 @@ struct em28xx { struct em28xx_fmt *format; - struct em28xx_IR *ir; - /* Some older em28xx chips needs a waiting time after writing */ unsigned int wait_after_write; @@ -623,8 +626,6 @@ struct em28xx { unsigned long i2c_hash; /* i2c devicelist hash - for boards with generic ID */ - struct em28xx_audio adev; - /* capture state tracking */ int capture_type; unsigned char top_field:1; @@ -704,8 +705,6 @@ struct em28xx { /* Snapshot button input device */ char snapshot_button_path[30]; /* path of the input dev */ struct input_dev *sbutton_input_dev; - - struct em28xx_dvb *dvb; }; #define kref_to_dev(d) container_of(d, struct em28xx, ref) -- 1.8.4.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 04/19] em28xx: move struct v4l2_ctrl_handler ctrl_handler from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 13 + drivers/media/usb/em28xx/em28xx.h | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 89947db..22acb0f 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1138,7 +1138,9 @@ static void em28xx_ctrl_notify(struct v4l2_ctrl *ctrl, void *priv) static int em28xx_s_ctrl(struct v4l2_ctrl *ctrl) { - struct em28xx *dev = container_of(ctrl-handler, struct em28xx, ctrl_handler); + struct em28xx_v4l2 *v4l2 = + container_of(ctrl-handler, struct em28xx_v4l2, ctrl_handler); + struct em28xx *dev = v4l2-dev; int ret = -EINVAL; switch (ctrl-id) { @@ -1849,6 +1851,7 @@ void em28xx_free_v4l2(struct kref *ref) { struct em28xx_v4l2 *v4l2 = container_of(ref, struct em28xx_v4l2, ref); + v4l2-dev-v4l2 = NULL; kfree(v4l2); } @@ -1968,7 +1971,7 @@ static int em28xx_v4l2_fini(struct em28xx *dev) video_unregister_device(dev-vdev); } - v4l2_ctrl_handler_free(dev-ctrl_handler); + v4l2_ctrl_handler_free(v4l2-ctrl_handler); v4l2_device_unregister(v4l2-v4l2_dev); if (dev-clk) { @@ -2276,7 +2279,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) u8 val; int ret; unsigned int maxw; - struct v4l2_ctrl_handler *hdl = dev-ctrl_handler; + struct v4l2_ctrl_handler *hdl; struct em28xx_v4l2 *v4l2; if (dev-is_audio_only) { @@ -2300,6 +2303,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) return -ENOMEM; } kref_init(v4l2-ref); + v4l2-dev = dev; dev-v4l2 = v4l2; ret = v4l2_device_register(dev-udev-dev, v4l2-v4l2_dev); @@ -2308,6 +2312,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) goto err; } + hdl = v4l2-ctrl_handler; v4l2_ctrl_handler_init(hdl, 8); v4l2-v4l2_dev.ctrl_handler = hdl; @@ -2594,7 +2599,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) return 0; unregister_dev: - v4l2_ctrl_handler_free(dev-ctrl_handler); + v4l2_ctrl_handler_free(v4l2-ctrl_handler); v4l2_device_unregister(v4l2-v4l2_dev); err: dev-v4l2 = NULL; diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index b18b968..910c2d8 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -499,8 +499,10 @@ struct em28xx_eeprom { struct em28xx_v4l2 { struct kref ref; + struct em28xx *dev; struct v4l2_device v4l2_dev; + struct v4l2_ctrl_handler ctrl_handler; }; struct em28xx_audio { @@ -566,7 +568,6 @@ struct em28xx { unsigned int has_alsa_audio:1; unsigned int is_audio_only:1; - struct v4l2_ctrl_handler ctrl_handler; struct v4l2_clk *clk; struct em28xx_board board; -- 1.8.4.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 07/19] em28xx: move videobuf2 related data from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-cards.c | 2 -- drivers/media/usb/em28xx/em28xx-video.c | 15 +-- drivers/media/usb/em28xx/em28xx.h | 12 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index ff19833..a21cce1 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2991,8 +2991,6 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, const char *chip_name = default_chip_name; dev-udev = udev; - mutex_init(dev-vb_queue_lock); - mutex_init(dev-vb_vbi_queue_lock); mutex_init(dev-ctrl_urb_lock); spin_lock_init(dev-slock); diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 7252eef..301acef 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1049,9 +1049,10 @@ static int em28xx_vb2_setup(struct em28xx *dev) { int rc; struct vb2_queue *q; + struct em28xx_v4l2 *v4l2 = dev-v4l2; /* Setup Videobuf2 for Video capture */ - q = dev-vb_vidq; + q = v4l2-vb_vidq; q-type = V4L2_BUF_TYPE_VIDEO_CAPTURE; q-io_modes = VB2_READ | VB2_MMAP | VB2_USERPTR | VB2_DMABUF; q-timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; @@ -1065,7 +1066,7 @@ static int em28xx_vb2_setup(struct em28xx *dev) return rc; /* Setup Videobuf2 for VBI capture */ - q = dev-vb_vbiq; + q = v4l2-vb_vbiq; q-type = V4L2_BUF_TYPE_VBI_CAPTURE; q-io_modes = VB2_READ | VB2_MMAP | VB2_USERPTR; q-timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; @@ -2483,8 +2484,10 @@ static int em28xx_v4l2_init(struct em28xx *dev) ret = -ENODEV; goto unregister_dev; } - v4l2-vdev-queue = dev-vb_vidq; - v4l2-vdev-queue-lock = dev-vb_queue_lock; + mutex_init(v4l2-vb_queue_lock); + mutex_init(v4l2-vb_vbi_queue_lock); + v4l2-vdev-queue = v4l2-vb_vidq; + v4l2-vdev-queue-lock = v4l2-vb_queue_lock; /* disable inapplicable ioctls */ if (dev-board.is_webcam) { @@ -2519,8 +2522,8 @@ static int em28xx_v4l2_init(struct em28xx *dev) v4l2-vbi_dev = em28xx_vdev_init(dev, em28xx_video_template, vbi); - v4l2-vbi_dev-queue = dev-vb_vbiq; - v4l2-vbi_dev-queue-lock = dev-vb_vbi_queue_lock; + v4l2-vbi_dev-queue = v4l2-vb_vbiq; + v4l2-vbi_dev-queue-lock = v4l2-vb_vbi_queue_lock; /* disable inapplicable ioctls */ v4l2_disable_ioctl(v4l2-vdev, VIDIOC_S_PARM); diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 88d0589..b02e8b1 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -508,6 +508,12 @@ struct em28xx_v4l2 { struct video_device *vdev; struct video_device *vbi_dev; struct video_device *radio_dev; + + /* Videobuf2 */ + struct vb2_queue vb_vidq; + struct vb2_queue vb_vbiq; + struct mutex vb_queue_lock; + struct mutex vb_vbi_queue_lock; }; struct em28xx_audio { @@ -649,12 +655,6 @@ struct em28xx { struct mutex lock; struct mutex ctrl_urb_lock; /* protects urb_buf */ - /* Videobuf2 */ - struct vb2_queue vb_vidq; - struct vb2_queue vb_vbiq; - struct mutex vb_queue_lock; - struct mutex vb_vbi_queue_lock; - /* resources in use */ unsigned int resources; -- 1.8.4.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 06/19] em28xx: move video_device structs from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 120 ++-- drivers/media/usb/em28xx/em28xx.h | 7 +- 2 files changed, 56 insertions(+), 71 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 4fb0053..7252eef 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1447,7 +1447,7 @@ static int vidioc_enum_input(struct file *file, void *priv, (EM28XX_VMUX_CABLE == INPUT(n)-type)) i-type = V4L2_INPUT_TYPE_TUNER; - i-std = dev-vdev-tvnorms; + i-std = dev-v4l2-vdev-tvnorms; /* webcams do not have the STD API */ if (dev-board.is_webcam) i-capabilities = 0; @@ -1691,9 +1691,10 @@ static int vidioc_s_register(struct file *file, void *priv, static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct video_device *vdev = video_devdata(file); - struct em28xx_fh *fh = priv; - struct em28xx *dev = fh-dev; + struct video_device *vdev = video_devdata(file); + struct em28xx_fh *fh = priv; + struct em28xx *dev = fh-dev; + struct em28xx_v4l2*v4l2 = dev-v4l2; strlcpy(cap-driver, em28xx, sizeof(cap-driver)); strlcpy(cap-card, em28xx_boards[dev-model].name, sizeof(cap-card)); @@ -1715,9 +1716,9 @@ static int vidioc_querycap(struct file *file, void *priv, cap-capabilities = cap-device_caps | V4L2_CAP_DEVICE_CAPS | V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; - if (dev-vbi_dev) + if (v4l2-vbi_dev) cap-capabilities |= V4L2_CAP_VBI_CAPTURE; - if (dev-radio_dev) + if (v4l2-radio_dev) cap-capabilities |= V4L2_CAP_RADIO; return 0; } @@ -1955,20 +1956,20 @@ static int em28xx_v4l2_fini(struct em28xx *dev) em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE); - if (dev-radio_dev) { + if (v4l2-radio_dev) { em28xx_info(V4L2 device %s deregistered\n, - video_device_node_name(dev-radio_dev)); - video_unregister_device(dev-radio_dev); + video_device_node_name(v4l2-radio_dev)); + video_unregister_device(v4l2-radio_dev); } - if (dev-vbi_dev) { + if (v4l2-vbi_dev) { em28xx_info(V4L2 device %s deregistered\n, - video_device_node_name(dev-vbi_dev)); - video_unregister_device(dev-vbi_dev); + video_device_node_name(v4l2-vbi_dev)); + video_unregister_device(v4l2-vbi_dev); } - if (dev-vdev) { + if (v4l2-vdev) { em28xx_info(V4L2 device %s deregistered\n, - video_device_node_name(dev-vdev)); - video_unregister_device(dev-vdev); + video_device_node_name(v4l2-vdev)); + video_unregister_device(v4l2-vdev); } v4l2_ctrl_handler_free(v4l2-ctrl_handler); @@ -2061,23 +2062,6 @@ exit: return 0; } -/* - * em28xx_videodevice_release() - * called when the last user of the video device exits and frees the memeory - */ -static void em28xx_videodevice_release(struct video_device *vdev) -{ - struct em28xx *dev = video_get_drvdata(vdev); - - video_device_release(vdev); - if (vdev == dev-vdev) - dev-vdev = NULL; - else if (vdev == dev-vbi_dev) - dev-vbi_dev = NULL; - else if (vdev == dev-radio_dev) - dev-radio_dev = NULL; -} - static const struct v4l2_file_operations em28xx_v4l_fops = { .owner = THIS_MODULE, .open = em28xx_v4l2_open, @@ -2134,7 +2118,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { static const struct video_device em28xx_video_template = { .fops = em28xx_v4l_fops, .ioctl_ops = video_ioctl_ops, - .release= em28xx_videodevice_release, + .release= video_device_release, .tvnorms= V4L2_STD_ALL, }; @@ -2163,7 +2147,7 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = { static struct video_device em28xx_radio_template = { .fops = radio_fops, .ioctl_ops = radio_ioctl_ops, - .release= em28xx_videodevice_release, + .release= video_device_release, }; /* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */ @@ -2493,36 +2477,36 @@ static int em28xx_v4l2_init(struct em28xx *dev) goto unregister_dev; /* allocate and fill video video_device struct */ - dev-vdev = em28xx_vdev_init(dev, em28xx_video_template, video); - if (!dev-vdev)
[PATCH 15/19] em28xx: move v4l2 user counting fields from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 27 +++ drivers/media/usb/em28xx/em28xx.h | 5 +++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 496dcef..aaab111 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -934,7 +934,7 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count) if (rc) return rc; - if (dev-streaming_users == 0) { + if (v4l2-streaming_users == 0) { /* First active streaming user, so allocate all the URBs */ /* Allocate the USB bandwidth */ @@ -972,7 +972,7 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count) 0, tuner, s_frequency, f); } - dev-streaming_users++; + v4l2-streaming_users++; return rc; } @@ -980,6 +980,7 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count) static int em28xx_stop_streaming(struct vb2_queue *vq) { struct em28xx *dev = vb2_get_drv_priv(vq); + struct em28xx_v4l2 *v4l2 = dev-v4l2; struct em28xx_dmaqueue *vidq = dev-vidq; unsigned long flags = 0; @@ -987,7 +988,7 @@ static int em28xx_stop_streaming(struct vb2_queue *vq) res_free(dev, vq-type); - if (dev-streaming_users-- == 1) { + if (v4l2-streaming_users-- == 1) { /* Last active user, so shutdown all the URBS */ em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE); } @@ -1008,6 +1009,7 @@ static int em28xx_stop_streaming(struct vb2_queue *vq) int em28xx_stop_vbi_streaming(struct vb2_queue *vq) { struct em28xx *dev = vb2_get_drv_priv(vq); + struct em28xx_v4l2 *v4l2 = dev-v4l2; struct em28xx_dmaqueue *vbiq = dev-vbiq; unsigned long flags = 0; @@ -1015,7 +1017,7 @@ int em28xx_stop_vbi_streaming(struct vb2_queue *vq) res_free(dev, vq-type); - if (dev-streaming_users-- == 1) { + if (v4l2-streaming_users-- == 1) { /* Last active user, so shutdown all the URBS */ em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE); } @@ -1344,8 +1346,9 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct em28xx *dev = video_drvdata(file); + struct em28xx_v4l2 *v4l2 = dev-v4l2; - if (dev-streaming_users 0) + if (v4l2-streaming_users 0) return -EBUSY; vidioc_try_fmt_vid_cap(file, priv, f); @@ -1384,7 +1387,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) if (norm == v4l2-norm) return 0; - if (dev-streaming_users 0) + if (v4l2-streaming_users 0) return -EBUSY; v4l2-norm = norm; @@ -1907,7 +1910,7 @@ static int em28xx_v4l2_open(struct file *filp) em28xx_videodbg(open dev=%s type=%s users=%d\n, video_device_node_name(vdev), v4l2_type_names[fh_type], - dev-users); + v4l2-users); if (mutex_lock_interruptible(dev-lock)) return -ERESTARTSYS; @@ -1922,7 +1925,7 @@ static int em28xx_v4l2_open(struct file *filp) fh-type = fh_type; filp-private_data = fh; - if (dev-users == 0) { + if (v4l2-users == 0) { em28xx_set_mode(dev, EM28XX_ANALOG_MODE); if (vdev-vfl_type != VFL_TYPE_RADIO) @@ -1942,7 +1945,7 @@ static int em28xx_v4l2_open(struct file *filp) kref_get(dev-ref); kref_get(v4l2-ref); - dev-users++; + v4l2-users++; mutex_unlock(dev-lock); v4l2_fh_add(fh-fh); @@ -2051,12 +2054,12 @@ static int em28xx_v4l2_close(struct file *filp) struct em28xx_v4l2*v4l2 = dev-v4l2; int errCode; - em28xx_videodbg(users=%d\n, dev-users); + em28xx_videodbg(users=%d\n, v4l2-users); vb2_fop_release(filp); mutex_lock(dev-lock); - if (dev-users == 1) { + if (v4l2-users == 1) { /* No sense to try to write to the device */ if (dev-disconnected) goto exit; @@ -2078,8 +2081,8 @@ static int em28xx_v4l2_close(struct file *filp) } exit: + v4l2-users--; kref_put(v4l2-ref, em28xx_free_v4l2); - dev-users--; mutex_unlock(dev-lock); kref_put(dev-ref, em28xx_free_device); diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 91bb624..0585217 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -523,6 +523,9 @@ struct em28xx_v4l2 { int sensor_yres;
[PATCH 12/19] em28xx: move progressive/interlaced fields from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-cards.c | 2 -- drivers/media/usb/em28xx/em28xx-video.c | 27 +-- drivers/media/usb/em28xx/em28xx.h | 10 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index a21cce1..64ea25a 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2682,8 +2682,6 @@ static void em28xx_card_setup(struct em28xx *dev) if (dev-board.is_webcam) { if (em28xx_detect_sensor(dev) 0) dev-board.is_webcam = 0; - else - dev-progressive = 1; } switch (dev-model) { diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index c316147..abb4e8e 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -447,9 +447,10 @@ static void em28xx_copy_video(struct em28xx *dev, unsigned char *usb_buf, unsigned long len) { + struct em28xx_v4l2 *v4l2 = dev-v4l2; void *fieldstart, *startwrite, *startread; int linesdone, currlinedone, offset, lencopy, remain; - int bytesperline = dev-v4l2-width 1; + int bytesperline = v4l2-width 1; if (buf-pos + len buf-length) len = buf-length - buf-pos; @@ -457,7 +458,7 @@ static void em28xx_copy_video(struct em28xx *dev, startread = usb_buf; remain = len; - if (dev-progressive || buf-top_field) + if (v4l2-progressive || buf-top_field) fieldstart = buf-vb_buf; else /* interlaced mode, even nr. of lines */ fieldstart = buf-vb_buf + bytesperline; @@ -465,7 +466,7 @@ static void em28xx_copy_video(struct em28xx *dev, linesdone = buf-pos / bytesperline; currlinedone = buf-pos % bytesperline; - if (dev-progressive) + if (v4l2-progressive) offset = linesdone * bytesperline + currlinedone; else offset = linesdone * bytesperline * 2 + currlinedone; @@ -489,7 +490,7 @@ static void em28xx_copy_video(struct em28xx *dev, remain -= lencopy; while (remain 0) { - if (dev-progressive) + if (v4l2-progressive) startwrite += lencopy; else startwrite += lencopy + bytesperline; @@ -611,7 +612,9 @@ finish_field_prepare_next(struct em28xx *dev, struct em28xx_buffer *buf, struct em28xx_dmaqueue *dma_q) { - if (dev-progressive || dev-top_field) { /* Brand new frame */ + struct em28xx_v4l2 *v4l2 = dev-v4l2; + + if (v4l2-progressive || dev-top_field) { /* Brand new frame */ if (buf != NULL) finish_buffer(dev, buf); buf = get_next_buf(dev, dma_q); @@ -1234,10 +1237,10 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; /* FIXME: TOP? NONE? BOTTOM? ALTENATE? */ - if (dev-progressive) + if (v4l2-progressive) f-fmt.pix.field = V4L2_FIELD_NONE; else - f-fmt.pix.field = dev-interlaced ? + f-fmt.pix.field = v4l2-interlaced_fieldmode ? V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; return 0; } @@ -1258,6 +1261,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, { struct em28xx_fh *fh= priv; struct em28xx *dev = fh-dev; + struct em28xx_v4l2*v4l2 = dev-v4l2; unsigned int width = f-fmt.pix.width; unsigned int height = f-fmt.pix.height; unsigned int maxw = norm_maxw(dev); @@ -1299,10 +1303,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, f-fmt.pix.bytesperline = (width * fmt-depth + 7) 3; f-fmt.pix.sizeimage = f-fmt.pix.bytesperline * height; f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; - if (dev-progressive) + if (v4l2-progressive) f-fmt.pix.field = V4L2_FIELD_NONE; else - f-fmt.pix.field = dev-interlaced ? + f-fmt.pix.field = v4l2-interlaced_fieldmode ? V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; f-fmt.pix.priv = 0; @@ -2316,6 +2320,9 @@ static int em28xx_v4l2_init(struct em28xx *dev) v4l2_ctrl_handler_init(hdl, 8); v4l2-v4l2_dev.ctrl_handler = hdl; + if (dev-board.is_webcam) + v4l2-progressive = 1; + /* * Default format, used for tvp5150 or saa711x output formats */ @@ -2430,7 +2437,7 @@ static
[PATCH 19/19] em28xx: move fields wq_trigger and streaming_started from struct em28xx to struct em28xx_audio
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-audio.c | 39 ++--- drivers/media/usb/em28xx/em28xx.h | 8 +++ 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index c1937ea..e5ed5b9 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c @@ -92,7 +92,7 @@ static void em28xx_audio_isocirq(struct urb *urb) if (dev-disconnected) { dprintk(device disconnected while streaming. URB status=%d.\n, urb-status); - atomic_set(dev-stream_started, 0); + atomic_set(dev-adev.stream_started, 0); return; } @@ -109,7 +109,7 @@ static void em28xx_audio_isocirq(struct urb *urb) break; } - if (atomic_read(dev-stream_started) == 0) + if (atomic_read(dev-adev.stream_started) == 0) return; if (dev-adev.capture_pcm_substream) { @@ -185,7 +185,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) em28xx_errdev(submit of audio urb failed (error=%i)\n, errCode); em28xx_deinit_isoc_audio(dev); - atomic_set(dev-stream_started, 0); + atomic_set(dev-adev.stream_started, 0); return errCode; } @@ -332,9 +332,9 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) dev-mute = 1; mutex_lock(dev-lock); dev-adev.users--; - if (atomic_read(dev-stream_started) 0) { - atomic_set(dev-stream_started, 0); - schedule_work(dev-wq_trigger); + if (atomic_read(dev-adev.stream_started) 0) { + atomic_set(dev-adev.stream_started, 0); + schedule_work(dev-adev.wq_trigger); } em28xx_audio_analog_set(dev); @@ -381,12 +381,13 @@ static int snd_em28xx_hw_capture_params(struct snd_pcm_substream *substream, static int snd_em28xx_hw_capture_free(struct snd_pcm_substream *substream) { struct em28xx *dev = snd_pcm_substream_chip(substream); + struct em28xx_audio *adev = dev-adev; dprintk(Stop capture, if needed\n); - if (atomic_read(dev-stream_started) 0) { - atomic_set(dev-stream_started, 0); - schedule_work(dev-wq_trigger); + if (atomic_read(adev-stream_started) 0) { + atomic_set(adev-stream_started, 0); + schedule_work(adev-wq_trigger); } return 0; @@ -407,9 +408,11 @@ static int snd_em28xx_prepare(struct snd_pcm_substream *substream) static void audio_trigger(struct work_struct *work) { - struct em28xx *dev = container_of(work, struct em28xx, wq_trigger); + struct em28xx_audio *adev = + container_of(work, struct em28xx_audio, wq_trigger); + struct em28xx *dev = container_of(adev, struct em28xx, adev); - if (atomic_read(dev-stream_started)) { + if (atomic_read(adev-stream_started)) { dprintk(starting capture); em28xx_init_audio_isoc(dev); } else { @@ -431,17 +434,17 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */ case SNDRV_PCM_TRIGGER_RESUME: /* fall through */ case SNDRV_PCM_TRIGGER_START: - atomic_set(dev-stream_started, 1); + atomic_set(dev-adev.stream_started, 1); break; case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ case SNDRV_PCM_TRIGGER_STOP: - atomic_set(dev-stream_started, 0); + atomic_set(dev-adev.stream_started, 0); break; default: retval = -EINVAL; } - schedule_work(dev-wq_trigger); + schedule_work(dev-adev.wq_trigger); return retval; } @@ -929,7 +932,7 @@ static int em28xx_audio_init(struct em28xx *dev) strcpy(card-shortname, Em28xx Audio); strcpy(card-longname, Empia Em28xx Audio); - INIT_WORK(dev-wq_trigger, audio_trigger); + INIT_WORK(adev-wq_trigger, audio_trigger); if (dev-audio_mode.ac97 != EM28XX_NO_AC97) { em28xx_cvol_new(card, dev, Video, AC97_VIDEO); @@ -984,7 +987,7 @@ static int em28xx_audio_fini(struct em28xx *dev) if (dev-adev.sndcard) { snd_card_disconnect(dev-adev.sndcard); - flush_work(dev-wq_trigger); + flush_work(dev-adev.wq_trigger); em28xx_audio_free_urb(dev); @@ -1006,7 +1009,7 @@ static int em28xx_audio_suspend(struct em28xx *dev) em28xx_info(Suspending audio extension);
[PATCH 11/19] em28xx: move struct em28xx_fmt *format from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 14 +++--- drivers/media/usb/em28xx/em28xx.h | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 821d182..c316147 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -222,7 +222,7 @@ static int em28xx_set_outfmt(struct em28xx *dev) u8 fmt, vinctrl; struct em28xx_v4l2 *v4l2 = dev-v4l2; - fmt = dev-format-reg; + fmt = v4l2-format-reg; if (!dev-is_em25xx) fmt |= 0x20; /* @@ -877,7 +877,7 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, size = fmt-fmt.pix.sizeimage; else size = -(v4l2-width * v4l2-height * dev-format-depth + 7) 3; + (v4l2-width * v4l2-height * v4l2-format-depth + 7) 3; if (size == 0) return -EINVAL; @@ -901,7 +901,7 @@ buffer_prepare(struct vb2_buffer *vb) em28xx_videodbg(%s, field=%d\n, __func__, vb-v4l2_buf.field); - size = (v4l2-width * v4l2-height * dev-format-depth + 7) 3; + size = (v4l2-width * v4l2-height * v4l2-format-depth + 7) 3; if (vb2_plane_size(vb, 0) size) { em28xx_videodbg(%s data will not fit into plane (%lu %lu)\n, @@ -1228,8 +1228,8 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, f-fmt.pix.width = v4l2-width; f-fmt.pix.height = v4l2-height; - f-fmt.pix.pixelformat = dev-format-fourcc; - f-fmt.pix.bytesperline = (v4l2-width * dev-format-depth + 7) 3; + f-fmt.pix.pixelformat = v4l2-format-fourcc; + f-fmt.pix.bytesperline = (v4l2-width * v4l2-format-depth + 7) 3; f-fmt.pix.sizeimage = f-fmt.pix.bytesperline * v4l2-height; f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; @@ -1319,7 +1319,7 @@ static int em28xx_set_video_format(struct em28xx *dev, unsigned int fourcc, if (!fmt) return -EINVAL; - dev-format = fmt; + v4l2-format = fmt; v4l2-width = width; v4l2-height = height; @@ -2433,7 +2433,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) dev-interlaced = EM28XX_INTERLACED_DEFAULT; /* Analog specific initialization */ - dev-format = format[0]; + v4l2-format = format[0]; maxw = norm_maxw(dev); /* MaxPacketSize for em2800 is too small to capture at full resolution diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index f0b3b8c..dd93a37 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -518,6 +518,7 @@ struct em28xx_v4l2 { u8 vinmode; u8 vinctl; + struct em28xx_fmt *format; v4l2_std_id norm; /* selected tv norm */ /* Frame properties */ @@ -606,8 +607,6 @@ struct em28xx { struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */ atomic_t stream_started; /* stream should be running if true */ - struct em28xx_fmt *format; - /* Some older em28xx chips needs a waiting time after writing */ unsigned int wait_after_write; -- 1.8.4.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 08/19] em28xx: move v4l2 frame resolutions and scale data from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-vbi.c | 10 +++-- drivers/media/usb/em28xx/em28xx-video.c | 80 +++-- drivers/media/usb/em28xx/em28xx.h | 16 --- 3 files changed, 61 insertions(+), 45 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-vbi.c b/drivers/media/usb/em28xx/em28xx-vbi.c index db3d655..6d7f657 100644 --- a/drivers/media/usb/em28xx/em28xx-vbi.c +++ b/drivers/media/usb/em28xx/em28xx-vbi.c @@ -47,12 +47,13 @@ static int vbi_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, unsigned int sizes[], void *alloc_ctxs[]) { struct em28xx *dev = vb2_get_drv_priv(vq); + struct em28xx_v4l2 *v4l2 = dev-v4l2; unsigned long size; if (fmt) size = fmt-fmt.pix.sizeimage; else - size = dev-vbi_width * dev-vbi_height * 2; + size = v4l2-vbi_width * v4l2-vbi_height * 2; if (0 == *nbuffers) *nbuffers = 32; @@ -69,11 +70,12 @@ static int vbi_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, static int vbi_buffer_prepare(struct vb2_buffer *vb) { - struct em28xx*dev = vb2_get_drv_priv(vb-vb2_queue); - struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb); + struct em28xx*dev = vb2_get_drv_priv(vb-vb2_queue); + struct em28xx_v4l2 *v4l2 = dev-v4l2; + struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb); unsigned longsize; - size = dev-vbi_width * dev-vbi_height * 2; + size = v4l2-vbi_width * v4l2-vbi_height * 2; if (vb2_plane_size(vb, 0) size) { printk(KERN_INFO %s data will not fit into plane (%lu %lu)\n, diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 301acef..ecc4411 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -218,6 +218,7 @@ static int em28xx_set_outfmt(struct em28xx *dev) { int ret; u8 fmt, vinctrl; + struct em28xx_v4l2 *v4l2 = dev-v4l2; fmt = dev-format-reg; if (!dev-is_em25xx) @@ -243,8 +244,8 @@ static int em28xx_set_outfmt(struct em28xx *dev) if (em28xx_vbi_supported(dev) == 1) { vinctrl |= EM28XX_VINCTRL_VBI_RAW; em28xx_write_reg(dev, EM28XX_R34_VBI_START_H, 0x00); - em28xx_write_reg(dev, EM28XX_R36_VBI_WIDTH, dev-vbi_width/4); - em28xx_write_reg(dev, EM28XX_R37_VBI_HEIGHT, dev-vbi_height); + em28xx_write_reg(dev, EM28XX_R36_VBI_WIDTH, v4l2-vbi_width/4); + em28xx_write_reg(dev, EM28XX_R37_VBI_HEIGHT, v4l2-vbi_height); if (dev-norm V4L2_STD_525_60) { /* NTSC */ em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x09); @@ -323,16 +324,16 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) /* FIXME: this only function read values from dev */ static int em28xx_resolution_set(struct em28xx *dev) { - int width, height; - width = norm_maxw(dev); - height = norm_maxh(dev); + struct em28xx_v4l2 *v4l2 = dev-v4l2; + int width = norm_maxw(dev); + int height = norm_maxh(dev); /* Properly setup VBI */ - dev-vbi_width = 720; + v4l2-vbi_width = 720; if (dev-norm V4L2_STD_525_60) - dev-vbi_height = 12; + v4l2-vbi_height = 12; else - dev-vbi_height = 18; + v4l2-vbi_height = 18; em28xx_set_outfmt(dev); @@ -350,15 +351,16 @@ static int em28xx_resolution_set(struct em28xx *dev) else em28xx_capture_area_set(dev, 0, 0, width, height); - return em28xx_scaler_set(dev, dev-hscale, dev-vscale); + return em28xx_scaler_set(dev, v4l2-hscale, v4l2-vscale); } /* Set USB alternate setting for analog video */ static int em28xx_set_alternate(struct em28xx *dev) { + struct em28xx_v4l2 *v4l2 = dev-v4l2; int errCode; int i; - unsigned int min_pkt_size = dev-width * 2 + 4; + unsigned int min_pkt_size = v4l2-width * 2 + 4; /* NOTE: for isoc transfers, only alt settings 0 are allowed bulk transfers seem to work only with alt=0 ! */ @@ -375,7 +377,7 @@ static int em28xx_set_alternate(struct em28xx *dev) the frame size should be increased, otherwise, only green screen will be received. */ - if (dev-width * 2 * dev-height 720 * 240 * 2) + if (v4l2-width * 2 * v4l2-height 720 * 240 * 2) min_pkt_size *= 2; for (i = 0; i dev-num_alt; i++) { @@ -445,7 +447,7 @@ static void em28xx_copy_video(struct em28xx *dev, { void *fieldstart, *startwrite, *startread; int linesdone, currlinedone,
[PATCH 17/19] em28xx: remove field tda9887_conf from struct em28xx
The tda9887 configuration is already stored in the board data, and it is used only one time by the v4l2 sub-module at tuner setup. Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-cards.c | 3 --- drivers/media/usb/em28xx/em28xx-video.c | 6 +++--- drivers/media/usb/em28xx/em28xx.h | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 64ea25a..b81946f 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2719,9 +2719,6 @@ static void em28xx_card_setup(struct em28xx *dev) if (em28xx_boards[dev-model].tuner_addr) dev-tuner_addr = em28xx_boards[dev-model].tuner_addr; - if (em28xx_boards[dev-model].tda9887_conf) - dev-tda9887_conf = em28xx_boards[dev-model].tda9887_conf; - /* request some modules */ switch (dev-model) { case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2: diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 35bf2b9..8c0082c 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -2254,11 +2254,11 @@ static void em28xx_tuner_setup(struct em28xx *dev) 0, tuner, s_type_addr, tun_setup); } - if (dev-tda9887_conf) { + if (dev-board.tda9887_conf) { struct v4l2_priv_tun_config tda9887_cfg; tda9887_cfg.tuner = TUNER_TDA9887; - tda9887_cfg.priv = dev-tda9887_conf; + tda9887_cfg.priv = dev-board.tda9887_conf; v4l2_device_call_all(v4l2_dev, 0, tuner, s_config, tda9887_cfg); @@ -2364,7 +2364,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) /* Initialize tuner and camera */ if (dev-board.tuner_type != TUNER_ABSENT) { - int has_demod = (dev-tda9887_conf TDA9887_PRESENT); + int has_demod = (dev-board.tda9887_conf TDA9887_PRESENT); if (dev-board.radio.type) v4l2_i2c_new_subdev(v4l2-v4l2_dev, diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 8a0ed93..917cb25 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -633,7 +633,6 @@ struct em28xx { int tuner_type; /* type of the tuner */ int tuner_addr; /* tuner address */ - int tda9887_conf; /* i2c i/o */ struct i2c_adapter i2c_adap[NUM_I2C_BUSES]; -- 1.8.4.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 09/19] em28xx: move vinmode and vinctrl data from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-camera.c | 16 drivers/media/usb/em28xx/em28xx-video.c | 10 +- drivers/media/usb/em28xx/em28xx.h| 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index c2672b4..3a88867 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -372,8 +372,8 @@ int em28xx_init_camera(struct em28xx *dev) break; } /* probably means GRGB 16 bit bayer */ - dev-vinmode = 0x0d; - dev-vinctl = 0x00; + v4l2-vinmode = 0x0d; + v4l2-vinctl = 0x00; break; } @@ -384,8 +384,8 @@ int em28xx_init_camera(struct em28xx *dev) em28xx_initialize_mt9m001(dev); /* probably means BGGR 16 bit bayer */ - dev-vinmode = 0x0c; - dev-vinctl = 0x00; + v4l2-vinmode = 0x0c; + v4l2-vinctl = 0x00; break; case EM28XX_MT9M111: @@ -396,8 +396,8 @@ int em28xx_init_camera(struct em28xx *dev) em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev-board.xclk); em28xx_initialize_mt9m111(dev); - dev-vinmode = 0x0a; - dev-vinctl = 0x00; + v4l2-vinmode = 0x0a; + v4l2-vinctl = 0x00; break; case EM28XX_OV2640: @@ -438,8 +438,8 @@ int em28xx_init_camera(struct em28xx *dev) /* NOTE: for UXGA=1600x1200 switch to 12MHz */ dev-board.xclk = EM28XX_XCLK_FREQUENCY_24MHZ; em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev-board.xclk); - dev-vinmode = 0x08; - dev-vinctl = 0x00; + v4l2-vinmode = 0x08; + v4l2-vinctl = 0x00; break; } diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index ecc4411..0676aa4 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -236,11 +236,11 @@ static int em28xx_set_outfmt(struct em28xx *dev) if (ret 0) return ret; - ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, dev-vinmode); + ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, v4l2-vinmode); if (ret 0) return ret; - vinctrl = dev-vinctl; + vinctrl = v4l2-vinctl; if (em28xx_vbi_supported(dev) == 1) { vinctrl |= EM28XX_VINCTRL_VBI_RAW; em28xx_write_reg(dev, EM28XX_R34_VBI_START_H, 0x00); @@ -2316,9 +2316,9 @@ static int em28xx_v4l2_init(struct em28xx *dev) /* * Default format, used for tvp5150 or saa711x output formats */ - dev-vinmode = 0x10; - dev-vinctl = EM28XX_VINCTRL_INTERLACED | - EM28XX_VINCTRL_CCIR656_ENABLE; + v4l2-vinmode = 0x10; + v4l2-vinctl = EM28XX_VINCTRL_INTERLACED | + EM28XX_VINCTRL_CCIR656_ENABLE; /* request some modules */ diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index e029136..7ca0ff98 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -515,6 +515,9 @@ struct em28xx_v4l2 { struct mutex vb_queue_lock; struct mutex vb_vbi_queue_lock; + u8 vinmode; + u8 vinctl; + /* Frame properties */ int width; /* current frame width */ int height; /* current frame height */ @@ -597,9 +600,6 @@ struct em28xx { /* Progressive (non-interlaced) mode */ int progressive; - /* Vinmode/Vinctl used at the driver */ - int vinmode, vinctl; - /* Controls audio streaming */ struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */ atomic_t stream_started; /* stream should be running if true */ -- 1.8.4.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 05/19] em28xx: move struct v4l2_clk *clk from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-camera.c | 11 ++- drivers/media/usb/em28xx/em28xx-video.c | 6 +++--- drivers/media/usb/em28xx/em28xx.h| 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index daebef3..c2672b4 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -330,13 +330,14 @@ int em28xx_init_camera(struct em28xx *dev) char clk_name[V4L2_SUBDEV_NAME_SIZE]; struct i2c_client *client = dev-i2c_client[dev-def_i2c_bus]; struct i2c_adapter *adap = dev-i2c_adap[dev-def_i2c_bus]; + struct em28xx_v4l2 *v4l2 = dev-v4l2; int ret = 0; v4l2_clk_name_i2c(clk_name, sizeof(clk_name), i2c_adapter_id(adap), client-addr); - dev-clk = v4l2_clk_register_fixed(clk_name, mclk, -EINVAL); - if (IS_ERR(dev-clk)) - return PTR_ERR(dev-clk); + v4l2-clk = v4l2_clk_register_fixed(clk_name, mclk, -EINVAL); + if (IS_ERR(v4l2-clk)) + return PTR_ERR(v4l2-clk); switch (dev-em28xx_sensor) { case EM28XX_MT9V011: @@ -448,8 +449,8 @@ int em28xx_init_camera(struct em28xx *dev) } if (ret 0) { - v4l2_clk_unregister_fixed(dev-clk); - dev-clk = NULL; + v4l2_clk_unregister_fixed(v4l2-clk); + v4l2-clk = NULL; } return ret; diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 22acb0f..4fb0053 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1974,9 +1974,9 @@ static int em28xx_v4l2_fini(struct em28xx *dev) v4l2_ctrl_handler_free(v4l2-ctrl_handler); v4l2_device_unregister(v4l2-v4l2_dev); - if (dev-clk) { - v4l2_clk_unregister_fixed(dev-clk); - dev-clk = NULL; + if (v4l2-clk) { + v4l2_clk_unregister_fixed(v4l2-clk); + v4l2-clk = NULL; } kref_put(v4l2-ref, em28xx_free_v4l2); diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 910c2d8..a4d26bf 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -503,6 +503,7 @@ struct em28xx_v4l2 { struct v4l2_device v4l2_dev; struct v4l2_ctrl_handler ctrl_handler; + struct v4l2_clk *clk; }; struct em28xx_audio { @@ -568,7 +569,6 @@ struct em28xx { unsigned int has_alsa_audio:1; unsigned int is_audio_only:1; - struct v4l2_clk *clk; struct em28xx_board board; /* Webcam specific fields */ -- 1.8.4.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 14/19] em28xx: move capture state tracking fields from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 44 + drivers/media/usb/em28xx/em28xx.h | 13 +- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 640c0b0..496dcef 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -434,7 +434,7 @@ static inline void finish_buffer(struct em28xx *dev, { em28xx_isocdbg([%p/%d] wakeup\n, buf, buf-top_field); - buf-vb.v4l2_buf.sequence = dev-field_count++; + buf-vb.v4l2_buf.sequence = dev-v4l2-field_count++; buf-vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; v4l2_get_timestamp(buf-vb.v4l2_buf.timestamp); @@ -616,13 +616,13 @@ finish_field_prepare_next(struct em28xx *dev, { struct em28xx_v4l2 *v4l2 = dev-v4l2; - if (v4l2-progressive || dev-top_field) { /* Brand new frame */ + if (v4l2-progressive || v4l2-top_field) { /* Brand new frame */ if (buf != NULL) finish_buffer(dev, buf); buf = get_next_buf(dev, dma_q); } if (buf != NULL) { - buf-top_field = dev-top_field; + buf-top_field = v4l2-top_field; buf-pos = 0; } @@ -656,17 +656,17 @@ static inline void process_frame_data_em28xx(struct em28xx *dev, data_len -= 4; } else if (data_pkt[0] == 0x33 data_pkt[1] == 0x95) { /* Field start (VBI mode) */ - dev-capture_type = 0; - dev-vbi_read = 0; + v4l2-capture_type = 0; + v4l2-vbi_read = 0; em28xx_isocdbg(VBI START HEADER !!!\n); - dev-top_field = !(data_pkt[2] 1); + v4l2-top_field = !(data_pkt[2] 1); data_pkt += 4; data_len -= 4; } else if (data_pkt[0] == 0x22 data_pkt[1] == 0x5a) { /* Field start (VBI disabled) */ - dev-capture_type = 2; + v4l2-capture_type = 2; em28xx_isocdbg(VIDEO START HEADER !!!\n); - dev-top_field = !(data_pkt[2] 1); + v4l2-top_field = !(data_pkt[2] 1); data_pkt += 4; data_len -= 4; } @@ -674,37 +674,37 @@ static inline void process_frame_data_em28xx(struct em28xx *dev, /* NOTE: With bulk transfers, intermediate data packets * have no continuation header */ - if (dev-capture_type == 0) { + if (v4l2-capture_type == 0) { vbi_buf = finish_field_prepare_next(dev, vbi_buf, vbi_dma_q); dev-usb_ctl.vbi_buf = vbi_buf; - dev-capture_type = 1; + v4l2-capture_type = 1; } - if (dev-capture_type == 1) { + if (v4l2-capture_type == 1) { int vbi_size = v4l2-vbi_width * v4l2-vbi_height; - int vbi_data_len = ((dev-vbi_read + data_len) vbi_size) ? - (vbi_size - dev-vbi_read) : data_len; + int vbi_data_len = ((v4l2-vbi_read + data_len) vbi_size) ? + (vbi_size - v4l2-vbi_read) : data_len; /* Copy VBI data */ if (vbi_buf != NULL) em28xx_copy_vbi(dev, vbi_buf, data_pkt, vbi_data_len); - dev-vbi_read += vbi_data_len; + v4l2-vbi_read += vbi_data_len; if (vbi_data_len data_len) { /* Continue with copying video data */ - dev-capture_type = 2; + v4l2-capture_type = 2; data_pkt += vbi_data_len; data_len -= vbi_data_len; } } - if (dev-capture_type == 2) { + if (v4l2-capture_type == 2) { buf = finish_field_prepare_next(dev, buf, dma_q); dev-usb_ctl.vid_buf = buf; - dev-capture_type = 3; + v4l2-capture_type = 3; } - if (dev-capture_type == 3 buf != NULL data_len 0) + if (v4l2-capture_type == 3 buf != NULL data_len 0) em28xx_copy_video(dev, buf, data_pkt, data_len); } @@ -717,6 +717,7 @@ static inline void process_frame_data_em25xx(struct em28xx *dev, { struct em28xx_buffer*buf = dev-usb_ctl.vid_buf; struct em28xx_dmaqueue *dmaq = dev-vidq; + struct em28xx_v4l2 *v4l2 = dev-v4l2; bool frame_end = 0; /* Check for header */ @@ -725,7 +726,7 @@ static inline void process_frame_data_em25xx(struct em28xx *dev, if (data_len = 2) {/* em25xx
[PATCH 10/19] em28xx: move TV norm from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 35 ++--- drivers/media/usb/em28xx/em28xx.h | 3 ++- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 0676aa4..821d182 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -155,13 +155,15 @@ static inline unsigned int norm_maxw(struct em28xx *dev) static inline unsigned int norm_maxh(struct em28xx *dev) { + struct em28xx_v4l2 *v4l2 = dev-v4l2; + if (dev-board.is_webcam) return dev-sensor_yres; if (dev-board.max_range_640_480) return 480; - return (dev-norm V4L2_STD_625_50) ? 576 : 480; + return (v4l2-norm V4L2_STD_625_50) ? 576 : 480; } static int em28xx_vbi_supported(struct em28xx *dev) @@ -246,10 +248,10 @@ static int em28xx_set_outfmt(struct em28xx *dev) em28xx_write_reg(dev, EM28XX_R34_VBI_START_H, 0x00); em28xx_write_reg(dev, EM28XX_R36_VBI_WIDTH, v4l2-vbi_width/4); em28xx_write_reg(dev, EM28XX_R37_VBI_HEIGHT, v4l2-vbi_height); - if (dev-norm V4L2_STD_525_60) { + if (v4l2-norm V4L2_STD_525_60) { /* NTSC */ em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x09); - } else if (dev-norm V4L2_STD_625_50) { + } else if (v4l2-norm V4L2_STD_625_50) { /* PAL */ em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x07); } @@ -330,7 +332,7 @@ static int em28xx_resolution_set(struct em28xx *dev) /* Properly setup VBI */ v4l2-vbi_width = 720; - if (dev-norm V4L2_STD_525_60) + if (v4l2-norm V4L2_STD_525_60) v4l2-vbi_height = 12; else v4l2-vbi_height = 18; @@ -1349,7 +1351,7 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm) struct em28xx_fh *fh = priv; struct em28xx *dev = fh-dev; - *norm = dev-norm; + *norm = dev-v4l2-norm; return 0; } @@ -1371,13 +1373,13 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) struct em28xx_v4l2 *v4l2 = dev-v4l2; struct v4l2_format f; - if (norm == dev-norm) + if (norm == v4l2-norm) return 0; if (dev-streaming_users 0) return -EBUSY; - dev-norm = norm; + v4l2-norm = norm; /* Adjusts width/height, if needed */ f.fmt.pix.width = 720; @@ -1391,7 +1393,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) v4l2-hscale, v4l2-vscale); em28xx_resolution_set(dev); - v4l2_device_call_all(v4l2-v4l2_dev, 0, core, s_std, dev-norm); + v4l2_device_call_all(v4l2-v4l2_dev, 0, core, s_std, v4l2-norm); return 0; } @@ -1399,16 +1401,17 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) static int vidioc_g_parm(struct file *file, void *priv, struct v4l2_streamparm *p) { - struct em28xx_fh *fh = priv; - struct em28xx *dev = fh-dev; + struct em28xx_fh *fh = priv; + struct em28xx *dev = fh-dev; + struct em28xx_v4l2 *v4l2 = dev-v4l2; int rc = 0; p-parm.capture.readbuffers = EM28XX_MIN_BUF; if (dev-board.is_webcam) - rc = v4l2_device_call_until_err(dev-v4l2-v4l2_dev, 0, + rc = v4l2_device_call_until_err(v4l2-v4l2_dev, 0, video, g_parm, p); else - v4l2_video_std_frame_period(dev-norm, + v4l2_video_std_frame_period(v4l2-norm, p-parm.capture.timeperframe); return rc; @@ -1809,11 +1812,11 @@ static int vidioc_g_fmt_vbi_cap(struct file *file, void *priv, memset(format-fmt.vbi.reserved, 0, sizeof(format-fmt.vbi.reserved)); /* Varies by video standard (NTSC, PAL, etc.) */ - if (dev-norm V4L2_STD_525_60) { + if (v4l2-norm V4L2_STD_525_60) { /* NTSC */ format-fmt.vbi.start[0] = 10; format-fmt.vbi.start[1] = 273; - } else if (dev-norm V4L2_STD_625_50) { + } else if (v4l2-norm V4L2_STD_625_50) { /* PAL */ format-fmt.vbi.start[0] = 6; format-fmt.vbi.start[1] = 318; @@ -2425,8 +2428,8 @@ static int em28xx_v4l2_init(struct em28xx *dev) } /* set default norm */ - dev-norm = V4L2_STD_PAL; - v4l2_device_call_all(v4l2-v4l2_dev, 0, core, s_std, dev-norm); + v4l2-norm = V4L2_STD_PAL; + v4l2_device_call_all(v4l2-v4l2_dev, 0,
[PATCH 18/19] em28xx: remove field tuner_addr from struct em28xx
The tuner address is only used by the v4l submodule and at tuner setup and can be obtained from the board data directly (if specified). Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-cards.c | 2 -- drivers/media/usb/em28xx/em28xx-video.c | 17 - drivers/media/usb/em28xx/em28xx.h | 1 - 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index b81946f..e552375 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2716,8 +2716,6 @@ static void em28xx_card_setup(struct em28xx *dev) dev-board.name, dev-model); dev-tuner_type = em28xx_boards[dev-model].tuner_type; - if (em28xx_boards[dev-model].tuner_addr) - dev-tuner_addr = em28xx_boards[dev-model].tuner_addr; /* request some modules */ switch (dev-model) { diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 8c0082c..254a7ff 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -2223,16 +2223,13 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, return vfd; } -static void em28xx_tuner_setup(struct em28xx *dev) +static void em28xx_tuner_setup(struct em28xx *dev, unsigned short tuner_addr) { struct em28xx_v4l2 *v4l2 = dev-v4l2; struct v4l2_device *v4l2_dev = v4l2-v4l2_dev; struct tuner_setup tun_setup; struct v4l2_frequency f; - if (dev-tuner_type == TUNER_ABSENT) - return; - memset(tun_setup, 0, sizeof(tun_setup)); tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; @@ -2248,7 +2245,7 @@ static void em28xx_tuner_setup(struct em28xx *dev) if ((dev-tuner_type != TUNER_ABSENT) (dev-tuner_type)) { tun_setup.type = dev-tuner_type; - tun_setup.addr = dev-tuner_addr; + tun_setup.addr = tuner_addr; v4l2_device_call_all(v4l2_dev, 0, tuner, s_type_addr, tun_setup); @@ -2364,6 +2361,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) /* Initialize tuner and camera */ if (dev-board.tuner_type != TUNER_ABSENT) { + unsigned short tuner_addr = dev-board.tuner_addr; int has_demod = (dev-board.tda9887_conf TDA9887_PRESENT); if (dev-board.radio.type) @@ -2375,7 +2373,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) v4l2_i2c_new_subdev(v4l2-v4l2_dev, dev-i2c_adap[dev-def_i2c_bus], tuner, 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); - if (dev-tuner_addr == 0) { + if (tuner_addr == 0) { enum v4l2_i2c_tuner_type type = has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; struct v4l2_subdev *sd; @@ -2385,15 +2383,16 @@ static int em28xx_v4l2_init(struct em28xx *dev) 0, v4l2_i2c_tuner_addrs(type)); if (sd) - dev-tuner_addr = v4l2_i2c_subdev_addr(sd); + tuner_addr = v4l2_i2c_subdev_addr(sd); } else { v4l2_i2c_new_subdev(v4l2-v4l2_dev, dev-i2c_adap[dev-def_i2c_bus], - tuner, dev-tuner_addr, NULL); + tuner, tuner_addr, NULL); } + + em28xx_tuner_setup(dev, tuner_addr); } - em28xx_tuner_setup(dev); if (dev-em28xx_sensor != EM28XX_NOSENSOR) em28xx_init_camera(dev); diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 917cb25..3a3fe16 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -632,7 +632,6 @@ struct em28xx { struct em28xx_audio_mode audio_mode; int tuner_type; /* type of the tuner */ - int tuner_addr; /* tuner address */ /* i2c i/o */ struct i2c_adapter i2c_adap[NUM_I2C_BUSES]; -- 1.8.4.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 13/19] em28xx: move sensor parameter fields from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-camera.c | 20 ++-- drivers/media/usb/em28xx/em28xx-video.c | 6 -- drivers/media/usb/em28xx/em28xx.h| 10 ++ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 3a88867..12d4c03 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -349,8 +349,8 @@ int em28xx_init_camera(struct em28xx *dev) .platform_data = pdata, }; - dev-sensor_xres = 640; - dev-sensor_yres = 480; + v4l2-sensor_xres = 640; + v4l2-sensor_yres = 480; /* * FIXME: mt9v011 uses I2S speed as xtal clk - at least with @@ -363,8 +363,8 @@ int em28xx_init_camera(struct em28xx *dev) */ dev-board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ; em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev-board.xclk); - dev-sensor_xtal = 430; - pdata.xtal = dev-sensor_xtal; + v4l2-sensor_xtal = 430; + pdata.xtal = v4l2-sensor_xtal; if (NULL == v4l2_i2c_new_subdev_board(dev-v4l2-v4l2_dev, adap, mt9v011_info, NULL)) { @@ -378,8 +378,8 @@ int em28xx_init_camera(struct em28xx *dev) break; } case EM28XX_MT9M001: - dev-sensor_xres = 1280; - dev-sensor_yres = 1024; + v4l2-sensor_xres = 1280; + v4l2-sensor_yres = 1024; em28xx_initialize_mt9m001(dev); @@ -389,8 +389,8 @@ int em28xx_init_camera(struct em28xx *dev) break; case EM28XX_MT9M111: - dev-sensor_xres = 640; - dev-sensor_yres = 512; + v4l2-sensor_xres = 640; + v4l2-sensor_yres = 512; dev-board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ; em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev-board.xclk); @@ -419,8 +419,8 @@ int em28xx_init_camera(struct em28xx *dev) * - adjust bridge xclk * - disable 16 bit (12 bit) output formats on high resolutions */ - dev-sensor_xres = 640; - dev-sensor_yres = 480; + v4l2-sensor_xres = 640; + v4l2-sensor_yres = 480; subdev = v4l2_i2c_new_subdev_board(dev-v4l2-v4l2_dev, adap, diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index abb4e8e..640c0b0 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -144,8 +144,10 @@ static struct em28xx_fmt format[] = { /*FIXME: maxw should be dependent of alt mode */ static inline unsigned int norm_maxw(struct em28xx *dev) { + struct em28xx_v4l2 *v4l2 = dev-v4l2; + if (dev-board.is_webcam) - return dev-sensor_xres; + return v4l2-sensor_xres; if (dev-board.max_range_640_480) return 640; @@ -158,7 +160,7 @@ static inline unsigned int norm_maxh(struct em28xx *dev) struct em28xx_v4l2 *v4l2 = dev-v4l2; if (dev-board.is_webcam) - return dev-sensor_yres; + return v4l2-sensor_yres; if (dev-board.max_range_640_480) return 480; diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 1491879..f447108 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -518,6 +518,11 @@ struct em28xx_v4l2 { u8 vinmode; u8 vinctl; + /* Camera specific fields */ + int sensor_xres; + int sensor_yres; + int sensor_xtal; + struct em28xx_fmt *format; v4l2_std_id norm; /* selected tv norm */ @@ -600,10 +605,7 @@ struct em28xx { struct em28xx_board board; - /* Webcam specific fields */ - enum em28xx_sensor em28xx_sensor; - int sensor_xres, sensor_yres; - int sensor_xtal; + enum em28xx_sensor em28xx_sensor; /* camera specific */ /* Controls audio streaming */ struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */ -- 1.8.4.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 16/19] em28xx: move tuner frequency field from struct em28xx to struct v4l2
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-video.c | 16 +--- drivers/media/usb/em28xx/em28xx.h | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index aaab111..35bf2b9 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -963,7 +963,7 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count) /* Ask tuner to go to analog or radio mode */ memset(f, 0, sizeof(f)); - f.frequency = dev-ctl_freq; + f.frequency = v4l2-frequency; if (vq-owner vq-owner-vdev-vfl_type == VFL_TYPE_RADIO) f.type = V4L2_TUNER_RADIO; else @@ -1597,11 +1597,12 @@ static int vidioc_g_frequency(struct file *file, void *priv, { struct em28xx_fh *fh = priv; struct em28xx *dev = fh-dev; + struct em28xx_v4l2*v4l2 = dev-v4l2; if (0 != f-tuner) return -EINVAL; - f-frequency = dev-ctl_freq; + f-frequency = v4l2-frequency; return 0; } @@ -1618,7 +1619,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, v4l2_device_call_all(v4l2-v4l2_dev, 0, tuner, s_frequency, f); v4l2_device_call_all(v4l2-v4l2_dev, 0, tuner, g_frequency, new_freq); - dev-ctl_freq = new_freq.frequency; + v4l2-frequency = new_freq.frequency; return 0; } @@ -2224,9 +2225,10 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, static void em28xx_tuner_setup(struct em28xx *dev) { - struct v4l2_device *v4l2_dev = dev-v4l2-v4l2_dev; - struct tuner_setup tun_setup; - struct v4l2_frequencyf; + struct em28xx_v4l2 *v4l2 = dev-v4l2; + struct v4l2_device *v4l2_dev = v4l2-v4l2_dev; + struct tuner_setup tun_setup; + struct v4l2_frequency f; if (dev-tuner_type == TUNER_ABSENT) return; @@ -2281,7 +2283,7 @@ static void em28xx_tuner_setup(struct em28xx *dev) f.tuner = 0; f.type = V4L2_TUNER_ANALOG_TV; f.frequency = 9076; /* just a magic number */ - dev-ctl_freq = f.frequency; + v4l2-frequency = f.frequency; v4l2_device_call_all(v4l2_dev, 0, tuner, s_frequency, f); } diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 0585217..8a0ed93 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h @@ -526,6 +526,8 @@ struct em28xx_v4l2 { int users; /* user count for exclusive use */ int streaming_users;/* number of actively streaming users */ + u32 frequency; /* selected tuner frequency */ + struct em28xx_fmt *format; v4l2_std_id norm; /* selected tv norm */ @@ -644,7 +646,6 @@ struct em28xx { struct rt_mutex i2c_bus_lock; /* video for linux */ - int ctl_freq; /* selected frequency */ unsigned int ctl_input; /* selected input */ unsigned int ctl_ainput;/* selected audio input */ unsigned int ctl_aoutput;/* selected audio output */ -- 1.8.4.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 03/19] em28xx: start moving em28xx-v4l specific data to its own struct
Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-camera.c | 4 +- drivers/media/usb/em28xx/em28xx-video.c | 160 +-- drivers/media/usb/em28xx/em28xx.h| 8 +- 3 files changed, 116 insertions(+), 56 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 505e050..daebef3 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -365,7 +365,7 @@ int em28xx_init_camera(struct em28xx *dev) dev-sensor_xtal = 430; pdata.xtal = dev-sensor_xtal; if (NULL == - v4l2_i2c_new_subdev_board(dev-v4l2_dev, adap, + v4l2_i2c_new_subdev_board(dev-v4l2-v4l2_dev, adap, mt9v011_info, NULL)) { ret = -ENODEV; break; @@ -422,7 +422,7 @@ int em28xx_init_camera(struct em28xx *dev) dev-sensor_yres = 480; subdev = -v4l2_i2c_new_subdev_board(dev-v4l2_dev, adap, +v4l2_i2c_new_subdev_board(dev-v4l2-v4l2_dev, adap, ov2640_info, NULL); if (NULL == subdev) { ret = -ENODEV; diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 45ad471..89947db 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -189,10 +189,11 @@ static int em28xx_vbi_supported(struct em28xx *dev) */ static void em28xx_wake_i2c(struct em28xx *dev) { - v4l2_device_call_all(dev-v4l2_dev, 0, core, reset, 0); - v4l2_device_call_all(dev-v4l2_dev, 0, video, s_routing, + struct v4l2_device *v4l2_dev = dev-v4l2-v4l2_dev; + v4l2_device_call_all(v4l2_dev, 0, core, reset, 0); + v4l2_device_call_all(v4l2_dev, 0, video, s_routing, INPUT(dev-ctl_input)-vmux, 0, 0); - v4l2_device_call_all(dev-v4l2_dev, 0, video, s_stream, 0); + v4l2_device_call_all(v4l2_dev, 0, video, s_stream, 0); } static int em28xx_colorlevels_set_default(struct em28xx *dev) @@ -952,7 +953,8 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count) f.type = V4L2_TUNER_RADIO; else f.type = V4L2_TUNER_ANALOG_TV; - v4l2_device_call_all(dev-v4l2_dev, 0, tuner, s_frequency, f); + v4l2_device_call_all(dev-v4l2-v4l2_dev, +0, tuner, s_frequency, f); } dev-streaming_users++; @@ -1083,6 +1085,7 @@ static int em28xx_vb2_setup(struct em28xx *dev) static void video_mux(struct em28xx *dev, int index) { + struct v4l2_device *v4l2_dev = dev-v4l2-v4l2_dev; dev-ctl_input = index; dev-ctl_ainput = INPUT(index)-amux; dev-ctl_aoutput = INPUT(index)-aout; @@ -1090,21 +1093,21 @@ static void video_mux(struct em28xx *dev, int index) if (!dev-ctl_aoutput) dev-ctl_aoutput = EM28XX_AOUT_MASTER; - v4l2_device_call_all(dev-v4l2_dev, 0, video, s_routing, + v4l2_device_call_all(v4l2_dev, 0, video, s_routing, INPUT(index)-vmux, 0, 0); if (dev-board.has_msp34xx) { if (dev-i2s_speed) { - v4l2_device_call_all(dev-v4l2_dev, 0, audio, + v4l2_device_call_all(v4l2_dev, 0, audio, s_i2s_clock_freq, dev-i2s_speed); } /* Note: this is msp3400 specific */ - v4l2_device_call_all(dev-v4l2_dev, 0, audio, s_routing, + v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, dev-ctl_ainput, MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0); } if (dev-board.adecoder != EM28XX_NOADECODER) { - v4l2_device_call_all(dev-v4l2_dev, 0, audio, s_routing, + v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, dev-ctl_ainput, dev-ctl_aoutput, 0); } @@ -1344,7 +1347,7 @@ static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *norm) struct em28xx_fh *fh = priv; struct em28xx *dev = fh-dev; - v4l2_device_call_all(dev-v4l2_dev, 0, video, querystd, norm); + v4l2_device_call_all(dev-v4l2-v4l2_dev, 0, video, querystd, norm); return 0; } @@ -1374,7 +1377,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) size_to_scale(dev, dev-width, dev-height, dev-hscale, dev-vscale); em28xx_resolution_set(dev); - v4l2_device_call_all(dev-v4l2_dev, 0, core, s_std, dev-norm); + v4l2_device_call_all(dev-v4l2-v4l2_dev, 0, core, s_std, dev-norm); return 0; } @@ -1388,7
Re: cx23885-dvb.c:undefined reference to `tda18271_attach'
Hi Peter, Em Mon, 24 Mar 2014 16:34:17 +0100 Peter Senna Tschudin peter.se...@gmail.com escreveu: Hi, I'm being blamed for some bugs for more than one year, and this weekend I was able to reproduce the error for the first time. I have the impression that the issue is related to Kconfig because when compiling the Kernel for x86(not x86_64), and when: CONFIG_VIDEO_CX23885=y and CONFIG_MEDIA_TUNER_TDA18271=m the build fails as the tuner code was compiled as a module when it should have been compiled as part of the Kernel. No. It is valid to have those I2C drivers compiled as module while the main driver is compiled builtin. The trick is to use dvb_attach() macro. This macro is very bad named. It should be named as something like: request_module_and_execute_symbol() In order to express what it really does. On the Kconfig file drivers/media/pci/cx23885/Kconfig: config VIDEO_CX23885 tristate Conexant cx23885 (2388x successor) support ... select MEDIA_TUNER_TDA18271 if MEDIA_SUBDRV_AUTOSELECT which I think is the problem. Can I just remove this 'if MEDIA_SUBDRV_AUTOSELECT'? Or what is the correct way of telling Kconfig to set CONFIG_MEDIA_TUNER_TDA18271 based on the value of CONFIG_VIDEO_CX23885? You shouldn't be doing any of this. In this specific setup, we have: # CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set CONFIG_MEDIA_TUNER_TDA18271=m CONFIG_VIDEO_CX23885=y With should be a valid configuration. I'll try to reproduce and fix this one locally and send a fix for it latter. There are at least 6 similar cases which I'm willing to send patches. Thank you, Peter -- 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 -- Regards, 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
[PATCH] m88rs2000: fix sparse static warnings.
warnings m88rs2000.c:300:16: warning: symbol 'm88rs2000_setup' was not declared. Should it be static? m88rs2000.c:318:16: warning: symbol 'm88rs2000_shutdown' was not declared. Should it be static? m88rs2000.c:328:16: warning: symbol 'fe_reset' was not declared. Should it be static? m88rs2000.c:366:16: warning: symbol 'fe_trigger' was not declared. Should it be static? Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb-frontends/m88rs2000.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index 32cffca..d63bc9c 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -297,7 +297,7 @@ struct inittab { u8 val; }; -struct inittab m88rs2000_setup[] = { +static struct inittab m88rs2000_setup[] = { {DEMOD_WRITE, 0x9a, 0x30}, {DEMOD_WRITE, 0x00, 0x01}, {WRITE_DELAY, 0x19, 0x00}, @@ -315,7 +315,7 @@ struct inittab m88rs2000_setup[] = { {0xff, 0xaa, 0xff} }; -struct inittab m88rs2000_shutdown[] = { +static struct inittab m88rs2000_shutdown[] = { {DEMOD_WRITE, 0x9a, 0x30}, {DEMOD_WRITE, 0xb0, 0x00}, {DEMOD_WRITE, 0xf1, 0x89}, @@ -325,7 +325,7 @@ struct inittab m88rs2000_shutdown[] = { {0xff, 0xaa, 0xff} }; -struct inittab fe_reset[] = { +static struct inittab fe_reset[] = { {DEMOD_WRITE, 0x00, 0x01}, {DEMOD_WRITE, 0x20, 0x81}, {DEMOD_WRITE, 0x21, 0x80}, @@ -363,7 +363,7 @@ struct inittab fe_reset[] = { {0xff, 0xaa, 0xff} }; -struct inittab fe_trigger[] = { +static struct inittab fe_trigger[] = { {DEMOD_WRITE, 0x97, 0x04}, {DEMOD_WRITE, 0x99, 0x77}, {DEMOD_WRITE, 0x9b, 0x64}, -- 1.9.1 -- 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
[linuxtv-media:master 248/499] WARNING: adding a line without newline at end of file
tree: git://linuxtv.org/media_tree.git master head: 8432164ddf7bfe40748ac49995356ab4dfda43b7 commit: b240eacdd536bac23c9d48dfc3d527ed6870ddad [248/499] [media] drx-j: get rid of drx_driver.c scripts/checkpatch.pl 0001-media-drx-j-get-rid-of-drx_driver.c.patch # many are suggestions rather than must-fix WARNING: line over 80 characters #865: drivers/media/dvb-frontends/drx39xyj/drxj.c:20739: + if (block_hdr.addr + 2 * sizeof(u16) + 2 * sizeof (u32) size) WARNING: space prohibited between function name and open parenthesis '(' #865: drivers/media/dvb-frontends/drx39xyj/drxj.c:20739: + if (block_hdr.addr + 2 * sizeof(u16) + 2 * sizeof (u32) size) WARNING: line over 80 characters #876: drivers/media/dvb-frontends/drx39xyj/drxj.c:20750: + DRX_ATTR_MCRECORD(demod).mc_dev_type = mc_dev_type; WARNING: line over 80 characters #877: drivers/media/dvb-frontends/drx39xyj/drxj.c:20751: + DRX_ATTR_MCRECORD(demod).mc_version = mc_version; WARNING: line over 80 characters #878: drivers/media/dvb-frontends/drx39xyj/drxj.c:20752: + DRX_ATTR_MCRECORD(demod).mc_base_version = mc_base_version; WARNING: line over 80 characters #881: drivers/media/dvb-frontends/drx39xyj/drxj.c:20755: + mc_dev_type, mc_version, mc_base_version); WARNING: please, no space before tabs #910: drivers/media/dvb-frontends/drx39xyj/drxj.c:20784: + * ^I-EINVAL:$ WARNING: line over 80 characters #1011: drivers/media/dvb-frontends/drx39xyj/drxj.c:20885: +(block_hdr.CRC != drx_u_code_compute_crc(mc_data, block_hdr.size))) WARNING: line over 80 characters #1058: drivers/media/dvb-frontends/drx39xyj/drxj.c:20932: + (unsigned)(mc_data - mc_data_init)); ERROR: spaces required around that '=' (ctx:WxV) #1062: drivers/media/dvb-frontends/drx39xyj/drxj.c:20936: + result =drxbsp_hst_memcmp(curr_ptr, ^ WARNING: line over 80 characters #1068: drivers/media/dvb-frontends/drx39xyj/drxj.c:20942: + (unsigned)(mc_data - mc_data_init)); ERROR: spaces required around that '=' (ctx:WxO) #1073: drivers/media/dvb-frontends/drx39xyj/drxj.c:20947: + curr_ptr =(curr_ptr[bytes_to_comp]); ^ ERROR: space required before that '' (ctx:OxV) #1073: drivers/media/dvb-frontends/drx39xyj/drxj.c:20947: + curr_ptr =(curr_ptr[bytes_to_comp]); ^ ERROR: spaces required around that '-=' (ctx:WxV) #1074: drivers/media/dvb-frontends/drx39xyj/drxj.c:20948: + bytes_left -=((u32) bytes_to_comp); ^ WARNING: static char array declaration should probably be static const char #1109: drivers/media/dvb-frontends/drx39xyj/drxj.c:20983: + static char drx_driver_core_module_name[] = Core driver; WARNING: line over 80 characters #1144: drivers/media/dvb-frontends/drx39xyj/drxj.c:21018: + struct drx_version_list *current_list_element = demod_version_list; WARNING: line over 80 characters #1281: drivers/media/dvb-frontends/drx39xyj/drxj.c:21155: + return drx_ctrl_version(demod, (struct drx_version_list **)ctrl_data); WARNING: line over 80 characters #1307: drivers/media/dvb-frontends/drx39xyj/drxj.c:21181: +(struct drxu_code_info *)ctrl_data, WARNING: adding a line without newline at end of file #1322: drivers/media/dvb-frontends/drx39xyj/drxj.c:21196: +} --- 0-DAY kernel build testing backend Open Source Technology Center http://lists.01.org/mailman/listinfo/kbuild Intel Corporation -- 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 RFC v2 2/6] drm/i2c: tda998x: Move tda998x to a couple encoder/connector
Hi Jean-François, Thank you for the patch. On Friday 21 March 2014 09:17:32 Jean-Francois Moine wrote: The 'slave encoder' structure of the tda998x driver asks for glue between the DRM driver and the encoder/connector structures. This patch changes the driver to a normal DRM encoder/connector thanks to the infrastructure for componentised subsystems. I like the idea, but I'm not really happy with the implementation. Let me try to explain why below. Signed-off-by: Jean-Francois Moine moin...@free.fr --- drivers/gpu/drm/i2c/tda998x_drv.c | 323 +++ 1 file changed, 188 insertions(+), 135 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index fd6751c..1c25e40 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c [snip] @@ -44,10 +45,14 @@ struct tda998x_priv { wait_queue_head_t wq_edid; volatile int wq_edid_wait; - struct drm_encoder *encoder; + struct drm_encoder encoder; + struct drm_connector connector; }; [snip] -static int -tda998x_probe(struct i2c_client *client, const struct i2c_device_id *id) +static int tda_bind(struct device *dev, struct device *master, void *data) { + struct drm_device *drm = data; This is the part that bothers me. You're making two assumptions here, that the DRM driver will pass a struct drm_device pointer to the bind operation, and that the I2C encoder driver can take control of DRM encoder and connector creation. Although it could become problematic later, the first assumption isn't too much of an issue for now. I'll thus focus on the second one. The component framework isolate the encoder and DRM master drivers as far as component creation and binding is concerned, but doesn't provide a way for the two drivers to communicate together (nor should it). You're solving this by passing a pointer to the DRM device to the encoder bind operation, making the encoder driver create a DRM encoder and connector, and relying on the DRM core to orchestrate CRTCs, encoders and connectors. You thus assume that the encoder hardware should be represented by a DRM encoder object, and that its output is connected to a connector that should be represented by a DRM connector object. While this can work in your use case, that won't always hold true. Hardware encoders can be chained together, while DRM encoders can't. The DRM core has recently received support for bridge objects to overcome that limitation. Depending on the hardware topology, a given hardware encoder should be modeled as a DRM encoder or as a DRM bridge. That decision shouldn't be taken by the encoder driver but by the DRM master driver. The I2C encoder driver thus shouldn't create the DRM encoder and DRM connector itself. I believe the encoder/master communication problem should be solved differently. Instead of passing a pointer to the DRM device to the encoder driver and making the encoder driver control DRM encoder and connector creation, the encoder driver should instead create an object not visible to userspace that can be retrieved by the DRM master driver (possibly through registration with the DRM core, or by going through drvdata in the encoder's struct device). The DRM master could use that object to communicate with the encoder, and would register the DRM encoder and DRM connector itself based on hardware topology. + struct i2c_client *i2c_client = to_i2c_client(dev); + struct tda998x_priv *priv = i2c_get_clientdata(i2c_client); + struct drm_connector *connector = priv-connector; + struct drm_encoder *encoder = priv-encoder; + int ret; + + if (!try_module_get(THIS_MODULE)) { + dev_err(dev, cannot get module %s\n, THIS_MODULE-name); + return -EINVAL; + } + + ret = drm_connector_init(drm, connector, + connector_funcs, + DRM_MODE_CONNECTOR_HDMIA); This is one example of the shortcomings I've explained above. An encoder driver can't always know what connector type it is connected to. If I'm not mistaken possible options here are DVII, DVID, HDMIA and HDMIB. It should be up to the master driver to select the connector type based on its overall view of the hardware, or even to a connector driver that would be bound to a connector DT node (as proposed in https://www.mail-archive.com/devicetree@vger.kernel.org/msg16585.html). + if (ret 0) + return ret; + drm_connector_helper_add(connector, connector_helper_funcs); + + ret = drm_encoder_init(drm, encoder, + encoder_funcs, + DRM_MODE_ENCODER_TMDS); + + encoder-possible_crtcs = 1;// 1 lcd_num + + if (ret 0) + goto err; + drm_encoder_helper_add(encoder, encoder_helper_funcs); + + ret =
[PATCH 1/1] media/usb/gspca: Add support for Scopium astro webcam (0547:7303)
This patch does not modify existing drivers. It adds subdriver to gspca for DTCS033 (Scopium) webcam for astrophotography. The patch adds dtcs033.c and modifies Kconfig and Makefile. Signed-off-by: Robert Butora robert.butora...@gmail.com --- drivers/media/usb/gspca/Kconfig | 10 + drivers/media/usb/gspca/Makefile | 2 + drivers/media/usb/gspca/dtcs033.c | 434 ++ 3 files changed, 446 insertions(+) create mode 100644 drivers/media/usb/gspca/dtcs033.c diff --git a/drivers/media/usb/gspca/Kconfig b/drivers/media/usb/gspca/Kconfig index 4f0c6d5..eed10d7 100644 --- a/drivers/media/usb/gspca/Kconfig +++ b/drivers/media/usb/gspca/Kconfig @@ -50,6 +50,16 @@ config USB_GSPCA_CPIA1 To compile this driver as a module, choose M here: the module will be called gspca_cpia1. +config USB_GSPCA_DTCS033 + tristate DTCS033 (Scopium) USB Astro-Camera Driver + depends on VIDEO_V4L2 USB_GSPCA + help + Say Y here if you want support for the Scopium camera + for planetary astrophotography. + + To compile this driver as a module, choose M here: the + module will be called gspca_dtcs033. + config USB_GSPCA_ETOMS tristate Etoms USB Camera Driver depends on VIDEO_V4L2 USB_GSPCA diff --git a/drivers/media/usb/gspca/Makefile b/drivers/media/usb/gspca/Makefile index 5855131..f46975e 100644 --- a/drivers/media/usb/gspca/Makefile +++ b/drivers/media/usb/gspca/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_USB_GSPCA) += gspca_main.o obj-$(CONFIG_USB_GSPCA_BENQ) += gspca_benq.o obj-$(CONFIG_USB_GSPCA_CONEX)+= gspca_conex.o obj-$(CONFIG_USB_GSPCA_CPIA1)+= gspca_cpia1.o +obj-$(CONFIG_USB_GSPCA_DTCS033) += gspca_dtcs033.o obj-$(CONFIG_USB_GSPCA_ETOMS)+= gspca_etoms.o obj-$(CONFIG_USB_GSPCA_FINEPIX) += gspca_finepix.o obj-$(CONFIG_USB_GSPCA_JEILINJ) += gspca_jeilinj.o @@ -48,6 +49,7 @@ gspca_main-objs := gspca.o autogain_functions.o gspca_benq-objs := benq.o gspca_conex-objs:= conex.o gspca_cpia1-objs:= cpia1.o +gspca_dtcs033-objs := dtcs033.o gspca_etoms-objs:= etoms.o gspca_finepix-objs := finepix.o gspca_jeilinj-objs := jeilinj.o diff --git a/drivers/media/usb/gspca/dtcs033.c b/drivers/media/usb/gspca/dtcs033.c new file mode 100644 index 000..ebe48a1 --- /dev/null +++ b/drivers/media/usb/gspca/dtcs033.c @@ -0,0 +1,434 @@ +/* + * Subdriver for Scopium astro-camera (DTCS033, 0547:7303) + * + * Copyright (C) 2014 Robert Butora (robert.butora...@gmail.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * 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. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME : fmt +#define MODULE_NAME dtcs033 +#include gspca.h + +MODULE_AUTHOR(Robert Butora robert.butora...@gmail.com); +MODULE_DESCRIPTION(Scopium DTCS033 astro-cam USB Camera Driver); +MODULE_LICENSE(GPL); + + +/* send a usb request */ +static void reg_rw(struct gspca_dev *gspca_dev, + u8 bRequestType, u8 bRequest, + u16 wValue, u16 wIndex, u16 wLength) +{ + struct usb_device *udev = gspca_dev-dev; + int ret; + + if (gspca_dev-usb_err 0) + return; + + ret = usb_control_msg(udev, + usb_rcvctrlpipe(udev, 0), + bRequest, + bRequestType, + wValue, wIndex, + gspca_dev-usb_buf, wLength, 500); + + if (ret 0) { + gspca_dev-usb_err = ret; + pr_err(usb_control_msg error %d\n, ret); + } + + return; +} +/* send several usb in/out requests */ +static int reg_reqs(struct gspca_dev *gspca_dev, + const struct usb_ctrlrequest *preqs, int n_reqs) +{ + int i = 0; + const struct usb_ctrlrequest *preq; + + while ((i n_reqs) (gspca_dev-usb_err = 0)) { + + preq = preqs[i]; + + reg_rw(gspca_dev, preq-bRequestType, preq-bRequest, + preq-wValue, preq-wIndex, preq-wLength); + + if (gspca_dev-usb_err 0) { + + PERR(usb error request no: %d / %d\n, + i, n_reqs); + } else if (preq-bRequestType USB_DIR_IN) { + + PDEBUG(D_STREAM, + USB IN (%d) returned[%d] %02X %02X %02X %s, + i, + preq-wLength, + gspca_dev-usb_buf[0], + gspca_dev-usb_buf[1], + gspca_dev-usb_buf[2], +
[linuxtv-media:master 453/499] WARNING: Comparing jiffies is almost always wrong; prefer time_after, time_before and friends
tree: git://linuxtv.org/media_tree.git master head: 8432164ddf7bfe40748ac49995356ab4dfda43b7 commit: 3d0c8fa3c5a0f9ffc4c3e8b4625ddeb875aee50b [453/499] [media] msi3101: convert to SDR API scripts/checkpatch.pl 0001-media-msi3101-convert-to-SDR-API.patch # many are suggestions rather than must-fix WARNING: line over 80 characters #369: drivers/staging/media/msi3101/sdr-msi3101.c:55: +#define V4L2_PIX_FMT_SDR_S8 v4l2_fourcc('D', 'S', '0', '8') /* signed 8-bit */ WARNING: line over 80 characters #370: drivers/staging/media/msi3101/sdr-msi3101.c:56: +#define V4L2_PIX_FMT_SDR_S12v4l2_fourcc('D', 'S', '1', '2') /* signed 12-bit */ WARNING: line over 80 characters #371: drivers/staging/media/msi3101/sdr-msi3101.c:57: +#define V4L2_PIX_FMT_SDR_S14v4l2_fourcc('D', 'S', '1', '4') /* signed 14-bit */ WARNING: line over 80 characters #372: drivers/staging/media/msi3101/sdr-msi3101.c:58: +#define V4L2_PIX_FMT_SDR_MSI2500_384 v4l2_fourcc('M', '3', '8', '4') /* Mirics MSi2500 format 384 */ WARNING: Unnecessary space before function pointer arguments #450: drivers/staging/media/msi3101/sdr-msi3101.c:151: + int (*convert_stream) (struct msi3101_state *s, u8 *dst, u8 *src, WARNING: line over 80 characters #553: drivers/staging/media/msi3101/sdr-msi3101.c:212: + sample_num[i] = src[3] 24 | src[2] 16 | src[1] 8 | src[0] 0; WARNING: Comparing jiffies is almost always wrong; prefer time_after, time_before and friends #588: drivers/staging/media/msi3101/sdr-msi3101.c:235: + if ((s-jiffies_next + msecs_to_jiffies(1)) = jiffies) { WARNING: line over 80 characters #590: drivers/staging/media/msi3101/sdr-msi3101.c:237: + unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s-jiffies_next); WARNING: Missing a blank line after declarations #592: drivers/staging/media/msi3101/sdr-msi3101.c:239: + unsigned int samples = sample_num[i_max - 1] - s-sample; + s-jiffies_next = jiffies_now; WARNING: Comparing jiffies is almost always wrong; prefer time_after, time_before and friends #798: drivers/staging/media/msi3101/sdr-msi3101.c:387: + if ((s-jiffies_next + msecs_to_jiffies(1)) = jiffies) { WARNING: line over 80 characters #801: drivers/staging/media/msi3101/sdr-msi3101.c:389: + unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s-jiffies_next); WARNING: Comparing jiffies is almost always wrong; prefer time_after, time_before and friends #884: drivers/staging/media/msi3101/sdr-msi3101.c:452: + if ((s-jiffies_next + msecs_to_jiffies(1)) = jiffies) { WARNING: line over 80 characters #887: drivers/staging/media/msi3101/sdr-msi3101.c:454: + unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s-jiffies_next); WARNING: line over 80 characters #933: drivers/staging/media/msi3101/sdr-msi3101.c:492: + sample_num[i] = src[3] 24 | src[2] 16 | src[1] 8 | src[0] 0; WARNING: Comparing jiffies is almost always wrong; prefer time_after, time_before and friends #958: drivers/staging/media/msi3101/sdr-msi3101.c:515: + if ((s-jiffies_next + msecs_to_jiffies(1)) = jiffies) { WARNING: line over 80 characters #960: drivers/staging/media/msi3101/sdr-msi3101.c:517: + unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s-jiffies_next); WARNING: Missing a blank line after declarations #962: drivers/staging/media/msi3101/sdr-msi3101.c:519: + unsigned int samples = sample_num[i_max - 1] - s-sample; + s-jiffies_next = jiffies_now; ERROR: space required after that ';' (ctx:VxV) #987: drivers/staging/media/msi3101/sdr-msi3101.c:539: + struct {signed int x:14;} se; ^ WARNING: Missing a blank line after declarations #1245: drivers/staging/media/msi3101/sdr-msi3101.c:1073: + u32 reg; + dev_dbg(s-udev-dev, %s: lna=%d mixer=%d if=%d\n, __func__, WARNING: Missing a blank line after declarations #1447: drivers/staging/media/msi3101/sdr-msi3101.c:1380: + int i; + dev_dbg(s-udev-dev, %s: pixelformat fourcc %4.4s\n, __func__, WARNING: Missing a blank line after declarations #1473: drivers/staging/media/msi3101/sdr-msi3101.c:1404: + int i; + dev_dbg(s-udev-dev, %s: pixelformat fourcc %4.4s\n, __func__, WARNING: Missing a blank line after declarations #1528: drivers/staging/media/msi3101/sdr-msi3101.c:1455: + int ret = 0; + dev_dbg(s-udev-dev, %s: tuner=%d type=%d\n, WARNING: Missing a blank line after declarations #1548: drivers/staging/media/msi3101/sdr-msi3101.c:1473: + int ret, band; + dev_dbg(s-udev-dev, %s: tuner=%d type=%d frequency=%u\n, WARNING: line over 80 characters #1559: drivers/staging/media/msi3101/sdr-msi3101.c:1484: + #define BAND_RF_0 ((bands_rf[0].rangehigh + bands_rf[1].rangelow) / 2) --- 0-DAY kernel build testing backend
Re: [PATCH 1/5] rc-main: add generic scancode filtering
On Fri, Feb 28, 2014 at 11:17:02PM +, James Hogan wrote: Add generic scancode filtering of RC input events, and fall back to permitting any RC_FILTER_NORMAL scancode filter to be set if no s_filter callback exists. This allows raw IR decoder events to be filtered, and potentially allows hardware decoders to set looser filters and rely on generic code to filter out the corner cases. Hi James, What's the purpose of providing the sw scancode filtering in the case where there's no hardware filtering support at all? (sorry that I'm replying so late...busy schedule :)) Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Mauro Carvalho Chehab m.che...@samsung.com Cc: Antti Seppälä a.sepp...@gmail.com Cc: linux-media@vger.kernel.org --- drivers/media/rc/rc-main.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 6448128..0a4f680 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -633,6 +633,7 @@ EXPORT_SYMBOL_GPL(rc_repeat); static void ir_do_keydown(struct rc_dev *dev, int scancode, u32 keycode, u8 toggle) { + struct rc_scancode_filter *filter; bool new_event = !dev-keypressed || dev-last_scancode != scancode || dev-last_toggle != toggle; @@ -640,6 +641,11 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode, if (new_event dev-keypressed) ir_do_keyup(dev, false); + /* Generic scancode filtering */ + filter = dev-scancode_filters[RC_FILTER_NORMAL]; + if (filter-mask ((scancode ^ filter-data) filter-mask)) + return; + input_event(dev-input_dev, EV_MSC, MSC_SCAN, scancode); if (new_event keycode != KEY_RESERVED) { @@ -1019,9 +1025,7 @@ static ssize_t show_filter(struct device *device, return -EINVAL; mutex_lock(dev-lock); - if (!dev-s_filter) - val = 0; - else if (fattr-mask) + if (fattr-mask) val = dev-scancode_filters[fattr-type].mask; else val = dev-scancode_filters[fattr-type].data; @@ -1069,7 +1073,7 @@ static ssize_t store_filter(struct device *device, return ret; /* Scancode filter not supported (but still accept 0) */ - if (!dev-s_filter) + if (!dev-s_filter fattr-type != RC_FILTER_NORMAL) return val ? -EINVAL : count; mutex_lock(dev-lock); @@ -1081,9 +1085,11 @@ static ssize_t store_filter(struct device *device, local_filter.mask = val; else local_filter.data = val; - ret = dev-s_filter(dev, fattr-type, local_filter); - if (ret 0) - goto unlock; + if (dev-s_filter) { + ret = dev-s_filter(dev, fattr-type, local_filter); + if (ret 0) + goto unlock; + } /* Success, commit the new filter */ *filter = local_filter; -- 1.8.3.2 -- 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 -- David Härdeman -- 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 v2 0/9] rc: Add IR encode based wakeup filtering
On Mon, Mar 17, 2014 at 10:34:25PM +, James Hogan wrote: It's ambiguous the other way too (which is probably a strong point against having actual protocol bits for each NEC variant, since they only differ in how the scancode is constructed). E.g. the Tivo keymap is 32-bit NEC, but has extended NEC scancodes where the bytes of the command are complements (i.e. the extended NEC command checksum passes). This makes it hard to filter on at the scancode level (the drivers will probably get it right for the hardware filters, but the software filter will likely get it wrong in those corner cases since it knows nothing of NEC). There's multiple ways the NEC scancode formats could be improved (incompatibly!) to reduce the problems, but none are perfect. E.g. one possibility is to scrap the NEC and extended NEC scancodes and just use 32-bit NEC scancodes format throughout: YES! All the knowledge of original NEC (16 bit), extended NEC, etc that have multiplied over both drivers and in various parts of rc-core is a big mistake IMHO. The only sane way of handling NEC is to always treat it as a 32 bit scancode (and only in cases where e.g. the hardware returns or expects a 16 bit value should the scancode be converted to/from the canonical 32 bit format). There is absolutely no advantages in trying to parse or understand the NEC format unless it absolutely cannot be avoided. I haven't had the time to really review your patches in depth, but whatever you do, please try to keep any knowledge of NEC 16/24/32 bit distinction out of any functionality you add. I had a suggested patch before which would also make the keymap handling 32-bit centric...essentially by redefining the set/get keymap ioctls a bit (with backwards compatibility that guesses if the scancode is 16/24/32 bit based). It's been on my todo list for a long time to dust it off...(yeah...I know)... 0x[16-bit-address][16-bit-command] which encodes scancodes for extended NEC like this: 0x[16-bit-address][~8-bit-command][8-bit-command] and normal NEC like this: 0x[~8-bit-address][8-bit-address][~8-bit-command][8-bit-command] Thanks James -- David Härdeman -- 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
cron job: media_tree daily build: OK
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Tue Mar 25 04:00:19 CET 2014 git branch: test git hash: 8432164ddf7bfe40748ac49995356ab4dfda43b7 gcc version:i686-linux-gcc (GCC) 4.8.2 sparse version: v0.5.0 host hardware: x86_64 host os:3.13-5.slh.4-amd64 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-exynos: OK linux-git-arm-mx: OK linux-git-arm-omap: OK linux-git-arm-omap1: OK linux-git-arm-pxa: OK linux-git-blackfin: OK linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.31.14-i686: OK linux-2.6.32.27-i686: OK linux-2.6.33.7-i686: OK linux-2.6.34.7-i686: OK linux-2.6.35.9-i686: OK linux-2.6.36.4-i686: OK linux-2.6.37.6-i686: OK linux-2.6.38.8-i686: OK linux-2.6.39.4-i686: OK linux-3.0.60-i686: OK linux-3.1.10-i686: OK linux-3.2.37-i686: OK linux-3.3.8-i686: OK linux-3.4.27-i686: OK linux-3.5.7-i686: OK linux-3.6.11-i686: OK linux-3.7.4-i686: OK linux-3.8-i686: OK linux-3.9.2-i686: OK linux-3.10.1-i686: OK linux-3.11.1-i686: OK linux-3.12-i686: OK linux-3.13-i686: OK linux-3.14-rc1-i686: OK linux-2.6.31.14-x86_64: OK linux-2.6.32.27-x86_64: OK linux-2.6.33.7-x86_64: OK linux-2.6.34.7-x86_64: OK linux-2.6.35.9-x86_64: OK linux-2.6.36.4-x86_64: OK linux-2.6.37.6-x86_64: OK linux-2.6.38.8-x86_64: OK linux-2.6.39.4-x86_64: OK linux-3.0.60-x86_64: OK linux-3.1.10-x86_64: OK linux-3.2.37-x86_64: OK linux-3.3.8-x86_64: OK linux-3.4.27-x86_64: OK linux-3.5.7-x86_64: OK linux-3.6.11-x86_64: OK linux-3.7.4-x86_64: OK linux-3.8-x86_64: OK linux-3.9.2-x86_64: OK linux-3.10.1-x86_64: OK linux-3.11.1-x86_64: OK linux-3.12-x86_64: OK linux-3.13-x86_64: OK linux-3.14-rc1-x86_64: OK apps: OK spec-git: OK sparse version: v0.5.0 sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Tuesday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Tuesday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- 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] [media] uvcvideo: Fix marking buffer erroneous in case of FID toggling
Set error bit for incomplete buffers when end of buffer is detected by FID toggling (for example when last transaction with EOF is lost). This prevents passing incomplete buffers to the userspace. Signed-off-by: Anton Leontiev bun...@t-25.ru --- drivers/media/usb/uvc/uvc_video.c | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 8d52baf..57c9a4b 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -1133,6 +1133,17 @@ static int uvc_video_encode_data(struct uvc_streaming *stream, */ /* + * Set error flag for incomplete buffer. + */ +static void uvc_buffer_check_bytesused(const struct uvc_streaming *const stream, + struct uvc_buffer *const buf) +{ + if (buf-length != buf-bytesused + !(stream-cur_format-flags UVC_FMT_FLAG_COMPRESSED)) + buf-error = 1; +} + +/* * Completion handler for video URBs. */ static void uvc_video_decode_isoc(struct urb *urb, struct uvc_streaming *stream, @@ -1156,9 +1167,11 @@ static void uvc_video_decode_isoc(struct urb *urb, struct uvc_streaming *stream, do { ret = uvc_video_decode_start(stream, buf, mem, urb-iso_frame_desc[i].actual_length); - if (ret == -EAGAIN) + if (ret == -EAGAIN) { + uvc_buffer_check_bytesused(stream, buf); buf = uvc_queue_next_buffer(stream-queue, buf); + } } while (ret == -EAGAIN); if (ret 0) @@ -1173,11 +1186,7 @@ static void uvc_video_decode_isoc(struct urb *urb, struct uvc_streaming *stream, urb-iso_frame_desc[i].actual_length); if (buf-state == UVC_BUF_STATE_READY) { - if (buf-length != buf-bytesused - !(stream-cur_format-flags - UVC_FMT_FLAG_COMPRESSED)) - buf-error = 1; - + uvc_buffer_check_bytesused(stream, buf); buf = uvc_queue_next_buffer(stream-queue, buf); } } -- 1.9.1 -- 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
[GIT PULL FOR v3.15] Davinci media fixes
Hi Mauro, Please pull the following patches which are fixes for various davinci media drivers. Thanks, --Prabhakar Lad The following changes since commit 8432164ddf7bfe40748ac49995356ab4dfda43b7: [media] Sensoray 2255 uses videobuf2 (2014-03-24 17:23:43 -0300) are available in the git repository at: git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git for_mauro for you to fetch changes up to ef981f26167ec6afc8c9038a99ed28a149bac819: staging: media: davinci: vpfe: make sure all the buffers are released (2014-03-25 11:08:24 +0530) Lad, Prabhakar (5): media: davinci: vpif_capture: fix releasing of active buffers media: davinci: vpif_display: fix releasing of active buffers media: davinci: vpbe_display: fix releasing of active buffers media: davinci: vpfe: make sure all the buffers unmapped and released staging: media: davinci: vpfe: make sure all the buffers are released drivers/media/platform/davinci/vpbe_display.c | 16 ++- drivers/media/platform/davinci/vpfe_capture.c |2 ++ drivers/media/platform/davinci/vpif_capture.c | 34 +++--- drivers/media/platform/davinci/vpif_display.c | 35 +++ drivers/staging/media/davinci_vpfe/vpfe_video.c | 13 +++-- 5 files changed, 74 insertions(+), 26 deletions(-) -- 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