Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f571e004 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab
Browse files

[media] af9013: rewrite whole driver



Rewrite whole af9013 demod driver in order to decrease I2C I/O.

We need to decrease I2C load since AF9015 (I2C adapter / USB-bridge used)
seems to have some problems under heavy I2C traffic.

Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e90ab840
Loading
Loading
Loading
Loading
+42 −40
Original line number Diff line number Diff line
@@ -50,14 +50,14 @@ static int af9015_properties_count = ARRAY_SIZE(af9015_properties);

static struct af9013_config af9015_af9013_config[] = {
	{
		.demod_address = AF9015_I2C_DEMOD,
		.output_mode = AF9013_OUTPUT_MODE_USB,
		.i2c_addr = AF9015_I2C_DEMOD,
		.ts_mode = AF9013_TS_USB,
		.api_version = { 0, 1, 9, 0 },
		.gpio[0] = AF9013_GPIO_HI,
		.gpio[3] = AF9013_GPIO_TUNER_ON,

	}, {
		.output_mode = AF9013_OUTPUT_MODE_SERIAL,
		.ts_mode = AF9013_TS_SERIAL,
		.api_version = { 0, 1, 9, 0 },
		.gpio[0] = AF9013_GPIO_TUNER_ON,
		.gpio[1] = AF9013_GPIO_LO,
@@ -216,8 +216,8 @@ static int af9015_write_reg_i2c(struct dvb_usb_device *d, u8 addr, u16 reg,
{
	struct req_t req = {WRITE_I2C, addr, reg, 1, 1, 1, &val};

	if (addr == af9015_af9013_config[0].demod_address ||
	    addr == af9015_af9013_config[1].demod_address)
	if (addr == af9015_af9013_config[0].i2c_addr ||
	    addr == af9015_af9013_config[1].i2c_addr)
		req.addr_len = 3;

	return af9015_ctrl_msg(d, &req);
@@ -228,8 +228,8 @@ static int af9015_read_reg_i2c(struct dvb_usb_device *d, u8 addr, u16 reg,
{
	struct req_t req = {READ_I2C, addr, reg, 0, 1, 1, val};

	if (addr == af9015_af9013_config[0].demod_address ||
	    addr == af9015_af9013_config[1].demod_address)
	if (addr == af9015_af9013_config[0].i2c_addr ||
	    addr == af9015_af9013_config[1].i2c_addr)
		req.addr_len = 3;

	return af9015_ctrl_msg(d, &req);
@@ -271,8 +271,8 @@ Due to that the only way to select correct tuner is use demodulator I2C-gate.
		return -EAGAIN;

	while (i < num) {
		if (msg[i].addr == af9015_af9013_config[0].demod_address ||
		    msg[i].addr == af9015_af9013_config[1].demod_address) {
		if (msg[i].addr == af9015_af9013_config[0].i2c_addr ||
		    msg[i].addr == af9015_af9013_config[1].i2c_addr) {
			addr = msg[i].buf[0] << 8;
			addr += msg[i].buf[1];
			mbox = msg[i].buf[2];
@@ -288,8 +288,7 @@ Due to that the only way to select correct tuner is use demodulator I2C-gate.
				ret = -EOPNOTSUPP;
				goto error;
			}
			if (msg[i].addr ==
				af9015_af9013_config[0].demod_address)
			if (msg[i].addr == af9015_af9013_config[0].i2c_addr)
				req.cmd = READ_MEMORY;
			else
				req.cmd = READ_I2C;
@@ -307,7 +306,7 @@ Due to that the only way to select correct tuner is use demodulator I2C-gate.
				goto error;
			}
			if (msg[i].addr ==
				af9015_af9013_config[0].demod_address) {
				af9015_af9013_config[0].i2c_addr) {
				ret = -EINVAL;
				goto error;
			}
@@ -325,8 +324,7 @@ Due to that the only way to select correct tuner is use demodulator I2C-gate.
				ret = -EOPNOTSUPP;
				goto error;
			}
			if (msg[i].addr ==
				af9015_af9013_config[0].demod_address)
			if (msg[i].addr == af9015_af9013_config[0].i2c_addr)
				req.cmd = WRITE_MEMORY;
			else
				req.cmd = WRITE_I2C;
@@ -508,7 +506,7 @@ static int af9015_copy_firmware(struct dvb_usb_device *d)
	msleep(100);

	ret = af9015_read_reg_i2c(d,
		af9015_af9013_config[1].demod_address, 0x98be, &val);
		af9015_af9013_config[1].i2c_addr, 0x98be, &val);
	if (ret)
		goto error;
	else
@@ -536,7 +534,7 @@ static int af9015_copy_firmware(struct dvb_usb_device *d)
		goto error;

	/* request boot firmware */
	ret = af9015_write_reg_i2c(d, af9015_af9013_config[1].demod_address,
	ret = af9015_write_reg_i2c(d, af9015_af9013_config[1].i2c_addr,
		0xe205, 1);
	deb_info("%s: firmware boot cmd status:%d\n", __func__, ret);
	if (ret)
@@ -547,7 +545,7 @@ static int af9015_copy_firmware(struct dvb_usb_device *d)

		/* check firmware status */
		ret = af9015_read_reg_i2c(d,
			af9015_af9013_config[1].demod_address, 0x98be, &val);
			af9015_af9013_config[1].i2c_addr, 0x98be, &val);
		deb_info("%s: firmware status cmd status:%d fw status:%02x\n",
			__func__, ret, val);
		if (ret)
@@ -840,7 +838,7 @@ static int af9015_read_config(struct usb_device *udev)
	if (ret)
		goto error;

	deb_info("%s: IR mode:%d\n", __func__, val);
	deb_info("%s: IR mode=%d\n", __func__, val);
	for (i = 0; i < af9015_properties_count; i++) {
		if (val == AF9015_IR_MODE_DISABLED)
			af9015_properties[i].rc.core.rc_codes = NULL;
@@ -854,7 +852,7 @@ static int af9015_read_config(struct usb_device *udev)
	if (ret)
		goto error;
	af9015_config.dual_mode = val;
	deb_info("%s: TS mode:%d\n", __func__, af9015_config.dual_mode);
	deb_info("%s: TS mode=%d\n", __func__, af9015_config.dual_mode);

	/* Set adapter0 buffer size according to USB port speed, adapter1 buffer
	   size can be static because it is enabled only USB2.0 */
@@ -878,7 +876,7 @@ static int af9015_read_config(struct usb_device *udev)
		ret = af9015_rw_udev(udev, &req);
		if (ret)
			goto error;
		af9015_af9013_config[1].demod_address = val;
		af9015_af9013_config[1].i2c_addr = val;

		/* enable 2nd adapter */
		for (i = 0; i < af9015_properties_count; i++)
@@ -900,34 +898,38 @@ static int af9015_read_config(struct usb_device *udev)
			goto error;
		switch (val) {
		case 0:
			af9015_af9013_config[i].adc_clock = 28800;
			af9015_af9013_config[i].clock = 28800000;
			break;
		case 1:
			af9015_af9013_config[i].adc_clock = 20480;
			af9015_af9013_config[i].clock = 20480000;
			break;
		case 2:
			af9015_af9013_config[i].adc_clock = 28000;
			af9015_af9013_config[i].clock = 28000000;
			break;
		case 3:
			af9015_af9013_config[i].adc_clock = 25000;
			af9015_af9013_config[i].clock = 25000000;
			break;
		};
		deb_info("%s: [%d] xtal:%d set adc_clock:%d\n", __func__, i,
			val, af9015_af9013_config[i].adc_clock);
		deb_info("%s: [%d] xtal=%d set clock=%d\n", __func__, i,
			val, af9015_af9013_config[i].clock);

		/* tuner IF */
		/* IF frequency */
		req.addr = AF9015_EEPROM_IF1H + offset;
		ret = af9015_rw_udev(udev, &req);
		if (ret)
			goto error;
		af9015_af9013_config[i].tuner_if = val << 8;

		af9015_af9013_config[i].if_frequency = val << 8;

		req.addr = AF9015_EEPROM_IF1L + offset;
		ret = af9015_rw_udev(udev, &req);
		if (ret)
			goto error;
		af9015_af9013_config[i].tuner_if += val;
		deb_info("%s: [%d] IF1:%d\n", __func__, i,
			af9015_af9013_config[0].tuner_if);

		af9015_af9013_config[i].if_frequency += val;
		af9015_af9013_config[i].if_frequency *= 1000;
		deb_info("%s: [%d] IF frequency=%d\n", __func__, i,
			af9015_af9013_config[0].if_frequency);

		/* MT2060 IF1 */
		req.addr = AF9015_EEPROM_MT2060_IF1H  + offset;
@@ -940,7 +942,7 @@ static int af9015_read_config(struct usb_device *udev)
		if (ret)
			goto error;
		af9015_config.mt2060_if1[i] += val;
		deb_info("%s: [%d] MT2060 IF1:%d\n", __func__, i,
		deb_info("%s: [%d] MT2060 IF1=%d\n", __func__, i,
			af9015_config.mt2060_if1[i]);

		/* tuner */
@@ -957,30 +959,30 @@ static int af9015_read_config(struct usb_device *udev)
		case AF9013_TUNER_TDA18271:
		case AF9013_TUNER_QT1010A:
		case AF9013_TUNER_TDA18218:
			af9015_af9013_config[i].rf_spec_inv = 1;
			af9015_af9013_config[i].spec_inv = 1;
			break;
		case AF9013_TUNER_MXL5003D:
		case AF9013_TUNER_MXL5005D:
		case AF9013_TUNER_MXL5005R:
		case AF9013_TUNER_MXL5007T:
			af9015_af9013_config[i].rf_spec_inv = 0;
			af9015_af9013_config[i].spec_inv = 0;
			break;
		case AF9013_TUNER_MC44S803:
			af9015_af9013_config[i].gpio[1] = AF9013_GPIO_LO;
			af9015_af9013_config[i].rf_spec_inv = 1;
			af9015_af9013_config[i].spec_inv = 1;
			break;
		default:
			warn("tuner id:%d not supported, please report!", val);
			warn("tuner id=%d not supported, please report!", val);
			return -ENODEV;
		};

		af9015_af9013_config[i].tuner = val;
		deb_info("%s: [%d] tuner id:%d\n", __func__, i, val);
		deb_info("%s: [%d] tuner id=%d\n", __func__, i, val);
	}

error:
	if (ret)
		err("eeprom read failed:%d", ret);
		err("eeprom read failed=%d", ret);

	/* AverMedia AVerTV Volar Black HD (A850) device have bad EEPROM
	   content :-( Override some wrong values here. Ditto for the
@@ -998,7 +1000,7 @@ error:
			af9015_properties[i].num_adapters = 1;

		/* set correct IF */
		af9015_af9013_config[0].tuner_if = 4570;
		af9015_af9013_config[0].if_frequency = 4570000;
	}

	return ret;
@@ -1156,7 +1158,7 @@ static int af9015_af9013_sleep(struct dvb_frontend *fe)
	if (mutex_lock_interruptible(&adap->dev->usb_mutex))
		return -EAGAIN;

	ret = priv->init[adap->id](fe);
	ret = priv->sleep[adap->id](fe);

	mutex_unlock(&adap->dev->usb_mutex);

+868 −888

File changed.

Preview size limit exceeded, changes collapsed.

+61 −52
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
 * Afatech AF9013 demodulator driver
 *
 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
 *
 * Thanks to Afatech who kindly provided information.
 *
@@ -21,33 +22,11 @@
 *
 */

#ifndef _AF9013_H_
#define _AF9013_H_
#ifndef AF9013_H
#define AF9013_H

#include <linux/dvb/frontend.h>

enum af9013_ts_mode {
	AF9013_OUTPUT_MODE_PARALLEL,
	AF9013_OUTPUT_MODE_SERIAL,
	AF9013_OUTPUT_MODE_USB, /* only for AF9015 */
};

enum af9013_tuner {
	AF9013_TUNER_MXL5003D   =   3, /* MaxLinear */
	AF9013_TUNER_MXL5005D   =  13, /* MaxLinear */
	AF9013_TUNER_MXL5005R   =  30, /* MaxLinear */
	AF9013_TUNER_ENV77H11D5 = 129, /* Panasonic */
	AF9013_TUNER_MT2060     = 130, /* Microtune */
	AF9013_TUNER_MC44S803   = 133, /* Freescale */
	AF9013_TUNER_QT1010     = 134, /* Quantek */
	AF9013_TUNER_UNKNOWN    = 140, /* for can tuners ? */
	AF9013_TUNER_MT2060_2   = 147, /* Microtune */
	AF9013_TUNER_TDA18271   = 156, /* NXP */
	AF9013_TUNER_QT1010A    = 162, /* Quantek */
	AF9013_TUNER_MXL5007T   = 177, /* MaxLinear */
	AF9013_TUNER_TDA18218   = 179, /* NXP */
};

/* AF9013/5 GPIOs (mostly guessed)
   demod#1-gpio#0 - set demod#2 i2c-addr for dual devices
   demod#1-gpio#1 - xtal setting (?)
@@ -55,44 +34,74 @@ enum af9013_tuner {
   demod#2-gpio#0 - tuner#2
   demod#2-gpio#1 - xtal setting (?)
*/
#define AF9013_GPIO_ON (1 << 0)
#define AF9013_GPIO_EN (1 << 1)
#define AF9013_GPIO_O  (1 << 2)
#define AF9013_GPIO_I  (1 << 3)

#define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN)
#define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)

#define AF9013_GPIO_TUNER_ON  (AF9013_GPIO_ON|AF9013_GPIO_EN)
#define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)

struct af9013_config {
	/* demodulator's I2C address */
	u8 demod_address;
	/*
	 * I2C address
	 */
	u8 i2c_addr;

	/* frequencies in kHz */
	u32 adc_clock;
	/*
	 * clock
	 * 20480000, 25000000, 28000000, 28800000
	 */
	u32 clock;

	/* tuner ID */
	/*
	 * tuner
	 */
#define AF9013_TUNER_MXL5003D      3 /* MaxLinear */
#define AF9013_TUNER_MXL5005D     13 /* MaxLinear */
#define AF9013_TUNER_MXL5005R     30 /* MaxLinear */
#define AF9013_TUNER_ENV77H11D5  129 /* Panasonic */
#define AF9013_TUNER_MT2060      130 /* Microtune */
#define AF9013_TUNER_MC44S803    133 /* Freescale */
#define AF9013_TUNER_QT1010      134 /* Quantek */
#define AF9013_TUNER_UNKNOWN     140 /* for can tuners ? */
#define AF9013_TUNER_MT2060_2    147 /* Microtune */
#define AF9013_TUNER_TDA18271    156 /* NXP */
#define AF9013_TUNER_QT1010A     162 /* Quantek */
#define AF9013_TUNER_MXL5007T    177 /* MaxLinear */
#define AF9013_TUNER_TDA18218    179 /* NXP */
	u8 tuner;

	/* tuner IF */
	u16 tuner_if;
	/*
	 * IF frequency
	 */
	u32 if_frequency;

	/* TS data output mode */
	u8 output_mode:2;
	/*
	 * TS settings
	 */
#define AF9013_TS_USB       0
#define AF9013_TS_PARALLEL  1
#define AF9013_TS_SERIAL    2
	u8 ts_mode:2;

	/* RF spectrum inversion */
	u8 rf_spec_inv:1;
	/*
	 * input spectrum inversion
	 */
	bool spec_inv;

	/* API version */
	/*
	 * firmware API version
	 */
	u8 api_version[4];

	/* GPIOs */
	/*
	 * GPIOs
	 */
#define AF9013_GPIO_ON (1 << 0)
#define AF9013_GPIO_EN (1 << 1)
#define AF9013_GPIO_O  (1 << 2)
#define AF9013_GPIO_I  (1 << 3)
#define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN)
#define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
#define AF9013_GPIO_TUNER_ON  (AF9013_GPIO_ON|AF9013_GPIO_EN)
#define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
	u8 gpio[4];
};


#if defined(CONFIG_DVB_AF9013) || \
	(defined(CONFIG_DVB_AF9013_MODULE) && defined(MODULE))
extern struct dvb_frontend *af9013_attach(const struct af9013_config *config,
@@ -106,4 +115,4 @@ const struct af9013_config *config, struct i2c_adapter *i2c)
}
#endif /* CONFIG_DVB_AF9013 */

#endif /* _AF9013_H_ */
#endif /* AF9013_H */
+46 −47
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
 * Afatech AF9013 demodulator driver
 *
 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
 *
 * Thanks to Afatech who kindly provided information.
 *
@@ -21,24 +22,19 @@
 *
 */

#ifndef _AF9013_PRIV_
#define _AF9013_PRIV_
#ifndef AF9013_PRIV_H
#define AF9013_PRIV_H

#define LOG_PREFIX "af9013"
extern int af9013_debug;

#define dprintk(var, level, args...) \
	    do { if ((var & level)) printk(args); } while (0)
#include "dvb_frontend.h"
#include "af9013.h"
#include <linux/firmware.h>

#define debug_dump(b, l, func) {\
	int loop_; \
	for (loop_ = 0; loop_ < l; loop_++) \
		func("%02x ", b[loop_]); \
	func("\n");\
}

#define deb_info(args...) dprintk(af9013_debug, 0x01, args)
#define LOG_PREFIX "af9013"

#undef dbg
#define dbg(f, arg...) \
	if (af9013_debug) \
		printk(KERN_INFO   LOG_PREFIX": " f "\n" , ## arg)
#undef err
#define err(f, arg...)  printk(KERN_ERR     LOG_PREFIX": " f "\n" , ## arg)
#undef info
@@ -48,70 +44,71 @@ extern int af9013_debug;

#define AF9013_DEFAULT_FIRMWARE     "dvb-fe-af9013.fw"

struct regdesc {
struct af9013_reg_bit {
	u16 addr;
	u8  pos:4;
	u8  len:4;
	u8  val;
};

struct snr_table {
struct af9013_snr {
	u32 val;
	u8 snr;
};

struct coeff {
	u32 adc_clock;
	fe_bandwidth_t bw;
struct af9013_coeff {
	u32 clock;
	u32 bandwidth_hz;
	u8 val[24];
};

/* pre-calculated coeff lookup table */
static struct coeff coeff_table[] = {
static const struct af9013_coeff coeff_lut[] = {
	/* 28.800 MHz */
	{ 28800, BANDWIDTH_8_MHZ, { 0x02, 0x8a, 0x28, 0xa3, 0x05, 0x14,
	{ 28800000, 8000000, { 0x02, 0x8a, 0x28, 0xa3, 0x05, 0x14,
		0x51, 0x11, 0x00, 0xa2, 0x8f, 0x3d, 0x00, 0xa2, 0x8a,
		0x29, 0x00, 0xa2, 0x85, 0x14, 0x01, 0x45, 0x14, 0x14 } },
	{ 28800, BANDWIDTH_7_MHZ, { 0x02, 0x38, 0xe3, 0x8e, 0x04, 0x71,
	{ 28800000, 7000000, { 0x02, 0x38, 0xe3, 0x8e, 0x04, 0x71,
		0xc7, 0x07, 0x00, 0x8e, 0x3d, 0x55, 0x00, 0x8e, 0x38,
		0xe4, 0x00, 0x8e, 0x34, 0x72, 0x01, 0x1c, 0x71, 0x32 } },
	{ 28800, BANDWIDTH_6_MHZ, { 0x01, 0xe7, 0x9e, 0x7a, 0x03, 0xcf,
	{ 28800000, 6000000, { 0x01, 0xe7, 0x9e, 0x7a, 0x03, 0xcf,
		0x3c, 0x3d, 0x00, 0x79, 0xeb, 0x6e, 0x00, 0x79, 0xe7,
		0x9e, 0x00, 0x79, 0xe3, 0xcf, 0x00, 0xf3, 0xcf, 0x0f } },
	/* 20.480 MHz */
	{ 20480, BANDWIDTH_8_MHZ, { 0x03, 0x92, 0x49, 0x26, 0x07, 0x24,
	{ 20480000, 8000000, { 0x03, 0x92, 0x49, 0x26, 0x07, 0x24,
		0x92, 0x13, 0x00, 0xe4, 0x99, 0x6e, 0x00, 0xe4, 0x92,
		0x49, 0x00, 0xe4, 0x8b, 0x25, 0x01, 0xc9, 0x24, 0x25 } },
	{ 20480, BANDWIDTH_7_MHZ, { 0x03, 0x20, 0x00, 0x01, 0x06, 0x40,
	{ 20480000, 7000000, { 0x03, 0x20, 0x00, 0x01, 0x06, 0x40,
		0x00, 0x00, 0x00, 0xc8, 0x06, 0x40, 0x00, 0xc8, 0x00,
		0x00, 0x00, 0xc7, 0xf9, 0xc0, 0x01, 0x90, 0x00, 0x00 } },
	{ 20480, BANDWIDTH_6_MHZ, { 0x02, 0xad, 0xb6, 0xdc, 0x05, 0x5b,
	{ 20480000, 6000000, { 0x02, 0xad, 0xb6, 0xdc, 0x05, 0x5b,
		0x6d, 0x2e, 0x00, 0xab, 0x73, 0x13, 0x00, 0xab, 0x6d,
		0xb7, 0x00, 0xab, 0x68, 0x5c, 0x01, 0x56, 0xdb, 0x1c } },
	/* 28.000 MHz */
	{ 28000, BANDWIDTH_8_MHZ, { 0x02, 0x9c, 0xbc, 0x15, 0x05, 0x39,
	{ 28000000, 8000000, { 0x02, 0x9c, 0xbc, 0x15, 0x05, 0x39,
		0x78, 0x0a, 0x00, 0xa7, 0x34, 0x3f, 0x00, 0xa7, 0x2f,
		0x05, 0x00, 0xa7, 0x29, 0xcc, 0x01, 0x4e, 0x5e, 0x03 } },
	{ 28000, BANDWIDTH_7_MHZ, { 0x02, 0x49, 0x24, 0x92, 0x04, 0x92,
	{ 28000000, 7000000, { 0x02, 0x49, 0x24, 0x92, 0x04, 0x92,
		0x49, 0x09, 0x00, 0x92, 0x4d, 0xb7, 0x00, 0x92, 0x49,
		0x25, 0x00, 0x92, 0x44, 0x92, 0x01, 0x24, 0x92, 0x12 } },
	{ 28000, BANDWIDTH_6_MHZ, { 0x01, 0xf5, 0x8d, 0x10, 0x03, 0xeb,
	{ 28000000, 6000000, { 0x01, 0xf5, 0x8d, 0x10, 0x03, 0xeb,
		0x1a, 0x08, 0x00, 0x7d, 0x67, 0x2f, 0x00, 0x7d, 0x63,
		0x44, 0x00, 0x7d, 0x5f, 0x59, 0x00, 0xfa, 0xc6, 0x22 } },
	/* 25.000 MHz */
	{ 25000, BANDWIDTH_8_MHZ, { 0x02, 0xec, 0xfb, 0x9d, 0x05, 0xd9,
	{ 25000000, 8000000, { 0x02, 0xec, 0xfb, 0x9d, 0x05, 0xd9,
		0xf7, 0x0e, 0x00, 0xbb, 0x44, 0xc1, 0x00, 0xbb, 0x3e,
		0xe7, 0x00, 0xbb, 0x39, 0x0d, 0x01, 0x76, 0x7d, 0x34 } },
	{ 25000, BANDWIDTH_7_MHZ, { 0x02, 0x8f, 0x5c, 0x29, 0x05, 0x1e,
	{ 25000000, 7000000, { 0x02, 0x8f, 0x5c, 0x29, 0x05, 0x1e,
		0xb8, 0x14, 0x00, 0xa3, 0xdc, 0x29, 0x00, 0xa3, 0xd7,
		0x0a, 0x00, 0xa3, 0xd1, 0xec, 0x01, 0x47, 0xae, 0x05 } },
	{ 25000, BANDWIDTH_6_MHZ, { 0x02, 0x31, 0xbc, 0xb5, 0x04, 0x63,
	{ 25000000, 6000000, { 0x02, 0x31, 0xbc, 0xb5, 0x04, 0x63,
		0x79, 0x1b, 0x00, 0x8c, 0x73, 0x91, 0x00, 0x8c, 0x6f,
		0x2d, 0x00, 0x8c, 0x6a, 0xca, 0x01, 0x18, 0xde, 0x17 } },
};

/* QPSK SNR lookup table */
static struct snr_table qpsk_snr_table[] = {
static const struct af9013_snr qpsk_snr_lut[] = {
	{ 0x000000,  0 },
	{ 0x0b4771,  0 },
	{ 0x0c1aed,  1 },
	{ 0x0d0d27,  2 },
@@ -131,7 +128,8 @@ static struct snr_table qpsk_snr_table[] = {
};

/* QAM16 SNR lookup table */
static struct snr_table qam16_snr_table[] = {
static const struct af9013_snr qam16_snr_lut[] = {
	{ 0x000000,  0 },
	{ 0x05eb62,  5 },
	{ 0x05fecf,  6 },
	{ 0x060b80,  7 },
@@ -151,7 +149,8 @@ static struct snr_table qam16_snr_table[] = {
};

/* QAM64 SNR lookup table */
static struct snr_table qam64_snr_table[] = {
static const struct af9013_snr qam64_snr_lut[] = {
	{ 0x000000,  0 },
	{ 0x03109b, 12 },
	{ 0x0310d4, 13 },
	{ 0x031920, 14 },
@@ -170,7 +169,7 @@ static struct snr_table qam64_snr_table[] = {
	{ 0xffffff, 27 },
};

static struct regdesc ofsm_init[] = {
static const struct af9013_reg_bit ofsm_init[] = {
	{ 0xd73a, 0, 8, 0xa1 },
	{ 0xd73b, 0, 8, 0x1f },
	{ 0xd73c, 4, 4, 0x0a },
@@ -252,7 +251,7 @@ static struct regdesc ofsm_init[] = {

/* Panasonic ENV77H11D5 tuner init
   AF9013_TUNER_ENV77H11D5 = 129 */
static struct regdesc tuner_init_env77h11d5[] = {
static const struct af9013_reg_bit tuner_init_env77h11d5[] = {
	{ 0x9bd5, 0, 8, 0x01 },
	{ 0x9bd6, 0, 8, 0x03 },
	{ 0x9bbe, 0, 8, 0x01 },
@@ -318,7 +317,7 @@ static struct regdesc tuner_init_env77h11d5[] = {

/* Microtune MT2060 tuner init
   AF9013_TUNER_MT2060     = 130 */
static struct regdesc tuner_init_mt2060[] = {
static const struct af9013_reg_bit tuner_init_mt2060[] = {
	{ 0x9bd5, 0, 8, 0x01 },
	{ 0x9bd6, 0, 8, 0x07 },
	{ 0xd1a0, 1, 1, 0x01 },
@@ -395,7 +394,7 @@ static struct regdesc tuner_init_mt2060[] = {

/* Microtune MT2060 tuner init
   AF9013_TUNER_MT2060_2   = 147 */
static struct regdesc tuner_init_mt2060_2[] = {
static const struct af9013_reg_bit tuner_init_mt2060_2[] = {
	{ 0x9bd5, 0, 8, 0x01 },
	{ 0x9bd6, 0, 8, 0x06 },
	{ 0x9bbe, 0, 8, 0x01 },
@@ -462,7 +461,7 @@ static struct regdesc tuner_init_mt2060_2[] = {

/* MaxLinear MXL5003 tuner init
   AF9013_TUNER_MXL5003D   =   3 */
static struct regdesc tuner_init_mxl5003d[] = {
static const struct af9013_reg_bit tuner_init_mxl5003d[] = {
	{ 0x9bd5, 0, 8, 0x01 },
	{ 0x9bd6, 0, 8, 0x09 },
	{ 0xd1a0, 1, 1, 0x01 },
@@ -534,7 +533,7 @@ static struct regdesc tuner_init_mxl5003d[] = {
   AF9013_TUNER_MXL5005D   =  13
   AF9013_TUNER_MXL5005R   =  30
   AF9013_TUNER_MXL5007T   = 177 */
static struct regdesc tuner_init_mxl5005[] = {
static const struct af9013_reg_bit tuner_init_mxl5005[] = {
	{ 0x9bd5, 0, 8, 0x01 },
	{ 0x9bd6, 0, 8, 0x07 },
	{ 0xd1a0, 1, 1, 0x01 },
@@ -613,7 +612,7 @@ static struct regdesc tuner_init_mxl5005[] = {
/* Quantek QT1010 tuner init
   AF9013_TUNER_QT1010     = 134
   AF9013_TUNER_QT1010A    = 162 */
static struct regdesc tuner_init_qt1010[] = {
static const struct af9013_reg_bit tuner_init_qt1010[] = {
	{ 0x9bd5, 0, 8, 0x01 },
	{ 0x9bd6, 0, 8, 0x09 },
	{ 0xd1a0, 1, 1, 0x01 },
@@ -690,7 +689,7 @@ static struct regdesc tuner_init_qt1010[] = {

/* Freescale MC44S803 tuner init
   AF9013_TUNER_MC44S803   = 133 */
static struct regdesc tuner_init_mc44s803[] = {
static const struct af9013_reg_bit tuner_init_mc44s803[] = {
	{ 0x9bd5, 0, 8, 0x01 },
	{ 0x9bd6, 0, 8, 0x06 },
	{ 0xd1a0, 1, 1, 0x01 },
@@ -772,7 +771,7 @@ static struct regdesc tuner_init_mc44s803[] = {

/* unknown, probably for tin can tuner, tuner init
   AF9013_TUNER_UNKNOWN   = 140 */
static struct regdesc tuner_init_unknown[] = {
static const struct af9013_reg_bit tuner_init_unknown[] = {
	{ 0x9bd5, 0, 8, 0x01 },
	{ 0x9bd6, 0, 8, 0x02 },
	{ 0xd1a0, 1, 1, 0x01 },
@@ -845,7 +844,7 @@ static struct regdesc tuner_init_unknown[] = {
/* NXP TDA18271 & TDA18218 tuner init
   AF9013_TUNER_TDA18271   = 156
   AF9013_TUNER_TDA18218   = 179 */
static struct regdesc tuner_init_tda18271[] = {
static const struct af9013_reg_bit tuner_init_tda18271[] = {
	{ 0x9bd5, 0, 8, 0x01 },
	{ 0x9bd6, 0, 8, 0x04 },
	{ 0xd1a0, 1, 1, 0x01 },
@@ -920,4 +919,4 @@ static struct regdesc tuner_init_tda18271[] = {
	{ 0x9bee, 0, 1, 0x01 },
};

#endif /* _AF9013_PRIV_ */
#endif /* AF9013_PRIV_H */