stb6100_cfg.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 = &fe->ops;
  20. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  21. struct tuner_state t_state;
  22. int err = 0;
  23. if (tuner_ops->get_state) {
  24. err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state);
  25. if (err < 0) {
  26. printk("%s: Invalid parameter\n", __func__);
  27. return err;
  28. }
  29. *frequency = t_state.frequency;
  30. }
  31. return 0;
  32. }
  33. static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
  34. {
  35. struct dvb_frontend_ops *frontend_ops = &fe->ops;
  36. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  37. struct tuner_state t_state;
  38. int err = 0;
  39. t_state.frequency = frequency;
  40. if (tuner_ops->set_state) {
  41. err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state);
  42. if (err < 0) {
  43. printk("%s: Invalid parameter\n", __func__);
  44. return err;
  45. }
  46. }
  47. return 0;
  48. }
  49. static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
  50. {
  51. struct dvb_frontend_ops *frontend_ops = &fe->ops;
  52. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  53. struct tuner_state t_state;
  54. int err = 0;
  55. if (tuner_ops->get_state) {
  56. err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state);
  57. if (err < 0) {
  58. printk("%s: Invalid parameter\n", __func__);
  59. return err;
  60. }
  61. *bandwidth = t_state.bandwidth;
  62. }
  63. return 0;
  64. }
  65. static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
  66. {
  67. struct dvb_frontend_ops *frontend_ops = &fe->ops;
  68. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  69. struct tuner_state t_state;
  70. int err = 0;
  71. t_state.bandwidth = bandwidth;
  72. if (tuner_ops->set_state) {
  73. err = tuner_ops->set_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state);
  74. if (err < 0) {
  75. printk("%s: Invalid parameter\n", __func__);
  76. return err;
  77. }
  78. }
  79. return 0;
  80. }