tda8261_cfg.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. TDA8261 8PSK/QPSK tuner 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. static int tda8261_get_frequency(struct dvb_frontend *fe, u32 *frequency)
  17. {
  18. struct dvb_frontend_ops *frontend_ops = NULL;
  19. struct dvb_tuner_ops *tuner_ops = NULL;
  20. struct tuner_state t_state;
  21. int err = 0;
  22. if (&fe->ops)
  23. frontend_ops = &fe->ops;
  24. if (&frontend_ops->tuner_ops)
  25. tuner_ops = &frontend_ops->tuner_ops;
  26. if (tuner_ops->get_state) {
  27. if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
  28. printk("%s: Invalid parameter\n", __func__);
  29. return err;
  30. }
  31. *frequency = t_state.frequency;
  32. printk("%s: Frequency=%d\n", __func__, t_state.frequency);
  33. }
  34. return 0;
  35. }
  36. static int tda8261_set_frequency(struct dvb_frontend *fe, u32 frequency)
  37. {
  38. struct dvb_frontend_ops *frontend_ops = NULL;
  39. struct dvb_tuner_ops *tuner_ops = NULL;
  40. struct tuner_state t_state;
  41. int err = 0;
  42. t_state.frequency = frequency;
  43. if (&fe->ops)
  44. frontend_ops = &fe->ops;
  45. if (&frontend_ops->tuner_ops)
  46. tuner_ops = &frontend_ops->tuner_ops;
  47. if (tuner_ops->set_state) {
  48. if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
  49. printk("%s: Invalid parameter\n", __func__);
  50. return err;
  51. }
  52. }
  53. printk("%s: Frequency=%d\n", __func__, t_state.frequency);
  54. return 0;
  55. }
  56. static int tda8261_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
  57. {
  58. struct dvb_frontend_ops *frontend_ops = &fe->ops;
  59. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  60. struct tuner_state t_state;
  61. int err = 0;
  62. if (&fe->ops)
  63. frontend_ops = &fe->ops;
  64. if (&frontend_ops->tuner_ops)
  65. tuner_ops = &frontend_ops->tuner_ops;
  66. if (tuner_ops->get_state) {
  67. if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
  68. printk("%s: Invalid parameter\n", __func__);
  69. return err;
  70. }
  71. *bandwidth = t_state.bandwidth;
  72. }
  73. printk("%s: Bandwidth=%d\n", __func__, t_state.bandwidth);
  74. return 0;
  75. }