Commit graph

703 commits

Author SHA1 Message Date
Antti Palosaari abfc8d66d7 [media] rtl2832_sdr: remove unneeded spinlock irq flags initialization
There is no need to init flags before calling spin_lock_irqsave().
spin_lock_irqsave is macro which stores value to 'flags'

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 16:42:36 -03:00
Mauro Carvalho Chehab 3cf0c6bd68 Merge remote-tracking branch 'linus/master' into patchwork
There are some patches that depends on media-v3.16-rc6.
So, merge back from upstream before applying them.

* linus/master: (1123 commits)
  drm/nouveau: ltc/gf100-: fix cbc issues on certain boards
  drm/bochs: add missing drm_connector_register call
  drm/cirrus: add missing drm_connector_register call
  staging: vt6655: buffer overflow in ioctl
  USB: storage: Add quirks for Entrega/Xircom USB to SCSI converters
  USB: storage: Add quirk for Ariston Technologies iConnect USB to SCSI adapter
  USB: storage: Add quirk for Adaptec USBConnect 2000 USB-to-SCSI Adapter
  USB: EHCI: unlink QHs even after the controller has stopped
  [SCSI] fix for bidi use after free
  [SCSI] fix regression that accidentally disabled block-based tcq
  [SCSI] libiscsi: fix potential buffer overrun in __iscsi_conn_send_pdu
  drm/radeon: Fix typo 'addr' -> 'entry' in rs400_gart_set_page
  drm/nouveau/runpm: fix module unload
  drm/radeon/px: fix module unload
  vgaswitcheroo: add vga_switcheroo_fini_domain_pm_ops
  drm/radeon: don't reset dma on r6xx-evergreen init
  drm/radeon: don't reset sdma on CIK init
  drm/radeon: don't reset dma on NI/SI init
  drm/radeon/dpm: fix resume on mullins
  drm/radeon: Disable HDP flush before every CS again for < r600
  ...
2014-09-21 16:40:04 -03:00
abdoulaye berthe 88d5e520aa driver:gpio remove all usage of gpio_remove retval in driver
this remove all reference to gpio_remove retval in all driver
except pinctrl and gpio. the same thing is done for gpio and
pinctrl in two different patches.

Signed-off-by: Abdoulaye Berthe <berthe.ab@gmail.com>
Acked-by: Michael Büsch <m@bues.ch>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-09-18 11:03:10 -07:00
Antti Palosaari 9dc0f3fe3f [media] af9033: feed clock to RF tuner
IT9135 RF tuner clock is coming from demodulator. We need enable it
early in demod init, before any tuner I/O. Currently it is enabled
by tuner driver itself, but it is too late and performance will be
reduced as some registers are not updated correctly. Clock is
disabled automatically when demod is put onto sleep.

Cc: <stable@vger.kernel.org> # v3.15+
Cc: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-04 12:23:56 -03:00
Bimow Chen 0df6580c5f [media] af9033: update IT9135 tuner inittabs
Update IT9135 BX tuner config 60 and 61 inittabs.

[crope@iki.fi: removed two reg writes from driver init itself]
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-04 12:22:55 -03:00
Mauro Carvalho Chehab 89fffac802 [media] drxk_hard: fix bad alignments
drivers/media/dvb-frontends/drxk_hard.c:2224:3-22: code aligned with following code on line 2227

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 19:19:18 -03:00
Mauro Carvalho Chehab cea1300214 [media] drxd_hard: fix bad alignments
As reported by cocinelle:

drivers/media/dvb-frontends/drxd_hard.c:2632:3-51: code aligned with following code on line 2633

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 19:18:08 -03:00
Mauro Carvalho Chehab a16ae7d5bc [media] sp8870: fix bad alignments
As reported by cocinelle:

drivers/media/dvb-frontends/sp8870.c:395:2-14: code aligned with following code on line 397

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 19:18:08 -03:00
Mauro Carvalho Chehab 7c9950768f [media] stv0367: just return 0 instead of using a var
Instead of allocating a var to store 0 and just return it,
change the code to return 0 directly.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:28 -03:00
Mauro Carvalho Chehab 5a7f7b79d8 [media] drxk_hard: simplify test logic
instead of testing if it is false or true, just use
if (!foo) or if (foo). That makes the code easier to
read and shorter.

Also, properly initialize booleans with true or false.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:23 -03:00
Mauro Carvalho Chehab 79a5ee7882 [media] tda10071: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:17 -03:00
Mauro Carvalho Chehab 2fe15e2013 [media] af9013: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Also, instead of testing foo == false, just use the
simplified notation if(!foo).

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:16 -03:00
Mauro Carvalho Chehab afbd6eb4ba [media] m88ds3103: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:16 -03:00
Mauro Carvalho Chehab 285c0b005f [media] cxd2820r: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:15 -03:00
Mauro Carvalho Chehab 6a5e7fde3a [media] af9013: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:14 -03:00
Mauro Carvalho Chehab 49bc89623d [media] stv0900_core: don't allocate a temporary var
The error return code STV0900_NO_ERROR happens only once, at
the end of the functions. So, just return it directly.

This driver should actually be fixed to return standard
Linux error codes, instead of its own macros, but this
should be done on a separate patchset.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:13 -03:00
Hans Verkuil e73c7bfea0 [media] si2165: fix sparse warning
drivers/media/dvb-frontends/si2165.c:329:16: warning: odd constant _Bool cast (ffffffffffffffea becomes 1)

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 10:00:36 -03:00
Hans Verkuil 817d2fd4cb [media] stv0367: fix sparse warnings
drivers/media/dvb-frontends/stv0367.c:557:5: warning: symbol 'stv0367cab_RF_LookUp1' was not declared. Should it be static?
drivers/media/dvb-frontends/stv0367.c:569:5: warning: symbol 'stv0367cab_RF_LookUp2' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 10:00:13 -03:00
Hans Verkuil fba16a1eee [media] bcm3510: fix sparse warnings
drivers/media/dvb-frontends/bcm3510.c:646:24: warning: cast to restricted __le16
drivers/media/dvb-frontends/bcm3510.c:647:24: warning: cast to restricted __le16

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:39:45 -03:00
Hans Verkuil ce08131c42 [media] mb86a16/mb86a20s: fix sparse warnings
drivers/media/dvb-frontends/mb86a16.c:31:14: warning: symbol 'verbose' was not declared. Should it be static?
drivers/media/dvb-frontends/mb86a20s.c:36:4: warning: symbol 'mb86a20s_subchannel' was not declared. Should it be static?
drivers/media/dvb-frontends/mb86a20s.c:1333:24: warning: symbol 'cnr_qpsk_table' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:37:47 -03:00
Hans Verkuil 4182438e65 [media] drxj: fix sparse warnings
drivers/media/dvb-frontends/drx39xyj/drxj.c:11768:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11768:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11768:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11768:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11770:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11770:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11770:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11770:25: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11794:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11796:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11796:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11796:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11796:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11798:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11798:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11798:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11798:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11800:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11800:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11800:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11800:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11605:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11605:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11605:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11605:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11632:29: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11632:29: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11632:29: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11632:29: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11650:34: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11652:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11652:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11652:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11652:34: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11654:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11654:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11654:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11654:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11656:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11656:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11656:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11656:33: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11670:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11670:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11670:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11670:35: warning: cast to restricted __be16
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11678:47: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11680:46: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32
drivers/media/dvb-frontends/drx39xyj/drxj.c:11682:51: warning: cast to restricted __be32

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:36:22 -03:00
Hans Verkuil 18ef20da8f [media] dib7000p: fix sparse warning
drivers/media/dvb-frontends/dib7000p.c:2562:5: warning: symbol 'dib7090_set_diversity_in' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:33:42 -03:00
Antti Palosaari 41b9aa0040 [media] m88ds3103: fix coding style issues
Fix coding style issues pointed out by checkpatch.pl.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:54:13 -03:00
Antti Palosaari d28677ffbc [media] m88ds3103: change .set_voltage() implementation
Add some error checking and implement functionality a little bit
differently.

Cc: Nibble Max <nibble.max@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:53:30 -03:00
CrazyCat e395e573b3 [media] si2168: DVB-T2 PLP selection implemented
DVB-T2 PLP selection implemented for Si2168 demod.
Tested with PCTV 292e.

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:45:36 -03:00
Olli Salonen 868736ad34 [media] sp2: Add I2C driver for CIMaX SP2 common interface module
Driver for the CIMaX SP2 common interface chip. It is very much based on
the existing cimax2 driver for cx23885, but should be more reusable. The
product has been sold with name Atmel T90FJR as well and the data sheets
for that chip seem to be publicly available.

It seems that the USB device that I have and the cx23885 based devices will
need to interact differently with the chip for the CAM operations. Thus
there is one callback function that is passed on to the sp2 driver
(see function sp2_ci_op_cam for that one).

