MyungJoo Ham | 527e7e9 | 2011-03-04 15:50:26 +0900 | [diff] [blame] | 1 | /* |
| 2 | * max8997.h - Driver for the Maxim 8997/8966 |
| 3 | * |
| 4 | * Copyright (C) 2009-2010 Samsung Electrnoics |
| 5 | * MyungJoo Ham <myungjoo.ham@samsung.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | * |
| 21 | * This driver is based on max8998.h |
| 22 | * |
| 23 | * MAX8997 has PMIC, MUIC, HAPTIC, RTC, FLASH, and Fuel Gauge devices. |
| 24 | * Except Fuel Gauge, every device shares the same I2C bus and included in |
| 25 | * this mfd driver. Although the fuel gauge is included in the chip, it is |
| 26 | * excluded from the driver because a) it has a different I2C bus from |
| 27 | * others and b) it can be enabled simply by using MAX17042 driver. |
| 28 | */ |
| 29 | |
| 30 | #ifndef __LINUX_MFD_MAX8998_H |
| 31 | #define __LINUX_MFD_MAX8998_H |
| 32 | |
| 33 | #include <linux/regulator/consumer.h> |
| 34 | |
| 35 | /* MAX8997/8966 regulator IDs */ |
| 36 | enum max8998_regulators { |
| 37 | MAX8997_LDO1 = 0, |
| 38 | MAX8997_LDO2, |
| 39 | MAX8997_LDO3, |
| 40 | MAX8997_LDO4, |
| 41 | MAX8997_LDO5, |
| 42 | MAX8997_LDO6, |
| 43 | MAX8997_LDO7, |
| 44 | MAX8997_LDO8, |
| 45 | MAX8997_LDO9, |
| 46 | MAX8997_LDO10, |
| 47 | MAX8997_LDO11, |
| 48 | MAX8997_LDO12, |
| 49 | MAX8997_LDO13, |
| 50 | MAX8997_LDO14, |
| 51 | MAX8997_LDO15, |
| 52 | MAX8997_LDO16, |
| 53 | MAX8997_LDO17, |
| 54 | MAX8997_LDO18, |
| 55 | MAX8997_LDO21, |
| 56 | MAX8997_BUCK1, |
| 57 | MAX8997_BUCK2, |
| 58 | MAX8997_BUCK3, |
| 59 | MAX8997_BUCK4, |
| 60 | MAX8997_BUCK5, |
| 61 | MAX8997_BUCK6, |
| 62 | MAX8997_BUCK7, |
| 63 | MAX8997_EN32KHZ_AP, |
| 64 | MAX8997_EN32KHZ_CP, |
| 65 | MAX8997_ENVICHG, |
| 66 | MAX8997_ESAFEOUT1, |
| 67 | MAX8997_ESAFEOUT2, |
| 68 | MAX8997_CHARGER_CV, /* control MBCCV of MBCCTRL3 */ |
| 69 | MAX8997_CHARGER, /* charger current, MBCCTRL4 */ |
| 70 | MAX8997_CHARGER_TOPOFF, /* MBCCTRL5 */ |
MyungJoo Ham | bd6ca2c | 2011-03-11 11:34:44 +0900 | [diff] [blame] | 71 | |
| 72 | MAX8997_REG_MAX, |
MyungJoo Ham | 527e7e9 | 2011-03-04 15:50:26 +0900 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | struct max8997_regulator_data { |
| 76 | int id; |
| 77 | struct regulator_init_data *initdata; |
| 78 | }; |
| 79 | |
Donggeun Kim | 2439d97 | 2011-11-24 18:12:17 +0900 | [diff] [blame^] | 80 | enum max8997_muic_usb_type { |
| 81 | MAX8997_USB_HOST, |
| 82 | MAX8997_USB_DEVICE, |
| 83 | }; |
| 84 | |
| 85 | enum max8997_muic_charger_type { |
| 86 | MAX8997_CHARGER_TYPE_NONE = 0, |
| 87 | MAX8997_CHARGER_TYPE_USB, |
| 88 | MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT, |
| 89 | MAX8997_CHARGER_TYPE_DEDICATED_CHG, |
| 90 | MAX8997_CHARGER_TYPE_500MA, |
| 91 | MAX8997_CHARGER_TYPE_1A, |
| 92 | MAX8997_CHARGER_TYPE_DEAD_BATTERY = 7, |
| 93 | }; |
| 94 | |
| 95 | struct max8997_muic_reg_data { |
| 96 | u8 addr; |
| 97 | u8 data; |
| 98 | }; |
| 99 | |
| 100 | /** |
| 101 | * struct max8997_muic_platform_data |
| 102 | * @usb_callback: callback function for USB |
| 103 | * inform callee of USB type (HOST or DEVICE) |
| 104 | * and attached state(true or false) |
| 105 | * @charger_callback: callback function for charger |
| 106 | * inform callee of charger_type |
| 107 | * and attached state(true or false) |
| 108 | * @deskdock_callback: callback function for desk dock |
| 109 | * inform callee of attached state(true or false) |
| 110 | * @cardock_callback: callback function for car dock |
| 111 | * inform callee of attached state(true or false) |
| 112 | * @mhl_callback: callback function for MHL (Mobile High-definition Link) |
| 113 | * inform callee of attached state(true or false) |
| 114 | * @uart_callback: callback function for JIG UART |
| 115 | * inform callee of attached state(true or false) |
| 116 | * @init_data: array of max8997_muic_reg_data |
| 117 | * used for initializing registers of MAX8997 MUIC device |
| 118 | * @num_init_data: array size of init_data |
| 119 | */ |
| 120 | struct max8997_muic_platform_data { |
| 121 | void (*usb_callback)(enum max8997_muic_usb_type usb_type, |
| 122 | bool attached); |
| 123 | void (*charger_callback)(bool attached, |
| 124 | enum max8997_muic_charger_type charger_type); |
| 125 | void (*deskdock_callback) (bool attached); |
| 126 | void (*cardock_callback) (bool attached); |
| 127 | void (*mhl_callback) (bool attached); |
| 128 | void (*uart_callback) (bool attached); |
| 129 | |
| 130 | struct max8997_muic_reg_data *init_data; |
| 131 | int num_init_data; |
| 132 | }; |
| 133 | |
MyungJoo Ham | 527e7e9 | 2011-03-04 15:50:26 +0900 | [diff] [blame] | 134 | struct max8997_platform_data { |
MyungJoo Ham | 8de6bc7 | 2011-03-24 15:54:45 +0900 | [diff] [blame] | 135 | /* IRQ */ |
| 136 | int irq_base; |
| 137 | int ono; |
| 138 | int wakeup; |
| 139 | |
MyungJoo Ham | bd6ca2c | 2011-03-11 11:34:44 +0900 | [diff] [blame] | 140 | /* ---- PMIC ---- */ |
| 141 | struct max8997_regulator_data *regulators; |
| 142 | int num_regulators; |
| 143 | |
| 144 | /* |
| 145 | * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore, |
| 146 | * With buckx_gpiodvs enabled, the buckx cannot be controlled |
| 147 | * independently. To control buckx (of 1, 2, and 5) independently, |
| 148 | * disable buckx_gpiodvs and control with BUCKxDVS1 register. |
| 149 | * |
| 150 | * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage |
| 151 | * on buckx will change the voltage of bucky at the same time. |
| 152 | * |
| 153 | */ |
| 154 | bool ignore_gpiodvs_side_effect; |
| 155 | int buck125_gpios[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */ |
| 156 | int buck125_default_idx; /* Default value of SET1, 2, 3 */ |
| 157 | unsigned int buck1_voltage[8]; /* buckx_voltage in uV */ |
| 158 | bool buck1_gpiodvs; |
| 159 | unsigned int buck2_voltage[8]; |
| 160 | bool buck2_gpiodvs; |
| 161 | unsigned int buck5_voltage[8]; |
| 162 | bool buck5_gpiodvs; |
| 163 | |
Donggeun Kim | 149c077 | 2011-06-22 19:40:06 +0900 | [diff] [blame] | 164 | /* ---- Charger control ---- */ |
| 165 | /* eoc stands for 'end of charge' */ |
| 166 | int eoc_mA; /* 50 ~ 200mA by 10mA step */ |
| 167 | /* charge Full Timeout */ |
| 168 | int timeout; /* 0 (no timeout), 5, 6, 7 hours */ |
| 169 | |
Donggeun Kim | 2439d97 | 2011-11-24 18:12:17 +0900 | [diff] [blame^] | 170 | /* ---- MUIC ---- */ |
| 171 | struct max8997_muic_platform_data *muic_pdata; |
| 172 | |
MyungJoo Ham | 527e7e9 | 2011-03-04 15:50:26 +0900 | [diff] [blame] | 173 | /* HAPTIC: Not implemented */ |
| 174 | /* RTC: Not implemented */ |
| 175 | /* Flash: Not implemented */ |
MyungJoo Ham | 527e7e9 | 2011-03-04 15:50:26 +0900 | [diff] [blame] | 176 | }; |
| 177 | |
| 178 | #endif /* __LINUX_MFD_MAX8998_H */ |