mfd: rk808: permit having multiple PMIC instances

Message ID 20221025-rk808-multi-v1-0-c07b7cf3fd67@linaro.org
State New
Headers
Series mfd: rk808: permit having multiple PMIC instances |

Commit Message

Neil Armstrong Oct. 25, 2022, 9:54 a.m. UTC
  This set each cells id to -1 to allow multiple instances of
each cell in case multiple PMICs handled by the rk808 driver
are probed.

This fixes probing a RK818 and a RK817 on the Odroid Go Ultra
devices.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
Cc: Lee Jones <lee@kernel.org>
Cc: linux-kernel@vger.kernel.org
---
 drivers/mfd/rk808.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)


---
base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740
change-id: 20221025-rk808-multi-65dd03a92705

Best regards,
  

Comments

Lee Jones Oct. 31, 2022, 3:22 p.m. UTC | #1
On Tue, 25 Oct 2022, Neil Armstrong wrote:

> This set each cells id to -1 to allow multiple instances of
> each cell in case multiple PMICs handled by the rk808 driver
> are probed.
> 
> This fixes probing a RK818 and a RK817 on the Odroid Go Ultra
> devices.

No issue with the premise Neil, but would you be kind enough to use
the define provided (PLATFORM_DEVID_NONE) instead of the magic number
please?

> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
> Cc: Lee Jones <lee@kernel.org>
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/mfd/rk808.c | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> index e00da7c7e3b1..b9cfd249912d 100644
> --- a/drivers/mfd/rk808.c
> +++ b/drivers/mfd/rk808.c
> @@ -137,58 +137,64 @@ static const struct resource rk817_charger_resources[] = {
>  };
>  
>  static const struct mfd_cell rk805s[] = {
> -	{ .name = "rk808-clkout", },
> -	{ .name = "rk808-regulator", },
> -	{ .name = "rk805-pinctrl", },
> +	{ .name = "rk808-clkout", .id = -1, },
> +	{ .name = "rk808-regulator", .id = -1, },
> +	{ .name = "rk805-pinctrl", .id = -1, },
>  	{
>  		.name = "rk808-rtc",
>  		.num_resources = ARRAY_SIZE(rtc_resources),
>  		.resources = &rtc_resources[0],
> +		.id = -1,
>  	},
>  	{	.name = "rk805-pwrkey",
>  		.num_resources = ARRAY_SIZE(rk805_key_resources),
>  		.resources = &rk805_key_resources[0],
> +		.id = -1,
>  	},
>  };
>  
>  static const struct mfd_cell rk808s[] = {
> -	{ .name = "rk808-clkout", },
> -	{ .name = "rk808-regulator", },
> +	{ .name = "rk808-clkout", .id = -1, },
> +	{ .name = "rk808-regulator", .id = -1, },
>  	{
>  		.name = "rk808-rtc",
>  		.num_resources = ARRAY_SIZE(rtc_resources),
>  		.resources = rtc_resources,
> +		.id = -1,
>  	},
>  };
>  
>  static const struct mfd_cell rk817s[] = {
> -	{ .name = "rk808-clkout",},
> -	{ .name = "rk808-regulator",},
> +	{ .name = "rk808-clkout", .id = -1, },
> +	{ .name = "rk808-regulator", .id = -1, },
>  	{
>  		.name = "rk805-pwrkey",
>  		.num_resources = ARRAY_SIZE(rk817_pwrkey_resources),
>  		.resources = &rk817_pwrkey_resources[0],
> +		.id = -1,
>  	},
>  	{
>  		.name = "rk808-rtc",
>  		.num_resources = ARRAY_SIZE(rk817_rtc_resources),
>  		.resources = &rk817_rtc_resources[0],
> +		.id = -1,
>  	},
> -	{ .name = "rk817-codec",},
> +	{ .name = "rk817-codec", .id = -1, },
>  	{
>  		.name = "rk817-charger",
>  		.num_resources = ARRAY_SIZE(rk817_charger_resources),
>  		.resources = &rk817_charger_resources[0],
> +		.id = -1,
>  	},
>  };
>  
>  static const struct mfd_cell rk818s[] = {
> -	{ .name = "rk808-clkout", },
> -	{ .name = "rk808-regulator", },
> +	{ .name = "rk808-regulator", .id = -1, },
>  	{
>  		.name = "rk808-rtc",
>  		.num_resources = ARRAY_SIZE(rtc_resources),
>  		.resources = rtc_resources,
> +		.id = -1,
>  	},
>  };
>  
> 
> ---
> base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740
> change-id: 20221025-rk808-multi-65dd03a92705
> 
> Best regards,
  
