mantis_vp3030.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. Mantis VP-3030 driver
  3. Copyright (C) Manu Abraham (abraham.manu@gmail.com)
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #include <linux/signal.h>
  17. #include <linux/sched.h>
  18. #include <linux/interrupt.h>
  19. #include "dmxdev.h"
  20. #include "dvbdev.h"
  21. #include "dvb_demux.h"
  22. #include "dvb_frontend.h"
  23. #include "dvb_net.h"
  24. #include "zl10353.h"
  25. #include "tda665x.h"
  26. #include "mantis_common.h"
  27. #include "mantis_ioc.h"
  28. #include "mantis_dvb.h"
  29. #include "mantis_vp3030.h"
  30. static struct zl10353_config mantis_vp3030_config = {
  31. .demod_address = 0x0f,
  32. };
  33. static struct tda665x_config env57h12d5_config = {
  34. .name = "ENV57H12D5 (ET-50DT)",
  35. .addr = 0x60,
  36. .frequency_min = 47000000,
  37. .frequency_max = 862000000,
  38. .frequency_offst = 3616667,
  39. .ref_multiplier = 6, /* 1/6 MHz */
  40. .ref_divider = 100000, /* 1/6 MHz */
  41. };
  42. #define MANTIS_MODEL_NAME "VP-3030"
  43. #define MANTIS_DEV_TYPE "DVB-T"
  44. static int vp3030_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
  45. {
  46. struct i2c_adapter *adapter = &mantis->adapter;
  47. struct mantis_hwconfig *config = mantis->hwconfig;
  48. int err = 0;
  49. mantis_gpio_set_bits(mantis, config->reset, 0);
  50. msleep(100);
  51. err = mantis_frontend_power(mantis, POWER_ON);
  52. msleep(100);
  53. mantis_gpio_set_bits(mantis, config->reset, 1);
  54. if (err == 0) {
  55. msleep(250);
  56. dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
  57. fe = dvb_attach(zl10353_attach, &mantis_vp3030_config, adapter);
  58. if (!fe)
  59. return -1;
  60. dvb_attach(tda665x_attach, fe, &env57h12d5_config, adapter);
  61. } else {
  62. dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
  63. adapter->name,
  64. err);
  65. return -EIO;
  66. }
  67. mantis->fe = fe;
  68. dprintk(MANTIS_ERROR, 1, "Done!");
  69. return 0;
  70. }
  71. struct mantis_hwconfig vp3030_config = {
  72. .model_name = MANTIS_MODEL_NAME,
  73. .dev_type = MANTIS_DEV_TYPE,
  74. .ts_size = MANTIS_TS_188,
  75. .baud_rate = MANTIS_BAUD_9600,
  76. .parity = MANTIS_PARITY_NONE,
  77. .bytes = 0,
  78. .frontend_init = vp3030_frontend_init,
  79. .power = GPIF_A12,
  80. .reset = GPIF_A13,
  81. .i2c_mode = MANTIS_BYTE_MODE
  82. };