zd1301_demod.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * ZyDAS ZD1301 driver (demodulator)
  3. *
  4. * Copyright (C) 2015 Antti Palosaari <crope@iki.fi>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #ifndef ZD1301_DEMOD_H
  17. #define ZD1301_DEMOD_H
  18. #include <linux/platform_device.h>
  19. #include <linux/dvb/frontend.h>
  20. #include <media/dvb_frontend.h>
  21. /**
  22. * struct zd1301_demod_platform_data - Platform data for the zd1301_demod driver
  23. * @reg_priv: First argument of reg_read and reg_write callbacks.
  24. * @reg_read: Register read callback.
  25. * @reg_write: Register write callback.
  26. */
  27. struct zd1301_demod_platform_data {
  28. void *reg_priv;
  29. int (*reg_read)(void *, u16, u8 *);
  30. int (*reg_write)(void *, u16, u8);
  31. };
  32. #if IS_REACHABLE(CONFIG_DVB_ZD1301_DEMOD)
  33. /**
  34. * zd1301_demod_get_dvb_frontend() - Get pointer to DVB frontend
  35. * @pdev: Pointer to platform device
  36. *
  37. * Return: Pointer to DVB frontend which given platform device owns.
  38. */
  39. struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *pdev);
  40. /**
  41. * zd1301_demod_get_i2c_adapter() - Get pointer to I2C adapter
  42. * @pdev: Pointer to platform device
  43. *
  44. * Return: Pointer to I2C adapter which given platform device owns.
  45. */
  46. struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *pdev);
  47. #else
  48. /**
  49. * zd1301_demod_get_dvb_frontend() - Attach a zd1301 frontend
  50. * @dev: Pointer to platform device
  51. *
  52. * Return: Pointer to %struct dvb_frontend or NULL if attach fails.
  53. */
  54. static inline struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *dev)
  55. {
  56. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  57. return NULL;
  58. }
  59. static inline struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *dev)
  60. {
  61. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  62. return NULL;
  63. }
  64. #endif
  65. #endif /* ZD1301_DEMOD_H */