Neil Armstrong Oct. 31, 2022, 3:30 p.m. UTC | #2
Hi,

On 31/10/2022 16:22, Lee Jones wrote:
> On Tue, 25 Oct 2022, Neil Armstrong wrote:
> 
>> This set each cells id to -1 to allow multiple instances of
>> each cell in case multiple PMICs handled by the rk808 driver
>> are probed.
>>
>> This fixes probing a RK818 and a RK817 on the Odroid Go Ultra
>> devices.
> 
> No issue with the premise Neil, but would you be kind enough to use
> the define provided (PLATFORM_DEVID_NONE) instead of the magic number
> please?

Sure, will re-spin asap with PLATFORM_DEVID_NONE

Thanks,
Neil

> 
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> ---
>> Cc: Lee Jones <lee@kernel.org>
>> Cc: linux-kernel@vger.kernel.org
>> ---
>>   drivers/mfd/rk808.c | 26 ++++++++++++++++----------
>>   1 file changed, 16 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
>> index e00da7c7e3b1..b9cfd249912d 100644
>> --- a/drivers/mfd/rk808.c
>> +++ b/drivers/mfd/rk808.c
>> @@ -137,58 +137,64 @@ static const struct resource rk817_charger_resources[] = {
>>   };
>>   
>>   static const struct mfd_cell rk805s[] = {
>> -	{ .name = "rk808-clkout", },
>> -	{ .name = "rk808-regulator", },
>> -	{ .name = "rk805-pinctrl", },
>> +	{ .name = "rk808-clkout", .id = -1, },
>> +	{ .name = "rk808-regulator", .id = -1, },
>> +	{ .name = "rk805-pinctrl", .id = -1, },
>>   	{
>>   		.name = "rk808-rtc",
>>   		.num_resources = ARRAY_SIZE(rtc_resources),
>>   		.resources = &rtc_resources[0],
>> +		.id = -1,
>>   	},
>>   	{	.name = "rk805-pwrkey",
>>   		.num_resources = ARRAY_SIZE(rk805_key_resources),
>>   		.resources = &rk805_key_resources[0],
>> +		.id = -1,
>>   	},
>>   };
>>   
>>   static const struct mfd_cell rk808s[] = {
>> -	{ .name = "rk808-clkout", },
>> -	{ .name = "rk808-regulator", },
>> +	{ .name = "rk808-clkout", .id = -1, },
>> +	{ .name = "rk808-regulator", .id = -1, },
>>   	{
>>   		.name = "rk808-rtc",
>>   		.num_resources = ARRAY_SIZE(rtc_resources),
>>   		.resources = rtc_resources,
>> +		.id = -1,
>>   	},
>>   };
>>   
>>   static const struct mfd_cell rk817s[] = {
>> -	{ .name = "rk808-clkout",},
>> -	{ .name = "rk808-regulator",},
>> +	{ .name = "rk808-clkout", .id = -1, },
>> +	{ .name = "rk808-regulator", .id = -1, },
>>   	{
>>   		.name = "rk805-pwrkey",
>>   		.num_resources = ARRAY_SIZE(rk817_pwrkey_resources),
>>   		.resources = &rk817_pwrkey_resources[0],
>> +		.id = -1,
>>   	},
>>   	{
>>   		.name = "rk808-rtc",
>>   		.num_resources = ARRAY_SIZE(rk817_rtc_resources),
>>   		.resources = &rk817_rtc_resources[0],
>> +		.id = -1,
>>   	},
>> -	{ .name = "rk817-codec",},
>> +	{ .name = "rk817-codec", .id = -1, },
>>   	{
>>   		.name = "rk817-charger",
>>   		.num_resources = ARRAY_SIZE(rk817_charger_resources),
>>   		.resources = &rk817_charger_resources[0],
>> +		.id = -1,
>>   	},
>>   };
>>   
>>   static const struct mfd_cell rk818s[] = {
>> -	{ .name = "rk808-clkout", },
>> -	{ .name = "rk808-regulator", },
>> +	{ .name = "rk808-regulator", .id = -1, },
>>   	{
>>   		.name = "rk808-rtc",
>>   		.num_resources = ARRAY_SIZE(rtc_resources),
>>   		.resources = rtc_resources,
>> +		.id = -1,
>>   	},
>>   };
>>   
>>
>> ---
>> base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740
>> change-id: 20221025-rk808-multi-65dd03a92705
>>
>> Best regards,
>
  

