^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* dvb-usb.h is part of the DVB USB library.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@posteo.de)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * see dvb-usb-init.c for copyright information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * the headerfile, all dvb-usb-drivers have to include.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * TODO: clean-up the structures for unused fields and update the comments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #ifndef __DVB_USB_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define __DVB_USB_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/usb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/firmware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <media/rc-core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <media/dvb_frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <media/dvb_demux.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <media/dvb_net.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <media/dmxdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include "dvb-pll.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <media/dvb-usb-ids.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* debug */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #ifdef CONFIG_DVB_USB_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define dprintk(var,level,args...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) do { if ((var & level)) { printk(args); } } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define debug_dump(b,l,func) {\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int loop_; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) for (loop_ = 0; loop_ < l; loop_++) func("%02x ", b[loop_]); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) func("\n");\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define DVB_USB_DEBUG_STATUS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define dprintk(args...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define debug_dump(b,l,func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define DVB_USB_DEBUG_STATUS " (debugging is not enabled)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /* generic log methods - taken from usb.h */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #ifndef DVB_USB_LOG_PREFIX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define DVB_USB_LOG_PREFIX "dvb-usb (please define a log prefix)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #undef err
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define err(format, arg...) printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #undef info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define info(format, arg...) printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #undef warn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * struct dvb_usb_device_description - name and its according USB IDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * @name: real name of the box, regardless which DVB USB device class is in use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * @cold_ids: array of struct usb_device_id which describe the device in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * pre-firmware state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * @warm_ids: array of struct usb_device_id which describe the device in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * post-firmware state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * Each DVB USB device class can have one or more actual devices, this struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * assigns a name to it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) struct dvb_usb_device_description {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define DVB_USB_ID_MAX_NUM 15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct usb_device_id *cold_ids[DVB_USB_ID_MAX_NUM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) static inline u8 rc5_custom(struct rc_map_table *key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) return (key->scancode >> 8) & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) static inline u8 rc5_data(struct rc_map_table *key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) return key->scancode & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) static inline u16 rc5_scan(struct rc_map_table *key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) return key->scancode & 0xffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) struct dvb_usb_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) struct dvb_usb_adapter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) struct usb_data_stream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * Properties of USB streaming - TODO this structure should be somewhere else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * describes the kind of USB transfer used for data-streaming.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * (BULK or ISOC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) struct usb_data_stream_properties {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #define USB_BULK 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #define USB_ISOC 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) int type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) int endpoint;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) int buffersize; /* per URB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) } bulk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) int framesperurb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) int framesize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) int interval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) } isoc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) } u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * struct dvb_usb_adapter_properties - properties of a dvb-usb-adapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * A DVB-USB-Adapter is basically a dvb_adapter which is present on a USB-device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * @caps: capabilities of the DVB USB device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * @pid_filter_count: number of PID filter position in the optional hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * PID-filter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * @num_frontends: number of frontends of the DVB USB adapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * @frontend_ctrl: called to power on/off active frontend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * @streaming_ctrl: called to start and stop the MPEG2-TS streaming of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * device (not URB submitting/killing).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * This callback will be called without data URBs being active - data URBs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * will be submitted only after streaming_ctrl(1) returns successfully and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * they will be killed before streaming_ctrl(0) gets called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * @pid_filter_ctrl: called to en/disable the PID filter, if any.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * @pid_filter: called to set/unset a PID for filtering.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * @frontend_attach: called to attach the possible frontends (fill fe-field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * of struct dvb_usb_device).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * @tuner_attach: called to attach the correct tuner and to fill pll_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * pll_desc and pll_init_buf of struct dvb_usb_device).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * @stream: configuration of the USB streaming
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct dvb_usb_adapter_fe_properties {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #define DVB_USB_ADAP_HAS_PID_FILTER 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #define DVB_USB_ADAP_NEED_PID_FILTERING 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #define DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) int caps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) int pid_filter_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) int (*streaming_ctrl) (struct dvb_usb_adapter *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) int (*frontend_attach) (struct dvb_usb_adapter *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) int (*tuner_attach) (struct dvb_usb_adapter *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct usb_data_stream_properties stream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) int size_of_priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #define MAX_NO_OF_FE_PER_ADAP 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct dvb_usb_adapter_properties {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) int size_of_priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) int (*frontend_ctrl) (struct dvb_frontend *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) int num_frontends;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) struct dvb_usb_adapter_fe_properties fe[MAX_NO_OF_FE_PER_ADAP];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * struct dvb_rc_legacy - old properties of remote controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * @rc_map_table: a hard-wired array of struct rc_map_table (NULL to disable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * remote control handling).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * @rc_map_size: number of items in @rc_map_table.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * @rc_query: called to query an event event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * @rc_interval: time in ms between two queries.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) struct dvb_rc_legacy {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) /* remote control properties */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) #define REMOTE_NO_KEY_PRESSED 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #define REMOTE_KEY_PRESSED 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) #define REMOTE_KEY_REPEAT 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct rc_map_table *rc_map_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) int rc_map_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) int (*rc_query) (struct dvb_usb_device *, u32 *, int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) int rc_interval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * struct dvb_rc properties of remote controller, using rc-core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * @rc_codes: name of rc codes table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * @protocol: type of protocol(s) currently used by the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * @allowed_protos: protocol(s) supported by the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * @driver_type: Used to point if a device supports raw mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * @change_protocol: callback to change protocol
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) * @rc_query: called to query an event event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * @rc_interval: time in ms between two queries.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) * @bulk_mode: device supports bulk mode for RC (disable polling mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) struct dvb_rc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) char *rc_codes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) u64 protocol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) u64 allowed_protos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) enum rc_driver_type driver_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) int (*change_protocol)(struct rc_dev *dev, u64 *rc_proto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) char *module_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) int (*rc_query) (struct dvb_usb_device *d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) int rc_interval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) bool bulk_mode; /* uses bulk mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) u32 scancode_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * enum dvb_usb_mode - Specifies if it is using a legacy driver or a new one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) * based on rc-core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) * This is initialized/used only inside dvb-usb-remote.c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) * It shouldn't be set by the drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) enum dvb_usb_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) DVB_RC_LEGACY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) DVB_RC_CORE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) * struct dvb_usb_device_properties - properties of a dvb-usb-device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) * @usb_ctrl: which USB device-side controller is in use. Needed for firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) * download.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) * @firmware: name of the firmware file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) * @download_firmware: called to download the firmware when the usb_ctrl is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) * DEVICE_SPECIFIC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) * @no_reconnect: device doesn't do a reconnect after downloading the firmware,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) * so do the warm initialization right after it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) * @size_of_priv: how many bytes shall be allocated for the private field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) * of struct dvb_usb_device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) * @priv_init: optional callback to initialize the variable that private field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) * of struct dvb_usb_device has pointer to just after it had been allocated and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) * zeroed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) * @priv_destroy: just like priv_init, only called before deallocating
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) * the memory pointed by private field of struct dvb_usb_device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) * @power_ctrl: called to enable/disable power of the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) * @read_mac_address: called to read the MAC address of the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) * @identify_state: called to determine the state (cold or warm), when it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) * is not distinguishable by the USB IDs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) * @rc: remote controller properties
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) * @i2c_algo: i2c_algorithm if the device has I2CoverUSB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) * @generic_bulk_ctrl_endpoint: most of the DVB USB devices have a generic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) * endpoint which received control messages with bulk transfers. When this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * helper functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) * @generic_bulk_ctrl_endpoint_response: some DVB USB devices use a separate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) * endpoint for responses to control messages sent with bulk transfers via
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) * the generic_bulk_ctrl_endpoint. When this is non-zero, this will be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) * instead of the generic_bulk_ctrl_endpoint when reading usb responses in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) * the dvb_usb_generic_rw helper function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) * @num_device_descs: number of struct dvb_usb_device_description in @devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) * @devices: array of struct dvb_usb_device_description compatibles with these
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) * properties.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) #define MAX_NO_OF_ADAPTER_PER_DEVICE 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) struct dvb_usb_device_properties {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #define DVB_USB_IS_AN_I2C_ADAPTER 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) int caps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) #define DEVICE_SPECIFIC 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) #define CYPRESS_AN2135 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) #define CYPRESS_AN2235 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) #define CYPRESS_FX2 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) int usb_ctrl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) int (*download_firmware) (struct usb_device *, const struct firmware *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) const char *firmware;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) int no_reconnect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) int size_of_priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) int (*priv_init)(struct dvb_usb_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) void (*priv_destroy)(struct dvb_usb_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) int num_adapters;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) struct dvb_usb_adapter_properties adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) int (*power_ctrl) (struct dvb_usb_device *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) int (*read_mac_address) (struct dvb_usb_device *, u8 []);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) int (*identify_state)(struct usb_device *udev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) const struct dvb_usb_device_properties *props,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) const struct dvb_usb_device_description **desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) int *cold);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) enum dvb_usb_mode mode; /* Drivers shouldn't touch on it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) struct dvb_rc_legacy legacy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) struct dvb_rc core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) } rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) struct i2c_algorithm *i2c_algo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) int generic_bulk_ctrl_endpoint;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) int generic_bulk_ctrl_endpoint_response;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) int num_device_descs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) struct dvb_usb_device_description devices[12];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) * struct usb_data_stream - generic object of an USB stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) * @buf_num: number of buffer allocated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) * @buf_size: size of each buffer in buf_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) * @buf_list: array containing all allocate buffers for streaming.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) * @dma_addr: list of dma_addr_t for each buffer in buf_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) * @urbs_initialized: number of URBs initialized.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) * @urbs_submitted: number of URBs submitted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) #define MAX_NO_URBS_FOR_DATA_STREAM 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) struct usb_data_stream {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) struct usb_device *udev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) struct usb_data_stream_properties props;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) #define USB_STATE_INIT 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) #define USB_STATE_URB_BUF 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) int state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) void (*complete) (struct usb_data_stream *, u8 *, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) int buf_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) unsigned long buf_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) dma_addr_t dma_addr[MAX_NO_URBS_FOR_DATA_STREAM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) int urbs_initialized;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) int urbs_submitted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) void *user_priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) * struct dvb_usb_adapter - a DVB adapter on a USB device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) * @id: index of this adapter (starting with 0).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) * @feedcount: number of requested feeds (used for streaming-activation)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) * @pid_filtering: is hardware pid_filtering used or not.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) * @pll_addr: I2C address of the tuner for programming
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) * @pll_init: array containing the initialization buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) * @pll_desc: pointer to the appropriate struct dvb_pll_desc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) * @dvb_adap: device's dvb_adapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) * @dmxdev: device's dmxdev.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) * @demux: device's software demuxer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) * @dvb_net: device's dvb_net interfaces.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) * @dvb_frontend: device's frontend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) * @max_feed_count: how many feeds can be handled simultaneously by this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) * device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) * @fe_init: rerouted frontend-init (wakeup) function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) * @fe_sleep: rerouted frontend-sleep function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) * @stream: the usb data stream.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) struct dvb_usb_fe_adapter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) struct dvb_frontend *fe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) int (*fe_init) (struct dvb_frontend *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) int (*fe_sleep) (struct dvb_frontend *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) struct usb_data_stream stream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) int pid_filtering;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) int max_feed_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) struct dvb_usb_adapter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) struct dvb_usb_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) struct dvb_usb_adapter_properties props;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) #define DVB_USB_ADAP_STATE_INIT 0x000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) #define DVB_USB_ADAP_STATE_DVB 0x001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) int state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) u8 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) int feedcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) /* dvb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) struct dvb_adapter dvb_adap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) struct dmxdev dmxdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) struct dvb_demux demux;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) struct dvb_net dvb_net;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) struct dvb_usb_fe_adapter fe_adap[MAX_NO_OF_FE_PER_ADAP];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) int active_fe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) int num_frontends_initialized;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) * struct dvb_usb_device - object of a DVB USB device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) * @props: copy of the struct dvb_usb_properties this device belongs to.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) * @desc: pointer to the device's struct dvb_usb_device_description.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) * @state: initialization and runtime state of the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) * @powered: indicated whether the device is power or not.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) * Powered is in/decremented for each call to modify the state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) * @udev: pointer to the device's struct usb_device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) * @data_mutex: mutex to protect the data structure used to store URB data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) * @usb_mutex: mutex of USB control messages (reading needs two messages).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) * Please notice that this mutex is used internally at the generic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) * URB control functions. So, drivers using dvb_usb_generic_rw() and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) * derivated functions should not lock it internally.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) * @i2c_mutex: mutex for i2c-transfers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) * @rc_dev: rc device for the remote control (rc-core mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * @input_dev: input device for the remote control (legacy mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * @rc_query_work: struct work_struct frequent rc queries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * @last_event: last triggered event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * @last_state: last state (no, pressed, repeat)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * @owner: owner of the dvb_adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) * @priv: private data of the actual driver (allocate by dvb-usb, size defined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) * in size_of_priv of dvb_usb_properties).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) struct dvb_usb_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) struct dvb_usb_device_properties props;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) const struct dvb_usb_device_description *desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) struct usb_device *udev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) #define DVB_USB_STATE_INIT 0x000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) #define DVB_USB_STATE_I2C 0x001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) #define DVB_USB_STATE_DVB 0x002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) #define DVB_USB_STATE_REMOTE 0x004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) int state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) int powered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) /* locking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) struct mutex data_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) struct mutex usb_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) /* i2c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) struct mutex i2c_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) struct i2c_adapter i2c_adap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) int num_adapters_initialized;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) /* remote control */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) struct rc_dev *rc_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) struct input_dev *input_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) char rc_phys[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) struct delayed_work rc_query_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) u32 last_event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) int last_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) extern int dvb_usb_device_init(struct usb_interface *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) const struct dvb_usb_device_properties *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) struct module *, struct dvb_usb_device **,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) short *adapter_nums);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) extern void dvb_usb_device_exit(struct usb_interface *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) /* the generic read/write method for device control */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) extern int __must_check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) dvb_usb_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) extern int __must_check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) /* commonly used remote control parsing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[5], u32 *, int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) /* commonly used firmware download types and function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) struct hexline {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) u8 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) u32 addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) u8 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) u8 data[255];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) u8 chk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) extern int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) #endif