Lines Matching +full:sb +full:- +full:rmi

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * sbrmi.c - hwmon driver for a SB-RMI mailbox
6 * Copyright (C) 2020-2021 Advanced Micro Devices, Inc.
28 * SB-RMI supports soft mailbox service request to MP1 (power management
30 * SB-RMI message IDs
39 /* SB-RMI registers */
81 * Enable the SB-RMI Software alert status in sbrmi_enable_alert()
104 mutex_lock(&data->lock); in rmi_mailbox_xfer()
107 ret = i2c_smbus_write_byte_data(data->client, in rmi_mailbox_xfer()
113 ret = i2c_smbus_write_byte_data(data->client, in rmi_mailbox_xfer()
114 SBRMI_INBNDMSG0, msg->cmd); in rmi_mailbox_xfer()
124 byte = (msg->data_in >> i * 8) & 0xff; in rmi_mailbox_xfer()
125 ret = i2c_smbus_write_byte_data(data->client, in rmi_mailbox_xfer()
135 ret = i2c_smbus_write_byte_data(data->client, in rmi_mailbox_xfer()
146 sw_status = i2c_smbus_read_byte_data(data->client, in rmi_mailbox_xfer()
155 } while (retry--); in rmi_mailbox_xfer()
158 dev_err(&data->client->dev, in rmi_mailbox_xfer()
160 ret = -EIO; in rmi_mailbox_xfer()
169 if (msg->read) { in rmi_mailbox_xfer()
171 ret = i2c_smbus_read_byte_data(data->client, in rmi_mailbox_xfer()
175 msg->data_out |= ret << i * 8; in rmi_mailbox_xfer()
183 ret = i2c_smbus_write_byte_data(data->client, SBRMI_STATUS, in rmi_mailbox_xfer()
187 mutex_unlock(&data->lock); in rmi_mailbox_xfer()
199 return -EINVAL; in sbrmi_read()
212 msg.data_out = data->pwr_limit_max; in sbrmi_read()
216 return -EINVAL; in sbrmi_read()
232 return -EINVAL; in sbrmi_write()
239 val = clamp_val(val, SBRMI_PWR_MIN, data->pwr_limit_max); in sbrmi_write()
295 data->pwr_limit_max = msg.data_out; in sbrmi_get_max_pwr_limit()
302 struct device *dev = &client->dev; in sbrmi_probe()
309 return -ENOMEM; in sbrmi_probe()
311 data->client = client; in sbrmi_probe()
312 mutex_init(&data->lock); in sbrmi_probe()
314 /* Enable alert for SB-RMI sequence */ in sbrmi_probe()
324 hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, data, in sbrmi_probe()
356 MODULE_DESCRIPTION("Hwmon driver for AMD SB-RMI emulated sensor");