diff mbox series

[v3,11/12] opp: Handle missing OPP table in dev_pm_opp_xlate_performance_state()

Message ID 20210118005524.27787-12-digetx@gmail.com (mailing list archive)
State New
Delegated to: viresh kumar
Headers show
Series OPP API fixes and improvements | expand

Commit Message

Dmitry Osipenko Jan. 18, 2021, 12:55 a.m. UTC
NVIDIA Tegra SoCs have a power domains topology such that child domains
only clamp a power rail, while parent domain controls shared performance
state of the multiple child domains. In this case child's domain doesn't
need to have OPP table. Hence we want to allow children power domains to
pass performance state to the parent domain if child's domain doesn't have
OPP table.

The dev_pm_opp_xlate_performance_state() gets src_table=NULL if a child
power domain doesn't have OPP table and in this case we should pass the
performance state to the parent domain.

Tested-by: Peter Geis <pgwipeout@gmail.com>
Tested-by: Nicolas Chauvet <kwizart@gmail.com>
Tested-by: Matt Merhar <mattmerhar@protonmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Viresh Kumar Jan. 18, 2021, 11:18 a.m. UTC | #1
On 18-01-21, 03:55, Dmitry Osipenko wrote:
> NVIDIA Tegra SoCs have a power domains topology such that child domains
> only clamp a power rail, while parent domain controls shared performance
> state of the multiple child domains. In this case child's domain doesn't
> need to have OPP table. Hence we want to allow children power domains to
> pass performance state to the parent domain if child's domain doesn't have
> OPP table.
> 
> The dev_pm_opp_xlate_performance_state() gets src_table=NULL if a child
> power domain doesn't have OPP table and in this case we should pass the
> performance state to the parent domain.
> 
> Tested-by: Peter Geis <pgwipeout@gmail.com>
> Tested-by: Nicolas Chauvet <kwizart@gmail.com>
> Tested-by: Matt Merhar <mattmerhar@protonmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/opp/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 7726c4c40b53..ca8c6acc29f4 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -2419,7 +2419,7 @@ int dev_pm_opp_xlate_performance_state(struct opp_table *src_table,
>  	 * and so none of them have the "required-opps" property set. Return the
>  	 * pstate of the src_table as it is in such cases.
>  	 */
> -	if (!src_table->required_opp_count)
> +	if (!src_table || !src_table->required_opp_count)
>  		return pstate;
>  
>  	for (i = 0; i < src_table->required_opp_count; i++) {

Applied. Thanks.
diff mbox series

Patch

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 7726c4c40b53..ca8c6acc29f4 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -2419,7 +2419,7 @@  int dev_pm_opp_xlate_performance_state(struct opp_table *src_table,
 	 * and so none of them have the "required-opps" property set. Return the
 	 * pstate of the src_table as it is in such cases.
 	 */
-	if (!src_table->required_opp_count)
+	if (!src_table || !src_table->required_opp_count)
 		return pstate;
 
 	for (i = 0; i < src_table->required_opp_count; i++) {