diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2006-07-04 12:47:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 10:53:45 -0400 |
commit | 74340b0a8bc60b400c7e5fe4950303aa6f914d16 (patch) | |
tree | 1cf35a926b7cc63d3c5174d179bdf05eaa2d7ea8 /drivers/media/dvb/frontends/dib3000mb.c | |
parent | 46f73f936665ab26c8501634e6aa34464fcc1521 (diff) |
V4L/DVB (4457): Remove dib3000-common-module
removing the dib3000-common-module. The common stuff is not common anymore - it will be only used by the 3000mb-driver.
A new 3000mc/p-driver will be added which will share common stuff with dib7000.
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends/dib3000mb.c')
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mb.c | 76 |
1 files changed, 74 insertions, 2 deletions
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index 5302e11883a2..adbabfdb04a9 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c | |||
@@ -29,9 +29,10 @@ | |||
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | 31 | ||
32 | #include "dib3000-common.h" | 32 | #include "dvb_frontend.h" |
33 | #include "dib3000mb_priv.h" | 33 | |
34 | #include "dib3000.h" | 34 | #include "dib3000.h" |
35 | #include "dib3000mb_priv.h" | ||
35 | 36 | ||
36 | /* Version information */ | 37 | /* Version information */ |
37 | #define DRIVER_VERSION "0.1" | 38 | #define DRIVER_VERSION "0.1" |
@@ -44,10 +45,81 @@ module_param(debug, int, 0644); | |||
44 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-able))."); | 45 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-able))."); |
45 | #endif | 46 | #endif |
46 | #define deb_info(args...) dprintk(0x01,args) | 47 | #define deb_info(args...) dprintk(0x01,args) |
48 | #define deb_i2c(args...) dprintk(0x02,args) | ||
49 | #define deb_srch(args...) dprintk(0x04,args) | ||
50 | #define deb_info(args...) dprintk(0x01,args) | ||
47 | #define deb_xfer(args...) dprintk(0x02,args) | 51 | #define deb_xfer(args...) dprintk(0x02,args) |
48 | #define deb_setf(args...) dprintk(0x04,args) | 52 | #define deb_setf(args...) dprintk(0x04,args) |
49 | #define deb_getf(args...) dprintk(0x08,args) | 53 | #define deb_getf(args...) dprintk(0x08,args) |
50 | 54 | ||
55 | #ifdef CONFIG_DVB_DIBCOM_DEBUG | ||
56 | static int debug; | ||
57 | module_param(debug, int, 0644); | ||
58 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=i2c,4=srch (|-able))."); | ||
59 | #endif | ||
60 | |||
61 | static int dib3000_read_reg(struct dib3000_state *state, u16 reg) | ||
62 | { | ||
63 | u8 wb[] = { ((reg >> 8) | 0x80) & 0xff, reg & 0xff }; | ||
64 | u8 rb[2]; | ||
65 | struct i2c_msg msg[] = { | ||
66 | { .addr = state->config.demod_address, .flags = 0, .buf = wb, .len = 2 }, | ||
67 | { .addr = state->config.demod_address, .flags = I2C_M_RD, .buf = rb, .len = 2 }, | ||
68 | }; | ||
69 | |||
70 | if (i2c_transfer(state->i2c, msg, 2) != 2) | ||
71 | deb_i2c("i2c read error\n"); | ||
72 | |||
73 | deb_i2c("reading i2c bus (reg: %5d 0x%04x, val: %5d 0x%04x)\n",reg,reg, | ||
74 | (rb[0] << 8) | rb[1],(rb[0] << 8) | rb[1]); | ||
75 | |||
76 | return (rb[0] << 8) | rb[1]; | ||
77 | } | ||
78 | |||
79 | static int dib3000_write_reg(struct dib3000_state *state, u16 reg, u16 val) | ||
80 | { | ||
81 | u8 b[] = { | ||
82 | (reg >> 8) & 0xff, reg & 0xff, | ||
83 | (val >> 8) & 0xff, val & 0xff, | ||
84 | }; | ||
85 | struct i2c_msg msg[] = { | ||
86 | { .addr = state->config.demod_address, .flags = 0, .buf = b, .len = 4 } | ||
87 | }; | ||
88 | deb_i2c("writing i2c bus (reg: %5d 0x%04x, val: %5d 0x%04x)\n",reg,reg,val,val); | ||
89 | |||
90 | return i2c_transfer(state->i2c,msg, 1) != 1 ? -EREMOTEIO : 0; | ||
91 | } | ||
92 | |||
93 | static int dib3000_search_status(u16 irq,u16 lock) | ||
94 | { | ||
95 | if (irq & 0x02) { | ||
96 | if (lock & 0x01) { | ||
97 | deb_srch("auto search succeeded\n"); | ||
98 | return 1; // auto search succeeded | ||
99 | } else { | ||
100 | deb_srch("auto search not successful\n"); | ||
101 | return 0; // auto search failed | ||
102 | } | ||
103 | } else if (irq & 0x01) { | ||
104 | deb_srch("auto search failed\n"); | ||
105 | return 0; // auto search failed | ||
106 | } | ||
107 | return -1; // try again | ||
108 | } | ||
109 | |||
110 | /* for auto search */ | ||
111 | static u16 dib3000_seq[2][2][2] = /* fft,gua, inv */ | ||
112 | { /* fft */ | ||
113 | { /* gua */ | ||
114 | { 0, 1 }, /* 0 0 { 0,1 } */ | ||
115 | { 3, 9 }, /* 0 1 { 0,1 } */ | ||
116 | }, | ||
117 | { | ||
118 | { 2, 5 }, /* 1 0 { 0,1 } */ | ||
119 | { 6, 11 }, /* 1 1 { 0,1 } */ | ||
120 | } | ||
121 | }; | ||
122 | |||
51 | static int dib3000mb_get_frontend(struct dvb_frontend* fe, | 123 | static int dib3000mb_get_frontend(struct dvb_frontend* fe, |
52 | struct dvb_frontend_parameters *fep); | 124 | struct dvb_frontend_parameters *fep); |
53 | 125 | ||