mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-29 02:20:21 +00:00
[Feature] Support simple power domain API (#9005)
* [Feature] Power domain for device 1.Support device power on/off. 2.Support attach/detach device. 3.Support power domain driver api. Signed-off-by: GuEe-GUI <2991707448@qq.com> * [DM/platform] Enhanced platform bus 1.Add power domain for device. 2.Support `remove` and `shutdown` bus interface. Signed-off-by: GuEe-GUI <2991707448@qq.com> --------- Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
@@ -92,9 +92,7 @@ static struct rt_platform_device *alloc_ofw_platform_device(struct rt_ofw_node *
|
||||
rt_ofw_node_get(np);
|
||||
rt_ofw_node_set_flag(np, RT_OFW_F_PLATFORM);
|
||||
|
||||
#ifdef RT_USING_OFW
|
||||
pdev->parent.ofw_node = np;
|
||||
#endif
|
||||
|
||||
ofw_device_rename(&pdev->parent);
|
||||
}
|
||||
@@ -232,3 +230,27 @@ static int platform_ofw_device_probe(void)
|
||||
return (int)err;
|
||||
}
|
||||
INIT_PLATFORM_EXPORT(platform_ofw_device_probe);
|
||||
|
||||
rt_err_t rt_platform_ofw_free(struct rt_platform_device *pdev)
|
||||
{
|
||||
rt_err_t err = RT_EOK;
|
||||
|
||||
if (pdev)
|
||||
{
|
||||
struct rt_ofw_node *np = pdev->parent.ofw_node;
|
||||
|
||||
if (np)
|
||||
{
|
||||
rt_ofw_node_clear_flag(np, RT_OFW_F_PLATFORM);
|
||||
rt_ofw_node_put(np);
|
||||
|
||||
pdev->parent.ofw_node = RT_NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = -RT_EINVAL;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user