summaryrefslogtreecommitdiff
path: root/drivers/media
AgeCommit message (Collapse)Author
2015-04-02[media] rtl28xxu: return success for unimplemented FE callbackAntti Palosaari
Return success for FE callback on case we don't have any special implementation. fc0013 tuner driver calls that callback in order to switch antenna input, even we don't provide antenna switch. Returning error caused fc0013 driver given up tuning. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] rtl2832: disable regmap register cacheAntti Palosaari
Caching register reads causes some random I/O errors on channel change. Disable caching now in order to avoid those errors. Reverts partly commit dcadb82 Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vb2: Fix dma_dir setting for dma-contig mem typeSakari Ailus
The last argument of vb2_dc_get_user_pages() is of type enum dma_data_direction, but the caller, vb2_dc_get_userptr() passes a value which is the result of comparison dma_dir == DMA_FROM_DEVICE. This results in the write parameter to get_user_pages() being zero in all cases, i.e. that the caller has no intent to write there. This was broken by patch "vb2: replace 'write' by 'dma_dir'". Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Cc: stable@vger.kernel.org # for v3.19 Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-01[media] media: s5p-mfc: fix broken pointer cast on 64bit archMarek Szyprowski
Unsigned int cannot be used to store casted pointer on 64bit architecture, so correct such casts to properly use unsigned long variables. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> [k.debski@samsung.com: removed volatile and __iomem from cast] Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-01[media] media: s5p-mfc: fix mmap support for 64bit archMarek Szyprowski
TASK_SIZE is depends on the systems architecture (32 or 64 bits) and it should not be used for defining offset boundary for mmaping buffers for CAPTURE and OUTPUT queues. This patch fixes support for MMAP calls on the CAPTURE queue on 64bit architectures (like ARM64). Cc: stable@vger.kernel.org Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-01[media] cx23885: fix querycapHans Verkuil
cap->device_caps wasn't set in cx23885-417.c causing a warning from the v4l2-core. Reported-by: Joseph Jasi <joe.yasi@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v3.19 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-01[media] sh_veu: v4l2_dev wasn't setHans Verkuil
The v4l2_dev field of struct video_device must be set correctly. This was never done for this driver, so no video nodes were created anymore. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v3.11 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-04[media] s5p-mfc: Fix NULL pointer dereference caused by not set q->lockKamil Debski
The patch "media: s5p-mfc: use vb2_ops_wait_prepare/finish helper" (654a731be1a0b6f606f3f3d12b50db08f2ae3c3) introduced a kernel panic. The q->lock was set for just one queue, the other was not set thus causing a NULL pointer dereference. Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-04[media] s5p-jpeg: exynos3250: fix erroneous reset procedureJacek Anaszewski
The first while loop in the function exynos3250_jpeg_reset had no chance to be executed because the reg variable was initialized to 0. Initialize reg variable to 1 to fix the issue. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Reported-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-04[media] s5p-tv: hdmi needs I2C supportArnd Bergmann
Building the s5p-tv HDMI support when CONFIG_I2C is disabled gives us this build error: s5p-tv/hdmi_drv.c: In function 'hdmi_probe': s5p-tv/hdmi_drv.c:947:2: error: implicit declaration of function 'i2c_get_adapter' [-Werror=implicit-function-declaration] adapter = i2c_get_adapter(pdata->hdmiphy_bus); ^ This patch changes the Kconfig description to include I2C as a dependency for this driver, so it cannot be configured incorrectly. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-04[media] s5p-jpeg: Initialize cb and cr to zeroTony K Nadackal
To avoid garbage value written into image base address planes, initialize cb and cr of structure s5p_jpeg_addr to zero. Signed-off-by: Tony K Nadackal <tony.kn@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03[media] media: fix gspca drivers build dependenciesRandy Dunlap
Several (15) drivers in media/usb/gspca use IF_ENABLED(CONFIG_INPUT) to decide if they should call input* interfaces, but those drivers do not build successfully when CONFIG_INPUT=m and the gspca drivers are builtin (=y). Making USB_GSPCA depend on INPUT || INPUT=n fixes the build dependencies and allows all of them to build cleanly. Fixes these build errors (selections, not all are listed): drivers/built-in.o: In function `gspca_disconnect': (.text+0x32ed0f): undefined reference to `input_unregister_device' drivers/built-in.o: In function `sd_isoc_irq': konica.c:(.text+0x333098): undefined reference to `input_event' konica.c:(.text+0x3330ab): undefined reference to `input_event' drivers/built-in.o: In function `sd_stopN': konica.c:(.text+0x3338d3): undefined reference to `input_event' konica.c:(.text+0x3338e5): undefined reference to `input_event' drivers/built-in.o: In function `ov51x_handle_button': ov519.c:(.text+0x335ddb): undefined reference to `input_event' drivers/built-in.o:ov519.c:(.text+0x335ded): more undefined references to `input_event' follow pac7302.c:(.text+0x336ea1): undefined reference to `input_event' pac7302.c:(.text+0x336eb3): undefined reference to `input_event' drivers/built-in.o: In function `sd_pkt_scan': spca561.c:(.text+0x338fd8): undefined reference to `input_event' drivers/built-in.o:spca561.c:(.text+0x338feb): more undefined references to `input_event' follow t613.c:(.text+0x33a6fd): undefined reference to `input_event' drivers/built-in.o:t613.c:(.text+0x33a70f): more undefined references to `input_event' follow Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03[media] soc-camera: Fix devm_kfree() in soc_of_bind()Geert Uytterhoeven
Unlike scan_async_group(), soc_of_bind() doesn't allocate its soc_camera_async_client structure using devm_kzalloc(), but has it embedded inside the soc_of_info structure. Hence on failure, it must free the whole soc_of_info structure, and not just the embedded soc_camera_async_client structure, as the latter causes a warning, and may cause slab corruption: soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0 ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at drivers/base/devres.c:887 devm_kfree+0x30/0x40() CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.19.0-shmobile-08386-g37feb0d093cb2d8e #128 Hardware name: Generic R8A7791 (Flattened Device Tree) Backtrace: [<c0011e7c>] (dump_backtrace) from [<c0012024>] (show_stack+0x18/0x1c) r6:c05a923b r5:00000009 r4:00000000 r3:00204140 [<c001200c>] (show_stack) from [<c048ed30>] (dump_stack+0x78/0x94) [<c048ecb8>] (dump_stack) from [<c002687c>] (warn_slowpath_common+0x8c/0xb8) r4:00000000 r3:00000000 [<c00267f0>] (warn_slowpath_common) from [<c0026980>] (warn_slowpath_null+0x24/0x2c) r8:ee7d8214 r7:ed83b810 r6:ed83bc20 r5:fffffffa r4:ed83e510 [<c002695c>] (warn_slowpath_null) from [<c025e0cc>] (devm_kfree+0x30/0x40) [<c025e09c>] (devm_kfree) from [<c032bbf4>] (soc_of_bind.isra.14+0x194/0x1d4) [<c032ba60>] (soc_of_bind.isra.14) from [<c032c6b8>] (soc_camera_host_register+0x208/0x31c) r9:00000070 r8:ee7e05d0 r7:ee153210 r6:00000000 r5:ee7e0218 r4:ed83bc20 [<c032c4b0>] (soc_camera_host_register) from [<c032e80c>] (rcar_vin_probe+0x1f4/0x238) r8:ee153200 r7:00000008 r6:ee153210 r5:ed83bc10 r4:c066319c r3:000000c0 [<c032e618>] (rcar_vin_probe) from [<c025c334>] (platform_drv_probe+0x50/0xa0) r10:00000000 r9:c0662fa8 r8:00000000 r7:c06a3700 r6:c0662fa8 r5:ee153210 r4:00000000 [<c025c2e4>] (platform_drv_probe) from [<c025af08>] (driver_probe_device+0xc4/0x208) r6:c06a36f4 r5:00000000 r4:ee153210 r3:c025c2e4 [<c025ae44>] (driver_probe_device) from [<c025b108>] (__driver_attach+0x70/0x94) r9:c066f9c0 r8:c0624a98 r7:c065b790 r6:c0662fa8 r5:ee153244 r4:ee153210 [<c025b098>] (__driver_attach) from [<c025984c>] (bus_for_each_dev+0x74/0x98) r6:c025b098 r5:c0662fa8 r4:00000000 r3:00000001 [<c02597d8>] (bus_for_each_dev) from [<c025b1dc>] (driver_attach+0x20/0x28) r6:ed83c200 r5:00000000 r4:c0662fa8 [<c025b1bc>] (driver_attach) from [<c025a00c>] (bus_add_driver+0xdc/0x1c4) [<c0259f30>] (bus_add_driver) from [<c025b8f4>] (driver_register+0xa4/0xe8) r7:c0624a98 r6:00000000 r5:c060b010 r4:c0662fa8 [<c025b850>] (driver_register) from [<c025ccd0>] (__platform_driver_register+0x50/0x64) r5:c060b010 r4:ed8394c0 [<c025cc80>] (__platform_driver_register) from [<c060b028>] (rcar_vin_driver_init+0x18/0x20) [<c060b010>] (rcar_vin_driver_init) from [<c05edde8>] (do_one_initcall+0x108/0x1b8) [<c05edce0>] (do_one_initcall) from [<c05edfb4>] (kernel_init_freeable+0x11c/0x1e4) r9:c066f9c0 r8:c066f9c0 r7:c062eab0 r6:c06252c4 r5:000000ad r4:00000006 [<c05ede98>] (kernel_init_freeable) from [<c048c3d0>] (kernel_init+0x10/0xec) r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c048c3c0 r4:00000000 [<c048c3c0>] (kernel_init) from [<c000eba0>] (ret_from_fork+0x14/0x34) r4:00000000 r3:ee04e000 ---[ end trace e3a984cc0335c8a0 ]--- rcar_vin e6ef1000.video: group probe failed: -6 Fixes: 1ddc6a6caa94e1e1 ("[media] soc_camera: add support for dt binding soc_camera drivers") Cc: <stable@vger.kernel.org> # 3.17+ Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02[media] media: atmel-isi: increase the burst length to improve the performanceJosh Wu
The burst length could be BEATS_4/8/16. Before this patch, isi use default value BEATS_4. To imporve the performance we could set it to BEATS_16. Otherwise sometime it would cause the ISI overflow error. Reported-by: Bo Shen <voice.shen@atmel.com> Signed-off-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02[media] vb2: fix 'UNBALANCED' warnings when calling vb2_thread_stop()Hans Verkuil
Stopping the vb2 thread (as used by several DVB devices) can result in an 'UNBALANCED' warning such as this: vb2: counters for queue ffff880407ee9828: UNBALANCED! vb2: setup: 1 start_streaming: 1 stop_streaming: 1 vb2: wait_prepare: 249333 wait_finish: 249334 This is due to a race condition between stopping the thread and calling vb2_internal_streamoff(). While I have not been able to deduce the exact mechanism how this race condition can produce this warning, I can see that the way the stream is stopped is likely to lead to a race somewhere. This patch simplifies how this is done by first ensuring that the thread is completely stopped before cleaning up the vb2 queue. It does that by setting threadio->stop to true, followed by a call to vb2_queue_error() which will wake up the thread. The thread sees that 'stop' is true and it will exit. The call to kthread_stop() waits until the thread has exited, and only then is the queue cleaned up by calling __vb2_cleanup_fileio(). This is a much cleaner sequence and the warning has now disappeared. Reported-by: Jurgen Kramer <gtmkramer@xs4all.nl> Tested-by: Jurgen Kramer <gtmkramer@xs4all.nl> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v3.18 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-11mm: gup: use get_user_pages_unlockedAndrea Arcangeli
This allows those get_user_pages calls to pass FAULT_FLAG_ALLOW_RETRY to the page fault in order to release the mmap_sem during the I/O. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Andres Lagar-Cavilla <andreslc@google.com> Cc: Peter Feiner <pfeiner@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-02-03[media] dvb_net: Convert local hex dump to print_hex_dump_debugJoe Perches
Use the generic facility instead of a home-grown one. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] dvb_net: Use standard debugging facilitiesJoe Perches
Convert dprintk to netdev_dbg where appropriate. Remove dvb_net_debug module_param. Remove __func__ from output as that can be added by dynamic_debug. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] dvb_net: Use vsprintf %pM extension to print Ethernet addressesJoe Perches
No need for more macros, so remove them and use the kernel extension. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] stb0899: use sign_extend32() for sign extensionMartin Kepplinger
Instead of implement its own logic, use the already-defined one. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] si2168: add support for 1.7MHz bandwidthOlli Salonen
This patch is based on Antti's silabs branch. Add support for 1.7 MHz bandwidth. Supported in all versions of Si2168 according to short data sheets. [mchehab@osg.samsung.com: Fix CodingStyle] Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] si2168: return error if set_frontend is called with invalid parametersOlli Salonen
This patch should is based on Antti's silabs branch. According to dvb-frontend.h set_frontend may be called with bandwidth_hz set to 0 if automatic bandwidth is required. Si2168 does not support automatic bandwidth and does not declare FE_CAN_BANDWIDTH_AUTO in caps. This patch will change the behaviour in a way that EINVAL is returned if bandwidth_hz is 0. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] lirc_dev: avoid potential null-dereferenceAndy Shevchenko
We have to check pointer for NULL and then dereference it. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] dvb: tc90522: re-add symbol-rate reportAkihiro Tsukada
symbol-rate report was wrongly removed off by the commit:906aaf5a . Signed-off-by: Akihiro Tsukada <tskd08@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] lmedm04: add read snr, signal strength and ber call backsMalcolm Priestley
This allows calling the original functions providing the streaming is off. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] lmedm04: Create frontend call back for read statusMalcolm Priestley
Create dm04_read_status to check lock through either interrupt values or directly by the call back. When the device is not streaming the frontends original call back is used. When streaming has started it turns off I2C messaging by setting st->i2c_talk_onoff to zero. I2C can only be turn on again by one of the other allowed frontend calls. All old code is removed from lme2510_msg and this function only needs to set st->i2c_talk_onoff to 1. The lock status is saved and when the frondend is locked is maintained by lme2510_int_response who will now just kill the lock. The call back for rs2000 tuner is nologer required. All frontend types have been tested. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] lmedm04: create frontend callbacks for signal/snr/ber/ucblocksMalcolm Priestley
Create call backs dm04_read_signal_strength, dm04_read_snr and move dm04_read_ber and dm04_read_ucblocks for all frontends Removing the I2C filtering from lme2510_msg and the old rs2000 callbacks. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in ↵Malcolm Priestley
interrupt urb A quirk of some older firmwares that report endpoint pipe type as PIPE_BULK but the endpoint otheriwse functions as interrupt. Check if usb_endpoint_type is USB_ENDPOINT_XFER_BULK and set as usb_rcvbulkpipe. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] lmedm04: Increase Interupt due time to 200 msecMalcolm Priestley
Ocassionally the device fails to report back an interrupt urb status which results in false no lock trigger on the RS2000 demodulator. Increase time from 60 msecs to 200 msecs. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Cc: <stable@vger.kernel.org> # v3.17+ Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] cx88-dvb: whitespace cleanupMauro Carvalho Chehab
X-Patchwork-Delegate: m.chehab@samsung.com Fix the following smatch warning: drivers/media/pci/cx88//cx88-dvb.c:1508 dvb_register() warn: if statement not indented Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: properly initialize pdataMauro Carvalho Chehab
As complained by smatch: drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1159 rtl2832u_tuner_attach() info: 'pdata' is not actually initialized (unreached code). Cc: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl2832: declare functions as staticMauro Carvalho Chehab
drivers/media/dvb-frontends/rtl2832.c:157:5: warning: no previous prototype for ‘rtl2832_bulk_write’ [-Wmissing-prototypes] int rtl2832_bulk_write(struct i2c_client *client, unsigned int reg, ^ drivers/media/dvb-frontends/rtl2832.c:169:5: warning: no previous prototype for ‘rtl2832_update_bits’ [-Wmissing-prototypes] int rtl2832_update_bits(struct i2c_client *client, unsigned int reg, ^ drivers/media/dvb-frontends/rtl2832.c:181:5: warning: no previous prototype for ‘rtl2832_bulk_read’ [-Wmissing-prototypes] int rtl2832_bulk_read(struct i2c_client *client, unsigned int reg, void *val, Cc: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl2830: declare functions as staticMauro Carvalho Chehab
drivers/media/dvb-frontends/rtl2830.c:21:5: warning: no previous prototype for ‘rtl2830_bulk_write’ [-Wmissing-prototypes] int rtl2830_bulk_write(struct i2c_client *client, unsigned int reg, ^ drivers/media/dvb-frontends/rtl2830.c:33:5: warning: no previous prototype for ‘rtl2830_update_bits’ [-Wmissing-prototypes] int rtl2830_update_bits(struct i2c_client *client, unsigned int reg, ^ drivers/media/dvb-frontends/rtl2830.c:45:5: warning: no previous prototype for ‘rtl2830_bulk_read’ [-Wmissing-prototypes] int rtl2830_bulk_read(struct i2c_client *client, unsigned int reg, void *val, ^ Cc: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl2832_sdr: add kernel-doc comments for platform_dataAntti Palosaari
Add kernel-doc comments for platform_data configuration structure. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl2832: add kernel-doc comments for platform_dataAntti Palosaari
Add kernel-doc comments for platform_data configuration structure. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl2830: add kernel-doc comments for platform_dataAntti Palosaari
Add kernel-doc comments for platform_data configuration structure. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl2832: implement own lock for regmapAntti Palosaari
Introduce own lock to silence lockdep warning. lockdep validator makes wrong decision when two similar (&map->mutex) locks were taken recursively, even those are different mutexes in a two different drivers. After that patch, functionality remains same, but mutex names are different. That is a temporary hack, proper solution is make regmap aware of locked nested locking rules. ============================================= [ INFO: possible recursive locking detected ] 3.18.0-rc4+ #4 Tainted: G O --------------------------------------------- kdvb-ad-0-fe-0/2814 is trying to acquire lock: (&map->mutex){+.+.+.}, at: [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40 but task is already holding lock: (&map->mutex){+.+.+.}, at: [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&map->mutex); lock(&map->mutex); *** DEADLOCK *** May be due to missing lock nesting notation 1 lock held by kdvb-ad-0-fe-0/2814: #0: (&map->mutex){+.+.+.}, at: [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40 stack backtrace: CPU: 3 PID: 2814 Comm: kdvb-ad-0-fe-0 Tainted: G O 3.18.0-rc4+ #4 Hardware name: System manufacturer System Product Name/M5A78L-M/USB3, BIOS 2001 09/11/2014 0000000000000000 00000000410c8772 ffff880293af3868 ffffffff817a6f82 0000000000000000 ffff8800b3462be0 ffff880293af3968 ffffffff810e7f94 ffff880293af3888 00000000410c8772 ffffffff82dfee60 ffffffff81ab8f89 Call Trace: [<ffffffff817a6f82>] dump_stack+0x4e/0x68 [<ffffffff810e7f94>] __lock_acquire+0x1ea4/0x1f50 [<ffffffff810e2a7d>] ? trace_hardirqs_off+0xd/0x10 [<ffffffff817b01f3>] ? _raw_spin_lock_irqsave+0x83/0xa0 [<ffffffff810e13e6>] ? up+0x16/0x50 [<ffffffff810e2a7d>] ? trace_hardirqs_off+0xd/0x10 [<ffffffff817af8bf>] ? _raw_spin_unlock_irqrestore+0x5f/0x70 [<ffffffff810e9069>] lock_acquire+0xc9/0x170 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40 [<ffffffff817ab50e>] mutex_lock_nested+0x7e/0x430 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40 [<ffffffff817a530b>] ? printk+0x70/0x86 [<ffffffff8110d9e8>] ? mod_timer+0x168/0x240 [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40 [<ffffffff814f08d9>] regmap_update_bits+0x29/0x60 [<ffffffffa03e9778>] rtl2832_select+0x38/0x70 [rtl2832] [<ffffffffa039b03d>] i2c_mux_master_xfer+0x3d/0x90 [i2c_mux] [<ffffffff815da493>] __i2c_transfer+0x73/0x2e0 [<ffffffff815dbaba>] i2c_transfer+0x5a/0xc0 [<ffffffff815dbb6e>] i2c_master_send+0x4e/0x70 [<ffffffffa03ff25a>] regmap_i2c_write+0x1a/0x50 [regmap_i2c] [<ffffffff817ab713>] ? mutex_lock_nested+0x283/0x430 [<ffffffff814f06b2>] _regmap_raw_write+0x862/0x880 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40 [<ffffffff814f0744>] _regmap_bus_raw_write+0x74/0xa0 [<ffffffff814ef3d2>] _regmap_write+0x92/0x140 [<ffffffff814f0b7b>] regmap_write+0x4b/0x70 [<ffffffffa032b090>] ? dvb_frontend_release+0x110/0x110 [dvb_core] [<ffffffffa05141d4>] e4000_init+0x34/0x210 [e4000] [<ffffffffa032a029>] dvb_frontend_init+0x59/0xc0 [dvb_core] [<ffffffff810bde30>] ? finish_task_switch+0x80/0x180 [<ffffffff810bddf2>] ? finish_task_switch+0x42/0x180 [<ffffffffa032b116>] dvb_frontend_thread+0x86/0x7b0 [dvb_core] [<ffffffff817a9203>] ? __schedule+0x343/0x930 [<ffffffffa032b090>] ? dvb_frontend_release+0x110/0x110 [dvb_core] [<ffffffff810b826b>] kthread+0x10b/0x130 [<ffffffff81020099>] ? sched_clock+0x9/0x10 [<ffffffff810b8160>] ? kthread_create_on_node+0x250/0x250 [<ffffffff817b063c>] ret_from_fork+0x7c/0xb0 [<ffffffff810b8160>] ? kthread_create_on_node+0x250/0x250 Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: correct reg access routine name prefixesAntti Palosaari
Use rtl28xxu_ prefix for all register access routine names. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: merge rtl2831u and rtl2832u propertiesAntti Palosaari
As all the callbacks are already same we could merge device properties struct too and save space. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: merge chip type specific all callbacksAntti Palosaari
Merge all chip type specific prefixed (rtl2831u_ and rtl2832u_) callback to top level callback prefixed as rtl28xxu_. rtl2831u_foo() => rtl28xxu_foo() rtl2832u_foo() => rtl28xxu_foo() Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: add heuristic to detect chip typeAntti Palosaari
Detect automatically whether chip is old RTL2831U or newer RTL2832U/RTL2832P. Detection is based I2C command that is found only from newer RTL2832U models. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: move usb buffers to stateAntti Palosaari
Buffer needed for USB control message is small so move it to state and get rid of alloc/free used for each control message. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: fix loggingAntti Palosaari
Pass correct device pointer to dev_* logging in order to print module name and bus id correctly. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: rename state variable 'priv' to 'dev'Antti Palosaari
I prefer dev over priv and I want keep all my drivers in line with that. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl2832: remove internal mux I2C adapterAntti Palosaari
There was 2 muxed I2C adapters, one for demod tuner bus and one for internal use. Idea of internal I2C adapter was to force I2C repeater close when demod access its registers. Driver has also delayed work queue based method to close I2C repeater. After regmap conversion internal I2C adapter based repeater close left unused - only work queue method was in use. We could not use internal mux adapter method with regmap as it makes recursive regmap call, which causes deadlock as regmap has own locking. Due to that remove whole method totally. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl2832_sdr: refcount to rtl28xxuAntti Palosaari
We are consumer of DVB frontend provided by rtl28xxu module. Due to that we must use refcount to ensure none could remove rtl28xxu when we are alive (or when we are streaming, if more fine-grained refcounting is wanted). Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: do not refcount rtl2832_sdr moduleAntti Palosaari
This driver, rtl28xxu, offers frontend service for rtl2832_sdr module, thus we are producer and rtl2832_sdr module is consumer. Due to that, reference counting should be done in way rtl2832_sdr takes refrence to rtl28xxu. Remove wrong refcount. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: simplify FE callback handlingAntti Palosaari
Logic is so simple that there is no idea to separate tuner selection to own function, instead do it in a callback and get rid of one function. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: fix DVB FE callbackAntti Palosaari
DVB FE callback functionality went broken after I moved tuners to demod muxed I2C adapter. That happens because driver state was carried by I2C adapter and when mux is used there is one adapter more in a chain. USB adapter <-> I2C adapter <-> muxed I2C adapter Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl2832: implement sleepAntti Palosaari
Put demod to soft reset in order to save power when sleep. That drops power usage ~30mA @5V on USB dongle I tested. In real life it does not matter much as USB IF powers off demod too, but now it is done twice - demod and USB IF. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>