Commit Graph

749 Commits

Author SHA1 Message Date
Mauro Carvalho Chehab e1b2ac4d1e [media] siano: Only feed DVB data when there's a feed
Right now, the driver sends DVB data even before tunning.
It was noticed that this may lead into some mistakes at DVB
decode, as the PIDs from wrong channels may be associated with
another frequency, as they may already be inside the PID buffers.
So, prevent it by not feeding DVB demux with data while there's no
feed or while the device is not tuned.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:52:05 -03:00
Mauro Carvalho Chehab 5c3b87435b [media] siano: Fix bandwidth report
It was expected that the bandwidth would be following the defines
at smscoreapi.h. However, this doesn't work. Instead, this field
brings just the bandwidth in MHz. Convert it to Hertz.
It should be noticed that, on ISDB, using the _EX request, the
field TuneBW seems to show the value that matches the bandwidth
code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:51:47 -03:00
Mauro Carvalho Chehab 9671045f4c [media] siano: fix PER/BER report on DVBv5
The check for lock logic is broken. Due to that, no PER/BER
stats will ever be showed, and the DVBV3 events will be wrong.
Also, the per-layer PER/BER stats for ISDB-T are filled with
the wrong index.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:49:32 -03:00
Mauro Carvalho Chehab f5de95e246 [media] siano: fix signal strength and CNR stats measurements
There are a number of small issues with the stats refactoring:
	- InBandPwr better represents the signal strength;
	- Don't zero signal strength /cnr if no lock;
	- Fix signal strength/cnr scale;
	- Don't need to fill PER/BER if not locked, as the
	  code will disable those stats anyway.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:49:17 -03:00
Mauro Carvalho Chehab a9b9fbdf0a [media] siano: don't request statistics too fast
As each DVBv3 call may generate an stats overhead, prevent doing
it too fast. This is specially useful if a burst of get stats
DVBv3 call is sent.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:49:04 -03:00
Mauro Carvalho Chehab 4cce1f4eb2 [media] siano: add two missing fields to ISDB-T stats debugfs
Those fields help to identify the version of the ISDB stats.
Useful while debuging the driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:48:49 -03:00
Mauro Carvalho Chehab 503efe5cfc [media] siano: split debugfs code into a separate file
To avoid mixing two different things at the same place, move the
debugfs code into a separate file.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:48:41 -03:00
Mauro Carvalho Chehab 3f6b87cff6 [media] siano: allow showing the complete statistics via debugfs
Outputs the result of the statistics responses via debugfs.
That can help to track bugs at the stats filling.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:47:49 -03:00
Mauro Carvalho Chehab c02272f9b9 [media] siano: fix start of statistics
It seems that the first u32 after the header for some stats are used by
something not documented.
The stats struct starts after it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:47:39 -03:00
Mauro Carvalho Chehab d42f1cb253 [media] siano: Convert it to report DVBv5 stats
While this frontend provides a nice set of statistics, the
way it is currently reported to userspace is poor. Worse than
that, instead of using quality indicators that range from 0 to 65535,
as expected by userspace, most indicators range from 0 to 100.
Improve it by using DVBv5 statistics API. The legacy indicators
are still reported using the very same old way, but they're now
using a proper range (0 to 65535 for quality indicadors; 0.1 dB
for SNR).

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:47:31 -03:00
Mauro Carvalho Chehab ff702eb8d9 [media] siano: split debug logic from the status update routine
It is confusing to merge both status updates with debug stuff.
Also, it is a better idea to move those status updates to
debugfs, instead of doing a large amount of printk's like that.
So, break them into a separate block of routines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:47:18 -03:00
Mauro Carvalho Chehab eab0fa0f04 [media] siano: split get_frontend into per-std functions
Instead of handling both DVB-T and ISDB-T at the same get_frontend
function, break it intow one function per-delivery system.
That makes the code clearer as we start to add support for DVBv5
statistics, and for ISDB-T get frontend stuff.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:46:56 -03:00
Mauro Carvalho Chehab 80ccb51a0f [media] siano: simplify message endianness logic
Currently, every time a message is sent or received, the endiannes
need to be fixed on big endian machines. This is currently done
on every call to the send API, and on every msg reception logic.
Instead of doing that, move it to the send/receive functions.
That simplifies the logic and avoids the risk of forgetting to
fix it somewhere.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:46:18 -03:00
Mauro Carvalho Chehab fe802fd92d [media] siano: call MSG_SMS_INIT_DEVICE_REQ
Newer firmwares seem to require an init device message. Apply
such change from Doron Cohen's patch:
	http://patchwork.linuxtv.org/patch/7889/

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:45:36 -03:00
Mauro Carvalho Chehab dfbf021c9e [media] siano: Configure board's mtu and xtal
Backported from Doron Cohen's patch:
	http://patchwork.linuxtv.org/patch/7889/

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:45:25 -03:00
Mauro Carvalho Chehab 347d8f1fa6 [media] siano: add new devices to the Siano Driver
This patch is based on Doron Cohen's patches:
	http://patchwork.linuxtv.org/patch/7881/
	http://patchwork.linuxtv.org/patch/7888/
	http://patchwork.linuxtv.org/patch/7883/
