helene.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * helene.h
  4. *
  5. * Sony HELENE DVB-S/S2/T/T2/C/C2/ISDB-T/S tuner driver (CXD2858ER)
  6. *
  7. * Copyright 2012 Sony Corporation
  8. * Copyright (C) 2014 NetUP Inc.
  9. * Copyright (C) 2014 Abylay Ospan <aospan@netup.ru>
  10. */
  11. #ifndef __DVB_HELENE_H__
  12. #define __DVB_HELENE_H__
  13. #include <linux/dvb/frontend.h>
  14. #include <linux/i2c.h>
  15. enum helene_xtal {
  16. SONY_HELENE_XTAL_16000, /* 16 MHz */
  17. SONY_HELENE_XTAL_20500, /* 20.5 MHz */
  18. SONY_HELENE_XTAL_24000, /* 24 MHz */
  19. SONY_HELENE_XTAL_41000 /* 41 MHz */
  20. };
  21. /**
  22. * struct helene_config - the configuration of 'Helene' tuner driver
  23. * @i2c_address: I2C address of the tuner
  24. * @xtal_freq_mhz: Oscillator frequency, MHz
  25. * @set_tuner_priv: Callback function private context
  26. * @set_tuner_callback: Callback function that notifies the parent driver
  27. * which tuner is active now
  28. * @xtal: Cristal frequency as described by &enum helene_xtal
  29. * @fe: Frontend for which connects this tuner
  30. */
  31. struct helene_config {
  32. u8 i2c_address;
  33. u8 xtal_freq_mhz;
  34. void *set_tuner_priv;
  35. int (*set_tuner_callback)(void *, int);
  36. enum helene_xtal xtal;
  37. struct dvb_frontend *fe;
  38. };
  39. #if IS_REACHABLE(CONFIG_DVB_HELENE)
  40. /**
  41. * Attach a helene tuner (terrestrial and cable standards)
  42. *
  43. * @fe: frontend to be attached
  44. * @config: pointer to &struct helene_config with tuner configuration.
  45. * @i2c: i2c adapter to use.
  46. *
  47. * return: FE pointer on success, NULL on failure.
  48. */
  49. extern struct dvb_frontend *helene_attach(struct dvb_frontend *fe,
  50. const struct helene_config *config,
  51. struct i2c_adapter *i2c);
  52. /**
  53. * Attach a helene tuner (satellite standards)
  54. *
  55. * @fe: frontend to be attached
  56. * @config: pointer to &struct helene_config with tuner configuration.
  57. * @i2c: i2c adapter to use.
  58. *
  59. * return: FE pointer on success, NULL on failure.
  60. */
  61. extern struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe,
  62. const struct helene_config *config,
  63. struct i2c_adapter *i2c);
  64. #else
  65. static inline struct dvb_frontend *helene_attach(struct dvb_frontend *fe,
  66. const struct helene_config *config,
  67. struct i2c_adapter *i2c)
  68. {
  69. pr_warn("%s: driver disabled by Kconfig\n", __func__);
  70. return NULL;
  71. }
  72. static inline struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe,
  73. const struct helene_config *config,
  74. struct i2c_adapter *i2c)
  75. {
  76. pr_warn("%s: driver disabled by Kconfig\n", __func__);
  77. return NULL;
  78. }
  79. #endif
  80. #endif