Commit 9b78c5a3007e10a172d4e83bea18509fdff2e8e3
1 parent
88f8472c9f
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
[media] b2c2: export b2c2_flexcop_debug symbol
ERROR: "b2c2_flexcop_debug" [drivers/media/pci/b2c2/b2c2-flexcop-pci.ko] undefined! Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Showing 1 changed file with 1 additions and 0 deletions Inline Diff
drivers/media/common/b2c2/flexcop.c
1 | /* | 1 | /* |
2 | * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III | 2 | * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III |
3 | * flexcop.c - main module part | 3 | * flexcop.c - main module part |
4 | * Copyright (C) 2004-9 Patrick Boettcher <patrick.boettcher@desy.de> | 4 | * Copyright (C) 2004-9 Patrick Boettcher <patrick.boettcher@desy.de> |
5 | * based on skystar2-driver Copyright (C) 2003 Vadim Catana, skystar@moldova.cc | 5 | * based on skystar2-driver Copyright (C) 2003 Vadim Catana, skystar@moldova.cc |
6 | * | 6 | * |
7 | * Acknowledgements: | 7 | * Acknowledgements: |
8 | * John Jurrius from BBTI, Inc. for extensive support | 8 | * John Jurrius from BBTI, Inc. for extensive support |
9 | * with code examples and data books | 9 | * with code examples and data books |
10 | * Bjarne Steinsbo, bjarne at steinsbo.com (some ideas for rewriting) | 10 | * Bjarne Steinsbo, bjarne at steinsbo.com (some ideas for rewriting) |
11 | * | 11 | * |
12 | * Contributions to the skystar2-driver have been done by | 12 | * Contributions to the skystar2-driver have been done by |
13 | * Vincenzo Di Massa, hawk.it at tiscalinet.it (several DiSEqC fixes) | 13 | * Vincenzo Di Massa, hawk.it at tiscalinet.it (several DiSEqC fixes) |
14 | * Roberto Ragusa, r.ragusa at libero.it (polishing, restyling the code) | 14 | * Roberto Ragusa, r.ragusa at libero.it (polishing, restyling the code) |
15 | * Uwe Bugla, uwe.bugla at gmx.de (doing tests, restyling code, writing docu) | 15 | * Uwe Bugla, uwe.bugla at gmx.de (doing tests, restyling code, writing docu) |
16 | * Niklas Peinecke, peinecke at gdv.uni-hannover.de (hardware pid/mac | 16 | * Niklas Peinecke, peinecke at gdv.uni-hannover.de (hardware pid/mac |
17 | * filtering) | 17 | * filtering) |
18 | * | 18 | * |
19 | * This program is free software; you can redistribute it and/or | 19 | * This program is free software; you can redistribute it and/or |
20 | * modify it under the terms of the GNU Lesser General Public License | 20 | * modify it under the terms of the GNU Lesser General Public License |
21 | * as published by the Free Software Foundation; either version 2.1 | 21 | * as published by the Free Software Foundation; either version 2.1 |
22 | * of the License, or (at your option) any later version. | 22 | * of the License, or (at your option) any later version. |
23 | * | 23 | * |
24 | * This program is distributed in the hope that it will be useful, | 24 | * This program is distributed in the hope that it will be useful, |
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
27 | * GNU General Public License for more details. | 27 | * GNU General Public License for more details. |
28 | * | 28 | * |
29 | * You should have received a copy of the GNU Lesser General Public License | 29 | * You should have received a copy of the GNU Lesser General Public License |
30 | * along with this program; if not, write to the Free Software | 30 | * along with this program; if not, write to the Free Software |
31 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 31 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "flexcop.h" | 34 | #include "flexcop.h" |
35 | 35 | ||
36 | #define DRIVER_NAME "B2C2 FlexcopII/II(b)/III digital TV receiver chip" | 36 | #define DRIVER_NAME "B2C2 FlexcopII/II(b)/III digital TV receiver chip" |
37 | #define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@desy.de" | 37 | #define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@desy.de" |
38 | 38 | ||
39 | #ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG | 39 | #ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG |
40 | #define DEBSTATUS "" | 40 | #define DEBSTATUS "" |
41 | #else | 41 | #else |
42 | #define DEBSTATUS " (debugging is not enabled)" | 42 | #define DEBSTATUS " (debugging is not enabled)" |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | int b2c2_flexcop_debug; | 45 | int b2c2_flexcop_debug; |
46 | EXPORT_SYMBOL_GPL(b2c2_flexcop_debug); | ||
46 | module_param_named(debug, b2c2_flexcop_debug, int, 0644); | 47 | module_param_named(debug, b2c2_flexcop_debug, int, 0644); |
47 | MODULE_PARM_DESC(debug, | 48 | MODULE_PARM_DESC(debug, |
48 | "set debug level (1=info,2=tuner,4=i2c,8=ts," | 49 | "set debug level (1=info,2=tuner,4=i2c,8=ts," |
49 | "16=sram,32=reg (|-able))." | 50 | "16=sram,32=reg (|-able))." |
50 | DEBSTATUS); | 51 | DEBSTATUS); |
51 | #undef DEBSTATUS | 52 | #undef DEBSTATUS |
52 | 53 | ||
53 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 54 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
54 | 55 | ||
55 | /* global zero for ibi values */ | 56 | /* global zero for ibi values */ |
56 | flexcop_ibi_value ibi_zero; | 57 | flexcop_ibi_value ibi_zero; |
57 | 58 | ||
58 | static int flexcop_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) | 59 | static int flexcop_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) |
59 | { | 60 | { |
60 | struct flexcop_device *fc = dvbdmxfeed->demux->priv; | 61 | struct flexcop_device *fc = dvbdmxfeed->demux->priv; |
61 | return flexcop_pid_feed_control(fc, dvbdmxfeed, 1); | 62 | return flexcop_pid_feed_control(fc, dvbdmxfeed, 1); |
62 | } | 63 | } |
63 | 64 | ||
64 | static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | 65 | static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) |
65 | { | 66 | { |
66 | struct flexcop_device *fc = dvbdmxfeed->demux->priv; | 67 | struct flexcop_device *fc = dvbdmxfeed->demux->priv; |
67 | return flexcop_pid_feed_control(fc, dvbdmxfeed, 0); | 68 | return flexcop_pid_feed_control(fc, dvbdmxfeed, 0); |
68 | } | 69 | } |
69 | 70 | ||
70 | static int flexcop_dvb_init(struct flexcop_device *fc) | 71 | static int flexcop_dvb_init(struct flexcop_device *fc) |
71 | { | 72 | { |
72 | int ret = dvb_register_adapter(&fc->dvb_adapter, | 73 | int ret = dvb_register_adapter(&fc->dvb_adapter, |
73 | "FlexCop Digital TV device", fc->owner, | 74 | "FlexCop Digital TV device", fc->owner, |
74 | fc->dev, adapter_nr); | 75 | fc->dev, adapter_nr); |
75 | if (ret < 0) { | 76 | if (ret < 0) { |
76 | err("error registering DVB adapter"); | 77 | err("error registering DVB adapter"); |
77 | return ret; | 78 | return ret; |
78 | } | 79 | } |
79 | fc->dvb_adapter.priv = fc; | 80 | fc->dvb_adapter.priv = fc; |
80 | 81 | ||
81 | fc->demux.dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING | 82 | fc->demux.dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING |
82 | | DMX_MEMORY_BASED_FILTERING); | 83 | | DMX_MEMORY_BASED_FILTERING); |
83 | fc->demux.priv = fc; | 84 | fc->demux.priv = fc; |
84 | fc->demux.filternum = fc->demux.feednum = FC_MAX_FEED; | 85 | fc->demux.filternum = fc->demux.feednum = FC_MAX_FEED; |
85 | fc->demux.start_feed = flexcop_dvb_start_feed; | 86 | fc->demux.start_feed = flexcop_dvb_start_feed; |
86 | fc->demux.stop_feed = flexcop_dvb_stop_feed; | 87 | fc->demux.stop_feed = flexcop_dvb_stop_feed; |
87 | fc->demux.write_to_decoder = NULL; | 88 | fc->demux.write_to_decoder = NULL; |
88 | 89 | ||
89 | ret = dvb_dmx_init(&fc->demux); | 90 | ret = dvb_dmx_init(&fc->demux); |
90 | if (ret < 0) { | 91 | if (ret < 0) { |
91 | err("dvb_dmx failed: error %d", ret); | 92 | err("dvb_dmx failed: error %d", ret); |
92 | goto err_dmx; | 93 | goto err_dmx; |
93 | } | 94 | } |
94 | 95 | ||
95 | fc->hw_frontend.source = DMX_FRONTEND_0; | 96 | fc->hw_frontend.source = DMX_FRONTEND_0; |
96 | 97 | ||
97 | fc->dmxdev.filternum = fc->demux.feednum; | 98 | fc->dmxdev.filternum = fc->demux.feednum; |
98 | fc->dmxdev.demux = &fc->demux.dmx; | 99 | fc->dmxdev.demux = &fc->demux.dmx; |
99 | fc->dmxdev.capabilities = 0; | 100 | fc->dmxdev.capabilities = 0; |
100 | ret = dvb_dmxdev_init(&fc->dmxdev, &fc->dvb_adapter); | 101 | ret = dvb_dmxdev_init(&fc->dmxdev, &fc->dvb_adapter); |
101 | if (ret < 0) { | 102 | if (ret < 0) { |
102 | err("dvb_dmxdev_init failed: error %d", ret); | 103 | err("dvb_dmxdev_init failed: error %d", ret); |
103 | goto err_dmx_dev; | 104 | goto err_dmx_dev; |
104 | } | 105 | } |
105 | 106 | ||
106 | ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->hw_frontend); | 107 | ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->hw_frontend); |
107 | if (ret < 0) { | 108 | if (ret < 0) { |
108 | err("adding hw_frontend to dmx failed: error %d", ret); | 109 | err("adding hw_frontend to dmx failed: error %d", ret); |
109 | goto err_dmx_add_hw_frontend; | 110 | goto err_dmx_add_hw_frontend; |
110 | } | 111 | } |
111 | 112 | ||
112 | fc->mem_frontend.source = DMX_MEMORY_FE; | 113 | fc->mem_frontend.source = DMX_MEMORY_FE; |
113 | ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->mem_frontend); | 114 | ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->mem_frontend); |
114 | if (ret < 0) { | 115 | if (ret < 0) { |
115 | err("adding mem_frontend to dmx failed: error %d", ret); | 116 | err("adding mem_frontend to dmx failed: error %d", ret); |
116 | goto err_dmx_add_mem_frontend; | 117 | goto err_dmx_add_mem_frontend; |
117 | } | 118 | } |
118 | 119 | ||
119 | ret = fc->demux.dmx.connect_frontend(&fc->demux.dmx, &fc->hw_frontend); | 120 | ret = fc->demux.dmx.connect_frontend(&fc->demux.dmx, &fc->hw_frontend); |
120 | if (ret < 0) { | 121 | if (ret < 0) { |
121 | err("connect frontend failed: error %d", ret); | 122 | err("connect frontend failed: error %d", ret); |
122 | goto err_connect_frontend; | 123 | goto err_connect_frontend; |
123 | } | 124 | } |
124 | 125 | ||
125 | ret = dvb_net_init(&fc->dvb_adapter, &fc->dvbnet, &fc->demux.dmx); | 126 | ret = dvb_net_init(&fc->dvb_adapter, &fc->dvbnet, &fc->demux.dmx); |
126 | if (ret < 0) { | 127 | if (ret < 0) { |
127 | err("dvb_net_init failed: error %d", ret); | 128 | err("dvb_net_init failed: error %d", ret); |
128 | goto err_net; | 129 | goto err_net; |
129 | } | 130 | } |
130 | 131 | ||
131 | fc->init_state |= FC_STATE_DVB_INIT; | 132 | fc->init_state |= FC_STATE_DVB_INIT; |
132 | return 0; | 133 | return 0; |
133 | 134 | ||
134 | err_net: | 135 | err_net: |
135 | fc->demux.dmx.disconnect_frontend(&fc->demux.dmx); | 136 | fc->demux.dmx.disconnect_frontend(&fc->demux.dmx); |
136 | err_connect_frontend: | 137 | err_connect_frontend: |
137 | fc->demux.dmx.remove_frontend(&fc->demux.dmx, &fc->mem_frontend); | 138 | fc->demux.dmx.remove_frontend(&fc->demux.dmx, &fc->mem_frontend); |
138 | err_dmx_add_mem_frontend: | 139 | err_dmx_add_mem_frontend: |
139 | fc->demux.dmx.remove_frontend(&fc->demux.dmx, &fc->hw_frontend); | 140 | fc->demux.dmx.remove_frontend(&fc->demux.dmx, &fc->hw_frontend); |
140 | err_dmx_add_hw_frontend: | 141 | err_dmx_add_hw_frontend: |
141 | dvb_dmxdev_release(&fc->dmxdev); | 142 | dvb_dmxdev_release(&fc->dmxdev); |
142 | err_dmx_dev: | 143 | err_dmx_dev: |
143 | dvb_dmx_release(&fc->demux); | 144 | dvb_dmx_release(&fc->demux); |
144 | err_dmx: | 145 | err_dmx: |
145 | dvb_unregister_adapter(&fc->dvb_adapter); | 146 | dvb_unregister_adapter(&fc->dvb_adapter); |
146 | return ret; | 147 | return ret; |
147 | } | 148 | } |
148 | 149 | ||
149 | static void flexcop_dvb_exit(struct flexcop_device *fc) | 150 | static void flexcop_dvb_exit(struct flexcop_device *fc) |
150 | { | 151 | { |
151 | if (fc->init_state & FC_STATE_DVB_INIT) { | 152 | if (fc->init_state & FC_STATE_DVB_INIT) { |
152 | dvb_net_release(&fc->dvbnet); | 153 | dvb_net_release(&fc->dvbnet); |
153 | 154 | ||
154 | fc->demux.dmx.close(&fc->demux.dmx); | 155 | fc->demux.dmx.close(&fc->demux.dmx); |
155 | fc->demux.dmx.remove_frontend(&fc->demux.dmx, | 156 | fc->demux.dmx.remove_frontend(&fc->demux.dmx, |
156 | &fc->mem_frontend); | 157 | &fc->mem_frontend); |
157 | fc->demux.dmx.remove_frontend(&fc->demux.dmx, | 158 | fc->demux.dmx.remove_frontend(&fc->demux.dmx, |
158 | &fc->hw_frontend); | 159 | &fc->hw_frontend); |
159 | dvb_dmxdev_release(&fc->dmxdev); | 160 | dvb_dmxdev_release(&fc->dmxdev); |
160 | dvb_dmx_release(&fc->demux); | 161 | dvb_dmx_release(&fc->demux); |
161 | dvb_unregister_adapter(&fc->dvb_adapter); | 162 | dvb_unregister_adapter(&fc->dvb_adapter); |
162 | deb_info("deinitialized dvb stuff\n"); | 163 | deb_info("deinitialized dvb stuff\n"); |
163 | } | 164 | } |
164 | fc->init_state &= ~FC_STATE_DVB_INIT; | 165 | fc->init_state &= ~FC_STATE_DVB_INIT; |
165 | } | 166 | } |
166 | 167 | ||
167 | /* these methods are necessary to achieve the long-term-goal of hiding the | 168 | /* these methods are necessary to achieve the long-term-goal of hiding the |
168 | * struct flexcop_device from the bus-parts */ | 169 | * struct flexcop_device from the bus-parts */ |
169 | void flexcop_pass_dmx_data(struct flexcop_device *fc, u8 *buf, u32 len) | 170 | void flexcop_pass_dmx_data(struct flexcop_device *fc, u8 *buf, u32 len) |
170 | { | 171 | { |
171 | dvb_dmx_swfilter(&fc->demux, buf, len); | 172 | dvb_dmx_swfilter(&fc->demux, buf, len); |
172 | } | 173 | } |
173 | EXPORT_SYMBOL(flexcop_pass_dmx_data); | 174 | EXPORT_SYMBOL(flexcop_pass_dmx_data); |
174 | 175 | ||
175 | void flexcop_pass_dmx_packets(struct flexcop_device *fc, u8 *buf, u32 no) | 176 | void flexcop_pass_dmx_packets(struct flexcop_device *fc, u8 *buf, u32 no) |
176 | { | 177 | { |
177 | dvb_dmx_swfilter_packets(&fc->demux, buf, no); | 178 | dvb_dmx_swfilter_packets(&fc->demux, buf, no); |
178 | } | 179 | } |
179 | EXPORT_SYMBOL(flexcop_pass_dmx_packets); | 180 | EXPORT_SYMBOL(flexcop_pass_dmx_packets); |
180 | 181 | ||
181 | static void flexcop_reset(struct flexcop_device *fc) | 182 | static void flexcop_reset(struct flexcop_device *fc) |
182 | { | 183 | { |
183 | flexcop_ibi_value v210, v204; | 184 | flexcop_ibi_value v210, v204; |
184 | 185 | ||
185 | /* reset the flexcop itself */ | 186 | /* reset the flexcop itself */ |
186 | fc->write_ibi_reg(fc,ctrl_208,ibi_zero); | 187 | fc->write_ibi_reg(fc,ctrl_208,ibi_zero); |
187 | 188 | ||
188 | v210.raw = 0; | 189 | v210.raw = 0; |
189 | v210.sw_reset_210.reset_block_000 = 1; | 190 | v210.sw_reset_210.reset_block_000 = 1; |
190 | v210.sw_reset_210.reset_block_100 = 1; | 191 | v210.sw_reset_210.reset_block_100 = 1; |
191 | v210.sw_reset_210.reset_block_200 = 1; | 192 | v210.sw_reset_210.reset_block_200 = 1; |
192 | v210.sw_reset_210.reset_block_300 = 1; | 193 | v210.sw_reset_210.reset_block_300 = 1; |
193 | v210.sw_reset_210.reset_block_400 = 1; | 194 | v210.sw_reset_210.reset_block_400 = 1; |
194 | v210.sw_reset_210.reset_block_500 = 1; | 195 | v210.sw_reset_210.reset_block_500 = 1; |
195 | v210.sw_reset_210.reset_block_600 = 1; | 196 | v210.sw_reset_210.reset_block_600 = 1; |
196 | v210.sw_reset_210.reset_block_700 = 1; | 197 | v210.sw_reset_210.reset_block_700 = 1; |
197 | v210.sw_reset_210.Block_reset_enable = 0xb2; | 198 | v210.sw_reset_210.Block_reset_enable = 0xb2; |
198 | v210.sw_reset_210.Special_controls = 0xc259; | 199 | v210.sw_reset_210.Special_controls = 0xc259; |
199 | fc->write_ibi_reg(fc,sw_reset_210,v210); | 200 | fc->write_ibi_reg(fc,sw_reset_210,v210); |
200 | msleep(1); | 201 | msleep(1); |
201 | 202 | ||
202 | /* reset the periphical devices */ | 203 | /* reset the periphical devices */ |
203 | 204 | ||
204 | v204 = fc->read_ibi_reg(fc,misc_204); | 205 | v204 = fc->read_ibi_reg(fc,misc_204); |
205 | v204.misc_204.Per_reset_sig = 0; | 206 | v204.misc_204.Per_reset_sig = 0; |
206 | fc->write_ibi_reg(fc,misc_204,v204); | 207 | fc->write_ibi_reg(fc,misc_204,v204); |
207 | msleep(1); | 208 | msleep(1); |
208 | v204.misc_204.Per_reset_sig = 1; | 209 | v204.misc_204.Per_reset_sig = 1; |
209 | fc->write_ibi_reg(fc,misc_204,v204); | 210 | fc->write_ibi_reg(fc,misc_204,v204); |
210 | } | 211 | } |
211 | 212 | ||
212 | void flexcop_reset_block_300(struct flexcop_device *fc) | 213 | void flexcop_reset_block_300(struct flexcop_device *fc) |
213 | { | 214 | { |
214 | flexcop_ibi_value v208_save = fc->read_ibi_reg(fc, ctrl_208), | 215 | flexcop_ibi_value v208_save = fc->read_ibi_reg(fc, ctrl_208), |
215 | v210 = fc->read_ibi_reg(fc, sw_reset_210); | 216 | v210 = fc->read_ibi_reg(fc, sw_reset_210); |
216 | 217 | ||
217 | deb_rdump("208: %08x, 210: %08x\n", v208_save.raw, v210.raw); | 218 | deb_rdump("208: %08x, 210: %08x\n", v208_save.raw, v210.raw); |
218 | fc->write_ibi_reg(fc,ctrl_208,ibi_zero); | 219 | fc->write_ibi_reg(fc,ctrl_208,ibi_zero); |
219 | 220 | ||
220 | v210.sw_reset_210.reset_block_300 = 1; | 221 | v210.sw_reset_210.reset_block_300 = 1; |
221 | v210.sw_reset_210.Block_reset_enable = 0xb2; | 222 | v210.sw_reset_210.Block_reset_enable = 0xb2; |
222 | 223 | ||
223 | fc->write_ibi_reg(fc,sw_reset_210,v210); | 224 | fc->write_ibi_reg(fc,sw_reset_210,v210); |
224 | fc->write_ibi_reg(fc,ctrl_208,v208_save); | 225 | fc->write_ibi_reg(fc,ctrl_208,v208_save); |
225 | } | 226 | } |
226 | 227 | ||
227 | struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) | 228 | struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) |
228 | { | 229 | { |
229 | void *bus; | 230 | void *bus; |
230 | struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), | 231 | struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), |
231 | GFP_KERNEL); | 232 | GFP_KERNEL); |
232 | if (!fc) { | 233 | if (!fc) { |
233 | err("no memory"); | 234 | err("no memory"); |
234 | return NULL; | 235 | return NULL; |
235 | } | 236 | } |
236 | 237 | ||
237 | bus = kzalloc(bus_specific_len, GFP_KERNEL); | 238 | bus = kzalloc(bus_specific_len, GFP_KERNEL); |
238 | if (!bus) { | 239 | if (!bus) { |
239 | err("no memory"); | 240 | err("no memory"); |
240 | kfree(fc); | 241 | kfree(fc); |
241 | return NULL; | 242 | return NULL; |
242 | } | 243 | } |
243 | 244 | ||
244 | fc->bus_specific = bus; | 245 | fc->bus_specific = bus; |
245 | 246 | ||
246 | return fc; | 247 | return fc; |
247 | } | 248 | } |
248 | EXPORT_SYMBOL(flexcop_device_kmalloc); | 249 | EXPORT_SYMBOL(flexcop_device_kmalloc); |
249 | 250 | ||
250 | void flexcop_device_kfree(struct flexcop_device *fc) | 251 | void flexcop_device_kfree(struct flexcop_device *fc) |
251 | { | 252 | { |
252 | kfree(fc->bus_specific); | 253 | kfree(fc->bus_specific); |
253 | kfree(fc); | 254 | kfree(fc); |
254 | } | 255 | } |
255 | EXPORT_SYMBOL(flexcop_device_kfree); | 256 | EXPORT_SYMBOL(flexcop_device_kfree); |
256 | 257 | ||
257 | int flexcop_device_initialize(struct flexcop_device *fc) | 258 | int flexcop_device_initialize(struct flexcop_device *fc) |
258 | { | 259 | { |
259 | int ret; | 260 | int ret; |
260 | ibi_zero.raw = 0; | 261 | ibi_zero.raw = 0; |
261 | 262 | ||
262 | flexcop_reset(fc); | 263 | flexcop_reset(fc); |
263 | flexcop_determine_revision(fc); | 264 | flexcop_determine_revision(fc); |
264 | flexcop_sram_init(fc); | 265 | flexcop_sram_init(fc); |
265 | flexcop_hw_filter_init(fc); | 266 | flexcop_hw_filter_init(fc); |
266 | flexcop_smc_ctrl(fc, 0); | 267 | flexcop_smc_ctrl(fc, 0); |
267 | 268 | ||
268 | ret = flexcop_dvb_init(fc); | 269 | ret = flexcop_dvb_init(fc); |
269 | if (ret) | 270 | if (ret) |
270 | goto error; | 271 | goto error; |
271 | 272 | ||
272 | /* i2c has to be done before doing EEProm stuff - | 273 | /* i2c has to be done before doing EEProm stuff - |
273 | * because the EEProm is accessed via i2c */ | 274 | * because the EEProm is accessed via i2c */ |
274 | ret = flexcop_i2c_init(fc); | 275 | ret = flexcop_i2c_init(fc); |
275 | if (ret) | 276 | if (ret) |
276 | goto error; | 277 | goto error; |
277 | 278 | ||
278 | /* do the MAC address reading after initializing the dvb_adapter */ | 279 | /* do the MAC address reading after initializing the dvb_adapter */ |
279 | if (fc->get_mac_addr(fc, 0) == 0) { | 280 | if (fc->get_mac_addr(fc, 0) == 0) { |
280 | u8 *b = fc->dvb_adapter.proposed_mac; | 281 | u8 *b = fc->dvb_adapter.proposed_mac; |
281 | info("MAC address = %pM", b); | 282 | info("MAC address = %pM", b); |
282 | flexcop_set_mac_filter(fc,b); | 283 | flexcop_set_mac_filter(fc,b); |
283 | flexcop_mac_filter_ctrl(fc,1); | 284 | flexcop_mac_filter_ctrl(fc,1); |
284 | } else | 285 | } else |
285 | warn("reading of MAC address failed.\n"); | 286 | warn("reading of MAC address failed.\n"); |
286 | 287 | ||
287 | ret = flexcop_frontend_init(fc); | 288 | ret = flexcop_frontend_init(fc); |
288 | if (ret) | 289 | if (ret) |
289 | goto error; | 290 | goto error; |
290 | 291 | ||
291 | flexcop_device_name(fc,"initialization of","complete"); | 292 | flexcop_device_name(fc,"initialization of","complete"); |
292 | return 0; | 293 | return 0; |
293 | 294 | ||
294 | error: | 295 | error: |
295 | flexcop_device_exit(fc); | 296 | flexcop_device_exit(fc); |
296 | return ret; | 297 | return ret; |
297 | } | 298 | } |
298 | EXPORT_SYMBOL(flexcop_device_initialize); | 299 | EXPORT_SYMBOL(flexcop_device_initialize); |
299 | 300 | ||
300 | void flexcop_device_exit(struct flexcop_device *fc) | 301 | void flexcop_device_exit(struct flexcop_device *fc) |
301 | { | 302 | { |
302 | flexcop_frontend_exit(fc); | 303 | flexcop_frontend_exit(fc); |
303 | flexcop_i2c_exit(fc); | 304 | flexcop_i2c_exit(fc); |
304 | flexcop_dvb_exit(fc); | 305 | flexcop_dvb_exit(fc); |
305 | } | 306 | } |
306 | EXPORT_SYMBOL(flexcop_device_exit); | 307 | EXPORT_SYMBOL(flexcop_device_exit); |
307 | 308 | ||
308 | static int flexcop_module_init(void) | 309 | static int flexcop_module_init(void) |
309 | { | 310 | { |
310 | info(DRIVER_NAME " loaded successfully"); | 311 | info(DRIVER_NAME " loaded successfully"); |
311 | return 0; | 312 | return 0; |
312 | } | 313 | } |
313 | 314 | ||
314 | static void flexcop_module_cleanup(void) | 315 | static void flexcop_module_cleanup(void) |
315 | { | 316 | { |
316 | info(DRIVER_NAME " unloaded successfully"); | 317 | info(DRIVER_NAME " unloaded successfully"); |
317 | } | 318 | } |
318 | 319 | ||
319 | module_init(flexcop_module_init); | 320 | module_init(flexcop_module_init); |
320 | module_exit(flexcop_module_cleanup); | 321 | module_exit(flexcop_module_cleanup); |
321 | 322 | ||
322 | MODULE_AUTHOR(DRIVER_AUTHOR); | 323 | MODULE_AUTHOR(DRIVER_AUTHOR); |
323 | MODULE_DESCRIPTION(DRIVER_NAME); | 324 | MODULE_DESCRIPTION(DRIVER_NAME); |
324 | MODULE_LICENSE("GPL"); | 325 | MODULE_LICENSE("GPL"); |
325 | 326 |