summaryrefslogtreecommitdiff
path: root/drivers/media/common
AgeCommit message (Collapse)AuthorFilesLines
2013-03-21[media] siano: add support for .poll on debugfsMauro Carvalho Chehab1-18/+59
Implement poll() method for debugfs and be sure that the debug_data won't be freed on ir or on read(). With this change, poll() will return POLLIN if either data was filled or if data was read. That allows read() to return 0 to indicate EOF in the latter case. As poll() is now provided, fix support for non-block mode. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: fix status report with old firmware and ISDB-TMauro Carvalho Chehab1-1/+13
This seems to be ever broken. That's the status report with Firmware 2.1, before adding support for sms2270 is: [22273.787218] smsdvb_onresponse: MSG_SMS_GET_STATISTICS_RES [22273.792592] IsRfLocked = 1 [22273.792592] IsDemodLocked = 1 ... [22273.792598] TransmissionMode = -64 ... (all unshown fields are filled with zeros) Of course, transmission mode being a negative number is wrong. So, we need to take a deeper look on it. With the debugfs patches applied, it is possible to see that, instead of filling StatisticsType with 5, and FullSize with the size of the payload (this is what happens with sms2270 and firmware 8.1), those fields are also initialized with zero: StatisticsType = 0 FullSize = 0 IsRfLocked = 1 IsDemodLocked = 1 IsExternalLNAOn = 0 SNR = 0 dB RSSI = 0 dBm InBandPwr = 0 dBm CarrierOffset = 0 Bandwidth = 0 Frequency = 0 Hz TransmissionMode = -64 ModemState = 0 GuardInterval = 0 SystemType = 0 PartialReception = 0 NumOfLayers = 0 SmsToHostTxErrors = 0 The data under "TransmissionMode" varies according with the signal, and it is negative. It also matches the value for InBandPwr when the tuner is on DVB-T (ok, signal doesn't lock, but the power level should be about the same with the antena fixed, and measured at about the same time). So, there's a very high chance that, when StatisticsType is zero, the signal strength is at the same position as Transmission Mode. So, discard all other parameters, and provide only signal/rf lock and signal strength if StatisticsType is 0, for ISDB-T. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: Only feed DVB data when there's a feedMauro Carvalho Chehab2-3/+18
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[media] siano: Fix bandwidth reportMauro Carvalho Chehab1-15/+4
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[media] siano: fix PER/BER report on DVBv5Mauro Carvalho Chehab1-17/+29
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[media] siano: fix signal strength and CNR stats measurementsMauro Carvalho Chehab1-22/+35
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[media] siano: don't request statistics too fastMauro Carvalho Chehab2-0/+7
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[media] siano: add two missing fields to ISDB-T stats debugfsMauro Carvalho Chehab1-0/+10
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[media] siano: split debugfs code into a separate fileMauro Carvalho Chehab6-433/+664
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[media] siano: allow showing the complete statistics via debugfsMauro Carvalho Chehab1-109/+355
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[media] siano: fix start of statisticsMauro Carvalho Chehab1-2/+4
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[media] siano: Convert it to report DVBv5 statsMauro Carvalho Chehab1-358/+468
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[media] siano: split debug logic from the status update routineMauro Carvalho Chehab1-115/+135
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[media] siano: split get_frontend into per-std functionsMauro Carvalho Chehab1-105/+124
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[media] siano: simplify message endianness logicMauro Carvalho Chehab2-22/+0
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[media] siano: call MSG_SMS_INIT_DEVICE_REQMauro Carvalho Chehab1-1/+42
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[media] siano: Configure board's mtu and xtalMauro Carvalho Chehab1-0/+56
Backported from Doron Cohen's patch: http://patchwork.linuxtv.org/patch/7889/ Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: add new devices to the Siano DriverMauro Carvalho Chehab2-3/+70
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[media] siano: use the newer stats message for recent firmwaresMauro Carvalho Chehab2-20/+260
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[media] siano: add support for LNA on ISDB-TMauro Carvalho Chehab1-1/+18
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[media] siano: add support for ISDB-T full-segMauro Carvalho Chehab1-29/+17
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[media] siano: use a separate completion for statsMauro Carvalho Chehab1-2/+4
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[media] siano: add some new messages to the smscoreapiMauro Carvalho Chehab1-0/+16
Based on Doron Cohen's patch: http://patchwork.linuxtv.org/patch/7887/ Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: cleanups at smscoreapi.cMauro Carvalho Chehab2-10/+16
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[media] siano: always load smsdvbMauro Carvalho Chehab1-13/+1
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[media] siano: fix the debug messageMauro Carvalho Chehab1-5/+8
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[media] siano: report the choosed firmware in debugMauro Carvalho Chehab1-0/+1
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[media] siano: make load firmware logic to work with newer firmwaresMauro Carvalho Chehab2-136/+220
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[media] siano: store firmware versionMauro Carvalho Chehab2-0/+3
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[media] siano: add additional attributes to cards entriesMauro Carvalho Chehab1-0/+6
Those attributes will be used by the newer sms2xxx cards. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: Properly initialize board informationMauro Carvalho Chehab1-0/+1
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[media] siano: add the remaining new defines from new driverMauro Carvalho Chehab1-6/+33
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[media] siano: better debug send/receive messagesMauro Carvalho Chehab3-18/+345
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[media] siano: update message macrosMauro Carvalho Chehab1-53/+321
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[media] siano: remove a duplicated structure definitionMauro Carvalho Chehab3-63/+30
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[media] siano: Add the new voltage definitions for GPIOMauro Carvalho Chehab1-0/+12
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[media] siano: Change GPIO voltage setting namesMauro Carvalho Chehab3-9/+9
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-19[media] siano: Remove redundant NULL check before kfreeSyam Sidhardhan1-2/+1
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-02-08[media] tveeprom: Fix lots of bad whitespaceMauro Carvalho Chehab1-148/+142
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[media] tveeprom: move from media/i2c to media/commonHans Verkuil3-0/+797
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[media] btcx-risc: move from media/i2c to media/commonHans Verkuil4-0/+299
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[media] cx2341x: move from media/i2c to media/commonHans Verkuil3-0/+1730
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>
2012-12-27[media] media: saa7146: don't use mutex_lock_interruptible() in device_release()Cyril Roelandt1-2/+1
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-21[media] v4l: Convert drivers to use monotonic timestampsSakari Ailus1-1/+1
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-11-23[media] siano: fix build with allmodconfigMauro Carvalho Chehab1-1/+1
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-23Revert "[media] siano: fix build with allmodconfig"Mauro Carvalho Chehab1-1/+1
This reverts commit 6ee28d94c9bfa0640a7c94c289ca0df239d90a0d. 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-13[media] siano: fix build with allmodconfigMauro Carvalho Chehab1-1/+1
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-07[media] siano: fix RC compilationMauro Carvalho Chehab2-1/+5
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:100: 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 fdd1eeb49d36 "[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-10-27[media] siano: get rid of warning: no previous prototypeMauro Carvalho Chehab1-1/+1
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[media] rc-core: add separate defines for protocol bitmaps and numbersDavid Härdeman1-1/+1
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>