Re: [PATCHv2 3/4] power: Add Qualcomm SMBB driver

2015-09-22 Thread Sebastian Reichel
Hi,

On Tue, Sep 15, 2015 at 06:33:00AM -0700, Bjorn Andersson wrote:
> On Tue 15 Sep 05:43 PDT 2015, Sebastian Reichel wrote:
> 
> > Hi,
> > 
> > On Thu, Jul 30, 2015 at 10:53:56AM -0700, Bjorn Andersson wrote:
> > > From: Courtney Cavin 
> > > 
> > > Add the Qualcomm Switch-Mode Battery Charger and Boost driver, found in
> > > pm8941.
> > > 
> > > Signed-off-by: Courtney Cavin 
> > > Signed-off-by: Bjorn Andersson 
> > > ---
> > > 
> > > Changes since v1:
> > > - Corrected authorship
> > > - Dropped MODULE_ALIAS
> > 
> > Acked-By: Sebastian Reichel 
> > 
> > I think the first patch made it into 4.3, so I can simply queue this
> > patch together with the DT binding?
> > 
> 
> That is correct, sorry for it not being mentioned in the thread.

Thanks, queued.

-- Sebastian


signature.asc
Description: Digital signature


Re: [PATCHv2 3/4] power: Add Qualcomm SMBB driver

2015-09-15 Thread Bjorn Andersson
On Tue 15 Sep 05:43 PDT 2015, Sebastian Reichel wrote:

> Hi,
> 
> On Thu, Jul 30, 2015 at 10:53:56AM -0700, Bjorn Andersson wrote:
> > From: Courtney Cavin 
> > 
> > Add the Qualcomm Switch-Mode Battery Charger and Boost driver, found in
> > pm8941.
> > 
> > Signed-off-by: Courtney Cavin 
> > Signed-off-by: Bjorn Andersson 
> > ---
> > 
> > Changes since v1:
> > - Corrected authorship
> > - Dropped MODULE_ALIAS
> 
> Acked-By: Sebastian Reichel 
> 
> I think the first patch made it into 4.3, so I can simply queue this
> patch together with the DT binding?
> 

That is correct, sorry for it not being mentioned in the thread.

Thanks,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 3/4] power: Add Qualcomm SMBB driver

2015-09-15 Thread Sebastian Reichel
Hi,

On Thu, Jul 30, 2015 at 10:53:56AM -0700, Bjorn Andersson wrote:
> From: Courtney Cavin 
> 
> Add the Qualcomm Switch-Mode Battery Charger and Boost driver, found in
> pm8941.
> 
> Signed-off-by: Courtney Cavin 
> Signed-off-by: Bjorn Andersson 
> ---
> 
> Changes since v1:
> - Corrected authorship
> - Dropped MODULE_ALIAS

Acked-By: Sebastian Reichel 

I think the first patch made it into 4.3, so I can simply queue this
patch together with the DT binding?

-- Sebastian


signature.asc
Description: Digital signature


Re: [PATCHv2 3/4] power: Add Qualcomm SMBB driver

2015-08-28 Thread Bjorn Andersson
On Thu 30 Jul 10:53 PDT 2015, Bjorn Andersson wrote:

Ping?

