hopper_vp3028.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. Hopper VP-3028 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 "mantis_common.h"
  16. #include "mantis_ioc.h"
  17. #include "mantis_dvb.h"
  18. #include "hopper_vp3028.h"
  19. static struct zl10353_config hopper_vp3028_config = {
  20. .demod_address = 0x0f,
  21. };
  22. #define MANTIS_MODEL_NAME "VP-3028"
  23. #define MANTIS_DEV_TYPE "DVB-T"
  24. static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
  25. {
  26. struct i2c_adapter *adapter = &mantis->adapter;
  27. struct mantis_hwconfig *config = mantis->hwconfig;
  28. int err;
  29. mantis_gpio_set_bits(mantis, config->reset, 0);
  30. msleep(100);
  31. err = mantis_frontend_power(mantis, POWER_ON);
  32. msleep(100);
  33. mantis_gpio_set_bits(mantis, config->reset, 1);
  34. err = mantis_frontend_power(mantis, POWER_ON);
  35. if (err == 0) {
  36. msleep(250);
  37. dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
  38. fe = dvb_attach(zl10353_attach, &hopper_vp3028_config, adapter);
  39. if (!fe)
  40. return -1;
  41. } else {
  42. dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
  43. adapter->name,
  44. err);
  45. return -EIO;
  46. }
  47. dprintk(MANTIS_ERROR, 1, "Done!");
  48. return 0;
  49. }
  50. struct mantis_hwconfig vp3028_config = {
  51. .model_name = MANTIS_MODEL_NAME,
  52. .dev_type = MANTIS_DEV_TYPE,
  53. .ts_size = MANTIS_TS_188,
  54. .baud_rate = MANTIS_BAUD_9600,
  55. .parity = MANTIS_PARITY_NONE,
  56. .bytes = 0,
  57. .frontend_init = vp3028_frontend_init,
  58. .power = GPIF_A00,
  59. .reset = GPIF_A03,
  60. };