Lines Matching +full:data +full:- +full:sheet

1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Honeywell HIH-6130/HIH-6131 humidity and temperature sensor driver
9 * Data sheets available (2012-06-22) at
18 #include <linux/hwmon-sysfs.h>
26 * struct hih6130 - HIH-6130 device specific data
46 * hih6130_temp_ticks_to_millicelsius() - convert raw temperature ticks to
54 * from data sheet section 5.0 in hih6130_temp_ticks_to_millicelsius()
55 * Formula T = ( ticks / ( 2^14 - 2 ) ) * 165 -40 in hih6130_temp_ticks_to_millicelsius()
57 return (DIV_ROUND_CLOSEST(ticks * 1650, 16382) - 400) * 100; in hih6130_temp_ticks_to_millicelsius()
61 * hih6130_rh_ticks_to_per_cent_mille() - convert raw humidity ticks to
62 * one-thousandths of a percent relative humidity
69 * from data sheet section 4.0 in hih6130_rh_ticks_to_per_cent_mille()
70 * Formula RH = ( ticks / ( 2^14 -2 ) ) * 100 in hih6130_rh_ticks_to_per_cent_mille()
76 * hih6130_update_measurements() - get updated measurements from device
84 struct i2c_client *client = hih6130->client; in hih6130_update_measurements()
90 .addr = client->addr, in hih6130_update_measurements()
97 mutex_lock(&hih6130->lock); in hih6130_update_measurements()
110 if (time_after(jiffies, hih6130->last_update + HZ) || !hih6130->valid) { in hih6130_update_measurements()
114 * According with the datasheet it should be with no data, but in hih6130_update_measurements()
120 ret = i2c_master_send(client, tmp, hih6130->write_length); in hih6130_update_measurements()
127 ret = i2c_transfer(client->adapter, msgs, 1); in hih6130_update_measurements()
132 dev_err(&client->dev, "Error while reading measurement result\n"); in hih6130_update_measurements()
133 ret = -EIO; in hih6130_update_measurements()
138 hih6130->humidity = hih6130_rh_ticks_to_per_cent_mille(t); in hih6130_update_measurements()
141 hih6130->temperature = hih6130_temp_ticks_to_millicelsius(t); in hih6130_update_measurements()
143 hih6130->last_update = jiffies; in hih6130_update_measurements()
144 hih6130->valid = true; in hih6130_update_measurements()
147 mutex_unlock(&hih6130->lock); in hih6130_update_measurements()
153 * hih6130_temperature_show() - show temperature measurement value in sysfs
171 return sprintf(buf, "%d\n", hih6130->temperature); in hih6130_temperature_show()
175 * hih6130_humidity_show() - show humidity measurement value in sysfs
192 return sprintf(buf, "%d\n", hih6130->humidity); in hih6130_humidity_show()
209 struct device *dev = &client->dev; in hih6130_probe()
213 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { in hih6130_probe()
214 dev_err(&client->dev, "adapter does not support true I2C\n"); in hih6130_probe()
215 return -ENODEV; in hih6130_probe()
220 return -ENOMEM; in hih6130_probe()
222 hih6130->client = client; in hih6130_probe()
223 mutex_init(&hih6130->lock); in hih6130_probe()
225 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_QUICK)) in hih6130_probe()
226 hih6130->write_length = 1; in hih6130_probe()
228 hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, in hih6130_probe()
259 MODULE_DESCRIPTION("Honeywell HIH-6130 humidity and temperature sensor driver");