Commit e33951e1 authored by Michael Hunold's avatar Michael Hunold Committed by Linus Torvalds

[PATCH] update the av7110 and budget drivers

 - update the av7110 and budget drivers
 - replaced ddelay() wait function with generic dvb_delay()
   implementation
 - new DATA_MPEG_VIDEO_EVENT for direct mpeg2 video playback
 - added support for DVB-C cards with MSP3400 mixer and analog tuner
 - fixed up the av7110_ir handler and especially the write_proc()
   function; this fixed the bug the Stanford Checker has found
parent 33e9942c
This diff is collapsed.
This diff is collapsed.
#include "dvb_filter.h" #include "dvb_filter.h"
#include "av7110_ipack.h" #include "av7110_ipack.h"
#include <linux/string.h> /* for memcpy() */ #include <linux/string.h> /* for memcpy() */
#include <linux/vmalloc.h>
void av7110_ipack_reset(ipack *p) void av7110_ipack_reset(struct ipack *p)
{ {
p->found = 0; p->found = 0;
p->cid = 0; p->cid = 0;
...@@ -19,7 +20,7 @@ void av7110_ipack_reset(ipack *p) ...@@ -19,7 +20,7 @@ void av7110_ipack_reset(ipack *p)
} }
void av7110_ipack_init(ipack *p, int size, void av7110_ipack_init(struct ipack *p, int size,
void (*func)(u8 *buf, int size, void *priv)) void (*func)(u8 *buf, int size, void *priv))
{ {
if ( !(p->buf = vmalloc(size*sizeof(u8))) ){ if ( !(p->buf = vmalloc(size*sizeof(u8))) ){
...@@ -32,17 +33,18 @@ void av7110_ipack_init(ipack *p, int size, ...@@ -32,17 +33,18 @@ void av7110_ipack_init(ipack *p, int size,
} }
void av7110_ipack_free(ipack * p) void av7110_ipack_free(struct ipack * p)
{ {
if (p->buf) vfree(p->buf); if (p->buf)
vfree(p->buf);
} }
static static
void send_ipack(ipack *p) void send_ipack(struct ipack *p)
{ {
int off; int off;
AudioInfo ai; struct dvb_audio_info ai;
int ac3_off = 0; int ac3_off = 0;
int streamid=0; int streamid=0;
int nframes= 0; int nframes= 0;
...@@ -109,7 +111,7 @@ void send_ipack(ipack *p) ...@@ -109,7 +111,7 @@ void send_ipack(ipack *p)
} }
void av7110_ipack_flush(ipack *p) void av7110_ipack_flush(struct ipack *p)
{ {
if (p->plength != MMAX_PLENGTH-6 || p->found<=6) if (p->plength != MMAX_PLENGTH-6 || p->found<=6)
return; return;
...@@ -121,7 +123,7 @@ void av7110_ipack_flush(ipack *p) ...@@ -121,7 +123,7 @@ void av7110_ipack_flush(ipack *p)
static static
void write_ipack(ipack *p, const u8 *data, int count) void write_ipack(struct ipack *p, const u8 *data, int count)
{ {
u8 headr[3] = { 0x00, 0x00, 0x01} ; u8 headr[3] = { 0x00, 0x00, 0x01} ;
...@@ -144,7 +146,7 @@ void write_ipack(ipack *p, const u8 *data, int count) ...@@ -144,7 +146,7 @@ void write_ipack(ipack *p, const u8 *data, int count)
} }
int av7110_ipack_instant_repack (const u8 *buf, int count, ipack *p) int av7110_ipack_instant_repack (const u8 *buf, int count, struct ipack *p)
{ {
int l; int l;
int c=0; int c=0;
......
#ifndef _AV7110_IPACK_H_ #ifndef _AV7110_IPACK_H_
#define _AV7110_IPACK_H_ #define _AV7110_IPACK_H_
extern void av7110_ipack_init(ipack *p, int size, extern void av7110_ipack_init(struct ipack *p, int size,
void (*func)(u8 *buf, int size, void *priv)); void (*func)(u8 *buf, int size, void *priv));
extern void av7110_ipack_reset(ipack *p); extern void av7110_ipack_reset(struct ipack *p);
extern int av7110_ipack_instant_repack(const u8 *buf, int count, ipack *p); extern int av7110_ipack_instant_repack(const u8 *buf, int count, struct ipack *p);
extern void av7110_ipack_free(ipack * p); extern void av7110_ipack_free(struct ipack * p);
extern void av7110_ipack_flush(ipack *p); extern void av7110_ipack_flush(struct ipack *p);
#endif #endif
...@@ -7,12 +7,7 @@ ...@@ -7,12 +7,7 @@
#include "av7110.h" #include "av7110.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) #define UP_TIMEOUT (HZ/4)
#include "input_fake.h"
#endif
#define UP_TIMEOUT (HZ/2)
static int av7110_ir_debug = 0; static int av7110_ir_debug = 0;
...@@ -21,11 +16,12 @@ static int av7110_ir_debug = 0; ...@@ -21,11 +16,12 @@ static int av7110_ir_debug = 0;
static struct input_dev input_dev; static struct input_dev input_dev;
static u32 ir_config;
static static
u16 key_map [256] = { u16 key_map [256] = {
KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7,
KEY_8, KEY_9, KEY_MHP, 0, KEY_POWER, KEY_MUTE, 0, KEY_INFO, KEY_8, KEY_9, KEY_BACK, 0, KEY_POWER, KEY_MUTE, 0, KEY_INFO,
KEY_VOLUMEUP, KEY_VOLUMEDOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, KEY_VOLUMEUP, KEY_VOLUMEDOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
KEY_CHANNELUP, KEY_CHANNELDOWN, 0, 0, 0, 0, 0, 0, KEY_CHANNELUP, KEY_CHANNELDOWN, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
...@@ -64,32 +60,61 @@ struct timer_list keyup_timer = { function: av7110_emit_keyup }; ...@@ -64,32 +60,61 @@ struct timer_list keyup_timer = { function: av7110_emit_keyup };
static static
void av7110_emit_key (u32 ircom) void av7110_emit_key (u32 ircom)
{ {
int down = ircom & (0x80000000); u8 data;
u16 keycode = key_map[ircom & 0xff]; u8 addr;
static u16 old_toggle = 0;
u16 new_toggle;
u16 keycode;
/* extract device address and data */
if (ir_config & 0x0001) {
/* TODO RCMM: ? bits device address, 8 bits data */
data = ircom & 0xff;
addr = (ircom >> 8) & 0xff;
} else {
/* RC5: 5 bits device address, 6 bits data */
data = ircom & 0x3f;
addr = (ircom >> 6) & 0x1f;
}
keycode = key_map[data];
dprintk ("#########%08x######### addr %i data 0x%02x (keycode %i)\n",
ircom, addr, data, keycode);
dprintk ("#########%08x######### key %02x %s (keycode %i)\n", /* check device address (if selected) */
ircom, ircom & 0xff, down ? "pressed" : "released", keycode); if (ir_config & 0x4000)
if (addr != ((ir_config >> 16) & 0xff))
return;
if (!keycode) { if (!keycode) {
printk ("%s: unknown key 0x%02x!!\n", printk ("%s: unknown key 0x%02x!!\n",
__FUNCTION__, ircom & 0xff); __FUNCTION__, data);
return; return;
} }
if (ir_config & 0x0001)
new_toggle = 0; /* RCMM */
else
new_toggle = (ircom & 0x800); /* RC5 */
if (timer_pending (&keyup_timer)) { if (timer_pending (&keyup_timer)) {
del_timer (&keyup_timer); del_timer (&keyup_timer);
if (keyup_timer.data != keycode) if (keyup_timer.data != keycode || new_toggle != old_toggle) {
input_event (&input_dev, EV_KEY, keyup_timer.data, !!0); input_event (&input_dev, EV_KEY, keyup_timer.data, !!0);
} input_event (&input_dev, EV_KEY, keycode, !0);
} else
clear_bit (keycode, input_dev.key); input_event (&input_dev, EV_KEY, keycode, 2);
} else
input_event (&input_dev, EV_KEY, keycode, !0); input_event (&input_dev, EV_KEY, keycode, !0);
keyup_timer.expires = jiffies + UP_TIMEOUT; keyup_timer.expires = jiffies + UP_TIMEOUT;
keyup_timer.data = keycode; keyup_timer.data = keycode;
add_timer (&keyup_timer); add_timer (&keyup_timer);
old_toggle = new_toggle;
} }
static static
...@@ -108,17 +133,36 @@ void input_register_keys (void) ...@@ -108,17 +133,36 @@ void input_register_keys (void)
} }
static void input_repeat_key(unsigned long data)
{
/* dummy routine to disable autorepeat in the input driver */
}
static static
int av7110_ir_write_proc (struct file *file, const char *buffer, int av7110_ir_write_proc (struct file *file, const char *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
u32 ir_config; char *page;
int size = 4 + 256 * sizeof(u16);
if (count < 4 + 256 * sizeof(u16)) if (count < size)
return -EINVAL; return -EINVAL;
memcpy (&ir_config, buffer, 4); page = (char *)vmalloc(size);
memcpy (&key_map, buffer + 4, 256 * sizeof(u16)); if( NULL == page ) {
return -ENOMEM;
}
if (copy_from_user(page, buffer, size)) {
vfree(page);
return -EFAULT;
}
memcpy (&ir_config, page, 4);
memcpy (&key_map, page + 4, 256 * sizeof(u16));
vfree(page);
av7110_setup_irc_config (NULL, ir_config); av7110_setup_irc_config (NULL, ir_config);
...@@ -141,10 +185,12 @@ int __init av7110_ir_init (void) ...@@ -141,10 +185,12 @@ int __init av7110_ir_init (void)
* enable keys * enable keys
*/ */
set_bit (EV_KEY, input_dev.evbit); set_bit (EV_KEY, input_dev.evbit);
set_bit (EV_REP, input_dev.evbit);
input_register_keys (); input_register_keys ();
input_register_device(&input_dev); input_register_device(&input_dev);
input_dev.timer.function = input_repeat_key;
av7110_setup_irc_config (NULL, 0x0001); av7110_setup_irc_config (NULL, 0x0001);
av7110_register_irc_handler (av7110_emit_key); av7110_register_irc_handler (av7110_emit_key);
......
...@@ -30,13 +30,10 @@ ...@@ -30,13 +30,10 @@
* the project's page is at http://www.linuxtv.org/dvb/ * the project's page is at http://www.linuxtv.org/dvb/
*/ */
#include "budget.h"
#include <media/saa7146_vv.h> #include <media/saa7146_vv.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) #include "budget.h"
#define KBUILD_MODNAME budget_av #include "dvb_functions.h"
#endif
struct budget_av { struct budget_av {
struct budget budget; struct budget budget;
...@@ -48,13 +45,6 @@ struct budget_av { ...@@ -48,13 +45,6 @@ struct budget_av {
* INITIALIZATION * INITIALIZATION
****************************************************************************/ ****************************************************************************/
static inline
void ddelay(int i)
{
current->state=TASK_INTERRUPTIBLE;
schedule_timeout((HZ*i)/100);
}
static static
u8 i2c_readreg (struct dvb_i2c_bus *i2c, u8 id, u8 reg) u8 i2c_readreg (struct dvb_i2c_bus *i2c, u8 id, u8 reg)
...@@ -175,7 +165,7 @@ int budget_av_detach (struct saa7146_dev *dev) ...@@ -175,7 +165,7 @@ int budget_av_detach (struct saa7146_dev *dev)
saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO); saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO);
ddelay(20); dvb_delay(200);
saa7146_unregister_device (&budget_av->vd, dev); saa7146_unregister_device (&budget_av->vd, dev);
...@@ -221,7 +211,7 @@ int budget_av_attach (struct saa7146_dev* dev, ...@@ -221,7 +211,7 @@ 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);
ddelay(50); dvb_delay(500);
if ((err = saa7113_init (budget_av))) { if ((err = saa7113_init (budget_av))) {
budget_av_detach(dev); budget_av_detach(dev);
...@@ -245,9 +235,11 @@ int budget_av_attach (struct saa7146_dev* dev, ...@@ -245,9 +235,11 @@ int budget_av_attach (struct saa7146_dev* dev,
/* what is this? since we don't support open()/close() /* what is this? since we don't support open()/close()
notifications, we simply put this into the release handler... */ notifications, we simply put this into the release handler... */
// saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO); /*
ddelay(20); saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout (20);
*/
/* fixme: find some sane values here... */ /* fixme: find some sane values here... */
saa7146_write(dev, PCI_BT_V1, 0x1c00101f); saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
...@@ -348,7 +340,7 @@ struct pci_device_id pci_tbl [] = { ...@@ -348,7 +340,7 @@ struct pci_device_id pci_tbl [] = {
} }
}; };
MODULE_DEVICE_TABLE(pci, pci_tbl);
static static
struct saa7146_extension budget_extension = { struct saa7146_extension budget_extension = {
......
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
*/ */
#include "budget.h" #include "budget.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#define KBUILD_MODNAME budget
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -39,12 +35,6 @@ ...@@ -39,12 +35,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/input.h> #include <linux/input.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "input_fake.h"
#endif
struct budget_ci { struct budget_ci {
struct budget budget; struct budget budget;
struct input_dev input_dev; struct input_dev input_dev;
...@@ -388,7 +378,7 @@ struct pci_device_id pci_tbl[] = { ...@@ -388,7 +378,7 @@ struct pci_device_id pci_tbl[] = {
} }
}; };
MODULE_DEVICE_TABLE(pci, pci_tbl);
static static
struct saa7146_extension budget_extension = { struct saa7146_extension budget_extension = {
......
#include "budget.h" #include "budget.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#define KBUILD_MODNAME budget
#endif
int budget_debug = 0; int budget_debug = 0;
/****************************************************************************
* General helper functions
****************************************************************************/
static inline void ddelay(int i)
{
current->state=TASK_INTERRUPTIBLE;
schedule_timeout((HZ*i)/100);
}
/**************************************************************************** /****************************************************************************
* TT budget / WinTV Nova * TT budget / WinTV Nova
****************************************************************************/ ****************************************************************************/
...@@ -142,14 +129,11 @@ int budget_stop_feed(struct dvb_demux_feed *feed) ...@@ -142,14 +129,11 @@ int budget_stop_feed(struct dvb_demux_feed *feed)
static static
int budget_register(struct budget *budget) int budget_register(struct budget *budget)
{ {
int ret;
dmx_frontend_t *dvbfront=&budget->hw_frontend;
struct dvb_demux *dvbdemux=&budget->demux; struct dvb_demux *dvbdemux=&budget->demux;
int ret;
DEB_EE(("budget: %p\n",budget)); DEB_EE(("budget: %p\n",budget));
memcpy(budget->demux_id, "demux0_0", 9);
budget->demux_id[5] = budget->dvb_adapter->num + '0';
dvbdemux->priv = (void *) budget; dvbdemux->priv = (void *) budget;
dvbdemux->filternum = 256; dvbdemux->filternum = 256;
...@@ -158,33 +142,24 @@ int budget_register(struct budget *budget) ...@@ -158,33 +142,24 @@ int budget_register(struct budget *budget)
dvbdemux->stop_feed = budget_stop_feed; dvbdemux->stop_feed = budget_stop_feed;
dvbdemux->write_to_decoder = NULL; dvbdemux->write_to_decoder = NULL;
dvbdemux->dmx.vendor = "CIM";
dvbdemux->dmx.model = "sw";
dvbdemux->dmx.id = budget->demux_id;
dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING | dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING |
DMX_MEMORY_BASED_FILTERING); DMX_MEMORY_BASED_FILTERING);
dvb_dmx_init(&budget->demux); dvb_dmx_init(&budget->demux);
dvbfront->id = "hw_frontend";
dvbfront->vendor = "VLSI";
dvbfront->model = "DVB Frontend";
dvbfront->source = DMX_FRONTEND_0;
budget->dmxdev.filternum = 256; budget->dmxdev.filternum = 256;
budget->dmxdev.demux = &dvbdemux->dmx; budget->dmxdev.demux = &dvbdemux->dmx;
budget->dmxdev.capabilities = 0; budget->dmxdev.capabilities = 0;
dvb_dmxdev_init(&budget->dmxdev, budget->dvb_adapter); dvb_dmxdev_init(&budget->dmxdev, budget->dvb_adapter);
ret=dvbdemux->dmx.add_frontend (&dvbdemux->dmx, budget->hw_frontend.source = DMX_FRONTEND_0;
&budget->hw_frontend);
ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->hw_frontend);
if (ret < 0) if (ret < 0)
return ret; return ret;
budget->mem_frontend.id = "mem_frontend";
budget->mem_frontend.vendor = "memory";
budget->mem_frontend.model = "sw";
budget->mem_frontend.source = DMX_MEMORY_FE; budget->mem_frontend.source = DMX_MEMORY_FE;
ret=dvbdemux->dmx.add_frontend (&dvbdemux->dmx, ret=dvbdemux->dmx.add_frontend (&dvbdemux->dmx,
&budget->mem_frontend); &budget->mem_frontend);
...@@ -278,9 +253,9 @@ int ttpci_budget_init (struct budget *budget, ...@@ -278,9 +253,9 @@ int ttpci_budget_init (struct budget *budget,
saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI); /* frontend power on */ saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI); /* frontend power on */
if (budget_register(budget) == 0) if (budget_register(budget) == 0) {
return 0; return 0;
}
err: err:
if (budget->grabbing) if (budget->grabbing)
vfree(budget->grabbing); vfree(budget->grabbing);
...@@ -312,7 +287,6 @@ int ttpci_budget_deinit (struct budget *budget) ...@@ -312,7 +287,6 @@ int ttpci_budget_deinit (struct budget *budget)
saa7146_pgtable_free (dev->pci, &budget->pt); saa7146_pgtable_free (dev->pci, &budget->pt);
vfree (budget->grabbing); vfree (budget->grabbing);
kfree (budget);
return 0; return 0;
} }
......
...@@ -31,9 +31,7 @@ ...@@ -31,9 +31,7 @@
*/ */
#include "budget.h" #include "budget.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) #include "av7110.h"
#define KBUILD_MODNAME budget_patch
#endif
#define budget_patch budget #define budget_patch budget
...@@ -49,45 +47,6 @@ struct pci_device_id pci_tbl[] = { ...@@ -49,45 +47,6 @@ struct pci_device_id pci_tbl[] = {
} }
}; };
#define COMMAND (DPRAM_BASE + 0x0FC)
#define DPRAM_BASE 0x4000
#define DEBINOSWAP 0x000e0000
typedef enum {
AudioDAC,
CabADAC,
ON22K,
OFF22K,
MainSwitch,
ADSwitch,
SendDiSEqC,
SetRegister
} AUDCOM;
typedef enum {
COMTYPE_NOCOM,
COMTYPE_PIDFILTER,
COMTYPE_MPEGDECODER,
COMTYPE_OSD,
COMTYPE_BMP,
COMTYPE_ENCODER,
COMTYPE_AUDIODAC,
COMTYPE_REQUEST,
COMTYPE_SYSTEM,
COMTYPE_REC_PLAY,
COMTYPE_COMMON_IF,
COMTYPE_PID_FILTER,
COMTYPE_PES,
COMTYPE_TS,
COMTYPE_VIDEO,
COMTYPE_AUDIO,
COMTYPE_CI_LL,
} COMTYPE;
static static
int wdebi(struct budget_patch *budget, u32 config, int addr, u32 val, int count) int wdebi(struct budget_patch *budget, u32 config, int addr, u32 val, int count)
{ {
...@@ -235,31 +194,34 @@ int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_d ...@@ -235,31 +194,34 @@ int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_d
** (74HCT4040, LVC74) for the generation of this VSYNC signal, ** (74HCT4040, LVC74) for the generation of this VSYNC signal,
** which seems that can be done perfectly without this :-)). ** which seems that can be done perfectly without this :-)).
*/ */
#define WRITE_RPS1(x) dev->d_rps1.cpu_addr[ cnt++ ] = cpu_to_le32(x)
cnt = 0; // Setup RPS1 "program" (p35) cnt = 0; // Setup RPS1 "program" (p35)
// Wait reset Source Line Counter Threshold (p36) // Wait reset Source Line Counter Threshold (p36)
dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS); WRITE_RPS1(cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS));
// Wait Source Line Counter Threshold (p36) // Wait Source Line Counter Threshold (p36)
dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | EVT_HS); WRITE_RPS1(cpu_to_le32(CMD_PAUSE | EVT_HS));
// Set GPIO3=1 (p42) // Set GPIO3=1 (p42)
dev->rps1[cnt++]=cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)); WRITE_RPS1(cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)));
dev->rps1[cnt++]=cpu_to_le32(GPIO3_MSK); WRITE_RPS1(cpu_to_le32(GPIO3_MSK));
dev->rps1[cnt++]=cpu_to_le32(SAA7146_GPIO_OUTHI<<24); WRITE_RPS1(cpu_to_le32(SAA7146_GPIO_OUTHI<<24));
// Wait reset Source Line Counter Threshold (p36) // Wait reset Source Line Counter Threshold (p36)
dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS); WRITE_RPS1(cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS));
// Wait Source Line Counter Threshold // Wait Source Line Counter Threshold
dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | EVT_HS); WRITE_RPS1(cpu_to_le32(CMD_PAUSE | EVT_HS));
// Set GPIO3=0 (p42) // Set GPIO3=0 (p42)
dev->rps1[cnt++]=cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)); WRITE_RPS1(cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)));
dev->rps1[cnt++]=cpu_to_le32(GPIO3_MSK); WRITE_RPS1(cpu_to_le32(GPIO3_MSK));
dev->rps1[cnt++]=cpu_to_le32(SAA7146_GPIO_OUTLO<<24); WRITE_RPS1(cpu_to_le32(SAA7146_GPIO_OUTLO<<24));
// Jump to begin of RPS program (p37) // Jump to begin of RPS program (p37)
dev->rps1[cnt++]=cpu_to_le32(CMD_JUMP); WRITE_RPS1(cpu_to_le32(CMD_JUMP));
dev->rps1[cnt++]=cpu_to_le32(virt_to_bus(&dev->rps1[0])); WRITE_RPS1(cpu_to_le32(dev->d_rps1.dma_handle));
// Fix VSYNC level // Fix VSYNC level
saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO);
// Set RPS1 Address register to point to RPS code (r108 p42) // Set RPS1 Address register to point to RPS code (r108 p42)
saa7146_write(dev, RPS_ADDR1, virt_to_bus(&dev->rps1[0])); saa7146_write(dev, RPS_ADDR1, dev->d_rps1.dma_handle);
// Set Source Line Counter Threshold, using BRS (rCC p43) // Set Source Line Counter Threshold, using BRS (rCC p43)
saa7146_write(dev, RPS_THRESH1, ((TS_HEIGHT/2) | MASK_12)); saa7146_write(dev, RPS_THRESH1, ((TS_HEIGHT/2) | MASK_12));
// Enable RPS1 (rFC p33) // Enable RPS1 (rFC p33)
......
...@@ -30,18 +30,7 @@ ...@@ -30,18 +30,7 @@
*/ */
#include "budget.h" #include "budget.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) #include "dvb_functions.h"
#define KBUILD_MODNAME budget
#endif
static inline void ddelay(int i)
{
current->state=TASK_INTERRUPTIBLE;
schedule_timeout((HZ*i)/100);
}
static static
void Set22K (struct budget *budget, int state) void Set22K (struct budget *budget, int state)
...@@ -87,7 +76,7 @@ void DiseqcSendByte (struct budget *budget, int data) ...@@ -87,7 +76,7 @@ void DiseqcSendByte (struct budget *budget, int data)
static static
int SendDiSEqCMsg (struct budget *budget, int len, u8 *msg, int burst) int SendDiSEqCMsg (struct budget *budget, int len, u8 *msg, unsigned long burst)
{ {
struct saa7146_dev *dev=budget->dev; struct saa7146_dev *dev=budget->dev;
int i; int i;
...@@ -110,7 +99,7 @@ int SendDiSEqCMsg (struct budget *budget, int len, u8 *msg, int burst) ...@@ -110,7 +99,7 @@ int SendDiSEqCMsg (struct budget *budget, int len, u8 *msg, int burst)
udelay(12500); udelay(12500);
saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO);
} }
ddelay(2); dvb_delay(20);
} }
return 0; return 0;
...@@ -146,7 +135,7 @@ int budget_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) ...@@ -146,7 +135,7 @@ int budget_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
} }
case FE_DISEQC_SEND_BURST: case FE_DISEQC_SEND_BURST:
SendDiSEqCMsg (budget, 0, NULL, (int) arg); SendDiSEqCMsg (budget, 0, NULL, (unsigned long)arg);
break; break;
default: default:
...@@ -160,15 +149,18 @@ int budget_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) ...@@ -160,15 +149,18 @@ int budget_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
static static
int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info)
{ {
struct budget *budget; struct budget *budget = NULL;
int err; int err;
if (!(budget = kmalloc (sizeof(struct budget), GFP_KERNEL))) budget = kmalloc(sizeof(struct budget), GFP_KERNEL);
if( NULL == budget ) {
return -ENOMEM; return -ENOMEM;
}
DEB_EE(("budget: %p\n",budget)); DEB_EE(("dev:%p, info:%p, budget:%p\n",dev,info,budget));
if ((err = ttpci_budget_init (budget, dev, info))) { if ((err = ttpci_budget_init (budget, dev, info))) {
printk("==> failed\n");
kfree (budget); kfree (budget);
return err; return err;
} }
...@@ -194,6 +186,7 @@ int budget_detach (struct saa7146_dev* dev) ...@@ -194,6 +186,7 @@ int budget_detach (struct saa7146_dev* dev)
err = ttpci_budget_deinit (budget); err = ttpci_budget_deinit (budget);
kfree (budget); kfree (budget);
dev->ext_priv = NULL;
return err; return err;
} }
...@@ -222,7 +215,7 @@ struct pci_device_id pci_tbl[] = { ...@@ -222,7 +215,7 @@ struct pci_device_id pci_tbl[] = {
} }
}; };
MODULE_DEVICE_TABLE(pci, pci_tbl);
static static
struct saa7146_extension budget_extension = { struct saa7146_extension budget_extension = {
......
#ifndef __BUDGET_DVB__ #ifndef __BUDGET_DVB__
#define __BUDGET_DVB__ #define __BUDGET_DVB__
#include <media/saa7146.h>
#include "dvb_i2c.h" #include "dvb_i2c.h"
#include "dvb_frontend.h" #include "dvb_frontend.h"
#include "dvbdev.h" #include "dvbdev.h"
...@@ -10,8 +12,6 @@ ...@@ -10,8 +12,6 @@
#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 {
...@@ -24,7 +24,7 @@ struct budget { ...@@ -24,7 +24,7 @@ struct budget {
/* devices */ /* devices */
struct dvb_device dvb_dev; struct dvb_device dvb_dev;
dvb_net_t dvb_net; struct dvb_net dvb_net;
struct saa7146_dev *dev; struct saa7146_dev *dev;
...@@ -37,12 +37,11 @@ struct budget { ...@@ -37,12 +37,11 @@ struct budget {
struct tasklet_struct fidb_tasklet; struct tasklet_struct fidb_tasklet;
struct tasklet_struct vpe_tasklet; struct tasklet_struct vpe_tasklet;
dmxdev_t dmxdev; struct dmxdev dmxdev;
struct dvb_demux demux; struct dvb_demux demux;
char demux_id[16];
dmx_frontend_t hw_frontend; struct dmx_frontend hw_frontend;
dmx_frontend_t mem_frontend; struct dmx_frontend mem_frontend;
int fe_synced; int fe_synced;
struct semaphore pid_mutex; struct semaphore pid_mutex;
......
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