consumer.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * mux/consumer.h - definitions for the multiplexer consumer interface
  4. *
  5. * Copyright (C) 2017 Axentia Technologies AB
  6. *
  7. * Author: Peter Rosin <[email protected]>
  8. */
  9. #ifndef _LINUX_MUX_CONSUMER_H
  10. #define _LINUX_MUX_CONSUMER_H
  11. #include <linux/compiler.h>
  12. struct device;
  13. struct mux_control;
  14. struct mux_state;
  15. unsigned int mux_control_states(struct mux_control *mux);
  16. int __must_check mux_control_select_delay(struct mux_control *mux,
  17. unsigned int state,
  18. unsigned int delay_us);
  19. int __must_check mux_state_select_delay(struct mux_state *mstate,
  20. unsigned int delay_us);
  21. int __must_check mux_control_try_select_delay(struct mux_control *mux,
  22. unsigned int state,
  23. unsigned int delay_us);
  24. int __must_check mux_state_try_select_delay(struct mux_state *mstate,
  25. unsigned int delay_us);
  26. static inline int __must_check mux_control_select(struct mux_control *mux,
  27. unsigned int state)
  28. {
  29. return mux_control_select_delay(mux, state, 0);
  30. }
  31. static inline int __must_check mux_state_select(struct mux_state *mstate)
  32. {
  33. return mux_state_select_delay(mstate, 0);
  34. }
  35. static inline int __must_check mux_control_try_select(struct mux_control *mux,
  36. unsigned int state)
  37. {
  38. return mux_control_try_select_delay(mux, state, 0);
  39. }
  40. static inline int __must_check mux_state_try_select(struct mux_state *mstate)
  41. {
  42. return mux_state_try_select_delay(mstate, 0);
  43. }
  44. int mux_control_deselect(struct mux_control *mux);
  45. int mux_state_deselect(struct mux_state *mstate);
  46. struct mux_control *mux_control_get(struct device *dev, const char *mux_name);
  47. void mux_control_put(struct mux_control *mux);
  48. struct mux_control *devm_mux_control_get(struct device *dev,
  49. const char *mux_name);
  50. struct mux_state *devm_mux_state_get(struct device *dev,
  51. const char *mux_name);
  52. #endif /* _LINUX_MUX_CONSUMER_H */