mantis_vp2033.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. Mantis VP-2033 driver
  3. Copyright (C) 2005, 2006 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 "mantis_common.h"
  17. #include "mantis_vp2033.h"
  18. #define MANTIS_MODEL_NAME "VP-2033"
  19. #define MANTIS_DEV_TYPE "DVB-C"
  20. struct mantis_hwconfig vp2033_mantis_config = {
  21. .model_name = MANTIS_MODEL_NAME,
  22. .dev_type = MANTIS_DEV_TYPE,
  23. };
  24. struct cu1216_config philips_cu1216_config = {
  25. .demod_address = 0x18 >> 1,
  26. .pll_set = philips_cu1216_tuner_set,
  27. // .fe_reset = mantis_fe_reset,
  28. };
  29. int philips_cu1216_tuner_set(struct dvb_frontend *fe,
  30. struct dvb_frontend_parameters *params)
  31. {
  32. struct mantis_pci *mantis = fe->dvb->priv;
  33. u8 buf[4];
  34. struct i2c_msg msg = {
  35. .addr = 0xc0 >> 1,
  36. .flags = 0,
  37. .buf = buf,
  38. .len = sizeof (buf)
  39. };
  40. #define TUNER_MUL 62500
  41. u32 div = (params->frequency + 36125000 + TUNER_MUL / 2) / TUNER_MUL;
  42. buf[0] = (div >> 8) & 0x7f;
  43. buf[1] = div & 0xff;
  44. buf[2] = 0x86;
  45. buf[3] = (params->frequency < 150000000 ? 0xA1 :
  46. params->frequency < 445000000 ? 0x92 : 0x34);
  47. if (i2c_transfer(&mantis->adapter, &msg, 1) < 0) {
  48. printk("%s tuner not ack!\n", __FUNCTION__);
  49. return -EIO;
  50. }
  51. msleep(100);
  52. return 0;
  53. }