summaryrefslogtreecommitdiff
path: root/drivers/media/common
AgeCommit message (Collapse)Author
2013-04-14[media] media: Fix randconfig errorRandy Dunlap
Fix randconfig error when USB is not enabled: ERROR: "usb_control_msg" [drivers/media/common/cypress_firmware.ko] undefined! Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-08[media] cx88: kernel bz#9476: Fix tone setting for Nova-S+ model 92001Mauro Carvalho Chehab
Hauppauge Nova-S-Plus DVB-S model 92001 does not lock on horizontal polarisation. According with the info provided at the BZ, model 92002 does. The difference is that, on model 92001, the tone select is done via isl6421, while, on other devices, this is done via cx24123 code. This patch adds a way to override the demod's set_tone at isl6421 driver. In order to avoid regressions, the override is enabled only for cx88 Nova S plus model 92001. For all other models and devices, the set_tone is provided by the demod driver. Patch originally proposed at bz@9476[1] by Michel Meyers and John Donoghue but applying the original patch would break support for all other devices based on isl6421. [1] https://bugzilla.kernel.org/show_bug.cgi?id=9476 Tested-by: Adam Sampson <ats@offog.org> Tested-by: Hans-Peter Jansen <hpj@urpla.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-04[media] siano: Fix array boundary at smscore_translate_msg()Mauro Carvalho Chehab
As reported by Dan Carpenter: FYI, there are new smatch warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next master head: da17d7bda957ae4697b6abc0793f74fb9b50b58f commit: 4c3bdb5e2f5612ceb99ac17dbbe673b59a94d105 [media] siano: better debug send/receive messages drivers/media/common/siano/smscoreapi.c:396 smscore_translate_msg() error: buffer overflow 'siano_msgs' 401 <= 401 While it is almost impossible for this error to happen in practice, as it would require the siano's firmware to return an special invalid answer to a message request, fixing it is trivial. So, let's do it. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-29[media] media: move dvb-usb-v2/cypress_firmware.c to media/commonHans Verkuil
Loading the cypress firmware is not dvb specific and should be common functionality. Move the source to media/common and make it a standalone module. As a result we can remove the dependency on dvb-usb in go7007, which has nothing to do with dvb. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-24[media] v4l2: pass std by value to the write-only s_std ioctlHans Verkuil
This ioctl is defined as IOW, so pass the argument by value instead of by reference. I could have chosen to add const instead, but this is 1) easier to handle in drivers and 2) consistent with the s_std subdev operation. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Jonathan Corbet <corbet@lwn.net> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-22[media] siano: remove the ir protocol fieldMauro Carvalho Chehab
This field is unused. Remove it. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-22[media] siano: use do_div() for 64-bits divisionMauro Carvalho Chehab
As reported by Frank Schäfer <fschaefer.oss@googlemail.com>: ERROR: "__divdi3" [drivers/media/common/siano/smsdvb.ko] undefined! Reported-by: Frank Schäfer <fschaefer.oss@googlemail.com> Tested-by: Gianluca Gennari <gennarone@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: make some functions staticMauro Carvalho Chehab
drivers/media/common/siano/smsdvb-debugfs.c:51:6: warning: no previous prototype for 'smsdvb_print_dvb_stats' [-Wmissing-prototypes] drivers/media/common/siano/smsdvb-debugfs.c:154:6: warning: no previous prototype for 'smsdvb_print_isdb_stats' [-Wmissing-prototypes] drivers/media/common/siano/smsdvb-debugfs.c:244:6: warning: no previous prototype for 'smsdvb_print_isdb_stats_ex' [-Wmissing-prototypes] drivers/media/common/siano/smscoreapi.c:832:5: warning: no previous prototype for 'smscore_configure_board' [-Wmissing-prototypes] drivers/media/common/siano/smscoreapi.c:1301:5: warning: no previous prototype for 'smscore_init_device' [-Wmissing-prototypes] Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: Fix the remaining checkpatch.pl compliantsMauro Carvalho Chehab
Fix all other remaining checkpatch.pl compliants on the Siano driver, except for the 80-cols (soft) limit. Those are harder to fix, and probably not worth to do right now. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: remove the remaining CamelCase compliantsMauro Carvalho Chehab
Remove the remaining CamelCase checkpatch.pl compliants. There are still a few left, but those are due to USB and DVB APIs. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: fix checkpatch.pl compliants on smscoreapi.hMauro Carvalho Chehab
Fix the remaining checkpatch.pl compliants at smscoreapi.h, except by the "line over 80 characters" on comments. Fixing those would require more time, as the better is to convert them into the struct descriptions used inside the kernel, as described at: Documentation/kernel-doc-nano-HOWTO.txt Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: convert structure names to lowercaseMauro Carvalho Chehab
There are several structures defined in uppercase. Convert them to lowercase, and simplify their names, when possible. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: get rid of CammelCase from smscoreapi.hMauro Carvalho Chehab
It is almost impossible to see a compliant with checkpatch.pl on those Siano drivers, as there are simply too much violations on it. So, now that a big change was done, the better is to cleanup the checkpatch compliants. Let's first replace all CammelCase symbols found at smscoreapi.h using camel_case namespace. That removed 144 checkpatch.pl compliants on this file. Of course, the other files need to be fixed accordingly. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: add MODULE_FIRMWARE() macrosMauro Carvalho Chehab
This driver can use several firmwares. Provide such info at module firmware metadata. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: use defines for firmware namesMauro Carvalho Chehab
There are too many firmwares there. As we need to add MODULE_FIMWARE() macros, the better is to define their names on just one place and use the macros for both cards/device type tables and MODULE_FIRMWARE(). Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: Remove bogus complain about MSG_SMS_DVBT_BDA_DATAMauro Carvalho Chehab
When the driver is tuned into chanel, and it is removed/reinserted, the message stream data may be arriving during device probe: [ 5680.162004] smscore_set_device_mode: set device mode to 6 [ 5680.162267] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.162391] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.162641] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.162891] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.163016] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.163266] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.163516] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.163640] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.163891] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.164016] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.164265] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.164515] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.164519] smscore_onresponse: Firmware id 6 prots 0x40 ver 8.1 [ 5680.164766] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.166018] smscore_onresponse: message MSG_SMS_DVBT_BDA_DATA(693) not handled. [ 5680.166438] DVB: registering new adapter (Siano Rio Digital Receiver) Instead of complaining, just silently discard those messages, instead of complaining. A proper fix is to put the device on suspend/power down mode when the module is removed. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: remove doubled new lineMauro Carvalho Chehab
sms_debug() and sms_info() already adds a '\n' at the printed strings. No need to add more. That helps to cleanup stuff like: [ 4868.205648] smscore_onresponse: message not handled. [ 4868.205898] smscore_onresponse: message not handled. and: [ 5467.959769] smscore_onresponse: data rate 143069 bytes/secs While here, provides the message name, when the message is not handled by the smsmdtv core. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: reorder smscore_get_fw_filename() functionMauro Carvalho Chehab
Put this function earlier in the code, to avoid the need of defining a function stub. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: remove the bogus firmware lookup codeMauro Carvalho Chehab
There is an special lookup code that is called when SMS_BOARD_UNKNOWN. The logic there is bogus and will cause an oops, as .type is SMS_UNKNOWN_TYPE (-1). As the code would do: return smscore_fw_lkup[type][mode]; That would mean that it would try to go past the smscore_fw_lkup table. So, just remove that bogus code, simplifying the logic. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: honour per-card default modeMauro Carvalho Chehab
Instead of using a global default_mode, passed via modprobe parameter, use the one defined inside the cards struct. That will prevent the need of manually specify it for each board, except, of course, if the user wants to do something different, on boards that accept multiple types. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: simplify firmware lookup logicMauro Carvalho Chehab
There are two ways to specify firmware for siano devices: a per-device ID and a per-device type. The per-device type logic is currently made by a 11x9 string table, sparsely filled. It is very hard to read the table at the source code, as there are too much "none" filling there ("none" there is a way to tell NULL). Instead of using such problematic table, convert it into an easy to read table, where the unused values will be defaulted to NULL. While here, also simplifies a little bit the logic and print a message if an user-selected mode doesn't exist. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21[media] siano: add support for .poll on debugfsMauro Carvalho Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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>