Commit 29ad5b6c authored by Michael Hunold's avatar Michael Hunold Committed by Linus Torvalds

[PATCH] DVB: misc driver updates

- [DVB] av7110: convert MODULE_PARM() to module_param(), replace home-brewn
  waiting stuff in osd code with wait_event_interruptible_timeout()

- [DVB] av7110: put a semaphore around osd calls to make sure they're
  properly serialized, timeout variable in arm_thread() must be int, not
  unsigned long

- [DVB] av7110: add additional OSD window types (patch by Jeremy Jones), new
  ioctl OSD_GET_CAPABILITY/OSD_CAP_MEMSIZE; returns size of OSD memory

- [DVB] av7110: put audio/video initialization into separate function
  init_av7110_av(); call this function after system initialization and after
  arm crash to restore the previous state; thanks to Soeren Sonnenburg
  <bugreports@nn7.de> for this patch.

- [DVB] av7110, budget, ttusb-budget: remove dvb i2c remains, support kernel
  i2c

- [DVB] av7110, budget: use msleep() instead of my_wait(), thanks to Kernel
  Janitors/Nishanth Aravamudan <nacc@us.ibm.com>

- [DVB] av7110, budget: fix videodev has no release callback

- [DVB] av7110: more sparse annotiations

- [DVB] budget: add support for TerraTec Cinergy 1200 DVB-S

- [DVB] budget: fix race condition in irq handler

- [DVB] skystar2, av7110, ttusb-budget, budget: make i2c
  client_(un)register() functions static
