Lines Matching defs:state

25  * The idle-as-is "state" is not an actual state that may be selected, it
26 * only implies that the state should not be changed. So, use that state
27 * as indication that the cached state of the multiplexer is unknown.
32 * struct mux_state - Represents a mux controller state specific to a given
35 * @state: State of the mux to be selected.
42 unsigned int state;
85 * the desired idle state in the returned mux_chip->mux[N].idle_state members.
86 * The default idle state is MUX_IDLE_AS_IS. The mux driver also needs to
141 static int mux_control_set(struct mux_control *mux, int state)
143 int ret = mux->chip->ops->set(mux, state);
145 mux->cached_state = ret < 0 ? MUX_CACHE_UNKNOWN : state;
176 dev_err(&mux_chip->dev, "unable to set idle state\n");
312 static int __mux_control_select(struct mux_control *mux, int state)
316 if (WARN_ON(state < 0 || state >= mux->states))
319 if (mux->cached_state == state)
322 ret = mux_control_set(mux, state);
348 * mux_control_select_delay() - Select the given multiplexer state.
349 * @mux: The mux-control to request a change of state from.
350 * @state: The new requested state.
351 * @delay_us: The time to delay (in microseconds) if the mux state is changed.
353 * On successfully selecting the mux-control state, it will be locked until
363 * Return: 0 when the mux-control state has the requested state or a negative
366 int mux_control_select_delay(struct mux_control *mux, unsigned int state,
375 ret = __mux_control_select(mux, state);
387 * mux_state_select_delay() - Select the given multiplexer state.
388 * @mstate: The mux-state to select.
389 * @delay_us: The time to delay (in microseconds) if the mux state is changed.
391 * On successfully selecting the mux-state, its mux-control will be locked
401 * Return: 0 when the mux-state has been selected or a negative
406 return mux_control_select_delay(mstate->mux, mstate->state, delay_us);
411 * mux_control_try_select_delay() - Try to select the given multiplexer state.
412 * @mux: The mux-control to request a change of state from.
413 * @state: The new requested state.
414 * @delay_us: The time to delay (in microseconds) if the mux state is changed.
416 * On successfully selecting the mux-control state, it will be locked until
423 * Return: 0 when the mux-control state has the requested state or a negative
426 int mux_control_try_select_delay(struct mux_control *mux, unsigned int state,
434 ret = __mux_control_select(mux, state);
446 * mux_state_try_select_delay() - Try to select the given multiplexer state.
447 * @mstate: The mux-state to select.
448 * @delay_us: The time to delay (in microseconds) if the mux state is changed.
450 * On successfully selecting the mux-state, its mux-control will be locked
457 * Return: 0 when the mux-state has been selected or a negative errno on
462 return mux_control_try_select_delay(mstate->mux, mstate->state, delay_us);
467 * mux_control_deselect() - Deselect the previously selected multiplexer state.
475 * occur if the mux has an idle state. Note that even if an error occurs, the
493 * mux_state_deselect() - Deselect the previously selected multiplexer state.
494 * @mstate: The mux-state to deselect.
501 * occur if the mux has an idle state. Note that even if an error occurs, the
524 * @state: Pointer to where the requested state is returned, or NULL when
530 unsigned int *state)
540 if (state)
541 index = of_property_match_string(np, "mux-state-names",
553 if (state)
555 "mux-states", "#mux-state-cells",
563 np, state ? "state" : "control", mux_name ?: "", index);
573 if (state) {
576 dev_err(dev, "%pOF: wrong #mux-state-cells for %pOF\n",
584 *state = args.args[1];
586 *state = args.args[0];
675 * mux_state_get() - Get the mux-state for a device.
676 * @dev: The device that needs a mux-state.
677 * @mux_name: The name identifying the mux-state.
679 * Return: A pointer to the mux-state, or an ERR_PTR with a negative errno.
689 mstate->mux = mux_get(dev, mux_name, &mstate->state);
701 * mux_state_put() - Put away the mux-state for good.
702 * @mstate: The mux-state to put away.
720 * devm_mux_state_get() - Get the mux-state for a device, with resource
725 * Return: Pointer to the mux-state, or an ERR_PTR with a negative errno.