It basically merges the above patches, rebasing them to
the macro definitions used upstream, with are different
 than the ones used by them internally.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:45:06 -03:00
Mauro Carvalho Chehab b4059095ab [media] siano: use the newer stats message for recent firmwares
The old statistics request don't work with newer firmwares.
Add a logic to use the newer stats if firmware major is 8.
Note that I have only 2 devices here, one with firmware 2.1
(Hauppauge model 55009 Rev B1F7) and another one with
firmware 8.1. We may need to adjust the firmware minimal
version for the *_EX message variants, as we start finding
firmware versions between 2.x and 8.x.
This patch was based on Doron Cohen patch:
	http://patchwork.linuxtv.org/patch/7886/

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:44:31 -03:00
Mauro Carvalho Chehab 0c189fa69e [media] siano: add support for LNA on ISDB-T
The very same code also exists for DVB-T. Add it for ISDB-T.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:44:05 -03:00
Mauro Carvalho Chehab a51fea4fdb [media] siano: add support for ISDB-T full-seg
Fix the DVBv5 API handling for ISDB-T and add support
for 13 segments.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:43:54 -03:00
Mauro Carvalho Chehab 76e41a655a [media] siano: use a separate completion for stats
Instead of re-use tune_done also for stats, the better is to use
a different completion.
Also, it was noticed that sometimes, the driver answers with
MSG_SMS_SIGNAL_DETECTED_IND for status request. Fix the code to
also handle those other signal indicators.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:43:31 -03:00
Mauro Carvalho Chehab faab6820b3 [media] siano: add some new messages to the smscoreapi
Based on Doron Cohen's patch:
	http://patchwork.linuxtv.org/patch/7887/

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:43:09 -03:00
Mauro Carvalho Chehab e5d218ee75 [media] siano: cleanups at smscoreapi.c
Some cleanups at smscoreapi. Most are just CodingStyle.
Also, use kzalloc when allocating a new buffer, as it initializes
the allocated space with zero.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:42:19 -03:00
Mauro Carvalho Chehab 9e915e5bc8 [media] siano: always load smsdvb
Without smsdvb, the driver actually does nothing, as it
lacks the userspace API.
While I wrote it independently, in order to make a sms2270 board
I have here to work, this patch is functionally identical to this
patch from Doron Cohen:
	http://patchwork.linuxtv.org/patch/7894/

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:41:59 -03:00
Mauro Carvalho Chehab 1e19c21ec7 [media] siano: fix the debug message
Instead of displaying this:
	[   61.869415] smscore_load_firmware_family2: rc=0, postload=0x          (null)
