stb6100_cfg.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. printk("%s: Frequency=%d\n", __func__, t_state.frequency);
  34. }
  35. return 0;
  36. }
  37. static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
  38. {
  39. struct dvb_frontend_ops *frontend_ops = NULL;
  40. struct dvb_tuner_ops *tuner_ops = NULL;
  41. struct tuner_state t_state;
  42. int err = 0;
  43. t_state.frequency = frequency;
  44. if (&fe->ops)
  45. frontend_ops = &fe->ops;
  46. if (&frontend_ops->tuner_ops)
  47. tuner_ops = &frontend_ops->tuner_ops;
  48. if (tuner_ops->set_state) {
  49. if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
  50. printk("%s: Invalid parameter\n", __func__);
  51. return err;
  52. }
  53. }
  54. printk("%s: Frequency=%d\n", __func__, t_state.frequency);
  55. return 0;
  56. }
  57. static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
  58. {
  59. struct dvb_frontend_ops *frontend_ops = &fe->ops;
  60. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  61. struct tuner_state t_state;
  62. int err = 0;
  63. if (&fe->ops)
  64. frontend_ops = &fe->ops;
  65. if (&frontend_ops->tuner_ops)
  66. tuner_ops = &frontend_ops->tuner_ops;
  67. if (tuner_ops->get_state) {
  68. if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
  69. printk("%s: Invalid parameter\n", __func__);
  70. return err;
  71. }
  72. *bandwidth = t_state.bandwidth;
  73. }
  74. printk("%s: Bandwidth=%d\n", __func__, t_state.bandwidth);
  75. return 0;
  76. }
  77. static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
  78. {
  79. struct dvb_frontend_ops *frontend_ops = NULL;
  80. struct dvb_tuner_ops *tuner_ops = NULL;
  81. struct tuner_state t_state;
  82. int err = 0;
  83. t_state.bandwidth = bandwidth;
  84. if (&fe->ops)
  85. frontend_ops = &fe->ops;
  86. if (&frontend_ops->tuner_ops)
  87. tuner_ops = &frontend_ops->tuner_ops;
  88. if (tuner_ops->set_state) {
  89. if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
  90. printk("%s: Invalid parameter\n", __func__);
  91. return err;
  92. }
  93. }
  94. printk("%s: Bandwidth=%d\n", __func__, t_state.bandwidth);
  95. return 0;
  96. }