IRQ functionality is not included currently (not needed by USB devices
and I don't have a PCIe device for development).

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:06:49 -03:00
Olli Salonen 389ce3984b [media] si2168: add ts_mode setting and move to si2168_init
Luis Alves submitted a TS mode patch to si2168 earlier, but the
patch was rejected due to a small issue. Here is a working version.
Also, setting of TS mode is moved from si2168_set_frontend to
si2168_init.

This patch adds the TS mode as a config option for the si2168 demod:
- ts_mode added to config struct.
- Possible (interesting) values are
   * Parallel mode = 0x06
   * Serial mode = 0x03

Currently the modules using this demod only use parallel mode.
Patches for these modules later in this patch series.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:03:19 -03:00
nibble.max 79d0933032 [media] m88ds3103: implement set voltage and TS clock
Implement set voltage operation.
Separate TS clock as a own configuration parameter.
Add TS clock polarity parameter.

[crope@iki.fi: merge em28xx driver m88ds3103 config change patch
to that one, in order to keep build unbroken]

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:02:10 -03:00
Olli Salonen 37b4e43d8b [media] si2168: clean logging
Same thing for si2168 as Antti did earlier for tda18212:

There is no need to print module name nor function name as those
are done by kernel logging system when dev_xxx logging is used and
driver is proper I2C driver.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 14:57:27 -03:00
Mauro Carvalho Chehab 5b6aa19919 [media] as102-fe: Add a release function
This is needed to free state and for dvb_detach() to be
called.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:31 -05:00
Mauro Carvalho Chehab 4628f993bf [media] as102: add missing viterbi lock
In order to get FE_HAS_SYNC, the viterbi should already be
locked too. So, add the missing FE_HAS_VITERBI lock.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:31 -05:00
Mauro Carvalho Chehab dcae778148 [media] as102-fe: make it an independent driver
Move as102-fe to dvb-frontends directory and make it an
independent driver.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:30 -05:00
Mauro Carvalho Chehab 7f196789b3 si2135: Declare the structs even if frontend is not enabled
As reported by Kbuildtest:

   In file included from drivers/media/usb/cx231xx/cx231xx-dvb.c:35:0:
   drivers/media/dvb-frontends/si2165.h:57:9: warning: 'struct si2165_config' declared inside parameter list [enabled by default]
     struct i2c_adapter *i2c)
            ^
   drivers/media/dvb-frontends/si2165.h:57:9: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:157:21: error: variable 'hauppauge_930C_HD_1113xx_si2165_config' has initializer but incomplete type
    static const struct si2165_config hauppauge_930C_HD_1113xx_si2165_config = {
                        ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:158:2: error: unknown field 'i2c_addr' specified in initializer
     .i2c_addr = 0x64,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:158:2: warning: excess elements in struct initializer [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:158:2: warning: (near initialization for 'hauppauge_930C_HD_1113xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:159:2: error: unknown field 'chip_mode' specified in initializer
     .chip_mode = SI2165_MODE_PLL_XTAL,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:159:15: error: 'SI2165_MODE_PLL_XTAL' undeclared here (not in a function)
     .chip_mode = SI2165_MODE_PLL_XTAL,
                  ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:159:2: warning: excess elements in struct initializer [enabled by default]
     .chip_mode = SI2165_MODE_PLL_XTAL,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:159:2: warning: (near initialization for 'hauppauge_930C_HD_1113xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:160:2: error: unknown field 'ref_freq_Hz' specified in initializer
     .ref_freq_Hz = 16000000,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:160:2: warning: excess elements in struct initializer [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:160:2: warning: (near initialization for 'hauppauge_930C_HD_1113xx_si2165_config') [enabled by default]
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:163:21: error: variable 'pctv_quatro_stick_1114xx_si2165_config' has initializer but incomplete type
    static const struct si2165_config pctv_quatro_stick_1114xx_si2165_config = {
                        ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:164:2: error: unknown field 'i2c_addr' specified in initializer
     .i2c_addr = 0x64,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:164:2: warning: excess elements in struct initializer [enabled by default]
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:164:2: warning: (near initialization for 'pctv_quatro_stick_1114xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:165:2: error: unknown field 'chip_mode' specified in initializer
     .chip_mode = SI2165_MODE_PLL_EXT,
     ^
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:165:15: error: 'SI2165_MODE_PLL_EXT' undeclared here (not in a function)
     .chip_mode = SI2165_MODE_PLL_EXT,
                  ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:165:2: warning: excess elements in struct initializer [enabled by default]
     .chip_mode = SI2165_MODE_PLL_EXT,
     ^
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:165:2: warning: (near initialization for 'pctv_quatro_stick_1114xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:166:2: error: unknown field 'ref_freq_Hz' specified in initializer
     .ref_freq_Hz = 24000000,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:166:2: warning: excess elements in struct initializer [enabled by default]
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:166:2: warning: (near initialization for 'pctv_quatro_stick_1114xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c: In function 'dvb_init':
   drivers/media/usb/cx231xx/cx231xx-dvb.c:731:3: warning: passing argument 1 of 'si2165_attach' from incompatible pointer type [enabled by default]
      dev->dvb->frontend = dvb_attach(si2165_attach,
      ^
   In file included from drivers/media/usb/cx231xx/cx231xx-dvb.c:35:0:
   drivers/media/dvb-frontends/si2165.h:55:36: note: expected 'const struct si2165_config *' but argument is of type 'const struct si2165_config *'
    static inline struct dvb_frontend *si2165_attach(
                                       ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:764:3: warning: passing argument 1 of 'si2165_attach' from incompatible pointer type [enabled by default]
      dev->dvb->frontend = dvb_attach(si2165_attach,
      ^
   In file included from drivers/media/usb/cx231xx/cx231xx-dvb.c:35:0:
   drivers/media/dvb-frontends/si2165.h:55:36: note: expected 'const struct si2165_config *' but argument is of type 'const struct si2165_config *'
    static inline struct dvb_frontend *si2165_attach(
                                       ^

That happens because the frontend was disabled by .config, but the
si2165_attach void stub require those structs, and also the
drivers that call it.

While here, remove the duplicated info about the possible I2C
addresses.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-28 10:37:08 -03:00
Matthias Schwarzott 3e54a1697a [media] si2165: Add demod driver for DVB-T only
DVB-T was tested  with 8MHz BW channels in germany
This driver is the simplest possible, it uses automatic mode for all
parameters (TPS).

Added spectrum inversion support.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Tested-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:01:41 -03:00
Mauro Carvalho Chehab 60ecb71a72 [media] remove some new warnings on drxj
changeset b601fe5688 did some cleanup, but didn't remove some
now unused vars:
	drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_set_frontend':
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12072:21: warning: unused variable 'uio_data' [-Wunused-variable]
	drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_set_lna':
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12230:21: warning: unused variable 'uio_data' [-Wunused-variable]
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12229:20: warning: unused variable 'uio_cfg' [-Wunused-variable]
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12224:6: warning: unused variable 'result' [-Wunused-variable]

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:57:09 -03:00
Shuah Khan b601fe5688 [media] media: drx39xyj - use drxj_set_lna_state() and remove duplicate LNA code
drx39xxj_set_lna() and drx39xxj_set_frontend() set LNA. Instead of
duplicating LNA configure code, change to use drxj_set_lna_state()
which sets LNA to the caller requested state (on or off).

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:22:51 -03:00
Shuah Khan 3074187111 [media] media: drx39xyj - fix to return actual error codes instead of -EIO
Several functions ignore the return values in error legs and always
return -EIO. This makes it hard to debug and take proper action in
calling routines.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:22:30 -03:00
Shuah Khan 998819d271 [media] media: drx39xyj - add resume support
drx39xyj driver lacks resume support. Add support by changing
its fe ops init interface to detect the resume status by checking
fe exit flag and do the necessary initialization. With this change,
driver resume correctly in both dvb adapter is not in use and in use
by an application cases.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:22:05 -03:00
Shuah Khan 5b22b1a4f7 [media] media: drx39xyj driver change to check fe exit flag from release
Change drx39xyj_release() to check fe exit flag to detect the
device disconnect state and avoid accessing the device after
it has been removed.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:19:21 -03:00
Antti Palosaari 69cc4bfab9 [media] Kconfig: rtl2832_sdr must depend on USB
Fixes error:
[next:master 7435/8702] ERROR: "usb_alloc_urb
[drivers/media/dvb-frontends/rtl2832_sdr.ko] undefined!

rtl2832_sdr driver implements own USB streaming for SDR data.
Logically that functionality belongs to USB interface driver, but
currently it is implemented here.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:32:04 -03:00
Himangi Saraogi 157a5fe90a [media] dib7000m: Remove unnecessary null test
This patch removes the null test on ch. ch is initialized at the
beginning of the function to &demod->dtv_property_cache. Since demod
is dereferenced prior to the null test, demod must be a valid pointer,
and &demod->dtv_property_cache cannot be null.

The following Coccinelle script is used for detecting the change:

@r@
expression e,f;
identifier g,y;
statement S1,S2;
@@

*e = &f->g
<+...
 f->y
 ...+>
*if (e != NULL || ...)
 S1 else S2

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:42:23 -03:00
Mauro Carvalho Chehab 277bfd2f4d [media] mb86a20s: Fix the code that estimates the measurement interval
Instead of looking at the guard interval field, it was using
the interval length, with is wrong. Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:34:03 -03:00
Mauro Carvalho Chehab 4247368bf7 [media] mb86a20s: Fix Interleaving
Interleaving code was wrong at mb86a20s: instead, it was looking
at the Guard Interval. Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:33:41 -03:00
Mauro Carvalho Chehab 276dfc4b99 [media] mb86a20s: fix ISDB-T mode handling
The driver was reporting an incorrect mode, when mode 2
is selected.

While testing it, noticed that neither mode 1 or guard
interval 1/32 is supported by this device. Document it,
and ensure that it will report _AUTO when it doesn't lock,
in order to not report a wrong detection to userspace.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:33:25 -03:00
Antti Palosaari 4423a2ba80 [media] m88ds3103: implement BER
Implement read_ber for BER estimate.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:30:58 -03:00
Antti Palosaari 3ae266f80c [media] m88ds3103: fix SNR reporting on 32-bit arch
There was 32-bit calculation overflow. Use div_u64.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:28:26 -03:00
Fabian Frederick 045655a94d [media] dvb-frontends: remove unnecessary break after goto
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:26:57 -03:00
Emil Goode 8f73b481b9 [media] Cleanup line > 80 character violations
This cleans up some line over 80 character violations.

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:24:24 -03:00
Emil Goode 20721185c9 [media] Remove checks of struct member addresses
This removes checks of struct member addresses since they likely result
in the condition always being true. Also in the stb6100_get_bandwidth
and tda8261_get_bandwidth functions the pointers frontend_ops and
tuner_ops are assigned the same addresses twice.

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:23:53 -03:00
Heinrich Schuchardt 18d75a09e9 [media] media: dib9000: avoid out of bound access
This updated patch also fixes out of bound access to b[].

In dib9000_risc_apb_access_write() an out of bound access to mb[].

The current test to avoid out of bound access to mb[] is insufficient.
For len = 19 non-existent mb[10] will be accessed.

For odd values of len b[] is accessed out of bounds.

For large values of len an of bound access to mb[] may occur in
dib9000_mbx_send_attr.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:15:41 -03:00
Dan Carpenter 58632818ab [media] dvb-frontends: decimal vs hex typo in ChannelConfiguration()
>From the context this should be hex 0x80 instead of decimal 80.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:00:54 -03:00
Mauro Carvalho Chehab fcb388ce6c [media] si2168: Fix a badly solved merge conflict
changeset a733291d69 didn't merge the fixes well. It ended by
restoring some bad logic removed there.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 20:38:13 -03:00
CrazyCat 4d1ab185db [media] cxd2820r: TS clock inversion in config
TS clock inversion in config.

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Acked-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 09:47:05 -03:00
Mauro Carvalho Chehab a733291d69 Merge commit '67dd8f35c2d8ed80f26c9654b474cffc11c6674d' into patchwork
* .: (268 commits)
  Linux 3.16-rc6
  um: segv: Save regs only in case of a kernel mode fault
  um: Fix hung task in fix_range_common()
  um: Ensure that a stub page cannot get unmapped
  Revert "um: Fix wait_stub_done() error handling"
  btrfs: test for valid bdev before kobj removal in btrfs_rm_device
  Btrfs: fix abnormal long waiting in fsync
  random: check for increase of entropy_count because of signed conversion
  ARM: EXYNOS: Fix core ID used by platsmp and hotplug code
  ahci: add support for the Promise FastTrak TX8660 SATA HBA (ahci mode)
  ARM: at91/dt: add missing clocks property to pwm node in sam9x5.dtsi
  ARM: at91/dt: fix usb0 clocks definition in sam9n12 dtsi
  ARM: at91: at91sam9x5: correct typo error for ohci clock
  irqchip: gic: Fix core ID calculation when topology is read from DT
  GFS2: fs/gfs2/rgrp.c: kernel-doc warning fixes
  GFS2: memcontrol: Spelling s/invlidate/invalidate/
  GFS2: Allow caching of glocks for flock
  GFS2: Allow flocks to use normal glock dq rather than dq_wait
  GFS2: replace count*size kzalloc by kcalloc
  GFS2: Use GFP_NOFS when allocating glocks
  ...

Conflicts:
	drivers/media/dvb-frontends/si2168.c
	drivers/media/dvb-frontends/si2168_priv.h
	drivers/media/tuners/si2157.c
2014-07-22 02:03:59 -03:00
Antti Palosaari 64a43323e4 [media] rtl2832_sdr: fix Kconfig dependencies
MEDIA_SDR_SUPPORT and I2C_MUX are needed for rtl2832_sdr.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 01:36:29 -03:00
Antti Palosaari a98ccfcf48 [media] rtl2832_sdr: remove plain 64-bit divisions
Commit 0ba2aeb6da
(v4l2-ctrls: increase internal min/max/step/def to 64 bit)
changes v4l2 controls to 64-bit. Driver it not working on 32-bit
arch as it uses directly control 'step' which is changed to 64-bit.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 01:30:39 -03:00
Antti Palosaari d57fe40401 [media] rtl2832_sdr: fill FMT buffer size
Fill FMT buffer size field in order to inform app which will be
used streaming buffer size. Currently driver doesn't allow buffer
size value proposed by application.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:39:03 -03:00
Luis Alves 635a90cf93 [media] si2168: Support Si2168-A20 firmware downloading
This adds support for the Si2168-A20 firmware download.

Extracting the firmware:

wget http://www.tbsdtv.com/download/document/tbs6281/tbs6281-t2-t-driver_v1.0.0.6.zip
unzip tbs6281-t2-t-driver_v1.0.0.6.zip
dd if=tbs-6281_x64/tbs6281_64.sys of=dvb-demod-si2168-a20-01.fw count=28656 bs=1 skip=1625088

md5sum:
32e06713b33915f674bfb2c209beaea5 /lib/firmware/dvb-demod-si2168-a20-01.fw

Signed-off-by: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:26:18 -03:00
Luis Alves 2da2e18513 [media] si2168: Remove testing for demod presence on probe
Testing demod presence on probe fails if the demod was sleep mode.

Signed-off-by: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:24:46 -03:00
Luis Alves 4d6efc7a96 [media] si2168: Fix i2c_add_mux_adapter return value
In case of failure the return value was always 0. Return proper
error code (ENODEV) instead.

Signed-off-by: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:24:14 -03:00
Olli Salonen 43911776fa [media] si2168: improve scanning performance
Improve scanning performance by setting property 0301 with a value
from Windows driver.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:21:53 -03:00
Luis Alves 32bf88182d [media] si2168: Set symbol rate for DVB-C
This patch adds symbol rate setting to the driver.

Signed-off-by: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:21:37 -03:00
Antti Palosaari 624ce384d5 [media] rtl2832_sdr: print notice to point SDR API is not 100% stable yet
SDR API is very new and surprises may occur. Due to that print
notice to remind possible users.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 20:59:06 -03:00
Antti Palosaari 2970c0d572 [media] rtl2832_sdr: put complex U16 format behind module parameter
Move emulated format behind module parameter as those are not
supported. Format conversions will be on library eventually.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 20:58:44 -03:00
Antti Palosaari 77bbb2b049 rtl2832_sdr: move from staging to media
Move rtl2832_sdr driver module from staging to media.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 20:55:41 -03:00
Antti Palosaari b6b6fd6feb [media] si2168: few firmware download changes
Rework firmware selection logic a little bit.
Print notice asking user update firmware when old Si2168 B40
firmware is used.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Tested-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:09 -03:00
Antti Palosaari 668aa63cfc [media] si2168: advertise Si2168 A30 firmware
Driver uses that new firmware too, so advertise it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Tested-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:08 -03:00
Olli Salonen c9cb0820d5 [media] si2168: Add support for chip revision Si2168 A30
Add handling for different chip revisions and firmwares.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:05 -03:00
Olli Salonen b02db9e1e0 [media] si2168: Small typo fix (SI2157 -> SI2168)
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:04 -03:00
Antti Palosaari 1d518c2763 [media] si2168: receive 4 bytes reply from cmd 0x14
Command 0x14 returns 4 bytes as a reply. It is used for setting
key/value pairs to firmware and it returns 4 bytes back including
old value.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:04 -03:00
Antti Palosaari 982c6238cf [media] si2168: do not set values which are already on default
No need to set explicitly value that are already defaulted same.

Setting new value returns old value. Firmware default values can
be found just looking returned value.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:03 -03:00
Antti Palosaari 93f726396d [media] si2168: remove duplicate command
Same command was executed twice, but different value. Remove
redundant command.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:03 -03:00
Antti Palosaari 88ac8f8606 [media] si2168: implement CNR statistic
Implement CNR statistic.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:02 -03:00
Antti Palosaari 888680ff9d [media] si2168: set cmd args using memcpy
Use memcpy for set cmd buffer in order to keep style in line with
rest of file.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:01 -03:00
Antti Palosaari 4de0ed7cf7 [media] si2168: implement sleep
Implement sleep for power-management.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:01 -03:00
Antti Palosaari c2c1a6e585 [media] tda10071: fix returned symbol rate calculation
Detected symbol rate value was returned too small.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:03:59 -03:00
Antti Palosaari b32725e84c [media] tda10071: fix spec inversion reporting
Inversion ON was reported as inversion OFF and vice versa.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:03:23 -03:00
Antti Palosaari bc760cdae9 [media] tda10071: add missing DVB-S2/PSK-8 FEC AUTO
FEC AUTO is valid for PSK-8 modulation too. Add it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:03:08 -03:00
Antti Palosaari db4175ae20 [media] tda10071: force modulation to QPSK on DVB-S
Only supported modulation for DVB-S is QPSK. Modulation parameter
contains invalid value for DVB-S on some cases, which leads driver
refusing tuning attempt. Due to that, hard code modulation to QPSK
in case of DVB-S.

Cc: stable@vger.kernel.org
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:02:42 -03:00
Mauro Carvalho Chehab 3c0d394ea7 [media] dib8000: improve the message that reports per-layer locks
The message is currently highly encoded:
	[70299.863521] DiB8000: Mpeg locks [ L0 : 0 | L1 : 1 | L2 : 0 ]

And doesn't properly reflect that some problems might have happened.
Instead, display it as:
	[75160.822321] DiB8000: Not all ISDB-T layers locked in 32 ms: Layer A NOT LOCKED, Layer B locked, Layer C not enabled

In order to better reflect what's happening with layer locking.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:59:01 -03:00
Mauro Carvalho Chehab ecc31d557e [media] dib8000: improve debug messages
When debug is enabled:
	- Report when frontend gets restarted;
	- Be coherent on the displayed lines;
	- Show the transmission mode;
	- Hide unused layers.

No functional changes (except at the printk's).

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:59:00 -03:00
Mauro Carvalho Chehab a768f90ef0 [media] dib8000: Update the ADC gain table
This table doesn't match the new one.
Update it.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:58:59 -03:00
Mauro Carvalho Chehab d6c62b7638 [media] dib8000: use jifies instead of current_kernel_time()
Instead of doing the tuning delays and timeouts using
current_kernel_time(), use jiffies. That consumes less
CPU cycles, and it is monotonic.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:58:59 -03:00
Mauro Carvalho Chehab 0de04ca1dc [media] dib0090: Fix the sleep time at the state machine
msleep() is not too precise: its precision depends on the
HZ config. As the driver selects precise timings for the
state machine, change it to usleep_range().

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:58:55 -03:00
Mauro Carvalho Chehab 4607bb7a47 [media] dib8000: Fix the sleep time at the state machine
msleep() is not too precise: its precision depends on the
HZ config. As the driver selects precise timings for the
state machine, change it to usleep_range().

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:58:42 -03:00
Mauro Carvalho Chehab 6d38454a59 [media] dib8000: Restart sad during dib8000_reset
Just like the Windows driver, restart SAD during reset

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:56:30 -03:00
Mauro Carvalho Chehab dde8e11536 [media] dib8000: In auto-search, try first with partial reception enabled
TV broadcasters generally use partial reception. So, enable it by
default in auto-search mode. The driver will latter detect if the
transmission is on some other mode.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:56:23 -03:00
Mauro Carvalho Chehab 08623517f4 [media] dib8000: remove a double call for dib8000_get_symbol_duration()
The symbol duration was already obtained at CT_DEMOD_START.
No need to do it again at CT_DEMOD_STEP_3.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:56:13 -03:00
Mauro Carvalho Chehab 7fec1c80a7 [media] dib8000: Fix: add missing 4K FFT mode
Without that, tuning may fail on 4K FFT mode, as the transmission
parameter cache will be initialized with a wrong value.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:55:38 -03:00
Mauro Carvalho Chehab 7fa676c6f4 [media] dib8000: Fix alignments at dib8000_tune()
There are two tabs instead of one aligning this struct.
Worse than that, on some places, the alignment is wrong.
Fix it.

No functional changes.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:55:31 -03:00
Mauro Carvalho Chehab c063c7c6a3 [media] dib8000: Fix ADC OFF settings
The ADC OFF values are wrong. This causes troubles on detecting
weak signals.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:55:16 -03:00
Mauro Carvalho Chehab 34ba2e65ba [media] dib8000: Fix handling of interleave bigger than 2
If interleave is bigger than 2, the code will set it to 0, as
dib8000 registers use a log2(). So, change the code to handle
it accordingly.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:55:04 -03:00
Benoit Taine 20f63150a2 [media] drx-j: Use kmemdup instead of kmalloc + memcpy
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:34:21 -03:00
Alan 690130fe0b [media] dvb-frontends: Add static
Add static to tda m_* variables in the header. They don't need to be global.
With some cleanup they could probably even be marked const.

Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=68191

Reported-by: Christian Schneider <christian@ch-sc.de>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:33:46 -03:00
Mauro Carvalho Chehab f2fd7ce6f2 [media] au0828/au8522: Add PAL-M support
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:31:37 -03:00
Mauro Carvalho Chehab c9f5ccc24d [media] au8522: Fix demod analog mode setting
There are several issues on the current code:
	1) msleep(1) is actually equivalent to msleep(10);
	2) au8522_video_set() will set reg 0xa4 to the
	   proper value for SIF, CVBS or S-Video. No need
	   to force it to CVBS;
	3) Let's not hardcode 0x9d for CBS on audio_set.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:31:17 -03:00
Mauro Carvalho Chehab 65c8820912 [media] au8522: cleanup s-video settings at setup_decoder_defaults()
setup_decoder_defaults() doesn't really care about the input
port. All it needs to know is if the input port is s-video or
not.

As the caller function already knows that, just pass a boolean
instead.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:27:06 -03:00
Mauro Carvalho Chehab d289cdf022 [media] au8522: be sure that we'll setup audio routing at the right time
Let's set the the audio routing also at stream start. With this change,
we don't risk enabling the analog demux while not streaming, reducing
the risk of interfering with a DVB demux that might be happening.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:26:28 -03:00
Mauro Carvalho Chehab 38fe3510fa [media] au8522: be sure that the setup will happen at streamon time
The same demod is used on both analog and digital mode. We should
not let the commands for analog mode to happen while the device
is in digital mode. So, monitor it via streamon.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:25:25 -03:00
Mauro Carvalho Chehab 364693166c [media] au8522: move input_mode out one level
The input mode is used not only inside the setup_decoder_defaults()
but also at au8522_*_mode routines.

So, move it one level up. As an advantage, we can now group the
function that sets the input into just one.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:25:00 -03:00
Antti Palosaari 0c76e68d6e [media] si2168: firmware download fix
First 8 bytes belonging to firmware image were hard-coded and uploaded
by the driver mistakenly. Introduce new corrected firmware file and
remove those 8 bytes from the driver.

New firmware image could be extracted from the PCTV 292e driver CD
using following command:

$ dd if=/TVC 6.4.8/Driver/PCTV Empia/emOEM.sys ibs=1 skip=1089408 count=2728 of=dvb-demod-si2168-02.fw
$ md5sum dvb-demod-si2168-02.fw
d8da7ff67cd56cd8aa4e101aea45e052  dvb-demod-si2168-02.fw
$ sudo cp dvb-demod-si2168-02.fw /lib/firmware/

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:13:33 -03:00
Antti Palosaari eefae30a1b [media] si2168: add one missing parenthesis
Fix following warnings:
si2168_cmd_execute() warn: add some parenthesis here?
si2168_cmd_execute() warn: maybe use && instead of &

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:12:48 -03:00
Mauro Carvalho Chehab 3926d91a6b [media] dib7000p: Callibrate signal strength
Calibrate the signal strength to dB.

For this callibration, I used adapter 0 (antenna 1), connected
via a normal cable to a DTF-2111 generator.

The same cabling and RF generator connected to adapter 1
(antenna 2) has a difference of +3dBm (signal was stronger
there).

Yet, changing the RF for a difference of, let's say, 6dB
reflected on a 6dB difference at the measured signal, with
is good.

So, the signal strengh can indeed be used to measure the
antenna gain, if the antenna is repositioned. It is
not precise to measure the absolute dBm value, however.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:51 -03:00
Mauro Carvalho Chehab 041ad44968 [media] dib7000p: Add DVBv5 stats support
Adds DVBv5 stats support. For now, just mimic whatever dib8000
does, as they're very similar, with regards to statistics.

However, dib7000p_get_time_us() likely require some
adjustments, as I didn't actually reviewed the formula
for it to work with DVB-T. Still, better than nothing,
as latter patches can improve it.

This patch also doesn't show the signal strength in dB
yet. The code is already there, but it requires to be
callibrated.

A latter patch will do the calibration.

It seems that this patch is also a bug fix: Before this
patch, the frontend were not tuning with some userspace
tools. I suspect that dib7000p firmware or hardware
internally expects that the statistics to be collected,
in order for it to work. With this patch, the DVB core
will always retrive statistics, even if userspace doesn't
request. So, it makes the device work on all tested apps.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:50 -03:00
Mauro Carvalho Chehab d44913c1e5 [media] dib8000: export just one symbol
Exporting multiple symbols don't work as it causes compilation
breakages, due to the way dvb_attach() works.

The bug happens when:
        CONFIG_DVB_DIB8000=m
	CONFIG_DVB_USB_DIB0700=y

As a bonus, dib8000 won't be loaded anymore if the device uses
a different frontend, reducing the memory footprint.

Tested with both Pixelview PV-D231 and MyGica S870.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:50 -03:00
Mauro Carvalho Chehab b9bc7d59b7 [media] dib8000: rename dib8000_attach to dib8000_init
Well, what we call as "foo_attach" is the method that should
be called by the dvb_attach() macro.

It should be noticed that the name "dvb_attach" is really a
bad name and don't express what it does.

dvb_attach() basically does three things, if the frontend is
compiled as a module:
- It lookups for the module that it is known to have the
  given symbol name and requests such module;
- It increments the module usage (anonymously - so lsmod
  doesn't print who loaded the module);
- after loading the module, it runs the function associated
  with the dynamic symbol.

When compiled as builtin, it just calls the function given to it.

As dvb_attach() increments refcount, it can't be (easily)
called more than once for the same module, or the kernel
will deny to remove the module, because refcount will never
be zeroed.

In other words, the function name given to dvb_attach()
should be one single symbol that will always be called
before any other function on that module to be used.

For almost all DVB frontends, there's just one function,
but, on dib8000, there are several exported symbols.

We need to get rid of all those direct calls, because they
cause compilation breakages when bridge is builtin and
frontend is module, we'll need to add a new function that
will be the first one to be called, whatever initialization
is needed.

So, let's rename this function, in order to prepare for
a next patch that will add a new attach() function that
will be the only one exported by this module.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:49 -03:00
Mauro Carvalho Chehab 8abe4a0a3f [media] dib7000: export just one symbol
Exporting multiple symbols don't work as it causes compilation
breakages, due to the way dvb_attach() works.

This were reported several times, like:

   drivers/built-in.o: In function `cxusb_dualdig4_rev2_tuner_attach':
>> cxusb.c:(.text+0x27d4b5): undefined reference to `dib7000p_get_i2c_master'
   drivers/built-in.o: In function `dib7070_set_param_override':
   cxusb.c:(.text+0x27d5a5): undefined reference to `dib0070_wbd_offset'
>> cxusb.c:(.text+0x27d5be): undefined reference to `dib7000p_set_wbd_ref'
   drivers/built-in.o: In function `dib7070_tuner_reset':
>> cxusb.c:(.text+0x27d5f9): undefined reference to `dib7000p_set_gpio'
   drivers/built-in.o: In function `cxusb_dualdig4_rev2_frontend_attach':
>> cxusb.c:(.text+0x27df5c): undefined reference to `dib7000p_i2c_enumeration'

In this specific report:
	CONFIG_DVB_USB_CXUSB=y
	CONFIG_DVB_DIB7000P=m

But the same type of bug can happen if:
	CONFIG_DVB_DIB7000P=m
and one of the bridge drivers is compiled builtin (cxusb, cx23885-dvb
and/or dib0700).

As a bonus, dib7000p won't be loaded anymore if the device uses
a different frontend, reducing the memory footprint.

Tested with Hauppauge Nova-TD (2 frontends).

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:49 -03:00
Mauro Carvalho Chehab 7f67d96ab1 [media] dib7000p: rename dib7000p_attach to dib7000p_init
Well, what we call as "foo_attach" is the method that should
be called by the dvb_attach() macro.

It should be noticed that the name "dvb_attach" is really a
bad name and don't express what it does.

dvb_attach() basically does three things, if the frontend is
compiled as a module:
- It lookups for the module that it is known to have the
  given symbol name and requests such module;
- It increments the module usage (anonymously - so lsmod
  doesn't print who loaded the module);
- after loading the module, it runs the function associated
  with the dynamic symbol.

When compiled as builtin, it just calls the function given to it.

As dvb_attach() increments refcount, it can't be (easily)
called more than once for the same module, or the kernel
will deny to remove the module, because refcount will never
be zeroed.

In other words, the function name given to dvb_attach()
should be one single symbol that will always be called
before any other function on that module to be used.

For almost all DVB frontends, there's just one function.

However, the dib7000p initialization can require up to 3
functions to be called:
	- dib7000p_get_i2c_master;
	- dib7000p_i2c_enumeration;
	- dib7000p_init (before this patch dib7000_attach).

(plus a bunch of other functions that the bridge driver will
need to call).

As we need to get rid of all those direct calls, because they
cause compilation breakages when bridge is builtin and
frontend is module, we'll need to add a new function that
will be the first one to be called, whatever initialization
is needed.

So, let's rename the function that probes and init the hardware
to dib7000p_init.

A latter patch will add a new dib7000p_attach that will be
used as originally conceived by dvb_attach() way.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:48 -03:00
Mauro Carvalho Chehab 619c027da0 [media] drxd: get rid of EXPORT_SYMBOL(drxd_config_i2c)
This symbol is not used externally. Get rid of it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:38 -03:00
Antti Palosaari 722a042de7 [media] si2168: relax demod lock checks a little
bit3 was not cleared always leaving driver reporting demod is not
fully locked. Do not check bit0 as it seems to be always 0.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 09:54:26 -03:00
Antti Palosaari 711615df0b [media] si2168: add copyright and license
Add copyright and license for each file.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 09:53:39 -03:00
Antti Palosaari c790885b87 [media] si2168: add support for DVB-C (annex A version)
Add support for DVB-C (annex A version).

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 09:53:04 -03:00
Antti Palosaari bffab93c46 [media] si2168: add support for DVB-T2
Add support for DVB-T2.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 09:52:22 -03:00
Antti Palosaari 845f35052e [media] si2168: Silicon Labs Si2168 DVB-T/T2/C demod driver
Silicon Labs Si2168 DVB-T/T2/C demod driver.
That driver version supports only DVB-T.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 09:50:23 -03:00
Shuah Khan c9af5c1542 [media] lgdt3305: include sleep functionality in lgdt3304_ops
Add sleep ops to lgdt3304_ops to invoke lgdt3305_sleep() to be called
from dvb_frontend_suspend(). lgdt3305_soft_reset() is called for both
3304 and 3305 devices. soft_reset and sleep touch LGDT3305_GEN_CTRL_3
on 3304 and 3305 devices. Hence, adding sleep to lgdt3304_ops will help
suspend 3304 properly from dvb_frontend_suspend().

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-07 09:40:24 -03:00
Paul Bolle aa81d5e2d3 [media] drx-j: use customise option correctly
The Kconfig entry for "Micronas DRX-J demodulator" defaults to modular
if DVB_FE_CUSTOMISE is set. But that Kconfig symbol was replaced with
MEDIA_SUBDRV_AUTOSELECT as of v3.7. So use the new symbol. And negate
the logic, because MEDIA_SUBDRV_AUTOSELECT's logic is the opposite of
the former logic.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-07 09:39:51 -03:00
Malcolm Priestley 7d3c8e8f74 [media] m88rs2000: fix sparse static warnings
fix the following warnings:
m88rs2000.c:300:16: warning: symbol 'm88rs2000_setup' was not declared. Should it be static?
m88rs2000.c:318:16: warning: symbol 'm88rs2000_shutdown' was not declared. Should it be static?
m88rs2000.c:328:16: warning: symbol 'fe_reset' was not declared. Should it be static?
m88rs2000.c:366:16: warning: symbol 'fe_trigger' was not declared. Should it be static?

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-07 09:39:39 -03:00
Antti Palosaari 418a97cbce [media] m88ds3103: fix bug on .set_tone()
Band switching didn't worked always reliably as there was one
register bit set wrong.

Thanks to Robert Schlabbach for pointing this bug and solution.

Reported-by: Robert Schlabbach <Robert.Schlabbach@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-28 18:09:49 -03:00
Mauro Carvalho Chehab ed97a6fe53 [media] af9033: Don't export functions for the hardware filter
Exporting functions for hardware filter is a bad idea, as it
breaks compilation if:
	CONFIG_DVB_USB_AF9035=y
	CONFIG_DVB_AF9033=m

Because the PID filter function calls would be hardcoded at
af9035.

The same doesn't happen with af9033_attach() because the
dvb_attach() doesn't hardcode it. Instead, it dynamically
links it at runtime.

However, calling dvb_attach() multiple times is problematic,
as it increments module kref.

So, the better is to pass one parameter for the af9033 module
to fill the hardware filters, and then use it inside af9035.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-14 20:26:59 -03:00
Antti Palosaari 040cf86c8a [media] af9033: implement PID filter
Implement PID filter and export it via symbol.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-14 20:26:25 -03:00
Antti Palosaari 2f9dff3f39 [media] m88ds3103: possible uninitialized scalar variable
It was possible that tuner_frequency variable, used for carrier offset
compensation, was uninitialized. That happens when tuner
.get_frequency() callback is not defined.

Currently that case is not possible as only used tuner has this callback.

Coverity CID 1166057: Uninitialized scalar variable (UNINIT)

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-12 08:04:52 -03:00
Antti Palosaari 8a648fbbc1 [media] m88ds3103: remove dead code 2nd part
Coverity CID 1166051: Logically dead code (DEADCODE)

TS clock calculation could be more accurate, but as it is not,
remove those unused clock speeds.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-12 08:04:42 -03:00
Antti Palosaari 672e02485e [media] m88ds3103: remove dead code
Coverity CID 1166050: Dead default in switch (DEADCODE)

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-12 08:04:32 -03:00
Gianluca Gennari 90d9c3e1ed [media] drx39xyj: fix 64 bit division on 32 bit arch
Fix this linker warning:
WARNING: "__divdi3" [media_build/v4l/drx39xyj.ko] undefined!

[m.chehab@samsung.com: add include for asm/div64.h]
Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:50:36 -03:00
Mauro Carvalho Chehab 0d49e77611 drx-j: Fix post-BER calculus on QAM modulation
There are two troubles there:
	1) the bit error measure were not accumulating;
	2) it was missing the bit count.

Fix them.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:43:54 -03:00
Mauro Carvalho Chehab ee0f4a1444 drx-j: use ber_count var
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'ctrl_get_qam_sig_quality':
drivers/media/dvb-frontends/drx39xyj/drxj.c:9468:6: warning: variable 'ber_cnt' set but not used [-Wunused-but-set-variable]
  u32 ber_cnt = 0; /* BER count */
      ^

By reading the comment, it is said that BER should be calculated as:
	qam_pre_rs_ber = frac_times1e6( ber_cnt, rs_bit_cnt );

Also, it makes sense to take the mantissa into account, so fix the
code to do what's commented.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:21 -03:00
Mauro Carvalho Chehab d591590e1b [media] drx-j: enable DVBv5 stats
Now that everything is set, let's enable DVBv5 stats, for
applications that support it.

DVBv3 apps will still work.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:21 -03:00
Mauro Carvalho Chehab 80846a5c2f [media] drx-j: Fix detection of no signal
When the signal is 7, it means that no signal was received.

Value experimentally measured.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:20 -03:00
Mauro Carvalho Chehab 6983257813 [media] drx-j: properly handle bit counts on stats
Instead of just assuming that the min resolution is 1E-6,
pass both bit error and bit counts for userspace to calculate
BER. The same applies for PER, for 8VSB. It is not clear how
to get the packet count for QAM. So, for now, don't expose PER
for QAM.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:20 -03:00
Mauro Carvalho Chehab 03fdfbfd3b [media] drx-j: Prepare to use DVBv5 stats
Convert the stats internally to use DVBv5. For now, it will keep
showing everything via DVBv3 API only, as the .len value were
not initialized.

That allows testing if the new stats code didn't break anything.

A latter patch will add the final bits for the DVBv5 stats to
fully work.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:19 -03:00
Mauro Carvalho Chehab 80e5ed14e1 [media] drx-j: re-add get_sig_strength()
We'll need to use this function. Restore it from the
git history.

This function will be used on the next patch.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:19 -03:00
Mauro Carvalho Chehab 6f64c522bc [media] drx-j: Don't use "state" for DVB lock state
State is already used on other places for the state struct.
Don't use it here, to avoid troubles with latter patches.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:18 -03:00
Mauro Carvalho Chehab 9c44a5d76e [media] drx-j: get rid of some unused vars
As reported when compiled with W=1:

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘ctrl_set_channel’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:10340:26: warning: variable ‘common_attr’ set but not used [-Wunused-but-set-variable]
  struct drx_common_attr *common_attr = NULL;
                          ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:10336:6: warning: variable ‘intermediate_freq’ set but not used [-Wunused-but-set-variable]
  s32 intermediate_freq = 0;

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:18 -03:00
Mauro Carvalho Chehab 691cbbe354 [media] drx-j: propagate returned error from request_firmware()
Fix a smatch warning:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:11711 drx_ctrl_u_code() info: why not propagate 'rc' from request_firmware() instead of (-2)?

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:17 -03:00
Mauro Carvalho Chehab 1e5ec31a46 [media] drx-j: Fix usage of drxj_close()
This function is currently not used. However, it was meant to
be called at device release. So, add it there.

While here, remove the bad check, as reported by Dan, as
smatch warning:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:20041 drxj_close() warn: variable dereferenced before check 'demod' (see line 20036)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:17 -03:00
Mauro Carvalho Chehab 0147314639 [media] drx-j: remove external symbols
This driver doesn't export any external symbol, except for
the attach() method.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:16 -03:00
Mauro Carvalho Chehab b6c4065eef [media] drx-j: get rid of dead code
There are large chunks of code at drx-j that aren't used. Most
of them are due to analog TV support. Well, just enabling them
won't make analog support work, as devices with DRX and analog
support requires an extra chip (avf4910).

We don't have drivers for it, nor the current device that uses
this frontend has support for analog TV.

So, let's just get rid of this code. If latter needed, this
patch can easily be reverted from git history.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:16 -03:00
Mauro Carvalho Chehab 1d001c3fde [media] drx-j: don't use mc_info before checking if its not NULL
smatch warning:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:20803 drx_ctrl_u_code() warn: variable dereferenced before check 'mc_info' (see line 20800)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:15 -03:00
Mauro Carvalho Chehab d1f2aae3d9 [media] drx39xxj.h: Fix undefined reference to attach function
As reported by the kbuild test robot <fengguang.wu@intel.com>:

drivers/built-in.o: In function `em28xx_dvb_init':
    em28xx-dvb.c:(.text+0x876f2c): undefined reference to `drx39xxj_attach'

That happens when CONFIG_VIDEO_EM28XX_DVB is selected, and neither
CONFIG_MEDIA_SUBDRV_AUTOSELECT or DVB_DRX39XYJ is selected.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:15 -03:00
Mauro Carvalho Chehab 87bf0e5487 [media] drx-j: Fix dubious usage of "&" instead of "&&"
Fixes the following warnings:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:16764:68: warning: dubious: x & !y
	drivers/media/dvb-frontends/drx39xyj/drxj.c:16778:68: warning: dubious: x & !y
	drivers/media/dvb-frontends/drx39xyj/drxj.c:16797:68: warning: dubious: x & !y

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:49 -03:00
Mauro Carvalho Chehab db5657c5ec [media] drx-j: Don't use 0 as NULL
Fixes the following warnings:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:65: warning: Using plain integer as NULL pointer
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:71: warning: Using plain integer as NULL pointer
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:52: warning: Using plain integer as NULL pointer
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:58: warning: Using plain integer as NULL pointer

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:48 -03:00
Dave Jones 73b8922fef [media] drx-d: add missing braces in drxd_hard.c:DRXD_init
No functional changes, but removes a duplicate check, if
!state->type_A.

Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:48 -03:00
Fengguang Wu c4cfb29303 [media] drx-j: drxj_default_aud_data_g can be static
Fix sparse warning:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1039:16: sparse: symbol 'drxj_default_aud_data_g' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:47 -03:00
Mauro Carvalho Chehab c897df0e2d Linux 3.14-rc5
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJTE+9XAAoJEHm+PkMAQRiGrMQIAKI2V49Kj8WlnwGchFvsbGJB
 SLALwNi33T/IBKdZRhrfryBu02Zj7eVvZ2ML35dJEnmF88O+dJBDMTkKV1xalrip
 mtkBrjUnfAI04fq/daLQ1TsAy4qqlra5tSTuDCw8ILOnGPwT0VydIEHNdtmoUIfw
 xlZLxHzny1MslZ78d7uR/cUnV9ylKRRajWzfw1HT8hL51fCt8nRWY0sCvwvl+kMJ
 LsK+6I7mHDUuzA7QBmBI+dhzQgos5+JkkrnpmqHAqwmIh+AI3ksmjUCQ4dM7owrO
 IvEx+ZNDqxAdLcm1WAxATNfxddFXHc62JTvKuuKqTVWuaxVfK1Aqt8MjDMIPeAQ=
 =yV5u
 -----END PGP SIGNATURE-----

Merge tag 'v3.14-rc5' into patchwork

Linux 3.14-rc5

* tag 'v3.14-rc5': (1117 commits)
  Linux 3.14-rc5
  drm/vmwgfx: avoid null pointer dereference at failure paths
  drm/vmwgfx: Make sure backing mobs are cleared when allocated. Update driver date.
  drm/vmwgfx: Remove some unused surface formats
  MAINTAINERS: add maintainer entry for Armada DRM driver
  arm64: Fix !CONFIG_SMP kernel build
  arm64: mm: Add double logical invert to pte accessors
  dm cache: fix truncation bug when mapping I/O to >2TB fast device
  perf tools: Fix strict alias issue for find_first_bit
  powerpc/powernv: Fix indirect XSCOM unmangling
  powerpc/powernv: Fix opal_xscom_{read,write} prototype
  powerpc/powernv: Refactor PHB diag-data dump
  powerpc/powernv: Dump PHB diag-data immediately
  powerpc: Increase stack redzone for 64-bit userspace to 512 bytes
  powerpc/ftrace: bugfix for test_24bit_addr
  powerpc/crashdump : Fix page frame number check in copy_oldmem_page
  powerpc/le: Ensure that the 'stop-self' RTAS token is handled correctly
  kvm, vmx: Really fix lazy FPU on nested guest
  perf tools: fix BFD detection on opensuse
  drm/radeon: enable speaker allocation setup on dce3.2
  ...
2014-03-11 06:55:49 -03:00
Antti Palosaari 92d20d9fd1 [media] rtl2832: implement delayed I2C gate close
Delay possible I2C gate close a little bit in order to see if there
is next message coming to tuner in a sequence.

Also, export private muxed I2C adapter. That is aimed only for SDR
extension module as SDR belongs to same RTL2832 physical I2C bus (it
is physically property of RTL2832, whilst it is own kernel module).

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:41:18 -03:00
Luis Alves 0db5c800aa [media] rtl2832: Fix deadlock on i2c mux select function
Signed-off-by: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:39:34 -03:00
Antti Palosaari 0ea872d43e [media] rtl2832: add muxed I2C adapter for demod itself
There was a deadlock between master I2C adapter and muxed I2C
adapter. Implement two I2C muxed I2C adapters and leave master
alone, just only for offering I2C adapter for these mux adapters.

Reported-by: Luis Alves <ljalvs@gmail.com>
Reported-by: Benjamin Larsson <benjamin@southpole.se>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:39:17 -03:00
Antti Palosaari 8823f0288d [media] rtl2832: provide muxed I2C adapter
RTL2832 provides gated / repeater I2C adapter for tuner.
Implement it as a muxed I2C adapter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:38:28 -03:00
Antti Palosaari 3ca2418d70 [media] rtl2832: style changes and minor cleanup
Most of those were reported by checkpatch.pl...

debug module parameter is not used anywhere so remove it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:38:01 -03:00
Antti Palosaari 5791eee264 [media] rtl2832: remove unused if_dvbt config parameter
All used tuners has get_if_frequency() callback and that parameter
is not needed and will not needed as all upcoming tuner drivers
should implement get_if_frequency().

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:36:59 -03:00
Mauro Carvalho Chehab a5e7a67f9e [media] drx-j: set it to serial mode by default
Currently, there's just one device using this frontend: PCTV 80e,
and it works on serial mode.

Change the default here to serial mode. If we add more devices,
then this option should be set via config structure.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:42:09 -03:00
Mauro Carvalho Chehab 41b5cc0c91 [media] drx-j: Properly initialize mpeg struct before using it
The cfg_mpeg_output has more fields than what it is initialized
when the code is called. Be sure to initialize everything before
use, in order to avoid random behaviors.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:42:00 -03:00
Mauro Carvalho Chehab bf9b94ab92 [media] drx-j: disable OOB
Just like the windows driver, disable OOB after setting the driver
version.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:41:49 -03:00
Shuah Khan 1ad77b5c29 [media] drx-j: fix boot failure due to null pointer dereference
DJH_DEBUG only code path in drxbsp_i2c_write_read() dereferences
w_dev_addr and subsequently w_dev_addr->user_data->i2c which results
in failure during boot. This patch fixes the null pointer derefence
bug as well as the following compile errors:

  LD      arch/x86/built-in.o
  CC      drivers/media/dvb-frontends/drx39xyj/drxj.o
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxbsp_i2c_write_read’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1558:25: error: redeclaration of ‘state’ with no linkage
  struct drx39xxj_state *state = w_dev_addr->user_data;
                         ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1512:25: note: previous declaration of ‘state’ was here
  struct drx39xxj_state *state;
                         ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1558:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  struct drx39xxj_state *state = w_dev_addr->user_data;
  ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1560:17: error: redeclaration of ‘msg’ with no linkage
  struct i2c_msg msg[2] = {
                 ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1513:17: note: previous declaration of ‘msg’ was here
  struct i2c_msg msg[2];
                 ^

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:41:29 -03:00
Shuah Khan 546ef6bf25 [media] drx-j: remove return that prevents DJH_DEBUG code to run
drxbsp_i2c_write_read() has return that prevents DJH_DEBUG code to run.
Remove it.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:41:14 -03:00
Shuah Khan 6c955b8b3b [media] drx-j: fix pr_dbg undefined compile errors when DJH_DEBUG is defined
drxj.c fails to compile with the following errors when DJH_DEBUG
is defined.

drivers/media/dvb-frontends/drx39xyj/drxj.c:1567:2: error: implicit declaration of function ‘pr_dbg’ [-Werror=implicit-function-declaration]
  pr_dbg("drx3933 i2c operation addr=%x i2c=%p, wc=%x rc=%x\n",
  ^

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:41:04 -03:00
Mauro Carvalho Chehab 8afff9a23f [media] drx-j: be sure to do a full software reset
Mimic what windows driver does here: it writes 0x07 to
SIO_CC_SOFT_RST__A, instead of just 0x03.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:40:54 -03:00
Mauro Carvalho Chehab d7a5478a8a [media] drx-j: be sure to send the powerup command at device open
As drxj_close puts the device in powerdown, we need to power it up
properly at drxj_open.

This is the behavior noticed at the Windows driver.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:40:43 -03:00
Mauro Carvalho Chehab 9e4c509d74 [media] drx-j: Use single master mode
There are no other I2C masters here. Also, the Windows driver uses
this mode (and both drxd and drxk Kernel drivers). So, switch
to it.

That helps to compare the logs between the Linux driver and the
Windows one.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:40:29 -03:00
Mauro Carvalho Chehab ea8f3c2c60 [media] drx-j: Allow userspace control of LNA
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 14:40:10 -03:00
Mauro Carvalho Chehab 244c0e06bf [media] drx-j: get rid of function wrappers
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 14:40:00 -03:00
Mauro Carvalho Chehab 80bff4b075 [media] drx-j: get rid of struct drx_dap_fasi_funct_g
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 14:39:44 -03:00
Mauro Carvalho Chehab 73b3fc3d74 [media] drx-j: get rid of drx_dap_fasi.c
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 14:39:06 -03:00
Mauro Carvalho Chehab 0ad0c37c7c [media] drx-j: get rid of function prototypes at drx_dap_fasi.c
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 14:38:54 -03:00
Mauro Carvalho Chehab 97a8918abf [media] drx-j: Get rid of I2C protocol version
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 14:38:42 -03:00
Mauro Carvalho Chehab 938f11fa3f [media] drx-j: Fix qam/256 mode
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 14:38:30 -03:00
Mauro Carvalho Chehab 096c8fac7d [media] drx-j: remove some unused data
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 14:37:53 -03:00
Mauro Carvalho Chehab ceea5e2d9d [media] drx-j: use the proper timeout code on scu_command
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 14:37:41 -03:00
Mauro Carvalho Chehab c4dc6f9222 [media] drx-j: call ctrl_set_standard even if a standard is powered
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 14:37:09 -03:00
Mauro Carvalho Chehab c76286bafc [media] drx-j: avoid calling power_down_foo twice
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 14:36:59 -03:00
Mauro Carvalho Chehab 7abc7a54da [media] drx-j: be sure to use tuner's IF
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 14:36:48 -03:00
Mauro Carvalho Chehab a6530ce54b [media] drx-j: get rid of tuner dummy get/set frequency
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 14:36:39 -03:00
Mauro Carvalho Chehab d7b0631eb2 [media] drx-j: remove some ugly bindings from drx39xxj_dummy.c
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 14:36:26 -03:00
Mauro Carvalho Chehab 74c8794a8f [media] drx-j: comment or remove unused code
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 14:36:10 -03:00
Mauro Carvalho Chehab b0baeb494e [media] drx-j: get rid of drxj_ctrl()
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 14:35:57 -03:00
Mauro Carvalho Chehab 190137478f [media] drx-j: move drx39xxj into drxj.c
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 14:35:43 -03:00
Mauro Carvalho Chehab b78359a689 [media] drx-j: get rid of the remaining drx generic functions
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 14:35:31 -03:00
Mauro Carvalho Chehab dc5a91d49d [media] drx-j: get rid of drx_ctrl
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 14:35:18 -03:00
Mauro Carvalho Chehab 30de0bfc76 [media] drx-j: Remove duplicated firmware upload code
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 14:35:06 -03:00
Mauro Carvalho Chehab 5b60053cae [media] drx-j: Avoid any regressions by preserving old behavior
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 14:34:53 -03:00
Mauro Carvalho Chehab b240eacdd5 [media] drx-j: get rid of drx_driver.c
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 14:34:27 -03:00
Mauro Carvalho Chehab ad55f6c881 [media] drx-j: prepend function names with drx_ at drx_driver.c
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 14:34:14 -03:00
Mauro Carvalho Chehab 1e76a99963 [media] drx-j: Some cleanups at drx_driver.c source
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 14:34:04 -03:00
Mauro Carvalho Chehab 96b43136b8 [media] drx-j: Allow standard selection
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 14:33:47 -03:00
Mauro Carvalho Chehab aafdbaa6cf [media] drx-j: reset the DVB scan configuration at powerup
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 14:33:36 -03:00
Mauro Carvalho Chehab d0b2519e04 [media] drx-j: get rid of its own be??_to_cpu() implementation
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 14:33:25 -03:00
Mauro Carvalho Chehab e2b8e8d241 [media] drx-j: remove unused code from drx_driver.c
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 14:33:16 -03:00
Mauro Carvalho Chehab 2cd63e487c [media] drx-j: Split firmware size check from the main routine
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 14:32:54 -03:00
Mauro Carvalho Chehab b48293db4a [media] drx-j: dynamically load the firmware
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 14:32:17 -03:00
Mauro Carvalho Chehab 782ae20df2 [media] drx-j: Be sure that all allocated data are properly initialized
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 14:31:21 -03:00
Mauro Carvalho Chehab 29b93d8f9c [media] drx-j: Fix release and error path on drx39xxj.c
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 14:31:07 -03:00
Mauro Carvalho Chehab 9cf5370e31 [media] drx-j: remove the useless microcode_size
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 14:30:55 -03:00
Mauro Carvalho Chehab 2f1f733386 [media] drx-j: make checkpatch.pl happy
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 14:30:44 -03:00
Mauro Carvalho Chehab c361fda0e5 [media] drx-j: remove drxj_options.h
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 14:30:34 -03:00
Mauro Carvalho Chehab ab0db7e069 [media] drx-j: remove typedefs at drx_driver.c
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 14:30:22 -03:00
Mauro Carvalho Chehab b8cbcd354f [media] drx-j: get rid of some ugly macros
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 14:30:09 -03:00
Mauro Carvalho Chehab 935c665404 [media] drx-j: Replace printk's by pr_foo()
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 14:29:55 -03:00
Mauro Carvalho Chehab 9482354f4a [media] drx-j: Use the Linux error codes
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 14:29:41 -03:00
Mauro Carvalho Chehab 6371351777 [media] drx-j: CodingStyle fixups on drxj.c
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 14:29:18 -03:00
Mauro Carvalho Chehab 60d3603ba0 [media] drx-j: Remove typedefs in drxj.c
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 14:29:02 -03:00
Mauro Carvalho Chehab e33f2193ad [media] drx-j: More CamelCase fixups
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:28:50 -03:00
Mauro Carvalho Chehab 259f380e68 [media] drx-j: Simplify logic expressions
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 14:28:37 -03:00
Mauro Carvalho Chehab 64e49cb988 [media] drx-j: don't use parenthesis on return
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 14:27:35 -03:00
Mauro Carvalho Chehab 068e94ea17 [media] drx-j: replace the ugly CHK_ERROR() macro
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 14:26:46 -03:00
Mauro Carvalho Chehab b1d0a59649 [media] drx-j: Don't use buffer if an error occurs
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 14:26:21 -03:00
Mauro Carvalho Chehab adc0e25893 [media] drx-j: a few more CodingStyle fixups
Some whitespace cleanups.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:26:08 -03:00
Mauro Carvalho Chehab b3ce3a8311 [media] drx-j: Get rid of typedefs on drxh.h
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 14:25:58 -03:00
Mauro Carvalho Chehab 1bfc9e15a1 [media] drx-j: get rid of typedefs in drx_driver.h
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 14:25:46 -03:00
Mauro Carvalho Chehab ffe7c4f921 [media] drx-j: Get rid of drx39xyj/bsp_tuner.h
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>
2014-03-04 14:25:28 -03:00
Mauro Carvalho Chehab f531f22505 [media] drx-j: make a few functions static
drivers/media/dvb-frontends/drx39xyj/drx_driver.c:181:7: warning: no previous prototype for 'get_scan_context' [-Wmissing-prototypes]
 void *get_scan_context(pdrx_demod_instance_t demod, void *scan_context)

drivers/media/dvb-frontends/drx39xyj/drx_driver.c: At top level:
drivers/media/dvb-frontends/drx39xyj/drx_driver.c:842:5: warning: no previous prototype for 'ctrl_dump_registers' [-Wmissing-prototypes]
 int ctrl_dump_registers(pdrx_demod_instance_t demod,

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:25:19 -03:00
Mauro Carvalho Chehab 4a8a8694de [media] drx-j: Some minor CodingStyle fixes at headers
No functional changes.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:25:08 -03:00
Mauro Carvalho Chehab 4d7bb0ebbb [media] drx-j: Remove a bunch of unused but assigned vars
None of those vars are used on those functions. Just remove them.

After this patch, there's just one of such warnings:

	drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'ctrl_get_qam_sig_quality':
	drivers/media/dvb-frontends/drx39xyj/drxj.c:7872:6: warning: variable 'ber_cnt' set but not used [-Wunused-but-set-variable]
	  u32 ber_cnt = 0; /* BER count */

We'll keep it, as BER count will be useful when converting the
frontend to report statistics via DVBv5 API

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:24:57 -03:00
Mauro Carvalho Chehab c677f7601f [media] drx-j: remove the unused tuner_i2c_write_read() function
This function is not static. Also, it is not used anywhere.
So, drop it.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:24:44 -03:00
Mauro Carvalho Chehab 22892268cd [media] drx-j: do more CodingStyle fixes
This time, use checkpatch --strict --fix.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:24:32 -03:00
Mauro Carvalho Chehab 57afe2f0bb [media] drx-j: Don't use CamelCase
There's no reason at all to use CamelCase here. Convert all of
them to normal case.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:24:17 -03:00
Mauro Carvalho Chehab 7ef66759a3 [media] drx-j: Use checkpatch --fix to solve several issues
Instead of manually fixing the issues, use the --fix experimental
checkpatch. That solves a bunch of checkpatch issues.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:23:35 -03:00
Mauro Carvalho Chehab dbe82e0613 [media] drx-j: fix whitespacing on pointer parmameters
Patch generated with this script:

for i in drivers/media/dvb-frontends/drx39xyj/*.[ch]; do perl -ne 's,(enum|struct|void|int|u32|u64|u16|u8|s8|s16|s32|s64)\s+(\S+)\s+\*[ ]+,\1 \2 *,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 14:23:17 -03:00
Mauro Carvalho Chehab 61263c751b [media] drx-j: get rid of most of the typedefs
There are lots of typedefs there. Let's get rid of them.

Most of the work here is due to this small script:

	if [ "$3" == "" ]; then
		echo "usage: $0 type DRXName drx_name"
	fi
	t=$1; f=$2; g=$3
	for i in *.[ch]; do
		sed s,"p${f}_t","$t $g *",g <$i >a && mv a $i && \
		sed s,"${f}_t","$t $g",g <$i >a && mv a $i
	done

Just kept there the function typedefs, as those are still useful.

Yet, all those tuner_ops can likely be just removed on a latter
cleanup patch.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:23:04 -03:00
Mauro Carvalho Chehab 6c1d56c5cb [media] drx-j: get rid of the bsp*.h headers
Move them into drx_driver.h

That makes easier to cleanup further what's there at the
headers.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:22:47 -03:00
Mauro Carvalho Chehab 73f7065be6 [media] drx-j: get rid of the other typedefs at bsp_types.h
Most of the work were done by those small scripts:

for i in *; do sed s,pDRXFrequency_t,"s32 *",g <$i >a && mv a $i; done
for i in *; do sed s,DRXFrequency_t,"s32",g <$i >a && mv a $i; done
for i in *; do sed s,pDRXSymbolrate_t,"u32 *",g <$i >a && mv a $i; done
for i in *; do sed s,DRXSymbolrate_t,"u32",g <$i >a && mv a $i; done
for i in *; do sed s,FALSE,false,g <$i >a && mv a $i; done
for i in *; do sed s,TRUE,true,g <$i >a && mv a $i; done
for i in *; do sed s,Bool_t,bool,g <$i >a && mv a $i; done
for i in *; do sed s,pbool,"bool *",g <$i >a && mv a $i; done

The only remaining things there are the return values.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:22:35 -03:00
Mauro Carvalho Chehab 43a431e4b2 [media] drx-j: get rid of the integer typedefs
Patch created using this small script:

for j in 8 16 32; do for i in *; do sed s,pu${j}_t,"u$j *",g <$i >a && mv a $i; done; done
for j in 8 16 32; do for i in *; do sed s,ps${j}_t,"s$j *",g <$i >a && mv a $i; done; done
for j in 8 16 32; do for i in *; do sed s,s${j}_t,"s$j",g <$i >a && mv a $i; done; done
for j in 8 16 32; do for i in *; do sed s,u${j}_t,"u$j",g <$i >a && mv a $i; done; done

and fixing the bsp_types.h header.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:22:17 -03:00
Mauro Carvalho Chehab bab3fccac9 [media] drx-j: remove the "const" annotate on HICommand()
After removing the typedef, it is now clear that HICommand() were
abusing of a var that was expecting to be constant:

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘HICommand’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:2272:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2272:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2273:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2273:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2274:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2274:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2275:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2275:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2278:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2278:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2279:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2279:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2291:2: warning: passing argument 1 of ‘drxDapDRXJFunct_g.writeReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2291:2: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2311:4: warning: passing argument 1 of ‘drxDapDRXJFunct_g.readReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2311:4: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’
drivers/media/dvb-frontends/drx39xyj/drxj.c:2315:3: warning: passing argument 1 of ‘drxDapDRXJFunct_g.readReg16Func’ discards ‘const’ qualifier from pointer target type [enabled by default]
drivers/media/dvb-frontends/drx39xyj/drxj.c:2315:3: note: expected ‘struct i2c_device_addr *’ but argument is of type ‘const struct i2c_device_addr *’

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:21:57 -03:00
Mauro Carvalho Chehab 5b223b390d [media] drx-j: get rid of the typedefs on bsp_i2c.h
Most of the hard work here were done by this small script:

for i in *; do sed s,pI2CDeviceAddr_t,"struct i2c_device_addr *",g <$i >a && mv a $i; done
for i in *; do sed s,I2CDeviceAddr_t,"struct i2c_device_addr",g <$i >a && mv a $i; done

Only bsp_i2c.h were added by hand.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:21:37 -03:00
Mauro Carvalho Chehab c7db16ae19 [media] drx-j: Fix CodingStyle
Make checkpatch.pl happy.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:21:20 -03:00
Mauro Carvalho Chehab 3fc954a1e9 [media] drx-j: Fix compilation and un-comment it
There were some DVB internal API changes, since this driver were
written. Change it to work with the new API.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:21:00 -03:00
Mauro Carvalho Chehab 443f18d0d5 [media] drx-j: CodingStyle fixes
Do the automatic CodingStyle fixes found at Lindent.

No functional changes.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:20:30 -03:00
Devin Heitmueller ca3355a947 [media] drx-j: put under 3-clause BSD license
Relicense the drx-j driver under a standard 3-clause BSD license, which makes
it GPL compatible.

This was done explicitly with permission from Trident Microsystems.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:20:27 -03:00
Devin Heitmueller 38b2df95c5 [media] drx-j: add a driver for Trident drx-j frontend
Add support for the Trident DRX-J driver, including a card profile for the
PCTV 80e which uses the chip.

Thanks to Trident for allowing the release of this code under a BSD license,
and of course Hauppauge/PCTV for pushing for its release to the community.

[pdickeybeta@gmail.com: modified to fix compilation errors and also to move
 the driver files from the drx39xy subdirectory to the frontends directory]

[m.chehab@samsung.com: fix merge conflicts, commented drx-j compilation and
 added EM28XX_R06_I2C_CLK setup also to the board setup]

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:20:23 -03:00
Heinrich Schuchardt b59de95bed [media] ds3000: fix reading array out of bound in ds3000_read_snr
An attempt was made to read dvbs2_snr_tab[80],
though dvbs2_snr_tab has only 80 elements.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-28 15:21:02 -03:00
Alexander Shiyan 7e6bd12fb7 [media] stb6100: fix buffer length check in stb6100_write_reg_range()
We are checking sizeof() the wrong variable!

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-28 15:20:33 -03:00
Dan Carpenter c6aa852ae0 [media] stv0900: remove an unneeded check
No need to check lock twice here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-28 15:20:15 -03:00
Malcolm Priestley 8272d0a0c0 [media] m88rs2000: prevent frontend crash on continuous transponder scans
Add m88rs2000_get_tune_settings, min delay of 2000 ms on symbol
rate more than 3000000 and delay of 3000ms less than this.

Adding min delay prevents crashing the frontend on continuous
transponder scans. Other dvb_frontend_tune_settings remain as default.

This makes very little time difference to good channel scans, but slows down
the set frontend where lock can never be achieved i.e. DVB-S2.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-28 15:19:44 -03:00
Malcolm Priestley 3c8023a782 [media] m88rs2000: add caps FE_CAN_INVERSION_AUTO
The m88rs2000 frontend is always auto inversion.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-28 15:18:50 -03:00
Malcolm Priestley 182f3fe929 [media] it913x-fe: Dead code remove driver
This driver has been replaced by af9033 and tuner_it913x

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-24 10:49:52 -03:00
Antti Palosaari 116802f1ce [media] tda10071: coding style issues
Fix some coding style issues, mostly reported by checkpatch.pl.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-24 10:37:16 -03:00
Antti Palosaari 0711560677 [media] tda10071: do not check tuner PLL lock on read_status()
Tuner PLL lock flag was mapped to FE_HAS_SIGNAL, which is wrong. PLL
lock has nothing to do with received signal. In real life that flag
is always set.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-24 10:35:36 -03:00
Dan Carpenter a3a528ba8e [media] tda10071: remove a duplicative test
"ret" is an error code here, we already tested that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-24 10:34:43 -03:00
Mauro Carvalho Chehab 37e59f876b [media, edac] Change my email address
There are several left overs with my old email address.
Remove their occurrences and add myself at CREDITS, to
allow people to be able to reach me on my new addresses.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-07 08:03:07 -02:00
Andi Shyti a33dd5171d [media] cx24117: use a valid dev pointer for dev_err printout
Don't use '&state->priv->i2c->dev' reference to device because
state is still 'NULL'. Use '&i2c->dev' instead.

This bug has been reported by scan.coverity.com

Signed-off-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Cc: vger@stable.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 06:36:03 -02:00
Andi Shyti 62fd0d30e1 [media] cx24117: remove dead code in always 'false' if statement
At this point of the execution in the function cx24117_attach()
demod cannot be '0'. In that case the function returns earlier
with an error value ('NULL'). Remove the if statement.

This error has been reported by scan.coverity.com

Signed-off-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 06:35:26 -02:00
Michael Krufky 08e1097266 [media] update Michael Krufky's email address
I am no longer available at the kernellabs.com or m1k.net email
addresses.  Update each instance of my email to my linuxtv.org
account.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 06:34:21 -02:00
Mauro Carvalho Chehab 4b81972498 [media] drxk: remove the option to load firmware asynchronously
The option to load firmware asynchronously were added due to
a requirement with a few versions of udev. It turns that this was
a bad idea and caused regressions on drxk-based devices.

So, we end by only letting the firmware to be loaded syncronously
everywhere.

So, let's remove the bad code.

This patch partially reverts the changeset 8e30783b0b.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-14 14:40:10 -02:00
Mauro Carvalho Chehab e4a3bc1c2c [media] dib8000: Fix a few warnings when compiled for avr32
drivers/media/dvb-frontends/dib8000.c: In function 'dib8000_get_time_us':
	drivers/media/dvb-frontends/dib8000.c:3957: warning: 'interleaving' may be used uninitialized in this function
	drivers/media/dvb-frontends/dib8000.c:3956: warning: 'rate_denum' may be used uninitialized in this function

Those are actually false positives, but it doesn't hurt cleaning them.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-13 16:28:13 -02:00
Mauro Carvalho Chehab 5dc8526b90 [media] dib8000: Properly represent long long integers
When compiling with avr32, it gets those errors:

	drivers/media/dvb-frontends/dib8000.c: In function 'dib8000_get_stats':
	drivers/media/dvb-frontends/dib8000.c:4121: warning: integer constant is too large for 'long' type

Fix integer representation to avoid overflow.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-13 16:28:12 -02:00
Mauro Carvalho Chehab fa1e1de6bb [media] nxt200x: increase write buffer size
The buffer size on nxt200x is not enough:

	...
	> Dec 20 10:52:04 rich kernel: [   31.747949] nxt200x: nxt200x_writebytes: i2c wr reg=002c: len=255 is too big!
	...

Increase it to 256 bytes.

Reported-by: Rich Freeman <rich0@gentoo.org>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-13 10:29:47 -02:00
Malcolm Priestley a6d8e68b60 [media] m88rs2000: Correct m88rs2000_get_fec
Value of fec is achieved by the upper nibble bits 6,7 & 8.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07 09:40:34 -02:00
Malcolm Priestley 49c44802a7 [media] m88rs2000: Correct m88rs2000_set_fec settings
Register 0x70 is used to set fec, register 0x76 is used to get fec

Register 0x76 is set to 0x8.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07 09:40:04 -02:00
Malcolm Priestley 7a9d6b43f8 [media] m88rs2000: correct read status lock value
The correct lock values is when bits of the value 0xee are set.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07 09:38:01 -02:00
Malcolm Priestley dd4491dfb9 [media] m88rs2000: set symbol rate accurately
Current setting of symbol rate is not very actuate causing
loss of lock.

Covert temp to u64 and use mclk to calculate from big number.

Calculate symbol rate by dividing symbol rate by 1000 times
1 << 24 and dividing sum by mclk.

Add other symbol rate settings to function registers 0xa0-0xa3.

In set_frontend add changes to register 0xf1 this must be done
prior call to fe_reset. Register 0x00 doesn't need a second
write of 0x1

Applied after patch
m88rs2000: add m88rs2000_set_carrieroffset

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # v3.9+
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07 09:37:29 -02:00
Malcolm Priestley 06af15d1b6 [media] m88rs2000: add m88rs2000_set_carrieroffset
Set the carrier offset correctly using the default mclk values.

Add function m88rs2000_get_mclk to calculate the mclk value
against crystal frequency which will later be used for
other functions.

Add function m88rs2000_set_carrieroffset to calculate
and set the offset value.

variable offset becomes a signed value.

Register 0x86 is set the appropriate value according to
remainder value of frequency % 192857 calculation as
shown.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # v3.9+
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07 09:35:58 -02:00