stb6100_cfg.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. #include <linux/dvb/frontend.h>
  18. #include "dvb_frontend.h"
  19. static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
  20. {
  21. struct dvb_frontend_ops *frontend_ops = &fe->ops;
  22. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  23. int err = 0;
  24. if (tuner_ops->get_frequency) {
  25. err = tuner_ops->get_frequency(fe, frequency);
  26. if (err < 0) {
  27. printk("%s: Invalid parameter\n", __func__);
  28. return err;
  29. }
  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 dtv_frontend_properties *c = &fe->dtv_property_cache;
  38. u32 bw = c->bandwidth_hz;
  39. int err = 0;
  40. c->frequency = frequency;
  41. c->bandwidth_hz = 0; /* Don't adjust the bandwidth */
  42. if (tuner_ops->set_params) {
  43. err = tuner_ops->set_params(fe);
  44. c->bandwidth_hz = bw;
  45. if (err < 0) {
  46. printk("%s: Invalid parameter\n", __func__);
  47. return err;
  48. }
  49. }
  50. return 0;
  51. }
  52. static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
  53. {
  54. struct dvb_frontend_ops *frontend_ops = &fe->ops;
  55. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  56. int err = 0;
  57. if (tuner_ops->get_bandwidth) {
  58. err = tuner_ops->get_bandwidth(fe, bandwidth);
  59. if (err < 0) {
  60. printk("%s: Invalid parameter\n", __func__);
  61. return err;
  62. }
  63. }
  64. return 0;
  65. }
  66. static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
  67. {
  68. struct dvb_frontend_ops *frontend_ops = &fe->ops;
  69. struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
  70. struct dtv_frontend_properties *c = &fe->dtv_property_cache;
  71. u32 freq = c->frequency;
  72. int err = 0;
  73. c->bandwidth_hz = bandwidth;
  74. c->frequency = 0; /* Don't adjust the frequency */
  75. if (tuner_ops->set_params) {
  76. err = tuner_ops->set_params(fe);
  77. c->frequency = freq;
  78. if (err < 0) {
  79. printk("%s: Invalid parameter\n", __func__);
  80. return err;
  81. }
  82. }
  83. return 0;
  84. }