Skip to content

Commit 7d6d53b

Browse files
Hunterteaegggroeck
authored andcommitted
hwmon: (sht3x)replace "high-precision" property to "repeatability"
Replace use of "precision" with "repeatability" to match datasheet terminology. No functional change. Signed-off-by: JuenKit Yip <JuenKit_Yip@hotmail.com> Link: https://lore.kernel.org/r/DB4PR10MB626113BFFA66DE32C3479D229258A@DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM [groeck: Added commit description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 5bca68a commit 7d6d53b

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

Documentation/hwmon/sht3x.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Documentation/i2c/instantiating-devices.rst for methods to instantiate the devic
3030

3131
There is only one option configurable by means of sht3x_data:
3232

33-
high or low accuracy. High accuracy is used by default and using it is
33+
repeatability: high repeatability is used by default and using it is
3434
strongly recommended.
3535

3636
Even if sht3x sensor supports clock-strech(blocking mode) and non-strench

drivers/hwmon/sht3x.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include <linux/slab.h>
2222
#include <linux/jiffies.h>
2323

24-
/* commands (high precision mode) */
24+
/* commands (high repeatability mode) */
2525
static const unsigned char sht3x_cmd_measure_single_hpm[] = { 0x24, 0x00 };
2626

27-
/* commands (low power mode) */
27+
/* commands (low repeatability mode) */
2828
static const unsigned char sht3x_cmd_measure_single_lpm[] = { 0x24, 0x16 };
2929

3030
/* commands for periodic mode */
@@ -66,9 +66,14 @@ enum sht3x_limits {
6666
limit_min_hyst,
6767
};
6868

69+
enum sht3x_repeatability {
70+
low_repeatability,
71+
high_repeatability,
72+
};
73+
6974
DECLARE_CRC8_TABLE(sht3x_crc8_table);
7075

71-
/* periodic measure commands (high precision mode) */
76+
/* periodic measure commands (high repeatability mode) */
7277
static const char periodic_measure_commands_hpm[][SHT3X_CMD_LENGTH] = {
7378
/* 0.5 measurements per second */
7479
{0x20, 0x32},
@@ -82,7 +87,7 @@ static const char periodic_measure_commands_hpm[][SHT3X_CMD_LENGTH] = {
8287
{0x27, 0x37},
8388
};
8489

85-
/* periodic measure commands (low power mode) */
90+
/* periodic measure commands (low repeatability mode) */
8691
static const char periodic_measure_commands_lpm[][SHT3X_CMD_LENGTH] = {
8792
/* 0.5 measurements per second */
8893
{0x20, 0x2f},
@@ -132,7 +137,7 @@ struct sht3x_data {
132137
const unsigned char *command;
133138
u32 wait_time; /* in us*/
134139
unsigned long last_update; /* last update in periodic mode*/
135-
bool high_precision;
140+
enum sht3x_repeatability repeatability;
136141

137142
/*
138143
* cached values for temperature and humidity and limits
@@ -436,7 +441,7 @@ static void sht3x_select_command(struct sht3x_data *data)
436441
data->command = sht3x_cmd_measure_periodic_mode;
437442
data->wait_time = 0;
438443
} else {
439-
if (data->high_precision) {
444+
if (data->repeatability == high_repeatability) {
440445
data->command = sht3x_cmd_measure_single_hpm;
441446
data->wait_time = SHT3X_SINGLE_WAIT_TIME_HPM;
442447
} else {
@@ -584,7 +589,7 @@ static ssize_t update_interval_store(struct device *dev,
584589
}
585590

586591
if (mode > 0) {
587-
if (data->high_precision)
592+
if (data->repeatability == high_repeatability)
588593
command = periodic_measure_commands_hpm[mode - 1];
589594
else
590595
command = periodic_measure_commands_lpm[mode - 1];
@@ -679,7 +684,7 @@ static int sht3x_probe(struct i2c_client *client)
679684
if (!data)
680685
return -ENOMEM;
681686

682-
data->high_precision = true;
687+
data->repeatability = high_repeatability;
683688
data->mode = 0;
684689
data->last_update = jiffies - msecs_to_jiffies(3000);
685690
data->client = client;

0 commit comments

Comments
 (0)