hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/acpi/pmic/intel_pmic_chtwc.c
....@@ -1,18 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Intel CHT Whiskey Cove PMIC operation region driver
34 * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
45 *
56 * Based on various non upstream patches to support the CHT Whiskey Cove PMIC:
67 * 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.
168 */
179
1810 #include <linux/acpi.h>
....@@ -239,6 +231,24 @@
239231 return regmap_update_bits(regmap, reg, bitmask, on ? 1 : 0);
240232 }
241233
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
+
242252 /*
243253 * The thermal table and ops are empty, we do not support the Thermal opregion
244254 * (DPTF) due to lacking documentation.
....@@ -246,6 +256,7 @@
246256 static struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = {
247257 .get_power = intel_cht_wc_pmic_get_power,
248258 .update_power = intel_cht_wc_pmic_update_power,
259
+ .exec_mipi_pmic_seq_element = intel_cht_wc_exec_mipi_pmic_seq_element,
249260 .power_table = power_table,
250261 .power_table_count = ARRAY_SIZE(power_table),
251262 };