Skip to content

Commit 9225bcd

Browse files
committed
firmware: ti_sci: Use system_state to determine polling
Commit b9e8a7d ("firmware: ti_sci: Switch transport to polled mode during system suspend") aims to resolve issues with tisci operations during system suspend operation. However, the system may enter a no_irq stage in various other usage modes, including power-off and restart. To determine if polling mode is appropriate, use the system_state instead. While at this, drop the unused is_suspending state variable and related helpers. Fixes: b9e8a7d ("firmware: ti_sci: Switch transport to polled mode during system suspend") Reported-by: Francesco Dolcini <[email protected]> Reported-by: Wadim Egorov <[email protected]> Tested-by: Francesco Dolcini <[email protected]> # Toradex Verdin AM62 Link: https://lore.kernel.org/r/[email protected] Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Nishanth Menon <[email protected]>
1 parent 06c2afb commit 9225bcd

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

drivers/firmware/ti_sci.c

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ struct ti_sci_desc {
9797
* @node: list head
9898
* @host_id: Host ID
9999
* @users: Number of users of this instance
100-
* @is_suspending: Flag set to indicate in suspend path.
101100
*/
102101
struct ti_sci_info {
103102
struct device *dev;
@@ -116,7 +115,6 @@ struct ti_sci_info {
116115
u8 host_id;
117116
/* protected by ti_sci_list_mutex */
118117
int users;
119-
bool is_suspending;
120118
};
121119

122120
#define cl_to_ti_sci_info(c) container_of(c, struct ti_sci_info, cl)
@@ -418,14 +416,14 @@ static inline int ti_sci_do_xfer(struct ti_sci_info *info,
418416

419417
ret = 0;
420418

421-
if (!info->is_suspending) {
419+
if (system_state <= SYSTEM_RUNNING) {
422420
/* And we wait for the response. */
423421
timeout = msecs_to_jiffies(info->desc->max_rx_timeout_ms);
424422
if (!wait_for_completion_timeout(&xfer->done, timeout))
425423
ret = -ETIMEDOUT;
426424
} else {
427425
/*
428-
* If we are suspending, we cannot use wait_for_completion_timeout
426+
* If we are !running, we cannot use wait_for_completion_timeout
429427
* during noirq phase, so we must manually poll the completion.
430428
*/
431429
ret = read_poll_timeout_atomic(try_wait_for_completion, done_state,
@@ -3281,35 +3279,6 @@ static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
32813279
return NOTIFY_BAD;
32823280
}
32833281

3284-
static void ti_sci_set_is_suspending(struct ti_sci_info *info, bool is_suspending)
3285-
{
3286-
info->is_suspending = is_suspending;
3287-
}
3288-
3289-
static int ti_sci_suspend(struct device *dev)
3290-
{
3291-
struct ti_sci_info *info = dev_get_drvdata(dev);
3292-
/*
3293-
* We must switch operation to polled mode now as drivers and the genpd
3294-
* layer may make late TI SCI calls to change clock and device states
3295-
* from the noirq phase of suspend.
3296-
*/
3297-
ti_sci_set_is_suspending(info, true);
3298-
3299-
return 0;
3300-
}
3301-
3302-
static int ti_sci_resume(struct device *dev)
3303-
{
3304-
struct ti_sci_info *info = dev_get_drvdata(dev);
3305-
3306-
ti_sci_set_is_suspending(info, false);
3307-
3308-
return 0;
3309-
}
3310-
3311-
static DEFINE_SIMPLE_DEV_PM_OPS(ti_sci_pm_ops, ti_sci_suspend, ti_sci_resume);
3312-
33133282
/* Description for K2G */
33143283
static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = {
33153284
.default_host_id = 2,
@@ -3516,7 +3485,6 @@ static struct platform_driver ti_sci_driver = {
35163485
.driver = {
35173486
.name = "ti-sci",
35183487
.of_match_table = of_match_ptr(ti_sci_of_match),
3519-
.pm = &ti_sci_pm_ops,
35203488
},
35213489
};
35223490
module_platform_driver(ti_sci_driver);

0 commit comments

Comments
 (0)