summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/frontends/dib3000-common.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/frontends/dib3000-common.h')
-rw-r--r--linux/drivers/media/dvb/frontends/dib3000-common.h76
1 files changed, 64 insertions, 12 deletions
diff --git a/linux/drivers/media/dvb/frontends/dib3000-common.h b/linux/drivers/media/dvb/frontends/dib3000-common.h
index 436eb1afa..c09f0e3d2 100644
--- a/linux/drivers/media/dvb/frontends/dib3000-common.h
+++ b/linux/drivers/media/dvb/frontends/dib3000-common.h
@@ -22,10 +22,11 @@
* see Documentation/dvb/README.dibusb for more information
*
*/
-
#ifndef DIB3000_COMMON_H
#define DIB3000_COMMON_H
+#include "dvb_frontend.h"
+#include "dib3000.h"
/* info and err, taken from usb.h, if there is anything available like by default,
* please change !
@@ -41,6 +42,67 @@ struct dib3000_pid
int active;
};
+/* frontend state */
+struct dib3000_state {
+ struct i2c_adapter* i2c;
+
+ struct dvb_frontend_ops ops;
+
+/* configuration settings */
+ const struct dib3000_config* config;
+
+ spinlock_t pid_list_lock;
+ struct dib3000_pid *pid_list;
+
+ int feedcount;
+
+ struct dvb_frontend frontend;
+};
+
+/* commonly used methods by the dib3000mb/mc/p frontend */
+extern int dib3000_read_reg(struct dib3000_state *state, u16 reg);
+extern int dib3000_write_reg(struct dib3000_state *state, u16 reg, u16 val);
+
+extern int dib3000_init_pid_list(struct dib3000_state *state, int num);
+extern void dib3000_dealloc_pid_list(struct dib3000_state *state);
+extern int dib3000_get_pid_index(struct dib3000_pid pid_list[], int num_pids,
+ int pid, spinlock_t *pid_list_lock,int onoff);
+
+extern int dib3000_search_status(u16 irq,u16 lock);
+
+/* handy shortcuts */
+#define rd(reg) dib3000_read_reg(state,reg)
+
+#define wr(reg,val) if (dib3000_write_reg(state,reg,val)) \
+ { err("while sending 0x%04x to 0x%04x.",val,reg); return -EREMOTEIO; }
+
+#define wr_foreach(a,v) { int i; \
+ deb_alot("sizeof: %d %d\n",sizeof(a),sizeof(v));\
+ for (i=0; i < sizeof(a)/sizeof(u16); i++) \
+ wr(a[i],v[i]); \
+ }
+
+#define set(reg,val) wr(reg,rd(reg) | val)
+
+/* debug */
+
+#ifdef CONFIG_DVB_DIBCOM_DEBUG
+#define dprintk(level,args...) \
+ do { if ((debug & level)) { printk(args); } } while (0)
+
+static int debug;
+module_param(debug, int, 0x644);
+MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=alotmore,8=setfe,16=getfe (|-able)).");
+#else
+#define dprintk(args...) do { } while (0)
+#endif
+
+#define deb_info(args...) dprintk(0x01,args)
+#define deb_xfer(args...) dprintk(0x02,args)
+#define deb_alot(args...) dprintk(0x04,args)
+#define deb_setf(args...) dprintk(0x08,args)
+#define deb_getf(args...) dprintk(0x10,args)
+
/* mask for enabling a specific pid for the pid_filter */
#define DIB3000_ACTIVATE_PID_FILTERING (0x2000)
@@ -81,17 +143,7 @@ struct dib3000_pid
#define DIB3000_TUNER_WRITE_DISABLE(a) (0xffff & ((a << 7) | (1 << 7)))
/* for auto search */
-static u16 dib3000_seq[2][2][2] = /* fft,gua, inv */
- { /* fft */
- { /* gua */
- { 0, 1 }, /* 0 0 { 0,1 } */
- { 3, 9 }, /* 0 1 { 0,1 } */
- },
- {
- { 2, 5 }, /* 1 0 { 0,1 } */
- { 6, 11 }, /* 1 1 { 0,1 } */
- }
- };
+extern u16 dib3000_seq[2][2][2];
#define DIB3000_REG_MANUFACTOR_ID ( 1025)
#define DIB3000_I2C_ID_DIBCOM (0x01b3)