Re: [PATCH V2 0/3] Create sched_select_cpu() and use it in workqueues

2012-10-31 Thread Viresh Kumar
On 15 October 2012 10:08, Viresh Kumar  wrote:
> I totally understand since last few weeks you guys were very busy as the
> merge window was around. So, didn't tried to disturb you then :)
>
> Can you please share your viewpoint on this patchset now? And also
> the running timer migration patch (which was sent separately)?

Ping!!

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


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

2012-10-31 Thread Rajanikanth H.V
From: "Rajanikanth H.V" 

This patch-set adds device tree binding for ab8500 battery-managed
devices. Removes the redundant platform structure maintained
across bm devices and implements common DT probe routine across all the
modules.

Test status:
a) Tested across 'legacy platform data' and DT binding support
a.1) ab8500_charger driver fails to get regulator in the
legacy platform mode.
b) Interrupt numbers assigned differs between legacy and FDT mode.
(a) Legacy platform_data Mode:
root@ME:/ cat /proc/interrupts
   CPU0   CPU1
483:  0  0ab8500  ab8500-ponkey-dbf
484:  0  0ab8500  ab8500-ponkey-dbr
485:  0  0ab8500  BATT_OVV
494:  0  1ab8500
495:  0  0ab8500  ab8500-rtc
501:  0 13ab8500  NCONV_ACCU
503:  7 22ab8500  CCEOC
504:  0  1ab8500  CC_INT_CALIB
505:  0  0ab8500  LOW_BAT_F
516:  0 34ab8500  ab8500-gpadc
556:  0  0ab8500  usb-link-status

(b) FDT Mode:
root@ME:/ cat /proc/interrupts
   CPU0   CPU1
  6:  0  0ab8500  ab8500-ponkey-dbf
  7:  0  0ab8500  ab8500-ponkey-dbr
  8:  0  0ab8500  BATT_OVV
162:  0  7ab8500  ab8500-gpadc
163:  0  1ab8500
164:  0  0ab8500  ab8500-rtc
484:  0  0ab8500  usb-link-status
499:  0  4ab8500  NCONV_ACCU
500:  0  0ab8500  LOW_BAT_F
502:  0  1ab8500  CC_INT_CALIB
503:  0  6ab8500  CCEOC

c) Event handlers across bm-modules have been verified only
   during 'battery discharge process' as 'battery charging process'
   depends on ab8500-usb code

Rajanikanth H.V (4):
  mfd: ab8500: add devicetree support for fuelgauge
  mfd: ab8500: add devicetree support for btemp
  mfd: ab8500: add devicetree support for charger
  mfd: ab8500: add devicetree support for chargalg

 Documentation/devicetree/bindings/mfd/ab8500.txt   |   27 +-
 .../bindings/power_supply/ab8500/btemp.txt |   16 +
 .../bindings/power_supply/ab8500/chargalg.txt  |   16 +
 .../bindings/power_supply/ab8500/charger.txt   |   25 +
 .../devicetree/bindings/power_supply/ab8500/fg.txt |   58 +++
 arch/arm/boot/dts/dbx5x0.dtsi  |   28 +-
 drivers/mfd/ab8500-core.c  |   20 +
 drivers/power/Kconfig  |6 -
 drivers/power/Makefile |2 +-
 drivers/power/ab8500_bmdata.c  |  518 
 drivers/power/ab8500_btemp.c   |   76 +--
 drivers/power/ab8500_charger.c |   83 ++--
 drivers/power/ab8500_fg.c  |   81 +--
 drivers/power/abx500_chargalg.c|   56 ++-
 include/linux/mfd/abx500.h |   34 +-
 15 files changed, 881 insertions(+), 165 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
 create mode 100644 
Documentation/devicetree/bindings/power_supply/ab8500/chargalg.txt
 create mode 100644 
Documentation/devicetree/bindings/power_supply/ab8500/charger.txt
 create mode 100644 Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
 create mode 100644 drivers/power/ab8500_bmdata.c

-- 
1.7.10.4


___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


[PATCH 2/4] mfd: ab8500: add devicetree support for btemp

2012-10-31 Thread Rajanikanth H.V
From: "Rajanikanth H.V" 

This patch adds device tree support for
battery-temperature-monitor driver

Signed-off-by: Rajanikanth H.V 
---
 Documentation/devicetree/bindings/mfd/ab8500.txt   |6 ++
 .../bindings/power_supply/ab8500/btemp.txt |   16 +
 arch/arm/boot/dts/dbx5x0.dtsi  |5 ++
 drivers/mfd/ab8500-core.c  |5 ++
 drivers/power/Kconfig  |6 --
 drivers/power/ab8500_bmdata.c  |4 +-
 drivers/power/ab8500_btemp.c   |   66 
 7 files changed, 73 insertions(+), 35 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt

diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt 
b/Documentation/devicetree/bindings/mfd/ab8500.txt
index 6ca8d81..f2ee0e7 100644
--- a/Documentation/devicetree/bindings/mfd/ab8500.txt
+++ b/Documentation/devicetree/bindings/mfd/ab8500.txt
@@ -30,6 +30,12 @@ ab8500-fg:   : vddadc   
: Fuel Gauge
 : LOW_BAT_F:  : LOW threshold 
