.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | | - * intel_pmic_xpower.c - XPower AXP288 PMIC operation region driver |
---|
| 3 | + * XPower AXP288 PMIC operation region driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2014 Intel Corporation. All rights reserved. |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of the GNU General Public License version |
---|
8 | | - * 2 as published by the Free Software Foundation. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - * GNU General Public License for more details. |
---|
14 | 6 | */ |
---|
15 | 7 | |
---|
16 | | -#include <linux/init.h> |
---|
17 | 8 | #include <linux/acpi.h> |
---|
| 9 | +#include <linux/init.h> |
---|
18 | 10 | #include <linux/mfd/axp20x.h> |
---|
19 | 11 | #include <linux/regmap.h> |
---|
20 | 12 | #include <linux/platform_device.h> |
---|
| 13 | +#include <asm/iosf_mbi.h> |
---|
21 | 14 | #include "intel_pmic.h" |
---|
22 | 15 | |
---|
23 | 16 | #define XPOWER_GPADC_LOW 0x5b |
---|
.. | .. |
---|
183 | 176 | static int intel_xpower_pmic_update_power(struct regmap *regmap, int reg, |
---|
184 | 177 | int bit, bool on) |
---|
185 | 178 | { |
---|
186 | | - int data; |
---|
| 179 | + int data, ret; |
---|
187 | 180 | |
---|
188 | 181 | /* GPIO1 LDO regulator needs special handling */ |
---|
189 | 182 | if (reg == XPOWER_GPI1_CTRL) |
---|
190 | 183 | return regmap_update_bits(regmap, reg, GPI1_LDO_MASK, |
---|
191 | 184 | on ? GPI1_LDO_ON : GPI1_LDO_OFF); |
---|
192 | 185 | |
---|
193 | | - if (regmap_read(regmap, reg, &data)) |
---|
194 | | - return -EIO; |
---|
| 186 | + ret = iosf_mbi_block_punit_i2c_access(); |
---|
| 187 | + if (ret) |
---|
| 188 | + return ret; |
---|
| 189 | + |
---|
| 190 | + if (regmap_read(regmap, reg, &data)) { |
---|
| 191 | + ret = -EIO; |
---|
| 192 | + goto out; |
---|
| 193 | + } |
---|
195 | 194 | |
---|
196 | 195 | if (on) |
---|
197 | 196 | data |= BIT(bit); |
---|
.. | .. |
---|
199 | 198 | data &= ~BIT(bit); |
---|
200 | 199 | |
---|
201 | 200 | if (regmap_write(regmap, reg, data)) |
---|
202 | | - return -EIO; |
---|
| 201 | + ret = -EIO; |
---|
| 202 | +out: |
---|
| 203 | + iosf_mbi_unblock_punit_i2c_access(); |
---|
203 | 204 | |
---|
204 | | - return 0; |
---|
| 205 | + return ret; |
---|
205 | 206 | } |
---|
206 | 207 | |
---|
207 | 208 | /** |
---|
.. | .. |
---|
264 | 265 | .power_table_count = ARRAY_SIZE(power_table), |
---|
265 | 266 | .thermal_table = thermal_table, |
---|
266 | 267 | .thermal_table_count = ARRAY_SIZE(thermal_table), |
---|
| 268 | + .pmic_i2c_address = 0x34, |
---|
267 | 269 | }; |
---|
268 | 270 | |
---|
269 | 271 | static acpi_status intel_xpower_pmic_gpio_handler(u32 function, |
---|