Display, instead:
	[ 1348.441160] smscore_load_firmware_family2: rc=0

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:41:42 -03:00
Mauro Carvalho Chehab ab7bdb1298 [media] siano: report the choosed firmware in debug
Don't keep in the dark: report the firmware file name after
lookup. That helps to debug what's happening when a firmware is not
found.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:41:06 -03:00
Mauro Carvalho Chehab 018b0c6f8a [media] siano: make load firmware logic to work with newer firmwares
There are new firmwares for sms2xxx devices. Change the firmware
load logic to handle those newer firmwares and devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:40:05 -03:00
Mauro Carvalho Chehab 7333839505 [media] siano: store firmware version
As there are some changes that seem to be firmware-dependent,
we need to store the firmware version, as we don't want to break
support for existing cards that use a legacy (and sometimes
custom) firmware.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:38:16 -03:00
Mauro Carvalho Chehab db30567a63 [media] siano: add additional attributes to cards entries
Those attributes will be used by the newer sms2xxx cards.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:37:39 -03:00
Mauro Carvalho Chehab 3ba92d0b58 [media] siano: Properly initialize board information
Board #0 is an existing one. Instead of initializing the driver
with it, use a different value to detect if board is unknown.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:36:51 -03:00
Mauro Carvalho Chehab ab2b599ebf [media] siano: add the remaining new defines from new driver
Add the remaining new defines/enums from Doron Cohen's patch:
        http://patchwork.linuxtv.org/patch/7882/

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:36:42 -03:00
Mauro Carvalho Chehab 4c3bdb5e2f [media] siano: better debug send/receive messages
Instead of printing a message for some random messages, print
it for all sent/received ones. That helps a lot to debug
what's going on.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:35:49 -03:00
Mauro Carvalho Chehab f251001c80 [media] siano: update message macros
Convert from #define into an enum and add the newer message
macros as found on this patch from Doron Cohen:
	http://patchwork.linuxtv.org/patch/7882/
No messages got supressed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:33:26 -03:00
Mauro Carvalho Chehab c31b9fb260 [media] siano: remove a duplicated structure definition
The same GPIO config struct was declared twice at the
driver, with different names and different macros:
	struct smscore_config_gpio
	struct smscore_config_gpio
Remove the one that uses CamelCase and fix the references to
its attributes/macros.
No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:12:51 -03:00
Mauro Carvalho Chehab 739a8c91a3 [media] siano: Add the new voltage definitions for GPIO
Those new definitions came from this patch, from Doron Cohen:
	http://patchwork.linuxtv.org/patch/7882/

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:10:17 -03:00
Mauro Carvalho Chehab f82757d912 [media] siano: Change GPIO voltage setting names
Siano changed the namespace on more recent API, and re-used some
of the old names. In order to be able to update the API to support
newer chips, the better is to follow this change.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 07:10:06 -03:00
Syam Sidhardhan 2da8eab975 [media] siano: Remove redundant NULL check before kfree
kfree on NULL pointer is a no-op.

Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-18 17:03:41 -03:00
Mauro Carvalho Chehab cc318180c8 [media] tveeprom: Fix lots of bad whitespace
While running checkpatch.pl after the last patch, I noticed
lots of those:
	WARNING: please, no space before tabs
	#151: FILE: drivers/media/common/tveeprom.c:99:
	+^I{ TUNER_ABSENT,        ^I^I"None" },$

(together with other checkpatch.pl errors/warnings)

While I won't be fixing everything, as I have already an
script to fix the above, let's do it, in order to clean it
a little bit.

While here, also drop cmacs-specific format text at the end.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-08 16:19:22 -02:00
Hans Verkuil a393edad2a [media] tveeprom: move from media/i2c to media/common
The tveeprom module is a helper module for Hauppauge-based eeproms.
It's used by many drivers and the i2c part is actually optional, so this
driver is better placed in the media/common directory.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-08 16:12:29 -02:00
Hans Verkuil f1c50f2489 [media] btcx-risc: move from media/i2c to media/common
The btcx-risc module is a helper module for bttv/conexant based TV cards.
It isn't an i2c module at all, instead it should be in common since it is
used by 4 pci drivers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-08 16:11:25 -02:00
Hans Verkuil 6259582077 [media] cx2341x: move from media/i2c to media/common
The cx2341x module is a helper module for conexant-based MPEG encoders.
It isn't an i2c module at all, instead it should be in common since it is
used by 7 pci and usb drivers to handle the MPEG setup.
It also shouldn't be visible in the config menu as it is always
selected automatically by those drivers that need it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-08 16:09:55 -02:00
Cyril Roelandt 21a73397c0 [media] media: saa7146: don't use mutex_lock_interruptible() in device_release()
Use uninterruptible mutex_lock in the release() file op to make sure all
resources are properly freed when a process is being terminated. Returning
-ERESTARTSYS has no effect for a terminating process and this may cause driver
resources not to be released.
This was found using the following semantic patch (http://coccinelle.lip6.fr/):
<spml>
@r@
identifier fops;
identifier release_func;
@@
static const struct v4l2_file_operations fops = {
.release = release_func
};
@depends on r@
identifier r.release_func;
expression E;
@@
static int release_func(...)
{
...
- if (mutex_lock_interruptible(E)) return -ERESTARTSYS;
+ mutex_lock(E);
...
}
</spml>

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 17:34:28 -02:00
Sakari Ailus 8e6057b510 [media] v4l: Convert drivers to use monotonic timestamps
Convert drivers using wall clock time (CLOCK_REALTIME) to timestamp from the
monotonic timer (CLOCK_MONOTONIC).

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-21 10:56:43 -02:00
Mauro Carvalho Chehab 1323024fd3 [media] siano: fix build with allmodconfig
As reported by Stephen:

        After merging the v4l-dvb tree, today's linux-next build (x86_64
        allmodconfig) failed like this:

        ERROR: "sms_ir_exit" [drivers/media/common/siano/smsmdtv.ko] undefined!
        ERROR: "sms_ir_event" [drivers/media/common/siano/smsmdtv.ko] undefined!
        ERROR: "sms_ir_init" [drivers/media/common/siano/smsmdtv.ko] undefined!