battery voltage
 : CC_INT_CALIB :  : Coulomb 
Counter Internal Calibration
 : CCEOC:  : Coulomb 
Counter End of Conversion
+ab8500-btemp:  : vtvout   : Battery 
Temperature
+: BAT_CTRL_INDB:  : Battery 
Removal Indicator
+: BTEMP_LOW:  : Btemp < 
BtempLow, if battery temperature is lower than -10°C
+: BTEMP_LOW_MEDIUM :  : BtempLow < 
Btemp < BtempMedium,if battery temperature is between -10 and 0°C
+: BTEMP_MEDIUM_HIGH:  : BtempMedium < 
Btemp < BtempHigh,if battery temperature is between 0°C and“MaxTemp
+: BTEMP_HIGH   :  : Btemp > 
BtempHigh, if battery temperature is higher than “MaxTemp
 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/btemp.txt 
b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
new file mode 100644
index 000..0ba1bcc
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/ab8500/btemp.txt
@@ -0,0 +1,16 @@
+=== AB8500 Battery Temperature Monitor Driver ===
+
+The properties below describes the node for btemp driver.
+
+Required Properties:
+- compatible = Shall be: "stericsson,ab8500-btemp"
+- battery = Shall be battery specific information
+
+   Example:
+   ab8500_btemp {
+   compatible = "stericsson,ab8500-btemp";
+   battery= <&ab8500_battery>;
+   };
+
+For information on battery specific node, Ref:
+Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index 68317f5..79fdee4 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -362,6 +362,11 @@
battery= <&ab8500_battery>;
};
 
+   ab8500_btemp {
+   compatible = "stericsson,ab8500-btemp";
+   battery= <&ab8500_battery>;
+   };
+
ab8500_usb {
compatible = "stericsson,ab8500-usb";
interrupts = < 90 0x4
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index 7c3017b..94d45be 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -1046,8 +1046,13 @@ 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,
+#ifndef CONFIG_OF
+   .platform_data = &ab8500_bm_data,
+   .pdata_size = sizeof(ab8500_bm_data),
+#endif
},
{
.name = "ab8500-fg",
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 measur

[PATCH 3/4] mfd: ab8500: add devicetree support for charger

2012-10-31 Thread Rajanikanth H.V
From: "Rajanikanth H.V" 

This patch adds device tree support for ab8500-charger
driver

Signed-off-by: Rajanikanth H.V 
---
 Documentation/devicetree/bindings/mfd/ab8500.txt   |   14 
 .../bindings/power_supply/ab8500/charger.txt   |   25 +++
 arch/arm/boot/dts/dbx5x0.dtsi  |6 ++
 drivers/mfd/ab8500-core.c  |5 ++
 drivers/power/ab8500_charger.c |   73 
 5 files changed, 95 insertions(+), 28 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/power_supply/ab8500/charger.txt

diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt 
b/Documentation/devicetree/bindings/mfd/ab8500.txt
index f2ee0e7..13b707b 100644
--- a/Documentation/devicetree/bindings/mfd/ab8500.txt
+++ b/Documentation/devicetree/bindings/mfd/ab8500.txt
@@ -36,6 +36,20 @@ ab8500-btemp  :  : vtvout   
: Battery Temperature
 : BTEMP_LOW_MEDIUM :  : BtempLow < 
Btemp < BtempMedium,if battery temperature is between -10 and 0°C
 : BTEMP_MEDIUM_HIGH:  : BtempMedium < 
Btemp < BtempHigh,if battery temperature is between 0°C and“MaxTemp
 : BTEMP_HIGH   :  : Btemp > 
BtempHigh, if battery temperature is higher than “MaxTemp
+ab8500-charger  :  : vddadc   : Charger 
interface
+: MAIN_CH_UNPLUG_DET   :  : main charger 
unplug detection management (not in 8505)
+: MAIN_CHARGE_PLUG_DET :  : main charger 
plug detection management (not in 8505)
+: MAIN_EXT_CH_NOT_OK   :  : main charger 
not OK
+: MAIN_CH_TH_PROT_R:  : Die temp is 
above main charger
+: MAIN_CH_TH_PROT_F:  : Die temp is 
below main charger
+: VBUS_DET_F   :  : VBUS falling 
detected
+: VBUS_DET_R   :  : VBUS rising 
detected
+: USB_LINK_STATUS  :  : USB link 
status has changed
+: USB_CH_TH_PROT_R :  : Die temp is 
above usb charger
+: USB_CH_TH_PROT_F :  : Die temp is 
below usb charger
+: USB_CHARGER_NOT_OKR  :  : allowed USB 
charger not ok detection
+: VBUS_OVV :  : Overvoltage on 
Vbus ball detected (USB charge is stopped)
+: CH_WD_EXP:  : Charger 
watchdog detected
 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/charger.txt 
b/Documentation/devicetree/bindings/power_supply/ab8500/charger.txt
new file mode 100644
index 000..6bdbb08
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/ab8500/charger.txt
@@ -0,0 +1,25 @@
+=== AB8500 Charger Driver ===
+
+Required Properties:
+- compatible = Shall be "stericsson,ab8500-charger"
+- battery = Shall be battery specific information
+   Example:
+   ab8500_charger {
+   compatible = "stericsson,ab8500-charger";
+   battery= <&ab8500_battery>;
+   };
+
+- vddadc-supply: Supply for USB and Main charger
+   Example:
+   ab8500-charger {
+   vddadc-supply   = <&ab8500_ldo_tvout_reg>;
+   }
+- autopower_cfg:
+   Boolean value depicting the presence of 'automatic poweron after 
powerloss'
+   Example:
+   ab8500-charger {
+   autopower_cfg;
+   };
+
+For information on battery specific node, Ref:
+Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index 79fdee4..b1ecb5d 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -367,6 +367,12 @@
battery= <&ab8500_battery>;
};
 
