X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fpower-domain.h;h=2ff6c77cd765fe3791b8939d96c1c6abfb9f69b6;hb=6786ce1ce14feb4d02854a0c04bc0cce505be46e;hp=a558fbbdb21ab87b7465188875c66d3195a0cfc4;hpb=63d54c9c598079d3f30efb9e71be8fe5345a451d;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/power-domain.h b/include/power-domain.h index a558fbb..2ff6c77 100644 --- a/include/power-domain.h +++ b/include/power-domain.h @@ -55,23 +55,12 @@ struct udevice; * * @dev: The device which implements the power domain. * @id: The power domain ID within the provider. - * - * Currently, the power domain API assumes that a single integer ID is enough - * to identify and configure any power domain for any power domain provider. If - * this assumption becomes invalid in the future, the struct could be expanded - * to either (a) add more fields to allow power domain providers to store - * additional information, or (b) replace the id field with an opaque pointer, - * which the provider would dynamically allocate during its .of_xlate op, and - * process during is .request op. This may require the addition of an extra op - * to clean up the allocation. + * @priv: Private data corresponding to each power domain. */ struct power_domain { struct udevice *dev; - /* - * Written by of_xlate. We assume a single id is enough for now. In the - * future, we might add more fields here. - */ unsigned long id; + void *priv; }; /** @@ -85,7 +74,7 @@ struct power_domain { * * @dev: The client device. * @power_domain A pointer to a power domain struct to initialize. - * @return 0 if OK, or a negative error code. + * Return: 0 if OK, or a negative error code. */ #if CONFIG_IS_ENABLED(POWER_DOMAIN) int power_domain_get(struct udevice *dev, struct power_domain *power_domain); @@ -98,11 +87,53 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain) #endif /** + * power_domain_get_by_index - Get the indexed power domain for a device. + * + * @dev: The client device. + * @power_domain: A pointer to a power domain struct to initialize. + * @index: Power domain index to be powered on. + * + * Return: 0 if OK, or a negative error code. + */ +#if CONFIG_IS_ENABLED(POWER_DOMAIN) +int power_domain_get_by_index(struct udevice *dev, + struct power_domain *power_domain, int index); +#else +static inline +int power_domain_get_by_index(struct udevice *dev, + struct power_domain *power_domain, int index) +{ + return -ENOSYS; +} +#endif + +/** + * power_domain_get_by_name - Get the named power domain for a device. + * + * @dev: The client device. + * @power_domain: A pointer to a power domain struct to initialize. + * @name: Power domain name to be powered on. + * + * Return: 0 if OK, or a negative error code. + */ +#if CONFIG_IS_ENABLED(POWER_DOMAIN) +int power_domain_get_by_name(struct udevice *dev, + struct power_domain *power_domain, const char *name); +#else +static inline +int power_domain_get_by_name(struct udevice *dev, + struct power_domain *power_domain, const char *name) +{ + return -ENOSYS; +} +#endif + +/** * power_domain_free - Free a previously requested power domain. * * @power_domain: A power domain struct that was previously successfully * requested by power_domain_get(). - * @return 0 if OK, or a negative error code. + * Return: 0 if OK, or a negative error code. */ #if CONFIG_IS_ENABLED(POWER_DOMAIN) int power_domain_free(struct power_domain *power_domain); @@ -118,7 +149,7 @@ static inline int power_domain_free(struct power_domain *power_domain) * * @power_domain: A power domain struct that was previously successfully * requested by power_domain_get(). - * @return 0 if OK, or a negative error code. + * Return: 0 if OK, or a negative error code. */ #if CONFIG_IS_ENABLED(POWER_DOMAIN) int power_domain_on(struct power_domain *power_domain); @@ -130,11 +161,11 @@ static inline int power_domain_on(struct power_domain *power_domain) #endif /** - * power_domain_off - Disable power ot a power domain. + * power_domain_off - Disable power to a power domain. * * @power_domain: A power domain struct that was previously successfully * requested by power_domain_get(). - * @return 0 if OK, or a negative error code. + * Return: 0 if OK, or a negative error code. */ #if CONFIG_IS_ENABLED(POWER_DOMAIN) int power_domain_off(struct power_domain *power_domain); @@ -145,4 +176,36 @@ static inline int power_domain_off(struct power_domain *power_domain) } #endif +/** + * dev_power_domain_on - Enable power domains for a device . + * + * @dev: The client device. + * + * Return: 0 if OK, or a negative error code. + */ +#if CONFIG_IS_ENABLED(OF_REAL) && CONFIG_IS_ENABLED(POWER_DOMAIN) +int dev_power_domain_on(struct udevice *dev); +#else +static inline int dev_power_domain_on(struct udevice *dev) +{ + return 0; +} +#endif + +/** + * dev_power_domain_off - Disable power domains for a device . + * + * @dev: The client device. + * + * Return: 0 if OK, or a negative error code. + */ +#if CONFIG_IS_ENABLED(OF_REAL) && CONFIG_IS_ENABLED(POWER_DOMAIN) +int dev_power_domain_off(struct udevice *dev); +#else +static inline int dev_power_domain_off(struct udevice *dev) +{ + return 0; +} +#endif + #endif