drxk.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _DRXK_H_
  3. #define _DRXK_H_
  4. #include <linux/types.h>
  5. #include <linux/i2c.h>
  6. /**
  7. * struct drxk_config - Configure the initial parameters for DRX-K
  8. *
  9. * @adr: I2C address of the DRX-K
  10. * @parallel_ts: True means that the device uses parallel TS,
  11. * Serial otherwise.
  12. * @dynamic_clk: True means that the clock will be dynamically
  13. * adjusted. Static clock otherwise.
  14. * @enable_merr_cfg: Enable SIO_PDR_PERR_CFG/SIO_PDR_MVAL_CFG.
  15. * @single_master: Device is on the single master mode
  16. * @no_i2c_bridge: Don't switch the I2C bridge to talk with tuner
  17. * @antenna_gpio: GPIO bit used to control the antenna
  18. * @antenna_dvbt: GPIO bit for changing antenna to DVB-C. A value of 1
  19. * means that 1=DVBC, 0 = DVBT. Zero means the opposite.
  20. * @mpeg_out_clk_strength: DRXK Mpeg output clock drive strength.
  21. * @chunk_size: maximum size for I2C messages
  22. * @microcode_name: Name of the firmware file with the microcode
  23. * @qam_demod_parameter_count: The number of parameters used for the command
  24. * to set the demodulator parameters. All
  25. * firmwares are using the 2-parameter command.
  26. * An exception is the ``drxk_a3.mc`` firmware,
  27. * which uses the 4-parameter command.
  28. * A value of 0 (default) or lower indicates that
  29. * the correct number of parameters will be
  30. * automatically detected.
  31. *
  32. * On the ``*_gpio`` vars, bit 0 is UIO-1, bit 1 is UIO-2 and bit 2 is
  33. * UIO-3.
  34. */
  35. struct drxk_config {
  36. u8 adr;
  37. bool single_master;
  38. bool no_i2c_bridge;
  39. bool parallel_ts;
  40. bool dynamic_clk;
  41. bool enable_merr_cfg;
  42. bool antenna_dvbt;
  43. u16 antenna_gpio;
  44. u8 mpeg_out_clk_strength;
  45. int chunk_size;
  46. const char *microcode_name;
  47. int qam_demod_parameter_count;
  48. };
  49. #if IS_REACHABLE(CONFIG_DVB_DRXK)
  50. /**
  51. * Attach a drxk demod
  52. *
  53. * @config: pointer to &struct drxk_config with demod configuration.
  54. * @i2c: i2c adapter to use.
  55. *
  56. * return: FE pointer on success, NULL on failure.
  57. */
  58. extern struct dvb_frontend *drxk_attach(const struct drxk_config *config,
  59. struct i2c_adapter *i2c);
  60. #else
  61. static inline struct dvb_frontend *drxk_attach(const struct drxk_config *config,
  62. struct i2c_adapter *i2c)
  63. {
  64. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  65. return NULL;
  66. }
  67. #endif
  68. #endif