diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 18:25:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 18:25:08 -0500 |
commit | 0feb9bfcfa3f9bf67a4a1e3f2608700ad73f92ed (patch) | |
tree | 22c71657387b42787bc070502899a881ed909f39 /Documentation | |
parent | d8d8f6a4fd635dcc9e4f946394c1fbde85eeab66 (diff) | |
parent | ccf18968b1bbc2fb117190a1984ac2a826dac228 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 9 | ||||
-rw-r--r-- | Documentation/hwmon/w83627hf | 19 | ||||
-rw-r--r-- | Documentation/i2c/busses/i2c-nforce2 | 3 | ||||
-rw-r--r-- | Documentation/i2c/busses/i2c-parport | 1 | ||||
-rw-r--r-- | Documentation/i2c/porting-clients | 90 | ||||
-rw-r--r-- | Documentation/i2c/writing-clients | 20 |
6 files changed, 73 insertions, 69 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 8ae8dad8e150..9474501dd6cc 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -71,15 +71,6 @@ Who: Mauro Carvalho Chehab <mchehab@brturbo.com.br> | |||
71 | 71 | ||
72 | --------------------------- | 72 | --------------------------- |
73 | 73 | ||
74 | What: i2c sysfs name change: in1_ref, vid deprecated in favour of cpu0_vid | ||
75 | When: November 2005 | ||
76 | Files: drivers/i2c/chips/adm1025.c, drivers/i2c/chips/adm1026.c | ||
77 | Why: Match the other drivers' name for the same function, duplicate names | ||
78 | will be available until removal of old names. | ||
79 | Who: Grant Coady <gcoady@gmail.com> | ||
80 | |||
81 | --------------------------- | ||
82 | |||
83 | What: remove EXPORT_SYMBOL(panic_timeout) | 74 | What: remove EXPORT_SYMBOL(panic_timeout) |
84 | When: April 2006 | 75 | When: April 2006 |
85 | Files: kernel/panic.c | 76 | Files: kernel/panic.c |
diff --git a/Documentation/hwmon/w83627hf b/Documentation/hwmon/w83627hf index 78f37c2d602e..5d23776e9907 100644 --- a/Documentation/hwmon/w83627hf +++ b/Documentation/hwmon/w83627hf | |||
@@ -54,13 +54,16 @@ If you really want i2c accesses for these Super I/O chips, | |||
54 | use the w83781d driver. However this is not the preferred method | 54 | use the w83781d driver. However this is not the preferred method |
55 | now that this ISA driver has been developed. | 55 | now that this ISA driver has been developed. |
56 | 56 | ||
57 | Technically, the w83627thf does not support a VID reading. However, it's | 57 | The w83627_HF_ uses pins 110-106 as VID0-VID4. The w83627_THF_ uses the |
58 | possible or even likely that your mainboard maker has routed these signals | 58 | same pins as GPIO[0:4]. Technically, the w83627_THF_ does not support a |
59 | to a specific set of general purpose IO pins (the Asus P4C800-E is one such | 59 | VID reading. However the two chips have the identical 128 pin package. So, |
60 | board). The w83627thf driver now interprets these as VID. If the VID on | 60 | it is possible or even likely for a w83627thf to have the VID signals routed |
61 | your board doesn't work, first see doc/vid in the lm_sensors package. If | 61 | to these pins despite their not being labeled for that purpose. Therefore, |
62 | that still doesn't help, email us at lm-sensors@lm-sensors.org. | 62 | the w83627thf driver interprets these as VID. If the VID on your board |
63 | doesn't work, first see doc/vid in the lm_sensors package[1]. If that still | ||
64 | doesn't help, you may just ignore the bogus VID reading with no harm done. | ||
63 | 65 | ||
64 | For further information on this driver see the w83781d driver | 66 | For further information on this driver see the w83781d driver documentation. |
65 | documentation. | 67 | |
68 | [1] http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/lm_sensors2/doc/vid | ||
66 | 69 | ||
diff --git a/Documentation/i2c/busses/i2c-nforce2 b/Documentation/i2c/busses/i2c-nforce2 index e379e182e64f..d751282d9b2a 100644 --- a/Documentation/i2c/busses/i2c-nforce2 +++ b/Documentation/i2c/busses/i2c-nforce2 | |||
@@ -5,7 +5,8 @@ Supported adapters: | |||
5 | * nForce2 Ultra 400 MCP 10de:0084 | 5 | * nForce2 Ultra 400 MCP 10de:0084 |
6 | * nForce3 Pro150 MCP 10de:00D4 | 6 | * nForce3 Pro150 MCP 10de:00D4 |
7 | * nForce3 250Gb MCP 10de:00E4 | 7 | * nForce3 250Gb MCP 10de:00E4 |
8 | * nForce4 MCP 10de:0052 | 8 | * nForce4 MCP 10de:0052 |
9 | * nForce4 MCP-04 10de:0034 | ||
9 | 10 | ||
10 | Datasheet: not publically available, but seems to be similar to the | 11 | Datasheet: not publically available, but seems to be similar to the |
11 | AMD-8111 SMBus 2.0 adapter. | 12 | AMD-8111 SMBus 2.0 adapter. |
diff --git a/Documentation/i2c/busses/i2c-parport b/Documentation/i2c/busses/i2c-parport index 9f1d0082da18..d9f23c0763f1 100644 --- a/Documentation/i2c/busses/i2c-parport +++ b/Documentation/i2c/busses/i2c-parport | |||
@@ -17,6 +17,7 @@ It currently supports the following devices: | |||
17 | * Velleman K8000 adapter | 17 | * Velleman K8000 adapter |
18 | * ELV adapter | 18 | * ELV adapter |
19 | * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032) | 19 | * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032) |
20 | * Barco LPT->DVI (K5800236) adapter | ||
20 | 21 | ||
21 | These devices use different pinout configurations, so you have to tell | 22 | These devices use different pinout configurations, so you have to tell |
22 | the driver what you have, using the type module parameter. There is no | 23 | the driver what you have, using the type module parameter. There is no |
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index 184fac2377aa..f03c2a02f806 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients | |||
@@ -1,10 +1,13 @@ | |||
1 | Revision 5, 2005-07-29 | 1 | Revision 6, 2005-11-20 |
2 | Jean Delvare <khali@linux-fr.org> | 2 | Jean Delvare <khali@linux-fr.org> |
3 | Greg KH <greg@kroah.com> | 3 | Greg KH <greg@kroah.com> |
4 | 4 | ||
5 | This is a guide on how to convert I2C chip drivers from Linux 2.4 to | 5 | This is a guide on how to convert I2C chip drivers from Linux 2.4 to |
6 | Linux 2.6. I have been using existing drivers (lm75, lm78) as examples. | 6 | Linux 2.6. I have been using existing drivers (lm75, lm78) as examples. |
7 | Then I converted a driver myself (lm83) and updated this document. | 7 | Then I converted a driver myself (lm83) and updated this document. |
8 | Note that this guide is strongly oriented towards hardware monitoring | ||
9 | drivers. Many points are still valid for other type of drivers, but | ||
10 | others may be irrelevant. | ||
8 | 11 | ||
9 | There are two sets of points below. The first set concerns technical | 12 | There are two sets of points below. The first set concerns technical |
10 | changes. The second set concerns coding policy. Both are mandatory. | 13 | changes. The second set concerns coding policy. Both are mandatory. |
@@ -22,16 +25,20 @@ Technical changes: | |||
22 | #include <linux/module.h> | 25 | #include <linux/module.h> |
23 | #include <linux/init.h> | 26 | #include <linux/init.h> |
24 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/jiffies.h> | ||
25 | #include <linux/i2c.h> | 29 | #include <linux/i2c.h> |
30 | #include <linux/i2c-isa.h> /* for ISA drivers */ | ||
26 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ | 31 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ |
27 | #include <linux/hwmon-sysfs.h> | 32 | #include <linux/hwmon-sysfs.h> |
28 | #include <linux/hwmon-vid.h> /* if you need VRM support */ | 33 | #include <linux/hwmon-vid.h> /* if you need VRM support */ |
34 | #include <linux/err.h> /* for class registration */ | ||
29 | #include <asm/io.h> /* if you have I/O operations */ | 35 | #include <asm/io.h> /* if you have I/O operations */ |
30 | Please respect this inclusion order. Some extra headers may be | 36 | Please respect this inclusion order. Some extra headers may be |
31 | required for a given driver (e.g. "lm75.h"). | 37 | required for a given driver (e.g. "lm75.h"). |
32 | 38 | ||
33 | * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses | 39 | * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses |
34 | are no more handled by the i2c core. | 40 | are no more handled by the i2c core. Address ranges are no more |
41 | supported either, define each individual address separately. | ||
35 | SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>. | 42 | SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>. |
36 | 43 | ||
37 | * [Client data] Get rid of sysctl_id. Try using standard names for | 44 | * [Client data] Get rid of sysctl_id. Try using standard names for |
@@ -48,23 +55,23 @@ Technical changes: | |||
48 | int kind); | 55 | int kind); |
49 | static void lm75_init_client(struct i2c_client *client); | 56 | static void lm75_init_client(struct i2c_client *client); |
50 | static int lm75_detach_client(struct i2c_client *client); | 57 | static int lm75_detach_client(struct i2c_client *client); |
51 | static void lm75_update_client(struct i2c_client *client); | 58 | static struct lm75_data lm75_update_device(struct device *dev); |
52 | 59 | ||
53 | * [Sysctl] All sysctl stuff is of course gone (defines, ctl_table | 60 | * [Sysctl] All sysctl stuff is of course gone (defines, ctl_table |
54 | and functions). Instead, you have to define show and set functions for | 61 | and functions). Instead, you have to define show and set functions for |
55 | each sysfs file. Only define set for writable values. Take a look at an | 62 | each sysfs file. Only define set for writable values. Take a look at an |
56 | existing 2.6 driver for details (lm78 for example). Don't forget | 63 | existing 2.6 driver for details (it87 for example). Don't forget |
57 | to define the attributes for each file (this is that step that | 64 | to define the attributes for each file (this is that step that |
58 | links callback functions). Use the file names specified in | 65 | links callback functions). Use the file names specified in |
59 | Documentation/i2c/sysfs-interface for the individual files. Also | 66 | Documentation/hwmon/sysfs-interface for the individual files. Also |
60 | convert the units these files read and write to the specified ones. | 67 | convert the units these files read and write to the specified ones. |
61 | If you need to add a new type of file, please discuss it on the | 68 | If you need to add a new type of file, please discuss it on the |
62 | sensors mailing list <lm-sensors@lm-sensors.org> by providing a | 69 | sensors mailing list <lm-sensors@lm-sensors.org> by providing a |
63 | patch to the Documentation/i2c/sysfs-interface file. | 70 | patch to the Documentation/hwmon/sysfs-interface file. |
64 | 71 | ||
65 | * [Attach] For I2C drivers, the attach function should make sure | 72 | * [Attach] For I2C drivers, the attach function should make sure |
66 | that the adapter's class has I2C_CLASS_HWMON, using the | 73 | that the adapter's class has I2C_CLASS_HWMON (or whatever class is |
67 | following construct: | 74 | suitable for your driver), using the following construct: |
68 | if (!(adapter->class & I2C_CLASS_HWMON)) | 75 | if (!(adapter->class & I2C_CLASS_HWMON)) |
69 | return 0; | 76 | return 0; |
70 | ISA-only drivers of course don't need this. | 77 | ISA-only drivers of course don't need this. |
@@ -72,63 +79,72 @@ Technical changes: | |||
72 | 79 | ||
73 | * [Detect] As mentioned earlier, the flags parameter is gone. | 80 | * [Detect] As mentioned earlier, the flags parameter is gone. |
74 | The type_name and client_name strings are replaced by a single | 81 | The type_name and client_name strings are replaced by a single |
75 | name string, which will be filled with a lowercase, short string | 82 | name string, which will be filled with a lowercase, short string. |
76 | (typically the driver name, e.g. "lm75"). | ||
77 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's | 83 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's |
78 | useless. Same for isa-only drivers, as the test would always be | 84 | useless. Same for isa-only drivers, as the test would always be |
79 | true. Only hybrid drivers (which are quite rare) still need it. | 85 | true. Only hybrid drivers (which are quite rare) still need it. |
80 | The errorN labels are reduced to the number needed. If that number | 86 | The labels used for error paths are reduced to the number needed. |
81 | is 2 (i2c-only drivers), it is advised that the labels are named | 87 | It is advised that the labels are given descriptive names such as |
82 | exit and exit_free. For i2c+isa drivers, labels should be named | 88 | exit and exit_free. Don't forget to properly set err before |
83 | ERROR0, ERROR1 and ERROR2. Don't forget to properly set err before | ||
84 | jumping to error labels. By the way, labels should be left-aligned. | 89 | jumping to error labels. By the way, labels should be left-aligned. |
85 | Use kzalloc instead of kmalloc. | 90 | Use kzalloc instead of kmalloc. |
86 | Use i2c_set_clientdata to set the client data (as opposed to | 91 | Use i2c_set_clientdata to set the client data (as opposed to |
87 | a direct access to client->data). | 92 | a direct access to client->data). |
88 | Use strlcpy instead of strcpy to copy the client name. | 93 | Use strlcpy instead of strcpy or snprintf to copy the client name. |
89 | Replace the sysctl directory registration by calls to | 94 | Replace the sysctl directory registration by calls to |
90 | device_create_file. Move the driver initialization before any | 95 | device_create_file. Move the driver initialization before any |
91 | sysfs file creation. | 96 | sysfs file creation. |
97 | Register the client with the hwmon class (using hwmon_device_register) | ||
98 | if applicable. | ||
92 | Drop client->id. | 99 | Drop client->id. |
93 | Drop any 24RF08 corruption prevention you find, as this is now done | 100 | Drop any 24RF08 corruption prevention you find, as this is now done |
94 | at the i2c-core level, and doing it twice voids it. | 101 | at the i2c-core level, and doing it twice voids it. |
102 | Don't add I2C_CLIENT_ALLOW_USE to client->flags, it's the default now. | ||
95 | 103 | ||
96 | * [Init] Limits must not be set by the driver (can be done later in | 104 | * [Init] Limits must not be set by the driver (can be done later in |
97 | user-space). Chip should not be reset default (although a module | 105 | user-space). Chip should not be reset default (although a module |
98 | parameter may be used to force is), and initialization should be | 106 | parameter may be used to force it), and initialization should be |
99 | limited to the strictly necessary steps. | 107 | limited to the strictly necessary steps. |
100 | 108 | ||
101 | * [Detach] Get rid of data, remove the call to | 109 | * [Detach] Remove the call to i2c_deregister_entry. Do not log an |
102 | i2c_deregister_entry. Do not log an error message if | 110 | error message if i2c_detach_client fails, as i2c-core will now do |
103 | i2c_detach_client fails, as i2c-core will now do it for you. | 111 | it for you. |
104 | 112 | Unregister from the hwmon class if applicable. | |
105 | * [Update] Don't access client->data directly, use | 113 | |
106 | i2c_get_clientdata(client) instead. | 114 | * [Update] The function prototype changed, it is now |
107 | 115 | passed a device structure, which you have to convert to a client | |
108 | * [Interface] Init function should not print anything. Make sure | 116 | using to_i2c_client(dev). The update function should return a |
109 | there is a MODULE_LICENSE() line, at the bottom of the file | 117 | pointer to the client data. |
110 | (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this order). | 118 | Don't access client->data directly, use i2c_get_clientdata(client) |
119 | instead. | ||
120 | Use time_after() instead of direct jiffies comparison. | ||
121 | |||
122 | * [Interface] Make sure there is a MODULE_LICENSE() line, at the bottom | ||
123 | of the file (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this | ||
124 | order). | ||
125 | |||
126 | * [Driver] The flags field of the i2c_driver structure is gone. | ||
127 | I2C_DF_NOTIFY is now the default behavior. | ||
128 | The i2c_driver structure has a driver member, which is itself a | ||
129 | structure, those name member should be initialized to a driver name | ||
130 | string. i2c_driver itself has no name member anymore. | ||
111 | 131 | ||
112 | Coding policy: | 132 | Coding policy: |
113 | 133 | ||
114 | * [Copyright] Use (C), not (c), for copyright. | 134 | * [Copyright] Use (C), not (c), for copyright. |
115 | 135 | ||
116 | * [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you | 136 | * [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you |
117 | can. Calls to printk/pr_debug for debugging purposes are replaced | 137 | can. Calls to printk for debugging purposes are replaced by calls to |
118 | by calls to dev_dbg. Here is an example on how to call it (taken | 138 | dev_dbg where possible, else to pr_debug. Here is an example of how |
119 | from lm75_detect): | 139 | to call it (taken from lm75_detect): |
120 | dev_dbg(&client->dev, "Starting lm75 update\n"); | 140 | dev_dbg(&client->dev, "Starting lm75 update\n"); |
121 | Replace other printk calls with the dev_info, dev_err or dev_warn | 141 | Replace other printk calls with the dev_info, dev_err or dev_warn |
122 | function, as appropriate. | 142 | function, as appropriate. |
123 | 143 | ||
124 | * [Constants] Constants defines (registers, conversions, initial | 144 | * [Constants] Constants defines (registers, conversions) should be |
125 | values) should be aligned. This greatly improves readability. | 145 | aligned. This greatly improves readability. |
126 | Same goes for variables declarations. Alignments are achieved by the | 146 | Alignments are achieved by the means of tabs, not spaces. Remember |
127 | means of tabs, not spaces. Remember that tabs are set to 8 in the | 147 | that tabs are set to 8 in the Linux kernel code. |
128 | Linux kernel code. | ||
129 | |||
130 | * [Structure definition] The name field should be standardized. All | ||
131 | lowercase and as simple as the driver name itself (e.g. "lm75"). | ||
132 | 148 | ||
133 | * [Layout] Avoid extra empty lines between comments and what they | 149 | * [Layout] Avoid extra empty lines between comments and what they |
134 | comment. Respect the coding style (see Documentation/CodingStyle), | 150 | comment. Respect the coding style (see Documentation/CodingStyle), |
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index d19993cc0604..3a057c8e5507 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -25,9 +25,9 @@ routines, a client structure specific information like the actual I2C | |||
25 | address. | 25 | address. |
26 | 26 | ||
27 | static struct i2c_driver foo_driver = { | 27 | static struct i2c_driver foo_driver = { |
28 | .owner = THIS_MODULE, | 28 | .driver = { |
29 | .name = "Foo version 2.3 driver", | 29 | .name = "foo", |
30 | .flags = I2C_DF_NOTIFY, | 30 | }, |
31 | .attach_adapter = &foo_attach_adapter, | 31 | .attach_adapter = &foo_attach_adapter, |
32 | .detach_client = &foo_detach_client, | 32 | .detach_client = &foo_detach_client, |
33 | .command = &foo_command /* may be NULL */ | 33 | .command = &foo_command /* may be NULL */ |
@@ -36,10 +36,6 @@ static struct i2c_driver foo_driver = { | |||
36 | The name field must match the driver name, including the case. It must not | 36 | The name field must match the driver name, including the case. It must not |
37 | contain spaces, and may be up to 31 characters long. | 37 | contain spaces, and may be up to 31 characters long. |
38 | 38 | ||
39 | Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This | ||
40 | means that your driver will be notified when new adapters are found. | ||
41 | This is almost always what you want. | ||
42 | |||
43 | All other fields are for call-back functions which will be explained | 39 | All other fields are for call-back functions which will be explained |
44 | below. | 40 | below. |
45 | 41 | ||
@@ -496,17 +492,13 @@ Note that some functions are marked by `__init', and some data structures | |||
496 | by `__init_data'. Hose functions and structures can be removed after | 492 | by `__init_data'. Hose functions and structures can be removed after |
497 | kernel booting (or module loading) is completed. | 493 | kernel booting (or module loading) is completed. |
498 | 494 | ||
495 | |||
499 | Command function | 496 | Command function |
500 | ================ | 497 | ================ |
501 | 498 | ||
502 | A generic ioctl-like function call back is supported. You will seldom | 499 | A generic ioctl-like function call back is supported. You will seldom |
503 | need this. You may even set it to NULL. | 500 | need this, and its use is deprecated anyway, so newer design should not |
504 | 501 | use it. Set it to NULL. | |
505 | /* No commands defined */ | ||
506 | int foo_command(struct i2c_client *client, unsigned int cmd, void *arg) | ||
507 | { | ||
508 | return 0; | ||
509 | } | ||
510 | 502 | ||
511 | 503 | ||
512 | Sending and receiving | 504 | Sending and receiving |