linux/drivers/media/usb/dvb-usb/dw2102.c

// SPDX-License-Identifier: GPL-2.0-only
/* DVB USB framework compliant Linux driver for the
 *	DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
 *	TeVii S421, S480, S482, S600, S630, S632, S650, S660, S662,
 *	Prof 1100, 7500,
 *	Geniatech SU3000, T220,
 *	TechnoTrend S2-4600,
 *	Terratec Cinergy S2 cards
 * Copyright (C) 2008-2012 Igor M. Liplianin ([email protected])
 *
 * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
 */
#include <media/dvb-usb-ids.h>
#include "dw2102.h"
#include "si21xx.h"
#include "stv0299.h"
#include "z0194a.h"
#include "stv0288.h"
#include "stb6000.h"
#include "eds1547.h"
#include "cx24116.h"
#include "tda1002x.h"
#include "mt312.h"
#include "zl10039.h"
#include "ts2020.h"
#include "ds3000.h"
#include "stv0900.h"
#include "stv6110.h"
#include "stb6100.h"
#include "stb6100_proc.h"
#include "m88rs2000.h"
#include "tda18271.h"
#include "cxd2820r.h"
#include "m88ds3103.h"

/* Max transfer size done by I2C transfer functions */
#define MAX_XFER_SIZE

#define DW210X_READ_MSG
#define DW210X_WRITE_MSG

#define REG_1F_SYMBOLRATE_BYTE0
#define REG_20_SYMBOLRATE_BYTE1
#define REG_21_SYMBOLRATE_BYTE2
/* on my own*/
#define DW2102_VOLTAGE_CTRL
#define SU3000_STREAM_CTRL
#define DW2102_RC_QUERY
#define DW2102_LED_CTRL

#define DW2101_FIRMWARE
#define DW2102_FIRMWARE
#define DW2104_FIRMWARE
#define DW3101_FIRMWARE
#define S630_FIRMWARE
#define S660_FIRMWARE
#define P1100_FIRMWARE
#define P7500_FIRMWARE

#define err_str

struct dw2102_state {};

/* debug */
static int dvb_usb_dw2102_debug;
module_param_named(debug, dvb_usb_dw2102_debug, int, 0644);
MODULE_PARM_DESC();

/* demod probe */
static int demod_probe =;
module_param_named(demod, demod_probe, int, 0644);
MODULE_PARM_DESC();

DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);

static int dw210x_op_rw(struct usb_device *dev, u8 request, u16 value,
			u16 index, u8 *data, u16 len, int flags)
{}

/* I2C */
static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
			       int num)
{}

static int dw2102_serit_i2c_transfer(struct i2c_adapter *adap,
				     struct i2c_msg msg[], int num)
{}

static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
{}

static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
{}

static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
			       int num)
{}

static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
			     int num)
{}

static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
			       int num)
{}

static u32 dw210x_i2c_func(struct i2c_adapter *adapter)
{}

static struct i2c_algorithm dw2102_i2c_algo =;

static struct i2c_algorithm dw2102_serit_i2c_algo =;

static struct i2c_algorithm dw2102_earda_i2c_algo =;

static struct i2c_algorithm dw2104_i2c_algo =;

static struct i2c_algorithm dw3101_i2c_algo =;

static struct i2c_algorithm s6x0_i2c_algo =;

static struct i2c_algorithm su3000_i2c_algo =;

static int dw210x_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
{
	int i;
	u8 ibuf[] = {0, 0};
	u8 eeprom[256], eepromline[16];

	for (i = 0; i < 256; i++) {
		if (dw210x_op_rw(d->udev, 0xb6, 0xa0, i, ibuf, 2, DW210X_READ_MSG) < 0) {
			err("read eeprom failed.");
			return -EIO;
		} else {
			eepromline[i % 16] = ibuf[0];
			eeprom[i] = ibuf[0];
		}
		if ((i % 16) == 15) {
			deb_xfer("%02x: ", i - 15);
			debug_dump(eepromline, 16, deb_xfer);
		}
	}

	memcpy(mac, eeprom + 8, 6);
	return 0;
};

static int s6x0_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
{
	int i, ret;
	u8 ibuf[] = { 0 }, obuf[] = { 0 };
	u8 eeprom[256], eepromline[16];
	struct i2c_msg msg[] = {
		{
			.addr = 0xa0 >> 1,
			.flags = 0,
			.buf = obuf,
			.len = 1,
		}, {
			.addr = 0xa0 >> 1,
			.flags = I2C_M_RD,
			.buf = ibuf,
			.len = 1,
		}
	};

	for (i = 0; i < 256; i++) {
		obuf[0] = i;
		ret = s6x0_i2c_transfer(&d->i2c_adap, msg, 2);
		if (ret != 2) {
			err("read eeprom failed.");
			return -EIO;
		} else {
			eepromline[i % 16] = ibuf[0];
			eeprom[i] = ibuf[0];
		}

		if ((i % 16) == 15) {
			deb_xfer("%02x: ", i - 15);
			debug_dump(eepromline, 16, deb_xfer);
		}
	}

	memcpy(mac, eeprom + 16, 6);
	return 0;
};