The smsir file should be part of the smsmdtv core, if RC is defined.
Fix it.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-11-23 13:48:39 -02:00
Mauro Carvalho Chehab 6d9a06f27a Revert "[media] siano: fix build with allmodconfig"
This reverts commit 6ee28d94c9.

The patch got some alien code there, not sure why. Revert it to apply
it properly.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-11-23 13:46:50 -02:00
Mauro Carvalho Chehab 6ee28d94c9 [media] siano: fix build with allmodconfig
As reported by Stephen:

	After merging the v4l-dvb tree, today's linux-next build (x86_64
	allmodconfig) failed like this:

	ERROR: "sms_ir_exit" [drivers/media/common/siano/smsmdtv.ko] undefined!
	ERROR: "sms_ir_event" [drivers/media/common/siano/smsmdtv.ko] undefined!
	ERROR: "sms_ir_init" [drivers/media/common/siano/smsmdtv.ko] undefined!

The smsir file should be part of the smsmdtv core, if RC is defined.
Fix it.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-11-13 11:15:38 -02:00
Mauro Carvalho Chehab 2c4e11b7c1 [media] siano: fix RC compilation
As reported by Antti and by Stephen:
drivers/built-in.o: In function `sms_ir_event':
/home/david/checkouts/linux/drivers/media/common/siano/smsir.c:48: undefined reference to `ir_raw_event_store'
/home/david/checkouts/linux/drivers/media/common/siano/smsir.c:50: undefined reference to `ir_raw_event_handle'
drivers/built-in.o: In function `sms_ir_init':
/home/david/checkouts/linux/drivers/media/common/siano/smsir.c:56: undefined reference to `smscore_get_board_id'
/home/david/checkouts/linux/drivers/media/common/siano/smsir.c:60: undefined reference to `rc_allocate_device'
/home/david/checkouts/linux/drivers/media/common/siano/smsir.c:72: undefined reference to `sms_get_board'
/home/david/checkouts/linux/drivers/media/common/siano/smsir.c:92: undefined reference to `sms_get_board'
/home/david/checkouts/linux/drivers/media/common/siano/smsir.c:97: undefined reference to `rc_register_device'
/home/david/checkouts/linux/drivers/media/common/siano/smsir.c💯 undefined reference to `rc_free_device'
drivers/built-in.o: In function `sms_ir_exit':
/home/david/checkouts/linux/drivers/media/common/siano/smsir.c:111: undefined reference to `rc_unregister_device'
make: *** [vmlinux] Error 1

Caused by commit fdd1eeb49d "[media] siano: allow compiling it without RC support"
And it happens when CONFIG_SMS_SIANO_RC=y and CONFIG_RC_CORE=m .

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-11-07 11:09:08 +01:00
Mauro Carvalho Chehab c246ffc28e [media] siano: get rid of warning: no previous prototype
drivers/media/common/siano/smscoreapi.c:1095:26: warning: no previous prototype for 'get_entry' [-Wmissing-prototypes]

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-10-27 17:55:06 -02:00
David Härdeman c003ab1bed [media] rc-core: add separate defines for protocol bitmaps and numbers
The RC_TYPE_* defines are currently used both where a single protocol is
expected and where a bitmap of protocols is expected.