Signed-off-by: default avatarMichael Hunold <hunold@linuxtv.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7cd893fd
...@@ -2236,7 +2236,7 @@ static int flexcop_diseqc_ioctl(struct dvb_frontend *fe, unsigned int cmd, void ...@@ -2236,7 +2236,7 @@ static int flexcop_diseqc_ioctl(struct dvb_frontend *fe, unsigned int cmd, void
} }
int client_register(struct i2c_client *client) static int client_register(struct i2c_client *client)
{ {
struct adapter *adapter = (struct adapter*)i2c_get_adapdata(client->adapter); struct adapter *adapter = (struct adapter*)i2c_get_adapdata(client->adapter);
...@@ -2247,7 +2247,7 @@ int client_register(struct i2c_client *client) ...@@ -2247,7 +2247,7 @@ int client_register(struct i2c_client *client)
return 0; return 0;
} }
int client_unregister(struct i2c_client *client) static int client_unregister(struct i2c_client *client)
{ {
struct adapter *adapter = (struct adapter*)i2c_get_adapdata(client->adapter); struct adapter *adapter = (struct adapter*)i2c_get_adapdata(client->adapter);
......
This diff is collapsed.
...@@ -4,13 +4,12 @@ ...@@ -4,13 +4,12 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/i2c.h>
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#endif #endif
#include <media/saa7146_vv.h>
#include <linux/dvb/video.h> #include <linux/dvb/video.h>
#include <linux/dvb/audio.h> #include <linux/dvb/audio.h>
#include <linux/dvb/dmx.h> #include <linux/dvb/dmx.h>
...@@ -26,6 +25,7 @@ ...@@ -26,6 +25,7 @@
#include "dvb_net.h" #include "dvb_net.h"
#include "dvb_ringbuffer.h" #include "dvb_ringbuffer.h"
#include <media/saa7146_vv.h>
#define MAXFILT 32 #define MAXFILT 32
...@@ -60,12 +60,13 @@ struct av7110 { ...@@ -60,12 +60,13 @@ struct av7110 {
struct dvb_device dvb_dev; struct dvb_device dvb_dev;
struct dvb_net dvb_net; struct dvb_net dvb_net;
struct video_device v4l_dev; struct video_device *v4l_dev;
struct video_device vbi_dev; struct video_device *vbi_dev;
struct saa7146_dev *dev; struct saa7146_dev *dev;
struct dvb_i2c_bus *i2c_bus; struct i2c_adapter i2c_adap;
char *card_name; char *card_name;
/* support for analog module of dvb-c */ /* support for analog module of dvb-c */
...@@ -127,7 +128,7 @@ struct av7110 { ...@@ -127,7 +128,7 @@ struct av7110 {
int osdwin; /* currently active window */ int osdwin; /* currently active window */
u16 osdbpp[8]; u16 osdbpp[8];
struct semaphore osd_sema;
/* CA */ /* CA */
...@@ -187,6 +188,7 @@ struct av7110 { ...@@ -187,6 +188,7 @@ struct av7110 {
struct dvb_ringbuffer ci_rbuffer; struct dvb_ringbuffer ci_rbuffer;
struct dvb_ringbuffer ci_wbuffer; struct dvb_ringbuffer ci_wbuffer;
struct audio_mixer mixer;
struct dvb_adapter *dvb_adapter; struct dvb_adapter *dvb_adapter;
struct dvb_device *video_dev; struct dvb_device *video_dev;
......
...@@ -37,14 +37,10 @@ ...@@ -37,14 +37,10 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/fs.h> #include <linux/fs.h>
#define DEBUG_VARIABLE av7110_debug
extern int av7110_debug;
#include "av7110.h" #include "av7110.h"
#include "av7110_hw.h" #include "av7110_hw.h"
#include "av7110_av.h" #include "av7110_av.h"
#include "av7110_ipack.h" #include "av7110_ipack.h"
#include "dvb_functions.h"
/* MPEG-2 (ISO 13818 / H.222.0) stream types */ /* MPEG-2 (ISO 13818 / H.222.0) stream types */
#define PROG_STREAM_MAP 0xBC #define PROG_STREAM_MAP 0xBC
...@@ -292,6 +288,9 @@ int av7110_set_volume(struct av7110 *av7110, int volleft, int volright) ...@@ -292,6 +288,9 @@ int av7110_set_volume(struct av7110 *av7110, int volleft, int volright)
DEB_EE(("av7110: %p\n", av7110)); DEB_EE(("av7110: %p\n", av7110));
av7110->mixer.volume_left = volleft;
av7110->mixer.volume_right = volright;
switch (av7110->adac_type) { switch (av7110->adac_type) {
case DVB_ADAC_TI: case DVB_ADAC_TI:
volleft = (volleft * 256) / 1036; volleft = (volleft * 256) / 1036;
......
...@@ -38,13 +38,8 @@ ...@@ -38,13 +38,8 @@
#include <linux/byteorder/swabb.h> #include <linux/byteorder/swabb.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#define DEBUG_VARIABLE av7110_debug
extern int av7110_debug;
#include "dvb_i2c.h"
#include "av7110.h" #include "av7110.h"
#include "av7110_hw.h" #include "av7110_hw.h"
#include "dvb_functions.h"
void CI_handle(struct av7110 *av7110, u8 *data, u16 len) void CI_handle(struct av7110 *av7110, u8 *data, u16 len)
......
This diff is collapsed.
...@@ -39,29 +39,6 @@ enum av7110_osd_palette_type ...@@ -39,29 +39,6 @@ enum av7110_osd_palette_type
Pal8Bit = 256 /* 256 colors for 16 bit palette */ Pal8Bit = 256 /* 256 colors for 16 bit palette */
}; };
enum av7110_window_display_type {
BITMAP1, /* 1 bit bitmap */
BITMAP2, /* 2 bit bitmap */
BITMAP4, /* 4 bit bitmap */
BITMAP8, /* 8 bit bitmap */
BITMAP1HR, /* 1 Bit bitmap half resolution */
BITMAP2HR, /* 2 bit bitmap half resolution */
BITMAP4HR, /* 4 bit bitmap half resolution */
BITMAP8HR, /* 8 bit bitmap half resolution */
YCRCB422, /* 4:2:2 YCRCB Graphic Display */
YCRCB444, /* 4:4:4 YCRCB Graphic Display */
YCRCB444HR, /* 4:4:4 YCRCB graphic half resolution */
VIDEOTSIZE, /* True Size Normal MPEG Video Display */
VIDEOHSIZE, /* MPEG Video Display Half Resolution */
VIDEOQSIZE, /* MPEG Video Display Quarter Resolution */
VIDEODSIZE, /* MPEG Video Display Double Resolution */
VIDEOTHSIZE, /* True Size MPEG Video Display Half Resolution */
VIDEOTQSIZE, /* True Size MPEG Video Display Quarter Resolution*/
VIDEOTDSIZE, /* True Size MPEG Video Display Double Resolution */
VIDEONSIZE, /* Full Size MPEG Video Display */
CURSOR /* Cursor */
};
/* switch defines */ /* switch defines */
#define SB_GPIO 3 #define SB_GPIO 3
#define SB_OFF SAA7146_GPIO_OUTLO /* SlowBlank off (TV-Mode) */ #define SB_OFF SAA7146_GPIO_OUTLO /* SlowBlank off (TV-Mode) */
...@@ -388,6 +365,7 @@ extern void av7110_reset_arm(struct av7110 *av7110); ...@@ -388,6 +365,7 @@ extern void av7110_reset_arm(struct av7110 *av7110);
extern int av7110_bootarm(struct av7110 *av7110); extern int av7110_bootarm(struct av7110 *av7110);
extern int av7110_firmversion(struct av7110 *av7110); extern int av7110_firmversion(struct av7110 *av7110);
#define FW_CI_LL_SUPPORT(arm_app) ((arm_app) & 0x80000000) #define FW_CI_LL_SUPPORT(arm_app) ((arm_app) & 0x80000000)
#define FW_4M_SDRAM(arm_app) ((arm_app) & 0x40000000)
#define FW_VERSION(arm_app) ((arm_app) & 0x0000FFFF) #define FW_VERSION(arm_app) ((arm_app) & 0x0000FFFF)
extern int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...); extern int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...);
...@@ -495,7 +473,7 @@ static int inline vidcom(struct av7110 *av7110, u32 com, u32 arg) ...@@ -495,7 +473,7 @@ static int inline vidcom(struct av7110 *av7110, u32 com, u32 arg)
static int inline audcom(struct av7110 *av7110, u32 com) static int inline audcom(struct av7110 *av7110, u32 com)
{ {
return av7110_fw_cmd(av7110, COMTYPE_MISC, AV7110_FW_AUDIO_COMMAND, 4, return av7110_fw_cmd(av7110, COMTYPE_MISC, AV7110_FW_AUDIO_COMMAND, 2,
(com>>16), (com&0xffff)); (com>>16), (com&0xffff));
} }
...@@ -510,6 +488,7 @@ extern int av7110_diseqc_send(struct av7110 *av7110, int len, u8 *msg, unsigned ...@@ -510,6 +488,7 @@ extern int av7110_diseqc_send(struct av7110 *av7110, int len, u8 *msg, unsigned
#ifdef CONFIG_DVB_AV7110_OSD #ifdef CONFIG_DVB_AV7110_OSD
extern int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc); extern int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc);
extern int av7110_osd_capability(struct av7110 *av7110, osd_cap_t *cap);
#endif /* CONFIG_DVB_AV7110_OSD */ #endif /* CONFIG_DVB_AV7110_OSD */
......
#include <linux/types.h> #include <linux/types.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <asm/bitops.h> #include <asm/bitops.h>
#include "av7110.h" #include "av7110.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "input_fake.h"
#endif
#define UP_TIMEOUT (HZ/4) #define UP_TIMEOUT (HZ/4)
static int av7110_ir_debug = 0; static int av7110_ir_debug;
#define dprintk(x...) do { if (av7110_ir_debug) printk (x); } while (0) module_param_named(debug_ir, av7110_ir_debug, int, 0644);
MODULE_PARM_DESC(av7110_ir_debug, "Turn on/off IR debugging (default:off).");
#define dprintk(x...) do { if (av7110_ir_debug) printk (x); } while (0)
static struct input_dev input_dev; static struct input_dev input_dev;
...@@ -205,6 +203,7 @@ int __init av7110_ir_init (void) ...@@ -205,6 +203,7 @@ int __init av7110_ir_init (void)
void __exit av7110_ir_exit (void) void __exit av7110_ir_exit (void)
{ {
del_timer_sync(&keyup_timer);
remove_proc_entry ("av7110_ir", NULL); remove_proc_entry ("av7110_ir", NULL);
av7110_unregister_irc_handler (av7110_emit_key); av7110_unregister_irc_handler (av7110_emit_key);
input_unregister_device(&input_dev); input_unregister_device(&input_dev);
...@@ -213,6 +212,3 @@ void __exit av7110_ir_exit (void) ...@@ -213,6 +212,3 @@ void __exit av7110_ir_exit (void)
//MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>"); //MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>");
//MODULE_LICENSE("GPL"); //MODULE_LICENSE("GPL");
MODULE_PARM(av7110_ir_debug,"i");
MODULE_PARM_DESC(av7110_ir_debug, "enable AV7110 IR receiver debug messages");
...@@ -35,23 +35,16 @@ ...@@ -35,23 +35,16 @@
#include <linux/byteorder/swabb.h> #include <linux/byteorder/swabb.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#define DEBUG_VARIABLE av7110_debug
extern int av7110_debug;
#include "dvb_i2c.h"
#include "av7110.h" #include "av7110.h"
#include "av7110_hw.h" #include "av7110_hw.h"
#include "av7110_av.h" #include "av7110_av.h"
#include "dvb_functions.h"
int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val) int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val)
{ {
u8 msg[5] = { dev, reg >> 8, reg & 0xff, val >> 8 , val & 0xff }; u8 msg[5] = { dev, reg >> 8, reg & 0xff, val >> 8 , val & 0xff };
struct dvb_i2c_bus *i2c = av7110->i2c_bus;
struct i2c_msg msgs = { .flags = 0, .addr = 0x40, .len = 5, .buf = msg }; struct i2c_msg msgs = { .flags = 0, .addr = 0x40, .len = 5, .buf = msg };
if (i2c->xfer(i2c, &msgs, 1) != 1) { if (i2c_transfer(&av7110->i2c_adap, &msgs, 1) != 1) {
printk("av7110(%d): %s(%u = %u) failed\n", printk("av7110(%d): %s(%u = %u) failed\n",
av7110->dvb_adapter->num, __FUNCTION__, reg, val); av7110->dvb_adapter->num, __FUNCTION__, reg, val);
return -EIO; return -EIO;
...@@ -63,13 +56,12 @@ int msp_readreg(struct av7110 *av7110, u8 dev, u16 reg, u16 *val) ...@@ -63,13 +56,12 @@ int msp_readreg(struct av7110 *av7110, u8 dev, u16 reg, u16 *val)
{ {
u8 msg1[3] = { dev, reg >> 8, reg & 0xff }; u8 msg1[3] = { dev, reg >> 8, reg & 0xff };
u8 msg2[2]; u8 msg2[2];
struct dvb_i2c_bus *i2c = av7110->i2c_bus;
struct i2c_msg msgs[2] = { struct i2c_msg msgs[2] = {
{ .flags = 0, .addr = 0x40, .len = 3, .buf = msg1 }, { .flags = 0, .addr = 0x40, .len = 3, .buf = msg1 },
{ .flags = I2C_M_RD, .addr = 0x40, .len = 2, .buf = msg2 } { .flags = I2C_M_RD, .addr = 0x40, .len = 2, .buf = msg2 }
}; };
if (i2c->xfer(i2c, msgs, 2) != 2) { if (i2c_transfer(&av7110->i2c_adap, &msgs[0], 2) != 2) {
printk("av7110(%d): %s(%u) failed\n", printk("av7110(%d): %s(%u) failed\n",
av7110->dvb_adapter->num, __FUNCTION__, reg); av7110->dvb_adapter->num, __FUNCTION__, reg);
return -EIO; return -EIO;
...@@ -517,7 +509,7 @@ int av7110_init_analog_module(struct av7110 *av7110) ...@@ -517,7 +509,7 @@ int av7110_init_analog_module(struct av7110 *av7110)
printk("av7110(%d): DVB-C analog module detected, initializing MSP3400\n", printk("av7110(%d): DVB-C analog module detected, initializing MSP3400\n",
av7110->dvb_adapter->num); av7110->dvb_adapter->num);
av7110->adac_type = DVB_ADAC_MSP; av7110->adac_type = DVB_ADAC_MSP;
dvb_delay(100); // the probing above resets the msp... msleep(100); // the probing above resets the msp...
msp_readreg(av7110, MSP_RD_DSP, 0x001e, &version1); msp_readreg(av7110, MSP_RD_DSP, 0x001e, &version1);
msp_readreg(av7110, MSP_RD_DSP, 0x001f, &version2); msp_readreg(av7110, MSP_RD_DSP, 0x001f, &version2);
printk("av7110(%d): MSP3400 version 0x%04x 0x%04x\n", printk("av7110(%d): MSP3400 version 0x%04x 0x%04x\n",
......
...@@ -30,14 +30,12 @@ ...@@ -30,14 +30,12 @@
* the project's page is at http://www.linuxtv.org/dvb/ * the project's page is at http://www.linuxtv.org/dvb/
*/ */
#include <media/saa7146_vv.h>
#include "budget.h" #include "budget.h"
#include "dvb_functions.h" #include <media/saa7146_vv.h>
struct budget_av { struct budget_av {
struct budget budget; struct budget budget;
struct video_device vd; struct video_device *vd;
int cur_input; int cur_input;
int has_saa7113; int has_saa7113;
}; };
...@@ -47,7 +45,7 @@ struct budget_av { ...@@ -47,7 +45,7 @@ struct budget_av {
****************************************************************************/ ****************************************************************************/
static u8 i2c_readreg (struct dvb_i2c_bus *i2c, u8 id, u8 reg) static u8 i2c_readreg (struct i2c_adapter *i2c, u8 id, u8 reg)
{ {
u8 mm1[] = {0x00}; u8 mm1[] = {0x00};
u8 mm2[] = {0x00}; u8 mm2[] = {0x00};
...@@ -60,12 +58,12 @@ static u8 i2c_readreg (struct dvb_i2c_bus *i2c, u8 id, u8 reg) ...@@ -60,12 +58,12 @@ static u8 i2c_readreg (struct dvb_i2c_bus *i2c, u8 id, u8 reg)
msgs[0].len = 1; msgs[1].len = 1; msgs[0].len = 1; msgs[1].len = 1;
msgs[0].buf = mm1; msgs[1].buf = mm2; msgs[0].buf = mm1; msgs[1].buf = mm2;
i2c->xfer(i2c, msgs, 2); i2c_transfer(i2c, msgs, 2);
return mm2[0]; return mm2[0];
} }
static int i2c_readregs(struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 *buf, u8 len) static int i2c_readregs(struct i2c_adapter *i2c, u8 id, u8 reg, u8 *buf, u8 len)
{ {
u8 mm1[] = { reg }; u8 mm1[] = { reg };
struct i2c_msg msgs[2] = { struct i2c_msg msgs[2] = {
...@@ -73,13 +71,14 @@ static int i2c_readregs(struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 *buf, u8 len) ...@@ -73,13 +71,14 @@ static int i2c_readregs(struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 *buf, u8 len)
{ .addr = id/2, .flags = I2C_M_RD, .buf = buf, .len = len } { .addr = id/2, .flags = I2C_M_RD, .buf = buf, .len = len }
}; };
if (i2c->xfer(i2c, msgs, 2) != 2) if (i2c_transfer(i2c, msgs, 2) != 2)
return -EIO; return -EIO;
return 0; return 0;
} }
static int i2c_writereg (struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 val) static int i2c_writereg (struct i2c_adapter *i2c, u8 id, u8 reg, u8 val)
{ {
u8 msg[2]={ reg, val }; u8 msg[2]={ reg, val };
struct i2c_msg msgs; struct i2c_msg msgs;
...@@ -88,7 +87,7 @@ static int i2c_writereg (struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 val) ...@@ -88,7 +87,7 @@ static int i2c_writereg (struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 val)
msgs.addr=id/2; msgs.addr=id/2;
msgs.len=2; msgs.len=2;
msgs.buf=msg; msgs.buf=msg;
return i2c->xfer (i2c, &msgs, 1); return i2c_transfer(i2c, &msgs, 1);
} }
...@@ -127,7 +126,7 @@ static int saa7113_init (struct budget_av *budget_av) ...@@ -127,7 +126,7 @@ static int saa7113_init (struct budget_av *budget_av)
struct budget *budget = &budget_av->budget; struct budget *budget = &budget_av->budget;
const u8 *data = saa7113_tab; const u8 *data = saa7113_tab;
if (i2c_writereg (budget->i2c_bus, 0x4a, 0x01, 0x08) != 1) { if (i2c_writereg (&budget->i2c_adap, 0x4a, 0x01, 0x08) != 1) {
DEB_D(("saa7113: not found on KNC card\n")); DEB_D(("saa7113: not found on KNC card\n"));
return -ENODEV; return -ENODEV;
} }
...@@ -135,12 +134,12 @@ static int saa7113_init (struct budget_av *budget_av) ...@@ -135,12 +134,12 @@ static int saa7113_init (struct budget_av *budget_av)
INFO(("saa7113: detected and initializing\n")); INFO(("saa7113: detected and initializing\n"));
while (*data != 0xff) { while (*data != 0xff) {
i2c_writereg(budget->i2c_bus, 0x4a, *data, *(data+1)); i2c_writereg(&budget->i2c_adap, 0x4a, *data, *(data+1));
data += 2; data += 2;
} }
DEB_D(("saa7113: status=%02x\n", DEB_D(("saa7113: status=%02x\n",
i2c_readreg(budget->i2c_bus, 0x4a, 0x1f))); i2c_readreg(&budget->i2c_adap, 0x4a, 0x1f)));
return 0; return 0;
} }
...@@ -154,11 +153,11 @@ static int saa7113_setinput (struct budget_av *budget_av, int input) ...@@ -154,11 +153,11 @@ static int saa7113_setinput (struct budget_av *budget_av, int input)
return -ENODEV; return -ENODEV;
if (input == 1) { if (input == 1) {
i2c_writereg(budget->i2c_bus, 0x4a, 0x02, 0xc7); i2c_writereg(&budget->i2c_adap, 0x4a, 0x02, 0xc7);
i2c_writereg(budget->i2c_bus, 0x4a, 0x09, 0x80); i2c_writereg(&budget->i2c_adap, 0x4a, 0x09, 0x80);
} else if (input == 0) { } else if (input == 0) {
i2c_writereg(budget->i2c_bus, 0x4a, 0x02, 0xc0); i2c_writereg(&budget->i2c_adap, 0x4a, 0x02, 0xc0);
i2c_writereg(budget->i2c_bus, 0x4a, 0x09, 0x00); i2c_writereg(&budget->i2c_adap, 0x4a, 0x09, 0x00);
} else } else
return -EINVAL; return -EINVAL;
...@@ -177,7 +176,7 @@ static int budget_av_detach (struct saa7146_dev *dev) ...@@ -177,7 +176,7 @@ static int budget_av_detach (struct saa7146_dev *dev)
if ( 1 == budget_av->has_saa7113 ) { if ( 1 == budget_av->has_saa7113 ) {
saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO); saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO);
dvb_delay(200); msleep(200);
saa7146_unregister_device (&budget_av->vd, dev); saa7146_unregister_device (&budget_av->vd, dev);
} }
...@@ -201,7 +200,7 @@ static int budget_av_attach (struct saa7146_dev* dev, ...@@ -201,7 +200,7 @@ static int budget_av_attach (struct saa7146_dev* dev,
DEB_EE(("dev: %p\n",dev)); DEB_EE(("dev: %p\n",dev));
if (bi->type != BUDGET_KNC1) { if (bi->type != BUDGET_KNC1 && bi->type != BUDGET_CIN1200) {
return -ENODEV; return -ENODEV;
} }
...@@ -210,13 +209,13 @@ static int budget_av_attach (struct saa7146_dev* dev, ...@@ -210,13 +209,13 @@ static int budget_av_attach (struct saa7146_dev* dev,
memset(budget_av, 0, sizeof(struct budget_av)); memset(budget_av, 0, sizeof(struct budget_av));
dev->ext_priv = budget_av;
if ((err = ttpci_budget_init(&budget_av->budget, dev, info))) { if ((err = ttpci_budget_init(&budget_av->budget, dev, info))) {
kfree(budget_av); kfree(budget_av);
return err; return err;
} }
dev->ext_priv = budget_av;
/* knc1 initialization */ /* knc1 initialization */
saa7146_write(dev, DD1_STREAM_B, 0x04000000); saa7146_write(dev, DD1_STREAM_B, 0x04000000);
saa7146_write(dev, DD1_INIT, 0x07000600); saa7146_write(dev, DD1_INIT, 0x07000600);
...@@ -225,7 +224,7 @@ static int budget_av_attach (struct saa7146_dev* dev, ...@@ -225,7 +224,7 @@ static int budget_av_attach (struct saa7146_dev* dev,
//test_knc_ci(av7110); //test_knc_ci(av7110);
saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTHI); saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTHI);
dvb_delay(500); msleep(500);
if ( 0 == saa7113_init(budget_av) ) { if ( 0 == saa7113_init(budget_av) ) {
budget_av->has_saa7113 = 1; budget_av->has_saa7113 = 1;
...@@ -259,7 +258,7 @@ static int budget_av_attach (struct saa7146_dev* dev, ...@@ -259,7 +258,7 @@ static int budget_av_attach (struct saa7146_dev* dev,
saa7146_write(dev, PCI_BT_V1, 0x1c00101f); saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
mac = budget_av->budget.dvb_adapter->proposed_mac; mac = budget_av->budget.dvb_adapter->proposed_mac;
if (i2c_readregs(budget_av->budget.i2c_bus, 0xa0, 0x30, mac, 6)) { if (i2c_readregs(&budget_av->budget.i2c_adap, 0xa0, 0x30, mac, 6)) {
printk("KNC1-%d: Could not read MAC from KNC1 card\n", printk("KNC1-%d: Could not read MAC from KNC1 card\n",
budget_av->budget.dvb_adapter->num); budget_av->budget.dvb_adapter->num);
memset(mac, 0, 6); memset(mac, 0, 6);
...@@ -361,9 +360,11 @@ static struct saa7146_extension budget_extension; ...@@ -361,9 +360,11 @@ static struct saa7146_extension budget_extension;
MAKE_BUDGET_INFO(knc1, "KNC1 DVB-S", BUDGET_KNC1); MAKE_BUDGET_INFO(knc1, "KNC1 DVB-S", BUDGET_KNC1);
MAKE_BUDGET_INFO(cin1200, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200);
static struct pci_device_id pci_tbl [] = { static struct pci_device_id pci_tbl [] = {
MAKE_EXTENSION_PCI(knc1, 0x1131, 0x4f56), MAKE_EXTENSION_PCI(knc1, 0x1131, 0x4f56),
MAKE_EXTENSION_PCI(cin1200, 0x153b, 0x1154),
{ {
.vendor = 0, .vendor = 0,
} }
......
...@@ -38,13 +38,8 @@ ...@@ -38,13 +38,8 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include "dvb_functions.h"
#include "dvb_ca_en50221.h" #include "dvb_ca_en50221.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "input_fake.h"
#endif
#define DEBIADDR_IR 0x1234 #define DEBIADDR_IR 0x1234
#define DEBIADDR_CICONTROL 0x0000 #define DEBIADDR_CICONTROL 0x0000
#define DEBIADDR_CIVERSION 0x4000 #define DEBIADDR_CIVERSION 0x4000
...@@ -79,14 +74,15 @@ static u32 budget_debiread (struct budget_ci* budget_ci, u32 config, int addr, i ...@@ -79,14 +74,15 @@ static u32 budget_debiread (struct budget_ci* budget_ci, u32 config, int addr, i
{ {
struct saa7146_dev *saa = budget_ci->budget.dev; struct saa7146_dev *saa = budget_ci->budget.dev;
u32 result = 0; u32 result = 0;
unsigned long flags;
if (count > 4 || count <= 0) if (count > 4 || count <= 0)
return 0; return 0;
spin_lock(&budget_ci->debilock); spin_lock_irqsave(&budget_ci->debilock, flags);
if (saa7146_wait_for_debi_done(saa) < 0) { if (saa7146_wait_for_debi_done(saa) < 0) {
spin_unlock(&budget_ci->debilock); spin_unlock_irqrestore(&budget_ci->debilock, flags);
return 0; return 0;
} }
...@@ -101,21 +97,22 @@ static u32 budget_debiread (struct budget_ci* budget_ci, u32 config, int addr, i ...@@ -101,21 +97,22 @@ static u32 budget_debiread (struct budget_ci* budget_ci, u32 config, int addr, i
result = saa7146_read(saa, 0x88); result = saa7146_read(saa, 0x88);
result &= (0xffffffffUL >> ((4 - count) * 8)); result &= (0xffffffffUL >> ((4 - count) * 8));
spin_unlock(&budget_ci->debilock); spin_unlock_irqrestore(&budget_ci->debilock, flags);
return result; return result;
} }
static u8 budget_debiwrite (struct budget_ci* budget_ci, u32 config, int addr, int count, u32 value) static u8 budget_debiwrite (struct budget_ci* budget_ci, u32 config, int addr, int count, u32 value)
{ {
struct saa7146_dev *saa = budget_ci->budget.dev; struct saa7146_dev *saa = budget_ci->budget.dev;
unsigned long flags;
if (count > 4 || count <= 0) if (count > 4 || count <= 0)
return 0; return 0;
spin_lock(&budget_ci->debilock); spin_lock_irqsave(&budget_ci->debilock, flags);
if (saa7146_wait_for_debi_done(saa) < 0) { if (saa7146_wait_for_debi_done(saa) < 0) {
spin_unlock(&budget_ci->debilock); spin_unlock_irqrestore(&budget_ci->debilock, flags);
return 0; return 0;
} }
...@@ -128,7 +125,7 @@ static u8 budget_debiwrite (struct budget_ci* budget_ci, u32 config, int addr, i ...@@ -128,7 +125,7 @@ static u8 budget_debiwrite (struct budget_ci* budget_ci, u32 config, int addr, i
saa7146_wait_for_debi_done(saa); saa7146_wait_for_debi_done(saa);
spin_unlock(&budget_ci->debilock); spin_unlock_irqrestore(&budget_ci->debilock, flags);
return 0; return 0;
} }
...@@ -326,7 +323,7 @@ static int ciintf_slot_reset(struct dvb_ca_en50221* ca, int slot) { ...@@ -326,7 +323,7 @@ static int ciintf_slot_reset(struct dvb_ca_en50221* ca, int slot) {
saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI); saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI);
budget_ci->slot_status = SLOTSTATUS_RESET; budget_ci->slot_status = SLOTSTATUS_RESET;
budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, 0); budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, 0);
dvb_delay(1); msleep(1);
budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, CICONTROL_RESET); budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, CICONTROL_RESET);
saa7146_setgpio(saa, 1, SAA7146_GPIO_OUTHI); saa7146_setgpio(saa, 1, SAA7146_GPIO_OUTHI);
...@@ -372,14 +369,13 @@ static void ciintf_interrupt (unsigned long data) ...@@ -372,14 +369,13 @@ static void ciintf_interrupt (unsigned long data)
// ensure we don't get spurious IRQs during initialisation // ensure we don't get spurious IRQs during initialisation
if (!budget_ci->budget.ci_present) return; if (!budget_ci->budget.ci_present) return;
// read the CAM status
flags = budget_debiread(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1); flags = budget_debiread(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1);
if (flags & CICONTROL_CAMDETECT) {
// always set the GPIO mode back to "normal", in case the card is // GPIO should be set to trigger on falling edge if a CAM is present
// yanked at an inopportune moment
saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO); saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO);
if (flags & CICONTROL_CAMDETECT) {
if (budget_ci->slot_status & SLOTSTATUS_NONE) { if (budget_ci->slot_status & SLOTSTATUS_NONE) {
// CAM insertion IRQ // CAM insertion IRQ
budget_ci->slot_status = SLOTSTATUS_PRESENT; budget_ci->slot_status = SLOTSTATUS_PRESENT;
...@@ -395,7 +391,15 @@ static void ciintf_interrupt (unsigned long data) ...@@ -395,7 +391,15 @@ static void ciintf_interrupt (unsigned long data)
dvb_ca_en50221_frda_irq(&budget_ci->ca, 0); dvb_ca_en50221_frda_irq(&budget_ci->ca, 0);
} }
} else { } else {
// trigger on rising edge if a CAM is not present - when a CAM is inserted, we
// only want to get the IRQ when it sets READY. If we trigger on the falling edge,
// the CAM might not actually be ready yet.
saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI);
// generate a CAM removal IRQ if we haven't already
if (budget_ci->slot_status & SLOTSTATUS_OCCUPIED) { if (budget_ci->slot_status & SLOTSTATUS_OCCUPIED) {
// CAM removal IRQ
budget_ci->slot_status = SLOTSTATUS_NONE; budget_ci->slot_status = SLOTSTATUS_NONE;
dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, DVB_CA_EN50221_CAMCHANGE_REMOVED); dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, DVB_CA_EN50221_CAMCHANGE_REMOVED);
} }
...@@ -446,7 +450,11 @@ static int ciintf_init(struct budget_ci* budget_ci) ...@@ -446,7 +450,11 @@ static int ciintf_init(struct budget_ci* budget_ci)
// Setup CI slot IRQ // Setup CI slot IRQ
tasklet_init (&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci); tasklet_init (&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci);
if (budget_ci->slot_status != SLOTSTATUS_NONE) {
saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO); saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO);
} else {
saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI);
}
saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_03); saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_03);
budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, CICONTROL_RESET); budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, CICONTROL_RESET);
...@@ -475,7 +483,7 @@ static void ciintf_deinit(struct budget_ci* budget_ci) ...@@ -475,7 +483,7 @@ static void ciintf_deinit(struct budget_ci* budget_ci)
saa7146_setgpio(saa, 0, SAA7146_GPIO_INPUT); saa7146_setgpio(saa, 0, SAA7146_GPIO_INPUT);
tasklet_kill(&budget_ci->ciintf_irq_tasklet); tasklet_kill(&budget_ci->ciintf_irq_tasklet);
budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, 0); budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, 0);
dvb_delay(1); msleep(1);
budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, CICONTROL_RESET); budget_debiwrite(budget_ci, DEBICICTL, DEBIADDR_CICONTROL, 1, CICONTROL_RESET);
// disable TS data stream to CI interface // disable TS data stream to CI interface
...@@ -520,20 +528,19 @@ static int budget_ci_attach (struct saa7146_dev* dev, ...@@ -520,20 +528,19 @@ static int budget_ci_attach (struct saa7146_dev* dev,
spin_lock_init(&budget_ci->debilock); spin_lock_init(&budget_ci->debilock);
budget_ci->budget.ci_present = 0; budget_ci->budget.ci_present = 0;
dev->ext_priv = budget_ci;
if ((err = ttpci_budget_init (&budget_ci->budget, dev, info))) { if ((err = ttpci_budget_init (&budget_ci->budget, dev, info))) {
kfree (budget_ci); kfree (budget_ci);
return err; return err;
} }
dev->ext_priv = budget_ci;
tasklet_init (&budget_ci->msp430_irq_tasklet, msp430_ir_interrupt, tasklet_init (&budget_ci->msp430_irq_tasklet, msp430_ir_interrupt,
(unsigned long) budget_ci); (unsigned long) budget_ci);
msp430_ir_init (budget_ci); msp430_ir_init (budget_ci);
// UNCOMMENT TO TEST CI INTERFACE ciintf_init(budget_ci);
// ciintf_init(budget_ci);
return 0; return 0;
} }
......
...@@ -34,10 +34,15 @@ ...@@ -34,10 +34,15 @@
* the project's page is at http://www.linuxtv.org/dvb/ * the project's page is at http://www.linuxtv.org/dvb/
*/ */
#include <linux/moduleparam.h>
#include "budget.h" #include "budget.h"
#include "ttpci-eeprom.h" #include "ttpci-eeprom.h"
int budget_debug = 0; int budget_debug;
module_param_named(debug, budget_debug, int, 0644);
MODULE_PARM_DESC(budget_debug, "Turn on/off budget debugging (default:off).");
/**************************************************************************** /****************************************************************************
* TT budget / WinTV Nova * TT budget / WinTV Nova
...@@ -258,13 +263,26 @@ static void budget_unregister(struct budget *budget) ...@@ -258,13 +263,26 @@ static void budget_unregister(struct budget *budget)
dvb_dmx_release(&budget->demux); dvb_dmx_release(&budget->demux);
} }
/* fixme: can this be unified among all saa7146 based dvb cards? */
static int master_xfer (struct dvb_i2c_bus *i2c, const struct i2c_msg msgs[], int num) static int client_register(struct i2c_client *client)
{ {
struct saa7146_dev *dev = i2c->data; struct saa7146_dev *dev = (struct saa7146_dev*)i2c_get_adapdata(client->adapter);
return saa7146_i2c_transfer(dev, msgs, num, 6); struct budget *budget = (struct budget*)dev->ext_priv;
if (client->driver->command)
return client->driver->command(client, FE_REGISTER, budget->dvb_adapter);
return 0;
} }
static int client_unregister(struct i2c_client *client)
{
struct saa7146_dev *dev = (struct saa7146_dev*)i2c_get_adapdata(client->adapter);
struct budget *budget = (struct budget*)dev->ext_priv;
if (client->driver->command)
return client->driver->command(client, FE_UNREGISTER, budget->dvb_adapter);
return 0;
}
int ttpci_budget_init (struct budget *budget, int ttpci_budget_init (struct budget *budget,
struct saa7146_dev* dev, struct saa7146_dev* dev,
...@@ -301,17 +319,27 @@ int ttpci_budget_init (struct budget *budget, ...@@ -301,17 +319,27 @@ int ttpci_budget_init (struct budget *budget,
if (bi->type != BUDGET_FS_ACTIVY) if (bi->type != BUDGET_FS_ACTIVY)
saa7146_write(dev, GPIO_CTRL, 0x500000); /* GPIO 3 = 1 */ saa7146_write(dev, GPIO_CTRL, 0x500000); /* GPIO 3 = 1 */
saa7146_i2c_adapter_prepare(dev, NULL, 0, SAA7146_I2C_BUS_BIT_RATE_120); budget->i2c_adap = (struct i2c_adapter) {
.client_register = client_register,
budget->i2c_bus = dvb_register_i2c_bus (master_xfer, dev, .client_unregister = client_unregister,
budget->dvb_adapter, 0); #ifdef I2C_ADAP_CLASS_TV_DIGITAL
.class = I2C_ADAP_CLASS_TV_DIGITAL,
if (!budget->i2c_bus) { #else
.class = I2C_CLASS_TV_DIGITAL,
#endif
};
strlcpy(budget->i2c_adap.name, budget->card->name, sizeof(budget->i2c_adap.name));
saa7146_i2c_adapter_prepare(dev, &budget->i2c_adap, SAA7146_I2C_BUS_BIT_RATE_120);
strcpy(budget->i2c_adap.name, budget->card->name);
if (i2c_add_adapter(&budget->i2c_adap) < 0) {
dvb_unregister_adapter (budget->dvb_adapter); dvb_unregister_adapter (budget->dvb_adapter);
return -ENOMEM; return -ENOMEM;
} }
ttpci_eeprom_parse_mac(budget->i2c_bus); ttpci_eeprom_parse_mac(&budget->i2c_adap, budget->dvb_adapter->proposed_mac);
if( NULL == (budget->grabbing = saa7146_vmalloc_build_pgtable(dev->pci,length,&budget->pt))) { if( NULL == (budget->grabbing = saa7146_vmalloc_build_pgtable(dev->pci,length,&budget->pt))) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -334,12 +362,11 @@ int ttpci_budget_init (struct budget *budget, ...@@ -334,12 +362,11 @@ int ttpci_budget_init (struct budget *budget,
return 0; return 0;
} }
err: err:
i2c_del_adapter(&budget->i2c_adap);
if (budget->grabbing) if (budget->grabbing)
vfree(budget->grabbing); vfree(budget->grabbing);
dvb_unregister_i2c_bus (master_xfer,budget->i2c_bus->adapter,
budget->i2c_bus->id);
dvb_unregister_adapter (budget->dvb_adapter); dvb_unregister_adapter (budget->dvb_adapter);
return ret; return ret;
...@@ -354,8 +381,7 @@ int ttpci_budget_deinit (struct budget *budget) ...@@ -354,8 +381,7 @@ int ttpci_budget_deinit (struct budget *budget)
budget_unregister (budget); budget_unregister (budget);
dvb_unregister_i2c_bus (master_xfer, budget->i2c_bus->adapter, i2c_del_adapter(&budget->i2c_adap);
budget->i2c_bus->id);
dvb_unregister_adapter (budget->dvb_adapter); dvb_unregister_adapter (budget->dvb_adapter);
...@@ -402,7 +428,5 @@ EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler); ...@@ -402,7 +428,5 @@ EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler);
EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port); EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port);
EXPORT_SYMBOL_GPL(budget_debug); EXPORT_SYMBOL_GPL(budget_debug);
MODULE_PARM(budget_debug,"i");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
*/ */
#include "budget.h" #include "budget.h"
#include "dvb_functions.h"
static void Set22K (struct budget *budget, int state) static void Set22K (struct budget *budget, int state)
{ {
...@@ -100,7 +99,7 @@ static int SendDiSEqCMsg (struct budget *budget, int len, u8 *msg, unsigned long ...@@ -100,7 +99,7 @@ static int SendDiSEqCMsg (struct budget *budget, int len, u8 *msg, unsigned long
udelay(12500); udelay(12500);
saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO);
} }
dvb_delay(20); msleep(20);
} }
return 0; return 0;
...@@ -202,6 +201,8 @@ static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ ...@@ -202,6 +201,8 @@ static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
DEB_EE(("dev:%p, info:%p, budget:%p\n",dev,info,budget)); DEB_EE(("dev:%p, info:%p, budget:%p\n",dev,info,budget));
dev->ext_priv = budget;
if ((err = ttpci_budget_init (budget, dev, info))) { if ((err = ttpci_budget_init (budget, dev, info))) {
printk("==> failed\n"); printk("==> failed\n");
kfree (budget); kfree (budget);
...@@ -215,8 +216,6 @@ static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ ...@@ -215,8 +216,6 @@ static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
dvb_add_frontend_ioctls (budget->dvb_adapter, dvb_add_frontend_ioctls (budget->dvb_adapter,
budget_diseqc_ioctl, NULL, budget); budget_diseqc_ioctl, NULL, budget);
dev->ext_priv = budget;
return 0; return 0;
} }
......
#ifndef __BUDGET_DVB__ #ifndef __BUDGET_DVB__
#define __BUDGET_DVB__ #define __BUDGET_DVB__
#include <media/saa7146.h>
#include "dvb_i2c.h"
#include "dvb_frontend.h" #include "dvb_frontend.h"
#include "dvbdev.h" #include "dvbdev.h"
#include "demux.h" #include "demux.h"
...@@ -12,6 +9,8 @@ ...@@ -12,6 +9,8 @@
#include "dvb_filter.h" #include "dvb_filter.h"
#include "dvb_net.h" #include "dvb_net.h"
#include <media/saa7146.h>
extern int budget_debug; extern int budget_debug;
struct budget_info { struct budget_info {
...@@ -28,7 +27,7 @@ struct budget { ...@@ -28,7 +27,7 @@ struct budget {
struct saa7146_dev *dev; struct saa7146_dev *dev;
struct dvb_i2c_bus *i2c_bus; struct i2c_adapter i2c_adap;
struct budget_info *card; struct budget_info *card;
unsigned char *grabbing; unsigned char *grabbing;
...@@ -79,6 +78,7 @@ static struct saa7146_pci_extension_data x_var = { \ ...@@ -79,6 +78,7 @@ static struct saa7146_pci_extension_data x_var = { \
#define BUDGET_KNC1 2 #define BUDGET_KNC1 2
#define BUDGET_PATCH 3 #define BUDGET_PATCH 3
#define BUDGET_FS_ACTIVY 4 #define BUDGET_FS_ACTIVY 4
#define BUDGET_CIN1200 5
#define BUDGET_VIDEO_PORTA 0 #define BUDGET_VIDEO_PORTA 0
#define BUDGET_VIDEO_PORTB 1 #define BUDGET_VIDEO_PORTB 1
......
...@@ -35,9 +35,8 @@ ...@@ -35,9 +35,8 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/i2c.h>
#include "dvb_i2c.h"
#include "dvb_functions.h"
#if 1 #if 1
#define dprintk(x...) do { printk(x); } while (0) #define dprintk(x...) do { printk(x); } while (0)
...@@ -85,7 +84,7 @@ static int getmac_tt(u8 * decodedMAC, u8 * encodedMAC) ...@@ -85,7 +84,7 @@ static int getmac_tt(u8 * decodedMAC, u8 * encodedMAC)
return 0; return 0;
} }
static int ttpci_eeprom_read_encodedMAC(struct dvb_i2c_bus *i2c, u8 * encodedMAC) static int ttpci_eeprom_read_encodedMAC(struct i2c_adapter *adapter, u8 * encodedMAC)
{ {
int ret; int ret;
u8 b0[] = { 0xcc }; u8 b0[] = { 0xcc };
...@@ -97,7 +96,7 @@ static int ttpci_eeprom_read_encodedMAC(struct dvb_i2c_bus *i2c, u8 * encodedMAC ...@@ -97,7 +96,7 @@ static int ttpci_eeprom_read_encodedMAC(struct dvb_i2c_bus *i2c, u8 * encodedMAC
/* dprintk("%s\n", __FUNCTION__); */ /* dprintk("%s\n", __FUNCTION__); */
ret = i2c->xfer(i2c, msg, 2); ret = i2c_transfer(adapter, msg, 2);
if (ret != 2) /* Assume EEPROM isn't there */ if (ret != 2) /* Assume EEPROM isn't there */
return (-ENODEV); return (-ENODEV);
...@@ -106,36 +105,34 @@ static int ttpci_eeprom_read_encodedMAC(struct dvb_i2c_bus *i2c, u8 * encodedMAC ...@@ -106,36 +105,34 @@ static int ttpci_eeprom_read_encodedMAC(struct dvb_i2c_bus *i2c, u8 * encodedMAC
} }
int ttpci_eeprom_parse_mac(struct dvb_i2c_bus *i2c) int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 *proposed_mac)
{ {
int ret, i; int ret, i;
u8 encodedMAC[20]; u8 encodedMAC[20];
u8 decodedMAC[6]; u8 decodedMAC[6];
ret = ttpci_eeprom_read_encodedMAC(i2c, encodedMAC); ret = ttpci_eeprom_read_encodedMAC(adapter, encodedMAC);
if (ret != 0) { /* Will only be -ENODEV */ if (ret != 0) { /* Will only be -ENODEV */
dprintk("Couldn't read from EEPROM: not there?\n"); dprintk("Couldn't read from EEPROM: not there?\n");
memset(i2c->adapter->proposed_mac, 0, 6); memset(proposed_mac, 0, 6);
return ret; return ret;
} }
ret = getmac_tt(decodedMAC, encodedMAC); ret = getmac_tt(decodedMAC, encodedMAC);
if( ret != 0 ) { if( ret != 0 ) {
dprintk("%s adapter %i failed MAC signature check\n", dprintk("adapter failed MAC signature check\n");
i2c->adapter->name, i2c->adapter->num);
dprintk("encoded MAC from EEPROM was " ); dprintk("encoded MAC from EEPROM was " );
for(i=0; i<19; i++) { for(i=0; i<19; i++) {
dprintk( "%.2x:", encodedMAC[i]); dprintk( "%.2x:", encodedMAC[i]);
} }
dprintk("%.2x\n", encodedMAC[19]); dprintk("%.2x\n", encodedMAC[19]);
memset(i2c->adapter->proposed_mac, 0, 6); memset(proposed_mac, 0, 6);
return ret; return ret;
} }
memcpy(i2c->adapter->proposed_mac, decodedMAC, 6); memcpy(proposed_mac, decodedMAC, 6);
dprintk("%s adapter %i has MAC addr = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", dprintk("adapter has MAC addr = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
i2c->adapter->name, i2c->adapter->num,
decodedMAC[0], decodedMAC[1], decodedMAC[2], decodedMAC[0], decodedMAC[1], decodedMAC[2],
decodedMAC[3], decodedMAC[4], decodedMAC[5]); decodedMAC[3], decodedMAC[4], decodedMAC[5]);
return 0; return 0;
......
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
#ifndef __TTPCI_EEPROM_H__ #ifndef __TTPCI_EEPROM_H__
#define __TTPCI_EEPROM_H__ #define __TTPCI_EEPROM_H__
#include "dvb_i2c.h" #include <linux/types.h>
#include <linux/i2c.h>
extern int ttpci_eeprom_parse_mac(struct dvb_i2c_bus *i2c); extern int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 *propsed_mac);
#endif #endif
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/time.h> #include <linux/time.h>
...@@ -28,8 +29,6 @@ ...@@ -28,8 +29,6 @@
#include <linux/dvb/dmx.h> #include <linux/dvb/dmx.h>
#include <linux/pci.h> #include <linux/pci.h>
#include "dvb_functions.h"
/* /*
TTUSB_HWSECTIONS: TTUSB_HWSECTIONS:
the DSP supports filtering in hardware, however, since the "muxstream" the DSP supports filtering in hardware, however, since the "muxstream"
...@@ -49,7 +48,10 @@ ...@@ -49,7 +48,10 @@
this unless the device doesn't load at all. > 2 for bandwidth statistics. this unless the device doesn't load at all. > 2 for bandwidth statistics.
*/ */
static int debug = 0; static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
#define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0) #define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0)
...@@ -80,6 +82,8 @@ struct ttusb { ...@@ -80,6 +82,8 @@ struct ttusb {
struct dvb_adapter *adapter; struct dvb_adapter *adapter;
struct usb_device *dev; struct usb_device *dev;
struct i2c_adapter i2c_adap;
int disconnecting; int disconnecting;
int iso_streaming; int iso_streaming;
...@@ -242,10 +246,9 @@ static int ttusb_i2c_msg(struct ttusb *ttusb, ...@@ -242,10 +246,9 @@ static int ttusb_i2c_msg(struct ttusb *ttusb,
return rcv_len; return rcv_len;
} }
static int ttusb_i2c_xfer(struct dvb_i2c_bus *i2c, const struct i2c_msg msg[], static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg msg[], int num)
int num)
{ {
struct ttusb *ttusb = i2c->data; struct ttusb *ttusb = i2c_get_adapdata(adapter);
int i = 0; int i = 0;
int inc; int inc;
...@@ -514,7 +517,7 @@ static int ttusb_set_tone(struct ttusb *ttusb, fe_sec_tone_mode_t tone) ...@@ -514,7 +517,7 @@ static int ttusb_set_tone(struct ttusb *ttusb, fe_sec_tone_mode_t tone)
static int ttusb_lnb_ioctl(struct dvb_frontend *fe, unsigned int cmd, void *arg) static int ttusb_lnb_ioctl(struct dvb_frontend *fe, unsigned int cmd, void *arg)
{ {
struct ttusb *ttusb = fe->i2c->data; struct ttusb *ttusb = fe->before_after_data;
switch (cmd) { switch (cmd) {
case FE_SET_VOLTAGE: case FE_SET_VOLTAGE:
...@@ -787,7 +790,7 @@ static void ttusb_iso_irq(struct urb *urb, struct pt_regs *ptregs) ...@@ -787,7 +790,7 @@ static void ttusb_iso_irq(struct urb *urb, struct pt_regs *ptregs)
ttusb_process_frame(ttusb, data, len); ttusb_process_frame(ttusb, data, len);
} }
} }
usb_submit_urb(urb, GFP_KERNEL); usb_submit_urb(urb, GFP_ATOMIC);
} }
static void ttusb_free_iso_urbs(struct ttusb *ttusb) static void ttusb_free_iso_urbs(struct ttusb *ttusb)
...@@ -822,7 +825,7 @@ static int ttusb_alloc_iso_urbs(struct ttusb *ttusb) ...@@ -822,7 +825,7 @@ static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
if (! if (!
(urb = (urb =
usb_alloc_urb(FRAMES_PER_ISO_BUF, GFP_KERNEL))) { usb_alloc_urb(FRAMES_PER_ISO_BUF, GFP_ATOMIC))) {
ttusb_free_iso_urbs(ttusb); ttusb_free_iso_urbs(ttusb);
return -ENOMEM; return -ENOMEM;
} }
...@@ -880,7 +883,7 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb) ...@@ -880,7 +883,7 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb)
} }
for (i = 0; i < ISO_BUF_COUNT; i++) { for (i = 0; i < ISO_BUF_COUNT; i++) {
if ((err = usb_submit_urb(ttusb->iso_urb[i], GFP_KERNEL))) { if ((err = usb_submit_urb(ttusb->iso_urb[i], GFP_ATOMIC))) {
ttusb_stop_iso_xfer(ttusb); ttusb_stop_iso_xfer(ttusb);
printk printk
("%s: failed urb submission (%i: err = %i)!\n", ("%s: failed urb submission (%i: err = %i)!\n",
...@@ -1068,6 +1071,38 @@ static struct file_operations stc_fops = { ...@@ -1068,6 +1071,38 @@ static struct file_operations stc_fops = {
}; };
#endif #endif
u32 functionality(struct i2c_adapter *adapter)
{
return I2C_FUNC_I2C;
}
static struct i2c_algorithm ttusb_dec_algo = {
.name = "ttusb dec i2c algorithm",
.id = I2C_ALGO_BIT,
.master_xfer = master_xfer,
.functionality = functionality,
};
static int client_register(struct i2c_client *client)
{
struct ttusb *ttusb = (struct ttusb*)i2c_get_adapdata(client->adapter);
if (client->driver->command)
return client->driver->command(client, FE_REGISTER, ttusb->adapter);
return 0;
}
static int client_unregister(struct i2c_client *client)
{
struct ttusb *ttusb = (struct ttusb*)i2c_get_adapdata(client->adapter);
if (client->driver->command)
return client->driver->command(client, FE_UNREGISTER, ttusb->adapter);
return 0;
}
static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *id) static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
{ {
struct usb_device *udev; struct usb_device *udev;
...@@ -1078,17 +1113,6 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -1078,17 +1113,6 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
udev = interface_to_usbdev(intf); udev = interface_to_usbdev(intf);
/* Device has already been reset; its configuration was chosen.
* If this fault happens, use a hotplug script to choose the
* right configuration (write bConfigurationValue in sysfs).
*/
if (udev->actconfig->desc.bConfigurationValue != 1) {
dev_err(&intf->dev, "device config is #%d, need #1\n",
udev->actconfig->desc.bConfigurationValue);
return -ENODEV;
}
if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV; if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV;
if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL))) if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL)))
...@@ -1117,7 +1141,29 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -1117,7 +1141,29 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE); dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE);
dvb_register_i2c_bus(ttusb_i2c_xfer, ttusb, ttusb->adapter, 0); /* i2c */
memset(&ttusb->i2c_adap, 0, sizeof(struct i2c_adapter));
strcpy(ttusb->i2c_adap.name, "TTUSB DEC");
i2c_set_adapdata(&ttusb->i2c_adap, ttusb);
#ifdef I2C_ADAP_CLASS_TV_DIGITAL
ttusb->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL;
#else
ttusb->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
#endif
ttusb->i2c_adap.algo = &ttusb_dec_algo;
ttusb->i2c_adap.algo_data = NULL;
ttusb->i2c_adap.id = I2C_ALGO_BIT;
ttusb->i2c_adap.client_register = client_register;
ttusb->i2c_adap.client_unregister = client_unregister;
result = i2c_add_adapter(&ttusb->i2c_adap);
if (result) {
dvb_unregister_adapter (ttusb->adapter);
return result;
}
dvb_add_frontend_ioctls(ttusb->adapter, ttusb_lnb_ioctl, NULL, dvb_add_frontend_ioctls(ttusb->adapter, ttusb_lnb_ioctl, NULL,
ttusb); ttusb);
...@@ -1137,9 +1183,10 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -1137,9 +1183,10 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
ttusb->dvb_demux.write_to_decoder = NULL; ttusb->dvb_demux.write_to_decoder = NULL;
if ((result = dvb_dmx_init(&ttusb->dvb_demux)) < 0) { if ((result = dvb_dmx_init(&ttusb->dvb_demux)) < 0) {
printk("ttusb_dvb: dvb_dmx_init failed (errno = %d)\n", printk("ttusb_dvb: dvb_dmx_init failed (errno = %d)\n", result);
result); i2c_del_adapter(&ttusb->i2c_adap);
goto err; dvb_unregister_adapter (ttusb->adapter);
return -ENODEV;
} }
//FIXME dmxdev (nur WAS?) //FIXME dmxdev (nur WAS?)
ttusb->dmxdev.filternum = ttusb->dvb_demux.filternum; ttusb->dmxdev.filternum = ttusb->dvb_demux.filternum;
...@@ -1150,15 +1197,20 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -1150,15 +1197,20 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
printk("ttusb_dvb: dvb_dmxdev_init failed (errno = %d)\n", printk("ttusb_dvb: dvb_dmxdev_init failed (errno = %d)\n",
result); result);
dvb_dmx_release(&ttusb->dvb_demux); dvb_dmx_release(&ttusb->dvb_demux);
goto err; i2c_del_adapter(&ttusb->i2c_adap);
dvb_unregister_adapter (ttusb->adapter);
return -ENODEV;
} }
if (dvb_net_init if (dvb_net_init(ttusb->adapter, &ttusb->dvbnet, &ttusb->dvb_demux.dmx)) {
(ttusb->adapter, &ttusb->dvbnet, &ttusb->dvb_demux.dmx)) {
printk("ttusb_dvb: dvb_net_init failed!\n"); printk("ttusb_dvb: dvb_net_init failed!\n");
dvb_dmxdev_release(&ttusb->dmxdev);
dvb_dmx_release(&ttusb->dvb_demux);
i2c_del_adapter(&ttusb->i2c_adap);
dvb_unregister_adapter (ttusb->adapter);
return -ENODEV;
} }
err:
#if 0 #if 0
ttusb->stc_devfs_handle = ttusb->stc_devfs_handle =
devfs_register(ttusb->adapter->devfs_handle, TTUSB_BUDGET_NAME, devfs_register(ttusb->adapter->devfs_handle, TTUSB_BUDGET_NAME,
...@@ -1187,7 +1239,7 @@ static void ttusb_disconnect(struct usb_interface *intf) ...@@ -1187,7 +1239,7 @@ static void ttusb_disconnect(struct usb_interface *intf)
dvb_dmxdev_release(&ttusb->dmxdev); dvb_dmxdev_release(&ttusb->dmxdev);
dvb_dmx_release(&ttusb->dvb_demux); dvb_dmx_release(&ttusb->dvb_demux);
dvb_unregister_i2c_bus(ttusb_i2c_xfer, ttusb->adapter, 0); i2c_del_adapter(&ttusb->i2c_adap);
dvb_unregister_adapter(ttusb->adapter); dvb_unregister_adapter(ttusb->adapter);
ttusb_free_iso_urbs(ttusb); ttusb_free_iso_urbs(ttusb);
...@@ -1234,9 +1286,6 @@ static void __exit ttusb_exit(void) ...@@ -1234,9 +1286,6 @@ static void __exit ttusb_exit(void)
module_init(ttusb_init); module_init(ttusb_init);
module_exit(ttusb_exit); module_exit(ttusb_exit);
MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug or not");
MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>"); MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>");
MODULE_DESCRIPTION("TTUSB DVB Driver"); MODULE_DESCRIPTION("TTUSB DVB Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -22,10 +22,12 @@ ...@@ -22,10 +22,12 @@
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/version.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#if defined(CONFIG_CRC32) || defined(CONFIG_CRC32_MODULE) #if defined(CONFIG_CRC32) || defined(CONFIG_CRC32_MODULE)
...@@ -37,13 +39,17 @@ ...@@ -37,13 +39,17 @@
#include "dmxdev.h" #include "dmxdev.h"
#include "dvb_demux.h" #include "dvb_demux.h"
#include "dvb_i2c.h"
#include "dvb_filter.h" #include "dvb_filter.h"
#include "dvb_frontend.h" #include "dvb_frontend.h"
#include "dvb_net.h" #include "dvb_net.h"
static int debug = 0; static int debug;
static int output_pva = 0; static int output_pva;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
module_param(output_pva, int, 0444);
MODULE_PARM_DESC(output_pva, "Output PVA from dvr device (default:off)");
#define dprintk if (debug) printk #define dprintk if (debug) printk
...@@ -95,7 +101,6 @@ struct ttusb_dec { ...@@ -95,7 +101,6 @@ struct ttusb_dec {
struct dmxdev dmxdev; struct dmxdev dmxdev;
struct dvb_demux demux; struct dvb_demux demux;
struct dmx_frontend frontend; struct dmx_frontend frontend;
struct dvb_i2c_bus i2c_bus;
struct dvb_net dvb_net; struct dvb_net dvb_net;
struct dvb_frontend_info *frontend_info; struct dvb_frontend_info *frontend_info;
int (*frontend_ioctl) (struct dvb_frontend *, unsigned int, void *); int (*frontend_ioctl) (struct dvb_frontend *, unsigned int, void *);
...@@ -1100,7 +1105,7 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec) ...@@ -1100,7 +1105,7 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec)
&dec->iso_dma_handle); &dec->iso_dma_handle);
memset(dec->iso_buffer, 0, memset(dec->iso_buffer, 0,
sizeof(ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT))); ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT));
for (i = 0; i < ISO_BUF_COUNT; i++) { for (i = 0; i < ISO_BUF_COUNT; i++) {
struct urb *urb; struct urb *urb;
...@@ -1600,7 +1605,7 @@ static int ttusb_dec_3000s_frontend_ioctl(struct dvb_frontend *fe, ...@@ -1600,7 +1605,7 @@ static int ttusb_dec_3000s_frontend_ioctl(struct dvb_frontend *fe,
p->u.qam.symbol_rate); p->u.qam.symbol_rate);
dprintk(" inversion->%d\n", p->inversion); dprintk(" inversion->%d\n", p->inversion);
freq = htonl(p->frequency * 1000 + freq = htonl(p->frequency +
(dec->hi_band ? LOF_HI : LOF_LO)); (dec->hi_band ? LOF_HI : LOF_LO));
memcpy(&b[4], &freq, sizeof(u32)); memcpy(&b[4], &freq, sizeof(u32));
sym_rate = htonl(p->u.qam.symbol_rate); sym_rate = htonl(p->u.qam.symbol_rate);
...@@ -1628,9 +1633,18 @@ static int ttusb_dec_3000s_frontend_ioctl(struct dvb_frontend *fe, ...@@ -1628,9 +1633,18 @@ static int ttusb_dec_3000s_frontend_ioctl(struct dvb_frontend *fe,
dprintk("%s: FE_INIT\n", __FUNCTION__); dprintk("%s: FE_INIT\n", __FUNCTION__);
break; break;
case FE_DISEQC_SEND_MASTER_CMD: case FE_DISEQC_SEND_MASTER_CMD: {
u8 b[] = { 0x00, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00 };
struct dvb_diseqc_master_cmd *cmd = arg;
memcpy(&b[4], cmd->msg, cmd->msg_len);
dprintk("%s: FE_DISEQC_SEND_MASTER_CMD\n", __FUNCTION__); dprintk("%s: FE_DISEQC_SEND_MASTER_CMD\n", __FUNCTION__);
ttusb_dec_send_command(dec, 0x72,
sizeof(b) - (6 - cmd->msg_len), b,
NULL, NULL);
break; break;
}
case FE_DISEQC_SEND_BURST: case FE_DISEQC_SEND_BURST:
dprintk("%s: FE_DISEQC_SEND_BURST\n", __FUNCTION__); dprintk("%s: FE_DISEQC_SEND_BURST\n", __FUNCTION__);
...@@ -1669,15 +1683,13 @@ static int ttusb_dec_3000s_frontend_ioctl(struct dvb_frontend *fe, ...@@ -1669,15 +1683,13 @@ static int ttusb_dec_3000s_frontend_ioctl(struct dvb_frontend *fe,
static void ttusb_dec_init_frontend(struct ttusb_dec *dec) static void ttusb_dec_init_frontend(struct ttusb_dec *dec)
{ {
dec->i2c_bus.adapter = dec->adapter; int ret;
ret = dvb_register_frontend(dec->frontend_ioctl, dec->adapter, dec, dec->frontend_info, THIS_MODULE);
dvb_register_frontend(dec->frontend_ioctl, &dec->i2c_bus, (void *)dec,
dec->frontend_info);
} }
static void ttusb_dec_exit_frontend(struct ttusb_dec *dec) static void ttusb_dec_exit_frontend(struct ttusb_dec *dec)
{ {
dvb_unregister_frontend(dec->frontend_ioctl, &dec->i2c_bus); dvb_unregister_frontend_new(dec->frontend_ioctl, dec->adapter);
} }
static void ttusb_dec_init_filters(struct ttusb_dec *dec) static void ttusb_dec_init_filters(struct ttusb_dec *dec)
...@@ -1840,7 +1852,3 @@ MODULE_DESCRIPTION(DRIVER_NAME); ...@@ -1840,7 +1852,3 @@ MODULE_DESCRIPTION(DRIVER_NAME);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(usb, ttusb_dec_table); MODULE_DEVICE_TABLE(usb, ttusb_dec_table);
MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug level");
MODULE_PARM(output_pva, "i");
MODULE_PARM_DESC(output_pva, "Output PVA from dvr device");
...@@ -94,6 +94,7 @@ typedef enum { ...@@ -94,6 +94,7 @@ typedef enum {
OSD_Text, // (x0,y0,size,color,text) OSD_Text, // (x0,y0,size,color,text)
OSD_SetWindow, // (x0) set window with number 0<x0<8 as current OSD_SetWindow, // (x0) set window with number 0<x0<8 as current
OSD_MoveWindow, // move current window to (x0, y0) OSD_MoveWindow, // move current window to (x0, y0)
OSD_OpenRaw, // Open other types of OSD windows
} OSD_Command; } OSD_Command;
typedef struct osd_cmd_s { typedef struct osd_cmd_s {
...@@ -106,8 +107,39 @@ typedef struct osd_cmd_s { ...@@ -106,8 +107,39 @@ typedef struct osd_cmd_s {
void __user *data; void __user *data;
} osd_cmd_t; } osd_cmd_t;
/* OSD_OpenRaw: set 'color' to desired window type */
typedef enum {
OSD_BITMAP1, /* 1 bit bitmap */
OSD_BITMAP2, /* 2 bit bitmap */
OSD_BITMAP4, /* 4 bit bitmap */
OSD_BITMAP8, /* 8 bit bitmap */
OSD_BITMAP1HR, /* 1 Bit bitmap half resolution */
OSD_BITMAP2HR, /* 2 bit bitmap half resolution */
OSD_BITMAP4HR, /* 4 bit bitmap half resolution */
OSD_BITMAP8HR, /* 8 bit bitmap half resolution */
OSD_YCRCB422, /* 4:2:2 YCRCB Graphic Display */
OSD_YCRCB444, /* 4:4:4 YCRCB Graphic Display */
OSD_YCRCB444HR, /* 4:4:4 YCRCB graphic half resolution */
OSD_VIDEOTSIZE, /* True Size Normal MPEG Video Display */
OSD_VIDEOHSIZE, /* MPEG Video Display Half Resolution */
OSD_VIDEOQSIZE, /* MPEG Video Display Quarter Resolution */
OSD_VIDEODSIZE, /* MPEG Video Display Double Resolution */
OSD_VIDEOTHSIZE, /* True Size MPEG Video Display Half Resolution */
OSD_VIDEOTQSIZE, /* True Size MPEG Video Display Quarter Resolution*/
OSD_VIDEOTDSIZE, /* True Size MPEG Video Display Double Resolution */
OSD_VIDEONSIZE, /* Full Size MPEG Video Display */
OSD_CURSOR /* Cursor */
} osd_raw_window_t;
typedef struct osd_cap_s {
int cmd;
#define OSD_CAP_MEMSIZE 1 /* memory size */
long val;
} osd_cap_t;
#define OSD_SEND_CMD _IOW('o', 160, osd_cmd_t) #define OSD_SEND_CMD _IOW('o', 160, osd_cmd_t)
#define OSD_GET_CAPABILITY _IOR('o', 161, osd_cap_t)
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment