Re: [PATCH v2 13/17] power: supply: olpc_battery: Use DT to get battery version

2019-01-07 Thread Lubomir Rintel
On Wed, 2018-12-05 at 21:54 +0100, Sebastian Reichel wrote:
> Hi,
> 
> On Fri, Nov 16, 2018 at 05:23:59PM +0100, Lubomir Rintel wrote:
> > Avoid using the x86 OLPC platform specific call to get the board
> > version. It won't work on FDT-based ARM MMP2 platform.
> > 
> > Signed-off-by: Lubomir Rintel 
> > Reviewed-by: Andy Shevchenko 
> > Acked-by: Pavel Machek 
> > 
> > ---
> 
> Reviewed-by: Sebastian Reichel 
> 
> I assume this patch cannot be applied to power-supply without patch
> 12 having been merged to avoid breaking XO1.5 devices temporarily?

That is true. What's the correct way to deal with a situation like
this? Just hold the patch until the other changes get in, perhaps via
linux-platform-drivers-x86.git? Or maybe this can go in together via
that tree along with the other patches?

Thanks
Lubo

> -- Sebastian
> 
> > Changes since v1:
> > - Sort the new include a bit higher
> > 
> >  drivers/power/supply/olpc_battery.c | 10 +++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/power/supply/olpc_battery.c
> > b/drivers/power/supply/olpc_battery.c
> > index 5a97e42a3547..5323987d9284 100644
> > --- a/drivers/power/supply/olpc_battery.c
> > +++ b/drivers/power/supply/olpc_battery.c
> > @@ -14,6 +14,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -622,11 +623,13 @@ static int olpc_battery_probe(struct
> > platform_device *pdev)
> > olpc_ac = power_supply_register(&pdev->dev, &olpc_ac_desc,
> > NULL);
> > if (IS_ERR(olpc_ac))
> > return PTR_ERR(olpc_ac);
> > -
> > -   if (olpc_board_at_least(olpc_board_pre(0xd0))) { /* XO-1.5 */
> > +   if (of_property_match_string(pdev->dev.of_node, "compatible",
> > +   "olpc,xo1.5-battery") >= 0) {
> > +   /* XO-1.5 */
> > olpc_bat_desc.properties = olpc_xo15_bat_props;
> > olpc_bat_desc.num_properties =
> > ARRAY_SIZE(olpc_xo15_bat_props);
> > -   } else { /* XO-1 */
> > +   } else {
> > +   /* XO-1 */
> > olpc_bat_desc.properties = olpc_xo1_bat_props;
> > olpc_bat_desc.num_properties =
> > ARRAY_SIZE(olpc_xo1_bat_props);
> > }
> > @@ -672,6 +675,7 @@ static int olpc_battery_remove(struct
> > platform_device *pdev)
> >  
> >  static const struct of_device_id olpc_battery_ids[] = {
> > { .compatible = "olpc,xo1-battery" },
> > +   { .compatible = "olpc,xo1.5-battery" },
> > {}
> >  };
> >  MODULE_DEVICE_TABLE(of, olpc_battery_ids);
> > -- 
> > 2.19.1
> > 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 13/17] power: supply: olpc_battery: Use DT to get battery version

2018-12-05 Thread Sebastian Reichel
Hi,

On Fri, Nov 16, 2018 at 05:23:59PM +0100, Lubomir Rintel wrote:
> Avoid using the x86 OLPC platform specific call to get the board
> version. It won't work on FDT-based ARM MMP2 platform.
> 
> Signed-off-by: Lubomir Rintel 
> Reviewed-by: Andy Shevchenko 
> Acked-by: Pavel Machek 
> 
> ---

Reviewed-by: Sebastian Reichel 

I assume this patch cannot be applied to power-supply without patch
12 having been merged to avoid breaking XO1.5 devices temporarily?

-- Sebastian

> Changes since v1:
> - Sort the new include a bit higher
> 
>  drivers/power/supply/olpc_battery.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/supply/olpc_battery.c 
> b/drivers/power/supply/olpc_battery.c
> index 5a97e42a3547..5323987d9284 100644
> --- a/drivers/power/supply/olpc_battery.c
> +++ b/drivers/power/supply/olpc_battery.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -622,11 +623,13 @@ static int olpc_battery_probe(struct platform_device 
> *pdev)
>   olpc_ac = power_supply_register(&pdev->dev, &olpc_ac_desc, NULL);
>   if (IS_ERR(olpc_ac))
>   return PTR_ERR(olpc_ac);
> -
> - if (olpc_board_at_least(olpc_board_pre(0xd0))) { /* XO-1.5 */
> + if (of_property_match_string(pdev->dev.of_node, "compatible",
> + "olpc,xo1.5-battery") >= 0) {
> + /* XO-1.5 */
>   olpc_bat_desc.properties = olpc_xo15_bat_props;
>   olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo15_bat_props);
> - } else { /* XO-1 */
> + } else {
> + /* XO-1 */
>   olpc_bat_desc.properties = olpc_xo1_bat_props;
>   olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
>   }
> @@ -672,6 +675,7 @@ static int olpc_battery_remove(struct platform_device 
> *pdev)
>  
>  static const struct of_device_id olpc_battery_ids[] = {
>   { .compatible = "olpc,xo1-battery" },
> + { .compatible = "olpc,xo1.5-battery" },
>   {}
>  };
>  MODULE_DEVICE_TABLE(of, olpc_battery_ids);
> -- 
> 2.19.1
> 


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 13/17] power: supply: olpc_battery: Use DT to get battery version

2018-12-02 Thread Darren Hart
On Fri, Nov 16, 2018 at 05:23:59PM +0100, Lubomir Rintel wrote:
> Avoid using the x86 OLPC platform specific call to get the board
> version. It won't work on FDT-based ARM MMP2 platform.
> 
> Signed-off-by: Lubomir Rintel 
> Reviewed-by: Andy Shevchenko 
> Acked-by: Pavel Machek 
> 
> ---
> Changes since v1:
> - Sort the new include a bit higher
> 
>  drivers/power/supply/olpc_battery.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/supply/olpc_battery.c 
> b/drivers/power/supply/olpc_battery.c
> index 5a97e42a3547..5323987d9284 100644
> --- a/drivers/power/supply/olpc_battery.c
> +++ b/drivers/power/supply/olpc_battery.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -622,11 +623,13 @@ static int olpc_battery_probe(struct platform_device 
> *pdev)
>   olpc_ac = power_supply_register(&pdev->dev, &olpc_ac_desc, NULL);
>   if (IS_ERR(olpc_ac))
>   return PTR_ERR(olpc_ac);
> -
> - if (olpc_board_at_least(olpc_board_pre(0xd0))) { /* XO-1.5 */
> + if (of_property_match_string(pdev->dev.of_node, "compatible",
> + "olpc,xo1.5-battery") >= 0) {
> + /* XO-1.5 */
>   olpc_bat_desc.properties = olpc_xo15_bat_props;
>   olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo15_bat_props);
> - } else { /* XO-1 */
> + } else {
> + /* XO-1 */
>   olpc_bat_desc.properties = olpc_xo1_bat_props;
>   olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
>   }
> @@ -672,6 +675,7 @@ static int olpc_battery_remove(struct platform_device 
> *pdev)
>  
>  static const struct of_device_id olpc_battery_ids[] = {
>   { .compatible = "olpc,xo1-battery" },
> + { .compatible = "olpc,xo1.5-battery" },

The code previously supported xo1.5 (it seems), and the commit message doesn't
mention changing the compatible string. Was this an intentional change? If so,
it should be mentioned in the commit message.

>   {}
>  };
>  MODULE_DEVICE_TABLE(of, olpc_battery_ids);
> -- 
> 2.19.1
> 
> 

-- 
Darren Hart
VMware Open Source Technology Center
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 13/17] power: supply: olpc_battery: Use DT to get battery version

2018-11-16 Thread Lubomir Rintel
Avoid using the x86 OLPC platform specific call to get the board
version. It won't work on FDT-based ARM MMP2 platform.

Signed-off-by: Lubomir Rintel 
Reviewed-by: Andy Shevchenko 
Acked-by: Pavel Machek 

---
Changes since v1:
- Sort the new include a bit higher

 drivers/power/supply/olpc_battery.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/power/supply/olpc_battery.c 
b/drivers/power/supply/olpc_battery.c
index 5a97e42a3547..5323987d9284 100644
--- a/drivers/power/supply/olpc_battery.c
+++ b/drivers/power/supply/olpc_battery.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -622,11 +623,13 @@ static int olpc_battery_probe(struct platform_device 
*pdev)
olpc_ac = power_supply_register(&pdev->dev, &olpc_ac_desc, NULL);
if (IS_ERR(olpc_ac))
return PTR_ERR(olpc_ac);
-
-   if (olpc_board_at_least(olpc_board_pre(0xd0))) { /* XO-1.5 */
+   if (of_property_match_string(pdev->dev.of_node, "compatible",
+   "olpc,xo1.5-battery") >= 0) {
+   /* XO-1.5 */
olpc_bat_desc.properties = olpc_xo15_bat_props;
olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo15_bat_props);
-   } else { /* XO-1 */
+   } else {
+   /* XO-1 */
olpc_bat_desc.properties = olpc_xo1_bat_props;
olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
}
@@ -672,6 +675,7 @@ static int olpc_battery_remove(struct platform_device *pdev)
 
 static const struct of_device_id olpc_battery_ids[] = {
{ .compatible = "olpc,xo1-battery" },
+   { .compatible = "olpc,xo1.5-battery" },
{}
 };
 MODULE_DEVICE_TABLE(of, olpc_battery_ids);
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel