Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 1 | /* |
| 2 | Mantis PCI bridge driver |
Manu Abraham | 8825a09 | 2009-12-15 09:13:49 -0300 | [diff] [blame] | 3 | Copyright (C) Manu Abraham (abraham.manu@gmail.com) |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 4 | |
| 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 2 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 | */ |
| 19 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 20 | #include <linux/kernel.h> |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 21 | #include <linux/bitops.h> |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 22 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 23 | #include <linux/signal.h> |
| 24 | #include <linux/sched.h> |
| 25 | #include <linux/interrupt.h> |
| 26 | #include <linux/pci.h> |
| 27 | #include <linux/i2c.h> |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 28 | |
| 29 | #include "dmxdev.h" |
| 30 | #include "dvbdev.h" |
| 31 | #include "dvb_demux.h" |
| 32 | #include "dvb_frontend.h" |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 33 | #include "dvb_net.h" |
| 34 | |
| 35 | #include "mantis_common.h" |
| 36 | #include "mantis_dma.h" |
| 37 | #include "mantis_ca.h" |
| 38 | #include "mantis_ioc.h" |
| 39 | #include "mantis_dvb.h" |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 40 | |
Manu Abraham | 616f75e | 2009-12-04 05:33:56 -0300 | [diff] [blame] | 41 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 42 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 43 | int mantis_frontend_power(struct mantis_pci *mantis, enum mantis_power power) |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 44 | { |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 45 | struct mantis_hwconfig *config = mantis->hwconfig; |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 46 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 47 | switch (power) { |
| 48 | case POWER_ON: |
| 49 | dprintk(MANTIS_DEBUG, 1, "Power ON"); |
Ben Hutchings | 3037fd1 | 2010-11-14 14:56:00 -0300 | [diff] [blame] | 50 | mantis_gpio_set_bits(mantis, config->power, POWER_ON); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 51 | msleep(100); |
Ben Hutchings | 3037fd1 | 2010-11-14 14:56:00 -0300 | [diff] [blame] | 52 | mantis_gpio_set_bits(mantis, config->power, POWER_ON); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 53 | msleep(100); |
| 54 | break; |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 55 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 56 | case POWER_OFF: |
| 57 | dprintk(MANTIS_DEBUG, 1, "Power OFF"); |
Ben Hutchings | 3037fd1 | 2010-11-14 14:56:00 -0300 | [diff] [blame] | 58 | mantis_gpio_set_bits(mantis, config->power, POWER_OFF); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 59 | msleep(100); |
| 60 | break; |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 61 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 62 | default: |
| 63 | dprintk(MANTIS_DEBUG, 1, "Unknown state <%02x>", power); |
| 64 | return -1; |
| 65 | } |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 66 | |
| 67 | return 0; |
| 68 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 69 | EXPORT_SYMBOL_GPL(mantis_frontend_power); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 70 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 71 | void mantis_frontend_soft_reset(struct mantis_pci *mantis) |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 72 | { |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 73 | struct mantis_hwconfig *config = mantis->hwconfig; |
| 74 | |
| 75 | dprintk(MANTIS_DEBUG, 1, "Frontend RESET"); |
Ben Hutchings | 3037fd1 | 2010-11-14 14:56:00 -0300 | [diff] [blame] | 76 | mantis_gpio_set_bits(mantis, config->reset, 0); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 77 | msleep(100); |
Ben Hutchings | 3037fd1 | 2010-11-14 14:56:00 -0300 | [diff] [blame] | 78 | mantis_gpio_set_bits(mantis, config->reset, 0); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 79 | msleep(100); |
Ben Hutchings | 3037fd1 | 2010-11-14 14:56:00 -0300 | [diff] [blame] | 80 | mantis_gpio_set_bits(mantis, config->reset, 1); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 81 | msleep(100); |
Ben Hutchings | 3037fd1 | 2010-11-14 14:56:00 -0300 | [diff] [blame] | 82 | mantis_gpio_set_bits(mantis, config->reset, 1); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 83 | msleep(100); |
| 84 | |
| 85 | return; |
| 86 | } |
| 87 | EXPORT_SYMBOL_GPL(mantis_frontend_soft_reset); |
| 88 | |
| 89 | static int mantis_frontend_shutdown(struct mantis_pci *mantis) |
| 90 | { |
| 91 | int err; |
| 92 | |
| 93 | mantis_frontend_soft_reset(mantis); |
| 94 | err = mantis_frontend_power(mantis, POWER_OFF); |
| 95 | if (err != 0) { |
| 96 | dprintk(MANTIS_ERROR, 1, "Frontend POWER OFF failed! <%d>", err); |
| 97 | return 1; |
| 98 | } |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 99 | |
| 100 | return 0; |
| 101 | } |
| 102 | |
| 103 | static int mantis_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) |
| 104 | { |
| 105 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
| 106 | struct mantis_pci *mantis = dvbdmx->priv; |
| 107 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 108 | dprintk(MANTIS_DEBUG, 1, "Mantis DVB Start feed"); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 109 | if (!dvbdmx->dmx.frontend) { |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 110 | dprintk(MANTIS_DEBUG, 1, "no frontend ?"); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 111 | return -EINVAL; |
| 112 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 113 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 114 | mantis->feeds++; |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 115 | dprintk(MANTIS_DEBUG, 1, "mantis start feed, feeds=%d", mantis->feeds); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 116 | |
| 117 | if (mantis->feeds == 1) { |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 118 | dprintk(MANTIS_DEBUG, 1, "mantis start feed & dma"); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 119 | mantis_dma_start(mantis); |
Marko Ristola | 9c81496 | 2010-11-14 14:09:04 -0300 | [diff] [blame] | 120 | tasklet_enable(&mantis->tasklet); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | return mantis->feeds; |
| 124 | } |
| 125 | |
| 126 | static int mantis_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) |
| 127 | { |
| 128 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
| 129 | struct mantis_pci *mantis = dvbdmx->priv; |
| 130 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 131 | dprintk(MANTIS_DEBUG, 1, "Mantis DVB Stop feed"); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 132 | if (!dvbdmx->dmx.frontend) { |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 133 | dprintk(MANTIS_DEBUG, 1, "no frontend ?"); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 134 | return -EINVAL; |
| 135 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 136 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 137 | mantis->feeds--; |
| 138 | if (mantis->feeds == 0) { |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 139 | dprintk(MANTIS_DEBUG, 1, "mantis stop feed and dma"); |
Marko Ristola | 9c81496 | 2010-11-14 14:09:04 -0300 | [diff] [blame] | 140 | tasklet_disable(&mantis->tasklet); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 141 | mantis_dma_stop(mantis); |
| 142 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 143 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 144 | return 0; |
| 145 | } |
| 146 | |
| 147 | int __devinit mantis_dvb_init(struct mantis_pci *mantis) |
| 148 | { |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 149 | struct mantis_hwconfig *config = mantis->hwconfig; |
| 150 | int result = -1; |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 151 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 152 | dprintk(MANTIS_DEBUG, 1, "dvb_register_adapter"); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 153 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 154 | result = dvb_register_adapter(&mantis->dvb_adapter, |
| 155 | "Mantis DVB adapter", |
| 156 | THIS_MODULE, |
| 157 | &mantis->pdev->dev, |
| 158 | adapter_nr); |
| 159 | |
| 160 | if (result < 0) { |
| 161 | |
| 162 | dprintk(MANTIS_ERROR, 1, "Error registering adapter"); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 163 | return -ENODEV; |
| 164 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 165 | |
| 166 | mantis->dvb_adapter.priv = mantis; |
| 167 | mantis->demux.dmx.capabilities = DMX_TS_FILTERING | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 168 | DMX_SECTION_FILTERING | |
| 169 | DMX_MEMORY_BASED_FILTERING; |
| 170 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 171 | mantis->demux.priv = mantis; |
| 172 | mantis->demux.filternum = 256; |
| 173 | mantis->demux.feednum = 256; |
| 174 | mantis->demux.start_feed = mantis_dvb_start_feed; |
| 175 | mantis->demux.stop_feed = mantis_dvb_stop_feed; |
| 176 | mantis->demux.write_to_decoder = NULL; |
| 177 | |
| 178 | dprintk(MANTIS_DEBUG, 1, "dvb_dmx_init"); |
| 179 | result = dvb_dmx_init(&mantis->demux); |
| 180 | if (result < 0) { |
| 181 | dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 182 | |
| 183 | goto err0; |
| 184 | } |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 185 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 186 | mantis->dmxdev.filternum = 256; |
| 187 | mantis->dmxdev.demux = &mantis->demux.dmx; |
| 188 | mantis->dmxdev.capabilities = 0; |
| 189 | dprintk(MANTIS_DEBUG, 1, "dvb_dmxdev_init"); |
| 190 | |
| 191 | result = dvb_dmxdev_init(&mantis->dmxdev, &mantis->dvb_adapter); |
| 192 | if (result < 0) { |
| 193 | |
| 194 | dprintk(MANTIS_ERROR, 1, "dvb_dmxdev_init failed, ERROR=%d", result); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 195 | goto err1; |
| 196 | } |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 197 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 198 | mantis->fe_hw.source = DMX_FRONTEND_0; |
| 199 | result = mantis->demux.dmx.add_frontend(&mantis->demux.dmx, &mantis->fe_hw); |
| 200 | if (result < 0) { |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 201 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 202 | dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 203 | goto err2; |
| 204 | } |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 205 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 206 | mantis->fe_mem.source = DMX_MEMORY_FE; |
Manu Abraham | f5ae4f6 | 2009-12-15 08:47:21 -0300 | [diff] [blame] | 207 | result = mantis->demux.dmx.add_frontend(&mantis->demux.dmx, &mantis->fe_mem); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 208 | if (result < 0) { |
Manu Abraham | f5ae4f6 | 2009-12-15 08:47:21 -0300 | [diff] [blame] | 209 | dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 210 | goto err3; |
| 211 | } |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 212 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 213 | result = mantis->demux.dmx.connect_frontend(&mantis->demux.dmx, &mantis->fe_hw); |
| 214 | if (result < 0) { |
| 215 | dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 216 | goto err4; |
| 217 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 218 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 219 | dvb_net_init(&mantis->dvb_adapter, &mantis->dvbnet, &mantis->demux.dmx); |
| 220 | tasklet_init(&mantis->tasklet, mantis_dma_xfer, (unsigned long) mantis); |
Marko Ristola | 9c81496 | 2010-11-14 14:09:04 -0300 | [diff] [blame] | 221 | tasklet_disable(&mantis->tasklet); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 222 | if (mantis->hwconfig) { |
| 223 | result = config->frontend_init(mantis, mantis->fe); |
| 224 | if (result < 0) { |
| 225 | dprintk(MANTIS_ERROR, 1, "!!! NO Frontends found !!!"); |
| 226 | goto err5; |
| 227 | } else { |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 228 | if (mantis->fe == NULL) { |
| 229 | dprintk(MANTIS_ERROR, 1, "FE <NULL>"); |
| 230 | goto err5; |
| 231 | } |
| 232 | |
| 233 | if (dvb_register_frontend(&mantis->dvb_adapter, mantis->fe)) { |
| 234 | dprintk(MANTIS_ERROR, 1, "ERROR: Frontend registration failed"); |
| 235 | |
| 236 | if (mantis->fe->ops.release) |
| 237 | mantis->fe->ops.release(mantis->fe); |
| 238 | |
| 239 | mantis->fe = NULL; |
| 240 | goto err5; |
| 241 | } |
| 242 | } |
| 243 | } |
Manu Abraham | d9dd5f7 | 2009-12-04 05:07:41 -0300 | [diff] [blame] | 244 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 245 | return 0; |
| 246 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 247 | /* Error conditions .. */ |
| 248 | err5: |
| 249 | tasklet_kill(&mantis->tasklet); |
| 250 | dvb_net_release(&mantis->dvbnet); |
Manu Abraham | 68fe255 | 2009-12-04 09:01:35 -0300 | [diff] [blame] | 251 | dvb_unregister_frontend(mantis->fe); |
| 252 | dvb_frontend_detach(mantis->fe); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 253 | err4: |
| 254 | mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_mem); |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 255 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 256 | err3: |
| 257 | mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_hw); |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 258 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 259 | err2: |
| 260 | dvb_dmxdev_release(&mantis->dmxdev); |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 261 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 262 | err1: |
| 263 | dvb_dmx_release(&mantis->demux); |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 264 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 265 | err0: |
| 266 | dvb_unregister_adapter(&mantis->dvb_adapter); |
| 267 | |
| 268 | return result; |
| 269 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 270 | EXPORT_SYMBOL_GPL(mantis_dvb_init); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 271 | |
| 272 | int __devexit mantis_dvb_exit(struct mantis_pci *mantis) |
| 273 | { |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 274 | int err; |
| 275 | |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 276 | if (mantis->fe) { |
Manu Abraham | f5ae4f6 | 2009-12-15 08:47:21 -0300 | [diff] [blame] | 277 | /* mantis_ca_exit(mantis); */ |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 278 | err = mantis_frontend_shutdown(mantis); |
| 279 | if (err != 0) |
| 280 | dprintk(MANTIS_ERROR, 1, "Frontend exit while POWER ON! <%d>", err); |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 281 | dvb_unregister_frontend(mantis->fe); |
Manu Abraham | c5e598a | 2009-12-09 19:59:26 -0300 | [diff] [blame] | 282 | dvb_frontend_detach(mantis->fe); |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 283 | } |
| 284 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 285 | tasklet_kill(&mantis->tasklet); |
| 286 | dvb_net_release(&mantis->dvbnet); |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 287 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 288 | mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_mem); |
| 289 | mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_hw); |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 290 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 291 | dvb_dmxdev_release(&mantis->dmxdev); |
| 292 | dvb_dmx_release(&mantis->demux); |
| 293 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 294 | dprintk(MANTIS_DEBUG, 1, "dvb_unregister_adapter"); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 295 | dvb_unregister_adapter(&mantis->dvb_adapter); |
| 296 | |
| 297 | return 0; |
| 298 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 299 | EXPORT_SYMBOL_GPL(mantis_dvb_exit); |