Re: [PATCH V6 1/4] firmware: ti_sci: Introduce Power Management Ops

From: Andrew Davis
Date: Thu Aug 03 2023 - 11:57:49 EST


On 8/3/23 10:42 AM, Dhruva Gole wrote:
On Aug 03, 2023 at 10:14:03 -0500, Andrew Davis wrote:
[..snip..]
#define TI_SCI_IRQ_SECONDARY_HOST_INVALID 0xff
/**
diff --git a/include/linux/soc/ti/ti_sci_protocol.h b/include/linux/soc/ti/ti_sci_protocol.h
index bd0d11af76c5..f2d1d74ab8fc 100644
--- a/include/linux/soc/ti/ti_sci_protocol.h
+++ b/include/linux/soc/ti/ti_sci_protocol.h
@@ -195,6 +195,49 @@ struct ti_sci_clk_ops {
u64 *current_freq);
};
+/* TISCI LPM wake up sources */
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_WKUP_I2C0 0x00
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_WKUP_UART0 0x10
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_MCU_GPIO0 0x20
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_WKUP_ICEMELTER0 0x30
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_WKUP_TIMER0 0x40
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_WKUP_TIMER1 0x41
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_WKUP_RTC0 0x50
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_RESET 0x60
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_USB0 0x70
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_USB1 0x71
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_MAIN_IO 0x80
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_MCU_IO 0x81
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_CAN_IO 0x82
+#define TISCI_MSG_VALUE_LPM_WAKE_SOURCE_INVALID 0xFF

I don't see these used in this series, do you need them? lpm_wake_reason()

True, we are not currently using these macros. They _maybe required in
future.
I can remove them if required?

doesn't seem used either and I'm not sure how you plan to use it, could
you detail that?

When the system wakes from suspend-to-mem we can check which
subsystem has woken us up with the TISCI LPM_WAKEUP_REASON message.
There's no hardware event generated and we have to ask the firmware
for the actual wake reason.

We may want to add support for a wake up interrupt controller that will
generate an interrupt for other subsystems. This might end up using this
lpm_wake_reason API, hence even though the function maybe unused today
it will be required for above described scenario.

However if you prefer that I remove it and then add it in future when we
finally write a working interrupt controller driver, then do let me
know.


It's easier to review code that is used. We may go with a
completely different approach by then, will be easier to unwind
this if you don't start with it, only add it when used.

Andrew


Andrew

+
+/* TISCI LPM IO isolation control values */
+#define TISCI_MSG_VALUE_IO_ENABLE 1
+#define TISCI_MSG_VALUE_IO_DISABLE 0
+
[..snip..]