Re: [RFC 1/3] power_supply: Define Binding for supplied-nodes

2013-02-17 Thread Rajanikanth HV

On Sunday 17 February 2013 04:08 AM, Anton Vorontsov wrote:
[...]
> 
> "supplied nodes" sounds confusing (doesn't reflect direction), IMO. I'd
> rather call it power-supply,supplied-to = <_battery>;
> 
> But... I'm recalling there was a similar discussion not that long ago, and
> Arnd came up with the idea that supplied-to is not fully in spirit of DT,
> and proposed his view of proper bindings. Please find the discussion here:
> 
>   http://lkml.org/lkml/2012/9/14/104
'supplied-to or supplied nodes' is specific to "power-supply core and
battery managed devices/drivers" and not platform specific.
Dependent battery drivers interacts/shares power supply events with the
help of 'supplied_to' 'num_supplicants' and external_power_changed(...)
identifiers which are defined and fixed during driver design, it will be
more meaningful to have it internal to drivers instead DT.
Ref: ab8500_[fg,btemp,charger].c, abx500_chargalg.c and
arch/arm/boot/dts/dbx5x0.dtsi


Thanks,
Rajanikanth
[...]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 1/3] power_supply: Define Binding for supplied-nodes

2013-02-17 Thread Rajanikanth HV

On Sunday 17 February 2013 04:08 AM, Anton Vorontsov wrote:
[...]
 
 supplied nodes sounds confusing (doesn't reflect direction), IMO. I'd
 rather call it power-supply,supplied-to = some_battery;
 
 But... I'm recalling there was a similar discussion not that long ago, and
 Arnd came up with the idea that supplied-to is not fully in spirit of DT,
 and proposed his view of proper bindings. Please find the discussion here:
 
   http://lkml.org/lkml/2012/9/14/104
'supplied-to or supplied nodes' is specific to power-supply core and
battery managed devices/drivers and not platform specific.
Dependent battery drivers interacts/shares power supply events with the
help of 'supplied_to' 'num_supplicants' and external_power_changed(...)
identifiers which are defined and fixed during driver design, it will be
more meaningful to have it internal to drivers instead DT.
Ref: ab8500_[fg,btemp,charger].c, abx500_chargalg.c and
arch/arm/boot/dts/dbx5x0.dtsi


Thanks,
Rajanikanth
[...]
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH Resend V2] dt: add helper function to read u8 & u16 variables & arrays

2012-11-18 Thread Rajanikanth HV
On 19 November 2012 12:00, Viresh Kumar  wrote:
> Firstly you tried square braces [ ], I am not sure if that is allowed.
> Can you point me to the specification?
http://www.devicetree.org/Device_Tree_Usage
"
a-byte-data-property = [0x01 0x23 0x34 0x56];
"
>
> And simply passing 0x50, 0x60 etc.. will make them u32 instead of
> u8. i.e. they will be stored as 0x0050, etc.
>
> --
> viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH Resend V2] dt: add helper function to read u8 & u16 variables & arrays

2012-11-18 Thread Rajanikanth HV
On 19 November 2012 09:24, Viresh Kumar  wrote:
> On 12 November 2012 09:03, Viresh Kumar  wrote:
>> On 12 November 2012 01:12, Rob Herring  wrote:
>>> I don't think the size is stored in the dtb. It is only in the dts. You
>>> need to define the size in the binding definitions and use '/bits/'
>>> annotation. With this the data is packed. Then the array function used
>>> should match what the binding defines.
>
> Hi Rob,
>
> Can you please help me in getting the correct format to do this from dts.
> I tried:
>
> data1 = /bits/ 8 <0x50 0x60 0x70>;
as per spec, format for data byte defines will be:
data1 = [ 0x50 0x60 0x70 ];
however, i see a parse error from device tree compiler when i tried.
>
> as written in your earlier mail... but it didn't worked. Tried to
> search too, but
> couldn't find it.
>
> ___
> linaro-dev mailing list
> linaro-...@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] Implement device tree support for ab8500 BM Devices

2012-11-18 Thread Rajanikanth HV
> On 19 November 2012 09:16, Anton Vorontsov  wrote:
> (But I'm bouncing the patches to Samuel and Mark anyway, jfyi.)
>
> p.s.
>
> FWIW, I fixed these warnings.
>
>   CHECK   drivers/power/ab8500_bmdata.c
> drivers/power/ab8500_bmdata.c:146:23: warning: symbol 
> 'temp_to_batres_tbl_thermistor' was not declared. Should it be static?
> drivers/power/ab8500_bmdata.c:160:23: warning: symbol 
> 'temp_to_batres_tbl_ext_thermistor' was not declared. Should it be static?
> drivers/power/ab8500_bmdata.c:171:23: warning: symbol 
> 'temp_to_batres_tbl_9100' was not declared. Should it be static?
> drivers/power/ab8500_bmdata.c:181:28: warning: symbol 'bat_type_thermistor' 
> was not declared. Should it be static?
> drivers/power/ab8500_bmdata.c:267:28: warning: symbol 
> 'bat_type_ext_thermistor' was not declared. Should it be static?
>
> Plus fixed a few stylistic issues.

thanks anton for validating my patch, you seems to have older version
of patch set,
i am rebasing  new version of patch set to 3.7-rc5, will communicate asap.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] Implement device tree support for ab8500 BM Devices

2012-11-18 Thread Rajanikanth HV
 On 19 November 2012 09:16, Anton Vorontsov anton.voront...@linaro.org wrote:
 (But I'm bouncing the patches to Samuel and Mark anyway, jfyi.)

 p.s.

 FWIW, I fixed these warnings.

   CHECK   drivers/power/ab8500_bmdata.c
 drivers/power/ab8500_bmdata.c:146:23: warning: symbol 
 'temp_to_batres_tbl_thermistor' was not declared. Should it be static?
 drivers/power/ab8500_bmdata.c:160:23: warning: symbol 
 'temp_to_batres_tbl_ext_thermistor' was not declared. Should it be static?
 drivers/power/ab8500_bmdata.c:171:23: warning: symbol 
 'temp_to_batres_tbl_9100' was not declared. Should it be static?
 drivers/power/ab8500_bmdata.c:181:28: warning: symbol 'bat_type_thermistor' 
 was not declared. Should it be static?
 drivers/power/ab8500_bmdata.c:267:28: warning: symbol 
 'bat_type_ext_thermistor' was not declared. Should it be static?

 Plus fixed a few stylistic issues.

thanks anton for validating my patch, you seems to have older version
of patch set,
i am rebasing  new version of patch set to 3.7-rc5, will communicate asap.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH Resend V2] dt: add helper function to read u8 u16 variables arrays

2012-11-18 Thread Rajanikanth HV
On 19 November 2012 09:24, Viresh Kumar viresh.ku...@linaro.org wrote:
 On 12 November 2012 09:03, Viresh Kumar viresh.ku...@linaro.org wrote:
 On 12 November 2012 01:12, Rob Herring robherri...@gmail.com wrote:
 I don't think the size is stored in the dtb. It is only in the dts. You
 need to define the size in the binding definitions and use '/bits/'
 annotation. With this the data is packed. Then the array function used
 should match what the binding defines.

 Hi Rob,

 Can you please help me in getting the correct format to do this from dts.
 I tried:

 data1 = /bits/ 8 0x50 0x60 0x70;
as per spec, format for data byte defines will be:
data1 = [ 0x50 0x60 0x70 ];
however, i see a parse error from device tree compiler when i tried.

 as written in your earlier mail... but it didn't worked. Tried to
 search too, but
 couldn't find it.

 ___
 linaro-dev mailing list
 linaro-...@lists.linaro.org
 http://lists.linaro.org/mailman/listinfo/linaro-dev
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH Resend V2] dt: add helper function to read u8 u16 variables arrays

2012-11-18 Thread Rajanikanth HV
On 19 November 2012 12:00, Viresh Kumar viresh.ku...@linaro.org wrote:
 Firstly you tried square braces [ ], I am not sure if that is allowed.
 Can you point me to the specification?
http://www.devicetree.org/Device_Tree_Usage

a-byte-data-property = [0x01 0x23 0x34 0x56];


 And simply passing 0x50, 0x60 etc.. will make them u32 instead of
 u8. i.e. they will be stored as 0x0050, etc.

 --
 viresh
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge

2012-11-15 Thread Rajanikanth HV


On Saturday 10 November 2012 10:23 PM, Francesco Lavra wrote:
>>> I don't get the point of declaring the char array and copying the string
>>> in it, when you could simply use just the pointer returned by
>>> of_get_property().
>>
>> I am considering a corner case where in 'battery-type' property is not
>> present and battery is connected.In this case i promote battery to
>> UNKNOWN from null.
> 
> You could achieve the same result without using the char array, with
> this assignment:
> 
> btech = "UNKNOWN";
> 
>> FYI: Further, btemp driver will identify the connected battery based on
>> resistance value and decide to use.
>> Ref: ab8500_btemp_id(...) ab8500_btemp.c
>>
>>> Anyway, if the string property is longer than 8 characters, you are
>>> writing past the size of the destination array.
>>
>> i believe it is safe as power_supply.h comprises defines having battery
>> technology type in 4 characters length which is normally the case and
>> 7 chars length being "UNKNOWN" seldom referred
> 
> You should be able to handle whatever the device tree contains, and if
> it contains unexpected data this is not a good excuse for locking up the
> system.
agreed, if we were to go by what device tree contains then explicit
assignment for battery type as "UNKNOWN" is not required, hence only 2
use case persist as :
a) property name with one of the said value be present
(as per documentation)
b) property name not present
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge

2012-11-15 Thread Rajanikanth HV


On Saturday 10 November 2012 10:23 PM, Francesco Lavra wrote:
 I don't get the point of declaring the char array and copying the string
 in it, when you could simply use just the pointer returned by
 of_get_property().

 I am considering a corner case where in 'battery-type' property is not
 present and battery is connected.In this case i promote battery to
 UNKNOWN from null.
 
 You could achieve the same result without using the char array, with
 this assignment:
 
 btech = UNKNOWN;
 
 FYI: Further, btemp driver will identify the connected battery based on
 resistance value and decide to use.
 Ref: ab8500_btemp_id(...) ab8500_btemp.c

 Anyway, if the string property is longer than 8 characters, you are
 writing past the size of the destination array.

 i believe it is safe as power_supply.h comprises defines having battery
 technology type in 4 characters length which is normally the case and
 7 chars length being UNKNOWN seldom referred
 
 You should be able to handle whatever the device tree contains, and if
 it contains unexpected data this is not a good excuse for locking up the
 system.