Functions like rc_keydown() and functions which add/remove entries to the
keytable want a single protocol. Future userspace APIs would also
benefit from numeric protocols (rather than bitmap ones). Keytables are
smaller if they can use a small(ish) integer rather than a bitmap.

Other functions or struct members (e.g. allowed_protos,
enabled_protocols, etc) accept multiple protocols and need a bitmap.

Using different types reduces the risk of programmer error. Using a
protocol enum whereever possible also makes for a more future-proof
user-space API as we don't need to worry about a sufficient number of
bits being available (e.g. in structs used for ioctl() calls).

The use of both a number and a corresponding bit is dalso one in e.g.
the input subsystem as well (see all the references to set/clear bit when
changing keytables for example).

This patch separate the different usages in preparation for
upcoming patches.

Where a single protocol is expected, enum rc_type is used; where one or more
protocol(s) are expected, something like u64 is used.

The patch has been rewritten so that the format of the sysfs "protocols"
file is no longer altered (at the loss of some detail). The file itself
should probably be deprecated in the future though.

Signed-off-by: David Härdeman <david@hardeman.nu>
Cc: Andy Walls <awalls@md.metrocast.net>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Antti Palosaari <crope@iki.fi>
Cc: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-10-27 11:49:51 -02:00
Mauro Carvalho Chehab ff30d37083 [media] common/*/Kconfig: Remove unused helps
Those items don't have any menu anymore; they're auto-selected by
USB/PCI/MMC drivers. So, there's no sense on keeping any help
there anymore.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-10-17 16:59:13 -03:00
Mauro Carvalho Chehab fdd1eeb49d [media] siano: allow compiling it without RC support
Remote controller support should be optional on all drivers.

Make it optional at Siano's driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-10-17 16:59:01 -03:00
Hans Verkuil e6eb28c220 [media] v4l2: make vidioc_s_fbuf const
Write-only ioctls should have a const argument in the ioctl op.
Do this conversion for vidioc_s_fbuf.
Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-26 10:42:36 -03:00
Mauro Carvalho Chehab 8511f8eaa8 [media] flexcop: Show the item to enable debug after the driver
Instead of showing the option to show debug at the end, show
it after each driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-21 08:05:33 -03:00
Mauro Carvalho Chehab fccea74ff8 [media] Kconfig: merge all customise options into just one
Instead of having 3 options to allow customizing the media
sub-drivers (tuners, I2C drivers, frontends), merge all of
them into just one.

That simplifies the life for users, as they can just keep
this untouched.

Life for developers is also simpler, as there's now just
one Kconfig item to remember, for the ancillary sub-drivers
providing supports for chips that could change from one
board design to another.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-21 08:05:06 -03:00
Mauro Carvalho Chehab 9b78c5a300 [media] b2c2: export b2c2_flexcop_debug symbol
ERROR: "b2c2_flexcop_debug" [drivers/media/pci/b2c2/b2c2-flexcop-pci.ko] undefined!

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-17 11:09:19 -03:00
Mauro Carvalho Chehab 88f8472c9f [media] Fix some Makefile rules
On a few places, := were using instead of +=, causing drivers to
not compile.

While here, standardize the usage of += on all cases where multiple
lines are needed, and for obj-y/obj-m targets, and := when just one
line is needed, on <module>-obj rules.

Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Identified-by: Antti Polosaari <crope@iki.fi>
Tested-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-16 19:55:03 -03:00
Mauro Carvalho Chehab 0013ca8c52 [media] siano: break it into common, mmc and usb
siano is, in fact, 2 drivers: one for MMC and one for USB, plus
a common bus-independent code. Break it accordingly.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13 23:52:52 -03:00
Mauro Carvalho Chehab ed0c8b5465 [media] saa7146: Move it to its own directory
In order to better organize the directory tree, move the
saa7146 common driver to its own directory.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13 23:52:49 -03:00
Mauro Carvalho Chehab ccae7af2bf [media] common: move media/common/tuners to media/tuners
Move the tuners one level up, as the "common" directory will be used
by drivers that are shared between more than one driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13 23:40:28 -03:00
Mauro Carvalho Chehab 3785bc170f [media] b2c2: break it into common/pci/usb directories
b2c2 is, in fact, 2 drivers: one for PCI and one for USB, plus
a common bus-independent code. Break it accordingly.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13 23:38:31 -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
Mauro Carvalho Chehab 3d6c2bc08a [media] dvb: move the dvb core one level up
just like the V4L2 core, move the DVB core to drivers/media, as the
intention is to get rid of both "video" and "dvb" directories.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13 23:08:14 -03:00
Andy Shevchenko c6480cccdb [media] common: tunners: use %*ph to dump small buffers
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13 16:37:30 -03:00
Dan Carpenter ffd491fd6f [media] qt1010: signedness bug in qt1010_init_meas1()
qt1010_init_meas2() returns zero on success and negative error codes on
failure so the return type should be int instead of u8.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-12 13:21:06 -03:00
Antti Palosaari e0e52d4e9f [media] tda18218: silence compiler warning
Trivial fix.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-12 13:01:45 -03:00
Antti Palosaari d46ddbe4bf [media] tda18212: use Kernel dev_* logging
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-12 13:01:33 -03:00
Antti Palosaari e666a44fa3 [media] tda18212: silence compiler warning
Trivial fix.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-12 12:38:52 -03:00
Hans Petter Selasky 1e9c14f7d2 [media] tuner-xc2028: add missing else case
>From 59306435992d9349f10ad82a8adf14d98becbbe8 Mon Sep 17 00:00:00 2001

Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-12 05:43:44 -03:00
Devin Heitmueller 3de5bffddb [media] xc5000: change filename to production/redistributable xc5000c firmware
The original xc5000c driver support was based on a beta version of the
firmware, and there were no redistribution rights.  Change over to using
the release version, for which freely redistributable firmware can be
found here:

http://kernellabs.com/firmware/xc5000/README.xc5000c
http://kernellabs.com/firmware/xc5000/dvb-fe-xc5000c-4.1.30.7.fw

Thanks to Ramon Cazares from Cresta Technology for making the firmware
available as well as working out the licensing issues.

[mchehab@redhat.com: Fix a merge conflict with the patch that added support
 for MODULE_FIRMWARE() macro]
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 21:01:44 -03:00
Devin Heitmueller ca60a45dd4 [media] xc5000: show debug version fields in decimal instead of hex
The driver prints out a dotted version number but it's in hex.  As a
result, the version doesn't visibly match the filename for the firmware,
and it caused a bunch of confusion while discussing different versions
with the chip manufacturer.

Change the firmware printout to be in decimal.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 20:58:05 -03:00
Devin Heitmueller 22d5c6f585 [media] xc5000: add support for firmware load check and init status
The xc5000c and newer versions of the xc5000a firmware need minor revisions
to their initialization process.  Add support for validating the firmware
was properly loaded, as well as checking the init status after initialization.

Based on advice from CrestaTech support as well as xc5000 datasheet v2.3.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 20:56:45 -03:00
Devin Heitmueller de49bc6ee9 [media] xc5000: reset device if encountering PLL lock failure
It's possible for the xc5000 to enter an unknown state such that all
subsequent tuning requests fail.  The only way to recover is to reset the
tuner and reload the firmware.  This problem was detected after several days
straight of issuing tuning requests every five seconds.

Reset the firmware in the event that the PLL is in an unlocked state.  This
solution was provided by the engineer at CrestaTech (the company that acquired
Xceive).

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 20:55:55 -03:00
Devin Heitmueller fc7a74bad1 [media] xc5000: don't invoke auto calibration unless we really did reset tuner
The current code invokes the auto calibration of the tuner whenever the
init routine is called (whenever the DVB frontend opens the device).
However we should really only be invoking the calibration if we actually
did reset the device and reload the firmware.

Rework the routine to only do calibration if reset and firmware load was
performed.  Also because the called function is now a no-op if the
firmware is already loaded, the caller no longer needs to invoke
is_firmware_loaded().

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 20:36:43 -03:00
Devin Heitmueller 0a3dabb15e [media] xc5000: properly report i2c write failures
The logic as written would *never* actually return an error condition,
since the loop would run until the counter hit zero but the check was
for a value less than zero.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 20:33:13 -03:00
Devin Heitmueller 7c287f1849 [media] xc5000: add support for showing the SNR and gain in the debug output
When debugging is enabled, also show the analog SNR and the total gain
status values.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 20:32:47 -03:00
Devin Heitmueller 1aa9c487ff [media] xc5000: properly show quality register values
The quality register only has relevant data in bits 2-0, so discard the
other bits (which results in a value being printed that is consistent
with the expected 0-7 range).

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 20:32:24 -03:00
Hans Verkuil 6de7d14d7a [media] saa7146: remove V4L2_FL_LOCK_ALL_FOPS
Add proper locking to the file operations, allowing for the removal
of the V4L2_FL_LOCK_ALL_FOPS flag.

I also removed some dead code in the form of the saa7146_devices list and
saa7146_devices_lock mutex: these were used once but that was a long time
ago.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-09 19:43:28 -03:00
Tim Gardner 3422f2a6bc [media] xc5000: Add MODULE_FIRMWARE statements
This will make modinfo more useful with regard
to discovering necessary firmware files.

Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Michael Krufky <mkrufky@kernellabs.com>
Cc: Eddi De Pieri <eddi@depieri.net>
Cc: linux-media@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-30 23:31:42 -03:00
Dan Carpenter f088ccd640 [media] tuner-xc2028: unlock on error in xc2028_get_afc()
We need to do a mutex_unlock(&priv->lock) before returning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-30 20:37:19 -03:00
Dan Carpenter 3a495ed77a [media] tuner-xc2028: fix "=" vs "==" typo
We intended to do a compare here, not an assignment.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-30 20:33:08 -03:00
Mauro Carvalho Chehab ab9cbcd36c [media] tuner-xc2028: tag the usual firmwares to help dracut
When tuner-xc2028 is not compiled as a module, dracut will
need to copy the firmware inside the initfs image.

So, use MODULE_FIRMWARE() to indicate such need.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-06 14:15:41 -03:00
Mauro Carvalho Chehab 8cfd9dccf2 [media] media: Remove VIDEO_MEDIA Kconfig option
In the past, it was possible to have either DVB or V4L2 core
as module and the other as builtin. Such config never make much
sense, and created several issues in order to make the Kconfig
dependency to work, as all drivers that depend on both (most
TV drivers) would need to be compiled as 'm'. Due to that,
the VIDEO_MEDIA config option were added.

Instead of such weird approach, let's just use the MEDIA_SUPPORT
=y or =m to select if the media subsystem core will be either
builtin or module, simplifying the building system logic.

Also, fix the tuners configuration, by enabling them only if
a tuner is required. So, if just webcam/grabbers support is
selected, no tuner option will be selected. Also, if only digital
TV is selected, no analog tuner support is selected.

That removes the need of using EXPERT customise options, when
analog TV is not selected.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-05 18:21:53 -03:00
Mauro Carvalho Chehab b4c184e506 [media] media: reorganize the main Kconfig items
Change the main items to:

<m> Multimedia support  --->
   [ ]   Cameras/video grabbers support
   [ ]   Analog TV support
   [ ]   Digital TV support
   [ ]   AM/FM radio receivers/transmitters support
   [ ]   Remote Controller support

This provides an interface that is clearer to end users that
are compiling the Kernel, and will allow the building system
to automatically unselect drivers for unused functions.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-05 18:21:28 -03:00
Mauro Carvalho Chehab 5cf73ce15f [media] xc5000: Add support for DMB-TH and ISDB-T
xc5000 is just a tuner, not a decoder, so both DMB-TH and ISDB-T should
work properly there: it is just a matter of teaching the driver what
saw filter should be used and how to calculate the center frequency.

Requested-by: Choi Wing Chan <chanchoiwing@gmail.com>
Cc: Steven Toth <stoth@linuxtv.org>
Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-05 14:22:13 -03:00
Mauro Carvalho Chehab 1d432a3d77 [media] tuner, xc2028: add support for get_afc()
Implement API support to return AFC frequency shift, as this device
supports it. The only other driver that implements it is tda9887,
and the frequency there is reported in Hz. So, use Hz also for this
tuner.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-04 02:46:58 -03:00
Mauro Carvalho Chehab 90acb85fb4 [media] tuner-xc2028: Fix signal strength report
There are several bugs at the signal strength algorithm:

	- It is using logical OR, instead of bit OR;
	- It doesn't wait up to 18 ms as it should;
	- the strength range is not ok.

Rework on it, in order to make it work.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-04 02:01:07 -03:00
Mauro Carvalho Chehab 61a96113de [media] tuner-xc2028: use request_firmware_nowait()
Change the firmware logic to use request_firmware_nowait(), and
to preserve the loaded firmwares in memory, to reduce the risk
of troubles with buggy userspace apps.

With this change, while the firmware is being loaded, the driver
will return -EAGAIN to any calls. If, for some reason, firmware
failed to be loaded from userspace, it will return -ENODEV.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-06-30 14:26:06 -03:00
Peter Senna Tschudin cb4f6818f8 [media] saa7146: Variable set but not used
In function fops_open variable type was set but not used. Tested by compilation only.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Michael Hunold <michael@mihu.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-06-18 20:18:00 -03:00
Hans-Frieder Vogt b144c98ca0 [media] fc0013 ver. 0.2: introduction of get_rf_strength function
Changes compared to version 0.1 of driver (sent 6 May):
- Initial implementation of get_rf_strength function.
- Introduction of a warning message

Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20 10:22:17 -03:00
Hans-Frieder Vogt 4a14db7e61 [media] fc0012 ver. 0.6: introduction of get_rf_strength function
Changes compared to version 0.5 of driver (sent 6 May):
- Initial implementation of get_rf_strength function.

Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20 10:22:08 -03:00
Hans-Frieder Vogt e889adc911 [media] fc001x: tuner driver for FC0013
Support for tuner Fitipower FC0013

Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20 10:21:47 -03:00
Hans-Frieder Vogt ef89ec7ecd [media] fc001x: tuner driver for FC0012, version 0.5
Support for tuner Fitipower FC0012

Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20 10:19:46 -03:00
Hans-Frieder Vogt fee5fcf6b3 [media] fc001x: common header file for FC0012 and FC0013
Common defines for the FC0012 (v0.5) and FC0013 tuner drivers

Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20 10:19:02 -03:00
Hans Verkuil a299e407b9 [media] av7110: fix v4l2_compliance test issues
Besides the usual inconsistencies in input enumeration there was also a
kernel crash if you tried to poll on a vbi node. The checks for sliced
vbi output vs vbi capture were not complete enough.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 15:04:11 -03:00
Hans Verkuil ab49ae0f20 [media] saa7146: fix querycap, vbi/video separation and g/s_register
The querycap ioctl returned an incorrect version number and incorrect
capabilities (mixing up vbi and video caps).

The reason for that was that video nodes could do vbi activities: that
should be separated between the vbi and video nodes.

There were also a few minor problems with dbg_g/s_register that have
been resolved. The mxb/saa7146 driver now passes the v4l2_compliance tests.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 15:00:49 -03:00
Hans Verkuil 537fa492e0 [media] saa7146: support control events and priority handling
Use v4l2_fh which gives you control events and priority handling for free.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 15:00:03 -03:00
Hans Verkuil 9bb601935b [media] saa7146: rename vbi/video_q to vbi/video_dmaq
There was also a vbi_q and video_q in saa7146_fh, so that was confusing.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 14:59:23 -03:00
Hans Verkuil 6694a5608f [media] saa7146: remove the unneeded type field from saa7146_fh
This information can also be retrieved from struct video_device.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 14:58:57 -03:00
Hans Verkuil fca3469aa8 [media] saa7146: move vbi fields from saa7146_fh to saa7146_vv
This fields are global and don't belong in a fh struct.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 14:58:39 -03:00
Hans Verkuil fd74d6eb4c [media] saa7146: move video_fmt from saa7146_fh to saa7146_vv
This is a global structure and does not belong to saa7146_fh.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 14:58:16 -03:00
Hans Verkuil 5da545ad08 [media] saa7146: move overlay information from saa7146_fh into saa7146_vv
This is global information, not per-filehandle information.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 14:57:51 -03:00