GUI e7cddf3a52
[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>
2024-05-30 15:30:40 +08:00

62 lines
1.4 KiB
C

/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-04-12 ErikChan the first version
* 2023-10-13 zmshahaha distinguish ofw and none-ofw situation
*/
#ifndef __PLATFORM_H__
#define __PLATFORM_H__
#ifdef RT_USING_OFW
#include <drivers/ofw.h>
#endif
#include <drivers/core/driver.h>
struct rt_platform_device
{
struct rt_device parent;
int dev_id;
const char *name;
#ifdef RT_USING_OFW
const struct rt_ofw_node_id *id;
#endif
void *priv;
};
struct rt_platform_driver
{
struct rt_driver parent;
const char *name;
#ifdef RT_USING_OFW
const struct rt_ofw_node_id *ids;
#endif
rt_err_t (*probe)(struct rt_platform_device *pdev);
rt_err_t (*remove)(struct rt_platform_device *pdev);
rt_err_t (*shutdown)(struct rt_platform_device *pdev);
};
struct rt_platform_device *rt_platform_device_alloc(const char *name);
rt_err_t rt_platform_driver_register(struct rt_platform_driver *pdrv);
rt_err_t rt_platform_device_register(struct rt_platform_device *pdev);
rt_err_t rt_platform_ofw_device_probe_child(struct rt_ofw_node *np);
rt_err_t rt_platform_ofw_free(struct rt_platform_device *pdev);
#define RT_PLATFORM_DRIVER_EXPORT(driver) RT_DRIVER_EXPORT(driver, platform, BUILIN)
#endif /* __PLATFORM_H__ */