.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Intel CHT Whiskey Cove PMIC operation region driver |
---|
3 | 4 | * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com> |
---|
4 | 5 | * |
---|
5 | 6 | * Based on various non upstream patches to support the CHT Whiskey Cove PMIC: |
---|
6 | 7 | * Copyright (C) 2013-2015 Intel Corporation. All rights reserved. |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or |
---|
9 | | - * modify it under the terms of the GNU General Public License version |
---|
10 | | - * 2 as published by the Free Software Foundation. |
---|
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 | 8 | */ |
---|
17 | 9 | |
---|
18 | 10 | #include <linux/acpi.h> |
---|
.. | .. |
---|
239 | 231 | return regmap_update_bits(regmap, reg, bitmask, on ? 1 : 0); |
---|
240 | 232 | } |
---|
241 | 233 | |
---|
| 234 | +static int intel_cht_wc_exec_mipi_pmic_seq_element(struct regmap *regmap, |
---|
| 235 | + u16 i2c_client_address, |
---|
| 236 | + u32 reg_address, |
---|
| 237 | + u32 value, u32 mask) |
---|
| 238 | +{ |
---|
| 239 | + u32 address; |
---|
| 240 | + |
---|
| 241 | + if (i2c_client_address > 0xff || reg_address > 0xff) { |
---|
| 242 | + pr_warn("%s warning addresses too big client 0x%x reg 0x%x\n", |
---|
| 243 | + __func__, i2c_client_address, reg_address); |
---|
| 244 | + return -ERANGE; |
---|
| 245 | + } |
---|
| 246 | + |
---|
| 247 | + address = (i2c_client_address << 8) | reg_address; |
---|
| 248 | + |
---|
| 249 | + return regmap_update_bits(regmap, address, mask, value); |
---|
| 250 | +} |
---|
| 251 | + |
---|
242 | 252 | /* |
---|
243 | 253 | * The thermal table and ops are empty, we do not support the Thermal opregion |
---|
244 | 254 | * (DPTF) due to lacking documentation. |
---|
.. | .. |
---|
246 | 256 | static struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = { |
---|
247 | 257 | .get_power = intel_cht_wc_pmic_get_power, |
---|
248 | 258 | .update_power = intel_cht_wc_pmic_update_power, |
---|
| 259 | + .exec_mipi_pmic_seq_element = intel_cht_wc_exec_mipi_pmic_seq_element, |
---|
249 | 260 | .power_table = power_table, |
---|
250 | 261 | .power_table_count = ARRAY_SIZE(power_table), |
---|
251 | 262 | }; |
---|