> From: Courtney Cavin 
> 
> Add the Qualcomm Switch-Mode Battery Charger and Boost driver, found in
> pm8941.
> 
> Signed-off-by: Courtney Cavin 
> Signed-off-by: Bjorn Andersson 
> ---
> 
> Changes since v1:
> - Corrected authorship
> - Dropped MODULE_ALIAS
> 
>  drivers/power/Kconfig |  12 +
>  drivers/power/Makefile|   1 +
>  drivers/power/qcom_smbb.c | 951 
> ++
>  3 files changed, 964 insertions(+)
>  create mode 100644 drivers/power/qcom_smbb.c
> 
> diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
> index 08beeed5485d..cfc236655661 100644
> --- a/drivers/power/Kconfig
> +++ b/drivers/power/Kconfig
> @@ -379,6 +379,18 @@ config CHARGER_MAX8998
>   Say Y to enable support for the battery charger control sysfs and
>   platform data of MAX8998/LP3974 PMICs.
> 
> +config CHARGER_QCOM_SMBB
> +   tristate "Qualcomm Switch-Mode Battery Charger and Boost"
> +   depends on MFD_SPMI_PMIC || COMPILE_TEST
> +   depends on OF
> +   help
> + Say Y to include support for the Switch-Mode Battery Charger and
> + Boost (SMBB) hardware found in Qualcomm PM8941 PMICs.  The charger
> + is an integrated, single-cell lithium-ion battery charger.  DT
> + configuration is required for loading, see the devicetree
> + documentation for more detail.  The base name for this driver is
> + 'pm8941_charger'.
> +
>  config CHARGER_BQ2415X
> tristate "TI BQ2415x battery charger driver"
> depends on I2C
> diff --git a/drivers/power/Makefile b/drivers/power/Makefile
> index 5752ce818f51..48e459243820 100644
> --- a/drivers/power/Makefile
> +++ b/drivers/power/Makefile
> @@ -57,6 +57,7 @@ obj-$(CONFIG_CHARGER_MAX14577)+= max14577_charger.o
>  obj-$(CONFIG_CHARGER_MAX77693) += max77693_charger.o
>  obj-$(CONFIG_CHARGER_MAX8997)  += max8997_charger.o
>  obj-$(CONFIG_CHARGER_MAX8998)  += max8998_charger.o
> +obj-$(CONFIG_CHARGER_QCOM_SMBB)+= qcom_smbb.o
>  obj-$(CONFIG_CHARGER_BQ2415X)  += bq2415x_charger.o
>  obj-$(CONFIG_CHARGER_BQ24190)  += bq24190_charger.o
>  obj-$(CONFIG_CHARGER_BQ24257)  += bq24257_charger.o
> diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
> new file mode 100644
> index ..0dabfe8cceb2
> --- /dev/null
> +++ b/drivers/power/qcom_smbb.c
> @@ -0,0 +1,951 @@
> +/* Copyright (c) 2014, Sony Mobile Communications Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * This driver is for the multi-block Switch-Mode Battery Charger and Boost
> + * (SMBB) hardware, found in Qualcomm PM8941 PMICs.  The charger is an
> + * integrated, single-cell lithium-ion battery charger.
> + *
> + * Sub-components:
> + *  - Charger core
> + *  - Buck
> + *  - DC charge-path
> + *  - USB charge-path
> + *  - Battery interface
> + *  - Boost (not implemented)
> + *  - Misc
> + *  - HF-Buck
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define SMBB_CHG_VMAX  0x040
> +#define SMBB_CHG_VSAFE 0x041
> +#define SMBB_CHG_CFG   0x043
> +#define SMBB_CHG_IMAX  0x044
> +#define SMBB_CHG_ISAFE 0x045
> +#define SMBB_CHG_VIN_MIN   0x047
> +#define SMBB_CHG_CTRL  0x049
> +#define CTRL_ENBIT(7)
> +#define SMBB_CHG_VBAT_WEAK 0x052
> +#define SMBB_CHG_IBAT_TERM_CHG 0x05b
> +#define IBAT_TERM_CHG_IEOC BIT(7)
> +#define IBAT_TERM_CHG_IEOC_BMS BIT(7)
> +#define IBAT_TERM_CHG_IEOC_CHG 0
> +#define SMBB_CHG_VBAT_DET  0x05d
> +#define SMBB_CHG_TCHG_MAX_EN   0x060
> +#define TCHG_MAX_ENBIT(7)
> +#define SMBB_CHG_WDOG_TIME 0x062
> +#define SMBB_CHG_WDOG_EN   0x065
> +#define WDOG_ENBIT(7)
> +
> +#define SMBB_BUCK_REG_MODE 0x174
> +#define BUCK_REG_MODE  BIT(0)
> +#define BUCK_REG_MODE_VBAT BIT(0)
> +#define BUCK_REG_MODE_VSYS 0
> +
> +#define SMBB_BAT_PRES_STATUS   0x208
> +#define PRES_STATUS_BAT_PRES   BIT(7)
> +#define SMBB_BAT_TEMP_STATUS   0x209
> +#define TEMP_STATUS_OK BIT(7)
> +#define TEMP_STATUS_HOTBIT(6)
> +#define SMBB_BAT_BTC_CTRL  0x249
> +#define BTC_CTRL_COMP_EN   BIT(7)
> +#define BTC_CTRL_COLD_EXT  BIT(1)
> +#define BTC_CTRL_HOT_EXT_N BIT(0)
> +
> +#define SMBB_USB_IMAX  0x344
> +#define SMBB_USB_ENUM_TIMER_STOP 0x34e
> +#define ENUM_TIMER_STOP   

[PATCHv2 3/4] power: Add Qualcomm SMBB driver

2015-07-30 Thread Bjorn Andersson
From: Courtney Cavin 

Add the Qualcomm Switch-Mode Battery Charger and Boost driver, found in
pm8941.

Signed-off-by: Courtney Cavin 
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Corrected authorship
- Dropped MODULE_ALIAS

 drivers/power/Kconfig |  12 +
 drivers/power/Makefile|   1 +
 drivers/power/qcom_smbb.c | 951 ++
 3 files changed, 964 insertions(+)
 create mode 100644 drivers/power/qcom_smbb.c

diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 08beeed5485d..cfc236655661 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -379,6 +379,18 @@ config CHARGER_MAX8998
  Say Y to enable support for the battery charger control sysfs and
  platform data of MAX8998/LP3974 PMICs.
 
+config CHARGER_QCOM_SMBB
+   tristate "Qualcomm Switch-Mode Battery Charger and Boost"
+   depends on MFD_SPMI_PMIC || COMPILE_TEST
+   depends on OF
+   help
+ Say Y to include support for the Switch-Mode Battery Charger and
+ Boost (SMBB) hardware found in Qualcomm PM8941 PMICs.  The charger
+ is an integrated, single-cell lithium-ion battery charger.  DT
+ configuration is required for loading, see the devicetree
+ documentation for more detail.  The base name for this driver is
+ 'pm8941_charger'.
+
 config CHARGER_BQ2415X
tristate "TI BQ2415x battery charger driver"
depends on I2C
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 5752ce818f51..48e459243820 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -57,6 +57,7 @@ obj-$(CONFIG_CHARGER_MAX14577)+= max14577_charger.o
 obj-$(CONFIG_CHARGER_MAX77693) += max77693_charger.o
 obj-$(CONFIG_CHARGER_MAX8997)  += max8997_charger.o
 obj-$(CONFIG_CHARGER_MAX8998)  += max8998_charger.o
+obj-$(CONFIG_CHARGER_QCOM_SMBB)+= qcom_smbb.o
 obj-$(CONFIG_CHARGER_BQ2415X)  += bq2415x_charger.o
 obj-$(CONFIG_CHARGER_BQ24190)  += bq24190_charger.o
 obj-$(CONFIG_CHARGER_BQ24257)  += bq24257_charger.o
diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
new file mode 100644
index ..0dabfe8cceb2
--- /dev/null
+++ b/drivers/power/qcom_smbb.c
@@ -0,0 +1,951 @@
+/* Copyright (c) 2014, Sony Mobile Communications Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This driver is for the multi-block Switch-Mode Battery Charger and Boost
+ * (SMBB) hardware, found in Qualcomm PM8941 PMICs.  The charger is an
+ * integrated, single-cell lithium-ion battery charger.
+ *
+ * Sub-components:
+ *  - Charger core
+ *  - Buck
+ *  - DC charge-path
+ *  - USB charge-path
+ *  - Battery interface
+ *  - Boost (not implemented)
+ *  - Misc
+ *  - HF-Buck
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SMBB_CHG_VMAX  0x040
+#define SMBB_CHG_VSAFE 0x041
+#define SMBB_CHG_CFG   0x043
+#define SMBB_CHG_IMAX  0x044
+#define SMBB_CHG_ISAFE 0x045
+#define SMBB_CHG_VIN_MIN   0x047
+#define SMBB_CHG_CTRL  0x049
+#define CTRL_ENBIT(7)
+#define SMBB_CHG_VBAT_WEAK 0x052
+#define SMBB_CHG_IBAT_TERM_CHG 0x05b
+#define IBAT_TERM_CHG_IEOC BIT(7)
+#define IBAT_TERM_CHG_IEOC_BMS BIT(7)
+#define IBAT_TERM_CHG_IEOC_CHG 0
+#define SMBB_CHG_VBAT_DET  0x05d
+#define SMBB_CHG_TCHG_MAX_EN   0x060
+#define TCHG_MAX_ENBIT(7)
+#define SMBB_CHG_WDOG_TIME 0x062
+#define SMBB_CHG_WDOG_EN   0x065
+#define WDOG_ENBIT(7)
+
+#define SMBB_BUCK_REG_MODE 0x174
+#define BUCK_REG_MODE  BIT(0)
+#define BUCK_REG_MODE_VBAT BIT(0)
+#define BUCK_REG_MODE_VSYS 0
+
+#define SMBB_BAT_PRES_STATUS   0x208
+#define PRES_STATUS_BAT_PRES   BIT(7)
+#define SMBB_BAT_TEMP_STATUS   0x209
+#define TEMP_STATUS_OK BIT(7)
+#define TEMP_STATUS_HOTBIT(6)
+#define SMBB_BAT_BTC_CTRL  0x249
+#define BTC_CTRL_COMP_EN   BIT(7)
+#define BTC_CTRL_COLD_EXT  BIT(1)
+#define BTC_CTRL_HOT_EXT_N BIT(0)
+
+#define SMBB_USB_IMAX  0x344
+#define SMBB_USB_ENUM_TIMER_STOP 0x34e
+#define ENUM_TIMER_STOPBIT(0)
+#define SMBB_USB_SEC_ACCESS0x3d0
+#define SEC_ACCESS_MAGIC   0xa5
+#define SMBB_USB_REV_BST   0x3ed
+#define REV_BST_CHG_GONE   BIT(7)
+
+#define SMBB_DC_IMAX   0x444
+
+#define SMBB_MISC_REV2 0x601
+#define SMBB_MISC_BOOT_DONE0x642
+#define BOOT_DONE  BIT(7)
+
+#define S