Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
jc42.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>

Go to the source code of this file.

Data Structures

struct  jc42_chips
 
struct  jc42_data
 

Macros

#define JC42_REG_CAP   0x00
 
#define JC42_REG_CONFIG   0x01
 
#define JC42_REG_TEMP_UPPER   0x02
 
#define JC42_REG_TEMP_LOWER   0x03
 
#define JC42_REG_TEMP_CRITICAL   0x04
 
#define JC42_REG_TEMP   0x05
 
#define JC42_REG_MANID   0x06
 
#define JC42_REG_DEVICEID   0x07
 
#define JC42_ALARM_CRIT_BIT   15
 
#define JC42_ALARM_MAX_BIT   14
 
#define JC42_ALARM_MIN_BIT   13
 
#define JC42_CFG_CRIT_ONLY   (1 << 2)
 
#define JC42_CFG_TCRIT_LOCK   (1 << 6)
 
#define JC42_CFG_EVENT_LOCK   (1 << 7)
 
#define JC42_CFG_SHUTDOWN   (1 << 8)
 
#define JC42_CFG_HYST_SHIFT   9
 
#define JC42_CFG_HYST_MASK   (0x03 << 9)
 
#define JC42_CAP_RANGE   (1 << 2)
 
#define ADT_MANID   0x11d4 /* Analog Devices */
 
#define ATMEL_MANID   0x001f /* Atmel */
 
#define MAX_MANID   0x004d /* Maxim */
 
#define IDT_MANID   0x00b3 /* IDT */
 
#define MCP_MANID   0x0054 /* Microchip */
 
#define NXP_MANID   0x1131 /* NXP Semiconductors */
 
#define ONS_MANID   0x1b09 /* ON Semiconductor */
 
#define STM_MANID   0x104a /* ST Microelectronics */
 
#define ADT7408_DEVID   0x0801
 
#define ADT7408_DEVID_MASK   0xffff
 
#define AT30TS00_DEVID   0x8201
 
#define AT30TS00_DEVID_MASK   0xffff
 
#define TS3000B3_DEVID   0x2903 /* Also matches TSE2002B3 */
 
#define TS3000B3_DEVID_MASK   0xffff
 
#define TS3000GB2_DEVID   0x2912 /* Also matches TSE2002GB2 */
 
#define TS3000GB2_DEVID_MASK   0xffff
 
#define MAX6604_DEVID   0x3e00
 
#define MAX6604_DEVID_MASK   0xffff
 
#define MCP9804_DEVID   0x0200
 
#define MCP9804_DEVID_MASK   0xfffc
 
#define MCP98242_DEVID   0x2000
 
#define MCP98242_DEVID_MASK   0xfffc
 
#define MCP98243_DEVID   0x2100
 
#define MCP98243_DEVID_MASK   0xfffc
 
#define MCP9843_DEVID   0x0000 /* Also matches mcp9805 */
 
#define MCP9843_DEVID_MASK   0xfffe
 
#define SE97_DEVID   0xa200
 
#define SE97_DEVID_MASK   0xfffc
 
#define SE98_DEVID   0xa100
 
#define SE98_DEVID_MASK   0xfffc
 
#define CAT6095_DEVID   0x0800 /* Also matches CAT34TS02 */
 
#define CAT6095_DEVID_MASK   0xffe0
 
#define STTS424_DEVID   0x0101
 
#define STTS424_DEVID_MASK   0xffff
 
#define STTS424E_DEVID   0x0000
 
#define STTS424E_DEVID_MASK   0xfffe
 
#define STTS2002_DEVID   0x0300
 
#define STTS2002_DEVID_MASK   0xffff
 
#define STTS3000_DEVID   0x0200
 
#define STTS3000_DEVID_MASK   0xffff
 
#define JC42_DEV_PM_OPS   NULL
 
#define JC42_TEMP_MIN_EXTENDED   (-40000)
 
#define JC42_TEMP_MIN   0
 
#define JC42_TEMP_MAX   125000
 
#define show(value)
 
#define set(value, reg)
 

