aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/debugfs-pktcdvd5
-rw-r--r--Documentation/ABI/testing/sysfs-class-pktcdvd2
-rw-r--r--Documentation/DocBook/gadget.tmpl4
-rw-r--r--Documentation/DocBook/kernel-api.tmpl3
-rw-r--r--Documentation/DocBook/stylesheet.xsl1
-rw-r--r--Documentation/DocBook/usb.tmpl6
-rw-r--r--Documentation/HOWTO1
-rw-r--r--Documentation/acpi-hotkey.txt38
-rw-r--r--Documentation/auxdisplay/cfag12864b105
-rw-r--r--Documentation/auxdisplay/cfag12864b-example.c282
-rw-r--r--Documentation/auxdisplay/ks010855
-rw-r--r--Documentation/cdrom/packet-writing.txt2
-rw-r--r--Documentation/crypto/api-intro.txt4
-rw-r--r--Documentation/driver-model/devres.txt268
-rw-r--r--Documentation/drivers/edac/edac.txt16
-rw-r--r--Documentation/fb/s3fb.txt78
-rw-r--r--Documentation/feature-removal-schedule.txt88
-rw-r--r--Documentation/filesystems/relay.txt9
-rw-r--r--Documentation/filesystems/ufs.txt9
-rw-r--r--Documentation/gpio.txt274
-rw-r--r--Documentation/hrtimer/timer_stats.txt68
-rw-r--r--Documentation/hrtimers/highres.txt249
-rw-r--r--Documentation/hrtimers/hrtimers.txt (renamed from Documentation/hrtimers.txt)0
-rw-r--r--Documentation/i2c/busses/i2c-i80160
-rw-r--r--Documentation/i2c/busses/i2c-parport15
-rw-r--r--Documentation/i2c/busses/i2c-piix42
-rw-r--r--Documentation/i2c/busses/i2c-viapro7
-rw-r--r--Documentation/i2c/porting-clients6
-rw-r--r--Documentation/i2c/smbus-protocol2
-rw-r--r--Documentation/i2c/writing-clients58
-rw-r--r--Documentation/ioctl-number.txt3
-rw-r--r--Documentation/isdn/README.gigaset65
-rw-r--r--Documentation/kdump/kdump.txt8
-rw-r--r--Documentation/kernel-doc-nano-HOWTO.txt39
-rw-r--r--Documentation/kernel-parameters.txt24
-rw-r--r--Documentation/local_ops.txt163
-rw-r--r--Documentation/nfsroot.txt4
-rw-r--r--Documentation/pci.txt4
-rw-r--r--Documentation/powerpc/booting-without-of.txt18
-rw-r--r--Documentation/powerpc/mpc52xx-device-tree-bindings.txt183
-rw-r--r--Documentation/rbtree.txt192
-rw-r--r--Documentation/rtc.txt46
-rw-r--r--Documentation/s390/Debugging390.txt2
-rw-r--r--Documentation/scsi/ChangeLog.megaraid16
-rw-r--r--Documentation/sony-laptop.txt106
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt60
-rw-r--r--Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl4
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl33
-rw-r--r--Documentation/sound/alsa/hda_codec.txt10
-rw-r--r--Documentation/sound/alsa/soc/DAI.txt56
-rw-r--r--Documentation/sound/alsa/soc/clocking.txt51
-rw-r--r--Documentation/sound/alsa/soc/codec.txt197
-rw-r--r--Documentation/sound/alsa/soc/dapm.txt297
-rw-r--r--Documentation/sound/alsa/soc/machine.txt113
-rw-r--r--Documentation/sound/alsa/soc/overview.txt83
-rw-r--r--Documentation/sound/alsa/soc/platform.txt58
-rw-r--r--Documentation/sound/alsa/soc/pops_clicks.txt52
-rw-r--r--Documentation/spi/spi-summary3
-rw-r--r--Documentation/sysrq.txt44
-rw-r--r--Documentation/usb/proc_usb_info.txt21
-rw-r--r--Documentation/usb/usbmon.txt152
-rw-r--r--Documentation/video-output.txt34
-rw-r--r--Documentation/x86_64/boot-options.txt132
-rw-r--r--Documentation/x86_64/cpu-hotplug-spec2
-rw-r--r--Documentation/x86_64/kernel-stacks26
-rw-r--r--Documentation/x86_64/machinecheck70
-rw-r--r--Documentation/x86_64/mm.txt22
67 files changed, 3727 insertions, 383 deletions
diff --git a/Documentation/ABI/testing/debugfs-pktcdvd b/Documentation/ABI/testing/debugfs-pktcdvd
index 03dbd883cc41..bf9c16b64c34 100644
--- a/Documentation/ABI/testing/debugfs-pktcdvd
+++ b/Documentation/ABI/testing/debugfs-pktcdvd
@@ -1,6 +1,6 @@
1What: /debug/pktcdvd/pktcdvd[0-7] 1What: /debug/pktcdvd/pktcdvd[0-7]
2Date: Oct. 2006 2Date: Oct. 2006
3KernelVersion: 2.6.19 3KernelVersion: 2.6.20
4Contact: Thomas Maier <balagi@justmail.de> 4Contact: Thomas Maier <balagi@justmail.de>
5Description: 5Description:
6 6
@@ -11,8 +11,7 @@ The pktcdvd module (packet writing driver) creates
11these files in debugfs: 11these files in debugfs:
12 12
13/debug/pktcdvd/pktcdvd[0-7]/ 13/debug/pktcdvd/pktcdvd[0-7]/
14 info (0444) Lots of human readable driver 14 info (0444) Lots of driver statistics and infos.
15 statistics and infos. Multiple lines!
16 15
17Example: 16Example:
18------- 17-------
diff --git a/Documentation/ABI/testing/sysfs-class-pktcdvd b/Documentation/ABI/testing/sysfs-class-pktcdvd
index c4c55edc9a5c..b1c3f0263359 100644
--- a/Documentation/ABI/testing/sysfs-class-pktcdvd
+++ b/Documentation/ABI/testing/sysfs-class-pktcdvd
@@ -1,6 +1,6 @@
1What: /sys/class/pktcdvd/ 1What: /sys/class/pktcdvd/
2Date: Oct. 2006 2Date: Oct. 2006
3KernelVersion: 2.6.19 3KernelVersion: 2.6.20
4Contact: Thomas Maier <balagi@justmail.de> 4Contact: Thomas Maier <balagi@justmail.de>
5Description: 5Description:
6 6
diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl
index a34442436128..e7fc96433408 100644
--- a/Documentation/DocBook/gadget.tmpl
+++ b/Documentation/DocBook/gadget.tmpl
@@ -482,13 +482,13 @@ slightly.
482<para>Gadget drivers 482<para>Gadget drivers
483rely on common USB structures and constants 483rely on common USB structures and constants
484defined in the 484defined in the
485<filename>&lt;linux/usb_ch9.h&gt;</filename> 485<filename>&lt;linux/usb/ch9.h&gt;</filename>
486header file, which is standard in Linux 2.6 kernels. 486header file, which is standard in Linux 2.6 kernels.
487These are the same types and constants used by host 487These are the same types and constants used by host
488side drivers (and usbcore). 488side drivers (and usbcore).
489</para> 489</para>
490 490
491!Iinclude/linux/usb_ch9.h 491!Iinclude/linux/usb/ch9.h
492</sect1> 492</sect1>
493 493
494<sect1 id="core"><title>Core Objects and Methods</title> 494<sect1 id="core"><title>Core Objects and Methods</title>
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 3fa0c4b4541e..0bb90237e230 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -316,6 +316,9 @@ X!Earch/i386/kernel/mca.c
316 <sect1><title>DMI Interfaces</title> 316 <sect1><title>DMI Interfaces</title>
317!Edrivers/firmware/dmi_scan.c 317!Edrivers/firmware/dmi_scan.c
318 </sect1> 318 </sect1>
319 <sect1><title>EDD Interfaces</title>
320!Idrivers/firmware/edd.c
321 </sect1>
319 </chapter> 322 </chapter>
320 323
321 <chapter id="security"> 324 <chapter id="security">
diff --git a/Documentation/DocBook/stylesheet.xsl b/Documentation/DocBook/stylesheet.xsl
index 3ccce886c349..974e17ccf106 100644
--- a/Documentation/DocBook/stylesheet.xsl
+++ b/Documentation/DocBook/stylesheet.xsl
@@ -4,4 +4,5 @@
4<param name="funcsynopsis.style">ansi</param> 4<param name="funcsynopsis.style">ansi</param>
5<param name="funcsynopsis.tabular.threshold">80</param> 5<param name="funcsynopsis.tabular.threshold">80</param>
6<!-- <param name="paper.type">A4</param> --> 6<!-- <param name="paper.type">A4</param> -->
7<param name="generate.section.toc.level">2</param>
7</stylesheet> 8</stylesheet>
diff --git a/Documentation/DocBook/usb.tmpl b/Documentation/DocBook/usb.tmpl
index 143e5ff7deb8..a2ebd651b05a 100644
--- a/Documentation/DocBook/usb.tmpl
+++ b/Documentation/DocBook/usb.tmpl
@@ -187,13 +187,13 @@
187 187
188<chapter><title>USB-Standard Types</title> 188<chapter><title>USB-Standard Types</title>
189 189
190 <para>In <filename>&lt;linux/usb_ch9.h&gt;</filename> you will find 190 <para>In <filename>&lt;linux/usb/ch9.h&gt;</filename> you will find
191 the USB data types defined in chapter 9 of the USB specification. 191 the USB data types defined in chapter 9 of the USB specification.
192 These data types are used throughout USB, and in APIs including 192 These data types are used throughout USB, and in APIs including
193 this host side API, gadget APIs, and usbfs. 193 this host side API, gadget APIs, and usbfs.
194 </para> 194 </para>
195 195
196!Iinclude/linux/usb_ch9.h 196!Iinclude/linux/usb/ch9.h
197 197
198 </chapter> 198 </chapter>
199 199
@@ -574,7 +574,7 @@ for (;;) {
574#include &lt;asm/byteorder.h&gt;</programlisting> 574#include &lt;asm/byteorder.h&gt;</programlisting>
575 The standard USB device model requests, from "Chapter 9" of 575 The standard USB device model requests, from "Chapter 9" of
576 the USB 2.0 specification, are automatically included from 576 the USB 2.0 specification, are automatically included from
577 the <filename>&lt;linux/usb_ch9.h&gt;</filename> header. 577 the <filename>&lt;linux/usb/ch9.h&gt;</filename> header.
578 </para> 578 </para>
579 579
580 <para>Unless noted otherwise, the ioctl requests 580 <para>Unless noted otherwise, the ioctl requests
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index 8d51c148f721..48123dba5e6a 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -30,6 +30,7 @@ are not a good substitute for a solid C education and/or years of
30experience, the following books are good for, if anything, reference: 30experience, the following books are good for, if anything, reference:
31 - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] 31 - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
32 - "Practical C Programming" by Steve Oualline [O'Reilly] 32 - "Practical C Programming" by Steve Oualline [O'Reilly]
33 - "C: A Reference Manual" by Harbison and Steele [Prentice Hall]
33 34
34The kernel is written using GNU C and the GNU toolchain. While it 35The kernel is written using GNU C and the GNU toolchain. While it
35adheres to the ISO C89 standard, it uses a number of extensions that are 36adheres to the ISO C89 standard, it uses a number of extensions that are
diff --git a/Documentation/acpi-hotkey.txt b/Documentation/acpi-hotkey.txt
deleted file mode 100644
index 38040fa37649..000000000000
--- a/Documentation/acpi-hotkey.txt
+++ /dev/null
@@ -1,38 +0,0 @@
1driver/acpi/hotkey.c implement:
21. /proc/acpi/hotkey/event_config
3(event based hotkey or event config interface):
4a. add a event based hotkey(event) :
5echo "0:bus::action:method:num:num" > event_config
6
7b. delete a event based hotkey(event):
8echo "1:::::num:num" > event_config
9
10c. modify a event based hotkey(event):
11echo "2:bus::action:method:num:num" > event_config
12
132. /proc/acpi/hotkey/poll_config
14(polling based hotkey or event config interface):
15a.add a polling based hotkey(event) :
16echo "0:bus:method:action:method:num" > poll_config
17this adding command will create a proc file
18/proc/acpi/hotkey/method, which is used to get
19result of polling.
20
21b.delete a polling based hotkey(event):
22echo "1:::::num" > event_config
23
24c.modify a polling based hotkey(event):
25echo "2:bus:method:action:method:num" > poll_config
26
273./proc/acpi/hotkey/action
28(interface to call aml method associated with a
29specific hotkey(event))
30echo "event_num:event_type:event_argument" >
31 /proc/acpi/hotkey/action.
32The result of the execution of this aml method is
33attached to /proc/acpi/hotkey/poll_method, which is dynamically
34created. Please use command "cat /proc/acpi/hotkey/polling_method"
35to retrieve it.
36
37Note: Use cmdline "acpi_generic_hotkey" to over-ride
38platform-specific with generic driver.
diff --git a/Documentation/auxdisplay/cfag12864b b/Documentation/auxdisplay/cfag12864b
new file mode 100644
index 000000000000..3572b98f45b8
--- /dev/null
+++ b/Documentation/auxdisplay/cfag12864b
@@ -0,0 +1,105 @@
1 ===================================
2 cfag12864b LCD Driver Documentation
3 ===================================
4
5License: GPLv2
6Author & Maintainer: Miguel Ojeda Sandonis <maxextreme@gmail.com>
7Date: 2006-10-27
8
9
10
11--------
120. INDEX
13--------
14
15 1. DRIVER INFORMATION
16 2. DEVICE INFORMATION
17 3. WIRING
18 4. USERSPACE PROGRAMMING
19
20
21---------------------
221. DRIVER INFORMATION
23---------------------
24
25This driver support one cfag12864b display at time.
26
27
28---------------------
292. DEVICE INFORMATION
30---------------------
31
32Manufacturer: Crystalfontz
33Device Name: Crystalfontz 12864b LCD Series
34Device Code: cfag12864b
35Webpage: http://www.crystalfontz.com
36Device Webpage: http://www.crystalfontz.com/products/12864b/
37Type: LCD (Liquid Crystal Display)
38Width: 128
39Height: 64
40Colors: 2 (B/N)
41Controller: ks0108
42Controllers: 2
43Pages: 8 each controller
44Addresses: 64 each page
45Data size: 1 byte each address
46Memory size: 2 * 8 * 64 * 1 = 1024 bytes = 1 Kbyte
47
48
49---------
503. WIRING
51---------
52
53The cfag12864b LCD Series don't have official wiring.
54
55The common wiring is done to the parallel port as shown:
56
57Parallel Port cfag12864b
58
59 Name Pin# Pin# Name
60
61Strobe ( 1)------------------------------(17) Enable
62Data 0 ( 2)------------------------------( 4) Data 0
63Data 1 ( 3)------------------------------( 5) Data 1
64Data 2 ( 4)------------------------------( 6) Data 2
65Data 3 ( 5)------------------------------( 7) Data 3
66Data 4 ( 6)------------------------------( 8) Data 4
67Data 5 ( 7)------------------------------( 9) Data 5
68Data 6 ( 8)------------------------------(10) Data 6
69Data 7 ( 9)------------------------------(11) Data 7
70 (10) [+5v]---( 1) Vdd
71 (11) [GND]---( 2) Ground
72 (12) [+5v]---(14) Reset
73 (13) [GND]---(15) Read / Write
74 Line (14)------------------------------(13) Controller Select 1
75 (15)
76 Init (16)------------------------------(12) Controller Select 2
77Select (17)------------------------------(16) Data / Instruction
78Ground (18)---[GND] [+5v]---(19) LED +
79Ground (19)---[GND]
80Ground (20)---[GND] E A Values:
81Ground (21)---[GND] [GND]---[P1]---(18) Vee · R = Resistor = 22 ohm
82Ground (22)---[GND] | · P1 = Preset = 10 Kohm
83Ground (23)---[GND] ---- S ------( 3) V0 · P2 = Preset = 1 Kohm
84Ground (24)---[GND] | |
85Ground (25)---[GND] [GND]---[P2]---[R]---(20) LED -
86
87
88------------------------
894. USERSPACE PROGRAMMING
90------------------------
91
92The cfag12864bfb describes a framebuffer device (/dev/fbX).
93
94It has a size of 1024 bytes = 1 Kbyte.
95Each bit represents one pixel. If the bit is high, the pixel will
96turn on. If the pixel is low, the pixel will turn off.
97
98You can use the framebuffer as a file: fopen, fwrite, fclose...
99Although the LCD won't get updated until the next refresh time arrives.
100
101Also, you can mmap the framebuffer: open & mmap, munmap & close...
102which is the best option for most uses.
103
104Check Documentation/auxdisplay/cfag12864b-example.c
105for a real working userspace complete program with usage examples.
diff --git a/Documentation/auxdisplay/cfag12864b-example.c b/Documentation/auxdisplay/cfag12864b-example.c
new file mode 100644
index 000000000000..7bfac354d4c9
--- /dev/null
+++ b/Documentation/auxdisplay/cfag12864b-example.c
@@ -0,0 +1,282 @@
1/*
2 * Filename: cfag12864b-example.c
3 * Version: 0.1.0
4 * Description: cfag12864b LCD userspace example program
5 * License: GPLv2
6 *
7 * Author: Copyright (C) Miguel Ojeda Sandonis <maxextreme@gmail.com>
8 * Date: 2006-10-31
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25/*
26 * ------------------------
27 * start of cfag12864b code
28 * ------------------------
29 */
30
31#include <string.h>
32#include <fcntl.h>
33#include <unistd.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <sys/mman.h>
37
38#define CFAG12864B_WIDTH (128)
39#define CFAG12864B_HEIGHT (64)
40#define CFAG12864B_SIZE (128 * 64 / 8)
41#define CFAG12864B_BPB (8)
42#define CFAG12864B_ADDRESS(x, y) ((y) * CFAG12864B_WIDTH / \
43 CFAG12864B_BPB + (x) / CFAG12864B_BPB)
44#define CFAG12864B_BIT(n) (((unsigned char) 1) << (n))
45
46#undef CFAG12864B_DOCHECK
47#ifdef CFAG12864B_DOCHECK
48 #define CFAG12864B_CHECK(x, y) ((x) < CFAG12864B_WIDTH && \
49 (y) < CFAG12864B_HEIGHT)
50#else
51 #define CFAG12864B_CHECK(x, y) (1)
52#endif
53
54int cfag12864b_fd;
55unsigned char * cfag12864b_mem;
56unsigned char cfag12864b_buffer[CFAG12864B_SIZE];
57
58/*
59 * init a cfag12864b framebuffer device
60 *
61 * No error: return = 0
62 * Unable to open: return = -1
63 * Unable to mmap: return = -2
64 */
65int cfag12864b_init(char *path)
66{
67 cfag12864b_fd = open(path, O_RDWR);
68 if (cfag12864b_fd == -1)
69 return -1;
70
71 cfag12864b_mem = mmap(0, CFAG12864B_SIZE, PROT_READ | PROT_WRITE,
72 MAP_SHARED, cfag12864b_fd, 0);
73 if (cfag12864b_mem == MAP_FAILED) {
74 close(cfag12864b_fd);
75 return -2;
76 }
77
78 return 0;
79}
80
81/*
82 * exit a cfag12864b framebuffer device
83 */
84void cfag12864b_exit(void)
85{
86 munmap(cfag12864b_mem, CFAG12864B_SIZE);
87 close(cfag12864b_fd);
88}
89
90/*
91 * set (x, y) pixel
92 */
93void cfag12864b_set(unsigned char x, unsigned char y)
94{
95 if (CFAG12864B_CHECK(x, y))
96 cfag12864b_buffer[CFAG12864B_ADDRESS(x, y)] |=
97 CFAG12864B_BIT(x % CFAG12864B_BPB);
98}
99
100/*
101 * unset (x, y) pixel
102 */
103void cfag12864b_unset(unsigned char x, unsigned char y)
104{
105 if (CFAG12864B_CHECK(x, y))
106 cfag12864b_buffer[CFAG12864B_ADDRESS(x, y)] &=
107 ~CFAG12864B_BIT(x % CFAG12864B_BPB);
108}
109
110/*
111 * is set (x, y) pixel?
112 *
113 * Pixel off: return = 0
114 * Pixel on: return = 1
115 */
116unsigned char cfag12864b_isset(unsigned char x, unsigned char y)
117{
118 if (CFAG12864B_CHECK(x, y))
119 if (cfag12864b_buffer[CFAG12864B_ADDRESS(x, y)] &
120 CFAG12864B_BIT(x % CFAG12864B_BPB))
121 return 1;
122
123 return 0;
124}
125
126/*
127 * not (x, y) pixel
128 */
129void cfag12864b_not(unsigned char x, unsigned char y)
130{
131 if (cfag12864b_isset(x, y))
132 cfag12864b_unset(x, y);
133 else
134 cfag12864b_set(x, y);
135}
136
137/*
138 * fill (set all pixels)
139 */
140void cfag12864b_fill(void)
141{
142 unsigned short i;
143
144 for (i = 0; i < CFAG12864B_SIZE; i++)
145 cfag12864b_buffer[i] = 0xFF;
146}
147
148/*
149 * clear (unset all pixels)
150 */
151void cfag12864b_clear(void)
152{
153 unsigned short i;
154
155 for (i = 0; i < CFAG12864B_SIZE; i++)
156 cfag12864b_buffer[i] = 0;
157}
158
159/*
160 * format a [128*64] matrix
161 *
162 * Pixel off: src[i] = 0
163 * Pixel on: src[i] > 0
164 */
165void cfag12864b_format(unsigned char * matrix)
166{
167 unsigned char i, j, n;
168
169 for (i = 0; i < CFAG12864B_HEIGHT; i++)
170 for (j = 0; j < CFAG12864B_WIDTH / CFAG12864B_BPB; j++) {
171 cfag12864b_buffer[i * CFAG12864B_WIDTH / CFAG12864B_BPB +
172 j] = 0;
173 for (n = 0; n < CFAG12864B_BPB; n++)
174 if (matrix[i * CFAG12864B_WIDTH +
175 j * CFAG12864B_BPB + n])
176 cfag12864b_buffer[i * CFAG12864B_WIDTH /
177 CFAG12864B_BPB + j] |=
178 CFAG12864B_BIT(n);
179 }
180}
181
182/*
183 * blit buffer to lcd
184 */
185void cfag12864b_blit(void)
186{
187 memcpy(cfag12864b_mem, cfag12864b_buffer, CFAG12864B_SIZE);
188}
189
190/*
191 * ----------------------
192 * end of cfag12864b code
193 * ----------------------
194 */
195
196#include <stdio.h>
197#include <string.h>
198
199#define EXAMPLES 6
200
201void example(unsigned char n)
202{
203 unsigned short i, j;
204 unsigned char matrix[CFAG12864B_WIDTH * CFAG12864B_HEIGHT];
205
206 if (n > EXAMPLES)
207 return;
208
209 printf("Example %i/%i - ", n, EXAMPLES);
210
211 switch (n) {
212 case 1:
213 printf("Draw points setting bits");
214 cfag12864b_clear();
215 for (i = 0; i < CFAG12864B_WIDTH; i += 2)
216 for (j = 0; j < CFAG12864B_HEIGHT; j += 2)
217 cfag12864b_set(i, j);
218 break;
219
220 case 2:
221 printf("Clear the LCD");
222 cfag12864b_clear();
223 break;
224
225 case 3:
226 printf("Draw rows formatting a [128*64] matrix");
227 memset(matrix, 0, CFAG12864B_WIDTH * CFAG12864B_HEIGHT);
228 for (i = 0; i < CFAG12864B_WIDTH; i++)
229 for (j = 0; j < CFAG12864B_HEIGHT; j += 2)
230 matrix[j * CFAG12864B_WIDTH + i] = 1;
231 cfag12864b_format(matrix);
232 break;
233
234 case 4:
235 printf("Fill the lcd");
236 cfag12864b_fill();
237 break;
238
239 case 5:
240 printf("Draw columns unsetting bits");
241 for (i = 0; i < CFAG12864B_WIDTH; i += 2)
242 for (j = 0; j < CFAG12864B_HEIGHT; j++)
243 cfag12864b_unset(i, j);
244 break;
245
246 case 6:
247 printf("Do negative not-ing all bits");
248 for (i = 0; i < CFAG12864B_WIDTH; i++)
249 for (j = 0; j < CFAG12864B_HEIGHT; j ++)
250 cfag12864b_not(i, j);
251 break;
252 }
253
254 puts(" - [Press Enter]");
255}
256
257int main(int argc, char *argv[])
258{
259 unsigned char n;
260
261 if (argc != 2) {
262 printf(
263 "Sintax: %s fbdev\n"
264 "Usually: /dev/fb0, /dev/fb1...\n", argv[0]);
265 return -1;
266 }
267
268 if (cfag12864b_init(argv[1])) {
269 printf("Can't init %s fbdev\n", argv[1]);
270 return -2;
271 }
272
273 for (n = 1; n <= EXAMPLES; n++) {
274 example(n);
275 cfag12864b_blit();
276 while (getchar() != '\n');
277 }
278
279 cfag12864b_exit();
280
281 return 0;
282}
diff --git a/Documentation/auxdisplay/ks0108 b/Documentation/auxdisplay/ks0108
new file mode 100644
index 000000000000..92b03b60c613
--- /dev/null
+++ b/Documentation/auxdisplay/ks0108
@@ -0,0 +1,55 @@
1 ==========================================
2 ks0108 LCD Controller Driver Documentation
3 ==========================================
4
5License: GPLv2
6Author & Maintainer: Miguel Ojeda Sandonis <maxextreme@gmail.com>
7Date: 2006-10-27
8
9
10
11--------
120. INDEX
13--------
14
15 1. DRIVER INFORMATION
16 2. DEVICE INFORMATION
17 3. WIRING
18
19
20---------------------
211. DRIVER INFORMATION
22---------------------
23
24This driver support the ks0108 LCD controller.
25
26
27---------------------
282. DEVICE INFORMATION
29---------------------
30
31Manufacturer: Samsung
32Device Name: KS0108 LCD Controller
33Device Code: ks0108
34Webpage: -
35Device Webpage: -
36Type: LCD Controller (Liquid Crystal Display Controller)
37Width: 64
38Height: 64
39Colors: 2 (B/N)
40Pages: 8
41Addresses: 64 each page
42Data size: 1 byte each address
43Memory size: 8 * 64 * 1 = 512 bytes
44
45
46---------
473. WIRING
48---------
49
50The driver supports data parallel port wiring.
51
52If you aren't building LCD related hardware, you should check
53your LCD specific wiring information in the same folder.
54
55For example, check Documentation/auxdisplay/cfag12864b.
diff --git a/Documentation/cdrom/packet-writing.txt b/Documentation/cdrom/packet-writing.txt
index 7715d2247c4d..cf1f8126991c 100644
--- a/Documentation/cdrom/packet-writing.txt
+++ b/Documentation/cdrom/packet-writing.txt
@@ -93,7 +93,7 @@ Notes
93Using the pktcdvd sysfs interface 93Using the pktcdvd sysfs interface
94--------------------------------- 94---------------------------------
95 95
96Since Linux 2.6.19, the pktcdvd module has a sysfs interface 96Since Linux 2.6.20, the pktcdvd module has a sysfs interface
97and can be controlled by it. For example the "pktcdvd" tool uses 97and can be controlled by it. For example the "pktcdvd" tool uses
98this interface. (see http://people.freenet.de/BalaGi#pktcdvd ) 98this interface. (see http://people.freenet.de/BalaGi#pktcdvd )
99 99
diff --git a/Documentation/crypto/api-intro.txt b/Documentation/crypto/api-intro.txt
index 5a03a2801d67..e41a79aa71ce 100644
--- a/Documentation/crypto/api-intro.txt
+++ b/Documentation/crypto/api-intro.txt
@@ -193,6 +193,7 @@ Original developers of the crypto algorithms:
193 Kartikey Mahendra Bhatt (CAST6) 193 Kartikey Mahendra Bhatt (CAST6)
194 Jon Oberheide (ARC4) 194 Jon Oberheide (ARC4)
195 Jouni Malinen (Michael MIC) 195 Jouni Malinen (Michael MIC)
196 NTT(Nippon Telegraph and Telephone Corporation) (Camellia)
196 197
197SHA1 algorithm contributors: 198SHA1 algorithm contributors:
198 Jean-Francois Dive 199 Jean-Francois Dive
@@ -246,6 +247,9 @@ Tiger algorithm contributors:
246VIA PadLock contributors: 247VIA PadLock contributors:
247 Michal Ludvig 248 Michal Ludvig
248 249
250Camellia algorithm contributors:
251 NTT(Nippon Telegraph and Telephone Corporation) (Camellia)
252
249Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com> 253Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com>
250 254
251Please send any credits updates or corrections to: 255Please send any credits updates or corrections to:
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
new file mode 100644
index 000000000000..5163b85308f5
--- /dev/null
+++ b/Documentation/driver-model/devres.txt
@@ -0,0 +1,268 @@
1Devres - Managed Device Resource
2================================
3
4Tejun Heo <teheo@suse.de>
5
6First draft 10 January 2007
7
8
91. Intro : Huh? Devres?
102. Devres : Devres in a nutshell
113. Devres Group : Group devres'es and release them together
124. Details : Life time rules, calling context, ...
135. Overhead : How much do we have to pay for this?
146. List of managed interfaces : Currently implemented managed interfaces
15
16
17 1. Intro
18 --------
19
20devres came up while trying to convert libata to use iomap. Each
21iomapped address should be kept and unmapped on driver detach. For
22example, a plain SFF ATA controller (that is, good old PCI IDE) in
23native mode makes use of 5 PCI BARs and all of them should be
24maintained.
25
26As with many other device drivers, libata low level drivers have
27sufficient bugs in ->remove and ->probe failure path. Well, yes,
28that's probably because libata low level driver developers are lazy
29bunch, but aren't all low level driver developers? After spending a
30day fiddling with braindamaged hardware with no document or
31braindamaged document, if it's finally working, well, it's working.
32
33For one reason or another, low level drivers don't receive as much
34attention or testing as core code, and bugs on driver detach or
35initilaization failure doesn't happen often enough to be noticeable.
36Init failure path is worse because it's much less travelled while
37needs to handle multiple entry points.
38
39So, many low level drivers end up leaking resources on driver detach
40and having half broken failure path implementation in ->probe() which
41would leak resources or even cause oops when failure occurs. iomap
42adds more to this mix. So do msi and msix.
43
44
45 2. Devres
46 ---------
47
48devres is basically linked list of arbitrarily sized memory areas
49associated with a struct device. Each devres entry is associated with
50a release function. A devres can be released in several ways. No
51matter what, all devres entries are released on driver detach. On
52release, the associated release function is invoked and then the
53devres entry is freed.
54
55Managed interface is created for resources commonly used by device
56drivers using devres. For example, coherent DMA memory is acquired
57using dma_alloc_coherent(). The managed version is called
58dmam_alloc_coherent(). It is identical to dma_alloc_coherent() except
59for the DMA memory allocated using it is managed and will be
60automatically released on driver detach. Implementation looks like
61the following.
62
63 struct dma_devres {
64 size_t size;
65 void *vaddr;
66 dma_addr_t dma_handle;
67 };
68
69 static void dmam_coherent_release(struct device *dev, void *res)
70 {
71 struct dma_devres *this = res;
72
73 dma_free_coherent(dev, this->size, this->vaddr, this->dma_handle);
74 }
75
76 dmam_alloc_coherent(dev, size, dma_handle, gfp)
77 {
78 struct dma_devres *dr;
79 void *vaddr;
80
81 dr = devres_alloc(dmam_coherent_release, sizeof(*dr), gfp);
82 ...
83
84 /* alloc DMA memory as usual */
85 vaddr = dma_alloc_coherent(...);
86 ...
87
88 /* record size, vaddr, dma_handle in dr */
89 dr->vaddr = vaddr;
90 ...
91
92 devres_add(dev, dr);
93
94 return vaddr;
95 }
96
97If a driver uses dmam_alloc_coherent(), the area is guaranteed to be
98freed whether initialization fails half-way or the device gets
99detached. If most resources are acquired using managed interface, a
100driver can have much simpler init and exit code. Init path basically
101looks like the following.
102
103 my_init_one()
104 {
105 struct mydev *d;
106
107 d = devm_kzalloc(dev, sizeof(*d), GFP_KERNEL);
108 if (!d)
109 return -ENOMEM;
110
111 d->ring = dmam_alloc_coherent(...);
112 if (!d->ring)
113 return -ENOMEM;
114
115 if (check something)
116 return -EINVAL;
117 ...
118
119 return register_to_upper_layer(d);
120 }
121
122And exit path,
123
124 my_remove_one()
125 {
126 unregister_from_upper_layer(d);
127 shutdown_my_hardware();
128 }
129
130As shown above, low level drivers can be simplified a lot by using
131devres. Complexity is shifted from less maintained low level drivers
132to better maintained higher layer. Also, as init failure path is
133shared with exit path, both can get more testing.
134
135
136 3. Devres group
137 ---------------
138
139Devres entries can be grouped using devres group. When a group is
140released, all contained normal devres entries and properly nested
141groups are released. One usage is to rollback series of acquired
142resources on failure. For example,
143
144 if (!devres_open_group(dev, NULL, GFP_KERNEL))
145 return -ENOMEM;
146
147 acquire A;
148 if (failed)
149 goto err;
150
151 acquire B;
152 if (failed)
153 goto err;
154 ...
155
156 devres_remove_group(dev, NULL);
157 return 0;
158
159 err:
160 devres_release_group(dev, NULL);
161 return err_code;
162
163As resource acquision failure usually means probe failure, constructs
164like above are usually useful in midlayer driver (e.g. libata core
165layer) where interface function shouldn't have side effect on failure.
166For LLDs, just returning error code suffices in most cases.
167
168Each group is identified by void *id. It can either be explicitly
169specified by @id argument to devres_open_group() or automatically
170created by passing NULL as @id as in the above example. In both
171cases, devres_open_group() returns the group's id. The returned id
172can be passed to other devres functions to select the target group.
173If NULL is given to those functions, the latest open group is
174selected.
175
176For example, you can do something like the following.
177
178 int my_midlayer_create_something()
179 {
180 if (!devres_open_group(dev, my_midlayer_create_something, GFP_KERNEL))
181 return -ENOMEM;
182
183 ...
184
185 devres_close_group(dev, my_midlayer_something);
186 return 0;
187 }
188
189 void my_midlayer_destroy_something()
190 {
191 devres_release_group(dev, my_midlayer_create_soemthing);
192 }
193
194
195 4. Details
196 ----------
197
198Lifetime of a devres entry begins on devres allocation and finishes
199when it is released or destroyed (removed and freed) - no reference
200counting.
201
202devres core guarantees atomicity to all basic devres operations and
203has support for single-instance devres types (atomic
204lookup-and-add-if-not-found). Other than that, synchronizing
205concurrent accesses to allocated devres data is caller's
206responsibility. This is usually non-issue because bus ops and
207resource allocations already do the job.
208
209For an example of single-instance devres type, read pcim_iomap_table()
210in lib/iomap.c.
211
212All devres interface functions can be called without context if the
213right gfp mask is given.
214
215
216 5. Overhead
217 -----------
218
219Each devres bookkeeping info is allocated together with requested data
220area. With debug option turned off, bookkeeping info occupies 16
221bytes on 32bit machines and 24 bytes on 64bit (three pointers rounded
222up to ull alignment). If singly linked list is used, it can be
223reduced to two pointers (8 bytes on 32bit, 16 bytes on 64bit).
224
225Each devres group occupies 8 pointers. It can be reduced to 6 if
226singly linked list is used.
227
228Memory space overhead on ahci controller with two ports is between 300
229and 400 bytes on 32bit machine after naive conversion (we can
230certainly invest a bit more effort into libata core layer).
231
232
233 6. List of managed interfaces
234 -----------------------------
235
236IO region
237 devm_request_region()
238 devm_request_mem_region()
239 devm_release_region()
240 devm_release_mem_region()
241
242IRQ
243 devm_request_irq()
244 devm_free_irq()
245
246DMA
247 dmam_alloc_coherent()
248 dmam_free_coherent()
249 dmam_alloc_noncoherent()
250 dmam_free_noncoherent()
251 dmam_declare_coherent_memory()
252 dmam_pool_create()
253 dmam_pool_destroy()
254
255PCI
256 pcim_enable_device() : after success, all PCI ops become managed
257 pcim_pin_device() : keep PCI device enabled after release
258
259IOMAP
260 devm_ioport_map()
261 devm_ioport_unmap()
262 devm_ioremap()
263 devm_ioremap_nocache()
264 devm_iounmap()
265 pcim_iomap()
266 pcim_iounmap()
267 pcim_iomap_table() : array of mapped addresses indexed by BAR
268 pcim_iomap_regions() : do request_region() and iomap() on multiple BARs
diff --git a/Documentation/drivers/edac/edac.txt b/Documentation/drivers/edac/edac.txt
index 7b3d969d2964..3c5a9e4297b4 100644
--- a/Documentation/drivers/edac/edac.txt
+++ b/Documentation/drivers/edac/edac.txt
@@ -339,7 +339,21 @@ Device Symlink:
339 339
340 'device' 340 'device'
341 341
342 Symlink to the memory controller device 342 Symlink to the memory controller device.
343
344Sdram memory scrubbing rate:
345
346 'sdram_scrub_rate'
347
348 Read/Write attribute file that controls memory scrubbing. The scrubbing
349 rate is set by writing a minimum bandwith in bytes/sec to the attribute
350 file. The rate will be translated to an internal value that gives at
351 least the specified rate.
352
353 Reading the file will return the actual scrubbing rate employed.
354
355 If configuration fails or memory scrubbing is not implemented, the value
356 of the attribute file will be -1.
343 357
344 358
345 359
diff --git a/Documentation/fb/s3fb.txt b/Documentation/fb/s3fb.txt
new file mode 100644
index 000000000000..8a04c0da0c91
--- /dev/null
+++ b/Documentation/fb/s3fb.txt
@@ -0,0 +1,78 @@
1
2 s3fb - fbdev driver for S3 Trio/Virge chips
3 ===========================================
4
5
6Supported Hardware
7==================
8
9 S3 Trio32
10 S3 Trio64 (and variants V+, UV+, V2/DX, V2/GX)
11 S3 Virge (and variants VX, DX, GX and GX2+)
12 S3 Plato/PX (completely untested)
13 S3 Aurora64V+ (completely untested)
14
15 - only PCI bus supported
16 - only BIOS initialized VGA devices supported
17 - probably not working on big endian
18
19I tested s3fb on Trio64 (plain, V+ and V2/DX) and Virge (plain, VX, DX),
20all on i386.
21
22
23Supported Features
24==================
25
26 * 4 bpp pseudocolor modes (with 18bit palette, two variants)
27 * 8 bpp pseudocolor mode (with 18bit palette)
28 * 16 bpp truecolor modes (RGB 555 and RGB 565)
29 * 24 bpp truecolor mode (RGB 888) on (only on Virge VX)
30 * 32 bpp truecolor mode (RGB 888) on (not on Virge VX)
31 * text mode (activated by bpp = 0)
32 * interlaced mode variant (not available in text mode)
33 * doublescan mode variant (not available in text mode)
34 * panning in both directions
35 * suspend/resume support
36 * DPMS support
37
38Text mode is supported even in higher resolutions, but there is limitation
39to lower pixclocks (maximum between 50-60 MHz, depending on specific hardware).
40This limitation is not enforced by driver. Text mode supports 8bit wide fonts
41only (hardware limitation) and 16bit tall fonts (driver limitation).
42
43There are two 4 bpp modes. First mode (selected if nonstd == 0) is mode with
44packed pixels, high nibble first. Second mode (selected if nonstd == 1) is mode
45with interleaved planes (1 byte interleave), MSB first. Both modes support
468bit wide fonts only (driver limitation).
47
48Suspend/resume works on systems that initialize video card during resume and
49if device is active (for example used by fbcon).
50
51
52Missing Features
53================
54(alias TODO list)
55
56 * secondary (not initialized by BIOS) device support
57 * big endian support
58 * Zorro bus support
59 * MMIO support
60 * 24 bpp mode support on more cards
61 * support for fontwidths != 8 in 4 bpp modes
62 * support for fontheight != 16 in text mode
63 * composite and external sync (is anyone able to test this?)
64 * hardware cursor
65 * video overlay support
66 * vsync synchronization
67 * feature connector support
68 * acceleration support (8514-like 2D, Virge 3D, busmaster transfers)
69 * better values for some magic registers (performance issues)
70
71
72Known bugs
73==========
74
75 * cursor disable in text mode doesn't work
76
77--
78Ondrej Zajicek <santiago@crfreenet.org>
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 0ba6af02cdaf..28f897fd3674 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -50,22 +50,6 @@ Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de>
50 50
51--------------------------- 51---------------------------
52 52
53What: ieee1394 core's unused exports (CONFIG_IEEE1394_EXPORT_FULL_API)
54When: January 2007
55Why: There are no projects known to use these exported symbols, except
56 dfg1394 (uses one symbol whose functionality is core-internal now).
57Who: Stefan Richter <stefanr@s5r6.in-berlin.de>
58
59---------------------------
60
61What: ieee1394's *_oui sysfs attributes (CONFIG_IEEE1394_OUI_DB)
62When: January 2007
63Files: drivers/ieee1394/: oui.db, oui2c.sh
64Why: big size, little value
65Who: Stefan Richter <stefanr@s5r6.in-berlin.de>
66
67---------------------------
68
69What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. 53What: Video4Linux API 1 ioctls and video_decoder.h from Video devices.
70When: December 2006 54When: December 2006
71Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 55Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6
@@ -186,18 +170,6 @@ Who: Greg Kroah-Hartman <gregkh@suse.de>
186 170
187--------------------------- 171---------------------------
188 172
189What: find_trylock_page
190When: January 2007
191Why: The interface no longer has any callers left in the kernel. It
192 is an odd interface (compared with other find_*_page functions), in
193 that it does not take a refcount to the page, only the page lock.
194 It should be replaced with find_get_page or find_lock_page if possible.
195 This feature removal can be reevaluated if users of the interface
196 cannot cleanly use something else.
197Who: Nick Piggin <npiggin@suse.de>
198
199---------------------------
200
201What: Interrupt only SA_* flags 173What: Interrupt only SA_* flags
202When: Januar 2007 174When: Januar 2007
203Why: The interrupt related SA_* flags are replaced by IRQF_* to move them 175Why: The interrupt related SA_* flags are replaced by IRQF_* to move them
@@ -243,6 +215,13 @@ Who: Jean Delvare <khali@linux-fr.org>,
243 215
244--------------------------- 216---------------------------
245 217
218What: drivers depending on OBSOLETE_OSS
219When: options in 2.6.22, code in 2.6.24
220Why: OSS drivers with ALSA replacements
221Who: Adrian Bunk <bunk@stusta.de>
222
223---------------------------
224
246What: IPv4 only connection tracking/NAT/helpers 225What: IPv4 only connection tracking/NAT/helpers
247When: 2.6.22 226When: 2.6.22
248Why: The new layer 3 independant connection tracking replaces the old 227Why: The new layer 3 independant connection tracking replaces the old
@@ -274,28 +253,6 @@ Who: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
274 253
275--------------------------- 254---------------------------
276 255
277What: ACPI hotkey driver (CONFIG_ACPI_HOTKEY)
278When: 2.6.21
279Why: hotkey.c was an attempt to consolidate multiple drivers that use
280 ACPI to implement hotkeys. However, hotkeys are not documented
281 in the ACPI specification, so the drivers used undocumented
282 vendor-specific hooks and turned out to be more different than
283 the same.
284
285 Further, the keys and the features supplied by each platform
286 are different, so there will always be a need for
287 platform-specific drivers.
288
289 So the new plan is to delete hotkey.c and instead, work on the
290 platform specific drivers to try to make them look the same
291 to the user when they supply the same features.
292
293 hotkey.c has always depended on CONFIG_EXPERIMENTAL
294
295Who: Len Brown <len.brown@intel.com>
296
297---------------------------
298
299What: /sys/firmware/acpi/namespace 256What: /sys/firmware/acpi/namespace
300When: 2.6.21 257When: 2.6.21
301Why: The ACPI namespace is effectively the symbol list for 258Why: The ACPI namespace is effectively the symbol list for
@@ -306,11 +263,18 @@ Why: The ACPI namespace is effectively the symbol list for
306 the BIOS can be extracted and disassembled with acpidump 263 the BIOS can be extracted and disassembled with acpidump
307 and iasl as documented in the pmtools package here: 264 and iasl as documented in the pmtools package here:
308 http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utils 265 http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utils
309
310Who: Len Brown <len.brown@intel.com> 266Who: Len Brown <len.brown@intel.com>
311 267
312--------------------------- 268---------------------------
313 269
270What: ACPI procfs interface
271When: July 2007
272Why: After ACPI sysfs conversion, ACPI attributes will be duplicated
273 in sysfs and the ACPI procfs interface should be removed.
274Who: Zhang Rui <rui.zhang@intel.com>
275
276---------------------------
277
314What: /proc/acpi/button 278What: /proc/acpi/button
315When: August 2007 279When: August 2007
316Why: /proc/acpi/button has been replaced by events to the input layer 280Why: /proc/acpi/button has been replaced by events to the input layer
@@ -325,3 +289,25 @@ Why: Unmaintained for years, superceded by JFFS2 for years.
325Who: Jeff Garzik <jeff@garzik.org> 289Who: Jeff Garzik <jeff@garzik.org>
326 290
327--------------------------- 291---------------------------
292
293What: sk98lin network driver
294When: July 2007
295Why: In kernel tree version of driver is unmaintained. Sk98lin driver
296 replaced by the skge driver.
297Who: Stephen Hemminger <shemminger@osdl.org>
298
299---------------------------
300
301What: Compaq touchscreen device emulation
302When: Oct 2007
303Files: drivers/input/tsdev.c
304Why: The code says it was obsolete when it was written in 2001.
305 tslib is a userspace library which does anything tsdev can do and
306 much more besides in userspace where this code belongs. There is no
307 longer any need for tsdev and applications should have converted to
308 use tslib by now.
309 The name "tsdev" is also extremely confusing and lots of people have
310 it loaded when they don't need/use it.
311Who: Richard Purdie <rpurdie@rpsys.net>
312
313---------------------------
diff --git a/Documentation/filesystems/relay.txt b/Documentation/filesystems/relay.txt
index d6788dae0349..7fbb6ffe5769 100644
--- a/Documentation/filesystems/relay.txt
+++ b/Documentation/filesystems/relay.txt
@@ -157,7 +157,7 @@ TBD(curr. line MT:/API/)
157 channel management functions: 157 channel management functions:
158 158
159 relay_open(base_filename, parent, subbuf_size, n_subbufs, 159 relay_open(base_filename, parent, subbuf_size, n_subbufs,
160 callbacks) 160 callbacks, private_data)
161 relay_close(chan) 161 relay_close(chan)
162 relay_flush(chan) 162 relay_flush(chan)
163 relay_reset(chan) 163 relay_reset(chan)
@@ -251,7 +251,7 @@ static struct rchan_callbacks relay_callbacks =
251 251
252And an example relay_open() invocation using them: 252And an example relay_open() invocation using them:
253 253
254 chan = relay_open("cpu", NULL, SUBBUF_SIZE, N_SUBBUFS, &relay_callbacks); 254 chan = relay_open("cpu", NULL, SUBBUF_SIZE, N_SUBBUFS, &relay_callbacks, NULL);
255 255
256If the create_buf_file() callback fails, or isn't defined, channel 256If the create_buf_file() callback fails, or isn't defined, channel
257creation and thus relay_open() will fail. 257creation and thus relay_open() will fail.
@@ -289,6 +289,11 @@ they use the proper locking for such a buffer, either by wrapping
289writes in a spinlock, or by copying a write function from relay.h and 289writes in a spinlock, or by copying a write function from relay.h and
290creating a local version that internally does the proper locking. 290creating a local version that internally does the proper locking.
291 291
292The private_data passed into relay_open() allows clients to associate
293user-defined data with a channel, and is immediately available
294(including in create_buf_file()) via chan->private_data or
295buf->chan->private_data.
296
292Channel 'modes' 297Channel 'modes'
293--------------- 298---------------
294 299
diff --git a/Documentation/filesystems/ufs.txt b/Documentation/filesystems/ufs.txt
index 2b5a56a6a558..7a602adeca2b 100644
--- a/Documentation/filesystems/ufs.txt
+++ b/Documentation/filesystems/ufs.txt
@@ -21,7 +21,7 @@ ufstype=type_of_ufs
21 supported as read-write 21 supported as read-write
22 22
23 ufs2 used in FreeBSD 5.x 23 ufs2 used in FreeBSD 5.x
24 supported as read-only 24 supported as read-write
25 25
26 5xbsd synonym for ufs2 26 5xbsd synonym for ufs2
27 27
@@ -50,12 +50,11 @@ ufstype=type_of_ufs
50POSSIBLE PROBLEMS 50POSSIBLE PROBLEMS
51================= 51=================
52 52
53There is still bug in reallocation of fragment, in file fs/ufs/balloc.c, 53See next section, if you have any.
54line 364. But it seems working on current buffer cache configuration.
55 54
56 55
57BUG REPORTS 56BUG REPORTS
58=========== 57===========
59 58
60Any ufs bug report you can send to daniel.pirkl@email.cz (do not send 59Any ufs bug report you can send to daniel.pirkl@email.cz or
61partition tables bug reports.) 60to dushistov@mail.ru (do not send partition tables bug reports).
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt
new file mode 100644
index 000000000000..576ce463cf44
--- /dev/null
+++ b/Documentation/gpio.txt
@@ -0,0 +1,274 @@
1GPIO Interfaces
2
3This provides an overview of GPIO access conventions on Linux.
4
5
6What is a GPIO?
7===============
8A "General Purpose Input/Output" (GPIO) is a flexible software-controlled
9digital signal. They are provided from many kinds of chip, and are familiar
10to Linux developers working with embedded and custom hardware. Each GPIO
11represents a bit connected to a particular pin, or "ball" on Ball Grid Array
12(BGA) packages. Board schematics show which external hardware connects to
13which GPIOs. Drivers can be written generically, so that board setup code
14passes such pin configuration data to drivers.
15
16System-on-Chip (SOC) processors heavily rely on GPIOs. In some cases, every
17non-dedicated pin can be configured as a GPIO; and most chips have at least
18several dozen of them. Programmable logic devices (like FPGAs) can easily
19provide GPIOs; multifunction chips like power managers, and audio codecs
20often have a few such pins to help with pin scarcity on SOCs; and there are
21also "GPIO Expander" chips that connect using the I2C or SPI serial busses.
22Most PC southbridges have a few dozen GPIO-capable pins (with only the BIOS
23firmware knowing how they're used).
24
25The exact capabilities of GPIOs vary between systems. Common options:
26
27 - Output values are writable (high=1, low=0). Some chips also have
28 options about how that value is driven, so that for example only one
29 value might be driven ... supporting "wire-OR" and similar schemes
30 for the other value.
31
32 - Input values are likewise readable (1, 0). Some chips support readback
33 of pins configured as "output", which is very useful in such "wire-OR"
34 cases (to support bidirectional signaling). GPIO controllers may have
35 input de-glitch logic, sometimes with software controls.
36
37 - Inputs can often be used as IRQ signals, often edge triggered but
38 sometimes level triggered. Such IRQs may be configurable as system
39 wakeup events, to wake the system from a low power state.
40
41 - Usually a GPIO will be configurable as either input or output, as needed
42 by different product boards; single direction ones exist too.
43
44 - Most GPIOs can be accessed while holding spinlocks, but those accessed
45 through a serial bus normally can't. Some systems support both types.
46
47On a given board each GPIO is used for one specific purpose like monitoring
48MMC/SD card insertion/removal, detecting card writeprotect status, driving
49a LED, configuring a transceiver, bitbanging a serial bus, poking a hardware
50watchdog, sensing a switch, and so on.
51
52
53GPIO conventions
54================
55Note that this is called a "convention" because you don't need to do it this
56way, and it's no crime if you don't. There **are** cases where portability
57is not the main issue; GPIOs are often used for the kind of board-specific
58glue logic that may even change between board revisions, and can't ever be
59used on a board that's wired differently. Only least-common-denominator
60functionality can be very portable. Other features are platform-specific,
61and that can be critical for glue logic.
62
63Plus, this doesn't define an implementation framework, just an interface.
64One platform might implement it as simple inline functions accessing chip
65registers; another might implement it by delegating through abstractions
66used for several very different kinds of GPIO controller.
67
68That said, if the convention is supported on their platform, drivers should
69use it when possible:
70
71 #include <asm/gpio.h>
72
73If you stick to this convention then it'll be easier for other developers to
74see what your code is doing, and help maintain it.
75
76
77Identifying GPIOs
78-----------------
79GPIOs are identified by unsigned integers in the range 0..MAX_INT. That
80reserves "negative" numbers for other purposes like marking signals as
81"not available on this board", or indicating faults. Code that doesn't
82touch the underlying hardware treats these integers as opaque cookies.
83
84Platforms define how they use those integers, and usually #define symbols
85for the GPIO lines so that board-specific setup code directly corresponds
86to the relevant schematics. In contrast, drivers should only use GPIO
87numbers passed to them from that setup code, using platform_data to hold
88board-specific pin configuration data (along with other board specific
89data they need). That avoids portability problems.
90
91So for example one platform uses numbers 32-159 for GPIOs; while another
92uses numbers 0..63 with one set of GPIO controllers, 64-79 with another
93type of GPIO controller, and on one particular board 80-95 with an FPGA.
94The numbers need not be contiguous; either of those platforms could also
95use numbers 2000-2063 to identify GPIOs in a bank of I2C GPIO expanders.
96
97Whether a platform supports multiple GPIO controllers is currently a
98platform-specific implementation issue.
99
100
101Using GPIOs
102-----------
103One of the first things to do with a GPIO, often in board setup code when
104setting up a platform_device using the GPIO, is mark its direction:
105
106 /* set as input or output, returning 0 or negative errno */
107 int gpio_direction_input(unsigned gpio);
108 int gpio_direction_output(unsigned gpio);
109
110The return value is zero for success, else a negative errno. It should
111be checked, since the get/set calls don't have error returns and since
112misconfiguration is possible. (These calls could sleep.)
113
114Setting the direction can fail if the GPIO number is invalid, or when
115that particular GPIO can't be used in that mode. It's generally a bad
116idea to rely on boot firmware to have set the direction correctly, since
117it probably wasn't validated to do more than boot Linux. (Similarly,
118that board setup code probably needs to multiplex that pin as a GPIO,
119and configure pullups/pulldowns appropriately.)
120
121
122Spinlock-Safe GPIO access
123-------------------------
124Most GPIO controllers can be accessed with memory read/write instructions.
125That doesn't need to sleep, and can safely be done from inside IRQ handlers.
126
127Use these calls to access such GPIOs:
128
129 /* GPIO INPUT: return zero or nonzero */
130 int gpio_get_value(unsigned gpio);
131
132 /* GPIO OUTPUT */
133 void gpio_set_value(unsigned gpio, int value);
134
135The values are boolean, zero for low, nonzero for high. When reading the
136value of an output pin, the value returned should be what's seen on the
137pin ... that won't always match the specified output value, because of
138issues including wire-OR and output latencies.
139
140The get/set calls have no error returns because "invalid GPIO" should have
141been reported earlier in gpio_set_direction(). However, note that not all
142platforms can read the value of output pins; those that can't should always
143return zero. Also, using these calls for GPIOs that can't safely be accessed
144without sleeping (see below) is an error.
145
146Platform-specific implementations are encouraged to optimize the two
147calls to access the GPIO value in cases where the GPIO number (and for
148output, value) are constant. It's normal for them to need only a couple
149of instructions in such cases (reading or writing a hardware register),
150and not to need spinlocks. Such optimized calls can make bitbanging
151applications a lot more efficient (in both space and time) than spending
152dozens of instructions on subroutine calls.
153
154
155GPIO access that may sleep
156--------------------------
157Some GPIO controllers must be accessed using message based busses like I2C
158or SPI. Commands to read or write those GPIO values require waiting to
159get to the head of a queue to transmit a command and get its response.
160This requires sleeping, which can't be done from inside IRQ handlers.
161
162Platforms that support this type of GPIO distinguish them from other GPIOs
163by returning nonzero from this call:
164
165 int gpio_cansleep(unsigned gpio);
166
167To access such GPIOs, a different set of accessors is defined:
168
169 /* GPIO INPUT: return zero or nonzero, might sleep */
170 int gpio_get_value_cansleep(unsigned gpio);
171
172 /* GPIO OUTPUT, might sleep */
173 void gpio_set_value_cansleep(unsigned gpio, int value);
174
175Other than the fact that these calls might sleep, and will not be ignored
176for GPIOs that can't be accessed from IRQ handlers, these calls act the
177same as the spinlock-safe calls.
178
179
180Claiming and Releasing GPIOs (OPTIONAL)
181---------------------------------------
182To help catch system configuration errors, two calls are defined.
183However, many platforms don't currently support this mechanism.
184
185 /* request GPIO, returning 0 or negative errno.
186 * non-null labels may be useful for diagnostics.
187 */
188 int gpio_request(unsigned gpio, const char *label);
189
190 /* release previously-claimed GPIO */
191 void gpio_free(unsigned gpio);
192
193Passing invalid GPIO numbers to gpio_request() will fail, as will requesting
194GPIOs that have already been claimed with that call. The return value of
195gpio_request() must be checked. (These calls could sleep.)
196
197These calls serve two basic purposes. One is marking the signals which
198are actually in use as GPIOs, for better diagnostics; systems may have
199several hundred potential GPIOs, but often only a dozen are used on any
200given board. Another is to catch conflicts between drivers, reporting
201errors when drivers wrongly think they have exclusive use of that signal.
202
203These two calls are optional because not not all current Linux platforms
204offer such functionality in their GPIO support; a valid implementation
205could return success for all gpio_request() calls. Unlike the other calls,
206the state they represent doesn't normally match anything from a hardware
207register; it's just a software bitmap which clearly is not necessary for
208correct operation of hardware or (bug free) drivers.
209
210Note that requesting a GPIO does NOT cause it to be configured in any
211way; it just marks that GPIO as in use. Separate code must handle any
212pin setup (e.g. controlling which pin the GPIO uses, pullup/pulldown).
213
214
215GPIOs mapped to IRQs
216--------------------
217GPIO numbers are unsigned integers; so are IRQ numbers. These make up
218two logically distinct namespaces (GPIO 0 need not use IRQ 0). You can
219map between them using calls like:
220
221 /* map GPIO numbers to IRQ numbers */
222 int gpio_to_irq(unsigned gpio);
223
224 /* map IRQ numbers to GPIO numbers */
225 int irq_to_gpio(unsigned irq);
226
227Those return either the corresponding number in the other namespace, or
228else a negative errno code if the mapping can't be done. (For example,
229some GPIOs can't used as IRQs.) It is an unchecked error to use a GPIO
230number that hasn't been marked as an input using gpio_set_direction(), or
231to use an IRQ number that didn't originally come from gpio_to_irq().
232
233These two mapping calls are expected to cost on the order of a single
234addition or subtraction. They're not allowed to sleep.
235
236Non-error values returned from gpio_to_irq() can be passed to request_irq()
237or free_irq(). They will often be stored into IRQ resources for platform
238devices, by the board-specific initialization code. Note that IRQ trigger
239options are part of the IRQ interface, e.g. IRQF_TRIGGER_FALLING, as are
240system wakeup capabilities.
241
242Non-error values returned from irq_to_gpio() would most commonly be used
243with gpio_get_value(), for example to initialize or update driver state
244when the IRQ is edge-triggered.
245
246
247
248What do these conventions omit?
249===============================
250One of the biggest things these conventions omit is pin multiplexing, since
251this is highly chip-specific and nonportable. One platform might not need
252explicit multiplexing; another might have just two options for use of any
253given pin; another might have eight options per pin; another might be able
254to route a given GPIO to any one of several pins. (Yes, those examples all
255come from systems that run Linux today.)
256
257Related to multiplexing is configuration and enabling of the pullups or
258pulldowns integrated on some platforms. Not all platforms support them,
259or support them in the same way; and any given board might use external
260pullups (or pulldowns) so that the on-chip ones should not be used.
261
262There are other system-specific mechanisms that are not specified here,
263like the aforementioned options for input de-glitching and wire-OR output.
264Hardware may support reading or writing GPIOs in gangs, but that's usually
265configuration dependent: for GPIOs sharing the same bank. (GPIOs are
266commonly grouped in banks of 16 or 32, with a given SOC having several such
267banks.) Some systems can trigger IRQs from output GPIOs. Code relying on
268such mechanisms will necessarily be nonportable.
269
270Dynamic definition of GPIOs is not currently supported; for example, as
271a side effect of configuring an add-on board with some GPIO expanders.
272
273These calls are purely for kernel space, but a userspace API could be built
274on top of it.
diff --git a/Documentation/hrtimer/timer_stats.txt b/Documentation/hrtimer/timer_stats.txt
new file mode 100644
index 000000000000..27f782e3593f
--- /dev/null
+++ b/Documentation/hrtimer/timer_stats.txt
@@ -0,0 +1,68 @@
1timer_stats - timer usage statistics
2------------------------------------
3
4timer_stats is a debugging facility to make the timer (ab)usage in a Linux
5system visible to kernel and userspace developers. It is not intended for
6production usage as it adds significant overhead to the (hr)timer code and the
7(hr)timer data structures.
8
9timer_stats should be used by kernel and userspace developers to verify that
10their code does not make unduly use of timers. This helps to avoid unnecessary
11wakeups, which should be avoided to optimize power consumption.
12
13It can be enabled by CONFIG_TIMER_STATS in the "Kernel hacking" configuration
14section.
15
16timer_stats collects information about the timer events which are fired in a
17Linux system over a sample period:
18
19- the pid of the task(process) which initialized the timer
20- the name of the process which initialized the timer
21- the function where the timer was intialized
22- the callback function which is associated to the timer
23- the number of events (callbacks)
24
25timer_stats adds an entry to /proc: /proc/timer_stats
26
27This entry is used to control the statistics functionality and to read out the
28sampled information.
29
30The timer_stats functionality is inactive on bootup.
31
32To activate a sample period issue:
33# echo 1 >/proc/timer_stats
34
35To stop a sample period issue:
36# echo 0 >/proc/timer_stats
37
38The statistics can be retrieved by:
39# cat /proc/timer_stats
40
41The readout of /proc/timer_stats automatically disables sampling. The sampled
42information is kept until a new sample period is started. This allows multiple
43readouts.
44
45Sample output of /proc/timer_stats:
46
47Timerstats sample period: 3.888770 s
48 12, 0 swapper hrtimer_stop_sched_tick (hrtimer_sched_tick)
49 15, 1 swapper hcd_submit_urb (rh_timer_func)
50 4, 959 kedac schedule_timeout (process_timeout)
51 1, 0 swapper page_writeback_init (wb_timer_fn)
52 28, 0 swapper hrtimer_stop_sched_tick (hrtimer_sched_tick)
53 22, 2948 IRQ 4 tty_flip_buffer_push (delayed_work_timer_fn)
54 3, 3100 bash schedule_timeout (process_timeout)
55 1, 1 swapper queue_delayed_work_on (delayed_work_timer_fn)
56 1, 1 swapper queue_delayed_work_on (delayed_work_timer_fn)
57 1, 1 swapper neigh_table_init_no_netlink (neigh_periodic_timer)
58 1, 2292 ip __netdev_watchdog_up (dev_watchdog)
59 1, 23 events/1 do_cache_clean (delayed_work_timer_fn)
6090 total events, 30.0 events/sec
61
62The first column is the number of events, the second column the pid, the third
63column is the name of the process. The forth column shows the function which
64initialized the timer and in parantheses the callback function which was
65executed on expiry.
66
67 Thomas, Ingo
68
diff --git a/Documentation/hrtimers/highres.txt b/Documentation/hrtimers/highres.txt
new file mode 100644
index 000000000000..ce0e9a91e157
--- /dev/null
+++ b/Documentation/hrtimers/highres.txt
@@ -0,0 +1,249 @@
1High resolution timers and dynamic ticks design notes
2-----------------------------------------------------
3
4Further information can be found in the paper of the OLS 2006 talk "hrtimers
5and beyond". The paper is part of the OLS 2006 Proceedings Volume 1, which can
6be found on the OLS website:
7http://www.linuxsymposium.org/2006/linuxsymposium_procv1.pdf
8
9The slides to this talk are available from:
10http://tglx.de/projects/hrtimers/ols2006-hrtimers.pdf
11
12The slides contain five figures (pages 2, 15, 18, 20, 22), which illustrate the
13changes in the time(r) related Linux subsystems. Figure #1 (p. 2) shows the
14design of the Linux time(r) system before hrtimers and other building blocks
15got merged into mainline.
16
17Note: the paper and the slides are talking about "clock event source", while we
18switched to the name "clock event devices" in meantime.
19
20The design contains the following basic building blocks:
21
22- hrtimer base infrastructure
23- timeofday and clock source management
24- clock event management
25- high resolution timer functionality
26- dynamic ticks
27
28
29hrtimer base infrastructure
30---------------------------
31
32The hrtimer base infrastructure was merged into the 2.6.16 kernel. Details of
33the base implementation are covered in Documentation/hrtimers/hrtimer.txt. See
34also figure #2 (OLS slides p. 15)
35
36The main differences to the timer wheel, which holds the armed timer_list type
37timers are:
38 - time ordered enqueueing into a rb-tree
39 - independent of ticks (the processing is based on nanoseconds)
40
41
42timeofday and clock source management
43-------------------------------------
44
45John Stultz's Generic Time Of Day (GTOD) framework moves a large portion of
46code out of the architecture-specific areas into a generic management
47framework, as illustrated in figure #3 (OLS slides p. 18). The architecture
48specific portion is reduced to the low level hardware details of the clock
49sources, which are registered in the framework and selected on a quality based
50decision. The low level code provides hardware setup and readout routines and
51initializes data structures, which are used by the generic time keeping code to
52convert the clock ticks to nanosecond based time values. All other time keeping
53related functionality is moved into the generic code. The GTOD base patch got
54merged into the 2.6.18 kernel.
55
56Further information about the Generic Time Of Day framework is available in the
57OLS 2005 Proceedings Volume 1:
58http://www.linuxsymposium.org/2005/linuxsymposium_procv1.pdf
59
60The paper "We Are Not Getting Any Younger: A New Approach to Time and
61Timers" was written by J. Stultz, D.V. Hart, & N. Aravamudan.
62
63Figure #3 (OLS slides p.18) illustrates the transformation.
64
65
66clock event management
67----------------------
68
69While clock sources provide read access to the monotonically increasing time
70value, clock event devices are used to schedule the next event
71interrupt(s). The next event is currently defined to be periodic, with its
72period defined at compile time. The setup and selection of the event device
73for various event driven functionalities is hardwired into the architecture
74dependent code. This results in duplicated code across all architectures and
75makes it extremely difficult to change the configuration of the system to use
76event interrupt devices other than those already built into the
77architecture. Another implication of the current design is that it is necessary
78to touch all the architecture-specific implementations in order to provide new
79functionality like high resolution timers or dynamic ticks.
80
81The clock events subsystem tries to address this problem by providing a generic
82solution to manage clock event devices and their usage for the various clock
83event driven kernel functionalities. The goal of the clock event subsystem is
84to minimize the clock event related architecture dependent code to the pure
85hardware related handling and to allow easy addition and utilization of new
86clock event devices. It also minimizes the duplicated code across the
87architectures as it provides generic functionality down to the interrupt
88service handler, which is almost inherently hardware dependent.
89
90Clock event devices are registered either by the architecture dependent boot
91code or at module insertion time. Each clock event device fills a data
92structure with clock-specific property parameters and callback functions. The
93clock event management decides, by using the specified property parameters, the
94set of system functions a clock event device will be used to support. This
95includes the distinction of per-CPU and per-system global event devices.
96
97System-level global event devices are used for the Linux periodic tick. Per-CPU
98event devices are used to provide local CPU functionality such as process
99accounting, profiling, and high resolution timers.
100
101The management layer assignes one or more of the folliwing functions to a clock
102event device:
103 - system global periodic tick (jiffies update)
104 - cpu local update_process_times
105 - cpu local profiling
106 - cpu local next event interrupt (non periodic mode)
107
108The clock event device delegates the selection of those timer interrupt related
109functions completely to the management layer. The clock management layer stores
110a function pointer in the device description structure, which has to be called
111from the hardware level handler. This removes a lot of duplicated code from the
112architecture specific timer interrupt handlers and hands the control over the
113clock event devices and the assignment of timer interrupt related functionality
114to the core code.
115
116The clock event layer API is rather small. Aside from the clock event device
117registration interface it provides functions to schedule the next event
118interrupt, clock event device notification service and support for suspend and
119resume.
120
121The framework adds about 700 lines of code which results in a 2KB increase of
122the kernel binary size. The conversion of i386 removes about 100 lines of
123code. The binary size decrease is in the range of 400 byte. We believe that the
124increase of flexibility and the avoidance of duplicated code across
125architectures justifies the slight increase of the binary size.
126
127The conversion of an architecture has no functional impact, but allows to
128utilize the high resolution and dynamic tick functionalites without any change
129to the clock event device and timer interrupt code. After the conversion the
130enabling of high resolution timers and dynamic ticks is simply provided by
131adding the kernel/time/Kconfig file to the architecture specific Kconfig and
132adding the dynamic tick specific calls to the idle routine (a total of 3 lines
133added to the idle function and the Kconfig file)
134
135Figure #4 (OLS slides p.20) illustrates the transformation.
136
137
138high resolution timer functionality
139-----------------------------------
140
141During system boot it is not possible to use the high resolution timer
142functionality, while making it possible would be difficult and would serve no
143useful function. The initialization of the clock event device framework, the
144clock source framework (GTOD) and hrtimers itself has to be done and
145appropriate clock sources and clock event devices have to be registered before
146the high resolution functionality can work. Up to the point where hrtimers are
147initialized, the system works in the usual low resolution periodic mode. The
148clock source and the clock event device layers provide notification functions
149which inform hrtimers about availability of new hardware. hrtimers validates
150the usability of the registered clock sources and clock event devices before
151switching to high resolution mode. This ensures also that a kernel which is
152configured for high resolution timers can run on a system which lacks the
153necessary hardware support.
154
155The high resolution timer code does not support SMP machines which have only
156global clock event devices. The support of such hardware would involve IPI
157calls when an interrupt happens. The overhead would be much larger than the
158benefit. This is the reason why we currently disable high resolution and
159dynamic ticks on i386 SMP systems which stop the local APIC in C3 power
160state. A workaround is available as an idea, but the problem has not been
161tackled yet.
162
163The time ordered insertion of timers provides all the infrastructure to decide
164whether the event device has to be reprogrammed when a timer is added. The
165decision is made per timer base and synchronized across per-cpu timer bases in
166a support function. The design allows the system to utilize separate per-CPU
167clock event devices for the per-CPU timer bases, but currently only one
168reprogrammable clock event device per-CPU is utilized.
169
170When the timer interrupt happens, the next event interrupt handler is called
171from the clock event distribution code and moves expired timers from the
172red-black tree to a separate double linked list and invokes the softirq
173handler. An additional mode field in the hrtimer structure allows the system to
174execute callback functions directly from the next event interrupt handler. This
175is restricted to code which can safely be executed in the hard interrupt
176context. This applies, for example, to the common case of a wakeup function as
177used by nanosleep. The advantage of executing the handler in the interrupt
178context is the avoidance of up to two context switches - from the interrupted
179context to the softirq and to the task which is woken up by the expired
180timer.
181
182Once a system has switched to high resolution mode, the periodic tick is
183switched off. This disables the per system global periodic clock event device -
184e.g. the PIT on i386 SMP systems.
185
186The periodic tick functionality is provided by an per-cpu hrtimer. The callback
187function is executed in the next event interrupt context and updates jiffies
188and calls update_process_times and profiling. The implementation of the hrtimer
189based periodic tick is designed to be extended with dynamic tick functionality.
190This allows to use a single clock event device to schedule high resolution
191timer and periodic events (jiffies tick, profiling, process accounting) on UP
192systems. This has been proved to work with the PIT on i386 and the Incrementer
193on PPC.
194
195The softirq for running the hrtimer queues and executing the callbacks has been
196separated from the tick bound timer softirq to allow accurate delivery of high
197resolution timer signals which are used by itimer and POSIX interval
198timers. The execution of this softirq can still be delayed by other softirqs,
199but the overall latencies have been significantly improved by this separation.
200
201Figure #5 (OLS slides p.22) illustrates the transformation.
202
203
204dynamic ticks
205-------------
206
207Dynamic ticks are the logical consequence of the hrtimer based periodic tick
208replacement (sched_tick). The functionality of the sched_tick hrtimer is
209extended by three functions:
210
211- hrtimer_stop_sched_tick
212- hrtimer_restart_sched_tick
213- hrtimer_update_jiffies
214
215hrtimer_stop_sched_tick() is called when a CPU goes into idle state. The code
216evaluates the next scheduled timer event (from both hrtimers and the timer
217wheel) and in case that the next event is further away than the next tick it
218reprograms the sched_tick to this future event, to allow longer idle sleeps
219without worthless interruption by the periodic tick. The function is also
220called when an interrupt happens during the idle period, which does not cause a
221reschedule. The call is necessary as the interrupt handler might have armed a
222new timer whose expiry time is before the time which was identified as the
223nearest event in the previous call to hrtimer_stop_sched_tick.
224
225hrtimer_restart_sched_tick() is called when the CPU leaves the idle state before
226it calls schedule(). hrtimer_restart_sched_tick() resumes the periodic tick,
227which is kept active until the next call to hrtimer_stop_sched_tick().
228
229hrtimer_update_jiffies() is called from irq_enter() when an interrupt happens
230in the idle period to make sure that jiffies are up to date and the interrupt
231handler has not to deal with an eventually stale jiffy value.
232
233The dynamic tick feature provides statistical values which are exported to
234userspace via /proc/stats and can be made available for enhanced power
235management control.
236
237The implementation leaves room for further development like full tickless
238systems, where the time slice is controlled by the scheduler, variable
239frequency profiling, and a complete removal of jiffies in the future.
240
241
242Aside the current initial submission of i386 support, the patchset has been
243extended to x86_64 and ARM already. Initial (work in progress) support is also
244available for MIPS and PowerPC.
245
246 Thomas, Ingo
247
248
249
diff --git a/Documentation/hrtimers.txt b/Documentation/hrtimers/hrtimers.txt
index ce31f65e12e7..ce31f65e12e7 100644
--- a/Documentation/hrtimers.txt
+++ b/Documentation/hrtimers/hrtimers.txt
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801
index 3db69a086c41..c34f0db78a30 100644
--- a/Documentation/i2c/busses/i2c-i801
+++ b/Documentation/i2c/busses/i2c-i801
@@ -48,14 +48,9 @@ following:
48The SMBus controller is function 3 in device 1f. Class 0c05 is SMBus Serial 48The SMBus controller is function 3 in device 1f. Class 0c05 is SMBus Serial
49Controller. 49Controller.
50 50
51If you do NOT see the 24x3 device at function 3, and you can't figure out
52any way in the BIOS to enable it,
53
54The ICH chips are quite similar to Intel's PIIX4 chip, at least in the 51The ICH chips are quite similar to Intel's PIIX4 chip, at least in the
55SMBus controller. 52SMBus controller.
56 53
57See the file i2c-piix4 for some additional information.
58
59 54
60Process Call Support 55Process Call Support
61-------------------- 56--------------------
@@ -74,6 +69,61 @@ SMBus 2.0 Support
74 69
75The 82801DB (ICH4) and later chips support several SMBus 2.0 features. 70The 82801DB (ICH4) and later chips support several SMBus 2.0 features.
76 71
72
73Hidden ICH SMBus
74----------------
75
76If your system has an Intel ICH south bridge, but you do NOT see the
77SMBus device at 00:1f.3 in lspci, and you can't figure out any way in the
78BIOS to enable it, it means it has been hidden by the BIOS code. Asus is
79well known for first doing this on their P4B motherboard, and many other
80boards after that. Some vendor machines are affected as well.
81
82The first thing to try is the "i2c_ec" ACPI driver. It could be that the
83SMBus was hidden on purpose because it'll be driven by ACPI. If the
84i2c_ec driver works for you, just forget about the i2c-i801 driver and
85don't try to unhide the ICH SMBus. Even if i2c_ec doesn't work, you
86better make sure that the SMBus isn't used by the ACPI code. Try loading
87the "fan" and "thermal" drivers, and check in /proc/acpi/fan and
88/proc/acpi/thermal_zone. If you find anything there, it's likely that
89the ACPI is accessing the SMBus and it's safer not to unhide it. Only
90once you are certain that ACPI isn't using the SMBus, you can attempt
91to unhide it.
92
93In order to unhide the SMBus, we need to change the value of a PCI
94register before the kernel enumerates the PCI devices. This is done in
95drivers/pci/quirks.c, where all affected boards must be listed (see
96function asus_hides_smbus_hostbridge.) If the SMBus device is missing,
97and you think there's something interesting on the SMBus (e.g. a
98hardware monitoring chip), you need to add your board to the list.
99
100The motherboard is identified using the subvendor and subdevice IDs of the
101host bridge PCI device. Get yours with "lspci -n -v -s 00:00.0":
102
10300:00.0 Class 0600: 8086:2570 (rev 02)
104 Subsystem: 1043:80f2
105 Flags: bus master, fast devsel, latency 0
106 Memory at fc000000 (32-bit, prefetchable) [size=32M]
107 Capabilities: [e4] #09 [2106]
108 Capabilities: [a0] AGP version 3.0
109
110Here the host bridge ID is 2570 (82865G/PE/P), the subvendor ID is 1043
111(Asus) and the subdevice ID is 80f2 (P4P800-X). You can find the symbolic
112names for the bridge ID and the subvendor ID in include/linux/pci_ids.h,
113and then add a case for your subdevice ID at the right place in
114drivers/pci/quirks.c. Then please give it very good testing, to make sure
115that the unhidden SMBus doesn't conflict with e.g. ACPI.
116
117If it works, proves useful (i.e. there are usable chips on the SMBus)
118and seems safe, please submit a patch for inclusion into the kernel.
119
120Note: There's a useful script in lm_sensors 2.10.2 and later, named
121unhide_ICH_SMBus (in prog/hotplug), which uses the fakephp driver to
122temporarily unhide the SMBus without having to patch and recompile your
123kernel. It's very convenient if you just want to check if there's
124anything interesting on your hidden ICH SMBus.
125
126
77********************** 127**********************
78The lm_sensors project gratefully acknowledges the support of Texas 128The lm_sensors project gratefully acknowledges the support of Texas
79Instruments in the initial development of this driver. 129Instruments in the initial development of this driver.
diff --git a/Documentation/i2c/busses/i2c-parport b/Documentation/i2c/busses/i2c-parport
index 77b995dfca22..dceaba1ad930 100644
--- a/Documentation/i2c/busses/i2c-parport
+++ b/Documentation/i2c/busses/i2c-parport
@@ -19,6 +19,7 @@ It currently supports the following devices:
19 * (type=4) Analog Devices ADM1032 evaluation board 19 * (type=4) Analog Devices ADM1032 evaluation board
20 * (type=5) Analog Devices evaluation boards: ADM1025, ADM1030, ADM1031 20 * (type=5) Analog Devices evaluation boards: ADM1025, ADM1030, ADM1031
21 * (type=6) Barco LPT->DVI (K5800236) adapter 21 * (type=6) Barco LPT->DVI (K5800236) adapter
22 * (type=7) One For All JP1 parallel port adapter
22 23
23These devices use different pinout configurations, so you have to tell 24These devices use different pinout configurations, so you have to tell
24the driver what you have, using the type module parameter. There is no 25the driver what you have, using the type module parameter. There is no
@@ -157,3 +158,17 @@ many more, using /dev/velleman.
157 http://home.wanadoo.nl/hihihi/libk8005.htm 158 http://home.wanadoo.nl/hihihi/libk8005.htm
158 http://struyve.mine.nu:8080/index.php?block=k8000 159 http://struyve.mine.nu:8080/index.php?block=k8000
159 http://sourceforge.net/projects/libk8005/ 160 http://sourceforge.net/projects/libk8005/
161
162
163One For All JP1 parallel port adapter
164-------------------------------------
165
166The JP1 project revolves around a set of remote controls which expose
167the I2C bus their internal configuration EEPROM lives on via a 6 pin
168jumper in the battery compartment. More details can be found at:
169
170http://www.hifi-remote.com/jp1/
171
172Details of the simple parallel port hardware can be found at:
173
174http://www.hifi-remote.com/jp1/hardware.shtml
diff --git a/Documentation/i2c/busses/i2c-piix4 b/Documentation/i2c/busses/i2c-piix4
index 921476333235..7cbe43fa2701 100644
--- a/Documentation/i2c/busses/i2c-piix4
+++ b/Documentation/i2c/busses/i2c-piix4
@@ -6,7 +6,7 @@ Supported adapters:
6 Datasheet: Publicly available at the Intel website 6 Datasheet: Publicly available at the Intel website
7 * ServerWorks OSB4, CSB5, CSB6 and HT-1000 southbridges 7 * ServerWorks OSB4, CSB5, CSB6 and HT-1000 southbridges
8 Datasheet: Only available via NDA from ServerWorks 8 Datasheet: Only available via NDA from ServerWorks
9 * ATI IXP southbridges IXP200, IXP300, IXP400 9 * ATI IXP200, IXP300, IXP400 and SB600 southbridges
10 Datasheet: Not publicly available 10 Datasheet: Not publicly available
11 * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge 11 * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge
12 Datasheet: Publicly available at the SMSC website http://www.smsc.com 12 Datasheet: Publicly available at the SMSC website http://www.smsc.com
diff --git a/Documentation/i2c/busses/i2c-viapro b/Documentation/i2c/busses/i2c-viapro
index 25680346e0ac..775f489e86f6 100644
--- a/Documentation/i2c/busses/i2c-viapro
+++ b/Documentation/i2c/busses/i2c-viapro
@@ -13,6 +13,9 @@ Supported adapters:
13 * VIA Technologies, Inc. VT8235, VT8237R, VT8237A, VT8251 13 * VIA Technologies, Inc. VT8235, VT8237R, VT8237A, VT8251
14 Datasheet: available on request and under NDA from VIA 14 Datasheet: available on request and under NDA from VIA
15 15
16 * VIA Technologies, Inc. CX700
17 Datasheet: available on request and under NDA from VIA
18
16Authors: 19Authors:
17 Kyösti Mälkki <kmalkki@cc.hut.fi>, 20 Kyösti Mälkki <kmalkki@cc.hut.fi>,
18 Mark D. Studebaker <mdsxyz123@yahoo.com>, 21 Mark D. Studebaker <mdsxyz123@yahoo.com>,
@@ -44,6 +47,7 @@ Your lspci -n listing must show one of these :
44 device 1106:3227 (VT8237R) 47 device 1106:3227 (VT8237R)
45 device 1106:3337 (VT8237A) 48 device 1106:3337 (VT8237A)
46 device 1106:3287 (VT8251) 49 device 1106:3287 (VT8251)
50 device 1106:8324 (CX700)
47 51
48If none of these show up, you should look in the BIOS for settings like 52If none of these show up, you should look in the BIOS for settings like
49enable ACPI / SMBus or even USB. 53enable ACPI / SMBus or even USB.
@@ -51,3 +55,6 @@ enable ACPI / SMBus or even USB.
51Except for the oldest chips (VT82C596A/B, VT82C686A and most probably 55Except for the oldest chips (VT82C596A/B, VT82C686A and most probably
52VT8231), this driver supports I2C block transactions. Such transactions 56VT8231), this driver supports I2C block transactions. Such transactions
53are mainly useful to read from and write to EEPROMs. 57are mainly useful to read from and write to EEPROMs.
58
59The CX700 additionally appears to support SMBus PEC, although this driver
60doesn't implement it yet.
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
index f03c2a02f806..ca272b263a92 100644
--- a/Documentation/i2c/porting-clients
+++ b/Documentation/i2c/porting-clients
@@ -129,6 +129,12 @@ Technical changes:
129 structure, those name member should be initialized to a driver name 129 structure, those name member should be initialized to a driver name
130 string. i2c_driver itself has no name member anymore. 130 string. i2c_driver itself has no name member anymore.
131 131
132* [Driver model] Instead of shutdown or reboot notifiers, provide a
133 shutdown() method in your driver.
134
135* [Power management] Use the driver model suspend() and resume()
136 callbacks instead of the obsolete pm_register() calls.
137
132Coding policy: 138Coding policy:
133 139
134* [Copyright] Use (C), not (c), for copyright. 140* [Copyright] Use (C), not (c), for copyright.
diff --git a/Documentation/i2c/smbus-protocol b/Documentation/i2c/smbus-protocol
index 09f5e5ca4927..8a653c60d25a 100644
--- a/Documentation/i2c/smbus-protocol
+++ b/Documentation/i2c/smbus-protocol
@@ -97,7 +97,7 @@ SMBus Write Word Data
97===================== 97=====================
98 98
99This is the opposite operation of the Read Word Data command. 16 bits 99This is the opposite operation of the Read Word Data command. 16 bits
100of data is read from a device, from a designated register that is 100of data is written to a device, to the designated register that is
101specified through the Comm byte. 101specified through the Comm byte.
102 102
103S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P 103S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index 3a057c8e5507..fbcff96f4ca1 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -21,20 +21,26 @@ The driver structure
21 21
22Usually, you will implement a single driver structure, and instantiate 22Usually, you will implement a single driver structure, and instantiate
23all clients from it. Remember, a driver structure contains general access 23all clients from it. Remember, a driver structure contains general access
24routines, a client structure specific information like the actual I2C 24routines, and should be zero-initialized except for fields with data you
25address. 25provide. A client structure holds device-specific information like the
26driver model device node, and its I2C address.
26 27
27static struct i2c_driver foo_driver = { 28static struct i2c_driver foo_driver = {
28 .driver = { 29 .driver = {
29 .name = "foo", 30 .name = "foo",
30 }, 31 },
31 .attach_adapter = &foo_attach_adapter, 32 .attach_adapter = foo_attach_adapter,
32 .detach_client = &foo_detach_client, 33 .detach_client = foo_detach_client,
33 .command = &foo_command /* may be NULL */ 34 .shutdown = foo_shutdown, /* optional */
35 .suspend = foo_suspend, /* optional */
36 .resume = foo_resume, /* optional */
37 .command = foo_command, /* optional */
34} 38}
35 39
36The name field must match the driver name, including the case. It must not 40The name field is the driver name, and must not contain spaces. It
37contain spaces, and may be up to 31 characters long. 41should match the module name (if the driver can be compiled as a module),
42although you can use MODULE_ALIAS (passing "foo" in this example) to add
43another name for the module.
38 44
39All other fields are for call-back functions which will be explained 45All other fields are for call-back functions which will be explained
40below. 46below.
@@ -43,11 +49,18 @@ below.
43Extra client data 49Extra client data
44================= 50=================
45 51
46The client structure has a special `data' field that can point to any 52Each client structure has a special `data' field that can point to any
47structure at all. You can use this to keep client-specific data. You 53structure at all. You should use this to keep device-specific data,
54especially in drivers that handle multiple I2C or SMBUS devices. You
48do not always need this, but especially for `sensors' drivers, it can 55do not always need this, but especially for `sensors' drivers, it can
49be very useful. 56be very useful.
50 57
58 /* store the value */
59 void i2c_set_clientdata(struct i2c_client *client, void *data);
60
61 /* retrieve the value */
62 void *i2c_get_clientdata(struct i2c_client *client);
63
51An example structure is below. 64An example structure is below.
52 65
53 struct foo_data { 66 struct foo_data {
@@ -493,6 +506,33 @@ by `__init_data'. Hose functions and structures can be removed after
493kernel booting (or module loading) is completed. 506kernel booting (or module loading) is completed.
494 507
495 508
509Power Management
510================
511
512If your I2C device needs special handling when entering a system low
513power state -- like putting a transceiver into a low power mode, or
514activating a system wakeup mechanism -- do that in the suspend() method.
515The resume() method should reverse what the suspend() method does.
516
517These are standard driver model calls, and they work just like they
518would for any other driver stack. The calls can sleep, and can use
519I2C messaging to the device being suspended or resumed (since their
520parent I2C adapter is active when these calls are issued, and IRQs
521are still enabled).
522
523
524System Shutdown
525===============
526
527If your I2C device needs special handling when the system shuts down
528or reboots (including kexec) -- like turning something off -- use a
529shutdown() method.
530
531Again, this is a standard driver model call, working just like it
532would for any other driver stack: the calls can sleep, and can use
533I2C messaging.
534
535
496Command function 536Command function
497================ 537================
498 538
diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt
index 5a8bd5bd88ef..8f750c0efed5 100644
--- a/Documentation/ioctl-number.txt
+++ b/Documentation/ioctl-number.txt
@@ -94,8 +94,7 @@ Code Seq# Include File Comments
94'L' 00-1F linux/loop.h 94'L' 00-1F linux/loop.h
95'L' E0-FF linux/ppdd.h encrypted disk device driver 95'L' E0-FF linux/ppdd.h encrypted disk device driver
96 <http://linux01.gwdg.de/~alatham/ppdd.html> 96 <http://linux01.gwdg.de/~alatham/ppdd.html>
97'M' all linux/soundcard.h conflict! 97'M' all linux/soundcard.h
98'M' 00-1F linux/isicom.h conflict!
99'N' 00-1F drivers/usb/scanner.h 98'N' 00-1F drivers/usb/scanner.h
100'P' all linux/soundcard.h 99'P' all linux/soundcard.h
101'Q' all linux/soundcard.h 100'Q' all linux/soundcard.h
diff --git a/Documentation/isdn/README.gigaset b/Documentation/isdn/README.gigaset
index fa0d4cca964a..55b2852904a4 100644
--- a/Documentation/isdn/README.gigaset
+++ b/Documentation/isdn/README.gigaset
@@ -8,29 +8,33 @@ GigaSet 307x Device Driver
8 This release supports the connection of the Gigaset 307x/417x family of 8 This release supports the connection of the Gigaset 307x/417x family of
9 ISDN DECT bases via Gigaset M101 Data, Gigaset M105 Data or direct USB 9 ISDN DECT bases via Gigaset M101 Data, Gigaset M105 Data or direct USB
10 connection. The following devices are reported to be compatible: 10 connection. The following devices are reported to be compatible:
11 307x/417x: 11
12 Gigaset SX255isdn 12 Bases:
13 Gigaset SX353isdn 13 Siemens Gigaset 3070/3075 isdn
14 Sinus 45 [AB] isdn (Deutsche Telekom) 14 Siemens Gigaset 4170/4175 isdn
15 Sinus 721X/XA 15 Siemens Gigaset SX205/255
16 Siemens Gigaset SX353
17 T-Com Sinus 45 [AB] isdn
18 T-Com Sinus 721X[A] [SE]
16 Vox Chicago 390 ISDN (KPN Telecom) 19 Vox Chicago 390 ISDN (KPN Telecom)
17 M101: 20
18 Sinus 45 Data 1 (Telekom) 21 RS232 data boxes:
19 M105: 22 Siemens Gigaset M101 Data
20 Gigaset USB Adapter DECT 23 T-Com Sinus 45 Data 1
21 Sinus 45 Data 2 (Telekom) 24
22 Sinus 721 data 25 USB data boxes:
26 Siemens Gigaset M105 Data
27 Siemens Gigaset USB Adapter DECT
28 T-Com Sinus 45 Data 2
29 T-Com Sinus 721 data
23 Chicago 390 USB (KPN) 30 Chicago 390 USB (KPN)
31
24 See also http://www.erbze.info/sinus_gigaset.htm and 32 See also http://www.erbze.info/sinus_gigaset.htm and
25 http://gigaset307x.sourceforge.net/ 33 http://gigaset307x.sourceforge.net/
26 34
27 We had also reports from users of Gigaset M105 who could use the drivers 35 We had also reports from users of Gigaset M105 who could use the drivers
28 with SX 100 and CX 100 ISDN bases (only in unimodem mode, see section 2.4.) 36 with SX 100 and CX 100 ISDN bases (only in unimodem mode, see section 2.4.)
29 If you have another device that works with our driver, please let us know. 37 If you have another device that works with our driver, please let us know.
30 For example, Gigaset SX205isdn/Sinus 721 X SE and Gigaset SX303isdn bases
31 are just versions without answering machine of models known to work, so
32 they should work just as well; but so far we are lacking positive reports
33 on these.
34 38
35 Chances of getting an USB device to work are good if the output of 39 Chances of getting an USB device to work are good if the output of
36 lsusb 40 lsusb
@@ -60,14 +64,28 @@ GigaSet 307x Device Driver
60 To get the device working, you have to load the proper kernel module. You 64 To get the device working, you have to load the proper kernel module. You
61 can do this using 65 can do this using
62 modprobe modulename 66 modprobe modulename
63 where modulename is usb_gigaset (M105) or bas_gigaset (direct USB 67 where modulename is ser_gigaset (M101), usb_gigaset (M105), or
64 connection to the base). 68 bas_gigaset (direct USB connection to the base).
69
70 The module ser_gigaset provides a serial line discipline N_GIGASET_M101
71 which drives the device through the regular serial line driver. To use it,
72 run the Gigaset M101 daemon "gigasetm101d" (also available from
73 http://sourceforge.net/projects/gigaset307x/) with the device file of the
74 RS232 port to the M101 as an argument, for example:
75 gigasetm101d /dev/ttyS1
76 This will open the device file, set its line discipline to N_GIGASET_M101,
77 and then sleep in the background, keeping the device open so that the
78 line discipline remains active. To deactivate it, kill the daemon, for
79 example with
80 killall gigasetm101d
81 before disconnecting the device.
65 82
662.2. Device nodes for user space programs 832.2. Device nodes for user space programs
67 ------------------------------------ 84 ------------------------------------
68 The device can be accessed from user space (eg. by the user space tools 85 The device can be accessed from user space (eg. by the user space tools
69 mentioned in 1.2.) through the device nodes: 86 mentioned in 1.2.) through the device nodes:
70 87
88 - /dev/ttyGS0 for M101 (RS232 data boxes)
71 - /dev/ttyGU0 for M105 (USB data boxes) 89 - /dev/ttyGU0 for M105 (USB data boxes)
72 - /dev/ttyGB0 for the base driver (direct USB connection) 90 - /dev/ttyGB0 for the base driver (direct USB connection)
73 91
@@ -168,6 +186,19 @@ GigaSet 307x Device Driver
168 You can also use /sys/class/tty/ttyGxy/cidmode for changing the CID mode 186 You can also use /sys/class/tty/ttyGxy/cidmode for changing the CID mode
169 setting (ttyGxy is ttyGU0 or ttyGB0). 187 setting (ttyGxy is ttyGU0 or ttyGB0).
170 188
1892.6. M105 Undocumented USB Requests
190 ------------------------------
191
192 The Gigaset M105 USB data box understands a couple of useful, but
193 undocumented USB commands. These requests are not used in normal
194 operation (for wireless access to the base), but are needed for access
195 to the M105's own configuration mode (registration to the base, baudrate
196 and line format settings, device status queries) via the gigacontr
197 utility. Their use is disabled in the driver by default for safety
198 reasons but can be enabled by setting the kernel configuration option
199 "Support for undocumented USB requests" (GIGASET_UNDOCREQ) to "Y" and
200 recompiling.
201
171 202
1723. Troubleshooting 2033. Troubleshooting
173 --------------- 204 ---------------
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 073306818347..79775a4130b5 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -311,10 +311,10 @@ Following are the arch specific command line options to be used while
311loading dump-capture kernel. 311loading dump-capture kernel.
312 312
313For i386, x86_64 and ia64: 313For i386, x86_64 and ia64:
314 "init 1 irqpoll maxcpus=1" 314 "1 irqpoll maxcpus=1"
315 315
316For ppc64: 316For ppc64:
317 "init 1 maxcpus=1 noirqdistrib" 317 "1 maxcpus=1 noirqdistrib"
318 318
319 319
320Notes on loading the dump-capture kernel: 320Notes on loading the dump-capture kernel:
@@ -332,8 +332,8 @@ Notes on loading the dump-capture kernel:
332* You must specify <root-dev> in the format corresponding to the root 332* You must specify <root-dev> in the format corresponding to the root
333 device name in the output of mount command. 333 device name in the output of mount command.
334 334
335* "init 1" boots the dump-capture kernel into single-user mode without 335* Boot parameter "1" boots the dump-capture kernel into single-user
336 networking. If you want networking, use "init 3." 336 mode without networking. If you want networking, use "3".
337 337
338* We generally don' have to bring up a SMP kernel just to capture the 338* We generally don' have to bring up a SMP kernel just to capture the
339 dump. Hence generally it is useful either to build a UP dump-capture 339 dump. Hence generally it is useful either to build a UP dump-capture
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt
index 284e7e198e93..2075c0658bf5 100644
--- a/Documentation/kernel-doc-nano-HOWTO.txt
+++ b/Documentation/kernel-doc-nano-HOWTO.txt
@@ -101,16 +101,20 @@ The format of the block comment is like this:
101 101
102/** 102/**
103 * function_name(:)? (- short description)? 103 * function_name(:)? (- short description)?
104(* @parameterx: (description of parameter x)?)* 104(* @parameterx(space)*: (description of parameter x)?)*
105(* a blank line)? 105(* a blank line)?
106 * (Description:)? (Description of function)? 106 * (Description:)? (Description of function)?
107 * (section header: (section description)? )* 107 * (section header: (section description)? )*
108(*)?*/ 108(*)?*/
109 109
110The short function description cannot be multiline, but the other 110The short function description ***cannot be multiline***, but the other
111descriptions can be (and they can contain blank lines). Avoid putting a 111descriptions can be (and they can contain blank lines). If you continue
112spurious blank line after the function name, or else the description will 112that initial short description onto a second line, that second line will
113be repeated! 113appear further down at the beginning of the description section, which is
114almost certainly not what you had in mind.
115
116Avoid putting a spurious blank line after the function name, or else the
117description will be repeated!
114 118
115All descriptive text is further processed, scanning for the following special 119All descriptive text is further processed, scanning for the following special
116patterns, which are highlighted appropriately. 120patterns, which are highlighted appropriately.
@@ -121,6 +125,31 @@ patterns, which are highlighted appropriately.
121'@parameter' - name of a parameter 125'@parameter' - name of a parameter
122'%CONST' - name of a constant. 126'%CONST' - name of a constant.
123 127
128NOTE 1: The multi-line descriptive text you provide does *not* recognize
129line breaks, so if you try to format some text nicely, as in:
130
131 Return codes
132 0 - cool
133 1 - invalid arg
134 2 - out of memory
135
136this will all run together and produce:
137
138 Return codes 0 - cool 1 - invalid arg 2 - out of memory
139
140NOTE 2: If the descriptive text you provide has lines that begin with
141some phrase followed by a colon, each of those phrases will be taken as
142a new section heading, which means you should similarly try to avoid text
143like:
144
145 Return codes:
146 0: cool
147 1: invalid arg
148 2: out of memory
149
150every line of which would start a new section. Again, probably not
151what you were after.
152
124Take a look around the source tree for examples. 153Take a look around the source tree for examples.
125 154
126 155
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 25d298517104..ce1f2c85e20f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -104,6 +104,9 @@ loader, and have no meaning to the kernel directly.
104Do not modify the syntax of boot loader parameters without extreme 104Do not modify the syntax of boot loader parameters without extreme
105need or coordination with <Documentation/i386/boot.txt>. 105need or coordination with <Documentation/i386/boot.txt>.
106 106
107There are also arch-specific kernel-parameters not documented here.
108See for example <Documentation/x86_64/boot-options.txt>.
109
107Note that ALL kernel parameters listed below are CASE SENSITIVE, and that 110Note that ALL kernel parameters listed below are CASE SENSITIVE, and that
108a trailing = on the name of any parameter states that that parameter will 111a trailing = on the name of any parameter states that that parameter will
109be entered as an environment variable, whereas its absence indicates that 112be entered as an environment variable, whereas its absence indicates that
@@ -361,6 +364,11 @@ and is between 256 and 4096 characters. It is defined in the file
361 clocksource is not available, it defaults to PIT. 364 clocksource is not available, it defaults to PIT.
362 Format: { pit | tsc | cyclone | pmtmr } 365 Format: { pit | tsc | cyclone | pmtmr }
363 366
367 code_bytes [IA32] How many bytes of object code to print in an
368 oops report.
369 Range: 0 - 8192
370 Default: 64
371
364 disable_8254_timer 372 disable_8254_timer
365 enable_8254_timer 373 enable_8254_timer
366 [IA32/X86_64] Disable/Enable interrupt 0 timer routing 374 [IA32/X86_64] Disable/Enable interrupt 0 timer routing
@@ -601,6 +609,10 @@ and is between 256 and 4096 characters. It is defined in the file
601 highmem otherwise. This also works to reduce highmem 609 highmem otherwise. This also works to reduce highmem
602 size on bigger boxes. 610 size on bigger boxes.
603 611
612 highres= [KNL] Enable/disable high resolution timer mode.
613 Valid parameters: "on", "off"
614 Default: "on"
615
604 hisax= [HW,ISDN] 616 hisax= [HW,ISDN]
605 See Documentation/isdn/README.HiSax. 617 See Documentation/isdn/README.HiSax.
606 618
@@ -1070,6 +1082,10 @@ and is between 256 and 4096 characters. It is defined in the file
1070 in certain environments such as networked servers or 1082 in certain environments such as networked servers or
1071 real-time systems. 1083 real-time systems.
1072 1084
1085 nohz= [KNL] Boottime enable/disable dynamic ticks
1086 Valid arguments: on, off
1087 Default: on
1088
1073 noirqbalance [IA-32,SMP,KNL] Disable kernel irq balancing 1089 noirqbalance [IA-32,SMP,KNL] Disable kernel irq balancing
1074 1090
1075 noirqdebug [IA-32] Disables the code which attempts to detect and 1091 noirqdebug [IA-32] Disables the code which attempts to detect and
@@ -1259,6 +1275,12 @@ and is between 256 and 4096 characters. It is defined in the file
1259 This sorting is done to get a device 1275 This sorting is done to get a device
1260 order compatible with older (<= 2.4) kernels. 1276 order compatible with older (<= 2.4) kernels.
1261 nobfsort Don't sort PCI devices into breadth-first order. 1277 nobfsort Don't sort PCI devices into breadth-first order.
1278 cbiosize=nn[KMG] The fixed amount of bus space which is
1279 reserved for the CardBus bridge's IO window.
1280 The default value is 256 bytes.
1281 cbmemsize=nn[KMG] The fixed amount of bus space which is
1282 reserved for the CardBus bridge's memory
1283 window. The default value is 64 megabytes.
1262 1284
1263 pcmv= [HW,PCMCIA] BadgePAD 4 1285 pcmv= [HW,PCMCIA] BadgePAD 4
1264 1286
@@ -1396,6 +1418,8 @@ and is between 256 and 4096 characters. It is defined in the file
1396 in <PAGE_SIZE> units (needed only for swap files). 1418 in <PAGE_SIZE> units (needed only for swap files).
1397 See Documentation/power/swsusp-and-swap-files.txt 1419 See Documentation/power/swsusp-and-swap-files.txt
1398 1420
1421 retain_initrd [RAM] Keep initrd memory after extraction
1422
1399 rhash_entries= [KNL,NET] 1423 rhash_entries= [KNL,NET]
1400 Set number of hash buckets for route cache 1424 Set number of hash buckets for route cache
1401 1425
diff --git a/Documentation/local_ops.txt b/Documentation/local_ops.txt
new file mode 100644
index 000000000000..b0aca0705d1e
--- /dev/null
+++ b/Documentation/local_ops.txt
@@ -0,0 +1,163 @@
1 Semantics and Behavior of Local Atomic Operations
2
3 Mathieu Desnoyers
4
5
6 This document explains the purpose of the local atomic operations, how
7to implement them for any given architecture and shows how they can be used
8properly. It also stresses on the precautions that must be taken when reading
9those local variables across CPUs when the order of memory writes matters.
10
11
12
13* Purpose of local atomic operations
14
15Local atomic operations are meant to provide fast and highly reentrant per CPU
16counters. They minimize the performance cost of standard atomic operations by
17removing the LOCK prefix and memory barriers normally required to synchronize
18across CPUs.
19
20Having fast per CPU atomic counters is interesting in many cases : it does not
21require disabling interrupts to protect from interrupt handlers and it permits
22coherent counters in NMI handlers. It is especially useful for tracing purposes
23and for various performance monitoring counters.
24
25Local atomic operations only guarantee variable modification atomicity wrt the
26CPU which owns the data. Therefore, care must taken to make sure that only one
27CPU writes to the local_t data. This is done by using per cpu data and making
28sure that we modify it from within a preemption safe context. It is however
29permitted to read local_t data from any CPU : it will then appear to be written
30out of order wrt other memory writes on the owner CPU.
31
32
33* Implementation for a given architecture
34
35It can be done by slightly modifying the standard atomic operations : only
36their UP variant must be kept. It typically means removing LOCK prefix (on
37i386 and x86_64) and any SMP sychronization barrier. If the architecture does
38not have a different behavior between SMP and UP, including asm-generic/local.h
39in your archtecture's local.h is sufficient.
40
41The local_t type is defined as an opaque signed long by embedding an
42atomic_long_t inside a structure. This is made so a cast from this type to a
43long fails. The definition looks like :
44
45typedef struct { atomic_long_t a; } local_t;
46
47
48* How to use local atomic operations
49
50#include <linux/percpu.h>
51#include <asm/local.h>
52
53static DEFINE_PER_CPU(local_t, counters) = LOCAL_INIT(0);
54
55
56* Counting
57
58Counting is done on all the bits of a signed long.
59
60In preemptible context, use get_cpu_var() and put_cpu_var() around local atomic
61operations : it makes sure that preemption is disabled around write access to
62the per cpu variable. For instance :
63
64 local_inc(&get_cpu_var(counters));
65 put_cpu_var(counters);
66
67If you are already in a preemption-safe context, you can directly use
68__get_cpu_var() instead.
69
70 local_inc(&__get_cpu_var(counters));
71
72
73
74* Reading the counters
75
76Those local counters can be read from foreign CPUs to sum the count. Note that
77the data seen by local_read across CPUs must be considered to be out of order
78relatively to other memory writes happening on the CPU that owns the data.
79
80 long sum = 0;
81 for_each_online_cpu(cpu)
82 sum += local_read(&per_cpu(counters, cpu));
83
84If you want to use a remote local_read to synchronize access to a resource
85between CPUs, explicit smp_wmb() and smp_rmb() memory barriers must be used
86respectively on the writer and the reader CPUs. It would be the case if you use
87the local_t variable as a counter of bytes written in a buffer : there should
88be a smp_wmb() between the buffer write and the counter increment and also a
89smp_rmb() between the counter read and the buffer read.
90
91
92Here is a sample module which implements a basic per cpu counter using local.h.
93
94--- BEGIN ---
95/* test-local.c
96 *
97 * Sample module for local.h usage.
98 */
99
100
101#include <asm/local.h>
102#include <linux/module.h>
103#include <linux/timer.h>
104
105static DEFINE_PER_CPU(local_t, counters) = LOCAL_INIT(0);
106
107static struct timer_list test_timer;
108
109/* IPI called on each CPU. */
110static void test_each(void *info)
111{
112 /* Increment the counter from a non preemptible context */
113 printk("Increment on cpu %d\n", smp_processor_id());
114 local_inc(&__get_cpu_var(counters));
115
116 /* This is what incrementing the variable would look like within a
117 * preemptible context (it disables preemption) :
118 *
119 * local_inc(&get_cpu_var(counters));
120 * put_cpu_var(counters);
121 */
122}
123
124static void do_test_timer(unsigned long data)
125{
126 int cpu;
127
128 /* Increment the counters */
129 on_each_cpu(test_each, NULL, 0, 1);
130 /* Read all the counters */
131 printk("Counters read from CPU %d\n", smp_processor_id());
132 for_each_online_cpu(cpu) {
133 printk("Read : CPU %d, count %ld\n", cpu,
134 local_read(&per_cpu(counters, cpu)));
135 }
136 del_timer(&test_timer);
137 test_timer.expires = jiffies + 1000;
138 add_timer(&test_timer);
139}
140
141static int __init test_init(void)
142{
143 /* initialize the timer that will increment the counter */
144 init_timer(&test_timer);
145 test_timer.function = do_test_timer;
146 test_timer.expires = jiffies + 1;
147 add_timer(&test_timer);
148
149 return 0;
150}
151
152static void __exit test_exit(void)
153{
154 del_timer_sync(&test_timer);
155}
156
157module_init(test_init);
158module_exit(test_exit);
159
160MODULE_LICENSE("GPL");
161MODULE_AUTHOR("Mathieu Desnoyers");
162MODULE_DESCRIPTION("Local Atomic Ops");
163--- END ---
diff --git a/Documentation/nfsroot.txt b/Documentation/nfsroot.txt
index 719f9a9d60c0..16a7cae2721d 100644
--- a/Documentation/nfsroot.txt
+++ b/Documentation/nfsroot.txt
@@ -67,8 +67,8 @@ nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
67 <nfs-options> Standard NFS options. All options are separated by commas. 67 <nfs-options> Standard NFS options. All options are separated by commas.
68 The following defaults are used: 68 The following defaults are used:
69 port = as given by server portmap daemon 69 port = as given by server portmap daemon
70 rsize = 1024 70 rsize = 4096
71 wsize = 1024 71 wsize = 4096
72 timeo = 7 72 timeo = 7
73 retrans = 3 73 retrans = 3
74 acregmin = 3 74 acregmin = 3
diff --git a/Documentation/pci.txt b/Documentation/pci.txt
index fd5028eca13e..cdf2f3c0ab14 100644
--- a/Documentation/pci.txt
+++ b/Documentation/pci.txt
@@ -205,8 +205,8 @@ Tips on when/where to use the above attributes:
205 exclusively called by the probe() routine, can be marked __devinit. 205 exclusively called by the probe() routine, can be marked __devinit.
206 Ditto for remove() and __devexit. 206 Ditto for remove() and __devexit.
207 207
208 o If mydriver_probe() is marked with __devinit(), then all address 208 o If mydriver_remove() is marked with __devexit(), then all address
209 references to mydriver_probe must use __devexit_p(mydriver_probe) 209 references to mydriver_remove must use __devexit_p(mydriver_remove)
210 (in the struct pci_driver declaration for example). 210 (in the struct pci_driver declaration for example).
211 __devexit_p() will generate the function name _or_ NULL if the 211 __devexit_p() will generate the function name _or_ NULL if the
212 function will be discarded. For an example, see drivers/net/tg3.c. 212 function will be discarded. For an example, see drivers/net/tg3.c.
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index 33994271cb3b..b41397d6430a 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -497,7 +497,7 @@ looks like in practice.
497 | |- device_type = "cpu" 497 | |- device_type = "cpu"
498 | |- reg = <0> 498 | |- reg = <0>
499 | |- clock-frequency = <5f5e1000> 499 | |- clock-frequency = <5f5e1000>
500 | |- linux,boot-cpu 500 | |- 64-bit
501 | |- linux,phandle = <2> 501 | |- linux,phandle = <2>
502 | 502 |
503 o memory@0 503 o memory@0
@@ -509,7 +509,6 @@ looks like in practice.
509 o chosen 509 o chosen
510 |- name = "chosen" 510 |- name = "chosen"
511 |- bootargs = "root=/dev/sda2" 511 |- bootargs = "root=/dev/sda2"
512 |- linux,platform = <00000600>
513 |- linux,phandle = <4> 512 |- linux,phandle = <4>
514 513
515This tree is almost a minimal tree. It pretty much contains the 514This tree is almost a minimal tree. It pretty much contains the
@@ -519,7 +518,7 @@ physical memory layout. It also includes misc information passed
519through /chosen, like in this example, the platform type (mandatory) 518through /chosen, like in this example, the platform type (mandatory)
520and the kernel command line arguments (optional). 519and the kernel command line arguments (optional).
521 520
522The /cpus/PowerPC,970@0/linux,boot-cpu property is an example of a 521The /cpus/PowerPC,970@0/64-bit property is an example of a
523property without a value. All other properties have a value. The 522property without a value. All other properties have a value. The
524significance of the #address-cells and #size-cells properties will be 523significance of the #address-cells and #size-cells properties will be
525explained in chapter IV which defines precisely the required nodes and 524explained in chapter IV which defines precisely the required nodes and
@@ -733,8 +732,7 @@ address which can extend beyond that limit.
733 that typically get driven by the same platform code in the 732 that typically get driven by the same platform code in the
734 kernel, you would use a different "model" property but put a 733 kernel, you would use a different "model" property but put a
735 value in "compatible". The kernel doesn't directly use that 734 value in "compatible". The kernel doesn't directly use that
736 value (see /chosen/linux,platform for how the kernel chooses a 735 value but it is generally useful.
737 platform type) but it is generally useful.
738 736
739 The root node is also generally where you add additional properties 737 The root node is also generally where you add additional properties
740 specific to your board like the serial number if any, that sort of 738 specific to your board like the serial number if any, that sort of
@@ -778,7 +776,6 @@ address which can extend beyond that limit.
778 bytes 776 bytes
779 - d-cache-size : one cell, size of L1 data cache in bytes 777 - d-cache-size : one cell, size of L1 data cache in bytes
780 - i-cache-size : one cell, size of L1 instruction cache in bytes 778 - i-cache-size : one cell, size of L1 instruction cache in bytes
781 - linux, boot-cpu : Should be defined if this cpu is the boot cpu.
782 779
783 Recommended properties: 780 Recommended properties:
784 781
@@ -843,11 +840,6 @@ address which can extend beyond that limit.
843 the prom_init() trampoline when booting with an OF client interface, 840 the prom_init() trampoline when booting with an OF client interface,
844 but that you have to provide yourself when using the flattened format. 841 but that you have to provide yourself when using the flattened format.
845 842
846 Required properties:
847
848 - linux,platform : This is your platform number as assigned by the
849 architecture maintainers
850
851 Recommended properties: 843 Recommended properties:
852 844
853 - bootargs : This zero-terminated string is passed as the kernel 845 - bootargs : This zero-terminated string is passed as the kernel
@@ -1334,6 +1326,9 @@ platforms are moved over to use the flattened-device-tree model.
1334 fsl-usb2-mph compatible controllers. Either this property or 1326 fsl-usb2-mph compatible controllers. Either this property or
1335 "port0" (or both) must be defined for "fsl-usb2-mph" compatible 1327 "port0" (or both) must be defined for "fsl-usb2-mph" compatible
1336 controllers. 1328 controllers.
1329 - dr_mode : indicates the working mode for "fsl-usb2-dr" compatible
1330 controllers. Can be "host", "peripheral", or "otg". Default to
1331 "host" if not defined for backward compatibility.
1337 1332
1338 Recommended properties : 1333 Recommended properties :
1339 - interrupts : <a b> where a is the interrupt number and b is a 1334 - interrupts : <a b> where a is the interrupt number and b is a
@@ -1367,6 +1362,7 @@ platforms are moved over to use the flattened-device-tree model.
1367 #size-cells = <0>; 1362 #size-cells = <0>;
1368 interrupt-parent = <700>; 1363 interrupt-parent = <700>;
1369 interrupts = <26 1>; 1364 interrupts = <26 1>;
1365 dr_mode = "otg";
1370 phy = "ulpi"; 1366 phy = "ulpi";
1371 }; 1367 };
1372 1368
diff --git a/Documentation/powerpc/mpc52xx-device-tree-bindings.txt b/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
index 69f016f02bb0..e59fcbbe338c 100644
--- a/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
+++ b/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
@@ -1,7 +1,7 @@
1MPC52xx Device Tree Bindings 1MPC5200 Device Tree Bindings
2---------------------------- 2----------------------------
3 3
4(c) 2006 Secret Lab Technologies Ltd 4(c) 2006-2007 Secret Lab Technologies Ltd
5Grant Likely <grant.likely at secretlab.ca> 5Grant Likely <grant.likely at secretlab.ca>
6 6
7********** DRAFT *********** 7********** DRAFT ***********
@@ -20,11 +20,11 @@ described in Documentation/powerpc/booting-without-of.txt), or passed
20by Open Firmare (IEEE 1275) compatible firmware using an OF compatible 20by Open Firmare (IEEE 1275) compatible firmware using an OF compatible
21client interface API. 21client interface API.
22 22
23This document specifies the requirements on the device-tree for mpc52xx 23This document specifies the requirements on the device-tree for mpc5200
24based boards. These requirements are above and beyond the details 24based boards. These requirements are above and beyond the details
25specified in either the OpenFirmware spec or booting-without-of.txt 25specified in either the OpenFirmware spec or booting-without-of.txt
26 26
27All new mpc52xx-based boards are expected to match this document. In 27All new mpc5200-based boards are expected to match this document. In
28cases where this document is not sufficient to support a new board port, 28cases where this document is not sufficient to support a new board port,
29this document should be updated as part of adding the new board support. 29this document should be updated as part of adding the new board support.
30 30
@@ -32,26 +32,26 @@ II - Philosophy
32=============== 32===============
33The core of this document is naming convention. The whole point of 33The core of this document is naming convention. The whole point of
34defining this convention is to reduce or eliminate the number of 34defining this convention is to reduce or eliminate the number of
35special cases required to support a 52xx board. If all 52xx boards 35special cases required to support a 5200 board. If all 5200 boards
36follow the same convention, then generic 52xx support code will work 36follow the same convention, then generic 5200 support code will work
37rather than coding special cases for each new board. 37rather than coding special cases for each new board.
38 38
39This section tries to capture the thought process behind why the naming 39This section tries to capture the thought process behind why the naming
40convention is what it is. 40convention is what it is.
41 41
421. Node names 421. names
43------------- 43---------
44There is strong convention/requirements already established for children 44There is strong convention/requirements already established for children
45of the root node. 'cpus' describes the processor cores, 'memory' 45of the root node. 'cpus' describes the processor cores, 'memory'
46describes memory, and 'chosen' provides boot configuration. Other nodes 46describes memory, and 'chosen' provides boot configuration. Other nodes
47are added to describe devices attached to the processor local bus. 47are added to describe devices attached to the processor local bus.
48
48Following convention already established with other system-on-chip 49Following convention already established with other system-on-chip
49processors, MPC52xx boards must have an 'soc5200' node as a child of the 50processors, 5200 device trees should use the name 'soc5200' for the
50root node. 51parent node of on chip devices, and the root node should be its parent.
51 52
52The soc5200 node holds child nodes for all on chip devices. Child nodes 53Child nodes are typically named after the configured function. ie.
53are typically named after the configured function. ie. the FEC node is 54the FEC node is named 'ethernet', and a PSC in uart mode is named 'serial'.
54named 'ethernet', and a PSC in uart mode is named 'serial'.
55 55
562. device_type property 562. device_type property
57----------------------- 57-----------------------
@@ -66,28 +66,47 @@ exactly.
66Since device_type isn't enough to match devices to drivers, there also 66Since device_type isn't enough to match devices to drivers, there also
67needs to be a naming convention for the compatible property. Compatible 67needs to be a naming convention for the compatible property. Compatible
68is an list of device descriptions sorted from specific to generic. For 68is an list of device descriptions sorted from specific to generic. For
69the mpc52xx, the required format for each compatible value is 69the mpc5200, the required format for each compatible value is
70<chip>-<device>[-<mode>]. At the minimum, the list shall contain two 70<chip>-<device>[-<mode>]. The OS should be able to match a device driver
71items; the first specifying the exact chip, and the second specifying 71to the device based solely on the compatible value. If two drivers
72mpc52xx for the chip. 72match on the compatible list; the 'most compatible' driver should be
73 73selected.
74ie. ethernet on mpc5200b: compatible = "mpc5200b-ethernet\0mpc52xx-ethernet" 74
75 75The split between the MPC5200 and the MPC5200B leaves a bit of a
76The idea here is that most drivers will match to the most generic field 76connundrum. How should the compatible property be set up to provide
77in the compatible list (mpc52xx-*), but can also test the more specific 77maximum compatability information; but still acurately describe the
78field for enabling bug fixes or extra features. 78chip? For the MPC5200; the answer is easy. Most of the SoC devices
79originally appeared on the MPC5200. Since they didn't exist anywhere
80else; the 5200 compatible properties will contain only one item;
81"mpc5200-<device>".
82
83The 5200B is almost the same as the 5200, but not quite. It fixes
84silicon bugs and it adds a small number of enhancements. Most of the
85devices either provide exactly the same interface as on the 5200. A few
86devices have extra functions but still have a backwards compatible mode.
87To express this infomation as completely as possible, 5200B device trees
88should have two items in the compatible list;
89"mpc5200b-<device>\0mpc5200-<device>". It is *strongly* recommended
90that 5200B device trees follow this convention (instead of only listing
91the base mpc5200 item).
92
93If another chip appear on the market with one of the mpc5200 SoC
94devices, then the compatible list should include mpc5200-<device>.
95
96ie. ethernet on mpc5200: compatible = "mpc5200-ethernet"
97 ethernet on mpc5200b: compatible = "mpc5200b-ethernet\0mpc5200-ethernet"
79 98
80Modal devices, like PSCs, also append the configured function to the 99Modal devices, like PSCs, also append the configured function to the
81end of the compatible field. ie. A PSC in i2s mode would specify 100end of the compatible field. ie. A PSC in i2s mode would specify
82"mpc52xx-psc-i2s", not "mpc52xx-i2s". This convention is chosen to 101"mpc5200-psc-i2s", not "mpc5200-i2s". This convention is chosen to
83avoid naming conflicts with non-psc devices providing the same 102avoid naming conflicts with non-psc devices providing the same
84function. For example, "mpc52xx-spi" and "mpc52xx-psc-spi" describe 103function. For example, "mpc5200-spi" and "mpc5200-psc-spi" describe
85the mpc5200 simple spi device and a PSC spi mode respectively. 104the mpc5200 simple spi device and a PSC spi mode respectively.
86 105
87If the soc device is more generic and present on other SOCs, the 106If the soc device is more generic and present on other SOCs, the
88compatible property can specify the more generic device type also. 107compatible property can specify the more generic device type also.
89 108
90ie. mscan: compatible = "mpc5200-mscan\0mpc52xx-mscan\0fsl,mscan"; 109ie. mscan: compatible = "mpc5200-mscan\0fsl,mscan";
91 110
92At the time of writing, exact chip may be either 'mpc5200' or 111At the time of writing, exact chip may be either 'mpc5200' or
93'mpc5200b'. 112'mpc5200b'.
@@ -96,7 +115,7 @@ Device drivers should always try to match as generically as possible.
96 115
97III - Structure 116III - Structure
98=============== 117===============
99The device tree for an mpc52xx board follows the structure defined in 118The device tree for an mpc5200 board follows the structure defined in
100booting-without-of.txt with the following additional notes: 119booting-without-of.txt with the following additional notes:
101 120
1020) the root node 1210) the root node
@@ -115,7 +134,7 @@ Typical memory description node; see booting-without-of.
115 134
1163) The soc5200 node 1353) The soc5200 node
117------------------- 136-------------------
118This node describes the on chip SOC peripherals. Every mpc52xx based 137This node describes the on chip SOC peripherals. Every mpc5200 based
119board will have this node, and as such there is a common naming 138board will have this node, and as such there is a common naming
120convention for SOC devices. 139convention for SOC devices.
121 140
@@ -125,71 +144,111 @@ name type description
125device_type string must be "soc" 144device_type string must be "soc"
126ranges int should be <0 baseaddr baseaddr+10000> 145ranges int should be <0 baseaddr baseaddr+10000>
127reg int must be <baseaddr 10000> 146reg int must be <baseaddr 10000>
147compatible string mpc5200: "mpc5200-soc"
148 mpc5200b: "mpc5200b-soc\0mpc5200-soc"
149system-frequency int Fsystem frequency; source of all
150 other clocks.
151bus-frequency int IPB bus frequency in HZ. Clock rate
152 used by most of the soc devices.
153#interrupt-cells int must be <3>.
128 154
129Recommended properties: 155Recommended properties:
130name type description 156name type description
131---- ---- ----------- 157---- ---- -----------
132compatible string should be "<chip>-soc\0mpc52xx-soc" 158model string Exact model of the chip;
133 ie. "mpc5200b-soc\0mpc52xx-soc" 159 ie: model="fsl,mpc5200"
134#interrupt-cells int must be <3>. If it is not defined 160revision string Silicon revision of chip
135 here then it must be defined in every 161 ie: revision="M08A"
136 soc device node. 162
137bus-frequency int IPB bus frequency in HZ. Clock rate 163The 'model' and 'revision' properties are *strongly* recommended. Having
138 used by most of the soc devices. 164them presence acts as a bit of a safety net for working around as yet
139 Defining it here avoids needing it 165undiscovered bugs on one version of silicon. For example, device drivers
140 added to every device node. 166can use the model and revision properties to decide if a bug fix should
167be turned on.
141 168
1424) soc5200 child nodes 1694) soc5200 child nodes
143---------------------- 170----------------------
144Any on chip SOC devices available to Linux must appear as soc5200 child nodes. 171Any on chip SOC devices available to Linux must appear as soc5200 child nodes.
145 172
146Note: in the tables below, '*' matches all <chip> values. ie. 173Note: The tables below show the value for the mpc5200. A mpc5200b device
147*-pic would translate to "mpc5200-pic\0mpc52xx-pic" 174tree should use the "mpc5200b-<device>\0mpc5200-<device> form.
148 175
149Required soc5200 child nodes: 176Required soc5200 child nodes:
150name device_type compatible Description 177name device_type compatible Description
151---- ----------- ---------- ----------- 178---- ----------- ---------- -----------
152cdm@<addr> cdm *-cmd Clock Distribution 179cdm@<addr> cdm mpc5200-cmd Clock Distribution
153pic@<addr> interrupt-controller *-pic need an interrupt 180pic@<addr> interrupt-controller mpc5200-pic need an interrupt
154 controller to boot 181 controller to boot
155bestcomm@<addr> dma-controller *-bestcomm 52xx pic also requires 182bestcomm@<addr> dma-controller mpc5200-bestcomm 5200 pic also requires
156 the bestcomm device 183 the bestcomm device
157 184
158Recommended soc5200 child nodes; populate as needed for your board 185Recommended soc5200 child nodes; populate as needed for your board
159name device_type compatible Description 186name device_type compatible Description
160---- ----------- ---------- ----------- 187---- ----------- ---------- -----------
161gpt@<addr> gpt *-gpt General purpose timers 188gpt@<addr> gpt mpc5200-gpt General purpose timers
162rtc@<addr> rtc *-rtc Real time clock 189rtc@<addr> rtc mpc5200-rtc Real time clock
163mscan@<addr> mscan *-mscan CAN bus controller 190mscan@<addr> mscan mpc5200-mscan CAN bus controller
164pci@<addr> pci *-pci PCI bridge 191pci@<addr> pci mpc5200-pci PCI bridge
165serial@<addr> serial *-psc-uart PSC in serial mode 192serial@<addr> serial mpc5200-psc-uart PSC in serial mode
166i2s@<addr> sound *-psc-i2s PSC in i2s mode 193i2s@<addr> sound mpc5200-psc-i2s PSC in i2s mode
167ac97@<addr> sound *-psc-ac97 PSC in ac97 mode 194ac97@<addr> sound mpc5200-psc-ac97 PSC in ac97 mode
168spi@<addr> spi *-psc-spi PSC in spi mode 195spi@<addr> spi mpc5200-psc-spi PSC in spi mode
169irda@<addr> irda *-psc-irda PSC in IrDA mode 196irda@<addr> irda mpc5200-psc-irda PSC in IrDA mode
170spi@<addr> spi *-spi MPC52xx spi device 197spi@<addr> spi mpc5200-spi MPC5200 spi device
171ethernet@<addr> network *-fec MPC52xx ethernet device 198ethernet@<addr> network mpc5200-fec MPC5200 ethernet device
172ata@<addr> ata *-ata IDE ATA interface 199ata@<addr> ata mpc5200-ata IDE ATA interface
173i2c@<addr> i2c *-i2c I2C controller 200i2c@<addr> i2c mpc5200-i2c I2C controller
174usb@<addr> usb-ohci-be *-ohci,ohci-be USB controller 201usb@<addr> usb-ohci-be mpc5200-ohci,ohci-be USB controller
175xlb@<addr> xlb *-xlb XLB arbritrator 202xlb@<addr> xlb mpc5200-xlb XLB arbritrator
203
204Important child node properties
205name type description
206---- ---- -----------
207cell-index int When multiple devices are present, is the
208 index of the device in the hardware (ie. There
209 are 6 PSC on the 5200 numbered PSC1 to PSC6)
210 PSC1 has 'cell-index = <0>'
211 PSC4 has 'cell-index = <3>'
212
2135) General Purpose Timer nodes (child of soc5200 node)
214On the mpc5200 and 5200b, GPT0 has a watchdog timer function. If the board
215design supports the internal wdt, then the device node for GPT0 should
216include the empty property 'has-wdt'.
217
2186) PSC nodes (child of soc5200 node)
219PSC nodes can define the optional 'port-number' property to force assignment
220order of serial ports. For example, PSC5 might be physically connected to
221the port labeled 'COM1' and PSC1 wired to 'COM1'. In this case, PSC5 would
222have a "port-number = <0>" property, and PSC1 would have "port-number = <1>".
223
224PSC in i2s mode: The mpc5200 and mpc5200b PSCs are not compatible when in
225i2s mode. An 'mpc5200b-psc-i2s' node cannot include 'mpc5200-psc-i2s' in the
226compatible field.
176 227
177IV - Extra Notes 228IV - Extra Notes
178================ 229================
179 230
1801. Interrupt mapping 2311. Interrupt mapping
181-------------------- 232--------------------
182The mpc52xx pic driver splits hardware IRQ numbers into two levels. The 233The mpc5200 pic driver splits hardware IRQ numbers into two levels. The
183split reflects the layout of the PIC hardware itself, which groups 234split reflects the layout of the PIC hardware itself, which groups
184interrupts into one of three groups; CRIT, MAIN or PERP. Also, the 235interrupts into one of three groups; CRIT, MAIN or PERP. Also, the
185Bestcomm dma engine has it's own set of interrupt sources which are 236Bestcomm dma engine has it's own set of interrupt sources which are
186cascaded off of peripheral interrupt 0, which the driver interprets as a 237cascaded off of peripheral interrupt 0, which the driver interprets as a
187fourth group, SDMA. 238fourth group, SDMA.
188 239
189The interrupts property for device nodes using the mpc52xx pic consists 240The interrupts property for device nodes using the mpc5200 pic consists
190of three cells; <L1 L2 level> 241of three cells; <L1 L2 level>
191 242
192 L1 := [CRIT=0, MAIN=1, PERP=2, SDMA=3] 243 L1 := [CRIT=0, MAIN=1, PERP=2, SDMA=3]
193 L2 := interrupt number; directly mapped from the value in the 244 L2 := interrupt number; directly mapped from the value in the
194 "ICTL PerStat, MainStat, CritStat Encoded Register" 245 "ICTL PerStat, MainStat, CritStat Encoded Register"
195 level := [LEVEL_HIGH=0, EDGE_RISING=1, EDGE_FALLING=2, LEVEL_LOW=3] 246 level := [LEVEL_HIGH=0, EDGE_RISING=1, EDGE_FALLING=2, LEVEL_LOW=3]
247
2482. Shared registers
249-------------------
250Some SoC devices share registers between them. ie. the i2c devices use
251a single clock control register, and almost all device are affected by
252the port_config register. Devices which need to manipulate shared regs
253should look to the parent SoC node. The soc node is responsible
254for arbitrating all shared register access.
diff --git a/Documentation/rbtree.txt b/Documentation/rbtree.txt
new file mode 100644
index 000000000000..7224459b469e
--- /dev/null
+++ b/Documentation/rbtree.txt
@@ -0,0 +1,192 @@
1Red-black Trees (rbtree) in Linux
2January 18, 2007
3Rob Landley <rob@landley.net>
4=============================
5
6What are red-black trees, and what are they for?
7------------------------------------------------
8
9Red-black trees are a type of self-balancing binary search tree, used for
10storing sortable key/value data pairs. This differs from radix trees (which
11are used to efficiently store sparse arrays and thus use long integer indexes
12to insert/access/delete nodes) and hash tables (which are not kept sorted to
13be easily traversed in order, and must be tuned for a specific size and
14hash function where rbtrees scale gracefully storing arbitrary keys).
15
16Red-black trees are similar to AVL trees, but provide faster real-time bounded
17worst case performance for insertion and deletion (at most two rotations and
18three rotations, respectively, to balance the tree), with slightly slower
19(but still O(log n)) lookup time.
20
21To quote Linux Weekly News:
22
23 There are a number of red-black trees in use in the kernel.
24 The anticipatory, deadline, and CFQ I/O schedulers all employ
25 rbtrees to track requests; the packet CD/DVD driver does the same.
26 The high-resolution timer code uses an rbtree to organize outstanding
27 timer requests. The ext3 filesystem tracks directory entries in a
28 red-black tree. Virtual memory areas (VMAs) are tracked with red-black
29 trees, as are epoll file descriptors, cryptographic keys, and network
30 packets in the "hierarchical token bucket" scheduler.
31
32This document covers use of the Linux rbtree implementation. For more
33information on the nature and implementation of Red Black Trees, see:
34
35 Linux Weekly News article on red-black trees
36 http://lwn.net/Articles/184495/
37
38 Wikipedia entry on red-black trees
39 http://en.wikipedia.org/wiki/Red-black_tree
40
41Linux implementation of red-black trees
42---------------------------------------
43
44Linux's rbtree implementation lives in the file "lib/rbtree.c". To use it,
45"#include <linux/rbtree.h>".
46
47The Linux rbtree implementation is optimized for speed, and thus has one
48less layer of indirection (and better cache locality) than more traditional
49tree implementations. Instead of using pointers to separate rb_node and data
50structures, each instance of struct rb_node is embedded in the data structure
51it organizes. And instead of using a comparison callback function pointer,
52users are expected to write their own tree search and insert functions
53which call the provided rbtree functions. Locking is also left up to the
54user of the rbtree code.
55
56Creating a new rbtree
57---------------------
58
59Data nodes in an rbtree tree are structures containing a struct rb_node member:
60
61 struct mytype {
62 struct rb_node node;
63 char *keystring;
64 };
65
66When dealing with a pointer to the embedded struct rb_node, the containing data
67structure may be accessed with the standard container_of() macro. In addition,
68individual members may be accessed directly via rb_entry(node, type, member).
69
70At the root of each rbtree is an rb_root structure, which is initialized to be
71empty via:
72
73 struct rb_root mytree = RB_ROOT;
74
75Searching for a value in an rbtree
76----------------------------------
77
78Writing a search function for your tree is fairly straightforward: start at the
79root, compare each value, and follow the left or right branch as necessary.
80
81Example:
82
83 struct mytype *my_search(struct rb_root *root, char *string)
84 {
85 struct rb_node *node = root->rb_node;
86
87 while (node) {
88 struct mytype *data = container_of(node, struct mytype, node);
89 int result;
90
91 result = strcmp(string, data->keystring);
92
93 if (result < 0)
94 node = node->rb_left;
95 else if (result > 0)
96 node = node->rb_right;
97 else
98 return data;
99 }
100 return NULL;
101 }
102
103Inserting data into an rbtree
104-----------------------------
105
106Inserting data in the tree involves first searching for the place to insert the
107new node, then inserting the node and rebalancing ("recoloring") the tree.
108
109The search for insertion differs from the previous search by finding the
110location of the pointer on which to graft the new node. The new node also
111needs a link to its parent node for rebalancing purposes.
112
113Example:
114
115 int my_insert(struct rb_root *root, struct mytype *data)
116 {
117 struct rb_node **new = &(root->rb_node), *parent = NULL;
118
119 /* Figure out where to put new node */
120 while (*new) {
121 struct mytype *this = container_of(*new, struct mytype, node);
122 int result = strcmp(data->keystring, this->keystring);
123
124 parent = *new;
125 if (result < 0)
126 new = &((*new)->rb_left);
127 else if (result > 0)
128 new = &((*new)->rb_right);
129 else
130 return FALSE;
131 }
132
133 /* Add new node and rebalance tree. */
134 rb_link_node(data->node, parent, new);
135 rb_insert_color(data->node, root);
136
137 return TRUE;
138 }
139
140Removing or replacing existing data in an rbtree
141------------------------------------------------
142
143To remove an existing node from a tree, call:
144
145 void rb_erase(struct rb_node *victim, struct rb_root *tree);
146
147Example:
148
149 struct mytype *data = mysearch(mytree, "walrus");
150
151 if (data) {
152 rb_erase(data->node, mytree);
153 myfree(data);
154 }
155
156To replace an existing node in a tree with a new one with the same key, call:
157
158 void rb_replace_node(struct rb_node *old, struct rb_node *new,
159 struct rb_root *tree);
160
161Replacing a node this way does not re-sort the tree: If the new node doesn't
162have the same key as the old node, the rbtree will probably become corrupted.
163
164Iterating through the elements stored in an rbtree (in sort order)
165------------------------------------------------------------------
166
167Four functions are provided for iterating through an rbtree's contents in
168sorted order. These work on arbitrary trees, and should not need to be
169modified or wrapped (except for locking purposes):
170
171 struct rb_node *rb_first(struct rb_root *tree);
172 struct rb_node *rb_last(struct rb_root *tree);
173 struct rb_node *rb_next(struct rb_node *node);
174 struct rb_node *rb_prev(struct rb_node *node);
175
176To start iterating, call rb_first() or rb_last() with a pointer to the root
177of the tree, which will return a pointer to the node structure contained in
178the first or last element in the tree. To continue, fetch the next or previous
179node by calling rb_next() or rb_prev() on the current node. This will return
180NULL when there are no more nodes left.
181
182The iterator functions return a pointer to the embedded struct rb_node, from
183which the containing data structure may be accessed with the container_of()
184macro, and individual members may be accessed directly via
185rb_entry(node, type, member).
186
187Example:
188
189 struct rb_node *node;
190 for (node = rb_first(&mytree); node; node = rb_next(node))
191 printk("key=%s\n", rb_entry(node, int, keystring));
192
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt
index 7cf1ec5bcdd3..1ef6bb88cd00 100644
--- a/Documentation/rtc.txt
+++ b/Documentation/rtc.txt
@@ -149,7 +149,7 @@ RTC class framework, but can't be supported by the older driver.
149 is connected to an IRQ line, it can often issue an alarm IRQ up to 149 is connected to an IRQ line, it can often issue an alarm IRQ up to
150 24 hours in the future. 150 24 hours in the future.
151 151
152 * RTC_WKALM_SET, RTC_WKALM_READ ... RTCs that can issue alarms beyond 152 * RTC_WKALM_SET, RTC_WKALM_RD ... RTCs that can issue alarms beyond
153 the next 24 hours use a slightly more powerful API, which supports 153 the next 24 hours use a slightly more powerful API, which supports
154 setting the longer alarm time and enabling its IRQ using a single 154 setting the longer alarm time and enabling its IRQ using a single
155 request (using the same model as EFI firmware). 155 request (using the same model as EFI firmware).
@@ -167,6 +167,28 @@ Linux out of a low power sleep state (or hibernation) back to a fully
167operational state. For example, a system could enter a deep power saving 167operational state. For example, a system could enter a deep power saving
168state until it's time to execute some scheduled tasks. 168state until it's time to execute some scheduled tasks.
169 169
170Note that many of these ioctls need not actually be implemented by your
171driver. The common rtc-dev interface handles many of these nicely if your
172driver returns ENOIOCTLCMD. Some common examples:
173
174 * RTC_RD_TIME, RTC_SET_TIME: the read_time/set_time functions will be
175 called with appropriate values.
176
177 * RTC_ALM_SET, RTC_ALM_READ, RTC_WKALM_SET, RTC_WKALM_RD: the
178 set_alarm/read_alarm functions will be called. To differentiate
179 between the ALM and WKALM, check the larger fields of the rtc_wkalrm
180 struct (like tm_year). These will be set to -1 when using ALM and
181 will be set to proper values when using WKALM.
182
183 * RTC_IRQP_SET, RTC_IRQP_READ: the irq_set_freq function will be called
184 to set the frequency while the framework will handle the read for you
185 since the frequency is stored in the irq_freq member of the rtc_device
186 structure. Also make sure you set the max_user_freq member in your
187 initialization routines so the framework can sanity check the user
188 input for you.
189
190If all else fails, check out the rtc-test.c driver!
191
170 192
171-------------------- 8< ---------------- 8< ----------------------------- 193-------------------- 8< ---------------- 8< -----------------------------
172 194
@@ -237,7 +259,7 @@ int main(int argc, char **argv)
237 "\n...Update IRQs not supported.\n"); 259 "\n...Update IRQs not supported.\n");
238 goto test_READ; 260 goto test_READ;
239 } 261 }
240 perror("ioctl"); 262 perror("RTC_UIE_ON ioctl");
241 exit(errno); 263 exit(errno);
242 } 264 }
243 265
@@ -284,7 +306,7 @@ int main(int argc, char **argv)
284 /* Turn off update interrupts */ 306 /* Turn off update interrupts */
285 retval = ioctl(fd, RTC_UIE_OFF, 0); 307 retval = ioctl(fd, RTC_UIE_OFF, 0);
286 if (retval == -1) { 308 if (retval == -1) {
287 perror("ioctl"); 309 perror("RTC_UIE_OFF ioctl");
288 exit(errno); 310 exit(errno);
289 } 311 }
290 312
@@ -292,7 +314,7 @@ test_READ:
292 /* Read the RTC time/date */ 314 /* Read the RTC time/date */
293 retval = ioctl(fd, RTC_RD_TIME, &rtc_tm); 315 retval = ioctl(fd, RTC_RD_TIME, &rtc_tm);
294 if (retval == -1) { 316 if (retval == -1) {
295 perror("ioctl"); 317 perror("RTC_RD_TIME ioctl");
296 exit(errno); 318 exit(errno);
297 } 319 }
298 320
@@ -320,14 +342,14 @@ test_READ:
320 "\n...Alarm IRQs not supported.\n"); 342 "\n...Alarm IRQs not supported.\n");
321 goto test_PIE; 343 goto test_PIE;
322 } 344 }
323 perror("ioctl"); 345 perror("RTC_ALM_SET ioctl");
324 exit(errno); 346 exit(errno);
325 } 347 }
326 348
327 /* Read the current alarm settings */ 349 /* Read the current alarm settings */
328 retval = ioctl(fd, RTC_ALM_READ, &rtc_tm); 350 retval = ioctl(fd, RTC_ALM_READ, &rtc_tm);
329 if (retval == -1) { 351 if (retval == -1) {
330 perror("ioctl"); 352 perror("RTC_ALM_READ ioctl");
331 exit(errno); 353 exit(errno);
332 } 354 }
333 355
@@ -337,7 +359,7 @@ test_READ:
337 /* Enable alarm interrupts */ 359 /* Enable alarm interrupts */
338 retval = ioctl(fd, RTC_AIE_ON, 0); 360 retval = ioctl(fd, RTC_AIE_ON, 0);
339 if (retval == -1) { 361 if (retval == -1) {
340 perror("ioctl"); 362 perror("RTC_AIE_ON ioctl");
341 exit(errno); 363 exit(errno);
342 } 364 }
343 365
@@ -355,7 +377,7 @@ test_READ:
355 /* Disable alarm interrupts */ 377 /* Disable alarm interrupts */
356 retval = ioctl(fd, RTC_AIE_OFF, 0); 378 retval = ioctl(fd, RTC_AIE_OFF, 0);
357 if (retval == -1) { 379 if (retval == -1) {
358 perror("ioctl"); 380 perror("RTC_AIE_OFF ioctl");
359 exit(errno); 381 exit(errno);
360 } 382 }
361 383
@@ -368,7 +390,7 @@ test_PIE:
368 fprintf(stderr, "\nNo periodic IRQ support\n"); 390 fprintf(stderr, "\nNo periodic IRQ support\n");
369 return 0; 391 return 0;
370 } 392 }
371 perror("ioctl"); 393 perror("RTC_IRQP_READ ioctl");
372 exit(errno); 394 exit(errno);
373 } 395 }
374 fprintf(stderr, "\nPeriodic IRQ rate is %ldHz.\n", tmp); 396 fprintf(stderr, "\nPeriodic IRQ rate is %ldHz.\n", tmp);
@@ -387,7 +409,7 @@ test_PIE:
387 "\n...Periodic IRQ rate is fixed\n"); 409 "\n...Periodic IRQ rate is fixed\n");
388 goto done; 410 goto done;
389 } 411 }
390 perror("ioctl"); 412 perror("RTC_IRQP_SET ioctl");
391 exit(errno); 413 exit(errno);
392 } 414 }
393 415
@@ -397,7 +419,7 @@ test_PIE:
397 /* Enable periodic interrupts */ 419 /* Enable periodic interrupts */
398 retval = ioctl(fd, RTC_PIE_ON, 0); 420 retval = ioctl(fd, RTC_PIE_ON, 0);
399 if (retval == -1) { 421 if (retval == -1) {
400 perror("ioctl"); 422 perror("RTC_PIE_ON ioctl");
401 exit(errno); 423 exit(errno);
402 } 424 }
403 425
@@ -416,7 +438,7 @@ test_PIE:
416 /* Disable periodic interrupts */ 438 /* Disable periodic interrupts */
417 retval = ioctl(fd, RTC_PIE_OFF, 0); 439 retval = ioctl(fd, RTC_PIE_OFF, 0);
418 if (retval == -1) { 440 if (retval == -1) {
419 perror("ioctl"); 441 perror("RTC_PIE_OFF ioctl");
420 exit(errno); 442 exit(errno);
421 } 443 }
422 } 444 }
diff --git a/Documentation/s390/Debugging390.txt b/Documentation/s390/Debugging390.txt
index 3f9ddbc23b27..0993969609cf 100644
--- a/Documentation/s390/Debugging390.txt
+++ b/Documentation/s390/Debugging390.txt
@@ -480,7 +480,7 @@ r2 argument 0 / return value 0 call-clobbered
480r3 argument 1 / return value 1 (if long long) call-clobbered 480r3 argument 1 / return value 1 (if long long) call-clobbered
481r4 argument 2 call-clobbered 481r4 argument 2 call-clobbered
482r5 argument 3 call-clobbered 482r5 argument 3 call-clobbered
483r6 argument 5 saved 483r6 argument 4 saved
484r7 pointer-to arguments 5 to ... saved 484r7 pointer-to arguments 5 to ... saved
485r8 this & that saved 485r8 this & that saved
486r9 this & that saved 486r9 this & that saved
diff --git a/Documentation/scsi/ChangeLog.megaraid b/Documentation/scsi/ChangeLog.megaraid
index a056bbe67c7e..37796fe45bd0 100644
--- a/Documentation/scsi/ChangeLog.megaraid
+++ b/Documentation/scsi/ChangeLog.megaraid
@@ -1,3 +1,19 @@
1Release Date : Thu Nov 16 15:32:35 EST 2006 -
2 Sumant Patro <sumant.patro@lsi.com>
3Current Version : 2.20.5.1 (scsi module), 2.20.2.6 (cmm module)
4Older Version : 2.20.4.9 (scsi module), 2.20.2.6 (cmm module)
5
61. Changes in Initialization to fix kdump failure.
7 Send SYNC command on loading.
8 This command clears the pending commands in the adapter
9 and re-initialize its internal RAID structure.
10 Without this change, megaraid driver either panics or fails to
11 initialize the adapter during kdump's second kernel boot
12 if there are pending commands or interrupts from other devices
13 sharing the same IRQ.
142. Authors email-id domain name changed from lsil.com to lsi.com.
15 Also modified the MODULE_AUTHOR to megaraidlinux@lsi.com
16
1Release Date : Fri May 19 09:31:45 EST 2006 - Seokmann Ju <sju@lsil.com> 17Release Date : Fri May 19 09:31:45 EST 2006 - Seokmann Ju <sju@lsil.com>
2Current Version : 2.20.4.9 (scsi module), 2.20.2.6 (cmm module) 18Current Version : 2.20.4.9 (scsi module), 2.20.2.6 (cmm module)
3Older Version : 2.20.4.8 (scsi module), 2.20.2.6 (cmm module) 19Older Version : 2.20.4.8 (scsi module), 2.20.2.6 (cmm module)
diff --git a/Documentation/sony-laptop.txt b/Documentation/sony-laptop.txt
new file mode 100644
index 000000000000..dfd26df056f4
--- /dev/null
+++ b/Documentation/sony-laptop.txt
@@ -0,0 +1,106 @@
1Sony Notebook Control Driver (SNC) Readme
2-----------------------------------------
3 Copyright (C) 2004- 2005 Stelian Pop <stelian@popies.net>
4 Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
5
6This mini-driver drives the SNC device present in the ACPI BIOS of
7the Sony Vaio laptops.
8
9It gives access to some extra laptop functionalities. In its current
10form, this driver let the user set or query the screen brightness
11through the backlight subsystem and remove/apply power to some devices.
12
13Backlight control:
14------------------
15If your laptop model supports it, you will find sysfs files in the
16/sys/class/backlight/sony/
17directory. You will be able to query and set the current screen
18brightness:
19 brightness get/set screen brightness (an iteger
20 between 0 and 7)
21 actual_brightness reading from this file will query the HW
22 to get real brightness value
23 max_brightness the maximum brightness value
24
25
26Platform specific:
27------------------
28Loading the sony-laptop module will create a
29/sys/devices/platform/sony-laptop/
30directory populated with some files.
31
32You then read/write integer values from/to those files by using
33standard UNIX tools.
34
35The files are:
36 brightness_default screen brightness which will be set
37 when the laptop will be rebooted
38 cdpower power on/off the internal CD drive
39 audiopower power on/off the internal sound card
40 lanpower power on/off the internal ethernet card
41 (only in debug mode)
42
43Note that some files may be missing if they are not supported
44by your particular laptop model.
45
46Example usage:
47 # echo "1" > /sys/devices/platform/sony-laptop/brightness_default
48sets the lowest screen brightness for the next and later reboots,
49 # echo "8" > /sys/devices/platform/sony-laptop/brightness_default
50sets the highest screen brightness for the next and later reboots,
51 # cat /sys/devices/platform/sony-laptop/brightness_default
52retrieves the value.
53
54 # echo "0" > /sys/devices/platform/sony-laptop/audiopower
55powers off the sound card,
56 # echo "1" > /sys/devices/platform/sony-laptop/audiopower
57powers on the sound card.
58
59Development:
60------------
61
62If you want to help with the development of this driver (and
63you are not afraid of any side effects doing strange things with
64your ACPI BIOS could have on your laptop), load the driver and
65pass the option 'debug=1'.
66
67REPEAT: DON'T DO THIS IF YOU DON'T LIKE RISKY BUSINESS.
68
69In your kernel logs you will find the list of all ACPI methods
70the SNC device has on your laptop. You can see the GCDP/GCDP methods
71used to pwer on/off the CD drive, but there are others.
72
73I HAVE NO IDEA WHAT THOSE METHODS DO.
74
75The sony-laptop driver creates, for some of those methods (the most
76current ones found on several Vaio models), an entry under
77/sys/devices/platform/sony-laptop, just like the 'cdpower' one.
78You can create other entries corresponding to your own laptop methods by
79further editing the source (see the 'sony_acpi_values' table, and add a new
80entry to this table with your get/set method names using the
81HANDLE_NAMES macro).
82
83Your mission, should you accept it, is to try finding out what
84those entries are for, by reading/writing random values from/to those
85files and find out what is the impact on your laptop.
86
87Should you find anything interesting, please report it back to me,
88I will not disavow all knowledge of your actions :)
89
90Bugs/Limitations:
91-----------------
92
93* This driver is not based on official documentation from Sony
94 (because there is none), so there is no guarantee this driver
95 will work at all, or do the right thing. Although this hasn't
96 happened to me, this driver could do very bad things to your
97 laptop, including permanent damage.
98
99* The sony-laptop and sonypi drivers do not interact at all. In the
100 future, sonypi could use sony-laptop to do (part of) its business.
101
102* spicctrl, which is the userspace tool used to communicate with the
103 sonypi driver (through /dev/sonypi) does not try to use the
104 sony-laptop driver. In the future, spicctrl could try sonypi first,
105 and if it isn't present, try sony-laptop instead.
106
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 9fef210ab50a..c30ff1bb2d10 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -242,6 +242,12 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
242 ac97_clock - AC'97 clock (default = 48000) 242 ac97_clock - AC'97 clock (default = 48000)
243 ac97_quirk - AC'97 workaround for strange hardware 243 ac97_quirk - AC'97 workaround for strange hardware
244 See "AC97 Quirk Option" section below. 244 See "AC97 Quirk Option" section below.
245 ac97_codec - Workaround to specify which AC'97 codec
246 instead of probing. If this works for you
247 file a bug with your `lspci -vn` output.
248 -2 -- Force probing.
249 -1 -- Default behavior.
250 0-2 -- Use the specified codec.
245 spdif_aclink - S/PDIF transfer over AC-link (default = 1) 251 spdif_aclink - S/PDIF transfer over AC-link (default = 1)
246 252
247 This module supports one card and autoprobe. 253 This module supports one card and autoprobe.
@@ -779,6 +785,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
779 asus-dig ASUS with SPDIF out 785 asus-dig ASUS with SPDIF out
780 asus-dig2 ASUS with SPDIF out (using GPIO2) 786 asus-dig2 ASUS with SPDIF out (using GPIO2)
781 uniwill 3-jack 787 uniwill 3-jack
788 fujitsu Fujitsu Laptops (Pi1536)
782 F1734 2-jack 789 F1734 2-jack
783 lg LG laptop (m1 express dual) 790 lg LG laptop (m1 express dual)
784 lg-lw LG LW20/LW25 laptop 791 lg-lw LG LW20/LW25 laptop
@@ -800,14 +807,18 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
800 ALC262 807 ALC262
801 fujitsu Fujitsu Laptop 808 fujitsu Fujitsu Laptop
802 hp-bpc HP xw4400/6400/8400/9400 laptops 809 hp-bpc HP xw4400/6400/8400/9400 laptops
810 hp-bpc-d7000 HP BPC D7000
803 benq Benq ED8 811 benq Benq ED8
812 hippo Hippo (ATI) with jack detection, Sony UX-90s
813 hippo_1 Hippo (Benq) with jack detection
804 basic fixed pin assignment w/o SPDIF 814 basic fixed pin assignment w/o SPDIF
805 auto auto-config reading BIOS (default) 815 auto auto-config reading BIOS (default)
806 816
807 ALC882/885 817 ALC882/885
808 3stack-dig 3-jack with SPDIF I/O 818 3stack-dig 3-jack with SPDIF I/O
809 6stck-dig 6-jack digital with SPDIF I/O 819 6stack-dig 6-jack digital with SPDIF I/O
810 arima Arima W820Di1 820 arima Arima W820Di1
821 macpro MacPro support
811 auto auto-config reading BIOS (default) 822 auto auto-config reading BIOS (default)
812 823
813 ALC883/888 824 ALC883/888
@@ -817,6 +828,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
817 3stack-6ch-dig 3-jack 6-channel with SPDIF I/O 828 3stack-6ch-dig 3-jack 6-channel with SPDIF I/O
818 6stack-dig-demo 6-jack digital for Intel demo board 829 6stack-dig-demo 6-jack digital for Intel demo board
819 acer Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc) 830 acer Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc)
831 medion Medion Laptops
832 targa-dig Targa/MSI
833 targa-2ch-dig Targs/MSI with 2-channel
834 laptop-eapd 3-jack with SPDIF I/O and EAPD (Clevo M540JE, M550JE)
820 auto auto-config reading BIOS (default) 835 auto auto-config reading BIOS (default)
821 836
822 ALC861/660 837 ALC861/660
@@ -825,6 +840,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
825 6stack-dig 6-jack with SPDIF I/O 840 6stack-dig 6-jack with SPDIF I/O
826 3stack-660 3-jack (for ALC660) 841 3stack-660 3-jack (for ALC660)
827 uniwill-m31 Uniwill M31 laptop 842 uniwill-m31 Uniwill M31 laptop
843 toshiba Toshiba laptop support
844 asus Asus laptop support
845 asus-laptop ASUS F2/F3 laptops
846 auto auto-config reading BIOS (default)
847
848 ALC861VD/660VD
849 3stack 3-jack
850 3stack-dig 3-jack with SPDIF OUT
851 6stack-dig 6-jack with SPDIF OUT
852 3stack-660 3-jack (for ALC660VD)
828 auto auto-config reading BIOS (default) 853 auto auto-config reading BIOS (default)
829 854
830 CMI9880 855 CMI9880
@@ -845,6 +870,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
845 3stack 3-stack, shared surrounds 870 3stack 3-stack, shared surrounds
846 laptop 2-channel only (FSC V2060, Samsung M50) 871 laptop 2-channel only (FSC V2060, Samsung M50)
847 laptop-eapd 2-channel with EAPD (Samsung R65, ASUS A6J) 872 laptop-eapd 2-channel with EAPD (Samsung R65, ASUS A6J)
873 ultra 2-channel with EAPD (Samsung Ultra tablet PC)
848 874
849 AD1988 875 AD1988
850 6stack 6-jack 876 6stack 6-jack
@@ -854,12 +880,31 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
854 laptop 3-jack with hp-jack automute 880 laptop 3-jack with hp-jack automute
855 laptop-dig ditto with SPDIF 881 laptop-dig ditto with SPDIF
856 auto auto-config reading BIOS (default) 882 auto auto-config reading BIOS (default)
883
884 Conexant 5045
885 laptop Laptop config
886 test for testing/debugging purpose, almost all controls
887 can be adjusted. Appearing only when compiled with
888 $CONFIG_SND_DEBUG=y
889
890 Conexant 5047
891 laptop Basic Laptop config
892 laptop-hp Laptop config for some HP models (subdevice 30A5)
893 laptop-eapd Laptop config with EAPD support
894 test for testing/debugging purpose, almost all controls
895 can be adjusted. Appearing only when compiled with
896 $CONFIG_SND_DEBUG=y
857 897
858 STAC9200/9205/9220/9221/9254 898 STAC9200/9205/9220/9221/9254
859 ref Reference board 899 ref Reference board
860 3stack D945 3stack 900 3stack D945 3stack
861 5stack D945 5stack + SPDIF 901 5stack D945 5stack + SPDIF
862 902
903 STAC9202/9250/9251
904 ref Reference board, base config
905 m2-2 Some Gateway MX series laptops
906 m6 Some Gateway NX series laptops
907
863 STAC9227/9228/9229/927x 908 STAC9227/9228/9229/927x
864 ref Reference board 909 ref Reference board
865 3stack D965 3stack 910 3stack D965 3stack
@@ -974,6 +1019,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
974 Module for Envy24HT (VT/ICE1724), Envy24PT (VT1720) based PCI sound cards. 1019 Module for Envy24HT (VT/ICE1724), Envy24PT (VT1720) based PCI sound cards.
975 * MidiMan M Audio Revolution 5.1 1020 * MidiMan M Audio Revolution 5.1
976 * MidiMan M Audio Revolution 7.1 1021 * MidiMan M Audio Revolution 7.1
1022 * MidiMan M Audio Audiophile 192
977 * AMP Ltd AUDIO2000 1023 * AMP Ltd AUDIO2000
978 * TerraTec Aureon 5.1 Sky 1024 * TerraTec Aureon 5.1 Sky
979 * TerraTec Aureon 7.1 Space 1025 * TerraTec Aureon 7.1 Space
@@ -993,7 +1039,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
993 1039
994 model - Use the given board model, one of the following: 1040 model - Use the given board model, one of the following:
995 revo51, revo71, amp2000, prodigy71, prodigy71lt, 1041 revo51, revo71, amp2000, prodigy71, prodigy71lt,
996 prodigy192, aureon51, aureon71, universe, 1042 prodigy192, aureon51, aureon71, universe, ap192,
997 k8x800, phase22, phase28, ms300, av710 1043 k8x800, phase22, phase28, ms300, av710
998 1044
999 This module supports multiple cards and autoprobe. 1045 This module supports multiple cards and autoprobe.
@@ -1049,6 +1095,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1049 buggy_semaphore - Enable workaround for hardwares with buggy 1095 buggy_semaphore - Enable workaround for hardwares with buggy
1050 semaphores (e.g. on some ASUS laptops) 1096 semaphores (e.g. on some ASUS laptops)
1051 (default off) 1097 (default off)
1098 spdif_aclink - Use S/PDIF over AC-link instead of direct connection
1099 from the controller chip
1100 (0 = off, 1 = on, -1 = default)
1052 1101
1053 This module supports one chip and autoprobe. 1102 This module supports one chip and autoprobe.
1054 1103
@@ -1371,6 +1420,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1371 1420
1372 This module supports multiple cards. 1421 This module supports multiple cards.
1373 1422
1423 Module snd-portman2x4
1424 ---------------------
1425
1426 Module for Midiman Portman 2x4 parallel port MIDI interface
1427
1428 This module supports multiple cards.
1429
1374 Module snd-powermac (on ppc only) 1430 Module snd-powermac (on ppc only)
1375 --------------------------------- 1431 ---------------------------------
1376 1432
diff --git a/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl
index 1f3ae3e32d69..c4d2e3507af9 100644
--- a/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl
+++ b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl
@@ -36,7 +36,7 @@
36 </bookinfo> 36 </bookinfo>
37 37
38 <chapter><title>Management of Cards and Devices</title> 38 <chapter><title>Management of Cards and Devices</title>
39 <sect1><title>Card Managment</title> 39 <sect1><title>Card Management</title>
40!Esound/core/init.c 40!Esound/core/init.c
41 </sect1> 41 </sect1>
42 <sect1><title>Device Components</title> 42 <sect1><title>Device Components</title>
@@ -59,7 +59,7 @@
59 <sect1><title>PCM Format Helpers</title> 59 <sect1><title>PCM Format Helpers</title>
60!Esound/core/pcm_misc.c 60!Esound/core/pcm_misc.c
61 </sect1> 61 </sect1>
62 <sect1><title>PCM Memory Managment</title> 62 <sect1><title>PCM Memory Management</title>
63!Esound/core/pcm_memory.c 63!Esound/core/pcm_memory.c
64 </sect1> 64 </sect1>
65 </chapter> 65 </chapter>
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index ccd0a953953d..74d3a35b59bc 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -1360,8 +1360,7 @@
1360 <informalexample> 1360 <informalexample>
1361 <programlisting> 1361 <programlisting>
1362<![CDATA[ 1362<![CDATA[
1363 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, 1363 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id)
1364 struct pt_regs *regs)
1365 { 1364 {
1366 struct mychip *chip = dev_id; 1365 struct mychip *chip = dev_id;
1367 .... 1366 ....
@@ -2127,7 +2126,7 @@
2127 accessible via <constant>substream-&gt;runtime</constant>. 2126 accessible via <constant>substream-&gt;runtime</constant>.
2128 This runtime pointer holds the various information; it holds 2127 This runtime pointer holds the various information; it holds
2129 the copy of hw_params and sw_params configurations, the buffer 2128 the copy of hw_params and sw_params configurations, the buffer
2130 pointers, mmap records, spinlocks, etc. Almost everyhing you 2129 pointers, mmap records, spinlocks, etc. Almost everything you
2131 need for controlling the PCM can be found there. 2130 need for controlling the PCM can be found there.
2132 </para> 2131 </para>
2133 2132
@@ -2340,7 +2339,7 @@ struct _snd_pcm_runtime {
2340 2339
2341 <para> 2340 <para>
2342 When the PCM substreams can be synchronized (typically, 2341 When the PCM substreams can be synchronized (typically,
2343 synchorinized start/stop of a playback and a capture streams), 2342 synchronized start/stop of a playback and a capture streams),
2344 you can give <constant>SNDRV_PCM_INFO_SYNC_START</constant>, 2343 you can give <constant>SNDRV_PCM_INFO_SYNC_START</constant>,
2345 too. In this case, you'll need to check the linked-list of 2344 too. In this case, you'll need to check the linked-list of
2346 PCM substreams in the trigger callback. This will be 2345 PCM substreams in the trigger callback. This will be
@@ -3062,8 +3061,7 @@ struct _snd_pcm_runtime {
3062 <title>Interrupt Handler Case #1</title> 3061 <title>Interrupt Handler Case #1</title>
3063 <programlisting> 3062 <programlisting>
3064<![CDATA[ 3063<![CDATA[
3065 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, 3064 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id)
3066 struct pt_regs *regs)
3067 { 3065 {
3068 struct mychip *chip = dev_id; 3066 struct mychip *chip = dev_id;
3069 spin_lock(&chip->lock); 3067 spin_lock(&chip->lock);
@@ -3106,8 +3104,7 @@ struct _snd_pcm_runtime {
3106 <title>Interrupt Handler Case #2</title> 3104 <title>Interrupt Handler Case #2</title>
3107 <programlisting> 3105 <programlisting>
3108<![CDATA[ 3106<![CDATA[
3109 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, 3107 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id)
3110 struct pt_regs *regs)
3111 { 3108 {
3112 struct mychip *chip = dev_id; 3109 struct mychip *chip = dev_id;
3113 spin_lock(&chip->lock); 3110 spin_lock(&chip->lock);
@@ -3247,7 +3244,7 @@ struct _snd_pcm_runtime {
3247 You can even define your own constraint rules. 3244 You can even define your own constraint rules.
3248 For example, let's suppose my_chip can manage a substream of 1 channel 3245 For example, let's suppose my_chip can manage a substream of 1 channel
3249 if and only if the format is S16_LE, otherwise it supports any format 3246 if and only if the format is S16_LE, otherwise it supports any format
3250 specified in the <structname>snd_pcm_hardware</structname> stucture (or in any 3247 specified in the <structname>snd_pcm_hardware</structname> structure (or in any
3251 other constraint_list). You can build a rule like this: 3248 other constraint_list). You can build a rule like this:
3252 3249
3253 <example> 3250 <example>
@@ -3691,16 +3688,6 @@ struct _snd_pcm_runtime {
3691 </para> 3688 </para>
3692 3689
3693 <para> 3690 <para>
3694 Here, the chip instance is retrieved via
3695 <function>snd_kcontrol_chip()</function> macro. This macro
3696 just accesses to kcontrol-&gt;private_data. The
3697 kcontrol-&gt;private_data field is
3698 given as the argument of <function>snd_ctl_new()</function>
3699 (see the later subsection
3700 <link linkend="control-interface-constructor"><citetitle>Constructor</citetitle></link>).
3701 </para>
3702
3703 <para>
3704 The <structfield>value</structfield> field is depending on 3691 The <structfield>value</structfield> field is depending on
3705 the type of control as well as on info callback. For example, 3692 the type of control as well as on info callback. For example,
3706 the sb driver uses this field to store the register offset, 3693 the sb driver uses this field to store the register offset,
@@ -3780,7 +3767,7 @@ struct _snd_pcm_runtime {
3780 <para> 3767 <para>
3781 Like <structfield>get</structfield> callback, 3768 Like <structfield>get</structfield> callback,
3782 when the control has more than one elements, 3769 when the control has more than one elements,
3783 all elemehts must be evaluated in this callback, too. 3770 all elements must be evaluated in this callback, too.
3784 </para> 3771 </para>
3785 </section> 3772 </section>
3786 3773
@@ -5541,12 +5528,12 @@ struct _snd_pcm_runtime {
5541 #ifdef CONFIG_PM 5528 #ifdef CONFIG_PM
5542 static int snd_my_suspend(struct pci_dev *pci, pm_message_t state) 5529 static int snd_my_suspend(struct pci_dev *pci, pm_message_t state)
5543 { 5530 {
5544 .... /* do things for suspsend */ 5531 .... /* do things for suspend */
5545 return 0; 5532 return 0;
5546 } 5533 }
5547 static int snd_my_resume(struct pci_dev *pci) 5534 static int snd_my_resume(struct pci_dev *pci)
5548 { 5535 {
5549 .... /* do things for suspsend */ 5536 .... /* do things for suspend */
5550 return 0; 5537 return 0;
5551 } 5538 }
5552 #endif 5539 #endif
@@ -6111,7 +6098,7 @@ struct _snd_pcm_runtime {
6111<!-- ****************************************************** --> 6098<!-- ****************************************************** -->
6112<!-- Acknowledgments --> 6099<!-- Acknowledgments -->
6113<!-- ****************************************************** --> 6100<!-- ****************************************************** -->
6114 <chapter id="acknowledments"> 6101 <chapter id="acknowledgments">
6115 <title>Acknowledgments</title> 6102 <title>Acknowledgments</title>
6116 <para> 6103 <para>
6117 I would like to thank Phil Kerr for his help for improvement and 6104 I would like to thank Phil Kerr for his help for improvement and
diff --git a/Documentation/sound/alsa/hda_codec.txt b/Documentation/sound/alsa/hda_codec.txt
index 0be57ed81302..4eaae2a45534 100644
--- a/Documentation/sound/alsa/hda_codec.txt
+++ b/Documentation/sound/alsa/hda_codec.txt
@@ -277,11 +277,11 @@ Helper Functions
277snd_hda_get_codec_name() stores the codec name on the given string. 277snd_hda_get_codec_name() stores the codec name on the given string.
278 278
279snd_hda_check_board_config() can be used to obtain the configuration 279snd_hda_check_board_config() can be used to obtain the configuration
280information matching with the device. Define the table with struct 280information matching with the device. Define the model string table
281hda_board_config entries (zero-terminated), and pass it to the 281and the table with struct snd_pci_quirk entries (zero-terminated),
282function. The function checks the modelname given as a module 282and pass it to the function. The function checks the modelname given
283parameter, and PCI subsystem IDs. If the matching entry is found, it 283as a module parameter, and PCI subsystem IDs. If the matching entry
284returns the config field value. 284is found, it returns the config field value.
285 285
286snd_hda_add_new_ctls() can be used to create and add control entries. 286snd_hda_add_new_ctls() can be used to create and add control entries.
287Pass the zero-terminated array of struct snd_kcontrol_new. The same array 287Pass the zero-terminated array of struct snd_kcontrol_new. The same array
diff --git a/Documentation/sound/alsa/soc/DAI.txt b/Documentation/sound/alsa/soc/DAI.txt
new file mode 100644
index 000000000000..58cbfd01ea8f
--- /dev/null
+++ b/Documentation/sound/alsa/soc/DAI.txt
@@ -0,0 +1,56 @@
1ASoC currently supports the three main Digital Audio Interfaces (DAI) found on
2SoC controllers and portable audio CODECS today, namely AC97, I2S and PCM.
3
4
5AC97
6====
7
8 AC97 is a five wire interface commonly found on many PC sound cards. It is
9now also popular in many portable devices. This DAI has a reset line and time
10multiplexes its data on its SDATA_OUT (playback) and SDATA_IN (capture) lines.
11The bit clock (BCLK) is always driven by the CODEC (usually 12.288MHz) and the
12frame (FRAME) (usually 48kHz) is always driven by the controller. Each AC97
13frame is 21uS long and is divided into 13 time slots.
14
15The AC97 specification can be found at :-
16http://www.intel.com/design/chipsets/audio/ac97_r23.pdf
17
18
19I2S
20===
21
22 I2S is a common 4 wire DAI used in HiFi, STB and portable devices. The Tx and
23Rx lines are used for audio transmision, whilst the bit clock (BCLK) and
24left/right clock (LRC) synchronise the link. I2S is flexible in that either the
25controller or CODEC can drive (master) the BCLK and LRC clock lines. Bit clock
26usually varies depending on the sample rate and the master system clock
27(SYSCLK). LRCLK is the same as the sample rate. A few devices support separate
28ADC and DAC LRCLK's, this allows for similtanious capture and playback at
29different sample rates.
30
31I2S has several different operating modes:-
32
33 o I2S - MSB is transmitted on the falling edge of the first BCLK after LRC
34 transition.
35
36 o Left Justified - MSB is transmitted on transition of LRC.
37
38 o Right Justified - MSB is transmitted sample size BCLK's before LRC
39 transition.
40
41PCM
42===
43
44PCM is another 4 wire interface, very similar to I2S, that can support a more
45flexible protocol. It has bit clock (BCLK) and sync (SYNC) lines that are used
46to synchronise the link whilst the Tx and Rx lines are used to transmit and
47receive the audio data. Bit clock usually varies depending on sample rate
48whilst sync runs at the sample rate. PCM also supports Time Division
49Multiplexing (TDM) in that several devices can use the bus similtaniuosly (This
50is sometimes referred to as network mode).
51
52Common PCM operating modes:-
53
54 o Mode A - MSB is transmitted on falling edge of first BCLK after FRAME/SYNC.
55
56 o Mode B - MSB is transmitted on rising edge of FRAME/SYNC.
diff --git a/Documentation/sound/alsa/soc/clocking.txt b/Documentation/sound/alsa/soc/clocking.txt
new file mode 100644
index 000000000000..e93960d53a1e
--- /dev/null
+++ b/Documentation/sound/alsa/soc/clocking.txt
@@ -0,0 +1,51 @@
1Audio Clocking
2==============
3
4This text describes the audio clocking terms in ASoC and digital audio in
5general. Note: Audio clocking can be complex !
6
7
8Master Clock
9------------
10
11Every audio subsystem is driven by a master clock (sometimes refered to as MCLK
12or SYSCLK). This audio master clock can be derived from a number of sources
13(e.g. crystal, PLL, CPU clock) and is responsible for producing the correct
14audio playback and capture sample rates.
15
16Some master clocks (e.g. PLL's and CPU based clocks) are configuarble in that
17their speed can be altered by software (depending on the system use and to save
18power). Other master clocks are fixed at at set frequency (i.e. crystals).
19
20
21DAI Clocks
22----------
23The Digital Audio Interface is usually driven by a Bit Clock (often referred to
24as BCLK). This clock is used to drive the digital audio data across the link
25between the codec and CPU.
26
27The DAI also has a frame clock to signal the start of each audio frame. This
28clock is sometimes referred to as LRC (left right clock) or FRAME. This clock
29runs at exactly the sample rate (LRC = Rate).
30
31Bit Clock can be generated as follows:-
32
33BCLK = MCLK / x
34
35 or
36
37BCLK = LRC * x
38
39 or
40
41BCLK = LRC * Channels * Word Size
42
43This relationship depends on the codec or SoC CPU in particular. In general
44it's best to configure BCLK to the lowest possible speed (depending on your
45rate, number of channels and wordsize) to save on power.
46
47It's also desireable to use the codec (if possible) to drive (or master) the
48audio clocks as it's usually gives more accurate sample rates than the CPU.
49
50
51
diff --git a/Documentation/sound/alsa/soc/codec.txt b/Documentation/sound/alsa/soc/codec.txt
new file mode 100644
index 000000000000..48983c75aad9
--- /dev/null
+++ b/Documentation/sound/alsa/soc/codec.txt
@@ -0,0 +1,197 @@
1ASoC Codec Driver
2=================
3
4The codec driver is generic and hardware independent code that configures the
5codec to provide audio capture and playback. It should contain no code that is
6specific to the target platform or machine. All platform and machine specific
7code should be added to the platform and machine drivers respectively.
8
9Each codec driver *must* provide the following features:-
10
11 1) Codec DAI and PCM configuration
12 2) Codec control IO - using I2C, 3 Wire(SPI) or both API's
13 3) Mixers and audio controls
14 4) Codec audio operations
15
16Optionally, codec drivers can also provide:-
17
18 5) DAPM description.
19 6) DAPM event handler.
20 7) DAC Digital mute control.
21
22It's probably best to use this guide in conjuction with the existing codec
23driver code in sound/soc/codecs/
24
25ASoC Codec driver breakdown
26===========================
27
281 - Codec DAI and PCM configuration
29-----------------------------------
30Each codec driver must have a struct snd_soc_codec_dai to define it's DAI and
31PCM's capablities and operations. This struct is exported so that it can be
32registered with the core by your machine driver.
33
34e.g.
35
36struct snd_soc_codec_dai wm8731_dai = {
37 .name = "WM8731",
38 /* playback capabilities */
39 .playback = {
40 .stream_name = "Playback",
41 .channels_min = 1,
42 .channels_max = 2,
43 .rates = WM8731_RATES,
44 .formats = WM8731_FORMATS,},
45 /* capture capabilities */
46 .capture = {
47 .stream_name = "Capture",
48 .channels_min = 1,
49 .channels_max = 2,
50 .rates = WM8731_RATES,
51 .formats = WM8731_FORMATS,},
52 /* pcm operations - see section 4 below */
53 .ops = {
54 .prepare = wm8731_pcm_prepare,
55 .hw_params = wm8731_hw_params,
56 .shutdown = wm8731_shutdown,
57 },
58 /* DAI operations - see DAI.txt */
59 .dai_ops = {
60 .digital_mute = wm8731_mute,
61 .set_sysclk = wm8731_set_dai_sysclk,
62 .set_fmt = wm8731_set_dai_fmt,
63 }
64};
65EXPORT_SYMBOL_GPL(wm8731_dai);
66
67
682 - Codec control IO
69--------------------
70The codec can ususally be controlled via an I2C or SPI style interface (AC97
71combines control with data in the DAI). The codec drivers will have to provide
72functions to read and write the codec registers along with supplying a register
73cache:-
74
75 /* IO control data and register cache */
76 void *control_data; /* codec control (i2c/3wire) data */
77 void *reg_cache;
78
79Codec read/write should do any data formatting and call the hardware read write
80below to perform the IO. These functions are called by the core and alsa when
81performing DAPM or changing the mixer:-
82
83 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
84 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
85
86Codec hardware IO functions - usually points to either the I2C, SPI or AC97
87read/write:-
88
89 hw_write_t hw_write;
90 hw_read_t hw_read;
91
92
933 - Mixers and audio controls
94-----------------------------
95All the codec mixers and audio controls can be defined using the convenience
96macros defined in soc.h.
97
98 #define SOC_SINGLE(xname, reg, shift, mask, invert)
99
100Defines a single control as follows:-
101
102 xname = Control name e.g. "Playback Volume"
103 reg = codec register
104 shift = control bit(s) offset in register
105 mask = control bit size(s) e.g. mask of 7 = 3 bits
106 invert = the control is inverted
107
108Other macros include:-
109
110 #define SOC_DOUBLE(xname, reg, shift_left, shift_right, mask, invert)
111
112A stereo control
113
114 #define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, mask, invert)
115
116A stereo control spanning 2 registers
117
118 #define SOC_ENUM_SINGLE(xreg, xshift, xmask, xtexts)
119
120Defines an single enumerated control as follows:-
121
122 xreg = register
123 xshift = control bit(s) offset in register
124 xmask = control bit(s) size
125 xtexts = pointer to array of strings that describe each setting
126
127 #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts)
128
129Defines a stereo enumerated control
130
131
1324 - Codec Audio Operations
133--------------------------
134The codec driver also supports the following alsa operations:-
135
136/* SoC audio ops */
137struct snd_soc_ops {
138 int (*startup)(struct snd_pcm_substream *);
139 void (*shutdown)(struct snd_pcm_substream *);
140 int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
141 int (*hw_free)(struct snd_pcm_substream *);
142 int (*prepare)(struct snd_pcm_substream *);
143};
144
145Please refer to the alsa driver PCM documentation for details.
146http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm
147
148
1495 - DAPM description.
150---------------------
151The Dynamic Audio Power Management description describes the codec's power
152components, their relationships and registers to the ASoC core. Please read
153dapm.txt for details of building the description.
154
155Please also see the examples in other codec drivers.
156
157
1586 - DAPM event handler
159----------------------
160This function is a callback that handles codec domain PM calls and system
161domain PM calls (e.g. suspend and resume). It's used to put the codec to sleep
162when not in use.
163
164Power states:-
165
166 SNDRV_CTL_POWER_D0: /* full On */
167 /* vref/mid, clk and osc on, active */
168
169 SNDRV_CTL_POWER_D1: /* partial On */
170 SNDRV_CTL_POWER_D2: /* partial On */
171
172 SNDRV_CTL_POWER_D3hot: /* Off, with power */
173 /* everything off except vref/vmid, inactive */
174
175 SNDRV_CTL_POWER_D3cold: /* Everything Off, without power */
176
177
1787 - Codec DAC digital mute control.
179------------------------------------
180Most codecs have a digital mute before the DAC's that can be used to minimise
181any system noise. The mute stops any digital data from entering the DAC.
182
183A callback can be created that is called by the core for each codec DAI when the
184mute is applied or freed.
185
186i.e.
187
188static int wm8974_mute(struct snd_soc_codec *codec,
189 struct snd_soc_codec_dai *dai, int mute)
190{
191 u16 mute_reg = wm8974_read_reg_cache(codec, WM8974_DAC) & 0xffbf;
192 if(mute)
193 wm8974_write(codec, WM8974_DAC, mute_reg | 0x40);
194 else
195 wm8974_write(codec, WM8974_DAC, mute_reg);
196 return 0;
197}
diff --git a/Documentation/sound/alsa/soc/dapm.txt b/Documentation/sound/alsa/soc/dapm.txt
new file mode 100644
index 000000000000..c11877f5b4a1
--- /dev/null
+++ b/Documentation/sound/alsa/soc/dapm.txt
@@ -0,0 +1,297 @@
1Dynamic Audio Power Management for Portable Devices
2===================================================
3
41. Description
5==============
6
7Dynamic Audio Power Management (DAPM) is designed to allow portable Linux devices
8to use the minimum amount of power within the audio subsystem at all times. It
9is independent of other kernel PM and as such, can easily co-exist with the
10other PM systems.
11
12DAPM is also completely transparent to all user space applications as all power
13switching is done within the ASoC core. No code changes or recompiling are
14required for user space applications. DAPM makes power switching descisions based
15upon any audio stream (capture/playback) activity and audio mixer settings
16within the device.
17
18DAPM spans the whole machine. It covers power control within the entire audio
19subsystem, this includes internal codec power blocks and machine level power
20systems.
21
22There are 4 power domains within DAPM
23
24 1. Codec domain - VREF, VMID (core codec and audio power)
25 Usually controlled at codec probe/remove and suspend/resume, although
26 can be set at stream time if power is not needed for sidetone, etc.
27
28 2. Platform/Machine domain - physically connected inputs and outputs
29 Is platform/machine and user action specific, is configured by the
30 machine driver and responds to asynchronous events e.g when HP
31 are inserted
32
33 3. Path domain - audio susbsystem signal paths
34 Automatically set when mixer and mux settings are changed by the user.
35 e.g. alsamixer, amixer.
36
37 4. Stream domain - DAC's and ADC's.
38 Enabled and disabled when stream playback/capture is started and
39 stopped respectively. e.g. aplay, arecord.
40
41All DAPM power switching descisons are made automatically by consulting an audio
42routing map of the whole machine. This map is specific to each machine and
43consists of the interconnections between every audio component (including
44internal codec components). All audio components that effect power are called
45widgets hereafter.
46
47
482. DAPM Widgets
49===============
50
51Audio DAPM widgets fall into a number of types:-
52
53 o Mixer - Mixes several analog signals into a single analog signal.
54 o Mux - An analog switch that outputs only 1 of it's inputs.
55 o PGA - A programmable gain amplifier or attenuation widget.
56 o ADC - Analog to Digital Converter
57 o DAC - Digital to Analog Converter
58 o Switch - An analog switch
59 o Input - A codec input pin
60 o Output - A codec output pin
61 o Headphone - Headphone (and optional Jack)
62 o Mic - Mic (and optional Jack)
63 o Line - Line Input/Output (and optional Jack)
64 o Speaker - Speaker
65 o Pre - Special PRE widget (exec before all others)
66 o Post - Special POST widget (exec after all others)
67
68(Widgets are defined in include/sound/soc-dapm.h)
69
70Widgets are usually added in the codec driver and the machine driver. There are
71convience macros defined in soc-dapm.h that can be used to quickly build a
72list of widgets of the codecs and machines DAPM widgets.
73
74Most widgets have a name, register, shift and invert. Some widgets have extra
75parameters for stream name and kcontrols.
76
77
782.1 Stream Domain Widgets
79-------------------------
80
81Stream Widgets relate to the stream power domain and only consist of ADC's
82(analog to digital converters) and DAC's (digital to analog converters).
83
84Stream widgets have the following format:-
85
86SND_SOC_DAPM_DAC(name, stream name, reg, shift, invert),
87
88NOTE: the stream name must match the corresponding stream name in your codecs
89snd_soc_codec_dai.
90
91e.g. stream widgets for HiFi playback and capture
92
93SND_SOC_DAPM_DAC("HiFi DAC", "HiFi Playback", REG, 3, 1),
94SND_SOC_DAPM_ADC("HiFi ADC", "HiFi Capture", REG, 2, 1),
95
96
972.2 Path Domain Widgets
98-----------------------
99
100Path domain widgets have a ability to control or effect the audio signal or
101audio paths within the audio subsystem. They have the following form:-
102
103SND_SOC_DAPM_PGA(name, reg, shift, invert, controls, num_controls)
104
105Any widget kcontrols can be set using the controls and num_controls members.
106
107e.g. Mixer widget (the kcontrols are declared first)
108
109/* Output Mixer */
110static const snd_kcontrol_new_t wm8731_output_mixer_controls[] = {
111SOC_DAPM_SINGLE("Line Bypass Switch", WM8731_APANA, 3, 1, 0),
112SOC_DAPM_SINGLE("Mic Sidetone Switch", WM8731_APANA, 5, 1, 0),
113SOC_DAPM_SINGLE("HiFi Playback Switch", WM8731_APANA, 4, 1, 0),
114};
115
116SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1, wm8731_output_mixer_controls,
117 ARRAY_SIZE(wm8731_output_mixer_controls)),
118
119
1202.3 Platform/Machine domain Widgets
121-----------------------------------
122
123Machine widgets are different from codec widgets in that they don't have a
124codec register bit associated with them. A machine widget is assigned to each
125machine audio component (non codec) that can be independently powered. e.g.
126
127 o Speaker Amp
128 o Microphone Bias
129 o Jack connectors
130
131A machine widget can have an optional call back.
132
133e.g. Jack connector widget for an external Mic that enables Mic Bias
134when the Mic is inserted:-
135
136static int spitz_mic_bias(struct snd_soc_dapm_widget* w, int event)
137{
138 if(SND_SOC_DAPM_EVENT_ON(event))
139 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_MIC_BIAS);
140 else
141 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_MIC_BIAS);
142
143 return 0;
144}
145
146SND_SOC_DAPM_MIC("Mic Jack", spitz_mic_bias),
147
148
1492.4 Codec Domain
150----------------
151
152The Codec power domain has no widgets and is handled by the codecs DAPM event
153handler. This handler is called when the codec powerstate is changed wrt to any
154stream event or by kernel PM events.
155
156
1572.5 Virtual Widgets
158-------------------
159
160Sometimes widgets exist in the codec or machine audio map that don't have any
161corresponding register bit for power control. In this case it's necessary to
162create a virtual widget - a widget with no control bits e.g.
163
164SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_DAPM_NOPM, 0, 0, NULL, 0),
165
166This can be used to merge to signal paths together in software.
167
168After all the widgets have been defined, they can then be added to the DAPM
169subsystem individually with a call to snd_soc_dapm_new_control().
170
171
1723. Codec Widget Interconnections
173================================
174
175Widgets are connected to each other within the codec and machine by audio
176paths (called interconnections). Each interconnection must be defined in order
177to create a map of all audio paths between widgets.
178This is easiest with a diagram of the codec (and schematic of the machine audio
179system), as it requires joining widgets together via their audio signal paths.
180
181i.e. from the WM8731 codec's output mixer (wm8731.c)
182
183The WM8731 output mixer has 3 inputs (sources)
184
185 1. Line Bypass Input
186 2. DAC (HiFi playback)
187 3. Mic Sidetone Input
188
189Each input in this example has a kcontrol associated with it (defined in example
190above) and is connected to the output mixer via it's kcontrol name. We can now
191connect the destination widget (wrt audio signal) with it's source widgets.
192
193 /* output mixer */
194 {"Output Mixer", "Line Bypass Switch", "Line Input"},
195 {"Output Mixer", "HiFi Playback Switch", "DAC"},
196 {"Output Mixer", "Mic Sidetone Switch", "Mic Bias"},
197
198So we have :-
199
200 Destination Widget <=== Path Name <=== Source Widget
201
202Or:-
203
204 Sink, Path, Source
205
206Or :-
207
208 "Output Mixer" is connected to the "DAC" via the "HiFi Playback Switch".
209
210When there is no path name connecting widgets (e.g. a direct connection) we
211pass NULL for the path name.
212
213Interconnections are created with a call to:-
214
215snd_soc_dapm_connect_input(codec, sink, path, source);
216
217Finally, snd_soc_dapm_new_widgets(codec) must be called after all widgets and
218interconnections have been registered with the core. This causes the core to
219scan the codec and machine so that the internal DAPM state matches the
220physical state of the machine.
221
222
2233.1 Machine Widget Interconnections
224-----------------------------------
225Machine widget interconnections are created in the same way as codec ones and
226directly connect the codec pins to machine level widgets.
227
228e.g. connects the speaker out codec pins to the internal speaker.
229
230 /* ext speaker connected to codec pins LOUT2, ROUT2 */
231 {"Ext Spk", NULL , "ROUT2"},
232 {"Ext Spk", NULL , "LOUT2"},
233
234This allows the DAPM to power on and off pins that are connected (and in use)
235and pins that are NC respectively.
236
237
2384 Endpoint Widgets
239===================
240An endpoint is a start or end point (widget) of an audio signal within the
241machine and includes the codec. e.g.
242
243 o Headphone Jack
244 o Internal Speaker
245 o Internal Mic
246 o Mic Jack
247 o Codec Pins
248
249When a codec pin is NC it can be marked as not used with a call to
250
251snd_soc_dapm_set_endpoint(codec, "Widget Name", 0);
252
253The last argument is 0 for inactive and 1 for active. This way the pin and its
254input widget will never be powered up and consume power.
255
256This also applies to machine widgets. e.g. if a headphone is connected to a
257jack then the jack can be marked active. If the headphone is removed, then
258the headphone jack can be marked inactive.
259
260
2615 DAPM Widget Events
262====================
263
264Some widgets can register their interest with the DAPM core in PM events.
265e.g. A Speaker with an amplifier registers a widget so the amplifier can be
266powered only when the spk is in use.
267
268/* turn speaker amplifier on/off depending on use */
269static int corgi_amp_event(struct snd_soc_dapm_widget *w, int event)
270{
271 if (SND_SOC_DAPM_EVENT_ON(event))
272 set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON);
273 else
274 reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON);
275
276 return 0;
277}
278
279/* corgi machine dapm widgets */
280static const struct snd_soc_dapm_widget wm8731_dapm_widgets =
281 SND_SOC_DAPM_SPK("Ext Spk", corgi_amp_event);
282
283Please see soc-dapm.h for all other widgets that support events.
284
285
2865.1 Event types
287---------------
288
289The following event types are supported by event widgets.
290
291/* dapm event types */
292#define SND_SOC_DAPM_PRE_PMU 0x1 /* before widget power up */
293#define SND_SOC_DAPM_POST_PMU 0x2 /* after widget power up */
294#define SND_SOC_DAPM_PRE_PMD 0x4 /* before widget power down */
295#define SND_SOC_DAPM_POST_PMD 0x8 /* after widget power down */
296#define SND_SOC_DAPM_PRE_REG 0x10 /* before audio path setup */
297#define SND_SOC_DAPM_POST_REG 0x20 /* after audio path setup */
diff --git a/Documentation/sound/alsa/soc/machine.txt b/Documentation/sound/alsa/soc/machine.txt
new file mode 100644
index 000000000000..72bd222f2a21
--- /dev/null
+++ b/Documentation/sound/alsa/soc/machine.txt
@@ -0,0 +1,113 @@
1ASoC Machine Driver
2===================
3
4The ASoC machine (or board) driver is the code that glues together the platform
5and codec drivers.
6
7The machine driver can contain codec and platform specific code. It registers
8the audio subsystem with the kernel as a platform device and is represented by
9the following struct:-
10
11/* SoC machine */
12struct snd_soc_machine {
13 char *name;
14
15 int (*probe)(struct platform_device *pdev);
16 int (*remove)(struct platform_device *pdev);
17
18 /* the pre and post PM functions are used to do any PM work before and
19 * after the codec and DAI's do any PM work. */
20 int (*suspend_pre)(struct platform_device *pdev, pm_message_t state);
21 int (*suspend_post)(struct platform_device *pdev, pm_message_t state);
22 int (*resume_pre)(struct platform_device *pdev);
23 int (*resume_post)(struct platform_device *pdev);
24
25 /* machine stream operations */
26 struct snd_soc_ops *ops;
27
28 /* CPU <--> Codec DAI links */
29 struct snd_soc_dai_link *dai_link;
30 int num_links;
31};
32
33probe()/remove()
34----------------
35probe/remove are optional. Do any machine specific probe here.
36
37
38suspend()/resume()
39------------------
40The machine driver has pre and post versions of suspend and resume to take care
41of any machine audio tasks that have to be done before or after the codec, DAI's
42and DMA is suspended and resumed. Optional.
43
44
45Machine operations
46------------------
47The machine specific audio operations can be set here. Again this is optional.
48
49
50Machine DAI Configuration
51-------------------------
52The machine DAI configuration glues all the codec and CPU DAI's together. It can
53also be used to set up the DAI system clock and for any machine related DAI
54initialisation e.g. the machine audio map can be connected to the codec audio
55map, unconnnected codec pins can be set as such. Please see corgi.c, spitz.c
56for examples.
57
58struct snd_soc_dai_link is used to set up each DAI in your machine. e.g.
59
60/* corgi digital audio interface glue - connects codec <--> CPU */
61static struct snd_soc_dai_link corgi_dai = {
62 .name = "WM8731",
63 .stream_name = "WM8731",
64 .cpu_dai = &pxa_i2s_dai,
65 .codec_dai = &wm8731_dai,
66 .init = corgi_wm8731_init,
67 .ops = &corgi_ops,
68};
69
70struct snd_soc_machine then sets up the machine with it's DAI's. e.g.
71
72/* corgi audio machine driver */
73static struct snd_soc_machine snd_soc_machine_corgi = {
74 .name = "Corgi",
75 .dai_link = &corgi_dai,
76 .num_links = 1,
77};
78
79
80Machine Audio Subsystem
81-----------------------
82
83The machine soc device glues the platform, machine and codec driver together.
84Private data can also be set here. e.g.
85
86/* corgi audio private data */
87static struct wm8731_setup_data corgi_wm8731_setup = {
88 .i2c_address = 0x1b,
89};
90
91/* corgi audio subsystem */
92static struct snd_soc_device corgi_snd_devdata = {
93 .machine = &snd_soc_machine_corgi,
94 .platform = &pxa2xx_soc_platform,
95 .codec_dev = &soc_codec_dev_wm8731,
96 .codec_data = &corgi_wm8731_setup,
97};
98
99
100Machine Power Map
101-----------------
102
103The machine driver can optionally extend the codec power map and to become an
104audio power map of the audio subsystem. This allows for automatic power up/down
105of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack
106sockets in the machine init function. See soc/pxa/spitz.c and dapm.txt for
107details.
108
109
110Machine Controls
111----------------
112
113Machine specific audio mixer controls can be added in the dai init function. \ No newline at end of file
diff --git a/Documentation/sound/alsa/soc/overview.txt b/Documentation/sound/alsa/soc/overview.txt
new file mode 100644
index 000000000000..753c5cc5984a
--- /dev/null
+++ b/Documentation/sound/alsa/soc/overview.txt
@@ -0,0 +1,83 @@
1ALSA SoC Layer
2==============
3
4The overall project goal of the ALSA System on Chip (ASoC) layer is to provide
5better ALSA support for embedded system on chip procesors (e.g. pxa2xx, au1x00,
6iMX, etc) and portable audio codecs. Currently there is some support in the
7kernel for SoC audio, however it has some limitations:-
8
9 * Currently, codec drivers are often tightly coupled to the underlying SoC
10 cpu. This is not ideal and leads to code duplication i.e. Linux now has 4
11 different wm8731 drivers for 4 different SoC platforms.
12
13 * There is no standard method to signal user initiated audio events.
14 e.g. Headphone/Mic insertion, Headphone/Mic detection after an insertion
15 event. These are quite common events on portable devices and ofter require
16 machine specific code to re route audio, enable amps etc after such an event.
17
18 * Current drivers tend to power up the entire codec when playing
19 (or recording) audio. This is fine for a PC, but tends to waste a lot of
20 power on portable devices. There is also no support for saving power via
21 changing codec oversampling rates, bias currents, etc.
22
23
24ASoC Design
25===========
26
27The ASoC layer is designed to address these issues and provide the following
28features :-
29
30 * Codec independence. Allows reuse of codec drivers on other platforms
31 and machines.
32
33 * Easy I2S/PCM audio interface setup between codec and SoC. Each SoC interface
34 and codec registers it's audio interface capabilities with the core and are
35 subsequently matched and configured when the application hw params are known.
36
37 * Dynamic Audio Power Management (DAPM). DAPM automatically sets the codec to
38 it's minimum power state at all times. This includes powering up/down
39 internal power blocks depending on the internal codec audio routing and any
40 active streams.
41
42 * Pop and click reduction. Pops and clicks can be reduced by powering the
43 codec up/down in the correct sequence (including using digital mute). ASoC
44 signals the codec when to change power states.
45
46 * Machine specific controls: Allow machines to add controls to the sound card
47 e.g. volume control for speaker amp.
48
49To achieve all this, ASoC basically splits an embedded audio system into 3
50components :-
51
52 * Codec driver: The codec driver is platform independent and contains audio
53 controls, audio interface capabilities, codec dapm definition and codec IO
54 functions.
55
56 * Platform driver: The platform driver contains the audio dma engine and audio
57 interface drivers (e.g. I2S, AC97, PCM) for that platform.
58
59 * Machine driver: The machine driver handles any machine specific controls and
60 audio events. i.e. turing on an amp at start of playback.
61
62
63Documentation
64=============
65
66The documentation is spilt into the following sections:-
67
68overview.txt: This file.
69
70codec.txt: Codec driver internals.
71
72DAI.txt: Description of Digital Audio Interface standards and how to configure
73a DAI within your codec and CPU DAI drivers.
74
75dapm.txt: Dynamic Audio Power Management
76
77platform.txt: Platform audio DMA and DAI.
78
79machine.txt: Machine driver internals.
80
81pop_clicks.txt: How to minimise audio artifacts.
82
83clocking.txt: ASoC clocking for best power performance. \ No newline at end of file
diff --git a/Documentation/sound/alsa/soc/platform.txt b/Documentation/sound/alsa/soc/platform.txt
new file mode 100644
index 000000000000..e95b16d5a53b
--- /dev/null
+++ b/Documentation/sound/alsa/soc/platform.txt
@@ -0,0 +1,58 @@
1ASoC Platform Driver
2====================
3
4An ASoC platform driver can be divided into audio DMA and SoC DAI configuration
5and control. The platform drivers only target the SoC CPU and must have no board
6specific code.
7
8Audio DMA
9=========
10
11The platform DMA driver optionally supports the following alsa operations:-
12
13/* SoC audio ops */
14struct snd_soc_ops {
15 int (*startup)(struct snd_pcm_substream *);
16 void (*shutdown)(struct snd_pcm_substream *);
17 int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
18 int (*hw_free)(struct snd_pcm_substream *);
19 int (*prepare)(struct snd_pcm_substream *);
20 int (*trigger)(struct snd_pcm_substream *, int);
21};
22
23The platform driver exports it's DMA functionailty via struct snd_soc_platform:-
24
25struct snd_soc_platform {
26 char *name;
27
28 int (*probe)(struct platform_device *pdev);
29 int (*remove)(struct platform_device *pdev);
30 int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai);
31 int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai);
32
33 /* pcm creation and destruction */
34 int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *);
35 void (*pcm_free)(struct snd_pcm *);
36
37 /* platform stream ops */
38 struct snd_pcm_ops *pcm_ops;
39};
40
41Please refer to the alsa driver documentation for details of audio DMA.
42http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm
43
44An example DMA driver is soc/pxa/pxa2xx-pcm.c
45
46
47SoC DAI Drivers
48===============
49
50Each SoC DAI driver must provide the following features:-
51
52 1) Digital audio interface (DAI) description
53 2) Digital audio interface configuration
54 3) PCM's description
55 4) Sysclk configuration
56 5) Suspend and resume (optional)
57
58Please see codec.txt for a description of items 1 - 4.
diff --git a/Documentation/sound/alsa/soc/pops_clicks.txt b/Documentation/sound/alsa/soc/pops_clicks.txt
new file mode 100644
index 000000000000..2cf7ee5b3d74
--- /dev/null
+++ b/Documentation/sound/alsa/soc/pops_clicks.txt
@@ -0,0 +1,52 @@
1Audio Pops and Clicks
2=====================
3
4Pops and clicks are unwanted audio artifacts caused by the powering up and down
5of components within the audio subsystem. This is noticable on PC's when an
6audio module is either loaded or unloaded (at module load time the sound card is
7powered up and causes a popping noise on the speakers).
8
9Pops and clicks can be more frequent on portable systems with DAPM. This is
10because the components within the subsystem are being dynamically powered
11depending on the audio usage and this can subsequently cause a small pop or
12click every time a component power state is changed.
13
14
15Minimising Playback Pops and Clicks
16===================================
17
18Playback pops in portable audio subsystems cannot be completely eliminated atm,
19however future audio codec hardware will have better pop and click supression.
20Pops can be reduced within playback by powering the audio components in a
21specific order. This order is different for startup and shutdown and follows
22some basic rules:-
23
24 Startup Order :- DAC --> Mixers --> Output PGA --> Digital Unmute
25
26 Shutdown Order :- Digital Mute --> Output PGA --> Mixers --> DAC
27
28This assumes that the codec PCM output path from the DAC is via a mixer and then
29a PGA (programmable gain amplifier) before being output to the speakers.
30
31
32Minimising Capture Pops and Clicks
33==================================
34
35Capture artifacts are somewhat easier to get rid as we can delay activating the
36ADC until all the pops have occured. This follows similar power rules to
37playback in that components are powered in a sequence depending upon stream
38startup or shutdown.
39
40 Startup Order - Input PGA --> Mixers --> ADC
41
42 Shutdown Order - ADC --> Mixers --> Input PGA
43
44
45Zipper Noise
46============
47An unwanted zipper noise can occur within the audio playback or capture stream
48when a volume control is changed near its maximum gain value. The zipper noise
49is heard when the gain increase or decrease changes the mean audio signal
50amplitude too quickly. It can be minimised by enabling the zero cross setting
51for each volume control. The ZC forces the gain change to occur when the signal
52crosses the zero amplitude line.
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary
index 72795796b13d..ecc7c9eb9f29 100644
--- a/Documentation/spi/spi-summary
+++ b/Documentation/spi/spi-summary
@@ -284,7 +284,6 @@ SPI protocol drivers somewhat resemble platform device drivers:
284 static struct spi_driver CHIP_driver = { 284 static struct spi_driver CHIP_driver = {
285 .driver = { 285 .driver = {
286 .name = "CHIP", 286 .name = "CHIP",
287 .bus = &spi_bus_type,
288 .owner = THIS_MODULE, 287 .owner = THIS_MODULE,
289 }, 288 },
290 289
@@ -312,7 +311,7 @@ might look like this unless you're creating a class_device:
312 chip = kzalloc(sizeof *chip, GFP_KERNEL); 311 chip = kzalloc(sizeof *chip, GFP_KERNEL);
313 if (!chip) 312 if (!chip)
314 return -ENOMEM; 313 return -ENOMEM;
315 dev_set_drvdata(&spi->dev, chip); 314 spi_set_drvdata(spi, chip);
316 315
317 ... etc 316 ... etc
318 return 0; 317 return 0;
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index 61613166981b..452c0f152304 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -64,11 +64,6 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
64 64
65* What are the 'command' keys? 65* What are the 'command' keys?
66~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 66~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67'r' - Turns off keyboard raw mode and sets it to XLATE.
68
69'k' - Secure Access Key (SAK) Kills all programs on the current virtual
70 console. NOTE: See important comments below in SAK section.
71
72'b' - Will immediately reboot the system without syncing or unmounting 67'b' - Will immediately reboot the system without syncing or unmounting
73 your disks. 68 your disks.
74 69
@@ -76,21 +71,37 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
76 71
77'd' - Shows all locks that are held. 72'd' - Shows all locks that are held.
78 73
79'o' - Will shut your system off (if configured and supported). 74'e' - Send a SIGTERM to all processes, except for init.
80 75
81's' - Will attempt to sync all mounted filesystems. 76'f' - Will call oom_kill to kill a memory hog process.
82 77
83'u' - Will attempt to remount all mounted filesystems read-only. 78'g' - Used by kgdb on ppc platforms.
84 79
85'p' - Will dump the current registers and flags to your console. 80'h' - Will display help (actually any other key than those listed
81 above will display help. but 'h' is easy to remember :-)
86 82
87't' - Will dump a list of current tasks and their information to your 83'i' - Send a SIGKILL to all processes, except for init.
88 console. 84
85'k' - Secure Access Key (SAK) Kills all programs on the current virtual
86 console. NOTE: See important comments below in SAK section.
89 87
90'm' - Will dump current memory info to your console. 88'm' - Will dump current memory info to your console.
91 89
92'n' - Used to make RT tasks nice-able 90'n' - Used to make RT tasks nice-able
93 91
92'o' - Will shut your system off (if configured and supported).
93
94'p' - Will dump the current registers and flags to your console.
95
96'r' - Turns off keyboard raw mode and sets it to XLATE.
97
98's' - Will attempt to sync all mounted filesystems.
99
100't' - Will dump a list of current tasks and their information to your
101 console.
102
103'u' - Will attempt to remount all mounted filesystems read-only.
104
94'v' - Dumps Voyager SMP processor info to your console. 105'v' - Dumps Voyager SMP processor info to your console.
95 106
96'w' - Dumps tasks that are in uninterruptable (blocked) state. 107'w' - Dumps tasks that are in uninterruptable (blocked) state.
@@ -102,17 +113,6 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
102 it so that only emergency messages like PANICs or OOPSes would 113 it so that only emergency messages like PANICs or OOPSes would
103 make it to your console.) 114 make it to your console.)
104 115
105'f' - Will call oom_kill to kill a memory hog process.
106
107'e' - Send a SIGTERM to all processes, except for init.
108
109'g' - Used by kgdb on ppc platforms.
110
111'i' - Send a SIGKILL to all processes, except for init.
112
113'h' - Will display help (actually any other key than those listed
114 above will display help. but 'h' is easy to remember :-)
115
116* Okay, so what can I use them for? 116* Okay, so what can I use them for?
117~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118Well, un'R'aw is very handy when your X server or a svgalib program crashes. 118Well, un'R'aw is very handy when your X server or a svgalib program crashes.
diff --git a/Documentation/usb/proc_usb_info.txt b/Documentation/usb/proc_usb_info.txt
index 22c5331260ca..077e9032d0cd 100644
--- a/Documentation/usb/proc_usb_info.txt
+++ b/Documentation/usb/proc_usb_info.txt
@@ -213,15 +213,16 @@ C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA
213 213
214Interface descriptor info (can be multiple per Config): 214Interface descriptor info (can be multiple per Config):
215 215
216I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss 216I:* If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss
217| | | | | | | |__Driver name 217| | | | | | | | |__Driver name
218| | | | | | | or "(none)" 218| | | | | | | | or "(none)"
219| | | | | | |__InterfaceProtocol 219| | | | | | | |__InterfaceProtocol
220| | | | | |__InterfaceSubClass 220| | | | | | |__InterfaceSubClass
221| | | | |__InterfaceClass 221| | | | | |__InterfaceClass
222| | | |__NumberOfEndpoints 222| | | | |__NumberOfEndpoints
223| | |__AlternateSettingNumber 223| | | |__AlternateSettingNumber
224| |__InterfaceNumber 224| | |__InterfaceNumber
225| |__ "*" indicates the active altsetting (others are " ")
225|__Interface info tag 226|__Interface info tag
226 227
227 A given interface may have one or more "alternate" settings. 228 A given interface may have one or more "alternate" settings.
@@ -277,7 +278,7 @@ of the USB devices on a system's root hub. (See more below
277on how to do this.) 278on how to do this.)
278 279
279The Interface lines can be used to determine what driver is 280The Interface lines can be used to determine what driver is
280being used for each device. 281being used for each device, and which altsetting it activated.
281 282
282The Configuration lines could be used to list maximum power 283The Configuration lines could be used to list maximum power
283(in milliamps) that a system's USB devices are using. 284(in milliamps) that a system's USB devices are using.
diff --git a/Documentation/usb/usbmon.txt b/Documentation/usb/usbmon.txt
index e65ec828d7aa..0f6808abd612 100644
--- a/Documentation/usb/usbmon.txt
+++ b/Documentation/usb/usbmon.txt
@@ -77,7 +77,7 @@ that the file size is not excessive for your favourite editor.
77 77
78The '1t' type data consists of a stream of events, such as URB submission, 78The '1t' type data consists of a stream of events, such as URB submission,
79URB callback, submission error. Every event is a text line, which consists 79URB callback, submission error. Every event is a text line, which consists
80of whitespace separated words. The number of position of words may depend 80of whitespace separated words. The number or position of words may depend
81on the event type, but there is a set of words, common for all types. 81on the event type, but there is a set of words, common for all types.
82 82
83Here is the list of words, from left to right: 83Here is the list of words, from left to right:
@@ -170,4 +170,152 @@ dd65f0e8 4128379808 C Bo:005:02 0 31 >
170 170
171* Raw binary format and API 171* Raw binary format and API
172 172
173TBD 173The overall architecture of the API is about the same as the one above,
174only the events are delivered in binary format. Each event is sent in
175the following structure (its name is made up, so that we can refer to it):
176
177struct usbmon_packet {
178 u64 id; /* 0: URB ID - from submission to callback */
179 unsigned char type; /* 8: Same as text; extensible. */
180 unsigned char xfer_type; /* ISO (0), Intr, Control, Bulk (3) */
181 unsigned char epnum; /* Endpoint number and transfer direction */
182 unsigned char devnum; /* Device address */
183 u16 busnum; /* 12: Bus number */
184 char flag_setup; /* 14: Same as text */
185 char flag_data; /* 15: Same as text; Binary zero is OK. */
186 s64 ts_sec; /* 16: gettimeofday */
187 s32 ts_usec; /* 24: gettimeofday */
188 int status; /* 28: */
189 unsigned int length; /* 32: Length of data (submitted or actual) */
190 unsigned int len_cap; /* 36: Delivered length */
191 unsigned char setup[8]; /* 40: Only for Control 'S' */
192}; /* 48 bytes total */
193
194These events can be received from a character device by reading with read(2),
195with an ioctl(2), or by accessing the buffer with mmap.
196
197The character device is usually called /dev/usbmonN, where N is the USB bus
198number. Number zero (/dev/usbmon0) is special and means "all buses".
199However, this feature is not implemented yet. Note that specific naming
200policy is set by your Linux distribution.
201
202If you create /dev/usbmon0 by hand, make sure that it is owned by root
203and has mode 0600. Otherwise, unpriviledged users will be able to snoop
204keyboard traffic.
205
206The following ioctl calls are available, with MON_IOC_MAGIC 0x92:
207
208 MON_IOCQ_URB_LEN, defined as _IO(MON_IOC_MAGIC, 1)
209
210This call returns the length of data in the next event. Note that majority of
211events contain no data, so if this call returns zero, it does not mean that
212no events are available.
213
214 MON_IOCG_STATS, defined as _IOR(MON_IOC_MAGIC, 3, struct mon_bin_stats)
215
216The argument is a pointer to the following structure:
217
218struct mon_bin_stats {
219 u32 queued;
220 u32 dropped;
221};
222
223The member "queued" refers to the number of events currently queued in the
224buffer (and not to the number of events processed since the last reset).
225
226The member "dropped" is the number of events lost since the last call
227to MON_IOCG_STATS.
228
229 MON_IOCT_RING_SIZE, defined as _IO(MON_IOC_MAGIC, 4)
230
231This call sets the buffer size. The argument is the size in bytes.
232The size may be rounded down to the next chunk (or page). If the requested
233size is out of [unspecified] bounds for this kernel, the call fails with
234-EINVAL.
235
236 MON_IOCQ_RING_SIZE, defined as _IO(MON_IOC_MAGIC, 5)
237
238This call returns the current size of the buffer in bytes.
239
240 MON_IOCX_GET, defined as _IOW(MON_IOC_MAGIC, 6, struct mon_get_arg)
241
242This call waits for events to arrive if none were in the kernel buffer,
243then returns the first event. Its argument is a pointer to the following
244structure:
245
246struct mon_get_arg {
247 struct usbmon_packet *hdr;
248 void *data;
249 size_t alloc; /* Length of data (can be zero) */
250};
251
252Before the call, hdr, data, and alloc should be filled. Upon return, the area
253pointed by hdr contains the next event structure, and the data buffer contains
254the data, if any. The event is removed from the kernel buffer.
255
256 MON_IOCX_MFETCH, defined as _IOWR(MON_IOC_MAGIC, 7, struct mon_mfetch_arg)
257
258This ioctl is primarily used when the application accesses the buffer
259with mmap(2). Its argument is a pointer to the following structure:
260
261struct mon_mfetch_arg {
262 uint32_t *offvec; /* Vector of events fetched */
263 uint32_t nfetch; /* Number of events to fetch (out: fetched) */
264 uint32_t nflush; /* Number of events to flush */
265};
266
267The ioctl operates in 3 stages.
268
269First, it removes and discards up to nflush events from the kernel buffer.
270The actual number of events discarded is returned in nflush.
271
272Second, it waits for an event to be present in the buffer, unless the pseudo-
273device is open with O_NONBLOCK.
274
275Third, it extracts up to nfetch offsets into the mmap buffer, and stores
276them into the offvec. The actual number of event offsets is stored into
277the nfetch.
278
279 MON_IOCH_MFLUSH, defined as _IO(MON_IOC_MAGIC, 8)
280
281This call removes a number of events from the kernel buffer. Its argument
282is the number of events to remove. If the buffer contains fewer events
283than requested, all events present are removed, and no error is reported.
284This works when no events are available too.
285
286 FIONBIO
287
288The ioctl FIONBIO may be implemented in the future, if there's a need.
289
290In addition to ioctl(2) and read(2), the special file of binary API can
291be polled with select(2) and poll(2). But lseek(2) does not work.
292
293* Memory-mapped access of the kernel buffer for the binary API
294
295The basic idea is simple:
296
297To prepare, map the buffer by getting the current size, then using mmap(2).
298Then, execute a loop similar to the one written in pseudo-code below:
299
300 struct mon_mfetch_arg fetch;
301 struct usbmon_packet *hdr;
302 int nflush = 0;
303 for (;;) {
304 fetch.offvec = vec; // Has N 32-bit words
305 fetch.nfetch = N; // Or less than N
306 fetch.nflush = nflush;
307 ioctl(fd, MON_IOCX_MFETCH, &fetch); // Process errors, too
308 nflush = fetch.nfetch; // This many packets to flush when done
309 for (i = 0; i < nflush; i++) {
310 hdr = (struct ubsmon_packet *) &mmap_area[vec[i]];
311 if (hdr->type == '@') // Filler packet
312 continue;
313 caddr_t data = &mmap_area[vec[i]] + 64;
314 process_packet(hdr, data);
315 }
316 }
317
318Thus, the main idea is to execute only one ioctl per N events.
319
320Although the buffer is circular, the returned headers and data do not cross
321the end of the buffer, so the above pseudo-code does not need any gathering.
diff --git a/Documentation/video-output.txt b/Documentation/video-output.txt
new file mode 100644
index 000000000000..e517011be4f9
--- /dev/null
+++ b/Documentation/video-output.txt
@@ -0,0 +1,34 @@
1
2 Video Output Switcher Control
3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 2006 luming.yu@intel.com
5
6The output sysfs class driver provides an abstract video output layer that
7can be used to hook platform specific methods to enable/disable video output
8device through common sysfs interface. For example, on my IBM ThinkPad T42
9laptop, The ACPI video driver registered its output devices and read/write
10method for 'state' with output sysfs class. The user interface under sysfs is:
11
12linux:/sys/class/video_output # tree .
13.
14|-- CRT0
15| |-- device -> ../../../devices/pci0000:00/0000:00:01.0
16| |-- state
17| |-- subsystem -> ../../../class/video_output
18| `-- uevent
19|-- DVI0
20| |-- device -> ../../../devices/pci0000:00/0000:00:01.0
21| |-- state
22| |-- subsystem -> ../../../class/video_output
23| `-- uevent
24|-- LCD0
25| |-- device -> ../../../devices/pci0000:00/0000:00:01.0
26| |-- state
27| |-- subsystem -> ../../../class/video_output
28| `-- uevent
29`-- TV0
30 |-- device -> ../../../devices/pci0000:00/0000:00:01.0
31 |-- state
32 |-- subsystem -> ../../../class/video_output
33 `-- uevent
34
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt
index 5c86ed6f0448..625a21db0c2a 100644
--- a/Documentation/x86_64/boot-options.txt
+++ b/Documentation/x86_64/boot-options.txt
@@ -180,40 +180,81 @@ PCI
180 pci=lastbus=NUMBER Scan upto NUMBER busses, no matter what the mptable says. 180 pci=lastbus=NUMBER Scan upto NUMBER busses, no matter what the mptable says.
181 pci=noacpi Don't use ACPI to set up PCI interrupt routing. 181 pci=noacpi Don't use ACPI to set up PCI interrupt routing.
182 182
183IOMMU 183IOMMU (input/output memory management unit)
184 184
185 iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge] 185 Currently four x86-64 PCI-DMA mapping implementations exist:
186 [,forcesac][,fullflush][,nomerge][,noaperture][,calgary] 186
187 size set size of iommu (in bytes) 187 1. <arch/x86_64/kernel/pci-nommu.c>: use no hardware/software IOMMU at all
188 noagp don't initialize the AGP driver and use full aperture. 188 (e.g. because you have < 3 GB memory).
189 off don't use the IOMMU 189 Kernel boot message: "PCI-DMA: Disabling IOMMU"
190 leak turn on simple iommu leak tracing (only when CONFIG_IOMMU_LEAK is on) 190
191 memaper[=order] allocate an own aperture over RAM with size 32MB^order. 191 2. <arch/x86_64/kernel/pci-gart.c>: AMD GART based hardware IOMMU.
192 noforce don't force IOMMU usage. Default. 192 Kernel boot message: "PCI-DMA: using GART IOMMU"
193 force Force IOMMU. 193
194 merge Do SG merging. Implies force (experimental) 194 3. <arch/x86_64/kernel/pci-swiotlb.c> : Software IOMMU implementation. Used
195 nomerge Don't do SG merging. 195 e.g. if there is no hardware IOMMU in the system and it is need because
196 forcesac For SAC mode for masks <40bits (experimental) 196 you have >3GB memory or told the kernel to us it (iommu=soft))
197 fullflush Flush IOMMU on each allocation (default) 197 Kernel boot message: "PCI-DMA: Using software bounce buffering
198 nofullflush Don't use IOMMU fullflush 198 for IO (SWIOTLB)"
199 allowed overwrite iommu off workarounds for specific chipsets. 199
200 soft Use software bounce buffering (default for Intel machines) 200 4. <arch/x86_64/pci-calgary.c> : IBM Calgary hardware IOMMU. Used in IBM
201 noaperture Don't touch the aperture for AGP. 201 pSeries and xSeries servers. This hardware IOMMU supports DMA address
202 allowdac Allow DMA >4GB 202 mapping with memory protection, etc.
203 When off all DMA over >4GB is forced through an IOMMU or bounce 203 Kernel boot message: "PCI-DMA: Using Calgary IOMMU"
204 buffering. 204
205 nodac Forbid DMA >4GB 205 iommu=[<size>][,noagp][,off][,force][,noforce][,leak[=<nr_of_leak_pages>]
206 panic Always panic when IOMMU overflows 206 [,memaper[=<order>]][,merge][,forcesac][,fullflush][,nomerge]
207 calgary Use the Calgary IOMMU if it is available 207 [,noaperture][,calgary]
208 208
209 swiotlb=pages[,force] 209 General iommu options:
210 210 off Don't initialize and use any kind of IOMMU.
211 pages Prereserve that many 128K pages for the software IO bounce buffering. 211 noforce Don't force hardware IOMMU usage when it is not needed.
212 force Force all IO through the software TLB. 212 (default).
213 213 force Force the use of the hardware IOMMU even when it is
214 calgary=[64k,128k,256k,512k,1M,2M,4M,8M] 214 not actually needed (e.g. because < 3 GB memory).
215 calgary=[translate_empty_slots] 215 soft Use software bounce buffering (SWIOTLB) (default for
216 calgary=[disable=<PCI bus number>] 216 Intel machines). This can be used to prevent the usage
217 of an available hardware IOMMU.
218
219 iommu options only relevant to the AMD GART hardware IOMMU:
220 <size> Set the size of the remapping area in bytes.
221 allowed Overwrite iommu off workarounds for specific chipsets.
222 fullflush Flush IOMMU on each allocation (default).
223 nofullflush Don't use IOMMU fullflush.
224 leak Turn on simple iommu leak tracing (only when
225 CONFIG_IOMMU_LEAK is on). Default number of leak pages
226 is 20.
227 memaper[=<order>] Allocate an own aperture over RAM with size 32MB<<order.
228 (default: order=1, i.e. 64MB)
229 merge Do scatter-gather (SG) merging. Implies "force"
230 (experimental).
231 nomerge Don't do scatter-gather (SG) merging.
232 noaperture Ask the IOMMU not to touch the aperture for AGP.
233 forcesac Force single-address cycle (SAC) mode for masks <40bits
234 (experimental).
235 noagp Don't initialize the AGP driver and use full aperture.
236 allowdac Allow double-address cycle (DAC) mode, i.e. DMA >4GB.
237 DAC is used with 32-bit PCI to push a 64-bit address in
238 two cycles. When off all DMA over >4GB is forced through
239 an IOMMU or software bounce buffering.
240 nodac Forbid DAC mode, i.e. DMA >4GB.
241 panic Always panic when IOMMU overflows.
242 calgary Use the Calgary IOMMU if it is available
243
244 iommu options only relevant to the software bounce buffering (SWIOTLB) IOMMU
245 implementation:
246 swiotlb=<pages>[,force]
247 <pages> Prereserve that many 128K pages for the software IO
248 bounce buffering.
249 force Force all IO through the software TLB.
250
251 Settings for the IBM Calgary hardware IOMMU currently found in IBM
252 pSeries and xSeries machines:
253
254 calgary=[64k,128k,256k,512k,1M,2M,4M,8M]
255 calgary=[translate_empty_slots]
256 calgary=[disable=<PCI bus number>]
257 panic Always panic when IOMMU overflows
217 258
218 64k,...,8M - Set the size of each PCI slot's translation table 259 64k,...,8M - Set the size of each PCI slot's translation table
219 when using the Calgary IOMMU. This is the size of the translation 260 when using the Calgary IOMMU. This is the size of the translation
@@ -234,14 +275,14 @@ IOMMU
234 275
235Debugging 276Debugging
236 277
237 oops=panic Always panic on oopses. Default is to just kill the process, 278 oops=panic Always panic on oopses. Default is to just kill the process,
238 but there is a small probability of deadlocking the machine. 279 but there is a small probability of deadlocking the machine.
239 This will also cause panics on machine check exceptions. 280 This will also cause panics on machine check exceptions.
240 Useful together with panic=30 to trigger a reboot. 281 Useful together with panic=30 to trigger a reboot.
241 282
242 kstack=N Print that many words from the kernel stack in oops dumps. 283 kstack=N Print N words from the kernel stack in oops dumps.
243 284
244 pagefaulttrace Dump all page faults. Only useful for extreme debugging 285 pagefaulttrace Dump all page faults. Only useful for extreme debugging
245 and will create a lot of output. 286 and will create a lot of output.
246 287
247 call_trace=[old|both|newfallback|new] 288 call_trace=[old|both|newfallback|new]
@@ -251,15 +292,8 @@ Debugging
251 newfallback: use new unwinder but fall back to old if it gets 292 newfallback: use new unwinder but fall back to old if it gets
252 stuck (default) 293 stuck (default)
253 294
254 call_trace=[old|both|newfallback|new] 295Miscellaneous
255 old: use old inexact backtracer
256 new: use new exact dwarf2 unwinder
257 both: print entries from both
258 newfallback: use new unwinder but fall back to old if it gets
259 stuck (default)
260
261Misc
262 296
263 noreplacement Don't replace instructions with more appropriate ones 297 noreplacement Don't replace instructions with more appropriate ones
264 for the CPU. This may be useful on asymmetric MP systems 298 for the CPU. This may be useful on asymmetric MP systems
265 where some CPU have less capabilities than the others. 299 where some CPUs have less capabilities than others.
diff --git a/Documentation/x86_64/cpu-hotplug-spec b/Documentation/x86_64/cpu-hotplug-spec
index 5c0fa345e556..3c23e0587db3 100644
--- a/Documentation/x86_64/cpu-hotplug-spec
+++ b/Documentation/x86_64/cpu-hotplug-spec
@@ -2,7 +2,7 @@ Firmware support for CPU hotplug under Linux/x86-64
2--------------------------------------------------- 2---------------------------------------------------
3 3
4Linux/x86-64 supports CPU hotplug now. For various reasons Linux wants to 4Linux/x86-64 supports CPU hotplug now. For various reasons Linux wants to
5know in advance boot time the maximum number of CPUs that could be plugged 5know in advance of boot time the maximum number of CPUs that could be plugged
6into the system. ACPI 3.0 currently has no official way to supply 6into the system. ACPI 3.0 currently has no official way to supply
7this information from the firmware to the operating system. 7this information from the firmware to the operating system.
8 8
diff --git a/Documentation/x86_64/kernel-stacks b/Documentation/x86_64/kernel-stacks
index bddfddd466ab..5ad65d51fb95 100644
--- a/Documentation/x86_64/kernel-stacks
+++ b/Documentation/x86_64/kernel-stacks
@@ -9,9 +9,9 @@ zombie. While the thread is in user space the kernel stack is empty
9except for the thread_info structure at the bottom. 9except for the thread_info structure at the bottom.
10 10
11In addition to the per thread stacks, there are specialized stacks 11In addition to the per thread stacks, there are specialized stacks
12associated with each cpu. These stacks are only used while the kernel 12associated with each CPU. These stacks are only used while the kernel
13is in control on that cpu, when a cpu returns to user space the 13is in control on that CPU; when a CPU returns to user space the
14specialized stacks contain no useful data. The main cpu stacks is 14specialized stacks contain no useful data. The main CPU stacks are:
15 15
16* Interrupt stack. IRQSTACKSIZE 16* Interrupt stack. IRQSTACKSIZE
17 17
@@ -32,17 +32,17 @@ x86_64 also has a feature which is not available on i386, the ability
32to automatically switch to a new stack for designated events such as 32to automatically switch to a new stack for designated events such as
33double fault or NMI, which makes it easier to handle these unusual 33double fault or NMI, which makes it easier to handle these unusual
34events on x86_64. This feature is called the Interrupt Stack Table 34events on x86_64. This feature is called the Interrupt Stack Table
35(IST). There can be up to 7 IST entries per cpu. The IST code is an 35(IST). There can be up to 7 IST entries per CPU. The IST code is an
36index into the Task State Segment (TSS), the IST entries in the TSS 36index into the Task State Segment (TSS). The IST entries in the TSS
37point to dedicated stacks, each stack can be a different size. 37point to dedicated stacks; each stack can be a different size.
38 38
39An IST is selected by an non-zero value in the IST field of an 39An IST is selected by a non-zero value in the IST field of an
40interrupt-gate descriptor. When an interrupt occurs and the hardware 40interrupt-gate descriptor. When an interrupt occurs and the hardware
41loads such a descriptor, the hardware automatically sets the new stack 41loads such a descriptor, the hardware automatically sets the new stack
42pointer based on the IST value, then invokes the interrupt handler. If 42pointer based on the IST value, then invokes the interrupt handler. If
43software wants to allow nested IST interrupts then the handler must 43software wants to allow nested IST interrupts then the handler must
44adjust the IST values on entry to and exit from the interrupt handler. 44adjust the IST values on entry to and exit from the interrupt handler.
45(this is occasionally done, e.g. for debug exceptions) 45(This is occasionally done, e.g. for debug exceptions.)
46 46
47Events with different IST codes (i.e. with different stacks) can be 47Events with different IST codes (i.e. with different stacks) can be
48nested. For example, a debug interrupt can safely be interrupted by an 48nested. For example, a debug interrupt can safely be interrupted by an
@@ -58,17 +58,17 @@ The currently assigned IST stacks are :-
58 58
59 Used for interrupt 12 - Stack Fault Exception (#SS). 59 Used for interrupt 12 - Stack Fault Exception (#SS).
60 60
61 This allows to recover from invalid stack segments. Rarely 61 This allows the CPU to recover from invalid stack segments. Rarely
62 happens. 62 happens.
63 63
64* DOUBLEFAULT_STACK. EXCEPTION_STKSZ (PAGE_SIZE). 64* DOUBLEFAULT_STACK. EXCEPTION_STKSZ (PAGE_SIZE).
65 65
66 Used for interrupt 8 - Double Fault Exception (#DF). 66 Used for interrupt 8 - Double Fault Exception (#DF).
67 67
68 Invoked when handling a exception causes another exception. Happens 68 Invoked when handling one exception causes another exception. Happens
69 when the kernel is very confused (e.g. kernel stack pointer corrupt) 69 when the kernel is very confused (e.g. kernel stack pointer corrupt).
70 Using a separate stack allows to recover from it well enough in many 70 Using a separate stack allows the kernel to recover from it well enough
71 cases to still output an oops. 71 in many cases to still output an oops.
72 72
73* NMI_STACK. EXCEPTION_STKSZ (PAGE_SIZE). 73* NMI_STACK. EXCEPTION_STKSZ (PAGE_SIZE).
74 74
diff --git a/Documentation/x86_64/machinecheck b/Documentation/x86_64/machinecheck
new file mode 100644
index 000000000000..068a6d9904b9
--- /dev/null
+++ b/Documentation/x86_64/machinecheck
@@ -0,0 +1,70 @@
1
2Configurable sysfs parameters for the x86-64 machine check code.
3
4Machine checks report internal hardware error conditions detected
5by the CPU. Uncorrected errors typically cause a machine check
6(often with panic), corrected ones cause a machine check log entry.
7
8Machine checks are organized in banks (normally associated with
9a hardware subsystem) and subevents in a bank. The exact meaning
10of the banks and subevent is CPU specific.
11
12mcelog knows how to decode them.
13
14When you see the "Machine check errors logged" message in the system
15log then mcelog should run to collect and decode machine check entries
16from /dev/mcelog. Normally mcelog should be run regularly from a cronjob.
17
18Each CPU has a directory in /sys/devices/system/machinecheck/machinecheckN
19(N = CPU number)
20
21The directory contains some configurable entries:
22
23Entries:
24
25bankNctl
26(N bank number)
27 64bit Hex bitmask enabling/disabling specific subevents for bank N
28 When a bit in the bitmask is zero then the respective
29 subevent will not be reported.
30 By default all events are enabled.
31 Note that BIOS maintain another mask to disable specific events
32 per bank. This is not visible here
33
34The following entries appear for each CPU, but they are truly shared
35between all CPUs.
36
37check_interval
38 How often to poll for corrected machine check errors, in seconds
39 (Note output is hexademical). Default 5 minutes.
40
41tolerant
42 Tolerance level. When a machine check exception occurs for a non
43 corrected machine check the kernel can take different actions.
44 Since machine check exceptions can happen any time it is sometimes
45 risky for the kernel to kill a process because it defies
46 normal kernel locking rules. The tolerance level configures
47 how hard the kernel tries to recover even at some risk of deadlock.
48
49 0: always panic,
50 1: panic if deadlock possible,
51 2: try to avoid panic,
52 3: never panic or exit (for testing only)
53
54 Default: 1
55
56 Note this only makes a difference if the CPU allows recovery
57 from a machine check exception. Current x86 CPUs generally do not.
58
59trigger
60 Program to run when a machine check event is detected.
61 This is an alternative to running mcelog regularly from cron
62 and allows to detect events faster.
63
64TBD document entries for AMD threshold interrupt configuration
65
66For more details about the x86 machine check architecture
67see the Intel and AMD architecture manuals from their developer websites.
68
69For more details about the architecture see
70see http://one.firstfloor.org/~andi/mce.pdf
diff --git a/Documentation/x86_64/mm.txt b/Documentation/x86_64/mm.txt
index 133561b9cb0c..f42798ed1c54 100644
--- a/Documentation/x86_64/mm.txt
+++ b/Documentation/x86_64/mm.txt
@@ -3,26 +3,26 @@
3 3
4Virtual memory map with 4 level page tables: 4Virtual memory map with 4 level page tables:
5 5
60000000000000000 - 00007fffffffffff (=47bits) user space, different per mm 60000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm
7hole caused by [48:63] sign extension 7hole caused by [48:63] sign extension
8ffff800000000000 - ffff80ffffffffff (=40bits) guard hole 8ffff800000000000 - ffff80ffffffffff (=40 bits) guard hole
9ffff810000000000 - ffffc0ffffffffff (=46bits) direct mapping of all phys. memory 9ffff810000000000 - ffffc0ffffffffff (=46 bits) direct mapping of all phys. memory
10ffffc10000000000 - ffffc1ffffffffff (=40bits) hole 10ffffc10000000000 - ffffc1ffffffffff (=40 bits) hole
11ffffc20000000000 - ffffe1ffffffffff (=45bits) vmalloc/ioremap space 11ffffc20000000000 - ffffe1ffffffffff (=45 bits) vmalloc/ioremap space
12... unused hole ... 12... unused hole ...
13ffffffff80000000 - ffffffff82800000 (=40MB) kernel text mapping, from phys 0 13ffffffff80000000 - ffffffff82800000 (=40 MB) kernel text mapping, from phys 0
14... unused hole ... 14... unused hole ...
15ffffffff88000000 - fffffffffff00000 (=1919MB) module mapping space 15ffffffff88000000 - fffffffffff00000 (=1919 MB) module mapping space
16 16
17The direct mapping covers all memory in the system upto the highest 17The direct mapping covers all memory in the system up to the highest
18memory address (this means in some cases it can also include PCI memory 18memory address (this means in some cases it can also include PCI memory
19holes) 19holes).
20 20
21vmalloc space is lazily synchronized into the different PML4 pages of 21vmalloc space is lazily synchronized into the different PML4 pages of
22the processes using the page fault handler, with init_level4_pgt as 22the processes using the page fault handler, with init_level4_pgt as
23reference. 23reference.
24 24
25Current X86-64 implementations only support 40 bit of address space, 25Current X86-64 implementations only support 40 bits of address space,
26but we support upto 46bits. This expands into MBZ space in the page tables. 26but we support up to 46 bits. This expands into MBZ space in the page tables.
27 27
28-Andi Kleen, Jul 2004 28-Andi Kleen, Jul 2004