summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJonghwa Lee <jonghwa3.lee@samsung.com>2013-04-02 17:08:58 +0900
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:42:58 +0900
commitff8bf393c78bbeadd92fab12584818623889c3c7 (patch)
tree721e89a1ab74fe0db160621373746d7ee5234cf2 /include
parent3c2953e5f11fb689b1a93119775fc33e4e8f7f1b (diff)
downloadlinux-3.10-ff8bf393c78bbeadd92fab12584818623889c3c7.tar.gz
linux-3.10-ff8bf393c78bbeadd92fab12584818623889c3c7.tar.bz2
linux-3.10-ff8bf393c78bbeadd92fab12584818623889c3c7.zip
power: max77693: Add max77693 charger dirver.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mfd/max77693.h8
-rw-r--r--include/linux/power/max77693_charger.h177
2 files changed, 185 insertions, 0 deletions
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 77d82074b1d..f42ae8ab78a 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -54,6 +54,11 @@ struct max77693_reg_data {
u8 data;
};
+struct max77693_charger_platform_data {
+ struct max77693_reg_data *init_data;
+ int num_init_data;
+};
+
struct max77693_muic_platform_data {
struct max77693_reg_data *init_data;
int num_init_data;
@@ -78,6 +83,9 @@ struct max77693_platform_data {
struct max77693_regulator_data *regulators;
int num_regulators;
+ /* charger data */
+ struct max77693_charger_platform_data *charger_data;
+
/* muic data */
struct max77693_muic_platform_data *muic_data;
};
diff --git a/include/linux/power/max77693_charger.h b/include/linux/power/max77693_charger.h
new file mode 100644
index 00000000000..0ad2f39c79c
--- /dev/null
+++ b/include/linux/power/max77693_charger.h
@@ -0,0 +1,177 @@
+/*
+ * max77693_charger.h
+ * Samsung max77693 Charger Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ *
+ */
+#ifndef __MAX77693_CHARGER_H
+#define __MAX77693_CHARGER_H __FILE__
+#include <linux/mfd/core.h>
+#include <linux/mfd/max77693_sec.h>
+#include <linux/mfd/max77693-private_sec.h>
+#include <linux/regulator/machine.h>
+
+#define ENABLE 1
+#define DISABLE 0
+
+/* macro */
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define ABS(x) ((x) < 0 ? (-1 * (x)) : (x))
+/*
+ * Use for battery
+ */
+#define OFF_CURR 0 /* charger off current */
+#define KEEP_CURR -1 /* keep previous current */
+
+/* MAX77693_CHG_REG_CHG_INT */
+#define MAX77693_BYP_I (1 << 0)
+#if defined(CONFIG_CHARGER_MAX77803)
+#define MAX77693_BATP_I (1 << 2)
+#else
+#define MAX77693_THM_I (1 << 2)
+#endif
+#define MAX77693_BAT_I (1 << 3)
+#define MAX77693_CHG_I (1 << 4)
+#if defined(CONFIG_CHARGER_MAX77803)
+#define MAX77693_WCIN_I (1 << 5)
+#endif
+#define MAX77693_CHGIN_I (1 << 6)
+
+/* MAX77693_CHG_REG_CHG_INT_MASK */
+#define MAX77693_BYP_IM (1 << 0)
+#define MAX77693_THM_IM (1 << 2)
+#define MAX77693_BAT_IM (1 << 3)
+#define MAX77693_CHG_IM (1 << 4)
+#if defined(CONFIG_CHARGER_MAX77803)
+#define MAX77693_WCIN_IM (1 << 5)
+#endif
+#define MAX77693_CHGIN_IM (1 << 6)
+
+/* MAX77693_CHG_REG_CHG_INT_OK */
+#define MAX77693_BYP_OK 0x01
+#define MAX77693_BYP_OK_SHIFT 0
+#if defined(CONFIG_CHARGER_MAX77803)
+#define MAX77693_BATP_OK 0x04
+#define MAX77693_BATP_OK_SHIFT 2
+#else
+#define MAX77693_THM_OK 0x04
+#define MAX77693_THM_OK_SHIFT 2
+#endif
+#define MAX77693_BAT_OK 0x08
+#define MAX77693_BAT_OK_SHIFT 3
+#define MAX77693_CHG_OK 0x10
+#define MAX77693_CHG_OK_SHIFT 4
+#if defined(CONFIG_CHARGER_MAX77803)
+#define MAX77693_WCIN_OK 0x20
+#define MAX77693_WCIN_OK_SHIFT 5
+#endif
+#define MAX77693_CHGIN_OK 0x40
+#define MAX77693_CHGIN_OK_SHIFT 6
+#define MAX77693_DETBAT 0x80
+#define MAX77693_DETBAT_SHIFT 7
+
+/* MAX77693_CHG_REG_CHG_DTLS_00 */
+#if defined(CONFIG_CHARGER_MAX77803)
+#define MAX77693_BATP_DTLS 0x01
+#define MAX77693_BATP_DTLS_SHIFT 0
+#else
+#define MAX77693_THM_DTLS 0x07
+#define MAX77693_THM_DTLS_SHIFT 0
+#endif
+#if defined(CONFIG_CHARGER_MAX77803)
+#define MAX77693_WCIN_DTLS 0x18
+#define MAX77693_WCIN_DTLS_SHIFT 3
+#endif
+#define MAX77693_CHGIN_DTLS 0x60
+#define MAX77693_CHGIN_DTLS_SHIFT 5
+
+/* MAX77693_CHG_REG_CHG_DTLS_01 */
+#define MAX77693_CHG_DTLS 0x0F
+#define MAX77693_CHG_DTLS_SHIFT 0
+#define MAX77693_BAT_DTLS 0x70
+#define MAX77693_BAT_DTLS_SHIFT 4
+
+/* MAX77693_CHG_REG_CHG_DTLS_02 */
+#define MAX77693_BYP_DTLS 0x0F
+#define MAX77693_BYP_DTLS_SHIFT 0
+#define MAX77693_BYP_DTLS0 0x1
+#define MAX77693_BYP_DTLS1 0x2
+#define MAX77693_BYP_DTLS2 0x4
+#define MAX77693_BYP_DTLS3 0x8
+
+/* MAX77693_CHG_REG_CHG_CNFG_00 */
+#define MAX77693_MODE_DEFAULT 0x04
+#define MAX77693_MODE_CHGR 0x01
+#define MAX77693_MODE_OTG 0x02
+#define MAX77693_MODE_BUCK 0x04
+
+/* MAX77693_CHG_REG_CHG_CNFG_02 */
+#define MAX77693_CHG_CC 0x3F
+
+/* MAX77693_CHG_REG_CHG_CNFG_03 */
+#define MAX77693_CHG_TO_ITH 0x07
+
+/* MAX77693_CHG_REG_CHG_CNFG_04 */
+#define MAX77693_CHG_MINVSYS_MASK 0xE0
+#define MAX77693_CHG_MINVSYS_SHIFT 5
+#define MAX77693_CHG_PRM_MASK 0x1F
+#define MAX77693_CHG_PRM_SHIFT 0
+
+/* MAX77693_CHG_REG_CHG_CNFG_09 */
+#define MAX77693_CHG_CHGIN_LIM 0x7F
+
+/* MAX77693_CHG_REG_CHG_CNFG_12 */
+#define MAX77693_CHG_WCINSEL 0x40
+
+/* MAX77693_MUIC_REG_CDETCTRL1 */
+#define MAX77693_CHGTYPMAN 0x02
+#define MAX77693_CHGTYPMAN_SHIFT 1
+
+/* MAX77693_MUIC_REG_STATUS2 */
+#define MAX77693_VBVOLT 0x40
+#define MAX77693_VBVOLT_SHIFT 6
+#define MAX77693_CHGDETRUN 0x08
+#define MAX77693_CHGDETRUN_SHIFT 3
+#define MAX77693_CHGTYPE 0x07
+#define MAX77693_CHGTYPE_SHIFT 0
+
+/* irq */
+#define IRQ_DEBOUNCE_TIME 20 /* msec */
+
+/* charger type detection */
+#define DET_ERR_RETRY 5
+#define DET_ERR_DELAY 200
+
+/* soft charging */
+#define SOFT_CHG_START_CURR 100 /* mA */
+#define SOFT_CHG_START_DUR 100 /* ms */
+#define SOFT_CHG_CURR_STEP 100 /* mA */
+#define SOFT_CHG_STEP_DUR 20 /* ms */
+
+#define DEFAULT_AC_CURRENT 1600 /* mA */
+#define DEFAULT_USB_CURRENT 500 /* mA */
+
+#ifndef CONFIG_MACH_SLP_ADONIS
+enum {
+ POWER_SUPPLY_VBUS_UNKNOWN = 0,
+ POWER_SUPPLY_VBUS_UVLO,
+ POWER_SUPPLY_VBUS_WEAK,
+ POWER_SUPPLY_VBUS_OVLO,
+ POWER_SUPPLY_VBUS_GOOD,
+};
+#endif
+
+extern sec_battery_platform_data_t sec_battery_pdata;
+#endif