Commit 888c9d64 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] dvb updates - mostly typedef to structs and other similar cleaning

parent a913beae
......@@ -6,5 +6,7 @@ dvb-ttpci-objs := saa7146_core.o saa7146_v4l.o av7110.o av7110_ir.o
obj-$(CONFIG_DVB_AV7110) += dvb-ttpci.o
EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
include $(TOPDIR)/Rules.make
This diff is collapsed.
......@@ -479,7 +479,7 @@ typedef struct p2t_s {
u8 counter;
long int pos;
int frags;
dvb_demux_feed_t *feed;
struct dvb_demux_feed *feed;
} p2t_t;
......@@ -561,7 +561,7 @@ typedef struct av7110_s {
int vidmode;
dmxdev_t dmxdev;
dvb_demux_t demux;
struct dvb_demux demux;
char demux_id[16];
dmx_frontend_t hw_frontend;
......@@ -580,9 +580,9 @@ typedef struct av7110_s {
#define TRICK_FREEZE 3
struct audio_status audiostate;
dvb_demux_filter_t *handle2filter[32];
struct dvb_demux_filter *handle2filter[32];
p2t_t p2t_filter[MAXFILT];
pes2ts_t p2t[2];
dvb_filter_pes2ts_t p2t[2];
struct ipack_s ipack[2];
u8 *kbuf[2];
......@@ -621,11 +621,11 @@ typedef struct av7110_s {
ring_buffer_t ci_wbuffer;
dvb_adapter_t *dvb_adapter;
dvb_device_t *video_dev;
dvb_device_t *audio_dev;
dvb_device_t *ca_dev;
dvb_device_t *osd_dev;
struct dvb_adapter *dvb_adapter;
struct dvb_device *video_dev;
struct dvb_device *audio_dev;
struct dvb_device *ca_dev;
struct dvb_device *osd_dev;
int dsp_dev;
} av7110_t;
......
......@@ -1399,7 +1399,7 @@ int i2c_reset(struct saa7146* saa)
/* if any error is still present, a fatal error has occured ... */
if ( SAA7146_I2C_BBR != (status = i2c_status_check(saa)) ) {
hprintk("saa7146: i2c_reset: fatal error, status:0x%08x\n",status);
return -1;
return -EIO;
}
return 0;
......
......@@ -33,8 +33,8 @@
#include "saa7146_core.h"
#include "saa7146_v4l.h"
#include "av7110.h"
#include "../dvb-core/compat.h"
#include "../dvb-core/dvb_i2c.h"
#include "compat.h"
#include "dvb_i2c.h"
/* insmod parameter: here you can specify the number of video-buffers
to be allocated. for simple capturing 2 buffers (double-buffering)
......@@ -197,23 +197,23 @@ static
int do_master_xfer (struct dvb_i2c_bus *i2c, struct i2c_msg msgs[], int num)
{
struct saa7146 *a = i2c->data;
int result, count;
int count;
int i = 0;
dprintk(KERN_ERR "saa7146_core.o: master_xfer called, num:%d\n",num);
/* prepare the message(s), get number of u32s to transfer */
count = prepare(msgs, num, a->i2c);
if ( 0 > count ) {
hprintk(KERN_ERR "saa7146_core.o: master_xfer: could not prepare i2c-message\n");
if (count < 0) {
hprintk(KERN_ERR "saa7146_core.o: could not prepare i2c-message\n");
return -EIO;
}
/* reset the i2c-device if necessary */
result = i2c_reset( a );
if ( 0 > result ) {
hprintk(KERN_ERR "saa7146_core.o: master_xfer: could not reset i2c-bus\n");
return result;
if (i2c_reset(a) < 0) {
hprintk(KERN_ERR "saa7146_core.o: could not reset i2c-bus\n");
return -EIO;
}
for(i = 0; i < count; i++) {
......@@ -222,31 +222,17 @@ int do_master_xfer (struct dvb_i2c_bus *i2c, struct i2c_msg msgs[], int num)
* we do not start the whole rps1-engine...
*/
result = i2c_write_out( a, &a->i2c[i],
SAA7146_I2C_TIMEOUT );
if ( 0 != result) {
/* if address-error occured, don't retry */
if ( result == -EREMOTEIO )
{
hprintk(KERN_ERR "saa7146_core.o: master_xfer: error in address phase\n");
return result;
}
hprintk(KERN_ERR "saa7146_core.o: master_xfer: error transferring, trying again\n");
break;
}
if (i2c_write_out(a, &a->i2c[i], SAA7146_I2C_TIMEOUT) < 0) {
hprintk (KERN_ERR "saa7146_core.o: "
"i2c error in address phase\n");
return -EREMOTEIO;
}
/* see if an error occured & the last retry failed */
if (0 != result) {
hprintk(KERN_ERR "saa7146_core.o: master_xfer: could not transfer i2c-message\n");
return -EIO;
}
/* if any things had to be read, get the results */
result = clean_up(msgs, num, a->i2c);
if ( 0 > result ) {
hprintk(KERN_ERR "saa7146_core.o: master_xfer: could not cleanup\n");
if (clean_up(msgs, num, a->i2c) < 0) {
hprintk(KERN_ERR "saa7146_core.o: i2c cleanup failed!\n");
return -EIO;
}
......@@ -259,13 +245,19 @@ int do_master_xfer (struct dvb_i2c_bus *i2c, struct i2c_msg msgs[], int num)
static
int master_xfer (struct dvb_i2c_bus *i2c, struct i2c_msg msgs[], int num)
{
struct saa7146 *saa = i2c->data;
int retries = SAA7146_I2C_RETRIES;
int ret;
if (down_interruptible (&saa->i2c_sem))
return -ERESTARTSYS;
do {
ret = do_master_xfer (i2c, msgs, num);
} while (ret != num && retries--);
up (&saa->i2c_sem);
return ret;
}
......@@ -273,6 +265,8 @@ int master_xfer (struct dvb_i2c_bus *i2c, struct i2c_msg msgs[], int num)
/* registering functions to load algorithms at runtime */
int i2c_saa7146_add_bus (struct saa7146 *saa)
{
init_MUTEX(&saa->i2c_sem);
/* enable i2c-port pins */
saa7146_write (saa->mem, MC1, (MASK_08 | MASK_24));
......@@ -389,9 +383,9 @@ static int saa7146_core_command (struct dvb_i2c_bus *i2c, unsigned int cmd, void
struct saa7146_debi_transfer *dt = arg;
printk("saa7146_core.o: SAA7146_DEBI_TRANSFER\n");
printk("saa7146_core.o: timeout:%d, swap:%d, slave16:%d, increment:%d, intel:%d, tien:%d\n", dt->timeout, dt->swap, dt->slave16, dt->increment, dt->intel, dt->tien);
printk("saa7146_core.o: address:0x%04x, num_bytes:%d, direction:%d, mem:0x%08x\n",dt->address,dt->address,dt->direction,dt->mem);
dprintk("saa7146_core.o: SAA7146_DEBI_TRANSFER\n");
dprintk("saa7146_core.o: timeout:%d, swap:%d, slave16:%d, increment:%d, intel:%d, tien:%d\n", dt->timeout, dt->swap, dt->slave16, dt->increment, dt->intel, dt->tien);
dprintk("saa7146_core.o: address:0x%04x, num_bytes:%d, direction:%d, mem:0x%08x\n",dt->address,dt->address,dt->direction,dt->mem);
debi_transfer(saa, dt);
break;
......@@ -622,7 +616,7 @@ int configure_saa7146 (struct saa7146 *saa)
}
/* print status message */
printk(KERN_ERR "saa7146_core.o: %s: bus:%d, rev:%d, mem:0x%08x.\n", saa->name, saa->device->bus->number, saa->revision, (unsigned int) saa->mem);
dprintk("saa7146_core.o: %s: bus:%d, rev:%d, mem:0x%08x.\n", saa->name, saa->device->bus->number, saa->revision, (unsigned int) saa->mem);
/* enable bus-mastering */
pci_set_master( saa->device );
......@@ -827,7 +821,7 @@ static
int __devinit saa7146_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct dvb_adapter_s *adap;
struct dvb_adapter *adap;
struct saa7146 *saa;
int card_type;
struct card_info *cinfo= (struct card_info *) ent->driver_data;
......
#ifndef __SAA7146_CORE__
#define __SAA7146_CORE__
#include <asm/io.h> /* definitions of u32 etc. */
#include "../dvb-core/dvbdev.h"
#if LINUX_VERSION_CODE < 0x020300
#define DECLARE_MUTEX(foo) struct semaphore foo = MUTEX
#define DECLARE_MUTEX_LOCKED(foo) struct semaphore foo = MUTEX_LOCKED
#define WAIT_QUEUE struct wait_queue*
#define init_waitqueue_head(wq) *(wq) = NULL;
#else
#define WAIT_QUEUE wait_queue_head_t
#endif
#include <asm/io.h>
#include <asm/semaphore.h>
#include "dvbdev.h"
/* maximum number of capture frames we support */
#define SAA7146_MAX_BUF 5
......@@ -37,12 +31,13 @@ struct saa7146 {
char name[32]; /* give it a nice name */
struct list_head list_head;
dvb_adapter_t *dvb_adapter;
struct dvb_i2c_bus *i2c_bus;
struct pci_dev *device;
int card_type;
struct dvb_adapter *dvb_adapter;
struct dvb_i2c_bus *i2c_bus;
struct semaphore i2c_sem;
void* data[SAA7146_MAX_EXTENSIONS]; /* data hooks for extensions */
int (*command) (struct dvb_i2c_bus *i, unsigned int cmd, void *arg);
......@@ -70,8 +65,8 @@ struct saa7146 {
int grab_format[SAA7146_MAX_BUF]; /* video format of grabs */
int grab_port[SAA7146_MAX_BUF]; /* video port for grab */
WAIT_QUEUE rps0_wq; /* rps0 interrupt queue (=> capture) */
WAIT_QUEUE rps1_wq; /* rps1 interrupt queue (=> i2c, ...) */
wait_queue_head_t rps0_wq; /* rps0 interrupt queue (=> capture) */
wait_queue_head_t rps1_wq; /* rps1 interrupt queue (=> i2c, ...) */
};
#define SAA7146_IRQ_RPS0
......
......@@ -320,7 +320,6 @@ static int saa7146_v4l_command(struct saa7146* saa, void *p, unsigned int cmd, v
/* set corresponding buffer to unused */
saa->frame_stat[i] = GBUFFER_UNUSED;
printk ("saa7146_v4l.o: SAA7146_V4L_CSYNC, frame %i done.\n", i);
break;
}
......
This diff is collapsed.
......@@ -64,7 +64,7 @@ typedef struct dmxdev_buffer_s {
typedef struct dmxdev_filter_s {
dvb_device_t *dvbdev;
struct dvb_device *dvbdev;
union {
dmx_section_filter_t *sec;
......@@ -102,8 +102,8 @@ typedef struct dmxdev_dvr_s {
typedef struct dmxdev_s {
dvb_device_t *dvbdev;
dvb_device_t *dvr_dvbdev;
struct dvb_device *dvbdev;
struct dvb_device *dvr_dvbdev;
dmxdev_filter_t *filter;
dmxdev_dvr_t *dvr;
......@@ -122,7 +122,7 @@ typedef struct dmxdev_s {
} dmxdev_t;
int DmxDevInit(dmxdev_t *dmxdev, dvb_adapter_t *);
void DmxDevRelease(dmxdev_t *dmxdev);
int dvb_dmxdev_init(dmxdev_t *dmxdev, struct dvb_adapter *);
void dvb_dmxdev_release(dmxdev_t *dmxdev);
#endif /* _DMXDEV_H_ */
This diff is collapsed.
......@@ -39,14 +39,14 @@
#define DVB_DEMUX_MASK_MAX 18
typedef struct dvb_demux_filter_s {
struct dvb_demux_filter {
dmx_section_filter_t filter;
u8 maskandmode [DMX_MAX_FILTER_SIZE];
u8 maskandnotmode [DMX_MAX_FILTER_SIZE];
int doneq;
struct dvb_demux_filter_s *next;
struct dvb_demux_feed_s *feed;
struct dvb_demux_filter *next;
struct dvb_demux_feed *feed;
int index;
int state;
int type;
......@@ -56,11 +56,10 @@ typedef struct dvb_demux_filter_s {
u16 hw_handle;
struct timer_list timer;
int ts_state;
};
//u16 pid; //to be removed
} dvb_demux_filter_t;
typedef struct dvb_demux_feed_s {
struct dvb_demux_feed {
union {
dmx_ts_feed_t ts;
dmx_section_feed_t sec;
......@@ -71,7 +70,7 @@ typedef struct dvb_demux_feed_s {
dmx_section_cb sec;
} cb;
struct dvb_demux_s *demux;
struct dvb_demux *demux;
int type;
int state;
u16 pid;
......@@ -81,7 +80,7 @@ typedef struct dvb_demux_feed_s {
int check_crc;
struct timespec timeout;
dvb_demux_filter_t *filter;
struct dvb_demux_filter *filter;
int cb_length;
int ts_type;
......@@ -93,42 +92,43 @@ typedef struct dvb_demux_feed_s {
int cc;
u16 peslen;
} dvb_demux_feed_t;
};
typedef struct dvb_demux_s {
struct dvb_demux {
dmx_demux_t dmx;
void *priv;
int filternum;
int feednum;
int (*start_feed)(dvb_demux_feed_t *);
int (*stop_feed)(dvb_demux_feed_t *);
int (*write_to_decoder)(dvb_demux_feed_t *, u8 *, size_t);
int (*start_feed)(struct dvb_demux_feed *);
int (*stop_feed)(struct dvb_demux_feed *);
int (*write_to_decoder)(struct dvb_demux_feed *, u8 *, size_t);
int users;
#define MAX_DVB_DEMUX_USERS 10
dvb_demux_filter_t *filter;
dvb_demux_feed_t *feed;
struct dvb_demux_filter *filter;
struct dvb_demux_feed *feed;
struct list_head frontend_list;
dvb_demux_feed_t *pesfilter[DMX_TS_PES_OTHER];
struct dvb_demux_feed *pesfilter[DMX_TS_PES_OTHER];
u16 pids[DMX_TS_PES_OTHER];
int playing;
int recording;
#define DMX_MAX_PID 0x2000
dvb_demux_feed_t *pid2feed[DMX_MAX_PID+1];
struct dvb_demux_feed *pid2feed[DMX_MAX_PID+1];
u8 tsbuf[188];
int tsbufp;
struct semaphore mutex;
spinlock_t lock;
} dvb_demux_t;
};
int DvbDmxInit(dvb_demux_t *dvbdemux);
int DvbDmxRelease(dvb_demux_t *dvbdemux);
void DvbDmxSWFilterPackets(dvb_demux_t *dvbdmx, const u8 *buf, int count);
int dvb_dmx_init(struct dvb_demux *dvbdemux);
int dvb_dmx_release(struct dvb_demux *dvbdemux);
void dvb_dmx_swfilter_packet(struct dvb_demux *dvbdmx, const u8 *buf);
void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf, int count);
#endif /* _DVB_DEMUX_H_ */
This diff is collapsed.
......@@ -6,18 +6,18 @@
#include "demux.h"
typedef int (pes2ts_cb_t) (void *, unsigned char *);
typedef int (dvb_filter_pes2ts_cb_t) (void *, unsigned char *);
typedef struct pes2ts_s {
typedef struct dvb_filter_pes2ts_s {
unsigned char buf[188];
unsigned char cc;
pes2ts_cb_t *cb;
dvb_filter_pes2ts_cb_t *cb;
void *priv;
} pes2ts_t;
} dvb_filter_pes2ts_t;
void pes2ts_init(pes2ts_t *p2ts, unsigned short pid,
pes2ts_cb_t *cb, void *priv);
int pes2ts(pes2ts_t *p2ts, unsigned char *pes, int len);
void dvb_filter_pes2ts_init(dvb_filter_pes2ts_t *p2ts, unsigned short pid,
dvb_filter_pes2ts_cb_t *cb, void *priv);
int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len);
#define PROG_STREAM_MAP 0xBC
......@@ -224,26 +224,11 @@ typedef struct audio_i{
} AudioInfo;
void reset_ipack(ipack *p);
int instant_repack(u8 *buf, int count, ipack *p);
void init_ipack(ipack *p, int size,
void dvb_filter_ipack_reset(ipack *p);
int dvb_filter_instant_repack(u8 *buf, int count, ipack *p);
void dvb_filter_ipack_init(ipack *p, int size,
void (*func)(u8 *buf, int size, void *priv));
void free_ipack(ipack * p);
void setup_ts2pes(ipack *pa, ipack *pv, u16 *pida, u16 *pidv,
void (*pes_write)(u8 *buf, int count, void *data),
void *priv);
void ts_to_pes(ipack *p, u8 *buf);
void send_ipack(ipack *p);
void send_ipack_rest(ipack *p);
int get_ainfo(uint8_t *mbuf, int count, AudioInfo *ai, int pr);
int get_ac3info(uint8_t *mbuf, int count, AudioInfo *ai, int pr);
int get_vinfo(uint8_t *mbuf, int count, VideoInfo *vi, int pr);
uint8_t *skip_pes_header(uint8_t **bufp);
void initialize_quant_matrix( uint32_t *matrix );
void initialize_mpg_picture(mpg_picture *pic);
void init_mpg_picture( mpg_picture *pic, int chan, int32_t field_type);
void mpg_set_picture_parameter( int32_t field_type, mpg_picture *pic );
int read_sequence_header(uint8_t *headr, VideoInfo *vi, int pr);
int read_gop_header(uint8_t *headr, mpg_picture *pic, int pr);
int read_picture_header(uint8_t *headr, mpg_picture *pic, int field, int pr);
void dvb_filter_ipack_free(ipack * p);
void dvb_filter_ipack_flush(ipack *p);
#endif
......@@ -83,7 +83,7 @@ struct dvb_frontend_data {
struct dvb_frontend_ioctl_data {
struct list_head list_head;
struct dvb_adapter_s *adapter;
struct dvb_adapter *adapter;
int (*before_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg);
int (*after_ioctl) (struct dvb_frontend *frontend,
......@@ -336,9 +336,6 @@ int dvb_frontend_set_parameters (struct dvb_frontend_data *fe,
struct dvb_frontend *frontend = &fe->frontend;
int err;
dprintk ("%s: f == %i, drift == %i\n",
__FUNCTION__, param->frequency, fe->lnb_drift);
dvb_bend_frequency (fe, 0);
if (first_trial) {
......@@ -352,6 +349,9 @@ int dvb_frontend_set_parameters (struct dvb_frontend_data *fe,
sizeof (struct dvb_frontend_parameters));
}
dprintk ("%s: f == %i, drift == %i\n",
__FUNCTION__, param->frequency, fe->lnb_drift);
param->frequency += fe->lnb_drift + fe->bending;
err = dvb_frontend_internal_ioctl (frontend, FE_SET_FRONTEND, param);
param->frequency -= fe->lnb_drift + fe->bending;
......@@ -367,9 +367,8 @@ void dvb_frontend_init (struct dvb_frontend_data *fe)
struct dvb_frontend *frontend = &fe->frontend;
struct dvb_frontend_parameters *init_param;
printk ("%s: initialising frontend %i:%i (%s)...\n", __FUNCTION__,
frontend->i2c->adapter->num, frontend->i2c->id,
fe->info->name);
printk ("DVB: initialising frontend %i:%i (%s)...\n",
frontend->i2c->adapter->num, frontend->i2c->id, fe->info->name);
dvb_frontend_internal_ioctl (frontend, FE_INIT, NULL);
......@@ -436,15 +435,20 @@ void dvb_frontend_recover (struct dvb_frontend_data *fe)
*/
{
int j = fe->lost_sync_count;
int stepsize = fe->info->frequency_stepsize;
if (j % 32 == 0)
fe->lnb_drift = 0;
int stepsize;
if (j % 2)
fe->lnb_drift += stepsize * ((j+1)/2);
if (fe->info->type == FE_QPSK)
stepsize = fe->parameters.u.qpsk.symbol_rate / 16000;
else
stepsize = fe->info->frequency_stepsize * 2;
if (j % 32 == 0) {
fe->lnb_drift = 0;
} else {
fe->lnb_drift = -fe->lnb_drift;
if (j % 2)
fe->lnb_drift += stepsize;
}
dvb_frontend_set_parameters (fe, &fe->parameters, 0);
}
......@@ -511,7 +515,8 @@ int dvb_frontend_thread (void *data)
fe->lost_sync_count = 0;
} else {
fe->lost_sync_count++;
if (fe->lost_sync_count < 10) /* XXX FIXME CHECKME! */
continue;
dvb_frontend_recover (fe);
delay = HZ/5;
if (jiffies - fe->lost_sync_jiffies > TIMEOUT) {
......@@ -627,7 +632,7 @@ unsigned int dvb_frontend_poll (struct file *file, struct poll_table_struct *wai
static
int dvb_frontend_open (struct inode *inode, struct file *file)
{
dvb_device_t *dvbdev = file->private_data;
struct dvb_device *dvbdev = file->private_data;
struct dvb_frontend_data *fe = dvbdev->priv;
int ret;
......@@ -648,7 +653,7 @@ int dvb_frontend_open (struct inode *inode, struct file *file)
static
int dvb_frontend_release (struct inode *inode, struct file *file)
{
dvb_device_t *dvbdev = file->private_data;
struct dvb_device *dvbdev = file->private_data;
struct dvb_frontend_data *fe = dvbdev->priv;
dprintk ("%s\n", __FUNCTION__);
......@@ -661,7 +666,7 @@ int dvb_frontend_release (struct inode *inode, struct file *file)
int
dvb_add_frontend_ioctls (struct dvb_adapter_s *adapter,
dvb_add_frontend_ioctls (struct dvb_adapter *adapter,
int (*before_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg),
int (*after_ioctl) (struct dvb_frontend *frontend,
......@@ -715,7 +720,7 @@ dvb_add_frontend_ioctls (struct dvb_adapter_s *adapter,
void
dvb_remove_frontend_ioctls (struct dvb_adapter_s *adapter,
dvb_remove_frontend_ioctls (struct dvb_adapter *adapter,
int (*before_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg),
int (*after_ioctl) (struct dvb_frontend *frontend,
......@@ -748,7 +753,7 @@ dvb_remove_frontend_ioctls (struct dvb_adapter_s *adapter,
int
dvb_add_frontend_notifier (struct dvb_adapter_s *adapter,
dvb_add_frontend_notifier (struct dvb_adapter *adapter,
void (*callback) (fe_status_t s, void *data),
void *data)
{
......@@ -791,7 +796,7 @@ dvb_add_frontend_notifier (struct dvb_adapter_s *adapter,
void
dvb_remove_frontend_notifier (struct dvb_adapter_s *adapter,
dvb_remove_frontend_notifier (struct dvb_adapter *adapter,
void (*callback) (fe_status_t s, void *data))
{
struct list_head *entry;
......@@ -827,11 +832,11 @@ dvb_remove_frontend_notifier (struct dvb_adapter_s *adapter,
static
struct file_operations dvb_frontend_fops = {
owner: THIS_MODULE,
ioctl: dvb_generic_ioctl,
poll: dvb_frontend_poll,
open: dvb_frontend_open,
release: dvb_frontend_release
.owner = THIS_MODULE,
.ioctl = dvb_generic_ioctl,
.poll = dvb_frontend_poll,
.open = dvb_frontend_open,
.release = dvb_frontend_release
};
......@@ -845,9 +850,11 @@ dvb_register_frontend (int (*ioctl) (struct dvb_frontend *frontend,
{
struct list_head *entry;
struct dvb_frontend_data *fe;
dvb_device_t dvbdev_template = { users: 1, writers: 1,
fops: &dvb_frontend_fops,
kernel_ioctl: dvb_frontend_ioctl
static const struct dvb_device dvbdev_template = {
.users = 1,
.writers = 1,
.fops = &dvb_frontend_fops,
.kernel_ioctl = dvb_frontend_ioctl
};
dprintk ("%s\n", __FUNCTION__);
......@@ -878,7 +885,9 @@ dvb_register_frontend (int (*ioctl) (struct dvb_frontend *frontend,
list_for_each (entry, &frontend_ioctl_list) {
struct dvb_frontend_ioctl_data *ioctl;
ioctl = list_entry (entry, struct dvb_frontend_ioctl_data, list_head);
ioctl = list_entry (entry,
struct dvb_frontend_ioctl_data,
list_head);
if (ioctl->adapter == i2c->adapter) {
fe->frontend.before_ioctl = ioctl->before_ioctl;
......@@ -936,3 +945,4 @@ MODULE_PARM(dvb_frontend_debug,"i");
MODULE_PARM(dvb_shutdown_timeout,"i");
MODULE_PARM_DESC(dvb_frontend_debug, "enable verbose debug messages");
MODULE_PARM_DESC(dvb_shutdown_timeout, "wait <shutdown_timeout> seconds after close() before suspending hardware");
......@@ -90,7 +90,7 @@ dvb_unregister_frontend (int (*ioctl) (struct dvb_frontend *frontend,
* Return value: number of frontends where the ioctl's were applied.
*/
extern int
dvb_add_frontend_ioctls (struct dvb_adapter_s *adapter,
dvb_add_frontend_ioctls (struct dvb_adapter *adapter,
int (*before_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg),
int (*after_ioctl) (struct dvb_frontend *frontend,
......@@ -99,18 +99,18 @@ dvb_add_frontend_ioctls (struct dvb_adapter_s *adapter,
extern void
dvb_remove_frontend_ioctls (struct dvb_adapter_s *adapter,
dvb_remove_frontend_ioctls (struct dvb_adapter *adapter,
int (*before_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg),
int (*after_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg));
extern int
dvb_add_frontend_notifier (struct dvb_adapter_s *adapter,
dvb_add_frontend_notifier (struct dvb_adapter *adapter,
void (*callback) (fe_status_t s, void *data),
void *data);
extern void
dvb_remove_frontend_notifier (struct dvb_adapter_s *adapter,
dvb_remove_frontend_notifier (struct dvb_adapter *adapter,
void (*callback) (fe_status_t s, void *data));
#endif
......
......@@ -173,7 +173,7 @@ struct dvb_i2c_bus*
dvb_register_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c,
struct i2c_msg msgs[], int num),
void *data,
struct dvb_adapter_s *adapter,
struct dvb_adapter *adapter,
int id)
{
struct dvb_i2c_bus *i2c;
......@@ -200,7 +200,7 @@ dvb_register_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c,
struct dvb_i2c_bus*
dvb_find_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c,
struct i2c_msg msgs[], int num),
struct dvb_adapter_s *adapter,
struct dvb_adapter *adapter,
int id)
{
struct list_head *entry;
......@@ -231,7 +231,7 @@ dvb_find_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c,
void dvb_unregister_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c,
struct i2c_msg msgs[], int num),
struct dvb_adapter_s *adapter,
struct dvb_adapter *adapter,
int id)
{
struct dvb_i2c_bus *i2c = dvb_find_i2c_bus (xfer, adapter, id);
......
......@@ -32,7 +32,7 @@ struct dvb_i2c_bus {
struct list_head list_head;
int (*xfer) (struct dvb_i2c_bus *i2c, struct i2c_msg msgs[], int num);
void *data;
struct dvb_adapter_s *adapter;
struct dvb_adapter *adapter;
int id;
struct list_head client_list;
};
......@@ -43,13 +43,13 @@ struct dvb_i2c_bus* dvb_register_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c,
struct i2c_msg msgs[],
int num),
void *data,
struct dvb_adapter_s *adapter,
struct dvb_adapter *adapter,
int id);
extern
void dvb_unregister_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c,
struct i2c_msg msgs[], int num),
struct dvb_adapter_s *adapter,
struct dvb_adapter *adapter,
int id);
......
......@@ -9,11 +9,12 @@
#include "dvb_net.h"
EXPORT_SYMBOL(DmxDevInit);
EXPORT_SYMBOL(DmxDevRelease);
EXPORT_SYMBOL(DvbDmxInit);
EXPORT_SYMBOL(DvbDmxRelease);
EXPORT_SYMBOL(DvbDmxSWFilterPackets);
EXPORT_SYMBOL(dvb_dmxdev_init);
EXPORT_SYMBOL(dvb_dmxdev_release);
EXPORT_SYMBOL(dvb_dmx_init);
EXPORT_SYMBOL(dvb_dmx_release);
EXPORT_SYMBOL(dvb_dmx_swfilter_packet);
EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
EXPORT_SYMBOL(dvb_register_frontend);
EXPORT_SYMBOL(dvb_unregister_frontend);
......@@ -37,13 +38,12 @@ EXPORT_SYMBOL(dvb_unregister_device);
EXPORT_SYMBOL(dvb_generic_ioctl);
EXPORT_SYMBOL(dvb_generic_open);
EXPORT_SYMBOL(dvb_generic_release);
EXPORT_SYMBOL(generic_usercopy);
EXPORT_SYMBOL(init_ipack);
EXPORT_SYMBOL(reset_ipack);
EXPORT_SYMBOL(free_ipack);
EXPORT_SYMBOL(send_ipack_rest);
EXPORT_SYMBOL(instant_repack);
EXPORT_SYMBOL(pes2ts_init);
EXPORT_SYMBOL(pes2ts);
EXPORT_SYMBOL(dvb_filter_ipack_init);
EXPORT_SYMBOL(dvb_filter_ipack_reset);
EXPORT_SYMBOL(dvb_filter_ipack_free);
EXPORT_SYMBOL(dvb_filter_ipack_flush);
EXPORT_SYMBOL(dvb_filter_instant_repack);
EXPORT_SYMBOL(dvb_filter_pes2ts_init);
EXPORT_SYMBOL(dvb_filter_pes2ts);
......@@ -435,7 +435,7 @@ dvb_net_remove_if(dvb_net_t *dvbnet, int num)
int dvb_net_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *parg)
{
dvb_device_t *dvbdev=(dvb_device_t *) file->private_data;
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
dvb_net_t *dvbnet=(dvb_net_t *) dvbdev->priv;
if (((file->f_flags&O_ACCMODE)==O_RDONLY))
......@@ -462,21 +462,18 @@ int dvb_net_ioctl(struct inode *inode, struct file *file,
}
static struct file_operations dvb_net_fops = {
owner: THIS_MODULE,
read: 0,
write: 0,
ioctl: dvb_generic_ioctl,
open: dvb_generic_open,
release: dvb_generic_release,
poll: 0,
.owner = THIS_MODULE,
.ioctl = dvb_generic_ioctl,
.open = dvb_generic_open,
.release = dvb_generic_release,
};
static dvb_device_t dvbdev_net = {
priv: 0,
users: 1,
writers: 1,
fops: &dvb_net_fops,
kernel_ioctl: dvb_net_ioctl,
static struct dvb_device dvbdev_net = {
.priv = 0,
.users = 1,
.writers = 1,
.fops = &dvb_net_fops,
.kernel_ioctl = dvb_net_ioctl,
};
void
......@@ -493,7 +490,7 @@ dvb_net_release(dvb_net_t *dvbnet)
}
int
dvb_net_init(dvb_adapter_t *adap, dvb_net_t *dvbnet, dmx_demux_t *demux)
dvb_net_init(struct dvb_adapter *adap, dvb_net_t *dvbnet, dmx_demux_t *demux)
{
int i;
......
......@@ -47,7 +47,7 @@ typedef struct dvb_net_priv_s {
} dvb_net_priv_t;
typedef struct dvb_net_s {
dvb_device_t *dvbdev;
struct dvb_device *dvbdev;
int card_num;
int dev_num;
......@@ -58,6 +58,6 @@ typedef struct dvb_net_s {
void dvb_net_release(dvb_net_t *);
int dvb_net_init(dvb_adapter_t *, dvb_net_t *, dmx_demux_t *);
int dvb_net_init(struct dvb_adapter *, dvb_net_t *, dmx_demux_t *);
#endif
......@@ -37,6 +37,7 @@
#include <asm/system.h>
#include <linux/kmod.h>
#include <linux/slab.h>
#include <linux/videodev.h>
#include "compat.h"
#include "dvbdev.h"
......@@ -69,17 +70,17 @@ static char *dnames[] = {
static
dvb_device_t* dvbdev_find_device (int minor)
struct dvb_device* dvbdev_find_device (int minor)
{
struct list_head *entry;
list_for_each (entry, &dvb_adapter_list) {
struct list_head *entry0;
dvb_adapter_t *adap;
adap = list_entry (entry, dvb_adapter_t, list_head);
struct dvb_adapter *adap;
adap = list_entry (entry, struct dvb_adapter, list_head);
list_for_each (entry0, &adap->device_list) {
dvb_device_t *dev;
dev = list_entry (entry0, dvb_device_t, list_head);
struct dvb_device *dev;
dev = list_entry (entry0, struct dvb_device, list_head);
if (nums2minor(adap->num, dev->type, dev->id) == minor)
return dev;
}
......@@ -92,7 +93,7 @@ dvb_device_t* dvbdev_find_device (int minor)
static
int dvb_device_open(struct inode *inode, struct file *file)
{
dvb_device_t *dvbdev;
struct dvb_device *dvbdev;
dvbdev = dvbdev_find_device (minor(inode->i_rdev));
......@@ -118,13 +119,8 @@ int dvb_device_open(struct inode *inode, struct file *file)
static struct file_operations dvb_device_fops =
{
owner: THIS_MODULE,
read: NULL,
write: NULL,
ioctl: NULL,
open: dvb_device_open,
release: NULL,
poll: NULL,
.owner = THIS_MODULE,
.open = dvb_device_open,
};
#endif /* CONFIG_DVB_DEVFS_ONLY */
......@@ -132,7 +128,7 @@ static struct file_operations dvb_device_fops =
int dvb_generic_open(struct inode *inode, struct file *file)
{
dvb_device_t *dvbdev = file->private_data;
struct dvb_device *dvbdev = file->private_data;
if (!dvbdev)
return -ENODEV;
......@@ -153,7 +149,7 @@ int dvb_generic_open(struct inode *inode, struct file *file)
int dvb_generic_release(struct inode *inode, struct file *file)
{
dvb_device_t *dvbdev = file->private_data;
struct dvb_device *dvbdev = file->private_data;
if (!dvbdev)
return -ENODEV;
......@@ -166,73 +162,10 @@ int dvb_generic_release(struct inode *inode, struct file *file)
}
/*
* helper function -- handles userspace copying for ioctl arguments
*/
int
generic_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg))
{
char sbuf[128];
void *mbuf = NULL;
void *parg = NULL;
int err = -EINVAL;
/* Copy arguments into temp kernel buffer */
switch (_IOC_DIR(cmd)) {
case _IOC_NONE:
parg = (void *)arg;
break;
case _IOC_READ: /* some v4l ioctls are marked wrong ... */
case _IOC_WRITE:
case (_IOC_WRITE | _IOC_READ):
if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
parg = sbuf;
} else {
/* too big to allocate from stack */
mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
if (NULL == mbuf)
return -ENOMEM;
parg = mbuf;
}
err = -EFAULT;
if (copy_from_user(parg, (void *)arg, _IOC_SIZE(cmd)))
goto out;
break;
}
/* call driver */
if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD)
err = -EINVAL;
if (err < 0)
goto out;
/* Copy results into user buffer */
switch (_IOC_DIR(cmd))
{
case _IOC_READ:
case (_IOC_WRITE | _IOC_READ):
if (copy_to_user((void *)arg, parg, _IOC_SIZE(cmd)))
err = -EFAULT;
break;
}
out:
if (mbuf)
kfree(mbuf);
return err;
}
int dvb_generic_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
dvb_device_t *dvbdev = file->private_data;
struct dvb_device *dvbdev = file->private_data;
if (!dvbdev)
return -ENODEV;
......@@ -240,20 +173,20 @@ int dvb_generic_ioctl(struct inode *inode, struct file *file,
if (!dvbdev->kernel_ioctl)
return -EINVAL;
return generic_usercopy (inode, file, cmd, arg, dvbdev->kernel_ioctl);
return video_usercopy (inode, file, cmd, arg, dvbdev->kernel_ioctl);
}
static
int dvbdev_get_free_id (struct dvb_adapter_s *adap, int type)
int dvbdev_get_free_id (struct dvb_adapter *adap, int type)
{
u32 id = 0;
while (id < DVB_MAX_IDS) {
struct list_head *entry;
list_for_each (entry, &adap->device_list) {
dvb_device_t *dev;
dev = list_entry (entry, dvb_device_t, list_head);
struct dvb_device *dev;
dev = list_entry (entry, struct dvb_device, list_head);
if (dev->type == type && dev->id == id)
goto skip;
}
......@@ -265,12 +198,12 @@ int dvbdev_get_free_id (struct dvb_adapter_s *adap, int type)
}
int dvb_register_device(dvb_adapter_t *adap, dvb_device_t **pdvbdev,
dvb_device_t *template, void *priv, int type)
int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
const struct dvb_device *template, void *priv, int type)
{
u32 id;
char name [20];
dvb_device_t *dvbdev;
struct dvb_device *dvbdev;
if (down_interruptible (&dvbdev_register_lock))
return -ERESTARTSYS;
......@@ -282,7 +215,7 @@ int dvb_register_device(dvb_adapter_t *adap, dvb_device_t **pdvbdev,
return -ENFILE;
}
*pdvbdev = dvbdev = kmalloc(sizeof(dvb_device_t), GFP_KERNEL);
*pdvbdev = dvbdev = kmalloc(sizeof(struct dvb_device), GFP_KERNEL);
if (!dvbdev) {
up(&dvbdev_register_lock);
......@@ -291,7 +224,7 @@ int dvb_register_device(dvb_adapter_t *adap, dvb_device_t **pdvbdev,
up (&dvbdev_register_lock);
memcpy(dvbdev, template, sizeof(dvb_device_t));
memcpy(dvbdev, template, sizeof(struct dvb_device));
dvbdev->type = type;
dvbdev->id = id;
dvbdev->adapter = adap;
......@@ -307,15 +240,15 @@ int dvb_register_device(dvb_adapter_t *adap, dvb_device_t **pdvbdev,
S_IFCHR | S_IRUSR | S_IWUSR,
dvbdev->fops, dvbdev);
dprintk("%s: register adapter%d/%s @ minor: %i (0x%02x) - dvbdev: %p\n",
__FUNCTION__, adap->num, name, nums2minor(adap->num, type, id),
nums2minor(adap->num, type, id), dvbdev);
dprintk("DVB: register adapter%d/%s @ minor: %i (0x%02x)\n",
adap->num, name, nums2minor(adap->num, type, id),
nums2minor(adap->num, type, id));
return 0;
}
void dvb_unregister_device(dvb_device_t *dvbdev)
void dvb_unregister_device(struct dvb_device *dvbdev)
{
if (!dvbdev)
return;
......@@ -334,8 +267,8 @@ int dvbdev_get_free_adapter_num (void)
while (1) {
struct list_head *entry;
list_for_each (entry, &dvb_adapter_list) {
dvb_adapter_t *adap;
adap = list_entry (entry, dvb_adapter_t, list_head);
struct dvb_adapter *adap;
adap = list_entry (entry, struct dvb_adapter, list_head);
if (adap->num == num)
goto skip;
}
......@@ -348,10 +281,10 @@ int dvbdev_get_free_adapter_num (void)
}
int dvb_register_adapter(dvb_adapter_t **padap, char *name)
int dvb_register_adapter(struct dvb_adapter **padap, char *name)
{
char dirname[16];
dvb_adapter_t *adap;
struct dvb_adapter *adap;
int num;
if (down_interruptible (&dvbdev_register_lock))
......@@ -362,17 +295,17 @@ int dvb_register_adapter(dvb_adapter_t **padap, char *name)
return -ENFILE;
}
if (!(*padap = adap = kmalloc(sizeof(dvb_adapter_t), GFP_KERNEL))) {
if (!(*padap = adap = kmalloc(sizeof(struct dvb_adapter), GFP_KERNEL))) {
up(&dvbdev_register_lock);
return -ENOMEM;
}
memset (adap, 0, sizeof(dvb_adapter_t));
memset (adap, 0, sizeof(struct dvb_adapter));
INIT_LIST_HEAD (&adap->device_list);
MOD_INC_USE_COUNT;
printk ("%s: registering new adapter (%s).\n", __FUNCTION__, name);
printk ("DVB: registering new adapter (%s).\n", name);
sprintf(dirname, "dvb/adapter%d", num);
adap->devfs_handle = devfs_mk_dir(NULL, dirname, NULL);
......@@ -386,7 +319,7 @@ int dvb_register_adapter(dvb_adapter_t **padap, char *name)
}
int dvb_unregister_adapter(dvb_adapter_t *adap)
int dvb_unregister_adapter(struct dvb_adapter *adap)
{
devfs_unregister (adap->devfs_handle);
if (down_interruptible (&dvbdev_register_lock))
......
......@@ -43,49 +43,48 @@
#define DVB_DEVICE_OSD 8
typedef struct dvb_adapter_s
{
struct dvb_adapter {
int num;
devfs_handle_t devfs_handle;
struct list_head list_head;
struct list_head device_list;
} dvb_adapter_t;
};
typedef struct dvb_device
{
struct dvb_device {
struct list_head list_head;
struct file_operations *fops;
devfs_handle_t devfs_handle;
dvb_adapter_t *adapter;
struct dvb_adapter *adapter;
int type;
u32 id;
int users;
int writers;
/* don't really need those !? */
/* don't really need those !? -- FIXME: use video_usercopy */
int (*kernel_ioctl)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg); // FIXME: use generic_usercopy()
unsigned int cmd, void *arg);
void *priv;
} dvb_device_t;
};
int dvb_register_device(dvb_adapter_t *adap, dvb_device_t **pdvbdev,
dvb_device_t *template, void *priv, int type);
void dvb_unregister_device(struct dvb_device *dvbdev);
extern int dvb_register_adapter (struct dvb_adapter **padap, char *name);
extern int dvb_unregister_adapter (struct dvb_adapter *adap);
int dvb_register_adapter(dvb_adapter_t **padap, char *name);
int dvb_unregister_adapter(dvb_adapter_t *adap);
extern int dvb_register_device (struct dvb_adapter *adap,
struct dvb_device **pdvbdev,
const struct dvb_device *template,
void *priv,
int type);
int dvb_generic_ioctl(struct inode *inode, struct file *file,
extern void dvb_unregister_device (struct dvb_device *dvbdev);
extern int dvb_generic_open (struct inode *inode, struct file *file);
extern int dvb_generic_release (struct inode *inode, struct file *file);
extern int dvb_generic_ioctl (struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
int dvb_generic_open(struct inode *inode, struct file *file);
int dvb_generic_release(struct inode *inode, struct file *file);
int generic_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg));
#endif /* #ifndef __DVBDEV_H */
#endif /* #ifndef _DVBDEV_H_ */
......@@ -23,6 +23,30 @@ config DVB_ALPS_BSRV2
DVB adapter simply enable all supported frontends, the
right one will get autodetected.
config DVB_ALPS_TDLB7
tristate "Alps TDLB7 (OFDM)"
depends on DVB_CORE
help
A DVB-T tuner module. Say Y when you want to support this frontend.
This tuner module needs some microcode located in a file called
"Sc_main.mc" in the windows driver. Please pass the module parameter
mcfile="/PATH/FILENAME" when loading alps_tdlb7.o.
If you don't know what tuner module is soldered on your
DVB adapter simply enable all supported frontends, the
right one will get autodetected.
config DVB_ALPS_TDMB7
tristate "Alps BSRV2 (OFDM)"
depends on DVB_CORE
help
A DVB-S tuner module. Say Y when you want to support this frontend.
If you don't know what tuner module is soldered on your
DVB adapter simply enable all supported frontends, the
right one will get autodetected.
config DVB_GRUNDIG_29504_491
tristate "Grundig 29504-491 (QPSK)"
depends on DVB_CORE
......
......@@ -6,6 +6,8 @@ EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
obj-$(CONFIG_DVB_ALPS_BSRU6) += alps_bsru6.o
obj-$(CONFIG_DVB_ALPS_BSRV2) += alps_bsrv2.o
obj-$(CONFIG_DVB_ALPS_TDLB7) += alps_tdlb7.o
obj-$(CONFIG_DVB_ALPS_TDMB7) += alps_tdmb7.o
obj-$(CONFIG_DVB_GRUNDIG_29504_491) += grundig_29504-491.o
obj-$(CONFIG_DVB_GRUNDIG_29504_401) += grundig_29504-401.o
obj-$(CONFIG_DVB_VES1820) += ves1820.o
......
/*
Alps BSRU6 DVB QPSK frontend driver
Alps BSRU6 and LG TDQB-S00x DVB QPSK frontend driver
Copyright (C) 2001-2002 Convergence Integrated Media GmbH
<ralph@convergence.de>, <holger@convergence.de>
<ralph@convergence.de>, <holger@convergence.de>,
<js@convergence.de>
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
......@@ -32,12 +33,16 @@ static int debug = 0;
#define M_CLK (88000000UL)
/* M=21, K=0, P=0, f_VCO = 4MHz*4*(M+1)/(K+1) = 352 MHz */
static
struct dvb_frontend_info bsru6_info = {
#ifdef CONFIG_ALPS_BSRU6_IS_LG_TDQBS00X
name: "LG TDQB-S00x",
#else
name: "Alps BSRU6",
#endif
type: FE_QPSK,
frequency_min: 950000,
frequency_max: 2150000,
......@@ -63,7 +68,8 @@ u8 init_tab [] = {
0x05, 0x35, // SDAT:0 SCLT:0 I2CT:1
0x06, 0x00, // DAC mode and MSB
0x07, 0x00, // DAC LSB
0x08, 0x43, // DiSEqC
// 0x08, 0x43, // DiSEqC
0x08, 0x03, // DiSEqC
0x09, 0x00,
0x0a, 0x42,
0x0c, 0x51, // QPSK reverse:1 Nyquist:0 OP0 val:1 OP0 con:1 OP1 val:1 OP1 con:1
......@@ -79,17 +85,20 @@ u8 init_tab [] = {
0x15, 0xc9, // lock detector threshold
0x16, 0x1d,
0x17, 0x0,
0x17, 0x00,
0x18, 0x14,
0x19, 0xf2,
0x1a, 0x11,
0x1b, 0x9c,
0x1c, 0x0,
0x1d, 0x0,
0x1e, 0xb,
0x1c, 0x00,
0x1d, 0x00,
0x1e, 0x0b,
0x1f, 0x50,
0x20, 0x00,
0x21, 0x00,
0x22, 0x00,
0x23, 0x00,
0x24, 0xff,
......@@ -110,16 +119,37 @@ u8 init_tab [] = {
0x33, 0xfc, // rs control
0x34, 0x93, // error control
0x0b, 0x00,
0x27, 0x00, 0x2f, 0x00, 0x30, 0x00,
0x35, 0x00, 0x36, 0x00, 0x37, 0x00,
0x38, 0x00, 0x39, 0x00, 0x3a, 0x00, 0x3b, 0x00,
0x3c, 0x00, 0x3d, 0x00, 0x3e, 0x00, 0x3f, 0x00,
0x40, 0x00, 0x41, 0x00, 0x42, 0x00, 0x43, 0x00,
0x44, 0x00, 0x45, 0x00, 0x46, 0x00, 0x47, 0x00,
0x48, 0x00, 0x49, 0x00, 0x4a, 0x00, 0x4b, 0x00,
0x4c, 0x00, 0x4d, 0x00, 0x4e, 0x00, 0x4f, 0x00
0x27, 0x00,
0x2f, 0x00,
0x30, 0x00,
0x35, 0x00,
0x36, 0x00,
0x37, 0x00,
0x38, 0x00,
0x39, 0x00,
0x3a, 0x00,
0x3b, 0x00,
0x3c, 0x00,
0x3d, 0x00,
0x3e, 0x00,
0x3f, 0x00,
0x40, 0x00,
0x41, 0x00,
0x42, 0x00,
0x43, 0x00,
0x44, 0x00,
0x45, 0x00,
0x46, 0x00,
0x47, 0x00,
0x48, 0x00,
0x49, 0x00,
0x4a, 0x00,
0x4b, 0x00,
0x4c, 0x00,
0x4d, 0x00,
0x4e, 0x00,
0x4f, 0x00
};
......@@ -231,12 +261,27 @@ int stv0299_init (struct dvb_i2c_bus *i2c)
static
int stv0299_set_inversion (struct dvb_i2c_bus *i2c, int inversion)
int stv0299_set_inversion (struct dvb_i2c_bus *i2c,
fe_spectral_inversion_t inversion)
{
u8 val;
dprintk ("%s\n", __FUNCTION__);
#ifdef CONFIG_ALPS_BSRU6_IS_LG_TDQBS00X /* reversed I/Q pins */
switch (inversion) {
case INVERSION_AUTO:
return -EOPNOTSUPP;
case INVERSION_OFF:
val = stv0299_readreg (i2c, 0x0c);
return stv0299_writereg (i2c, 0x0c, val & 0xfe);
case INVERSION_ON:
val = stv0299_readreg (i2c, 0x0c);
return stv0299_writereg (i2c, 0x0c, val | 0x01);
default:
return -EINVAL;
};
#else
switch (inversion) {
case INVERSION_AUTO:
return -EOPNOTSUPP;
......@@ -248,7 +293,8 @@ int stv0299_set_inversion (struct dvb_i2c_bus *i2c, int inversion)
return stv0299_writereg (i2c, 0x0c, val & 0xfe);
default:
return -EINVAL;
}
};
#endif
}
......@@ -277,9 +323,10 @@ int stv0299_set_FEC (struct dvb_i2c_bus *i2c, fe_code_rate_t fec)
static
fe_code_rate_t stv0299_get_FEC (struct dvb_i2c_bus *i2c)
fe_code_rate_t stv0299_get_fec (struct dvb_i2c_bus *i2c)
{
static fe_code_rate_t fec_tab [] = { FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_1_2 };
static fe_code_rate_t fec_tab [] = { FEC_2_3, FEC_3_4, FEC_5_6,
FEC_7_8, FEC_1_2 };
u8 index;
dprintk ("%s\n", __FUNCTION__);
......@@ -343,6 +390,9 @@ int stv0299_send_diseqc_msg (struct dvb_i2c_bus *i2c,
dprintk ("%s\n", __FUNCTION__);
if (stv0299_wait_diseqc_idle (i2c, 100) < 0)
return -ETIMEDOUT;
val = stv0299_readreg (i2c, 0x08);
if (stv0299_writereg (i2c, 0x08, (val & ~0x7) | 0x6)) /* DiSEqC mode */
......@@ -356,12 +406,7 @@ int stv0299_send_diseqc_msg (struct dvb_i2c_bus *i2c,
return -EREMOTEIO;
}
/* Shouldn't we wait for idle state (FE=1, FF=0) here to
make certain all bytes have been sent ?
Hmm, actually we should do that before all mode changes too ...
if (stv0299_wait_diseqc_idle (i2c, 100) < 0) */
if (stv0299_wait_diseqc_fifo (i2c, 100) < 0)
if (stv0299_wait_diseqc_idle (i2c, 100) < 0)
return -ETIMEDOUT;
return 0;
......@@ -375,18 +420,18 @@ int stv0299_send_diseqc_burst (struct dvb_i2c_bus *i2c, fe_sec_mini_cmd_t burst)
dprintk ("%s\n", __FUNCTION__);
val = stv0299_readreg (i2c, 0x08);
if (stv0299_wait_diseqc_fifo (i2c, 100) < 0)
if (stv0299_wait_diseqc_idle (i2c, 100) < 0)
return -ETIMEDOUT;
val = stv0299_readreg (i2c, 0x08);
if (stv0299_writereg (i2c, 0x08, (val & ~0x7) | 0x2)) /* burst mode */
return -EREMOTEIO;
if (stv0299_writereg (i2c, 0x09, burst == SEC_MINI_A ? 0x00 : 0xff))
return -EREMOTEIO;
if (stv0299_wait_diseqc_fifo (i2c, 100) < 0)
if (stv0299_wait_diseqc_idle (i2c, 100) < 0)
return -ETIMEDOUT;
if (stv0299_writereg (i2c, 0x08, val))
......@@ -403,6 +448,9 @@ int stv0299_set_tone (struct dvb_i2c_bus *i2c, fe_sec_tone_mode_t tone)
dprintk ("%s\n", __FUNCTION__);
if (stv0299_wait_diseqc_idle (i2c, 100) < 0)
return -ETIMEDOUT;
val = stv0299_readreg (i2c, 0x08);
switch (tone) {
......@@ -445,8 +493,6 @@ int stv0299_set_symbolrate (struct dvb_i2c_bus *i2c, u32 srate)
u32 tmp;
u8 aclk = 0xb4, bclk = 0x51;
dprintk ("%s\n", __FUNCTION__);
if (srate > M_CLK)
srate = M_CLK;
if (srate < 500000)
......@@ -479,7 +525,6 @@ int stv0299_set_symbolrate (struct dvb_i2c_bus *i2c, u32 srate)
}
static
int stv0299_get_symbolrate (struct dvb_i2c_bus *i2c)
{
......@@ -608,7 +653,7 @@ int bsru6_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
p->frequency += derot_freq;
p->inversion = (stv0299_readreg (i2c, 0x0c) & 1) ?
INVERSION_OFF : INVERSION_ON;
p->u.qpsk.fec_inner = stv0299_get_FEC (i2c);
p->u.qpsk.fec_inner = stv0299_get_fec (i2c);
p->u.qpsk.symbol_rate = stv0299_get_symbolrate (i2c);
break;
}
......@@ -694,7 +739,7 @@ module_exit (exit_bsru6);
MODULE_PARM(debug,"i");
MODULE_PARM_DESC(debug, "enable verbose debug messages");
MODULE_DESCRIPTION("BSRU6 DVB Frontend driver");
MODULE_DESCRIPTION("Alps BSRU6/LG TDQB-S00x DVB Frontend driver");
MODULE_AUTHOR("Ralph Metzler, Holger Waechtler");
MODULE_LICENSE("GPL");
......@@ -342,7 +342,7 @@ int bsrv2_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
*ber = ves1893_readreg (i2c, 0x15);
*ber |= (ves1893_readreg (i2c, 0x16) << 8);
*ber |= (ves1893_readreg (i2c, 0x17) << 16);
*ber |= ((ves1893_readreg (i2c, 0x17) & 0x0f) << 16);
*ber *= 10;
break;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -199,8 +199,8 @@ int ves1820_init (struct dvb_frontend *frontend)
u8 b0 [] = { 0xff };
u8 pwm;
int i;
struct i2c_msg msg [] = { { addr: 0x28, flags: 0, buf: b0, len: 1 },
{ addr: 0x28, flags: I2C_M_RD, buf: &pwm, len: 1 } };
struct i2c_msg msg [] = { { addr: 0x50, flags: 0, buf: b0, len: 1 },
{ addr: 0x50, flags: I2C_M_RD, buf: &pwm, len: 1 } };
dprintk("VES1820: init chip\n");
......@@ -433,12 +433,13 @@ int ves1820_ioctl (struct dvb_frontend *frontend, unsigned int cmd, void *arg)
}
case FE_READ_BER:
*((u32*) arg) = ves1820_readreg(frontend->i2c, 0x14) |
{
u32 ber = ves1820_readreg(frontend->i2c, 0x14) |
(ves1820_readreg(frontend->i2c, 0x15) << 8) |
(ves1820_readreg(frontend->i2c, 0x16) << 16);
/* XXX FIXME: scale!!*/
((ves1820_readreg(frontend->i2c, 0x16) & 0x0f) << 16);
*((u32*) arg) = 10 * ber;
break;
}
case FE_READ_SIGNAL_STRENGTH:
{
u8 gain = ves1820_readreg(frontend->i2c, 0x17);
......
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