summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends
AgeCommit message (Collapse)Author
2014-03-04[media] drx-j: Allow userspace control of LNAMauro Carvalho Chehab
Instead of just disabling the LNA every time, allow to control it from userspace. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of function wrappersMauro Carvalho Chehab
On several places, the I2C functions are just wrappers to others. Get rid of it. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of struct drx_dap_fasi_funct_gMauro Carvalho Chehab
This struct contains the first abstraction layer for the I2C access routines. Get rid of it. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of drx_dap_fasi.cMauro Carvalho Chehab
This file contains an abstract layer for the I2C transfer functions. Get rid of it, merging it at drxj. This will allow to remove another abstraction layer there, making the code easier to read, and removing the functions that just return -EIO. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of function prototypes at drx_dap_fasi.cMauro Carvalho Chehab
Reorder functions and data at drx_dap_fasi.c, in order to avoid having function prototypes. This is in preparation to merge this code inside drxj, removing some duplicated bits there, and getting rid of yet another abstraction layer. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Get rid of I2C protocol versionMauro Carvalho Chehab
This is not used anywere. Get rid of it. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Fix qam/256 modeMauro Carvalho Chehab
QAM/256 currently doesn't work, as the code is only called if channel->mirror is DRX_MIRROR_AUTO, but a prevous if prevents this condition to happen. While here, returns -EINVAL to not supported QAM modes and simplify the code, reducing the number of indents. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: remove some unused dataMauro Carvalho Chehab
Those struct data aren't used anymore. Get rid of them. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: use the proper timeout code on scu_commandMauro Carvalho Chehab
Checking if a time is after another one can have issues, as times are generally u32 wide. Use the proper macros for that at scu_command(). It should be noticed that other places also use jiffies calculus on an improper way. This should be fixed too, but the logic there is more complex. So, let's do it in separate patches. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: call ctrl_set_standard even if a standard is poweredMauro Carvalho Chehab
Modulation and other parameters might have changed. So, better to call ctrl_set_standard() even if the device is already powered. That helps to put the device into a sane state, if something got wrong on a previous set_frontend call. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: avoid calling power_down_foo twiceMauro Carvalho Chehab
When switching from one video standard to another one, power_down_vsb is called twice. Well, as the device is already in power_down mode, the second call always fail. This causes that any subsequent frontend set to fail as well: [145074.501243] drx39xyj:power_down_vsb: called [145089.195396] drx39xyj:power_down_vsb: error -5 [145089.195404] drx39xyj:ctrl_set_standard: error -5 [145089.195417] drx39xyj:drx39xxj_set_frontend: Failed to set standard! result=fffffffb [145089.195470] drx39xyj:ctrl_sig_quality: error -5 [145089.195473] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber! [145089.195475] drx39xyj:ctrl_sig_quality: error -5 [145089.195477] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength! [145089.195479] drx39xyj:ctrl_sig_quality: error -5 [145089.195480] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr! [145089.195482] drx39xyj:ctrl_sig_quality: error -5 [145089.195484] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks! [145089.195498] drx39xyj:ctrl_sig_quality: error -5 [145089.195500] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber! [145089.195502] drx39xyj:ctrl_sig_quality: error -5 [145089.195503] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength! [145089.195505] drx39xyj:ctrl_sig_quality: error -5 [145089.195506] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr! [145089.195508] drx39xyj:ctrl_sig_quality: error -5 [145089.195510] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks! [145090.196291] drx39xyj:drx39xxj_read_status: drx39xxj: could not get lock status! [145090.196508] drx39xyj:ctrl_sig_quality: error -5 [145090.196511] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber! [145090.196514] drx39xyj:ctrl_sig_quality: error -5 [145090.196515] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength! [145090.196518] drx39xyj:ctrl_sig_quality: error -5 [145090.196519] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr! [145090.196522] drx39xyj:ctrl_sig_quality: error -5 [145090.196523] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks! [145090.196553] drx39xyj:ctrl_sig_quality: error -5 [145090.196554] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber! [145090.196557] drx39xyj:ctrl_sig_quality: error -5 [145090.196558] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength! [145090.196560] drx39xyj:ctrl_sig_quality: error -5 [145090.196562] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr! [145090.196564] drx39xyj:ctrl_sig_quality: error -5 [145090.196565] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks! [145091.119265] drx39xyj:ctrl_sig_quality: error -5 [145091.119271] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber! [145091.119274] drx39xyj:ctrl_sig_quality: error -5 [145091.119276] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength! [145091.119278] drx39xyj:ctrl_sig_quality: error -5 [145091.119280] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr! [145091.119282] drx39xyj:ctrl_sig_quality: error -5 [145091.119283] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks! Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: be sure to use tuner's IFMauro Carvalho Chehab
Instead of just hardcoding an IF value of 5MHz, use the one provided by the tuner, with can be different for QAM and VSB. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of tuner dummy get/set frequencyMauro Carvalho Chehab
Those functions will never be used with Linux DVB binding. Get rid of them. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: remove some ugly bindings from drx39xxj_dummy.cMauro Carvalho Chehab
This file does an ugly binding between drxj and DVB frontend. Remove most of the functions there. We still need to get rid of get_frequency and set_frequency, but such patch is a little more complex, as it should also remove some previous tuner bindings. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: comment or remove unused codeMauro Carvalho Chehab
In order to avoid warnings and to remove dead code, remove the functions that don't make sense to happen, while commenting the others that might still be useful some day. That reduced a lot the text size: Before: text data bss dec hex filename 58419 2916 4 61339 ef9b drivers/media/dvb-frontends/drx39xyj/drx39xyj.ko After: text data bss dec hex filename 78331 2916 4 81251 13d63 drivers/media/dvb-frontends/drx39xyj/drx39xyj.ko Without any functional changes. It could be make sense latter to remove those drivers or to move them into an analog-specific part of the driver. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of drxj_ctrl()Mauro Carvalho Chehab
With this change, we finally got rid of all abstraction layers on this driver. This patch also fixes the LNA GPIO settings, as the original code were using a wrong control name for it. This patch exposes the several functions that aren't used. Some of them are related to analog demod that might be used some day, but others will likely never be needed, as they don't fit on Linux media APIs. Latter patches will clean up this mess. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: move drx39xxj into drxj.cMauro Carvalho Chehab
While drxj is already too big, moving the code there will make easier to get rid of the drxj_ctrl function. It will also help to detect and remove the unused functions, helping to remove lots of dead code there. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of the remaining drx generic functionsMauro Carvalho Chehab
Get rid of drx_open and drx_close, as those are just wrapper functions to drxj_open/drxj_close. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of drx_ctrlMauro Carvalho Chehab
This function is used only as an abstraction layer to call the two firmware functions. Remove it. As a bonus, the drx_ctrl_function is now unused and can be removed. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Remove duplicated firmware upload codeMauro Carvalho Chehab
Remove the duplicated firmware upload code that was commented inside drxj.c. This code is not used, and will not work anyway, as it doesn't download the firmware from userspace. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Avoid any regressions by preserving old behaviorMauro Carvalho Chehab
The version is initialized with zero at drx_driver.c. Keep it, in order to avoid the risk of causing any regression. While here, remove the drx_driver.h from drxj, as this is not required there. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of drx_driver.cMauro Carvalho Chehab
This file contains just the firmware load code, that it is also somewhat duplicated at drxj.c. Move the code into there. Latter patches will remove the duplicated code. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: prepend function names with drx_ at drx_driver.cMauro Carvalho Chehab
In order to prepare to get rid of drx_driver.c, prepend all functions there with drx_. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Some cleanups at drx_driver.c sourceMauro Carvalho Chehab
This is mostly CodingStyle fixes and improvements. No functional changes. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Allow standard selectionMauro Carvalho Chehab
ClearQAM is currently not working. Add support for it too. Unlikely other ATSC tuners, though, this device will not auto-detect between ATSC and ClearQAM. So, the delivery system should be properly set. Also, this frontend seems to also support DVB-C annex A/C. Add experimental support for them. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: reset the DVB scan configuration at powerupMauro Carvalho Chehab
Without this fixup, the DRX-J will not be properly initialized, loosing several PIDs. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of its own be??_to_cpu() implementationMauro Carvalho Chehab
Instead of handling endiannes with its own internal way, use the already existing macros. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: remove unused code from drx_driver.cMauro Carvalho Chehab
There are several drx-j code there that are never used, as they don't even fit into Linux DVB subystem model. Remove them, in order to simplify the code. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Split firmware size check from the main routineMauro Carvalho Chehab
The firmware upload routine is already complex enough. Split the first loop that verifies the firmware size into a separate routine, making the code more readable. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: dynamically load the firmwareMauro Carvalho Chehab
Instead of hardcoding the firmware files together with the driver, use request_firmware() way, loading it from userspace. The firmware files are placed at: http://linuxtv.org/downloads/firmware/#8 And they'll be latter submitted to linux-firmware git tree. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Be sure that all allocated data are properly initializedMauro Carvalho Chehab
The state struct is allocated without cleaning the memory. This causes random bugs. Clean it, and move the memcpy functions just below each kalloc, to be clearer that all those data are properly filled. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Fix release and error path on drx39xxj.cMauro Carvalho Chehab
There are memory leaks on both DVB release and dvb attach error path. Fix them. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: remove the useless microcode_sizeMauro Carvalho Chehab
This var is not used. Remove it from the code, as we'll now be converting the driver to load the firmware from an external file. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: make checkpatch.pl happyMauro Carvalho Chehab
Fix the remaining checkpatch.pl compliants at drxj. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: remove drxj_options.hMauro Carvalho Chehab
This file is empty (actually, all commented there). So, remove it. We should latter remove those macros too, or convert them into a struct to allow dynamically enable the options during device probing time. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: remove typedefs at drx_driver.cMauro Carvalho Chehab
Get rid of another typedef defined on this driver. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of some ugly macrosMauro Carvalho Chehab
There are several get/set macros that are bogus: they just call another macro and do either: x = FOO(d) or FOO(d) = x As checkpatch complains about that, and replacing all of them are as easy as running a small coccinelle script, get rid of all of them. Script used: @@ expression d, x; @@ -DRX_SET_MIRRORFREQSPECT(d, x); +DRX_ATTR_MIRRORFREQSPECT(d) = x; @@ expression d, x; @@ -DRX_GET_MIRRORFREQSPECT(d, x); +x = DRX_ATTR_MIRRORFREQSPECT(d); @@ expression d, x; @@ -DRX_SET_CURRENTPOWERMODE(d, x); +DRX_ATTR_CURRENTPOWERMODE(d) = x; @@ expression d, x; @@ -DRX_GET_CURRENTPOWERMODE(d, x); +x = DRX_ATTR_CURRENTPOWERMODE(d); @@ expression d, x; @@ -DRX_SET_MICROCODE(d, x); +DRX_ATTR_MICROCODE(d) = x; @@ expression d, x; @@ -DRX_GET_MICROCODE(d, x); +x = DRX_ATTR_MICROCODE(d); @@ expression d, x; @@ -DRX_SET_MICROCODESIZE(d, x); +DRX_ATTR_MICROCODESIZE(d) = x; @@ expression d, x; @@ -DRX_GET_MICROCODESIZE(d, x); +x = DRX_ATTR_MICROCODESIZE(d); @@ expression d, x; @@ -DRX_SET_VERIFYMICROCODE(d, x); +DRX_ATTR_VERIFYMICROCODE(d) = x; @@ expression d, x; @@ -DRX_GET_VERIFYMICROCODE(d, x); +x = DRX_ATTR_VERIFYMICROCODE(d); @@ expression d, x; @@ -DRX_SET_MCVERTYPE(d, x); +DRX_ATTR_MCRECORD(d).aux_type = x; @@ expression d, x; @@ -DRX_GET_MCVERTYPE(d, x); +x = DRX_ATTR_MCRECORD(d).aux_type; @@ expression d, x; @@ -DRX_SET_MCDEV(d, x); +DRX_ATTR_MCRECORD(d).mc_dev_type = x; @@ expression d, x; @@ -DRX_GET_MCDEV(d, x); +x = DRX_ATTR_MCRECORD(d).mc_dev_type; @@ expression d, x; @@ -DRX_SET_MCVERSION(d, x); +DRX_ATTR_MCRECORD(d).mc_version = x; @@ expression d, x; @@ -DRX_GET_MCVERSION(d, x); +x = DRX_ATTR_MCRECORD(d).mc_version; @@ expression d, x; @@ -DRX_SET_MCPATCH(d, x); +DRX_ATTR_MCRECORD(d).mc_base_version = x; @@ expression d, x; @@ -DRX_GET_MCPATCH(d, x); +x = DRX_ATTR_MCRECORD(d).mc_base_version; @@ expression d, x; @@ -DRX_SET_I2CADDR(d, x); +DRX_ATTR_I2CADDR(d) = x; @@ expression d, x; @@ -DRX_GET_I2CADDR(d, x); +x = DRX_ATTR_I2CADDR(d); @@ expression d, x; @@ -DRX_SET_I2CDEVID(d, x); +DRX_ATTR_I2CDEVID(d) = x; @@ expression d, x; @@ -DRX_GET_I2CDEVID(d, x); +x = DRX_ATTR_I2CDEVID(d); @@ expression d, x; @@ -DRX_SET_USEBOOTLOADER(d, x); +DRX_ATTR_USEBOOTLOADER(d) = x; @@ expression d, x; @@ -DRX_GET_USEBOOTLOADER(d, x); +x = DRX_ATTR_USEBOOTLOADER(d); @@ expression d, x; @@ -DRX_SET_CURRENTSTANDARD(d, x); +DRX_ATTR_CURRENTSTANDARD(d) = x; @@ expression d, x; @@ -DRX_GET_CURRENTSTANDARD(d, x); +x = DRX_ATTR_CURRENTSTANDARD(d); @@ expression d, x; @@ -DRX_SET_PREVSTANDARD(d, x); +DRX_ATTR_PREVSTANDARD(d) = x; @@ expression d, x; @@ -DRX_GET_PREVSTANDARD(d, x); +x = DRX_ATTR_PREVSTANDARD(d); @@ expression d, x; @@ -DRX_SET_CACHESTANDARD(d, x); +DRX_ATTR_CACHESTANDARD(d) = x; @@ expression d, x; @@ -DRX_GET_CACHESTANDARD(d, x); +x = DRX_ATTR_CACHESTANDARD(d); @@ expression d, x; @@ -DRX_SET_CURRENTCHANNEL(d, x); +DRX_ATTR_CURRENTCHANNEL(d) = x; @@ expression d, x; @@ -DRX_GET_CURRENTCHANNEL(d, x); +x = DRX_ATTR_CURRENTCHANNEL(d); @@ expression d, x; @@ -DRX_SET_ISOPENED(d, x); +DRX_ATTR_ISOPENED(d) = x; @@ expression d, x; @@ -DRX_GET_ISOPENED(d, x); +x = DRX_ATTR_ISOPENED(d); @@ expression d, x; @@ -DRX_SET_TUNER(d, x); +DRX_ATTR_TUNER(d) = x; @@ expression d, x; @@ -DRX_GET_TUNER(d, x); +x = DRX_ATTR_TUNER(d); @@ expression d, x; @@ -DRX_SET_CAPABILITIES(d, x); +DRX_ATTR_CAPABILITIES(d) = x; @@ expression d, x; @@ -DRX_GET_CAPABILITIES(d, x); +x = DRX_ATTR_CAPABILITIES(d); @@ expression d, x; @@ -DRX_SET_PRODUCTID(d, x); +DRX_ATTR_PRODUCTID(d) = x; @@ expression d, x; @@ -DRX_GET_PRODUCTID(d, x); +x = DRX_ATTR_PRODUCTID(d); @@ expression d, x; @@ -DRX_SET_MFX(d, x); +DRX_ATTR_PRODUCTID(d) = x; @@ expression d, x; @@ -DRX_GET_MFX(d, x); +x = DRX_ATTR_PRODUCTID(d); @@ expression d, x; @@ -DRX_SET_INTERMEDIATEFREQ(d, x); +DRX_ATTR_INTERMEDIATEFREQ(d) = x; @@ expression d, x; @@ -DRX_GET_INTERMEDIATEFREQ(d, x); +x = DRX_ATTR_INTERMEDIATEFREQ(d); @@ expression d, x; @@ -DRX_SET_SYSCLOCKFREQ(d, x); +DRX_ATTR_SYSCLOCKFREQ(d) = x; @@ expression d, x; @@ -DRX_GET_SYSCLOCKFREQ(d, x); +x = DRX_ATTR_SYSCLOCKFREQ(d); @@ expression d, x; @@ -DRX_SET_TUNERRFAGCPOL(d, x); +DRX_ATTR_TUNERRFAGCPOL(d) = x; @@ expression d, x; @@ -DRX_GET_TUNERRFAGCPOL(d, x); +x = DRX_ATTR_TUNERRFAGCPOL(d); @@ expression d, x; @@ -DRX_SET_TUNERIFAGCPOL(d, x); +DRX_ATTR_TUNERIFAGCPOL(d) = x; @@ expression d, x; @@ -DRX_GET_TUNERIFAGCPOL(d, x); +x = DRX_ATTR_TUNERIFAGCPOL(d); @@ expression d, x; @@ -DRX_SET_TUNERSLOWMODE(d, x); +DRX_ATTR_TUNERSLOWMODE(d) = x; @@ expression d, x; @@ -DRX_GET_TUNERSLOWMODE(d, x); +x = DRX_ATTR_TUNERSLOWMODE(d); @@ expression d, x; @@ -DRX_SET_TUNERPORTNR(d, x); +DRX_ATTR_TUNERSPORTNR(d) = x; Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Replace printk's by pr_foo()Mauro Carvalho Chehab
Instead of using printk's, use the pr_foo() macros. That fixes some checkpatch warnings and provide a better error, warning and debug support. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Use the Linux error codesMauro Carvalho Chehab
Instead of defining its own set of error codes, use the linux native ones. Please note that this patch made a "stupid" error code mapping, just replacing the codes with the closest one. In special, -EIO is being used on several places. I'm pretty sure this could be better assigned, but a change like that would require lots o time and efforts, without much benefit. So lets do adjstments at the error codes latter, when we have more time. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: CodingStyle fixups on drxj.cMauro Carvalho Chehab
Fix almost all checkpatch.pl warnings/errors on drxj.c, except for: - 80 cols whitespacing; - too many leading tabs; - a false positive at DRXJ_16TO8() macro. - static char array declaration should probably be static const char as adding "const" would cause warnings. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Remove typedefs in drxj.cMauro Carvalho Chehab
Remove three typedefs from drxj.c, using the following script: use File::Find; use strict; my $dir = shift or die "need a dir"; my $type = shift or die "need type"; my $var = shift or die "need var"; sub handle_file { my $file = shift; my $out; open IN, $file or die "can't open $file"; $out .= $_ while (<IN>); close IN; $out =~ s/\btypedef\s+($type)\s+\{([\d\D]+?)\s*\}\s+\b($var)[^\;]+\;/$type $var \{\2\};/; # This replaces the typedef declaration for a simple struct declaration - style 1 # This replaces the typedef declaration for a simple struct declaration - style 2 # Replace struct occurrences $out =~ s,\b($var)_t\s+,$type \1 ,g; $out =~ s,\bp_*($var)_t\s+,$type \1 *,g; $out =~ s,\b($var)_t\b,$type \1,g; $out =~ s,\bp_*($var)_t\b,$type \1 *,g; open OUT, ">$file" or die "can't open $file"; print OUT $out; close OUT; } sub parse_dir { my $file = $File::Find::name; return if (!($file =~ /.[ch]$/)); handle_file $file; } find({wanted => \&parse_dir, no_chdir => 1}, $dir); Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: More CamelCase fixupsMauro Carvalho Chehab
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Simplify logic expressionsMauro Carvalho Chehab
Don't need to test boolean x == true or x == false. That makes the code more compact. patch generated with make coccicheck and manually reviewed. While here, remove uneeded ';'. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: don't use parenthesis on returnMauro Carvalho Chehab
CodingStyle fix: don't use parenthesis on return, as it is not a function. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: replace the ugly CHK_ERROR() macroMauro Carvalho Chehab
Using return and goto inside macros is ugly and makes harder to understand the code and the labels. Remove those macros, and add a proper error debug message, when something bad happens. This was generated using the following coccinelle script: @@ @@ -DUMMY_READ(); +do { + u16 dummy; + RR16(demod->my_i2c_dev_addr, SCU_RAM_VERSION_HI__A, &dummy); +} while (0); @@ expression dev, addr, val; @@ -WR16(dev, addr, val) +CHK_ERROR(DRXJ_DAP.write_reg16func(dev, addr, val, 0)) @@ expression dev, addr, val; @@ -RR16(dev, addr, val) +CHK_ERROR(DRXJ_DAP.read_reg16func(dev, addr, val, 0)) @@ expression dev, addr, val; @@ -WR32(dev, addr, val) +CHK_ERROR(DRXJ_DAP.write_reg32func(dev, addr, val, 0)) @@ expression dev, addr, val; @@ -RR32(dev, addr, val) +CHK_ERROR(DRXJ_DAP.read_reg32func(dev, addr, val, 0)) @@ expression dev, addr, val, block; @@ -WRB(dev, addr, val, block) +CHK_ERROR(DRXJ_DAP.write_block_func(dev, addr, val, block, 0)) @@ expression dev, addr, val, block; @@ -RRB(dev, addr, val, block) +CHK_ERROR(DRXJ_DAP.read_block_func(dev, addr, val, block, 0)) @@ expression dev, addr, val; @@ -BCWR16(dev, addr, val) +CHK_ERROR(DRXJ_DAP.write_reg16func(dev, addr, val, DRXDAP_FASI_BROADCAST)) @@ expression dev, addr, val; @@ -ARR32(dev, addr, val) +CHK_ERROR(drxj_dap_atomic_read_reg32(dev, addr, val, 0)) @@ expression dev, addr, val; @@ -SARR16(dev, addr, val) +CHK_ERROR(drxj_dap_scu_atomic_read_reg16(dev, addr, val, 0)) @@ expression x; @@ -CHK_ERROR(x); +rc = x; +if (rc != DRX_STS_OK) { + pr_err("error %d\n", rc); + goto rw_error; +} Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Don't use buffer if an error occursMauro Carvalho Chehab
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxj_dap_scu_atomic_read_reg16’: drivers/media/dvb-frontends/drx39xyj/drxj.c:4170:9: warning: ‘*((void *)&buf+1)’ may be used uninitialized in this function [-Wmaybe-uninitialized] word = (u16) (buf[0] + (buf[1] << 8)); ^ drivers/media/dvb-frontends/drx39xyj/drxj.c:4170:9: warning: ‘buf’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxj_dap_atomic_read_reg32.isra.59’: drivers/media/dvb-frontends/drx39xyj/drxj.c:2186:7: warning: ‘*((void *)&buf+3)’ may be used uninitialized in this function [-Wmaybe-uninitialized] word = (u32) buf[3]; ^ drivers/media/dvb-frontends/drx39xyj/drxj.c:2188:10: warning: ‘*((void *)&buf+2)’ may be used uninitialized in this function [-Wmaybe-uninitialized] word |= (u32) buf[2]; ^ drivers/media/dvb-frontends/drx39xyj/drxj.c:2190:10: warning: ‘*((void *)&buf+1)’ may be used uninitialized in this function [-Wmaybe-uninitialized] word |= (u32) buf[1]; ^ drivers/media/dvb-frontends/drx39xyj/drxj.c:2192:10: warning: ‘buf’ may be used uninitialized in this function [-Wmaybe-uninitialized] word |= (u32) buf[0]; ^ Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: a few more CodingStyle fixupsMauro Carvalho Chehab
Some whitespace cleanups. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Get rid of typedefs on drxh.hMauro Carvalho Chehab
This were fixed with the help of this small perl script: #!/usr/bin/perl my $dir = shift or die "need a dir"; my $type = shift or die "need type"; my $var = shift or die "need var"; sub handle_file { my $file = shift; my $out; open IN, $file or die "can't open $file"; $out .= $_ while (<IN>); close IN; $out =~ s/\btypedef\s+($type)\s+\{([\d\D]+?)\s*\}\s+\b($var)[^\;]+\;/$type $var \{\2\};/; $out =~ s,\b($var)_t\s+,$type \1 ,g; $out =~ s,\bp_*($var)_t\s+,$type \1 *,g; $out =~ s,\b($var)_t\b,$type \1,g; $out =~ s,\bp_*($var)_t\b,$type \1 *,g; open OUT, ">$file" or die "can't open $file"; print OUT $out; close OUT; } sub parse_dir { my $file = $File::Find::name; return if (!($file =~ /.[ch]$/)); handle_file $file; } find({wanted => \&parse_dir, no_chdir => 1}, $dir); Some manual work were needed. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: get rid of typedefs in drx_driver.hMauro Carvalho Chehab
Most of the changes were done with scripts like: for i in drivers/media/dvb-frontends/drx39xyj/*.[ch]; do perl -ne '$var = "drx_sig_quality"; s,\b($var)_t\s+,struct \1 ,g; s,\bp_*($var)_t\s+,struct \1 *,g; s,\b($var)_t\b,struct \1,g; s,\bp_*($var)_t\b,struct \1 *,g; print $_' <$i >a && mv a $i; done Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04[media] drx-j: Get rid of drx39xyj/bsp_tuner.hMauro Carvalho Chehab
This file is not used anywhere. Drop it. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>