Lines Matching +full:smem +full:- +full:states
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
17 * struct qcom_smem_state - state context
38 * qcom_smem_state_update_bits() - update the masked bits in state with value
49 if (state->orphan) in qcom_smem_state_update_bits()
50 return -ENXIO; in qcom_smem_state_update_bits()
52 if (!state->ops.update_bits) in qcom_smem_state_update_bits()
53 return -ENOTSUPP; in qcom_smem_state_update_bits()
55 return state->ops.update_bits(state->priv, mask, value); in qcom_smem_state_update_bits()
66 if (state->of_node == np) { in of_node_to_state()
67 kref_get(&state->refcount); in of_node_to_state()
71 state = ERR_PTR(-EPROBE_DEFER); in of_node_to_state()
80 * qcom_smem_state_get() - acquire handle to a state
98 index = of_property_match_string(dev->of_node, in qcom_smem_state_get()
99 "qcom,smem-state-names", in qcom_smem_state_get()
102 dev_err(dev, "missing qcom,smem-state-names\n"); in qcom_smem_state_get()
107 ret = of_parse_phandle_with_args(dev->of_node, in qcom_smem_state_get()
108 "qcom,smem-states", in qcom_smem_state_get()
109 "#qcom,smem-state-cells", in qcom_smem_state_get()
113 dev_err(dev, "failed to parse qcom,smem-states property\n"); in qcom_smem_state_get()
118 dev_err(dev, "invalid #qcom,smem-state-cells\n"); in qcom_smem_state_get()
119 return ERR_PTR(-EINVAL); in qcom_smem_state_get()
138 list_del(&state->list); in qcom_smem_state_release()
143 * qcom_smem_state_put() - release state handle
149 kref_put(&state->refcount, qcom_smem_state_release); in qcom_smem_state_put()
155 * qcom_smem_state_register() - register a new state
168 return ERR_PTR(-ENOMEM); in qcom_smem_state_register()
170 kref_init(&state->refcount); in qcom_smem_state_register()
172 state->of_node = of_node; in qcom_smem_state_register()
173 state->ops = *ops; in qcom_smem_state_register()
174 state->priv = priv; in qcom_smem_state_register()
177 list_add(&state->list, &smem_states); in qcom_smem_state_register()
185 * qcom_smem_state_unregister() - unregister a registered state
190 state->orphan = true; in qcom_smem_state_unregister()