agreed, if we were to go by what device tree contains then explicit
assignment for battery type as UNKNOWN is not required, hence only 2
use case persist as :
a) property name with one of the said value be present
(as per documentation)
b) property name not present
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge

2012-10-27 Thread Rajanikanth HV
On 27 October 2012 20:37, Francesco Lavra  wrote:
> On 10/25/2012 08:30 AM, Rajanikanth H.V wrote:
>> From: "Rajanikanth H.V" 
>> + bat_tech = of_get_property(np_bat_supply,
>> + "stericsson,battery-type", NULL);
>> + if (!bat_tech)
>> + dev_warn(dev, "missing property battery-name/type\n");
>> +
>> + if (strncmp(bat_tech, "LION", 4) == 0) {
>
> What if bat_tech is NULL?
It will be UNKNOWN
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge

2012-10-27 Thread Rajanikanth HV
On 27 October 2012 20:37, Francesco Lavra francescolavra...@gmail.com wrote:
 On 10/25/2012 08:30 AM, Rajanikanth H.V wrote:
 From: Rajanikanth H.V rajanikanth...@stericsson.com
 + bat_tech = of_get_property(np_bat_supply,
 + stericsson,battery-type, NULL);
 + if (!bat_tech)
 + dev_warn(dev, missing property battery-name/type\n);
 +
 + if (strncmp(bat_tech, LION, 4) == 0) {

 What if bat_tech is NULL?
It will be UNKNOWN
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge

2012-10-01 Thread Rajanikanth HV
did you have a look at arnd and anton comments regarding
'supplied-to' and boolean property

On Monday 01 October 2012 03:19 PM, Lee Jones wrote:
> On Mon, 01 Oct 2012, Rajanikanth H.V wrote:
> 
>> From: "Rajanikanth H.V" 
>>
>> - This patch adds device tree support for fuelguage driver
>> - optimize bm devices platform_data usage and of_probe(...)
>>   Note: of_probe() routine for battery managed devices is made
>>   common across all bm drivers.
>>
>> Signed-off-by: Rajanikanth H.V 
>> ---
>>  Documentation/devicetree/bindings/mfd/ab8500.txt   |8 +-
>>  .../devicetree/bindings/power_supply/ab8500/fg.txt |   86 +++
>>  arch/arm/boot/dts/dbx5x0.dtsi  |   22 +-
>>  drivers/mfd/ab8500-core.c  |1 +
>>  drivers/power/Makefile |2 +-
>>  drivers/power/ab8500_bmdata.c  |  549 
>> 
>>  drivers/power/ab8500_btemp.c   |4 +-
>>  drivers/power/ab8500_charger.c |4 +-
>>  drivers/power/ab8500_fg.c  |   76 ++-
>>  drivers/power/abx500_chargalg.c|4 +-
>>  include/linux/mfd/abx500.h |   37 +-
>>  include/linux/mfd/abx500/ab8500-bm.h   |7 +
>>  12 files changed, 744 insertions(+), 56 deletions(-)
>>  create mode 100644 
>> Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
>>  create mode 100644 drivers/power/ab8500_bmdata.c
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt 
>> b/Documentation/devicetree/bindings/mfd/ab8500.txt
>> index ce83c8d..762dc11 100644
>> --- a/Documentation/devicetree/bindings/mfd/ab8500.txt
>> +++ b/Documentation/devicetree/bindings/mfd/ab8500.txt
>> @@ -24,7 +24,13 @@ ab8500-bm:  : 
>>  : Battery Manager
>>  ab8500-btemp :  :  : Battery 
>> Temperature
>>  ab8500-charger   :  :  : Battery 
>> Charger
>>  ab8500-codec :  :  : Audio Codec
>> -ab8500-fg:  :  : Fuel Gauge
>> +ab8500-fg:   : vddadc   : Fuel Gauge
>> +  : NCONV_ACCU   :  : Accumulate N 
>> Sample Conversion
>> +  : BATT_OVV :  : Battery Over 
>> Voltage
>> +  : LOW_BAT_F:  : LOW threshold 
>> battery voltage
>> +  : CC_INT_CALIB :  : Counter 
>> Counter Internal Calibration
> 
> I think you mean: Coulomb Counter.
> 
>> +  : CCEOC:  : Coulomb 
>> Counter End of Conversion
>> +  :  :  :
> 
> Random empty entry.
> 
>>  ab8500-gpadc : HW_CONV_END  : vddadc   : Analogue 
>> to Digital Converter
>> SW_CONV_END  :  :
>>  ab8500-gpio  :  :  : GPIO 
>> Controller
>> diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt 
>> b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
>> new file mode 100644
>> index 000..caa33b0
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
>> @@ -0,0 +1,86 @@
>> +=== AB8500 Fuel Gauge Driver ===
>> +
>> +AB8500 is a mixed signal multimedia and power management
>> +device comprising: power and energy-management-module,
>> +wall-charger, usb-charger, audio codec, general purpose adc,
>> +tvout, clock management and sim card interface.
>> +
>> +Fuel-guage support is part of energy-management-module, the other
> 
> Spelling.
> 
>> +components of this module are:
>> +main-charger, usb-combo-charger and Battery temperature monitoring.
>> +
>> +The properties below describes the node for fuel guage driver.
> 
> Spelling.
> 
>> +
>> +Required Properties:
>> +- compatible = "stericsson,ab8500-fg"
>> +- interface-name:
>> + Name of the controller/driver which is part of energy-management-module
>> +- supplied-to:
> 
> Still not sure about this property, or your justification for use.
> 
>> + This property shall have dependent nodes which represent other
>> + energy-management-module.
> 
> Plural?
> 
>> + This is a logical binding w.r.t power supply events
> 
> Proper English please, no slang.
> 
>> + across energy-management-module drivers where-in, the
> 
> Ill placed comma?
> 
>> + runtime battery properties are shared along with uevent
>> + notification.
> 
> Plural?
> 
>> + ref: di->fg.external_power_changed =
>> + ab8500_fg_external_power_changed;
>> + ab8500_fg.c
>> +
>> + Need for this property:
>> + energy-management-module driver updates power-supply properties

Re: [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge

2012-10-01 Thread Rajanikanth HV
did you have a look at arnd and anton comments regarding
'supplied-to' and boolean property

On Monday 01 October 2012 03:19 PM, Lee Jones wrote:
 On Mon, 01 Oct 2012, Rajanikanth H.V wrote:
 
 From: Rajanikanth H.V rajanikanth...@stericsson.com

 - This patch adds device tree support for fuelguage driver
 - optimize bm devices platform_data usage and of_probe(...)
   Note: of_probe() routine for battery managed devices is made
   common across all bm drivers.

 Signed-off-by: Rajanikanth H.V rajanikanth...@stericsson.com
 ---
  Documentation/devicetree/bindings/mfd/ab8500.txt   |8 +-
  .../devicetree/bindings/power_supply/ab8500/fg.txt |   86 +++
  arch/arm/boot/dts/dbx5x0.dtsi  |   22 +-
  drivers/mfd/ab8500-core.c  |1 +
  drivers/power/Makefile |2 +-
  drivers/power/ab8500_bmdata.c  |  549 
 
  drivers/power/ab8500_btemp.c   |4 +-
  drivers/power/ab8500_charger.c |4 +-
  drivers/power/ab8500_fg.c  |   76 ++-
  drivers/power/abx500_chargalg.c|4 +-
  include/linux/mfd/abx500.h |   37 +-
  include/linux/mfd/abx500/ab8500-bm.h   |7 +
  12 files changed, 744 insertions(+), 56 deletions(-)
  create mode 100644 
 Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
  create mode 100644 drivers/power/ab8500_bmdata.c

 diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt 
 b/Documentation/devicetree/bindings/mfd/ab8500.txt
 index ce83c8d..762dc11 100644
 --- a/Documentation/devicetree/bindings/mfd/ab8500.txt
 +++ b/Documentation/devicetree/bindings/mfd/ab8500.txt
 @@ -24,7 +24,13 @@ ab8500-bm:  : 
  : Battery Manager
  ab8500-btemp :  :  : Battery 
 Temperature
  ab8500-charger   :  :  : Battery 
 Charger
  ab8500-codec :  :  : Audio Codec
 -ab8500-fg:  :  : Fuel Gauge
 +ab8500-fg:   : vddadc   : Fuel Gauge
 +  : NCONV_ACCU   :  : Accumulate N 
 Sample Conversion
 +  : BATT_OVV :  : Battery Over 
 Voltage
 +  : LOW_BAT_F:  : LOW threshold 
 battery voltage
 +  : CC_INT_CALIB :  : Counter 
 Counter Internal Calibration
 
 I think you mean: Coulomb Counter.
 
 +  : CCEOC:  : Coulomb 
 Counter End of Conversion
 +  :  :  :
 
 Random empty entry.
 
  ab8500-gpadc : HW_CONV_END  : vddadc   : Analogue 
 to Digital Converter
 SW_CONV_END  :  :
  ab8500-gpio  :  :  : GPIO 
 Controller
 diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt 
 b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
 new file mode 100644
 index 000..caa33b0
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
 @@ -0,0 +1,86 @@
 +=== AB8500 Fuel Gauge Driver ===
 +
 +AB8500 is a mixed signal multimedia and power management
 +device comprising: power and energy-management-module,
 +wall-charger, usb-charger, audio codec, general purpose adc,
 +tvout, clock management and sim card interface.
 +
 +Fuel-guage support is part of energy-management-module, the other
 
 Spelling.
 
 +components of this module are:
 +main-charger, usb-combo-charger and Battery temperature monitoring.
 +
 +The properties below describes the node for fuel guage driver.
 
 Spelling.
 
 +
 +Required Properties:
 +- compatible = stericsson,ab8500-fg
 +- interface-name:
 + Name of the controller/driver which is part of energy-management-module
 +- supplied-to:
 
 Still not sure about this property, or your justification for use.
 
 + This property shall have dependent nodes which represent other
 + energy-management-module.
 
 Plural?
 
 + This is a logical binding w.r.t power supply events
 
 Proper English please, no slang.
 
 + across energy-management-module drivers where-in, the
 
 Ill placed comma?
 
 + runtime battery properties are shared along with uevent
 + notification.
 
 Plural?
 
 + ref: di-fg.external_power_changed =
 + ab8500_fg_external_power_changed;
 + ab8500_fg.c
 +
 + Need for this property:
 + energy-management-module driver updates power-supply properties
 + which are subset of events listed in 'enum 
 power_supply_property',
 + ref: power_supply.h file
 + Event handler invokes 

Re: Implement devicetree support for AB8500 Btemp

2012-09-14 Thread Rajanikanth HV


On Thursday 13 September 2012 08:07 PM, Arnd Bergmann wrote:
> On Thursday 13 September 2012, Rajanikanth HV wrote:
>> On Wednesday 12 September 2012 09:06 PM, Arnd Bergmann wrote:> > 
>>> If this is true, I don't understand what makes the 'supplied-to'
>>> properties you list in the device tree binding board specific. Are
>>> they not always done the same way? If so, you could just leave them
>>> out.
>> Precisely 'supplied-to' is not board specific, it was maintained as
>> platform_data which i migrated to dt-node. It is meant to establish
>> dependency across bm drivers based on power_supply property and
>> runtime battery attributes.
>> Basically, 'supplied-to' provides a way of exporting change in
>> power_supply_property and runtime batter characteristics so that other
>> bm devs shall make use or refer the updated values.
>> Ref: external_power_changed(...) call back api.
>> Note: all the bm drivers handles subset of power_supply property and
>>   battery attributes,
>>   ref: include/linux/power_supply.h and get_property(...) call back
>>   api across bm drivers.
> 
> Ok, so you want to just remove the property from the device tree,
> or do you want to establish a different method to specify these
> connections?
> 
>>> What does indeed seem to be needed is a place to identify the battery
>>> type, but it's not clear if the btemp device is the best place for
>>> that (maybe it is). 
>> I am not clear whether you are trying to correlate battery-type with
>> supplied-to. however, battery type is identified based on the
>> resistance value measured at batctrl pin which is expected to be in the
>> allowable limit of ab8500 device. This resistance limit varies across
>> battery types. This happens in btemp driver.
> 
> I wasn't correlating them. I just mentioned that unlike the supplied-to
> property, the battery type property does seem to belong into the device
> tree.
> 
>> For this, I would suggest you give a list of
>>> possible batteries and require a property such as
>>>
>>>  st-ericsson,battery-type: A string identifier for the type of battery,
>>>which impacts how an operating system interpret
>>>the sensor readings. Possible values include:
>>> * "none"-- no battery connected
>>> * "li-ion-9100" -- Type 9100 Li-ION battery
>>> * 
>> Can do this, not precisely as "st-ericsson,battery-type", it will be as
>> battery-type = [unknown|NiMH|LION|...|]], reason being
>> allowable battery type is based on technology, as you can see the
>> possible types as:
>> POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0,
>> POWER_SUPPLY_TECHNOLOGY_NiMH,
>> POWER_SUPPLY_TECHNOLOGY_LION,
>> POWER_SUPPLY_TECHNOLOGY_LIPO,
>> POWER_SUPPLY_TECHNOLOGY_LiFe,
>> POWER_SUPPLY_TECHNOLOGY_NiCd,
>> POWER_SUPPLY_TECHNOLOGY_LiMn
>> Ref: include/linux/power_supply.h
>> Note: doing this will impact my of_probe(...), may slightly bloat the
>> code.
> 
> Ok.
> 
> If you want to make the battery type a generic property, it's probably
> best to start a separate binding document for this in
> Documentation/devicetree/bindings/power-supply/common.txt
> and document a string for each of these.
> 
> If we expect the property to be needed only for ab8500, please use
> a vendor prefix like 'stericsson,'.
it is fine to have battery-name in the battery-type property as said
above and to have binding document, the basic requirement is to
maintain the battery type information for a specified battery also
within the same technology of battery method, battery parameters may
vary. Presently battery-type and its dependent information is
maintained in the drivers/power/ folder as per the arnd review
sometimes back.




> 
>   Arnd
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Implement devicetree support for AB8500 Btemp

2012-09-14 Thread Rajanikanth HV

On Friday 14 September 2012 01:39 PM, Arnd Bergmann wrote:
> On Friday 14 September 2012, Anton Vorontsov wrote:
>> Power supply subsystem's supplied_to describes not just how driver
>> should notify other devices, supplied_to is more generic stuff, in terms
>> that it describes power supply hierarchy. It's like a directed graph,
>> e.g.:
>>
>>supplied_to  and 
>>   supplied_to  and 
>>supplied_to 
>>  supplied_to 
>>supplied_to 
>>supplied_to 
>>
>> How things interact in linux are just implementations details.
>> So, device tree is surely a perfect place to describe these things.
>>
>> Although, in current bindings I see this:
>>
>> +   ab8500-fg {
>> +   /* Other enery management module */
>> +   supplied_to = "ab8500_chargalg", "ab8500_usb";
>> +   num_supplicants = <2>;
>> +   };
>>
>> Instead of addressing supplicants by name, it's better to address
>> via phandles. And, of course, num_supplicants is not needed, it can
>> be derived.
> 
> Right. that's what I thought. The other comment I made initially is
> that it would be more in the spirit of the existing bindings to have
> the supply property in the opposite directory, if we need it, like
> (picking up your above example):
> 
> 
> / {
>   /* power supply property in the root node is used by default */
>   power-supply = <>, <>;
> 
>   ac-power: power@... {
>   ...
>   };
> 
>   usb-power: power@... {
>   ...
>   };
> 
>   main-battery: battery@... {
>   power-supply = <>, <};
>   ;
> 
>   ...
> };
> 
> It's the same information and absolutely equivalent as far as I can tell,
> but it feel more logical in the way we tend to describe things.
> 
>   Arnd
> 
phandle'd supplied-to will looks like:

usb: ab8500-usb {

};

battery : ab8500-bat-type {
battery-name = "unknown|NiMH|LION|LIPO|LiFe|NiCd|LiMn";
thermistor_on_batctrl = <1>;
};

chargalg: ab8500-chargalg {
compatible = "stericsson,ab8500-chargalg";
interface-name = "ab8500_chargalg";
battery-info = <>
supplied-to = <_fg>;
...
};

fuelguage: ab8500-fg {
compatible = "stericsson,ab8500-fg";
interface-name = "ab8500_fg";
battery-info = <>
supplied-to = <_chargalg _usb>;
...
};
btemp: ab8500-btemp {
compatible = "stericsson,ab8500-fg";
interface-name = "ab8500_btemp";
battery-info = <>
supplied-to = <_chargalg _fg>;
...
};

charger: ab8500-charger {
compatible = "stericsson,ab8500-charger";
interface-name = "ab8500_charger";
battery-info = <>
supplied-to = <_chargalg _fg _btemp>;
...
};
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Implement devicetree support for AB8500 Btemp

2012-09-14 Thread Rajanikanth HV

On Friday 14 September 2012 01:39 PM, Arnd Bergmann wrote:
 On Friday 14 September 2012, Anton Vorontsov wrote:
 Power supply subsystem's supplied_to describes not just how driver
 should notify other devices, supplied_to is more generic stuff, in terms
 that it describes power supply hierarchy. It's like a directed graph,
 e.g.:

   AC power supplied_to main battery and backup battery
  USB power supplied_to main battery and backup battery
   main battery supplied_to system
 backup battery supplied_to system
   cmos battery supplied_to southbridge pci device
   mice battery supplied_to mice wireless hid

 How things interact in linux are just implementations details.
 So, device tree is surely a perfect place to describe these things.

 Although, in current bindings I see this:

 +   ab8500-fg {
 +   /* Other enery management module */
 +   supplied_to = ab8500_chargalg, ab8500_usb;
 +   num_supplicants = 2;
 +   };

 Instead of addressing supplicants by name, it's better to address
 via phandles. And, of course, num_supplicants is not needed, it can
 be derived.
 
 Right. that's what I thought. The other comment I made initially is
 that it would be more in the spirit of the existing bindings to have
 the supply property in the opposite directory, if we need it, like
 (picking up your above example):
 
 
 / {
   /* power supply property in the root node is used by default */
   power-supply = main-battery, backup-battery;
 
   ac-power: power@... {
   ...
   };
 
   usb-power: power@... {
   ...
   };
 
   main-battery: battery@... {
   power-supply = ac-power, usb-power};
   ;
 
   ...
 };
 
 It's the same information and absolutely equivalent as far as I can tell,
 but it feel more logical in the way we tend to describe things.
 
   Arnd
 
phandle'd supplied-to will looks like:

usb: ab8500-usb {

};

battery : ab8500-bat-type {
battery-name = unknown|NiMH|LION|LIPO|LiFe|NiCd|LiMn;
thermistor_on_batctrl = 1;
};

chargalg: ab8500-chargalg {
compatible = stericsson,ab8500-chargalg;
interface-name = ab8500_chargalg;
battery-info = ab8500-bat-type
supplied-to = ab8500_fg;
...
};

fuelguage: ab8500-fg {
compatible = stericsson,ab8500-fg;
interface-name = ab8500_fg;
battery-info = ab8500-bat-type
supplied-to = ab8500_chargalg ab8500_usb;
...
};
btemp: ab8500-btemp {
compatible = stericsson,ab8500-fg;
interface-name = ab8500_btemp;
battery-info = ab8500-bat-type
supplied-to = ab8500_chargalg ab8500_fg;
...
};

charger: ab8500-charger {
compatible = stericsson,ab8500-charger;
interface-name = ab8500_charger;
battery-info = ab8500-bat-type
supplied-to = ab8500_chargalg ab8500_fg ab8500_btemp;
...
};
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Implement devicetree support for AB8500 Btemp

2012-09-14 Thread Rajanikanth HV


On Thursday 13 September 2012 08:07 PM, Arnd Bergmann wrote:
 On Thursday 13 September 2012, Rajanikanth HV wrote:
 On Wednesday 12 September 2012 09:06 PM, Arnd Bergmann wrote:  
 If this is true, I don't understand what makes the 'supplied-to'
 properties you list in the device tree binding board specific. Are
 they not always done the same way? If so, you could just leave them
 out.
 Precisely 'supplied-to' is not board specific, it was maintained as
 platform_data which i migrated to dt-node. It is meant to establish
 dependency across bm drivers based on power_supply property and
 runtime battery attributes.
 Basically, 'supplied-to' provides a way of exporting change in
 power_supply_property and runtime batter characteristics so that other
 bm devs shall make use or refer the updated values.
 Ref: external_power_changed(...) call back api.
 Note: all the bm drivers handles subset of power_supply property and
   battery attributes,
   ref: include/linux/power_supply.h and get_property(...) call back
   api across bm drivers.
 
 Ok, so you want to just remove the property from the device tree,
 or do you want to establish a different method to specify these
 connections?
 
 What does indeed seem to be needed is a place to identify the battery
 type, but it's not clear if the btemp device is the best place for
 that (maybe it is). 
 I am not clear whether you are trying to correlate battery-type with
 supplied-to. however, battery type is identified based on the
 resistance value measured at batctrl pin which is expected to be in the
 allowable limit of ab8500 device. This resistance limit varies across
 battery types. This happens in btemp driver.
 
 I wasn't correlating them. I just mentioned that unlike the supplied-to
 property, the battery type property does seem to belong into the device
 tree.
 
 For this, I would suggest you give a list of
 possible batteries and require a property such as

  st-ericsson,battery-type: A string identifier for the type of battery,
which impacts how an operating system interpret
the sensor readings. Possible values include:
 * none-- no battery connected
 * li-ion-9100 -- Type 9100 Li-ION battery
 * add any others that apply here
 Can do this, not precisely as st-ericsson,battery-type, it will be as
 battery-type = [unknown|NiMH|LION|...|]], reason being
 allowable battery type is based on technology, as you can see the
 possible types as:
 POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0,
 POWER_SUPPLY_TECHNOLOGY_NiMH,
 POWER_SUPPLY_TECHNOLOGY_LION,
 POWER_SUPPLY_TECHNOLOGY_LIPO,
 POWER_SUPPLY_TECHNOLOGY_LiFe,
 POWER_SUPPLY_TECHNOLOGY_NiCd,
 POWER_SUPPLY_TECHNOLOGY_LiMn
 Ref: include/linux/power_supply.h
 Note: doing this will impact my of_probe(...), may slightly bloat the
 code.
 
 Ok.
 
 If you want to make the battery type a generic property, it's probably
 best to start a separate binding document for this in
 Documentation/devicetree/bindings/power-supply/common.txt
 and document a string for each of these.
 
 If we expect the property to be needed only for ab8500, please use
 a vendor prefix like 'stericsson,'.
it is fine to have battery-name in the battery-type property as said
above and to have binding document, the basic requirement is to
maintain the battery type information for a specified battery also
within the same technology of battery method, battery parameters may
vary. Presently battery-type and its dependent information is
maintained in the drivers/power/ folder as per the arnd review
sometimes back.




 
   Arnd
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Implement devicetree support for AB8500 Btemp

2012-09-13 Thread Rajanikanth HV


On Wednesday 12 September 2012 09:06 PM, Arnd Bergmann wrote:
> On Wednesday 12 September 2012, Rajanikanth HV wrote:
>> On Tuesday 11 September 2012 04:52 PM, Arnd Bergmann wrote:
>>> On Tuesday 11 September 2012, Rajanikanth HV wrote:
> 
>> Consider: USB charging:
>> __
>>|  |
>> --(Vbus)-->|   USB Charger with   |
>>|  Charger FSM (h/w)   |
>>|__|
>> ||
>> ||(Vbat and other signals)
>> |  __|_
>> to  | ||(GaugeSense
>>  Charger FSM| | LION   | Signal) _
>> | |Battery |--->|FuelGauge blk|
>> | |||{Coulomb Ctr}|
>> |   |-
>> |   
>> |   |
>> |   | (BatCtrl Signal)
>> |___|-->[Btemp blk]
>> |   |
>>   [ADC] |__Btemp_Low
>> |__Btemp_Med
>> |__Btemp_High
>>
>> Note: Charging algorithm is a logical entity.
> Ok, thanks for the explanation, this is starting to make a lot more
> sense. So the three blocks (fb, btemp, charger) are all separate
> mfd cells, each with their own register set in ab8500 and a separate
> driver in drivers/power, right?
Correct, You can have a look at ab8500 spec:
www.stericsson.com/developers/CD00291561_UM1031_AB8500_user_manual-rev5_CTDS_public.pdf
> 
> Then there is the ab8500-charalg driver which I guess is implementing
> the Charger FSM you mention above,
ab8500-charalg does not implements charger FSM, Charger FSM is a
hardware block for which any functional info is not available in the
spec. However, ab8500-charalg implements state m/c depicted in the
figure (9) of spec, implementation can be found in the code:
abx500_chargalg.c: centered around abx500_chargalg_algorithm(..)

Let me brief out what 'charger(Wall/USB)' and 'chargalg' driver does:

(a) Charger driver implements:
- events specific to Wall(a/c) and USB Charger
- power supply attributes handling and notification
  to power_supply core. Ref: enum power_supply_property
  linux/power_supply.h
  Note: subset of power_supply_property are handled 
- turn on/off charging led, AC and USB charging
- Regulating Voltage and Current values for charging
- voltage threshold check
- Charging regulation based on btemp
all this functionality has register dependency

(b) Charging algorithm:
- Starts by collecting power_supply properties across power
  class devices which are 'bm' devices
- Maintains the different charging states across ac and usb
  charging process pertaining to 'Vbus, main or Vbat', thermal,
  btemp etc.,   
- Implements subset of power_suppply_class properties   
Note: Do not have direct register interface

 but it doesn't have any registers
yes, but make use of power supply properties updated by other bm devs
while managing charging states.
> in the ab8500 but rather ties the other drivers together.
> 
> If this is true, I don't understand what makes the 'supplied-to'
> properties you list in the device tree binding board specific. Are
> they not always done the same way? If so, you could just leave them
> out.
Precisely 'supplied-to' is not board specific, it was maintained as
platform_data which i migrated to dt-node. It is meant to establish
dependency across bm drivers based on power_supply property and
runtime battery attributes.
Basically, 'supplied-to' provides a way of exporting change in
power_supply_property and runtime batter characteristics so that other
bm devs shall make use or refer the updated values.
Ref: external_power_changed(...) call back api.
Note: all the bm drivers handles subset of power_supply property and
  battery attributes,
  ref: include/linux/power_supply.h and get_property(...) call back
  api across bm drivers.
> 
> What does indeed seem to be needed is a place to identify the battery
> type, but it's not clear if the btemp device is the best place for
> that (maybe it is). 
I am not clear whether you are trying to correlate battery-type with
supplied-to. however, battery type is identified based on the
resistance value measured at batctrl pin which is expected to be in the
allowable limit of ab8500 device. This resistance limit varies across
battery types. This happens in btemp driver.

For this, I would suggest you give a list of
> possible batteries and require a property suc

Re: Implement devicetree support for AB8500 Btemp

2012-09-13 Thread Rajanikanth HV


On Wednesday 12 September 2012 09:06 PM, Arnd Bergmann wrote:
 On Wednesday 12 September 2012, Rajanikanth HV wrote:
 On Tuesday 11 September 2012 04:52 PM, Arnd Bergmann wrote:
 On Tuesday 11 September 2012, Rajanikanth HV wrote:
 
 Consider: USB charging:
 __
|  |
 --(Vbus)--|   USB Charger with   |
|  Charger FSM (h/w)   |
|__|
 ||
 ||(Vbat and other signals)
 |  __|_
 to  | ||(GaugeSense
  Charger FSM| | LION   | Signal) _
 | |Battery |---|FuelGauge blk|
 | |||{Coulomb Ctr}|
 |   |-
 |   Thermistor
 |   |
 |   | (BatCtrl Signal)
 |___|--[Btemp blk]
 |   |
   [ADC] |__Btemp_Low
 |__Btemp_Med
 |__Btemp_High

 Note: Charging algorithm is a logical entity.
 Ok, thanks for the explanation, this is starting to make a lot more
 sense. So the three blocks (fb, btemp, charger) are all separate
 mfd cells, each with their own register set in ab8500 and a separate
 driver in drivers/power, right?
Correct, You can have a look at ab8500 spec:
www.stericsson.com/developers/CD00291561_UM1031_AB8500_user_manual-rev5_CTDS_public.pdf
 
 Then there is the ab8500-charalg driver which I guess is implementing
 the Charger FSM you mention above,
ab8500-charalg does not implements charger FSM, Charger FSM is a
hardware block for which any functional info is not available in the
spec. However, ab8500-charalg implements state m/c depicted in the
figure (9) of spec, implementation can be found in the code:
abx500_chargalg.c: centered around abx500_chargalg_algorithm(..)

Let me brief out what 'charger(Wall/USB)' and 'chargalg' driver does:

(a) Charger driver implements:
- events specific to Wall(a/c) and USB Charger
- power supply attributes handling and notification
  to power_supply core. Ref: enum power_supply_property
  linux/power_supply.h
  Note: subset of power_supply_property are handled 
- turn on/off charging led, AC and USB charging
- Regulating Voltage and Current values for charging
- voltage threshold check
- Charging regulation based on btemp
all this functionality has register dependency

(b) Charging algorithm:
- Starts by collecting power_supply properties across power
  class devices which are 'bm' devices
- Maintains the different charging states across ac and usb
  charging process pertaining to 'Vbus, main or Vbat', thermal,
  btemp etc.,   
- Implements subset of power_suppply_class properties   
Note: Do not have direct register interface

 but it doesn't have any registers
yes, but make use of power supply properties updated by other bm devs
while managing charging states.
 in the ab8500 but rather ties the other drivers together.
 
 If this is true, I don't understand what makes the 'supplied-to'
 properties you list in the device tree binding board specific. Are
 they not always done the same way? If so, you could just leave them
 out.
Precisely 'supplied-to' is not board specific, it was maintained as
platform_data which i migrated to dt-node. It is meant to establish
dependency across bm drivers based on power_supply property and
runtime battery attributes.
Basically, 'supplied-to' provides a way of exporting change in
power_supply_property and runtime batter characteristics so that other
bm devs shall make use or refer the updated values.
Ref: external_power_changed(...) call back api.
Note: all the bm drivers handles subset of power_supply property and
  battery attributes,
  ref: include/linux/power_supply.h and get_property(...) call back
  api across bm drivers.
 
 What does indeed seem to be needed is a place to identify the battery
 type, but it's not clear if the btemp device is the best place for
 that (maybe it is). 
I am not clear whether you are trying to correlate battery-type with
supplied-to. however, battery type is identified based on the
resistance value measured at batctrl pin which is expected to be in the
allowable limit of ab8500 device. This resistance limit varies across
battery types. This happens in btemp driver.

For this, I would suggest you give a list of
 possible batteries and require a property such as
 
  st-ericsson,battery-type: A string identifier for the type of battery,
  which impacts how an operating system interpret
  the sensor readings. Possible values include:
   * none-- no battery connected
   * li-ion-9100 -- Type

Re: Implement devicetree support for AB8500 Btemp

2012-09-12 Thread Rajanikanth HV


On Tuesday 11 September 2012 04:52 PM, Arnd Bergmann wrote:
> On Tuesday 11 September 2012, Rajanikanth HV wrote:
>>>> +Supplied-to:
>>>> + This shall be power supply class dependency where in the
>> runtime battery
>>>> + properties will be shared across fuel guage and charging
>> algorithm driver.
>>>
>>> I probably don't understand enough of this, but shouldn't the other
>> devices
>>> that are supplied by this have a reference to this node rather than doing
>>> it this way around? Why use strings here instead of phandles?
>>
>> This is a logical binding w.r.t power supply event change
>> across energy-management-module drivers where in runtime battery
>> properties are shared along with uevent notification.
>> ref: di->btemp_psy.external_power_
>> changed =
>>  ab8500_btemp_external_power_changed;
>>  ref: ab8500_btemp.c
>>
>> Need for this property:
>>  btemp, fg and charger updates power-supply properties
>>  based on the events listed above.
>>  Event handler invokes power supply change notifier
>>  which in-turn invokes registered power supply class call-back
>>  based on the 'supplied_to' string.
>>  ref:
>>power_supply_changed_work(..) ./drivers/power/power_supply_core.c
>>
>> In this case how to approach through phandle?
>> 
>>
> 
> Sorry, I really tried, but I cannot make sense of what you wrote
> there. Can you try again and describe in full English sentences
> how the hardware blocks are connected
Consider: USB charging:
__
   |  |
--(Vbus)-->|   USB Charger with   |
   |  Charger FSM (h/w)   |
   |__|
||
||(Vbat and other signals)
|  __|_
to  | ||(GaugeSense
 Charger FSM| | LION   | Signal) _
| |Battery |--->|FuelGauge blk|
| |||{Coulomb Ctr}|
|   |-
|   
|   |
|   | (BatCtrl Signal)
|___|-->[Btemp blk]
|   |
  [ADC] |__Btemp_Low
|__Btemp_Med
|__Btemp_High

Note: Charging algorithm is a logical entity.

 and what their purpose is?
a) Coulomb counter comprises '12bit adc' and an 'N sample
average/accumulation' logic helps to measure battery capacity
Note: The charge and the discharge current of the battery is
converted to voltage by an external resistor connected
between GaugeSenseP and GaugeSenseN pins.

b) Battery temperature monitoring comprises a comparator which is
   enabled only by HW (charger state machine) helps to measure
   the thermal threshold
Note: The accuracy of the battery temperature measurement depends
of the accuracy of the thermistor used.

c) Charger provides 'Constant Current Constant Voltage' USB and
   Main(Wall) Charging support, it embeds: voltage detection,
   thermal protection, Constant voltage charging with programmable level,
   clock dithering and battery voltage monitoring

e.g. Correlation between charger and Btemp
- if the battery temperature is higher than “MaxTemp °C,
  the charger does not start, but is enabled

- if the battery temperature is between 0°C and “MaxTemp” °C
  charging is done in AB8500 Hardware control mode

- charging is done in DB8500 Software control mode, if the battery:
  has a voltage higher than the “BattOK Threshold

- If the battery temperature is between -10°C and 0°C:
  charging is done in AB8500 Hardware control mode

- If the battery temperature is below -10°C, charging is
  done in AB8500 Hardware control mode
> 
>   Arnd
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Implement devicetree support for AB8500 Btemp

2012-09-12 Thread Rajanikanth HV


On Tuesday 11 September 2012 04:52 PM, Arnd Bergmann wrote:
 On Tuesday 11 September 2012, Rajanikanth HV wrote:
 +Supplied-to:
 + This shall be power supply class dependency where in the
 runtime battery
 + properties will be shared across fuel guage and charging
 algorithm driver.

 I probably don't understand enough of this, but shouldn't the other
 devices
 that are supplied by this have a reference to this node rather than doing
 it this way around? Why use strings here instead of phandles?

 This is a logical binding w.r.t power supply event change
 across energy-management-module drivers where in runtime battery
 properties are shared along with uevent notification.
 ref: di-btemp_psy.external_power_
 changed =
  ab8500_btemp_external_power_changed;
  ref: ab8500_btemp.c

 Need for this property:
  btemp, fg and charger updates power-supply properties
  based on the events listed above.
  Event handler invokes power supply change notifier
  which in-turn invokes registered power supply class call-back
  based on the 'supplied_to' string.
  ref:
power_supply_changed_work(..) ./drivers/power/power_supply_core.c

 In this case how to approach through phandle?
 

 
 Sorry, I really tried, but I cannot make sense of what you wrote
 there. Can you try again and describe in full English sentences
 how the hardware blocks are connected
Consider: USB charging:
__
   |  |
--(Vbus)--|   USB Charger with   |
   |  Charger FSM (h/w)   |
   |__|
||
||(Vbat and other signals)
|  __|_
to  | ||(GaugeSense
 Charger FSM| | LION   | Signal) _
| |Battery |---|FuelGauge blk|
| |||{Coulomb Ctr}|
|   |-
|   Thermistor
|   |
|   | (BatCtrl Signal)
|___|--[Btemp blk]
|   |
  [ADC] |__Btemp_Low
|__Btemp_Med
|__Btemp_High

Note: Charging algorithm is a logical entity.

 and what their purpose is?
a) Coulomb counter comprises '12bit adc' and an 'N sample
average/accumulation' logic helps to measure battery capacity
Note: The charge and the discharge current of the battery is
converted to voltage by an external resistor connected
between GaugeSenseP and GaugeSenseN pins.

b) Battery temperature monitoring comprises a comparator which is
   enabled only by HW (charger state machine) helps to measure
   the thermal threshold
