summaryrefslogtreecommitdiff
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorZbigniew Lukwinski <zbigniew.lukwinski@linux.intel.com>2020-06-16 12:34:28 +0300
committerJae Hyun Yoo <jae.hyun.yoo@linux.intel.com>2021-11-05 10:22:10 +0300
commit18a551ca475231a1c7fa0c0f97b5f8182b832074 (patch)
treed25394b3ee10e25169dc743c70f57925e8eb65ec /include/linux/mfd
parent52c64bb0b8e1ce6829fa5b9ba26c5a9efdde4eb7 (diff)
downloadlinux-18a551ca475231a1c7fa0c0f97b5f8182b832074.tar.xz
hwmon: peci: PCS utils
1. Helpers for reading/writing PCS registers added. 2. PECI sensor configuration structure definition and helpers added. 3. New PECI PCS index and parameters definitions added. Tested: * on WilsonCity platform * hwmon/peci modules work as before the change Signed-off-by: Zbigniew Lukwinski <zbigniew.lukwinski@linux.intel.com>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/intel-peci-client.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/include/linux/mfd/intel-peci-client.h b/include/linux/mfd/intel-peci-client.h
index 46a8f006ad0e..c60591348c37 100644
--- a/include/linux/mfd/intel-peci-client.h
+++ b/include/linux/mfd/intel-peci-client.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (c) 2018-2019 Intel Corporation */
+/* Copyright (c) 2018-2020 Intel Corporation */
#ifndef __LINUX_MFD_INTEL_PECI_CLIENT_H
#define __LINUX_MFD_INTEL_PECI_CLIENT_H
@@ -116,4 +116,36 @@ peci_client_read_package_config(struct peci_client_manager *priv,
return 0;
}
+/**
+ * peci_client_write_package_config - write to the Package Configuration Space
+ * @priv: driver private data structure
+ * @index: encoding index for the requested service
+ * @param: parameter to specify the exact data being requested
+ * @data: data buffer with values to write
+ * Context: can sleep
+ *
+ * Return: zero on success, else a negative error code.
+ */
+static inline int
+peci_client_write_package_config(struct peci_client_manager *priv,
+ u8 index, u16 param, u8 *data)
+{
+ struct peci_rd_pkg_cfg_msg msg;
+ int ret;
+
+ msg.addr = priv->client->addr;
+ msg.index = index;
+ msg.param = param;
+ msg.rx_len = 4u;
+ memcpy(msg.pkg_config, data, msg.rx_len);
+
+ ret = peci_command(priv->client->adapter, PECI_CMD_WR_PKG_CFG, &msg);
+ if (!ret) {
+ if (msg.cc != PECI_DEV_CC_SUCCESS)
+ ret = -EAGAIN;
+ }
+
+ return ret;
+}
+
#endif /* __LINUX_MFD_INTEL_PECI_CLIENT_H */