Re: [PATCH V2 2/2] si2165: do load firmware without extra header
On 01.10.2014 07:58, Matthias Schwarzott wrote: The new file has a different name: dvb-demod-si2165-d.fw Count blocks instead of reading count from extra header. Calculate CRC during upload and compare result to what chip calcuated. Use 0x01 instead of real patch version, because this is only used to check if something was uploaded but not to check the version of it. V2: change firmware filename to lower case. Signed-off-by: Matthias Schwarzott z...@gentoo.org Hi Mauro, if you think it is necessary for not breaking userspace, I can change the patch to fall back to the old firmware file if the new one does not exists. Ignoring the additional header is simple. Regards Matthias -- 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: Dell XPS 12 Camera issues
Hi Laurent, Apologies for my late reply. [...] I searched here for some time before posting and haven't found the answer as of yet. Perhaps my search'foo isn't really there and to tell you the truth cameras and what not are a weak spot for me. Never really cared about them until now. Man I just need some ideas. So far the first 9 pages of google are purple (clicked) links. I've 5 pages of strace that I'm going through tonight. Anyone else out there have this issue with the XPS line? Any direction is much appreciated. I'll feel like a real idiot if a quick post and a link resolves it. This mail thread might be related: http://www.spinics.net/lists/linux- media/msg73460.html Mark, have you managed to finish carrying on your investigations ? The problems I was encountering were on the Dell XPS12 under Ubuntu. Note that these problems were clearly evident in guvcview. Some of the low resolution yuv modes worked in guvcview but most did not. None of the JPEG modes worked. So, if Matt is experiencing no problems with any of the resolutions in guvcivew, he's seeing a different issue. I'm afraid that I never really resolved the issue. It's been quite a while since I looked at this but my conclusion was that there was nothing wrong with uvcvideo. When I compared the usb logs for Windows and Ubuntu for the same resolution, I could see that the requests sent by Windows and Ubuntu to setup the resolution and initiate streaming were almost identical (and I actually modified uvcvideo to make them identical). However, the data return was not. In Windows the data was correctly formatted. In Ubuntu it was not. Had uvcvideo received the data sent by the camera under Windows, the camera would have operated correctly. My conclusion was that the issue was therefore either lower down in the Linux USB stack or there was some camera configuration magic going on in Windows which was necessary for the camera to operate correctly. But at that point I switched laptop and stopped investigating. Sorry I can't be of more help, Best regards, Mark - Intel Corporation SAS (French simplified joint stock company) Registered headquarters: Les Montalets- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- 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: uvcvideo fails on 3.16 and 3.17 kernels
Laurent hi, 2014-09-30 23:31 GMT+01:00 Laurent Pinchart laurent.pinch...@ideasonboard.com: Hi Paulo, Thank you for investigation this. On Tuesday 30 September 2014 13:56:15 Paulo Assis wrote: Ok, so I've set a workaround in guvcview, it now uses the length filed if bytesused is set to zero. Anyway I think this violates the v4l2 api: http://linuxtv.org/downloads/v4l-dvb-apis/buffer.html bytesused - ..., Drivers must set this field when type refers to an input stream, ... without this value we have no way of knowing the exact frame size for compressed formats. And this was working in uvcvideo up until 3.16, I don't know how many userspace apps rely on this value, but at least guvcview does, and it's currently broken for uvcvideo devices in the latest kernels. It took me some time to debug the problem, and I think the problem is actually on guvcview's side. When dequeuing a video buffer, the application requeues it immediately before processing the buffer's contents. The VIDIOC_QBUF ioctl will reset the bytesused field to 0. While you could work around the problem by using a different struct v4l2_buffer instance for the VIDIOC_QBUF call, the V4L2 doesn't allow userspace application to access a queued buffer. You must process the buffer before requeuing it. I though this was why we requested multiple buffers. If this is true then using just one buffer is enough, also using multiple threads to process frame data seems useless in this case, since we need to process the buffer before queueing the next one. I thought one could request 4 buffers for mmap and do: VIDIOC_DQBUF data-buf[0] VIDIOC_QBUF driver queues-buf[1] process buf[0] VIDIOC_DQBUF data-buf[1] VIDIOC_QBUF driver queues-buf[2] process buf[1] VIDIOC_DQBUF data-buf[2] VIDIOC_QBUF driver queues-buf[3] process buf[2] VIDIOC_DQBUF data-buf[3] VIDIOC_QBUF driver queues-buf[0] process buf[3] Now if we need to process the buffer between VIDIOC_DQBUF and VIDIOC_QBUF, whats the point in using more than one buffer ? Regards, Paulo 2014-09-30 9:50 GMT+01:00 Paulo Assis pj.as...@gmail.com: I referring to the following bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1362358 I've run some tests and after increasing verbosity for uvcvideo, I get: EOF on empty payload this seems consistent with the zero size frames returned by the driver. After VIDIOC_DQBUF | VIDIOC_QBUF, I get buf.bytesused=0 Testing with an eye toy 2 (gspca), everything works fine, so this is definitly related to uvcvideo. This happens on all available formats (YUYV and MJPEG) -- 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: uvcvideo fails on 3.16 and 3.17 kernels
Hi Paulo, On Wednesday 01 October 2014 11:48:26 Paulo Assis wrote: Laurent hi, 2014-09-30 23:31 GMT+01:00 Laurent Pinchart: Hi Paulo, Thank you for investigation this. On Tuesday 30 September 2014 13:56:15 Paulo Assis wrote: Ok, so I've set a workaround in guvcview, it now uses the length filed if bytesused is set to zero. Anyway I think this violates the v4l2 api: http://linuxtv.org/downloads/v4l-dvb-apis/buffer.html bytesused - ..., Drivers must set this field when type refers to an input stream, ... without this value we have no way of knowing the exact frame size for compressed formats. And this was working in uvcvideo up until 3.16, I don't know how many userspace apps rely on this value, but at least guvcview does, and it's currently broken for uvcvideo devices in the latest kernels. It took me some time to debug the problem, and I think the problem is actually on guvcview's side. When dequeuing a video buffer, the application requeues it immediately before processing the buffer's contents. The VIDIOC_QBUF ioctl will reset the bytesused field to 0. While you could work around the problem by using a different struct v4l2_buffer instance for the VIDIOC_QBUF call, the V4L2 doesn't allow userspace application to access a queued buffer. You must process the buffer before requeuing it. I though this was why we requested multiple buffers. If this is true then using just one buffer is enough, also using multiple threads to process frame data seems useless in this case, since we need to process the buffer before queueing the next one. I thought one could request 4 buffers for mmap and do: VIDIOC_DQBUF data-buf[0] VIDIOC_QBUF driver queues-buf[1] process buf[0] VIDIOC_DQBUF data-buf[1] VIDIOC_QBUF driver queues-buf[2] process buf[1] VIDIOC_DQBUF data-buf[2] VIDIOC_QBUF driver queues-buf[3] process buf[2] VIDIOC_DQBUF data-buf[3] VIDIOC_QBUF driver queues-buf[0] process buf[3] That's certainly valid. However, if I'm not mistaken, after dequeuing buffer i you immediately requeue the same buffer, not buffer i+1. What you should do is queueing all buffers right before starting the stream (I think you're doing fine there, but I haven't double-checked), and then, when a buffer is available, perform the following sequence. VIDIOC_DQBUF() - returns buffer i process buffer i VIDIOC_QBUF(buffer i) You can perform processing in a different thread if needed, the important part being not to requeue the buffer before userspace is done with it. The bug that caused guvcview to stop functioning is in v4l2_core.c. memset(vd-buf, 0, sizeof(struct v4l2_buffer)); vd-buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; vd-buf.memory = V4L2_MEMORY_MMAP; ret = xioctl(vd-fd, VIDIOC_DQBUF, vd-buf); if(!ret) { /* * driver timestamp is unreliable * use monotonic system time */ vd-timestamp = ns_time_monotonic(); /* queue the buffers */ ret = xioctl(vd-fd, VIDIOC_QBUF, vd-buf); ... } The VIDIOC_DQBUF call will return the correct bytesused value in vd- buf.bytesused, but the VIDIOC_QBUF call then resets that value to 0. As a quick workaround while you fix the buffer processing sequence, you can copy vd-buf into a new local v4l2_buffer variable after calling VIDIOC_DQBUF, and use that local variable in the VIDIOC_QBUF call. Note that you will still violate the V4L2 API as you're not allowed to touch a buffer after requeuing it, but it should hide the problem and get guvcview to display images again. Now if we need to process the buffer between VIDIOC_DQBUF and VIDIOC_QBUF, whats the point in using more than one buffer ? -- 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: uvcvideo fails on 3.16 and 3.17 kernels
Laurent, OK, I undersdant what I'm doing wrong now. I don't see any other solution in order to follow the v4l2 api, than to copy the mmap data into another buffer that will be used in frame processing, and then requeue. Guvcview processes frame data in several different threads and I don't want to wait for processing to finish before requeing, I just want to call the get_frame function from whathever thread and be done with it. This solution however forces a mem copy that the mmap operation intends to avoid. Best regards, Paulo 2014-10-01 12:05 GMT+01:00 Laurent Pinchart laurent.pinch...@ideasonboard.com: Hi Paulo, On Wednesday 01 October 2014 11:48:26 Paulo Assis wrote: Laurent hi, 2014-09-30 23:31 GMT+01:00 Laurent Pinchart: Hi Paulo, Thank you for investigation this. On Tuesday 30 September 2014 13:56:15 Paulo Assis wrote: Ok, so I've set a workaround in guvcview, it now uses the length filed if bytesused is set to zero. Anyway I think this violates the v4l2 api: http://linuxtv.org/downloads/v4l-dvb-apis/buffer.html bytesused - ..., Drivers must set this field when type refers to an input stream, ... without this value we have no way of knowing the exact frame size for compressed formats. And this was working in uvcvideo up until 3.16, I don't know how many userspace apps rely on this value, but at least guvcview does, and it's currently broken for uvcvideo devices in the latest kernels. It took me some time to debug the problem, and I think the problem is actually on guvcview's side. When dequeuing a video buffer, the application requeues it immediately before processing the buffer's contents. The VIDIOC_QBUF ioctl will reset the bytesused field to 0. While you could work around the problem by using a different struct v4l2_buffer instance for the VIDIOC_QBUF call, the V4L2 doesn't allow userspace application to access a queued buffer. You must process the buffer before requeuing it. I though this was why we requested multiple buffers. If this is true then using just one buffer is enough, also using multiple threads to process frame data seems useless in this case, since we need to process the buffer before queueing the next one. I thought one could request 4 buffers for mmap and do: VIDIOC_DQBUF data-buf[0] VIDIOC_QBUF driver queues-buf[1] process buf[0] VIDIOC_DQBUF data-buf[1] VIDIOC_QBUF driver queues-buf[2] process buf[1] VIDIOC_DQBUF data-buf[2] VIDIOC_QBUF driver queues-buf[3] process buf[2] VIDIOC_DQBUF data-buf[3] VIDIOC_QBUF driver queues-buf[0] process buf[3] That's certainly valid. However, if I'm not mistaken, after dequeuing buffer i you immediately requeue the same buffer, not buffer i+1. What you should do is queueing all buffers right before starting the stream (I think you're doing fine there, but I haven't double-checked), and then, when a buffer is available, perform the following sequence. VIDIOC_DQBUF() - returns buffer i process buffer i VIDIOC_QBUF(buffer i) You can perform processing in a different thread if needed, the important part being not to requeue the buffer before userspace is done with it. The bug that caused guvcview to stop functioning is in v4l2_core.c. memset(vd-buf, 0, sizeof(struct v4l2_buffer)); vd-buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; vd-buf.memory = V4L2_MEMORY_MMAP; ret = xioctl(vd-fd, VIDIOC_DQBUF, vd-buf); if(!ret) { /* * driver timestamp is unreliable * use monotonic system time */ vd-timestamp = ns_time_monotonic(); /* queue the buffers */ ret = xioctl(vd-fd, VIDIOC_QBUF, vd-buf); ... } The VIDIOC_DQBUF call will return the correct bytesused value in vd- buf.bytesused, but the VIDIOC_QBUF call then resets that value to 0. As a quick workaround while you fix the buffer processing sequence, you can copy vd-buf into a new local v4l2_buffer variable after calling VIDIOC_DQBUF, and use that local variable in the VIDIOC_QBUF call. Note that you will still violate the V4L2 API as you're not allowed to touch a buffer after requeuing it, but it should hide the problem and get guvcview to display images again. Now if we need to process the buffer between VIDIOC_DQBUF and VIDIOC_QBUF, whats the point in using more than one buffer ? -- 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: uvcvideo fails on 3.16 and 3.17 kernels
On 10/01/14 13:53, Paulo Assis wrote: Laurent, OK, I undersdant what I'm doing wrong now. I don't see any other solution in order to follow the v4l2 api, than to copy the mmap data into another buffer that will be used in frame processing, and then requeue. Guvcview processes frame data in several different threads and I don't want to wait for processing to finish before requeing, I just want to call the get_frame function from whathever thread and be done with it. This solution however forces a mem copy that the mmap operation intends to avoid. Once you requeue the buffer you no longer control it and it is owned by the driver, which may sync the buffer for the device making it unreliable to read from by the cpu (esp. on non-Intel architectures). And of course it will be used to capture frames, so the contents can be modified while you are still processing. In other words, you should wait with requeuing the buffer until after processing. What's strange about that? This is nothing new. You certainly don't want to copy the buffers, that's nuts. Just fix the application to postpone calling QBUF until after processing is done. Regards, Hans Best regards, Paulo 2014-10-01 12:05 GMT+01:00 Laurent Pinchart laurent.pinch...@ideasonboard.com: Hi Paulo, On Wednesday 01 October 2014 11:48:26 Paulo Assis wrote: Laurent hi, 2014-09-30 23:31 GMT+01:00 Laurent Pinchart: Hi Paulo, Thank you for investigation this. On Tuesday 30 September 2014 13:56:15 Paulo Assis wrote: Ok, so I've set a workaround in guvcview, it now uses the length filed if bytesused is set to zero. Anyway I think this violates the v4l2 api: http://linuxtv.org/downloads/v4l-dvb-apis/buffer.html bytesused - ..., Drivers must set this field when type refers to an input stream, ... without this value we have no way of knowing the exact frame size for compressed formats. And this was working in uvcvideo up until 3.16, I don't know how many userspace apps rely on this value, but at least guvcview does, and it's currently broken for uvcvideo devices in the latest kernels. It took me some time to debug the problem, and I think the problem is actually on guvcview's side. When dequeuing a video buffer, the application requeues it immediately before processing the buffer's contents. The VIDIOC_QBUF ioctl will reset the bytesused field to 0. While you could work around the problem by using a different struct v4l2_buffer instance for the VIDIOC_QBUF call, the V4L2 doesn't allow userspace application to access a queued buffer. You must process the buffer before requeuing it. I though this was why we requested multiple buffers. If this is true then using just one buffer is enough, also using multiple threads to process frame data seems useless in this case, since we need to process the buffer before queueing the next one. I thought one could request 4 buffers for mmap and do: VIDIOC_DQBUF data-buf[0] VIDIOC_QBUF driver queues-buf[1] process buf[0] VIDIOC_DQBUF data-buf[1] VIDIOC_QBUF driver queues-buf[2] process buf[1] VIDIOC_DQBUF data-buf[2] VIDIOC_QBUF driver queues-buf[3] process buf[2] VIDIOC_DQBUF data-buf[3] VIDIOC_QBUF driver queues-buf[0] process buf[3] That's certainly valid. However, if I'm not mistaken, after dequeuing buffer i you immediately requeue the same buffer, not buffer i+1. What you should do is queueing all buffers right before starting the stream (I think you're doing fine there, but I haven't double-checked), and then, when a buffer is available, perform the following sequence. VIDIOC_DQBUF() - returns buffer i process buffer i VIDIOC_QBUF(buffer i) You can perform processing in a different thread if needed, the important part being not to requeue the buffer before userspace is done with it. The bug that caused guvcview to stop functioning is in v4l2_core.c. memset(vd-buf, 0, sizeof(struct v4l2_buffer)); vd-buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; vd-buf.memory = V4L2_MEMORY_MMAP; ret = xioctl(vd-fd, VIDIOC_DQBUF, vd-buf); if(!ret) { /* * driver timestamp is unreliable * use monotonic system time */ vd-timestamp = ns_time_monotonic(); /* queue the buffers */ ret = xioctl(vd-fd, VIDIOC_QBUF, vd-buf); ... } The VIDIOC_DQBUF call will return the correct bytesused value in vd- buf.bytesused, but the VIDIOC_QBUF call then resets that value to 0. As a quick workaround while you fix the buffer processing sequence, you can copy vd-buf into a new local v4l2_buffer variable after calling VIDIOC_DQBUF, and use that local variable in the VIDIOC_QBUF call. Note that you will still violate the V4L2 API as you're not allowed to touch a buffer after requeuing it, but it should hide the problem
Re: [PATCH 00/10] CODA7 JPEG support
Le 2014-09-30 10:34, Kamil Debski a écrit : I agree with you Hans. MFC has a single encoder node that supports multiple codecs and I think this design works well. JPEG should be separated into separate device. Having combined encoders and combines decoders works well from application / gstreamer point of view too. It's only combine encoder and decoder that causes issues with our ability to probe what the HW is capable (without a need to know about the platform). Exynos has split JPEG decoder because it's not the same HW backing it. cheers, Nicolas -- 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 00/10] CODA7 JPEG support
Am Mittwoch, den 01.10.2014, 09:33 -0400 schrieb Nicolas Dufresne: Le 2014-09-30 10:34, Kamil Debski a écrit : I agree with you Hans. MFC has a single encoder node that supports multiple codecs and I think this design works well. JPEG should be separated into separate device. Having combined encoders and combines decoders works well from application / gstreamer point of view too. It's only combine encoder and decoder that causes issues with our ability to probe what the HW is capable (without a need to know about the platform). Exynos has split JPEG decoder because it's not the same HW backing it. Alright, I'll merge the H.264 and MPEG4 encoder devices again and resend the series tomorrow. thanks Philipp -- 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
Tevii S480 on Unicable SCR System
Hi, i have a development computer with a Tevii S480 connected to a Satellite channel router (EN50494). As long as I haven't started a video application this computers blocks any other receiver connected to this cable. I have measured the output of the Tevii card and found, that after start of the computer, the output is set to 18V. This is not reset after loading and initializing the drivers. So no other receiver could sent DiSEqC commands to the SCR until a video application at this computer initializes the voltage correctly. I think the voltage needs to be switched off until this card is really in use by an application. I have patched the file drivers/media/dvb-frontends/ds3000.c to initialize the voltage to OFF, which works for me. But I am not sure, if this is really the correct solution: --- ds3000.orig 2014-10-01 19:41:37.611631299 +0200 +++ ds3000.c2014-10-01 20:18:19.602930920 +0200 @@ -864,6 +864,7 @@ memcpy(state-frontend.ops, ds3000_ops, sizeof(struct dvb_frontend_ops)); state-frontend.demodulator_priv = state; + ds3000_set_voltage (state-frontend, SEC_VOLTAGE_OFF); return state-frontend; error3: --- Best Regards Uli -- Ulrich Eckhardt http://www.uli-eckhardt.de Ein Blitzableiter auf dem Kirchturm ist das denkbar stärkste Misstrauensvotum gegen den lieben Gott. (Karl Krauss) -- 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] pt3 (PCI, tc90522, mxl301rf, qm1d1c0042): pt3_unregister_subdev(), pt3_unregister_subdev(),...
[DVB driver for Earthsoft PT3 PCIE ISDB-S/T receiver] Status: working, tested Changes: - demod tuners converted to I2C binding model - i586 x86_64 clean compile - lightweight yet precise CNR calculus - raw CNR (DVBv3) - DVBv5 CNR @ 0.0001 dB (ref: include/uapi/linux/dvb/frontend.h, not 1/1000 dB!) - removed (unused?) tuner's *_release() - demod/tuner binding: pt3_unregister_subdev(), pt3_unregister_subdev() Features: - tuning enhancements (compared to PT1 DVB) 1. in addition to the real frequency: ISDB-S : freq. channel ID ISDB-T : freq# (I/O# +128), ch#, ch# +64 for CATV 2. in addition to TSID: ISDB-S : slot# - allocated devices ISDB-S : /dev/dvb/adapter0, /dev/dvb/adapter1 ISDB-T : /dev/dvb/adapter2, /dev/dvb/adapter3 Main components: 1. SharpVA4M6JC2103 : contains 2 ISDB-S + 2 ISDB-T tuners ISDB-S : Sharp QM1D1C0042 RF-IC ISDB-T : MaxLinear CMOS Hybrid TV MxL301RF 2. Toshiba TC90522XBG : quad demodulator (2ch OFDM + 2ch 8PSK) 3. Altera EP4CGX15BF14C8N : customized FPGA PCI bridge Full package: - URL: https://github.com/knight-rider/ptx/tree/master/pt3_dvb2 - buildable as standalone, DKMS or tree embedded module - installation: $ chmod +x dkms.install dkms.uninstall $ ./dkms.install Signed-off-by: Буди Романто, AreMa Inc knightri...@are.ma --- drivers/media/dvb-frontends/Kconfig |6 +- drivers/media/dvb-frontends/Makefile |1 + drivers/media/dvb-frontends/tc90522.c | 1145 - drivers/media/dvb-frontends/tc90522.h | 39 +- drivers/media/pci/pt3/Kconfig | 11 +- drivers/media/pci/pt3/Makefile|8 +- drivers/media/pci/pt3/pt3_common.h| 85 +++ drivers/media/pci/pt3/pt3_dma.c | 461 - drivers/media/pci/pt3/pt3_dma.h | 50 ++ drivers/media/pci/pt3/pt3_i2c.c | 281 drivers/media/pci/pt3/pt3_i2c.h | 25 + drivers/media/pci/pt3/pt3_pci.c | 435 + drivers/media/tuners/mxl301rf.c | 549 drivers/media/tuners/mxl301rf.h | 23 +- drivers/media/tuners/qm1d1c0042.c | 646 +-- drivers/media/tuners/qm1d1c0042.h | 32 +- 16 files changed, 2058 insertions(+), 1739 deletions(-) create mode 100644 drivers/media/pci/pt3/pt3_common.h create mode 100644 drivers/media/pci/pt3/pt3_dma.h create mode 100644 drivers/media/pci/pt3/pt3_i2c.h create mode 100644 drivers/media/pci/pt3/pt3_pci.c diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index 5a13454..39fef85 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig @@ -621,7 +621,7 @@ config DVB_S5H1411 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want to support this frontend. -comment ISDB-T (terrestrial) frontends +comment ISDB-S (satellite) ISDB-T (terrestrial) frontends depends on DVB_CORE config DVB_S921 @@ -649,11 +649,11 @@ config DVB_MB86A20S Say Y when you want to support this frontend. config DVB_TC90522 - tristate Toshiba TC90522 + tristate Toshiba TC90522XBG 8PSK(ISDB-S)/OFDM(ISDB-T) depends on DVB_CORE I2C default m if !MEDIA_SUBDRV_AUTOSELECT help - A Toshiba TC90522 2xISDB-T + 2xISDB-S demodulator. + Toshiba TC90522XBG 8PSK(ISDB-S)/OFDM(ISDB-T) quad demodulator. Say Y when you want to support this frontend. comment Digital terrestrial only tuners/PLL diff --git a/drivers/media/dvb-frontends/Makefile b/drivers/media/dvb-frontends/Makefile index ba59df6..6f05615 100644 --- a/drivers/media/dvb-frontends/Makefile +++ b/drivers/media/dvb-frontends/Makefile @@ -116,3 +116,4 @@ obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o obj-$(CONFIG_DVB_AF9033) += af9033.o obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o obj-$(CONFIG_DVB_TC90522) += tc90522.o + diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c index d9905fb..954ca8d 100644 --- a/drivers/media/dvb-frontends/tc90522.c +++ b/drivers/media/dvb-frontends/tc90522.c @@ -1,12 +1,12 @@ /* - * Toshiba TC90522 Demodulator + * Toshiba TC90522XBG 2ch OFDM(ISDB-T) + 2ch 8PSK(ISDB-S) demodulator frontend for Earthsoft PT3 * - * Copyright (C) 2014 Akihiro Tsukada tsk...@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 version 2. + * Copyright (C) 2014 Budi Rachmanto, AreMa Inc. i...@are.ma * + * 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 + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY;
randconfig build error with next-20141001, in drivers/media/platform/s5p-tv/hdmiphy_drv.c
Building with the attached random configuration file, drivers/media/platform/s5p-tv/hdmiphy_drv.c: In function ‘hdmiphy_s_dv_timings’: drivers/media/platform/s5p-tv/hdmiphy_drv.c:216:2: error: implicit declaration of function ‘i2c_master_send’ [-Werror=implicit-function-declaration] ret = i2c_master_send(client, buffer, 32); ^ drivers/media/platform/s5p-tv/hdmiphy_drv.c: At top level: drivers/media/platform/s5p-tv/hdmiphy_drv.c:325:1: warning: data definition has no type or storage class [enabled by default] module_i2c_driver(hdmiphy_driver); ^ drivers/media/platform/s5p-tv/hdmiphy_drv.c:325:1: error: type defaults to ‘int’ in declaration of ‘module_i2c_driver’ [-Werror=implicit-int] drivers/media/platform/s5p-tv/hdmiphy_drv.c:325:1: warning: parameter names (without types) in function declaration [enabled by default] drivers/media/platform/s5p-tv/hdmiphy_drv.c:315:26: warning: ‘hdmiphy_driver’ defined but not used [-Wunused-variable] static struct i2c_driver hdmiphy_driver = { ^ cc1: some warnings being treated as errors make[4]: *** [drivers/media/platform/s5p-tv/hdmiphy_drv.o] Error 1 # # Automatically generated file; DO NOT EDIT. # Linux/x86 3.17.0-rc7 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y CONFIG_X86=y CONFIG_INSTRUCTION_DECODER=y CONFIG_OUTPUT_FORMAT=elf32-i386 CONFIG_ARCH_DEFCONFIG=arch/x86/configs/i386_defconfig CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_MMU=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_HWEIGHT=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_ARCH_HAS_CPU_RELAX=y CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y # CONFIG_ZONE_DMA32 is not set # CONFIG_AUDIT_ARCH is not set CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_X86_32_LAZY_GS=y CONFIG_ARCH_HWEIGHT_CFLAGS=-fcall-saved-ecx -fcall-saved-edx CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_EXTABLE_SORT=y # # General setup # CONFIG_BROKEN_ON_SMP=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE= CONFIG_COMPILE_TEST=y CONFIG_LOCALVERSION= # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KERNEL_XZ=y CONFIG_HAVE_KERNEL_LZO=y CONFIG_HAVE_KERNEL_LZ4=y CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_BZIP2 is not set # CONFIG_KERNEL_LZMA is not set # CONFIG_KERNEL_XZ is not set # CONFIG_KERNEL_LZO is not set # CONFIG_KERNEL_LZ4 is not set CONFIG_DEFAULT_HOSTNAME=(none) # CONFIG_SYSVIPC is not set CONFIG_CROSS_MEMORY_ATTACH=y # CONFIG_FHANDLE is not set # CONFIG_USELIB is not set CONFIG_HAVE_ARCH_AUDITSYSCALL=y # # IRQ subsystem # CONFIG_GENERIC_IRQ_PROBE=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_DEBUG=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_SPARSE_IRQ=y CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y CONFIG_GENERIC_CMOS_UPDATE=y # # Timers subsystem # CONFIG_HZ_PERIODIC=y # CONFIG_NO_HZ_IDLE is not set # CONFIG_NO_HZ is not set # CONFIG_HIGH_RES_TIMERS is not set # # CPU/Task time and stats accounting # CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_IRQ_TIME_ACCOUNTING is not set CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y # # RCU Subsystem # CONFIG_TINY_RCU=y # CONFIG_TASKS_RCU is not set # CONFIG_RCU_STALL_COMMON is not set # CONFIG_TREE_RCU_TRACE is not set # CONFIG_BUILD_BIN2C is not set # CONFIG_IKCONFIG is not set CONFIG_LOG_BUF_SHIFT=17 CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y CONFIG_CGROUPS=y CONFIG_CGROUP_DEBUG=y # CONFIG_CGROUP_FREEZER is not set CONFIG_CGROUP_DEVICE=y # CONFIG_CPUSETS is not set CONFIG_CGROUP_CPUACCT=y # CONFIG_RESOURCE_COUNTERS is not set # CONFIG_CGROUP_PERF is not set CONFIG_CGROUP_SCHED=y CONFIG_FAIR_GROUP_SCHED=y # CONFIG_CFS_BANDWIDTH is not set # CONFIG_RT_GROUP_SCHED is not set # CONFIG_CHECKPOINT_RESTORE is not set CONFIG_NAMESPACES=y CONFIG_UTS_NS=y CONFIG_USER_NS=y CONFIG_PID_NS=y CONFIG_SCHED_AUTOGROUP=y # CONFIG_SYSFS_DEPRECATED is not set # CONFIG_RELAY is not set CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE= # CONFIG_RD_GZIP is not set # CONFIG_RD_BZIP2 is not set # CONFIG_RD_LZMA is not set CONFIG_RD_XZ=y CONFIG_RD_LZO=y CONFIG_RD_LZ4=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_LTO_MENU=y # CONFIG_LTO_DISABLE is not set
Re: [PATCH V2 05/13] cx231xx: Modifiy the symbolic constants for i2c ports and describe
Reviewed-by: Antti Palosaari cr...@iki.fi Antti On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: Change to I2C_0 ... I2C_2 for the master ports and add I2C_1_MUX_1 and I2C_1_MUX_3 for the muxed ones. V2: Renamed mux adapters to seperate them from master adapters. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx.h | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index c92382f..377216b 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -322,10 +322,11 @@ enum cx231xx_decoder { }; enum CX231XX_I2C_MASTER_PORT { - I2C_0 = 0, - I2C_1 = 1, - I2C_2 = 2, - I2C_3 = 3 + I2C_0 = 0, /* master 0 - internal connection */ + I2C_1 = 1, /* master 1 - used with mux */ + I2C_2 = 2, /* master 2 */ + I2C_1_MUX_1 = 3, /* master 1 - port 1 (I2C_DEMOD_EN = 0) */ + I2C_1_MUX_3 = 4 /* master 1 - port 3 (I2C_DEMOD_EN = 1) */ }; struct cx231xx_board { -- 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 V2 04/13] cx231xx: give each master i2c bus a seperate name
On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-i2c.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index a30d400..178fa48 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -506,6 +506,7 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) int cx231xx_i2c_register(struct cx231xx_i2c *bus) { struct cx231xx *dev = bus-dev; + char bus_name[3]; BUG_ON(!dev-cx231xx_send_usb_command); @@ -513,6 +514,10 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus) bus-i2c_adap.dev.parent = dev-udev-dev; strlcpy(bus-i2c_adap.name, bus-dev-name, sizeof(bus-i2c_adap.name)); + bus_name[0] = '-'; + bus_name[1] = '0' + bus-nr; + bus_name[2] = '\0'; + strlcat(bus-i2c_adap.name, bus_name, sizeof(bus-i2c_adap.name)); I am still thinking that. Isn't there any better alternative for this kind homemade number to string conversion? It is trivial, but for something on my head says we should avoid that kind of string manipulation... printf? num_to_str? dunno Antti bus-i2c_adap.algo_data = bus; i2c_set_adapdata(bus-i2c_adap, dev-v4l2_dev); -- 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 V2 07/13] cx231xx: add wrapper to get the i2c_adapter pointer
Reviewed-by: Antti Palosaari cr...@iki.fi Antti On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: This is a preparation for mapping I2C_1_MUX_1 and I2C_1_MUX_3 later to the seperate muxed i2c adapters. Map mux adapters to I2C_1 for now. Add local variables for i2c_adapters in dvb_init to get line lengths shorter. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-cards.c | 8 +++--- drivers/media/usb/cx231xx/cx231xx-dvb.c | 42 +-- drivers/media/usb/cx231xx/cx231xx-i2c.c | 20 ++- drivers/media/usb/cx231xx/cx231xx-input.c | 3 ++- drivers/media/usb/cx231xx/cx231xx.h | 1 + 5 files changed, 50 insertions(+), 24 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 2f027c7..f5fb93a 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -1033,7 +1033,7 @@ void cx231xx_card_setup(struct cx231xx *dev) /* request some modules */ if (dev-board.decoder == CX231XX_AVDECODER) { dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev, - dev-i2c_bus[I2C_0].i2c_adap, + cx231xx_get_i2c_adap(dev, I2C_0), cx25840, 0x88 1, NULL); if (dev-sd_cx25840 == NULL) cx231xx_info(cx25840 subdev registration failure\n); @@ -1043,8 +1043,10 @@ void cx231xx_card_setup(struct cx231xx *dev) /* Initialize the tuner */ if (dev-board.tuner_type != TUNER_ABSENT) { + struct i2c_adapter *tuner_i2c = cx231xx_get_i2c_adap(dev, + dev-board.tuner_i2c_master); dev-sd_tuner = v4l2_i2c_new_subdev(dev-v4l2_dev, - dev-i2c_bus[dev-board.tuner_i2c_master].i2c_adap, + tuner_i2c, tuner, dev-tuner_addr, NULL); if (dev-sd_tuner == NULL) @@ -1062,7 +1064,7 @@ void cx231xx_card_setup(struct cx231xx *dev) struct i2c_client client; memset(client, 0, sizeof(client)); - client.adapter = dev-i2c_bus[I2C_1].i2c_adap; + client.adapter = cx231xx_get_i2c_adap(dev, I2C_1); client.addr = 0xa0 1; read_eeprom(dev, client, eeprom, sizeof(eeprom)); diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 6c7b5e2..869c433 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -378,7 +378,7 @@ static int attach_xc5000(u8 addr, struct cx231xx *dev) struct xc5000_config cfg; memset(cfg, 0, sizeof(cfg)); - cfg.i2c_adap = dev-i2c_bus[dev-board.tuner_i2c_master].i2c_adap; + cfg.i2c_adap = cx231xx_get_i2c_adap(dev, dev-board.tuner_i2c_master); cfg.i2c_addr = addr; if (!dev-dvb-frontend) { @@ -583,6 +583,8 @@ static int dvb_init(struct cx231xx *dev) { int result = 0; struct cx231xx_dvb *dvb; + struct i2c_adapter *tuner_i2c; + struct i2c_adapter *demod_i2c; if (!dev-board.has_dvb) { /* This device does not support the extension */ @@ -599,6 +601,8 @@ static int dvb_init(struct cx231xx *dev) dev-cx231xx_set_analog_freq = cx231xx_set_analog_freq; dev-cx231xx_reset_analog_tuner = cx231xx_reset_analog_tuner; + tuner_i2c = cx231xx_get_i2c_adap(dev, dev-board.tuner_i2c_master); + demod_i2c = cx231xx_get_i2c_adap(dev, dev-board.demod_i2c_master); mutex_lock(dev-lock); cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE); cx231xx_demod_reset(dev); @@ -609,7 +613,7 @@ static int dvb_init(struct cx231xx *dev) dev-dvb-frontend = dvb_attach(s5h1432_attach, dvico_s5h1432_config, - dev-i2c_bus[dev-board.demod_i2c_master].i2c_adap); + demod_i2c); if (dev-dvb-frontend == NULL) { printk(DRIVER_NAME @@ -622,7 +626,7 @@ static int dvb_init(struct cx231xx *dev) dvb-frontend-callback = cx231xx_tuner_callback; if (!dvb_attach(xc5000_attach, dev-dvb-frontend, - dev-i2c_bus[dev-board.tuner_i2c_master].i2c_adap, + tuner_i2c, cnxt_rde250_tunerconfig)) { result = -EINVAL; goto out_free; @@ -634,7 +638,7 @@ static int dvb_init(struct cx231xx *dev) dev-dvb-frontend =
Re: [PATCH V2 08/13] cx231xx: remember status of i2c port_3 switch
I don't understand that patch. Commit message should explain it likely better details. You added flag 'port_3_switch_enabled' to device state. That is for I2C mux, but what it means? Does it means mux is currently switched to to port 3? Later you will use that flag to avoid unnecessary mux switching? regards Antti On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: If remembering is not stable enough, this must be changed to query from the register when needed. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-avcore.c | 3 +++ drivers/media/usb/cx231xx/cx231xx.h| 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 40a6987..4c85b6f 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -1294,6 +1294,9 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, value, 4); + if (status = 0) + dev-port_3_switch_enabled = is_port_3; + return status; } diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index f03338b..8a3c97b 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -629,6 +629,7 @@ struct cx231xx { /* I2C adapters: Master 1 2 (External) Master 3 (Internal only) */ struct cx231xx_i2c i2c_bus[3]; unsigned int xc_fw_load_done:1; + unsigned int port_3_switch_enabled:1; /* locks */ struct mutex gpio_i2c_lock; struct mutex i2c_lock; -- 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 V2 10/13] cx231xx: change usage of I2C_1 to the real i2c port
Reviewed-by: Antti Palosaari cr...@iki.fi Antti On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: change almost all instances of I2C_1 to I2C_1_MUX_3 Only these cases are changed to I2C_1_MUX_1: * All that have dont_use_port_3 set. * CX231XX_BOARD_HAUPPAUGE_EXETER, old code did explicitly not switch to port3. * eeprom access for 930C Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-cards.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index f5fb93a..4eb2057 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -104,7 +104,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, @@ -144,7 +144,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x32, @@ -184,7 +184,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x1c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, @@ -225,7 +225,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x1c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, @@ -297,7 +297,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, @@ -325,7 +325,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x32, @@ -353,7 +353,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_1, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x0e, @@ -419,7 +419,7 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_sda_gpio = -1, .gpio_pin_status_mask = 0x4001000, .tuner_i2c_master = I2C_2, - .demod_i2c_master = I2C_1, + .demod_i2c_master = I2C_1_MUX_3, .ir_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x10, @@ -457,7 +457,7 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_sda_gpio = -1, .gpio_pin_status_mask = 0x4001000, .tuner_i2c_master = I2C_2, - .demod_i2c_master = I2C_1, + .demod_i2c_master = I2C_1_MUX_3, .ir_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x10, @@ -495,7 +495,7 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_sda_gpio = -1, .gpio_pin_status_mask = 0x4001000, .tuner_i2c_master = I2C_2, - .demod_i2c_master = I2C_1, + .demod_i2c_master = I2C_1_MUX_3, .ir_i2c_master = I2C_2, .rc_map_name = RC_MAP_PIXELVIEW_002T, .has_dvb = 1, @@ -587,7 +587,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask =
Re: [PATCH V2 11/13] cx231xx: register i2c mux adapters for master1 and use as I2C_1_MUX_1 and I2C_1_MUX_3
Reviewed-by: Antti Palosaari cr...@iki.fi Antti On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/Kconfig| 1 + drivers/media/usb/cx231xx/cx231xx-core.c | 5 drivers/media/usb/cx231xx/cx231xx-i2c.c | 44 +++- drivers/media/usb/cx231xx/cx231xx.h | 4 +++ 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/Kconfig b/drivers/media/usb/cx231xx/Kconfig index 569aa29..173c0e2 100644 --- a/drivers/media/usb/cx231xx/Kconfig +++ b/drivers/media/usb/cx231xx/Kconfig @@ -7,6 +7,7 @@ config VIDEO_CX231XX select VIDEOBUF_VMALLOC select VIDEO_CX25840 select VIDEO_CX2341X + select I2C_MUX ---help--- This is a video4linux driver for Conexant 231xx USB based TV cards. diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index 180103e..c8a6d20 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -1300,6 +1300,9 @@ int cx231xx_dev_init(struct cx231xx *dev) cx231xx_i2c_register(dev-i2c_bus[1]); cx231xx_i2c_register(dev-i2c_bus[2]); + cx231xx_i2c_mux_register(dev, 0); + cx231xx_i2c_mux_register(dev, 1); + /* init hardware */ /* Note : with out calling set power mode function, afe can not be set up correctly */ @@ -1414,6 +1417,8 @@ EXPORT_SYMBOL_GPL(cx231xx_dev_init); void cx231xx_dev_uninit(struct cx231xx *dev) { /* Un Initialize I2C bus */ + cx231xx_i2c_mux_unregister(dev, 1); + cx231xx_i2c_mux_unregister(dev, 0); cx231xx_i2c_unregister(dev-i2c_bus[2]); cx231xx_i2c_unregister(dev-i2c_bus[1]); cx231xx_i2c_unregister(dev-i2c_bus[0]); diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 02ae498..bb82e6d 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -24,6 +24,7 @@ #include linux/kernel.h #include linux/usb.h #include linux/i2c.h +#include linux/i2c-mux.h #include media/v4l2-common.h #include media/tuner.h @@ -552,6 +553,46 @@ int cx231xx_i2c_unregister(struct cx231xx_i2c *bus) return 0; } +/* + * cx231xx_i2c_mux_select() + * switch i2c master number 1 between port1 and port3 + */ +static int cx231xx_i2c_mux_select(struct i2c_adapter *adap, + void *mux_priv, u32 chan_id) +{ + struct cx231xx *dev = mux_priv; + + return cx231xx_enable_i2c_port_3(dev, chan_id); +} + +int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no) +{ + struct i2c_adapter *i2c_parent = dev-i2c_bus[1].i2c_adap; + /* what is the correct mux_dev? */ + struct device *mux_dev = dev-udev-dev; + + dev-i2c_mux_adap[mux_no] = i2c_add_mux_adapter(i2c_parent, + mux_dev, + dev /* mux_priv */, + 0, + mux_no /* chan_id */, + 0 /* class */, + cx231xx_i2c_mux_select, + NULL); + + if (!dev-i2c_mux_adap[mux_no]) + cx231xx_warn(%s: i2c mux %d register FAILED\n, +dev-name, mux_no); + + return 0; +} + +void cx231xx_i2c_mux_unregister(struct cx231xx *dev, int mux_no) +{ + i2c_del_mux_adapter(dev-i2c_mux_adap[mux_no]); + dev-i2c_mux_adap[mux_no] = NULL; +} + struct i2c_adapter *cx231xx_get_i2c_adap(struct cx231xx *dev, int i2c_port) { switch (i2c_port) { @@ -562,8 +603,9 @@ struct i2c_adapter *cx231xx_get_i2c_adap(struct cx231xx *dev, int i2c_port) case I2C_2: return dev-i2c_bus[2].i2c_adap; case I2C_1_MUX_1: + return dev-i2c_mux_adap[0]; case I2C_1_MUX_3: - return dev-i2c_bus[1].i2c_adap; + return dev-i2c_mux_adap[1]; default: return NULL; } diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index 8a3c97b..c90aa44 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -628,6 +628,8 @@ struct cx231xx { /* I2C adapters: Master 1 2 (External) Master 3 (Internal only) */ struct cx231xx_i2c i2c_bus[3]; + struct i2c_adapter *i2c_mux_adap[2]; + unsigned int xc_fw_load_done:1; unsigned int port_3_switch_enabled:1; /* locks */ @@ -755,6 +757,8 @@ int cx231xx_reset_analog_tuner(struct cx231xx *dev); void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port); int cx231xx_i2c_register(struct cx231xx_i2c *bus); int cx231xx_i2c_unregister(struct cx231xx_i2c *bus); +int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no); +void
Re: [PATCH V2 13/13] cx231xx: scan all four existing i2c busses instead of the 3 masters
Reviewed-by: Antti Palosaari cr...@iki.fi btw. is there some reason you those on that order? I mean you scan I2C_2 between MUX segments? Antti On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: The scanning itself just fails (as before this series) but now the correct busses are scanned. V2: Changed to symbolic names where muxed adapters can be seen directly. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-core.c | 6 ++ drivers/media/usb/cx231xx/cx231xx-i2c.c | 8 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index c49022f..60d 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -1303,6 +1303,12 @@ int cx231xx_dev_init(struct cx231xx *dev) cx231xx_i2c_mux_register(dev, 0); cx231xx_i2c_mux_register(dev, 1); + /* scan the real bus segments */ + cx231xx_do_i2c_scan(dev, I2C_0); + cx231xx_do_i2c_scan(dev, I2C_1_MUX_1); + cx231xx_do_i2c_scan(dev, I2C_2); + cx231xx_do_i2c_scan(dev, I2C_1_MUX_3); + /* init hardware */ /* Note : with out calling set power mode function, afe can not be set up correctly */ diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index bb82e6d..0df50d3 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -492,6 +492,9 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) int i, rc; struct i2c_client client; + if (!i2c_scan) + return; + memset(client, 0, sizeof(client)); client.adapter = cx231xx_get_i2c_adap(dev, i2c_port); @@ -533,10 +536,7 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus) i2c_set_adapdata(bus-i2c_adap, dev-v4l2_dev); i2c_add_adapter(bus-i2c_adap); - if (0 == bus-i2c_rc) { - if (i2c_scan) - cx231xx_do_i2c_scan(dev, bus-nr); - } else + if (0 != bus-i2c_rc) cx231xx_warn(%s: i2c bus %d register FAILED\n, dev-name, bus-nr); -- 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] cx23885: initialize config structs for T9580
Reviewed-by: Antti Palosaari cr...@iki.fi That should go Kernel 3.18. Antti On 09/24/2014 06:06 AM, Olli Salonen wrote: The config structs used for DVBSky T9580 were not initialized. This patch fixes that. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/pci/cx23885/cx23885-dvb.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 13734b8..4cb9031 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -1600,6 +1600,7 @@ static int dvb_register(struct cx23885_tsport *port) break; /* attach tuner */ + memset(m88ts2022_config, 0, sizeof(m88ts2022_config)); m88ts2022_config.fe = fe0-dvb.frontend; m88ts2022_config.clock = 2700; memset(info, 0, sizeof(struct i2c_board_info)); @@ -1635,6 +1636,7 @@ static int dvb_register(struct cx23885_tsport *port) /* port c - terrestrial/cable */ case 2: /* attach frontend */ + memset(si2168_config, 0, sizeof(si2168_config)); si2168_config.i2c_adapter = adapter; si2168_config.fe = fe0-dvb.frontend; si2168_config.ts_mode = SI2168_TS_SERIAL; @@ -1654,6 +1656,7 @@ static int dvb_register(struct cx23885_tsport *port) port-i2c_client_demod = client_demod; /* attach tuner */ + memset(si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = fe0-dvb.frontend; memset(info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, si2157, I2C_NAME_SIZE); -- 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 1/5] cx23855: add support for DVBSky T980C (no CI support)
Reviewed-by: Antti Palosaari cr...@iki.fi Antti On 09/29/2014 10:44 AM, Olli Salonen wrote: This patch adds basic support for DVBSky T980C card. CI interface is not supported. DVBSky T980C is a PCIe card with the following components: - CX23885 PCIe bridge - Si2168-A20 demodulator - Si2158-A20 tuner - CIMaX SP2 CI chip The demodulator and tuner need firmware. They're the same as used with TT CT2-4650 CI: https://www.mail-archive.com/linux-media@vger.kernel.org/msg78033.html Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/pci/cx23885/cx23885-cards.c | 40 drivers/media/pci/cx23885/cx23885-dvb.c | 61 +++ drivers/media/pci/cx23885/cx23885.h | 1 + 3 files changed, 102 insertions(+) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 88c257d..e8965e6 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -680,6 +680,10 @@ struct cx23885_board cx23885_boards[] = { .portb = CX23885_MPEG_DVB, .portc = CX23885_MPEG_DVB, }, + [CX23885_BOARD_DVBSKY_T980C] = { + .name = DVBSky T980C, + .portb = CX23885_MPEG_DVB, + }, }; const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); @@ -939,6 +943,10 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x4254, .subdevice = 0x9580, .card = CX23885_BOARD_DVBSKY_T9580, + }, { + .subvendor = 0x4254, + .subdevice = 0x980c, + .card = CX23885_BOARD_DVBSKY_T980C, }, }; const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); @@ -1541,6 +1549,36 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) mdelay(100); cx23885_gpio_set(dev, GPIO_2 | GPIO_11); break; + case CX23885_BOARD_DVBSKY_T980C: + /* +* GPIO-0 INTA from CiMax, input +* GPIO-1 reset CiMax, output, high active +* GPIO-2 reset demod, output, low active +* GPIO-3 to GPIO-10 data/addr for CAM +* GPIO-11 ~CS0 to CiMax1 +* GPIO-12 ~CS1 to CiMax2 +* GPIO-13 ADL0 load LSB addr +* GPIO-14 ADL1 load MSB addr +* GPIO-15 ~RDY from CiMax +* GPIO-17 ~RD to CiMax +* GPIO-18 ~WR to CiMax +*/ + + cx_set(GP0_IO, 0x00060002); /* GPIO 1/2 as output */ + cx_clear(GP0_IO, 0x00010004); /* GPIO 0 as input */ + mdelay(100); /* reset delay */ + cx_set(GP0_IO, 0x00060004); /* GPIO as out, reset high */ + cx_clear(GP0_IO, 0x00010002); + cx_write(MC417_CTL, 0x0037); /* enable GPIO3-18 pins */ + + /* GPIO-15 IN as ~ACK, rest as OUT */ + cx_write(MC417_OEN, 0x1000); + + /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */ + cx_write(MC417_RWD, 0xc300); + + /* enable irq */ + cx_write(GPIO_ISM, 0x); /* INTERRUPTS active low */ } } @@ -1817,6 +1855,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_TEVII_S471: case CX23885_BOARD_DVBWORLD_2005: case CX23885_BOARD_PROF_8000: + case CX23885_BOARD_DVBSKY_T980C: ts1-gen_ctrl_val = 0x5; /* Parallel */ ts1-ts_clk_en_val = 0x1; /* Enable TS_CLK */ ts1-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; @@ -1935,6 +1974,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_T980C: dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev, dev-i2c_bus[2].i2c_adap, cx25840, 0x88 1, NULL); diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 2f532c9..d327459 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -1681,6 +1681,52 @@ static int dvb_register(struct cx23885_tsport *port) break; } break; + case CX23885_BOARD_DVBSKY_T980C: + i2c_bus = dev-i2c_bus[1]; + + /* attach frontend */ + memset(si2168_config, 0, sizeof(si2168_config)); + si2168_config.i2c_adapter = adapter; + si2168_config.fe = fe0-dvb.frontend; + si2168_config.ts_mode = SI2168_TS_PARALLEL; + memset(info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, si2168,
Re: [PATCH 2/5] sp2: fix incorrect struct
Reviewed-by: Antti Palosaari cr...@iki.fi Antti On 09/29/2014 10:44 AM, Olli Salonen wrote: Incorrect struct used in the SP2 driver. Reported-by: Max Nibble nibble@gmail.com Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/dvb-frontends/sp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c index 9b684d5..1f4f250 100644 --- a/drivers/media/dvb-frontends/sp2.c +++ b/drivers/media/dvb-frontends/sp2.c @@ -407,7 +407,7 @@ err: static int sp2_remove(struct i2c_client *client) { - struct si2157 *s = i2c_get_clientdata(client); + struct sp2 *s = i2c_get_clientdata(client); dev_dbg(client-dev, \n); -- 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 3/5] sp2: improve debug logging
Reviewed-by: Antti Palosaari cr...@iki.fi Antti On 09/29/2014 10:44 AM, Olli Salonen wrote: Improve debugging output. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/dvb-frontends/sp2.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c index 1f4f250..320cbe9 100644 --- a/drivers/media/dvb-frontends/sp2.c +++ b/drivers/media/dvb-frontends/sp2.c @@ -92,6 +92,9 @@ static int sp2_write_i2c(struct sp2 *s, u8 reg, u8 *buf, int len) return -EIO; } + dev_dbg(s-client-dev, addr=0x%04x, reg = 0x%02x, data = %*ph\n, + client-addr, reg, len, buf); + return 0; } @@ -103,9 +106,6 @@ static int sp2_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, u8 acs, int mem, ret; int (*ci_op_cam)(void*, u8, int, u8, int*) = s-ci_control; - dev_dbg(s-client-dev, slot=%d, acs=0x%02x, addr=0x%04x, data = 0x%02x, - slot, acs, addr, data); - if (slot != 0) return -EINVAL; @@ -140,13 +140,16 @@ static int sp2_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, u8 acs, if (ret) return ret; - if (read) { - dev_dbg(s-client-dev, cam read, addr=0x%04x, data = 0x%04x, - addr, mem); + dev_dbg(s-client-dev, %s: slot=%d, addr=0x%04x, %s, data=%x, + (read) ? read : write, slot, addr, + (acs == SP2_CI_ATTR_ACS) ? attr : io, + (read) ? mem : data); + + if (read) return mem; - } else { + else return 0; - } + } int sp2_ci_read_attribute_mem(struct dvb_ca_en50221 *en50221, -- 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] cx23885: add I2C client for CI into state and handle unregistering
Reviewed-by: Antti Palosaari cr...@iki.fi I was looking where is the CI I2C client pointer stored to that, but realized it was upcoming patch which will use that... regards Antti On 09/29/2014 10:44 AM, Olli Salonen wrote: If the CI chip has an I2C driver, we need to store I2C client into state. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/pci/cx23885/cx23885-dvb.c | 7 +++ drivers/media/pci/cx23885/cx23885.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index d327459..cc88997 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -1923,6 +1923,13 @@ int cx23885_dvb_unregister(struct cx23885_tsport *port) * implement MFE support. */ + /* remove I2C client for CI */ + client = port-i2c_client_ci; + if (client) { + module_put(client-dev.driver-owner); + i2c_unregister_device(client); + } + /* remove I2C client for tuner */ client = port-i2c_client_tuner; if (client) { diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index 1792d1a..c35ba2d 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -297,6 +297,7 @@ struct cx23885_tsport { struct i2c_client *i2c_client_demod; struct i2c_client *i2c_client_tuner; + struct i2c_client *i2c_client_ci; int (*set_frontend)(struct dvb_frontend *fe); int (*fe_set_voltage)(struct dvb_frontend *fe, -- 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 5/5] cx23855: add CI support for DVBSky T980C
On 09/29/2014 10:44 AM, Olli Salonen wrote: Add CI support for DVBSky T980C. I used the new host device independent CIMaX SP2 I2C driver to implement it. cx23885_sp2_ci_ctrl function is borrowed entirely from cimax2.c. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/pci/cx23885/cx23885-dvb.c | 105 +++- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index cc88997..70dbcd6 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -71,6 +71,7 @@ #include si2165.h #include si2168.h #include si2157.h +#include sp2.h #include m88ds3103.h #include m88ts2022.h @@ -616,6 +617,76 @@ static int dvbsky_t9580_set_voltage(struct dvb_frontend *fe, return 0; } +static int cx23885_sp2_ci_ctrl(void *priv, u8 read, int addr, + u8 data, int *mem) +{ + here is empty line. forget to ran checkpatch.pl? + /* MC417 */ + #define SP2_DATA 0x00ff + #define SP2_WR0x8000 + #define SP2_RD0x4000 + #define SP2_ACK 0x1000 + #define SP2_ADHI 0x0800 + #define SP2_ADLO 0x0400 + #define SP2_CS1 0x0200 + #define SP2_CS0 0x0100 + #define SP2_EN_ALL0x1000 + #define SP2_CTRL_OFF (SP2_CS1 | SP2_CS0 | SP2_WR | SP2_RD) + + struct cx23885_tsport *port = priv; + struct cx23885_dev *dev = port-dev; + int ret; + int tmp; + unsigned long timeout; + + mutex_lock(dev-gpio_lock); + + /* write addr */ + cx_write(MC417_OEN, SP2_EN_ALL); + cx_write(MC417_RWD, SP2_CTRL_OFF | + SP2_ADLO | (0xff addr)); + cx_clear(MC417_RWD, SP2_ADLO); + cx_write(MC417_RWD, SP2_CTRL_OFF | + SP2_ADHI | (0xff (addr 8))); + cx_clear(MC417_RWD, SP2_ADHI); + + if (read) { /* data in */ + cx_write(MC417_OEN, SP2_EN_ALL | SP2_DATA); + } else /* data out */ + cx_write(MC417_RWD, SP2_CTRL_OFF | data); wrong parenthesis usage. checkpatch.pl? see CodingStyle doc + + /* chip select 0 */ + cx_clear(MC417_RWD, SP2_CS0); + + /* read/write */ + cx_clear(MC417_RWD, (read) ? SP2_RD : SP2_WR); + + timeout = jiffies + msecs_to_jiffies(1); + for (;;) { + tmp = cx_read(MC417_RWD); + if ((tmp SP2_ACK) == 0) + break; + if (time_after(jiffies, timeout)) + break; + udelay(1); gaga, 1us delay in a busy waiting loop is very bad. It seems to read some register until value is correct. In a loop which is limited to one ms, using 1us delay. I cannot understand that, but is there some very critical timing needed this kind of code? That kind of code is nightmare for system performance, especially when it is on hot path (how often that code is executed?). See also timers documentation about these delays from kernel documentation. + } + + cx_set(MC417_RWD, SP2_CTRL_OFF); + *mem = tmp 0xff; + + mutex_unlock(dev-gpio_lock); + + if (!read) + if (*mem 0) { + ret = -EREMOTEIO; + goto err; + } I think missing parenthesis + + return 0; +err: + return ret; +} + static int cx23885_dvb_set_frontend(struct dvb_frontend *fe) { struct dtv_frontend_properties *p = fe-dtv_property_cache; @@ -944,11 +1015,11 @@ static int dvb_register(struct cx23885_tsport *port) struct vb2_dvb_frontend *fe0, *fe1 = NULL; struct si2168_config si2168_config; struct si2157_config si2157_config; + struct sp2_config sp2_config; struct m88ts2022_config m88ts2022_config; struct i2c_board_info info; struct i2c_adapter *adapter; - struct i2c_client *client_demod; - struct i2c_client *client_tuner; + struct i2c_client *client_demod, *client_tuner, *client_ci; int mfe_shared = 0; /* bus not shared by default */ int ret; @@ -1683,6 +1754,7 @@ static int dvb_register(struct cx23885_tsport *port) break; case CX23885_BOARD_DVBSKY_T980C: i2c_bus = dev-i2c_bus[1]; + i2c_bus2 = dev-i2c_bus[0]; /* attach frontend */ memset(si2168_config, 0, sizeof(si2168_config)); @@ -1820,6 +1892,35 @@ static int dvb_register(struct cx23885_tsport *port) case CX23885_BOARD_DVBSKY_T980C: { u8 eeprom[256]; /* 24C02 i2c eeprom */ + /* attach CI */ + memset(sp2_config, 0, sizeof(sp2_config)); +
Re: [PATCH V2 08/13] cx231xx: remember status of i2c port_3 switch
On 01.10.2014 21:36, Antti Palosaari wrote: I don't understand that patch. Commit message should explain it likely better details. You added flag 'port_3_switch_enabled' to device state. That is for I2C mux, but what it means? Does it means mux is currently switched to to port 3? Later you will use that flag to avoid unnecessary mux switching? You are right, it should be described better. Basically it is to be able to query the state of the mux. This is in the next patch used for the hack that detects if a specific tuner on a specific bus is accessed. It is not used to suppress unnecessary switching. The switching function explicitly reads the switch register and only writes it if the value is different. But maybe it would be more consistent if in this case the code also reads the register. Regards Matthias regards Antti On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: If remembering is not stable enough, this must be changed to query from the register when needed. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-avcore.c | 3 +++ drivers/media/usb/cx231xx/cx231xx.h| 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 40a6987..4c85b6f 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -1294,6 +1294,9 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, value, 4); +if (status = 0) +dev-port_3_switch_enabled = is_port_3; + return status; } diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index f03338b..8a3c97b 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -629,6 +629,7 @@ struct cx231xx { /* I2C adapters: Master 1 2 (External) Master 3 (Internal only) */ struct cx231xx_i2c i2c_bus[3]; unsigned int xc_fw_load_done:1; +unsigned int port_3_switch_enabled:1; /* locks */ struct mutex gpio_i2c_lock; struct mutex i2c_lock; -- 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 3/5] [media] pwc-if: fix build warning when !CONFIG_USB_PWC_INPUT_EVDEV
Label err_video_unreg in function usb_pwc_probe() is only used when CONFIG_USB_PWC_INPUT_EVDEV is defined. drivers/media/usb/pwc/pwc-if.c:1104:1: warning: label 'err_video_unreg' defined but not used [-Wunused-label] Signed-off-by: Luis Henriques luis.henriq...@canonical.com --- drivers/media/usb/pwc/pwc-if.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index 15b754da4a2c..e6b7e63b0b8e 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c @@ -1078,7 +1078,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id pdev-button_dev = input_allocate_device(); if (!pdev-button_dev) { rc = -ENOMEM; - goto err_video_unreg; + video_unregister_device(pdev-vdev); + goto err_unregister_v4l2_dev; } usb_make_path(udev, pdev-button_phys, sizeof(pdev-button_phys)); @@ -1095,14 +1096,13 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id if (rc) { input_free_device(pdev-button_dev); pdev-button_dev = NULL; - goto err_video_unreg; + video_unregister_device(pdev-vdev); + goto err_unregister_v4l2_dev; } #endif return 0; -err_video_unreg: - video_unregister_device(pdev-vdev); err_unregister_v4l2_dev: v4l2_device_unregister(pdev-v4l2_dev); err_free_controls: -- 2.1.0 -- 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-20141001, in drivers/i2c/algos/i2c-algo-bit.c
On 10/01/14 14:37, Jim Davis wrote: Building with the attached random configuration file, Also: warning: (CAN_PEAK_PCIEC SFC IGB VIDEO_TW68 DRM FB_DDC FB_VIA) selects I2C_ALGOBIT which has unmet direct dependencies (I2C) drivers/i2c/algos/i2c-algo-bit.c: In function ‘i2c_bit_add_bus’: drivers/i2c/algos/i2c-algo-bit.c:658:33: error: ‘i2c_add_adapter’ undeclared (first use in this function) return __i2c_bit_add_bus(adap, i2c_add_adapter); ^ drivers/i2c/algos/i2c-algo-bit.c:658:33: note: each undeclared identifier is reported only once for each function it appears in drivers/i2c/algos/i2c-algo-bit.c: In function ‘i2c_bit_add_numbered_bus’: drivers/i2c/algos/i2c-algo-bit.c:664:33: error: ‘i2c_add_numbered_adapter’ undeclared (first use in this function) return __i2c_bit_add_bus(adap, i2c_add_numbered_adapter); ^ CC net/openvswitch/actions.o drivers/i2c/algos/i2c-algo-bit.c: In function ‘i2c_bit_add_bus’: drivers/i2c/algos/i2c-algo-bit.c:659:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/i2c/algos/i2c-algo-bit.c: In function ‘i2c_bit_add_numbered_bus’: drivers/i2c/algos/i2c-algo-bit.c:665:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ make[3]: *** [drivers/i2c/algos/i2c-algo-bit.o] Error 1 In drivers/media/pci/tw68/Kconfig, VIDEO_TW68 should depend on I2C in order to make it safe to select I2C_ALGOBIT. In drivers/net/can/sja1000/Kconfig, CAN_PEAK_PCIEC should depend on I2C instead of selecting I2C (and change the help text). -- ~Randy -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Fixed all coding style issues for drivers/staging/media/lirc/
Fixed various coding sytles. Signed-off-by: Amber Thrall amber.rose.thr...@gmail.com --- drivers/staging/media/lirc/lirc_bt829.c | 2 +- drivers/staging/media/lirc/lirc_imon.c | 4 +- drivers/staging/media/lirc/lirc_sasem.c | 6 +-- drivers/staging/media/lirc/lirc_serial.c | 29 ++ drivers/staging/media/lirc/lirc_sir.c| 3 +- drivers/staging/media/lirc/lirc_zilog.c | 69 +++- 6 files changed, 52 insertions(+), 61 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c index 4c806ba..c70ca68 100644 --- a/drivers/staging/media/lirc/lirc_bt829.c +++ b/drivers/staging/media/lirc/lirc_bt829.c @@ -59,7 +59,7 @@ static bool debug; #define dprintk(fmt, args...) \ do { \ if (debug) \ - printk(KERN_DEBUG DRIVER_NAME : fmt, ## args); \ + dev_dbg(DRIVER_NAME, : fmt, ##args); \ } while (0) static int atir_minor; diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 7aca44f..bce0408 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -623,8 +623,8 @@ static void imon_incoming_packet(struct imon_context *context, if (debug) { dev_info(dev, raw packet: ); for (i = 0; i len; ++i) - printk(%02x , buf[i]); - printk(\n); + dev_info(dev, %02x , buf[i]); + dev_info(dev, \n); } /* diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index c20ef56..e88e246 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -583,10 +583,10 @@ static void incoming_packet(struct sasem_context *context, } if (debug) { - printk(KERN_INFO Incoming data: ); + pr_info(Incoming data: ); for (i = 0; i 8; ++i) - printk(KERN_CONT %02x , buf[i]); - printk(KERN_CONT \n); + pr_cont(%02x, buf[i]); + pr_cont(\n); } /* diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 181b92b..b07671b 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -116,8 +116,7 @@ static bool txsense;/* 0 = active high, 1 = active low */ #define dprintk(fmt, args...) \ do {\ if (debug) \ - printk(KERN_DEBUG LIRC_DRIVER_NAME : \ - fmt, ## args); \ + dev_dbg(LIRC_DRIVER_NAME, : fmt, ##args); \ } while (0) /* forward declarations */ @@ -356,9 +355,8 @@ static int init_timing_params(unsigned int new_duty_cycle, /* Derive pulse and space from the period */ pulse_width = period * duty_cycle / 100; space_width = period - pulse_width; - dprintk(in init_timing_params, freq=%d, duty_cycle=%d, - clk/jiffy=%ld, pulse=%ld, space=%ld, - conv_us_to_clocks=%ld\n, + dprintk(in init_timing_params, freq=%d, duty_cycle=%d, clk/jiffy=%ld, + pulse=%ld, space=%ld, conv_us_to_clocks=%ld\n, freq, duty_cycle, __this_cpu_read(cpu_info.loops_per_jiffy), pulse_width, space_width, conv_us_to_clocks); return 0; @@ -1075,7 +1073,7 @@ static int __init lirc_serial_init(void) result = platform_driver_register(lirc_serial_driver); if (result) { - printk(lirc register returned %d\n, result); + dprintk(lirc register returned %d\n, result); goto exit_buffer_free; } @@ -1166,22 +1164,20 @@ module_init(lirc_serial_init_module); module_exit(lirc_serial_exit_module); MODULE_DESCRIPTION(Infra-red receiver driver for serial ports.); -MODULE_AUTHOR(Ralph Metzler, Trent Piepho, Ben Pfaff, - Christoph Bartelmus, Andrei Tanas); +MODULE_AUTHOR(Ralph Metzler, Trent Piepho, Ben Pfaff, Christoph Bartelmus, Andrei Tanas); MODULE_LICENSE(GPL); module_param(type, int, S_IRUGO); -MODULE_PARM_DESC(type, Hardware type (0 = home-brew, 1 = IRdeo, - 2 = IRdeo Remote, 3 = AnimaX, 4 = IgorPlug, - 5 = NSLU2 RX:CTS2/TX:GreenLED)); +MODULE_PARM_DESC(type, Hardware type (0 = home-brew, 1 = IRdeo, + 2 = IRdeo Remote, 3 = AnimaX, 4 = IgorPlug, + 5 = NSLU2 RX:CTS2/TX:GreenLED)); module_param(io, int, S_IRUGO); MODULE_PARM_DESC(io, I/O address
cron job: media_tree daily build: WARNINGS
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: Thu Oct 2 04:00:16 CEST 2014 git branch: test git hash: cf3167cf1e969b17671a4d3d956d22718a8ceb85 gcc version:i686-linux-gcc (GCC) 4.9.1 sparse version: v0.5.0-20-g7abd8a7 host hardware: x86_64 host os:3.16-3.slh.1-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.32.27-i686: WARNINGS linux-2.6.33.7-i686: WARNINGS linux-2.6.34.7-i686: WARNINGS linux-2.6.35.9-i686: WARNINGS linux-2.6.36.4-i686: WARNINGS linux-2.6.37.6-i686: WARNINGS linux-2.6.38.8-i686: WARNINGS linux-2.6.39.4-i686: WARNINGS linux-3.0.60-i686: WARNINGS linux-3.1.10-i686: WARNINGS linux-3.2.37-i686: WARNINGS linux-3.3.8-i686: WARNINGS linux-3.4.27-i686: WARNINGS linux-3.5.7-i686: WARNINGS linux-3.6.11-i686: WARNINGS linux-3.7.4-i686: WARNINGS linux-3.8-i686: WARNINGS linux-3.9.2-i686: WARNINGS linux-3.10.1-i686: OK linux-3.11.1-i686: WARNINGS linux-3.12.23-i686: WARNINGS linux-3.13.11-i686: WARNINGS linux-3.14.9-i686: WARNINGS linux-3.15.2-i686: OK linux-3.16-i686: OK linux-3.17-rc1-i686: OK linux-2.6.32.27-x86_64: WARNINGS linux-2.6.33.7-x86_64: WARNINGS linux-2.6.34.7-x86_64: WARNINGS linux-2.6.35.9-x86_64: WARNINGS linux-2.6.36.4-x86_64: WARNINGS linux-2.6.37.6-x86_64: WARNINGS linux-2.6.38.8-x86_64: WARNINGS linux-2.6.39.4-x86_64: WARNINGS linux-3.0.60-x86_64: WARNINGS linux-3.1.10-x86_64: WARNINGS linux-3.2.37-x86_64: WARNINGS linux-3.3.8-x86_64: WARNINGS linux-3.4.27-x86_64: WARNINGS linux-3.5.7-x86_64: WARNINGS linux-3.6.11-x86_64: WARNINGS linux-3.7.4-x86_64: WARNINGS linux-3.8-x86_64: WARNINGS linux-3.9.2-x86_64: WARNINGS linux-3.10.1-x86_64: OK linux-3.11.1-x86_64: WARNINGS linux-3.12.23-x86_64: WARNINGS linux-3.13.11-x86_64: WARNINGS linux-3.14.9-x86_64: WARNINGS linux-3.15.2-x86_64: WARNINGS linux-3.16-x86_64: WARNINGS linux-3.17-rc1-x86_64: WARNINGS apps: OK spec-git: OK sparse: WARNINGS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Thursday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Thursday.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
Re: [PATCH] Fixed all coding style issues for drivers/staging/media/lirc/
On Wed, Oct 01, 2014 at 07:35:51PM -0700, Amber Thrall wrote: Fixed various coding sytles. You need to be specific as to what you changed. Also, use get_maintainer to figure out who to sent this to (hint, not me...) greg k-h -- 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 13/13] cx231xx: scan all four existing i2c busses instead of the 3 masters
On 01.10.2014 21:47, Antti Palosaari wrote: Reviewed-by: Antti Palosaari cr...@iki.fi btw. is there some reason you those on that order? I mean you scan I2C_2 between MUX segments? Antti Hi Antti, the only reason is that this is the order of the physical ports. I can add a comment to the code. Regards Matthias On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: The scanning itself just fails (as before this series) but now the correct busses are scanned. V2: Changed to symbolic names where muxed adapters can be seen directly. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-core.c | 6 ++ drivers/media/usb/cx231xx/cx231xx-i2c.c | 8 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index c49022f..60d 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -1303,6 +1303,12 @@ int cx231xx_dev_init(struct cx231xx *dev) cx231xx_i2c_mux_register(dev, 0); cx231xx_i2c_mux_register(dev, 1); +/* scan the real bus segments */ +cx231xx_do_i2c_scan(dev, I2C_0); +cx231xx_do_i2c_scan(dev, I2C_1_MUX_1); +cx231xx_do_i2c_scan(dev, I2C_2); +cx231xx_do_i2c_scan(dev, I2C_1_MUX_3); + /* init hardware */ /* Note : with out calling set power mode function, afe can not be set up correctly */ diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index bb82e6d..0df50d3 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -492,6 +492,9 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) int i, rc; struct i2c_client client; +if (!i2c_scan) +return; + memset(client, 0, sizeof(client)); client.adapter = cx231xx_get_i2c_adap(dev, i2c_port); @@ -533,10 +536,7 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus) i2c_set_adapdata(bus-i2c_adap, dev-v4l2_dev); i2c_add_adapter(bus-i2c_adap); -if (0 == bus-i2c_rc) { -if (i2c_scan) -cx231xx_do_i2c_scan(dev, bus-nr); -} else +if (0 != bus-i2c_rc) cx231xx_warn(%s: i2c bus %d register FAILED\n, dev-name, bus-nr); -- 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] Fixed all coding style issues for drivers/staging/media/lirc/
Fixed various coding style issues, including strings over 80 characters long and many deprecated printk's have been replaced with proper methods. Signed-off-by: Amber Thrall amber.rose.thr...@gmail.com --- drivers/staging/media/lirc/lirc_bt829.c | 2 +- drivers/staging/media/lirc/lirc_imon.c | 4 +- drivers/staging/media/lirc/lirc_sasem.c | 6 +-- drivers/staging/media/lirc/lirc_serial.c | 29 ++ drivers/staging/media/lirc/lirc_sir.c| 3 +- drivers/staging/media/lirc/lirc_zilog.c | 69 +++- 6 files changed, 52 insertions(+), 61 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c index 4c806ba..c70ca68 100644 --- a/drivers/staging/media/lirc/lirc_bt829.c +++ b/drivers/staging/media/lirc/lirc_bt829.c @@ -59,7 +59,7 @@ static bool debug; #define dprintk(fmt, args...) \ do { \ if (debug) \ - printk(KERN_DEBUG DRIVER_NAME : fmt, ## args); \ + dev_dbg(DRIVER_NAME, : fmt, ##args); \ } while (0) static int atir_minor; diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 7aca44f..bce0408 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -623,8 +623,8 @@ static void imon_incoming_packet(struct imon_context *context, if (debug) { dev_info(dev, raw packet: ); for (i = 0; i len; ++i) - printk(%02x , buf[i]); - printk(\n); + dev_info(dev, %02x , buf[i]); + dev_info(dev, \n); } /* diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index c20ef56..e88e246 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -583,10 +583,10 @@ static void incoming_packet(struct sasem_context *context, } if (debug) { - printk(KERN_INFO Incoming data: ); + pr_info(Incoming data: ); for (i = 0; i 8; ++i) - printk(KERN_CONT %02x , buf[i]); - printk(KERN_CONT \n); + pr_cont(%02x, buf[i]); + pr_cont(\n); } /* diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 181b92b..b07671b 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -116,8 +116,7 @@ static bool txsense;/* 0 = active high, 1 = active low */ #define dprintk(fmt, args...) \ do {\ if (debug) \ - printk(KERN_DEBUG LIRC_DRIVER_NAME : \ - fmt, ## args); \ + dev_dbg(LIRC_DRIVER_NAME, : fmt, ##args); \ } while (0) /* forward declarations */ @@ -356,9 +355,8 @@ static int init_timing_params(unsigned int new_duty_cycle, /* Derive pulse and space from the period */ pulse_width = period * duty_cycle / 100; space_width = period - pulse_width; - dprintk(in init_timing_params, freq=%d, duty_cycle=%d, - clk/jiffy=%ld, pulse=%ld, space=%ld, - conv_us_to_clocks=%ld\n, + dprintk(in init_timing_params, freq=%d, duty_cycle=%d, clk/jiffy=%ld, + pulse=%ld, space=%ld, conv_us_to_clocks=%ld\n, freq, duty_cycle, __this_cpu_read(cpu_info.loops_per_jiffy), pulse_width, space_width, conv_us_to_clocks); return 0; @@ -1075,7 +1073,7 @@ static int __init lirc_serial_init(void) result = platform_driver_register(lirc_serial_driver); if (result) { - printk(lirc register returned %d\n, result); + dprintk(lirc register returned %d\n, result); goto exit_buffer_free; } @@ -1166,22 +1164,20 @@ module_init(lirc_serial_init_module); module_exit(lirc_serial_exit_module); MODULE_DESCRIPTION(Infra-red receiver driver for serial ports.); -MODULE_AUTHOR(Ralph Metzler, Trent Piepho, Ben Pfaff, - Christoph Bartelmus, Andrei Tanas); +MODULE_AUTHOR(Ralph Metzler, Trent Piepho, Ben Pfaff, Christoph Bartelmus, Andrei Tanas); MODULE_LICENSE(GPL); module_param(type, int, S_IRUGO); -MODULE_PARM_DESC(type, Hardware type (0 = home-brew, 1 = IRdeo, - 2 = IRdeo Remote, 3 = AnimaX, 4 = IgorPlug, - 5 = NSLU2 RX:CTS2/TX:GreenLED)); +MODULE_PARM_DESC(type, Hardware type (0 = home-brew, 1 = IRdeo, + 2 = IRdeo Remote, 3 = AnimaX, 4 =
Re: [PATCH] Fixed all coding style issues for drivers/staging/media/lirc/
On Thu, Oct 2, 2014 at 12:40 AM, Amber Thrall amber.rose.thr...@gmail.com wrote: Fixed various coding style issues, including strings over 80 characters long and many deprecated printk's have been replaced with proper methods. Signed-off-by: Amber Thrall amber.rose.thr...@gmail.com --- drivers/staging/media/lirc/lirc_bt829.c | 2 +- drivers/staging/media/lirc/lirc_imon.c | 4 +- drivers/staging/media/lirc/lirc_sasem.c | 6 +-- drivers/staging/media/lirc/lirc_serial.c | 29 ++ drivers/staging/media/lirc/lirc_sir.c| 3 +- drivers/staging/media/lirc/lirc_zilog.c | 69 +++- 6 files changed, 52 insertions(+), 61 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c index 4c806ba..c70ca68 100644 --- a/drivers/staging/media/lirc/lirc_bt829.c +++ b/drivers/staging/media/lirc/lirc_bt829.c @@ -59,7 +59,7 @@ static bool debug; #define dprintk(fmt, args...) \ do { \ if (debug) \ - printk(KERN_DEBUG DRIVER_NAME : fmt, ## args); \ + dev_dbg(DRIVER_NAME, : fmt, ##args); \ } while (0) static int atir_minor; diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 7aca44f..bce0408 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -623,8 +623,8 @@ static void imon_incoming_packet(struct imon_context *context, if (debug) { dev_info(dev, raw packet: ); for (i = 0; i len; ++i) - printk(%02x , buf[i]); - printk(\n); + dev_info(dev, %02x , buf[i]); + dev_info(dev, \n); Did you mean pr_cont() for both of these? Otherwise each one will get a level + device info prefix. } /* diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index c20ef56..e88e246 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -583,10 +583,10 @@ static void incoming_packet(struct sasem_context *context, } if (debug) { - printk(KERN_INFO Incoming data: ); + pr_info(Incoming data: ); for (i = 0; i 8; ++i) - printk(KERN_CONT %02x , buf[i]); - printk(KERN_CONT \n); + pr_cont(%02x, buf[i]); + pr_cont(\n); } /* diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 181b92b..b07671b 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -116,8 +116,7 @@ static bool txsense;/* 0 = active high, 1 = active low */ #define dprintk(fmt, args...) \ do {\ if (debug) \ - printk(KERN_DEBUG LIRC_DRIVER_NAME : \ - fmt, ## args); \ + dev_dbg(LIRC_DRIVER_NAME, : fmt, ##args); \ This wants a device node, not a driver name string. There's a reason there was no , in the old macro... } while (0) /* forward declarations */ @@ -356,9 +355,8 @@ static int init_timing_params(unsigned int new_duty_cycle, /* Derive pulse and space from the period */ pulse_width = period * duty_cycle / 100; space_width = period - pulse_width; - dprintk(in init_timing_params, freq=%d, duty_cycle=%d, - clk/jiffy=%ld, pulse=%ld, space=%ld, - conv_us_to_clocks=%ld\n, + dprintk(in init_timing_params, freq=%d, duty_cycle=%d, clk/jiffy=%ld, + pulse=%ld, space=%ld, conv_us_to_clocks=%ld\n, freq, duty_cycle, __this_cpu_read(cpu_info.loops_per_jiffy), pulse_width, space_width, conv_us_to_clocks); return 0; @@ -1075,7 +1073,7 @@ static int __init lirc_serial_init(void) result = platform_driver_register(lirc_serial_driver); if (result) { - printk(lirc register returned %d\n, result); + dprintk(lirc register returned %d\n, result); goto exit_buffer_free; } @@ -1166,22 +1164,20 @@ module_init(lirc_serial_init_module); module_exit(lirc_serial_exit_module); MODULE_DESCRIPTION(Infra-red receiver driver for serial ports.); -MODULE_AUTHOR(Ralph Metzler, Trent Piepho, Ben Pfaff, - Christoph Bartelmus, Andrei Tanas); +MODULE_AUTHOR(Ralph Metzler, Trent Piepho, Ben Pfaff,
Re: [PATCH V2 04/13] cx231xx: give each master i2c bus a seperate name
On 01.10.2014 21:22, Antti Palosaari wrote: On 10/01/2014 08:20 AM, Matthias Schwarzott wrote: Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-i2c.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index a30d400..178fa48 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -506,6 +506,7 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) int cx231xx_i2c_register(struct cx231xx_i2c *bus) { struct cx231xx *dev = bus-dev; +char bus_name[3]; BUG_ON(!dev-cx231xx_send_usb_command); @@ -513,6 +514,10 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus) bus-i2c_adap.dev.parent = dev-udev-dev; strlcpy(bus-i2c_adap.name, bus-dev-name, sizeof(bus-i2c_adap.name)); +bus_name[0] = '-'; +bus_name[1] = '0' + bus-nr; +bus_name[2] = '\0'; +strlcat(bus-i2c_adap.name, bus_name, sizeof(bus-i2c_adap.name)); I am still thinking that. Isn't there any better alternative for this kind homemade number to string conversion? It is trivial, but for something on my head says we should avoid that kind of string manipulation... printf? num_to_str? I switched to snprintf. Regards Matthias -- 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 V3 08/13] cx231xx: remember status of i2c port_3 switch
This is used later for is_tuner function that switches i2c behaviour for some tuners. V2: Add comments about possible improvements for port_3 switch function. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-avcore.c | 10 ++ drivers/media/usb/cx231xx/cx231xx.h| 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 40a6987..148b5fa 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -1272,6 +1272,12 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) if (dev-board.dont_use_port_3) is_port_3 = false; + + /* Should this code check dev-port_3_switch_enabled first */ + /* to skip unnecessary reading of the register? */ + /* If yes, the flag dev-port_3_switch_enabled must be initialized */ + /* correctly. */ + status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, 4); if (status 0) @@ -1294,6 +1300,10 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, value, 4); + /* remember status of the switch for usage in is_tuner */ + if (status = 0) + dev-port_3_switch_enabled = is_port_3; + return status; } diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index f03338b..8a3c97b 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -629,6 +629,7 @@ struct cx231xx { /* I2C adapters: Master 1 2 (External) Master 3 (Internal only) */ struct cx231xx_i2c i2c_bus[3]; unsigned int xc_fw_load_done:1; + unsigned int port_3_switch_enabled:1; /* locks */ struct mutex gpio_i2c_lock; struct mutex i2c_lock; -- 2.1.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
[PATCH V3 06/13] cx231xx: Use symbolic constants for i2c ports instead of numbers
Replace numbers by the constants of same value and same meaning. Signed-off-by: Matthias Schwarzott z...@gentoo.org Reviewed-by: Antti Palosaari cr...@iki.fi --- drivers/media/usb/cx231xx/cx231xx-cards.c | 62 +++ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 092fb85..2f027c7 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -104,8 +104,8 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 1, - .demod_i2c_master = 2, + .tuner_i2c_master = I2C_1, + .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, .norm = V4L2_STD_PAL, @@ -144,8 +144,8 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 1, - .demod_i2c_master = 2, + .tuner_i2c_master = I2C_1, + .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x32, .norm = V4L2_STD_NTSC, @@ -184,8 +184,8 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x1c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 1, - .demod_i2c_master = 2, + .tuner_i2c_master = I2C_1, + .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, .norm = V4L2_STD_PAL, @@ -225,8 +225,8 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x1c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 1, - .demod_i2c_master = 2, + .tuner_i2c_master = I2C_1, + .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, .norm = V4L2_STD_PAL, @@ -297,8 +297,8 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 1, - .demod_i2c_master = 2, + .tuner_i2c_master = I2C_1, + .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, .norm = V4L2_STD_PAL, @@ -325,8 +325,8 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 1, - .demod_i2c_master = 2, + .tuner_i2c_master = I2C_1, + .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x32, .norm = V4L2_STD_NTSC, @@ -353,8 +353,8 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 1, - .demod_i2c_master = 2, + .tuner_i2c_master = I2C_1, + .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x0e, .norm = V4L2_STD_NTSC, @@ -418,9 +418,9 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_scl_gpio = -1, .tuner_sda_gpio = -1, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 2, - .demod_i2c_master = 1, - .ir_i2c_master = 2, + .tuner_i2c_master = I2C_2, + .demod_i2c_master = I2C_1, + .ir_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x10, .norm = V4L2_STD_PAL_M, @@ -456,9 +456,9 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_scl_gpio = -1, .tuner_sda_gpio = -1, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 2, - .demod_i2c_master = 1, - .ir_i2c_master = 2, + .tuner_i2c_master = I2C_2, + .demod_i2c_master = I2C_1, + .ir_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x10, .norm =
[PATCH V3 01/13] cx231xx: let i2c bus scanning use its own i2c_client
This is a preparation for deleting the otherwise useless i2c_clients that are allocated for all the i2c master adapters. Signed-off-by: Matthias Schwarzott z...@gentoo.org Reviewed-by: Antti Palosaari cr...@iki.fi --- drivers/media/usb/cx231xx/cx231xx-i2c.c | 17 +++-- drivers/media/usb/cx231xx/cx231xx.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 7c0f797..67a1391 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -480,22 +480,27 @@ static char *i2c_devs[128] = { * cx231xx_do_i2c_scan() * check i2c address range for devices */ -void cx231xx_do_i2c_scan(struct cx231xx *dev, struct i2c_client *c) +void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) { unsigned char buf; int i, rc; + struct i2c_client client; - cx231xx_info(: Checking for I2C devices ..\n); + memset(client, 0, sizeof(client)); + client.adapter = dev-i2c_bus[i2c_port].i2c_adap; + + cx231xx_info(: Checking for I2C devices on port=%d ..\n, i2c_port); for (i = 0; i 128; i++) { - c-addr = i; - rc = i2c_master_recv(c, buf, 0); + client.addr = i; + rc = i2c_master_recv(client, buf, 0); if (rc 0) continue; cx231xx_info(%s: i2c scan: found device @ 0x%x [%s]\n, dev-name, i 1, i2c_devs[i] ? i2c_devs[i] : ???); } - cx231xx_info(: Completed Checking for I2C devices.\n); + cx231xx_info(: Completed Checking for I2C devices on port=%d.\n, + i2c_port); } /* @@ -522,7 +527,7 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus) if (0 == bus-i2c_rc) { if (i2c_scan) - cx231xx_do_i2c_scan(dev, bus-i2c_client); + cx231xx_do_i2c_scan(dev, bus-nr); } else cx231xx_warn(%s: i2c bus %d register FAILED\n, dev-name, bus-nr); diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index aeb1bf4..5efc93e 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -751,7 +751,7 @@ int cx231xx_set_analog_freq(struct cx231xx *dev, u32 freq); int cx231xx_reset_analog_tuner(struct cx231xx *dev); /* Provided by cx231xx-i2c.c */ -void cx231xx_do_i2c_scan(struct cx231xx *dev, struct i2c_client *c); +void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port); int cx231xx_i2c_register(struct cx231xx_i2c *bus); int cx231xx_i2c_unregister(struct cx231xx_i2c *bus); -- 2.1.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
[PATCH V3 04/13] cx231xx: give each master i2c bus a seperate name
V2: Use snprintf to construct the complete name Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index a30d400..b10f482 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -506,13 +506,14 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) int cx231xx_i2c_register(struct cx231xx_i2c *bus) { struct cx231xx *dev = bus-dev; + char bus_name[3]; BUG_ON(!dev-cx231xx_send_usb_command); bus-i2c_adap = cx231xx_adap_template; bus-i2c_adap.dev.parent = dev-udev-dev; - strlcpy(bus-i2c_adap.name, bus-dev-name, sizeof(bus-i2c_adap.name)); + snprintf(bus-i2c_adap.name, sizeof(bus-i2c_adap.name), %s-%d, bus-dev-name, bus-nr); bus-i2c_adap.algo_data = bus; i2c_set_adapdata(bus-i2c_adap, dev-v4l2_dev); -- 2.1.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
cx231xx: Use muxed i2c adapters instead of custom switching
This series changes cx231xx driver to use standard muxed i2c busses. Everything works as before (tested with Hauppauge WinTV-930C-HD). Also the scanning is changed to these new busses, but still does not work (as before). Change scanning to read 1 byte instead of 0 only works for one bus. V2: The constants are changed so muxed adapters are named I2C_1_MUX_1 and I2C_1_MUX_3. With I2C_1 the underlying adapter could be reached (not recommended). V3: Use snprintf for constructing i2c adapter names. Update comments for port_3 switch function. Regards Matthias -- 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 V3 07/13] cx231xx: add wrapper to get the i2c_adapter pointer
This is a preparation for mapping I2C_1_MUX_1 and I2C_1_MUX_3 later to the seperate muxed i2c adapters. Map mux adapters to I2C_1 for now. Add local variables for i2c_adapters in dvb_init to get line lengths shorter. Signed-off-by: Matthias Schwarzott z...@gentoo.org Reviewed-by: Antti Palosaari cr...@iki.fi --- drivers/media/usb/cx231xx/cx231xx-cards.c | 8 +++--- drivers/media/usb/cx231xx/cx231xx-dvb.c | 42 +-- drivers/media/usb/cx231xx/cx231xx-i2c.c | 20 ++- drivers/media/usb/cx231xx/cx231xx-input.c | 3 ++- drivers/media/usb/cx231xx/cx231xx.h | 1 + 5 files changed, 50 insertions(+), 24 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 2f027c7..f5fb93a 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -1033,7 +1033,7 @@ void cx231xx_card_setup(struct cx231xx *dev) /* request some modules */ if (dev-board.decoder == CX231XX_AVDECODER) { dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev, - dev-i2c_bus[I2C_0].i2c_adap, + cx231xx_get_i2c_adap(dev, I2C_0), cx25840, 0x88 1, NULL); if (dev-sd_cx25840 == NULL) cx231xx_info(cx25840 subdev registration failure\n); @@ -1043,8 +1043,10 @@ void cx231xx_card_setup(struct cx231xx *dev) /* Initialize the tuner */ if (dev-board.tuner_type != TUNER_ABSENT) { + struct i2c_adapter *tuner_i2c = cx231xx_get_i2c_adap(dev, + dev-board.tuner_i2c_master); dev-sd_tuner = v4l2_i2c_new_subdev(dev-v4l2_dev, - dev-i2c_bus[dev-board.tuner_i2c_master].i2c_adap, + tuner_i2c, tuner, dev-tuner_addr, NULL); if (dev-sd_tuner == NULL) @@ -1062,7 +1064,7 @@ void cx231xx_card_setup(struct cx231xx *dev) struct i2c_client client; memset(client, 0, sizeof(client)); - client.adapter = dev-i2c_bus[I2C_1].i2c_adap; + client.adapter = cx231xx_get_i2c_adap(dev, I2C_1); client.addr = 0xa0 1; read_eeprom(dev, client, eeprom, sizeof(eeprom)); diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 6c7b5e2..869c433 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -378,7 +378,7 @@ static int attach_xc5000(u8 addr, struct cx231xx *dev) struct xc5000_config cfg; memset(cfg, 0, sizeof(cfg)); - cfg.i2c_adap = dev-i2c_bus[dev-board.tuner_i2c_master].i2c_adap; + cfg.i2c_adap = cx231xx_get_i2c_adap(dev, dev-board.tuner_i2c_master); cfg.i2c_addr = addr; if (!dev-dvb-frontend) { @@ -583,6 +583,8 @@ static int dvb_init(struct cx231xx *dev) { int result = 0; struct cx231xx_dvb *dvb; + struct i2c_adapter *tuner_i2c; + struct i2c_adapter *demod_i2c; if (!dev-board.has_dvb) { /* This device does not support the extension */ @@ -599,6 +601,8 @@ static int dvb_init(struct cx231xx *dev) dev-cx231xx_set_analog_freq = cx231xx_set_analog_freq; dev-cx231xx_reset_analog_tuner = cx231xx_reset_analog_tuner; + tuner_i2c = cx231xx_get_i2c_adap(dev, dev-board.tuner_i2c_master); + demod_i2c = cx231xx_get_i2c_adap(dev, dev-board.demod_i2c_master); mutex_lock(dev-lock); cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE); cx231xx_demod_reset(dev); @@ -609,7 +613,7 @@ static int dvb_init(struct cx231xx *dev) dev-dvb-frontend = dvb_attach(s5h1432_attach, dvico_s5h1432_config, - dev-i2c_bus[dev-board.demod_i2c_master].i2c_adap); + demod_i2c); if (dev-dvb-frontend == NULL) { printk(DRIVER_NAME @@ -622,7 +626,7 @@ static int dvb_init(struct cx231xx *dev) dvb-frontend-callback = cx231xx_tuner_callback; if (!dvb_attach(xc5000_attach, dev-dvb-frontend, - dev-i2c_bus[dev-board.tuner_i2c_master].i2c_adap, + tuner_i2c, cnxt_rde250_tunerconfig)) { result = -EINVAL; goto out_free; @@ -634,7 +638,7 @@ static int dvb_init(struct cx231xx *dev) dev-dvb-frontend = dvb_attach(s5h1411_attach,
[PATCH V3 05/13] cx231xx: Modifiy the symbolic constants for i2c ports and describe
Change to I2C_0 ... I2C_2 for the master ports and add I2C_1_MUX_1 and I2C_1_MUX_3 for the muxed ones. V2: Renamed mux adapters to seperate them from master adapters. Signed-off-by: Matthias Schwarzott z...@gentoo.org Reviewed-by: Antti Palosaari cr...@iki.fi --- drivers/media/usb/cx231xx/cx231xx.h | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index c92382f..377216b 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -322,10 +322,11 @@ enum cx231xx_decoder { }; enum CX231XX_I2C_MASTER_PORT { - I2C_0 = 0, - I2C_1 = 1, - I2C_2 = 2, - I2C_3 = 3 + I2C_0 = 0, /* master 0 - internal connection */ + I2C_1 = 1, /* master 1 - used with mux */ + I2C_2 = 2, /* master 2 */ + I2C_1_MUX_1 = 3, /* master 1 - port 1 (I2C_DEMOD_EN = 0) */ + I2C_1_MUX_3 = 4 /* master 1 - port 3 (I2C_DEMOD_EN = 1) */ }; struct cx231xx_board { -- 2.1.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
[PATCH V3 13/13] cx231xx: scan all four existing i2c busses instead of the 3 masters
The scanning itself just fails (as before this series) but now the correct busses are scanned. V2: Changed to symbolic names where muxed adapters can be seen directly. V3: Comment about scanning busses ordered by physical port numbers. Signed-off-by: Matthias Schwarzott z...@gentoo.org Reviewed-by: Antti Palosaari cr...@iki.fi --- drivers/media/usb/cx231xx/cx231xx-core.c | 6 ++ drivers/media/usb/cx231xx/cx231xx-i2c.c | 8 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index c49022f..9b5cd9e 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -1303,6 +1303,12 @@ int cx231xx_dev_init(struct cx231xx *dev) cx231xx_i2c_mux_register(dev, 0); cx231xx_i2c_mux_register(dev, 1); + /* scan the real bus segments in the order of physical port numbers */ + cx231xx_do_i2c_scan(dev, I2C_0); + cx231xx_do_i2c_scan(dev, I2C_1_MUX_1); + cx231xx_do_i2c_scan(dev, I2C_2); + cx231xx_do_i2c_scan(dev, I2C_1_MUX_3); + /* init hardware */ /* Note : with out calling set power mode function, afe can not be set up correctly */ diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index dc9c478..ec51bde 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -492,6 +492,9 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) int i, rc; struct i2c_client client; + if (!i2c_scan) + return; + memset(client, 0, sizeof(client)); client.adapter = cx231xx_get_i2c_adap(dev, i2c_port); @@ -529,10 +532,7 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus) i2c_set_adapdata(bus-i2c_adap, dev-v4l2_dev); i2c_add_adapter(bus-i2c_adap); - if (0 == bus-i2c_rc) { - if (i2c_scan) - cx231xx_do_i2c_scan(dev, bus-nr); - } else + if (0 != bus-i2c_rc) cx231xx_warn(%s: i2c bus %d register FAILED\n, dev-name, bus-nr); -- 2.1.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
[PATCH V3 12/13] cx231xx: drop unconditional port3 switching
All switching should be done by i2c mux adapters. Drop explicit dont_use_port_3 flag. Drop info message about switch. Only the removed code in start_streaming is questionable: It did switch the port_3 flag without accessing i2c in between. Signed-off-by: Matthias Schwarzott z...@gentoo.org Reviewed-by: Antti Palosaari cr...@iki.fi --- drivers/media/usb/cx231xx/cx231xx-avcore.c | 18 -- drivers/media/usb/cx231xx/cx231xx-cards.c | 8 drivers/media/usb/cx231xx/cx231xx-core.c | 4 +--- drivers/media/usb/cx231xx/cx231xx-dvb.c| 4 drivers/media/usb/cx231xx/cx231xx.h| 1 - 5 files changed, 1 insertion(+), 34 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 148b5fa..20bb96a 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -1270,9 +1270,6 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) int status = 0; bool current_is_port_3; - if (dev-board.dont_use_port_3) - is_port_3 = false; - /* Should this code check dev-port_3_switch_enabled first */ /* to skip unnecessary reading of the register? */ /* If yes, the flag dev-port_3_switch_enabled must be initialized */ @@ -1294,9 +1291,6 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) else value[0] = ~I2C_DEMOD_EN; - cx231xx_info(Changing the i2c master port to %d\n, -is_port_3 ? 3 : 1); - status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, value, 4); @@ -2327,9 +2321,6 @@ int cx231xx_set_power_mode(struct cx231xx *dev, enum AV_MODE mode) } if (dev-board.tuner_type != TUNER_ABSENT) { - /* Enable tuner */ - cx231xx_enable_i2c_port_3(dev, true); - /* reset the Tuner */ if (dev-board.tuner_gpio) cx231xx_gpio_set(dev, dev-board.tuner_gpio); @@ -2394,15 +2385,6 @@ int cx231xx_set_power_mode(struct cx231xx *dev, enum AV_MODE mode) } if (dev-board.tuner_type != TUNER_ABSENT) { - /* -* Enable tuner -* Hauppauge Exeter seems to need to do something different! -*/ - if (dev-model == CX231XX_BOARD_HAUPPAUGE_EXETER) - cx231xx_enable_i2c_port_3(dev, false); - else - cx231xx_enable_i2c_port_3(dev, true); - /* reset the Tuner */ if (dev-board.tuner_gpio) cx231xx_gpio_set(dev, dev-board.tuner_gpio); diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 4eb2057..432cbcf 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -262,7 +262,6 @@ struct cx231xx_board cx231xx_boards[] = { .norm = V4L2_STD_PAL, .no_alt_vanc = 1, .external_av = 1, - .dont_use_port_3 = 1, /* Actually, it has a 417, but it isn't working correctly. * So set to 0 for now until someone can manage to get this * to work reliably. */ @@ -390,7 +389,6 @@ struct cx231xx_board cx231xx_boards[] = { .norm = V4L2_STD_NTSC, .no_alt_vanc = 1, .external_av = 1, - .dont_use_port_3 = 1, .input = {{ .type = CX231XX_VMUX_COMPOSITE1, .vmux = CX231XX_VIN_2_1, @@ -532,7 +530,6 @@ struct cx231xx_board cx231xx_boards[] = { .norm = V4L2_STD_NTSC, .no_alt_vanc = 1, .external_av = 1, - .dont_use_port_3 = 1, .input = {{ .type = CX231XX_VMUX_COMPOSITE1, @@ -656,7 +653,6 @@ struct cx231xx_board cx231xx_boards[] = { .norm = V4L2_STD_NTSC, .no_alt_vanc = 1, .external_av = 1, - .dont_use_port_3 = 1, .input = {{ .type = CX231XX_VMUX_COMPOSITE1, .vmux = CX231XX_VIN_2_1, @@ -683,7 +679,6 @@ struct cx231xx_board cx231xx_boards[] = { .norm = V4L2_STD_NTSC, .no_alt_vanc = 1, .external_av = 1, - .dont_use_port_3 = 1, /*.has_417 = 1, */ /* This board is believed to have a hardware encoding chip * supporting mpeg1/2/4, but as the 417 is apparently not @@ -1012,9 +1007,6 @@ static int read_eeprom(struct cx231xx
[PATCH V3 10/13] cx231xx: change usage of I2C_1 to the real i2c port
change almost all instances of I2C_1 to I2C_1_MUX_3 Only these cases are changed to I2C_1_MUX_1: * All that have dont_use_port_3 set. * CX231XX_BOARD_HAUPPAUGE_EXETER, old code did explicitly not switch to port3. * eeprom access for 930C Signed-off-by: Matthias Schwarzott z...@gentoo.org Reviewed-by: Antti Palosaari cr...@iki.fi --- drivers/media/usb/cx231xx/cx231xx-cards.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index f5fb93a..4eb2057 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -104,7 +104,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, @@ -144,7 +144,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x32, @@ -184,7 +184,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x1c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, @@ -225,7 +225,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x1c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, @@ -297,7 +297,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, @@ -325,7 +325,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x32, @@ -353,7 +353,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = I2C_1, + .tuner_i2c_master = I2C_1_MUX_1, .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x0e, @@ -419,7 +419,7 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_sda_gpio = -1, .gpio_pin_status_mask = 0x4001000, .tuner_i2c_master = I2C_2, - .demod_i2c_master = I2C_1, + .demod_i2c_master = I2C_1_MUX_3, .ir_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x10, @@ -457,7 +457,7 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_sda_gpio = -1, .gpio_pin_status_mask = 0x4001000, .tuner_i2c_master = I2C_2, - .demod_i2c_master = I2C_1, + .demod_i2c_master = I2C_1_MUX_3, .ir_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x10, @@ -495,7 +495,7 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_sda_gpio = -1, .gpio_pin_status_mask = 0x4001000, .tuner_i2c_master = I2C_2, - .demod_i2c_master = I2C_1, + .demod_i2c_master = I2C_1_MUX_3, .ir_i2c_master = I2C_2, .rc_map_name = RC_MAP_PIXELVIEW_002T, .has_dvb = 1, @@ -587,7 +587,7 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio =
[PATCH V3 11/13] cx231xx: register i2c mux adapters for master1 and use as I2C_1_MUX_1 and I2C_1_MUX_3
Signed-off-by: Matthias Schwarzott z...@gentoo.org Reviewed-by: Antti Palosaari cr...@iki.fi --- drivers/media/usb/cx231xx/Kconfig| 1 + drivers/media/usb/cx231xx/cx231xx-core.c | 5 drivers/media/usb/cx231xx/cx231xx-i2c.c | 44 +++- drivers/media/usb/cx231xx/cx231xx.h | 4 +++ 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/Kconfig b/drivers/media/usb/cx231xx/Kconfig index 569aa29..173c0e2 100644 --- a/drivers/media/usb/cx231xx/Kconfig +++ b/drivers/media/usb/cx231xx/Kconfig @@ -7,6 +7,7 @@ config VIDEO_CX231XX select VIDEOBUF_VMALLOC select VIDEO_CX25840 select VIDEO_CX2341X + select I2C_MUX ---help--- This is a video4linux driver for Conexant 231xx USB based TV cards. diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index 180103e..c8a6d20 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -1300,6 +1300,9 @@ int cx231xx_dev_init(struct cx231xx *dev) cx231xx_i2c_register(dev-i2c_bus[1]); cx231xx_i2c_register(dev-i2c_bus[2]); + cx231xx_i2c_mux_register(dev, 0); + cx231xx_i2c_mux_register(dev, 1); + /* init hardware */ /* Note : with out calling set power mode function, afe can not be set up correctly */ @@ -1414,6 +1417,8 @@ EXPORT_SYMBOL_GPL(cx231xx_dev_init); void cx231xx_dev_uninit(struct cx231xx *dev) { /* Un Initialize I2C bus */ + cx231xx_i2c_mux_unregister(dev, 1); + cx231xx_i2c_mux_unregister(dev, 0); cx231xx_i2c_unregister(dev-i2c_bus[2]); cx231xx_i2c_unregister(dev-i2c_bus[1]); cx231xx_i2c_unregister(dev-i2c_bus[0]); diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index effd12c..dc9c478 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -24,6 +24,7 @@ #include linux/kernel.h #include linux/usb.h #include linux/i2c.h +#include linux/i2c-mux.h #include media/v4l2-common.h #include media/tuner.h @@ -548,6 +549,46 @@ int cx231xx_i2c_unregister(struct cx231xx_i2c *bus) return 0; } +/* + * cx231xx_i2c_mux_select() + * switch i2c master number 1 between port1 and port3 + */ +static int cx231xx_i2c_mux_select(struct i2c_adapter *adap, + void *mux_priv, u32 chan_id) +{ + struct cx231xx *dev = mux_priv; + + return cx231xx_enable_i2c_port_3(dev, chan_id); +} + +int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no) +{ + struct i2c_adapter *i2c_parent = dev-i2c_bus[1].i2c_adap; + /* what is the correct mux_dev? */ + struct device *mux_dev = dev-udev-dev; + + dev-i2c_mux_adap[mux_no] = i2c_add_mux_adapter(i2c_parent, + mux_dev, + dev /* mux_priv */, + 0, + mux_no /* chan_id */, + 0 /* class */, + cx231xx_i2c_mux_select, + NULL); + + if (!dev-i2c_mux_adap[mux_no]) + cx231xx_warn(%s: i2c mux %d register FAILED\n, +dev-name, mux_no); + + return 0; +} + +void cx231xx_i2c_mux_unregister(struct cx231xx *dev, int mux_no) +{ + i2c_del_mux_adapter(dev-i2c_mux_adap[mux_no]); + dev-i2c_mux_adap[mux_no] = NULL; +} + struct i2c_adapter *cx231xx_get_i2c_adap(struct cx231xx *dev, int i2c_port) { switch (i2c_port) { @@ -558,8 +599,9 @@ struct i2c_adapter *cx231xx_get_i2c_adap(struct cx231xx *dev, int i2c_port) case I2C_2: return dev-i2c_bus[2].i2c_adap; case I2C_1_MUX_1: + return dev-i2c_mux_adap[0]; case I2C_1_MUX_3: - return dev-i2c_bus[1].i2c_adap; + return dev-i2c_mux_adap[1]; default: return NULL; } diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index 8a3c97b..c90aa44 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -628,6 +628,8 @@ struct cx231xx { /* I2C adapters: Master 1 2 (External) Master 3 (Internal only) */ struct cx231xx_i2c i2c_bus[3]; + struct i2c_adapter *i2c_mux_adap[2]; + unsigned int xc_fw_load_done:1; unsigned int port_3_switch_enabled:1; /* locks */ @@ -755,6 +757,8 @@ int cx231xx_reset_analog_tuner(struct cx231xx *dev); void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port); int cx231xx_i2c_register(struct cx231xx_i2c *bus); int cx231xx_i2c_unregister(struct cx231xx_i2c *bus); +int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no); +void cx231xx_i2c_mux_unregister(struct cx231xx *dev, int mux_no); struct i2c_adapter
[PATCH V3 09/13] cx231xx: let is_tuner check the real i2c port and not the i2c master number
Get used i2c port from bus_nr and status of port_3 switch. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-i2c.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 13bf2d7..effd12c 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -54,10 +54,19 @@ do { \ }\ } while (0) +static inline int get_real_i2c_port(struct cx231xx *dev, int bus_nr) +{ + if (bus_nr == 1) + return dev-port_3_switch_enabled ? I2C_1_MUX_3 : I2C_1_MUX_1; + return bus_nr; +} + static inline bool is_tuner(struct cx231xx *dev, struct cx231xx_i2c *bus, const struct i2c_msg *msg, int tuner_type) { - if (bus-nr != dev-board.tuner_i2c_master) + int i2c_port = get_real_i2c_port(dev, bus-nr); + + if (i2c_port != dev-board.tuner_i2c_master) return false; if (msg-addr != dev-board.tuner_addr) -- 2.1.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
Re: [PATCH V3 04/13] cx231xx: give each master i2c bus a seperate name
On 10/02/2014 08:20 AM, Matthias Schwarzott wrote: V2: Use snprintf to construct the complete name Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index a30d400..b10f482 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -506,13 +506,14 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) int cx231xx_i2c_register(struct cx231xx_i2c *bus) { struct cx231xx *dev = bus-dev; + char bus_name[3]; you don't need that variable anymore :] BUG_ON(!dev-cx231xx_send_usb_command); bus-i2c_adap = cx231xx_adap_template; bus-i2c_adap.dev.parent = dev-udev-dev; - strlcpy(bus-i2c_adap.name, bus-dev-name, sizeof(bus-i2c_adap.name)); + snprintf(bus-i2c_adap.name, sizeof(bus-i2c_adap.name), %s-%d, bus-dev-name, bus-nr); bus-i2c_adap.algo_data = bus; i2c_set_adapdata(bus-i2c_adap, dev-v4l2_dev); With a correction for small mistake I mentioned: Reviewed-by: Antti Palosaari cr...@iki.fi 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 1/2] af9033: fix DVBv3 signal strength value not correct issue
Register 0x800048 is not dB measure but relative scale. Fix it and conform to NorDig specifications. From 02ee7de4600a43a322f75cf04d273effa04d3a42 Mon Sep 17 00:00:00 2001 From: Bimow Chen bimow.c...@ite.com.tw Date: Wed, 1 Oct 2014 18:28:54 +0800 Subject: [PATCH 1/2] af9033: fix DVBv3 signal strength value not correct issue Register 0x800048 is not dB measure but relative scale. Fix it and conform to NorDig specifications. Signed-off-by: Bimow Chen bimow.c...@ite.com.tw --- drivers/media/dvb-frontends/af9033.c | 43 +++- drivers/media/dvb-frontends/af9033_priv.h |6 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index 63a89c1..2b3d2f0 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c @@ -862,16 +862,43 @@ static int af9033_read_snr(struct dvb_frontend *fe, u16 *snr) static int af9033_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct af9033_dev *dev = fe-demodulator_priv; - int ret; - u8 strength2; + struct dtv_frontend_properties *c = dev-fe.dtv_property_cache; + int ret, tmp, power_real; + u8 u8tmp, gain_offset, buf[7]; - /* read signal strength of 0-100 scale */ - ret = af9033_rd_reg(dev, 0x800048, strength2); - if (ret 0) - goto err; + if (dev-is_af9035) { + ret = af9033_rd_reg(dev, 0x80004a, u8tmp); + /* scale value to 0x-0x */ + *strength = u8tmp * 0x / 100; + } else { + ret = af9033_rd_reg(dev, 0x8000f7, u8tmp); + ret |= af9033_rd_regs(dev, 0x80f900, buf, 7); + + if (c-frequency = 3) + gain_offset = 7; /* VHF */ + else + gain_offset = 4; /* UHF */ + + power_real = (u8tmp - 100 - gain_offset) - + power_reference[((buf[3] 0) 3)][((buf[6] 0) 7)]; + + if (power_real -15) + tmp = 0; + else if ((power_real = -15) (power_real 0)) + tmp = (2 * (power_real + 15)) / 3; + else if ((power_real = 0) (power_real 20)) + tmp = 4 * power_real + 10; + else if ((power_real = 20) (power_real 35)) + tmp = (2 * (power_real - 20)) / 3 + 90; + else + tmp = 100; + + /* scale value to 0x-0x */ + *strength = tmp * 0x / 100; + } - /* scale value to 0x-0x */ - *strength = strength2 * 0x / 100; + if (ret) + goto err; return 0; diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h index c12c92c..c9c8798 100644 --- a/drivers/media/dvb-frontends/af9033_priv.h +++ b/drivers/media/dvb-frontends/af9033_priv.h @@ -2051,4 +2051,10 @@ static const struct reg_val tuner_init_it9135_62[] = { { 0x80fd8b, 0x00 }, }; +/* NorDig power reference table */ +static const int power_reference[][5] = { + {-93, -91, -90, -89, -88}, /* QPSK 1/2 ~ 7/8 */ + {-87, -85, -84, -83, -82}, /* 16QAM 1/2 ~ 7/8 */ + {-82, -80, -78, -77, -76}, /* 64QAM 1/2 ~ 7/8 */ +}; #endif /* AF9033_PRIV_H */ -- 1.7.0.4
[PATCH 2/2] af9033: fix DVBv3 snr value not correct issue
Snr returns value not correct. Fix it. From 7b7d83e669e1c7a041241c7412fd05a5ca73815c Mon Sep 17 00:00:00 2001 From: Bimow Chen bimow.c...@ite.com.tw Date: Thu, 2 Oct 2014 10:37:13 +0800 Subject: [PATCH 2/2] af9033: fix DVBv3 snr value not correct issue Snr returns value not correct. Fix it. Signed-off-by: Bimow Chen bimow.c...@ite.com.tw --- drivers/media/dvb-frontends/af9033.c | 61 +++- drivers/media/dvb-frontends/af9033_priv.h |5 ++- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index 2b3d2f0..ad4ff78 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c @@ -849,14 +849,42 @@ static int af9033_read_snr(struct dvb_frontend *fe, u16 *snr) { struct af9033_dev *dev = fe-demodulator_priv; struct dtv_frontend_properties *c = dev-fe.dtv_property_cache; + int ret; + u8 u8tmp; /* use DVBv5 CNR */ - if (c-cnr.stat[0].scale == FE_SCALE_DECIBEL) - *snr = div_s64(c-cnr.stat[0].svalue, 100); /* 1000x = 10x */ - else + if (c-cnr.stat[0].scale == FE_SCALE_DECIBEL) { + *snr = div_s64(c-cnr.stat[0].svalue, 1000); + + /* read current modulation */ + ret = af9033_rd_reg(dev, 0x80f903, u8tmp); + if (ret) + goto err; + + /* scale value to 0x-0x */ + switch ((u8tmp 0) 3) { + case 0: + *snr = *snr * 0x / 23; + break; + case 1: + *snr = *snr * 0x / 26; + break; + case 2: + *snr = *snr * 0x / 32; + break; + default: + goto err; + } + } else { *snr = 0; + } return 0; + +err: + dev_dbg(dev-client-dev, failed=%d\n, ret); + + return ret; } static int af9033_read_signal_strength(struct dvb_frontend *fe, u16 *strength) @@ -1038,6 +1066,33 @@ static void af9033_stat_work(struct work_struct *work) snr_val = (buf[2] 16) | (buf[1] 8) | (buf[0] 0); + /* read superframe number */ + ret = af9033_rd_reg(dev, 0x80f78b, u8tmp); + if (ret) + goto err; + + if (u8tmp) + snr_val /= u8tmp; + + /* read current transmission mode */ + ret = af9033_rd_reg(dev, 0x80f900, u8tmp); + if (ret) + goto err; + + switch ((u8tmp 0) 3) { + case 0: + snr_val *= 4; + break; + case 1: + snr_val *= 1; + break; + case 2: + snr_val *= 2; + break; + default: + goto err; + } + /* read current modulation */ ret = af9033_rd_reg(dev, 0x80f903, u8tmp); if (ret) diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h index c9c8798..8e23275 100644 --- a/drivers/media/dvb-frontends/af9033_priv.h +++ b/drivers/media/dvb-frontends/af9033_priv.h @@ -181,7 +181,10 @@ static const struct val_snr qam64_snr_lut[] = { { 0x05570d, 26 }, { 0x059feb, 27 }, { 0x05bf38, 28 }, - { 0xff, 29 }, + { 0x05f78f, 29 }, + { 0x0612c3, 30 }, + { 0x0626be, 31 }, + { 0xff, 32 }, }; static const struct reg_val ofsm_init[] = { -- 1.7.0.4
Re: [PATCH V3 08/13] cx231xx: remember status of i2c port_3 switch
On 10/02/2014 08:21 AM, Matthias Schwarzott wrote: This is used later for is_tuner function that switches i2c behaviour for some tuners. V2: Add comments about possible improvements for port_3 switch function. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/cx231xx-avcore.c | 10 ++ drivers/media/usb/cx231xx/cx231xx.h| 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 40a6987..148b5fa 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -1272,6 +1272,12 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) if (dev-board.dont_use_port_3) is_port_3 = false; + + /* Should this code check dev-port_3_switch_enabled first */ + /* to skip unnecessary reading of the register? */ + /* If yes, the flag dev-port_3_switch_enabled must be initialized */ + /* correctly. */ That multiline comment is violates Linux CodingStyle. See Documentation/CodingStyle + status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, 4); if (status 0) @@ -1294,6 +1300,10 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, value, 4); + /* remember status of the switch for usage in is_tuner */ + if (status = 0) + dev-port_3_switch_enabled = is_port_3; + return status; } diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index f03338b..8a3c97b 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -629,6 +629,7 @@ struct cx231xx { /* I2C adapters: Master 1 2 (External) Master 3 (Internal only) */ struct cx231xx_i2c i2c_bus[3]; unsigned int xc_fw_load_done:1; + unsigned int port_3_switch_enabled:1; /* locks */ struct mutex gpio_i2c_lock; struct mutex i2c_lock; I trust functionality is correct. However, I expected to see mux switching logic inside mux select() / deselect(), maybe with caching mux switch position in order to avoid I/O needed for checking mux switch position. But as I don't know that driver internals very well, I am not adding reviewed by tag, which does not mean that is wrong. It is simply because I don't know. 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