summaryrefslogtreecommitdiff
path: root/src/drivers/power/max77686.h
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@gmail.com>2012-11-28 10:44:12 -0800
committerRonald G. Minnich <rminnich@gmail.com>2012-11-29 21:37:08 +0100
commitf2e13b0b198455b83d2162a27704ad7a61eca286 (patch)
tree212fbefbf2f6c838514fb8ac576c75e71c2ca583 /src/drivers/power/max77686.h
parent6d1fcd5e0bccea7f813706fce84c815c2782a356 (diff)
Add the maxim MAX77686 power controller.
Create a new directory in drivers for power controllers. Add the MAXIM MAX77686 power control support. Accessing this controller requires I2C support. Note that this will not build until the I2C usage is changed for coreboot. I'm putting it in mainly because we need it soon and I want to see if the new directory is acceptable. Change-Id: I6c2a6d2165f33b41d2c8e4813222b21d2385e879 Signed-off-by: David Hendricks <dhendrix@chromium.org> SIgned-off-by: Hung-Te Lin <hungte@chromium.org> Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-on: http://review.coreboot.org/1938 Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/drivers/power/max77686.h')
-rw-r--r--src/drivers/power/max77686.h134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/drivers/power/max77686.h b/src/drivers/power/max77686.h
new file mode 100644
index 0000000000..345471eb21
--- /dev/null
+++ b/src/drivers/power/max77686.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * Alim Akhtar <alim.akhtar@samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __MAX77686_H_
+#define __MAX77686_H_
+
+enum max77686_regnum {
+ PMIC_BUCK1 = 0,
+ PMIC_BUCK2,
+ PMIC_BUCK3,
+ PMIC_BUCK4,
+ PMIC_BUCK5,
+ PMIC_BUCK6,
+ PMIC_BUCK7,
+ PMIC_BUCK8,
+ PMIC_BUCK9,
+ PMIC_LDO1,
+ PMIC_LDO2,
+ PMIC_LDO3,
+ PMIC_LDO4,
+ PMIC_LDO5,
+ PMIC_LDO6,
+ PMIC_LDO7,
+ PMIC_LDO8,
+ PMIC_LDO9,
+ PMIC_LDO10,
+ PMIC_LDO11,
+ PMIC_LDO12,
+ PMIC_LDO13,
+ PMIC_LDO14,
+ PMIC_LDO15,
+ PMIC_LDO16,
+ PMIC_LDO17,
+ PMIC_LDO18,
+ PMIC_LDO19,
+ PMIC_LDO20,
+ PMIC_LDO21,
+ PMIC_LDO22,
+ PMIC_LDO23,
+ PMIC_LDO24,
+ PMIC_LDO25,
+ PMIC_LDO26,
+ PMIC_EN32KHZ_CP,
+};
+
+/**
+ * struct max77686_para - max77686 register parameters
+ * @param vol_addr i2c address of the given buck/ldo register
+ * @param vol_bitpos bit position to be set or clear within register
+ * @param vol_bitmask bit mask value
+ * @param reg_enaddr control register address, which enable the given
+ * given buck/ldo.
+ * @param reg_enbitpos bit position to be enabled
+ * @param reg_enbiton value to be written to buck/ldo to make it ON
+ * @param reg_enbitoff value to be written to buck/ldo to make it OFF
+ * @param vol_min minimum voltage level supported by given buck/ldo
+ * @param vol_div voltage division value of given buck/ldo
+ */
+struct max77686_para {
+ enum max77686_regnum regnum;
+ u8 vol_addr;
+ u8 vol_bitpos;
+ u8 vol_bitmask;
+ u8 reg_enaddr;
+ u8 reg_enbitpos;
+ u8 reg_enbitmask;
+ u8 reg_enbiton;
+ u8 reg_enbitoff;
+ u32 vol_min;
+ u32 vol_div;
+};
+
+/* I2C device address for pmic max77686 */
+#define MAX77686_I2C_ADDR (0x12 >> 1)
+
+enum {
+ REG_DISABLE = 0,
+ REG_ENABLE
+};
+
+enum {
+ MAX77686_MV = 0, /* mili volt */
+ MAX77686_UV /* micro volt */
+};
+
+/**
+ * This function enables the 32KHz coprocessor clock.
+ *
+ * Return 0 if ok, else -1
+ */
+int max77686_enable_32khz_cp(void);
+
+/**
+ * Set the required voltage level of pmic
+ *
+ * @param reg register number of buck/ldo to be set
+ * @param volt voltage level to be set
+ * @param enable enable or disable bit
+ * @param volt_units MAX77686_MV or MAX77686_UV, unit of the
+ * voltage parameters
+ *
+ * @return Return 0 if ok, else -1
+ */
+int max77686_volsetting(enum max77686_regnum reg, unsigned int volt,
+ int enable, int volt_units);
+
+/**
+ * Disable charging of the RTC backup battery
+ *
+ * @return Return 0 if ok, else -1
+ */
+int max77686_disable_backup_batt(void);
+
+#endif /* __MAX77686_PMIC_H_ */