Note: The accuracy of the battery temperature measurement depends
of the accuracy of the thermistor used.

c) Charger provides 'Constant Current Constant Voltage' USB and
   Main(Wall) Charging support, it embeds: voltage detection,
   thermal protection, Constant voltage charging with programmable level,
   clock dithering and battery voltage monitoring

e.g. Correlation between charger and Btemp
- if the battery temperature is higher than “MaxTemp °C,
  the charger does not start, but is enabled

- if the battery temperature is between 0°C and “MaxTemp” °C
  charging is done in AB8500 Hardware control mode

- charging is done in DB8500 Software control mode, if the battery:
  has a voltage higher than the “BattOK Threshold

- If the battery temperature is between -10°C and 0°C:
  charging is done in AB8500 Hardware control mode

- If the battery temperature is below -10°C, charging is
  done in AB8500 Hardware control mode
 
   Arnd
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


mfd: Implement devicetree support for AB8500 Btemp

2012-09-10 Thread Rajanikanth HV
This patch adds device tree support for
battery temperature monitor driver

Signed-off-by: Rajanikanth H.V 
---
 .../bindings/power_supply/ab8500/btemp.txt |   52 ++
 arch/arm/boot/dts/dbx5x0.dtsi  |8 +
 drivers/mfd/ab8500-core.c  |1 +
 drivers/power/Kconfig  |6 -
 drivers/power/ab8500_bmdata.h  |4 +-
 drivers/power/ab8500_btemp.c   |  181 
 6 files changed, 213 insertions(+), 39 deletions(-)
 create mode 100644
Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt

diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
new file mode 100644
index 000..b214efc
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
@@ -0,0 +1,52 @@
+=== AB8500 Battery Temperature Monitor Driver ===
+
+The properties below describes the node for battery
+temperature monitor driver.
+
+Required Properties:
+- compatible = "stericsson,ab8500-btemp"
+
+supplied-to:
+   This is a logical binding w.r.t power supply event change
+   across energy-management-module drivers where in the
+   runtime battery properties are shared along with uevent
+   notification.
+   ref: di->btemp_psy.external_power_changed =
+   ab8500_btemp_external_power_changed;
+   ab8500_btemp.c
+
+   Need for this property:
+   btemp, fg and charger updates power-supply properties
+   based on the events listed above.
+   Event handler invokes power supply change notifier
+   which in-turn invokes registered power supply class call-back
+   based on the 'supplied_to' string.
+   ref:
+   power_supply_changed_work(..) 
./drivers/power/power_supply_core.c
+
+   example:
+   ab8500-btemp {
+   /* Other enery management module */
+   supplied-to = "ab8500_chargalg", "ab8500_fg";
+   num_supplicants = <2>;
+   };
+
+thermister-interface:
+   'btemp' and 'batctrl' are the pins interfaced for battery temperature
+   measurement, btemp is used when NTC(negative temperature coefficient)
+   resister is interfaced external to battery and batctrl is used when
+   NTC resister is internal to battery.
+
+
+li-ion-9100-battery:
+   use this to add support for the 9100 Li-ION battery,
+   this adjust the bkup battery charger parameters
+   Note: this property is used for tablet version of snowball board.
+
+   example:
+   ab8500-btemp {
+   thermister-internal-to-battery = <1>;
+   li_ion_9100_battery = <0>;
+   };
+Note:
+interrupts are defined and registered in the driver
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index d69c087..643e7fd 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -360,6 +360,14 @@
li_ion_9100  = <0>;
};

