2007-10-02 10:57:03 -04:00
|
|
|
/* tuner-xc2028
|
|
|
|
*
|
|
|
|
* Copyright (c) 2007 Mauro Carvalho Chehab (mchehab@infradead.org)
|
2007-10-29 22:44:18 -04:00
|
|
|
*
|
2007-07-18 09:29:10 -04:00
|
|
|
* Copyright (c) 2007 Michel Ludwig (michel.ludwig@gmail.com)
|
|
|
|
* - frontend interface
|
2007-10-29 22:44:18 -04:00
|
|
|
*
|
2007-10-02 10:57:03 -04:00
|
|
|
* This code is placed under the terms of the GNU General Public License v2
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <asm/div64.h>
|
|
|
|
#include <linux/firmware.h>
|
2007-11-01 16:47:42 -04:00
|
|
|
#include <linux/videodev2.h>
|
2007-10-02 10:57:03 -04:00
|
|
|
#include <linux/delay.h>
|
2007-07-18 09:29:10 -04:00
|
|
|
#include <media/tuner.h>
|
2007-09-27 17:27:03 -04:00
|
|
|
#include <linux/mutex.h>
|
2007-10-23 14:24:06 -04:00
|
|
|
#include "tuner-i2c.h"
|
2007-10-02 10:57:03 -04:00
|
|
|
#include "tuner-xc2028.h"
|
2007-10-24 08:22:08 -04:00
|
|
|
#include "tuner-xc2028-types.h"
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-07-18 09:29:10 -04:00
|
|
|
#include <linux/dvb/frontend.h>
|
|
|
|
#include "dvb_frontend.h"
|
|
|
|
|
2007-11-16 14:28:21 -05:00
|
|
|
|
2007-11-04 09:03:36 -05:00
|
|
|
#define PREFIX "xc2028"
|
2007-10-23 14:24:06 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
static int debug;
|
|
|
|
module_param(debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "enable verbose debug messages");
|
|
|
|
|
2007-11-15 09:58:00 -05:00
|
|
|
static char audio_std[8];
|
|
|
|
module_param_string(audio_std, audio_std, sizeof(audio_std), 0);
|
|
|
|
MODULE_PARM_DESC(audio_std,
|
|
|
|
"Audio standard. XC3028 audio decoder explicitly "
|
|
|
|
"needs to know what audio\n"
|
|
|
|
"standard is needed for some video standards with audio A2 or NICAM.\n"
|
|
|
|
"The valid values are:\n"
|
|
|
|
"A2\n"
|
|
|
|
"A2/A\n"
|
|
|
|
"A2/B\n"
|
|
|
|
"NICAM\n"
|
|
|
|
"NICAM/A\n"
|
|
|
|
"NICAM/B\n");
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
static LIST_HEAD(xc2028_list);
|
2007-11-19 02:45:38 -05:00
|
|
|
static DEFINE_MUTEX(xc2028_list_mutex);
|
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
/* struct for storing firmware table */
|
|
|
|
struct firmware_description {
|
|
|
|
unsigned int type;
|
|
|
|
v4l2_std_id id;
|
|
|
|
unsigned char *ptr;
|
|
|
|
unsigned int size;
|
|
|
|
};
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
struct firmware_properties {
|
|
|
|
unsigned int type;
|
|
|
|
v4l2_std_id id;
|
|
|
|
v4l2_std_id std_req;
|
|
|
|
unsigned int scode_table;
|
|
|
|
int scode_nr;
|
|
|
|
};
|
|
|
|
|
2007-10-02 10:57:03 -04:00
|
|
|
struct xc2028_data {
|
2007-10-23 14:24:06 -04:00
|
|
|
struct list_head xc2028_list;
|
|
|
|
struct tuner_i2c_props i2c_props;
|
|
|
|
int (*tuner_callback) (void *dev,
|
|
|
|
int command, int arg);
|
|
|
|
void *video_dev;
|
|
|
|
int count;
|
2007-10-24 08:22:08 -04:00
|
|
|
__u32 frequency;
|
|
|
|
|
|
|
|
struct firmware_description *firm;
|
|
|
|
int firm_size;
|
2007-11-19 04:06:08 -05:00
|
|
|
__u16 firm_version;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-19 09:35:45 -05:00
|
|
|
__u16 hwmodel;
|
|
|
|
__u16 hwvers;
|
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
struct xc2028_ctrl ctrl;
|
2007-10-23 14:24:06 -04:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
struct firmware_properties cur_fw;
|
2007-10-23 14:24:06 -04:00
|
|
|
|
|
|
|
struct mutex lock;
|
2007-10-02 10:57:03 -04:00
|
|
|
};
|
|
|
|
|
2007-11-19 02:14:23 -05:00
|
|
|
#define i2c_send(priv, buf, size) ({ \
|
|
|
|
int _rc; \
|
|
|
|
_rc = tuner_i2c_xfer_send(&priv->i2c_props, buf, size); \
|
|
|
|
if (size != _rc) \
|
|
|
|
tuner_info("i2c output error: rc = %d (should be %d)\n",\
|
|
|
|
_rc, (int)size); \
|
|
|
|
_rc; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define i2c_rcv(priv, buf, size) ({ \
|
|
|
|
int _rc; \
|
|
|
|
_rc = tuner_i2c_xfer_recv(&priv->i2c_props, buf, size); \
|
|
|
|
if (size != _rc) \
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("i2c input error: rc = %d (should be %d)\n", \
|
2007-11-19 02:14:23 -05:00
|
|
|
_rc, (int)size); \
|
|
|
|
_rc; \
|
|
|
|
})
|
2007-11-01 16:47:42 -04:00
|
|
|
|
2007-11-19 02:31:58 -05:00
|
|
|
#define i2c_send_recv(priv, obuf, osize, ibuf, isize) ({ \
|
|
|
|
int _rc; \
|
|
|
|
_rc = tuner_i2c_xfer_send_recv(&priv->i2c_props, obuf, osize, \
|
|
|
|
ibuf, isize); \
|
|
|
|
if (isize != _rc) \
|
|
|
|
tuner_err("i2c input error: rc = %d (should be %d)\n", \
|
|
|
|
_rc, (int)isize); \
|
|
|
|
_rc; \
|
|
|
|
})
|
|
|
|
|
2007-11-19 02:14:23 -05:00
|
|
|
#define send_seq(priv, data...) ({ \
|
2007-10-23 14:24:06 -04:00
|
|
|
static u8 _val[] = data; \
|
2007-11-19 02:14:23 -05:00
|
|
|
int _rc; \
|
2007-10-02 10:57:03 -04:00
|
|
|
if (sizeof(_val) != \
|
2007-11-19 02:14:23 -05:00
|
|
|
(_rc = tuner_i2c_xfer_send(&priv->i2c_props, \
|
2007-10-23 14:24:06 -04:00
|
|
|
_val, sizeof(_val)))) { \
|
2007-11-19 02:14:23 -05:00
|
|
|
tuner_err("Error on line %d: %d\n", __LINE__, _rc); \
|
|
|
|
} else \
|
|
|
|
msleep(10); \
|
|
|
|
_rc; \
|
|
|
|
})
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 02:31:58 -05:00
|
|
|
static unsigned int xc2028_get_reg(struct xc2028_data *priv, u16 reg, u16 *val)
|
2007-10-02 10:57:03 -04:00
|
|
|
{
|
2007-11-05 06:41:50 -05:00
|
|
|
unsigned char buf[2];
|
2007-11-19 02:31:58 -05:00
|
|
|
unsigned char ibuf[2];
|
2007-10-23 14:24:06 -04:00
|
|
|
|
2007-11-19 02:31:58 -05:00
|
|
|
tuner_dbg("%s %04x called\n", __FUNCTION__, reg);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 02:31:58 -05:00
|
|
|
buf[0] = reg >> 8;
|
2007-11-05 07:07:13 -05:00
|
|
|
buf[1] = (unsigned char) reg;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 02:31:58 -05:00
|
|
|
if (i2c_send_recv(priv, buf, 2, ibuf, 2) != 2)
|
|
|
|
return -EIO;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 02:31:58 -05:00
|
|
|
*val = (ibuf[1]) | (ibuf[0] << 8);
|
|
|
|
return 0;
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
|
|
|
|
2007-11-14 17:30:28 -05:00
|
|
|
void dump_firm_type(unsigned int type)
|
|
|
|
{
|
|
|
|
if (type & BASE)
|
|
|
|
printk("BASE ");
|
2007-11-15 06:43:53 -05:00
|
|
|
if (type & INIT1)
|
|
|
|
printk("INIT1 ");
|
2007-11-14 17:30:28 -05:00
|
|
|
if (type & F8MHZ)
|
|
|
|
printk("F8MHZ ");
|
|
|
|
if (type & MTS)
|
|
|
|
printk("MTS ");
|
|
|
|
if (type & D2620)
|
|
|
|
printk("D2620 ");
|
|
|
|
if (type & D2633)
|
|
|
|
printk("D2633 ");
|
|
|
|
if (type & DTV6)
|
|
|
|
printk("DTV6 ");
|
|
|
|
if (type & QAM)
|
|
|
|
printk("QAM ");
|
|
|
|
if (type & DTV7)
|
|
|
|
printk("DTV7 ");
|
|
|
|
if (type & DTV78)
|
|
|
|
printk("DTV78 ");
|
|
|
|
if (type & DTV8)
|
|
|
|
printk("DTV8 ");
|
|
|
|
if (type & FM)
|
|
|
|
printk("FM ");
|
|
|
|
if (type & INPUT1)
|
|
|
|
printk("INPUT1 ");
|
|
|
|
if (type & LCD)
|
|
|
|
printk("LCD ");
|
|
|
|
if (type & NOGD)
|
|
|
|
printk("NOGD ");
|
|
|
|
if (type & MONO)
|
|
|
|
printk("MONO ");
|
|
|
|
if (type & ATSC)
|
|
|
|
printk("ATSC ");
|
|
|
|
if (type & IF)
|
|
|
|
printk("IF ");
|
|
|
|
if (type & LG60)
|
|
|
|
printk("LG60 ");
|
|
|
|
if (type & ATI638)
|
|
|
|
printk("ATI638 ");
|
|
|
|
if (type & OREN538)
|
|
|
|
printk("OREN538 ");
|
|
|
|
if (type & OREN36)
|
|
|
|
printk("OREN36 ");
|
|
|
|
if (type & TOYOTA388)
|
|
|
|
printk("TOYOTA388 ");
|
|
|
|
if (type & TOYOTA794)
|
|
|
|
printk("TOYOTA794 ");
|
|
|
|
if (type & DIBCOM52)
|
|
|
|
printk("DIBCOM52 ");
|
|
|
|
if (type & ZARLINK456)
|
|
|
|
printk("ZARLINK456 ");
|
|
|
|
if (type & CHINA)
|
|
|
|
printk("CHINA ");
|
|
|
|
if (type & F6MHZ)
|
|
|
|
printk("F6MHZ ");
|
|
|
|
if (type & INPUT2)
|
|
|
|
printk("INPUT2 ");
|
|
|
|
if (type & SCODE)
|
|
|
|
printk("SCODE ");
|
|
|
|
}
|
|
|
|
|
2007-11-16 14:28:21 -05:00
|
|
|
static v4l2_std_id parse_audio_std_option(void)
|
2007-11-15 09:58:00 -05:00
|
|
|
{
|
2007-11-19 02:16:47 -05:00
|
|
|
if (strcasecmp(audio_std, "A2") == 0)
|
2007-11-15 09:58:00 -05:00
|
|
|
return V4L2_STD_A2;
|
2007-11-19 02:16:47 -05:00
|
|
|
if (strcasecmp(audio_std, "A2/A") == 0)
|
2007-11-15 09:58:00 -05:00
|
|
|
return V4L2_STD_A2_A;
|
2007-11-19 02:16:47 -05:00
|
|
|
if (strcasecmp(audio_std, "A2/B") == 0)
|
2007-11-15 09:58:00 -05:00
|
|
|
return V4L2_STD_A2_B;
|
2007-11-19 02:16:47 -05:00
|
|
|
if (strcasecmp(audio_std, "NICAM") == 0)
|
2007-11-15 09:58:00 -05:00
|
|
|
return V4L2_STD_NICAM;
|
2007-11-19 02:16:47 -05:00
|
|
|
if (strcasecmp(audio_std, "NICAM/A") == 0)
|
2007-11-15 09:58:00 -05:00
|
|
|
return V4L2_STD_NICAM_A;
|
2007-11-19 02:16:47 -05:00
|
|
|
if (strcasecmp(audio_std, "NICAM/B") == 0)
|
2007-11-15 09:58:00 -05:00
|
|
|
return V4L2_STD_NICAM_B;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
static void free_firmware(struct xc2028_data *priv)
|
2007-10-02 10:57:03 -04:00
|
|
|
{
|
2007-10-24 08:22:08 -04:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!priv->firm)
|
|
|
|
return;
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
for (i = 0; i < priv->firm_size; i++)
|
|
|
|
kfree(priv->firm[i].ptr);
|
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
kfree(priv->firm);
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
priv->firm = NULL;
|
2007-11-19 04:06:08 -05:00
|
|
|
priv->firm_size = 0;
|
2007-11-19 09:22:03 -05:00
|
|
|
|
|
|
|
memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));
|
2007-10-24 08:22:08 -04:00
|
|
|
}
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
static int load_all_firmwares(struct dvb_frontend *fe)
|
2007-10-24 08:22:08 -04:00
|
|
|
{
|
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
2007-11-01 16:47:42 -04:00
|
|
|
const struct firmware *fw = NULL;
|
2007-10-02 10:57:03 -04:00
|
|
|
unsigned char *p, *endp;
|
2007-11-01 16:47:42 -04:00
|
|
|
int rc = 0;
|
|
|
|
int n, n_array;
|
2007-10-24 08:22:08 -04:00
|
|
|
char name[33];
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-10-23 14:24:06 -04:00
|
|
|
|
2007-11-19 04:06:08 -05:00
|
|
|
tuner_dbg("Reading firmware %s\n", priv->ctrl.fname);
|
2007-11-16 05:46:14 -05:00
|
|
|
rc = request_firmware(&fw, priv->ctrl.fname,
|
|
|
|
&priv->i2c_props.adap->dev);
|
2007-10-02 10:57:03 -04:00
|
|
|
if (rc < 0) {
|
2007-11-01 16:47:42 -04:00
|
|
|
if (rc == -ENOENT)
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("Error: firmware %s not found.\n",
|
2007-10-24 08:22:08 -04:00
|
|
|
priv->ctrl.fname);
|
2007-07-18 12:33:23 -04:00
|
|
|
else
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("Error %d while requesting firmware %s \n",
|
2007-10-24 08:22:08 -04:00
|
|
|
rc, priv->ctrl.fname);
|
2007-07-18 12:33:23 -04:00
|
|
|
|
2007-10-02 10:57:03 -04:00
|
|
|
return rc;
|
|
|
|
}
|
2007-11-01 16:47:42 -04:00
|
|
|
p = fw->data;
|
|
|
|
endp = p + fw->size;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 04:06:08 -05:00
|
|
|
if (fw->size < sizeof(name) - 1 + 2 + 2) {
|
|
|
|
tuner_err("Error: firmware file %s has invalid size!\n",
|
|
|
|
priv->ctrl.fname);
|
|
|
|
goto corrupt;
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
memcpy(name, p, sizeof(name) - 1);
|
|
|
|
name[sizeof(name) - 1] = 0;
|
|
|
|
p += sizeof(name) - 1;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-19 04:06:08 -05:00
|
|
|
priv->firm_version = le16_to_cpu(*(__u16 *) p);
|
2007-10-24 08:22:08 -04:00
|
|
|
p += 2;
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
n_array = le16_to_cpu(*(__u16 *) p);
|
2007-10-24 08:22:08 -04:00
|
|
|
p += 2;
|
|
|
|
|
2007-11-19 04:06:08 -05:00
|
|
|
tuner_info("Loading %d firmware images from %s, type: %s, ver %d.%d\n",
|
|
|
|
n_array, priv->ctrl.fname, name,
|
|
|
|
priv->firm_version >> 8, priv->firm_version & 0xff);
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
priv->firm = kzalloc(sizeof(*priv->firm) * n_array, GFP_KERNEL);
|
2007-11-19 04:06:08 -05:00
|
|
|
if (priv->firm == NULL) {
|
|
|
|
tuner_err("Not enough memory to load firmware file.\n");
|
2007-11-01 16:47:42 -04:00
|
|
|
rc = -ENOMEM;
|
2007-11-19 04:06:08 -05:00
|
|
|
goto err;
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
2007-10-24 08:22:08 -04:00
|
|
|
priv->firm_size = n_array;
|
2007-11-19 04:06:08 -05:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
n = -1;
|
|
|
|
while (p < endp) {
|
2007-10-24 08:22:08 -04:00
|
|
|
__u32 type, size;
|
|
|
|
v4l2_std_id id;
|
|
|
|
|
|
|
|
n++;
|
|
|
|
if (n >= n_array) {
|
2007-11-19 04:06:08 -05:00
|
|
|
tuner_err("More firmware images in file than "
|
|
|
|
"were expected!\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
goto corrupt;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Checks if there's enough bytes to read */
|
2007-11-01 16:47:42 -04:00
|
|
|
if (p + sizeof(type) + sizeof(id) + sizeof(size) > endp) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("Firmware header is incomplete!\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
goto corrupt;
|
|
|
|
}
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
type = le32_to_cpu(*(__u32 *) p);
|
2007-10-24 08:22:08 -04:00
|
|
|
p += sizeof(type);
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
id = le64_to_cpu(*(v4l2_std_id *) p);
|
2007-10-24 08:22:08 -04:00
|
|
|
p += sizeof(id);
|
|
|
|
|
2007-11-16 05:19:35 -05:00
|
|
|
size = le32_to_cpu(*(__u32 *) p);
|
2007-10-24 08:22:08 -04:00
|
|
|
p += sizeof(size);
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
if ((!size) || (size + p > endp)) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("Firmware type ");
|
2007-11-14 17:30:28 -05:00
|
|
|
dump_firm_type(type);
|
2007-11-16 14:28:21 -05:00
|
|
|
printk("(%x), id %llx is corrupted "
|
|
|
|
"(size=%d, expected %d)\n",
|
2007-11-19 02:38:53 -05:00
|
|
|
type, (unsigned long long)id,
|
2007-11-16 14:28:21 -05:00
|
|
|
(unsigned)(endp - p), size);
|
2007-10-24 08:22:08 -04:00
|
|
|
goto corrupt;
|
|
|
|
}
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
priv->firm[n].ptr = kzalloc(size, GFP_KERNEL);
|
2007-11-19 04:06:08 -05:00
|
|
|
if (priv->firm[n].ptr == NULL) {
|
|
|
|
tuner_err("Not enough memory to load firmware file.\n");
|
2007-11-01 16:47:42 -04:00
|
|
|
rc = -ENOMEM;
|
2007-10-24 08:22:08 -04:00
|
|
|
goto err;
|
|
|
|
}
|
2007-11-19 04:06:08 -05:00
|
|
|
tuner_dbg("Reading firmware type ");
|
|
|
|
if (debug) {
|
|
|
|
dump_firm_type(type);
|
|
|
|
printk("(%x), id %llx, size=%d.\n",
|
|
|
|
type, (unsigned long long)id, size);
|
|
|
|
}
|
2007-10-24 08:22:08 -04:00
|
|
|
|
|
|
|
memcpy(priv->firm[n].ptr, p, size);
|
|
|
|
priv->firm[n].type = type;
|
|
|
|
priv->firm[n].id = id;
|
|
|
|
priv->firm[n].size = size;
|
|
|
|
|
|
|
|
p += size;
|
|
|
|
}
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
if (n + 1 != priv->firm_size) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("Firmware file is incomplete!\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
goto corrupt;
|
|
|
|
}
|
|
|
|
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
corrupt:
|
2007-11-01 16:47:42 -04:00
|
|
|
rc = -EINVAL;
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("Error: firmware file is corrupted!\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
|
|
|
|
err:
|
2007-11-19 04:06:08 -05:00
|
|
|
tuner_info("Releasing partially loaded firmware file.\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
free_firmware(priv);
|
|
|
|
|
|
|
|
done:
|
|
|
|
release_firmware(fw);
|
2007-11-19 04:06:08 -05:00
|
|
|
if (rc == 0)
|
|
|
|
tuner_dbg("Firmware files loaded.\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2007-11-15 06:43:53 -05:00
|
|
|
static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
|
|
|
|
v4l2_std_id *id)
|
2007-10-24 08:22:08 -04:00
|
|
|
{
|
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
2007-11-19 08:04:06 -05:00
|
|
|
int i, best_i = -1, best_nr_matches = 0;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-19 08:04:06 -05:00
|
|
|
tuner_dbg("%s called, want type=", __FUNCTION__);
|
|
|
|
if (debug) {
|
|
|
|
dump_firm_type(type);
|
|
|
|
printk("(%x), id %016llx.\n", type, (unsigned long long)*id);
|
|
|
|
}
|
2007-10-24 08:22:08 -04:00
|
|
|
|
|
|
|
if (!priv->firm) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("Error! firmware not loaded\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2007-11-15 06:43:53 -05:00
|
|
|
if (((type & ~SCODE) == 0) && (*id == 0))
|
2007-11-01 16:47:42 -04:00
|
|
|
*id = V4L2_STD_PAL;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
if (type & BASE)
|
|
|
|
type &= BASE_TYPES;
|
|
|
|
else if (type & SCODE)
|
|
|
|
type &= SCODE_TYPES;
|
|
|
|
else if (type & DTV_TYPES)
|
2007-11-19 21:18:36 -05:00
|
|
|
type &= DTV_TYPES;
|
|
|
|
else if (type & STD_SPECIFIC_TYPES)
|
|
|
|
type &= STD_SPECIFIC_TYPES;
|
2007-11-19 09:22:03 -05:00
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
/* Seek for exact match */
|
2007-11-01 16:47:42 -04:00
|
|
|
for (i = 0; i < priv->firm_size; i++) {
|
|
|
|
if ((type == priv->firm[i].type) && (*id == priv->firm[i].id))
|
2007-10-24 08:22:08 -04:00
|
|
|
goto found;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Seek for generic video standard match */
|
2007-11-01 16:47:42 -04:00
|
|
|
for (i = 0; i < priv->firm_size; i++) {
|
2007-11-19 08:04:06 -05:00
|
|
|
v4l2_std_id match_mask;
|
|
|
|
int nr_matches;
|
|
|
|
|
|
|
|
if (type != priv->firm[i].type)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
match_mask = *id & priv->firm[i].id;
|
|
|
|
if (!match_mask)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((*id & match_mask) == *id)
|
|
|
|
goto found; /* Supports all the requested standards */
|
|
|
|
|
|
|
|
nr_matches = hweight64(match_mask);
|
|
|
|
if (nr_matches > best_nr_matches) {
|
|
|
|
best_nr_matches = nr_matches;
|
|
|
|
best_i = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (best_nr_matches > 0) {
|
|
|
|
tuner_dbg("Selecting best matching firmware (%d bits) for "
|
|
|
|
"type=", best_nr_matches);
|
|
|
|
dump_firm_type(type);
|
|
|
|
printk("(%x), id %016llx:\n", type, (unsigned long long)*id);
|
|
|
|
i = best_i;
|
|
|
|
goto found;
|
2007-10-24 08:22:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*FIXME: Would make sense to seek for type "hint" match ? */
|
|
|
|
|
2007-11-19 08:04:06 -05:00
|
|
|
i = -ENOENT;
|
2007-11-15 06:43:53 -05:00
|
|
|
goto ret;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
|
|
|
found:
|
|
|
|
*id = priv->firm[i].id;
|
|
|
|
|
2007-11-15 06:43:53 -05:00
|
|
|
ret:
|
2007-11-19 08:04:06 -05:00
|
|
|
tuner_dbg("%s firmware for type=", (i < 0) ? "Can't find" : "Found");
|
2007-11-15 07:44:30 -05:00
|
|
|
if (debug) {
|
|
|
|
dump_firm_type(type);
|
2007-11-19 02:38:53 -05:00
|
|
|
printk("(%x), id %016llx.\n", type, (unsigned long long)*id);
|
2007-11-15 07:44:30 -05:00
|
|
|
}
|
2007-11-15 06:43:53 -05:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int load_firmware(struct dvb_frontend *fe, unsigned int type,
|
|
|
|
v4l2_std_id *id)
|
|
|
|
{
|
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
|
|
|
int pos, rc;
|
2007-11-19 07:29:59 -05:00
|
|
|
unsigned char *p, *endp, buf[priv->ctrl.max_len];
|
2007-11-15 06:43:53 -05:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-11-15 06:43:53 -05:00
|
|
|
|
|
|
|
pos = seek_firmware(fe, type, id);
|
|
|
|
if (pos < 0)
|
|
|
|
return pos;
|
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_info("Loading firmware for type=");
|
2007-11-19 08:04:06 -05:00
|
|
|
dump_firm_type(priv->firm[pos].type);
|
|
|
|
printk("(%x), id %016llx.\n", priv->firm[pos].type,
|
|
|
|
(unsigned long long)*id);
|
2007-11-15 07:44:30 -05:00
|
|
|
|
2007-11-15 06:43:53 -05:00
|
|
|
p = priv->firm[pos].ptr;
|
|
|
|
endp = p + priv->firm[pos].size;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
while (p < endp) {
|
2007-10-24 08:22:08 -04:00
|
|
|
__u16 size;
|
|
|
|
|
|
|
|
/* Checks if there's enough bytes to read */
|
2007-11-01 16:47:42 -04:00
|
|
|
if (p + sizeof(size) > endp) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("Firmware chunk size is wrong\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
size = le16_to_cpu(*(__u16 *) p);
|
2007-10-24 08:22:08 -04:00
|
|
|
p += sizeof(size);
|
|
|
|
|
|
|
|
if (size == 0xffff)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (!size) {
|
2007-10-02 10:57:03 -04:00
|
|
|
/* Special callback command received */
|
2007-10-23 14:24:06 -04:00
|
|
|
rc = priv->tuner_callback(priv->video_dev,
|
2007-11-01 16:47:42 -04:00
|
|
|
XC2028_TUNER_RESET, 0);
|
|
|
|
if (rc < 0) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("Error at RESET code %d\n",
|
2007-11-01 16:47:42 -04:00
|
|
|
(*p) & 0x7f);
|
2007-10-24 08:22:08 -04:00
|
|
|
return -EINVAL;
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2007-11-16 05:49:49 -05:00
|
|
|
if (size >= 0xff00) {
|
|
|
|
switch (size) {
|
|
|
|
case 0xff00:
|
|
|
|
rc = priv->tuner_callback(priv->video_dev,
|
|
|
|
XC2028_RESET_CLK, 0);
|
|
|
|
if (rc < 0) {
|
|
|
|
tuner_err("Error at RESET code %d\n",
|
|
|
|
(*p) & 0x7f);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2007-11-19 02:53:50 -05:00
|
|
|
break;
|
2007-11-16 05:49:49 -05:00
|
|
|
default:
|
|
|
|
tuner_info("Invalid RESET code %d\n",
|
|
|
|
size & 0x7f);
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
}
|
2007-11-16 07:43:19 -05:00
|
|
|
continue;
|
2007-11-16 05:49:49 -05:00
|
|
|
}
|
2007-10-24 08:22:08 -04:00
|
|
|
|
|
|
|
/* Checks for a sleep command */
|
|
|
|
if (size & 0x8000) {
|
2007-11-01 16:47:42 -04:00
|
|
|
msleep(size & 0x7fff);
|
2007-10-24 08:22:08 -04:00
|
|
|
continue;
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
if ((size + p > endp)) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("missing bytes: need %d, have %d\n",
|
2007-11-01 16:47:42 -04:00
|
|
|
size, (int)(endp - p));
|
2007-10-24 08:22:08 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
buf[0] = *p;
|
2007-10-02 10:57:03 -04:00
|
|
|
p++;
|
2007-10-24 08:22:08 -04:00
|
|
|
size--;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
/* Sends message chunks */
|
2007-11-01 16:47:42 -04:00
|
|
|
while (size > 0) {
|
2007-11-19 07:29:59 -05:00
|
|
|
int len = (size < priv->ctrl.max_len - 1) ?
|
|
|
|
size : priv->ctrl.max_len - 1;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
memcpy(buf + 1, p, len);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 02:14:23 -05:00
|
|
|
rc = i2c_send(priv, buf, len + 1);
|
2007-11-01 16:47:42 -04:00
|
|
|
if (rc < 0) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("%d returned from send\n", rc);
|
2007-10-24 08:22:08 -04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
p += len;
|
|
|
|
size -= len;
|
|
|
|
}
|
|
|
|
}
|
2007-11-14 17:30:28 -05:00
|
|
|
return 0;
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
|
|
|
|
2007-11-15 06:43:53 -05:00
|
|
|
static int load_scode(struct dvb_frontend *fe, unsigned int type,
|
|
|
|
v4l2_std_id *id, int scode)
|
|
|
|
{
|
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
|
|
|
int pos, rc;
|
|
|
|
unsigned char *p;
|
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-11-15 06:43:53 -05:00
|
|
|
|
|
|
|
pos = seek_firmware(fe, type, id);
|
|
|
|
if (pos < 0)
|
|
|
|
return pos;
|
|
|
|
|
|
|
|
p = priv->firm[pos].ptr;
|
|
|
|
|
2007-11-19 08:12:45 -05:00
|
|
|
/* 16 SCODE entries per file; each SCODE entry is 12 bytes and
|
|
|
|
* has a 2-byte size header in the firmware format. */
|
|
|
|
if (priv->firm[pos].size != 14 * 16 || scode >= 16 ||
|
|
|
|
le16_to_cpu(*(__u16 *)(p + 14 * scode)) != 12)
|
2007-11-15 06:43:53 -05:00
|
|
|
return -EINVAL;
|
|
|
|
|
2007-11-19 08:12:45 -05:00
|
|
|
tuner_info("Loading SCODE for type=");
|
|
|
|
dump_firm_type(priv->firm[pos].type);
|
|
|
|
printk("(%x), id %016llx.\n", priv->firm[pos].type,
|
|
|
|
(unsigned long long)*id);
|
|
|
|
|
2007-11-19 04:06:08 -05:00
|
|
|
if (priv->firm_version < 0x0202)
|
2007-11-19 02:14:23 -05:00
|
|
|
rc = send_seq(priv, {0x20, 0x00, 0x00, 0x00});
|
|
|
|
else
|
|
|
|
rc = send_seq(priv, {0xa0, 0x00, 0x00, 0x00});
|
|
|
|
if (rc < 0)
|
|
|
|
return -EIO;
|
2007-11-15 06:43:53 -05:00
|
|
|
|
2007-11-19 08:12:45 -05:00
|
|
|
rc = i2c_send(priv, p + 14 * scode + 2, 12);
|
2007-11-19 02:14:23 -05:00
|
|
|
if (rc < 0)
|
|
|
|
return -EIO;
|
2007-11-15 06:43:53 -05:00
|
|
|
|
2007-11-19 02:14:23 -05:00
|
|
|
rc = send_seq(priv, {0x00, 0x8c});
|
|
|
|
if (rc < 0)
|
|
|
|
return -EIO;
|
2007-11-15 06:43:53 -05:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
|
2007-11-01 16:47:42 -04:00
|
|
|
v4l2_std_id std, fe_bandwidth_t bandwidth)
|
2007-10-02 10:57:03 -04:00
|
|
|
{
|
2007-10-23 14:24:06 -04:00
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
2007-11-19 09:35:45 -05:00
|
|
|
int rc = 0, is_retry = 0;
|
2007-11-19 09:22:03 -05:00
|
|
|
unsigned int type = 0;
|
|
|
|
struct firmware_properties new_fw;
|
2007-11-19 02:31:58 -05:00
|
|
|
u16 version, hwmodel;
|
2007-11-19 21:11:37 -05:00
|
|
|
v4l2_std_id std0;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
if (!priv->firm) {
|
2007-11-16 05:46:14 -05:00
|
|
|
if (!priv->ctrl.fname) {
|
|
|
|
tuner_info("xc2028/3028 firmware name not set!\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
return -EINVAL;
|
2007-11-16 05:46:14 -05:00
|
|
|
}
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
rc = load_all_firmwares(fe);
|
|
|
|
if (rc < 0)
|
2007-10-24 08:22:08 -04:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2007-11-22 10:08:53 -05:00
|
|
|
if (priv->ctrl.mts)
|
2007-11-19 09:22:03 -05:00
|
|
|
type |= MTS;
|
|
|
|
if (bandwidth == BANDWIDTH_7_MHZ || bandwidth == BANDWIDTH_8_MHZ)
|
|
|
|
type |= F8MHZ;
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
/* FIXME: How to load FM and FM|INPUT1 firmwares? */
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
if (new_mode == T_DIGITAL_TV) {
|
2007-11-19 08:23:17 -05:00
|
|
|
if (priv->ctrl.d2633)
|
|
|
|
type |= D2633;
|
|
|
|
else
|
|
|
|
type |= D2620;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
switch (bandwidth) {
|
2007-10-24 08:22:08 -04:00
|
|
|
case BANDWIDTH_8_MHZ:
|
|
|
|
type |= DTV8;
|
2007-07-18 09:29:10 -04:00
|
|
|
break;
|
2007-10-24 08:22:08 -04:00
|
|
|
case BANDWIDTH_7_MHZ:
|
|
|
|
type |= DTV7;
|
2007-07-18 09:29:10 -04:00
|
|
|
break;
|
2007-10-24 08:22:08 -04:00
|
|
|
case BANDWIDTH_6_MHZ:
|
|
|
|
/* FIXME: Should allow select also ATSC */
|
2007-11-14 17:30:28 -05:00
|
|
|
type |= DTV6 | QAM;
|
2007-07-18 09:29:10 -04:00
|
|
|
break;
|
2007-10-24 08:22:08 -04:00
|
|
|
default:
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("error: bandwidth not supported.\n");
|
2007-07-18 09:29:10 -04:00
|
|
|
};
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
|
|
|
|
2007-11-19 09:35:45 -05:00
|
|
|
retry:
|
2007-11-19 09:22:03 -05:00
|
|
|
new_fw.type = type;
|
|
|
|
new_fw.id = std;
|
|
|
|
new_fw.std_req = std;
|
|
|
|
new_fw.scode_table = SCODE | priv->ctrl.scode_table;
|
|
|
|
new_fw.scode_nr = 0;
|
|
|
|
|
|
|
|
tuner_dbg("checking firmware, user requested type=");
|
|
|
|
if (debug) {
|
|
|
|
dump_firm_type(new_fw.type);
|
|
|
|
printk("(%x), id %016llx, scode_tbl ", new_fw.type,
|
|
|
|
(unsigned long long)new_fw.std_req);
|
|
|
|
dump_firm_type(priv->ctrl.scode_table);
|
|
|
|
printk("(%x), scode_nr %d\n", priv->ctrl.scode_table,
|
|
|
|
new_fw.scode_nr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No need to reload base firmware if it matches */
|
|
|
|
if (((BASE | new_fw.type) & BASE_TYPES) ==
|
|
|
|
(priv->cur_fw.type & BASE_TYPES)) {
|
|
|
|
tuner_dbg("BASE firmware not changed.\n");
|
|
|
|
goto skip_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Updating BASE - forget about all currently loaded firmware */
|
|
|
|
memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));
|
|
|
|
|
|
|
|
/* Reset is needed before loading firmware */
|
|
|
|
rc = priv->tuner_callback(priv->video_dev,
|
|
|
|
XC2028_TUNER_RESET, 0);
|
|
|
|
if (rc < 0)
|
|
|
|
goto fail;
|
|
|
|
|
2007-11-19 21:11:37 -05:00
|
|
|
/* BASE firmwares are all std0 */
|
|
|
|
std0 = 0;
|
|
|
|
rc = load_firmware(fe, BASE | new_fw.type, &std0);
|
2007-11-19 09:22:03 -05:00
|
|
|
if (rc < 0) {
|
|
|
|
tuner_err("Error %d while loading base firmware\n",
|
|
|
|
rc);
|
|
|
|
goto fail;
|
|
|
|
}
|
2007-11-16 05:49:49 -05:00
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
/* Load INIT1, if needed */
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("Load init1 firmware, if exists\n");
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-19 21:11:37 -05:00
|
|
|
rc = load_firmware(fe, BASE | INIT1 | new_fw.type, &std0);
|
2007-11-19 21:43:13 -05:00
|
|
|
if (rc == -ENOENT)
|
|
|
|
rc = load_firmware(fe, (BASE | INIT1 | new_fw.type) & ~F8MHZ,
|
|
|
|
&std0);
|
2007-11-19 09:22:03 -05:00
|
|
|
if (rc < 0 && rc != -ENOENT) {
|
|
|
|
tuner_err("Error %d while loading init1 firmware\n",
|
|
|
|
rc);
|
|
|
|
goto fail;
|
|
|
|
}
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
skip_base:
|
|
|
|
/*
|
|
|
|
* No need to reload standard specific firmware if base firmware
|
|
|
|
* was not reloaded and requested video standards have not changed.
|
2007-10-24 08:22:08 -04:00
|
|
|
*/
|
2007-11-19 09:22:03 -05:00
|
|
|
if (priv->cur_fw.type == (BASE | new_fw.type) &&
|
|
|
|
priv->cur_fw.std_req == std) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("Std-specific firmware already loaded.\n");
|
2007-11-19 09:22:03 -05:00
|
|
|
goto skip_std_specific;
|
2007-07-18 12:33:23 -04:00
|
|
|
}
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
/* Reloading std-specific firmware forces a SCODE update */
|
|
|
|
priv->cur_fw.scode_table = 0;
|
|
|
|
|
2007-11-15 09:58:00 -05:00
|
|
|
/* Add audio hack to std mask */
|
2007-11-19 09:22:03 -05:00
|
|
|
if (new_mode == T_ANALOG_TV)
|
|
|
|
new_fw.id |= parse_audio_std_option();
|
2007-11-15 09:58:00 -05:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
rc = load_firmware(fe, new_fw.type, &new_fw.id);
|
2007-11-01 16:47:42 -04:00
|
|
|
if (rc < 0)
|
2007-11-19 09:22:03 -05:00
|
|
|
goto fail;
|
|
|
|
|
|
|
|
skip_std_specific:
|
|
|
|
if (priv->cur_fw.scode_table == new_fw.scode_table &&
|
|
|
|
priv->cur_fw.scode_nr == new_fw.scode_nr) {
|
|
|
|
tuner_dbg("SCODE firmware already loaded.\n");
|
|
|
|
goto check_device;
|
|
|
|
}
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-15 06:43:53 -05:00
|
|
|
/* Load SCODE firmware, if exists */
|
2007-11-19 09:22:03 -05:00
|
|
|
tuner_dbg("Trying to load scode %d\n", new_fw.scode_nr);
|
2007-11-15 06:43:53 -05:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
rc = load_scode(fe, new_fw.type | new_fw.scode_table,
|
|
|
|
&new_fw.id, new_fw.scode_nr);
|
2007-11-14 17:30:28 -05:00
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
check_device:
|
2007-11-19 09:35:45 -05:00
|
|
|
if (xc2028_get_reg(priv, 0x0004, &version) < 0 ||
|
|
|
|
xc2028_get_reg(priv, 0x0008, &hwmodel) < 0) {
|
|
|
|
tuner_err("Unable to read tuner registers.\n");
|
|
|
|
goto fail;
|
|
|
|
}
|
2007-11-05 07:07:13 -05:00
|
|
|
|
|
|
|
tuner_info("Device is Xceive %d version %d.%d, "
|
|
|
|
"firmware version %d.%d\n",
|
|
|
|
hwmodel, (version & 0xf000) >> 12, (version & 0xf00) >> 8,
|
|
|
|
(version & 0xf0) >> 4, version & 0xf);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 09:35:45 -05:00
|
|
|
/* Check firmware version against what we downloaded. */
|
|
|
|
if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) {
|
|
|
|
tuner_err("Incorrect readback of firmware version.\n");
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that the tuner hardware model remains consistent over time. */
|
|
|
|
if (priv->hwmodel == 0 && (hwmodel == 2028 || hwmodel == 3028)) {
|
|
|
|
priv->hwmodel = hwmodel;
|
|
|
|
priv->hwvers = version & 0xff00;
|
|
|
|
} else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel ||
|
|
|
|
priv->hwvers != (version & 0xff00)) {
|
|
|
|
tuner_err("Read invalid device hardware information - tuner "
|
|
|
|
"hung?\n");
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
memcpy(&priv->cur_fw, &new_fw, sizeof(priv->cur_fw));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* By setting BASE in cur_fw.type only after successfully loading all
|
|
|
|
* firmwares, we can:
|
|
|
|
* 1. Identify that BASE firmware with type=0 has been loaded;
|
|
|
|
* 2. Tell whether BASE firmware was just changed the next time through.
|
|
|
|
*/
|
|
|
|
priv->cur_fw.type |= BASE;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
|
|
|
return 0;
|
2007-11-19 09:22:03 -05:00
|
|
|
|
|
|
|
fail:
|
|
|
|
memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));
|
2007-11-19 09:35:45 -05:00
|
|
|
if (!is_retry) {
|
|
|
|
msleep(50);
|
|
|
|
is_retry = 1;
|
|
|
|
tuner_dbg("Retrying firmware load\n");
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
|
2007-11-19 09:22:03 -05:00
|
|
|
if (rc == -ENOENT)
|
|
|
|
rc = -EINVAL;
|
|
|
|
return rc;
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
static int xc2028_signal(struct dvb_frontend *fe, u16 *strength)
|
2007-10-02 10:57:03 -04:00
|
|
|
{
|
2007-10-23 14:24:06 -04:00
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
2007-11-19 02:31:58 -05:00
|
|
|
u16 frq_lock, signal = 0;
|
|
|
|
int rc;
|
2007-09-27 17:27:03 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
mutex_lock(&priv->lock);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-05 07:07:13 -05:00
|
|
|
/* Sync Lock Indicator */
|
2007-11-19 02:31:58 -05:00
|
|
|
rc = xc2028_get_reg(priv, 0x0002, &frq_lock);
|
|
|
|
if (rc < 0 || frq_lock == 0)
|
2007-09-27 17:27:03 -04:00
|
|
|
goto ret;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
|
|
|
/* Frequency is locked. Return signal quality */
|
|
|
|
|
2007-11-05 07:07:13 -05:00
|
|
|
/* Get SNR of the video signal */
|
2007-11-19 02:31:58 -05:00
|
|
|
rc = xc2028_get_reg(priv, 0x0040, &signal);
|
|
|
|
if (rc < 0)
|
|
|
|
signal = -frq_lock;
|
2007-09-27 17:27:03 -04:00
|
|
|
|
|
|
|
ret:
|
2007-10-23 14:24:06 -04:00
|
|
|
mutex_unlock(&priv->lock);
|
|
|
|
|
|
|
|
*strength = signal;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 02:31:58 -05:00
|
|
|
return rc;
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define DIV 15625
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ ,
|
|
|
|
enum tuner_mode new_mode,
|
|
|
|
v4l2_std_id std, fe_bandwidth_t bandwidth)
|
2007-10-02 10:57:03 -04:00
|
|
|
{
|
2007-10-23 14:24:06 -04:00
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
2007-11-01 16:47:42 -04:00
|
|
|
int rc = -EINVAL;
|
2007-11-19 04:20:17 -05:00
|
|
|
unsigned char buf[4];
|
2007-11-01 16:47:42 -04:00
|
|
|
u32 div, offset = 0;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-10-23 14:24:06 -04:00
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
mutex_lock(&priv->lock);
|
|
|
|
|
2007-07-18 22:14:25 -04:00
|
|
|
/* HACK: It seems that specific firmware need to be reloaded
|
2007-11-19 09:22:03 -05:00
|
|
|
when watching analog TV and freq is changed */
|
|
|
|
if (new_mode != T_DIGITAL_TV)
|
|
|
|
priv->cur_fw.type = 0;
|
2007-10-23 14:24:06 -04:00
|
|
|
|
2007-11-19 04:20:17 -05:00
|
|
|
tuner_dbg("should set frequency %d kHz\n", freq / 1000);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
if (check_firmware(fe, new_mode, std, bandwidth) < 0)
|
2007-09-27 17:27:03 -04:00
|
|
|
goto ret;
|
2007-07-18 12:33:23 -04:00
|
|
|
|
2007-11-19 04:35:26 -05:00
|
|
|
if (new_mode == T_DIGITAL_TV) {
|
2007-07-18 22:14:25 -04:00
|
|
|
offset = 2750000;
|
2007-11-19 09:22:03 -05:00
|
|
|
if (priv->cur_fw.type & DTV7)
|
2007-11-19 04:35:26 -05:00
|
|
|
offset -= 500000;
|
|
|
|
}
|
2007-07-18 12:33:23 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
div = (freq - offset + DIV / 2) / DIV;
|
2007-07-18 12:33:23 -04:00
|
|
|
|
2007-10-02 10:57:03 -04:00
|
|
|
/* CMD= Set frequency */
|
2007-11-19 04:06:08 -05:00
|
|
|
if (priv->firm_version < 0x0202)
|
2007-11-19 02:14:23 -05:00
|
|
|
rc = send_seq(priv, {0x00, 0x02, 0x00, 0x00});
|
|
|
|
else
|
|
|
|
rc = send_seq(priv, {0x80, 0x02, 0x00, 0x00});
|
|
|
|
if (rc < 0)
|
|
|
|
goto ret;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
rc = priv->tuner_callback(priv->video_dev, XC2028_RESET_CLK, 1);
|
2007-11-01 16:47:42 -04:00
|
|
|
if (rc < 0)
|
2007-10-23 14:24:06 -04:00
|
|
|
goto ret;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
|
|
|
msleep(10);
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
buf[0] = 0xff & (div >> 24);
|
|
|
|
buf[1] = 0xff & (div >> 16);
|
|
|
|
buf[2] = 0xff & (div >> 8);
|
|
|
|
buf[3] = 0xff & (div);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-19 02:14:23 -05:00
|
|
|
rc = i2c_send(priv, buf, sizeof(buf));
|
2007-11-01 16:47:42 -04:00
|
|
|
if (rc < 0)
|
2007-09-27 17:27:03 -04:00
|
|
|
goto ret;
|
2007-10-02 10:57:03 -04:00
|
|
|
msleep(100);
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
priv->frequency = freq;
|
2007-10-23 14:24:06 -04:00
|
|
|
|
2007-11-19 04:20:17 -05:00
|
|
|
tuner_dbg("divisor= %02x %02x %02x %02x (freq=%d.%03d)\n",
|
|
|
|
buf[0], buf[1], buf[2], buf[3],
|
|
|
|
freq / 1000000, (freq % 1000000) / 1000);
|
2007-09-27 17:27:03 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
rc = 0;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
ret:
|
|
|
|
mutex_unlock(&priv->lock);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
return rc;
|
2007-07-18 09:29:10 -04:00
|
|
|
}
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
static int xc2028_set_tv_freq(struct dvb_frontend *fe,
|
2007-11-01 16:47:42 -04:00
|
|
|
struct analog_parameters *p)
|
2007-10-02 10:57:03 -04:00
|
|
|
{
|
2007-10-23 14:24:06 -04:00
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
2007-11-22 09:47:18 -05:00
|
|
|
fe_bandwidth_t bw;
|
|
|
|
|
2007-11-23 09:36:18 -05:00
|
|
|
/* if std is not defined, choose one */
|
|
|
|
if (!p->std)
|
|
|
|
p->std = V4L2_STD_MN;
|
|
|
|
|
|
|
|
/* PAL/M, PAL/N, PAL/Nc and NTSC variants should use 6MHz firmware */
|
2007-11-22 09:47:18 -05:00
|
|
|
if (p->std & V4L2_STD_MN)
|
|
|
|
bw = BANDWIDTH_6_MHZ;
|
|
|
|
else
|
|
|
|
bw = BANDWIDTH_8_MHZ;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
return generic_set_tv_freq(fe, 62500l * p->frequency, T_ANALOG_TV,
|
2007-11-22 09:47:18 -05:00
|
|
|
p->std, bw);
|
2007-10-23 14:24:06 -04:00
|
|
|
}
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
static int xc2028_set_params(struct dvb_frontend *fe,
|
|
|
|
struct dvb_frontend_parameters *p)
|
2007-10-02 10:57:03 -04:00
|
|
|
{
|
2007-10-23 14:24:06 -04:00
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
2007-10-02 10:57:03 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
/* FIXME: Only OFDM implemented */
|
|
|
|
if (fe->ops.info.type != FE_OFDM) {
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_err("DTV type not implemented.\n");
|
2007-10-23 14:24:06 -04:00
|
|
|
return -EINVAL;
|
2007-10-02 10:57:03 -04:00
|
|
|
}
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
return generic_set_tv_freq(fe, p->frequency, T_DIGITAL_TV,
|
2007-11-01 16:47:42 -04:00
|
|
|
0 /* NOT USED */,
|
|
|
|
p->u.ofdm.bandwidth);
|
2007-10-02 10:57:03 -04:00
|
|
|
|
|
|
|
}
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-11-19 09:41:20 -05:00
|
|
|
static int xc2028_sleep(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
|
|
|
|
|
|
|
mutex_lock(&priv->lock);
|
|
|
|
|
|
|
|
if (priv->firm_version < 0x0202)
|
|
|
|
rc = send_seq(priv, {0x00, 0x08, 0x00, 0x00});
|
|
|
|
else
|
|
|
|
rc = send_seq(priv, {0x80, 0x08, 0x00, 0x00});
|
|
|
|
|
|
|
|
priv->cur_fw.type = 0; /* need firmware reload */
|
|
|
|
|
|
|
|
mutex_unlock(&priv->lock);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
static int xc2028_dvb_release(struct dvb_frontend *fe)
|
2007-07-18 09:29:10 -04:00
|
|
|
{
|
2007-10-23 14:24:06 -04:00
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-11-19 02:45:38 -05:00
|
|
|
mutex_lock(&xc2028_list_mutex);
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
priv->count--;
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
if (!priv->count) {
|
2007-10-29 16:38:59 -04:00
|
|
|
list_del(&priv->xc2028_list);
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
kfree(priv->ctrl.fname);
|
2007-10-24 08:22:08 -04:00
|
|
|
|
|
|
|
free_firmware(priv);
|
2007-11-01 16:47:42 -04:00
|
|
|
kfree(priv);
|
2007-11-19 04:06:08 -05:00
|
|
|
fe->tuner_priv = NULL;
|
2007-10-24 08:22:08 -04:00
|
|
|
}
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-11-19 02:45:38 -05:00
|
|
|
mutex_unlock(&xc2028_list_mutex);
|
|
|
|
|
2007-07-18 09:29:10 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
static int xc2028_get_frequency(struct dvb_frontend *fe, u32 *frequency)
|
2007-07-18 09:29:10 -04:00
|
|
|
{
|
2007-10-23 14:24:06 -04:00
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
*frequency = priv->frequency;
|
2007-07-18 09:29:10 -04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)
|
2007-10-24 08:22:08 -04:00
|
|
|
{
|
|
|
|
struct xc2028_data *priv = fe->tuner_priv;
|
|
|
|
struct xc2028_ctrl *p = priv_cfg;
|
2007-11-19 07:29:59 -05:00
|
|
|
int rc = 0;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
tuner_dbg("%s called\n", __FUNCTION__);
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-19 04:06:08 -05:00
|
|
|
mutex_lock(&priv->lock);
|
|
|
|
|
2007-11-19 07:29:59 -05:00
|
|
|
kfree(priv->ctrl.fname);
|
|
|
|
free_firmware(priv);
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-19 07:29:59 -05:00
|
|
|
memcpy(&priv->ctrl, p, sizeof(priv->ctrl));
|
|
|
|
priv->ctrl.fname = NULL;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-11-19 07:29:59 -05:00
|
|
|
if (p->fname) {
|
|
|
|
priv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL);
|
|
|
|
if (priv->ctrl.fname == NULL)
|
|
|
|
rc = -ENOMEM;
|
2007-10-24 08:22:08 -04:00
|
|
|
}
|
|
|
|
|
2007-11-19 07:29:59 -05:00
|
|
|
if (priv->ctrl.max_len < 9)
|
|
|
|
priv->ctrl.max_len = 13;
|
2007-11-01 15:56:26 -04:00
|
|
|
|
2007-11-19 04:06:08 -05:00
|
|
|
mutex_unlock(&priv->lock);
|
|
|
|
|
2007-11-19 07:29:59 -05:00
|
|
|
return rc;
|
2007-10-24 08:22:08 -04:00
|
|
|
}
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
static const struct dvb_tuner_ops xc2028_dvb_tuner_ops = {
|
2007-07-18 09:29:10 -04:00
|
|
|
.info = {
|
2007-11-01 16:47:42 -04:00
|
|
|
.name = "Xceive XC3028",
|
|
|
|
.frequency_min = 42000000,
|
|
|
|
.frequency_max = 864000000,
|
|
|
|
.frequency_step = 50000,
|
|
|
|
},
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-10-24 08:22:08 -04:00
|
|
|
.set_config = xc2028_set_config,
|
2007-10-23 14:24:06 -04:00
|
|
|
.set_analog_params = xc2028_set_tv_freq,
|
|
|
|
.release = xc2028_dvb_release,
|
|
|
|
.get_frequency = xc2028_get_frequency,
|
|
|
|
.get_rf_strength = xc2028_signal,
|
|
|
|
.set_params = xc2028_set_params,
|
2007-11-19 09:41:20 -05:00
|
|
|
.sleep = xc2028_sleep,
|
2007-07-18 09:29:10 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2007-11-16 05:46:14 -05:00
|
|
|
void *xc2028_attach(struct dvb_frontend *fe, struct xc2028_config *cfg)
|
2007-07-18 09:29:10 -04:00
|
|
|
{
|
2007-10-23 14:24:06 -04:00
|
|
|
struct xc2028_data *priv;
|
2007-11-16 05:46:14 -05:00
|
|
|
void *video_dev;
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-11-15 07:44:30 -05:00
|
|
|
if (debug)
|
2007-11-19 02:34:29 -05:00
|
|
|
printk(KERN_DEBUG PREFIX ": Xcv2028/3028 init called!\n");
|
2007-07-18 09:29:10 -04:00
|
|
|
|
2007-11-16 05:46:14 -05:00
|
|
|
if (NULL == cfg->video_dev)
|
|
|
|
return NULL;
|
2007-10-23 14:24:06 -04:00
|
|
|
|
2007-11-16 05:46:14 -05:00
|
|
|
if (!fe) {
|
2007-11-19 02:34:29 -05:00
|
|
|
printk(KERN_ERR PREFIX ": No frontend!\n");
|
2007-11-16 05:46:14 -05:00
|
|
|
return NULL;
|
2007-10-23 14:24:06 -04:00
|
|
|
}
|
|
|
|
|
2007-11-16 05:46:14 -05:00
|
|
|
video_dev = cfg->video_dev;
|
|
|
|
|
2007-11-19 02:45:38 -05:00
|
|
|
mutex_lock(&xc2028_list_mutex);
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
list_for_each_entry(priv, &xc2028_list, xc2028_list) {
|
2007-11-16 05:46:14 -05:00
|
|
|
if (priv->video_dev == cfg->video_dev) {
|
|
|
|
video_dev = NULL;
|
|
|
|
break;
|
|
|
|
}
|
2007-10-23 14:24:06 -04:00
|
|
|
}
|
|
|
|
|
2007-11-16 05:46:14 -05:00
|
|
|
if (video_dev) {
|
2007-10-23 14:24:06 -04:00
|
|
|
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
2007-11-19 02:45:38 -05:00
|
|
|
if (priv == NULL) {
|
|
|
|
mutex_unlock(&xc2028_list_mutex);
|
2007-11-16 05:46:14 -05:00
|
|
|
return NULL;
|
2007-11-19 02:45:38 -05:00
|
|
|
}
|
2007-09-27 17:27:03 -04:00
|
|
|
|
2007-11-16 05:46:14 -05:00
|
|
|
priv->i2c_props.addr = cfg->i2c_addr;
|
|
|
|
priv->i2c_props.adap = cfg->i2c_adap;
|
2007-10-23 14:24:06 -04:00
|
|
|
priv->video_dev = video_dev;
|
2007-11-16 05:46:14 -05:00
|
|
|
priv->tuner_callback = cfg->callback;
|
2007-11-19 07:29:59 -05:00
|
|
|
priv->ctrl.max_len = 13;
|
2007-10-24 08:22:08 -04:00
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
mutex_init(&priv->lock);
|
|
|
|
|
2007-11-01 16:47:42 -04:00
|
|
|
list_add_tail(&priv->xc2028_list, &xc2028_list);
|
2007-10-23 14:24:06 -04:00
|
|
|
}
|
2007-11-16 05:46:14 -05:00
|
|
|
|
|
|
|
fe->tuner_priv = priv;
|
2007-10-29 16:38:59 -04:00
|
|
|
priv->count++;
|
2007-10-23 14:24:06 -04:00
|
|
|
|
|
|
|
memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops,
|
2007-11-01 16:47:42 -04:00
|
|
|
sizeof(xc2028_dvb_tuner_ops));
|
2007-10-23 14:24:06 -04:00
|
|
|
|
|
|
|
tuner_info("type set to %s\n", "XCeive xc2028/xc3028 tuner");
|
|
|
|
|
2007-11-19 02:45:38 -05:00
|
|
|
mutex_unlock(&xc2028_list_mutex);
|
|
|
|
|
2007-11-16 05:46:14 -05:00
|
|
|
return fe;
|
2007-10-23 14:24:06 -04:00
|
|
|
}
|
2007-11-16 05:46:14 -05:00
|
|
|
|
2007-07-18 09:29:10 -04:00
|
|
|
EXPORT_SYMBOL(xc2028_attach);
|
|
|
|
|
2007-10-23 14:24:06 -04:00
|
|
|
MODULE_DESCRIPTION("Xceive xc2028/xc3028 tuner driver");
|
2007-10-29 22:44:18 -04:00
|
|
|
MODULE_AUTHOR("Michel Ludwig <michel.ludwig@gmail.com>");
|
2007-10-23 14:24:06 -04:00
|
|
|
MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>");
|
|
|
|
MODULE_LICENSE("GPL");
|