stb6100_cfg.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. STB6100 Silicon Tuner
  3. Copyright (C) Manu Abraham (abraham.manu@gmail.com)
  4. Copyright (C) ST Microelectronics
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
  18. {
  19. struct dvb_frontend_ops *frontend_ops = NULL;
  20. struct dvb_tuner_ops *tuner_ops = NULL;
  21. struct tuner_state t_state;
  22. int err = 0;
  23. if (&fe->ops)
  24. frontend_ops = &fe->ops;
  25. if (&frontend_ops->tuner_ops)
  26. tuner_ops = &frontend_ops->tuner_ops;
  27. if (tuner_ops->get_state) {
  28. if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
  29. printk("%s: Invalid parameter\n", __func__);
  30. return err;
  31. }
  32. *frequency = t_state.frequency;
  33. }
  34. return 0;
  35. }
  36. static int stb6100_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. return 0;
  54. }
  55. static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
  56. {
  57. struct dvb_frontend_ops *frontend_ops = &fe->ops;
  58. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  59. struct tuner_state t_state;
  60. int err = 0;
  61. if (&fe->ops)
  62. frontend_ops = &fe->ops;
  63. if (&frontend_ops->tuner_ops)
  64. tuner_ops = &frontend_ops->tuner_ops;
  65. if (tuner_ops->get_state) {
  66. if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
  67. printk("%s: Invalid parameter\n", __func__);
  68. return err;
  69. }
  70. *bandwidth = t_state.bandwidth;
  71. }
  72. return 0;
  73. }
  74. static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
  75. {
  76. struct dvb_frontend_ops *frontend_ops = NULL;
  77. struct dvb_tuner_ops *tuner_ops = NULL;
  78. struct tuner_state t_state;
  79. int err = 0;
  80. t_state.bandwidth = bandwidth;
  81. if (&fe->ops)
  82. frontend_ops = &fe->ops;
  83. if (&frontend_ops->tuner_ops)
  84. tuner_ops = &frontend_ops->tuner_ops;
  85. if (tuner_ops->set_state) {
  86. if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
  87. printk("%s: Invalid parameter\n", __func__);
  88. return err;
  89. }
  90. }
  91. return 0;
  92. }