diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/dontdiff | 4 | ||||
-rw-r--r-- | Documentation/driver-model/devres.txt | 2 | ||||
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 45 | ||||
-rw-r--r-- | Documentation/i2c/busses/i2c-nforce2 | 2 | ||||
-rw-r--r-- | Documentation/i2c/porting-clients | 18 | ||||
-rw-r--r-- | Documentation/i2c/summary | 29 | ||||
-rw-r--r-- | Documentation/i2c/writing-clients | 415 | ||||
-rw-r--r-- | Documentation/i386/boot.txt | 23 | ||||
-rw-r--r-- | Documentation/input/input-programming.txt | 125 | ||||
-rw-r--r-- | Documentation/kernel-parameters.txt | 21 | ||||
-rw-r--r-- | Documentation/pci.txt | 12 | ||||
-rw-r--r-- | Documentation/power/pci.txt | 2 | ||||
-rw-r--r-- | Documentation/scsi/aacraid.txt | 7 | ||||
-rw-r--r-- | Documentation/scsi/ncr53c8xx.txt | 5 | ||||
-rw-r--r-- | Documentation/spi/pxa2xx | 2 | ||||
-rw-r--r-- | Documentation/usb/usb-serial.txt | 2 | ||||
-rw-r--r-- | Documentation/x86_64/boot-options.txt | 14 | ||||
-rw-r--r-- | Documentation/x86_64/fake-numa-for-cpusets | 66 | ||||
-rw-r--r-- | Documentation/x86_64/machinecheck | 7 |
19 files changed, 407 insertions, 394 deletions
diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 63c2d0c55aa2..64e9f6c4826b 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff | |||
@@ -55,8 +55,8 @@ aic7*seq.h* | |||
55 | aicasm | 55 | aicasm |
56 | aicdb.h* | 56 | aicdb.h* |
57 | asm | 57 | asm |
58 | asm-offsets.* | 58 | asm-offsets.h |
59 | asm_offsets.* | 59 | asm_offsets.h |
60 | autoconf.h* | 60 | autoconf.h* |
61 | bbootsect | 61 | bbootsect |
62 | bin2c | 62 | bin2c |
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt index 5163b85308f5..6c8d8f27db34 100644 --- a/Documentation/driver-model/devres.txt +++ b/Documentation/driver-model/devres.txt | |||
@@ -182,7 +182,7 @@ For example, you can do something like the following. | |||
182 | 182 | ||
183 | ... | 183 | ... |
184 | 184 | ||
185 | devres_close_group(dev, my_midlayer_something); | 185 | devres_close_group(dev, my_midlayer_create_something); |
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
188 | 188 | ||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 5c88ba1ea262..5f96cb33743e 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -117,13 +117,6 @@ Who: Adrian Bunk <bunk@stusta.de> | |||
117 | 117 | ||
118 | --------------------------- | 118 | --------------------------- |
119 | 119 | ||
120 | What: pci_module_init(driver) | ||
121 | When: January 2007 | ||
122 | Why: Is replaced by pci_register_driver(pci_driver). | ||
123 | Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@suse.de> | ||
124 | |||
125 | --------------------------- | ||
126 | |||
127 | What: Usage of invalid timevals in setitimer | 120 | What: Usage of invalid timevals in setitimer |
128 | When: March 2007 | 121 | When: March 2007 |
129 | Why: POSIX requires to validate timevals in the setitimer call. This | 122 | Why: POSIX requires to validate timevals in the setitimer call. This |
@@ -190,18 +183,10 @@ Who: Jean Delvare <khali@linux-fr.org> | |||
190 | 183 | ||
191 | --------------------------- | 184 | --------------------------- |
192 | 185 | ||
193 | What: i2c_adapter.dev | 186 | What: i2c_adapter.list |
194 | i2c_adapter.list | ||
195 | When: July 2007 | 187 | When: July 2007 |
196 | Why: Superfluous, given i2c_adapter.class_dev: | 188 | Why: Superfluous, this list duplicates the one maintained by the driver |
197 | * The "dev" was a stand-in for the physical device node that legacy | 189 | core. |
198 | drivers would not have; but now it's almost always present. Any | ||
199 | remaining legacy drivers must upgrade (they now trigger warnings). | ||
200 | * The "list" duplicates class device children. | ||
201 | The delay in removing this is so upgraded lm_sensors and libsensors | ||
202 | can get deployed. (Removal causes minor changes in the sysfs layout, | ||
203 | notably the location of the adapter type name and parenting the i2c | ||
204 | client hardware directly from their controller.) | ||
205 | Who: Jean Delvare <khali@linux-fr.org>, | 190 | Who: Jean Delvare <khali@linux-fr.org>, |
206 | David Brownell <dbrownell@users.sourceforge.net> | 191 | David Brownell <dbrownell@users.sourceforge.net> |
207 | 192 | ||
@@ -314,3 +299,27 @@ Why: Code was merged, then submitter immediately disappeared leaving | |||
314 | Who: David S. Miller <davem@davemloft.net> | 299 | Who: David S. Miller <davem@davemloft.net> |
315 | 300 | ||
316 | --------------------------- | 301 | --------------------------- |
302 | |||
303 | What: read_dev_chars(), read_conf_data{,_lpm}() (s390 common I/O layer) | ||
304 | When: December 2007 | ||
305 | Why: These functions are a leftover from 2.4 times. They have several | ||
306 | problems: | ||
307 | - Duplication of checks that are done in the device driver's | ||
308 | interrupt handler | ||
309 | - common I/O layer can't do device specific error recovery | ||
310 | - device driver can't be notified for conditions happening during | ||
311 | execution of the function | ||
312 | Device drivers should issue the read device characteristics and read | ||
313 | configuration data ccws and do the appropriate error handling | ||
314 | themselves. | ||
315 | Who: Cornelia Huck <cornelia.huck@de.ibm.com> | ||
316 | |||
317 | --------------------------- | ||
318 | |||
319 | What: i2c-ixp2000, i2c-ixp4xx and scx200_i2c drivers | ||
320 | When: September 2007 | ||
321 | Why: Obsolete. The new i2c-gpio driver replaces all hardware-specific | ||
322 | I2C-over-GPIO drivers. | ||
323 | Who: Jean Delvare <khali@linux-fr.org> | ||
324 | |||
325 | --------------------------- | ||
diff --git a/Documentation/i2c/busses/i2c-nforce2 b/Documentation/i2c/busses/i2c-nforce2 index 7f61fbc03f7f..fae3495bcbaf 100644 --- a/Documentation/i2c/busses/i2c-nforce2 +++ b/Documentation/i2c/busses/i2c-nforce2 | |||
@@ -9,6 +9,8 @@ Supported adapters: | |||
9 | * nForce4 MCP-04 10de:0034 | 9 | * nForce4 MCP-04 10de:0034 |
10 | * nForce4 MCP51 10de:0264 | 10 | * nForce4 MCP51 10de:0264 |
11 | * nForce4 MCP55 10de:0368 | 11 | * nForce4 MCP55 10de:0368 |
12 | * nForce4 MCP61 10de:03EB | ||
13 | * nForce4 MCP65 10de:0446 | ||
12 | 14 | ||
13 | Datasheet: not publicly available, but seems to be similar to the | 15 | Datasheet: not publicly available, but seems to be similar to the |
14 | AMD-8111 SMBus 2.0 adapter. | 16 | AMD-8111 SMBus 2.0 adapter. |
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index ca272b263a92..7bf82c08f6ca 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients | |||
@@ -1,4 +1,4 @@ | |||
1 | Revision 6, 2005-11-20 | 1 | Revision 7, 2007-04-19 |
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 | ||
@@ -20,6 +20,10 @@ yours for best results. | |||
20 | 20 | ||
21 | Technical changes: | 21 | Technical changes: |
22 | 22 | ||
23 | * [Driver type] Any driver that was relying on i2c-isa has to be | ||
24 | converted to a proper isa, platform or pci driver. This is not | ||
25 | covered by this guide. | ||
26 | |||
23 | * [Includes] Get rid of "version.h" and <linux/i2c-proc.h>. | 27 | * [Includes] Get rid of "version.h" and <linux/i2c-proc.h>. |
24 | Includes typically look like that: | 28 | Includes typically look like that: |
25 | #include <linux/module.h> | 29 | #include <linux/module.h> |
@@ -27,12 +31,10 @@ Technical changes: | |||
27 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
28 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
29 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
30 | #include <linux/i2c-isa.h> /* for ISA drivers */ | ||
31 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ | 34 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ |
32 | #include <linux/hwmon-sysfs.h> | 35 | #include <linux/hwmon-sysfs.h> |
33 | #include <linux/hwmon-vid.h> /* if you need VRM support */ | 36 | #include <linux/hwmon-vid.h> /* if you need VRM support */ |
34 | #include <linux/err.h> /* for class registration */ | 37 | #include <linux/err.h> /* for class registration */ |
35 | #include <asm/io.h> /* if you have I/O operations */ | ||
36 | Please respect this inclusion order. Some extra headers may be | 38 | Please respect this inclusion order. Some extra headers may be |
37 | required for a given driver (e.g. "lm75.h"). | 39 | required for a given driver (e.g. "lm75.h"). |
38 | 40 | ||
@@ -69,20 +71,16 @@ Technical changes: | |||
69 | sensors mailing list <lm-sensors@lm-sensors.org> by providing a | 71 | sensors mailing list <lm-sensors@lm-sensors.org> by providing a |
70 | patch to the Documentation/hwmon/sysfs-interface file. | 72 | patch to the Documentation/hwmon/sysfs-interface file. |
71 | 73 | ||
72 | * [Attach] For I2C drivers, the attach function should make sure | 74 | * [Attach] The attach function should make sure that the adapter's |
73 | that the adapter's class has I2C_CLASS_HWMON (or whatever class is | 75 | class has I2C_CLASS_HWMON (or whatever class is suitable for your |
74 | suitable for your driver), using the following construct: | 76 | driver), using the following construct: |
75 | if (!(adapter->class & I2C_CLASS_HWMON)) | 77 | if (!(adapter->class & I2C_CLASS_HWMON)) |
76 | return 0; | 78 | return 0; |
77 | ISA-only drivers of course don't need this. | ||
78 | Call i2c_probe() instead of i2c_detect(). | 79 | Call i2c_probe() instead of i2c_detect(). |
79 | 80 | ||
80 | * [Detect] As mentioned earlier, the flags parameter is gone. | 81 | * [Detect] As mentioned earlier, the flags parameter is gone. |
81 | The type_name and client_name strings are replaced by a single | 82 | The type_name and client_name strings are replaced by a single |
82 | name string, which will be filled with a lowercase, short string. | 83 | name string, which will be filled with a lowercase, short string. |
83 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's | ||
84 | useless. Same for isa-only drivers, as the test would always be | ||
85 | true. Only hybrid drivers (which are quite rare) still need it. | ||
86 | The labels used for error paths are reduced to the number needed. | 84 | The labels used for error paths are reduced to the number needed. |
87 | It is advised that the labels are given descriptive names such as | 85 | It is advised that the labels are given descriptive names such as |
88 | exit and exit_free. Don't forget to properly set err before | 86 | exit and exit_free. Don't forget to properly set err before |
diff --git a/Documentation/i2c/summary b/Documentation/i2c/summary index 41dde8776791..aea60bf7e8f0 100644 --- a/Documentation/i2c/summary +++ b/Documentation/i2c/summary | |||
@@ -4,17 +4,23 @@ I2C and SMBus | |||
4 | ============= | 4 | ============= |
5 | 5 | ||
6 | I2C (pronounce: I squared C) is a protocol developed by Philips. It is a | 6 | I2C (pronounce: I squared C) is a protocol developed by Philips. It is a |
7 | slow two-wire protocol (10-400 kHz), but it suffices for many types of | 7 | slow two-wire protocol (variable speed, up to 400 kHz), with a high speed |
8 | devices. | 8 | extension (3.4 MHz). It provides an inexpensive bus for connecting many |
9 | types of devices with infrequent or low bandwidth communications needs. | ||
10 | I2C is widely used with embedded systems. Some systems use variants that | ||
11 | don't meet branding requirements, and so are not advertised as being I2C. | ||
9 | 12 | ||
10 | SMBus (System Management Bus) is a subset of the I2C protocol. Many | 13 | SMBus (System Management Bus) is based on the I2C protocol, and is mostly |
11 | modern mainboards have a System Management Bus. There are a lot of | 14 | a subset of I2C protocols and signaling. Many I2C devices will work on an |
12 | devices which can be connected to a SMBus; the most notable are modern | 15 | SMBus, but some SMBus protocols add semantics beyond what is required to |
13 | memory chips with EEPROM memories and chips for hardware monitoring. | 16 | achieve I2C branding. Modern PC mainboards rely on SMBus. The most common |
17 | devices connected through SMBus are RAM modules configured using I2C EEPROMs, | ||
18 | and hardware monitoring chips. | ||
14 | 19 | ||
15 | Because the SMBus is just a special case of the generalized I2C bus, we | 20 | Because the SMBus is mostly a subset of the generalized I2C bus, we can |
16 | can simulate the SMBus protocol on plain I2C busses. The reverse is | 21 | use its protocols on many I2C systems. However, there are systems that don't |
17 | regretfully impossible. | 22 | meet both SMBus and I2C electrical constraints; and others which can't |
23 | implement all the common SMBus protocol semantics or messages. | ||
18 | 24 | ||
19 | 25 | ||
20 | Terminology | 26 | Terminology |
@@ -29,6 +35,7 @@ When we talk about I2C, we use the following terms: | |||
29 | An Algorithm driver contains general code that can be used for a whole class | 35 | An Algorithm driver contains general code that can be used for a whole class |
30 | of I2C adapters. Each specific adapter driver depends on one algorithm | 36 | of I2C adapters. Each specific adapter driver depends on one algorithm |
31 | driver. | 37 | driver. |
38 | |||
32 | A Driver driver (yes, this sounds ridiculous, sorry) contains the general | 39 | A Driver driver (yes, this sounds ridiculous, sorry) contains the general |
33 | code to access some type of device. Each detected device gets its own | 40 | code to access some type of device. Each detected device gets its own |
34 | data in the Client structure. Usually, Driver and Client are more closely | 41 | data in the Client structure. Usually, Driver and Client are more closely |
@@ -40,6 +47,10 @@ a separate Adapter and Algorithm driver), and drivers for your I2C devices | |||
40 | in this package. See the lm_sensors project http://www.lm-sensors.nu | 47 | in this package. See the lm_sensors project http://www.lm-sensors.nu |
41 | for device drivers. | 48 | for device drivers. |
42 | 49 | ||
50 | At this time, Linux only operates I2C (or SMBus) in master mode; you can't | ||
51 | use these APIs to make a Linux system behave as a slave/device, either to | ||
52 | speak a custom protocol or to emulate some other device. | ||
53 | |||
43 | 54 | ||
44 | Included Bus Drivers | 55 | Included Bus Drivers |
45 | ==================== | 56 | ==================== |
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index fbcff96f4ca1..3d8d36b0ad12 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -1,5 +1,5 @@ | |||
1 | This is a small guide for those who want to write kernel drivers for I2C | 1 | This is a small guide for those who want to write kernel drivers for I2C |
2 | or SMBus devices. | 2 | or SMBus devices, using Linux as the protocol host/master (not slave). |
3 | 3 | ||
4 | To set up a driver, you need to do several things. Some are optional, and | 4 | To set up a driver, you need to do several things. Some are optional, and |
5 | some things can be done slightly or completely different. Use this as a | 5 | some things can be done slightly or completely different. Use this as a |
@@ -29,8 +29,16 @@ static struct i2c_driver foo_driver = { | |||
29 | .driver = { | 29 | .driver = { |
30 | .name = "foo", | 30 | .name = "foo", |
31 | }, | 31 | }, |
32 | |||
33 | /* iff driver uses driver model ("new style") binding model: */ | ||
34 | .probe = foo_probe, | ||
35 | .remove = foo_remove, | ||
36 | |||
37 | /* else, driver uses "legacy" binding model: */ | ||
32 | .attach_adapter = foo_attach_adapter, | 38 | .attach_adapter = foo_attach_adapter, |
33 | .detach_client = foo_detach_client, | 39 | .detach_client = foo_detach_client, |
40 | |||
41 | /* these may be used regardless of the driver binding model */ | ||
34 | .shutdown = foo_shutdown, /* optional */ | 42 | .shutdown = foo_shutdown, /* optional */ |
35 | .suspend = foo_suspend, /* optional */ | 43 | .suspend = foo_suspend, /* optional */ |
36 | .resume = foo_resume, /* optional */ | 44 | .resume = foo_resume, /* optional */ |
@@ -40,7 +48,8 @@ static struct i2c_driver foo_driver = { | |||
40 | The name field is the driver name, and must not contain spaces. It | 48 | The name field is the driver name, and must not contain spaces. It |
41 | should match the module name (if the driver can be compiled as a module), | 49 | should match the module name (if the driver can be compiled as a module), |
42 | although you can use MODULE_ALIAS (passing "foo" in this example) to add | 50 | although you can use MODULE_ALIAS (passing "foo" in this example) to add |
43 | another name for the module. | 51 | another name for the module. If the driver name doesn't match the module |
52 | name, the module won't be automatically loaded (hotplug/coldplug). | ||
44 | 53 | ||
45 | All other fields are for call-back functions which will be explained | 54 | All other fields are for call-back functions which will be explained |
46 | below. | 55 | below. |
@@ -65,16 +74,13 @@ An example structure is below. | |||
65 | 74 | ||
66 | struct foo_data { | 75 | struct foo_data { |
67 | struct i2c_client client; | 76 | struct i2c_client client; |
68 | struct semaphore lock; /* For ISA access in `sensors' drivers. */ | ||
69 | int sysctl_id; /* To keep the /proc directory entry for | ||
70 | `sensors' drivers. */ | ||
71 | enum chips type; /* To keep the chips type for `sensors' drivers. */ | 77 | enum chips type; /* To keep the chips type for `sensors' drivers. */ |
72 | 78 | ||
73 | /* Because the i2c bus is slow, it is often useful to cache the read | 79 | /* Because the i2c bus is slow, it is often useful to cache the read |
74 | information of a chip for some time (for example, 1 or 2 seconds). | 80 | information of a chip for some time (for example, 1 or 2 seconds). |
75 | It depends of course on the device whether this is really worthwhile | 81 | It depends of course on the device whether this is really worthwhile |
76 | or even sensible. */ | 82 | or even sensible. */ |
77 | struct semaphore update_lock; /* When we are reading lots of information, | 83 | struct mutex update_lock; /* When we are reading lots of information, |
78 | another process should not update the | 84 | another process should not update the |
79 | below information */ | 85 | below information */ |
80 | char valid; /* != 0 if the following fields are valid. */ | 86 | char valid; /* != 0 if the following fields are valid. */ |
@@ -95,8 +101,7 @@ some obscure clients). But we need generic reading and writing routines. | |||
95 | I have found it useful to define foo_read and foo_write function for this. | 101 | I have found it useful to define foo_read and foo_write function for this. |
96 | For some cases, it will be easier to call the i2c functions directly, | 102 | For some cases, it will be easier to call the i2c functions directly, |
97 | but many chips have some kind of register-value idea that can easily | 103 | but many chips have some kind of register-value idea that can easily |
98 | be encapsulated. Also, some chips have both ISA and I2C interfaces, and | 104 | be encapsulated. |
99 | it useful to abstract from this (only for `sensors' drivers). | ||
100 | 105 | ||
101 | The below functions are simple examples, and should not be copied | 106 | The below functions are simple examples, and should not be copied |
102 | literally. | 107 | literally. |
@@ -119,28 +124,101 @@ literally. | |||
119 | return i2c_smbus_write_word_data(client,reg,value); | 124 | return i2c_smbus_write_word_data(client,reg,value); |
120 | } | 125 | } |
121 | 126 | ||
122 | For sensors code, you may have to cope with ISA registers too. Something | ||
123 | like the below often works. Note the locking! | ||
124 | |||
125 | int foo_read_value(struct i2c_client *client, u8 reg) | ||
126 | { | ||
127 | int res; | ||
128 | if (i2c_is_isa_client(client)) { | ||
129 | down(&(((struct foo_data *) (client->data)) -> lock)); | ||
130 | outb_p(reg,client->addr + FOO_ADDR_REG_OFFSET); | ||
131 | res = inb_p(client->addr + FOO_DATA_REG_OFFSET); | ||
132 | up(&(((struct foo_data *) (client->data)) -> lock)); | ||
133 | return res; | ||
134 | } else | ||
135 | return i2c_smbus_read_byte_data(client,reg); | ||
136 | } | ||
137 | |||
138 | Writing is done the same way. | ||
139 | |||
140 | 127 | ||
141 | Probing and attaching | 128 | Probing and attaching |
142 | ===================== | 129 | ===================== |
143 | 130 | ||
131 | The Linux I2C stack was originally written to support access to hardware | ||
132 | monitoring chips on PC motherboards, and thus it embeds some assumptions | ||
133 | that are more appropriate to SMBus (and PCs) than to I2C. One of these | ||
134 | assumptions is that most adapters and devices drivers support the SMBUS_QUICK | ||
135 | protocol to probe device presence. Another is that devices and their drivers | ||
136 | can be sufficiently configured using only such probe primitives. | ||
137 | |||
138 | As Linux and its I2C stack became more widely used in embedded systems | ||
139 | and complex components such as DVB adapters, those assumptions became more | ||
140 | problematic. Drivers for I2C devices that issue interrupts need more (and | ||
141 | different) configuration information, as do drivers handling chip variants | ||
142 | that can't be distinguished by protocol probing, or which need some board | ||
143 | specific information to operate correctly. | ||
144 | |||
145 | Accordingly, the I2C stack now has two models for associating I2C devices | ||
146 | with their drivers: the original "legacy" model, and a newer one that's | ||
147 | fully compatible with the Linux 2.6 driver model. These models do not mix, | ||
148 | since the "legacy" model requires drivers to create "i2c_client" device | ||
149 | objects after SMBus style probing, while the Linux driver model expects | ||
150 | drivers to be given such device objects in their probe() routines. | ||
151 | |||
152 | |||
153 | Standard Driver Model Binding ("New Style") | ||
154 | ------------------------------------------- | ||
155 | |||
156 | System infrastructure, typically board-specific initialization code or | ||
157 | boot firmware, reports what I2C devices exist. For example, there may be | ||
158 | a table, in the kernel or from the boot loader, identifying I2C devices | ||
159 | and linking them to board-specific configuration information about IRQs | ||
160 | and other wiring artifacts, chip type, and so on. That could be used to | ||
161 | create i2c_client objects for each I2C device. | ||
162 | |||
163 | I2C device drivers using this binding model work just like any other | ||
164 | kind of driver in Linux: they provide a probe() method to bind to | ||
165 | those devices, and a remove() method to unbind. | ||
166 | |||
167 | static int foo_probe(struct i2c_client *client); | ||
168 | static int foo_remove(struct i2c_client *client); | ||
169 | |||
170 | Remember that the i2c_driver does not create those client handles. The | ||
171 | handle may be used during foo_probe(). If foo_probe() reports success | ||
172 | (zero not a negative status code) it may save the handle and use it until | ||
173 | foo_remove() returns. That binding model is used by most Linux drivers. | ||
174 | |||
175 | Drivers match devices when i2c_client.driver_name and the driver name are | ||
176 | the same; this approach is used in several other busses that don't have | ||
177 | device typing support in the hardware. The driver and module name should | ||
178 | match, so hotplug/coldplug mechanisms will modprobe the driver. | ||
179 | |||
180 | |||
181 | Device Creation (Standard driver model) | ||
182 | --------------------------------------- | ||
183 | |||
184 | If you know for a fact that an I2C device is connected to a given I2C bus, | ||
185 | you can instantiate that device by simply filling an i2c_board_info | ||
186 | structure with the device address and driver name, and calling | ||
187 | i2c_new_device(). This will create the device, then the driver core will | ||
188 | take care of finding the right driver and will call its probe() method. | ||
189 | If a driver supports different device types, you can specify the type you | ||
190 | want using the type field. You can also specify an IRQ and platform data | ||
191 | if needed. | ||
192 | |||
193 | Sometimes you know that a device is connected to a given I2C bus, but you | ||
194 | don't know the exact address it uses. This happens on TV adapters for | ||
195 | example, where the same driver supports dozens of slightly different | ||
196 | models, and I2C device addresses change from one model to the next. In | ||
197 | that case, you can use the i2c_new_probed_device() variant, which is | ||
198 | similar to i2c_new_device(), except that it takes an additional list of | ||
199 | possible I2C addresses to probe. A device is created for the first | ||
200 | responsive address in the list. If you expect more than one device to be | ||
201 | present in the address range, simply call i2c_new_probed_device() that | ||
202 | many times. | ||
203 | |||
204 | The call to i2c_new_device() or i2c_new_probed_device() typically happens | ||
205 | in the I2C bus driver. You may want to save the returned i2c_client | ||
206 | reference for later use. | ||
207 | |||
208 | |||
209 | Device Deletion (Standard driver model) | ||
210 | --------------------------------------- | ||
211 | |||
212 | Each I2C device which has been created using i2c_new_device() or | ||
213 | i2c_new_probed_device() can be unregistered by calling | ||
214 | i2c_unregister_device(). If you don't call it explicitly, it will be | ||
215 | called automatically before the underlying I2C bus itself is removed, as a | ||
216 | device can't survive its parent in the device driver model. | ||
217 | |||
218 | |||
219 | Legacy Driver Binding Model | ||
220 | --------------------------- | ||
221 | |||
144 | Most i2c devices can be present on several i2c addresses; for some this | 222 | Most i2c devices can be present on several i2c addresses; for some this |
145 | is determined in hardware (by soldering some chip pins to Vcc or Ground), | 223 | is determined in hardware (by soldering some chip pins to Vcc or Ground), |
146 | for others this can be changed in software (by writing to specific client | 224 | for others this can be changed in software (by writing to specific client |
@@ -157,13 +235,9 @@ detection algorithm. | |||
157 | You do not have to use this parameter interface; but don't try to use | 235 | You do not have to use this parameter interface; but don't try to use |
158 | function i2c_probe() if you don't. | 236 | function i2c_probe() if you don't. |
159 | 237 | ||
160 | NOTE: If you want to write a `sensors' driver, the interface is slightly | ||
161 | different! See below. | ||
162 | |||
163 | 238 | ||
164 | 239 | Probing classes (Legacy model) | |
165 | Probing classes | 240 | ------------------------------ |
166 | --------------- | ||
167 | 241 | ||
168 | All parameters are given as lists of unsigned 16-bit integers. Lists are | 242 | All parameters are given as lists of unsigned 16-bit integers. Lists are |
169 | terminated by I2C_CLIENT_END. | 243 | terminated by I2C_CLIENT_END. |
@@ -210,8 +284,8 @@ Note that you *have* to call the defined variable `normal_i2c', | |||
210 | without any prefix! | 284 | without any prefix! |
211 | 285 | ||
212 | 286 | ||
213 | Attaching to an adapter | 287 | Attaching to an adapter (Legacy model) |
214 | ----------------------- | 288 | -------------------------------------- |
215 | 289 | ||
216 | Whenever a new adapter is inserted, or for all adapters if the driver is | 290 | Whenever a new adapter is inserted, or for all adapters if the driver is |
217 | being registered, the callback attach_adapter() is called. Now is the | 291 | being registered, the callback attach_adapter() is called. Now is the |
@@ -237,17 +311,13 @@ them (unless a `force' parameter was used). In addition, addresses that | |||
237 | are already in use (by some other registered client) are skipped. | 311 | are already in use (by some other registered client) are skipped. |
238 | 312 | ||
239 | 313 | ||
240 | The detect client function | 314 | The detect client function (Legacy model) |
241 | -------------------------- | 315 | ----------------------------------------- |
242 | 316 | ||
243 | The detect client function is called by i2c_probe. The `kind' parameter | 317 | The detect client function is called by i2c_probe. The `kind' parameter |
244 | contains -1 for a probed detection, 0 for a forced detection, or a positive | 318 | contains -1 for a probed detection, 0 for a forced detection, or a positive |
245 | number for a forced detection with a chip type forced. | 319 | number for a forced detection with a chip type forced. |
246 | 320 | ||
247 | Below, some things are only needed if this is a `sensors' driver. Those | ||
248 | parts are between /* SENSORS ONLY START */ and /* SENSORS ONLY END */ | ||
249 | markers. | ||
250 | |||
251 | Returning an error different from -ENODEV in a detect function will cause | 321 | Returning an error different from -ENODEV in a detect function will cause |
252 | the detection to stop: other addresses and adapters won't be scanned. | 322 | the detection to stop: other addresses and adapters won't be scanned. |
253 | This should only be done on fatal or internal errors, such as a memory | 323 | This should only be done on fatal or internal errors, such as a memory |
@@ -256,64 +326,20 @@ shortage or i2c_attach_client failing. | |||
256 | For now, you can ignore the `flags' parameter. It is there for future use. | 326 | For now, you can ignore the `flags' parameter. It is there for future use. |
257 | 327 | ||
258 | int foo_detect_client(struct i2c_adapter *adapter, int address, | 328 | int foo_detect_client(struct i2c_adapter *adapter, int address, |
259 | unsigned short flags, int kind) | 329 | int kind) |
260 | { | 330 | { |
261 | int err = 0; | 331 | int err = 0; |
262 | int i; | 332 | int i; |
263 | struct i2c_client *new_client; | 333 | struct i2c_client *client; |
264 | struct foo_data *data; | 334 | struct foo_data *data; |
265 | const char *client_name = ""; /* For non-`sensors' drivers, put the real | 335 | const char *name = ""; |
266 | name here! */ | ||
267 | 336 | ||
268 | /* Let's see whether this adapter can support what we need. | 337 | /* Let's see whether this adapter can support what we need. |
269 | Please substitute the things you need here! | 338 | Please substitute the things you need here! */ |
270 | For `sensors' drivers, add `! is_isa &&' to the if statement */ | ||
271 | if (!i2c_check_functionality(adapter,I2C_FUNC_SMBUS_WORD_DATA | | 339 | if (!i2c_check_functionality(adapter,I2C_FUNC_SMBUS_WORD_DATA | |
272 | I2C_FUNC_SMBUS_WRITE_BYTE)) | 340 | I2C_FUNC_SMBUS_WRITE_BYTE)) |
273 | goto ERROR0; | 341 | goto ERROR0; |
274 | 342 | ||
275 | /* SENSORS ONLY START */ | ||
276 | const char *type_name = ""; | ||
277 | int is_isa = i2c_is_isa_adapter(adapter); | ||
278 | |||
279 | /* Do this only if the chip can additionally be found on the ISA bus | ||
280 | (hybrid chip). */ | ||
281 | |||
282 | if (is_isa) { | ||
283 | |||
284 | /* Discard immediately if this ISA range is already used */ | ||
285 | /* FIXME: never use check_region(), only request_region() */ | ||
286 | if (check_region(address,FOO_EXTENT)) | ||
287 | goto ERROR0; | ||
288 | |||
289 | /* Probe whether there is anything on this address. | ||
290 | Some example code is below, but you will have to adapt this | ||
291 | for your own driver */ | ||
292 | |||
293 | if (kind < 0) /* Only if no force parameter was used */ { | ||
294 | /* We may need long timeouts at least for some chips. */ | ||
295 | #define REALLY_SLOW_IO | ||
296 | i = inb_p(address + 1); | ||
297 | if (inb_p(address + 2) != i) | ||
298 | goto ERROR0; | ||
299 | if (inb_p(address + 3) != i) | ||
300 | goto ERROR0; | ||
301 | if (inb_p(address + 7) != i) | ||
302 | goto ERROR0; | ||
303 | #undef REALLY_SLOW_IO | ||
304 | |||
305 | /* Let's just hope nothing breaks here */ | ||
306 | i = inb_p(address + 5) & 0x7f; | ||
307 | outb_p(~i & 0x7f,address+5); | ||
308 | if ((inb_p(address + 5) & 0x7f) != (~i & 0x7f)) { | ||
309 | outb_p(i,address+5); | ||
310 | return 0; | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | |||
315 | /* SENSORS ONLY END */ | ||
316 | |||
317 | /* OK. For now, we presume we have a valid client. We now create the | 343 | /* OK. For now, we presume we have a valid client. We now create the |
318 | client structure, even though we cannot fill it completely yet. | 344 | client structure, even though we cannot fill it completely yet. |
319 | But it allows us to access several i2c functions safely */ | 345 | But it allows us to access several i2c functions safely */ |
@@ -323,13 +349,12 @@ For now, you can ignore the `flags' parameter. It is there for future use. | |||
323 | goto ERROR0; | 349 | goto ERROR0; |
324 | } | 350 | } |
325 | 351 | ||
326 | new_client = &data->client; | 352 | client = &data->client; |
327 | i2c_set_clientdata(new_client, data); | 353 | i2c_set_clientdata(client, data); |
328 | 354 | ||
329 | new_client->addr = address; | 355 | client->addr = address; |
330 | new_client->adapter = adapter; | 356 | client->adapter = adapter; |
331 | new_client->driver = &foo_driver; | 357 | client->driver = &foo_driver; |
332 | new_client->flags = 0; | ||
333 | 358 | ||
334 | /* Now, we do the remaining detection. If no `force' parameter is used. */ | 359 | /* Now, we do the remaining detection. If no `force' parameter is used. */ |
335 | 360 | ||
@@ -337,19 +362,17 @@ For now, you can ignore the `flags' parameter. It is there for future use. | |||
337 | parameter was used. */ | 362 | parameter was used. */ |
338 | if (kind < 0) { | 363 | if (kind < 0) { |
339 | /* The below is of course bogus */ | 364 | /* The below is of course bogus */ |
340 | if (foo_read(new_client,FOO_REG_GENERIC) != FOO_GENERIC_VALUE) | 365 | if (foo_read(client, FOO_REG_GENERIC) != FOO_GENERIC_VALUE) |
341 | goto ERROR1; | 366 | goto ERROR1; |
342 | } | 367 | } |
343 | 368 | ||
344 | /* SENSORS ONLY START */ | ||
345 | |||
346 | /* Next, specific detection. This is especially important for `sensors' | 369 | /* Next, specific detection. This is especially important for `sensors' |
347 | devices. */ | 370 | devices. */ |
348 | 371 | ||
349 | /* Determine the chip type. Not needed if a `force_CHIPTYPE' parameter | 372 | /* Determine the chip type. Not needed if a `force_CHIPTYPE' parameter |
350 | was used. */ | 373 | was used. */ |
351 | if (kind <= 0) { | 374 | if (kind <= 0) { |
352 | i = foo_read(new_client,FOO_REG_CHIPTYPE); | 375 | i = foo_read(client, FOO_REG_CHIPTYPE); |
353 | if (i == FOO_TYPE_1) | 376 | if (i == FOO_TYPE_1) |
354 | kind = chip1; /* As defined in the enum */ | 377 | kind = chip1; /* As defined in the enum */ |
355 | else if (i == FOO_TYPE_2) | 378 | else if (i == FOO_TYPE_2) |
@@ -363,63 +386,31 @@ For now, you can ignore the `flags' parameter. It is there for future use. | |||
363 | 386 | ||
364 | /* Now set the type and chip names */ | 387 | /* Now set the type and chip names */ |
365 | if (kind == chip1) { | 388 | if (kind == chip1) { |
366 | type_name = "chip1"; /* For /proc entry */ | 389 | name = "chip1"; |
367 | client_name = "CHIP 1"; | ||
368 | } else if (kind == chip2) { | 390 | } else if (kind == chip2) { |
369 | type_name = "chip2"; /* For /proc entry */ | 391 | name = "chip2"; |
370 | client_name = "CHIP 2"; | ||
371 | } | 392 | } |
372 | 393 | ||
373 | /* Reserve the ISA region */ | ||
374 | if (is_isa) | ||
375 | request_region(address,FOO_EXTENT,type_name); | ||
376 | |||
377 | /* SENSORS ONLY END */ | ||
378 | |||
379 | /* Fill in the remaining client fields. */ | 394 | /* Fill in the remaining client fields. */ |
380 | strcpy(new_client->name,client_name); | 395 | strlcpy(client->name, name, I2C_NAME_SIZE); |
381 | |||
382 | /* SENSORS ONLY BEGIN */ | ||
383 | data->type = kind; | 396 | data->type = kind; |
384 | /* SENSORS ONLY END */ | 397 | mutex_init(&data->update_lock); /* Only if you use this field */ |
385 | |||
386 | data->valid = 0; /* Only if you use this field */ | ||
387 | init_MUTEX(&data->update_lock); /* Only if you use this field */ | ||
388 | 398 | ||
389 | /* Any other initializations in data must be done here too. */ | 399 | /* Any other initializations in data must be done here too. */ |
390 | 400 | ||
391 | /* Tell the i2c layer a new client has arrived */ | ||
392 | if ((err = i2c_attach_client(new_client))) | ||
393 | goto ERROR3; | ||
394 | |||
395 | /* SENSORS ONLY BEGIN */ | ||
396 | /* Register a new directory entry with module sensors. See below for | ||
397 | the `template' structure. */ | ||
398 | if ((i = i2c_register_entry(new_client, type_name, | ||
399 | foo_dir_table_template,THIS_MODULE)) < 0) { | ||
400 | err = i; | ||
401 | goto ERROR4; | ||
402 | } | ||
403 | data->sysctl_id = i; | ||
404 | |||
405 | /* SENSORS ONLY END */ | ||
406 | |||
407 | /* This function can write default values to the client registers, if | 401 | /* This function can write default values to the client registers, if |
408 | needed. */ | 402 | needed. */ |
409 | foo_init_client(new_client); | 403 | foo_init_client(client); |
404 | |||
405 | /* Tell the i2c layer a new client has arrived */ | ||
406 | if ((err = i2c_attach_client(client))) | ||
407 | goto ERROR1; | ||
408 | |||
410 | return 0; | 409 | return 0; |
411 | 410 | ||
412 | /* OK, this is not exactly good programming practice, usually. But it is | 411 | /* OK, this is not exactly good programming practice, usually. But it is |
413 | very code-efficient in this case. */ | 412 | very code-efficient in this case. */ |
414 | 413 | ||
415 | ERROR4: | ||
416 | i2c_detach_client(new_client); | ||
417 | ERROR3: | ||
418 | ERROR2: | ||
419 | /* SENSORS ONLY START */ | ||
420 | if (is_isa) | ||
421 | release_region(address,FOO_EXTENT); | ||
422 | /* SENSORS ONLY END */ | ||
423 | ERROR1: | 414 | ERROR1: |
424 | kfree(data); | 415 | kfree(data); |
425 | ERROR0: | 416 | ERROR0: |
@@ -427,8 +418,8 @@ For now, you can ignore the `flags' parameter. It is there for future use. | |||
427 | } | 418 | } |
428 | 419 | ||
429 | 420 | ||
430 | Removing the client | 421 | Removing the client (Legacy model) |
431 | =================== | 422 | ================================== |
432 | 423 | ||
433 | The detach_client call back function is called when a client should be | 424 | The detach_client call back function is called when a client should be |
434 | removed. It may actually fail, but only when panicking. This code is | 425 | removed. It may actually fail, but only when panicking. This code is |
@@ -436,22 +427,12 @@ much simpler than the attachment code, fortunately! | |||
436 | 427 | ||
437 | int foo_detach_client(struct i2c_client *client) | 428 | int foo_detach_client(struct i2c_client *client) |
438 | { | 429 | { |
439 | int err,i; | 430 | int err; |
440 | |||
441 | /* SENSORS ONLY START */ | ||
442 | /* Deregister with the `i2c-proc' module. */ | ||
443 | i2c_deregister_entry(((struct lm78_data *)(client->data))->sysctl_id); | ||
444 | /* SENSORS ONLY END */ | ||
445 | 431 | ||
446 | /* Try to detach the client from i2c space */ | 432 | /* Try to detach the client from i2c space */ |
447 | if ((err = i2c_detach_client(client))) | 433 | if ((err = i2c_detach_client(client))) |
448 | return err; | 434 | return err; |
449 | 435 | ||
450 | /* HYBRID SENSORS CHIP ONLY START */ | ||
451 | if i2c_is_isa_client(client) | ||
452 | release_region(client->addr,LM78_EXTENT); | ||
453 | /* HYBRID SENSORS CHIP ONLY END */ | ||
454 | |||
455 | kfree(i2c_get_clientdata(client)); | 436 | kfree(i2c_get_clientdata(client)); |
456 | return 0; | 437 | return 0; |
457 | } | 438 | } |
@@ -464,45 +445,34 @@ When the kernel is booted, or when your foo driver module is inserted, | |||
464 | you have to do some initializing. Fortunately, just attaching (registering) | 445 | you have to do some initializing. Fortunately, just attaching (registering) |
465 | the driver module is usually enough. | 446 | the driver module is usually enough. |
466 | 447 | ||
467 | /* Keep track of how far we got in the initialization process. If several | ||
468 | things have to initialized, and we fail halfway, only those things | ||
469 | have to be cleaned up! */ | ||
470 | static int __initdata foo_initialized = 0; | ||
471 | |||
472 | static int __init foo_init(void) | 448 | static int __init foo_init(void) |
473 | { | 449 | { |
474 | int res; | 450 | int res; |
475 | printk("foo version %s (%s)\n",FOO_VERSION,FOO_DATE); | ||
476 | 451 | ||
477 | if ((res = i2c_add_driver(&foo_driver))) { | 452 | if ((res = i2c_add_driver(&foo_driver))) { |
478 | printk("foo: Driver registration failed, module not inserted.\n"); | 453 | printk("foo: Driver registration failed, module not inserted.\n"); |
479 | foo_cleanup(); | ||
480 | return res; | 454 | return res; |
481 | } | 455 | } |
482 | foo_initialized ++; | ||
483 | return 0; | 456 | return 0; |
484 | } | 457 | } |
485 | 458 | ||
486 | void foo_cleanup(void) | 459 | static void __exit foo_cleanup(void) |
487 | { | 460 | { |
488 | if (foo_initialized == 1) { | 461 | i2c_del_driver(&foo_driver); |
489 | if ((res = i2c_del_driver(&foo_driver))) { | ||
490 | printk("foo: Driver registration failed, module not removed.\n"); | ||
491 | return; | ||
492 | } | ||
493 | foo_initialized --; | ||
494 | } | ||
495 | } | 462 | } |
496 | 463 | ||
497 | /* Substitute your own name and email address */ | 464 | /* Substitute your own name and email address */ |
498 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>" | 465 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>" |
499 | MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices"); | 466 | MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices"); |
500 | 467 | ||
468 | /* a few non-GPL license types are also allowed */ | ||
469 | MODULE_LICENSE("GPL"); | ||
470 | |||
501 | module_init(foo_init); | 471 | module_init(foo_init); |
502 | module_exit(foo_cleanup); | 472 | module_exit(foo_cleanup); |
503 | 473 | ||
504 | Note that some functions are marked by `__init', and some data structures | 474 | Note that some functions are marked by `__init', and some data structures |
505 | by `__init_data'. Hose functions and structures can be removed after | 475 | by `__initdata'. These functions and structures can be removed after |
506 | kernel booting (or module loading) is completed. | 476 | kernel booting (or module loading) is completed. |
507 | 477 | ||
508 | 478 | ||
@@ -632,110 +602,7 @@ General purpose routines | |||
632 | Below all general purpose routines are listed, that were not mentioned | 602 | Below all general purpose routines are listed, that were not mentioned |
633 | before. | 603 | before. |
634 | 604 | ||
635 | /* This call returns a unique low identifier for each registered adapter, | 605 | /* This call returns a unique low identifier for each registered adapter. |
636 | * or -1 if the adapter was not registered. | ||
637 | */ | 606 | */ |
638 | extern int i2c_adapter_id(struct i2c_adapter *adap); | 607 | extern int i2c_adapter_id(struct i2c_adapter *adap); |
639 | 608 | ||
640 | |||
641 | The sensors sysctl/proc interface | ||
642 | ================================= | ||
643 | |||
644 | This section only applies if you write `sensors' drivers. | ||
645 | |||
646 | Each sensors driver creates a directory in /proc/sys/dev/sensors for each | ||
647 | registered client. The directory is called something like foo-i2c-4-65. | ||
648 | The sensors module helps you to do this as easily as possible. | ||
649 | |||
650 | The template | ||
651 | ------------ | ||
652 | |||
653 | You will need to define a ctl_table template. This template will automatically | ||
654 | be copied to a newly allocated structure and filled in where necessary when | ||
655 | you call sensors_register_entry. | ||
656 | |||
657 | First, I will give an example definition. | ||
658 | static ctl_table foo_dir_table_template[] = { | ||
659 | { FOO_SYSCTL_FUNC1, "func1", NULL, 0, 0644, NULL, &i2c_proc_real, | ||
660 | &i2c_sysctl_real,NULL,&foo_func }, | ||
661 | { FOO_SYSCTL_FUNC2, "func2", NULL, 0, 0644, NULL, &i2c_proc_real, | ||
662 | &i2c_sysctl_real,NULL,&foo_func }, | ||
663 | { FOO_SYSCTL_DATA, "data", NULL, 0, 0644, NULL, &i2c_proc_real, | ||
664 | &i2c_sysctl_real,NULL,&foo_data }, | ||
665 | { 0 } | ||
666 | }; | ||
667 | |||
668 | In the above example, three entries are defined. They can either be | ||
669 | accessed through the /proc interface, in the /proc/sys/dev/sensors/* | ||
670 | directories, as files named func1, func2 and data, or alternatively | ||
671 | through the sysctl interface, in the appropriate table, with identifiers | ||
672 | FOO_SYSCTL_FUNC1, FOO_SYSCTL_FUNC2 and FOO_SYSCTL_DATA. | ||
673 | |||
674 | The third, sixth and ninth parameters should always be NULL, and the | ||
675 | fourth should always be 0. The fifth is the mode of the /proc file; | ||
676 | 0644 is safe, as the file will be owned by root:root. | ||
677 | |||
678 | The seventh and eighth parameters should be &i2c_proc_real and | ||
679 | &i2c_sysctl_real if you want to export lists of reals (scaled | ||
680 | integers). You can also use your own function for them, as usual. | ||
681 | Finally, the last parameter is the call-back to gather the data | ||
682 | (see below) if you use the *_proc_real functions. | ||
683 | |||
684 | |||
685 | Gathering the data | ||
686 | ------------------ | ||
687 | |||
688 | The call back functions (foo_func and foo_data in the above example) | ||
689 | can be called in several ways; the operation parameter determines | ||
690 | what should be done: | ||
691 | |||
692 | * If operation == SENSORS_PROC_REAL_INFO, you must return the | ||
693 | magnitude (scaling) in nrels_mag; | ||
694 | * If operation == SENSORS_PROC_REAL_READ, you must read information | ||
695 | from the chip and return it in results. The number of integers | ||
696 | to display should be put in nrels_mag; | ||
697 | * If operation == SENSORS_PROC_REAL_WRITE, you must write the | ||
698 | supplied information to the chip. nrels_mag will contain the number | ||
699 | of integers, results the integers themselves. | ||
700 | |||
701 | The *_proc_real functions will display the elements as reals for the | ||
702 | /proc interface. If you set the magnitude to 2, and supply 345 for | ||
703 | SENSORS_PROC_REAL_READ, it would display 3.45; and if the user would | ||
704 | write 45.6 to the /proc file, it would be returned as 4560 for | ||
705 | SENSORS_PROC_REAL_WRITE. A magnitude may even be negative! | ||
706 | |||
707 | An example function: | ||
708 | |||
709 | /* FOO_FROM_REG and FOO_TO_REG translate between scaled values and | ||
710 | register values. Note the use of the read cache. */ | ||
711 | void foo_in(struct i2c_client *client, int operation, int ctl_name, | ||
712 | int *nrels_mag, long *results) | ||
713 | { | ||
714 | struct foo_data *data = client->data; | ||
715 | int nr = ctl_name - FOO_SYSCTL_FUNC1; /* reduce to 0 upwards */ | ||
716 | |||
717 | if (operation == SENSORS_PROC_REAL_INFO) | ||
718 | *nrels_mag = 2; | ||
719 | else if (operation == SENSORS_PROC_REAL_READ) { | ||
720 | /* Update the readings cache (if necessary) */ | ||
721 | foo_update_client(client); | ||
722 | /* Get the readings from the cache */ | ||
723 | results[0] = FOO_FROM_REG(data->foo_func_base[nr]); | ||
724 | results[1] = FOO_FROM_REG(data->foo_func_more[nr]); | ||
725 | results[2] = FOO_FROM_REG(data->foo_func_readonly[nr]); | ||
726 | *nrels_mag = 2; | ||
727 | } else if (operation == SENSORS_PROC_REAL_WRITE) { | ||
728 | if (*nrels_mag >= 1) { | ||
729 | /* Update the cache */ | ||
730 | data->foo_base[nr] = FOO_TO_REG(results[0]); | ||
731 | /* Update the chip */ | ||
732 | foo_write_value(client,FOO_REG_FUNC_BASE(nr),data->foo_base[nr]); | ||
733 | } | ||
734 | if (*nrels_mag >= 2) { | ||
735 | /* Update the cache */ | ||
736 | data->foo_more[nr] = FOO_TO_REG(results[1]); | ||
737 | /* Update the chip */ | ||
738 | foo_write_value(client,FOO_REG_FUNC_MORE(nr),data->foo_more[nr]); | ||
739 | } | ||
740 | } | ||
741 | } | ||
diff --git a/Documentation/i386/boot.txt b/Documentation/i386/boot.txt index 38fe1f03fb14..6498666ea330 100644 --- a/Documentation/i386/boot.txt +++ b/Documentation/i386/boot.txt | |||
@@ -2,7 +2,7 @@ | |||
2 | ---------------------------- | 2 | ---------------------------- |
3 | 3 | ||
4 | H. Peter Anvin <hpa@zytor.com> | 4 | H. Peter Anvin <hpa@zytor.com> |
5 | Last update 2007-01-26 | 5 | Last update 2007-03-06 |
6 | 6 | ||
7 | On the i386 platform, the Linux kernel uses a rather complicated boot | 7 | On the i386 platform, the Linux kernel uses a rather complicated boot |
8 | convention. This has evolved partially due to historical aspects, as | 8 | convention. This has evolved partially due to historical aspects, as |
@@ -35,9 +35,13 @@ Protocol 2.03: (Kernel 2.4.18-pre1) Explicitly makes the highest possible | |||
35 | initrd address available to the bootloader. | 35 | initrd address available to the bootloader. |
36 | 36 | ||
37 | Protocol 2.04: (Kernel 2.6.14) Extend the syssize field to four bytes. | 37 | Protocol 2.04: (Kernel 2.6.14) Extend the syssize field to four bytes. |
38 | |||
38 | Protocol 2.05: (Kernel 2.6.20) Make protected mode kernel relocatable. | 39 | Protocol 2.05: (Kernel 2.6.20) Make protected mode kernel relocatable. |
39 | Introduce relocatable_kernel and kernel_alignment fields. | 40 | Introduce relocatable_kernel and kernel_alignment fields. |
40 | 41 | ||
42 | Protocol 2.06: (Kernel 2.6.22) Added a field that contains the size of | ||
43 | the boot command line | ||
44 | |||
41 | 45 | ||
42 | **** MEMORY LAYOUT | 46 | **** MEMORY LAYOUT |
43 | 47 | ||
@@ -133,6 +137,8 @@ Offset Proto Name Meaning | |||
133 | 022C/4 2.03+ initrd_addr_max Highest legal initrd address | 137 | 022C/4 2.03+ initrd_addr_max Highest legal initrd address |
134 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel | 138 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel |
135 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not | 139 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not |
140 | 0235/3 N/A pad2 Unused | ||
141 | 0238/4 2.06+ cmdline_size Maximum size of the kernel command line | ||
136 | 142 | ||
137 | (1) For backwards compatibility, if the setup_sects field contains 0, the | 143 | (1) For backwards compatibility, if the setup_sects field contains 0, the |
138 | real value is 4. | 144 | real value is 4. |
@@ -233,6 +239,12 @@ filled out, however: | |||
233 | if your ramdisk is exactly 131072 bytes long and this field is | 239 | if your ramdisk is exactly 131072 bytes long and this field is |
234 | 0x37FFFFFF, you can start your ramdisk at 0x37FE0000.) | 240 | 0x37FFFFFF, you can start your ramdisk at 0x37FE0000.) |
235 | 241 | ||
242 | cmdline_size: | ||
243 | The maximum size of the command line without the terminating | ||
244 | zero. This means that the command line can contain at most | ||
245 | cmdline_size characters. With protocol version 2.05 and | ||
246 | earlier, the maximum size was 255. | ||
247 | |||
236 | 248 | ||
237 | **** THE KERNEL COMMAND LINE | 249 | **** THE KERNEL COMMAND LINE |
238 | 250 | ||
@@ -241,11 +253,10 @@ loader to communicate with the kernel. Some of its options are also | |||
241 | relevant to the boot loader itself, see "special command line options" | 253 | relevant to the boot loader itself, see "special command line options" |
242 | below. | 254 | below. |
243 | 255 | ||
244 | The kernel command line is a null-terminated string currently up to | 256 | The kernel command line is a null-terminated string. The maximum |
245 | 255 characters long, plus the final null. A string that is too long | 257 | length can be retrieved from the field cmdline_size. Before protocol |
246 | will be automatically truncated by the kernel, a boot loader may allow | 258 | version 2.06, the maximum was 255 characters. A string that is too |
247 | a longer command line to be passed to permit future kernels to extend | 259 | long will be automatically truncated by the kernel. |
248 | this limit. | ||
249 | 260 | ||
250 | If the boot protocol version is 2.02 or later, the address of the | 261 | If the boot protocol version is 2.02 or later, the address of the |
251 | kernel command line is given by the header field cmd_line_ptr (see | 262 | kernel command line is given by the header field cmd_line_ptr (see |
diff --git a/Documentation/input/input-programming.txt b/Documentation/input/input-programming.txt index 180e0689676c..d9d523099bb7 100644 --- a/Documentation/input/input-programming.txt +++ b/Documentation/input/input-programming.txt | |||
@@ -1,5 +1,3 @@ | |||
1 | $Id: input-programming.txt,v 1.4 2001/05/04 09:47:14 vojtech Exp $ | ||
2 | |||
3 | Programming input drivers | 1 | Programming input drivers |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~ | 2 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
5 | 3 | ||
@@ -20,28 +18,51 @@ pressed or released a BUTTON_IRQ happens. The driver could look like: | |||
20 | #include <asm/irq.h> | 18 | #include <asm/irq.h> |
21 | #include <asm/io.h> | 19 | #include <asm/io.h> |
22 | 20 | ||
21 | static struct input_dev *button_dev; | ||
22 | |||
23 | static void button_interrupt(int irq, void *dummy, struct pt_regs *fp) | 23 | static void button_interrupt(int irq, void *dummy, struct pt_regs *fp) |
24 | { | 24 | { |
25 | input_report_key(&button_dev, BTN_1, inb(BUTTON_PORT) & 1); | 25 | input_report_key(button_dev, BTN_1, inb(BUTTON_PORT) & 1); |
26 | input_sync(&button_dev); | 26 | input_sync(button_dev); |
27 | } | 27 | } |
28 | 28 | ||
29 | static int __init button_init(void) | 29 | static int __init button_init(void) |
30 | { | 30 | { |
31 | int error; | ||
32 | |||
31 | if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) { | 33 | if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) { |
32 | printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq); | 34 | printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq); |
33 | return -EBUSY; | 35 | return -EBUSY; |
34 | } | 36 | } |
35 | 37 | ||
36 | button_dev.evbit[0] = BIT(EV_KEY); | 38 | button_dev = input_allocate_device(); |
37 | button_dev.keybit[LONG(BTN_0)] = BIT(BTN_0); | 39 | if (!button_dev) { |
38 | 40 | printk(KERN_ERR "button.c: Not enough memory\n"); | |
39 | input_register_device(&button_dev); | 41 | error = -ENOMEM; |
42 | goto err_free_irq; | ||
43 | } | ||
44 | |||
45 | button_dev->evbit[0] = BIT(EV_KEY); | ||
46 | button_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); | ||
47 | |||
48 | error = input_register_device(button_dev); | ||
49 | if (error) { | ||
50 | printk(KERN_ERR "button.c: Failed to register device\n"); | ||
51 | goto err_free_dev; | ||
52 | } | ||
53 | |||
54 | return 0; | ||
55 | |||
56 | err_free_dev: | ||
57 | input_free_device(button_dev); | ||
58 | err_free_irq: | ||
59 | free_irq(BUTTON_IRQ, button_interrupt); | ||
60 | return error; | ||
40 | } | 61 | } |
41 | 62 | ||
42 | static void __exit button_exit(void) | 63 | static void __exit button_exit(void) |
43 | { | 64 | { |
44 | input_unregister_device(&button_dev); | 65 | input_unregister_device(button_dev); |
45 | free_irq(BUTTON_IRQ, button_interrupt); | 66 | free_irq(BUTTON_IRQ, button_interrupt); |
46 | } | 67 | } |
47 | 68 | ||
@@ -58,17 +79,18 @@ In the _init function, which is called either upon module load or when | |||
58 | booting the kernel, it grabs the required resources (it should also check | 79 | booting the kernel, it grabs the required resources (it should also check |
59 | for the presence of the device). | 80 | for the presence of the device). |
60 | 81 | ||
61 | Then it sets the input bitfields. This way the device driver tells the other | 82 | Then it allocates a new input device structure with input_aloocate_device() |
83 | and sets up input bitfields. This way the device driver tells the other | ||
62 | parts of the input systems what it is - what events can be generated or | 84 | parts of the input systems what it is - what events can be generated or |
63 | accepted by this input device. Our example device can only generate EV_KEY type | 85 | accepted by this input device. Our example device can only generate EV_KEY |
64 | events, and from those only BTN_0 event code. Thus we only set these two | 86 | type events, and from those only BTN_0 event code. Thus we only set these |
65 | bits. We could have used | 87 | two bits. We could have used |
66 | 88 | ||
67 | set_bit(EV_KEY, button_dev.evbit); | 89 | set_bit(EV_KEY, button_dev.evbit); |
68 | set_bit(BTN_0, button_dev.keybit); | 90 | set_bit(BTN_0, button_dev.keybit); |
69 | 91 | ||
70 | as well, but with more than single bits the first approach tends to be | 92 | as well, but with more than single bits the first approach tends to be |
71 | shorter. | 93 | shorter. |
72 | 94 | ||
73 | Then the example driver registers the input device structure by calling | 95 | Then the example driver registers the input device structure by calling |
74 | 96 | ||
@@ -76,16 +98,15 @@ Then the example driver registers the input device structure by calling | |||
76 | 98 | ||
77 | This adds the button_dev structure to linked lists of the input driver and | 99 | This adds the button_dev structure to linked lists of the input driver and |
78 | calls device handler modules _connect functions to tell them a new input | 100 | calls device handler modules _connect functions to tell them a new input |
79 | device has appeared. Because the _connect functions may call kmalloc(, | 101 | device has appeared. input_register_device() may sleep and therefore must |
80 | GFP_KERNEL), which can sleep, input_register_device() must not be called | 102 | not be called from an interrupt or with a spinlock held. |
81 | from an interrupt or with a spinlock held. | ||
82 | 103 | ||
83 | While in use, the only used function of the driver is | 104 | While in use, the only used function of the driver is |
84 | 105 | ||
85 | button_interrupt() | 106 | button_interrupt() |
86 | 107 | ||
87 | which upon every interrupt from the button checks its state and reports it | 108 | which upon every interrupt from the button checks its state and reports it |
88 | via the | 109 | via the |
89 | 110 | ||
90 | input_report_key() | 111 | input_report_key() |
91 | 112 | ||
@@ -113,16 +134,10 @@ can use the open and close callback to know when it can stop polling or | |||
113 | release the interrupt and when it must resume polling or grab the interrupt | 134 | release the interrupt and when it must resume polling or grab the interrupt |
114 | again. To do that, we would add this to our example driver: | 135 | again. To do that, we would add this to our example driver: |
115 | 136 | ||
116 | int button_used = 0; | ||
117 | |||
118 | static int button_open(struct input_dev *dev) | 137 | static int button_open(struct input_dev *dev) |
119 | { | 138 | { |
120 | if (button_used++) | ||
121 | return 0; | ||
122 | |||
123 | if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) { | 139 | if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) { |
124 | printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq); | 140 | printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq); |
125 | button_used--; | ||
126 | return -EBUSY; | 141 | return -EBUSY; |
127 | } | 142 | } |
128 | 143 | ||
@@ -131,20 +146,21 @@ static int button_open(struct input_dev *dev) | |||
131 | 146 | ||
132 | static void button_close(struct input_dev *dev) | 147 | static void button_close(struct input_dev *dev) |
133 | { | 148 | { |
134 | if (!--button_used) | 149 | free_irq(IRQ_AMIGA_VERTB, button_interrupt); |
135 | free_irq(IRQ_AMIGA_VERTB, button_interrupt); | ||
136 | } | 150 | } |
137 | 151 | ||
138 | static int __init button_init(void) | 152 | static int __init button_init(void) |
139 | { | 153 | { |
140 | ... | 154 | ... |
141 | button_dev.open = button_open; | 155 | button_dev->open = button_open; |
142 | button_dev.close = button_close; | 156 | button_dev->close = button_close; |
143 | ... | 157 | ... |
144 | } | 158 | } |
145 | 159 | ||
146 | Note the button_used variable - we have to track how many times the open | 160 | Note that input core keeps track of number of users for the device and |
147 | function was called to know when exactly our device stops being used. | 161 | makes sure that dev->open() is called only when the first user connects |
162 | to the device and that dev->close() is called when the very last user | ||
163 | disconnects. Calls to both callbacks are serialized. | ||
148 | 164 | ||
149 | The open() callback should return a 0 in case of success or any nonzero value | 165 | The open() callback should return a 0 in case of success or any nonzero value |
150 | in case of failure. The close() callback (which is void) must always succeed. | 166 | in case of failure. The close() callback (which is void) must always succeed. |
@@ -175,7 +191,7 @@ set the corresponding bits and call the | |||
175 | 191 | ||
176 | input_report_rel(struct input_dev *dev, int code, int value) | 192 | input_report_rel(struct input_dev *dev, int code, int value) |
177 | 193 | ||
178 | function. Events are generated only for nonzero value. | 194 | function. Events are generated only for nonzero value. |
179 | 195 | ||
180 | However EV_ABS requires a little special care. Before calling | 196 | However EV_ABS requires a little special care. Before calling |
181 | input_register_device, you have to fill additional fields in the input_dev | 197 | input_register_device, you have to fill additional fields in the input_dev |
@@ -187,6 +203,10 @@ the ABS_X axis: | |||
187 | button_dev.absfuzz[ABS_X] = 4; | 203 | button_dev.absfuzz[ABS_X] = 4; |
188 | button_dev.absflat[ABS_X] = 8; | 204 | button_dev.absflat[ABS_X] = 8; |
189 | 205 | ||
206 | Or, you can just say: | ||
207 | |||
208 | input_set_abs_params(button_dev, ABS_X, 0, 255, 4, 8); | ||
209 | |||
190 | This setting would be appropriate for a joystick X axis, with the minimum of | 210 | This setting would be appropriate for a joystick X axis, with the minimum of |
191 | 0, maximum of 255 (which the joystick *must* be able to reach, no problem if | 211 | 0, maximum of 255 (which the joystick *must* be able to reach, no problem if |
192 | it sometimes reports more, but it must be able to always reach the min and | 212 | it sometimes reports more, but it must be able to always reach the min and |
@@ -197,14 +217,7 @@ If you don't need absfuzz and absflat, you can set them to zero, which mean | |||
197 | that the thing is precise and always returns to exactly the center position | 217 | that the thing is precise and always returns to exactly the center position |
198 | (if it has any). | 218 | (if it has any). |
199 | 219 | ||
200 | 1.4 The void *private field | 220 | 1.4 NBITS(), LONG(), BIT() |
201 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
202 | |||
203 | This field in the input structure can be used to point to any private data | ||
204 | structures in the input device driver, in case the driver handles more than | ||
205 | one device. You'll need it in the open and close callbacks. | ||
206 | |||
207 | 1.5 NBITS(), LONG(), BIT() | ||
208 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | 221 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
209 | 222 | ||
210 | These three macros from input.h help some bitfield computations: | 223 | These three macros from input.h help some bitfield computations: |
@@ -213,13 +226,9 @@ These three macros from input.h help some bitfield computations: | |||
213 | LONG(x) - returns the index in the array in longs for bit x | 226 | LONG(x) - returns the index in the array in longs for bit x |
214 | BIT(x) - returns the index in a long for bit x | 227 | BIT(x) - returns the index in a long for bit x |
215 | 228 | ||
216 | 1.6 The number, id* and name fields | 229 | 1.5 The id* and name fields |
217 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 230 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
218 | 231 | ||
219 | The dev->number is assigned by the input system to the input device when it | ||
220 | is registered. It has no use except for identifying the device to the user | ||
221 | in system messages. | ||
222 | |||
223 | The dev->name should be set before registering the input device by the input | 232 | The dev->name should be set before registering the input device by the input |
224 | device driver. It's a string like 'Generic button device' containing a | 233 | device driver. It's a string like 'Generic button device' containing a |
225 | user friendly name of the device. | 234 | user friendly name of the device. |
@@ -234,15 +243,25 @@ driver. | |||
234 | 243 | ||
235 | The id and name fields can be passed to userland via the evdev interface. | 244 | The id and name fields can be passed to userland via the evdev interface. |
236 | 245 | ||
237 | 1.7 The keycode, keycodemax, keycodesize fields | 246 | 1.6 The keycode, keycodemax, keycodesize fields |
238 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 247 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
239 | 248 | ||
240 | These two fields will be used for any input devices that report their data | 249 | These three fields should be used by input devices that have dense keymaps. |
241 | as scancodes. If not all scancodes can be known by autodetection, they may | 250 | The keycode is an array used to map from scancodes to input system keycodes. |
242 | need to be set by userland utilities. The keycode array then is an array | 251 | The keycode max should contain the size of the array and keycodesize the |
243 | used to map from scancodes to input system keycodes. The keycode max will | 252 | size of each entry in it (in bytes). |
244 | contain the size of the array and keycodesize the size of each entry in it | 253 | |
245 | (in bytes). | 254 | Userspace can query and alter current scancode to keycode mappings using |
255 | EVIOCGKEYCODE and EVIOCSKEYCODE ioctls on corresponding evdev interface. | ||
256 | When a device has all 3 aforementioned fields filled in, the driver may | ||
257 | rely on kernel's default implementation of setting and querying keycode | ||
258 | mappings. | ||
259 | |||
260 | 1.7 dev->getkeycode() and dev->setkeycode() | ||
261 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
262 | getkeycode() and setkeycode() callbacks allow drivers to override default | ||
263 | keycode/keycodesize/keycodemax mapping mechanism provided by input core | ||
264 | and implement sparse keycode maps. | ||
246 | 265 | ||
247 | 1.8 Key autorepeat | 266 | 1.8 Key autorepeat |
248 | ~~~~~~~~~~~~~~~~~~ | 267 | ~~~~~~~~~~~~~~~~~~ |
@@ -266,7 +285,7 @@ direction - from the system to the input device driver. If your input device | |||
266 | driver can handle these events, it has to set the respective bits in evbit, | 285 | driver can handle these events, it has to set the respective bits in evbit, |
267 | *and* also the callback routine: | 286 | *and* also the callback routine: |
268 | 287 | ||
269 | button_dev.event = button_event; | 288 | button_dev->event = button_event; |
270 | 289 | ||
271 | int button_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); | 290 | int button_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); |
272 | { | 291 | { |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 84c3bd05c639..38d7db3262c7 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -64,6 +64,7 @@ parameter is applicable: | |||
64 | GENERIC_TIME The generic timeofday code is enabled. | 64 | GENERIC_TIME The generic timeofday code is enabled. |
65 | NFS Appropriate NFS support is enabled. | 65 | NFS Appropriate NFS support is enabled. |
66 | OSS OSS sound support is enabled. | 66 | OSS OSS sound support is enabled. |
67 | PV_OPS A paravirtualized kernel | ||
67 | PARIDE The ParIDE subsystem is enabled. | 68 | PARIDE The ParIDE subsystem is enabled. |
68 | PARISC The PA-RISC architecture is enabled. | 69 | PARISC The PA-RISC architecture is enabled. |
69 | PCI PCI bus support is enabled. | 70 | PCI PCI bus support is enabled. |
@@ -695,8 +696,15 @@ and is between 256 and 4096 characters. It is defined in the file | |||
695 | idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed | 696 | idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed |
696 | See Documentation/ide.txt. | 697 | See Documentation/ide.txt. |
697 | 698 | ||
698 | idle= [HW] | 699 | idle= [X86] |
699 | Format: idle=poll or idle=halt | 700 | Format: idle=poll or idle=mwait |
701 | Poll forces a polling idle loop that can slightly improves the performance | ||
702 | of waking up a idle CPU, but will use a lot of power and make the system | ||
703 | run hot. Not recommended. | ||
704 | idle=mwait. On systems which support MONITOR/MWAIT but the kernel chose | ||
705 | to not use it because it doesn't save as much power as a normal idle | ||
706 | loop use the MONITOR/MWAIT idle loop anyways. Performance should be the same | ||
707 | as idle=poll. | ||
700 | 708 | ||
701 | ignore_loglevel [KNL] | 709 | ignore_loglevel [KNL] |
702 | Ignore loglevel setting - this will print /all/ | 710 | Ignore loglevel setting - this will print /all/ |
@@ -1157,6 +1165,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1157 | 1165 | ||
1158 | nomce [IA-32] Machine Check Exception | 1166 | nomce [IA-32] Machine Check Exception |
1159 | 1167 | ||
1168 | noreplace-paravirt [IA-32,PV_OPS] Don't patch paravirt_ops | ||
1169 | |||
1170 | noreplace-smp [IA-32,SMP] Don't replace SMP instructions | ||
1171 | with UP alternatives | ||
1172 | |||
1160 | noresidual [PPC] Don't use residual data on PReP machines. | 1173 | noresidual [PPC] Don't use residual data on PReP machines. |
1161 | 1174 | ||
1162 | noresume [SWSUSP] Disables resume and restores original swap | 1175 | noresume [SWSUSP] Disables resume and restores original swap |
@@ -1562,6 +1575,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1562 | smart2= [HW] | 1575 | smart2= [HW] |
1563 | Format: <io1>[,<io2>[,...,<io8>]] | 1576 | Format: <io1>[,<io2>[,...,<io8>]] |
1564 | 1577 | ||
1578 | smp-alt-once [IA-32,SMP] On a hotplug CPU system, only | ||
1579 | attempt to substitute SMP alternatives once at boot. | ||
1580 | |||
1565 | snd-ad1816a= [HW,ALSA] | 1581 | snd-ad1816a= [HW,ALSA] |
1566 | 1582 | ||
1567 | snd-ad1848= [HW,ALSA] | 1583 | snd-ad1848= [HW,ALSA] |
@@ -1820,6 +1836,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1820 | [USBHID] The interval which mice are to be polled at. | 1836 | [USBHID] The interval which mice are to be polled at. |
1821 | 1837 | ||
1822 | vdso= [IA-32,SH] | 1838 | vdso= [IA-32,SH] |
1839 | vdso=2: enable compat VDSO (default with COMPAT_VDSO) | ||
1823 | vdso=1: enable VDSO (default) | 1840 | vdso=1: enable VDSO (default) |
1824 | vdso=0: disable VDSO mapping | 1841 | vdso=0: disable VDSO mapping |
1825 | 1842 | ||
diff --git a/Documentation/pci.txt b/Documentation/pci.txt index cdf2f3c0ab14..e2c9d0a0c43d 100644 --- a/Documentation/pci.txt +++ b/Documentation/pci.txt | |||
@@ -124,10 +124,6 @@ initialization with a pointer to a structure describing the driver | |||
124 | 124 | ||
125 | err_handler See Documentation/pci-error-recovery.txt | 125 | err_handler See Documentation/pci-error-recovery.txt |
126 | 126 | ||
127 | multithread_probe Enable multi-threaded probe/scan. Driver must | ||
128 | provide its own locking/syncronization for init | ||
129 | operations if this is enabled. | ||
130 | |||
131 | 127 | ||
132 | The ID table is an array of struct pci_device_id entries ending with an | 128 | The ID table is an array of struct pci_device_id entries ending with an |
133 | all-zero entry. Each entry consists of: | 129 | all-zero entry. Each entry consists of: |
@@ -163,9 +159,9 @@ echo "vendor device subvendor subdevice class class_mask driver_data" > \ | |||
163 | /sys/bus/pci/drivers/{driver}/new_id | 159 | /sys/bus/pci/drivers/{driver}/new_id |
164 | 160 | ||
165 | All fields are passed in as hexadecimal values (no leading 0x). | 161 | All fields are passed in as hexadecimal values (no leading 0x). |
166 | Users need pass only as many fields as necessary: | 162 | The vendor and device fields are mandatory, the others are optional. Users |
167 | o vendor, device, subvendor, and subdevice fields default | 163 | need pass only as many optional fields as necessary: |
168 | to PCI_ANY_ID (FFFFFFFF), | 164 | o subvendor and subdevice fields default to PCI_ANY_ID (FFFFFFFF) |
169 | o class and classmask fields default to 0 | 165 | o class and classmask fields default to 0 |
170 | o driver_data defaults to 0UL. | 166 | o driver_data defaults to 0UL. |
171 | 167 | ||
@@ -549,8 +545,6 @@ pci_find_slot() Find pci_dev corresponding to given bus and | |||
549 | pci_set_power_state() Set PCI Power Management state (0=D0 ... 3=D3) | 545 | pci_set_power_state() Set PCI Power Management state (0=D0 ... 3=D3) |
550 | pci_find_capability() Find specified capability in device's capability | 546 | pci_find_capability() Find specified capability in device's capability |
551 | list. | 547 | list. |
552 | pci_module_init() Inline helper function for ensuring correct | ||
553 | pci_driver initialization and error handling. | ||
554 | pci_resource_start() Returns bus start address for a given PCI region | 548 | pci_resource_start() Returns bus start address for a given PCI region |
555 | pci_resource_end() Returns bus end address for a given PCI region | 549 | pci_resource_end() Returns bus end address for a given PCI region |
556 | pci_resource_len() Returns the byte length of a PCI region | 550 | pci_resource_len() Returns the byte length of a PCI region |
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt index b6a3cbf7e846..e00b099a4b86 100644 --- a/Documentation/power/pci.txt +++ b/Documentation/power/pci.txt | |||
@@ -203,7 +203,7 @@ resume | |||
203 | 203 | ||
204 | Usage: | 204 | Usage: |
205 | 205 | ||
206 | if (dev->driver && dev->driver->suspend) | 206 | if (dev->driver && dev->driver->resume) |
207 | dev->driver->resume(dev) | 207 | dev->driver->resume(dev) |
208 | 208 | ||
209 | The resume callback may be called from any power state, and is always meant to | 209 | The resume callback may be called from any power state, and is always meant to |
diff --git a/Documentation/scsi/aacraid.txt b/Documentation/scsi/aacraid.txt index dc8e44fc650f..2368e7e4a8cf 100644 --- a/Documentation/scsi/aacraid.txt +++ b/Documentation/scsi/aacraid.txt | |||
@@ -37,7 +37,11 @@ Supported Cards/Chipsets | |||
37 | 9005:0286:9005:029d Adaptec 2420SA (Intruder HP release) | 37 | 9005:0286:9005:029d Adaptec 2420SA (Intruder HP release) |
38 | 9005:0286:9005:02ac Adaptec 1800 (Typhoon44) | 38 | 9005:0286:9005:02ac Adaptec 1800 (Typhoon44) |
39 | 9005:0285:9005:02b5 Adaptec 5445 (Voodoo44) | 39 | 9005:0285:9005:02b5 Adaptec 5445 (Voodoo44) |
40 | 9005:0285:15d9:02b5 SMC AOC-USAS-S4i | ||
41 | 9005:0285:15d9:02c9 SMC AOC-USAS-S4iR | ||
40 | 9005:0285:9005:02b6 Adaptec 5805 (Voodoo80) | 42 | 9005:0285:9005:02b6 Adaptec 5805 (Voodoo80) |
43 | 9005:0285:15d9:02b6 SMC AOC-USAS-S8i | ||
44 | 9005:0285:15d9:02ca SMC AOC-USAS-S8iR | ||
41 | 9005:0285:9005:02b7 Adaptec 5085 (Voodoo08) | 45 | 9005:0285:9005:02b7 Adaptec 5085 (Voodoo08) |
42 | 9005:0285:9005:02bb Adaptec 3405 (Marauder40LP) | 46 | 9005:0285:9005:02bb Adaptec 3405 (Marauder40LP) |
43 | 9005:0285:9005:02bc Adaptec 3805 (Marauder80LP) | 47 | 9005:0285:9005:02bc Adaptec 3805 (Marauder80LP) |
@@ -93,6 +97,9 @@ Supported Cards/Chipsets | |||
93 | 9005:0286:9005:02ae (Aurora Lite ARK) | 97 | 9005:0286:9005:02ae (Aurora Lite ARK) |
94 | 9005:0285:9005:02b0 (Sunrise Lake ARK) | 98 | 9005:0285:9005:02b0 (Sunrise Lake ARK) |
95 | 9005:0285:9005:02b1 Adaptec (Voodoo 8 internal 8 external) | 99 | 9005:0285:9005:02b1 Adaptec (Voodoo 8 internal 8 external) |
100 | 9005:0285:108e:7aac SUN STK RAID REM (Voodoo44 Coyote) | ||
101 | 9005:0285:108e:0286 SUN SG-XPCIESAS-R-IN (Cougar) | ||
102 | 9005:0285:108e:0287 SUN SG-XPCIESAS-R-EX (Prometheus) | ||
96 | 103 | ||
97 | People | 104 | People |
98 | ------------------------- | 105 | ------------------------- |
diff --git a/Documentation/scsi/ncr53c8xx.txt b/Documentation/scsi/ncr53c8xx.txt index caf10b155185..88ef88b949f7 100644 --- a/Documentation/scsi/ncr53c8xx.txt +++ b/Documentation/scsi/ncr53c8xx.txt | |||
@@ -562,11 +562,6 @@ if only one has a flaw for some SCSI feature, you can disable the | |||
562 | support by the driver of this feature at linux start-up and enable | 562 | support by the driver of this feature at linux start-up and enable |
563 | this feature after boot-up only for devices that support it safely. | 563 | this feature after boot-up only for devices that support it safely. |
564 | 564 | ||
565 | CONFIG_SCSI_NCR53C8XX_PROFILE_SUPPORT (default answer: n) | ||
566 | This option must be set for profiling information to be gathered | ||
567 | and printed out through the proc file system. This features may | ||
568 | impact performances. | ||
569 | |||
570 | CONFIG_SCSI_NCR53C8XX_IOMAPPED (default answer: n) | 565 | CONFIG_SCSI_NCR53C8XX_IOMAPPED (default answer: n) |
571 | Answer "y" if you suspect your mother board to not allow memory mapped I/O. | 566 | Answer "y" if you suspect your mother board to not allow memory mapped I/O. |
572 | May slow down performance a little. This option is required by | 567 | May slow down performance a little. This option is required by |
diff --git a/Documentation/spi/pxa2xx b/Documentation/spi/pxa2xx index f9717fe9bd85..215e3b8e7266 100644 --- a/Documentation/spi/pxa2xx +++ b/Documentation/spi/pxa2xx | |||
@@ -62,7 +62,7 @@ static struct resource pxa_spi_nssp_resources[] = { | |||
62 | 62 | ||
63 | static struct pxa2xx_spi_master pxa_nssp_master_info = { | 63 | static struct pxa2xx_spi_master pxa_nssp_master_info = { |
64 | .ssp_type = PXA25x_NSSP, /* Type of SSP */ | 64 | .ssp_type = PXA25x_NSSP, /* Type of SSP */ |
65 | .clock_enable = CKEN9_NSSP, /* NSSP Peripheral clock */ | 65 | .clock_enable = CKEN_NSSP, /* NSSP Peripheral clock */ |
66 | .num_chipselect = 1, /* Matches the number of chips attached to NSSP */ | 66 | .num_chipselect = 1, /* Matches the number of chips attached to NSSP */ |
67 | .enable_dma = 1, /* Enables NSSP DMA */ | 67 | .enable_dma = 1, /* Enables NSSP DMA */ |
68 | }; | 68 | }; |
diff --git a/Documentation/usb/usb-serial.txt b/Documentation/usb/usb-serial.txt index d61f6e7865de..b18e86a22506 100644 --- a/Documentation/usb/usb-serial.txt +++ b/Documentation/usb/usb-serial.txt | |||
@@ -42,7 +42,7 @@ ConnectTech WhiteHEAT 4 port converter | |||
42 | http://www.connecttech.com | 42 | http://www.connecttech.com |
43 | 43 | ||
44 | For any questions or problems with this driver, please contact | 44 | For any questions or problems with this driver, please contact |
45 | Stuart MacDonald at stuartm@connecttech.com | 45 | Connect Tech's Support Department at support@connecttech.com |
46 | 46 | ||
47 | 47 | ||
48 | HandSpring Visor, Palm USB, and Clié USB driver | 48 | HandSpring Visor, Palm USB, and Clié USB driver |
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt index 85f51e5a749f..6177d881983f 100644 --- a/Documentation/x86_64/boot-options.txt +++ b/Documentation/x86_64/boot-options.txt | |||
@@ -149,7 +149,19 @@ NUMA | |||
149 | 149 | ||
150 | numa=noacpi Don't parse the SRAT table for NUMA setup | 150 | numa=noacpi Don't parse the SRAT table for NUMA setup |
151 | 151 | ||
152 | numa=fake=X Fake X nodes and ignore NUMA setup of the actual machine. | 152 | numa=fake=CMDLINE |
153 | If a number, fakes CMDLINE nodes and ignores NUMA setup of the | ||
154 | actual machine. Otherwise, system memory is configured | ||
155 | depending on the sizes and coefficients listed. For example: | ||
156 | numa=fake=2*512,1024,4*256,*128 | ||
157 | gives two 512M nodes, a 1024M node, four 256M nodes, and the | ||
158 | rest split into 128M chunks. If the last character of CMDLINE | ||
159 | is a *, the remaining memory is divided up equally among its | ||
160 | coefficient: | ||
161 | numa=fake=2*512,2* | ||
162 | gives two 512M nodes and the rest split into two nodes. | ||
163 | Otherwise, the remaining system RAM is allocated to an | ||
164 | additional node. | ||
153 | 165 | ||
154 | numa=hotadd=percent | 166 | numa=hotadd=percent |
155 | Only allow hotadd memory to preallocate page structures upto | 167 | Only allow hotadd memory to preallocate page structures upto |
diff --git a/Documentation/x86_64/fake-numa-for-cpusets b/Documentation/x86_64/fake-numa-for-cpusets new file mode 100644 index 000000000000..d1a985c5b00a --- /dev/null +++ b/Documentation/x86_64/fake-numa-for-cpusets | |||
@@ -0,0 +1,66 @@ | |||
1 | Using numa=fake and CPUSets for Resource Management | ||
2 | Written by David Rientjes <rientjes@cs.washington.edu> | ||
3 | |||
4 | This document describes how the numa=fake x86_64 command-line option can be used | ||
5 | in conjunction with cpusets for coarse memory management. Using this feature, | ||
6 | you can create fake NUMA nodes that represent contiguous chunks of memory and | ||
7 | assign them to cpusets and their attached tasks. This is a way of limiting the | ||
8 | amount of system memory that are available to a certain class of tasks. | ||
9 | |||
10 | For more information on the features of cpusets, see Documentation/cpusets.txt. | ||
11 | There are a number of different configurations you can use for your needs. For | ||
12 | more information on the numa=fake command line option and its various ways of | ||
13 | configuring fake nodes, see Documentation/x86_64/boot-options.txt. | ||
14 | |||
15 | For the purposes of this introduction, we'll assume a very primitive NUMA | ||
16 | emulation setup of "numa=fake=4*512,". This will split our system memory into | ||
17 | four equal chunks of 512M each that we can now use to assign to cpusets. As | ||
18 | you become more familiar with using this combination for resource control, | ||
19 | you'll determine a better setup to minimize the number of nodes you have to deal | ||
20 | with. | ||
21 | |||
22 | A machine may be split as follows with "numa=fake=4*512," as reported by dmesg: | ||
23 | |||
24 | Faking node 0 at 0000000000000000-0000000020000000 (512MB) | ||
25 | Faking node 1 at 0000000020000000-0000000040000000 (512MB) | ||
26 | Faking node 2 at 0000000040000000-0000000060000000 (512MB) | ||
27 | Faking node 3 at 0000000060000000-0000000080000000 (512MB) | ||
28 | ... | ||
29 | On node 0 totalpages: 130975 | ||
30 | On node 1 totalpages: 131072 | ||
31 | On node 2 totalpages: 131072 | ||
32 | On node 3 totalpages: 131072 | ||
33 | |||
34 | Now following the instructions for mounting the cpusets filesystem from | ||
35 | Documentation/cpusets.txt, you can assign fake nodes (i.e. contiguous memory | ||
36 | address spaces) to individual cpusets: | ||
37 | |||
38 | [root@xroads /]# mkdir exampleset | ||
39 | [root@xroads /]# mount -t cpuset none exampleset | ||
40 | [root@xroads /]# mkdir exampleset/ddset | ||
41 | [root@xroads /]# cd exampleset/ddset | ||
42 | [root@xroads /exampleset/ddset]# echo 0-1 > cpus | ||
43 | [root@xroads /exampleset/ddset]# echo 0-1 > mems | ||
44 | |||
45 | Now this cpuset, 'ddset', will only allowed access to fake nodes 0 and 1 for | ||
46 | memory allocations (1G). | ||
47 | |||
48 | You can now assign tasks to these cpusets to limit the memory resources | ||
49 | available to them according to the fake nodes assigned as mems: | ||
50 | |||
51 | [root@xroads /exampleset/ddset]# echo $$ > tasks | ||
52 | [root@xroads /exampleset/ddset]# dd if=/dev/zero of=tmp bs=1024 count=1G | ||
53 | [1] 13425 | ||
54 | |||
55 | Notice the difference between the system memory usage as reported by | ||
56 | /proc/meminfo between the restricted cpuset case above and the unrestricted | ||
57 | case (i.e. running the same 'dd' command without assigning it to a fake NUMA | ||
58 | cpuset): | ||
59 | Unrestricted Restricted | ||
60 | MemTotal: 3091900 kB 3091900 kB | ||
61 | MemFree: 42113 kB 1513236 kB | ||
62 | |||
63 | This allows for coarse memory management for the tasks you assign to particular | ||
64 | cpusets. Since cpusets can form a hierarchy, you can create some pretty | ||
65 | interesting combinations of use-cases for various classes of tasks for your | ||
66 | memory management needs. | ||
diff --git a/Documentation/x86_64/machinecheck b/Documentation/x86_64/machinecheck index 068a6d9904b9..feaeaf6f6e4d 100644 --- a/Documentation/x86_64/machinecheck +++ b/Documentation/x86_64/machinecheck | |||
@@ -36,7 +36,12 @@ between all CPUs. | |||
36 | 36 | ||
37 | check_interval | 37 | check_interval |
38 | How often to poll for corrected machine check errors, in seconds | 38 | How often to poll for corrected machine check errors, in seconds |
39 | (Note output is hexademical). Default 5 minutes. | 39 | (Note output is hexademical). Default 5 minutes. When the poller |
40 | finds MCEs it triggers an exponential speedup (poll more often) on | ||
41 | the polling interval. When the poller stops finding MCEs, it | ||
42 | triggers an exponential backoff (poll less often) on the polling | ||
43 | interval. The check_interval variable is both the initial and | ||
44 | maximum polling interval. | ||
40 | 45 | ||
41 | tolerant | 46 | tolerant |
42 | Tolerance level. When a machine check exception occurs for a non | 47 | Tolerance level. When a machine check exception occurs for a non |