static int su3000_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
{}

static int su3000_power_ctrl(struct dvb_usb_device *d, int i)
{}

static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
{}

static int su3000_identify_state(struct usb_device *udev,
				 const struct dvb_usb_device_properties *props,
				 const struct dvb_usb_device_description **desc,
				 int *cold)
{}

static int dw210x_set_voltage(struct dvb_frontend *fe,
			      enum fe_sec_voltage voltage)
{}

static int s660_set_voltage(struct dvb_frontend *fe,
			    enum fe_sec_voltage voltage)
{}

static void dw210x_led_ctrl(struct dvb_frontend *fe, int offon)
{}

static int tt_s2_4600_read_status(struct dvb_frontend *fe,
				  enum fe_status *status)
{}

static struct stv0299_config sharp_z0194a_config =;

static struct cx24116_config dw2104_config =;

static struct si21xx_config serit_sp1511lhb_config =;

static struct tda10023_config dw3101_tda10023_config =;

static struct mt312_config zl313_config =;

static struct ds3000_config dw2104_ds3000_config =;

static struct ts2020_config dw2104_ts2020_config =;

static struct ds3000_config s660_ds3000_config =;

static struct ts2020_config s660_ts2020_config =;

static struct stv0900_config dw2104a_stv0900_config =;

static struct stb6100_config dw2104a_stb6100_config =;

static struct stv0900_config dw2104_stv0900_config =;

static struct stv6110_config dw2104_stv6110_config =;

static struct stv0900_config prof_7500_stv0900_config =;

static struct ds3000_config su3000_ds3000_config =;

static struct cxd2820r_config cxd2820r_config =;

static struct tda18271_config tda18271_config =;

static u8 m88rs2000_inittab[] =;

static struct m88rs2000_config s421_m88rs2000_config =;

static int dw2104_frontend_attach(struct dvb_usb_adapter *d)
{}

static struct dvb_usb_device_properties dw2102_properties;
static struct dvb_usb_device_properties dw2104_properties;
static struct dvb_usb_device_properties s6x0_properties;

static int dw2102_frontend_attach(struct dvb_usb_adapter *d)
{}

static int dw3101_frontend_attach(struct dvb_usb_adapter *d)
{}

static int zl100313_frontend_attach(struct dvb_usb_adapter *d)
{}

static int stv0288_frontend_attach(struct dvb_usb_adapter *d)
{}

static int ds3000_frontend_attach(struct dvb_usb_adapter *d)
{}

static int prof_7500_frontend_attach(struct dvb_usb_adapter *d)
{}

static int su3000_frontend_attach(struct dvb_usb_adapter *adap)
{}

static int t220_frontend_attach(struct dvb_usb_adapter *adap)
{}

static int m88rs2000_frontend_attach(struct dvb_usb_adapter *adap)
{}

static int tt_s2_4600_frontend_attach_probe_demod(struct dvb_usb_device *d,
						  const int probe_addr)
{}

static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap)
{}

static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
{}

static int dw3101_tuner_attach(struct dvb_usb_adapter *adap)
{}

static int dw2102_rc_query(struct dvb_usb_device *d)
{}

static int prof_rc_query(struct dvb_usb_device *d)
{}

static int su3000_rc_query(struct dvb_usb_device *d)
{}

enum dw2102_table_entry {};

static struct usb_device_id dw2102_table[] =;

MODULE_DEVICE_TABLE(usb, dw2102_table);

static int dw2102_load_firmware(struct usb_device *dev,
				const struct firmware *frmwr)
{}

static struct dvb_usb_device_properties dw2102_properties =;

static struct dvb_usb_device_properties dw2104_properties =;

static struct dvb_usb_device_properties dw3101_properties =;

static struct dvb_usb_device_properties s6x0_properties =;

static struct dvb_usb_device_properties p1100_properties =;

static struct dvb_usb_device_properties s660_properties =;

static struct dvb_usb_device_properties p7500_properties =;

static struct dvb_usb_device_properties su3000_properties =;

static struct dvb_usb_device_properties s421_properties =;

static struct dvb_usb_device_properties t220_properties =;

static struct dvb_usb_device_properties tt_s2_4600_properties =;

static int dw2102_probe(struct usb_interface *intf,
			const struct usb_device_id *id)
{}

static void dw2102_disconnect(struct usb_interface *intf)
{}

static struct usb_driver dw2102_driver =;

module_usb_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_VERSION();
MODULE_LICENSE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();