Patch

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index e00da7c7e3b1..b9cfd249912d 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -137,58 +137,64 @@  static const struct resource rk817_charger_resources[] = {
 };
 
 static const struct mfd_cell rk805s[] = {
-	{ .name = "rk808-clkout", },
-	{ .name = "rk808-regulator", },
-	{ .name = "rk805-pinctrl", },
+	{ .name = "rk808-clkout", .id = -1, },
+	{ .name = "rk808-regulator", .id = -1, },
+	{ .name = "rk805-pinctrl", .id = -1, },
 	{
 		.name = "rk808-rtc",
 		.num_resources = ARRAY_SIZE(rtc_resources),
 		.resources = &rtc_resources[0],
+		.id = -1,
 	},
 	{	.name = "rk805-pwrkey",
 		.num_resources = ARRAY_SIZE(rk805_key_resources),
 		.resources = &rk805_key_resources[0],
+		.id = -1,
 	},
 };
 
 static const struct mfd_cell rk808s[] = {
-	{ .name = "rk808-clkout", },
-	{ .name = "rk808-regulator", },
+	{ .name = "rk808-clkout", .id = -1, },
+	{ .name = "rk808-regulator", .id = -1, },
 	{
 		.name = "rk808-rtc",
 		.num_resources = ARRAY_SIZE(rtc_resources),
 		.resources = rtc_resources,
+		.id = -1,
 	},
 };
 
 static const struct mfd_cell rk817s[] = {
-	{ .name = "rk808-clkout",},
-	{ .name = "rk808-regulator",},
+	{ .name = "rk808-clkout", .id = -1, },
+	{ .name = "rk808-regulator", .id = -1, },
 	{
 		.name = "rk805-pwrkey",
 		.num_resources = ARRAY_SIZE(rk817_pwrkey_resources),
 		.resources = &rk817_pwrkey_resources[0],
+		.id = -1,
 	},
 	{
 		.name = "rk808-rtc",
 		.num_resources = ARRAY_SIZE(rk817_rtc_resources),
 		.resources = &rk817_rtc_resources[0],
+		.id = -1,
 	},
-	{ .name = "rk817-codec",},
+	{ .name = "rk817-codec", .id = -1, },
 	{
 		.name = "rk817-charger",
 		.num_resources = ARRAY_SIZE(rk817_charger_resources),
 		.resources = &rk817_charger_resources[0],
+		.id = -1,
 	},
 };
 
 static const struct mfd_cell rk818s[] = {
-	{ .name = "rk808-clkout", },
-	{ .name = "rk808-regulator", },
+	{ .name = "rk808-regulator", .id = -1, },
 	{
 		.name = "rk808-rtc",
 		.num_resources = ARRAY_SIZE(rtc_resources),
 		.resources = rtc_resources,
+		.id = -1,
 	},
 };