Krzysztof Kozlowski | 5e9384c | 2018-08-07 18:18:25 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | // |
| 3 | // max77686.c - Regulator driver for the Maxim 77686 |
| 4 | // |
| 5 | // Copyright (C) 2012 Samsung Electronics |
| 6 | // Chiwoong Byun <woong.byun@samsung.com> |
| 7 | // Jonghwa Lee <jonghwa3.lee@samsung.com> |
| 8 | // |
| 9 | // This driver is based on max8997.c |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/bug.h> |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 13 | #include <linux/err.h> |
Linus Walleij | 96392c3 | 2018-11-15 09:01:19 +0100 | [diff] [blame] | 14 | #include <linux/gpio/consumer.h> |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 15 | #include <linux/slab.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/regulator/driver.h> |
| 18 | #include <linux/regulator/machine.h> |
Yadwinder Singh Brar | 4706fca | 2012-07-05 09:28:25 +0530 | [diff] [blame] | 19 | #include <linux/regulator/of_regulator.h> |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 20 | #include <linux/mfd/max77686.h> |
| 21 | #include <linux/mfd/max77686-private.h> |
| 22 | |
| 23 | #define MAX77686_LDO_MINUV 800000 |
| 24 | #define MAX77686_LDO_UVSTEP 50000 |
| 25 | #define MAX77686_LDO_LOW_MINUV 800000 |
| 26 | #define MAX77686_LDO_LOW_UVSTEP 25000 |
| 27 | #define MAX77686_BUCK_MINUV 750000 |
| 28 | #define MAX77686_BUCK_UVSTEP 50000 |
Krzysztof Kozlowski | a959730 | 2016-04-29 12:59:51 +0200 | [diff] [blame] | 29 | #define MAX77686_BUCK_ENABLE_TIME 40 /* us */ |
| 30 | #define MAX77686_DVS_ENABLE_TIME 22 /* us */ |
Yadwinder Singh Brar | 852abad | 2012-06-19 13:23:42 +0530 | [diff] [blame] | 31 | #define MAX77686_RAMP_DELAY 100000 /* uV/us */ |
| 32 | #define MAX77686_DVS_RAMP_DELAY 27500 /* uV/us */ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 33 | #define MAX77686_DVS_MINUV 600000 |
| 34 | #define MAX77686_DVS_UVSTEP 12500 |
| 35 | |
Krzysztof Kozlowski | 7636f19 | 2014-10-27 13:11:47 +0100 | [diff] [blame] | 36 | /* |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 37 | * Value for configuring buck[89] and LDO{20,21,22} as GPIO control. |
| 38 | * It is the same as 'off' for other regulators. |
| 39 | */ |
| 40 | #define MAX77686_GPIO_CONTROL 0x0 |
| 41 | /* |
Krzysztof Kozlowski | 7636f19 | 2014-10-27 13:11:47 +0100 | [diff] [blame] | 42 | * Values used for configuring LDOs and bucks. |
| 43 | * Forcing low power mode: LDO1, 3-5, 9, 13, 17-26 |
| 44 | */ |
| 45 | #define MAX77686_LDO_LOWPOWER 0x1 |
| 46 | /* |
| 47 | * On/off controlled by PWRREQ: |
| 48 | * - LDO2, 6-8, 10-12, 14-16 |
| 49 | * - buck[1234] |
| 50 | */ |
| 51 | #define MAX77686_OFF_PWRREQ 0x1 |
| 52 | /* Low power mode controlled by PWRREQ: All LDOs */ |
| 53 | #define MAX77686_LDO_LOWPOWER_PWRREQ 0x2 |
| 54 | /* Forcing low power mode: buck[234] */ |
| 55 | #define MAX77686_BUCK_LOWPOWER 0x2 |
| 56 | #define MAX77686_NORMAL 0x3 |
| 57 | |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 58 | #define MAX77686_OPMODE_SHIFT 6 |
| 59 | #define MAX77686_OPMODE_BUCK234_SHIFT 4 |
| 60 | #define MAX77686_OPMODE_MASK 0x3 |
| 61 | |
| 62 | #define MAX77686_VSEL_MASK 0x3F |
| 63 | #define MAX77686_DVS_VSEL_MASK 0xFF |
| 64 | |
| 65 | #define MAX77686_RAMP_RATE_MASK 0xC0 |
| 66 | |
| 67 | #define MAX77686_REGULATORS MAX77686_REG_MAX |
| 68 | #define MAX77686_LDOS 26 |
| 69 | |
| 70 | enum max77686_ramp_rate { |
| 71 | RAMP_RATE_13P75MV, |
| 72 | RAMP_RATE_27P5MV, |
| 73 | RAMP_RATE_55MV, |
| 74 | RAMP_RATE_NO_CTRL, /* 100mV/us */ |
| 75 | }; |
| 76 | |
| 77 | struct max77686_data { |
Linus Walleij | 96392c3 | 2018-11-15 09:01:19 +0100 | [diff] [blame] | 78 | struct device *dev; |
Joe Perches | c53403a | 2015-05-18 10:01:03 -0700 | [diff] [blame] | 79 | DECLARE_BITMAP(gpio_enabled, MAX77686_REGULATORS); |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 80 | |
Krzysztof Kozlowski | eca29da | 2014-11-04 09:49:41 +0100 | [diff] [blame] | 81 | /* Array indexed by regulator id */ |
Yadwinder Singh Brar | 6d2c896 | 2012-10-16 17:24:18 +0530 | [diff] [blame] | 82 | unsigned int opmode[MAX77686_REGULATORS]; |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 83 | }; |
| 84 | |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 85 | static unsigned int max77686_get_opmode_shift(int id) |
| 86 | { |
| 87 | switch (id) { |
| 88 | case MAX77686_BUCK1: |
| 89 | case MAX77686_BUCK5 ... MAX77686_BUCK9: |
| 90 | return 0; |
| 91 | case MAX77686_BUCK2 ... MAX77686_BUCK4: |
| 92 | return MAX77686_OPMODE_BUCK234_SHIFT; |
| 93 | default: |
| 94 | /* all LDOs */ |
| 95 | return MAX77686_OPMODE_SHIFT; |
| 96 | } |
| 97 | } |
| 98 | |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 99 | /* |
| 100 | * When regulator is configured for GPIO control then it |
| 101 | * replaces "normal" mode. Any change from low power mode to normal |
| 102 | * should actually change to GPIO control. |
| 103 | * Map normal mode to proper value for such regulators. |
| 104 | */ |
| 105 | static unsigned int max77686_map_normal_mode(struct max77686_data *max77686, |
| 106 | int id) |
| 107 | { |
| 108 | switch (id) { |
| 109 | case MAX77686_BUCK8: |
| 110 | case MAX77686_BUCK9: |
| 111 | case MAX77686_LDO20 ... MAX77686_LDO22: |
Joe Perches | c53403a | 2015-05-18 10:01:03 -0700 | [diff] [blame] | 112 | if (test_bit(id, max77686->gpio_enabled)) |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 113 | return MAX77686_GPIO_CONTROL; |
| 114 | } |
| 115 | |
| 116 | return MAX77686_NORMAL; |
| 117 | } |
| 118 | |
Krzysztof Kozlowski | 78ce612 | 2014-10-29 12:14:52 +0100 | [diff] [blame] | 119 | /* Some BUCKs and LDOs supports Normal[ON/OFF] mode during suspend */ |
| 120 | static int max77686_set_suspend_disable(struct regulator_dev *rdev) |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 121 | { |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 122 | unsigned int val, shift; |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 123 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 124 | int ret, id = rdev_get_id(rdev); |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 125 | |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 126 | shift = max77686_get_opmode_shift(id); |
| 127 | val = MAX77686_OFF_PWRREQ; |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 128 | |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 129 | ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 130 | rdev->desc->enable_mask, val << shift); |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 131 | if (ret) |
| 132 | return ret; |
| 133 | |
Thiago Farina | 40e7214 | 2013-02-13 17:52:26 -0200 | [diff] [blame] | 134 | max77686->opmode[id] = val; |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 135 | return 0; |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | /* Some LDOs supports [LPM/Normal]ON mode during suspend state */ |
| 139 | static int max77686_set_suspend_mode(struct regulator_dev *rdev, |
| 140 | unsigned int mode) |
| 141 | { |
| 142 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); |
| 143 | unsigned int val; |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 144 | int ret, id = rdev_get_id(rdev); |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 145 | |
| 146 | /* BUCK[5-9] doesn't support this feature */ |
Thiago Farina | 40e7214 | 2013-02-13 17:52:26 -0200 | [diff] [blame] | 147 | if (id >= MAX77686_BUCK5) |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 148 | return 0; |
| 149 | |
| 150 | switch (mode) { |
| 151 | case REGULATOR_MODE_IDLE: /* ON in LP Mode */ |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 152 | val = MAX77686_LDO_LOWPOWER_PWRREQ; |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 153 | break; |
| 154 | case REGULATOR_MODE_NORMAL: /* ON in Normal Mode */ |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 155 | val = max77686_map_normal_mode(max77686, id); |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 156 | break; |
| 157 | default: |
| 158 | pr_warn("%s: regulator_suspend_mode : 0x%x not supported\n", |
| 159 | rdev->desc->name, mode); |
| 160 | return -EINVAL; |
| 161 | } |
| 162 | |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 163 | ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 164 | rdev->desc->enable_mask, |
| 165 | val << MAX77686_OPMODE_SHIFT); |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 166 | if (ret) |
| 167 | return ret; |
| 168 | |
Thiago Farina | 40e7214 | 2013-02-13 17:52:26 -0200 | [diff] [blame] | 169 | max77686->opmode[id] = val; |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 170 | return 0; |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | /* Some LDOs supports LPM-ON/OFF/Normal-ON mode during suspend state */ |
| 174 | static int max77686_ldo_set_suspend_mode(struct regulator_dev *rdev, |
| 175 | unsigned int mode) |
| 176 | { |
| 177 | unsigned int val; |
| 178 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 179 | int ret, id = rdev_get_id(rdev); |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 180 | |
| 181 | switch (mode) { |
| 182 | case REGULATOR_MODE_STANDBY: /* switch off */ |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 183 | val = MAX77686_OFF_PWRREQ; |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 184 | break; |
| 185 | case REGULATOR_MODE_IDLE: /* ON in LP Mode */ |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 186 | val = MAX77686_LDO_LOWPOWER_PWRREQ; |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 187 | break; |
| 188 | case REGULATOR_MODE_NORMAL: /* ON in Normal Mode */ |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 189 | val = max77686_map_normal_mode(max77686, id); |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 190 | break; |
| 191 | default: |
| 192 | pr_warn("%s: regulator_suspend_mode : 0x%x not supported\n", |
| 193 | rdev->desc->name, mode); |
| 194 | return -EINVAL; |
| 195 | } |
| 196 | |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 197 | ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 198 | rdev->desc->enable_mask, |
| 199 | val << MAX77686_OPMODE_SHIFT); |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 200 | if (ret) |
| 201 | return ret; |
| 202 | |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 203 | max77686->opmode[id] = val; |
Axel Lin | 3ecf198 | 2013-04-27 16:18:16 +0800 | [diff] [blame] | 204 | return 0; |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 205 | } |
| 206 | |
Yadwinder Singh Brar | 38d3403 | 2012-10-22 09:39:28 +0530 | [diff] [blame] | 207 | static int max77686_enable(struct regulator_dev *rdev) |
Yadwinder Singh Brar | 6d2c896 | 2012-10-16 17:24:18 +0530 | [diff] [blame] | 208 | { |
| 209 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 210 | unsigned int shift; |
| 211 | int id = rdev_get_id(rdev); |
| 212 | |
| 213 | shift = max77686_get_opmode_shift(id); |
Yadwinder Singh Brar | 6d2c896 | 2012-10-16 17:24:18 +0530 | [diff] [blame] | 214 | |
Krzysztof Kozlowski | 78ce612 | 2014-10-29 12:14:52 +0100 | [diff] [blame] | 215 | if (max77686->opmode[id] == MAX77686_OFF_PWRREQ) |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 216 | max77686->opmode[id] = max77686_map_normal_mode(max77686, id); |
Krzysztof Kozlowski | 78ce612 | 2014-10-29 12:14:52 +0100 | [diff] [blame] | 217 | |
Yadwinder Singh Brar | 6d2c896 | 2012-10-16 17:24:18 +0530 | [diff] [blame] | 218 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
| 219 | rdev->desc->enable_mask, |
Krzysztof Kozlowski | 68c5d18 | 2014-10-27 13:11:48 +0100 | [diff] [blame] | 220 | max77686->opmode[id] << shift); |
Yadwinder Singh Brar | 6d2c896 | 2012-10-16 17:24:18 +0530 | [diff] [blame] | 221 | } |
| 222 | |
Yadwinder Singh Brar | f503071 | 2012-06-20 10:50:51 +0530 | [diff] [blame] | 223 | static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) |
| 224 | { |
| 225 | unsigned int ramp_value = RAMP_RATE_NO_CTRL; |
| 226 | |
| 227 | switch (ramp_delay) { |
| 228 | case 1 ... 13750: |
| 229 | ramp_value = RAMP_RATE_13P75MV; |
| 230 | break; |
| 231 | case 13751 ... 27500: |
| 232 | ramp_value = RAMP_RATE_27P5MV; |
| 233 | break; |
| 234 | case 27501 ... 55000: |
| 235 | ramp_value = RAMP_RATE_55MV; |
| 236 | break; |
| 237 | case 55001 ... 100000: |
| 238 | break; |
| 239 | default: |
| 240 | pr_warn("%s: ramp_delay: %d not supported, setting 100000\n", |
| 241 | rdev->desc->name, ramp_delay); |
| 242 | } |
| 243 | |
| 244 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
| 245 | MAX77686_RAMP_RATE_MASK, ramp_value << 6); |
| 246 | } |
| 247 | |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 248 | static int max77686_of_parse_cb(struct device_node *np, |
| 249 | const struct regulator_desc *desc, |
| 250 | struct regulator_config *config) |
| 251 | { |
| 252 | struct max77686_data *max77686 = config->driver_data; |
Linus Walleij | d03c63d | 2018-12-06 13:43:43 +0100 | [diff] [blame] | 253 | int ret; |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 254 | |
| 255 | switch (desc->id) { |
| 256 | case MAX77686_BUCK8: |
| 257 | case MAX77686_BUCK9: |
| 258 | case MAX77686_LDO20 ... MAX77686_LDO22: |
Linus Walleij | d03c63d | 2018-12-06 13:43:43 +0100 | [diff] [blame] | 259 | config->ena_gpiod = gpiod_get_from_of_node(np, |
Linus Walleij | 96392c3 | 2018-11-15 09:01:19 +0100 | [diff] [blame] | 260 | "maxim,ena", |
| 261 | 0, |
| 262 | GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, |
| 263 | "max77686-regulator"); |
| 264 | if (IS_ERR(config->ena_gpiod)) |
| 265 | config->ena_gpiod = NULL; |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 266 | break; |
| 267 | default: |
| 268 | return 0; |
| 269 | } |
| 270 | |
Linus Walleij | 96392c3 | 2018-11-15 09:01:19 +0100 | [diff] [blame] | 271 | if (config->ena_gpiod) { |
Joe Perches | c53403a | 2015-05-18 10:01:03 -0700 | [diff] [blame] | 272 | set_bit(desc->id, max77686->gpio_enabled); |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 273 | |
Linus Walleij | d03c63d | 2018-12-06 13:43:43 +0100 | [diff] [blame] | 274 | ret = regmap_update_bits(config->regmap, desc->enable_reg, |
| 275 | desc->enable_mask, |
| 276 | MAX77686_GPIO_CONTROL); |
| 277 | if (ret) { |
| 278 | gpiod_put(config->ena_gpiod); |
| 279 | config->ena_gpiod = NULL; |
| 280 | } |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | return 0; |
| 284 | } |
| 285 | |
Bhumika Goyal | 404826c | 2017-01-28 19:52:24 +0530 | [diff] [blame] | 286 | static const struct regulator_ops max77686_ops = { |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 287 | .list_voltage = regulator_list_voltage_linear, |
Axel Lin | 2e3f7f2 | 2012-06-03 22:46:14 +0800 | [diff] [blame] | 288 | .map_voltage = regulator_map_voltage_linear, |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 289 | .is_enabled = regulator_is_enabled_regmap, |
Yadwinder Singh Brar | 6d2c896 | 2012-10-16 17:24:18 +0530 | [diff] [blame] | 290 | .enable = max77686_enable, |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 291 | .disable = regulator_disable_regmap, |
| 292 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| 293 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
Yadwinder Singh Brar | 852abad | 2012-06-19 13:23:42 +0530 | [diff] [blame] | 294 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 295 | .set_suspend_mode = max77686_set_suspend_mode, |
| 296 | }; |
| 297 | |
Bhumika Goyal | 404826c | 2017-01-28 19:52:24 +0530 | [diff] [blame] | 298 | static const struct regulator_ops max77686_ldo_ops = { |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 299 | .list_voltage = regulator_list_voltage_linear, |
| 300 | .map_voltage = regulator_map_voltage_linear, |
| 301 | .is_enabled = regulator_is_enabled_regmap, |
| 302 | .enable = max77686_enable, |
| 303 | .disable = regulator_disable_regmap, |
| 304 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| 305 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
| 306 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
| 307 | .set_suspend_mode = max77686_ldo_set_suspend_mode, |
Krzysztof Kozlowski | 78ce612 | 2014-10-29 12:14:52 +0100 | [diff] [blame] | 308 | .set_suspend_disable = max77686_set_suspend_disable, |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 309 | }; |
| 310 | |
Bhumika Goyal | 404826c | 2017-01-28 19:52:24 +0530 | [diff] [blame] | 311 | static const struct regulator_ops max77686_buck1_ops = { |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 312 | .list_voltage = regulator_list_voltage_linear, |
| 313 | .map_voltage = regulator_map_voltage_linear, |
| 314 | .is_enabled = regulator_is_enabled_regmap, |
| 315 | .enable = max77686_enable, |
| 316 | .disable = regulator_disable_regmap, |
| 317 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| 318 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
| 319 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
Krzysztof Kozlowski | 78ce612 | 2014-10-29 12:14:52 +0100 | [diff] [blame] | 320 | .set_suspend_disable = max77686_set_suspend_disable, |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 321 | }; |
| 322 | |
Bhumika Goyal | 404826c | 2017-01-28 19:52:24 +0530 | [diff] [blame] | 323 | static const struct regulator_ops max77686_buck_dvs_ops = { |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 324 | .list_voltage = regulator_list_voltage_linear, |
Axel Lin | 2e3f7f2 | 2012-06-03 22:46:14 +0800 | [diff] [blame] | 325 | .map_voltage = regulator_map_voltage_linear, |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 326 | .is_enabled = regulator_is_enabled_regmap, |
Yadwinder Singh Brar | 6d2c896 | 2012-10-16 17:24:18 +0530 | [diff] [blame] | 327 | .enable = max77686_enable, |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 328 | .disable = regulator_disable_regmap, |
| 329 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| 330 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
Yadwinder Singh Brar | 852abad | 2012-06-19 13:23:42 +0530 | [diff] [blame] | 331 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
Yadwinder Singh Brar | f503071 | 2012-06-20 10:50:51 +0530 | [diff] [blame] | 332 | .set_ramp_delay = max77686_set_ramp_delay, |
Krzysztof Kozlowski | 78ce612 | 2014-10-29 12:14:52 +0100 | [diff] [blame] | 333 | .set_suspend_disable = max77686_set_suspend_disable, |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 334 | }; |
| 335 | |
| 336 | #define regulator_desc_ldo(num) { \ |
| 337 | .name = "LDO"#num, \ |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 338 | .of_match = of_match_ptr("LDO"#num), \ |
| 339 | .regulators_node = of_match_ptr("voltage-regulators"), \ |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 340 | .of_parse_cb = max77686_of_parse_cb, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 341 | .id = MAX77686_LDO##num, \ |
| 342 | .ops = &max77686_ops, \ |
| 343 | .type = REGULATOR_VOLTAGE, \ |
| 344 | .owner = THIS_MODULE, \ |
| 345 | .min_uV = MAX77686_LDO_MINUV, \ |
| 346 | .uV_step = MAX77686_LDO_UVSTEP, \ |
Yadwinder Singh Brar | 852abad | 2012-06-19 13:23:42 +0530 | [diff] [blame] | 347 | .ramp_delay = MAX77686_RAMP_DELAY, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 348 | .n_voltages = MAX77686_VSEL_MASK + 1, \ |
| 349 | .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ |
| 350 | .vsel_mask = MAX77686_VSEL_MASK, \ |
| 351 | .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ |
| 352 | .enable_mask = MAX77686_OPMODE_MASK \ |
| 353 | << MAX77686_OPMODE_SHIFT, \ |
| 354 | } |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 355 | #define regulator_desc_lpm_ldo(num) { \ |
| 356 | .name = "LDO"#num, \ |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 357 | .of_match = of_match_ptr("LDO"#num), \ |
| 358 | .regulators_node = of_match_ptr("voltage-regulators"), \ |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 359 | .id = MAX77686_LDO##num, \ |
| 360 | .ops = &max77686_ldo_ops, \ |
| 361 | .type = REGULATOR_VOLTAGE, \ |
| 362 | .owner = THIS_MODULE, \ |
| 363 | .min_uV = MAX77686_LDO_MINUV, \ |
| 364 | .uV_step = MAX77686_LDO_UVSTEP, \ |
| 365 | .ramp_delay = MAX77686_RAMP_DELAY, \ |
| 366 | .n_voltages = MAX77686_VSEL_MASK + 1, \ |
| 367 | .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ |
| 368 | .vsel_mask = MAX77686_VSEL_MASK, \ |
| 369 | .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ |
| 370 | .enable_mask = MAX77686_OPMODE_MASK \ |
| 371 | << MAX77686_OPMODE_SHIFT, \ |
| 372 | } |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 373 | #define regulator_desc_ldo_low(num) { \ |
| 374 | .name = "LDO"#num, \ |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 375 | .of_match = of_match_ptr("LDO"#num), \ |
| 376 | .regulators_node = of_match_ptr("voltage-regulators"), \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 377 | .id = MAX77686_LDO##num, \ |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 378 | .ops = &max77686_ldo_ops, \ |
| 379 | .type = REGULATOR_VOLTAGE, \ |
| 380 | .owner = THIS_MODULE, \ |
| 381 | .min_uV = MAX77686_LDO_LOW_MINUV, \ |
| 382 | .uV_step = MAX77686_LDO_LOW_UVSTEP, \ |
| 383 | .ramp_delay = MAX77686_RAMP_DELAY, \ |
| 384 | .n_voltages = MAX77686_VSEL_MASK + 1, \ |
| 385 | .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ |
| 386 | .vsel_mask = MAX77686_VSEL_MASK, \ |
| 387 | .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ |
| 388 | .enable_mask = MAX77686_OPMODE_MASK \ |
| 389 | << MAX77686_OPMODE_SHIFT, \ |
| 390 | } |
| 391 | #define regulator_desc_ldo1_low(num) { \ |
| 392 | .name = "LDO"#num, \ |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 393 | .of_match = of_match_ptr("LDO"#num), \ |
| 394 | .regulators_node = of_match_ptr("voltage-regulators"), \ |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 395 | .id = MAX77686_LDO##num, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 396 | .ops = &max77686_ops, \ |
| 397 | .type = REGULATOR_VOLTAGE, \ |
| 398 | .owner = THIS_MODULE, \ |
| 399 | .min_uV = MAX77686_LDO_LOW_MINUV, \ |
| 400 | .uV_step = MAX77686_LDO_LOW_UVSTEP, \ |
Yadwinder Singh Brar | 852abad | 2012-06-19 13:23:42 +0530 | [diff] [blame] | 401 | .ramp_delay = MAX77686_RAMP_DELAY, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 402 | .n_voltages = MAX77686_VSEL_MASK + 1, \ |
| 403 | .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ |
| 404 | .vsel_mask = MAX77686_VSEL_MASK, \ |
| 405 | .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ |
| 406 | .enable_mask = MAX77686_OPMODE_MASK \ |
| 407 | << MAX77686_OPMODE_SHIFT, \ |
| 408 | } |
| 409 | #define regulator_desc_buck(num) { \ |
| 410 | .name = "BUCK"#num, \ |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 411 | .of_match = of_match_ptr("BUCK"#num), \ |
| 412 | .regulators_node = of_match_ptr("voltage-regulators"), \ |
Krzysztof Kozlowski | 3307e90 | 2015-01-05 12:48:43 +0100 | [diff] [blame] | 413 | .of_parse_cb = max77686_of_parse_cb, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 414 | .id = MAX77686_BUCK##num, \ |
| 415 | .ops = &max77686_ops, \ |
| 416 | .type = REGULATOR_VOLTAGE, \ |
| 417 | .owner = THIS_MODULE, \ |
| 418 | .min_uV = MAX77686_BUCK_MINUV, \ |
| 419 | .uV_step = MAX77686_BUCK_UVSTEP, \ |
Yadwinder Singh Brar | 852abad | 2012-06-19 13:23:42 +0530 | [diff] [blame] | 420 | .ramp_delay = MAX77686_RAMP_DELAY, \ |
Krzysztof Kozlowski | a959730 | 2016-04-29 12:59:51 +0200 | [diff] [blame] | 421 | .enable_time = MAX77686_BUCK_ENABLE_TIME, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 422 | .n_voltages = MAX77686_VSEL_MASK + 1, \ |
| 423 | .vsel_reg = MAX77686_REG_BUCK5OUT + (num - 5) * 2, \ |
| 424 | .vsel_mask = MAX77686_VSEL_MASK, \ |
| 425 | .enable_reg = MAX77686_REG_BUCK5CTRL + (num - 5) * 2, \ |
| 426 | .enable_mask = MAX77686_OPMODE_MASK, \ |
| 427 | } |
| 428 | #define regulator_desc_buck1(num) { \ |
| 429 | .name = "BUCK"#num, \ |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 430 | .of_match = of_match_ptr("BUCK"#num), \ |
| 431 | .regulators_node = of_match_ptr("voltage-regulators"), \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 432 | .id = MAX77686_BUCK##num, \ |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 433 | .ops = &max77686_buck1_ops, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 434 | .type = REGULATOR_VOLTAGE, \ |
| 435 | .owner = THIS_MODULE, \ |
| 436 | .min_uV = MAX77686_BUCK_MINUV, \ |
| 437 | .uV_step = MAX77686_BUCK_UVSTEP, \ |
Yadwinder Singh Brar | 852abad | 2012-06-19 13:23:42 +0530 | [diff] [blame] | 438 | .ramp_delay = MAX77686_RAMP_DELAY, \ |
Krzysztof Kozlowski | a959730 | 2016-04-29 12:59:51 +0200 | [diff] [blame] | 439 | .enable_time = MAX77686_BUCK_ENABLE_TIME, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 440 | .n_voltages = MAX77686_VSEL_MASK + 1, \ |
| 441 | .vsel_reg = MAX77686_REG_BUCK1OUT, \ |
| 442 | .vsel_mask = MAX77686_VSEL_MASK, \ |
| 443 | .enable_reg = MAX77686_REG_BUCK1CTRL, \ |
| 444 | .enable_mask = MAX77686_OPMODE_MASK, \ |
| 445 | } |
| 446 | #define regulator_desc_buck_dvs(num) { \ |
| 447 | .name = "BUCK"#num, \ |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 448 | .of_match = of_match_ptr("BUCK"#num), \ |
| 449 | .regulators_node = of_match_ptr("voltage-regulators"), \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 450 | .id = MAX77686_BUCK##num, \ |
Axel Lin | 74adfee5 | 2012-06-04 10:19:18 +0800 | [diff] [blame] | 451 | .ops = &max77686_buck_dvs_ops, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 452 | .type = REGULATOR_VOLTAGE, \ |
| 453 | .owner = THIS_MODULE, \ |
| 454 | .min_uV = MAX77686_DVS_MINUV, \ |
| 455 | .uV_step = MAX77686_DVS_UVSTEP, \ |
Yadwinder Singh Brar | 852abad | 2012-06-19 13:23:42 +0530 | [diff] [blame] | 456 | .ramp_delay = MAX77686_DVS_RAMP_DELAY, \ |
Krzysztof Kozlowski | a959730 | 2016-04-29 12:59:51 +0200 | [diff] [blame] | 457 | .enable_time = MAX77686_DVS_ENABLE_TIME, \ |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 458 | .n_voltages = MAX77686_DVS_VSEL_MASK + 1, \ |
| 459 | .vsel_reg = MAX77686_REG_BUCK2DVS1 + (num - 2) * 10, \ |
| 460 | .vsel_mask = MAX77686_DVS_VSEL_MASK, \ |
| 461 | .enable_reg = MAX77686_REG_BUCK2CTRL1 + (num - 2) * 10, \ |
| 462 | .enable_mask = MAX77686_OPMODE_MASK \ |
| 463 | << MAX77686_OPMODE_BUCK234_SHIFT, \ |
| 464 | } |
| 465 | |
Krzysztof Kozlowski | 73dbdf8 | 2014-10-27 16:03:42 +0100 | [diff] [blame] | 466 | static const struct regulator_desc regulators[] = { |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 467 | regulator_desc_ldo1_low(1), |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 468 | regulator_desc_ldo_low(2), |
| 469 | regulator_desc_ldo(3), |
| 470 | regulator_desc_ldo(4), |
| 471 | regulator_desc_ldo(5), |
| 472 | regulator_desc_ldo_low(6), |
| 473 | regulator_desc_ldo_low(7), |
| 474 | regulator_desc_ldo_low(8), |
| 475 | regulator_desc_ldo(9), |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 476 | regulator_desc_lpm_ldo(10), |
| 477 | regulator_desc_lpm_ldo(11), |
| 478 | regulator_desc_lpm_ldo(12), |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 479 | regulator_desc_ldo(13), |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 480 | regulator_desc_lpm_ldo(14), |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 481 | regulator_desc_ldo_low(15), |
Yadwinder Singh Brar | 15282ba | 2012-10-16 17:24:19 +0530 | [diff] [blame] | 482 | regulator_desc_lpm_ldo(16), |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 483 | regulator_desc_ldo(17), |
| 484 | regulator_desc_ldo(18), |
| 485 | regulator_desc_ldo(19), |
| 486 | regulator_desc_ldo(20), |
| 487 | regulator_desc_ldo(21), |
| 488 | regulator_desc_ldo(22), |
| 489 | regulator_desc_ldo(23), |
| 490 | regulator_desc_ldo(24), |
| 491 | regulator_desc_ldo(25), |
| 492 | regulator_desc_ldo(26), |
| 493 | regulator_desc_buck1(1), |
| 494 | regulator_desc_buck_dvs(2), |
| 495 | regulator_desc_buck_dvs(3), |
| 496 | regulator_desc_buck_dvs(4), |
| 497 | regulator_desc_buck(5), |
| 498 | regulator_desc_buck(6), |
| 499 | regulator_desc_buck(7), |
| 500 | regulator_desc_buck(8), |
| 501 | regulator_desc_buck(9), |
| 502 | }; |
| 503 | |
Bill Pemberton | a502357 | 2012-11-19 13:22:22 -0500 | [diff] [blame] | 504 | static int max77686_pmic_probe(struct platform_device *pdev) |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 505 | { |
| 506 | struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 507 | struct max77686_data *max77686; |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 508 | int i; |
Axel Lin | c59d2a6 | 2012-06-20 15:01:25 +0800 | [diff] [blame] | 509 | struct regulator_config config = { }; |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 510 | |
| 511 | dev_dbg(&pdev->dev, "%s\n", __func__); |
| 512 | |
| 513 | max77686 = devm_kzalloc(&pdev->dev, sizeof(struct max77686_data), |
| 514 | GFP_KERNEL); |
| 515 | if (!max77686) |
| 516 | return -ENOMEM; |
| 517 | |
Linus Walleij | 96392c3 | 2018-11-15 09:01:19 +0100 | [diff] [blame] | 518 | max77686->dev = &pdev->dev; |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 519 | config.dev = iodev->dev; |
Yadwinder Singh Brar | f503071 | 2012-06-20 10:50:51 +0530 | [diff] [blame] | 520 | config.regmap = iodev->regmap; |
Yadwinder Singh Brar | 6d2c896 | 2012-10-16 17:24:18 +0530 | [diff] [blame] | 521 | config.driver_data = max77686; |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 522 | platform_set_drvdata(pdev, max77686); |
| 523 | |
Axel Lin | ab0d1cb | 2012-06-08 12:03:04 +0800 | [diff] [blame] | 524 | for (i = 0; i < MAX77686_REGULATORS; i++) { |
Krzysztof Kozlowski | b0c13e8 | 2014-03-10 09:32:45 +0100 | [diff] [blame] | 525 | struct regulator_dev *rdev; |
Krzysztof Kozlowski | eca29da | 2014-11-04 09:49:41 +0100 | [diff] [blame] | 526 | int id = regulators[i].id; |
Krzysztof Kozlowski | b0c13e8 | 2014-03-10 09:32:45 +0100 | [diff] [blame] | 527 | |
Krzysztof Kozlowski | 4524df8 | 2014-11-04 09:49:42 +0100 | [diff] [blame] | 528 | max77686->opmode[id] = MAX77686_NORMAL; |
Krzysztof Kozlowski | b0c13e8 | 2014-03-10 09:32:45 +0100 | [diff] [blame] | 529 | rdev = devm_regulator_register(&pdev->dev, |
Sachin Kamat | 44815b4 | 2013-09-04 11:07:54 +0530 | [diff] [blame] | 530 | ®ulators[i], &config); |
Krzysztof Kozlowski | b0c13e8 | 2014-03-10 09:32:45 +0100 | [diff] [blame] | 531 | if (IS_ERR(rdev)) { |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 532 | int ret = PTR_ERR(rdev); |
Yadwinder Singh Brar | f503071 | 2012-06-20 10:50:51 +0530 | [diff] [blame] | 533 | dev_err(&pdev->dev, |
Krzysztof Kozlowski | 0480395 | 2014-11-05 10:47:50 +0100 | [diff] [blame] | 534 | "regulator init failed for %d: %d\n", i, ret); |
| 535 | return ret; |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 536 | } |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 537 | } |
Axel Lin | ab0d1cb | 2012-06-08 12:03:04 +0800 | [diff] [blame] | 538 | |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 539 | return 0; |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 540 | } |
| 541 | |
| 542 | static const struct platform_device_id max77686_pmic_id[] = { |
| 543 | {"max77686-pmic", 0}, |
| 544 | { }, |
| 545 | }; |
| 546 | MODULE_DEVICE_TABLE(platform, max77686_pmic_id); |
| 547 | |
| 548 | static struct platform_driver max77686_pmic_driver = { |
| 549 | .driver = { |
| 550 | .name = "max77686-pmic", |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 551 | }, |
| 552 | .probe = max77686_pmic_probe, |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 553 | .id_table = max77686_pmic_id, |
| 554 | }; |
| 555 | |
Javier Martinez Canillas | 314a820 | 2016-04-06 09:49:47 -0400 | [diff] [blame] | 556 | module_platform_driver(max77686_pmic_driver); |
Jonghwa Lee | 133d401 | 2012-06-01 13:17:14 +0900 | [diff] [blame] | 557 | |
| 558 | MODULE_DESCRIPTION("MAXIM 77686 Regulator Driver"); |
| 559 | MODULE_AUTHOR("Chiwoong Byun <woong.byun@samsung.com>"); |
| 560 | MODULE_LICENSE("GPL"); |