aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rfkill.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/rfkill.h')
-rw-r--r--include/linux/rfkill.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 16e39c7a67fc..e73e2429a1b1 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -160,8 +160,9 @@ struct rfkill * __must_check rfkill_alloc(const char *name,
160 * the rfkill structure. Before calling this function the driver needs 160 * the rfkill structure. Before calling this function the driver needs
161 * to be ready to service method calls from rfkill. 161 * to be ready to service method calls from rfkill.
162 * 162 *
163 * If the software blocked state is not set before registration, 163 * If rfkill_init_sw_state() is not called before registration,
164 * set_block will be called to initialize it to a default value. 164 * set_block() will be called to initialize the software blocked state
165 * to a default value.
165 * 166 *
166 * If the hardware blocked state is not set before registration, 167 * If the hardware blocked state is not set before registration,
167 * it is assumed to be unblocked. 168 * it is assumed to be unblocked.
@@ -234,9 +235,11 @@ bool __must_check rfkill_set_hw_state(struct rfkill *rfkill, bool blocked);
234 * rfkill drivers that get events when the soft-blocked state changes 235 * rfkill drivers that get events when the soft-blocked state changes
235 * (yes, some platforms directly act on input but allow changing again) 236 * (yes, some platforms directly act on input but allow changing again)
236 * use this function to notify the rfkill core (and through that also 237 * use this function to notify the rfkill core (and through that also
237 * userspace) of the current state. It is not necessary to notify on 238 * userspace) of the current state.
238 * resume; since hibernation can always change the soft-blocked state, 239 *
239 * the rfkill core will unconditionally restore the previous state. 240 * Drivers should also call this function after resume if the state has
241 * been changed by the user. This only makes sense for "persistent"
242 * devices (see rfkill_init_sw_state()).
240 * 243 *
241 * This function can be called in any context, even from within rfkill 244 * This function can be called in any context, even from within rfkill
242 * callbacks. 245 * callbacks.
@@ -247,6 +250,22 @@ bool __must_check rfkill_set_hw_state(struct rfkill *rfkill, bool blocked);
247bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked); 250bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked);
248 251
249/** 252/**
253 * rfkill_init_sw_state - Initialize persistent software block state
254 * @rfkill: pointer to the rfkill class to modify.
255 * @state: the current software block state to set
256 *
257 * rfkill drivers that preserve their software block state over power off
258 * use this function to notify the rfkill core (and through that also
259 * userspace) of their initial state. It should only be used before
260 * registration.
261 *
262 * In addition, it marks the device as "persistent", an attribute which
263 * can be read by userspace. Persistent devices are expected to preserve
264 * their own state when suspended.
265 */
266void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked);
267
268/**
250 * rfkill_set_states - Set the internal rfkill block states 269 * rfkill_set_states - Set the internal rfkill block states
251 * @rfkill: pointer to the rfkill class to modify. 270 * @rfkill: pointer to the rfkill class to modify.
252 * @sw: the current software block state to set 271 * @sw: the current software block state to set
@@ -307,6 +326,10 @@ static inline bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked)
307 return blocked; 326 return blocked;
308} 327}
309 328
329static inline void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked)
330{
331}
332
310static inline void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw) 333static inline void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw)
311{ 334{
312} 335}