You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a custom board with a power switch that controls a couple of sensors/devices. I'm looking for guidance on the best practices for integrating this power switch without modifying the main Zephyr repository's YAML and source files.
Here is the schematic for the power switches:
DTS Design: What is the recommended DTS design for incorporating the power switch? I want to avoid editing the sensor's YAML file and driver source files, as this approach could lead to extensive changes across various projects and board configurations. Additionally, it would affect the default official Zephyr release, impacting all teams and users.
Driver Implementation: How should I implement the power switch control in the sensor's driver file? Do I need to edit driver files for this support? I know that many sensor drivers use the PM_DEVICE_DT_INST_DEFINE() macro, which allows applications to manage power states by calling pm_device_action_run(device, PM_DEVICE_ACTION_SUSPEND) and pm_device_action_run(device, PM_DEVICE_ACTION_RESUME).
One idea that came into my mind is to create a general power controller source file with a higher initialization priority than any CONFIG_SENSOR_INIT_PRIORITY. This would allow the power controller to turn on the sensors before their initialization begins. However, this approach might not be optimal without directly associating the power switch with the driver instance.
Any recommendations on how to proceed with this implementation would be greatly appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a custom board with a power switch that controls a couple of sensors/devices. I'm looking for guidance on the best practices for integrating this power switch without modifying the main Zephyr repository's YAML and source files.
Here is the schematic for the power switches:
DTS Design: What is the recommended DTS design for incorporating the power switch? I want to avoid editing the sensor's YAML file and driver source files, as this approach could lead to extensive changes across various projects and board configurations. Additionally, it would affect the default official Zephyr release, impacting all teams and users.
Driver Implementation: How should I implement the power switch control in the sensor's driver file? Do I need to edit driver files for this support? I know that many sensor drivers use the PM_DEVICE_DT_INST_DEFINE() macro, which allows applications to manage power states by calling pm_device_action_run(device, PM_DEVICE_ACTION_SUSPEND) and pm_device_action_run(device, PM_DEVICE_ACTION_RESUME).
One idea that came into my mind is to create a general power controller source file with a higher initialization priority than any CONFIG_SENSOR_INIT_PRIORITY. This would allow the power controller to turn on the sensors before their initialization begins. However, this approach might not be optimal without directly associating the power switch with the driver instance.
Any recommendations on how to proceed with this implementation would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions