Source
x
static umode_t lm75_is_visible(const void *data, enum hwmon_sensor_types type,
/*
* lm75.c - Part of lm_sensors, Linux kernel modules for hardware
* monitoring
* Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* This driver handles the LM75 and compatible digital temperature sensors.
*/
enum lm75_type { /* keep sorted in alphabetical order */
adt75,
ds1775,
ds75,
ds7505,
g751,
lm75,
lm75a,
lm75b,
max6625,
max6626,
max31725,
mcp980x,
stds75,
stlm75,
tcn75,
tmp100,
tmp101,
tmp105,
tmp112,
tmp175,
tmp275,
tmp75,
tmp75c,
};
/* Addresses scanned */
static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
/* The LM75 registers */
/* Each client has this additional data */
struct lm75_data {
struct i2c_client *client;
struct regmap *regmap;
u8 orig_conf;
u8 resolution; /* In bits, between 9 and 16 */
u8 resolution_limits;
unsigned int sample_time; /* In ms */
};
/*-----------------------------------------------------------------------*/
static inline long lm75_reg_to_mc(s16 temp, u8 resolution)
{
return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8);
}
static int lm75_read(struct device *dev, enum hwmon_sensor_types type,