Lines Matching +full:d +full:- +full:link

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2020-21 Intel Corporation.
21 if (host_slp_check && ipc_pm->host_pm_state != IPC_MEM_HOST_PM_ACTIVE && in ipc_pm_signal_hpda_doorbell()
22 ipc_pm->host_pm_state != IPC_MEM_HOST_PM_ACTIVE_WAIT) { in ipc_pm_signal_hpda_doorbell()
23 ipc_pm->pending_hpda_update = true; in ipc_pm_signal_hpda_doorbell()
24 dev_dbg(ipc_pm->dev, in ipc_pm_signal_hpda_doorbell()
25 "Pend HPDA update set. Host PM_State: %d identifier:%d", in ipc_pm_signal_hpda_doorbell()
26 ipc_pm->host_pm_state, identifier); in ipc_pm_signal_hpda_doorbell()
31 ipc_pm->pending_hpda_update = true; in ipc_pm_signal_hpda_doorbell()
32 dev_dbg(ipc_pm->dev, "Pending HPDA update set. identifier:%d", in ipc_pm_signal_hpda_doorbell()
36 ipc_pm->pending_hpda_update = false; in ipc_pm_signal_hpda_doorbell()
39 ipc_cp_irq_hpda_update(ipc_pm->pcie, identifier); in ipc_pm_signal_hpda_doorbell()
47 if (ipc_pm->cp_state == IPC_MEM_DEV_PM_ACTIVE) in ipc_pm_link_activate()
50 if (ipc_pm->cp_state == IPC_MEM_DEV_PM_SLEEP) { in ipc_pm_link_activate()
51 if (ipc_pm->ap_state == IPC_MEM_DEV_PM_SLEEP) { in ipc_pm_link_activate()
53 ipc_cp_irq_sleep_control(ipc_pm->pcie, in ipc_pm_link_activate()
55 ipc_pm->ap_state = IPC_MEM_DEV_PM_ACTIVE_WAIT; in ipc_pm_link_activate()
60 if (ipc_pm->ap_state == IPC_MEM_DEV_PM_ACTIVE_WAIT) in ipc_pm_link_activate()
67 /* link is not ready */ in ipc_pm_link_activate()
75 if (ipc_pm->ap_state != IPC_MEM_DEV_PM_ACTIVE) { in ipc_pm_wait_for_device_active()
82 set_bit(0, &ipc_pm->host_sleep_pend); in ipc_pm_wait_for_device_active()
88 (&ipc_pm->host_sleep_complete, in ipc_pm_wait_for_device_active()
90 dev_err(ipc_pm->dev, in ipc_pm_wait_for_device_active()
91 "PM timeout. Expected State:%d. Actual: %d", in ipc_pm_wait_for_device_active()
92 IPC_MEM_DEV_PM_ACTIVE, ipc_pm->ap_state); in ipc_pm_wait_for_device_active()
105 clear_bit(0, &ipc_pm->host_sleep_pend); in ipc_pm_wait_for_device_active()
116 * -> signal SLEEP__ACK to CP in ipc_pm_on_link_sleep()
118 ipc_pm->cp_state = IPC_MEM_DEV_PM_SLEEP; in ipc_pm_on_link_sleep()
119 ipc_pm->ap_state = IPC_MEM_DEV_PM_SLEEP; in ipc_pm_on_link_sleep()
121 ipc_cp_irq_sleep_control(ipc_pm->pcie, IPC_MEM_DEV_PM_SLEEP); in ipc_pm_on_link_sleep()
126 ipc_pm->ap_state = IPC_MEM_DEV_PM_ACTIVE; in ipc_pm_on_link_wake()
129 ipc_pm->cp_state = IPC_MEM_DEV_PM_ACTIVE; in ipc_pm_on_link_wake()
131 ipc_cp_irq_sleep_control(ipc_pm->pcie, IPC_MEM_DEV_PM_ACTIVE); in ipc_pm_on_link_wake()
134 if (test_bit(CONSUME_STATE, &ipc_pm->host_sleep_pend)) in ipc_pm_on_link_wake()
135 complete(&ipc_pm->host_sleep_complete); in ipc_pm_on_link_wake()
144 if (ipc_pm->pending_hpda_update && in ipc_pm_on_link_wake()
145 ipc_pm->host_pm_state == IPC_MEM_HOST_PM_ACTIVE) in ipc_pm_on_link_wake()
156 new_cond = ipc_pm->pm_cond; in ipc_pm_trigger()
157 old_cond = ipc_pm->pm_cond; in ipc_pm_trigger()
165 case IPC_PM_UNIT_LINK: /* Device link state. */ in ipc_pm_trigger()
166 new_cond.link = active; in ipc_pm_trigger()
169 case IPC_PM_UNIT_HS: /* Host sleep trigger requires Link. */ in ipc_pm_trigger()
180 link_active = old_cond.link == IPC_PM_ACTIVE; in ipc_pm_trigger()
184 ipc_pm->pm_cond = new_cond; in ipc_pm_trigger()
186 if (new_cond.link) in ipc_pm_trigger()
191 if (old_cond.link == IPC_PM_SLEEP && new_cond.raw) { in ipc_pm_trigger()
196 link_active = old_cond.link == IPC_PM_ACTIVE; in ipc_pm_trigger()
205 if (ipc_pm->host_pm_state != IPC_MEM_HOST_PM_ACTIVE) { in ipc_pm_prepare_host_sleep()
206 dev_err(ipc_pm->dev, "host_pm_state=%d\tExpected to be: %d", in ipc_pm_prepare_host_sleep()
207 ipc_pm->host_pm_state, IPC_MEM_HOST_PM_ACTIVE); in ipc_pm_prepare_host_sleep()
211 ipc_pm->host_pm_state = IPC_MEM_HOST_PM_SLEEP_WAIT_D3; in ipc_pm_prepare_host_sleep()
218 if (ipc_pm->host_pm_state != IPC_MEM_HOST_PM_SLEEP) { in ipc_pm_prepare_host_active()
219 dev_err(ipc_pm->dev, "host_pm_state=%d\tExpected to be: %d", in ipc_pm_prepare_host_active()
220 ipc_pm->host_pm_state, IPC_MEM_HOST_PM_SLEEP); in ipc_pm_prepare_host_active()
225 ipc_pm->host_pm_state = IPC_MEM_HOST_PM_ACTIVE_WAIT; in ipc_pm_prepare_host_active()
233 ipc_pm->ap_state = IPC_MEM_DEV_PM_SLEEP; in ipc_pm_set_s2idle_sleep()
234 ipc_pm->cp_state = IPC_MEM_DEV_PM_SLEEP; in ipc_pm_set_s2idle_sleep()
235 ipc_pm->device_sleep_notification = IPC_MEM_DEV_PM_SLEEP; in ipc_pm_set_s2idle_sleep()
237 ipc_pm->ap_state = IPC_MEM_DEV_PM_ACTIVE; in ipc_pm_set_s2idle_sleep()
238 ipc_pm->cp_state = IPC_MEM_DEV_PM_ACTIVE; in ipc_pm_set_s2idle_sleep()
239 ipc_pm->device_sleep_notification = IPC_MEM_DEV_PM_ACTIVE; in ipc_pm_set_s2idle_sleep()
240 ipc_pm->pm_cond.link = IPC_PM_ACTIVE; in ipc_pm_set_s2idle_sleep()
246 if (cp_pm_req == ipc_pm->device_sleep_notification) in ipc_pm_dev_slp_notification()
249 ipc_pm->device_sleep_notification = cp_pm_req; in ipc_pm_dev_slp_notification()
252 switch (ipc_pm->cp_state) { in ipc_pm_dev_slp_notification()
259 /* Inform the PM that the device link can go down. */ in ipc_pm_dev_slp_notification()
264 dev_err(ipc_pm->dev, in ipc_pm_dev_slp_notification()
265 "loc-pm=%d active: confused req-pm=%d", in ipc_pm_dev_slp_notification()
266 ipc_pm->cp_state, cp_pm_req); in ipc_pm_dev_slp_notification()
274 /* Inform the PM that the device link is active. */ in ipc_pm_dev_slp_notification()
282 dev_err(ipc_pm->dev, in ipc_pm_dev_slp_notification()
283 "loc-pm=%d sleep: confused req-pm=%d", in ipc_pm_dev_slp_notification()
284 ipc_pm->cp_state, cp_pm_req); in ipc_pm_dev_slp_notification()
290 dev_err(ipc_pm->dev, "confused loc-pm=%d, req-pm=%d", in ipc_pm_dev_slp_notification()
291 ipc_pm->cp_state, cp_pm_req); in ipc_pm_dev_slp_notification()
300 struct iosm_imem *ipc_imem = ipc_protocol->imem; in ipc_pm_init()
301 struct iosm_pm *ipc_pm = &ipc_protocol->pm; in ipc_pm_init()
303 ipc_pm->pcie = ipc_imem->pcie; in ipc_pm_init()
304 ipc_pm->dev = ipc_imem->dev; in ipc_pm_init()
306 ipc_pm->pm_cond.irq = IPC_PM_SLEEP; in ipc_pm_init()
307 ipc_pm->pm_cond.hs = IPC_PM_SLEEP; in ipc_pm_init()
308 ipc_pm->pm_cond.link = IPC_PM_ACTIVE; in ipc_pm_init()
310 ipc_pm->cp_state = IPC_MEM_DEV_PM_ACTIVE; in ipc_pm_init()
311 ipc_pm->ap_state = IPC_MEM_DEV_PM_ACTIVE; in ipc_pm_init()
312 ipc_pm->host_pm_state = IPC_MEM_HOST_PM_ACTIVE; in ipc_pm_init()
314 /* Create generic wait-for-completion handler for Host Sleep in ipc_pm_init()
317 init_completion(&ipc_pm->host_sleep_complete); in ipc_pm_init()
322 clear_bit(0, &ipc_pm->host_sleep_pend); in ipc_pm_init()
330 struct iosm_pm *ipc_pm = &proto->pm; in ipc_pm_deinit()
332 complete(&ipc_pm->host_sleep_complete); in ipc_pm_deinit()