mantis_vp3030.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. Mantis VP-3030 driver
  4. Copyright (C) Manu Abraham ([email protected])
  5. */
  6. #include <linux/signal.h>
  7. #include <linux/sched.h>
  8. #include <linux/interrupt.h>
  9. #include <media/dmxdev.h>
  10. #include <media/dvbdev.h>
  11. #include <media/dvb_demux.h>
  12. #include <media/dvb_frontend.h>
  13. #include <media/dvb_net.h>
  14. #include "zl10353.h"
  15. #include "tda665x.h"
  16. #include "mantis_common.h"
  17. #include "mantis_ioc.h"
  18. #include "mantis_dvb.h"
  19. #include "mantis_vp3030.h"
  20. static struct zl10353_config mantis_vp3030_config = {
  21. .demod_address = 0x0f,
  22. };
  23. static struct tda665x_config env57h12d5_config = {
  24. .name = "ENV57H12D5 (ET-50DT)",
  25. .addr = 0x60,
  26. .frequency_min = 47 * MHz,
  27. .frequency_max = 862 * MHz,
  28. .frequency_offst = 3616667,
  29. .ref_multiplier = 6, /* 1/6 MHz */
  30. .ref_divider = 100000, /* 1/6 MHz */
  31. };
  32. #define MANTIS_MODEL_NAME "VP-3030"
  33. #define MANTIS_DEV_TYPE "DVB-T"
  34. static int vp3030_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
  35. {
  36. struct i2c_adapter *adapter = &mantis->adapter;
  37. struct mantis_hwconfig *config = mantis->hwconfig;
  38. int err = 0;
  39. mantis_gpio_set_bits(mantis, config->reset, 0);
  40. msleep(100);
  41. err = mantis_frontend_power(mantis, POWER_ON);
  42. msleep(100);
  43. mantis_gpio_set_bits(mantis, config->reset, 1);
  44. if (err == 0) {
  45. msleep(250);
  46. dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
  47. fe = dvb_attach(zl10353_attach, &mantis_vp3030_config, adapter);
  48. if (!fe)
  49. return -1;
  50. dvb_attach(tda665x_attach, fe, &env57h12d5_config, adapter);
  51. } else {
  52. dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
  53. adapter->name,
  54. err);
  55. return -EIO;
  56. }
  57. mantis->fe = fe;
  58. dprintk(MANTIS_ERROR, 1, "Done!");
  59. return 0;
  60. }
  61. struct mantis_hwconfig vp3030_config = {
  62. .model_name = MANTIS_MODEL_NAME,
  63. .dev_type = MANTIS_DEV_TYPE,
  64. .ts_size = MANTIS_TS_188,
  65. .baud_rate = MANTIS_BAUD_9600,
  66. .parity = MANTIS_PARITY_NONE,
  67. .bytes = 0,
  68. .frontend_init = vp3030_frontend_init,
  69. .power = GPIF_A12,
  70. .reset = GPIF_A13,
  71. .i2c_mode = MANTIS_BYTE_MODE
  72. };