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-01 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-06-24 13:02:35 +08:00
|
|
|
/* dvb-usb.h is part of the DVB USB library.
|
|
|
|
*
|
2016-01-24 22:56:58 +08:00
|
|
|
* Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@posteo.de)
|
2005-06-24 13:02:35 +08:00
|
|
|
* see dvb-usb-init.c for copyright information.
|
|
|
|
*
|
|
|
|
* the headerfile, all dvb-usb-drivers have to include.
|
2006-09-30 17:53:48 +08:00
|
|
|
*
|
|
|
|
* TODO: clean-up the structures for unused fields and update the comments
|
2005-06-24 13:02:35 +08:00
|
|
|
*/
|
|
|
|
#ifndef __DVB_USB_H__
|
|
|
|
#define __DVB_USB_H__
|
|
|
|
|
|
|
|
#include <linux/input.h>
|
|
|
|
#include <linux/usb.h>
|
2006-01-10 01:25:04 +08:00
|
|
|
#include <linux/firmware.h>
|
2006-02-07 16:49:14 +08:00
|
|
|
#include <linux/mutex.h>
|
2010-11-18 00:28:38 +08:00
|
|
|
#include <media/rc-core.h>
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
#include "dvb_frontend.h"
|
|
|
|
#include "dvb_demux.h"
|
|
|
|
#include "dvb_net.h"
|
|
|
|
#include "dmxdev.h"
|
|
|
|
|
|
|
|
#include "dvb-pll.h"
|
|
|
|
|
|
|
|
#include "dvb-usb-ids.h"
|
|
|
|
|
|
|
|
/* debug */
|
|
|
|
#ifdef CONFIG_DVB_USB_DEBUG
|
|
|
|
#define dprintk(var,level,args...) \
|
|
|
|
do { if ((var & level)) { printk(args); } } while (0)
|
|
|
|
|
|
|
|
#define debug_dump(b,l,func) {\
|
|
|
|
int loop_; \
|
|
|
|
for (loop_ = 0; loop_ < l; loop_++) func("%02x ", b[loop_]); \
|
|
|
|
func("\n");\
|
|
|
|
}
|
|
|
|
#define DVB_USB_DEBUG_STATUS
|
|
|
|
#else
|
|
|
|
#define dprintk(args...)
|
|
|
|
#define debug_dump(b,l,func)
|
|
|
|
|
|
|
|
#define DVB_USB_DEBUG_STATUS " (debugging is not enabled)"
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* generic log methods - taken from usb.h */
|
|
|
|
#ifndef DVB_USB_LOG_PREFIX
|
|
|
|
#define DVB_USB_LOG_PREFIX "dvb-usb (please define a log prefix)"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#undef err
|
|
|
|
#define err(format, arg...) printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
|
|
|
|
#undef info
|
|
|
|
#define info(format, arg...) printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
|
|
|
|
#undef warn
|
|
|
|
#define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct dvb_usb_device_description - name and its according USB IDs
|
|
|
|
* @name: real name of the box, regardless which DVB USB device class is in use
|
|
|
|
* @cold_ids: array of struct usb_device_id which describe the device in
|
|
|
|
* pre-firmware state
|
|
|
|
* @warm_ids: array of struct usb_device_id which describe the device in
|
|
|
|
* post-firmware state
|
|
|
|
*
|
|
|
|
* Each DVB USB device class can have one or more actual devices, this struct
|
|
|
|
* assigns a name to it.
|
|
|
|
*/
|
|
|
|
struct dvb_usb_device_description {
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
#define DVB_USB_ID_MAX_NUM 15
|
|
|
|
struct usb_device_id *cold_ids[DVB_USB_ID_MAX_NUM];
|
|
|
|
struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM];
|
|
|
|
};
|
|
|
|
|
[media] rc: Name RC keymap tables as rc_map_table
Remote keytables had different names all over the place. Part of the fault
is due to a bad naming when rc subsystem was created, but there were lots
of old names that were still here.
Use a common standard for everything.
Patch generated by this script:
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-18 02:46:09 +08:00
|
|
|
static inline u8 rc5_custom(struct rc_map_table *key)
|
2009-08-30 02:19:31 +08:00
|
|
|
{
|
2010-07-31 22:24:57 +08:00
|
|
|
return (key->scancode >> 8) & 0xff;
|
2009-08-30 02:19:31 +08:00
|
|
|
}
|
|
|
|
|
[media] rc: Name RC keymap tables as rc_map_table
Remote keytables had different names all over the place. Part of the fault
is due to a bad naming when rc subsystem was created, but there were lots
of old names that were still here.
Use a common standard for everything.
Patch generated by this script:
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-18 02:46:09 +08:00
|
|
|
static inline u8 rc5_data(struct rc_map_table *key)
|
2009-08-30 02:19:31 +08:00
|
|
|
{
|
2010-07-31 22:24:57 +08:00
|
|
|
return key->scancode & 0xff;
|
2009-08-30 02:19:31 +08:00
|
|
|
}
|
|
|
|
|
2011-05-07 14:49:13 +08:00
|
|
|
static inline u16 rc5_scan(struct rc_map_table *key)
|
2009-08-30 02:19:31 +08:00
|
|
|
{
|
2010-07-31 22:24:57 +08:00
|
|
|
return key->scancode & 0xffff;
|
2009-08-30 02:19:31 +08:00
|
|
|
}
|
|
|
|
|
2005-06-24 13:02:35 +08:00
|
|
|
struct dvb_usb_device;
|
2006-09-30 17:53:48 +08:00
|
|
|
struct dvb_usb_adapter;
|
|
|
|
struct usb_data_stream;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
/**
|
2006-09-19 23:51:33 +08:00
|
|
|
* Properties of USB streaming - TODO this structure should be somewhere else
|
|
|
|
* describes the kind of USB transfer used for data-streaming.
|
2006-09-30 17:53:48 +08:00
|
|
|
* (BULK or ISOC)
|
|
|
|
*/
|
|
|
|
struct usb_data_stream_properties {
|
|
|
|
#define USB_BULK 1
|
|
|
|
#define USB_ISOC 2
|
|
|
|
int type;
|
|
|
|
int count;
|
|
|
|
int endpoint;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
int buffersize; /* per URB */
|
|
|
|
} bulk;
|
|
|
|
struct {
|
|
|
|
int framesperurb;
|
|
|
|
int framesize;
|
|
|
|
int interval;
|
|
|
|
} isoc;
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct dvb_usb_adapter_properties - properties of a dvb-usb-adapter.
|
|
|
|
* A DVB-USB-Adapter is basically a dvb_adapter which is present on a USB-device.
|
2006-03-08 09:20:23 +08:00
|
|
|
* @caps: capabilities of the DVB USB device.
|
2005-06-24 13:02:35 +08:00
|
|
|
* @pid_filter_count: number of PID filter position in the optional hardware
|
|
|
|
* PID-filter.
|
2011-07-26 07:16:13 +08:00
|
|
|
* @num_frontends: number of frontends of the DVB USB adapter.
|
|
|
|
* @frontend_ctrl: called to power on/off active frontend.
|
2007-05-05 09:51:04 +08:00
|
|
|
* @streaming_ctrl: called to start and stop the MPEG2-TS streaming of the
|
2006-09-30 17:53:48 +08:00
|
|
|
* device (not URB submitting/killing).
|
|
|
|
* @pid_filter_ctrl: called to en/disable the PID filter, if any.
|
|
|
|
* @pid_filter: called to set/unset a PID for filtering.
|
|
|
|
* @frontend_attach: called to attach the possible frontends (fill fe-field
|
|
|
|
* of struct dvb_usb_device).
|
|
|
|
* @tuner_attach: called to attach the correct tuner and to fill pll_addr,
|
|
|
|
* pll_desc and pll_init_buf of struct dvb_usb_device).
|
|
|
|
* @stream: configuration of the USB streaming
|
|
|
|
*/
|
2011-09-06 20:31:57 +08:00
|
|
|
struct dvb_usb_adapter_fe_properties {
|
2006-09-30 17:53:48 +08:00
|
|
|
#define DVB_USB_ADAP_HAS_PID_FILTER 0x01
|
|
|
|
#define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02
|
|
|
|
#define DVB_USB_ADAP_NEED_PID_FILTERING 0x04
|
2006-09-19 23:51:43 +08:00
|
|
|
#define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08
|
2011-09-08 15:47:20 +08:00
|
|
|
#define DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD 0x10
|
2006-09-30 17:53:48 +08:00
|
|
|
int caps;
|
|
|
|
int pid_filter_count;
|
|
|
|
|
|
|
|
int (*streaming_ctrl) (struct dvb_usb_adapter *, int);
|
|
|
|
int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int);
|
|
|
|
int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int);
|
|
|
|
|
|
|
|
int (*frontend_attach) (struct dvb_usb_adapter *);
|
|
|
|
int (*tuner_attach) (struct dvb_usb_adapter *);
|
|
|
|
|
|
|
|
struct usb_data_stream_properties stream;
|
|
|
|
|
|
|
|
int size_of_priv;
|
2011-09-06 20:31:57 +08:00
|
|
|
};
|
|
|
|
|
2012-01-30 02:53:12 +08:00
|
|
|
#define MAX_NO_OF_FE_PER_ADAP 3
|
2011-09-06 20:31:57 +08:00
|
|
|
struct dvb_usb_adapter_properties {
|
|
|
|
int size_of_priv;
|
2009-09-08 00:32:29 +08:00
|
|
|
|
2011-09-06 20:31:57 +08:00
|
|
|
int (*frontend_ctrl) (struct dvb_frontend *, int);
|
|
|
|
|
|
|
|
int num_frontends;
|
|
|
|
struct dvb_usb_adapter_fe_properties fe[MAX_NO_OF_FE_PER_ADAP];
|
2006-09-30 17:53:48 +08:00
|
|
|
};
|
|
|
|
|
2010-08-01 05:04:09 +08:00
|
|
|
/**
|
|
|
|
* struct dvb_rc_legacy - old properties of remote controller
|
[media] rc: Name RC keymap tables as rc_map_table
Remote keytables had different names all over the place. Part of the fault
is due to a bad naming when rc subsystem was created, but there were lots
of old names that were still here.
Use a common standard for everything.
Patch generated by this script:
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-18 02:46:09 +08:00
|
|
|
* @rc_map_table: a hard-wired array of struct rc_map_table (NULL to disable
|
2010-08-01 05:04:09 +08:00
|
|
|
* remote control handling).
|
[media] rc: Name RC keymap tables as rc_map_table
Remote keytables had different names all over the place. Part of the fault
is due to a bad naming when rc subsystem was created, but there were lots
of old names that were still here.
Use a common standard for everything.
Patch generated by this script:
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-18 02:46:09 +08:00
|
|
|
* @rc_map_size: number of items in @rc_map_table.
|
2010-08-01 05:04:09 +08:00
|
|
|
* @rc_query: called to query an event event.
|
|
|
|
* @rc_interval: time in ms between two queries.
|
|
|
|
*/
|
|
|
|
struct dvb_rc_legacy {
|
|
|
|
/* remote control properties */
|
|
|
|
#define REMOTE_NO_KEY_PRESSED 0x00
|
|
|
|
#define REMOTE_KEY_PRESSED 0x01
|
|
|
|
#define REMOTE_KEY_REPEAT 0x02
|
[media] rc: Name RC keymap tables as rc_map_table
Remote keytables had different names all over the place. Part of the fault
is due to a bad naming when rc subsystem was created, but there were lots
of old names that were still here.
Use a common standard for everything.
Patch generated by this script:
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-18 02:46:09 +08:00
|
|
|
struct rc_map_table *rc_map_table;
|
|
|
|
int rc_map_size;
|
2010-08-01 05:04:09 +08:00
|
|
|
int (*rc_query) (struct dvb_usb_device *, u32 *, int *);
|
|
|
|
int rc_interval;
|
|
|
|
};
|
|
|
|
|
2010-08-01 06:07:55 +08:00
|
|
|
/**
|
|
|
|
* struct dvb_rc properties of remote controller, using rc-core
|
|
|
|
* @rc_codes: name of rc codes table
|
2010-08-01 20:37:23 +08:00
|
|
|
* @protocol: type of protocol(s) currently used by the driver
|
2010-10-30 03:08:23 +08:00
|
|
|
* @allowed_protos: protocol(s) supported by the driver
|
2010-11-01 03:24:19 +08:00
|
|
|
* @driver_type: Used to point if a device supports raw mode
|
2010-10-30 03:08:23 +08:00
|
|
|
* @change_protocol: callback to change protocol
|
2010-08-01 06:07:55 +08:00
|
|
|
* @rc_query: called to query an event event.
|
|
|
|
* @rc_interval: time in ms between two queries.
|
|
|
|
* @bulk_mode: device supports bulk mode for RC (disable polling mode)
|
|
|
|
*/
|
|
|
|
struct dvb_rc {
|
|
|
|
char *rc_codes;
|
2010-08-01 20:37:23 +08:00
|
|
|
u64 protocol;
|
2010-10-30 03:08:23 +08:00
|
|
|
u64 allowed_protos;
|
2010-11-01 03:24:19 +08:00
|
|
|
enum rc_driver_type driver_type;
|
2017-08-08 04:20:58 +08:00
|
|
|
int (*change_protocol)(struct rc_dev *dev, u64 *rc_proto);
|
2010-08-01 06:07:55 +08:00
|
|
|
char *module_name;
|
|
|
|
int (*rc_query) (struct dvb_usb_device *d);
|
|
|
|
int rc_interval;
|
|
|
|
bool bulk_mode; /* uses bulk mode */
|
2017-09-06 19:19:06 +08:00
|
|
|
u32 scancode_mask;
|
2010-08-01 06:07:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enum dvb_usb_mode - Specifies if it is using a legacy driver or a new one
|
|
|
|
* based on rc-core
|
|
|
|
* This is initialized/used only inside dvb-usb-remote.c.
|
|
|
|
* It shouldn't be set by the drivers.
|
|
|
|
*/
|
|
|
|
enum dvb_usb_mode {
|
|
|
|
DVB_RC_LEGACY,
|
|
|
|
DVB_RC_CORE,
|
|
|
|
};
|
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
/**
|
|
|
|
* struct dvb_usb_device_properties - properties of a dvb-usb-device
|
2005-06-24 13:02:35 +08:00
|
|
|
* @usb_ctrl: which USB device-side controller is in use. Needed for firmware
|
|
|
|
* download.
|
|
|
|
* @firmware: name of the firmware file.
|
2006-01-10 01:25:04 +08:00
|
|
|
* @download_firmware: called to download the firmware when the usb_ctrl is
|
|
|
|
* DEVICE_SPECIFIC.
|
|
|
|
* @no_reconnect: device doesn't do a reconnect after downloading the firmware,
|
2006-09-30 17:53:48 +08:00
|
|
|
* so do the warm initialization right after it
|
|
|
|
*
|
2005-06-24 13:02:35 +08:00
|
|
|
* @size_of_priv: how many bytes shall be allocated for the private field
|
|
|
|
* of struct dvb_usb_device.
|
|
|
|
*
|
|
|
|
* @power_ctrl: called to enable/disable power of the device.
|
|
|
|
* @read_mac_address: called to read the MAC address of the device.
|
|
|
|
* @identify_state: called to determine the state (cold or warm), when it
|
|
|
|
* is not distinguishable by the USB IDs.
|
|
|
|
*
|
2010-08-01 05:04:09 +08:00
|
|
|
* @rc: remote controller properties
|
2005-06-24 13:02:35 +08:00
|
|
|
*
|
|
|
|
* @i2c_algo: i2c_algorithm if the device has I2CoverUSB.
|
|
|
|
*
|
|
|
|
* @generic_bulk_ctrl_endpoint: most of the DVB USB devices have a generic
|
|
|
|
* endpoint which received control messages with bulk transfers. When this
|
|
|
|
* is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write-
|
|
|
|
* helper functions.
|
|
|
|
*
|
2010-02-01 08:06:10 +08:00
|
|
|
* @generic_bulk_ctrl_endpoint_response: some DVB USB devices use a separate
|
|
|
|
* endpoint for responses to control messages sent with bulk transfers via
|
|
|
|
* the generic_bulk_ctrl_endpoint. When this is non-zero, this will be used
|
|
|
|
* instead of the generic_bulk_ctrl_endpoint when reading usb responses in
|
|
|
|
* the dvb_usb_generic_rw helper function.
|
|
|
|
*
|
2005-06-24 13:02:35 +08:00
|
|
|
* @num_device_descs: number of struct dvb_usb_device_description in @devices
|
|
|
|
* @devices: array of struct dvb_usb_device_description compatibles with these
|
|
|
|
* properties.
|
|
|
|
*/
|
2006-09-30 17:53:48 +08:00
|
|
|
#define MAX_NO_OF_ADAPTER_PER_DEVICE 2
|
|
|
|
struct dvb_usb_device_properties {
|
2005-06-24 13:02:35 +08:00
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
#define DVB_USB_IS_AN_I2C_ADAPTER 0x01
|
2005-06-24 13:02:35 +08:00
|
|
|
int caps;
|
|
|
|
|
2006-01-10 01:25:04 +08:00
|
|
|
#define DEVICE_SPECIFIC 0
|
|
|
|
#define CYPRESS_AN2135 1
|
|
|
|
#define CYPRESS_AN2235 2
|
|
|
|
#define CYPRESS_FX2 3
|
2006-09-19 23:51:33 +08:00
|
|
|
int usb_ctrl;
|
|
|
|
int (*download_firmware) (struct usb_device *, const struct firmware *);
|
2009-05-27 06:49:34 +08:00
|
|
|
const char *firmware;
|
2006-09-19 23:51:33 +08:00
|
|
|
int no_reconnect;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
int size_of_priv;
|
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
int num_adapters;
|
|
|
|
struct dvb_usb_adapter_properties adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
|
2005-06-24 13:02:35 +08:00
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
int (*power_ctrl) (struct dvb_usb_device *, int);
|
2005-06-24 13:02:35 +08:00
|
|
|
int (*read_mac_address) (struct dvb_usb_device *, u8 []);
|
2006-09-30 17:53:48 +08:00
|
|
|
int (*identify_state) (struct usb_device *, struct dvb_usb_device_properties *,
|
2005-06-24 13:02:35 +08:00
|
|
|
struct dvb_usb_device_description **, int *);
|
|
|
|
|
2010-08-01 06:07:55 +08:00
|
|
|
struct {
|
|
|
|
enum dvb_usb_mode mode; /* Drivers shouldn't touch on it */
|
2010-08-01 05:04:09 +08:00
|
|
|
struct dvb_rc_legacy legacy;
|
2010-08-01 06:07:55 +08:00
|
|
|
struct dvb_rc core;
|
2010-08-01 05:04:09 +08:00
|
|
|
} rc;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
struct i2c_algorithm *i2c_algo;
|
|
|
|
|
|
|
|
int generic_bulk_ctrl_endpoint;
|
2010-02-01 08:06:10 +08:00
|
|
|
int generic_bulk_ctrl_endpoint_response;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
int num_device_descs;
|
2009-04-20 22:57:49 +08:00
|
|
|
struct dvb_usb_device_description devices[12];
|
2005-06-24 13:02:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2006-09-30 17:53:48 +08:00
|
|
|
* struct usb_data_stream - generic object of an USB stream
|
2005-07-08 08:58:08 +08:00
|
|
|
* @buf_num: number of buffer allocated.
|
|
|
|
* @buf_size: size of each buffer in buf_list.
|
|
|
|
* @buf_list: array containing all allocate buffers for streaming.
|
|
|
|
* @dma_addr: list of dma_addr_t for each buffer in buf_list.
|
|
|
|
*
|
2005-06-24 13:02:35 +08:00
|
|
|
* @urbs_initialized: number of URBs initialized.
|
|
|
|
* @urbs_submitted: number of URBs submitted.
|
2006-09-30 17:53:48 +08:00
|
|
|
*/
|
|
|
|
#define MAX_NO_URBS_FOR_DATA_STREAM 10
|
|
|
|
struct usb_data_stream {
|
2006-09-19 23:51:33 +08:00
|
|
|
struct usb_device *udev;
|
|
|
|
struct usb_data_stream_properties props;
|
2006-09-30 17:53:48 +08:00
|
|
|
|
|
|
|
#define USB_STATE_INIT 0x00
|
|
|
|
#define USB_STATE_URB_BUF 0x01
|
|
|
|
int state;
|
|
|
|
|
|
|
|
void (*complete) (struct usb_data_stream *, u8 *, size_t);
|
|
|
|
|
2006-09-19 23:51:33 +08:00
|
|
|
struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM];
|
|
|
|
int buf_num;
|
|
|
|
unsigned long buf_size;
|
|
|
|
u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM];
|
|
|
|
dma_addr_t dma_addr[MAX_NO_URBS_FOR_DATA_STREAM];
|
2006-09-30 17:53:48 +08:00
|
|
|
|
|
|
|
int urbs_initialized;
|
|
|
|
int urbs_submitted;
|
|
|
|
|
|
|
|
void *user_priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct dvb_usb_adapter - a DVB adapter on a USB device
|
|
|
|
* @id: index of this adapter (starting with 0).
|
|
|
|
*
|
2005-06-24 13:02:35 +08:00
|
|
|
* @feedcount: number of reqested feeds (used for streaming-activation)
|
|
|
|
* @pid_filtering: is hardware pid_filtering used or not.
|
2005-07-08 08:58:08 +08:00
|
|
|
*
|
2005-06-24 13:02:35 +08:00
|
|
|
* @pll_addr: I2C address of the tuner for programming
|
|
|
|
* @pll_init: array containing the initialization buffer
|
|
|
|
* @pll_desc: pointer to the appropriate struct dvb_pll_desc
|
2005-07-08 08:58:08 +08:00
|
|
|
* @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board
|
2006-09-19 23:51:33 +08:00
|
|
|
*
|
2005-06-24 13:02:35 +08:00
|
|
|
* @dvb_adap: device's dvb_adapter.
|
|
|
|
* @dmxdev: device's dmxdev.
|
|
|
|
* @demux: device's software demuxer.
|
|
|
|
* @dvb_net: device's dvb_net interfaces.
|
|
|
|
* @dvb_frontend: device's frontend.
|
|
|
|
* @max_feed_count: how many feeds can be handled simultaneously by this
|
|
|
|
* device
|
2006-09-19 23:51:33 +08:00
|
|
|
*
|
|
|
|
* @fe_init: rerouted frontend-init (wakeup) function.
|
2005-06-24 13:02:35 +08:00
|
|
|
* @fe_sleep: rerouted frontend-sleep function.
|
2006-09-19 23:51:33 +08:00
|
|
|
*
|
2006-09-30 17:53:48 +08:00
|
|
|
* @stream: the usb data stream.
|
|
|
|
*/
|
2011-09-06 20:31:57 +08:00
|
|
|
struct dvb_usb_fe_adapter {
|
|
|
|
struct dvb_frontend *fe;
|
|
|
|
|
|
|
|
int (*fe_init) (struct dvb_frontend *);
|
|
|
|
int (*fe_sleep) (struct dvb_frontend *);
|
|
|
|
|
|
|
|
struct usb_data_stream stream;
|
|
|
|
|
|
|
|
int pid_filtering;
|
|
|
|
int max_feed_count;
|
|
|
|
|
|
|
|
void *priv;
|
|
|
|
};
|
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
struct dvb_usb_adapter {
|
|
|
|
struct dvb_usb_device *dev;
|
|
|
|
struct dvb_usb_adapter_properties props;
|
|
|
|
|
|
|
|
#define DVB_USB_ADAP_STATE_INIT 0x000
|
|
|
|
#define DVB_USB_ADAP_STATE_DVB 0x001
|
|
|
|
int state;
|
|
|
|
|
2006-09-19 23:51:33 +08:00
|
|
|
u8 id;
|
2006-09-30 17:53:48 +08:00
|
|
|
|
|
|
|
int feedcount;
|
|
|
|
|
|
|
|
/* dvb */
|
|
|
|
struct dvb_adapter dvb_adap;
|
|
|
|
struct dmxdev dmxdev;
|
|
|
|
struct dvb_demux demux;
|
|
|
|
struct dvb_net dvb_net;
|
|
|
|
|
2011-09-06 20:31:57 +08:00
|
|
|
struct dvb_usb_fe_adapter fe_adap[MAX_NO_OF_FE_PER_ADAP];
|
|
|
|
int active_fe;
|
|
|
|
int num_frontends_initialized;
|
2006-09-30 17:53:48 +08:00
|
|
|
|
|
|
|
void *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct dvb_usb_device - object of a DVB USB device
|
|
|
|
* @props: copy of the struct dvb_usb_properties this device belongs to.
|
|
|
|
* @desc: pointer to the device's struct dvb_usb_device_description.
|
|
|
|
* @state: initialization and runtime state of the device.
|
|
|
|
*
|
2006-09-20 17:06:11 +08:00
|
|
|
* @powered: indicated whether the device is power or not.
|
|
|
|
* Powered is in/decremented for each call to modify the state.
|
2006-09-30 17:53:48 +08:00
|
|
|
* @udev: pointer to the device's struct usb_device.
|
|
|
|
*
|
2016-11-12 22:46:26 +08:00
|
|
|
* @data_mutex: mutex to protect the data structure used to store URB data
|
|
|
|
* @usb_mutex: mutex of USB control messages (reading needs two messages).
|
|
|
|
* Please notice that this mutex is used internally at the generic
|
|
|
|
* URB control functions. So, drivers using dvb_usb_generic_rw() and
|
|
|
|
* derivated functions should not lock it internally.
|
|
|
|
* @i2c_mutex: mutex for i2c-transfers
|
2006-09-30 17:53:48 +08:00
|
|
|
*
|
|
|
|
* @i2c_adap: device's i2c_adapter if it uses I2CoverUSB
|
|
|
|
*
|
2010-10-30 03:08:23 +08:00
|
|
|
* @rc_dev: rc device for the remote control (rc-core mode)
|
|
|
|
* @input_dev: input device for the remote control (legacy mode)
|
2005-06-24 13:02:35 +08:00
|
|
|
* @rc_query_work: struct work_struct frequent rc queries
|
|
|
|
* @last_event: last triggered event
|
|
|
|
* @last_state: last state (no, pressed, repeat)
|
|
|
|
* @owner: owner of the dvb_adapter
|
|
|
|
* @priv: private data of the actual driver (allocate by dvb-usb, size defined
|
|
|
|
* in size_of_priv of dvb_usb_properties).
|
|
|
|
*/
|
|
|
|
struct dvb_usb_device {
|
2006-09-30 17:53:48 +08:00
|
|
|
struct dvb_usb_device_properties props;
|
2005-06-24 13:02:35 +08:00
|
|
|
struct dvb_usb_device_description *desc;
|
|
|
|
|
|
|
|
struct usb_device *udev;
|
2005-07-08 08:58:08 +08:00
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
#define DVB_USB_STATE_INIT 0x000
|
|
|
|
#define DVB_USB_STATE_I2C 0x001
|
|
|
|
#define DVB_USB_STATE_DVB 0x002
|
|
|
|
#define DVB_USB_STATE_REMOTE 0x004
|
|
|
|
int state;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
int powered;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
/* locking */
|
2016-11-12 22:46:26 +08:00
|
|
|
struct mutex data_mutex;
|
2006-02-07 16:49:14 +08:00
|
|
|
struct mutex usb_mutex;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
/* i2c */
|
2006-02-07 16:49:14 +08:00
|
|
|
struct mutex i2c_mutex;
|
2005-06-24 13:02:35 +08:00
|
|
|
struct i2c_adapter i2c_adap;
|
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
int num_adapters_initialized;
|
|
|
|
struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
/* remote control */
|
2010-10-30 03:08:23 +08:00
|
|
|
struct rc_dev *rc_dev;
|
|
|
|
struct input_dev *input_dev;
|
2005-09-15 15:01:53 +08:00
|
|
|
char rc_phys[64];
|
2006-11-22 22:57:56 +08:00
|
|
|
struct delayed_work rc_query_work;
|
2005-06-24 13:02:35 +08:00
|
|
|
u32 last_event;
|
|
|
|
int last_state;
|
|
|
|
|
|
|
|
struct module *owner;
|
|
|
|
|
|
|
|
void *priv;
|
|
|
|
};
|
|
|
|
|
2008-04-10 06:13:13 +08:00
|
|
|
extern int dvb_usb_device_init(struct usb_interface *,
|
|
|
|
struct dvb_usb_device_properties *,
|
|
|
|
struct module *, struct dvb_usb_device **,
|
|
|
|
short *adapter_nums);
|
2005-06-24 13:02:35 +08:00
|
|
|
extern void dvb_usb_device_exit(struct usb_interface *);
|
|
|
|
|
|
|
|
/* the generic read/write method for device control */
|
2016-10-07 22:41:13 +08:00
|
|
|
extern int __must_check
|
|
|
|
dvb_usb_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16, int);
|
|
|
|
extern int __must_check
|
|
|
|
dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16);
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
/* commonly used remote control parsing */
|
|
|
|
extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *);
|
|
|
|
|
2006-01-10 01:25:04 +08:00
|
|
|
/* commonly used firmware download types and function */
|
|
|
|
struct hexline {
|
|
|
|
u8 len;
|
|
|
|
u32 addr;
|
|
|
|
u8 type;
|
|
|
|
u8 data[255];
|
|
|
|
u8 chk;
|
|
|
|
};
|
2006-01-10 04:21:38 +08:00
|
|
|
extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type);
|
2006-09-19 23:51:33 +08:00
|
|
|
extern int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos);
|
|
|
|
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
#endif
|