0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LINUX_MUX_CONSUMER_H
0011 #define _LINUX_MUX_CONSUMER_H
0012
0013 #include <linux/compiler.h>
0014
0015 struct device;
0016 struct mux_control;
0017 struct mux_state;
0018
0019 unsigned int mux_control_states(struct mux_control *mux);
0020 int __must_check mux_control_select_delay(struct mux_control *mux,
0021 unsigned int state,
0022 unsigned int delay_us);
0023 int __must_check mux_state_select_delay(struct mux_state *mstate,
0024 unsigned int delay_us);
0025 int __must_check mux_control_try_select_delay(struct mux_control *mux,
0026 unsigned int state,
0027 unsigned int delay_us);
0028 int __must_check mux_state_try_select_delay(struct mux_state *mstate,
0029 unsigned int delay_us);
0030
0031 static inline int __must_check mux_control_select(struct mux_control *mux,
0032 unsigned int state)
0033 {
0034 return mux_control_select_delay(mux, state, 0);
0035 }
0036
0037 static inline int __must_check mux_state_select(struct mux_state *mstate)
0038 {
0039 return mux_state_select_delay(mstate, 0);
0040 }
0041
0042 static inline int __must_check mux_control_try_select(struct mux_control *mux,
0043 unsigned int state)
0044 {
0045 return mux_control_try_select_delay(mux, state, 0);
0046 }
0047
0048 static inline int __must_check mux_state_try_select(struct mux_state *mstate)
0049 {
0050 return mux_state_try_select_delay(mstate, 0);
0051 }
0052
0053 int mux_control_deselect(struct mux_control *mux);
0054 int mux_state_deselect(struct mux_state *mstate);
0055
0056 struct mux_control *mux_control_get(struct device *dev, const char *mux_name);
0057 void mux_control_put(struct mux_control *mux);
0058
0059 struct mux_control *devm_mux_control_get(struct device *dev,
0060 const char *mux_name);
0061 struct mux_state *devm_mux_state_get(struct device *dev,
0062 const char *mux_name);
0063
0064 #endif