Lines Matching refs:sc

119 	struct scmi_syspower_conf *sc = reboot_nb_to_sconf(nb);  in scmi_reboot_notifier()  local
121 mutex_lock(&sc->state_mtx); in scmi_reboot_notifier()
125 if (sc->required_transition == SCMI_SYSTEM_SHUTDOWN) in scmi_reboot_notifier()
126 sc->state = SCMI_SYSPOWER_REBOOTING; in scmi_reboot_notifier()
129 if (sc->required_transition == SCMI_SYSTEM_COLDRESET || in scmi_reboot_notifier()
130 sc->required_transition == SCMI_SYSTEM_WARMRESET) in scmi_reboot_notifier()
131 sc->state = SCMI_SYSPOWER_REBOOTING; in scmi_reboot_notifier()
137 if (sc->state == SCMI_SYSPOWER_REBOOTING) { in scmi_reboot_notifier()
138 dev_dbg(sc->dev, "Reboot in progress...cancel delayed work.\n"); in scmi_reboot_notifier()
139 cancel_delayed_work_sync(&sc->forceful_work); in scmi_reboot_notifier()
141 mutex_unlock(&sc->state_mtx); in scmi_reboot_notifier()
155 scmi_request_forceful_transition(struct scmi_syspower_conf *sc) in scmi_request_forceful_transition() argument
157 dev_dbg(sc->dev, "Serving forceful request:%d\n", in scmi_request_forceful_transition()
158 sc->required_transition); in scmi_request_forceful_transition()
163 switch (sc->required_transition) { in scmi_request_forceful_transition()
178 struct scmi_syspower_conf *sc; in scmi_forceful_work_func() local
185 sc = dwork_to_sconf(dwork); in scmi_forceful_work_func()
187 dev_dbg(sc->dev, "Graceful request timed out...forcing !\n"); in scmi_forceful_work_func()
188 mutex_lock(&sc->state_mtx); in scmi_forceful_work_func()
190 unregister_reboot_notifier(&sc->reboot_nb); in scmi_forceful_work_func()
191 if (sc->state == SCMI_SYSPOWER_IN_PROGRESS) in scmi_forceful_work_func()
192 scmi_request_forceful_transition(sc); in scmi_forceful_work_func()
193 mutex_unlock(&sc->state_mtx); in scmi_forceful_work_func()
210 static void scmi_request_graceful_transition(struct scmi_syspower_conf *sc, in scmi_request_graceful_transition() argument
218 sc->reboot_nb.notifier_call = &scmi_reboot_notifier; in scmi_request_graceful_transition()
219 ret = register_reboot_notifier(&sc->reboot_nb); in scmi_request_graceful_transition()
223 INIT_DELAYED_WORK(&sc->forceful_work, in scmi_request_graceful_transition()
225 schedule_delayed_work(&sc->forceful_work, in scmi_request_graceful_transition()
229 dev_warn(sc->dev, in scmi_request_graceful_transition()
234 dev_dbg(sc->dev, in scmi_request_graceful_transition()
236 sc->required_transition, timeout_ms, adj_timeout_ms); in scmi_request_graceful_transition()
238 switch (sc->required_transition) { in scmi_request_graceful_transition()
278 struct scmi_syspower_conf *sc = userspace_nb_to_sconf(nb); in scmi_userspace_notifier() local
281 dev_err(sc->dev, "Ignoring unsupported system_state: 0x%X\n", in scmi_userspace_notifier()
287 dev_err(sc->dev, "Ignoring forceful notification.\n"); in scmi_userspace_notifier()
297 mutex_lock(&sc->state_mtx); in scmi_userspace_notifier()
298 if (sc->state != SCMI_SYSPOWER_IDLE) { in scmi_userspace_notifier()
299 dev_dbg(sc->dev, in scmi_userspace_notifier()
301 mutex_unlock(&sc->state_mtx); in scmi_userspace_notifier()
304 sc->state = SCMI_SYSPOWER_IN_PROGRESS; in scmi_userspace_notifier()
305 mutex_unlock(&sc->state_mtx); in scmi_userspace_notifier()
307 sc->required_transition = er->system_state; in scmi_userspace_notifier()
310 dev_info(sc->dev, "Serving shutdown/reboot request: %d\n", in scmi_userspace_notifier()
311 sc->required_transition); in scmi_userspace_notifier()
313 scmi_request_graceful_transition(sc, er->timeout); in scmi_userspace_notifier()
321 struct scmi_syspower_conf *sc; in scmi_syspower_probe() local
331 sc = devm_kzalloc(&sdev->dev, sizeof(*sc), GFP_KERNEL); in scmi_syspower_probe()
332 if (!sc) in scmi_syspower_probe()
335 sc->state = SCMI_SYSPOWER_IDLE; in scmi_syspower_probe()
336 mutex_init(&sc->state_mtx); in scmi_syspower_probe()
337 sc->required_transition = SCMI_SYSTEM_MAX; in scmi_syspower_probe()
338 sc->userspace_nb.notifier_call = &scmi_userspace_notifier; in scmi_syspower_probe()
339 sc->dev = &sdev->dev; in scmi_syspower_probe()
344 NULL, &sc->userspace_nb); in scmi_syspower_probe()