Lines Matching +full:sb +full:- +full:tsi
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * sbtsi_temp.c - hwmon driver for a SBI Temperature Sensor Interface (SB-TSI)
19 * SB-TSI registers only support SMBus byte data access. "_INT" registers are
44 * From SB-TSI spec: CPU temperature readings and limit registers encode the
46 * register encodes the base-2 of the integer portion, and the upper 3 bits of
47 * the "low byte" encode in base-2 the decimal portion.
88 err = i2c_smbus_read_byte_data(data->client, SBTSI_REG_CONFIG); in sbtsi_read()
92 mutex_lock(&data->lock); in sbtsi_read()
94 temp_dec = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_DEC); in sbtsi_read()
95 temp_int = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_INT); in sbtsi_read()
97 temp_int = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_INT); in sbtsi_read()
98 temp_dec = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_DEC); in sbtsi_read()
100 mutex_unlock(&data->lock); in sbtsi_read()
103 mutex_lock(&data->lock); in sbtsi_read()
104 temp_int = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_HIGH_INT); in sbtsi_read()
105 temp_dec = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_HIGH_DEC); in sbtsi_read()
106 mutex_unlock(&data->lock); in sbtsi_read()
109 mutex_lock(&data->lock); in sbtsi_read()
110 temp_int = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_LOW_INT); in sbtsi_read()
111 temp_dec = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_LOW_DEC); in sbtsi_read()
112 mutex_unlock(&data->lock); in sbtsi_read()
115 return -EINVAL; in sbtsi_read()
146 return -EINVAL; in sbtsi_write()
152 mutex_lock(&data->lock); in sbtsi_write()
153 err = i2c_smbus_write_byte_data(data->client, reg_int, temp_int); in sbtsi_write()
157 err = i2c_smbus_write_byte_data(data->client, reg_dec, temp_dec); in sbtsi_write()
159 mutex_unlock(&data->lock); in sbtsi_write()
203 struct device *dev = &client->dev; in sbtsi_probe()
209 return -ENOMEM; in sbtsi_probe()
211 data->client = client; in sbtsi_probe()
212 mutex_init(&data->lock); in sbtsi_probe()
214 hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, data, &sbtsi_chip_info, in sbtsi_probe()
246 MODULE_DESCRIPTION("Hwmon driver for AMD SB-TSI emulated sensor");