+   ab8500-btemp {
+   compatible = "stericsson,ab8500-btemp";
+   supplied_to = "ab8500_chargalg", 
"ab8500_fg";
+   num_supplicants = <2>;
+   thermister_on_batctrl = <1>;
+   li_ion_9100  = <0>;
+   };
+
ab8500-usb {
compatible = "stericsson,ab8500-usb";
interrupts = < 90 0x4
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index c413cfa..7ffba9b 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -1047,6 +1047,7 @@ static struct mfd_cell __devinitdata ab8500_bm_devs[] = {
},
{
.name = "ab8500-btemp",
+   .of_compatible = "stericsson,ab8500-btemp",
.num_resources = ARRAY_SIZE(ab8500_btemp_resources),
.resources = ab8500_btemp_resources,
},
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index c1892f3..1434871 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -304,12 +304,6 @@ config AB8500_BM
help
  Say Y to include support for AB8500 battery management.

-config AB8500_BATTERY_THERM_ON_BATCTRL
-   bool "Thermistor connected on BATCTRL ADC"
-   depends on AB8500_BM
-   help
- Say Y to enable battery temperature measurements using
- thermistor connected on BATCTRL ADC.
 endif # POWER_SUPPLY

 source "drivers/power/avs/Kconfig"
diff --git a/drivers/power/ab8500_bmdata.h b/drivers/power/ab8500_bmdata.h
index 748334a..0bd0a45 100644
--- 

[PATCH] mfd: Implement devicetree support for AB8500 fg

2012-09-10 Thread Rajanikanth HV
This patch adds device tree support for
fuel guage driver

Signed-off-by: Rajanikanth H.V 
---
 Documentation/devicetree/bindings/mfd/ab8500.txt   |8 +-
 .../devicetree/bindings/power_supply/ab8500/fg.txt |   61 +++
 arch/arm/boot/dts/dbx5x0.dtsi  |8 +
 drivers/mfd/ab8500-core.c  |1 +
 drivers/power/Makefile |2 +-
 drivers/power/ab8500_bmdata.h  |  442 
 drivers/power/ab8500_fg.c  |  148 ++-
 include/linux/mfd/abx500.h |2 +-
 8 files changed, 664 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
 create mode 100644 drivers/power/ab8500_bmdata.h

diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt
b/Documentation/devicetree/bindings/mfd/ab8500.txt
index ce83c8d..762dc11 100644
--- a/Documentation/devicetree/bindings/mfd/ab8500.txt
+++ b/Documentation/devicetree/bindings/mfd/ab8500.txt
@@ -24,7 +24,13 @@ ab8500-bm:  :
   : Battery Manager
 ab8500-btemp :  :  :
Battery Temperature
 ab8500-charger   :  :  :
Battery Charger
 ab8500-codec :  :  : Audio Codec
-ab8500-fg:  :  : Fuel Gauge
+ab8500-fg: : vddadc   : Fuel Gauge
+: NCONV_ACCU   :  : Accumulate N 
Sample Conversion
+: BATT_OVV :  : Battery Over 
Voltage
+: LOW_BAT_F:  : LOW threshold 
battery voltage
+: CC_INT_CALIB :  : Counter 
Counter Internal Calibration
+: CCEOC:  : Coulomb 
Counter End of Conversion
+:  :  :
 ab8500-gpadc : HW_CONV_END  : vddadc   :
Analogue to Digital Converter
SW_CONV_END  :  :
 ab8500-gpio  :  :  : GPIO
Controller
diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
new file mode 100644
index 000..c2c122e
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
@@ -0,0 +1,61 @@
+=== AB8500 Fuel Gauge Driver ===
+
+AB8500 is a mixed signal multimedia and power management
+device comprising: power and energy-management-module,
+wall-charger, usb-charger, audio codec, general purpose adc,
+tvout, clock management and sim card interface.
+
+Fuel-guage support is part of energy-management-module, the other
+components of this module are:
+main-charger, usb-combo-charger and Battery temperature monitoring.
+
+The properties below describes the node for fuel guage driver.
+
+Required Properties:
+- compatible = "stericsson,ab8500-fg"
+
+supplied-to:
+   This is a logical binding w.r.t power supply event change
+   across energy-management-module drivers where in the
+   runtime battery properties are shared along with uevent
+   notification.
+   ref: di->fg.external_power_changed =
+   ab8500_fg_external_power_changed;
+   ab8500_fg.c
+
+   Need for this property:
+   btemp, fg and charger updates power-supply properties
+   based on the events listed above.
+   Event handler invokes power supply change notifier
+   which in-turn invokes registered power supply class call-back
+   based on the 'supplied_to' string.
+   ref:
+   power_supply_changed_work(..) 
./drivers/power/power_supply_core.c
+
+   example:
+   ab8500-fg {
+   /* Other enery management module */
+   supplied_to = "ab8500_chargalg", "ab8500_usb";
+   num_supplicants = <2>;
+   };
+
+thermister-interface:
+   'btemp' and 'batctrl' are the pins interfaced for battery temperature
+   measurement, btemp is used when NTC(negative temperature coefficient)
+   resister is interfaced external to battery and batctrl is used when
+   NTC resister is internal to battery.
+
+
+li-ion-9100-battery:
+   use this to add support for the 9100 Li-ION battery,
+   this adjust the bkup battery charger parameters
+   Note: this property is used for tablet version of snowball board.
+
+   example:
+   ab8500-fg {
+   thermister-internal-to-battery = <1>;
+   li_ion_9100_battery = <0>;
+   };
+Note:
+interrupts are defined and registered in the driver
+
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index 

[PATCH] mfd: Implement devicetree support for AB8500 fg

2012-09-10 Thread Rajanikanth HV
This patch adds device tree support for
fuel guage driver

Signed-off-by: Rajanikanth H.V rajanikanth...@stericsson.com
---
 Documentation/devicetree/bindings/mfd/ab8500.txt   |8 +-
 .../devicetree/bindings/power_supply/ab8500/fg.txt |   61 +++
 arch/arm/boot/dts/dbx5x0.dtsi  |8 +
 drivers/mfd/ab8500-core.c  |1 +
 drivers/power/Makefile |2 +-
 drivers/power/ab8500_bmdata.h  |  442 
 drivers/power/ab8500_fg.c  |  148 ++-
 include/linux/mfd/abx500.h |2 +-
 8 files changed, 664 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
 create mode 100644 drivers/power/ab8500_bmdata.h

diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt
b/Documentation/devicetree/bindings/mfd/ab8500.txt
index ce83c8d..762dc11 100644
--- a/Documentation/devicetree/bindings/mfd/ab8500.txt
+++ b/Documentation/devicetree/bindings/mfd/ab8500.txt
@@ -24,7 +24,13 @@ ab8500-bm:  :
   : Battery Manager
 ab8500-btemp :  :  :
Battery Temperature
 ab8500-charger   :  :  :
Battery Charger
 ab8500-codec :  :  : Audio Codec
-ab8500-fg:  :  : Fuel Gauge
+ab8500-fg: : vddadc   : Fuel Gauge
+: NCONV_ACCU   :  : Accumulate N 
Sample Conversion
+: BATT_OVV :  : Battery Over 
Voltage
+: LOW_BAT_F:  : LOW threshold 
battery voltage
+: CC_INT_CALIB :  : Counter 
Counter Internal Calibration
+: CCEOC:  : Coulomb 
Counter End of Conversion
+:  :  :
 ab8500-gpadc : HW_CONV_END  : vddadc   :
Analogue to Digital Converter
SW_CONV_END  :  :
 ab8500-gpio  :  :  : GPIO
Controller
diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
new file mode 100644
index 000..c2c122e
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
@@ -0,0 +1,61 @@
+=== AB8500 Fuel Gauge Driver ===
+
+AB8500 is a mixed signal multimedia and power management
+device comprising: power and energy-management-module,
+wall-charger, usb-charger, audio codec, general purpose adc,
+tvout, clock management and sim card interface.
+
+Fuel-guage support is part of energy-management-module, the other
+components of this module are:
+main-charger, usb-combo-charger and Battery temperature monitoring.
+
+The properties below describes the node for fuel guage driver.
+
+Required Properties:
+- compatible = stericsson,ab8500-fg
+
+supplied-to:
+   This is a logical binding w.r.t power supply event change
+   across energy-management-module drivers where in the
+   runtime battery properties are shared along with uevent
+   notification.
+   ref: di-fg.external_power_changed =
+   ab8500_fg_external_power_changed;
+   ab8500_fg.c
+
+   Need for this property:
+   btemp, fg and charger updates power-supply properties
+   based on the events listed above.
+   Event handler invokes power supply change notifier
+   which in-turn invokes registered power supply class call-back
+   based on the 'supplied_to' string.
+   ref:
+   power_supply_changed_work(..) 
./drivers/power/power_supply_core.c
+
+   example:
+   ab8500-fg {
+   /* Other enery management module */
+   supplied_to = ab8500_chargalg, ab8500_usb;
+   num_supplicants = 2;
+   };
+
+thermister-interface:
+   'btemp' and 'batctrl' are the pins interfaced for battery temperature
+   measurement, btemp is used when NTC(negative temperature coefficient)
+   resister is interfaced external to battery and batctrl is used when
+   NTC resister is internal to battery.
+
+
+li-ion-9100-battery:
+   use this to add support for the 9100 Li-ION battery,
+   this adjust the bkup battery charger parameters
+   Note: this property is used for tablet version of snowball board.
+
+   example:
+   ab8500-fg {
+   thermister-internal-to-battery = 1;
+   li_ion_9100_battery = 0;
+   };
+Note:
+interrupts are defined and registered in the driver
+
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi 

mfd: Implement devicetree support for AB8500 Btemp

2012-09-10 Thread Rajanikanth HV
This patch adds device tree support for
battery temperature monitor driver

Signed-off-by: Rajanikanth H.V rajanikanth...@stericsson.com
---
 .../bindings/power_supply/ab8500/btemp.txt |   52 ++
 arch/arm/boot/dts/dbx5x0.dtsi  |8 +
 drivers/mfd/ab8500-core.c  |1 +
 drivers/power/Kconfig  |6 -
 drivers/power/ab8500_bmdata.h  |4 +-
 drivers/power/ab8500_btemp.c   |  181 
 6 files changed, 213 insertions(+), 39 deletions(-)
 create mode 100644
Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt

diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
new file mode 100644
index 000..b214efc
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
@@ -0,0 +1,52 @@
+=== AB8500 Battery Temperature Monitor Driver ===
+
+The properties below describes the node for battery
+temperature monitor driver.
+
+Required Properties:
+- compatible = stericsson,ab8500-btemp
+
+supplied-to:
+   This is a logical binding w.r.t power supply event change
+   across energy-management-module drivers where in the
+   runtime battery properties are shared along with uevent
+   notification.
+   ref: di-btemp_psy.external_power_changed =
+   ab8500_btemp_external_power_changed;
+   ab8500_btemp.c
+
+   Need for this property:
+   btemp, fg and charger updates power-supply properties
+   based on the events listed above.
+   Event handler invokes power supply change notifier
+   which in-turn invokes registered power supply class call-back
+   based on the 'supplied_to' string.
+   ref:
+   power_supply_changed_work(..) 
./drivers/power/power_supply_core.c
+
+   example:
+   ab8500-btemp {
+   /* Other enery management module */
+   supplied-to = ab8500_chargalg, ab8500_fg;
+   num_supplicants = 2;
+   };
+
+thermister-interface:
+   'btemp' and 'batctrl' are the pins interfaced for battery temperature
+   measurement, btemp is used when NTC(negative temperature coefficient)
+   resister is interfaced external to battery and batctrl is used when
+   NTC resister is internal to battery.
+
+
+li-ion-9100-battery:
+   use this to add support for the 9100 Li-ION battery,
+   this adjust the bkup battery charger parameters
+   Note: this property is used for tablet version of snowball board.
+
+   example:
+   ab8500-btemp {
+   thermister-internal-to-battery = 1;
+   li_ion_9100_battery = 0;
+   };
+Note:
+interrupts are defined and registered in the driver
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index d69c087..643e7fd 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -360,6 +360,14 @@
li_ion_9100  = 0;
};

