Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 1 | /* |
| 2 | Mantis VP-3030 driver |
| 3 | |
Manu Abraham | 8825a09 | 2009-12-15 09:13:49 -0300 | [diff] [blame] | 4 | Copyright (C) Manu Abraham (abraham.manu@gmail.com) |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -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" |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 32 | #include "tda665x.h" |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 33 | #include "mantis_common.h" |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 34 | #include "mantis_ioc.h" |
| 35 | #include "mantis_dvb.h" |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 36 | #include "mantis_vp3030.h" |
| 37 | |
| 38 | struct zl10353_config mantis_vp3030_config = { |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 39 | .demod_address = 0x0f, |
| 40 | }; |
| 41 | |
| 42 | struct tda665x_config env57h12d5_config = { |
| 43 | .name = "ENV57H12D5 (ET-50DT)", |
| 44 | .addr = 0x60, |
| 45 | .frequency_min = 47000000, |
| 46 | .frequency_max = 862000000, |
| 47 | .frequency_offst = 3616667, |
| 48 | .ref_multiplier = 6, /* 1/6 MHz */ |
| 49 | .ref_divider = 100000, /* 1/6 MHz */ |
Manu Abraham | df0cca1 | 2009-12-02 22:07:24 -0300 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | #define MANTIS_MODEL_NAME "VP-3030" |
| 53 | #define MANTIS_DEV_TYPE "DVB-T" |
| 54 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 55 | |
| 56 | static int vp3030_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) |
| 57 | { |
| 58 | struct i2c_adapter *adapter = &mantis->adapter; |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 59 | struct mantis_hwconfig *config = mantis->hwconfig; |
| 60 | int err = 0; |
| 61 | |
Ben Hutchings | 3037fd1 | 2010-11-14 14:56:00 -0300 | [diff] [blame] | 62 | mantis_gpio_set_bits(mantis, config->reset, 0); |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 63 | msleep(100); |
| 64 | err = mantis_frontend_power(mantis, POWER_ON); |
| 65 | msleep(100); |
Ben Hutchings | 3037fd1 | 2010-11-14 14:56:00 -0300 | [diff] [blame] | 66 | mantis_gpio_set_bits(mantis, config->reset, 1); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 67 | |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 68 | if (err == 0) { |
| 69 | msleep(250); |
| 70 | dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)"); |
Bjørn Mork | a22407f | 2010-11-14 14:24:36 -0300 | [diff] [blame] | 71 | fe = dvb_attach(zl10353_attach, &mantis_vp3030_config, adapter); |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 72 | |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 73 | if (!fe) |
| 74 | return -1; |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 75 | |
Bjørn Mork | a22407f | 2010-11-14 14:24:36 -0300 | [diff] [blame] | 76 | dvb_attach(tda665x_attach, fe, &env57h12d5_config, adapter); |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 77 | } else { |
| 78 | dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", |
| 79 | adapter->name, |
| 80 | err); |
| 81 | |
| 82 | return -EIO; |
| 83 | |
| 84 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 85 | mantis->fe = fe; |
| 86 | dprintk(MANTIS_ERROR, 1, "Done!"); |
| 87 | |
| 88 | return 0; |
| 89 | } |
| 90 | |
| 91 | struct mantis_hwconfig vp3030_config = { |
| 92 | .model_name = MANTIS_MODEL_NAME, |
| 93 | .dev_type = MANTIS_DEV_TYPE, |
| 94 | .ts_size = MANTIS_TS_188, |
| 95 | |
| 96 | .baud_rate = MANTIS_BAUD_9600, |
| 97 | .parity = MANTIS_PARITY_NONE, |
| 98 | .bytes = 0, |
| 99 | |
| 100 | .frontend_init = vp3030_frontend_init, |
Manu Abraham | 3e978a8 | 2009-12-04 05:56:35 -0300 | [diff] [blame] | 101 | .power = GPIF_A12, |
| 102 | .reset = GPIF_A13, |
Manu Abraham | bc832fa | 2009-12-04 05:57:28 -0300 | [diff] [blame] | 103 | |
| 104 | .i2c_mode = MANTIS_BYTE_MODE |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame] | 105 | }; |