Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
8a4ebbc8
Commit
8a4ebbc8
authored
Jan 26, 2004
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/gregkh/linux/i2c-2.6
into home.osdl.org:/home/torvalds/v2.5/linux
parents
959ab1dc
bef87257
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
90 deletions
+67
-90
Documentation/i2c/porting-clients
Documentation/i2c/porting-clients
+1
-4
drivers/i2c/busses/i2c-parport.h
drivers/i2c/busses/i2c-parport.h
+4
-3
drivers/i2c/busses/i2c-philips-par.c
drivers/i2c/busses/i2c-philips-par.c
+2
-2
drivers/i2c/busses/i2c-piix4.c
drivers/i2c/busses/i2c-piix4.c
+27
-21
drivers/i2c/chips/lm75.c
drivers/i2c/chips/lm75.c
+6
-6
drivers/i2c/chips/lm78.c
drivers/i2c/chips/lm78.c
+6
-6
drivers/i2c/chips/lm85.c
drivers/i2c/chips/lm85.c
+21
-48
No files found.
Documentation/i2c/porting-clients
View file @
8a4ebbc8
...
@@ -92,10 +92,7 @@ Technical changes:
...
@@ -92,10 +92,7 @@ Technical changes:
i2c_get_clientdata(client) instead.
i2c_get_clientdata(client) instead.
* [Interface] Init function should not print anything. Make sure
* [Interface] Init function should not print anything. Make sure
there is a MODULE_LICENSE() line. MODULE_PARM() is replaced
there is a MODULE_LICENSE() line.
by module_param(). Note that module_param has a third parameter,
that you should set to 0 by default. See include/linux/moduleparam.h
for details.
Coding policy:
Coding policy:
...
...
drivers/i2c/busses/i2c-parport.h
View file @
8a4ebbc8
...
@@ -67,12 +67,13 @@ static struct adapter_parm adapter_parm[] = {
...
@@ -67,12 +67,13 @@ static struct adapter_parm adapter_parm[] = {
.
getsda
=
{
0x40
,
STAT
,
1
},
.
getsda
=
{
0x40
,
STAT
,
1
},
.
getscl
=
{
0x08
,
STAT
,
1
},
.
getscl
=
{
0x08
,
STAT
,
1
},
},
},
/* type 4: ADM
1032 evaluation board
*/
/* type 4: ADM
1025 and ADM1032 evaluation boards
*/
{
{
.
setsda
=
{
0x02
,
DATA
,
1
},
.
setsda
=
{
0x02
,
DATA
,
1
},
.
setscl
=
{
0x01
,
DATA
,
1
},
.
setscl
=
{
0x01
,
DATA
,
1
},
.
getsda
=
{
0x10
,
STAT
,
1
},
.
getsda
=
{
0x10
,
STAT
,
1
},
.
init
=
{
0xf0
,
DATA
,
0
},
.
init
=
{
0xf0
,
DATA
,
0
},
/* ADM1025 doesn't need this,
but it doesn't hurt */
},
},
};
};
...
@@ -84,4 +85,4 @@ MODULE_PARM_DESC(type,
...
@@ -84,4 +85,4 @@ MODULE_PARM_DESC(type,
" 1 = home brew teletext adapter
\n
"
" 1 = home brew teletext adapter
\n
"
" 2 = Velleman K8000 adapter
\n
"
" 2 = Velleman K8000 adapter
\n
"
" 3 = ELV adapter
\n
"
" 3 = ELV adapter
\n
"
" 4 = ADM
1032 evalulation board
\n
"
);
" 4 = ADM
1025 and ADM1032 evaluation boards
\n
"
);
drivers/i2c/busses/i2c-philips-par.c
View file @
8a4ebbc8
...
@@ -184,8 +184,8 @@ static void i2c_parport_attach (struct parport *port)
...
@@ -184,8 +184,8 @@ static void i2c_parport_attach (struct parport *port)
return
;
return
;
}
}
/* reset hardware to sane state */
/* reset hardware to sane state */
bit_lp_
setsda
(
port
,
1
);
adapter
->
bit_lp_data
.
setsda
(
port
,
1
);
bit_lp_
setscl
(
port
,
1
);
adapter
->
bit_lp_data
.
setscl
(
port
,
1
);
parport_release
(
adapter
->
pdev
);
parport_release
(
adapter
->
pdev
);
if
(
i2c_bit_add_bus
(
&
adapter
->
adapter
)
<
0
)
{
if
(
i2c_bit_add_bus
(
&
adapter
->
adapter
)
<
0
)
{
...
...
drivers/i2c/busses/i2c-piix4.c
View file @
8a4ebbc8
...
@@ -68,6 +68,9 @@ struct sd {
...
@@ -68,6 +68,9 @@ struct sd {
#define SMBSLVEVT (0xA + piix4_smba)
#define SMBSLVEVT (0xA + piix4_smba)
#define SMBSLVDAT (0xC + piix4_smba)
#define SMBSLVDAT (0xC + piix4_smba)
/* count for request_region */
#define SMBIOSIZE 8
/* PCI Address Constants */
/* PCI Address Constants */
#define SMBBA 0x090
#define SMBBA 0x090
#define SMBHSTCFG 0x0D2
#define SMBHSTCFG 0x0D2
...
@@ -112,14 +115,13 @@ MODULE_PARM_DESC(fix_hstcfg,
...
@@ -112,14 +115,13 @@ MODULE_PARM_DESC(fix_hstcfg,
static
int
piix4_transaction
(
void
);
static
int
piix4_transaction
(
void
);
static
unsigned
short
piix4_smba
=
0
;
static
unsigned
short
piix4_smba
=
0
;
static
struct
i2c_adapter
piix4_adapter
;
static
struct
i2c_adapter
piix4_adapter
;
/*
/*
* Get DMI information.
* Get DMI information.
*/
*/
static
int
ibm_dmi_probe
(
void
)
static
int
__devinit
ibm_dmi_probe
(
void
)
{
{
#ifdef CONFIG_X86
#ifdef CONFIG_X86
extern
int
is_unsafe_smbus
;
extern
int
is_unsafe_smbus
;
...
@@ -129,9 +131,9 @@ static int ibm_dmi_probe(void)
...
@@ -129,9 +131,9 @@ static int ibm_dmi_probe(void)
#endif
#endif
}
}
static
int
piix4_setup
(
struct
pci_dev
*
PIIX4_dev
,
const
struct
pci_device_id
*
id
)
static
int
__devinit
piix4_setup
(
struct
pci_dev
*
PIIX4_dev
,
const
struct
pci_device_id
*
id
)
{
{
int
error_return
=
0
;
unsigned
char
temp
;
unsigned
char
temp
;
/* match up the function */
/* match up the function */
...
@@ -144,8 +146,7 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
...
@@ -144,8 +146,7 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
dev_err
(
&
PIIX4_dev
->
dev
,
"IBM Laptop detected; this module "
dev_err
(
&
PIIX4_dev
->
dev
,
"IBM Laptop detected; this module "
"may corrupt your serial eeprom! Refusing to load "
"may corrupt your serial eeprom! Refusing to load "
"module!
\n
"
);
"module!
\n
"
);
error_return
=
-
EPERM
;
return
-
EPERM
;
goto
END
;
}
}
/* Determine the address of the SMBus areas */
/* Determine the address of the SMBus areas */
...
@@ -163,11 +164,10 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
...
@@ -163,11 +164,10 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
}
}
}
}
if
(
!
request_region
(
piix4_smba
,
8
,
"piix4-smbus"
))
{
if
(
!
request_region
(
piix4_smba
,
SMBIOSIZE
,
"piix4-smbus"
))
{
dev_err
(
&
PIIX4_dev
->
dev
,
"SMB region 0x%x already in use!
\n
"
,
dev_err
(
&
PIIX4_dev
->
dev
,
"SMB region 0x%x already in use!
\n
"
,
piix4_smba
);
piix4_smba
);
error_return
=
-
ENODEV
;
return
-
ENODEV
;
goto
END
;
}
}
pci_read_config_byte
(
PIIX4_dev
,
SMBHSTCFG
,
&
temp
);
pci_read_config_byte
(
PIIX4_dev
,
SMBHSTCFG
,
&
temp
);
...
@@ -214,8 +214,9 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
...
@@ -214,8 +214,9 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
}
else
{
}
else
{
dev_err
(
&
PIIX4_dev
->
dev
,
dev_err
(
&
PIIX4_dev
->
dev
,
"Host SMBus controller not enabled!
\n
"
);
"Host SMBus controller not enabled!
\n
"
);
error_return
=
-
ENODEV
;
release_region
(
piix4_smba
,
SMBIOSIZE
);
goto
END
;
piix4_smba
=
0
;
return
-
ENODEV
;
}
}
}
}
...
@@ -231,8 +232,7 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
...
@@ -231,8 +232,7 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
dev_dbg
(
&
PIIX4_dev
->
dev
,
"SMBREV = 0x%X
\n
"
,
temp
);
dev_dbg
(
&
PIIX4_dev
->
dev
,
"SMBREV = 0x%X
\n
"
,
temp
);
dev_dbg
(
&
PIIX4_dev
->
dev
,
"SMBA = 0x%X
\n
"
,
piix4_smba
);
dev_dbg
(
&
PIIX4_dev
->
dev
,
"SMBA = 0x%X
\n
"
,
piix4_smba
);
END:
return
0
;
return
error_return
;
}
}
/* Another internally used function */
/* Another internally used function */
...
@@ -465,7 +465,8 @@ static struct pci_device_id piix4_ids[] = {
...
@@ -465,7 +465,8 @@ static struct pci_device_id piix4_ids[] = {
{
0
,
}
{
0
,
}
};
};
static
int
__devinit
piix4_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
id
)
static
int
__devinit
piix4_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
id
)
{
{
int
retval
;
int
retval
;
...
@@ -479,17 +480,24 @@ static int __devinit piix4_probe(struct pci_dev *dev, const struct pci_device_id
...
@@ -479,17 +480,24 @@ static int __devinit piix4_probe(struct pci_dev *dev, const struct pci_device_id
snprintf
(
piix4_adapter
.
name
,
I2C_NAME_SIZE
,
snprintf
(
piix4_adapter
.
name
,
I2C_NAME_SIZE
,
"SMBus PIIX4 adapter at %04x"
,
piix4_smba
);
"SMBus PIIX4 adapter at %04x"
,
piix4_smba
);
retval
=
i2c_add_adapter
(
&
piix4_adapter
);
if
((
retval
=
i2c_add_adapter
(
&
piix4_adapter
)))
{
dev_err
(
&
dev
->
dev
,
"Couldn't register adapter!
\n
"
);
release_region
(
piix4_smba
,
SMBIOSIZE
);
piix4_smba
=
0
;
}
return
retval
;
return
retval
;
}
}
static
void
__devexit
piix4_remove
(
struct
pci_dev
*
dev
)
static
void
__devexit
piix4_remove
(
struct
pci_dev
*
dev
)
{
{
i2c_del_adapter
(
&
piix4_adapter
);
if
(
piix4_smba
)
{
i2c_del_adapter
(
&
piix4_adapter
);
release_region
(
piix4_smba
,
SMBIOSIZE
);
piix4_smba
=
0
;
}
}
}
static
struct
pci_driver
piix4_driver
=
{
static
struct
pci_driver
piix4_driver
=
{
.
name
=
"piix4-smbus"
,
.
name
=
"piix4-smbus"
,
.
id_table
=
piix4_ids
,
.
id_table
=
piix4_ids
,
...
@@ -502,15 +510,13 @@ static int __init i2c_piix4_init(void)
...
@@ -502,15 +510,13 @@ static int __init i2c_piix4_init(void)
return
pci_module_init
(
&
piix4_driver
);
return
pci_module_init
(
&
piix4_driver
);
}
}
static
void
__exit
i2c_piix4_exit
(
void
)
static
void
__exit
i2c_piix4_exit
(
void
)
{
{
pci_unregister_driver
(
&
piix4_driver
);
pci_unregister_driver
(
&
piix4_driver
);
release_region
(
piix4_smba
,
8
);
}
}
MODULE_AUTHOR
MODULE_AUTHOR
(
"Frodo Looijaard <frodol@dds.nl> and "
(
"Frodo Looijaard <frodol@dds.nl> and
Philip Edelbrock <phil@netroedge.com>"
);
"
Philip Edelbrock <phil@netroedge.com>"
);
MODULE_DESCRIPTION
(
"PIIX4 SMBus driver"
);
MODULE_DESCRIPTION
(
"PIIX4 SMBus driver"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
...
...
drivers/i2c/chips/lm75.c
View file @
8a4ebbc8
...
@@ -104,9 +104,9 @@ static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \
...
@@ -104,9 +104,9 @@ static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \
set
(
temp_max
,
LM75_REG_TEMP_OS
);
set
(
temp_max
,
LM75_REG_TEMP_OS
);
set
(
temp_hyst
,
LM75_REG_TEMP_HYST
);
set
(
temp_hyst
,
LM75_REG_TEMP_HYST
);
static
DEVICE_ATTR
(
temp_max
,
S_IWUSR
|
S_IRUGO
,
show_temp_max
,
set_temp_max
);
static
DEVICE_ATTR
(
temp_max
1
,
S_IWUSR
|
S_IRUGO
,
show_temp_max
,
set_temp_max
);
static
DEVICE_ATTR
(
temp_hyst
,
S_IWUSR
|
S_IRUGO
,
show_temp_hyst
,
set_temp_hyst
);
static
DEVICE_ATTR
(
temp_hyst
1
,
S_IWUSR
|
S_IRUGO
,
show_temp_hyst
,
set_temp_hyst
);
static
DEVICE_ATTR
(
temp_input
,
S_IRUGO
,
show_temp_input
,
NULL
);
static
DEVICE_ATTR
(
temp_input
1
,
S_IRUGO
,
show_temp_input
,
NULL
);
static
int
lm75_attach_adapter
(
struct
i2c_adapter
*
adapter
)
static
int
lm75_attach_adapter
(
struct
i2c_adapter
*
adapter
)
{
{
...
@@ -197,9 +197,9 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
...
@@ -197,9 +197,9 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
lm75_init_client
(
new_client
);
lm75_init_client
(
new_client
);
/* Register sysfs hooks */
/* Register sysfs hooks */
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_max
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_max
1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_hyst
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_hyst
1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_input
1
);
return
0
;
return
0
;
...
...
drivers/i2c/chips/lm78.c
View file @
8a4ebbc8
...
@@ -369,10 +369,10 @@ static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count)
...
@@ -369,10 +369,10 @@ static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count)
return
count
;
return
count
;
}
}
static
DEVICE_ATTR
(
temp_input
,
S_IRUGO
,
show_temp
,
NULL
)
static
DEVICE_ATTR
(
temp_input
1
,
S_IRUGO
,
show_temp
,
NULL
)
static
DEVICE_ATTR
(
temp_max
,
S_IRUGO
|
S_IWUSR
,
static
DEVICE_ATTR
(
temp_max
1
,
S_IRUGO
|
S_IWUSR
,
show_temp_over
,
set_temp_over
)
show_temp_over
,
set_temp_over
)
static
DEVICE_ATTR
(
temp_hyst
,
S_IRUGO
|
S_IWUSR
,
static
DEVICE_ATTR
(
temp_hyst
1
,
S_IRUGO
|
S_IWUSR
,
show_temp_hyst
,
set_temp_hyst
)
show_temp_hyst
,
set_temp_hyst
)
/* 3 Fans */
/* 3 Fans */
...
@@ -678,9 +678,9 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
...
@@ -678,9 +678,9 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in_input6
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in_input6
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in_min6
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in_min6
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in_max6
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in_max6
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_input
1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_max
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_max
1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_hyst
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp_hyst
1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan_input1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan_input1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan_min1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan_min1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan_div1
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_fan_div1
);
...
...
drivers/i2c/chips/lm85.c
View file @
8a4ebbc8
...
@@ -48,9 +48,6 @@ static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
...
@@ -48,9 +48,6 @@ static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
/* Insmod parameters */
/* Insmod parameters */
SENSORS_INSMOD_4
(
lm85b
,
lm85c
,
adm1027
,
adt7463
);
SENSORS_INSMOD_4
(
lm85b
,
lm85c
,
adm1027
,
adt7463
);
/* Enable debug if true */
static
int
lm85debug
=
0
;
/* The LM85 registers */
/* The LM85 registers */
#define LM85_REG_IN(nr) (0x20 + (nr))
#define LM85_REG_IN(nr) (0x20 + (nr))
...
@@ -802,19 +799,15 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
...
@@ -802,19 +799,15 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
company
=
lm85_read_value
(
new_client
,
LM85_REG_COMPANY
);
company
=
lm85_read_value
(
new_client
,
LM85_REG_COMPANY
);
verstep
=
lm85_read_value
(
new_client
,
LM85_REG_VERSTEP
);
verstep
=
lm85_read_value
(
new_client
,
LM85_REG_VERSTEP
);
if
(
lm85debug
)
{
dev_dbg
(
&
adapter
->
dev
,
"Detecting device at %d,0x%02x with"
printk
(
"lm85: Detecting device at %d,0x%02x with"
" COMPANY: 0x%02x and VERSTEP: 0x%02x
\n
"
,
" COMPANY: 0x%02x and VERSTEP: 0x%02x
\n
"
,
i2c_adapter_id
(
new_client
->
adapter
),
new_client
->
addr
,
i2c_adapter_id
(
new_client
->
adapter
),
new_client
->
addr
,
company
,
verstep
);
company
,
verstep
);
}
/* If auto-detecting, Determine the chip type. */
/* If auto-detecting, Determine the chip type. */
if
(
kind
<=
0
)
{
if
(
kind
<=
0
)
{
if
(
lm85debug
)
{
dev_dbg
(
&
adapter
->
dev
,
"Autodetecting device at %d,0x%02x ...
\n
"
,
printk
(
"lm85: Autodetecting device at %d,0x%02x ...
\n
"
,
i2c_adapter_id
(
adapter
),
address
);
i2c_adapter_id
(
adapter
),
address
);
}
if
(
company
==
LM85_COMPANY_NATIONAL
if
(
company
==
LM85_COMPANY_NATIONAL
&&
verstep
==
LM85_VERSTEP_LM85C
)
{
&&
verstep
==
LM85_VERSTEP_LM85C
)
{
kind
=
lm85c
;
kind
=
lm85c
;
...
@@ -823,8 +816,8 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
...
@@ -823,8 +816,8 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
kind
=
lm85b
;
kind
=
lm85b
;
}
else
if
(
company
==
LM85_COMPANY_NATIONAL
}
else
if
(
company
==
LM85_COMPANY_NATIONAL
&&
(
verstep
&
0xf0
)
==
LM85_VERSTEP_GENERIC
)
{
&&
(
verstep
&
0xf0
)
==
LM85_VERSTEP_GENERIC
)
{
printk
(
"lm85:
Unrecgonized version/stepping 0x%02x"
dev_err
(
&
adapter
->
dev
,
"
Unrecgonized version/stepping 0x%02x"
" Defaulting to LM85.
\n
"
,
verstep
);
" Defaulting to LM85.
\n
"
,
verstep
);
kind
=
any_chip
;
kind
=
any_chip
;
}
else
if
(
company
==
LM85_COMPANY_ANALOG_DEV
}
else
if
(
company
==
LM85_COMPANY_ANALOG_DEV
&&
verstep
==
LM85_VERSTEP_ADM1027
)
{
&&
verstep
==
LM85_VERSTEP_ADM1027
)
{
...
@@ -834,21 +827,19 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
...
@@ -834,21 +827,19 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
kind
=
adt7463
;
kind
=
adt7463
;
}
else
if
(
company
==
LM85_COMPANY_ANALOG_DEV
}
else
if
(
company
==
LM85_COMPANY_ANALOG_DEV
&&
(
verstep
&
0xf0
)
==
LM85_VERSTEP_GENERIC
)
{
&&
(
verstep
&
0xf0
)
==
LM85_VERSTEP_GENERIC
)
{
printk
(
"lm85:
Unrecgonized version/stepping 0x%02x"
dev_err
(
&
adapter
->
dev
,
"
Unrecgonized version/stepping 0x%02x"
" Defaulting to ADM1027.
\n
"
,
verstep
);
" Defaulting to ADM1027.
\n
"
,
verstep
);
kind
=
adm1027
;
kind
=
adm1027
;
}
else
if
(
kind
==
0
&&
(
verstep
&
0xf0
)
==
0x60
)
{
}
else
if
(
kind
==
0
&&
(
verstep
&
0xf0
)
==
0x60
)
{
printk
(
"lm85:
Generic LM85 Version 6 detected
\n
"
);
dev_err
(
&
adapter
->
dev
,
"
Generic LM85 Version 6 detected
\n
"
);
/* Leave kind as "any_chip" */
/* Leave kind as "any_chip" */
}
else
{
}
else
{
if
(
lm85debug
)
{
dev_dbg
(
&
adapter
->
dev
,
"Autodetection failed
\n
"
);
printk
(
"lm85: Autodetection failed
\n
"
);
}
/* Not an LM85 ... */
/* Not an LM85 ... */
if
(
kind
==
0
)
{
/* User used force=x,y */
if
(
kind
==
0
)
{
/* User used force=x,y */
printk
(
"lm85:
Generic LM85 Version 6 not"
dev_err
(
&
adapter
->
dev
,
"
Generic LM85 Version 6 not"
" found at %d,0x%02x. Try force_lm85c.
\n
"
,
" found at %d,0x%02x. Try force_lm85c.
\n
"
,
i2c_adapter_id
(
adapter
),
address
);
i2c_adapter_id
(
adapter
),
address
);
}
}
err
=
0
;
err
=
0
;
goto
ERROR1
;
goto
ERROR1
;
...
@@ -879,12 +870,10 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
...
@@ -879,12 +870,10 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
data
->
valid
=
0
;
data
->
valid
=
0
;
init_MUTEX
(
&
data
->
update_lock
);
init_MUTEX
(
&
data
->
update_lock
);
if
(
lm85debug
)
{
dev_dbg
(
&
adapter
->
dev
,
"Assigning ID %d to %s at %d,0x%02x
\n
"
,
printk
(
"lm85: Assigning ID %d to %s at %d,0x%02x
\n
"
,
new_client
->
id
,
new_client
->
name
,
new_client
->
id
,
new_client
->
name
,
i2c_adapter_id
(
new_client
->
adapter
),
i2c_adapter_id
(
new_client
->
adapter
),
new_client
->
addr
);
new_client
->
addr
);
}
/* Tell the I2C layer a new client has arrived */
/* Tell the I2C layer a new client has arrived */
if
((
err
=
i2c_attach_client
(
new_client
)))
if
((
err
=
i2c_attach_client
(
new_client
)))
...
@@ -1021,31 +1010,24 @@ void lm85_init_client(struct i2c_client *client)
...
@@ -1021,31 +1010,24 @@ void lm85_init_client(struct i2c_client *client)
int
value
;
int
value
;
struct
lm85_data
*
data
=
i2c_get_clientdata
(
client
);
struct
lm85_data
*
data
=
i2c_get_clientdata
(
client
);
if
(
lm85debug
)
{
dev_dbg
(
&
client
->
dev
,
"Initializing device
\n
"
);
printk
(
"lm85(%d): Initializing device
\n
"
,
client
->
id
);
}
/* Warn if part was not "READY" */
/* Warn if part was not "READY" */
value
=
lm85_read_value
(
client
,
LM85_REG_CONFIG
);
value
=
lm85_read_value
(
client
,
LM85_REG_CONFIG
);
if
(
lm85debug
)
{
dev_dbg
(
&
client
->
dev
,
"LM85_REG_CONFIG is: 0x%02x
\n
"
,
value
);
printk
(
"lm85(%d): LM85_REG_CONFIG is: 0x%02x
\n
"
,
client
->
id
,
value
);
}
if
(
value
&
0x02
)
{
if
(
value
&
0x02
)
{
printk
(
"lm85(%d): Client (%d,0x%02x) config is locked.
\n
"
,
dev_err
(
&
client
->
dev
,
"Client (%d,0x%02x) config is locked.
\n
"
,
client
->
id
,
i2c_adapter_id
(
client
->
adapter
),
client
->
addr
);
i2c_adapter_id
(
client
->
adapter
),
client
->
addr
);
};
};
if
(
!
(
value
&
0x04
)
)
{
if
(
!
(
value
&
0x04
)
)
{
printk
(
"lm85(%d): Client (%d,0x%02x) is not ready.
\n
"
,
dev_err
(
&
client
->
dev
,
"Client (%d,0x%02x) is not ready.
\n
"
,
client
->
id
,
i2c_adapter_id
(
client
->
adapter
),
client
->
addr
);
i2c_adapter_id
(
client
->
adapter
),
client
->
addr
);
};
};
if
(
value
&
0x10
if
(
value
&
0x10
&&
(
data
->
type
==
adm1027
&&
(
data
->
type
==
adm1027
||
data
->
type
==
adt7463
)
)
{
||
data
->
type
==
adt7463
)
)
{
printk
(
"lm85(%d):
Client (%d,0x%02x) VxI mode is set. "
dev_err
(
&
client
->
dev
,
"
Client (%d,0x%02x) VxI mode is set. "
"Please report this to the lm85 maintainer.
\n
"
,
"Please report this to the lm85 maintainer.
\n
"
,
client
->
id
,
i2c_adapter_id
(
client
->
adapter
),
client
->
addr
);
i2c_adapter_id
(
client
->
adapter
),
client
->
addr
);
};
};
...
@@ -1061,11 +1043,8 @@ void lm85_init_client(struct i2c_client *client)
...
@@ -1061,11 +1043,8 @@ void lm85_init_client(struct i2c_client *client)
value
=
lm85_read_value
(
client
,
LM85_REG_CONFIG
);
value
=
lm85_read_value
(
client
,
LM85_REG_CONFIG
);
/* Try to clear LOCK, Set START, save everything else */
/* Try to clear LOCK, Set START, save everything else */
value
=
(
value
&
~
0x02
)
|
0x01
;
value
=
(
value
&
~
0x02
)
|
0x01
;
if
(
lm85debug
)
{
dev_dbg
(
&
client
->
dev
,
"Setting CONFIG to: 0x%02x
\n
"
,
value
);
printk
(
"lm85(%d): Setting CONFIG to: 0x%02x
\n
"
,
client
->
id
,
value
);
}
lm85_write_value
(
client
,
LM85_REG_CONFIG
,
value
);
lm85_write_value
(
client
,
LM85_REG_CONFIG
,
value
);
}
}
void
lm85_update_client
(
struct
i2c_client
*
client
)
void
lm85_update_client
(
struct
i2c_client
*
client
)
...
@@ -1078,10 +1057,8 @@ void lm85_update_client(struct i2c_client *client)
...
@@ -1078,10 +1057,8 @@ void lm85_update_client(struct i2c_client *client)
if
(
!
data
->
valid
||
if
(
!
data
->
valid
||
(
jiffies
-
data
->
last_reading
>
LM85_DATA_INTERVAL
)
)
{
(
jiffies
-
data
->
last_reading
>
LM85_DATA_INTERVAL
)
)
{
/* Things that change quickly */
/* Things that change quickly */
dev_dbg
(
&
client
->
dev
,
"Reading sensor values
\n
"
);
if
(
lm85debug
)
{
printk
(
"lm85(%d): Reading sensor values
\n
"
,
client
->
id
);
}
/* Have to read extended bits first to "freeze" the
/* Have to read extended bits first to "freeze" the
* more significant bits that are read later.
* more significant bits that are read later.
*/
*/
...
@@ -1125,10 +1102,8 @@ void lm85_update_client(struct i2c_client *client)
...
@@ -1125,10 +1102,8 @@ void lm85_update_client(struct i2c_client *client)
if
(
!
data
->
valid
||
if
(
!
data
->
valid
||
(
jiffies
-
data
->
last_config
>
LM85_CONFIG_INTERVAL
)
)
{
(
jiffies
-
data
->
last_config
>
LM85_CONFIG_INTERVAL
)
)
{
/* Things that don't change often */
/* Things that don't change often */
dev_dbg
(
&
client
->
dev
,
"Reading config values
\n
"
);
if
(
lm85debug
)
{
printk
(
"lm85(%d): Reading config values
\n
"
,
client
->
id
);
}
for
(
i
=
0
;
i
<=
4
;
++
i
)
{
for
(
i
=
0
;
i
<=
4
;
++
i
)
{
data
->
in_min
[
i
]
=
data
->
in_min
[
i
]
=
lm85_read_value
(
client
,
LM85_REG_IN_MIN
(
i
));
lm85_read_value
(
client
,
LM85_REG_IN_MIN
(
i
));
...
@@ -1234,8 +1209,6 @@ static void __exit sm_lm85_exit(void)
...
@@ -1234,8 +1209,6 @@ static void __exit sm_lm85_exit(void)
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_AUTHOR
(
"Philip Pokorny <ppokorny@penguincomputing.com>, Margit Schubert-While <margitsw@t-online.de>"
);
MODULE_AUTHOR
(
"Philip Pokorny <ppokorny@penguincomputing.com>, Margit Schubert-While <margitsw@t-online.de>"
);
MODULE_DESCRIPTION
(
"LM85-B, LM85-C driver"
);
MODULE_DESCRIPTION
(
"LM85-B, LM85-C driver"
);
MODULE_PARM
(
lm85debug
,
"i"
);
MODULE_PARM_DESC
(
lm85debug
,
"Enable debugging statements"
);
module_init
(
sm_lm85_init
);
module_init
(
sm_lm85_init
);
module_exit
(
sm_lm85_exit
);
module_exit
(
sm_lm85_exit
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment