Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 1 | /* |
Manu Abraham | 8825a09 | 2009-12-15 09:13:49 -0300 | [diff] [blame] | 2 | Hopper VP-3028 driver |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 3 | |
Manu Abraham | 8825a09 | 2009-12-15 09:13:49 -0300 | [diff] [blame] | 4 | Copyright (C) Manu Abraham (abraham.manu@gmail.com) |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | */ |
| 20 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 21 | #include <linux/signal.h> |
| 22 | #include <linux/sched.h> |
| 23 | #include <linux/interrupt.h> |
| 24 | |
| 25 | #include "dmxdev.h" |
| 26 | #include "dvbdev.h" |
| 27 | #include "dvb_demux.h" |
| 28 | #include "dvb_frontend.h" |
| 29 | #include "dvb_net.h" |
| 30 | |
| 31 | #include "zl10353.h" |
| 32 | #include "mantis_common.h" |
| 33 | #include "mantis_ioc.h" |
| 34 | #include "mantis_dvb.h" |
| 35 | #include "hopper_vp3028.h" |
| 36 | |
| 37 | struct zl10353_config hopper_vp3028_config = { |
| 38 | .demod_address = 0x0f, |
| 39 | }; |
| 40 | |
| 41 | #define MANTIS_MODEL_NAME "VP-3028" |
| 42 | #define MANTIS_DEV_TYPE "DVB-T" |
| 43 | |
| 44 | static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) |
| 45 | { |
| 46 | struct i2c_adapter *adapter = &mantis->adapter; |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 47 | struct mantis_hwconfig *config = mantis->hwconfig; |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 48 | int err = 0; |
| 49 | |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 50 | gpio_set_bits(mantis, config->reset, 0); |
| 51 | msleep(100); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 52 | err = mantis_frontend_power(mantis, POWER_ON); |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 53 | msleep(100); |
| 54 | gpio_set_bits(mantis, config->reset, 1); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 55 | |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 56 | err = mantis_frontend_power(mantis, POWER_ON); |
| 57 | if (err == 0) { |
| 58 | msleep(250); |
| 59 | dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)"); |
Bjørn Mork | a22407f | 2010-11-14 14:24:36 -0300 | [diff] [blame^] | 60 | fe = dvb_attach(zl10353_attach, &hopper_vp3028_config, adapter); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 61 | |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 62 | if (!fe) |
| 63 | return -1; |
| 64 | } else { |
| 65 | dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", |
| 66 | adapter->name, |
| 67 | err); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 68 | |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 69 | return -EIO; |
| 70 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 71 | dprintk(MANTIS_ERROR, 1, "Done!"); |
| 72 | |
| 73 | return 0; |
| 74 | } |
| 75 | |
| 76 | struct mantis_hwconfig vp3028_config = { |
| 77 | .model_name = MANTIS_MODEL_NAME, |
| 78 | .dev_type = MANTIS_DEV_TYPE, |
| 79 | .ts_size = MANTIS_TS_188, |
| 80 | |
| 81 | .baud_rate = MANTIS_BAUD_9600, |
| 82 | .parity = MANTIS_PARITY_NONE, |
| 83 | .bytes = 0, |
| 84 | |
| 85 | .frontend_init = vp3028_frontend_init, |
| 86 | .power = GPIF_A00, |
| 87 | .reset = GPIF_A03, |
| 88 | }; |