zd1301_demod.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * ZyDAS ZD1301 driver (demodulator)
  4. *
  5. * Copyright (C) 2015 Antti Palosaari <crope@iki.fi>
  6. */
  7. #ifndef ZD1301_DEMOD_H
  8. #define ZD1301_DEMOD_H
  9. #include <linux/platform_device.h>
  10. #include <linux/dvb/frontend.h>
  11. #include <media/dvb_frontend.h>
  12. /**
  13. * struct zd1301_demod_platform_data - Platform data for the zd1301_demod driver
  14. * @reg_priv: First argument of reg_read and reg_write callbacks.
  15. * @reg_read: Register read callback.
  16. * @reg_write: Register write callback.
  17. */
  18. struct zd1301_demod_platform_data {
  19. void *reg_priv;
  20. int (*reg_read)(void *, u16, u8 *);
  21. int (*reg_write)(void *, u16, u8);
  22. };
  23. #if IS_REACHABLE(CONFIG_DVB_ZD1301_DEMOD)
  24. /**
  25. * zd1301_demod_get_dvb_frontend() - Get pointer to DVB frontend
  26. * @pdev: Pointer to platform device
  27. *
  28. * Return: Pointer to DVB frontend which given platform device owns.
  29. */
  30. struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *pdev);
  31. /**
  32. * zd1301_demod_get_i2c_adapter() - Get pointer to I2C adapter
  33. * @pdev: Pointer to platform device
  34. *
  35. * Return: Pointer to I2C adapter which given platform device owns.
  36. */
  37. struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *pdev);
  38. #else
  39. /**
  40. * zd1301_demod_get_dvb_frontend() - Attach a zd1301 frontend
  41. * @dev: Pointer to platform device
  42. *
  43. * Return: Pointer to %struct dvb_frontend or NULL if attach fails.
  44. */
  45. static inline struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *dev)
  46. {
  47. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  48. return NULL;
  49. }
  50. static inline struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *dev)
  51. {
  52. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  53. return NULL;
  54. }
  55. #endif
  56. #endif /* ZD1301_DEMOD_H */