+   ab8500-btemp {
+   compatible = stericsson,ab8500-btemp;
+   supplied_to = ab8500_chargalg, 
ab8500_fg;
+   num_supplicants = 2;
+   thermister_on_batctrl = 1;
+   li_ion_9100  = 0;
+   };
+
ab8500-usb {
compatible = stericsson,ab8500-usb;
interrupts =  90 0x4
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index c413cfa..7ffba9b 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -1047,6 +1047,7 @@ static struct mfd_cell __devinitdata ab8500_bm_devs[] = {
},
{
.name = ab8500-btemp,
+   .of_compatible = stericsson,ab8500-btemp,
.num_resources = ARRAY_SIZE(ab8500_btemp_resources),
.resources = ab8500_btemp_resources,
},
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index c1892f3..1434871 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -304,12 +304,6 @@ config AB8500_BM
help
  Say Y to include support for AB8500 battery management.

-config AB8500_BATTERY_THERM_ON_BATCTRL
-   bool Thermistor connected on BATCTRL ADC
-   depends on AB8500_BM
-   help
- Say Y to enable battery temperature measurements using
- thermistor connected on BATCTRL ADC.
 endif # POWER_SUPPLY

 source drivers/power/avs/Kconfig
diff --git a/drivers/power/ab8500_bmdata.h b/drivers/power/ab8500_bmdata.h
index 748334a..0bd0a45 100644
--- 

Re: [PATCH] mfd: Implement devicetree support for AB8500 Btemp

2012-07-13 Thread Rajanikanth HV
> Date: Tue, 10 Jul 2012 14:12:01 +
> From: Arnd Bergmann 
> To: linux-arm-ker...@lists.infradead.org
> Cc: linaro-...@lists.linaro.org, linux-kernel@vger.kernel.org,
> "Rajanikanth H.V" ,
patc...@linaro.org
> Subject: Re: [PATCH] mfd: Implement devicetree support for AB8500
> Btemp
> Message-ID: <201207101412.01561.a...@arndb.de>
> Content-Type: Text/Plain;  charset="utf-8"
>
> On Tuesday 10 July 2012, Rajanikanth H.V wrote:
>
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
>> @@ -0,0 +1,54 @@
>> +AB8500 Battery Termperature Monitor Driver
>> +
>> +AB8500 is a mixed signal multimedia and power management
>> +device comprising: power and energy management module,
>> +WalliCharger and USB charger interface, audio, general
>> +purpose ADC TVOut, clock management and SIM card Interface.
>> +
>> +Battery temperature monitoring support is part of 'energy
>> +management module', the other components of this module
>> +are: 'main and USB Combo charger' and fuel guage.
>> +
>> +The properties below describes the node for battery
>> +temperature monitor driver.
>> +
>> +Required Properties:
>> +- compatible = "stericsson,ab8500-btemp"
>> +
>> +interrupts:
>> + Four battery temperature ranges are be defined
>> + which results in interrupt events as:
>> + - Btemp
>> + - BtempLow
>> + - BtempMedium
>> + - BtempHigh
>> +
>
> These names do not match the five interrupts in the example or in the
> code. When you provide an "interrupt-names" property you have to define
> the exact strings that are permissible for them in the binding.
>
>> +Supplied-to:
>> + This shall be power supply class dependency where in the
runtime battery
>> + properties will be shared across fuel guage and charging
algorithm driver.
>
> I probably don't understand enough of this, but shouldn't the other
devices
> that are supplied by this have a reference to this node rather than doing
> it this way around? Why use strings here instead of phandles?

This is a logical binding w.r.t power supply event change
across energy-management-module drivers where in runtime battery
properties are shared along with uevent notification.
ref: di->btemp_psy.external_power_changed =
 ab8500_btemp_external_power_changed;
 ref: ab8500_btemp.c

Need for this property:
 btemp, fg and charger updates power-supply properties
 based on the events listed above.
 Event handler invokes power supply change notifier
 which in-turn invokes registered power supply class call-back
 based on the 'supplied_to' string.
 ref:
   power_supply_changed_work(..) ./drivers/power/power_supply_core.c

In this case how to approach through phandle?

>
> You are also not listing some of the properties that are in the device
> tree here, like the "interrupts" property itself.
>
>> diff --git a/arch/arm/mach-ux500/board-mop500-bm.c
b/arch/arm/mach-ux500/board-mop500-bm.c
>> new file mode 100644
>> index 000..3349ceb
>> --- /dev/null
>> +++ b/arch/arm/mach-ux500/board-mop500-bm.c
>
> Didn't we conclude that this file has no board-specific information in it?
> Either explain why it's still here, or move it into the driver itself.
>
>> +/*
>> + * Note that the batres_vs_temp table must be strictly sorted by falling
>> + * temperature values to work.
>> + */
>> +#ifdef CONFIG_AB8500_9100_LI_ION_BATTERY
>> +#define BATRES   180
>> +#else
>> +#define BATRES   300
>> +#endif
>
> I think I mentioned before that you need to get rid of the
> CONFIG_AB8500_9100_LI_ION_BATTERY symbol. If you have exclusive
> compile-time options, it is impossible to build a kernel that
> runs on all system, so this has to be a run-time option.
>
> Arnd
>
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mfd: Implement devicetree support for AB8500 Btemp

2012-07-13 Thread Rajanikanth HV
> Date: Tue, 10 Jul 2012 18:20:13 +0200
> From: Lee Jones 
> To: "Rajanikanth H.V" 
> Cc: STEricsson_nomadik_linux ,
> linaro-...@lists.linaro.org, linux-kernel@vger.kernel.org,
> linux-arm-ker...@lists.infradead.org, patc...@linaro.org
> Subject: Re: [PATCH] mfd: Implement devicetree support for AB8500
> Btemp
> Message-ID: <4ffc563d.2080...@linaro.org>
> Content-Type: text/plain; charset=UTF-8; format=flowed
> 
> Some of my comments are picky, but if it's going into Mainline, it
> should at least look professional.
> 
> You didn't CC the ST-Ericsson internal mailing list.
> 
> Address is stericsson_nomadik_li...@list.st.com
> 
> I'll do it for now, but please do so on your next submission.
> 
> On 10/07/12 15:23, Rajanikanth H.V wrote:
>> From: "Rajanikanth H.V" 
>>
>>  This patch adds device tree support for
>>  battery temperature monitor driver
>>
>> Signed-off-by: Rajanikanth H.V 
>> ---
>>   .../bindings/power_supply/ab8500/btemp.txt |   54 ++
>>   arch/arm/boot/dts/db8500.dtsi  |   17 +
>>   arch/arm/mach-ux500/Makefile   |4 +-
>>   arch/arm/mach-ux500/board-mop500-bm.c  |  532 
>> 
>>   arch/arm/mach-ux500/include/mach/board-mop500-bm.h |   24 +
>>   drivers/mfd/ab8500-core.c  |1 +
>>   drivers/power/Kconfig  |8 +-
>>   drivers/power/ab8500_btemp.c   |   79 ++-
>>   include/linux/mfd/ab8500/pwmleds.h |   20 +
>>   9 files changed, 722 insertions(+), 17 deletions(-)
>>   create mode 100644 
>> Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
>>   create mode 100644 arch/arm/mach-ux500/board-mop500-bm.c
>>   create mode 100644 arch/arm/mach-ux500/include/mach/board-mop500-bm.h
>>   create mode 100644 include/linux/mfd/ab8500/pwmleds.h
>>
>> diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt 
>> b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
>> new file mode 100644
>> index 000..8543ed1
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
>> @@ -0,0 +1,54 @@
>> +AB8500 Battery Termperature Monitor Driver
> 
> Spelling.
> 
>> +
>> +AB8500 is a mixed signal multimedia and power management
>> +device comprising: power and energy management module,
>> +WalliCharger and USB charger interface, audio, general
>> +purpose ADC TVOut, clock management and SIM card Interface.
> 
> Mixture of capitalised and otherwise device names.
> 
>> +
>> +Battery temperature monitoring support is part of 'energy
>> +management module', the other components of this module
>> +are: 'main and USB Combo charger' and fuel guage.
> 
> Spelling. Mixed use of ''.
> 
>> +The properties below describes the node for battery
>> +temperature monitor driver.
>> +
>> +Required Properties:
>> +- compatible = "stericsson,ab8500-btemp"
>> +
>> +interrupts:
>> + Four battery temperature ranges are be defined
>> + which results in interrupt events as:
>> + - Btemp
>> + - BtempLow
>> + - BtempMedium
>> + - BtempHigh
>> +
>> +
>> +Supplied-to:
>> + This shall be power supply class dependency where in the runtime 
>> battery
>> + properties will be shared across fuel guage and charging algorithm 
>> driver.
> 
> Spelling.
> 
>> +
>> +Thermister-interface:
>> + 'btemp' and 'batctrl' are the pins interfaced for battery temperature
>> + measurement, btemp is used when NTC(Negative Termperature coefficient)
> 
> Spelling.
> 
>> + resister is interfaced external to battery and batctrl is used when
>> + NTC resister is internal to battery.
>> +
>> +example:
>> +ab8500-btemp {
>> + compatible = "stericsson,ab8500-btemp";
>> +
>> + interrupt-names =
>> + "BAT_CTRL_INDB",/* battery removal indicator */
>> + "BTEMP_LOW",/* Btemp < BtempLow, if battery 
>> temperature is lower than -10?C */
>> + "BTEMP_HIGH",   /* BtempLow < Btemp < BtempMedium,
>> + if battery 
>> temperature is between -10 and 0?C */
>> + "BTEMP_LOW_MEDIUM", /* BtempMedium < Btemp < BtempHigh,
>> + if battery 
>> temperature is between 0?C and ?MaxTemp?.*/
>> + "BTEMP_MEDIUM_HIGH";/* Btemp > BtempHigh,
>> + if battery 
>> temperature is higher than ?MaxTemp?. */
>> +
>> + supplied-to = "ab8500_chargalg", "ab8500_fg";
>> +
>> + thermister-internal-to-battery = <1>;
>> +};
>> diff --git a/arch/arm/boot/dts/db8500.dtsi b/arch/arm/boot/dts/db8500.dtsi
>> index 7279165..527fdc3 100644
>> --- a/arch/arm/boot/dts/db8500.dtsi
>> +++ b/arch/arm/boot/dts/db8500.dtsi
>> @@ -330,6 +330,23 @@
>>   vddadc-supply = 
>> 

Re: [PATCH] mfd: Implement devicetree support for AB8500 Btemp

2012-07-13 Thread Rajanikanth HV
 Date: Tue, 10 Jul 2012 18:20:13 +0200
 From: Lee Jones lee.jo...@linaro.org
 To: Rajanikanth H.V rajanikanth...@stericsson.com
 Cc: STEricsson_nomadik_linux stericsson_nomadik_li...@list.st.com,
 linaro-...@lists.linaro.org, linux-kernel@vger.kernel.org,
 linux-arm-ker...@lists.infradead.org, patc...@linaro.org
 Subject: Re: [PATCH] mfd: Implement devicetree support for AB8500
 Btemp
 Message-ID: 4ffc563d.2080...@linaro.org
 Content-Type: text/plain; charset=UTF-8; format=flowed
 
 Some of my comments are picky, but if it's going into Mainline, it
 should at least look professional.
 
 You didn't CC the ST-Ericsson internal mailing list.
 
 Address is stericsson_nomadik_li...@list.st.com
 
 I'll do it for now, but please do so on your next submission.
 
 On 10/07/12 15:23, Rajanikanth H.V wrote:
 From: Rajanikanth H.V rajanikanth...@stericsson.com

  This patch adds device tree support for
  battery temperature monitor driver

 Signed-off-by: Rajanikanth H.V rajanikanth...@stericsson.com
 ---
   .../bindings/power_supply/ab8500/btemp.txt |   54 ++
   arch/arm/boot/dts/db8500.dtsi  |   17 +
   arch/arm/mach-ux500/Makefile   |4 +-
   arch/arm/mach-ux500/board-mop500-bm.c  |  532 
 
   arch/arm/mach-ux500/include/mach/board-mop500-bm.h |   24 +
   drivers/mfd/ab8500-core.c  |1 +
   drivers/power/Kconfig  |8 +-
   drivers/power/ab8500_btemp.c   |   79 ++-
   include/linux/mfd/ab8500/pwmleds.h |   20 +
   9 files changed, 722 insertions(+), 17 deletions(-)
   create mode 100644 
 Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
   create mode 100644 arch/arm/mach-ux500/board-mop500-bm.c
   create mode 100644 arch/arm/mach-ux500/include/mach/board-mop500-bm.h
   create mode 100644 include/linux/mfd/ab8500/pwmleds.h

 diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt 
 b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
 new file mode 100644
 index 000..8543ed1
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
 @@ -0,0 +1,54 @@
 +AB8500 Battery Termperature Monitor Driver
 
 Spelling.
 
 +
 +AB8500 is a mixed signal multimedia and power management
 +device comprising: power and energy management module,
 +WalliCharger and USB charger interface, audio, general
 +purpose ADC TVOut, clock management and SIM card Interface.
 
 Mixture of capitalised and otherwise device names.
 
 +
 +Battery temperature monitoring support is part of 'energy
 +management module', the other components of this module
 +are: 'main and USB Combo charger' and fuel guage.
 
 Spelling. Mixed use of ''.
 
 +The properties below describes the node for battery
 +temperature monitor driver.
 +
 +Required Properties:
 +- compatible = stericsson,ab8500-btemp
 +
 +interrupts:
 + Four battery temperature ranges are be defined
 + which results in interrupt events as:
 + - Btemp
 + - BtempLow
 + - BtempMedium
 + - BtempHigh
 +
 +
 +Supplied-to:
 + This shall be power supply class dependency where in the runtime 
 battery
 + properties will be shared across fuel guage and charging algorithm 
 driver.
 
 Spelling.
 
 +
 +Thermister-interface:
 + 'btemp' and 'batctrl' are the pins interfaced for battery temperature
 + measurement, btemp is used when NTC(Negative Termperature coefficient)
 
 Spelling.
 
 + resister is interfaced external to battery and batctrl is used when
 + NTC resister is internal to battery.
 +
 +example:
 +ab8500-btemp {
 + compatible = stericsson,ab8500-btemp;
 +
 + interrupt-names =
 + BAT_CTRL_INDB,/* battery removal indicator */
 + BTEMP_LOW,/* Btemp  BtempLow, if battery 
 temperature is lower than -10?C */
 + BTEMP_HIGH,   /* BtempLow  Btemp  BtempMedium,
 + if battery 
 temperature is between -10 and 0?C */
 + BTEMP_LOW_MEDIUM, /* BtempMedium  Btemp  BtempHigh,
 + if battery 
 temperature is between 0?C and ?MaxTemp?.*/
 + BTEMP_MEDIUM_HIGH;/* Btemp  BtempHigh,
 + if battery 
 temperature is higher than ?MaxTemp?. */
 +
 + supplied-to = ab8500_chargalg, ab8500_fg;
 +
 + thermister-internal-to-battery = 1;
 +};
 diff --git a/arch/arm/boot/dts/db8500.dtsi b/arch/arm/boot/dts/db8500.dtsi
 index 7279165..527fdc3 100644
 --- a/arch/arm/boot/dts/db8500.dtsi
 +++ b/arch/arm/boot/dts/db8500.dtsi
 @@ -330,6 +330,23 @@
   vddadc-supply = 
 ab8500_ldo_tvout_reg;
   };

 + ab8500-btemp {
 +  

Re: [PATCH] mfd: Implement devicetree support for AB8500 Btemp

2012-07-13 Thread Rajanikanth HV
 Date: Tue, 10 Jul 2012 14:12:01 +
 From: Arnd Bergmann a...@arndb.de
 To: linux-arm-ker...@lists.infradead.org
 Cc: linaro-...@lists.linaro.org, linux-kernel@vger.kernel.org,
 Rajanikanth H.V rajanikanth...@stericsson.com,
patc...@linaro.org
 Subject: Re: [PATCH] mfd: Implement devicetree support for AB8500
 Btemp
 Message-ID: 201207101412.01561.a...@arndb.de
 Content-Type: Text/Plain;  charset=utf-8

 On Tuesday 10 July 2012, Rajanikanth H.V wrote:

 --- /dev/null
 +++ b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
 @@ -0,0 +1,54 @@
 +AB8500 Battery Termperature Monitor Driver
 +
 +AB8500 is a mixed signal multimedia and power management
 +device comprising: power and energy management module,
 +WalliCharger and USB charger interface, audio, general
 +purpose ADC TVOut, clock management and SIM card Interface.
 +
 +Battery temperature monitoring support is part of 'energy
 +management module', the other components of this module
 +are: 'main and USB Combo charger' and fuel guage.
 +
 +The properties below describes the node for battery
 +temperature monitor driver.
 +
 +Required Properties:
 +- compatible = stericsson,ab8500-btemp
 +
 +interrupts:
 + Four battery temperature ranges are be defined
 + which results in interrupt events as:
 + - Btemp
 + - BtempLow
 + - BtempMedium
 + - BtempHigh
 +

 These names do not match the five interrupts in the example or in the
 code. When you provide an interrupt-names property you have to define
 the exact strings that are permissible for them in the binding.

 +Supplied-to:
 + This shall be power supply class dependency where in the
runtime battery
 + properties will be shared across fuel guage and charging
algorithm driver.

 I probably don't understand enough of this, but shouldn't the other
devices
 that are supplied by this have a reference to this node rather than doing
 it this way around? Why use strings here instead of phandles?

This is a logical binding w.r.t power supply event change
across energy-management-module drivers where in runtime battery
properties are shared along with uevent notification.
ref: di-btemp_psy.external_power_changed =
 ab8500_btemp_external_power_changed;
 ref: ab8500_btemp.c

Need for this property:
 btemp, fg and charger updates power-supply properties
 based on the events listed above.
 Event handler invokes power supply change notifier
 which in-turn invokes registered power supply class call-back
 based on the 'supplied_to' string.
 ref:
   power_supply_changed_work(..) ./drivers/power/power_supply_core.c

In this case how to approach through phandle?


 You are also not listing some of the properties that are in the device
 tree here, like the interrupts property itself.

 diff --git a/arch/arm/mach-ux500/board-mop500-bm.c
b/arch/arm/mach-ux500/board-mop500-bm.c
 new file mode 100644
 index 000..3349ceb
 --- /dev/null
 +++ b/arch/arm/mach-ux500/board-mop500-bm.c

 Didn't we conclude that this file has no board-specific information in it?
 Either explain why it's still here, or move it into the driver itself.

 +/*
 + * Note that the batres_vs_temp table must be strictly sorted by falling
 + * temperature values to work.
 + */
 +#ifdef CONFIG_AB8500_9100_LI_ION_BATTERY
 +#define BATRES   180
 +#else
 +#define BATRES   300
 +#endif

 I think I mentioned before that you need to get rid of the
 CONFIG_AB8500_9100_LI_ION_BATTERY symbol. If you have exclusive
 compile-time options, it is impossible to build a kernel that
 runs on all system, so this has to be a run-time option.

 Arnd




--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/