Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
0feb9bfc
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 大约 4 年
通知
14
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0feb9bfc
编写于
1月 06, 2006
作者:
L
Linus Torvalds
浏览文件
操作
浏览文件
下载
差异文件
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6
上级
d8d8f6a4
ccf18968
变更
124
展开全部
隐藏空白更改
内联
并排
Showing
124 changed file
with
1550 addition
and
747 deletion
+1550
-747
Documentation/feature-removal-schedule.txt
Documentation/feature-removal-schedule.txt
+0
-9
Documentation/hwmon/w83627hf
Documentation/hwmon/w83627hf
+11
-8
Documentation/i2c/busses/i2c-nforce2
Documentation/i2c/busses/i2c-nforce2
+2
-1
Documentation/i2c/busses/i2c-parport
Documentation/i2c/busses/i2c-parport
+1
-0
Documentation/i2c/porting-clients
Documentation/i2c/porting-clients
+53
-37
Documentation/i2c/writing-clients
Documentation/i2c/writing-clients
+6
-14
MAINTAINERS
MAINTAINERS
+6
-0
arch/arm/mach-pxa/akita-ioexp.c
arch/arm/mach-pxa/akita-ioexp.c
+3
-4
drivers/acorn/char/pcf8583.c
drivers/acorn/char/pcf8583.c
+3
-2
drivers/hwmon/Kconfig
drivers/hwmon/Kconfig
+12
-0
drivers/hwmon/Makefile
drivers/hwmon/Makefile
+1
-0
drivers/hwmon/adm1021.c
drivers/hwmon/adm1021.c
+3
-3
drivers/hwmon/adm1025.c
drivers/hwmon/adm1025.c
+3
-7
drivers/hwmon/adm1026.c
drivers/hwmon/adm1026.c
+3
-7
drivers/hwmon/adm1031.c
drivers/hwmon/adm1031.c
+3
-3
drivers/hwmon/adm9240.c
drivers/hwmon/adm9240.c
+3
-3
drivers/hwmon/asb100.c
drivers/hwmon/asb100.c
+3
-3
drivers/hwmon/atxp1.c
drivers/hwmon/atxp1.c
+3
-3
drivers/hwmon/ds1621.c
drivers/hwmon/ds1621.c
+3
-3
drivers/hwmon/fscher.c
drivers/hwmon/fscher.c
+3
-3
drivers/hwmon/fscpos.c
drivers/hwmon/fscpos.c
+3
-3
drivers/hwmon/gl518sm.c
drivers/hwmon/gl518sm.c
+3
-3
drivers/hwmon/gl520sm.c
drivers/hwmon/gl520sm.c
+3
-3
drivers/hwmon/hwmon-vid.c
drivers/hwmon/hwmon-vid.c
+42
-27
drivers/hwmon/it87.c
drivers/hwmon/it87.c
+10
-8
drivers/hwmon/lm63.c
drivers/hwmon/lm63.c
+3
-3
drivers/hwmon/lm75.c
drivers/hwmon/lm75.c
+3
-3
drivers/hwmon/lm77.c
drivers/hwmon/lm77.c
+3
-3
drivers/hwmon/lm78.c
drivers/hwmon/lm78.c
+7
-6
drivers/hwmon/lm80.c
drivers/hwmon/lm80.c
+3
-3
drivers/hwmon/lm83.c
drivers/hwmon/lm83.c
+3
-3
drivers/hwmon/lm85.c
drivers/hwmon/lm85.c
+39
-11
drivers/hwmon/lm87.c
drivers/hwmon/lm87.c
+3
-3
drivers/hwmon/lm90.c
drivers/hwmon/lm90.c
+3
-3
drivers/hwmon/lm92.c
drivers/hwmon/lm92.c
+3
-3
drivers/hwmon/max1619.c
drivers/hwmon/max1619.c
+3
-3
drivers/hwmon/pc87360.c
drivers/hwmon/pc87360.c
+4
-3
drivers/hwmon/sis5595.c
drivers/hwmon/sis5595.c
+5
-3
drivers/hwmon/smsc47b397.c
drivers/hwmon/smsc47b397.c
+5
-3
drivers/hwmon/smsc47m1.c
drivers/hwmon/smsc47m1.c
+4
-3
drivers/hwmon/via686a.c
drivers/hwmon/via686a.c
+5
-3
drivers/hwmon/vt8231.c
drivers/hwmon/vt8231.c
+862
-0
drivers/hwmon/w83627ehf.c
drivers/hwmon/w83627ehf.c
+4
-3
drivers/hwmon/w83627hf.c
drivers/hwmon/w83627hf.c
+11
-12
drivers/hwmon/w83781d.c
drivers/hwmon/w83781d.c
+7
-6
drivers/hwmon/w83792d.c
drivers/hwmon/w83792d.c
+22
-61
drivers/hwmon/w83l785ts.c
drivers/hwmon/w83l785ts.c
+3
-3
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-i801.c
+1
-5
drivers/i2c/busses/i2c-ibm_iic.c
drivers/i2c/busses/i2c-ibm_iic.c
+1
-0
drivers/i2c/busses/i2c-isa.c
drivers/i2c/busses/i2c-isa.c
+4
-6
drivers/i2c/busses/i2c-mv64xxx.c
drivers/i2c/busses/i2c-mv64xxx.c
+15
-18
drivers/i2c/busses/i2c-nforce2.c
drivers/i2c/busses/i2c-nforce2.c
+2
-0
drivers/i2c/busses/i2c-parport.h
drivers/i2c/busses/i2c-parport.h
+11
-1
drivers/i2c/chips/ds1337.c
drivers/i2c/chips/ds1337.c
+34
-9
drivers/i2c/chips/ds1374.c
drivers/i2c/chips/ds1374.c
+3
-3
drivers/i2c/chips/eeprom.c
drivers/i2c/chips/eeprom.c
+3
-3
drivers/i2c/chips/isp1301_omap.c
drivers/i2c/chips/isp1301_omap.c
+3
-3
drivers/i2c/chips/m41t00.c
drivers/i2c/chips/m41t00.c
+3
-3
drivers/i2c/chips/max6875.c
drivers/i2c/chips/max6875.c
+3
-3
drivers/i2c/chips/pca9539.c
drivers/i2c/chips/pca9539.c
+3
-3
drivers/i2c/chips/pcf8574.c
drivers/i2c/chips/pcf8574.c
+3
-3
drivers/i2c/chips/pcf8591.c
drivers/i2c/chips/pcf8591.c
+3
-3
drivers/i2c/chips/rtc8564.c
drivers/i2c/chips/rtc8564.c
+20
-23
drivers/i2c/chips/tps65010.c
drivers/i2c/chips/tps65010.c
+3
-3
drivers/i2c/chips/x1205.c
drivers/i2c/chips/x1205.c
+3
-3
drivers/i2c/i2c-core.c
drivers/i2c/i2c-core.c
+24
-46
drivers/i2c/i2c-dev.c
drivers/i2c/i2c-dev.c
+23
-40
drivers/macintosh/therm_adt746x.c
drivers/macintosh/therm_adt746x.c
+3
-3
drivers/macintosh/therm_pm72.c
drivers/macintosh/therm_pm72.c
+3
-3
drivers/macintosh/therm_windtunnel.c
drivers/macintosh/therm_windtunnel.c
+3
-3
drivers/macintosh/windfarm_lm75_sensor.c
drivers/macintosh/windfarm_lm75_sensor.c
+3
-3
drivers/media/video/adv7170.c
drivers/media/video/adv7170.c
+3
-4
drivers/media/video/adv7175.c
drivers/media/video/adv7175.c
+3
-4
drivers/media/video/bt819.c
drivers/media/video/bt819.c
+3
-4
drivers/media/video/bt832.c
drivers/media/video/bt832.c
+3
-4
drivers/media/video/bt856.c
drivers/media/video/bt856.c
+3
-4
drivers/media/video/bttv-i2c.c
drivers/media/video/bttv-i2c.c
+1
-1
drivers/media/video/cs53l32a.c
drivers/media/video/cs53l32a.c
+7
-7
drivers/media/video/cx25840/cx25840-core.c
drivers/media/video/cx25840/cx25840-core.c
+3
-4
drivers/media/video/cx25840/cx25840.h
drivers/media/video/cx25840/cx25840.h
+4
-3
drivers/media/video/cx88/cx88-i2c.c
drivers/media/video/cx88/cx88-i2c.c
+1
-1
drivers/media/video/em28xx/em28xx-i2c.c
drivers/media/video/em28xx/em28xx-i2c.c
+0
-1
drivers/media/video/indycam.c
drivers/media/video/indycam.c
+3
-3
drivers/media/video/ir-kbd-i2c.c
drivers/media/video/ir-kbd-i2c.c
+3
-2
drivers/media/video/msp3400.c
drivers/media/video/msp3400.c
+10
-10
drivers/media/video/ovcamchip/ovcamchip_core.c
drivers/media/video/ovcamchip/ovcamchip_core.c
+3
-3
drivers/media/video/saa5246a.c
drivers/media/video/saa5246a.c
+3
-10
drivers/media/video/saa5249.c
drivers/media/video/saa5249.c
+3
-10
drivers/media/video/saa6588.c
drivers/media/video/saa6588.c
+3
-4
drivers/media/video/saa7110.c
drivers/media/video/saa7110.c
+3
-4
drivers/media/video/saa7111.c
drivers/media/video/saa7111.c
+3
-4
drivers/media/video/saa7114.c
drivers/media/video/saa7114.c
+3
-4
drivers/media/video/saa7115.c
drivers/media/video/saa7115.c
+7
-7
drivers/media/video/saa711x.c
drivers/media/video/saa711x.c
+3
-4
drivers/media/video/saa7127.c
drivers/media/video/saa7127.c
+9
-8
drivers/media/video/saa7134/saa6752hs.c
drivers/media/video/saa7134/saa6752hs.c
+3
-4
drivers/media/video/saa7134/saa7134-i2c.c
drivers/media/video/saa7134/saa7134-i2c.c
+2
-2
drivers/media/video/saa7185.c
drivers/media/video/saa7185.c
+3
-4
drivers/media/video/saa7191.c
drivers/media/video/saa7191.c
+3
-3
drivers/media/video/tda7432.c
drivers/media/video/tda7432.c
+3
-3
drivers/media/video/tda9840.c
drivers/media/video/tda9840.c
+3
-3
drivers/media/video/tda9875.c
drivers/media/video/tda9875.c
+3
-3
drivers/media/video/tda9887.c
drivers/media/video/tda9887.c
+1
-4
drivers/media/video/tea6415c.c
drivers/media/video/tea6415c.c
+3
-3
drivers/media/video/tea6420.c
drivers/media/video/tea6420.c
+3
-3
drivers/media/video/tuner-3036.c
drivers/media/video/tuner-3036.c
+3
-3
drivers/media/video/tuner-core.c
drivers/media/video/tuner-core.c
+2
-5
drivers/media/video/tvaudio.c
drivers/media/video/tvaudio.c
+3
-4
drivers/media/video/tveeprom.c
drivers/media/video/tveeprom.c
+3
-4
drivers/media/video/tvmixer.c
drivers/media/video/tvmixer.c
+5
-7
drivers/media/video/tvp5150.c
drivers/media/video/tvp5150.c
+3
-4
drivers/media/video/vpx3220.c
drivers/media/video/vpx3220.c
+3
-4
drivers/media/video/wm8775.c
drivers/media/video/wm8775.c
+5
-6
drivers/media/video/zoran_driver.c
drivers/media/video/zoran_driver.c
+7
-7
drivers/usb/media/w9968cf.c
drivers/usb/media/w9968cf.c
+2
-2
drivers/video/matrox/matroxfb_maven.c
drivers/video/matrox/matroxfb_maven.c
+3
-8
include/linux/hwmon-vid.h
include/linux/hwmon-vid.h
+3
-3
include/linux/i2c-id.h
include/linux/i2c-id.h
+0
-20
include/linux/i2c.h
include/linux/i2c.h
+12
-29
include/linux/pci_ids.h
include/linux/pci_ids.h
+1
-0
include/media/tuner.h
include/media/tuner.h
+4
-3
sound/oss/dmasound/dac3550a.c
sound/oss/dmasound/dac3550a.c
+3
-3
sound/oss/dmasound/tas_common.c
sound/oss/dmasound/tas_common.c
+3
-3
sound/ppc/keywest.c
sound/ppc/keywest.c
+3
-2
未找到文件。
Documentation/feature-removal-schedule.txt
浏览文件 @
0feb9bfc
...
...
@@ -71,15 +71,6 @@ Who: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
---------------------------
What: i2c sysfs name change: in1_ref, vid deprecated in favour of cpu0_vid
When: November 2005
Files: drivers/i2c/chips/adm1025.c, drivers/i2c/chips/adm1026.c
Why: Match the other drivers' name for the same function, duplicate names
will be available until removal of old names.
Who: Grant Coady <gcoady@gmail.com>
---------------------------
What: remove EXPORT_SYMBOL(panic_timeout)
When: April 2006
Files: kernel/panic.c
...
...
Documentation/hwmon/w83627hf
浏览文件 @
0feb9bfc
...
...
@@ -54,13 +54,16 @@ If you really want i2c accesses for these Super I/O chips,
use the w83781d driver. However this is not the preferred method
now that this ISA driver has been developed.
Technically, the w83627thf does not support a VID reading. However, it's
possible or even likely that your mainboard maker has routed these signals
to a specific set of general purpose IO pins (the Asus P4C800-E is one such
board). The w83627thf driver now interprets these as VID. If the VID on
your board doesn't work, first see doc/vid in the lm_sensors package. If
that still doesn't help, email us at lm-sensors@lm-sensors.org.
The w83627_HF_ uses pins 110-106 as VID0-VID4. The w83627_THF_ uses the
same pins as GPIO[0:4]. Technically, the w83627_THF_ does not support a
VID reading. However the two chips have the identical 128 pin package. So,
it is possible or even likely for a w83627thf to have the VID signals routed
to these pins despite their not being labeled for that purpose. Therefore,
the w83627thf driver interprets these as VID. If the VID on your board
doesn't work, first see doc/vid in the lm_sensors package[1]. If that still
doesn't help, you may just ignore the bogus VID reading with no harm done.
For further information on this driver see the w83781d driver
documentation.
For further information on this driver see the w83781d driver documentation.
[1] http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/lm_sensors2/doc/vid
Documentation/i2c/busses/i2c-nforce2
浏览文件 @
0feb9bfc
...
...
@@ -5,7 +5,8 @@ Supported adapters:
* nForce2 Ultra 400 MCP 10de:0084
* nForce3 Pro150 MCP 10de:00D4
* nForce3 250Gb MCP 10de:00E4
* nForce4 MCP 10de:0052
* nForce4 MCP 10de:0052
* nForce4 MCP-04 10de:0034
Datasheet: not publically available, but seems to be similar to the
AMD-8111 SMBus 2.0 adapter.
...
...
Documentation/i2c/busses/i2c-parport
浏览文件 @
0feb9bfc
...
...
@@ -17,6 +17,7 @@ It currently supports the following devices:
* Velleman K8000 adapter
* ELV adapter
* Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032)
* Barco LPT->DVI (K5800236) adapter
These devices use different pinout configurations, so you have to tell
the driver what you have, using the type module parameter. There is no
...
...
Documentation/i2c/porting-clients
浏览文件 @
0feb9bfc
Revision
5, 2005-07-29
Revision
6, 2005-11-20
Jean Delvare <khali@linux-fr.org>
Greg KH <greg@kroah.com>
This is a guide on how to convert I2C chip drivers from Linux 2.4 to
Linux 2.6. I have been using existing drivers (lm75, lm78) as examples.
Then I converted a driver myself (lm83) and updated this document.
Note that this guide is strongly oriented towards hardware monitoring
drivers. Many points are still valid for other type of drivers, but
others may be irrelevant.
There are two sets of points below. The first set concerns technical
changes. The second set concerns coding policy. Both are mandatory.
...
...
@@ -22,16 +25,20 @@ Technical changes:
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/i2c-isa.h> /* for ISA drivers */
#include <linux/hwmon.h> /* for hardware monitoring drivers */
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon-vid.h> /* if you need VRM support */
#include <linux/err.h> /* for class registration */
#include <asm/io.h> /* if you have I/O operations */
Please respect this inclusion order. Some extra headers may be
required for a given driver (e.g. "lm75.h").
* [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses
are no more handled by the i2c core.
are no more handled by the i2c core. Address ranges are no more
supported either, define each individual address separately.
SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>.
* [Client data] Get rid of sysctl_id. Try using standard names for
...
...
@@ -48,23 +55,23 @@ Technical changes:
int kind);
static void lm75_init_client(struct i2c_client *client);
static int lm75_detach_client(struct i2c_client *client);
static
void lm75_update_client(struct i2c_client *client
);
static
struct lm75_data lm75_update_device(struct device *dev
);
* [Sysctl] All sysctl stuff is of course gone (defines, ctl_table
and functions). Instead, you have to define show and set functions for
each sysfs file. Only define set for writable values. Take a look at an
existing 2.6 driver for details (
lm78
for example). Don't forget
existing 2.6 driver for details (
it87
for example). Don't forget
to define the attributes for each file (this is that step that
links callback functions). Use the file names specified in
Documentation/
i2c
/sysfs-interface for the individual files. Also
Documentation/
hwmon
/sysfs-interface for the individual files. Also
convert the units these files read and write to the specified ones.
If you need to add a new type of file, please discuss it on the
sensors mailing list <lm-sensors@lm-sensors.org> by providing a
patch to the Documentation/
i2c
/sysfs-interface file.
patch to the Documentation/
hwmon
/sysfs-interface file.
* [Attach] For I2C drivers, the attach function should make sure
that the adapter's class has I2C_CLASS_HWMON
, using the
following construct:
that the adapter's class has I2C_CLASS_HWMON
(or whatever class is
suitable for your driver), using the
following construct:
if (!(adapter->class & I2C_CLASS_HWMON))
return 0;
ISA-only drivers of course don't need this.
...
...
@@ -72,63 +79,72 @@ Technical changes:
* [Detect] As mentioned earlier, the flags parameter is gone.
The type_name and client_name strings are replaced by a single
name string, which will be filled with a lowercase, short string
(typically the driver name, e.g. "lm75").
name string, which will be filled with a lowercase, short string.
In i2c-only drivers, drop the i2c_is_isa_adapter check, it's
useless. Same for isa-only drivers, as the test would always be
true. Only hybrid drivers (which are quite rare) still need it.
The errorN labels are reduced to the number needed. If that number
is 2 (i2c-only drivers), it is advised that the labels are named
exit and exit_free. For i2c+isa drivers, labels should be named
ERROR0, ERROR1 and ERROR2. Don't forget to properly set err before
The labels used for error paths are reduced to the number needed.
It is advised that the labels are given descriptive names such as
exit and exit_free. Don't forget to properly set err before
jumping to error labels. By the way, labels should be left-aligned.
Use kzalloc instead of kmalloc.
Use i2c_set_clientdata to set the client data (as opposed to
a direct access to client->data).
Use strlcpy instead of strcpy to copy the client name.
Use strlcpy instead of strcpy
or snprintf
to copy the client name.
Replace the sysctl directory registration by calls to
device_create_file. Move the driver initialization before any
sysfs file creation.
Register the client with the hwmon class (using hwmon_device_register)
if applicable.
Drop client->id.
Drop any 24RF08 corruption prevention you find, as this is now done
at the i2c-core level, and doing it twice voids it.
Don't add I2C_CLIENT_ALLOW_USE to client->flags, it's the default now.
* [Init] Limits must not be set by the driver (can be done later in
user-space). Chip should not be reset default (although a module
parameter may be used to force i
s
), and initialization should be
parameter may be used to force i
t
), and initialization should be
limited to the strictly necessary steps.
* [Detach] Get rid of data, remove the call to
i2c_deregister_entry. Do not log an error message if
i2c_detach_client fails, as i2c-core will now do it for you.
* [Update] Don't access client->data directly, use
i2c_get_clientdata(client) instead.
* [Interface] Init function should not print anything. Make sure
there is a MODULE_LICENSE() line, at the bottom of the file
(after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this order).
* [Detach] Remove the call to i2c_deregister_entry. Do not log an
error message if i2c_detach_client fails, as i2c-core will now do
it for you.
Unregister from the hwmon class if applicable.
* [Update] The function prototype changed, it is now
passed a device structure, which you have to convert to a client
using to_i2c_client(dev). The update function should return a
pointer to the client data.
Don't access client->data directly, use i2c_get_clientdata(client)
instead.
Use time_after() instead of direct jiffies comparison.
* [Interface] Make sure there is a MODULE_LICENSE() line, at the bottom
of the file (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this
order).
* [Driver] The flags field of the i2c_driver structure is gone.
I2C_DF_NOTIFY is now the default behavior.
The i2c_driver structure has a driver member, which is itself a
structure, those name member should be initialized to a driver name
string. i2c_driver itself has no name member anymore.
Coding policy:
* [Copyright] Use (C), not (c), for copyright.
* [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you
can. Calls to printk
/pr_debug for debugging purposes are replaced
by calls to dev_dbg. Here is an example on how to call it (taken
from lm75_detect):
can. Calls to printk
for debugging purposes are replaced by calls to
dev_dbg where possible, else to pr_debug. Here is an example of how
to call it (taken
from lm75_detect):
dev_dbg(&client->dev, "Starting lm75 update\n");
Replace other printk calls with the dev_info, dev_err or dev_warn
function, as appropriate.
* [Constants] Constants defines (registers, conversions, initial
values) should be aligned. This greatly improves readability.
Same goes for variables declarations. Alignments are achieved by the
means of tabs, not spaces. Remember that tabs are set to 8 in the
Linux kernel code.
* [Structure definition] The name field should be standardized. All
lowercase and as simple as the driver name itself (e.g. "lm75").
* [Constants] Constants defines (registers, conversions) should be
aligned. This greatly improves readability.
Alignments are achieved by the means of tabs, not spaces. Remember
that tabs are set to 8 in the Linux kernel code.
* [Layout] Avoid extra empty lines between comments and what they
comment. Respect the coding style (see Documentation/CodingStyle),
...
...
Documentation/i2c/writing-clients
浏览文件 @
0feb9bfc
...
...
@@ -25,9 +25,9 @@ routines, a client structure specific information like the actual I2C
address.
static struct i2c_driver foo_driver = {
.
owner = THIS_MODULE,
.name = "Foo version 2.3 driver
",
.flags = I2C_DF_NOTIFY
,
.
driver = {
.name = "foo
",
}
,
.attach_adapter = &foo_attach_adapter,
.detach_client = &foo_detach_client,
.command = &foo_command /* may be NULL */
...
...
@@ -36,10 +36,6 @@ static struct i2c_driver foo_driver = {
The name field must match the driver name, including the case. It must not
contain spaces, and may be up to 31 characters long.
Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This
means that your driver will be notified when new adapters are found.
This is almost always what you want.
All other fields are for call-back functions which will be explained
below.
...
...
@@ -496,17 +492,13 @@ Note that some functions are marked by `__init', and some data structures
by `__init_data'. Hose functions and structures can be removed after
kernel booting (or module loading) is completed.
Command function
================
A generic ioctl-like function call back is supported. You will seldom
need this. You may even set it to NULL.
/* No commands defined */
int foo_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
return 0;
}
need this, and its use is deprecated anyway, so newer design should not
use it. Set it to NULL.
Sending and receiving
...
...
MAINTAINERS
浏览文件 @
0feb9bfc
...
...
@@ -2916,6 +2916,12 @@ W: http://linuxtv.org
T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
S: Maintained
VT8231 HARDWARE MONITOR DRIVER
P: Roger Lucas
M: roger@planbit.co.uk
L: lm-sensors@lm-sensors.org
S: Maintained
W1 DALLAS'S 1-WIRE BUS
P: Evgeniy Polyakov
M: johnpol@2ka.mipt.ru
...
...
arch/arm/mach-pxa/akita-ioexp.c
浏览文件 @
0feb9bfc
...
...
@@ -124,17 +124,16 @@ static int max7310_detach_client(struct i2c_client *client)
}
static
struct
i2c_driver
max7310_i2c_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"akita-max7310"
,
.
driver
=
{
.
name
=
"akita-max7310"
,
},
.
id
=
I2C_DRIVERID_AKITAIOEXP
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
max7310_attach_adapter
,
.
detach_client
=
max7310_detach_client
,
};
static
struct
i2c_client
max7310_template
=
{
name:
"akita-max7310"
,
flags:
I2C_CLIENT_ALLOW_USE
,
driver:
&
max7310_i2c_driver
,
};
...
...
drivers/acorn/char/pcf8583.c
浏览文件 @
0feb9bfc
...
...
@@ -257,9 +257,10 @@ pcf8583_command(struct i2c_client *client, unsigned int cmd, void *arg)
}
static
struct
i2c_driver
pcf8583_driver
=
{
.
name
=
"PCF8583"
,
.
driver
=
{
.
name
=
"PCF8583"
,
},
.
id
=
I2C_DRIVERID_PCF8583
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
pcf8583_probe
,
.
detach_client
=
pcf8583_detach
,
.
command
=
pcf8583_command
...
...
drivers/hwmon/Kconfig
浏览文件 @
0feb9bfc
...
...
@@ -350,6 +350,18 @@ config SENSORS_VIA686A
This driver can also be built as a module. If so, the module
will be called via686a.
config SENSORS_VT8231
tristate "VT8231"
depends on HWMON && I2C && PCI && EXPERIMENTAL
select HWMON_VID
select I2C_ISA
help
If you say yes here then you get support for the integrated sensors
in the VIA VT8231 device.
This driver can also be built as a module. If so, the module
will be called vt8231.
config SENSORS_W83781D
tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F"
depends on HWMON && I2C
...
...
drivers/hwmon/Makefile
浏览文件 @
0feb9bfc
...
...
@@ -40,6 +40,7 @@ obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o
obj-$(CONFIG_SENSORS_SMSC47B397)
+=
smsc47b397.o
obj-$(CONFIG_SENSORS_SMSC47M1)
+=
smsc47m1.o
obj-$(CONFIG_SENSORS_VIA686A)
+=
via686a.o
obj-$(CONFIG_SENSORS_VT8231)
+=
vt8231.o
obj-$(CONFIG_SENSORS_W83627EHF)
+=
w83627ehf.o
obj-$(CONFIG_SENSORS_W83L785TS)
+=
w83l785ts.o
...
...
drivers/hwmon/adm1021.c
浏览文件 @
0feb9bfc
...
...
@@ -126,10 +126,10 @@ static int read_only;
/* This is the driver that will be inserted */
static
struct
i2c_driver
adm1021_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"adm1021"
,
.
driver
=
{
.
name
=
"adm1021"
,
},
.
id
=
I2C_DRIVERID_ADM1021
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
adm1021_attach_adapter
,
.
detach_client
=
adm1021_detach_client
,
};
...
...
drivers/hwmon/adm1025.c
浏览文件 @
0feb9bfc
...
...
@@ -118,10 +118,10 @@ static struct adm1025_data *adm1025_update_device(struct device *dev);
*/
static
struct
i2c_driver
adm1025_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"adm1025"
,
.
driver
=
{
.
name
=
"adm1025"
,
},
.
id
=
I2C_DRIVERID_ADM1025
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
adm1025_attach_adapter
,
.
detach_client
=
adm1025_detach_client
,
};
...
...
@@ -287,8 +287,6 @@ static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char
struct
adm1025_data
*
data
=
adm1025_update_device
(
dev
);
return
sprintf
(
buf
,
"%u
\n
"
,
vid_from_reg
(
data
->
vid
,
data
->
vrm
));
}
/* in1_ref is deprecated in favour of cpu0_vid, remove after 2005-11-11 */
static
DEVICE_ATTR
(
in1_ref
,
S_IRUGO
,
show_vid
,
NULL
);
static
DEVICE_ATTR
(
cpu0_vid
,
S_IRUGO
,
show_vid
,
NULL
);
static
ssize_t
show_vrm
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
...
...
@@ -444,8 +442,6 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind)
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp1_max
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp2_max
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_alarms
);
/* in1_ref is deprecated, remove after 2005-11-11 */
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in1_ref
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_cpu0_vid
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_vrm
);
...
...
drivers/hwmon/adm1026.c
浏览文件 @
0feb9bfc
...
...
@@ -308,9 +308,9 @@ static void adm1026_init_client(struct i2c_client *client);
static
struct
i2c_driver
adm1026_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"adm1026"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"adm1026"
,
}
,
.
attach_adapter
=
adm1026_attach_adapter
,
.
detach_client
=
adm1026_detach_client
,
};
...
...
@@ -1227,8 +1227,6 @@ static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, c
struct
adm1026_data
*
data
=
adm1026_update_device
(
dev
);
return
sprintf
(
buf
,
"%d
\n
"
,
vid_from_reg
(
data
->
vid
&
0x3f
,
data
->
vrm
));
}
/* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */
static
DEVICE_ATTR
(
vid
,
S_IRUGO
,
show_vid_reg
,
NULL
);
static
DEVICE_ATTR
(
cpu0_vid
,
S_IRUGO
,
show_vid_reg
,
NULL
);
static
ssize_t
show_vrm_reg
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
...
...
@@ -1673,8 +1671,6 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address,
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp1_crit_enable
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp2_crit_enable
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp3_crit_enable
);
/* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_vid
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_cpu0_vid
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_vrm
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_alarms
);
...
...
drivers/hwmon/adm1031.c
浏览文件 @
0feb9bfc
...
...
@@ -105,9 +105,9 @@ static struct adm1031_data *adm1031_update_device(struct device *dev);
/* This is the driver that will be inserted */
static
struct
i2c_driver
adm1031_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"adm1031"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"adm1031"
,
}
,
.
attach_adapter
=
adm1031_attach_adapter
,
.
detach_client
=
adm1031_detach_client
,
};
...
...
drivers/hwmon/adm9240.c
浏览文件 @
0feb9bfc
...
...
@@ -137,10 +137,10 @@ static struct adm9240_data *adm9240_update_device(struct device *dev);
/* driver data */
static
struct
i2c_driver
adm9240_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"adm9240"
,
.
driver
=
{
.
name
=
"adm9240"
,
},
.
id
=
I2C_DRIVERID_ADM9240
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
adm9240_attach_adapter
,
.
detach_client
=
adm9240_detach_client
,
};
...
...
drivers/hwmon/asb100.c
浏览文件 @
0feb9bfc
...
...
@@ -217,10 +217,10 @@ static struct asb100_data *asb100_update_device(struct device *dev);
static
void
asb100_init_client
(
struct
i2c_client
*
client
);
static
struct
i2c_driver
asb100_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"asb100"
,
.
driver
=
{
.
name
=
"asb100"
,
},
.
id
=
I2C_DRIVERID_ASB100
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
asb100_attach_adapter
,
.
detach_client
=
asb100_detach_client
,
};
...
...
drivers/hwmon/atxp1.c
浏览文件 @
0feb9bfc
...
...
@@ -50,9 +50,9 @@ static struct atxp1_data * atxp1_update_device(struct device *dev);
static
int
atxp1_detect
(
struct
i2c_adapter
*
adapter
,
int
address
,
int
kind
);
static
struct
i2c_driver
atxp1_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"atxp1"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"atxp1"
,
}
,
.
attach_adapter
=
atxp1_attach_adapter
,
.
detach_client
=
atxp1_detach_client
,
};
...
...
drivers/hwmon/ds1621.c
浏览文件 @
0feb9bfc
...
...
@@ -89,10 +89,10 @@ static struct ds1621_data *ds1621_update_client(struct device *dev);
/* This is the driver that will be inserted */
static
struct
i2c_driver
ds1621_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"ds1621"
,
.
driver
=
{
.
name
=
"ds1621"
,
},
.
id
=
I2C_DRIVERID_DS1621
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
ds1621_attach_adapter
,
.
detach_client
=
ds1621_detach_client
,
};
...
...
drivers/hwmon/fscher.c
浏览文件 @
0feb9bfc
...
...
@@ -118,10 +118,10 @@ static int fscher_write_value(struct i2c_client *client, u8 reg, u8 value);
*/
static
struct
i2c_driver
fscher_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"fscher"
,
.
driver
=
{
.
name
=
"fscher"
,
},
.
id
=
I2C_DRIVERID_FSCHER
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
fscher_attach_adapter
,
.
detach_client
=
fscher_detach_client
,
};
...
...
drivers/hwmon/fscpos.c
浏览文件 @
0feb9bfc
...
...
@@ -100,10 +100,10 @@ static void reset_fan_alarm(struct i2c_client *client, int nr);
* Driver data (common to all clients)
*/
static
struct
i2c_driver
fscpos_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"fscpos"
,
.
driver
=
{
.
name
=
"fscpos"
,
},
.
id
=
I2C_DRIVERID_FSCPOS
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
fscpos_attach_adapter
,
.
detach_client
=
fscpos_detach_client
,
};
...
...
drivers/hwmon/gl518sm.c
浏览文件 @
0feb9bfc
...
...
@@ -151,10 +151,10 @@ static struct gl518_data *gl518_update_device(struct device *dev);
/* This is the driver that will be inserted */
static
struct
i2c_driver
gl518_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"gl518sm"
,
.
driver
=
{
.
name
=
"gl518sm"
,
},
.
id
=
I2C_DRIVERID_GL518
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
gl518_attach_adapter
,
.
detach_client
=
gl518_detach_client
,
};
...
...
drivers/hwmon/gl520sm.c
浏览文件 @
0feb9bfc
...
...
@@ -109,10 +109,10 @@ static struct gl520_data *gl520_update_device(struct device *dev);
/* Driver data */
static
struct
i2c_driver
gl520_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"gl520sm"
,
.
driver
=
{
.
name
=
"gl520sm"
,
},
.
id
=
I2C_DRIVERID_GL520
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
gl520_attach_adapter
,
.
detach_client
=
gl520_detach_client
,
};
...
...
drivers/hwmon/hwmon-vid.c
浏览文件 @
0feb9bfc
...
...
@@ -49,20 +49,22 @@
. . . .
11110 = 0.800 V
11111 = 0.000 V (off)
The 17 specification is in fact Intel Mobile Voltage Positioning -
(IMVP-II). You can find more information in the datasheet of Max1718
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2452
*/
/* vrm is the VRM/VRD document version multiplied by 10.
val is the 4-, 5- or 6-bit VID code.
Returned value is in mV to avoid floating point in the kernel. */
int
vid_from_reg
(
int
val
,
int
vrm
)
int
vid_from_reg
(
int
val
,
u8
vrm
)
{
int
vid
;
switch
(
vrm
)
{
case
0
:
return
0
;
case
100
:
/* VRD 10.0 */
if
((
val
&
0x1f
)
==
0x1f
)
return
0
;
...
...
@@ -91,10 +93,16 @@ int vid_from_reg(int val, int vrm)
case
84
:
/* VRM 8.4 */
val
&=
0x0f
;
/* fall through */
default
:
/* VRM 8.2 */
case
82
:
/* VRM 8.2 */
return
(
val
==
0x1f
?
0
:
val
&
0x10
?
5100
-
(
val
)
*
100
:
2050
-
(
val
)
*
50
);
case
17
:
/* Intel IMVP-II */
return
(
val
&
0x10
?
975
-
(
val
&
0xF
)
*
25
:
1750
-
val
*
50
);
default:
/* report 0 for unknown */
printk
(
KERN_INFO
"hwmon-vid: requested unknown VRM version
\n
"
);
return
0
;
}
}
...
...
@@ -108,30 +116,36 @@ struct vrm_model {
u8
vendor
;
u8
eff_family
;
u8
eff_model
;
int
vrm_type
;
u8
eff_stepping
;
u8
vrm_type
;
};
#define ANY 0xFF
#ifdef CONFIG_X86
/* the stepping parameter is highest acceptable stepping for current line */
static
struct
vrm_model
vrm_models
[]
=
{
{
X86_VENDOR_AMD
,
0x6
,
ANY
,
90
},
/* Athlon Duron etc */
{
X86_VENDOR_AMD
,
0xF
,
ANY
,
24
},
/* Athlon 64, Opteron */
{
X86_VENDOR_INTEL
,
0x6
,
0x9
,
85
},
/* 0.13um too */
{
X86_VENDOR_INTEL
,
0x6
,
0xB
,
85
},
/* Tualatin */
{
X86_VENDOR_INTEL
,
0x6
,
ANY
,
82
},
/* any P6 */
{
X86_VENDOR_INTEL
,
0x7
,
ANY
,
0
},
/* Itanium */
{
X86_VENDOR_INTEL
,
0xF
,
0x0
,
90
},
/* P4 */
{
X86_VENDOR_INTEL
,
0xF
,
0x1
,
90
},
/* P4 Willamette */
{
X86_VENDOR_INTEL
,
0xF
,
0x2
,
90
},
/* P4 Northwood */
{
X86_VENDOR_INTEL
,
0xF
,
0x3
,
100
},
/* P4 Prescott */
{
X86_VENDOR_INTEL
,
0xF
,
0x4
,
100
},
/* P4 Prescott */
{
X86_VENDOR_INTEL
,
0x10
,
ANY
,
0
},
/* Itanium 2 */
{
X86_VENDOR_UNKNOWN
,
ANY
,
ANY
,
0
}
/* stop here */
{
X86_VENDOR_AMD
,
0x6
,
ANY
,
ANY
,
90
},
/* Athlon Duron etc */
{
X86_VENDOR_AMD
,
0xF
,
ANY
,
ANY
,
24
},
/* Athlon 64, Opteron and above VRM 24 */
{
X86_VENDOR_INTEL
,
0x6
,
0x9
,
ANY
,
85
},
/* 0.13um too */
{
X86_VENDOR_INTEL
,
0x6
,
0xB
,
ANY
,
85
},
/* Tualatin */
{
X86_VENDOR_INTEL
,
0x6
,
ANY
,
ANY
,
82
},
/* any P6 */
{
X86_VENDOR_INTEL
,
0x7
,
ANY
,
ANY
,
0
},
/* Itanium */
{
X86_VENDOR_INTEL
,
0xF
,
0x0
,
ANY
,
90
},
/* P4 */
{
X86_VENDOR_INTEL
,
0xF
,
0x1
,
ANY
,
90
},
/* P4 Willamette */
{
X86_VENDOR_INTEL
,
0xF
,
0x2
,
ANY
,
90
},
/* P4 Northwood */
{
X86_VENDOR_INTEL
,
0xF
,
ANY
,
ANY
,
100
},
/* Prescott and above assume VRD 10 */
{
X86_VENDOR_INTEL
,
0x10
,
ANY
,
ANY
,
0
},
/* Itanium 2 */
{
X86_VENDOR_CENTAUR
,
0x6
,
0x7
,
ANY
,
85
},
/* Eden ESP/Ezra */
{
X86_VENDOR_CENTAUR
,
0x6
,
0x8
,
0x7
,
85
},
/* Ezra T */
{
X86_VENDOR_CENTAUR
,
0x6
,
0x9
,
0x7
,
85
},
/* Nemiah */
{
X86_VENDOR_CENTAUR
,
0x6
,
0x9
,
ANY
,
17
},
/* C3-M */
{
X86_VENDOR_UNKNOWN
,
ANY
,
ANY
,
ANY
,
0
}
/* stop here */
};
static
int
find_vrm
(
u8
eff_family
,
u8
eff_model
,
u8
vendor
)
static
u8
find_vrm
(
u8
eff_family
,
u8
eff_model
,
u8
eff_stepping
,
u8
vendor
)
{
int
i
=
0
;
...
...
@@ -139,7 +153,8 @@ static int find_vrm(u8 eff_family, u8 eff_model, u8 vendor)
if
(
vrm_models
[
i
].
vendor
==
vendor
)
if
((
vrm_models
[
i
].
eff_family
==
eff_family
)
&&
((
vrm_models
[
i
].
eff_model
==
eff_model
)
||
(
vrm_models
[
i
].
eff_model
==
ANY
)))
(
vrm_models
[
i
].
eff_model
==
ANY
))
&&
(
eff_stepping
<=
vrm_models
[
i
].
eff_stepping
))
return
vrm_models
[
i
].
vrm_type
;
i
++
;
}
...
...
@@ -147,12 +162,11 @@ static int find_vrm(u8 eff_family, u8 eff_model, u8 vendor)
return
0
;
}
int
vid_which_vrm
(
void
)
u8
vid_which_vrm
(
void
)
{
struct
cpuinfo_x86
*
c
=
cpu_data
;
u32
eax
;
u8
eff_family
,
eff_model
;
int
vrm_ret
;
u8
eff_family
,
eff_model
,
eff_stepping
,
vrm_ret
;
if
(
c
->
x86
<
6
)
/* Any CPU with family lower than 6 */
return
0
;
/* doesn't have VID and/or CPUID */
...
...
@@ -160,20 +174,21 @@ int vid_which_vrm(void)
eax
=
cpuid_eax
(
1
);
eff_family
=
((
eax
&
0x00000F00
)
>>
8
);
eff_model
=
((
eax
&
0x000000F0
)
>>
4
);
eff_stepping
=
eax
&
0xF
;
if
(
eff_family
==
0xF
)
{
/* use extended model & family */
eff_family
+=
((
eax
&
0x00F00000
)
>>
20
);
eff_model
+=
((
eax
&
0x000F0000
)
>>
16
)
<<
4
;
}
vrm_ret
=
find_vrm
(
eff_family
,
eff_model
,
c
->
x86_vendor
);
vrm_ret
=
find_vrm
(
eff_family
,
eff_model
,
eff_stepping
,
c
->
x86_vendor
);
if
(
vrm_ret
==
0
)
printk
(
KERN_INFO
"hwmon-vid: Unknown VRM version of your "
"x86 CPU
\n
"
);
return
vrm_ret
;
}
/* and now something completely different for the non-x86 world */
/* and now
for
something completely different for the non-x86 world */
#else
int
vid_which_vrm
(
void
)
u8
vid_which_vrm
(
void
)
{
printk
(
KERN_INFO
"hwmon-vid: Unknown VRM version of your CPU
\n
"
);
return
0
;
...
...
drivers/hwmon/it87.c
浏览文件 @
0feb9bfc
...
...
@@ -213,7 +213,7 @@ struct it87_data {
u8
sensor
;
/* Register value */
u8
fan_div
[
3
];
/* Register encoding, shifted right */
u8
vid
;
/* Register encoding, combined */
int
vrm
;
u8
vrm
;
u32
alarms
;
/* Register encoding, combined */
u8
fan_main_ctrl
;
/* Register value */
u8
manual_pwm_ctl
[
3
];
/* manual PWM value set by user */
...
...
@@ -234,17 +234,18 @@ static void it87_init_client(struct i2c_client *client, struct it87_data *data);
static
struct
i2c_driver
it87_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"it87"
,
.
driver
=
{
.
name
=
"it87"
,
},
.
id
=
I2C_DRIVERID_IT87
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
it87_attach_adapter
,
.
detach_client
=
it87_detach_client
,
};
static
struct
i2c_driver
it87_isa_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"it87-isa"
,
.
driver
=
{
.
name
=
"it87-isa"
,
},
.
attach_adapter
=
it87_isa_attach_adapter
,
.
detach_client
=
it87_detach_client
,
};
...
...
@@ -668,7 +669,7 @@ static ssize_t
show_vrm_reg
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
struct
it87_data
*
data
=
it87_update_device
(
dev
);
return
sprintf
(
buf
,
"%
ld
\n
"
,
(
long
)
data
->
vrm
);
return
sprintf
(
buf
,
"%
u
\n
"
,
data
->
vrm
);
}
static
ssize_t
store_vrm_reg
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
...
...
@@ -761,7 +762,8 @@ static int it87_detect(struct i2c_adapter *adapter, int address, int kind)
/* Reserve the ISA region */
if
(
is_isa
)
if
(
!
request_region
(
address
,
IT87_EXTENT
,
it87_isa_driver
.
name
))
if
(
!
request_region
(
address
,
IT87_EXTENT
,
it87_isa_driver
.
driver
.
name
))
goto
ERROR0
;
/* For now, we presume we have a valid client. We create the
...
...
drivers/hwmon/lm63.c
浏览文件 @
0feb9bfc
...
...
@@ -139,9 +139,9 @@ static void lm63_init_client(struct i2c_client *client);
*/
static
struct
i2c_driver
lm63_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm63"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"lm63"
,
}
,
.
attach_adapter
=
lm63_attach_adapter
,
.
detach_client
=
lm63_detach_client
,
};
...
...
drivers/hwmon/lm75.c
浏览文件 @
0feb9bfc
...
...
@@ -66,10 +66,10 @@ static struct lm75_data *lm75_update_device(struct device *dev);
/* This is the driver that will be inserted */
static
struct
i2c_driver
lm75_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm75"
,
.
driver
=
{
.
name
=
"lm75"
,
},
.
id
=
I2C_DRIVERID_LM75
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
lm75_attach_adapter
,
.
detach_client
=
lm75_detach_client
,
};
...
...
drivers/hwmon/lm77.c
浏览文件 @
0feb9bfc
...
...
@@ -74,9 +74,9 @@ static struct lm77_data *lm77_update_device(struct device *dev);
/* This is the driver that will be inserted */
static
struct
i2c_driver
lm77_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm77"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"lm77"
,
}
,
.
attach_adapter
=
lm77_attach_adapter
,
.
detach_client
=
lm77_detach_client
,
};
...
...
drivers/hwmon/lm78.c
浏览文件 @
0feb9bfc
...
...
@@ -164,17 +164,18 @@ static void lm78_init_client(struct i2c_client *client);
static
struct
i2c_driver
lm78_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm78"
,
.
driver
=
{
.
name
=
"lm78"
,
},
.
id
=
I2C_DRIVERID_LM78
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
lm78_attach_adapter
,
.
detach_client
=
lm78_detach_client
,
};
static
struct
i2c_driver
lm78_isa_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm78-isa"
,
.
driver
=
{
.
name
=
"lm78-isa"
,
},
.
attach_adapter
=
lm78_isa_attach_adapter
,
.
detach_client
=
lm78_detach_client
,
};
...
...
@@ -497,7 +498,7 @@ static int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
/* Reserve the ISA region */
if
(
is_isa
)
if
(
!
request_region
(
address
,
LM78_EXTENT
,
lm78_isa_driver
.
name
))
{
lm78_isa_driver
.
driver
.
name
))
{
err
=
-
EBUSY
;
goto
ERROR0
;
}
...
...
drivers/hwmon/lm80.c
浏览文件 @
0feb9bfc
...
...
@@ -143,10 +143,10 @@ static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value);
*/
static
struct
i2c_driver
lm80_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm80"
,
.
driver
=
{
.
name
=
"lm80"
,
},
.
id
=
I2C_DRIVERID_LM80
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
lm80_attach_adapter
,
.
detach_client
=
lm80_detach_client
,
};
...
...
drivers/hwmon/lm83.c
浏览文件 @
0feb9bfc
...
...
@@ -124,10 +124,10 @@ static struct lm83_data *lm83_update_device(struct device *dev);
*/
static
struct
i2c_driver
lm83_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm83"
,
.
driver
=
{
.
name
=
"lm83"
,
},
.
id
=
I2C_DRIVERID_LM83
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
lm83_attach_adapter
,
.
detach_client
=
lm83_detach_client
,
};
...
...
drivers/hwmon/lm85.c
浏览文件 @
0feb9bfc
...
...
@@ -380,10 +380,10 @@ static void lm85_init_client(struct i2c_client *client);
static
struct
i2c_driver
lm85_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm85"
,
.
driver
=
{
.
name
=
"lm85"
,
},
.
id
=
I2C_DRIVERID_LM85
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
lm85_attach_adapter
,
.
detach_client
=
lm85_detach_client
,
};
...
...
@@ -443,7 +443,17 @@ show_fan_offset(4);
static
ssize_t
show_vid_reg
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
struct
lm85_data
*
data
=
lm85_update_device
(
dev
);
return
sprintf
(
buf
,
"%ld
\n
"
,
(
long
)
vid_from_reg
(
data
->
vid
,
data
->
vrm
));
int
vid
;
if
(
data
->
type
==
adt7463
&&
(
data
->
vid
&
0x80
))
{
/* 6-pin VID (VRM 10) */
vid
=
vid_from_reg
(
data
->
vid
&
0x3f
,
data
->
vrm
);
}
else
{
/* 5-pin VID (VRM 9) */
vid
=
vid_from_reg
(
data
->
vid
&
0x1f
,
data
->
vrm
);
}
return
sprintf
(
buf
,
"%d
\n
"
,
vid
);
}
static
DEVICE_ATTR
(
cpu0_vid
,
S_IRUGO
,
show_vid_reg
,
NULL
);
...
...
@@ -1176,17 +1186,14 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in1_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in2_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in3_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in4_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in0_min
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in1_min
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in2_min
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in3_min
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in4_min
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in0_max
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in1_max
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in2_max
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in3_max
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in4_max
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp1_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp2_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp3_input
);
...
...
@@ -1224,6 +1231,15 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp2_auto_temp_crit
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_temp3_auto_temp_crit
);
/* The ADT7463 has an optional VRM 10 mode where pin 21 is used
as a sixth digital VID input rather than an analog input. */
data
->
vid
=
lm85_read_value
(
new_client
,
LM85_REG_VID
);
if
(
!
(
kind
==
adt7463
&&
(
data
->
vid
&
0x80
)))
{
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in4_input
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in4_min
);
device_create_file
(
&
new_client
->
dev
,
&
dev_attr_in4_max
);
}
return
0
;
/* Error out and cleanup code */
...
...
@@ -1382,11 +1398,18 @@ static struct lm85_data *lm85_update_device(struct device *dev)
irrelevant. So it is left in 4*/
data
->
adc_scale
=
(
data
->
type
==
emc6d102
)
?
16
:
4
;
for
(
i
=
0
;
i
<=
4
;
++
i
)
{
data
->
vid
=
lm85_read_value
(
client
,
LM85_REG_VID
);
for
(
i
=
0
;
i
<=
3
;
++
i
)
{
data
->
in
[
i
]
=
lm85_read_value
(
client
,
LM85_REG_IN
(
i
));
}
if
(
!
(
data
->
type
==
adt7463
&&
(
data
->
vid
&
0x80
)))
{
data
->
in
[
4
]
=
lm85_read_value
(
client
,
LM85_REG_IN
(
4
));
}
for
(
i
=
0
;
i
<=
3
;
++
i
)
{
data
->
fan
[
i
]
=
lm85_read_value
(
client
,
LM85_REG_FAN
(
i
));
...
...
@@ -1450,13 +1473,20 @@ static struct lm85_data *lm85_update_device(struct device *dev)
/* Things that don't change often */
dev_dbg
(
&
client
->
dev
,
"Reading config values
\n
"
);
for
(
i
=
0
;
i
<=
4
;
++
i
)
{
for
(
i
=
0
;
i
<=
3
;
++
i
)
{
data
->
in_min
[
i
]
=
lm85_read_value
(
client
,
LM85_REG_IN_MIN
(
i
));
data
->
in_max
[
i
]
=
lm85_read_value
(
client
,
LM85_REG_IN_MAX
(
i
));
}
if
(
!
(
data
->
type
==
adt7463
&&
(
data
->
vid
&
0x80
)))
{
data
->
in_min
[
4
]
=
lm85_read_value
(
client
,
LM85_REG_IN_MIN
(
4
));
data
->
in_max
[
4
]
=
lm85_read_value
(
client
,
LM85_REG_IN_MAX
(
4
));
}
if
(
data
->
type
==
emc6d100
)
{
for
(
i
=
5
;
i
<=
7
;
++
i
)
{
data
->
in_min
[
i
]
=
...
...
@@ -1478,8 +1508,6 @@ static struct lm85_data *lm85_update_device(struct device *dev)
lm85_read_value
(
client
,
LM85_REG_TEMP_MAX
(
i
));
}
data
->
vid
=
lm85_read_value
(
client
,
LM85_REG_VID
);
for
(
i
=
0
;
i
<=
2
;
++
i
)
{
int
val
;
data
->
autofan
[
i
].
config
=
...
...
drivers/hwmon/lm87.c
浏览文件 @
0feb9bfc
...
...
@@ -161,10 +161,10 @@ static struct lm87_data *lm87_update_device(struct device *dev);
*/
static
struct
i2c_driver
lm87_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm87"
,
.
driver
=
{
.
name
=
"lm87"
,
},
.
id
=
I2C_DRIVERID_LM87
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
lm87_attach_adapter
,
.
detach_client
=
lm87_detach_client
,
};
...
...
drivers/hwmon/lm90.c
浏览文件 @
0feb9bfc
...
...
@@ -186,10 +186,10 @@ static struct lm90_data *lm90_update_device(struct device *dev);
*/
static
struct
i2c_driver
lm90_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm90"
,
.
driver
=
{
.
name
=
"lm90"
,
},
.
id
=
I2C_DRIVERID_LM90
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
lm90_attach_adapter
,
.
detach_client
=
lm90_detach_client
,
};
...
...
drivers/hwmon/lm92.c
浏览文件 @
0feb9bfc
...
...
@@ -410,10 +410,10 @@ static int lm92_detach_client(struct i2c_client *client)
*/
static
struct
i2c_driver
lm92_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"lm92"
,
.
driver
=
{
.
name
=
"lm92"
,
},
.
id
=
I2C_DRIVERID_LM92
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
lm92_attach_adapter
,
.
detach_client
=
lm92_detach_client
,
};
...
...
drivers/hwmon/max1619.c
浏览文件 @
0feb9bfc
...
...
@@ -90,9 +90,9 @@ static struct max1619_data *max1619_update_device(struct device *dev);
*/
static
struct
i2c_driver
max1619_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"max1619"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"max1619"
,
}
,
.
attach_adapter
=
max1619_attach_adapter
,
.
detach_client
=
max1619_detach_client
,
};
...
...
drivers/hwmon/pc87360.c
浏览文件 @
0feb9bfc
...
...
@@ -236,8 +236,9 @@ static struct pc87360_data *pc87360_update_device(struct device *dev);
*/
static
struct
i2c_driver
pc87360_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"pc87360"
,
.
driver
=
{
.
name
=
"pc87360"
,
},
.
attach_adapter
=
pc87360_detect
,
.
detach_client
=
pc87360_detach_client
,
};
...
...
@@ -798,7 +799,7 @@ static int pc87360_detect(struct i2c_adapter *adapter)
for
(
i
=
0
;
i
<
3
;
i
++
)
{
if
(((
data
->
address
[
i
]
=
extra_isa
[
i
]))
&&
!
request_region
(
extra_isa
[
i
],
PC87360_EXTENT
,
pc87360_driver
.
name
))
{
pc87360_driver
.
driver
.
name
))
{
dev_err
(
&
new_client
->
dev
,
"Region 0x%x-0x%x already "
"in use!
\n
"
,
extra_isa
[
i
],
extra_isa
[
i
]
+
PC87360_EXTENT
-
1
);
...
...
drivers/hwmon/sis5595.c
浏览文件 @
0feb9bfc
...
...
@@ -198,8 +198,9 @@ static struct sis5595_data *sis5595_update_device(struct device *dev);
static
void
sis5595_init_client
(
struct
i2c_client
*
client
);
static
struct
i2c_driver
sis5595_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"sis5595"
,
.
driver
=
{
.
name
=
"sis5595"
,
},
.
attach_adapter
=
sis5595_detect
,
.
detach_client
=
sis5595_detach_client
,
};
...
...
@@ -484,7 +485,8 @@ static int sis5595_detect(struct i2c_adapter *adapter)
if
(
force_addr
)
address
=
force_addr
&
~
(
SIS5595_EXTENT
-
1
);
/* Reserve the ISA region */
if
(
!
request_region
(
address
,
SIS5595_EXTENT
,
sis5595_driver
.
name
))
{
if
(
!
request_region
(
address
,
SIS5595_EXTENT
,
sis5595_driver
.
driver
.
name
))
{
err
=
-
EBUSY
;
goto
exit
;
}
...
...
drivers/hwmon/smsc47b397.c
浏览文件 @
0feb9bfc
...
...
@@ -226,8 +226,9 @@ static int smsc47b397_detach_client(struct i2c_client *client)
static
int
smsc47b397_detect
(
struct
i2c_adapter
*
adapter
);
static
struct
i2c_driver
smsc47b397_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"smsc47b397"
,
.
driver
=
{
.
name
=
"smsc47b397"
,
},
.
attach_adapter
=
smsc47b397_detect
,
.
detach_client
=
smsc47b397_detach_client
,
};
...
...
@@ -238,7 +239,8 @@ static int smsc47b397_detect(struct i2c_adapter *adapter)
struct
smsc47b397_data
*
data
;
int
err
=
0
;
if
(
!
request_region
(
address
,
SMSC_EXTENT
,
smsc47b397_driver
.
name
))
{
if
(
!
request_region
(
address
,
SMSC_EXTENT
,
smsc47b397_driver
.
driver
.
name
))
{
dev_err
(
&
adapter
->
dev
,
"Region 0x%x already in use!
\n
"
,
address
);
return
-
EBUSY
;
...
...
drivers/hwmon/smsc47m1.c
浏览文件 @
0feb9bfc
...
...
@@ -126,8 +126,9 @@ static struct smsc47m1_data *smsc47m1_update_device(struct device *dev,
static
struct
i2c_driver
smsc47m1_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"smsc47m1"
,
.
driver
=
{
.
name
=
"smsc47m1"
,
},
.
attach_adapter
=
smsc47m1_detect
,
.
detach_client
=
smsc47m1_detach_client
,
};
...
...
@@ -394,7 +395,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter)
int
err
=
0
;
int
fan1
,
fan2
,
pwm1
,
pwm2
;
if
(
!
request_region
(
address
,
SMSC_EXTENT
,
smsc47m1_driver
.
name
))
{
if
(
!
request_region
(
address
,
SMSC_EXTENT
,
smsc47m1_driver
.
driver
.
name
))
{
dev_err
(
&
adapter
->
dev
,
"Region 0x%x already in use!
\n
"
,
address
);
return
-
EBUSY
;
}
...
...
drivers/hwmon/via686a.c
浏览文件 @
0feb9bfc
...
...
@@ -572,8 +572,9 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
/* The driver. I choose to use type i2c_driver, as at is identical to both
smbus_driver and isa_driver, and clients could be of either kind */
static
struct
i2c_driver
via686a_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"via686a"
,
.
driver
=
{
.
name
=
"via686a"
,
},
.
attach_adapter
=
via686a_detect
,
.
detach_client
=
via686a_detach_client
,
};
...
...
@@ -615,7 +616,8 @@ static int via686a_detect(struct i2c_adapter *adapter)
}
/* Reserve the ISA region */
if
(
!
request_region
(
address
,
VIA686A_EXTENT
,
via686a_driver
.
name
))
{
if
(
!
request_region
(
address
,
VIA686A_EXTENT
,
via686a_driver
.
driver
.
name
))
{
dev_err
(
&
adapter
->
dev
,
"region 0x%x already in use!
\n
"
,
address
);
return
-
ENODEV
;
...
...
drivers/hwmon/vt8231.c
0 → 100644
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/hwmon/w83627ehf.c
浏览文件 @
0feb9bfc
...
...
@@ -676,7 +676,7 @@ static int w83627ehf_detect(struct i2c_adapter *adapter)
int
i
,
err
=
0
;
if
(
!
request_region
(
address
+
REGION_OFFSET
,
REGION_LENGTH
,
w83627ehf_driver
.
name
))
{
w83627ehf_driver
.
driver
.
name
))
{
err
=
-
EBUSY
;
goto
exit
;
}
...
...
@@ -785,8 +785,9 @@ static int w83627ehf_detach_client(struct i2c_client *client)
}
static
struct
i2c_driver
w83627ehf_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"w83627ehf"
,
.
driver
=
{
.
name
=
"w83627ehf"
,
},
.
attach_adapter
=
w83627ehf_detect
,
.
detach_client
=
w83627ehf_detach_client
,
};
...
...
drivers/hwmon/w83627hf.c
浏览文件 @
0feb9bfc
...
...
@@ -332,8 +332,9 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev);
static
void
w83627hf_init_client
(
struct
i2c_client
*
client
);
static
struct
i2c_driver
w83627hf_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"w83627hf"
,
.
driver
=
{
.
name
=
"w83627hf"
,
},
.
attach_adapter
=
w83627hf_detect
,
.
detach_client
=
w83627hf_detach_client
,
};
...
...
@@ -1009,7 +1010,7 @@ static int w83627hf_detect(struct i2c_adapter *adapter)
address
=
force_addr
&
WINB_ALIGNMENT
;
if
(
!
request_region
(
address
+
WINB_REGION_OFFSET
,
WINB_REGION_SIZE
,
w83627hf_driver
.
name
))
{
w83627hf_driver
.
driver
.
name
))
{
err
=
-
EBUSY
;
goto
ERROR0
;
}
...
...
@@ -1122,11 +1123,10 @@ static int w83627hf_detect(struct i2c_adapter *adapter)
if
(
kind
!=
w83697hf
)
device_create_file_temp
(
new_client
,
3
);
if
(
kind
!=
w83697hf
)
if
(
kind
!=
w83697hf
&&
data
->
vid
!=
0xff
)
{
device_create_file_vid
(
new_client
);
if
(
kind
!=
w83697hf
)
device_create_file_vrm
(
new_client
);
}
device_create_file_fan_div
(
new_client
,
1
);
device_create_file_fan_div
(
new_client
,
2
);
...
...
@@ -1232,7 +1232,7 @@ static int w83627thf_read_gpio5(struct i2c_client *client)
/* Make sure the pins are configured for input
There must be at least five (VRM 9), and possibly 6 (VRM 10) */
sel
=
superio_inb
(
W83627THF_GPIO5_IOSR
);
sel
=
superio_inb
(
W83627THF_GPIO5_IOSR
)
&
0x3f
;
if
((
sel
&
0x1f
)
!=
0x1f
)
{
dev_dbg
(
&
client
->
dev
,
"GPIO5 not configured for VID "
"function
\n
"
);
...
...
@@ -1323,19 +1323,18 @@ static void w83627hf_init_client(struct i2c_client *client)
int
hi
=
w83627hf_read_value
(
client
,
W83781D_REG_CHIPID
);
data
->
vid
=
(
lo
&
0x0f
)
|
((
hi
&
0x01
)
<<
4
);
}
else
if
(
w83627thf
==
data
->
type
)
{
data
->
vid
=
w83627thf_read_gpio5
(
client
)
&
0x3f
;
data
->
vid
=
w83627thf_read_gpio5
(
client
);
}
/* Read VRM & OVT Config only once */
if
(
w83627thf
==
data
->
type
||
w83637hf
==
data
->
type
)
{
data
->
vrm_ovt
=
w83627hf_read_value
(
client
,
W83627THF_REG_VRM_OVT_CFG
);
data
->
vrm
=
(
data
->
vrm_ovt
&
0x01
)
?
90
:
82
;
}
else
{
/* Convert VID to voltage based on default VRM */
data
->
vrm
=
vid_which_vrm
();
}
/* Convert VID to voltage based on VRM */
data
->
vrm
=
vid_which_vrm
();
tmp
=
w83627hf_read_value
(
client
,
W83781D_REG_SCFG1
);
for
(
i
=
1
;
i
<=
3
;
i
++
)
{
if
(
!
(
tmp
&
BIT_SCFG1
[
i
-
1
]))
{
...
...
drivers/hwmon/w83781d.c
浏览文件 @
0feb9bfc
...
...
@@ -269,17 +269,18 @@ static struct w83781d_data *w83781d_update_device(struct device *dev);
static
void
w83781d_init_client
(
struct
i2c_client
*
client
);
static
struct
i2c_driver
w83781d_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"w83781d"
,
.
driver
=
{
.
name
=
"w83781d"
,
},
.
id
=
I2C_DRIVERID_W83781D
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
w83781d_attach_adapter
,
.
detach_client
=
w83781d_detach_client
,
};
static
struct
i2c_driver
w83781d_isa_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"w83781d-isa"
,
.
driver
=
{
.
name
=
"w83781d-isa"
,
},
.
attach_adapter
=
w83781d_isa_attach_adapter
,
.
detach_client
=
w83781d_detach_client
,
};
...
...
@@ -1012,7 +1013,7 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
if
(
is_isa
)
if
(
!
request_region
(
address
,
W83781D_EXTENT
,
w83781d_isa_driver
.
name
))
{
w83781d_isa_driver
.
driver
.
name
))
{
dev_dbg
(
&
adapter
->
dev
,
"Request of region "
"0x%x-0x%x for w83781d failed
\n
"
,
address
,
address
+
W83781D_EXTENT
-
1
);
...
...
drivers/hwmon/w83792d.c
浏览文件 @
0feb9bfc
...
...
@@ -269,7 +269,6 @@ DIV_TO_REG(long val)
struct
w83792d_data
{
struct
i2c_client
client
;
struct
class_device
*
class_dev
;
struct
semaphore
lock
;
enum
chips
type
;
struct
semaphore
update_lock
;
...
...
@@ -282,7 +281,7 @@ struct w83792d_data {
u8
in
[
9
];
/* Register value */
u8
in_max
[
9
];
/* Register value */
u8
in_min
[
9
];
/* Register value */
u
8
low_bits
[
2
];
/* Additional resolution to voltage in0-6
*/
u
16
low_bits
;
/* Additional resolution to voltage in6-0
*/
u8
fan
[
7
];
/* Register value */
u8
fan_min
[
7
];
/* Register value */
u8
temp1
[
3
];
/* current, over, thyst */
...
...
@@ -317,45 +316,17 @@ static void w83792d_print_debug(struct w83792d_data *data, struct device *dev);
static
void
w83792d_init_client
(
struct
i2c_client
*
client
);
static
struct
i2c_driver
w83792d_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"w83792d"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"w83792d"
,
}
,
.
attach_adapter
=
w83792d_attach_adapter
,
.
detach_client
=
w83792d_detach_client
,
};
static
long
in_count_from_reg
(
int
nr
,
struct
w83792d_data
*
data
)
static
inline
long
in_count_from_reg
(
int
nr
,
struct
w83792d_data
*
data
)
{
u16
vol_count
=
data
->
in
[
nr
];
u16
low_bits
=
0
;
vol_count
=
(
vol_count
<<
2
);
switch
(
nr
)
{
case
0
:
/* vin0 */
low_bits
=
(
data
->
low_bits
[
0
])
&
0x03
;
break
;
case
1
:
/* vin1 */
low_bits
=
((
data
->
low_bits
[
0
])
&
0x0c
)
>>
2
;
break
;
case
2
:
/* vin2 */
low_bits
=
((
data
->
low_bits
[
0
])
&
0x30
)
>>
4
;
break
;
case
3
:
/* vin3 */
low_bits
=
((
data
->
low_bits
[
0
])
&
0xc0
)
>>
6
;
break
;
case
4
:
/* vin4 */
low_bits
=
(
data
->
low_bits
[
1
])
&
0x03
;
break
;
case
5
:
/* vin5 */
low_bits
=
((
data
->
low_bits
[
1
])
&
0x0c
)
>>
2
;
break
;
case
6
:
/* vin6 */
low_bits
=
((
data
->
low_bits
[
1
])
&
0x30
)
>>
4
;
default:
break
;
}
vol_count
=
vol_count
|
low_bits
;
return
vol_count
;
/* in7 and in8 do not have low bits, but the formula still works */
return
((
data
->
in
[
nr
]
<<
2
)
|
((
data
->
low_bits
>>
(
2
*
nr
))
&
0x03
));
}
/* following are the sysfs callback functions */
...
...
@@ -1192,7 +1163,6 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
new_client
=
&
data
->
client
;
i2c_set_clientdata
(
new_client
,
data
);
new_client
->
addr
=
address
;
init_MUTEX
(
&
data
->
lock
);
new_client
->
adapter
=
adapter
;
new_client
->
driver
=
&
w83792d_driver
;
new_client
->
flags
=
0
;
...
...
@@ -1243,7 +1213,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
goto
ERROR1
;
}
val1
=
w83792d_read_value
(
new_client
,
W83792D_REG_WCHIPID
);
if
(
val1
==
0x7a
&&
address
>=
0x2c
)
{
if
(
val1
==
0x7a
)
{
kind
=
w83792d
;
}
else
{
if
(
kind
==
0
)
...
...
@@ -1416,26 +1386,17 @@ w83792d_detach_client(struct i2c_client *client)
return
0
;
}
/* The SMBus locks itself, usually, but nothing may access the Winbond between
bank switches. ISA access must always be locked explicitly!
We ignore the W83792D BUSY flag at this moment - it could lead to deadlocks,
would slow down the W83792D access and should not be necessary.
There are some ugly typecasts here, but the good news is - they should
nowhere else be necessary! */
static
int
w83792d_read_value
(
struct
i2c_client
*
client
,
u8
reg
)
/* The SMBus locks itself. The Winbond W83792D chip has a bank register,
but the driver only accesses registers in bank 0, so we don't have
to switch banks and lock access between switches. */
static
int
w83792d_read_value
(
struct
i2c_client
*
client
,
u8
reg
)
{
int
res
=
0
;
res
=
i2c_smbus_read_byte_data
(
client
,
reg
);
return
res
;
return
i2c_smbus_read_byte_data
(
client
,
reg
);
}
static
int
w83792d_write_value
(
struct
i2c_client
*
client
,
u8
reg
,
u8
value
)
static
int
w83792d_write_value
(
struct
i2c_client
*
client
,
u8
reg
,
u8
value
)
{
i2c_smbus_write_byte_data
(
client
,
reg
,
value
);
return
0
;
return
i2c_smbus_write_byte_data
(
client
,
reg
,
value
);
}
static
void
...
...
@@ -1492,10 +1453,10 @@ static struct w83792d_data *w83792d_update_device(struct device *dev)
data
->
in_min
[
i
]
=
w83792d_read_value
(
client
,
W83792D_REG_IN_MIN
[
i
]);
}
data
->
low_bits
[
0
]
=
w83792d_read_value
(
client
,
W83792D_REG_LOW_BITS1
)
;
data
->
low_bits
[
1
]
=
w83792d_read_value
(
client
,
W83792D_REG_LOW_BITS2
);
data
->
low_bits
=
w83792d_read_value
(
client
,
W83792D_REG_LOW_BITS1
)
+
(
w83792d_read_value
(
client
,
W83792D_REG_LOW_BITS2
)
<<
8
)
;
for
(
i
=
0
;
i
<
7
;
i
++
)
{
/* Update the Fan measured value and limits */
data
->
fan
[
i
]
=
w83792d_read_value
(
client
,
...
...
@@ -1506,7 +1467,7 @@ static struct w83792d_data *w83792d_update_device(struct device *dev)
pwm_array_tmp
[
i
]
=
w83792d_read_value
(
client
,
W83792D_REG_PWM
[
i
]);
data
->
pwm
[
i
]
=
pwm_array_tmp
[
i
]
&
0x0f
;
data
->
pwm_mode
[
i
]
=
(
pwm_array_tmp
[
i
]
>>
7
)
&
0x01
;
data
->
pwm_mode
[
i
]
=
pwm_array_tmp
[
i
]
>>
7
;
}
reg_tmp
=
w83792d_read_value
(
client
,
W83792D_REG_FAN_CFG
);
...
...
@@ -1607,8 +1568,8 @@ static void w83792d_print_debug(struct w83792d_data *data, struct device *dev)
dev_dbg
(
dev
,
"vin[%d] max is: 0x%x
\n
"
,
i
,
data
->
in_max
[
i
]);
dev_dbg
(
dev
,
"vin[%d] min is: 0x%x
\n
"
,
i
,
data
->
in_min
[
i
]);
}
dev_dbg
(
dev
,
"Low Bit1 is: 0x%x
\n
"
,
data
->
low_bits
[
0
]
);
dev_dbg
(
dev
,
"Low Bit2 is: 0x%x
\n
"
,
data
->
low_bits
[
1
]
);
dev_dbg
(
dev
,
"Low Bit1 is: 0x%x
\n
"
,
data
->
low_bits
&
0xff
);
dev_dbg
(
dev
,
"Low Bit2 is: 0x%x
\n
"
,
data
->
low_bits
>>
8
);
dev_dbg
(
dev
,
"7 set of Fan Counts and Duty Cycles: =====>
\n
"
);
for
(
i
=
0
;
i
<
7
;
i
++
)
{
dev_dbg
(
dev
,
"fan[%d] is: 0x%x
\n
"
,
i
,
data
->
fan
[
i
]);
...
...
drivers/hwmon/w83l785ts.c
浏览文件 @
0feb9bfc
...
...
@@ -92,10 +92,10 @@ static struct w83l785ts_data *w83l785ts_update_device(struct device *dev);
*/
static
struct
i2c_driver
w83l785ts_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"w83l785ts"
,
.
driver
=
{
.
name
=
"w83l785ts"
,
},
.
id
=
I2C_DRIVERID_W83L785TS
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
w83l785ts_attach_adapter
,
.
detach_client
=
w83l785ts_detach_client
,
};
...
...
drivers/i2c/busses/i2c-i801.c
浏览文件 @
0feb9bfc
...
...
@@ -468,8 +468,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
return
-
1
;
}
if
(
hwpec
)
outb_p
(
1
,
SMBAUXCTL
);
/* enable hardware PEC */
outb_p
(
hwpec
,
SMBAUXCTL
);
/* enable/disable hardware PEC */
if
(
block
)
ret
=
i801_block_transaction
(
data
,
read_write
,
size
,
hwpec
);
...
...
@@ -478,9 +477,6 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
ret
=
i801_transaction
();
}
if
(
hwpec
)
outb_p
(
0
,
SMBAUXCTL
);
/* disable hardware PEC */
if
(
block
)
return
ret
;
if
(
ret
)
...
...
drivers/i2c/busses/i2c-ibm_iic.c
浏览文件 @
0feb9bfc
...
...
@@ -725,6 +725,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
strcpy
(
adap
->
name
,
"IBM IIC"
);
i2c_set_adapdata
(
adap
,
dev
);
adap
->
id
=
I2C_HW_OCP
;
adap
->
class
=
I2C_CLASS_HWMON
;
adap
->
algo
=
&
iic_algo
;
adap
->
client_register
=
NULL
;
adap
->
client_unregister
=
NULL
;
...
...
drivers/i2c/busses/i2c-isa.c
浏览文件 @
0feb9bfc
...
...
@@ -92,15 +92,13 @@ int i2c_isa_add_driver(struct i2c_driver *driver)
int
res
;
/* Add the driver to the list of i2c drivers in the driver core */
driver
->
driver
.
name
=
driver
->
name
;
driver
->
driver
.
owner
=
driver
->
owner
;
driver
->
driver
.
bus
=
&
i2c_bus_type
;
driver
->
driver
.
probe
=
i2c_isa_device_probe
;
driver
->
driver
.
remove
=
i2c_isa_device_remove
;
res
=
driver_register
(
&
driver
->
driver
);
if
(
res
)
return
res
;
dev_dbg
(
&
isa_adapter
.
dev
,
"Driver %s registered
\n
"
,
driver
->
name
);
dev_dbg
(
&
isa_adapter
.
dev
,
"Driver %s registered
\n
"
,
driver
->
driver
.
name
);
/* Now look for clients */
driver
->
attach_adapter
(
&
isa_adapter
);
...
...
@@ -124,14 +122,14 @@ int i2c_isa_del_driver(struct i2c_driver *driver)
if
((
res
=
driver
->
detach_client
(
client
)))
{
dev_err
(
&
isa_adapter
.
dev
,
"Failed, driver "
"%s not unregistered!
\n
"
,
driver
->
name
);
driver
->
driver
.
name
);
return
res
;
}
}
/* Get the driver off the core list */
driver_unregister
(
&
driver
->
driver
);
dev_dbg
(
&
isa_adapter
.
dev
,
"Driver %s unregistered
\n
"
,
driver
->
name
);
dev_dbg
(
&
isa_adapter
.
dev
,
"Driver %s unregistered
\n
"
,
driver
->
driver
.
name
);
return
0
;
}
...
...
@@ -176,7 +174,7 @@ static void __exit i2c_isa_exit(void)
list_for_each_safe
(
item
,
_n
,
&
isa_adapter
.
clients
)
{
client
=
list_entry
(
item
,
struct
i2c_client
,
list
);
dev_err
(
&
isa_adapter
.
dev
,
"Driver %s still has an active "
"ISA client at 0x%x
\n
"
,
client
->
driver
->
name
,
"ISA client at 0x%x
\n
"
,
client
->
driver
->
driver
.
name
,
client
->
addr
);
}
if
(
client
!=
NULL
)
...
...
drivers/i2c/busses/i2c-mv64xxx.c
浏览文件 @
0feb9bfc
/*
* drivers/i2c/busses/i2c-mv64xxx.c
*
* Driver for the i2c controller on the Marvell line of host bridges for MIPS
* and PPC (e.g, gt642[46]0, mv643[46]0, mv644[46]0).
*
...
...
@@ -65,7 +63,6 @@ enum {
MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK
,
MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK
,
MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA
,
MV64XXX_I2C_STATE_ABORTING
,
};
/* Driver actions */
...
...
@@ -85,6 +82,7 @@ struct mv64xxx_i2c_data {
int
irq
;
u32
state
;
u32
action
;
u32
aborting
;
u32
cntl_bits
;
void
__iomem
*
reg_base
;
u32
reg_base_p
;
...
...
@@ -122,12 +120,6 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
return
;
}
if
(
drv_data
->
state
==
MV64XXX_I2C_STATE_ABORTING
)
{
drv_data
->
action
=
MV64XXX_I2C_ACTION_SEND_STOP
;
drv_data
->
state
=
MV64XXX_I2C_STATE_IDLE
;
return
;
}
/* The status from the ctlr [mostly] tells us what to do next */
switch
(
status
)
{
/* Start condition interrupt */
...
...
@@ -148,14 +140,16 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
/* FALLTHRU */
case
MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK
:
/* 0xd0 */
case
MV64XXX_I2C_STATUS_MAST_WR_ACK
:
/* 0x28 */
if
(
drv_data
->
bytes_left
>
0
)
{
if
((
drv_data
->
bytes_left
==
0
)
||
(
drv_data
->
aborting
&&
(
drv_data
->
byte_posn
!=
0
)))
{
drv_data
->
action
=
MV64XXX_I2C_ACTION_SEND_STOP
;
drv_data
->
state
=
MV64XXX_I2C_STATE_IDLE
;
}
else
{
drv_data
->
action
=
MV64XXX_I2C_ACTION_SEND_DATA
;
drv_data
->
state
=
MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK
;
drv_data
->
bytes_left
--
;
}
else
{
drv_data
->
action
=
MV64XXX_I2C_ACTION_SEND_STOP
;
drv_data
->
state
=
MV64XXX_I2C_STATE_IDLE
;
}
break
;
...
...
@@ -184,7 +178,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
}
drv_data
->
state
=
MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA
;
if
(
drv_data
->
bytes_left
==
1
)
if
(
(
drv_data
->
bytes_left
==
1
)
||
drv_data
->
aborting
)
drv_data
->
cntl_bits
&=
~
MV64XXX_I2C_REG_CONTROL_ACK
;
break
;
...
...
@@ -320,6 +314,7 @@ mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data,
drv_data
->
msg
=
msg
;
drv_data
->
byte_posn
=
0
;
drv_data
->
bytes_left
=
msg
->
len
;
drv_data
->
aborting
=
0
;
drv_data
->
rc
=
0
;
drv_data
->
cntl_bits
=
MV64XXX_I2C_REG_CONTROL_ACK
|
MV64XXX_I2C_REG_CONTROL_INTEN
|
MV64XXX_I2C_REG_CONTROL_TWSIEN
;
...
...
@@ -359,17 +354,19 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
}
if
(
abort
&&
drv_data
->
block
)
{
drv_data
->
state
=
MV64XXX_I2C_STATE_ABORTING
;
drv_data
->
aborting
=
1
;
spin_unlock_irqrestore
(
&
drv_data
->
lock
,
flags
);
time_left
=
wait_event_timeout
(
drv_data
->
waitq
,
!
drv_data
->
block
,
msecs_to_jiffies
(
drv_data
->
adapter
.
timeout
));
if
(
time_left
<=
0
)
{
if
(
(
time_left
<=
0
)
&&
drv_data
->
block
)
{
drv_data
->
state
=
MV64XXX_I2C_STATE_IDLE
;
dev_err
(
&
drv_data
->
adapter
.
dev
,
"mv64xxx: I2C bus locked
\n
"
);
"mv64xxx: I2C bus locked, block: %d, "
"time_left: %d
\n
"
,
drv_data
->
block
,
(
int
)
time_left
);
}
}
else
spin_unlock_irqrestore
(
&
drv_data
->
lock
,
flags
);
...
...
@@ -510,7 +507,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
goto
exit_kfree
;
}
str
n
cpy
(
drv_data
->
adapter
.
name
,
MV64XXX_I2C_CTLR_NAME
" adapter"
,
str
l
cpy
(
drv_data
->
adapter
.
name
,
MV64XXX_I2C_CTLR_NAME
" adapter"
,
I2C_NAME_SIZE
);
init_waitqueue_head
(
&
drv_data
->
waitq
);
...
...
drivers/i2c/busses/i2c-nforce2.c
浏览文件 @
0feb9bfc
...
...
@@ -30,6 +30,7 @@
nForce3 Pro150 MCP 00D4
nForce3 250Gb MCP 00E4
nForce4 MCP 0052
nForce4 MCP-04 0034
This driver supports the 2 SMBuses that are included in the MCP of the
nForce2/3/4 chipsets.
...
...
@@ -257,6 +258,7 @@ static struct pci_device_id nforce2_ids[] = {
{
PCI_DEVICE
(
PCI_VENDOR_ID_NVIDIA
,
PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS
)
},
{
PCI_DEVICE
(
PCI_VENDOR_ID_NVIDIA
,
PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS
)
},
{
PCI_DEVICE
(
PCI_VENDOR_ID_NVIDIA
,
PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS
)
},
{
PCI_DEVICE
(
PCI_VENDOR_ID_NVIDIA
,
PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS
)
},
{
0
}
};
...
...
drivers/i2c/busses/i2c-parport.h
浏览文件 @
0feb9bfc
...
...
@@ -80,6 +80,14 @@ static struct adapter_parm adapter_parm[] = {
.
setscl
=
{
0x01
,
DATA
,
1
},
.
getsda
=
{
0x10
,
STAT
,
1
},
},
/* type 6: Barco LPT->DVI (K5800236) adapter */
{
.
setsda
=
{
0x02
,
DATA
,
1
},
.
setscl
=
{
0x01
,
DATA
,
1
},
.
getsda
=
{
0x20
,
STAT
,
0
},
.
getscl
=
{
0x40
,
STAT
,
0
},
.
init
=
{
0xfc
,
DATA
,
0
},
},
};
static
int
type
;
...
...
@@ -91,4 +99,6 @@ MODULE_PARM_DESC(type,
" 2 = Velleman K8000 adapter
\n
"
" 3 = ELV adapter
\n
"
" 4 = ADM1032 evaluation board
\n
"
" 5 = ADM1025, ADM1030 and ADM1031 evaluation boards
\n
"
);
" 5 = ADM1025, ADM1030 and ADM1031 evaluation boards
\n
"
" 6 = Barco LPT->DVI (K5800236) adapter
\n
"
);
drivers/i2c/chips/ds1337.c
浏览文件 @
0feb9bfc
...
...
@@ -52,9 +52,9 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd,
* Driver data (common to all clients)
*/
static
struct
i2c_driver
ds1337_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"ds1337"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"ds1337"
,
}
,
.
attach_adapter
=
ds1337_attach_adapter
,
.
detach_client
=
ds1337_detach_client
,
.
command
=
ds1337_command
,
...
...
@@ -337,13 +337,38 @@ static int ds1337_detect(struct i2c_adapter *adapter, int address, int kind)
static
void
ds1337_init_client
(
struct
i2c_client
*
client
)
{
s32
va
l
;
u8
status
,
contro
l
;
/* Ensure that device is set in 24-hour mode */
val
=
i2c_smbus_read_byte_data
(
client
,
DS1337_REG_HOUR
);
if
((
val
>=
0
)
&&
(
val
&
(
1
<<
6
)))
i2c_smbus_write_byte_data
(
client
,
DS1337_REG_HOUR
,
val
&
0x3f
);
/* On some boards, the RTC isn't configured by boot firmware.
* Handle that case by starting/configuring the RTC now.
*/
status
=
i2c_smbus_read_byte_data
(
client
,
DS1337_REG_STATUS
);
control
=
i2c_smbus_read_byte_data
(
client
,
DS1337_REG_CONTROL
);
if
((
status
&
0x80
)
||
(
control
&
0x80
))
{
/* RTC not running */
u8
buf
[
16
];
struct
i2c_msg
msg
[
1
];
dev_dbg
(
&
client
->
dev
,
"%s: RTC not running!
\n
"
,
__FUNCTION__
);
/* Initialize all, including STATUS and CONTROL to zero */
memset
(
buf
,
0
,
sizeof
(
buf
));
msg
[
0
].
addr
=
client
->
addr
;
msg
[
0
].
flags
=
0
;
msg
[
0
].
len
=
sizeof
(
buf
);
msg
[
0
].
buf
=
&
buf
[
0
];
i2c_transfer
(
client
->
adapter
,
msg
,
1
);
}
else
{
/* Running: ensure that device is set in 24-hour mode */
s32
val
;
val
=
i2c_smbus_read_byte_data
(
client
,
DS1337_REG_HOUR
);
if
((
val
>=
0
)
&&
(
val
&
(
1
<<
6
)))
i2c_smbus_write_byte_data
(
client
,
DS1337_REG_HOUR
,
val
&
0x3f
);
}
}
static
int
ds1337_detach_client
(
struct
i2c_client
*
client
)
...
...
drivers/i2c/chips/ds1374.c
浏览文件 @
0feb9bfc
...
...
@@ -232,10 +232,10 @@ static int ds1374_detach(struct i2c_client *client)
}
static
struct
i2c_driver
ds1374_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
DS1374_DRV_NAME
,
.
driver
=
{
.
name
=
DS1374_DRV_NAME
,
},
.
id
=
I2C_DRIVERID_DS1374
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
ds1374_attach
,
.
detach_client
=
ds1374_detach
,
};
...
...
drivers/i2c/chips/eeprom.c
浏览文件 @
0feb9bfc
...
...
@@ -68,10 +68,10 @@ static int eeprom_detach_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static
struct
i2c_driver
eeprom_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"eeprom"
,
.
driver
=
{
.
name
=
"eeprom"
,
},
.
id
=
I2C_DRIVERID_EEPROM
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
eeprom_attach_adapter
,
.
detach_client
=
eeprom_detach_client
,
};
...
...
drivers/i2c/chips/isp1301_omap.c
浏览文件 @
0feb9bfc
...
...
@@ -1632,11 +1632,11 @@ static int isp1301_scan_bus(struct i2c_adapter *bus)
}
static
struct
i2c_driver
isp1301_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"isp1301_omap"
,
.
driver
=
{
.
name
=
"isp1301_omap"
,
},
.
id
=
1301
,
/* FIXME "official", i2c-ids.h */
.
class
=
I2C_CLASS_HWMON
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
isp1301_scan_bus
,
.
detach_client
=
isp1301_detach_client
,
};
...
...
drivers/i2c/chips/m41t00.c
浏览文件 @
0feb9bfc
...
...
@@ -211,10 +211,10 @@ m41t00_detach(struct i2c_client *client)
}
static
struct
i2c_driver
m41t00_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
M41T00_DRV_NAME
,
.
driver
=
{
.
name
=
M41T00_DRV_NAME
,
},
.
id
=
I2C_DRIVERID_STM41T00
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
m41t00_attach
,
.
detach_client
=
m41t00_detach
,
};
...
...
drivers/i2c/chips/max6875.c
浏览文件 @
0feb9bfc
...
...
@@ -67,9 +67,9 @@ static int max6875_detach_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static
struct
i2c_driver
max6875_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"max6875"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"max6875"
,
}
,
.
attach_adapter
=
max6875_attach_adapter
,
.
detach_client
=
max6875_detach_client
,
};
...
...
drivers/i2c/chips/pca9539.c
浏览文件 @
0feb9bfc
...
...
@@ -38,9 +38,9 @@ static int pca9539_detach_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static
struct
i2c_driver
pca9539_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"pca9539"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"pca9539"
,
}
,
.
attach_adapter
=
pca9539_attach_adapter
,
.
detach_client
=
pca9539_detach_client
,
};
...
...
drivers/i2c/chips/pcf8574.c
浏览文件 @
0feb9bfc
...
...
@@ -65,10 +65,10 @@ static void pcf8574_init_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static
struct
i2c_driver
pcf8574_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"pcf8574"
,
.
driver
=
{
.
name
=
"pcf8574"
,
},
.
id
=
I2C_DRIVERID_PCF8574
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
pcf8574_attach_adapter
,
.
detach_client
=
pcf8574_detach_client
,
};
...
...
drivers/i2c/chips/pcf8591.c
浏览文件 @
0feb9bfc
...
...
@@ -88,10 +88,10 @@ static int pcf8591_read_channel(struct device *dev, int channel);
/* This is the driver that will be inserted */
static
struct
i2c_driver
pcf8591_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"pcf8591"
,
.
driver
=
{
.
name
=
"pcf8591"
,
},
.
id
=
I2C_DRIVERID_PCF8591
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
pcf8591_attach_adapter
,
.
detach_client
=
pcf8591_detach_client
,
};
...
...
drivers/i2c/chips/rtc8564.c
浏览文件 @
0feb9bfc
...
...
@@ -14,6 +14,7 @@
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/bcd.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/string.h>
...
...
@@ -52,9 +53,6 @@ static inline u8 _rtc8564_ctrl2(struct i2c_client *client)
#define CTRL1(c) _rtc8564_ctrl1(c)
#define CTRL2(c) _rtc8564_ctrl2(c)
#define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10)
#define BIN_TO_BCD(val) ((((val)/10)<<4) + (val)%10)
static
int
debug
;;
module_param
(
debug
,
int
,
S_IRUGO
|
S_IWUSR
);
...
...
@@ -157,7 +155,6 @@ static int rtc8564_attach(struct i2c_adapter *adap, int addr, int kind)
strlcpy
(
new_client
->
name
,
"RTC8564"
,
I2C_NAME_SIZE
);
i2c_set_clientdata
(
new_client
,
d
);
new_client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
new_client
->
addr
=
addr
;
new_client
->
adapter
=
adap
;
new_client
->
driver
=
&
rtc8564_driver
;
...
...
@@ -224,16 +221,16 @@ static int rtc8564_get_datetime(struct i2c_client *client, struct rtc_tm *dt)
return
ret
;
/* century stored in minute alarm reg */
dt
->
year
=
BCD
_TO_
BIN
(
buf
[
RTC8564_REG_YEAR
]);
dt
->
year
+=
100
*
BCD
_TO_
BIN
(
buf
[
RTC8564_REG_AL_MIN
]
&
0x3f
);
dt
->
mday
=
BCD
_TO_
BIN
(
buf
[
RTC8564_REG_DAY
]
&
0x3f
);
dt
->
wday
=
BCD
_TO_
BIN
(
buf
[
RTC8564_REG_WDAY
]
&
7
);
dt
->
mon
=
BCD
_TO_
BIN
(
buf
[
RTC8564_REG_MON_CENT
]
&
0x1f
);
dt
->
year
=
BCD
2
BIN
(
buf
[
RTC8564_REG_YEAR
]);
dt
->
year
+=
100
*
BCD
2
BIN
(
buf
[
RTC8564_REG_AL_MIN
]
&
0x3f
);
dt
->
mday
=
BCD
2
BIN
(
buf
[
RTC8564_REG_DAY
]
&
0x3f
);
dt
->
wday
=
BCD
2
BIN
(
buf
[
RTC8564_REG_WDAY
]
&
7
);
dt
->
mon
=
BCD
2
BIN
(
buf
[
RTC8564_REG_MON_CENT
]
&
0x1f
);
dt
->
secs
=
BCD
_TO_
BIN
(
buf
[
RTC8564_REG_SEC
]
&
0x7f
);
dt
->
secs
=
BCD
2
BIN
(
buf
[
RTC8564_REG_SEC
]
&
0x7f
);
dt
->
vl
=
(
buf
[
RTC8564_REG_SEC
]
&
0x80
)
==
0x80
;
dt
->
mins
=
BCD
_TO_
BIN
(
buf
[
RTC8564_REG_MIN
]
&
0x7f
);
dt
->
hours
=
BCD
_TO_
BIN
(
buf
[
RTC8564_REG_HR
]
&
0x3f
);
dt
->
mins
=
BCD
2
BIN
(
buf
[
RTC8564_REG_MIN
]
&
0x7f
);
dt
->
hours
=
BCD
2
BIN
(
buf
[
RTC8564_REG_HR
]
&
0x3f
);
_DBGRTCTM
(
2
,
*
dt
);
...
...
@@ -255,18 +252,18 @@ rtc8564_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo)
buf
[
RTC8564_REG_CTRL1
]
=
CTRL1
(
client
)
|
RTC8564_CTRL1_STOP
;
buf
[
RTC8564_REG_CTRL2
]
=
CTRL2
(
client
);
buf
[
RTC8564_REG_SEC
]
=
BIN
_TO_
BCD
(
dt
->
secs
);
buf
[
RTC8564_REG_MIN
]
=
BIN
_TO_
BCD
(
dt
->
mins
);
buf
[
RTC8564_REG_HR
]
=
BIN
_TO_
BCD
(
dt
->
hours
);
buf
[
RTC8564_REG_SEC
]
=
BIN
2
BCD
(
dt
->
secs
);
buf
[
RTC8564_REG_MIN
]
=
BIN
2
BCD
(
dt
->
mins
);
buf
[
RTC8564_REG_HR
]
=
BIN
2
BCD
(
dt
->
hours
);
if
(
datetoo
)
{
len
+=
5
;
buf
[
RTC8564_REG_DAY
]
=
BIN
_TO_
BCD
(
dt
->
mday
);
buf
[
RTC8564_REG_WDAY
]
=
BIN
_TO_
BCD
(
dt
->
wday
);
buf
[
RTC8564_REG_MON_CENT
]
=
BIN
_TO_
BCD
(
dt
->
mon
)
&
0x1f
;
buf
[
RTC8564_REG_DAY
]
=
BIN
2
BCD
(
dt
->
mday
);
buf
[
RTC8564_REG_WDAY
]
=
BIN
2
BCD
(
dt
->
wday
);
buf
[
RTC8564_REG_MON_CENT
]
=
BIN
2
BCD
(
dt
->
mon
)
&
0x1f
;
/* century stored in minute alarm reg */
buf
[
RTC8564_REG_YEAR
]
=
BIN
_TO_
BCD
(
dt
->
year
%
100
);
buf
[
RTC8564_REG_AL_MIN
]
=
BIN
_TO_
BCD
(
dt
->
year
/
100
);
buf
[
RTC8564_REG_YEAR
]
=
BIN
2
BCD
(
dt
->
year
%
100
);
buf
[
RTC8564_REG_AL_MIN
]
=
BIN
2
BCD
(
dt
->
year
/
100
);
}
ret
=
rtc8564_write
(
client
,
0
,
buf
,
len
);
...
...
@@ -361,10 +358,10 @@ rtc8564_command(struct i2c_client *client, unsigned int cmd, void *arg)
}
static
struct
i2c_driver
rtc8564_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"RTC8564"
,
.
driver
=
{
.
name
=
"RTC8564"
,
},
.
id
=
I2C_DRIVERID_RTC8564
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
rtc8564_probe
,
.
detach_client
=
rtc8564_detach
,
.
command
=
rtc8564_command
...
...
drivers/i2c/chips/tps65010.c
浏览文件 @
0feb9bfc
...
...
@@ -637,9 +637,9 @@ static int __init tps65010_scan_bus(struct i2c_adapter *bus)
}
static
struct
i2c_driver
tps65010_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"tps65010"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"tps65010"
,
}
,
.
attach_adapter
=
tps65010_scan_bus
,
.
detach_client
=
__exit_p
(
tps65010_detach_client
),
};
...
...
drivers/i2c/chips/x1205.c
浏览文件 @
0feb9bfc
...
...
@@ -105,9 +105,9 @@ static int x1205_command(struct i2c_client *client, unsigned int cmd,
void
*
arg
);
static
struct
i2c_driver
x1205_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"x1205"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"x1205"
,
}
,
.
attach_adapter
=
&
x1205_attach
,
.
detach_client
=
&
x1205_detach
,
};
...
...
drivers/i2c/i2c-core.c
浏览文件 @
0feb9bfc
...
...
@@ -197,7 +197,7 @@ int i2c_add_adapter(struct i2c_adapter *adap)
/* inform drivers of new adapters */
list_for_each
(
item
,
&
drivers
)
{
driver
=
list_entry
(
item
,
struct
i2c_driver
,
list
);
if
(
driver
->
flags
&
I2C_DF_NOTIFY
)
if
(
driver
->
attach_adapter
)
/* We ignore the return code; if it fails, too bad */
driver
->
attach_adapter
(
adap
);
}
...
...
@@ -235,7 +235,8 @@ int i2c_del_adapter(struct i2c_adapter *adap)
if
(
driver
->
detach_adapter
)
if
((
res
=
driver
->
detach_adapter
(
adap
)))
{
dev_err
(
&
adap
->
dev
,
"detach_adapter failed "
"for driver [%s]
\n
"
,
driver
->
name
);
"for driver [%s]
\n
"
,
driver
->
driver
.
name
);
goto
out_unlock
;
}
}
...
...
@@ -245,10 +246,6 @@ int i2c_del_adapter(struct i2c_adapter *adap)
list_for_each_safe
(
item
,
_n
,
&
adap
->
clients
)
{
client
=
list_entry
(
item
,
struct
i2c_client
,
list
);
/* detaching devices is unconditional of the set notify
* flag, as _all_ clients that reside on the adapter
* must be deleted, as this would cause invalid states.
*/
if
((
res
=
client
->
driver
->
detach_client
(
client
)))
{
dev_err
(
&
adap
->
dev
,
"detach_client failed for client "
"[%s] at address 0x%02x
\n
"
,
client
->
name
,
...
...
@@ -286,7 +283,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
* chips.
*/
int
i2c_
add_driver
(
struct
i2c_driver
*
driver
)
int
i2c_
register_driver
(
struct
module
*
owner
,
struct
i2c_driver
*
driver
)
{
struct
list_head
*
item
;
struct
i2c_adapter
*
adapter
;
...
...
@@ -295,8 +292,7 @@ int i2c_add_driver(struct i2c_driver *driver)
down
(
&
core_lists
);
/* add the driver to the list of i2c drivers in the driver core */
driver
->
driver
.
owner
=
driver
->
owner
;
driver
->
driver
.
name
=
driver
->
name
;
driver
->
driver
.
owner
=
owner
;
driver
->
driver
.
bus
=
&
i2c_bus_type
;
driver
->
driver
.
probe
=
i2c_device_probe
;
driver
->
driver
.
remove
=
i2c_device_remove
;
...
...
@@ -306,10 +302,10 @@ int i2c_add_driver(struct i2c_driver *driver)
goto
out_unlock
;
list_add_tail
(
&
driver
->
list
,
&
drivers
);
pr_debug
(
"i2c-core: driver [%s] registered
\n
"
,
driver
->
name
);
pr_debug
(
"i2c-core: driver [%s] registered
\n
"
,
driver
->
driver
.
name
);
/* now look for instances of driver on our adapters */
if
(
driver
->
flags
&
I2C_DF_NOTIFY
)
{
if
(
driver
->
attach_adapter
)
{
list_for_each
(
item
,
&
adapters
)
{
adapter
=
list_entry
(
item
,
struct
i2c_adapter
,
list
);
driver
->
attach_adapter
(
adapter
);
...
...
@@ -320,6 +316,7 @@ int i2c_add_driver(struct i2c_driver *driver)
up
(
&
core_lists
);
return
res
;
}
EXPORT_SYMBOL
(
i2c_register_driver
);
int
i2c_del_driver
(
struct
i2c_driver
*
driver
)
{
...
...
@@ -334,17 +331,14 @@ int i2c_del_driver(struct i2c_driver *driver)
/* Have a look at each adapter, if clients of this driver are still
* attached. If so, detach them to be able to kill the driver
* afterwards.
*
* Removing clients does not depend on the notify flag, else
* invalid operation might (will!) result, when using stale client
* pointers.
*/
list_for_each
(
item1
,
&
adapters
)
{
adap
=
list_entry
(
item1
,
struct
i2c_adapter
,
list
);
if
(
driver
->
detach_adapter
)
{
if
((
res
=
driver
->
detach_adapter
(
adap
)))
{
dev_err
(
&
adap
->
dev
,
"detach_adapter failed "
"for driver [%s]
\n
"
,
driver
->
name
);
"for driver [%s]
\n
"
,
driver
->
driver
.
name
);
goto
out_unlock
;
}
}
else
{
...
...
@@ -368,7 +362,7 @@ int i2c_del_driver(struct i2c_driver *driver)
driver_unregister
(
&
driver
->
driver
);
list_del
(
&
driver
->
list
);
pr_debug
(
"i2c-core: driver [%s] unregistered
\n
"
,
driver
->
name
);
pr_debug
(
"i2c-core: driver [%s] unregistered
\n
"
,
driver
->
driver
.
name
);
out_unlock:
up
(
&
core_lists
);
...
...
@@ -419,8 +413,7 @@ int i2c_attach_client(struct i2c_client *client)
}
}
if
(
client
->
flags
&
I2C_CLIENT_ALLOW_USE
)
client
->
usage_count
=
0
;
client
->
usage_count
=
0
;
client
->
dev
.
parent
=
&
client
->
adapter
->
dev
;
client
->
dev
.
driver
=
&
client
->
driver
->
driver
;
...
...
@@ -443,8 +436,7 @@ int i2c_detach_client(struct i2c_client *client)
struct
i2c_adapter
*
adapter
=
client
->
adapter
;
int
res
=
0
;
if
((
client
->
flags
&
I2C_CLIENT_ALLOW_USE
)
&&
(
client
->
usage_count
>
0
))
{
if
(
client
->
usage_count
>
0
)
{
dev_warn
(
&
client
->
dev
,
"Client [%s] still busy, "
"can't detach
\n
"
,
client
->
name
);
return
-
EBUSY
;
...
...
@@ -475,10 +467,10 @@ int i2c_detach_client(struct i2c_client *client)
static
int
i2c_inc_use_client
(
struct
i2c_client
*
client
)
{
if
(
!
try_module_get
(
client
->
driver
->
owner
))
if
(
!
try_module_get
(
client
->
driver
->
driver
.
owner
))
return
-
ENODEV
;
if
(
!
try_module_get
(
client
->
adapter
->
owner
))
{
module_put
(
client
->
driver
->
owner
);
module_put
(
client
->
driver
->
driver
.
owner
);
return
-
ENODEV
;
}
...
...
@@ -487,7 +479,7 @@ static int i2c_inc_use_client(struct i2c_client *client)
static
void
i2c_dec_use_client
(
struct
i2c_client
*
client
)
{
module_put
(
client
->
driver
->
owner
);
module_put
(
client
->
driver
->
driver
.
owner
);
module_put
(
client
->
adapter
->
owner
);
}
...
...
@@ -499,33 +491,20 @@ int i2c_use_client(struct i2c_client *client)
if
(
ret
)
return
ret
;
if
(
client
->
flags
&
I2C_CLIENT_ALLOW_USE
)
{
if
(
client
->
flags
&
I2C_CLIENT_ALLOW_MULTIPLE_USE
)
client
->
usage_count
++
;
else
if
(
client
->
usage_count
>
0
)
goto
busy
;
else
client
->
usage_count
++
;
}
client
->
usage_count
++
;
return
0
;
busy:
i2c_dec_use_client
(
client
);
return
-
EBUSY
;
}
int
i2c_release_client
(
struct
i2c_client
*
client
)
{
if
(
client
->
flags
&
I2C_CLIENT_ALLOW_USE
)
{
if
(
client
->
usage_count
>
0
)
client
->
usage_count
--
;
else
{
pr_debug
(
"i2c-core: %s used one too many times
\n
"
,
__FUNCTION__
);
return
-
EPERM
;
}
if
(
!
client
->
usage_count
)
{
pr_debug
(
"i2c-core: %s used one too many times
\n
"
,
__FUNCTION__
);
return
-
EPERM
;
}
client
->
usage_count
--
;
i2c_dec_use_client
(
client
);
return
0
;
...
...
@@ -539,14 +518,14 @@ void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg)
down
(
&
adap
->
clist_lock
);
list_for_each
(
item
,
&
adap
->
clients
)
{
client
=
list_entry
(
item
,
struct
i2c_client
,
list
);
if
(
!
try_module_get
(
client
->
driver
->
owner
))
if
(
!
try_module_get
(
client
->
driver
->
driver
.
owner
))
continue
;
if
(
NULL
!=
client
->
driver
->
command
)
{
up
(
&
adap
->
clist_lock
);
client
->
driver
->
command
(
client
,
cmd
,
arg
);
down
(
&
adap
->
clist_lock
);
}
module_put
(
client
->
driver
->
owner
);
module_put
(
client
->
driver
->
driver
.
owner
);
}
up
(
&
adap
->
clist_lock
);
}
...
...
@@ -1147,7 +1126,6 @@ EXPORT_SYMBOL_GPL(i2c_bus_type);
EXPORT_SYMBOL
(
i2c_add_adapter
);
EXPORT_SYMBOL
(
i2c_del_adapter
);
EXPORT_SYMBOL
(
i2c_add_driver
);
EXPORT_SYMBOL
(
i2c_del_driver
);
EXPORT_SYMBOL
(
i2c_attach_client
);
EXPORT_SYMBOL
(
i2c_detach_client
);
...
...
drivers/i2c/i2c-dev.c
浏览文件 @
0feb9bfc
...
...
@@ -42,8 +42,7 @@ static struct i2c_client i2cdev_client_template;
struct
i2c_dev
{
int
minor
;
struct
i2c_adapter
*
adap
;
struct
class_device
class_dev
;
struct
completion
released
;
/* FIXME, we need a class_device_unregister() */
struct
class_device
*
class_dev
;
};
#define to_i2c_dev(d) container_of(d, struct i2c_dev, class_dev)
...
...
@@ -105,7 +104,10 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev)
static
ssize_t
show_adapter_name
(
struct
class_device
*
class_dev
,
char
*
buf
)
{
struct
i2c_dev
*
i2c_dev
=
to_i2c_dev
(
class_dev
);
struct
i2c_dev
*
i2c_dev
=
i2c_dev_get_by_minor
(
MINOR
(
class_dev
->
devt
));
if
(
!
i2c_dev
)
return
-
ENODEV
;
return
sprintf
(
buf
,
"%s
\n
"
,
i2c_dev
->
adap
->
name
);
}
static
CLASS_DEVICE_ATTR
(
name
,
S_IRUGO
,
show_adapter_name
,
NULL
);
...
...
@@ -408,21 +410,12 @@ static struct file_operations i2cdev_fops = {
.
release
=
i2cdev_release
,
};
static
void
release_i2c_dev
(
struct
class_device
*
dev
)
{
struct
i2c_dev
*
i2c_dev
=
to_i2c_dev
(
dev
);
complete
(
&
i2c_dev
->
released
);
}
static
struct
class
i2c_dev_class
=
{
.
name
=
"i2c-dev"
,
.
release
=
&
release_i2c_dev
,
};
static
struct
class
*
i2c_dev_class
;
static
int
i2cdev_attach_adapter
(
struct
i2c_adapter
*
adap
)
{
struct
i2c_dev
*
i2c_dev
;
int
retval
;
struct
device
*
dev
;
i2c_dev
=
get_free_i2c_dev
(
adap
);
if
(
IS_ERR
(
i2c_dev
))
...
...
@@ -434,21 +427,20 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
/* register this i2c device with the driver core */
i2c_dev
->
adap
=
adap
;
if
(
adap
->
dev
.
parent
==
&
platform_bus
)
i2c_dev
->
class_dev
.
dev
=
&
adap
->
dev
;
dev
=
&
adap
->
dev
;
else
i2c_dev
->
class_dev
.
dev
=
adap
->
dev
.
parent
;
i2c_dev
->
class_dev
.
class
=
&
i2c_dev_class
;
i2c_dev
->
class_dev
.
devt
=
MKDEV
(
I2C_MAJOR
,
i2c_dev
->
minor
);
snprintf
(
i2c_dev
->
class_dev
.
class_id
,
BUS_ID_SIZE
,
"i2c-%d"
,
i2c_dev
->
minor
);
retval
=
class_device_register
(
&
i2c_dev
->
class_dev
);
if
(
retval
)
dev
=
adap
->
dev
.
parent
;
i2c_dev
->
class_dev
=
class_device_create
(
i2c_dev_class
,
NULL
,
MKDEV
(
I2C_MAJOR
,
i2c_dev
->
minor
),
dev
,
"i2c-%d"
,
i2c_dev
->
minor
);
if
(
!
i2c_dev
->
class_dev
)
goto
error
;
class_device_create_file
(
&
i2c_dev
->
class_dev
,
&
class_device_attr_name
);
class_device_create_file
(
i2c_dev
->
class_dev
,
&
class_device_attr_name
);
return
0
;
error:
return_i2c_dev
(
i2c_dev
);
kfree
(
i2c_dev
);
return
retval
;
return
-
ENODEV
;
}
static
int
i2cdev_detach_adapter
(
struct
i2c_adapter
*
adap
)
...
...
@@ -459,10 +451,8 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap)
if
(
!
i2c_dev
)
return
-
ENODEV
;
init_completion
(
&
i2c_dev
->
released
);
return_i2c_dev
(
i2c_dev
);
class_device_unregister
(
&
i2c_dev
->
class_dev
);
wait_for_completion
(
&
i2c_dev
->
released
);
class_device_destroy
(
i2c_dev_class
,
MKDEV
(
I2C_MAJOR
,
i2c_dev
->
minor
));
kfree
(
i2c_dev
);
pr_debug
(
"i2c-dev: adapter [%s] unregistered
\n
"
,
adap
->
name
);
...
...
@@ -474,21 +464,14 @@ static int i2cdev_detach_client(struct i2c_client *client)
return
0
;
}
static
int
i2cdev_command
(
struct
i2c_client
*
client
,
unsigned
int
cmd
,
void
*
arg
)
{
return
-
1
;
}
static
struct
i2c_driver
i2cdev_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"dev_driver"
,
.
driver
=
{
.
name
=
"dev_driver"
,
},
.
id
=
I2C_DRIVERID_I2CDEV
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
i2cdev_attach_adapter
,
.
detach_adapter
=
i2cdev_detach_adapter
,
.
detach_client
=
i2cdev_detach_client
,
.
command
=
i2cdev_command
,
};
static
struct
i2c_client
i2cdev_client_template
=
{
...
...
@@ -507,8 +490,8 @@ static int __init i2c_dev_init(void)
if
(
res
)
goto
out
;
res
=
class_register
(
&
i2c_dev_class
);
if
(
res
)
i2c_dev_class
=
class_create
(
THIS_MODULE
,
"i2c-dev"
);
if
(
IS_ERR
(
i2c_dev_class
)
)
goto
out_unreg_chrdev
;
res
=
i2c_add_driver
(
&
i2cdev_driver
);
...
...
@@ -518,7 +501,7 @@ static int __init i2c_dev_init(void)
return
0
;
out_unreg_class:
class_
unregister
(
&
i2c_dev_class
);
class_
destroy
(
i2c_dev_class
);
out_unreg_chrdev:
unregister_chrdev
(
I2C_MAJOR
,
"i2c"
);
out:
...
...
@@ -529,7 +512,7 @@ static int __init i2c_dev_init(void)
static
void
__exit
i2c_dev_exit
(
void
)
{
i2c_del_driver
(
&
i2cdev_driver
);
class_
unregister
(
&
i2c_dev_class
);
class_
destroy
(
i2c_dev_class
);
unregister_chrdev
(
I2C_MAJOR
,
"i2c"
);
}
...
...
drivers/macintosh/therm_adt746x.c
浏览文件 @
0feb9bfc
...
...
@@ -176,9 +176,9 @@ detach_thermostat(struct i2c_adapter *adapter)
}
static
struct
i2c_driver
thermostat_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"therm_adt746x"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"therm_adt746x"
,
}
,
.
attach_adapter
=
attach_thermostat
,
.
detach_adapter
=
detach_thermostat
,
};
...
...
drivers/macintosh/therm_pm72.c
浏览文件 @
0feb9bfc
...
...
@@ -283,9 +283,9 @@ static int therm_pm72_detach(struct i2c_adapter *adapter);
static
struct
i2c_driver
therm_pm72_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"therm_pm72"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"therm_pm72"
,
}
,
.
attach_adapter
=
therm_pm72_attach
,
.
detach_adapter
=
therm_pm72_detach
,
};
...
...
drivers/macintosh/therm_windtunnel.c
浏览文件 @
0feb9bfc
...
...
@@ -354,10 +354,10 @@ do_detach( struct i2c_client *client )
}
static
struct
i2c_driver
g4fan_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"therm_windtunnel"
,
.
driver
=
{
.
name
=
"therm_windtunnel"
,
},
.
id
=
I2C_DRIVERID_G4FAN
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
do_attach
,
.
detach_client
=
do_detach
,
};
...
...
drivers/macintosh/windfarm_lm75_sensor.c
浏览文件 @
0feb9bfc
...
...
@@ -47,9 +47,9 @@ static int wf_lm75_attach(struct i2c_adapter *adapter);
static
int
wf_lm75_detach
(
struct
i2c_client
*
client
);
static
struct
i2c_driver
wf_lm75_driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"wf_lm75"
,
.
flags
=
I2C_DF_NOTIFY
,
.
driver
=
{
.
name
=
"wf_lm75"
,
}
,
.
attach_adapter
=
wf_lm75_attach
,
.
detach_client
=
wf_lm75_detach
,
};
...
...
drivers/media/video/adv7170.c
浏览文件 @
0feb9bfc
...
...
@@ -420,7 +420,6 @@ adv7170_detect_client (struct i2c_adapter *adapter,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_adv7170
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
if
((
client
->
addr
==
I2C_ADV7170
>>
1
)
||
(
client
->
addr
==
(
I2C_ADV7170
>>
1
)
+
1
))
{
dname
=
adv7170_name
;
...
...
@@ -498,11 +497,11 @@ adv7170_detach_client (struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_adv7170
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"adv7170"
,
/* name */
.
driver
=
{
.
name
=
"adv7170"
,
/* name */
},
.
id
=
I2C_DRIVERID_ADV7170
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
adv7170_attach_adapter
,
.
detach_client
=
adv7170_detach_client
,
...
...
drivers/media/video/adv7175.c
浏览文件 @
0feb9bfc
...
...
@@ -470,7 +470,6 @@ adv7175_detect_client (struct i2c_adapter *adapter,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_adv7175
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
if
((
client
->
addr
==
I2C_ADV7175
>>
1
)
||
(
client
->
addr
==
(
I2C_ADV7175
>>
1
)
+
1
))
{
dname
=
adv7175_name
;
...
...
@@ -548,11 +547,11 @@ adv7175_detach_client (struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_adv7175
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"adv7175"
,
/* name */
.
driver
=
{
.
name
=
"adv7175"
,
/* name */
},
.
id
=
I2C_DRIVERID_ADV7175
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
adv7175_attach_adapter
,
.
detach_client
=
adv7175_detach_client
,
...
...
drivers/media/video/bt819.c
浏览文件 @
0feb9bfc
...
...
@@ -535,7 +535,6 @@ bt819_detect_client (struct i2c_adapter *adapter,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_bt819
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
decoder
=
kmalloc
(
sizeof
(
struct
bt819
),
GFP_KERNEL
);
if
(
decoder
==
NULL
)
{
...
...
@@ -623,11 +622,11 @@ bt819_detach_client (struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_bt819
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"bt819"
,
.
driver
=
{
.
name
=
"bt819"
,
},
.
id
=
I2C_DRIVERID_BT819
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
bt819_attach_adapter
,
.
detach_client
=
bt819_detach_client
,
...
...
drivers/media/video/bt832.c
浏览文件 @
0feb9bfc
...
...
@@ -230,10 +230,10 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"i2c bt832 driver"
,
.
driver
=
{
.
name
=
"i2c bt832 driver"
,
},
.
id
=
-
1
,
/* FIXME */
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
bt832_probe
,
.
detach_client
=
bt832_detach
,
.
command
=
bt832_command
,
...
...
@@ -241,7 +241,6 @@ static struct i2c_driver driver = {
static
struct
i2c_client
client_template
=
{
.
name
=
"bt832"
,
.
flags
=
I2C_CLIENT_ALLOW_USE
,
.
driver
=
&
driver
,
};
...
...
drivers/media/video/bt856.c
浏览文件 @
0feb9bfc
...
...
@@ -323,7 +323,6 @@ bt856_detect_client (struct i2c_adapter *adapter,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_bt856
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
strlcpy
(
I2C_NAME
(
client
),
"bt856"
,
sizeof
(
I2C_NAME
(
client
)));
encoder
=
kmalloc
(
sizeof
(
struct
bt856
),
GFP_KERNEL
);
...
...
@@ -405,11 +404,11 @@ bt856_detach_client (struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_bt856
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"bt856"
,
.
driver
=
{
.
name
=
"bt856"
,
},
.
id
=
I2C_DRIVERID_BT856
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
bt856_attach_adapter
,
.
detach_client
=
bt856_detach_client
,
...
...
drivers/media/video/bttv-i2c.c
浏览文件 @
0feb9bfc
...
...
@@ -300,7 +300,7 @@ static int attach_inform(struct i2c_client *client)
if
(
bttv_debug
)
printk
(
KERN_DEBUG
"bttv%d: %s i2c attach [addr=0x%x,client=%s]
\n
"
,
btv
->
c
.
nr
,
client
->
driver
->
name
,
client
->
addr
,
btv
->
c
.
nr
,
client
->
driver
->
driver
.
name
,
client
->
addr
,
client
->
name
);
if
(
!
client
->
driver
->
command
)
return
0
;
...
...
drivers/media/video/cs53l32a.c
浏览文件 @
0feb9bfc
...
...
@@ -42,15 +42,16 @@ MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On");
#define cs53l32a_dbg(fmt, arg...) \
do { \
if (debug) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
#define cs53l32a_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define cs53l32a_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
static
unsigned
short
normal_i2c
[]
=
{
0x22
>>
1
,
I2C_CLIENT_END
};
...
...
@@ -154,7 +155,6 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
snprintf
(
client
->
name
,
sizeof
(
client
->
name
)
-
1
,
"cs53l32a"
);
cs53l32a_info
(
"chip found @ 0x%x (%s)
\n
"
,
address
<<
1
,
adapter
->
name
);
...
...
@@ -216,13 +216,13 @@ static int cs53l32a_detach(struct i2c_client *client)
/* i2c implementation */
static
struct
i2c_driver
i2c_driver
=
{
.
name
=
"cs53l32a"
,
.
driver
=
{
.
name
=
"cs53l32a"
,
},
.
id
=
I2C_DRIVERID_CS53L32A
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
cs53l32a_probe
,
.
detach_client
=
cs53l32a_detach
,
.
command
=
cs53l32a_command
,
.
owner
=
THIS_MODULE
,
};
...
...
drivers/media/video/cx25840/cx25840-core.c
浏览文件 @
0feb9bfc
...
...
@@ -773,7 +773,6 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_cx25840
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
snprintf
(
client
->
name
,
sizeof
(
client
->
name
)
-
1
,
"cx25840"
);
cx25840_dbg
(
"detecting cx25840 client on address 0x%x
\n
"
,
address
<<
1
);
...
...
@@ -844,15 +843,15 @@ static int cx25840_detach_client(struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_cx25840
=
{
.
name
=
"cx25840"
,
.
driver
=
{
.
name
=
"cx25840"
,
},
.
id
=
I2C_DRIVERID_CX25840
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
cx25840_attach_adapter
,
.
detach_client
=
cx25840_detach_client
,
.
command
=
cx25840_command
,
.
owner
=
THIS_MODULE
,
};
...
...
drivers/media/video/cx25840/cx25840.h
浏览文件 @
0feb9bfc
...
...
@@ -27,15 +27,16 @@
extern
int
cx25840_debug
;
#define cx25840_dbg(fmt, arg...) do { if (cx25840_debug) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define cx25840_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define cx25840_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define CX25840_CID_CARDTYPE (V4L2_CID_PRIVATE_BASE+0)
...
...
drivers/media/video/cx88/cx88-i2c.c
浏览文件 @
0feb9bfc
...
...
@@ -94,7 +94,7 @@ static int attach_inform(struct i2c_client *client)
struct
cx88_core
*
core
=
i2c_get_adapdata
(
client
->
adapter
);
dprintk
(
1
,
"%s i2c attach [addr=0x%x,client=%s]
\n
"
,
client
->
driver
->
name
,
client
->
addr
,
client
->
name
);
client
->
driver
->
driver
.
name
,
client
->
addr
,
client
->
name
);
if
(
!
client
->
driver
->
command
)
return
0
;
...
...
drivers/media/video/em28xx/em28xx-i2c.c
浏览文件 @
0feb9bfc
...
...
@@ -497,7 +497,6 @@ static struct i2c_adapter em28xx_adap_template = {
static
struct
i2c_client
em28xx_client_template
=
{
.
name
=
"em28xx internal"
,
.
flags
=
I2C_CLIENT_ALLOW_USE
,
};
/* ----------------------------------------------------------- */
...
...
drivers/media/video/indycam.c
浏览文件 @
0feb9bfc
...
...
@@ -451,10 +451,10 @@ static int indycam_command(struct i2c_client *client, unsigned int cmd,
}
static
struct
i2c_driver
i2c_driver_indycam
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"indycam"
,
.
driver
=
{
.
name
=
"indycam"
,
},
.
id
=
I2C_DRIVERID_INDYCAM
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
indycam_probe
,
.
detach_client
=
indycam_detach
,
.
command
=
indycam_command
,
...
...
drivers/media/video/ir-kbd-i2c.c
浏览文件 @
0feb9bfc
...
...
@@ -278,9 +278,10 @@ static int ir_detach(struct i2c_client *client);
static
int
ir_probe
(
struct
i2c_adapter
*
adap
);
static
struct
i2c_driver
driver
=
{
.
name
=
"ir remote kbd driver"
,
.
driver
=
{
.
name
=
"ir remote kbd driver"
,
},
.
id
=
I2C_DRIVERID_INFRARED
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
ir_probe
,
.
detach_client
=
ir_detach
,
};
...
...
drivers/media/video/msp3400.c
浏览文件 @
0feb9bfc
...
...
@@ -59,7 +59,8 @@
#define msp3400_dbg(fmt, arg...) \
do { \
if (debug) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
...
...
@@ -67,7 +68,8 @@
#define msp3400_dbg_mediumvol(fmt, arg...) \
do { \
if (debug >= 2) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
...
...
@@ -75,18 +77,19 @@
#define msp3400_dbg_highvol(fmt, arg...) \
do { \
if (debug >= 16) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
#define msp3400_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define msp3400_warn(fmt, arg...) do { \
printk(KERN_WARNING "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_WARNING "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define msp3400_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define OPMODE_AUTO -1
...
...
@@ -1561,14 +1564,12 @@ static int msp_resume(struct device * dev);
static
void
msp_wake_thread
(
struct
i2c_client
*
client
);
static
struct
i2c_driver
driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"msp3400"
,
.
id
=
I2C_DRIVERID_MSP3400
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
msp_probe
,
.
detach_client
=
msp_detach
,
.
command
=
msp_command
,
.
driver
=
{
.
name
=
"i2c msp3400 driver"
,
.
suspend
=
msp_suspend
,
.
resume
=
msp_resume
,
},
...
...
@@ -1577,7 +1578,6 @@ static struct i2c_driver driver = {
static
struct
i2c_client
client_template
=
{
.
name
=
"(unset)"
,
.
flags
=
I2C_CLIENT_ALLOW_USE
,
.
driver
=
&
driver
,
};
...
...
drivers/media/video/ovcamchip/ovcamchip_core.c
浏览文件 @
0feb9bfc
...
...
@@ -410,11 +410,11 @@ static int ovcamchip_command(struct i2c_client *c, unsigned int cmd, void *arg)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"ovcamchip"
,
.
driver
=
{
.
name
=
"ovcamchip"
,
},
.
id
=
I2C_DRIVERID_OVCAMCHIP
,
.
class
=
I2C_CLASS_CAM_DIGITAL
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
ovcamchip_attach
,
.
detach_client
=
ovcamchip_detach
,
.
command
=
ovcamchip_command
,
...
...
drivers/media/video/saa5246a.c
浏览文件 @
0feb9bfc
...
...
@@ -151,25 +151,18 @@ static int saa5246a_detach(struct i2c_client *client)
return
0
;
}
static
int
saa5246a_command
(
struct
i2c_client
*
device
,
unsigned
int
cmd
,
void
*
arg
)
{
return
-
EINVAL
;
}
/*
* I2C interfaces
*/
static
struct
i2c_driver
i2c_driver_videotext
=
{
.
owner
=
THIS_MODULE
,
.
name
=
IF_NAME
,
/* name */
.
driver
=
{
.
name
=
IF_NAME
,
/* name */
},
.
id
=
I2C_DRIVERID_SAA5249
,
/* in i2c.h */
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa5246a_probe
,
.
detach_client
=
saa5246a_detach
,
.
command
=
saa5246a_command
};
static
struct
i2c_client
client_template
=
{
...
...
drivers/media/video/saa5249.c
浏览文件 @
0feb9bfc
...
...
@@ -226,23 +226,16 @@ static int saa5249_detach(struct i2c_client *client)
return
0
;
}
static
int
saa5249_command
(
struct
i2c_client
*
device
,
unsigned
int
cmd
,
void
*
arg
)
{
return
-
EINVAL
;
}
/* new I2C driver support */
static
struct
i2c_driver
i2c_driver_videotext
=
{
.
owner
=
THIS_MODULE
,
.
name
=
IF_NAME
,
/* name */
.
driver
=
{
.
name
=
IF_NAME
,
/* name */
},
.
id
=
I2C_DRIVERID_SAA5249
,
/* in i2c.h */
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa5249_probe
,
.
detach_client
=
saa5249_detach
,
.
command
=
saa5249_command
};
static
struct
i2c_client
client_template
=
{
...
...
drivers/media/video/saa6588.c
浏览文件 @
0feb9bfc
...
...
@@ -495,10 +495,10 @@ static int saa6588_command(struct i2c_client *client, unsigned int cmd,
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"i2c saa6588 driver"
,
.
driver
=
{
.
name
=
"i2c saa6588 driver"
,
},
.
id
=
-
1
,
/* FIXME */
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa6588_probe
,
.
detach_client
=
saa6588_detach
,
.
command
=
saa6588_command
,
...
...
@@ -506,7 +506,6 @@ static struct i2c_driver driver = {
static
struct
i2c_client
client_template
=
{
.
name
=
"saa6588"
,
.
flags
=
I2C_CLIENT_ALLOW_USE
,
.
driver
=
&
driver
,
};
...
...
drivers/media/video/saa7110.c
浏览文件 @
0feb9bfc
...
...
@@ -501,7 +501,6 @@ saa7110_detect_client (struct i2c_adapter *adapter,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_saa7110
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
strlcpy
(
I2C_NAME
(
client
),
"saa7110"
,
sizeof
(
I2C_NAME
(
client
)));
decoder
=
kmalloc
(
sizeof
(
struct
saa7110
),
GFP_KERNEL
);
...
...
@@ -587,11 +586,11 @@ saa7110_detach_client (struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_saa7110
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"saa7110"
,
.
driver
=
{
.
name
=
"saa7110"
,
},
.
id
=
I2C_DRIVERID_SAA7110
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa7110_attach_adapter
,
.
detach_client
=
saa7110_detach_client
,
...
...
drivers/media/video/saa7111.c
浏览文件 @
0feb9bfc
...
...
@@ -518,7 +518,6 @@ saa7111_detect_client (struct i2c_adapter *adapter,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_saa7111
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
strlcpy
(
I2C_NAME
(
client
),
"saa7111"
,
sizeof
(
I2C_NAME
(
client
)));
decoder
=
kmalloc
(
sizeof
(
struct
saa7111
),
GFP_KERNEL
);
...
...
@@ -590,11 +589,11 @@ saa7111_detach_client (struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_saa7111
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"saa7111"
,
.
driver
=
{
.
name
=
"saa7111"
,
},
.
id
=
I2C_DRIVERID_SAA7111A
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa7111_attach_adapter
,
.
detach_client
=
saa7111_detach_client
,
...
...
drivers/media/video/saa7114.c
浏览文件 @
0feb9bfc
...
...
@@ -859,7 +859,6 @@ saa7114_detect_client (struct i2c_adapter *adapter,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_saa7114
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
strlcpy
(
I2C_NAME
(
client
),
"saa7114"
,
sizeof
(
I2C_NAME
(
client
)));
decoder
=
kmalloc
(
sizeof
(
struct
saa7114
),
GFP_KERNEL
);
...
...
@@ -1204,11 +1203,11 @@ saa7114_detach_client (struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_saa7114
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"saa7114"
,
.
driver
=
{
.
name
=
"saa7114"
,
},
.
id
=
I2C_DRIVERID_SAA7114
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa7114_attach_adapter
,
.
detach_client
=
saa7114_detach_client
,
...
...
drivers/media/video/saa7115.c
浏览文件 @
0feb9bfc
...
...
@@ -52,15 +52,16 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define saa7115_dbg(fmt,arg...) \
do { \
if (debug) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
#define saa7115_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define saa7115_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
static
unsigned
short
normal_i2c
[]
=
{
0x42
>>
1
,
0x40
>>
1
,
I2C_CLIENT_END
};
...
...
@@ -1270,7 +1271,6 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_saa7115
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
snprintf
(
client
->
name
,
sizeof
(
client
->
name
)
-
1
,
"saa7115"
);
saa7115_dbg
(
"detecting saa7115 client on address 0x%x
\n
"
,
address
<<
1
);
...
...
@@ -1354,13 +1354,13 @@ static int saa7115_detach(struct i2c_client *client)
/* i2c implementation */
static
struct
i2c_driver
i2c_driver_saa7115
=
{
.
name
=
"saa7115"
,
.
driver
=
{
.
name
=
"saa7115"
,
},
.
id
=
I2C_DRIVERID_SAA711X
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa7115_probe
,
.
detach_client
=
saa7115_detach
,
.
command
=
saa7115_command
,
.
owner
=
THIS_MODULE
,
};
...
...
drivers/media/video/saa711x.c
浏览文件 @
0feb9bfc
...
...
@@ -494,7 +494,6 @@ saa711x_detect_client (struct i2c_adapter *adapter,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_saa711x
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
strlcpy
(
I2C_NAME
(
client
),
"saa711x"
,
sizeof
(
I2C_NAME
(
client
)));
decoder
=
kmalloc
(
sizeof
(
struct
saa711x
),
GFP_KERNEL
);
if
(
decoder
==
NULL
)
{
...
...
@@ -565,11 +564,11 @@ saa711x_detach_client (struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_saa711x
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"saa711x"
,
.
driver
=
{
.
name
=
"saa711x"
,
},
.
id
=
I2C_DRIVERID_SAA711X
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa711x_attach_adapter
,
.
detach_client
=
saa711x_detach_client
,
...
...
drivers/media/video/saa7127.c
浏览文件 @
0feb9bfc
...
...
@@ -69,7 +69,8 @@ MODULE_PARM_DESC(test_image, "test_image (0-1)");
#define saa7127_dbg(fmt, arg...) \
do { \
if (debug >= 1) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
...
...
@@ -77,15 +78,16 @@ MODULE_PARM_DESC(test_image, "test_image (0-1)");
#define saa7127_dbg_highvol(fmt, arg...) \
do { \
if (debug == 2) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
#define saa7127_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define saa7127_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->
driver.
name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
static
unsigned
short
normal_i2c
[]
=
{
0x88
>>
1
,
I2C_CLIENT_END
};
...
...
@@ -719,7 +721,6 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_saa7127
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
snprintf
(
client
->
name
,
sizeof
(
client
->
name
)
-
1
,
"saa7127"
);
saa7127_dbg
(
"detecting saa7127 client on address 0x%x
\n
"
,
address
<<
1
);
...
...
@@ -819,13 +820,13 @@ static int saa7127_detach(struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_saa7127
=
{
.
name
=
"saa7127"
,
.
driver
=
{
.
name
=
"saa7127"
,
},
.
id
=
I2C_DRIVERID_SAA7127
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa7127_probe
,
.
detach_client
=
saa7127_detach
,
.
command
=
saa7127_command
,
.
owner
=
THIS_MODULE
,
};
...
...
drivers/media/video/saa7134/saa6752hs.c
浏览文件 @
0feb9bfc
...
...
@@ -597,10 +597,10 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"i2c saa6752hs MPEG encoder"
,
.
driver
=
{
.
name
=
"i2c saa6752hs MPEG encoder"
,
},
.
id
=
I2C_DRIVERID_SAA6752HS
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa6752hs_probe
,
.
detach_client
=
saa6752hs_detach
,
.
command
=
saa6752hs_command
,
...
...
@@ -609,7 +609,6 @@ static struct i2c_driver driver = {
static
struct
i2c_client
client_template
=
{
.
name
=
"saa6752hs"
,
.
flags
=
I2C_CLIENT_ALLOW_USE
,
.
driver
=
&
driver
,
};
...
...
drivers/media/video/saa7134/saa7134-i2c.c
浏览文件 @
0feb9bfc
...
...
@@ -333,7 +333,7 @@ static int attach_inform(struct i2c_client *client)
struct
tuner_setup
tun_setup
;
d1printk
(
"%s i2c attach [addr=0x%x,client=%s]
\n
"
,
client
->
driver
->
name
,
client
->
addr
,
client
->
name
);
client
->
driver
->
driver
.
name
,
client
->
addr
,
client
->
name
);
/* Am I an i2c remote control? */
...
...
@@ -343,7 +343,7 @@ static int attach_inform(struct i2c_client *client)
{
struct
IR_i2c
*
ir
=
i2c_get_clientdata
(
client
);
d1printk
(
"%s i2c IR detected (%s).
\n
"
,
client
->
driver
->
name
,
ir
->
phys
);
client
->
driver
->
driver
.
name
,
ir
->
phys
);
saa7134_set_i2c_ir
(
dev
,
ir
);
break
;
}
...
...
drivers/media/video/saa7185.c
浏览文件 @
0feb9bfc
...
...
@@ -415,7 +415,6 @@ saa7185_detect_client (struct i2c_adapter *adapter,
client
->
addr
=
address
;
client
->
adapter
=
adapter
;
client
->
driver
=
&
i2c_driver_saa7185
;
client
->
flags
=
I2C_CLIENT_ALLOW_USE
;
strlcpy
(
I2C_NAME
(
client
),
"saa7185"
,
sizeof
(
I2C_NAME
(
client
)));
encoder
=
kmalloc
(
sizeof
(
struct
saa7185
),
GFP_KERNEL
);
...
...
@@ -487,11 +486,11 @@ saa7185_detach_client (struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
i2c_driver_saa7185
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"saa7185"
,
/* name */
.
driver
=
{
.
name
=
"saa7185"
,
/* name */
},
.
id
=
I2C_DRIVERID_SAA7185B
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa7185_attach_adapter
,
.
detach_client
=
saa7185_detach_client
,
...
...
drivers/media/video/saa7191.c
浏览文件 @
0feb9bfc
...
...
@@ -788,10 +788,10 @@ static int saa7191_command(struct i2c_client *client, unsigned int cmd,
}
static
struct
i2c_driver
i2c_driver_saa7191
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"saa7191"
,
.
driver
=
{
.
name
=
"saa7191"
,
},
.
id
=
I2C_DRIVERID_SAA7191
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa7191_probe
,
.
detach_client
=
saa7191_detach
,
.
command
=
saa7191_command
...
...
drivers/media/video/tda7432.c
浏览文件 @
0feb9bfc
...
...
@@ -501,10 +501,10 @@ static int tda7432_command(struct i2c_client *client,
}
static
struct
i2c_driver
driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"i2c tda7432 driver"
,
.
driver
=
{
.
name
=
"i2c tda7432 driver"
,
},
.
id
=
I2C_DRIVERID_TDA7432
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
tda7432_probe
,
.
detach_client
=
tda7432_detach
,
.
command
=
tda7432_command
,
...
...
drivers/media/video/tda9840.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tda9875.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tda9887.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tea6415c.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tea6420.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tuner-3036.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tuner-core.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tvaudio.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tveeprom.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tvmixer.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/tvp5150.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/vpx3220.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/wm8775.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/media/video/zoran_driver.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/usb/media/w9968cf.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
drivers/video/matrox/matroxfb_maven.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
include/linux/hwmon-vid.h
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
include/linux/i2c-id.h
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
include/linux/i2c.h
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
include/linux/pci_ids.h
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
include/media/tuner.h
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
sound/oss/dmasound/dac3550a.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
sound/oss/dmasound/tas_common.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
sound/ppc/keywest.c
浏览文件 @
0feb9bfc
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录