Commit graph

26 commits

Author SHA1 Message Date
Krzysztof Kozlowski 04d8be053f [media] dvb-frontends: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:58:20 -03:00
Mauro Carvalho Chehab 0df289a209 [media] dvb: Get rid of typedev usage for enums
The DVB API was originally defined using typedefs. This is against
Kernel CodingStyle, and there's no good usage here. While we can't
remove its usage on userspace, we can avoid its usage in Kernelspace.

So, let's do it.

This patch was generated by this shell script:

	for j in $(grep typedef include/uapi/linux/dvb/frontend.h |cut -d' ' -f 3); do for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f); do sed "s,${j}_t,enum $j," <$i >a && mv a $i; done; done

While here, make CodingStyle fixes on the affected lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> # for drivers/media/firewire/*
2015-06-09 17:47:35 -03:00
Mauro Carvalho Chehab d858b0e787 [media] rtl2830: declare functions as static
drivers/media/dvb-frontends/rtl2830.c:21:5: warning: no previous prototype for ‘rtl2830_bulk_write’ [-Wmissing-prototypes]
 int rtl2830_bulk_write(struct i2c_client *client, unsigned int reg,
     ^
drivers/media/dvb-frontends/rtl2830.c:33:5: warning: no previous prototype for ‘rtl2830_update_bits’ [-Wmissing-prototypes]
 int rtl2830_update_bits(struct i2c_client *client, unsigned int reg,
     ^
drivers/media/dvb-frontends/rtl2830.c:45:5: warning: no previous prototype for ‘rtl2830_bulk_read’ [-Wmissing-prototypes]
 int rtl2830_bulk_read(struct i2c_client *client, unsigned int reg, void *val,
     ^

Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:38:29 -02:00
Antti Palosaari 15d37f3824 [media] rtl2830: convert to regmap API
Use regmap to cover register access routines.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 15:59:19 -02:00
Antti Palosaari fd4cfa8bb1 [media] rtl2830: implement own I2C locking
Own I2C locking is needed due to two special reasons:
1) Chips uses multiple register pages/banks on single I2C slave.
Page is changed via I2C register access.
2) Chip offers muxed/gated I2C adapter for tuner. Gate/mux is
controlled by I2C register access.

Due to these reasons, I2C locking did not fit very well.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 15:54:59 -02:00
Antti Palosaari df70ddad81 [media] rtl2830: implement PID filter
Implement PID filter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:56:50 -02:00
Antti Palosaari 6dcfe3cc2e [media] rtl2830: wrap DVBv5 CNR to DVBv3 SNR
Change legacy DVBv3 read SNR to return values calculated by DVBv5
statistics.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:56:14 -02:00
Antti Palosaari f491391cc3 [media] rtl2830: wrap DVBv5 BER to DVBv3
Change legacy DVBv3 read BER to return values calculated by DVBv5
statistics.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:55:51 -02:00
Antti Palosaari d512e28651 [media] rtl2830: wrap DVBv5 signal strength to DVBv3
Change legacy DVBv3 signal strength to return values calculated by
DVBv5 statistics.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:55:28 -02:00
Antti Palosaari 5bb11ca586 [media] rtl2830: implement DVBv5 BER statistic
DVBv5 BER.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:55:08 -02:00
Antti Palosaari 871f70252b [media] rtl2830: implement DVBv5 signal strength statistics
Estimate signal strength from IF AGC.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:54:35 -02:00
Antti Palosaari 47b4dbfff1 [media] rtl2830: implement DVBv5 CNR statistic
DVBv5 CNR.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:53:53 -02:00
Antti Palosaari 947debb4f2 [media] rtl2830: style related changes
Trivial changes proposed by checkpatch.pl and some more.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:53:06 -02:00
Antti Palosaari b8cb50d237 [media] rtl2830: get rid of internal config data
Remove internal config and use configuration values directly from
the platform data.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:52:25 -02:00
Antti Palosaari 7cc3932889 [media] rtl2830: fix logging
Pass correct device for dev_foo() logging in order to print logs
correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:51:39 -02:00
Antti Palosaari 1f153c4d88 [media] rtl2830: carry pointer to I2C client for every function
As a I2C driver struct i2c_client is top level structure representing
the driver. Use it as parameter to carry all needed information for
each function in order to simplify things.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:51:08 -02:00
Antti Palosaari f544f100ac [media] rtl2830: rename 'priv' to 'dev'
Use name 'dev' for device state instance as it is more common and
also one letter shorter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:50:02 -02:00
Antti Palosaari aba4e34a78 [media] rtl2830: get rid of legacy DVB driver binding
Remove legacy DVB binding as all users are using I2C binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:48:44 -02:00
Antti Palosaari 28c0879939 [media] rtl2830: convert driver to kernel I2C model
Convert driver to kernel I2C model. Old DVB proprietary model is
still left there also.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:47:32 -02:00
Antti Palosaari eed5b0cfb4 [media] rtl2830: add parent for I2C adapter
i2c i2c-6: adapter [RTL2830 tuner I2C adapter] registered
BUG: unable to handle kernel NULL pointer dereference at 0000000000000220
IP: [<ffffffffa0002900>] i2c_register_adapter+0x130/0x390 [i2c_core]

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-12-09 14:50:51 -02:00
Mauro Carvalho Chehab 37ebaf6891 [media] dvb-frontends: Don't use dynamic static allocation
Dynamic static allocation is evil, as Kernel stack is too low, and
compilation complains about it on some archs:
	drivers/media/dvb-frontends/af9013.c:77:1: warning: 'af9013_wr_regs_i2c' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/af9033.c:188:1: warning: 'af9033_wr_reg_val_tab' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/af9033.c:68:1: warning: 'af9033_wr_regs' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/bcm3510.c:230:1: warning: 'bcm3510_do_hab_cmd' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/cxd2820r_core.c:84:1: warning: 'cxd2820r_rd_regs_i2c.isra.1' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/rtl2830.c:56:1: warning: 'rtl2830_wr' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/rtl2832.c:187:1: warning: 'rtl2832_wr' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/tda10071.c:52:1: warning: 'tda10071_wr_regs' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/tda10071.c:84:1: warning: 'tda10071_rd_regs' uses dynamic stack allocation [enabled by default]
Instead, let's enforce a limit for the buffer. Considering that I2C
transfers are generally limited, and that devices used on USB has a
max data length of 64 bytes for	the control URBs.
So, it seem safe to use 64 bytes as the hard limit for all those devices.
 On most cases, the limit is a way lower than that, but	this limit
is small enough to not affect the Kernel stack, and it is a no brain
limit, as using smaller ones would require to either carefully each
driver or to take a look on each datasheet.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-11-08 09:45:39 -02:00
Mauro Carvalho Chehab a17ff2eed6 [media] rtl2830.c: get rid of warning: no previous prototype
drivers/media/dvb-frontends/rtl2830.c:133:5: warning: no previous prototype for 'rtl2830_wr_reg_mask' [-Wmissing-prototypes]
drivers/media/dvb-frontends/rtl2830.c:153:5: warning: no previous prototype for 'rtl2830_rd_reg_mask' [-Wmissing-prototypes]
drivers/media/dvb-frontends/rtl2830.c:259:5: warning: no previous prototype for 'rtl2830_get_tune_settings' [-Wmissing-prototypes]

Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-10-27 17:56:42 -02:00
Antti Palosaari 3a2fca2684 [media] rtl2830: declare two tables as constant
This optimizes few hundred bytes from data to text segment.
Also remove one unused function that was commented out already.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-23 20:47:22 -03:00
Antti Palosaari 66b3c4deb9 [media] rtl2830: use .get_if_frequency()
Use .get_if_frequency() as all used tuner drivers
(mt2060/qt1010/mxl5005s) supports it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-23 20:18:10 -03:00
Antti Palosaari 86ad0f1dd7 [media] rtl2830: use Kernel dev_foo() logging
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-23 20:12:11 -03:00
Mauro Carvalho Chehab 9a0bf528b4 [media] move the dvb/frontends to drivers/media/dvb-frontends
Raise the DVB frontends one level up, as the intention is to remove
the drivers/media/dvb directory.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13 23:13:41 -03:00
Renamed from drivers/media/dvb/frontends/rtl2830.c (Browse further)