From f75dce1c5a4e67aa7abffea6a320e23b1c33341e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 18 Apr 2008 18:34:00 -0300 Subject: Add support for Hauppauge HVR950Q/HVR850/FusioHDTV7-USB From: Steven Toth Including support for the AU0828 USB Bridge. Including support for the AU8522 ATSC/QAM Demodulator. Including support for the AU8522 ATSC/QAM Demodulator. Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/au0828/au0828-cards.c | 144 ++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 linux/drivers/media/video/au0828/au0828-cards.c (limited to 'linux/drivers/media/video/au0828/au0828-cards.c') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c new file mode 100644 index 000000000..c4cb11e9d --- /dev/null +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -0,0 +1,144 @@ +/* + * Driver for the Auvitek USB bridge + * + * Copyright (c) 2008 Steven Toth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "au0828.h" +#include "au0828-cards.h" + +#define _dbg(level, fmt, arg...)\ + do {\ + if (debug >= level) \ + printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\ + } while (0) + +struct au0828_board au0828_boards[] = { + [AU0828_BOARD_UNKNOWN] = { + .name = "Unknown board", + }, + [AU0828_BOARD_HAUPPAUGE_HVR850] = { + .name = "Hauppauge HVR850", + }, + [AU0828_BOARD_HAUPPAUGE_HVR950Q] = { + .name = "Hauppauge HVR950Q", + }, + [AU0828_BOARD_DVICO_FUSIONHDTV7] = { + .name = "DViCO FusionHDTV USB", + }, +}; +const unsigned int au0828_bcount = ARRAY_SIZE(au0828_boards); + +/* Tuner callback function for au0828 boards. Currently only needed + * for HVR1500Q, which has an xc5000 tuner. + */ +int au0828_tuner_callback(void *priv, int command, int arg) +{ + struct au0828_dev *dev = priv; + + switch(dev->board) { + case AU0828_BOARD_HAUPPAUGE_HVR850: + case AU0828_BOARD_HAUPPAUGE_HVR950Q: + case AU0828_BOARD_DVICO_FUSIONHDTV7: + if(command == 0) { + /* Tuner Reset Command from xc5000 */ + /* Drive the tuner into reset and out */ + au0828_clear(dev, REG_001, 2); + mdelay(200); + au0828_set(dev, REG_001, 2); + mdelay(50); + return 0; + } + else { + printk(KERN_ERR + "%s(): Unknown command.\n", __FUNCTION__); + return -EINVAL; + } + break; + } + + return 0; /* Should never be here */ +} + +/* + * The bridge has between 8 and 12 gpios. + * Regs 1 and 0 deal with output enables. + * Regs 3 and 2 * deal with direction. + */ +void au0828_gpio_setup(struct au0828_dev *dev) +{ + switch(dev->board) { + case AU0828_BOARD_HAUPPAUGE_HVR850: + case AU0828_BOARD_HAUPPAUGE_HVR950Q: + /* GPIO's + * 4 - CS5340 + * 5 - AU8522 Demodulator + * 6 - eeprom W/P + * 9 - XC5000 Tuner + */ + + /* Into reset */ + au0828_write(dev, REG_003, 0x02); + au0828_write(dev, REG_002, 0x88 | 0x20); + au0828_write(dev, REG_001, 0x0); + au0828_write(dev, REG_000, 0x0); + msleep(100); + + /* Out of reset */ + au0828_write(dev, REG_003, 0x02); + au0828_write(dev, REG_001, 0x02); + au0828_write(dev, REG_002, 0x88 | 0x20); + au0828_write(dev, REG_000, 0x88 | 0x20 | 0x40); + msleep(250); + break; + case AU0828_BOARD_DVICO_FUSIONHDTV7: + /* GPIO's + * 6 - ? + * 8 - AU8522 Demodulator + * 9 - XC5000 Tuner + */ + + /* Into reset */ + au0828_write(dev, REG_003, 0x02); + au0828_write(dev, REG_002, 0xa0); + au0828_write(dev, REG_001, 0x0); + au0828_write(dev, REG_000, 0x0); + msleep(100); + + /* Out of reset */ + au0828_write(dev, REG_003, 0x02); + au0828_write(dev, REG_002, 0xa0); + au0828_write(dev, REG_001, 0x02); + au0828_write(dev, REG_000, 0xa0); + msleep(250); + break; + } +} + +/* table of devices that work with this driver */ +struct usb_device_id au0828_usb_id_table [] = { + { USB_DEVICE(0x2040, 0x7200), + .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, + { USB_DEVICE(0x2040, 0x7240), + .driver_info = AU0828_BOARD_HAUPPAUGE_HVR850 }, + { USB_DEVICE(0x0fe9, 0xd620), + .driver_info = AU0828_BOARD_DVICO_FUSIONHDTV7 }, + { }, +}; + +MODULE_DEVICE_TABLE(usb, au0828_usb_id_table); -- cgit v1.2.3 From 4c0cab7cc8debfe1d245a47baa775aa190409082 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Sat, 29 Mar 2008 15:53:07 -0400 Subject: HVR950Q Hauppauge eeprom support. From: Steven Toth HVR950Q Hauppauge eeprom support. Signed-off-by: Steven Toth --- linux/drivers/media/video/au0828/au0828-cards.c | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'linux/drivers/media/video/au0828/au0828-cards.c') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c index c4cb11e9d..cbcc6f81f 100644 --- a/linux/drivers/media/video/au0828/au0828-cards.c +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -75,6 +75,45 @@ int au0828_tuner_callback(void *priv, int command, int arg) return 0; /* Should never be here */ } +static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) +{ + struct tveeprom tv; + + tveeprom_hauppauge_analog(&dev->i2c_client, &tv, eeprom_data); + + /* Make sure we support the board model */ + switch (tv.model) + { + case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */ + break; + default: + printk("%s: warning: unknown hauppauge model #%d\n", __FUNCTION__, tv.model); + break; + } + + printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n", __FUNCTION__, tv.model); +} + + +void au0828_card_setup(struct au0828_dev *dev) +{ + + static u8 eeprom[256]; + + if (dev->i2c_rc == 0) { + dev->i2c_client.addr = 0xa0 >> 1; + tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom)); + } + + switch(dev->board) { + case AU0828_BOARD_HAUPPAUGE_HVR850: + case AU0828_BOARD_HAUPPAUGE_HVR950Q: + if (dev->i2c_rc == 0) + hauppauge_eeprom(dev, eeprom+0xa0); + break; + } +} + /* * The bridge has between 8 and 12 gpios. * Regs 1 and 0 deal with output enables. -- cgit v1.2.3 From 8d8ffa5f1f9595b7109db94523ed92e050d32c3e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 18 Apr 2008 18:39:11 -0300 Subject: au0828: Cleanup From: Steven Toth Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/au0828/au0828-cards.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'linux/drivers/media/video/au0828/au0828-cards.c') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c index cbcc6f81f..eafdc552a 100644 --- a/linux/drivers/media/video/au0828/au0828-cards.c +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -22,12 +22,6 @@ #include "au0828.h" #include "au0828-cards.h" -#define _dbg(level, fmt, arg...)\ - do {\ - if (debug >= level) \ - printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\ - } while (0) - struct au0828_board au0828_boards[] = { [AU0828_BOARD_UNKNOWN] = { .name = "Unknown board", @@ -51,6 +45,8 @@ int au0828_tuner_callback(void *priv, int command, int arg) { struct au0828_dev *dev = priv; + dprintk(1, "%s()\n", __FUNCTION__); + switch(dev->board) { case AU0828_BOARD_HAUPPAUGE_HVR850: case AU0828_BOARD_HAUPPAUGE_HVR950Q: @@ -97,9 +93,10 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) void au0828_card_setup(struct au0828_dev *dev) { - static u8 eeprom[256]; + dprintk(1, "%s()\n", __FUNCTION__); + if (dev->i2c_rc == 0) { dev->i2c_client.addr = 0xa0 >> 1; tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom)); @@ -121,6 +118,8 @@ void au0828_card_setup(struct au0828_dev *dev) */ void au0828_gpio_setup(struct au0828_dev *dev) { + dprintk(1, "%s()\n", __FUNCTION__); + switch(dev->board) { case AU0828_BOARD_HAUPPAUGE_HVR850: case AU0828_BOARD_HAUPPAUGE_HVR950Q: -- cgit v1.2.3 From 6bcbc93d2be17bd66512af5180a9451e147300c3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 18 Apr 2008 18:42:30 -0300 Subject: au0828: replace __FUNCTION__ with __func__ From: Michael Krufky replace __FUNCTION__ with __func__ and clean associated checkpatch.pl warnings. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/au0828/au0828-cards.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'linux/drivers/media/video/au0828/au0828-cards.c') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c index eafdc552a..5c9c3aea9 100644 --- a/linux/drivers/media/video/au0828/au0828-cards.c +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -45,7 +45,7 @@ int au0828_tuner_callback(void *priv, int command, int arg) { struct au0828_dev *dev = priv; - dprintk(1, "%s()\n", __FUNCTION__); + dprintk(1, "%s()\n", __func__); switch(dev->board) { case AU0828_BOARD_HAUPPAUGE_HVR850: @@ -62,7 +62,7 @@ int au0828_tuner_callback(void *priv, int command, int arg) } else { printk(KERN_ERR - "%s(): Unknown command.\n", __FUNCTION__); + "%s(): Unknown command.\n", __func__); return -EINVAL; } break; @@ -83,11 +83,13 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */ break; default: - printk("%s: warning: unknown hauppauge model #%d\n", __FUNCTION__, tv.model); + printk(KERN_WARNING "%s: warning: " + "unknown hauppauge model #%d\n", __func__, tv.model); break; } - printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n", __FUNCTION__, tv.model); + printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n", + __func__, tv.model); } @@ -95,7 +97,7 @@ void au0828_card_setup(struct au0828_dev *dev) { static u8 eeprom[256]; - dprintk(1, "%s()\n", __FUNCTION__); + dprintk(1, "%s()\n", __func__); if (dev->i2c_rc == 0) { dev->i2c_client.addr = 0xa0 >> 1; @@ -118,7 +120,7 @@ void au0828_card_setup(struct au0828_dev *dev) */ void au0828_gpio_setup(struct au0828_dev *dev) { - dprintk(1, "%s()\n", __FUNCTION__); + dprintk(1, "%s()\n", __func__); switch(dev->board) { case AU0828_BOARD_HAUPPAUGE_HVR850: -- cgit v1.2.3 From 359d1d58bc15a93bcede273e981430f6a11aba11 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 17 Apr 2008 17:41:28 -0400 Subject: au0828: Cleanup From: Steven Toth au0828: Cleanup Signed-off-by: Steven Toth --- linux/drivers/media/video/au0828/au0828-cards.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'linux/drivers/media/video/au0828/au0828-cards.c') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c index 5c9c3aea9..f6c6228b6 100644 --- a/linux/drivers/media/video/au0828/au0828-cards.c +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -51,7 +51,7 @@ int au0828_tuner_callback(void *priv, int command, int arg) case AU0828_BOARD_HAUPPAUGE_HVR850: case AU0828_BOARD_HAUPPAUGE_HVR950Q: case AU0828_BOARD_DVICO_FUSIONHDTV7: - if(command == 0) { + if (command == 0) { /* Tuner Reset Command from xc5000 */ /* Drive the tuner into reset and out */ au0828_clear(dev, REG_001, 2); @@ -78,8 +78,7 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) tveeprom_hauppauge_analog(&dev->i2c_client, &tv, eeprom_data); /* Make sure we support the board model */ - switch (tv.model) - { + switch (tv.model) { case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */ break; default: @@ -92,7 +91,6 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) __func__, tv.model); } - void au0828_card_setup(struct au0828_dev *dev) { static u8 eeprom[256]; @@ -116,7 +114,7 @@ void au0828_card_setup(struct au0828_dev *dev) /* * The bridge has between 8 and 12 gpios. * Regs 1 and 0 deal with output enables. - * Regs 3 and 2 * deal with direction. + * Regs 3 and 2 deal with direction. */ void au0828_gpio_setup(struct au0828_dev *dev) { -- cgit v1.2.3 From 84c4b2e514830410585f1c6b3345419694a008c5 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 17 Apr 2008 17:47:11 -0400 Subject: au0828: Add HVR850 model number From: Steven Toth au0828: Add HVR850 model number Signed-off-by: Steven Toth --- linux/drivers/media/video/au0828/au0828-cards.c | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/drivers/media/video/au0828/au0828-cards.c') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c index f6c6228b6..688cb8d26 100644 --- a/linux/drivers/media/video/au0828/au0828-cards.c +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -80,6 +80,7 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) /* Make sure we support the board model */ switch (tv.model) { case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */ + case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */ break; default: printk(KERN_WARNING "%s: warning: " -- cgit v1.2.3 From 8ace45c3f08656c82d005b7a6aac4e4dac1ddcfe Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 18 Apr 2008 19:12:52 -0300 Subject: CodingStyle fixes for au8522 and au0828 From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/au0828/au0828-cards.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'linux/drivers/media/video/au0828/au0828-cards.c') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c index 688cb8d26..8ca91f814 100644 --- a/linux/drivers/media/video/au0828/au0828-cards.c +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -47,7 +47,7 @@ int au0828_tuner_callback(void *priv, int command, int arg) dprintk(1, "%s()\n", __func__); - switch(dev->board) { + switch (dev->board) { case AU0828_BOARD_HAUPPAUGE_HVR850: case AU0828_BOARD_HAUPPAUGE_HVR950Q: case AU0828_BOARD_DVICO_FUSIONHDTV7: @@ -59,8 +59,7 @@ int au0828_tuner_callback(void *priv, int command, int arg) au0828_set(dev, REG_001, 2); mdelay(50); return 0; - } - else { + } else { printk(KERN_ERR "%s(): Unknown command.\n", __func__); return -EINVAL; @@ -103,7 +102,7 @@ void au0828_card_setup(struct au0828_dev *dev) tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom)); } - switch(dev->board) { + switch (dev->board) { case AU0828_BOARD_HAUPPAUGE_HVR850: case AU0828_BOARD_HAUPPAUGE_HVR950Q: if (dev->i2c_rc == 0) @@ -121,7 +120,7 @@ void au0828_gpio_setup(struct au0828_dev *dev) { dprintk(1, "%s()\n", __func__); - switch(dev->board) { + switch (dev->board) { case AU0828_BOARD_HAUPPAUGE_HVR850: case AU0828_BOARD_HAUPPAUGE_HVR950Q: /* GPIO's -- cgit v1.2.3 From 6f27a5778d71d98848ab2e69d46b3a8b82679d8b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 25 Apr 2008 19:06:03 +0000 Subject: au0828/ cleanups and fixes From: Adrian Bunk This patch contains the following cleanups and fixes: - "debug" is definitely not a good name for a global variable, renamed it to "au0828_debug" this fixes a compile error with some kernel configurations - since the module parameter is int the variable shouldn't be unsigned - remove the {usb,bridge,i2c}_debug module parameters since they are already covered by the "debug" module parameter - remove the unused au0828_bcount - make the needlessly global i2c_scan static - make the needlessly global dvb_register() static Signed-off-by: Adrian Bunk Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/au0828/au0828-cards.c | 1 - 1 file changed, 1 deletion(-) (limited to 'linux/drivers/media/video/au0828/au0828-cards.c') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c index 8ca91f814..a2a698344 100644 --- a/linux/drivers/media/video/au0828/au0828-cards.c +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -36,7 +36,6 @@ struct au0828_board au0828_boards[] = { .name = "DViCO FusionHDTV USB", }, }; -const unsigned int au0828_bcount = ARRAY_SIZE(au0828_boards); /* Tuner callback function for au0828 boards. Currently only needed * for HVR1500Q, which has an xc5000 tuner. -- cgit v1.2.3