+   ab8500_charger {
+   compatible  = 
"stericsson,ab8500-charger";
+   battery = <&ab8500_battery>;
+   vddadc-supply   = 
<&ab8500_ldo_tvout_reg>;
+   };
+
ab8500_usb {
compatible = "stericsson,ab8500-usb";
interrupts = < 90 0x4
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index 94d45be..c7a120

[PATCH 4/4] mfd: ab8500: add devicetree support for chargalg

2012-10-31 Thread Rajanikanth H.V
From: "Rajanikanth H.V" 

This patch adds device tree support for charging algorithm
driver

Signed-off-by: Rajanikanth H.V 
---
 .../bindings/power_supply/ab8500/chargalg.txt  |   16 ++
 arch/arm/boot/dts/dbx5x0.dtsi  |5 ++
 drivers/mfd/ab8500-core.c  |5 ++
 drivers/power/abx500_chargalg.c|   54 ++--
 include/linux/mfd/abx500.h |6 ---
 5 files changed, 64 insertions(+), 22 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/power_supply/ab8500/chargalg.txt

diff --git a/Documentation/devicetree/bindings/power_supply/ab8500/chargalg.txt 
b/Documentation/devicetree/bindings/power_supply/ab8500/chargalg.txt
new file mode 100644
index 000..ef53283
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/ab8500/chargalg.txt
@@ -0,0 +1,16 @@
+=== AB8500 Charging Algorithm Driver ===
+
+The properties below describes the node for chargalg driver.
+
+Required Properties:
+- compatible = Shall be: "stericsson,ab8500-chargalg"
+- battery = Shall be battery specific information
+
+Example:
+ab8500_chargalg {
+   compatible = "stericsson,ab8500-chargalg";
+   battery= <&ab8500_battery>;
+};
+
+For information on battery specific node, Ref:
+Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index b1ecb5d..a678afa 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -373,6 +373,11 @@
vddadc-supply   = 
<&ab8500_ldo_tvout_reg>;
};
 
+   ab8500_chargalg {
+   compatible  = 
"stericsson,ab8500-chargalg";
+   battery = <&ab8500_battery>;
+   };
+
ab8500_usb {
compatible = "stericsson,ab8500-usb";
interrupts = < 90 0x4
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index c7a120b..5ec70f2 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -1071,8 +1071,13 @@ static struct mfd_cell __devinitdata ab8500_bm_devs[] = {
},
{
.name = "ab8500-chargalg",
+   .of_compatible = "stericsson,ab8500-chargalg",
.num_resources = ARRAY_SIZE(ab8500_chargalg_resources),
.resources = ab8500_chargalg_resources,
+#ifndef CONFIG_OF
+   .platform_data = &ab8500_bm_data,
+   .pdata_size = sizeof(ab8500_bm_data),
+#endif
},
 };
 
diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c
index 88b5cc1..c603556 100644
--- a/drivers/power/abx500_chargalg.c
+++ b/drivers/power/abx500_chargalg.c
@@ -21,6 +21,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -205,7 +207,6 @@ enum maxim_ret {
  * @chg_info:  information about connected charger types
  * @batt_data: data of the battery
  * @susp_status:   current charger suspension status
- * @pdata: pointer to the abx500_chargalg platform data
  * @bat:   pointer to the abx500_bm platform data
  * @chargalg_psy:  structure that holds the battery properties exposed by
  * the charging algorithm
@@ -231,7 +232,6 @@ struct abx500_chargalg {
struct abx500_chargalg_charger_info chg_info;
struct abx500_chargalg_battery_data batt_data;
struct abx500_chargalg_suspension_status susp_status;
-   struct abx500_bmdevs_plat_data *pdata;
struct abx500_bm_data *bat;
struct power_supply chargalg_psy;
struct ux500_charger *ac_chg;
@@ -1795,25 +1795,44 @@ static int __devexit abx500_chargalg_remove(struct 
platform_device *pdev)
flush_scheduled_work();
power_supply_unregister(&di->chargalg_psy);
platform_set_drvdata(pdev, NULL);
-   kfree(di);
 
return 0;
 }
 
+static char *supply_interface[] = {
+   "ab8500_fg",
+};
+
 static int __devinit abx500_chargalg_probe(struct platform_device *pdev)
 {
-   struct abx500_bmdevs_plat_data *plat_data;
+   struct device_node *np = pdev->dev.of_node;
+   struct abx500_chargalg *di;
int ret = 0;
 
-   struct abx500_chargalg *di =
-   kzalloc(sizeof(struct abx500_chargalg), GFP_KERNEL);
-   if (!di)
+   di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL);
+   if (!di) {
+   dev_err(&pdev->dev, "%s no mem for ab8500_chargalg\n", 
__func__);
return -ENOMEM;
+   }
+   di->bat = pdev->mfd_cell->platform_data;
+   if (!di->bat) {
+   if (np) {
+   ret = bmdevs_of_probe(&pdev->dev, np, &di->bat);
+ 

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

2012-10-31 Thread Rajanikanth H.V
From: "Rajanikanth H.V" 

- This patch adds device tree support for fuelgauge 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.
- test status:
  - interrupt numbers assigned differs between legacy and FDT mode.

Signed-off-by: Rajanikanth H.V 
---
 Documentation/devicetree/bindings/mfd/ab8500.txt   |7 +-
 .../devicetree/bindings/power_supply/ab8500/fg.txt |   58 +++
 arch/arm/boot/dts/dbx5x0.dtsi  |   12 +-
 drivers/mfd/ab8500-core.c  |5 +
 drivers/power/Makefile |2 +-
 drivers/power/ab8500_bmdata.c  |  518 
 drivers/power/ab8500_btemp.c   |   16 +-
 drivers/power/ab8500_charger.c |   16 +-
 drivers/power/ab8500_fg.c  |   81 +--
 drivers/power/abx500_chargalg.c|8 +-
 include/linux/mfd/abx500.h |   36 +-
 11 files changed, 664 insertions(+), 95 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..6ca8d81 100644
--- a/Documentation/devicetree/bindings/mfd/ab8500.txt
+++ b/Documentation/devicetree/bindings/mfd/ab8500.txt
@@ -24,7 +24,12 @@ 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 :  : Coulomb 
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..ccafcb9
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/ab8500/fg.txt
@@ -0,0 +1,58 @@
+=== 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.
+
+Fuelgauge support is part of energy-management-modules, other
+components of this module are:
+main-charger, usb-combo-charger and battery-temperature-monitoring.
+
+The properties below describes the node for fuelgauge driver.
+
+Required Properties:
+- compatible = This shall be: "stericsson,ab8500-fg"
+- battery = Shall be battery specific information
+   Example:
+   ab8500_fg {
+   compatible = "stericsson,ab8500-fg";
+   battery= <&ab8500_battery>;
+   };
+
+dependent node:
+   ab8500_battery: ab8500_battery {
+   };
+   This node will provide information on 'thermistor interface' and
+   'battery technology type' used.
+
+Properties of this node are:
+thermistor-on-batctrl:
+   A boolean value indicating thermistor interface to battery
+
+   Note:
+   'btemp' and 'batctrl' are the pins interfaced for battery temperature
+   measurement, 'btemp' signal is used when NTC(negative temperature
+   coefficient) resister is interfaced external to battery whereas
+   'batctrl' pin is used when NTC resister is internal to battery.
+
+   Example:
+   ab8500_battery: ab8500_battery {
+   thermistor-on-batctrl;
+   };
+   indicates: NTC resister is internal to battery, 'batctrl' is used
+   for thermal measurement.
+
+   The absence of property 'thermal-on-batctrl' indicates
+   NTC resister is external to battery and  'btemp' signal is used
+   for thermal measurement.
+
+battery-type:
+   This shall be the battery manufacturing technology type,
+   allowed types are:
+   "UNKNOWN" "NiMH" "LION" "LIPO" "LiFe" "NiCd" "LiMn"
+   Example:
+   a

[PATCH V3 0/4] cpuidle : multiple drivers support

2012-10-31 Thread Daniel Lezcano
The discussion about having different cpus on the system with
different latencies bring us to a first attemp by adding a
pointer in the cpuidle_device to the states array.

But as Rafael suggested, it would make more sense to create a
driver per cpu [1].

This patch adds support for multiple cpuidle drivers.

It creates a per cpu cpuidle driver pointer.

In order to not break the different drivers, the function 
cpuidle_register_driver
assign for each cpu, the driver.

The multiple driver support is optional and if it is not set, the cpuide driver
core code remains the same (except some code reorganisation).

I did the following tests compiled, booted, tested without/with CONFIG_CPU_IDLE,
with/without CONFIG_CPU_IDLE_MULTIPLE_DRIVERS.

Tested on Core2 Duo T9500 with acpi_idle [and intel_idle]
Tested on ARM Dual Cortex-A9 U8500 (aka Snowball)

V1 tested on Tegra3 and Vexpress TC2

[1] http://www.spinics.net/lists/linux-acpi/msg37921.html

Changelog:

V2:
 * fixed sysfs output : /sys/devices/system/cpu/cpu[0-9]/driver/name
 * fixed ifdefs in driver.c
 * fixed register_driver function loop when unregistering
 * removed WARN under spinlock
 * fixed changelog for patch [2/4]
 * changed cpuidle_get_cpu_driver function parameter
 * removed cpuidle_for_each_driver function
 * replaced smp_processor_id() by get_cpu/put_cpu

V3:
 * refreshed patchset

Daniel Lezcano (4):
  cpuidle: move driver's refcount to cpuidle
  cpuidle: move driver checking within the lock section
  cpuidle: prepare the driver core to be multi drivers aware
  cpuidle: support multiple drivers

 drivers/cpuidle/Kconfig   |9 ++
 drivers/cpuidle/cpuidle.c |   36 +---
 drivers/cpuidle/cpuidle.h |4 +-
 drivers/cpuidle/driver.c  |  209 ++--
 drivers/cpuidle/sysfs.c   |  174 --
 include/linux/cpuidle.h   |8 ++-
 6 files changed, 388 insertions(+), 52 deletions(-)

-- 
1.7.5.4


___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


[PATCH V3 3/4] cpuidle: prepare the driver core to be multi drivers aware

2012-10-31 Thread Daniel Lezcano
This patch is a preparation for the multiple drivers support.

As the next patch will introduce the multiple drivers with the Kconfig
option and we want to keep the code clean and understandable, this patch
defines a set of functions for encapsulating some common parts and split
what should be done in a lock context or not.

Signed-off-by: Daniel Lezcano 
Acked-by: Peter De Schrijver 
---
 drivers/cpuidle/driver.c |   60 -
 1 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 3e59075..8246662 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -39,11 +39,20 @@ static void set_power_states(struct cpuidle_driver *drv)
drv->states[i].power_usage = -1 - i;
 }
 
-/**
- * cpuidle_register_driver - registers a driver
- * @drv: the driver
- */
-int cpuidle_register_driver(struct cpuidle_driver *drv)
+static void __cpuidle_driver_init(struct cpuidle_driver *drv)
+{
+   drv->refcnt = 0;
+
+   if (!drv->power_specified)
+   set_power_states(drv);
+}
+
+static void cpuidle_set_driver(struct cpuidle_driver *drv)
+{
+   cpuidle_curr_driver = drv;
+}
+
+static int __cpuidle_register_driver(struct cpuidle_driver *drv)
 {
if (!drv || !drv->state_count)
return -EINVAL;
@@ -51,22 +60,38 @@ int cpuidle_register_driver(struct cpuidle_driver *drv)
if (cpuidle_disabled())
return -ENODEV;
 
-   spin_lock(&cpuidle_driver_lock);
-   if (cpuidle_curr_driver) {
-   spin_unlock(&cpuidle_driver_lock);
+   if (cpuidle_get_driver())
return -EBUSY;
-   }
 
-   if (!drv->power_specified)
-   set_power_states(drv);
+   __cpuidle_driver_init(drv);
 
-   drv->refcnt = 0;
+   cpuidle_set_driver(drv);
 
-   cpuidle_curr_driver = drv;
+   return 0;
+}
+
+static void __cpuidle_unregister_driver(struct cpuidle_driver *drv)
+{
+   if (drv != cpuidle_get_driver())
+   return;
+
+   if (!WARN_ON(drv->refcnt > 0))
+   cpuidle_set_driver(NULL);
+}
 
+/**
+ * cpuidle_register_driver - registers a driver
+ * @drv: the driver
+ */
+int cpuidle_register_driver(struct cpuidle_driver *drv)
+{
+   int ret;
+
+   spin_lock(&cpuidle_driver_lock);
+   ret = __cpuidle_register_driver(drv);
spin_unlock(&cpuidle_driver_lock);
 
-   return 0;
+   return ret;
 }
 EXPORT_SYMBOL_GPL(cpuidle_register_driver);
 
@@ -86,8 +111,7 @@ EXPORT_SYMBOL_GPL(cpuidle_get_driver);
 void cpuidle_unregister_driver(struct cpuidle_driver *drv)
 {
spin_lock(&cpuidle_driver_lock);
-   if (drv == cpuidle_curr_driver && !WARN_ON(drv->refcnt > 0))
-   cpuidle_curr_driver = NULL;
+   __cpuidle_unregister_driver(drv);
spin_unlock(&cpuidle_driver_lock);
 }
 EXPORT_SYMBOL_GPL(cpuidle_unregister_driver);
@@ -98,7 +122,7 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
 
spin_lock(&cpuidle_driver_lock);
 
-   drv = cpuidle_curr_driver;
+   drv = cpuidle_get_driver();
drv->refcnt++;
 
spin_unlock(&cpuidle_driver_lock);
@@ -107,7 +131,7 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
 
 void cpuidle_driver_unref(void)
 {
-   struct cpuidle_driver *drv = cpuidle_curr_driver;
+   struct cpuidle_driver *drv = cpuidle_get_driver();
 
spin_lock(&cpuidle_driver_lock);
 
-- 
1.7.5.4


___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


[PATCH V3 1/4] cpuidle: move driver's refcount to cpuidle

2012-10-31 Thread Daniel Lezcano
We want to support different cpuidle drivers co-existing together.
In this case we should move the refcount to the cpuidle_driver
structure to handle several drivers at a time.

Signed-off-by: Daniel Lezcano 
Acked-by: Peter De Schrijver 
---
 drivers/cpuidle/driver.c |   13 -
 include/linux/cpuidle.h  |1 +
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 87db387..39ba8e1 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -16,7 +16,6 @@
 
 static struct cpuidle_driver *cpuidle_curr_driver;
 DEFINE_SPINLOCK(cpuidle_driver_lock);
-int cpuidle_driver_refcount;
 
 static void set_power_states(struct cpuidle_driver *drv)
 {
@@ -61,6 +60,8 @@ int cpuidle_register_driver(struct cpuidle_driver *drv)
if (!drv->power_specified)
set_power_states(drv);
 
+   drv->refcnt = 0;
+
cpuidle_curr_driver = drv;
 
spin_unlock(&cpuidle_driver_lock);
@@ -92,7 +93,7 @@ void cpuidle_unregister_driver(struct cpuidle_driver *drv)
 
spin_lock(&cpuidle_driver_lock);
 
-   if (!WARN_ON(cpuidle_driver_refcount > 0))
+   if (!WARN_ON(drv->refcnt > 0))
cpuidle_curr_driver = NULL;
 
spin_unlock(&cpuidle_driver_lock);
@@ -106,7 +107,7 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
spin_lock(&cpuidle_driver_lock);
 
drv = cpuidle_curr_driver;
-   cpuidle_driver_refcount++;
+   drv->refcnt++;
 
spin_unlock(&cpuidle_driver_lock);
return drv;
@@ -114,10 +115,12 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
 
 void cpuidle_driver_unref(void)
 {
+   struct cpuidle_driver *drv = cpuidle_curr_driver;
+
spin_lock(&cpuidle_driver_lock);
 
-   if (!WARN_ON(cpuidle_driver_refcount <= 0))
-   cpuidle_driver_refcount--;
+   if (drv && !WARN_ON(drv->refcnt <= 0))
+   drv->refcnt--;
 
spin_unlock(&cpuidle_driver_lock);
 }
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 7daf0e3..d08e1af 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -124,6 +124,7 @@ static inline int cpuidle_get_last_residency(struct 
cpuidle_device *dev)
 struct cpuidle_driver {
const char  *name;
struct module   *owner;
+   int refcnt;
 
unsigned intpower_specified:1;
/* set to 1 to use the core cpuidle time keeping (for all states). */
-- 
1.7.5.4


___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


[PATCH V3 2/4] cpuidle: move driver checking within the lock section

2012-10-31 Thread Daniel Lezcano
The code is racy and the check with cpuidle_curr_driver should be
done under the lock.

I don't find a path in the different drivers where that could happen
because the arch specific drivers are written in such way it is not
possible to register a driver while it is unregistered, except maybe
in a very improbable case when "intel_idle" and "processor_idle" are
competing. One could unregister a driver, while the other one is
registering.

Signed-off-by: Daniel Lezcano 
Acked-by: Peter De Schrijver 
---
 drivers/cpuidle/driver.c |   10 +-
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 39ba8e1..3e59075 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -85,17 +85,9 @@ EXPORT_SYMBOL_GPL(cpuidle_get_driver);
  */
 void cpuidle_unregister_driver(struct cpuidle_driver *drv)
 {
-   if (drv != cpuidle_curr_driver) {
-   WARN(1, "invalid cpuidle_unregister_driver(%s)\n",
-   drv->name);
-   return;
-   }
-
spin_lock(&cpuidle_driver_lock);
-
-   if (!WARN_ON(drv->refcnt > 0))
+   if (drv == cpuidle_curr_driver && !WARN_ON(drv->refcnt > 0))
cpuidle_curr_driver = NULL;
-
spin_unlock(&cpuidle_driver_lock);
 }
 EXPORT_SYMBOL_GPL(cpuidle_unregister_driver);
-- 
1.7.5.4


___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


[PATCH V3 4/4] cpuidle: support multiple drivers

2012-10-31 Thread Daniel Lezcano
With the tegra3 and the big.LITTLE [1] new architectures, several cpus
with different characteristics (latencies and states) can co-exists on the
system.

The cpuidle framework has the limitation of handling only identical cpus.

This patch removes this limitation by introducing the multiple driver support
for cpuidle.

This option is configurable at compile time and should be enabled for the
architectures mentioned above. So there is no impact for the other platforms
if the option is disabled. The option defaults to 'n'. Note the multiple drivers
support is also compatible with the existing drivers, even if just one driver is
needed, all the cpu will be tied to this driver using an extra small chunk of
processor memory.

The multiple driver support use a per-cpu driver pointer instead of a global
variable and the accessor to this variable are done from a cpu context.

In order to keep the compatibility with the existing drivers, the function
'cpuidle_register_driver' and 'cpuidle_unregister_driver' will register
the specified driver for all the cpus.

The semantic for the output of /sys/devices/system/cpu/cpuidle/current_driver
remains the same except the driver name will be related to the current cpu.

The /sys/devices/system/cpu/cpu[0-9]/cpuidle/driver/name files are added
allowing to read the per cpu driver name.

[1] http://lwn.net/Articles/481055/


Signed-off-by: Daniel Lezcano 
Acked-by: Peter De Schrijver 
---
 drivers/cpuidle/Kconfig   |9 +++
 drivers/cpuidle/cpuidle.c |   36 ++
 drivers/cpuidle/cpuidle.h |4 +-
 drivers/cpuidle/driver.c  |  166 ++-
 drivers/cpuidle/sysfs.c   |  174 +++--
 include/linux/cpuidle.h   |7 ++-
 6 files changed, 356 insertions(+), 40 deletions(-)

diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index a76b689..234ae65 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -9,6 +9,15 @@ config CPU_IDLE
 
  If you're using an ACPI-enabled platform, you should say Y here.
 
+config CPU_IDLE_MULTIPLE_DRIVERS
+bool "Support multiple cpuidle drivers"
+depends on CPU_IDLE
+default n
+help
+ Allows the cpuidle framework to use different drivers for each CPU.
+ This is useful if you have a system with different CPU latencies and
+ states. If unsure say N.
+
 config CPU_IDLE_GOV_LADDER
bool
depends on CPU_IDLE
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index ce4cac7..711dd83 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -68,7 +68,7 @@ static cpuidle_enter_t cpuidle_enter_ops;
 int cpuidle_play_dead(void)
 {
struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
-   struct cpuidle_driver *drv = cpuidle_get_driver();
+   struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
int i, dead_state = -1;
int power_usage = -1;
 
@@ -128,7 +128,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct 
cpuidle_driver *drv,
 int cpuidle_idle_call(void)
 {
struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
-   struct cpuidle_driver *drv = cpuidle_get_driver();
+   struct cpuidle_driver *drv;
int next_state, entered_state;
 
if (off)
@@ -141,6 +141,8 @@ int cpuidle_idle_call(void)
if (!dev || !dev->enabled)
return -EBUSY;
 
+   drv = cpuidle_get_cpu_driver(dev);
+
/* ask the governor for the next state */
next_state = cpuidle_curr_governor->select(drv, dev);
if (need_resched()) {
@@ -312,15 +314,19 @@ static void poll_idle_init(struct cpuidle_driver *drv) {}
 int cpuidle_enable_device(struct cpuidle_device *dev)
 {
int ret, i;
-   struct cpuidle_driver *drv = cpuidle_get_driver();
+   struct cpuidle_driver *drv;
 
if (!dev)
return -EINVAL;
 
if (dev->enabled)
return 0;
+
+   drv = cpuidle_get_cpu_driver(dev);
+
if (!drv || !cpuidle_curr_governor)
return -EIO;
+
if (!dev->state_count)
dev->state_count = drv->state_count;
 
@@ -335,7 +341,8 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 
poll_idle_init(drv);
 
-   if ((ret = cpuidle_add_state_sysfs(dev)))
+   ret = cpuidle_add_device_sysfs(dev);
+   if (ret)
return ret;
 
if (cpuidle_curr_governor->enable &&
@@ -356,7 +363,7 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
return 0;
 
 fail_sysfs:
-   cpuidle_remove_state_sysfs(dev);
+   cpuidle_remove_device_sysfs(dev);
 
return ret;
 }
@@ -372,17 +379,20 @@ EXPORT_SYMBOL_GPL(cpuidle_enable_device);
  */
 void cpuidle_disable_device(struct cpuidle_device *dev)
 {
+   struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
+
if (!dev || !dev->enabled)
return;
-   

Re: Linaro Website Contact

2012-10-31 Thread Loïc Minier
Hey

(Cc:ing linaro-dev@ where we usually discuss technical stuff)

On Wed, Oct 31, 2012, sundar.subramani...@gmail.com wrote:
> This is great. Just tried the pre-compiled image and works like a charm.
> It took a little longer than two minutes though on my i3/4Gig machine.
> Haven't yet tried compiling anything yet but how do i get started with
> porting some libraries to armv8? Just compile with the toolchain and run?

Great!

This page gives some ideas on how to rebuild the filesystem and how to
fix some common issues:
https://wiki.linaro.org/HowTo/ARMv8/OpenEmbedded

Perhaps you want to try to build this or that software you care about,
or just try "bitbake world" to build as many things as possible and see
what breaks  :-)

 Cheers,
-- 
Loïc Minier

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


RE: [PATCH V3 4/5] Thermal: Add ST-Ericsson DB8500 thermal driver.

2012-10-31 Thread Zhang, Rui


> -Original Message-
> From: hongbo.zhang [mailto:hongbo.zh...@linaro.org]
> Sent: Wednesday, October 31, 2012 12:49 AM
> To: linaro-dev@lists.linaro.org; linux-ker...@vger.kernel.org; linux-
> p...@vger.kernel.org; Zhang, Rui; amit.kach...@linaro.org
> Cc: patc...@linaro.org; linaro-ker...@lists.linaro.org;
> stericsson_nomadik_li...@list.st.com; ker...@igloocommunity.org;
> hongbo.zhang
> Subject: [PATCH V3 4/5] Thermal: Add ST-Ericsson DB8500 thermal driver.
> Importance: High
> 
> From: "hongbo.zhang" 
> 
> This diver is based on the thermal management framework in
> thermal_sys.c. A thermal zone device is created with the trip points to
> which cooling devices can be bound, the current cooling device is
> cpufreq, e.g. CPU frequency is clipped down to cool the CPU, and other
> cooling devices can be added and bound to the trip points dynamically.
> The platform specific PRCMU interrupts are used to active thermal
> update when trip points are reached.
> 
> Signed-off-by: hongbo.zhang 
> ---
>  .../devicetree/bindings/thermal/db8500-thermal.txt |  40 ++
>  drivers/thermal/Kconfig|  20 +
>  drivers/thermal/Makefile   |   2 +
>  drivers/thermal/db8500_cpufreq_cooling.c   | 108 +
>  drivers/thermal/db8500_thermal.c   | 531
> +
>  include/linux/platform_data/db8500_thermal.h   |  38 ++
>  6 files changed, 739 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/db8500-
> thermal.txt
>  create mode 100644 drivers/thermal/db8500_cpufreq_cooling.c
>  create mode 100644 drivers/thermal/db8500_thermal.c  create mode
> 100644 include/linux/platform_data/db8500_thermal.h
> 
> diff --git a/Documentation/devicetree/bindings/thermal/db8500-
> thermal.txt b/Documentation/devicetree/bindings/thermal/db8500-
> thermal.txt
> new file mode 100644
> index 000..cab6916
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/db8500-thermal.txt
> @@ -0,0 +1,40 @@
> +* ST-Ericsson DB8500 Thermal
> +
> +** Thermal node properties:
> +
> +- compatible : "stericsson,db8500-thermal";
> +- reg : address range of the thermal sensor registers;
> +- interrupts : interrupts generated from PRCMU;
> +- interrupt-names : "IRQ_HOTMON_LOW" and "IRQ_HOTMON_HIGH";
> +- num-trips : number of total trip points;
> +- tripN-temp : temperature of trip point N, should be in ascending
> +order;
> +- tripN-type : type of trip point N, should be one of "active"
> +"passive" "hot" "critical";
> +- tripN-cdev-num : number of the cooling devices which can be bound to
> +trip point N;
> +- tripN-cdev-nameM : name of the No. M cooling device of trip point N;
> +
> +Usually the num-trips and tripN-*** are separated in board related dts
> files.
> +
> +Example:
> +thermal@801573c0 {
> + compatible = "stericsson,db8500-thermal";
> + reg = <0x801573c0 0x40>;
> + interrupts = <21 0x4>, <22 0x4>;
> + interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH";
> +
> + num-trips = <3>;
> +
> + trip0-temp = <7>;
> + trip0-type = "active";
> + trip0-cdev-num = <1>;
> + trip0-cdev-name0 = "thermal-cpufreq-0";
> +
> + trip1-temp = <75000>;
> + trip1-type = "active";
> + trip1-cdev-num = <2>;
> + trip1-cdev-name0 = "thermal-cpufreq-0";
> + trip1-cdev-name1 = "thermal-fan";
> +
> + trip2-temp = <85000>;
> + trip2-type = "critical";
> + trip2-cdev-num = <0>;
> +}
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index
> e1cb6bd..54c8fd0 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -31,6 +31,26 @@ config CPU_THERMAL
> and not the ACPI interface.
> If you want this support, you should say Y here.
> 
> +config DB8500_THERMAL
> + bool "DB8500 thermal management"
> + depends on THERMAL
> + default y
> + help
> +   Adds DB8500 thermal management implementation according to the
> thermal
> +   management framework. A thermal zone with several trip points
> will be
> +   created. Cooling devices can be bound to the trip points to
> cool this
> +   thermal zone if trip points reached.
> +
> +config DB8500_CPUFREQ_COOLING
> + tristate "DB8500 cpufreq cooling"
> + depends on CPU_THERMAL
> + default y
> + help
> +   Adds DB8500 cpufreq cooling devices, and these cooling devices
> can be
> +   bound to thermal zone trip points. When a trip point reached,
> the
> +   bound cpufreq cooling device turns active to set CPU frequency
> low to
> +   cool down the CPU.
> +
>  config SPEAR_THERMAL
>   bool "SPEAr thermal sensor driver"
>   depends on THERMAL
> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index
> 885550d..c7a8dab 100644
> --- a/drivers/thermal/Makefile
> +++ b/drivers/thermal/Makefile
> @@ -7,3 +7,5 @@ obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o
>  obj-$(CONFIG_SPEAR_THERMAL)  += spear_ther