#include "em28xx.h"
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/usb.h>
#include <media/tuner.h>
#include <media/drv-intf/msp3400.h>
#include <media/i2c/saa7115.h>
#include <dt-bindings/media/tvp5150.h>
#include <media/i2c/tvaudio.h>
#include <media/tveeprom.h>
#include <media/v4l2-common.h>
#include <sound/ac97_codec.h>
#define DRIVER_NAME …
static int tuner = …;
module_param(tuner, int, 0444);
MODULE_PARM_DESC(…) …;
static unsigned int disable_ir;
module_param(disable_ir, int, 0444);
MODULE_PARM_DESC(…) …;
static unsigned int disable_usb_speed_check;
module_param(disable_usb_speed_check, int, 0444);
MODULE_PARM_DESC(…) …;
static unsigned int card[] = …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
static int usb_xfer_mode = …;
module_param(usb_xfer_mode, int, 0444);
MODULE_PARM_DESC(…) …;
static DECLARE_BITMAP(em28xx_devused, EM28XX_MAXBOARDS);
struct em28xx_hash_table { … };
static void em28xx_pre_card_setup(struct em28xx *dev);
static const struct em28xx_reg_seq default_analog[] = …;
static const struct em28xx_reg_seq default_digital[] = …;
static struct em28xx_reg_seq zolid_tuner[] = …;
static struct em28xx_reg_seq zolid_digital[] = …;
static const struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = …;
static const struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = …;
static const struct em28xx_reg_seq hauppauge_wintv_hvr_900R2_digital[] = …;
static const struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = …;
static const struct em28xx_reg_seq em2882_kworld_315u_digital[] = …;
static const struct em28xx_reg_seq em2882_kworld_315u_tuner_gpio[] = …;
static const struct em28xx_reg_seq kworld_330u_analog[] = …;
static const struct em28xx_reg_seq kworld_330u_digital[] = …;
static const struct em28xx_reg_seq evga_indtube_analog[] = …;
static const struct em28xx_reg_seq evga_indtube_digital[] = …;
static const struct em28xx_reg_seq kworld_a340_digital[] = …;
static const struct em28xx_reg_seq kworld_ub435q_v3_digital[] = …;
static const struct em28xx_reg_seq pinnacle_hybrid_pro_analog[] = …;
static const struct em28xx_reg_seq pinnacle_hybrid_pro_digital[] = …;
static const struct em28xx_reg_seq terratec_cinergy_USB_XS_FR_analog[] = …;
static const struct em28xx_reg_seq terratec_cinergy_USB_XS_FR_digital[] = …;
static const struct em28xx_reg_seq em2874_pctv_80e_digital[] = …;
static const struct em28xx_reg_seq reddo_dvb_c_usb_box[] = …;
static const struct em28xx_reg_seq default_tuner_gpio[] = …;
static const struct em28xx_reg_seq compro_unmute_tv_gpio[] = …;
static const struct em28xx_reg_seq compro_unmute_svid_gpio[] = …;
static const struct em28xx_reg_seq compro_mute_gpio[] = …;
static const struct em28xx_reg_seq terratec_av350_mute_gpio[] = …;
static const struct em28xx_reg_seq terratec_av350_unmute_gpio[] = …;
static const struct em28xx_reg_seq silvercrest_reg_seq[] = …;
static const struct em28xx_reg_seq vc211a_enable[] = …;
static const struct em28xx_reg_seq dikom_dk300_digital[] = …;
static const struct em28xx_reg_seq leadership_digital[] = …;
static const struct em28xx_reg_seq leadership_reset[] = …;
static const struct em28xx_reg_seq pctv_290e[] = …;
#if 0
static const struct em28xx_reg_seq terratec_h5_gpio[] = {
{EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
{EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
{EM2874_R80_GPIO_P0_CTRL, 0xf2, 0xff, 50},
{EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 50},
{ -1, -1, -1, -1},
};
static const struct em28xx_reg_seq terratec_h5_digital[] = {
{EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 10},
{EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
{EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 10},
{ -1, -1, -1, -1},
};
#endif
static const struct em28xx_reg_seq pctv_460e[] = …;
static const struct em28xx_reg_seq c3tech_digital_duo_digital[] = …;
static const struct em28xx_reg_seq pctv_461e[] = …;
#if 0
static const struct em28xx_reg_seq hauppauge_930c_gpio[] = {
{EM2874_R80_GPIO_P0_CTRL, 0x6f, 0xff, 10},
{EM2874_R80_GPIO_P0_CTRL, 0x4f, 0xff, 10},
{EM2874_R80_GPIO_P0_CTRL, 0x6f, 0xff, 10},
{EM2874_R80_GPIO_P0_CTRL, 0x4f, 0xff, 10},
{ -1, -1, -1, -1},
};
static const struct em28xx_reg_seq hauppauge_930c_digital[] = {
{EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 10},
{EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
{EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 10},
{ -1, -1, -1, -1},
};
#endif
static const struct em28xx_reg_seq maxmedia_ub425_tc[] = …;
static const struct em28xx_reg_seq pctv_510e[] = …;
static const struct em28xx_reg_seq pctv_520e[] = …;
static const struct em28xx_reg_seq speedlink_vad_laplace_reg_seq[] = …;
static const struct em28xx_reg_seq pctv_292e[] = …;
static const struct em28xx_reg_seq terratec_t2_stick_hd[] = …;
static const struct em28xx_reg_seq plex_px_bcud[] = …;
static const struct em28xx_reg_seq hauppauge_dualhd_dvb[] = …;
static struct em28xx_reg_seq hauppauge_usb_quadhd_atsc_reg_seq[] = …;
static const struct em28xx_reg_seq mygica_utv3_composite_audio_gpio[] = …;
static const struct em28xx_reg_seq mygica_utv3_tuner_audio_gpio[] = …;
static const struct em28xx_reg_seq mygica_utv3_suspend_gpio[] = …;
static const struct em28xx_button std_snapshot_button[] = …;
static const struct em28xx_button speedlink_vad_laplace_buttons[] = …;
static struct em28xx_led speedlink_vad_laplace_leds[] = …;
static struct em28xx_led kworld_ub435q_v3_leds[] = …;
static struct em28xx_led pctv_80e_leds[] = …;
static struct em28xx_led terratec_grabby_leds[] = …;
static struct em28xx_led hauppauge_dualhd_leds[] = …;
static struct em28xx_led hauppauge_usb_quadhd_leds[] = …;
const struct em28xx_board em28xx_boards[] = …;
EXPORT_SYMBOL_GPL(…);
static const unsigned int em28xx_bcount = …;
struct usb_device_id em28xx_id_table[] = …;
MODULE_DEVICE_TABLE(usb, em28xx_id_table);
static const struct em28xx_hash_table em28xx_eeprom_hash[] = …;
static const struct em28xx_hash_table em28xx_i2c_hash[] = …;
int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
{ … }
EXPORT_SYMBOL_GPL(…);
static inline void em28xx_set_xclk_i2c_speed(struct em28xx *dev)
{ … }
static inline void em28xx_set_model(struct em28xx *dev)
{ … }
static int em28xx_wait_until_ac97_features_equals(struct em28xx *dev,
int expected_feat)
{ … }
static void em28xx_pre_card_setup(struct em28xx *dev)
{ … }
static int em28xx_hint_board(struct em28xx *dev)
{ … }
static void em28xx_card_setup(struct em28xx *dev)
{ … }
void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
{ … }
EXPORT_SYMBOL_GPL(…);
static void request_module_async(struct work_struct *work)
{ … }
static void request_modules(struct em28xx *dev)
{ … }
static void flush_request_modules(struct em28xx *dev)
{ … }
static int em28xx_media_device_init(struct em28xx *dev,
struct usb_device *udev)
{ … }
static void em28xx_unregister_media_device(struct em28xx *dev)
{ … }
static void em28xx_release_resources(struct em28xx *dev)
{
struct usb_device *udev = interface_to_usbdev(dev->intf);
mutex_lock(&dev->lock);
em28xx_unregister_media_device(dev);
if (dev->def_i2c_bus)
em28xx_i2c_unregister(dev, 1);
em28xx_i2c_unregister(dev, 0);
if (dev->ts == PRIMARY_TS)
usb_put_dev(udev);
clear_bit(dev->devno, em28xx_devused);
mutex_unlock(&dev->lock);
};
void em28xx_free_device(struct kref *ref)
{ … }
EXPORT_SYMBOL_GPL(…);
static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,
struct usb_interface *intf,
int minor)
{ … }
static int em28xx_duplicate_dev(struct em28xx *dev)
{ … }
#define hb_mult(wMaxPacketSize) …
static void em28xx_check_usb_descriptor(struct em28xx *dev,
struct usb_device *udev,
struct usb_interface *intf,
int alt, int ep,
bool *has_vendor_audio,
bool *has_video,
bool *has_dvb)
{ … }
static int em28xx_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{ … }
static void em28xx_usb_disconnect(struct usb_interface *intf)
{ … }
static int em28xx_usb_suspend(struct usb_interface *intf,
pm_message_t message)
{ … }
static int em28xx_usb_resume(struct usb_interface *intf)
{ … }
static struct usb_driver em28xx_usb_driver = …;
module_usb_driver(…) …;