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

Commit 8c70017f authored by Steven Toth's avatar Steven Toth Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (7044): XC5000: Fix support for HVR1500Q broken by patch 1



From Zhang: This patch fixes support for the HVR1500Q which was broken
when the xc5000 analog patch was added.

Patch committed as-is, cleanups to follows .... Steve

Signed-off-by: default avatarChaogui Zhang <czhang1974@gmail.com>
Signed-off-by: default avatarSteven Toth <stoth@hauppauge.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 60464da8
Loading
Loading
Loading
Loading
+28 −0
Original line number Original line Diff line number Diff line
@@ -244,6 +244,34 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
			dev->name, tv.model);
			dev->name, tv.model);
}
}


/* Tuner callback function for cx23885 boards. Currently only needed
 * for HVR1500Q, which has an xc5000 tuner.
 */
int cx23885_tuner_callback(void *i2c_bus, int command, int arg)
{
	struct cx23885_i2c *bus = i2c_bus;
	struct cx23885_dev *dev = bus->dev;

	switch(dev->board) {
	case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
		if(command == 0) {	/* Tuner Reset Command from xc5000 */
			/* Drive the tuner into reset and out */
			cx_clear(GP0_IO, 0x00000004);
			mdelay(200);
			cx_set(GP0_IO, 0x00000004);
			return 0;
		}
		else {
			printk(KERN_ERR
				"%s(): Unknow command.\n", __FUNCTION__);
			return -EINVAL;
		}
		break;
	}

	return 0; /* Should never be here */
}
EXPORT_SYMBOL(cx23885_tuner_callback);
void cx23885_gpio_setup(struct cx23885_dev *dev)
void cx23885_gpio_setup(struct cx23885_dev *dev)
{
{
	switch(dev->board) {
	switch(dev->board) {
+7 −28
Original line number Original line Diff line number Diff line
@@ -87,32 +87,6 @@ static void dvb_buf_release(struct videobuf_queue *q,
	cx23885_free_buffer(q, (struct cx23885_buffer*)vb);
	cx23885_free_buffer(q, (struct cx23885_buffer*)vb);
}
}


static int cx23885_request_firmware(struct dvb_frontend *fe,
	const struct firmware **fw, char *name)
{
	struct cx23885_tsport *port = fe->dvb->priv;
	struct cx23885_dev *dev = port->dev;

	dprintk(1, "%s(?,?,%s)\n", __FUNCTION__, name);

	return request_firmware(fw, name, &dev->pci->dev);
}

static int hauppauge_hvr1500q_tuner_reset(struct dvb_frontend *fe)
{
	struct cx23885_tsport *port = fe->dvb->priv;
	struct cx23885_dev *dev = port->dev;

	dprintk(1, "%s()\n", __FUNCTION__);

	/* Drive the tuner into reset back back */
	cx_clear(GP0_IO, 0x00000004);
	mdelay(200);
	cx_set(GP0_IO, 0x00000004);

	return 0;
}

static struct videobuf_queue_ops dvb_qops = {
static struct videobuf_queue_ops dvb_qops = {
	.buf_setup    = dvb_buf_setup,
	.buf_setup    = dvb_buf_setup,
	.buf_prepare  = dvb_buf_prepare,
	.buf_prepare  = dvb_buf_prepare,
@@ -182,8 +156,8 @@ static struct s5h1409_config hauppauge_hvr1500q_config = {
static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
	.i2c_address      = 0x61,
	.i2c_address      = 0x61,
	.if_khz           = 5380,
	.if_khz           = 5380,
	.request_firmware = cx23885_request_firmware,
	/* cannot set .video_dev here, do it before attach. */
	.tuner_reset      = hauppauge_hvr1500q_tuner_reset
	.tuner_callback   = cx23885_tuner_callback
};
};


static struct tda829x_config tda829x_no_probe = {
static struct tda829x_config tda829x_no_probe = {
@@ -308,6 +282,11 @@ static int dvb_register(struct cx23885_tsport *port)
						&hauppauge_hvr1500q_config,
						&hauppauge_hvr1500q_config,
						&dev->i2c_bus[0].i2c_adap);
						&dev->i2c_bus[0].i2c_adap);
		if (port->dvb.frontend != NULL) {
		if (port->dvb.frontend != NULL) {
			/* tunerconfig.video_dev must point to
			 * i2c_adap.algo_data
			 */
			hauppauge_hvr1500q_tunerconfig.video_dev =
				i2c_bus->i2c_adap.algo_data;
			dvb_attach(xc5000_attach, port->dvb.frontend,
			dvb_attach(xc5000_attach, port->dvb.frontend,
				&i2c_bus->i2c_adap,
				&i2c_bus->i2c_adap,
				&hauppauge_hvr1500q_tunerconfig);
				&hauppauge_hvr1500q_tunerconfig);
+1 −0
Original line number Original line Diff line number Diff line
@@ -393,6 +393,7 @@ extern const unsigned int cx23885_bcount;
extern struct cx23885_subid cx23885_subids[];
extern struct cx23885_subid cx23885_subids[];
extern const unsigned int cx23885_idcount;
extern const unsigned int cx23885_idcount;


extern int cx23885_tuner_callback(void *i2c_bus, int command, int arg);
extern void cx23885_card_list(struct cx23885_dev *dev);
extern void cx23885_card_list(struct cx23885_dev *dev);
extern int  cx23885_ir_init(struct cx23885_dev *dev);
extern int  cx23885_ir_init(struct cx23885_dev *dev);
extern void cx23885_gpio_setup(struct cx23885_dev *dev);
extern void cx23885_gpio_setup(struct cx23885_dev *dev);