si21xx.h 830 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef SI21XX_H
  3. #define SI21XX_H
  4. #include <linux/dvb/frontend.h>
  5. #include <media/dvb_frontend.h>
  6. struct si21xx_config {
  7. /* the demodulator's i2c address */
  8. u8 demod_address;
  9. /* minimum delay before retuning */
  10. int min_delay_ms;
  11. };
  12. #if IS_REACHABLE(CONFIG_DVB_SI21XX)
  13. extern struct dvb_frontend *si21xx_attach(const struct si21xx_config *config,
  14. struct i2c_adapter *i2c);
  15. #else
  16. static inline struct dvb_frontend *si21xx_attach(
  17. const struct si21xx_config *config, struct i2c_adapter *i2c)
  18. {
  19. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  20. return NULL;
  21. }
  22. #endif
  23. static inline int si21xx_writeregister(struct dvb_frontend *fe, u8 reg, u8 val)
  24. {
  25. int r = 0;
  26. u8 buf[] = {reg, val};
  27. if (fe->ops.write)
  28. r = fe->ops.write(fe, buf, 2);
  29. return r;
  30. }
  31. #endif