Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 4d8e74ad4585672489da6145b3328d415f50db82 164 lines 4.7 kB view raw
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 <peda@axentia.se> 8 */ 9 10#ifndef _LINUX_MUX_CONSUMER_H 11#define _LINUX_MUX_CONSUMER_H 12 13#include <linux/compiler.h> 14 15struct device; 16struct mux_control; 17struct mux_state; 18 19#if IS_ENABLED(CONFIG_MULTIPLEXER) 20 21unsigned int mux_control_states(struct mux_control *mux); 22int __must_check mux_control_select_delay(struct mux_control *mux, 23 unsigned int state, 24 unsigned int delay_us); 25int __must_check mux_state_select_delay(struct mux_state *mstate, 26 unsigned int delay_us); 27int __must_check mux_control_try_select_delay(struct mux_control *mux, 28 unsigned int state, 29 unsigned int delay_us); 30int __must_check mux_state_try_select_delay(struct mux_state *mstate, 31 unsigned int delay_us); 32 33static inline int __must_check mux_control_select(struct mux_control *mux, 34 unsigned int state) 35{ 36 return mux_control_select_delay(mux, state, 0); 37} 38 39static inline int __must_check mux_state_select(struct mux_state *mstate) 40{ 41 return mux_state_select_delay(mstate, 0); 42} 43 44static inline int __must_check mux_control_try_select(struct mux_control *mux, 45 unsigned int state) 46{ 47 return mux_control_try_select_delay(mux, state, 0); 48} 49 50static inline int __must_check mux_state_try_select(struct mux_state *mstate) 51{ 52 return mux_state_try_select_delay(mstate, 0); 53} 54 55int mux_control_deselect(struct mux_control *mux); 56int mux_state_deselect(struct mux_state *mstate); 57 58struct mux_control *mux_control_get(struct device *dev, const char *mux_name); 59struct mux_control *mux_control_get_optional(struct device *dev, const char *mux_name); 60void mux_control_put(struct mux_control *mux); 61 62struct mux_control *devm_mux_control_get(struct device *dev, const char *mux_name); 63struct mux_state *devm_mux_state_get(struct device *dev, const char *mux_name); 64struct mux_state *devm_mux_state_get_optional(struct device *dev, const char *mux_name); 65struct mux_state *devm_mux_state_get_selected(struct device *dev, const char *mux_name); 66struct mux_state *devm_mux_state_get_optional_selected(struct device *dev, const char *mux_name); 67 68#else 69 70static inline unsigned int mux_control_states(struct mux_control *mux) 71{ 72 return 0; 73} 74static inline int __must_check mux_control_select_delay(struct mux_control *mux, 75 unsigned int state, unsigned int delay_us) 76{ 77 return -EOPNOTSUPP; 78} 79static inline int __must_check mux_state_select_delay(struct mux_state *mstate, 80 unsigned int delay_us) 81{ 82 return -EOPNOTSUPP; 83} 84static inline int __must_check mux_control_try_select_delay(struct mux_control *mux, 85 unsigned int state, 86 unsigned int delay_us) 87{ 88 return -EOPNOTSUPP; 89} 90static inline int __must_check mux_state_try_select_delay(struct mux_state *mstate, 91 unsigned int delay_us) 92{ 93 return -EOPNOTSUPP; 94} 95 96static inline int __must_check mux_control_select(struct mux_control *mux, 97 unsigned int state) 98{ 99 return -EOPNOTSUPP; 100} 101 102static inline int __must_check mux_state_select(struct mux_state *mstate) 103{ 104 return -EOPNOTSUPP; 105} 106 107static inline int __must_check mux_control_try_select(struct mux_control *mux, 108 unsigned int state) 109{ 110 return -EOPNOTSUPP; 111} 112 113static inline int __must_check mux_state_try_select(struct mux_state *mstate) 114{ 115 return -EOPNOTSUPP; 116} 117 118static inline int mux_control_deselect(struct mux_control *mux) 119{ 120 return -EOPNOTSUPP; 121} 122static inline int mux_state_deselect(struct mux_state *mstate) 123{ 124 return -EOPNOTSUPP; 125} 126 127static inline struct mux_control *mux_control_get(struct device *dev, const char *mux_name) 128{ 129 return ERR_PTR(-EOPNOTSUPP); 130} 131static inline struct mux_control *mux_control_get_optional(struct device *dev, 132 const char *mux_name) 133{ 134 return NULL; 135} 136static inline void mux_control_put(struct mux_control *mux) {} 137 138static inline struct mux_control *devm_mux_control_get(struct device *dev, const char *mux_name) 139{ 140 return ERR_PTR(-EOPNOTSUPP); 141} 142static inline struct mux_state *devm_mux_state_get(struct device *dev, const char *mux_name) 143{ 144 return ERR_PTR(-EOPNOTSUPP); 145} 146static inline struct mux_state *devm_mux_state_get_optional(struct device *dev, 147 const char *mux_name) 148{ 149 return NULL; 150} 151static inline struct mux_state *devm_mux_state_get_selected(struct device *dev, 152 const char *mux_name) 153{ 154 return ERR_PTR(-EOPNOTSUPP); 155} 156static inline struct mux_state *devm_mux_state_get_optional_selected(struct device *dev, 157 const char *mux_name) 158{ 159 return NULL; 160} 161 162#endif /* CONFIG_MULTIPLEXER */ 163 164#endif /* _LINUX_MUX_CONSUMER_H */