Functions

 MODULE_DEVICE_TABLE (i2c, jc42_id)
 
 show (temp_input)
 
 show (temp_crit)
 
 show (temp_min)
 
 show (temp_max)
 
 set (temp_min, JC42_REG_TEMP_LOWER)
 
 set (temp_max, JC42_REG_TEMP_UPPER)
 
 set (temp_crit, JC42_REG_TEMP_CRITICAL)
 
 module_i2c_driver (jc42_driver)
 
 MODULE_AUTHOR ("Guenter Roeck <[email protected]>")
 
 MODULE_DESCRIPTION ("JC42 driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define ADT7408_DEVID   0x0801

Definition at line 78 of file jc42.c.

#define ADT7408_DEVID_MASK   0xffff

Definition at line 79 of file jc42.c.

#define ADT_MANID   0x11d4 /* Analog Devices */

Definition at line 66 of file jc42.c.

#define AT30TS00_DEVID   0x8201

Definition at line 82 of file jc42.c.

#define AT30TS00_DEVID_MASK   0xffff

Definition at line 83 of file jc42.c.

#define ATMEL_MANID   0x001f /* Atmel */

Definition at line 67 of file jc42.c.

#define CAT6095_DEVID   0x0800 /* Also matches CAT34TS02 */

Definition at line 117 of file jc42.c.

#define CAT6095_DEVID_MASK   0xffe0

Definition at line 118 of file jc42.c.

#define IDT_MANID   0x00b3 /* IDT */

Definition at line 69 of file jc42.c.

#define JC42_ALARM_CRIT_BIT   15

Definition at line 50 of file jc42.c.

#define JC42_ALARM_MAX_BIT   14

Definition at line 51 of file jc42.c.

#define JC42_ALARM_MIN_BIT   13

Definition at line 52 of file jc42.c.

#define JC42_CAP_RANGE   (1 << 2)

Definition at line 63 of file jc42.c.

#define JC42_CFG_CRIT_ONLY   (1 << 2)

Definition at line 55 of file jc42.c.

#define JC42_CFG_EVENT_LOCK   (1 << 7)

Definition at line 57 of file jc42.c.

#define JC42_CFG_HYST_MASK   (0x03 << 9)

Definition at line 60 of file jc42.c.

#define JC42_CFG_HYST_SHIFT   9

Definition at line 59 of file jc42.c.

#define JC42_CFG_SHUTDOWN   (1 << 8)

Definition at line 58 of file jc42.c.

#define JC42_CFG_TCRIT_LOCK   (1 << 6)

Definition at line 56 of file jc42.c.

#define JC42_DEV_PM_OPS   NULL

Definition at line 217 of file jc42.c.

#define JC42_REG_CAP   0x00

Definition at line 40 of file jc42.c.

#define JC42_REG_CONFIG   0x01

Definition at line 41 of file jc42.c.

#define JC42_REG_DEVICEID   0x07

Definition at line 47 of file jc42.c.

#define JC42_REG_MANID   0x06

Definition at line 46 of file jc42.c.

#define JC42_REG_TEMP   0x05

Definition at line 45 of file jc42.c.

#define JC42_REG_TEMP_CRITICAL   0x04

Definition at line 44 of file jc42.c.

#define JC42_REG_TEMP_LOWER   0x03

Definition at line 43 of file jc42.c.

#define JC42_REG_TEMP_UPPER   0x02

Definition at line 42 of file jc42.c.

#define JC42_TEMP_MAX   125000

Definition at line 236 of file jc42.c.

#define JC42_TEMP_MIN   0

Definition at line 235 of file jc42.c.

#define JC42_TEMP_MIN_EXTENDED   (-40000)

Definition at line 234 of file jc42.c.

#define MAX6604_DEVID   0x3e00

Definition at line 93 of file jc42.c.

#define MAX6604_DEVID_MASK   0xffff

Definition at line 94 of file jc42.c.

#define MAX_MANID   0x004d /* Maxim */

Definition at line 68 of file jc42.c.

#define MCP9804_DEVID   0x0200

Definition at line 97 of file jc42.c.

#define MCP9804_DEVID_MASK   0xfffc

Definition at line 98 of file jc42.c.

#define MCP98242_DEVID   0x2000

Definition at line 100 of file jc42.c.

#define MCP98242_DEVID_MASK   0xfffc

Definition at line 101 of file jc42.c.

#define MCP98243_DEVID   0x2100

Definition at line 103 of file jc42.c.

#define MCP98243_DEVID_MASK   0xfffc

Definition at line 104 of file jc42.c.

#define MCP9843_DEVID   0x0000 /* Also matches mcp9805 */

Definition at line 106 of file jc42.c.

#define MCP9843_DEVID_MASK   0xfffe

Definition at line 107 of file jc42.c.

#define MCP_MANID   0x0054 /* Microchip */

Definition at line 70 of file jc42.c.

#define NXP_MANID   0x1131 /* NXP Semiconductors */

Definition at line 71 of file jc42.c.

#define ONS_MANID   0x1b09 /* ON Semiconductor */

Definition at line 72 of file jc42.c.

#define SE97_DEVID   0xa200

Definition at line 110 of file jc42.c.

#define SE97_DEVID_MASK   0xfffc

Definition at line 111 of file jc42.c.

#define SE98_DEVID   0xa100

Definition at line 113 of file jc42.c.

#define SE98_DEVID_MASK   0xfffc

Definition at line 114 of file jc42.c.

#define set (   value,
  reg 
)
Value:
static ssize_t set_##value(struct device *dev, \
const char *buf, size_t count) \
{ \
struct jc42_data *data = i2c_get_clientdata(client); \
int err, ret = count; \
long val; \
if (kstrtol(buf, 10, &val) < 0) \
return -EINVAL; \
mutex_lock(&data->update_lock); \
data->value = jc42_temp_to_reg(val, data->extended); \
err = i2c_smbus_write_word_swapped(client, reg, data->value); \
if (err < 0) \
ret = err; \
mutex_unlock(&data->update_lock); \
return ret; \
}

Definition at line 311 of file jc42.c.

#define show (   value)
Value:
static ssize_t show_##value(struct device *dev, \
char *buf) \
{ \
struct jc42_data *data = jc42_update_device(dev); \
if (IS_ERR(data)) \
return PTR_ERR(data); \
return sprintf(buf, "%d\n", jc42_temp_from_reg(data->value)); \
}

Definition at line 263 of file jc42.c.

#define STM_MANID   0x104a /* ST Microelectronics */

Definition at line 73 of file jc42.c.

#define STTS2002_DEVID   0x0300

Definition at line 127 of file jc42.c.

#define STTS2002_DEVID_MASK   0xffff

Definition at line 128 of file jc42.c.

#define STTS3000_DEVID   0x0200

Definition at line 130 of file jc42.c.

#define STTS3000_DEVID_MASK   0xffff

Definition at line 131 of file jc42.c.

#define STTS424_DEVID   0x0101

Definition at line 121 of file jc42.c.

#define STTS424_DEVID_MASK   0xffff

Definition at line 122 of file jc42.c.

#define STTS424E_DEVID   0x0000

Definition at line 124 of file jc42.c.

#define STTS424E_DEVID_MASK   0xfffe

Definition at line 125 of file jc42.c.

#define TS3000B3_DEVID   0x2903 /* Also matches TSE2002B3 */

Definition at line 86 of file jc42.c.

#define TS3000B3_DEVID_MASK   0xffff

Definition at line 87 of file jc42.c.

#define TS3000GB2_DEVID   0x2912 /* Also matches TSE2002GB2 */

Definition at line 89 of file jc42.c.

#define TS3000GB2_DEVID_MASK   0xffff

Definition at line 90 of file jc42.c.

Function Documentation

MODULE_AUTHOR ( "Guenter Roeck <[email protected]>"  )
MODULE_DESCRIPTION ( "JC42 driver )
MODULE_DEVICE_TABLE ( i2c  ,
jc42_id   
)
module_i2c_driver ( jc42_driver  )
MODULE_LICENSE ( "GPL"  )
set ( temp_min  ,
JC42_REG_TEMP_LOWER   
)
set ( temp_max  ,
JC42_REG_TEMP_UPPER   
)
set ( temp_crit  ,
JC42_REG_TEMP_CRITICAL   
)
show ( temp_input  )
show ( temp_crit  )
show ( temp_min  )
show ( temp_max  )