kernel-fxtec-pro1x/include/media/tuner-types.h
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00

190 lines
7 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* descriptions for simple tuners.
*/
#ifndef __TUNER_TYPES_H__
#define __TUNER_TYPES_H__
/**
* enum param_type - type of the tuner pameters
*
* @TUNER_PARAM_TYPE_RADIO: Tuner params are for FM and/or AM radio
* @TUNER_PARAM_TYPE_PAL: Tuner params are for PAL color TV standard
* @TUNER_PARAM_TYPE_SECAM: Tuner params are for SECAM color TV standard
* @TUNER_PARAM_TYPE_NTSC: Tuner params are for NTSC color TV standard
* @TUNER_PARAM_TYPE_DIGITAL: Tuner params are for digital TV
*/
enum param_type {
TUNER_PARAM_TYPE_RADIO,
TUNER_PARAM_TYPE_PAL,
TUNER_PARAM_TYPE_SECAM,
TUNER_PARAM_TYPE_NTSC,
TUNER_PARAM_TYPE_DIGITAL,
};
/**
* struct tuner_range - define the frequencies supported by the tuner
*
* @limit: Max frequency supported by that range, in 62.5 kHz
* (TV) or 62.5 Hz (Radio), as defined by
* V4L2_TUNER_CAP_LOW.
* @config: Value of the band switch byte (BB) to setup this mode.
* @cb: Value of the CB byte to setup this mode.
*
* Please notice that digital tuners like xc3028/xc4000/xc5000 don't use
* those ranges, as they're defined inside the driver. This is used by
* analog tuners that are compatible with the "Philips way" to setup the
* tuners. On those devices, the tuner set is done via 4 bytes:
*
* #) divider byte1 (DB1)
* #) divider byte 2 (DB2)
* #) Control byte (CB)
* #) band switch byte (BB)
*
* Some tuners also have an additional optional Auxiliary byte (AB).
*/
struct tuner_range {
unsigned short limit;
unsigned char config;
unsigned char cb;
};
/**
* struct tuner_params - Parameters to be used to setup the tuner. Those
* are used by drivers/media/tuners/tuner-types.c in
* order to specify the tuner properties. Most of
* the parameters are for tuners based on tda9887 IF-PLL
* multi-standard analog TV/Radio demodulator, with is
* very common on legacy analog tuners.
*
* @type: Type of the tuner parameters, as defined at
* enum param_type. If the tuner supports multiple
* standards, an array should be used, with one
* row per different standard.
* @cb_first_if_lower_freq: Many Philips-based tuners have a comment in
* their datasheet like
* "For channel selection involving band
* switching, and to ensure smooth tuning to the
* desired channel without causing unnecessary
* charge pump action, it is recommended to
* consider the difference between wanted channel
* frequency and the current channel frequency.
* Unnecessary charge pump action will result
* in very low tuning voltage which may drive the
* oscillator to extreme conditions".
* Set cb_first_if_lower_freq to 1, if this check
* is required for this tuner. I tested this for
* PAL by first setting the TV frequency to
* 203 MHz and then switching to 96.6 MHz FM
* radio. The result was static unless the
* control byte was sent first.
* @has_tda9887: Set to 1 if this tuner uses a tda9887
* @port1_fm_high_sensitivity: Many Philips tuners use tda9887 PORT1 to select
* the FM radio sensitivity. If this setting is 1,
* then set PORT1 to 1 to get proper FM reception.
* @port2_fm_high_sensitivity: Some Philips tuners use tda9887 PORT2 to select
* the FM radio sensitivity. If this setting is 1,
* then set PORT2 to 1 to get proper FM reception.
* @fm_gain_normal: Some Philips tuners use tda9887 cGainNormal to
* select the FM radio sensitivity. If this
* setting is 1, e register will use cGainNormal
* instead of cGainLow.
* @intercarrier_mode: Most tuners with a tda9887 use QSS mode.
* Some (cheaper) tuners use Intercarrier mode.
* If this setting is 1, then the tuner needs to
* be set to intercarrier mode.
* @port1_active: This setting sets the default value for PORT1.
* 0 means inactive, 1 means active. Note: the
* actual bit value written to the tda9887 is
* inverted. So a 0 here means a 1 in the B6 bit.
* @port2_active: This setting sets the default value for PORT2.
* 0 means inactive, 1 means active. Note: the
* actual bit value written to the tda9887 is
* inverted. So a 0 here means a 1 in the B7 bit.
* @port1_invert_for_secam_lc: Sometimes PORT1 is inverted when the SECAM-L'
* standard is selected. Set this bit to 1 if this
* is needed.
* @port2_invert_for_secam_lc: Sometimes PORT2 is inverted when the SECAM-L'
* standard is selected. Set this bit to 1 if this
* is needed.
* @port1_set_for_fm_mono: Some cards require PORT1 to be 1 for mono Radio
* FM and 0 for stereo.
* @default_pll_gating_18: Select 18% (or according to datasheet 0%)
* L standard PLL gating, vs the driver default
* of 36%.
* @radio_if: IF to use in radio mode. Tuners with a
* separate radio IF filter seem to use 10.7,
* while those without use 33.3 for PAL/SECAM
* tuners and 41.3 for NTSC tuners.
* 0 = 10.7, 1 = 33.3, 2 = 41.3
* @default_top_low: Default tda9887 TOP value in dB for the low
* band. Default is 0. Range: -16:+15
* @default_top_mid: Default tda9887 TOP value in dB for the mid
* band. Default is 0. Range: -16:+15
* @default_top_high: Default tda9887 TOP value in dB for the high
* band. Default is 0. Range: -16:+15
* @default_top_secam_low: Default tda9887 TOP value in dB for SECAM-L/L'
* for the low band. Default is 0. Several tuners
* require a different TOP value for the
* SECAM-L/L' standards. Range: -16:+15
* @default_top_secam_mid: Default tda9887 TOP value in dB for SECAM-L/L'
* for the mid band. Default is 0. Several tuners
* require a different TOP value for the
* SECAM-L/L' standards. Range: -16:+15
* @default_top_secam_high: Default tda9887 TOP value in dB for SECAM-L/L'
* for the high band. Default is 0. Several tuners
* require a different TOP value for the
* SECAM-L/L' standards. Range: -16:+15
* @iffreq: Intermediate frequency (IF) used by the tuner
* on digital mode.
* @count: Size of the ranges array.
* @ranges: Array with the frequency ranges supported by
* the tuner.
*/
struct tuner_params {
enum param_type type;
unsigned int cb_first_if_lower_freq:1;
unsigned int has_tda9887:1;
unsigned int port1_fm_high_sensitivity:1;
unsigned int port2_fm_high_sensitivity:1;
unsigned int fm_gain_normal:1;
unsigned int intercarrier_mode:1;
unsigned int port1_active:1;
unsigned int port2_active:1;
unsigned int port1_invert_for_secam_lc:1;
unsigned int port2_invert_for_secam_lc:1;
unsigned int port1_set_for_fm_mono:1;
unsigned int default_pll_gating_18:1;
unsigned int radio_if:2;
signed int default_top_low:5;
signed int default_top_mid:5;
signed int default_top_high:5;
signed int default_top_secam_low:5;
signed int default_top_secam_mid:5;
signed int default_top_secam_high:5;
u16 iffreq;
unsigned int count;
struct tuner_range *ranges;
};
struct tunertype {
char *name;
unsigned int count;
struct tuner_params *params;
u16 min;
u16 max;
u32 stepsize;
u8 *initdata;
u8 *sleepdata;
};
extern struct tunertype tuners[];
extern unsigned const int tuner_count;
#endif