diff options
Diffstat (limited to 'Documentation')
26 files changed, 838 insertions, 71 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index 9069189e78ef..afc286775891 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle | |||
@@ -160,6 +160,21 @@ supply of new-lines on your screen is not a renewable resource (think | |||
160 | 25-line terminal screens here), you have more empty lines to put | 160 | 25-line terminal screens here), you have more empty lines to put |
161 | comments on. | 161 | comments on. |
162 | 162 | ||
163 | Do not unnecessarily use braces where a single statement will do. | ||
164 | |||
165 | if (condition) | ||
166 | action(); | ||
167 | |||
168 | This does not apply if one branch of a conditional statement is a single | ||
169 | statement. Use braces in both branches. | ||
170 | |||
171 | if (condition) { | ||
172 | do_this(); | ||
173 | do_that(); | ||
174 | } else { | ||
175 | otherwise(); | ||
176 | } | ||
177 | |||
163 | 3.1: Spaces | 178 | 3.1: Spaces |
164 | 179 | ||
165 | Linux kernel style for use of spaces depends (mostly) on | 180 | Linux kernel style for use of spaces depends (mostly) on |
@@ -625,7 +640,7 @@ language. | |||
625 | 640 | ||
626 | There appears to be a common misperception that gcc has a magic "make me | 641 | There appears to be a common misperception that gcc has a magic "make me |
627 | faster" speedup option called "inline". While the use of inlines can be | 642 | faster" speedup option called "inline". While the use of inlines can be |
628 | appropriate (for example as a means of replacing macros, see Chapter 11), it | 643 | appropriate (for example as a means of replacing macros, see Chapter 12), it |
629 | very often is not. Abundant use of the inline keyword leads to a much bigger | 644 | very often is not. Abundant use of the inline keyword leads to a much bigger |
630 | kernel, which in turn slows the system as a whole down, due to a bigger | 645 | kernel, which in turn slows the system as a whole down, due to a bigger |
631 | icache footprint for the CPU and simply because there is less memory | 646 | icache footprint for the CPU and simply because there is less memory |
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 10b5cd6c54a0..6fd1646d3204 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -43,6 +43,7 @@ pdfdocs: $(PDF) | |||
43 | 43 | ||
44 | HTML := $(sort $(patsubst %.xml, %.html, $(BOOKS))) | 44 | HTML := $(sort $(patsubst %.xml, %.html, $(BOOKS))) |
45 | htmldocs: $(HTML) | 45 | htmldocs: $(HTML) |
46 | $(call build_main_index) | ||
46 | 47 | ||
47 | MAN := $(patsubst %.xml, %.9, $(BOOKS)) | 48 | MAN := $(patsubst %.xml, %.9, $(BOOKS)) |
48 | mandocs: $(MAN) | 49 | mandocs: $(MAN) |
@@ -132,10 +133,17 @@ quiet_cmd_db2pdf = PDF $@ | |||
132 | %.pdf : %.xml | 133 | %.pdf : %.xml |
133 | $(call cmd,db2pdf) | 134 | $(call cmd,db2pdf) |
134 | 135 | ||
136 | |||
137 | main_idx = Documentation/DocBook/index.html | ||
138 | build_main_index = rm -rf $(main_idx) && \ | ||
139 | echo '<h1>Linux Kernel HTML Documentation</h1>' >> $(main_idx) && \ | ||
140 | echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \ | ||
141 | cat $(HTML) >> $(main_idx) | ||
142 | |||
135 | quiet_cmd_db2html = HTML $@ | 143 | quiet_cmd_db2html = HTML $@ |
136 | cmd_db2html = xmlto xhtml $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \ | 144 | cmd_db2html = xmlto xhtml $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \ |
137 | echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \ | 145 | echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \ |
138 | Goto $(patsubst %.html,%,$(notdir $@))</a><p>' > $@ | 146 | $(patsubst %.html,%,$(notdir $@))</a><p>' > $@ |
139 | 147 | ||
140 | %.html: %.xml | 148 | %.html: %.xml |
141 | @(which xmlto > /dev/null 2>&1) || \ | 149 | @(which xmlto > /dev/null 2>&1) || \ |
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index b61dfc79e1b8..a2b2b4d187c5 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
@@ -576,4 +576,67 @@ X!Idrivers/video/console/fonts.c | |||
576 | !Edrivers/input/ff-core.c | 576 | !Edrivers/input/ff-core.c |
577 | !Edrivers/input/ff-memless.c | 577 | !Edrivers/input/ff-memless.c |
578 | </chapter> | 578 | </chapter> |
579 | |||
580 | <chapter id="spi"> | ||
581 | <title>Serial Peripheral Interface (SPI)</title> | ||
582 | <para> | ||
583 | SPI is the "Serial Peripheral Interface", widely used with | ||
584 | embedded systems because it is a simple and efficient | ||
585 | interface: basically a multiplexed shift register. | ||
586 | Its three signal wires hold a clock (SCK, often in the range | ||
587 | of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and | ||
588 | a "Master In, Slave Out" (MISO) data line. | ||
589 | SPI is a full duplex protocol; for each bit shifted out the | ||
590 | MOSI line (one per clock) another is shifted in on the MISO line. | ||
591 | Those bits are assembled into words of various sizes on the | ||
592 | way to and from system memory. | ||
593 | An additional chipselect line is usually active-low (nCS); | ||
594 | four signals are normally used for each peripheral, plus | ||
595 | sometimes an interrupt. | ||
596 | </para> | ||
597 | <para> | ||
598 | The SPI bus facilities listed here provide a generalized | ||
599 | interface to declare SPI busses and devices, manage them | ||
600 | according to the standard Linux driver model, and perform | ||
601 | input/output operations. | ||
602 | At this time, only "master" side interfaces are supported, | ||
603 | where Linux talks to SPI peripherals and does not implement | ||
604 | such a peripheral itself. | ||
605 | (Interfaces to support implementing SPI slaves would | ||
606 | necessarily look different.) | ||
607 | </para> | ||
608 | <para> | ||
609 | The programming interface is structured around two kinds of driver, | ||
610 | and two kinds of device. | ||
611 | A "Controller Driver" abstracts the controller hardware, which may | ||
612 | be as simple as a set of GPIO pins or as complex as a pair of FIFOs | ||
613 | connected to dual DMA engines on the other side of the SPI shift | ||
614 | register (maximizing throughput). Such drivers bridge between | ||
615 | whatever bus they sit on (often the platform bus) and SPI, and | ||
616 | expose the SPI side of their device as a | ||
617 | <structname>struct spi_master</structname>. | ||
618 | SPI devices are children of that master, represented as a | ||
619 | <structname>struct spi_device</structname> and manufactured from | ||
620 | <structname>struct spi_board_info</structname> descriptors which | ||
621 | are usually provided by board-specific initialization code. | ||
622 | A <structname>struct spi_driver</structname> is called a | ||
623 | "Protocol Driver", and is bound to a spi_device using normal | ||
624 | driver model calls. | ||
625 | </para> | ||
626 | <para> | ||
627 | The I/O model is a set of queued messages. Protocol drivers | ||
628 | submit one or more <structname>struct spi_message</structname> | ||
629 | objects, which are processed and completed asynchronously. | ||
630 | (There are synchronous wrappers, however.) Messages are | ||
631 | built from one or more <structname>struct spi_transfer</structname> | ||
632 | objects, each of which wraps a full duplex SPI transfer. | ||
633 | A variety of protocol tweaking options are needed, because | ||
634 | different chips adopt very different policies for how they | ||
635 | use the bits transferred with SPI. | ||
636 | </para> | ||
637 | !Iinclude/linux/spi/spi.h | ||
638 | !Fdrivers/spi/spi.c spi_register_board_info | ||
639 | !Edrivers/spi/spi.c | ||
640 | </chapter> | ||
641 | |||
579 | </book> | 642 | </book> |
diff --git a/Documentation/DocBook/librs.tmpl b/Documentation/DocBook/librs.tmpl index 3ff39bafc00e..94f21361e0ed 100644 --- a/Documentation/DocBook/librs.tmpl +++ b/Documentation/DocBook/librs.tmpl | |||
@@ -79,12 +79,12 @@ | |||
79 | <chapter id="usage"> | 79 | <chapter id="usage"> |
80 | <title>Usage</title> | 80 | <title>Usage</title> |
81 | <para> | 81 | <para> |
82 | This chapter provides examples how to use the library. | 82 | This chapter provides examples of how to use the library. |
83 | </para> | 83 | </para> |
84 | <sect1> | 84 | <sect1> |
85 | <title>Initializing</title> | 85 | <title>Initializing</title> |
86 | <para> | 86 | <para> |
87 | The init function init_rs returns a pointer to a | 87 | The init function init_rs returns a pointer to an |
88 | rs decoder structure, which holds the necessary | 88 | rs decoder structure, which holds the necessary |
89 | information for encoding, decoding and error correction | 89 | information for encoding, decoding and error correction |
90 | with the given polynomial. It either uses an existing | 90 | with the given polynomial. It either uses an existing |
@@ -98,10 +98,10 @@ | |||
98 | static struct rs_control *rs_decoder; | 98 | static struct rs_control *rs_decoder; |
99 | 99 | ||
100 | /* Symbolsize is 10 (bits) | 100 | /* Symbolsize is 10 (bits) |
101 | * Primitve polynomial is x^10+x^3+1 | 101 | * Primitive polynomial is x^10+x^3+1 |
102 | * first consecutive root is 0 | 102 | * first consecutive root is 0 |
103 | * primitve element to generate roots = 1 | 103 | * primitive element to generate roots = 1 |
104 | * generator polinomial degree (number of roots) = 6 | 104 | * generator polynomial degree (number of roots) = 6 |
105 | */ | 105 | */ |
106 | rs_decoder = init_rs (10, 0x409, 0, 1, 6); | 106 | rs_decoder = init_rs (10, 0x409, 0, 1, 6); |
107 | </programlisting> | 107 | </programlisting> |
@@ -116,12 +116,12 @@ rs_decoder = init_rs (10, 0x409, 0, 1, 6); | |||
116 | </para> | 116 | </para> |
117 | <para> | 117 | <para> |
118 | The expanded data can be inverted on the fly by | 118 | The expanded data can be inverted on the fly by |
119 | providing a non zero inversion mask. The expanded data is | 119 | providing a non-zero inversion mask. The expanded data is |
120 | XOR'ed with the mask. This is used e.g. for FLASH | 120 | XOR'ed with the mask. This is used e.g. for FLASH |
121 | ECC, where the all 0xFF is inverted to an all 0x00. | 121 | ECC, where the all 0xFF is inverted to an all 0x00. |
122 | The Reed-Solomon code for all 0x00 is all 0x00. The | 122 | The Reed-Solomon code for all 0x00 is all 0x00. The |
123 | code is inverted before storing to FLASH so it is 0xFF | 123 | code is inverted before storing to FLASH so it is 0xFF |
124 | too. This prevent's that reading from an erased FLASH | 124 | too. This prevents that reading from an erased FLASH |
125 | results in ECC errors. | 125 | results in ECC errors. |
126 | </para> | 126 | </para> |
127 | <para> | 127 | <para> |
@@ -273,7 +273,7 @@ free_rs(rs_decoder); | |||
273 | May be used under the terms of the GNU General Public License (GPL) | 273 | May be used under the terms of the GNU General Public License (GPL) |
274 | </programlisting> | 274 | </programlisting> |
275 | <para> | 275 | <para> |
276 | The wrapper functions and interfaces are written by Thomas Gleixner | 276 | The wrapper functions and interfaces are written by Thomas Gleixner. |
277 | </para> | 277 | </para> |
278 | <para> | 278 | <para> |
279 | Many users have provided bugfixes, improvements and helping hands for testing. | 279 | Many users have provided bugfixes, improvements and helping hands for testing. |
diff --git a/Documentation/SubmittingDrivers b/Documentation/SubmittingDrivers index 58bead05eabb..d7e26427e426 100644 --- a/Documentation/SubmittingDrivers +++ b/Documentation/SubmittingDrivers | |||
@@ -87,6 +87,21 @@ Clarity: It helps if anyone can see how to fix the driver. It helps | |||
87 | driver that intentionally obfuscates how the hardware works | 87 | driver that intentionally obfuscates how the hardware works |
88 | it will go in the bitbucket. | 88 | it will go in the bitbucket. |
89 | 89 | ||
90 | PM support: Since Linux is used on many portable and desktop systems, your | ||
91 | driver is likely to be used on such a system and therefore it | ||
92 | should support basic power management by implementing, if | ||
93 | necessary, the .suspend and .resume methods used during the | ||
94 | system-wide suspend and resume transitions. You should verify | ||
95 | that your driver correctly handles the suspend and resume, but | ||
96 | if you are unable to ensure that, please at least define the | ||
97 | .suspend method returning the -ENOSYS ("Function not | ||
98 | implemented") error. You should also try to make sure that your | ||
99 | driver uses as little power as possible when it's not doing | ||
100 | anything. For the driver testing instructions see | ||
101 | Documentation/power/drivers-testing.txt and for a relatively | ||
102 | complete overview of the power management issues related to | ||
103 | drivers see Documentation/power/devices.txt . | ||
104 | |||
90 | Control: In general if there is active maintainance of a driver by | 105 | Control: In general if there is active maintainance of a driver by |
91 | the author then patches will be redirected to them unless | 106 | the author then patches will be redirected to them unless |
92 | they are totally obvious and without need of checking. | 107 | they are totally obvious and without need of checking. |
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index e9126e794ed7..71acc28ed0d1 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c | |||
@@ -61,8 +61,6 @@ __u64 stime, utime; | |||
61 | #define MAX_MSG_SIZE 1024 | 61 | #define MAX_MSG_SIZE 1024 |
62 | /* Maximum number of cpus expected to be specified in a cpumask */ | 62 | /* Maximum number of cpus expected to be specified in a cpumask */ |
63 | #define MAX_CPUS 32 | 63 | #define MAX_CPUS 32 |
64 | /* Maximum length of pathname to log file */ | ||
65 | #define MAX_FILENAME 256 | ||
66 | 64 | ||
67 | struct msgtemplate { | 65 | struct msgtemplate { |
68 | struct nlmsghdr n; | 66 | struct nlmsghdr n; |
@@ -72,6 +70,16 @@ struct msgtemplate { | |||
72 | 70 | ||
73 | char cpumask[100+6*MAX_CPUS]; | 71 | char cpumask[100+6*MAX_CPUS]; |
74 | 72 | ||
73 | static void usage(void) | ||
74 | { | ||
75 | fprintf(stderr, "getdelays [-dilv] [-w logfile] [-r bufsize] " | ||
76 | "[-m cpumask] [-t tgid] [-p pid]\n"); | ||
77 | fprintf(stderr, " -d: print delayacct stats\n"); | ||
78 | fprintf(stderr, " -i: print IO accounting (works only with -p)\n"); | ||
79 | fprintf(stderr, " -l: listen forever\n"); | ||
80 | fprintf(stderr, " -v: debug on\n"); | ||
81 | } | ||
82 | |||
75 | /* | 83 | /* |
76 | * Create a raw netlink socket and bind | 84 | * Create a raw netlink socket and bind |
77 | */ | 85 | */ |
@@ -221,13 +229,13 @@ int main(int argc, char *argv[]) | |||
221 | int count = 0; | 229 | int count = 0; |
222 | int write_file = 0; | 230 | int write_file = 0; |
223 | int maskset = 0; | 231 | int maskset = 0; |
224 | char logfile[128]; | 232 | char *logfile = NULL; |
225 | int loop = 0; | 233 | int loop = 0; |
226 | 234 | ||
227 | struct msgtemplate msg; | 235 | struct msgtemplate msg; |
228 | 236 | ||
229 | while (1) { | 237 | while (1) { |
230 | c = getopt(argc, argv, "diw:r:m:t:p:v:l"); | 238 | c = getopt(argc, argv, "diw:r:m:t:p:vl"); |
231 | if (c < 0) | 239 | if (c < 0) |
232 | break; | 240 | break; |
233 | 241 | ||
@@ -241,7 +249,7 @@ int main(int argc, char *argv[]) | |||
241 | print_io_accounting = 1; | 249 | print_io_accounting = 1; |
242 | break; | 250 | break; |
243 | case 'w': | 251 | case 'w': |
244 | strncpy(logfile, optarg, MAX_FILENAME); | 252 | logfile = strdup(optarg); |
245 | printf("write to file %s\n", logfile); | 253 | printf("write to file %s\n", logfile); |
246 | write_file = 1; | 254 | write_file = 1; |
247 | break; | 255 | break; |
@@ -277,7 +285,7 @@ int main(int argc, char *argv[]) | |||
277 | loop = 1; | 285 | loop = 1; |
278 | break; | 286 | break; |
279 | default: | 287 | default: |
280 | printf("Unknown option %d\n", c); | 288 | usage(); |
281 | exit(-1); | 289 | exit(-1); |
282 | } | 290 | } |
283 | } | 291 | } |
diff --git a/Documentation/cciss.txt b/Documentation/cciss.txt index f74affe5c829..e65736c6b8bc 100644 --- a/Documentation/cciss.txt +++ b/Documentation/cciss.txt | |||
@@ -22,14 +22,21 @@ This driver is known to work with the following cards: | |||
22 | * SA E200i | 22 | * SA E200i |
23 | * SA E500 | 23 | * SA E500 |
24 | 24 | ||
25 | If nodes are not already created in the /dev/cciss directory, run as root: | 25 | Detecting drive failures: |
26 | ------------------------- | ||
26 | 27 | ||
27 | # cd /dev | 28 | To get the status of logical volumes and to detect physical drive |
28 | # ./MAKEDEV cciss | 29 | failures, you can use the cciss_vol_status program found here: |
30 | http://cciss.sourceforge.net/#cciss_utils | ||
29 | 31 | ||
30 | Device Naming: | 32 | Device Naming: |
31 | -------------- | 33 | -------------- |
32 | 34 | ||
35 | If nodes are not already created in the /dev/cciss directory, run as root: | ||
36 | |||
37 | # cd /dev | ||
38 | # ./MAKEDEV cciss | ||
39 | |||
33 | You need some entries in /dev for the cciss device. The MAKEDEV script | 40 | You need some entries in /dev for the cciss device. The MAKEDEV script |
34 | can make device nodes for you automatically. Currently the device setup | 41 | can make device nodes for you automatically. Currently the device setup |
35 | is as follows: | 42 | is as follows: |
diff --git a/Documentation/fb/deferred_io.txt b/Documentation/fb/deferred_io.txt new file mode 100644 index 000000000000..73cf9fb7cf60 --- /dev/null +++ b/Documentation/fb/deferred_io.txt | |||
@@ -0,0 +1,75 @@ | |||
1 | Deferred IO | ||
2 | ----------- | ||
3 | |||
4 | Deferred IO is a way to delay and repurpose IO. It uses host memory as a | ||
5 | buffer and the MMU pagefault as a pretrigger for when to perform the device | ||
6 | IO. The following example may be a useful explaination of how one such setup | ||
7 | works: | ||
8 | |||
9 | - userspace app like Xfbdev mmaps framebuffer | ||
10 | - deferred IO and driver sets up nopage and page_mkwrite handlers | ||
11 | - userspace app tries to write to mmaped vaddress | ||
12 | - we get pagefault and reach nopage handler | ||
13 | - nopage handler finds and returns physical page | ||
14 | - we get page_mkwrite where we add this page to a list | ||
15 | - schedule a workqueue task to be run after a delay | ||
16 | - app continues writing to that page with no additional cost. this is | ||
17 | the key benefit. | ||
18 | - the workqueue task comes in and mkcleans the pages on the list, then | ||
19 | completes the work associated with updating the framebuffer. this is | ||
20 | the real work talking to the device. | ||
21 | - app tries to write to the address (that has now been mkcleaned) | ||
22 | - get pagefault and the above sequence occurs again | ||
23 | |||
24 | As can be seen from above, one benefit is roughly to allow bursty framebuffer | ||
25 | writes to occur at minimum cost. Then after some time when hopefully things | ||
26 | have gone quiet, we go and really update the framebuffer which would be | ||
27 | a relatively more expensive operation. | ||
28 | |||
29 | For some types of nonvolatile high latency displays, the desired image is | ||
30 | the final image rather than the intermediate stages which is why it's okay | ||
31 | to not update for each write that is occuring. | ||
32 | |||
33 | It may be the case that this is useful in other scenarios as well. Paul Mundt | ||
34 | has mentioned a case where it is beneficial to use the page count to decide | ||
35 | whether to coalesce and issue SG DMA or to do memory bursts. | ||
36 | |||
37 | Another one may be if one has a device framebuffer that is in an usual format, | ||
38 | say diagonally shifting RGB, this may then be a mechanism for you to allow | ||
39 | apps to pretend to have a normal framebuffer but reswizzle for the device | ||
40 | framebuffer at vsync time based on the touched pagelist. | ||
41 | |||
42 | How to use it: (for applications) | ||
43 | --------------------------------- | ||
44 | No changes needed. mmap the framebuffer like normal and just use it. | ||
45 | |||
46 | How to use it: (for fbdev drivers) | ||
47 | ---------------------------------- | ||
48 | The following example may be helpful. | ||
49 | |||
50 | 1. Setup your structure. Eg: | ||
51 | |||
52 | static struct fb_deferred_io hecubafb_defio = { | ||
53 | .delay = HZ, | ||
54 | .deferred_io = hecubafb_dpy_deferred_io, | ||
55 | }; | ||
56 | |||
57 | The delay is the minimum delay between when the page_mkwrite trigger occurs | ||
58 | and when the deferred_io callback is called. The deferred_io callback is | ||
59 | explained below. | ||
60 | |||
61 | 2. Setup your deferred IO callback. Eg: | ||
62 | static void hecubafb_dpy_deferred_io(struct fb_info *info, | ||
63 | struct list_head *pagelist) | ||
64 | |||
65 | The deferred_io callback is where you would perform all your IO to the display | ||
66 | device. You receive the pagelist which is the list of pages that were written | ||
67 | to during the delay. You must not modify this list. This callback is called | ||
68 | from a workqueue. | ||
69 | |||
70 | 3. Call init | ||
71 | info->fbdefio = &hecubafb_defio; | ||
72 | fb_deferred_io_init(info); | ||
73 | |||
74 | 4. Call cleanup | ||
75 | fb_deferred_io_cleanup(info); | ||
diff --git a/Documentation/fb/s3fb.txt b/Documentation/fb/s3fb.txt index 8a04c0da0c91..2c97770bdbaa 100644 --- a/Documentation/fb/s3fb.txt +++ b/Documentation/fb/s3fb.txt | |||
@@ -35,10 +35,12 @@ Supported Features | |||
35 | * suspend/resume support | 35 | * suspend/resume support |
36 | * DPMS support | 36 | * DPMS support |
37 | 37 | ||
38 | Text mode is supported even in higher resolutions, but there is limitation | 38 | Text mode is supported even in higher resolutions, but there is limitation to |
39 | to lower pixclocks (maximum between 50-60 MHz, depending on specific hardware). | 39 | lower pixclocks (maximum usually between 50-60 MHz, depending on specific |
40 | This limitation is not enforced by driver. Text mode supports 8bit wide fonts | 40 | hardware, i get best results from plain S3 Trio32 card - about 75 MHz). This |
41 | only (hardware limitation) and 16bit tall fonts (driver limitation). | 41 | limitation is not enforced by driver. Text mode supports 8bit wide fonts only |
42 | (hardware limitation) and 16bit tall fonts (driver limitation). Text mode | ||
43 | support is broken on S3 Trio64 V2/DX. | ||
42 | 44 | ||
43 | There are two 4 bpp modes. First mode (selected if nonstd == 0) is mode with | 45 | There are two 4 bpp modes. First mode (selected if nonstd == 0) is mode with |
44 | packed pixels, high nibble first. Second mode (selected if nonstd == 1) is mode | 46 | packed pixels, high nibble first. Second mode (selected if nonstd == 1) is mode |
@@ -73,6 +75,8 @@ Known bugs | |||
73 | ========== | 75 | ========== |
74 | 76 | ||
75 | * cursor disable in text mode doesn't work | 77 | * cursor disable in text mode doesn't work |
78 | * text mode broken on S3 Trio64 V2/DX | ||
79 | |||
76 | 80 | ||
77 | -- | 81 | -- |
78 | Ondrej Zajicek <santiago@crfreenet.org> | 82 | Ondrej Zajicek <santiago@crfreenet.org> |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 5f96cb33743e..2291ff620d93 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -6,6 +6,14 @@ be removed from this file. | |||
6 | 6 | ||
7 | --------------------------- | 7 | --------------------------- |
8 | 8 | ||
9 | What: MXSER | ||
10 | When: December 2007 | ||
11 | Why: Old mxser driver is obsoleted by the mxser_new. Give it some time yet | ||
12 | and remove it. | ||
13 | Who: Jiri Slaby <jirislaby@gmail.com> | ||
14 | |||
15 | --------------------------- | ||
16 | |||
9 | What: V4L2 VIDIOC_G_MPEGCOMP and VIDIOC_S_MPEGCOMP | 17 | What: V4L2 VIDIOC_G_MPEGCOMP and VIDIOC_S_MPEGCOMP |
10 | When: October 2007 | 18 | When: October 2007 |
11 | Why: Broken attempt to set MPEG compression parameters. These ioctls are | 19 | Why: Broken attempt to set MPEG compression parameters. These ioctls are |
@@ -117,18 +125,6 @@ Who: Adrian Bunk <bunk@stusta.de> | |||
117 | 125 | ||
118 | --------------------------- | 126 | --------------------------- |
119 | 127 | ||
120 | What: Usage of invalid timevals in setitimer | ||
121 | When: March 2007 | ||
122 | Why: POSIX requires to validate timevals in the setitimer call. This | ||
123 | was never done by Linux. The invalid (e.g. negative timevals) were | ||
124 | silently converted to more or less random timeouts and intervals. | ||
125 | Until the removal a per boot limited number of warnings is printed | ||
126 | and the timevals are sanitized. | ||
127 | |||
128 | Who: Thomas Gleixner <tglx@linutronix.de> | ||
129 | |||
130 | --------------------------- | ||
131 | |||
132 | What: Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports | 128 | What: Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports |
133 | (temporary transition config option provided until then) | 129 | (temporary transition config option provided until then) |
134 | The transition config option will also be removed at the same time. | 130 | The transition config option will also be removed at the same time. |
@@ -156,7 +152,7 @@ Who: Greg Kroah-Hartman <gregkh@suse.de> | |||
156 | --------------------------- | 152 | --------------------------- |
157 | 153 | ||
158 | What: Interrupt only SA_* flags | 154 | What: Interrupt only SA_* flags |
159 | When: Januar 2007 | 155 | When: September 2007 |
160 | Why: The interrupt related SA_* flags are replaced by IRQF_* to move them | 156 | Why: The interrupt related SA_* flags are replaced by IRQF_* to move them |
161 | out of the signal namespace. | 157 | out of the signal namespace. |
162 | 158 | ||
@@ -323,3 +319,11 @@ Why: Obsolete. The new i2c-gpio driver replaces all hardware-specific | |||
323 | Who: Jean Delvare <khali@linux-fr.org> | 319 | Who: Jean Delvare <khali@linux-fr.org> |
324 | 320 | ||
325 | --------------------------- | 321 | --------------------------- |
322 | |||
323 | What: drivers depending on OSS_OBSOLETE | ||
324 | When: options in 2.6.23, code in 2.6.25 | ||
325 | Why: obsolete OSS drivers | ||
326 | Who: Adrian Bunk <bunk@stusta.de> | ||
327 | |||
328 | --------------------------- | ||
329 | |||
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 28bfea75bcf2..59c14159cc47 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -15,6 +15,7 @@ prototypes: | |||
15 | int (*d_delete)(struct dentry *); | 15 | int (*d_delete)(struct dentry *); |
16 | void (*d_release)(struct dentry *); | 16 | void (*d_release)(struct dentry *); |
17 | void (*d_iput)(struct dentry *, struct inode *); | 17 | void (*d_iput)(struct dentry *, struct inode *); |
18 | char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen); | ||
18 | 19 | ||
19 | locking rules: | 20 | locking rules: |
20 | none have BKL | 21 | none have BKL |
@@ -25,6 +26,7 @@ d_compare: no yes no no | |||
25 | d_delete: yes no yes no | 26 | d_delete: yes no yes no |
26 | d_release: no no no yes | 27 | d_release: no no no yes |
27 | d_iput: no no no yes | 28 | d_iput: no no no yes |
29 | d_dname: no no no no | ||
28 | 30 | ||
29 | --------------------------- inode_operations --------------------------- | 31 | --------------------------- inode_operations --------------------------- |
30 | prototypes: | 32 | prototypes: |
diff --git a/Documentation/filesystems/jfs.txt b/Documentation/filesystems/jfs.txt index bae128663748..26ebde77e821 100644 --- a/Documentation/filesystems/jfs.txt +++ b/Documentation/filesystems/jfs.txt | |||
@@ -29,7 +29,13 @@ errors=continue Keep going on a filesystem error. | |||
29 | errors=remount-ro Default. Remount the filesystem read-only on an error. | 29 | errors=remount-ro Default. Remount the filesystem read-only on an error. |
30 | errors=panic Panic and halt the machine if an error occurs. | 30 | errors=panic Panic and halt the machine if an error occurs. |
31 | 31 | ||
32 | Please send bugs, comments, cards and letters to shaggy@austin.ibm.com. | 32 | uid=value Override on-disk uid with specified value |
33 | gid=value Override on-disk gid with specified value | ||
34 | umask=value Override on-disk umask with specified octal value. For | ||
35 | directories, the execute bit will be set if the corresponding | ||
36 | read bit is set. | ||
37 | |||
38 | Please send bugs, comments, cards and letters to shaggy@linux.vnet.ibm.com. | ||
33 | 39 | ||
34 | The JFS mailing list can be subscribed to by using the link labeled | 40 | The JFS mailing list can be subscribed to by using the link labeled |
35 | "Mail list Subscribe" at our web page http://jfs.sourceforge.net/ | 41 | "Mail list Subscribe" at our web page http://jfs.sourceforge.net/ |
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 3f4b226572e7..4f3e84c520a5 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -1138,6 +1138,13 @@ determine whether or not they are still functioning properly. | |||
1138 | Because the NMI watchdog shares registers with oprofile, by disabling the NMI | 1138 | Because the NMI watchdog shares registers with oprofile, by disabling the NMI |
1139 | watchdog, oprofile may have more registers to utilize. | 1139 | watchdog, oprofile may have more registers to utilize. |
1140 | 1140 | ||
1141 | maps_protect | ||
1142 | ------------ | ||
1143 | |||
1144 | Enables/Disables the protection of the per-process proc entries "maps" and | ||
1145 | "smaps". When enabled, the contents of these files are visible only to | ||
1146 | readers that are allowed to ptrace() the given process. | ||
1147 | |||
1141 | 1148 | ||
1142 | 2.4 /proc/sys/vm - The virtual memory subsystem | 1149 | 2.4 /proc/sys/vm - The virtual memory subsystem |
1143 | ----------------------------------------------- | 1150 | ----------------------------------------------- |
diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt index 069cb1094300..fcc123ffa252 100644 --- a/Documentation/filesystems/vfat.txt +++ b/Documentation/filesystems/vfat.txt | |||
@@ -57,6 +57,13 @@ nonumtail=<bool> -- When creating 8.3 aliases, normally the alias will | |||
57 | currently exist in the directory, 'longfile.txt' will | 57 | currently exist in the directory, 'longfile.txt' will |
58 | be the short alias instead of 'longfi~1.txt'. | 58 | be the short alias instead of 'longfi~1.txt'. |
59 | 59 | ||
60 | usefree -- Use the "free clusters" value stored on FSINFO. It'll | ||
61 | be used to determine number of free clusters without | ||
62 | scanning disk. But it's not used by default, because | ||
63 | recent Windows don't update it correctly in some | ||
64 | case. If you are sure the "free clusters" on FSINFO is | ||
65 | correct, by this option you can avoid scanning disk. | ||
66 | |||
60 | quiet -- Stops printing certain warning messages. | 67 | quiet -- Stops printing certain warning messages. |
61 | 68 | ||
62 | check=s|r|n -- Case sensitivity checking setting. | 69 | check=s|r|n -- Case sensitivity checking setting. |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index ea271f2d3954..a47cc819f37b 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -827,7 +827,7 @@ This describes how a filesystem can overload the standard dentry | |||
827 | operations. Dentries and the dcache are the domain of the VFS and the | 827 | operations. Dentries and the dcache are the domain of the VFS and the |
828 | individual filesystem implementations. Device drivers have no business | 828 | individual filesystem implementations. Device drivers have no business |
829 | here. These methods may be set to NULL, as they are either optional or | 829 | here. These methods may be set to NULL, as they are either optional or |
830 | the VFS uses a default. As of kernel 2.6.13, the following members are | 830 | the VFS uses a default. As of kernel 2.6.22, the following members are |
831 | defined: | 831 | defined: |
832 | 832 | ||
833 | struct dentry_operations { | 833 | struct dentry_operations { |
@@ -837,6 +837,7 @@ struct dentry_operations { | |||
837 | int (*d_delete)(struct dentry *); | 837 | int (*d_delete)(struct dentry *); |
838 | void (*d_release)(struct dentry *); | 838 | void (*d_release)(struct dentry *); |
839 | void (*d_iput)(struct dentry *, struct inode *); | 839 | void (*d_iput)(struct dentry *, struct inode *); |
840 | char *(*d_dname)(struct dentry *, char *, int); | ||
840 | }; | 841 | }; |
841 | 842 | ||
842 | d_revalidate: called when the VFS needs to revalidate a dentry. This | 843 | d_revalidate: called when the VFS needs to revalidate a dentry. This |
@@ -859,6 +860,26 @@ struct dentry_operations { | |||
859 | VFS calls iput(). If you define this method, you must call | 860 | VFS calls iput(). If you define this method, you must call |
860 | iput() yourself | 861 | iput() yourself |
861 | 862 | ||
863 | d_dname: called when the pathname of a dentry should be generated. | ||
864 | Usefull for some pseudo filesystems (sockfs, pipefs, ...) to delay | ||
865 | pathname generation. (Instead of doing it when dentry is created, | ||
866 | its done only when the path is needed.). Real filesystems probably | ||
867 | dont want to use it, because their dentries are present in global | ||
868 | dcache hash, so their hash should be an invariant. As no lock is | ||
869 | held, d_dname() should not try to modify the dentry itself, unless | ||
870 | appropriate SMP safety is used. CAUTION : d_path() logic is quite | ||
871 | tricky. The correct way to return for example "Hello" is to put it | ||
872 | at the end of the buffer, and returns a pointer to the first char. | ||
873 | dynamic_dname() helper function is provided to take care of this. | ||
874 | |||
875 | Example : | ||
876 | |||
877 | static char *pipefs_dname(struct dentry *dent, char *buffer, int buflen) | ||
878 | { | ||
879 | return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]", | ||
880 | dentry->d_inode->i_ino); | ||
881 | } | ||
882 | |||
862 | Each dentry has a pointer to its parent dentry, as well as a hash list | 883 | Each dentry has a pointer to its parent dentry, as well as a hash list |
863 | of child dentries. Child dentries are basically like files in a | 884 | of child dentries. Child dentries are basically like files in a |
864 | directory. | 885 | directory. |
diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt index 8f750c0efed5..3de7d379cf07 100644 --- a/Documentation/ioctl-number.txt +++ b/Documentation/ioctl-number.txt | |||
@@ -138,7 +138,8 @@ Code Seq# Include File Comments | |||
138 | 'm' 00-1F net/irda/irmod.h conflict! | 138 | 'm' 00-1F net/irda/irmod.h conflict! |
139 | 'n' 00-7F linux/ncp_fs.h | 139 | 'n' 00-7F linux/ncp_fs.h |
140 | 'n' E0-FF video/matrox.h matroxfb | 140 | 'n' E0-FF video/matrox.h matroxfb |
141 | 'p' 00-3F linux/mc146818rtc.h | 141 | 'p' 00-0F linux/phantom.h conflict! (OpenHaptics needs this) |
142 | 'p' 00-3F linux/mc146818rtc.h conflict! | ||
142 | 'p' 40-7F linux/nvram.h | 143 | 'p' 40-7F linux/nvram.h |
143 | 'p' 80-9F user-space parport | 144 | 'p' 80-9F user-space parport |
144 | <mailto:tim@cyberelk.net> | 145 | <mailto:tim@cyberelk.net> |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 38d7db3262c7..6b8ad06846c4 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -496,6 +496,30 @@ and is between 256 and 4096 characters. It is defined in the file | |||
496 | Format: <area>[,<node>] | 496 | Format: <area>[,<node>] |
497 | See also Documentation/networking/decnet.txt. | 497 | See also Documentation/networking/decnet.txt. |
498 | 498 | ||
499 | default_blu= [VT] | ||
500 | Format: <blue0>,<blue1>,<blue2>,...,<blue15> | ||
501 | Change the default blue palette of the console. | ||
502 | This is a 16-member array composed of values | ||
503 | ranging from 0-255. | ||
504 | |||
505 | default_grn= [VT] | ||
506 | Format: <green0>,<green1>,<green2>,...,<green15> | ||
507 | Change the default green palette of the console. | ||
508 | This is a 16-member array composed of values | ||
509 | ranging from 0-255. | ||
510 | |||
511 | default_red= [VT] | ||
512 | Format: <red0>,<red1>,<red2>,...,<red15> | ||
513 | Change the default red palette of the console. | ||
514 | This is a 16-member array composed of values | ||
515 | ranging from 0-255. | ||
516 | |||
517 | default_utf8= [VT] | ||
518 | Format=<0|1> | ||
519 | Set system-wide default UTF-8 mode for all tty's. | ||
520 | Default is 0 and by setting to 1, it enables UTF-8 | ||
521 | mode for all newly opened or allocated terminals. | ||
522 | |||
499 | dhash_entries= [KNL] | 523 | dhash_entries= [KNL] |
500 | Set number of hash buckets for dentry cache. | 524 | Set number of hash buckets for dentry cache. |
501 | 525 | ||
@@ -816,6 +840,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
816 | lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip | 840 | lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip |
817 | Format: addr:<io>,irq:<irq> | 841 | Format: addr:<io>,irq:<irq> |
818 | 842 | ||
843 | legacy_serial.force [HW,IA-32,X86-64] | ||
844 | Probe for COM ports at legacy addresses even | ||
845 | if PNPBIOS or ACPI should describe them. This | ||
846 | is for working around firmware defects. | ||
847 | |||
819 | llsc*= [IA64] See function print_params() in | 848 | llsc*= [IA64] See function print_params() in |
820 | arch/ia64/sn/kernel/llsc4.c. | 849 | arch/ia64/sn/kernel/llsc4.c. |
821 | 850 | ||
@@ -1578,6 +1607,17 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1578 | smp-alt-once [IA-32,SMP] On a hotplug CPU system, only | 1607 | smp-alt-once [IA-32,SMP] On a hotplug CPU system, only |
1579 | attempt to substitute SMP alternatives once at boot. | 1608 | attempt to substitute SMP alternatives once at boot. |
1580 | 1609 | ||
1610 | smsc-ircc2.nopnp [HW] Don't use PNP to discover SMC devices | ||
1611 | smsc-ircc2.ircc_cfg= [HW] Device configuration I/O port | ||
1612 | smsc-ircc2.ircc_sir= [HW] SIR base I/O port | ||
1613 | smsc-ircc2.ircc_fir= [HW] FIR base I/O port | ||
1614 | smsc-ircc2.ircc_irq= [HW] IRQ line | ||
1615 | smsc-ircc2.ircc_dma= [HW] DMA channel | ||
1616 | smsc-ircc2.ircc_transceiver= [HW] Transceiver type: | ||
1617 | 0: Toshiba Satellite 1800 (GP data pin select) | ||
1618 | 1: Fast pin select (default) | ||
1619 | 2: ATC IRMode | ||
1620 | |||
1581 | snd-ad1816a= [HW,ALSA] | 1621 | snd-ad1816a= [HW,ALSA] |
1582 | 1622 | ||
1583 | snd-ad1848= [HW,ALSA] | 1623 | snd-ad1848= [HW,ALSA] |
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt index d71fafffce90..da5404ab7569 100644 --- a/Documentation/kprobes.txt +++ b/Documentation/kprobes.txt | |||
@@ -14,6 +14,7 @@ CONTENTS | |||
14 | 8. Kprobes Example | 14 | 8. Kprobes Example |
15 | 9. Jprobes Example | 15 | 9. Jprobes Example |
16 | 10. Kretprobes Example | 16 | 10. Kretprobes Example |
17 | Appendix A: The kprobes debugfs interface | ||
17 | 18 | ||
18 | 1. Concepts: Kprobes, Jprobes, Return Probes | 19 | 1. Concepts: Kprobes, Jprobes, Return Probes |
19 | 20 | ||
@@ -349,9 +350,12 @@ for instrumentation and error reporting.) | |||
349 | 350 | ||
350 | If the number of times a function is called does not match the number | 351 | If the number of times a function is called does not match the number |
351 | of times it returns, registering a return probe on that function may | 352 | of times it returns, registering a return probe on that function may |
352 | produce undesirable results. We have the do_exit() case covered. | 353 | produce undesirable results. In such a case, a line: |
353 | do_execve() and do_fork() are not an issue. We're unaware of other | 354 | kretprobe BUG!: Processing kretprobe d000000000041aa8 @ c00000000004f48c |
354 | specific cases where this could be a problem. | 355 | gets printed. With this information, one will be able to correlate the |
356 | exact instance of the kretprobe that caused the problem. We have the | ||
357 | do_exit() case covered. do_execve() and do_fork() are not an issue. | ||
358 | We're unaware of other specific cases where this could be a problem. | ||
355 | 359 | ||
356 | If, upon entry to or exit from a function, the CPU is running on | 360 | If, upon entry to or exit from a function, the CPU is running on |
357 | a stack other than that of the current task, registering a return | 361 | a stack other than that of the current task, registering a return |
@@ -614,3 +618,27 @@ http://www-106.ibm.com/developerworks/library/l-kprobes.html?ca=dgr-lnxw42Kprobe | |||
614 | http://www.redhat.com/magazine/005mar05/features/kprobes/ | 618 | http://www.redhat.com/magazine/005mar05/features/kprobes/ |
615 | http://www-users.cs.umn.edu/~boutcher/kprobes/ | 619 | http://www-users.cs.umn.edu/~boutcher/kprobes/ |
616 | http://www.linuxsymposium.org/2006/linuxsymposium_procv2.pdf (pages 101-115) | 620 | http://www.linuxsymposium.org/2006/linuxsymposium_procv2.pdf (pages 101-115) |
621 | |||
622 | |||
623 | Appendix A: The kprobes debugfs interface | ||
624 | |||
625 | With recent kernels (> 2.6.20) the list of registered kprobes is visible | ||
626 | under the /debug/kprobes/ directory (assuming debugfs is mounted at /debug). | ||
627 | |||
628 | /debug/kprobes/list: Lists all registered probes on the system | ||
629 | |||
630 | c015d71a k vfs_read+0x0 | ||
631 | c011a316 j do_fork+0x0 | ||
632 | c03dedc5 r tcp_v4_rcv+0x0 | ||
633 | |||
634 | The first column provides the kernel address where the probe is inserted. | ||
635 | The second column identifies the type of probe (k - kprobe, r - kretprobe | ||
636 | and j - jprobe), while the third column specifies the symbol+offset of | ||
637 | the probe. If the probed function belongs to a module, the module name | ||
638 | is also specified. | ||
639 | |||
640 | /debug/kprobes/enabled: Turn kprobes ON/OFF | ||
641 | |||
642 | Provides a knob to globally turn registered kprobes ON or OFF. By default, | ||
643 | all kprobes are enabled. By echoing "0" to this file, all registered probes | ||
644 | will be disarmed, till such time a "1" is echoed to this file. | ||
diff --git a/Documentation/laptop-mode.txt b/Documentation/laptop-mode.txt index 6f639e3473af..eeedee11c8c2 100644 --- a/Documentation/laptop-mode.txt +++ b/Documentation/laptop-mode.txt | |||
@@ -33,7 +33,7 @@ or anything. Simply install all the files included in this document, and | |||
33 | laptop mode will automatically be started when you're on battery. For | 33 | laptop mode will automatically be started when you're on battery. For |
34 | your convenience, a tarball containing an installer can be downloaded at: | 34 | your convenience, a tarball containing an installer can be downloaded at: |
35 | 35 | ||
36 | http://www.xs4all.nl/~bsamwel/laptop_mode/tools/ | 36 | http://www.samwel.tk/laptop_mode/laptop_mode/ |
37 | 37 | ||
38 | To configure laptop mode, you need to edit the configuration file, which is | 38 | To configure laptop mode, you need to edit the configuration file, which is |
39 | located in /etc/default/laptop-mode on Debian-based systems, or in | 39 | located in /etc/default/laptop-mode on Debian-based systems, or in |
diff --git a/Documentation/oops-tracing.txt b/Documentation/oops-tracing.txt index ea55ea8bc8ef..7d5b60dea551 100644 --- a/Documentation/oops-tracing.txt +++ b/Documentation/oops-tracing.txt | |||
@@ -234,9 +234,6 @@ characters, each representing a particular tainted value. | |||
234 | 6: 'B' if a page-release function has found a bad page reference or | 234 | 6: 'B' if a page-release function has found a bad page reference or |
235 | some unexpected page flags. | 235 | some unexpected page flags. |
236 | 236 | ||
237 | 7: 'U' if a user specifically requested that the Tainted flag be set, | ||
238 | ' ' otherwise. | ||
239 | |||
240 | 7: 'U' if a user or user application specifically requested that the | 237 | 7: 'U' if a user or user application specifically requested that the |
241 | Tainted flag be set, ' ' otherwise. | 238 | Tainted flag be set, ' ' otherwise. |
242 | 239 | ||
diff --git a/Documentation/power/basic-pm-debugging.txt b/Documentation/power/basic-pm-debugging.txt new file mode 100644 index 000000000000..1a85e2b964dc --- /dev/null +++ b/Documentation/power/basic-pm-debugging.txt | |||
@@ -0,0 +1,106 @@ | |||
1 | Debugging suspend and resume | ||
2 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL | ||
3 | |||
4 | 1. Testing suspend to disk (STD) | ||
5 | |||
6 | To verify that the STD works, you can try to suspend in the "reboot" mode: | ||
7 | |||
8 | # echo reboot > /sys/power/disk | ||
9 | # echo disk > /sys/power/state | ||
10 | |||
11 | and the system should suspend, reboot, resume and get back to the command prompt | ||
12 | where you have started the transition. If that happens, the STD is most likely | ||
13 | to work correctly, but you need to repeat the test at least a couple of times in | ||
14 | a row for confidence. This is necessary, because some problems only show up on | ||
15 | a second attempt at suspending and resuming the system. You should also test | ||
16 | the "platform" and "shutdown" modes of suspend: | ||
17 | |||
18 | # echo platform > /sys/power/disk | ||
19 | # echo disk > /sys/power/state | ||
20 | |||
21 | or | ||
22 | |||
23 | # echo shutdown > /sys/power/disk | ||
24 | # echo disk > /sys/power/state | ||
25 | |||
26 | in which cases you will have to press the power button to make the system | ||
27 | resume. If that does not work, you will need to identify what goes wrong. | ||
28 | |||
29 | a) Test mode of STD | ||
30 | |||
31 | To verify if there are any drivers that cause problems you can run the STD | ||
32 | in the test mode: | ||
33 | |||
34 | # echo test > /sys/power/disk | ||
35 | # echo disk > /sys/power/state | ||
36 | |||
37 | in which case the system should freeze tasks, suspend devices, disable nonboot | ||
38 | CPUs (if any), wait for 5 seconds, enable nonboot CPUs, resume devices, thaw | ||
39 | tasks and return to your command prompt. If that fails, most likely there is | ||
40 | a driver that fails to either suspend or resume (in the latter case the system | ||
41 | may hang or be unstable after the test, so please take that into consideration). | ||
42 | To find this driver, you can carry out a binary search according to the rules: | ||
43 | - if the test fails, unload a half of the drivers currently loaded and repeat | ||
44 | (that would probably involve rebooting the system, so always note what drivers | ||
45 | have been loaded before the test), | ||
46 | - if the test succeeds, load a half of the drivers you have unloaded most | ||
47 | recently and repeat. | ||
48 | |||
49 | Once you have found the failing driver (there can be more than just one of | ||
50 | them), you have to unload it every time before the STD transition. In that case | ||
51 | please make sure to report the problem with the driver. | ||
52 | |||
53 | It is also possible that a cycle can still fail after you have unloaded | ||
54 | all modules. In that case, you would want to look in your kernel configuration | ||
55 | for the drivers that can be compiled as modules (testing again with them as | ||
56 | modules), and possibly also try boot time options such as "noapic" or "noacpi". | ||
57 | |||
58 | b) Testing minimal configuration | ||
59 | |||
60 | If the test mode of STD works, you can boot the system with "init=/bin/bash" | ||
61 | and attempt to suspend in the "reboot", "shutdown" and "platform" modes. If | ||
62 | that does not work, there probably is a problem with a driver statically | ||
63 | compiled into the kernel and you can try to compile more drivers as modules, | ||
64 | so that they can be tested individually. Otherwise, there is a problem with a | ||
65 | modular driver and you can find it by loading a half of the modules you normally | ||
66 | use and binary searching in accordance with the algorithm: | ||
67 | - if there are n modules loaded and the attempt to suspend and resume fails, | ||
68 | unload n/2 of the modules and try again (that would probably involve rebooting | ||
69 | the system), | ||
70 | - if there are n modules loaded and the attempt to suspend and resume succeeds, | ||
71 | load n/2 modules more and try again. | ||
72 | |||
73 | Again, if you find the offending module(s), it(they) must be unloaded every time | ||
74 | before the STD transition, and please report the problem with it(them). | ||
75 | |||
76 | c) Advanced debugging | ||
77 | |||
78 | In case the STD does not work on your system even in the minimal configuration | ||
79 | and compiling more drivers as modules is not practical or some modules cannot | ||
80 | be unloaded, you can use one of the more advanced debugging techniques to find | ||
81 | the problem. First, if there is a serial port in your box, you can set the | ||
82 | CONFIG_DISABLE_CONSOLE_SUSPEND kernel configuration option and try to log kernel | ||
83 | messages using the serial console. This may provide you with some information | ||
84 | about the reasons of the suspend (resume) failure. Alternatively, it may be | ||
85 | possible to use a FireWire port for debugging with firescope | ||
86 | (ftp://ftp.firstfloor.org/pub/ak/firescope/). On i386 it is also possible to | ||
87 | use the PM_TRACE mechanism documented in Documentation/s2ram.txt . | ||
88 | |||
89 | 2. Testing suspend to RAM (STR) | ||
90 | |||
91 | To verify that the STR works, it is generally more convenient to use the s2ram | ||
92 | tool available from http://suspend.sf.net and documented at | ||
93 | http://en.opensuse.org/s2ram . However, before doing that it is recommended to | ||
94 | carry out the procedure described in section 1. | ||
95 | |||
96 | Assume you have resolved the problems with the STD and you have found some | ||
97 | failing drivers. These drivers are also likely to fail during the STR or | ||
98 | during the resume, so it is better to unload them every time before the STR | ||
99 | transition. Now, you can follow the instructions at | ||
100 | http://en.opensuse.org/s2ram to test the system, but if it does not work | ||
101 | "out of the box", you may need to boot it with "init=/bin/bash" and test | ||
102 | s2ram in the minimal configuration. In that case, you may be able to search | ||
103 | for failing drivers by following the procedure analogous to the one described in | ||
104 | 1b). If you find some failing drivers, you will have to unload them every time | ||
105 | before the STR transition (ie. before you run s2ram), and please report the | ||
106 | problems with them. | ||
diff --git a/Documentation/power/drivers-testing.txt b/Documentation/power/drivers-testing.txt new file mode 100644 index 000000000000..33016c2f18dd --- /dev/null +++ b/Documentation/power/drivers-testing.txt | |||
@@ -0,0 +1,42 @@ | |||
1 | Testing suspend and resume support in device drivers | ||
2 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL | ||
3 | |||
4 | 1. Preparing the test system | ||
5 | |||
6 | Unfortunately, to effectively test the support for the system-wide suspend and | ||
7 | resume transitions in a driver, it is necessary to suspend and resume a fully | ||
8 | functional system with this driver loaded. Moreover, that should be done | ||
9 | several times, preferably several times in a row, and separately for the suspend | ||
10 | to disk (STD) and the suspend to RAM (STR) transitions, because each of these | ||
11 | cases involves different ordering of operations and different interactions with | ||
12 | the machine's BIOS. | ||
13 | |||
14 | Of course, for this purpose the test system has to be known to suspend and | ||
15 | resume without the driver being tested. Thus, if possible, you should first | ||
16 | resolve all suspend/resume-related problems in the test system before you start | ||
17 | testing the new driver. Please see Documents/power/basic-pm-debugging.txt for | ||
18 | more information about the debugging of suspend/resume functionality. | ||
19 | |||
20 | 2. Testing the driver | ||
21 | |||
22 | Once you have resolved the suspend/resume-related problems with your test system | ||
23 | without the new driver, you are ready to test it: | ||
24 | |||
25 | a) Build the driver as a module, load it and try the STD in the test mode (see: | ||
26 | Documents/power/basic-pm-debugging.txt, 1a)). | ||
27 | |||
28 | b) Load the driver and attempt to suspend to disk in the "reboot", "shutdown" | ||
29 | and "platform" modes (see: Documents/power/basic-pm-debugging.txt, 1). | ||
30 | |||
31 | c) Compile the driver directly into the kernel and try the STD in the test mode. | ||
32 | |||
33 | d) Attempt to suspend to disk with the driver compiled directly into the kernel | ||
34 | in the "reboot", "shutdown" and "platform" modes. | ||
35 | |||
36 | e) Attempt to suspend to RAM using the s2ram tool with the driver loaded (see: | ||
37 | Documents/power/basic-pm-debugging.txt, 2). As far as the STR tests are | ||
38 | concerned, it should not matter whether or not the driver is built as a module. | ||
39 | |||
40 | Each of the above tests should be repeated several times and the STD tests | ||
41 | should be mixed with the STR tests. If any of them fails, the driver cannot be | ||
42 | regarded as suspend/resume-safe. | ||
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt index 1ef6bb88cd00..7c701b88d6d5 100644 --- a/Documentation/rtc.txt +++ b/Documentation/rtc.txt | |||
@@ -147,7 +147,7 @@ RTC class framework, but can't be supported by the older driver. | |||
147 | 147 | ||
148 | * RTC_AIE_ON, RTC_AIE_OFF, RTC_ALM_SET, RTC_ALM_READ ... when the RTC | 148 | * RTC_AIE_ON, RTC_AIE_OFF, RTC_ALM_SET, RTC_ALM_READ ... when the RTC |
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. (Use RTC_WKALM_* by preference.) |
151 | 151 | ||
152 | * RTC_WKALM_SET, RTC_WKALM_RD ... 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 |
@@ -175,10 +175,7 @@ driver returns ENOIOCTLCMD. Some common examples: | |||
175 | called with appropriate values. | 175 | called with appropriate values. |
176 | 176 | ||
177 | * RTC_ALM_SET, RTC_ALM_READ, RTC_WKALM_SET, RTC_WKALM_RD: the | 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 | 178 | set_alarm/read_alarm functions will be called. |
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 | 179 | ||
183 | * RTC_IRQP_SET, RTC_IRQP_READ: the irq_set_freq function will be called | 180 | * 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 | 181 | to set the frequency while the framework will handle the read for you |
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary index ecc7c9eb9f29..795fbb48ffa7 100644 --- a/Documentation/spi/spi-summary +++ b/Documentation/spi/spi-summary | |||
@@ -8,7 +8,7 @@ What is SPI? | |||
8 | The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial | 8 | The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial |
9 | link used to connect microcontrollers to sensors, memory, and peripherals. | 9 | link used to connect microcontrollers to sensors, memory, and peripherals. |
10 | 10 | ||
11 | The three signal wires hold a clock (SCLK, often on the order of 10 MHz), | 11 | The three signal wires hold a clock (SCK, often on the order of 10 MHz), |
12 | and parallel data lines with "Master Out, Slave In" (MOSI) or "Master In, | 12 | and parallel data lines with "Master Out, Slave In" (MOSI) or "Master In, |
13 | Slave Out" (MISO) signals. (Other names are also used.) There are four | 13 | Slave Out" (MISO) signals. (Other names are also used.) There are four |
14 | clocking modes through which data is exchanged; mode-0 and mode-3 are most | 14 | clocking modes through which data is exchanged; mode-0 and mode-3 are most |
@@ -22,7 +22,7 @@ other signals, often including an interrupt to the master. | |||
22 | 22 | ||
23 | Unlike serial busses like USB or SMBUS, even low level protocols for | 23 | Unlike serial busses like USB or SMBUS, even low level protocols for |
24 | SPI slave functions are usually not interoperable between vendors | 24 | SPI slave functions are usually not interoperable between vendors |
25 | (except for cases like SPI memory chips). | 25 | (except for commodities like SPI memory chips). |
26 | 26 | ||
27 | - SPI may be used for request/response style device protocols, as with | 27 | - SPI may be used for request/response style device protocols, as with |
28 | touchscreen sensors and memory chips. | 28 | touchscreen sensors and memory chips. |
@@ -77,8 +77,9 @@ cards without needing a special purpose MMC/SD/SDIO controller. | |||
77 | How do these driver programming interfaces work? | 77 | How do these driver programming interfaces work? |
78 | ------------------------------------------------ | 78 | ------------------------------------------------ |
79 | The <linux/spi/spi.h> header file includes kerneldoc, as does the | 79 | The <linux/spi/spi.h> header file includes kerneldoc, as does the |
80 | main source code, and you should certainly read that. This is just | 80 | main source code, and you should certainly read that chapter of the |
81 | an overview, so you get the big picture before the details. | 81 | kernel API document. This is just an overview, so you get the big |
82 | picture before those details. | ||
82 | 83 | ||
83 | SPI requests always go into I/O queues. Requests for a given SPI device | 84 | SPI requests always go into I/O queues. Requests for a given SPI device |
84 | are always executed in FIFO order, and complete asynchronously through | 85 | are always executed in FIFO order, and complete asynchronously through |
@@ -88,7 +89,7 @@ a command and then reading its response. | |||
88 | 89 | ||
89 | There are two types of SPI driver, here called: | 90 | There are two types of SPI driver, here called: |
90 | 91 | ||
91 | Controller drivers ... these are often built in to System-On-Chip | 92 | Controller drivers ... controllers may be built in to System-On-Chip |
92 | processors, and often support both Master and Slave roles. | 93 | processors, and often support both Master and Slave roles. |
93 | These drivers touch hardware registers and may use DMA. | 94 | These drivers touch hardware registers and may use DMA. |
94 | Or they can be PIO bitbangers, needing just GPIO pins. | 95 | Or they can be PIO bitbangers, needing just GPIO pins. |
@@ -108,18 +109,18 @@ those two types of driver. At this writing, Linux has no slave side | |||
108 | programming interface. | 109 | programming interface. |
109 | 110 | ||
110 | There is a minimal core of SPI programming interfaces, focussing on | 111 | There is a minimal core of SPI programming interfaces, focussing on |
111 | using driver model to connect controller and protocol drivers using | 112 | using the driver model to connect controller and protocol drivers using |
112 | device tables provided by board specific initialization code. SPI | 113 | device tables provided by board specific initialization code. SPI |
113 | shows up in sysfs in several locations: | 114 | shows up in sysfs in several locations: |
114 | 115 | ||
115 | /sys/devices/.../CTLR/spiB.C ... spi_device for on bus "B", | 116 | /sys/devices/.../CTLR/spiB.C ... spi_device on bus "B", |
116 | chipselect C, accessed through CTLR. | 117 | chipselect C, accessed through CTLR. |
117 | 118 | ||
118 | /sys/devices/.../CTLR/spiB.C/modalias ... identifies the driver | 119 | /sys/devices/.../CTLR/spiB.C/modalias ... identifies the driver |
119 | that should be used with this device (for hotplug/coldplug) | 120 | that should be used with this device (for hotplug/coldplug) |
120 | 121 | ||
121 | /sys/bus/spi/devices/spiB.C ... symlink to the physical | 122 | /sys/bus/spi/devices/spiB.C ... symlink to the physical |
122 | spiB-C device | 123 | spiB.C device |
123 | 124 | ||
124 | /sys/bus/spi/drivers/D ... driver for one or more spi*.* devices | 125 | /sys/bus/spi/drivers/D ... driver for one or more spi*.* devices |
125 | 126 | ||
@@ -240,7 +241,7 @@ The board_info should provide enough information to let the system work | |||
240 | without the chip's driver being loaded. The most troublesome aspect of | 241 | without the chip's driver being loaded. The most troublesome aspect of |
241 | that is likely the SPI_CS_HIGH bit in the spi_device.mode field, since | 242 | that is likely the SPI_CS_HIGH bit in the spi_device.mode field, since |
242 | sharing a bus with a device that interprets chipselect "backwards" is | 243 | sharing a bus with a device that interprets chipselect "backwards" is |
243 | not possible. | 244 | not possible until the infrastructure knows how to deselect it. |
244 | 245 | ||
245 | Then your board initialization code would register that table with the SPI | 246 | Then your board initialization code would register that table with the SPI |
246 | infrastructure, so that it's available later when the SPI master controller | 247 | infrastructure, so that it's available later when the SPI master controller |
@@ -268,16 +269,14 @@ board info based on the board that was hotplugged. Of course, you'd later | |||
268 | call at least spi_unregister_device() when that board is removed. | 269 | call at least spi_unregister_device() when that board is removed. |
269 | 270 | ||
270 | When Linux includes support for MMC/SD/SDIO/DataFlash cards through SPI, those | 271 | When Linux includes support for MMC/SD/SDIO/DataFlash cards through SPI, those |
271 | configurations will also be dynamic. Fortunately, those devices all support | 272 | configurations will also be dynamic. Fortunately, such devices all support |
272 | basic device identification probes, so that support should hotplug normally. | 273 | basic device identification probes, so they should hotplug normally. |
273 | 274 | ||
274 | 275 | ||
275 | How do I write an "SPI Protocol Driver"? | 276 | How do I write an "SPI Protocol Driver"? |
276 | ---------------------------------------- | 277 | ---------------------------------------- |
277 | All SPI drivers are currently kernel drivers. A userspace driver API | 278 | Most SPI drivers are currently kernel drivers, but there's also support |
278 | would just be another kernel driver, probably offering some lowlevel | 279 | for userspace drivers. Here we talk only about kernel drivers. |
279 | access through aio_read(), aio_write(), and ioctl() calls and using the | ||
280 | standard userspace sysfs mechanisms to bind to a given SPI device. | ||
281 | 280 | ||
282 | SPI protocol drivers somewhat resemble platform device drivers: | 281 | SPI protocol drivers somewhat resemble platform device drivers: |
283 | 282 | ||
@@ -319,7 +318,8 @@ might look like this unless you're creating a class_device: | |||
319 | 318 | ||
320 | As soon as it enters probe(), the driver may issue I/O requests to | 319 | As soon as it enters probe(), the driver may issue I/O requests to |
321 | the SPI device using "struct spi_message". When remove() returns, | 320 | the SPI device using "struct spi_message". When remove() returns, |
322 | the driver guarantees that it won't submit any more such messages. | 321 | or after probe() fails, the driver guarantees that it won't submit |
322 | any more such messages. | ||
323 | 323 | ||
324 | - An spi_message is a sequence of protocol operations, executed | 324 | - An spi_message is a sequence of protocol operations, executed |
325 | as one atomic sequence. SPI driver controls include: | 325 | as one atomic sequence. SPI driver controls include: |
@@ -368,7 +368,8 @@ the driver guarantees that it won't submit any more such messages. | |||
368 | Some drivers may need to modify spi_device characteristics like the | 368 | Some drivers may need to modify spi_device characteristics like the |
369 | transfer mode, wordsize, or clock rate. This is done with spi_setup(), | 369 | transfer mode, wordsize, or clock rate. This is done with spi_setup(), |
370 | which would normally be called from probe() before the first I/O is | 370 | which would normally be called from probe() before the first I/O is |
371 | done to the device. | 371 | done to the device. However, that can also be called at any time |
372 | that no message is pending for that device. | ||
372 | 373 | ||
373 | While "spi_device" would be the bottom boundary of the driver, the | 374 | While "spi_device" would be the bottom boundary of the driver, the |
374 | upper boundaries might include sysfs (especially for sensor readings), | 375 | upper boundaries might include sysfs (especially for sensor readings), |
@@ -445,11 +446,15 @@ SPI MASTER METHODS | |||
445 | This sets up the device clock rate, SPI mode, and word sizes. | 446 | This sets up the device clock rate, SPI mode, and word sizes. |
446 | Drivers may change the defaults provided by board_info, and then | 447 | Drivers may change the defaults provided by board_info, and then |
447 | call spi_setup(spi) to invoke this routine. It may sleep. | 448 | call spi_setup(spi) to invoke this routine. It may sleep. |
449 | Unless each SPI slave has its own configuration registers, don't | ||
450 | change them right away ... otherwise drivers could corrupt I/O | ||
451 | that's in progress for other SPI devices. | ||
448 | 452 | ||
449 | master->transfer(struct spi_device *spi, struct spi_message *message) | 453 | master->transfer(struct spi_device *spi, struct spi_message *message) |
450 | This must not sleep. Its responsibility is arrange that the | 454 | This must not sleep. Its responsibility is arrange that the |
451 | transfer happens and its complete() callback is issued; the two | 455 | transfer happens and its complete() callback is issued. The two |
452 | will normally happen later, after other transfers complete. | 456 | will normally happen later, after other transfers complete, and |
457 | if the controller is idle it will need to be kickstarted. | ||
453 | 458 | ||
454 | master->cleanup(struct spi_device *spi) | 459 | master->cleanup(struct spi_device *spi) |
455 | Your controller driver may use spi_device.controller_state to hold | 460 | Your controller driver may use spi_device.controller_state to hold |
diff --git a/Documentation/spi/spidev b/Documentation/spi/spidev new file mode 100644 index 000000000000..5c8e1b988a08 --- /dev/null +++ b/Documentation/spi/spidev | |||
@@ -0,0 +1,307 @@ | |||
1 | SPI devices have a limited userspace API, supporting basic half-duplex | ||
2 | read() and write() access to SPI slave devices. Using ioctl() requests, | ||
3 | full duplex transfers and device I/O configuration are also available. | ||
4 | |||
5 | #include <fcntl.h> | ||
6 | #include <unistd.h> | ||
7 | #include <sys/ioctl.h> | ||
8 | #include <linux/types.h> | ||
9 | #include <linux/spi/spidev.h> | ||
10 | |||
11 | Some reasons you might want to use this programming interface include: | ||
12 | |||
13 | * Prototyping in an environment that's not crash-prone; stray pointers | ||
14 | in userspace won't normally bring down any Linux system. | ||
15 | |||
16 | * Developing simple protocols used to talk to microcontrollers acting | ||
17 | as SPI slaves, which you may need to change quite often. | ||
18 | |||
19 | Of course there are drivers that can never be written in userspace, because | ||
20 | they need to access kernel interfaces (such as IRQ handlers or other layers | ||
21 | of the driver stack) that are not accessible to userspace. | ||
22 | |||
23 | |||
24 | DEVICE CREATION, DRIVER BINDING | ||
25 | =============================== | ||
26 | The simplest way to arrange to use this driver is to just list it in the | ||
27 | spi_board_info for a device as the driver it should use: the "modalias" | ||
28 | entry is "spidev", matching the name of the driver exposing this API. | ||
29 | Set up the other device characteristics (bits per word, SPI clocking, | ||
30 | chipselect polarity, etc) as usual, so you won't always need to override | ||
31 | them later. | ||
32 | |||
33 | (Sysfs also supports userspace driven binding/unbinding of drivers to | ||
34 | devices. That mechanism might be supported here in the future.) | ||
35 | |||
36 | When you do that, the sysfs node for the SPI device will include a child | ||
37 | device node with a "dev" attribute that will be understood by udev or mdev. | ||
38 | (Larger systems will have "udev". Smaller ones may configure "mdev" into | ||
39 | busybox; it's less featureful, but often enough.) For a SPI device with | ||
40 | chipselect C on bus B, you should see: | ||
41 | |||
42 | /dev/spidevB.C ... character special device, major number 153 with | ||
43 | a dynamically chosen minor device number. This is the node | ||
44 | that userspace programs will open, created by "udev" or "mdev". | ||
45 | |||
46 | /sys/devices/.../spiB.C ... as usual, the SPI device node will | ||
47 | be a child of its SPI master controller. | ||
48 | |||
49 | /sys/class/spidev/spidevB.C ... created when the "spidev" driver | ||
50 | binds to that device. (Directory or symlink, based on whether | ||
51 | or not you enabled the "deprecated sysfs files" Kconfig option.) | ||
52 | |||
53 | Do not try to manage the /dev character device special file nodes by hand. | ||
54 | That's error prone, and you'd need to pay careful attention to system | ||
55 | security issues; udev/mdev should already be configured securely. | ||
56 | |||
57 | If you unbind the "spidev" driver from that device, those two "spidev" nodes | ||
58 | (in sysfs and in /dev) should automatically be removed (respectively by the | ||
59 | kernel and by udev/mdev). You can unbind by removing the "spidev" driver | ||
60 | module, which will affect all devices using this driver. You can also unbind | ||
61 | by having kernel code remove the SPI device, probably by removing the driver | ||
62 | for its SPI controller (so its spi_master vanishes). | ||
63 | |||
64 | Since this is a standard Linux device driver -- even though it just happens | ||
65 | to expose a low level API to userspace -- it can be associated with any number | ||
66 | of devices at a time. Just provide one spi_board_info record for each such | ||
67 | SPI device, and you'll get a /dev device node for each device. | ||
68 | |||
69 | |||
70 | BASIC CHARACTER DEVICE API | ||
71 | ========================== | ||
72 | Normal open() and close() operations on /dev/spidevB.D files work as you | ||
73 | would expect. | ||
74 | |||
75 | Standard read() and write() operations are obviously only half-duplex, and | ||
76 | the chipselect is deactivated between those operations. Full-duplex access, | ||
77 | and composite operation without chipselect de-activation, is available using | ||
78 | the SPI_IOC_MESSAGE(N) request. | ||
79 | |||
80 | Several ioctl() requests let your driver read or override the device's current | ||
81 | settings for data transfer parameters: | ||
82 | |||
83 | SPI_IOC_RD_MODE, SPI_IOC_WR_MODE ... pass a pointer to a byte which will | ||
84 | return (RD) or assign (WR) the SPI transfer mode. Use the constants | ||
85 | SPI_MODE_0..SPI_MODE_3; or if you prefer you can combine SPI_CPOL | ||
86 | (clock polarity, idle high iff this is set) or SPI_CPHA (clock phase, | ||
87 | sample on trailing edge iff this is set) flags. | ||
88 | |||
89 | SPI_IOC_RD_LSB_FIRST, SPI_IOC_WR_LSB_FIRST ... pass a pointer to a byte | ||
90 | which will return (RD) or assign (WR) the bit justification used to | ||
91 | transfer SPI words. Zero indicates MSB-first; other values indicate | ||
92 | the less common LSB-first encoding. In both cases the specified value | ||
93 | is right-justified in each word, so that unused (TX) or undefined (RX) | ||
94 | bits are in the MSBs. | ||
95 | |||
96 | SPI_IOC_RD_BITS_PER_WORD, SPI_IOC_WR_BITS_PER_WORD ... pass a pointer to | ||
97 | a byte which will return (RD) or assign (WR) the number of bits in | ||
98 | each SPI transfer word. The value zero signifies eight bits. | ||
99 | |||
100 | SPI_IOC_RD_MAX_SPEED_HZ, SPI_IOC_WR_MAX_SPEED_HZ ... pass a pointer to a | ||
101 | u32 which will return (RD) or assign (WR) the maximum SPI transfer | ||
102 | speed, in Hz. The controller can't necessarily assign that specific | ||
103 | clock speed. | ||
104 | |||
105 | NOTES: | ||
106 | |||
107 | - At this time there is no async I/O support; everything is purely | ||
108 | synchronous. | ||
109 | |||
110 | - There's currently no way to report the actual bit rate used to | ||
111 | shift data to/from a given device. | ||
112 | |||
113 | - From userspace, you can't currently change the chip select polarity; | ||
114 | that could corrupt transfers to other devices sharing the SPI bus. | ||
115 | Each SPI device is deselected when it's not in active use, allowing | ||
116 | other drivers to talk to other devices. | ||
117 | |||
118 | - There's a limit on the number of bytes each I/O request can transfer | ||
119 | to the SPI device. It defaults to one page, but that can be changed | ||
120 | using a module parameter. | ||
121 | |||
122 | - Because SPI has no low-level transfer acknowledgement, you usually | ||
123 | won't see any I/O errors when talking to a non-existent device. | ||
124 | |||
125 | |||
126 | FULL DUPLEX CHARACTER DEVICE API | ||
127 | ================================ | ||
128 | |||
129 | See the sample program below for one example showing the use of the full | ||
130 | duplex programming interface. (Although it doesn't perform a full duplex | ||
131 | transfer.) The model is the same as that used in the kernel spi_sync() | ||
132 | request; the individual transfers offer the same capabilities as are | ||
133 | available to kernel drivers (except that it's not asynchronous). | ||
134 | |||
135 | The example shows one half-duplex RPC-style request and response message. | ||
136 | These requests commonly require that the chip not be deselected between | ||
137 | the request and response. Several such requests could be chained into | ||
138 | a single kernel request, even allowing the chip to be deselected after | ||
139 | each response. (Other protocol options include changing the word size | ||
140 | and bitrate for each transfer segment.) | ||
141 | |||
142 | To make a full duplex request, provide both rx_buf and tx_buf for the | ||
143 | same transfer. It's even OK if those are the same buffer. | ||
144 | |||
145 | |||
146 | SAMPLE PROGRAM | ||
147 | ============== | ||
148 | |||
149 | -------------------------------- CUT HERE | ||
150 | #include <stdio.h> | ||
151 | #include <unistd.h> | ||
152 | #include <stdlib.h> | ||
153 | #include <fcntl.h> | ||
154 | #include <string.h> | ||
155 | |||
156 | #include <sys/ioctl.h> | ||
157 | #include <sys/types.h> | ||
158 | #include <sys/stat.h> | ||
159 | |||
160 | #include <linux/types.h> | ||
161 | #include <linux/spi/spidev.h> | ||
162 | |||
163 | |||
164 | static int verbose; | ||
165 | |||
166 | static void do_read(int fd, int len) | ||
167 | { | ||
168 | unsigned char buf[32], *bp; | ||
169 | int status; | ||
170 | |||
171 | /* read at least 2 bytes, no more than 32 */ | ||
172 | if (len < 2) | ||
173 | len = 2; | ||
174 | else if (len > sizeof(buf)) | ||
175 | len = sizeof(buf); | ||
176 | memset(buf, 0, sizeof buf); | ||
177 | |||
178 | status = read(fd, buf, len); | ||
179 | if (status < 0) { | ||
180 | perror("read"); | ||
181 | return; | ||
182 | } | ||
183 | if (status != len) { | ||
184 | fprintf(stderr, "short read\n"); | ||
185 | return; | ||
186 | } | ||
187 | |||
188 | printf("read(%2d, %2d): %02x %02x,", len, status, | ||
189 | buf[0], buf[1]); | ||
190 | status -= 2; | ||
191 | bp = buf + 2; | ||
192 | while (status-- > 0) | ||
193 | printf(" %02x", *bp++); | ||
194 | printf("\n"); | ||
195 | } | ||
196 | |||
197 | static void do_msg(int fd, int len) | ||
198 | { | ||
199 | struct spi_ioc_transfer xfer[2]; | ||
200 | unsigned char buf[32], *bp; | ||
201 | int status; | ||
202 | |||
203 | memset(xfer, 0, sizeof xfer); | ||
204 | memset(buf, 0, sizeof buf); | ||
205 | |||
206 | if (len > sizeof buf) | ||
207 | len = sizeof buf; | ||
208 | |||
209 | buf[0] = 0xaa; | ||
210 | xfer[0].tx_buf = (__u64) buf; | ||
211 | xfer[0].len = 1; | ||
212 | |||
213 | xfer[1].rx_buf = (__u64) buf; | ||
214 | xfer[1].len = len; | ||
215 | |||
216 | status = ioctl(fd, SPI_IOC_MESSAGE(2), xfer); | ||
217 | if (status < 0) { | ||
218 | perror("SPI_IOC_MESSAGE"); | ||
219 | return; | ||
220 | } | ||
221 | |||
222 | printf("response(%2d, %2d): ", len, status); | ||
223 | for (bp = buf; len; len--) | ||
224 | printf(" %02x", *bp++); | ||
225 | printf("\n"); | ||
226 | } | ||
227 | |||
228 | static void dumpstat(const char *name, int fd) | ||
229 | { | ||
230 | __u8 mode, lsb, bits; | ||
231 | __u32 speed; | ||
232 | |||
233 | if (ioctl(fd, SPI_IOC_RD_MODE, &mode) < 0) { | ||
234 | perror("SPI rd_mode"); | ||
235 | return; | ||
236 | } | ||
237 | if (ioctl(fd, SPI_IOC_RD_LSB_FIRST, &lsb) < 0) { | ||
238 | perror("SPI rd_lsb_fist"); | ||
239 | return; | ||
240 | } | ||
241 | if (ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0) { | ||
242 | perror("SPI bits_per_word"); | ||
243 | return; | ||
244 | } | ||
245 | if (ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) { | ||
246 | perror("SPI max_speed_hz"); | ||
247 | return; | ||
248 | } | ||
249 | |||
250 | printf("%s: spi mode %d, %d bits %sper word, %d Hz max\n", | ||
251 | name, mode, bits, lsb ? "(lsb first) " : "", speed); | ||
252 | } | ||
253 | |||
254 | int main(int argc, char **argv) | ||
255 | { | ||
256 | int c; | ||
257 | int readcount = 0; | ||
258 | int msglen = 0; | ||
259 | int fd; | ||
260 | const char *name; | ||
261 | |||
262 | while ((c = getopt(argc, argv, "hm:r:v")) != EOF) { | ||
263 | switch (c) { | ||
264 | case 'm': | ||
265 | msglen = atoi(optarg); | ||
266 | if (msglen < 0) | ||
267 | goto usage; | ||
268 | continue; | ||
269 | case 'r': | ||
270 | readcount = atoi(optarg); | ||
271 | if (readcount < 0) | ||
272 | goto usage; | ||
273 | continue; | ||
274 | case 'v': | ||
275 | verbose++; | ||
276 | continue; | ||
277 | case 'h': | ||
278 | case '?': | ||
279 | usage: | ||
280 | fprintf(stderr, | ||
281 | "usage: %s [-h] [-m N] [-r N] /dev/spidevB.D\n", | ||
282 | argv[0]); | ||
283 | return 1; | ||
284 | } | ||
285 | } | ||
286 | |||
287 | if ((optind + 1) != argc) | ||
288 | goto usage; | ||
289 | name = argv[optind]; | ||
290 | |||
291 | fd = open(name, O_RDWR); | ||
292 | if (fd < 0) { | ||
293 | perror("open"); | ||
294 | return 1; | ||
295 | } | ||
296 | |||
297 | dumpstat(name, fd); | ||
298 | |||
299 | if (msglen) | ||
300 | do_msg(fd, msglen); | ||
301 | |||
302 | if (readcount) | ||
303 | do_read(fd, readcount); | ||
304 | |||
305 | close(fd); | ||
306 | return 0; | ||
307 | } | ||
diff --git a/Documentation/tty.txt b/Documentation/tty.txt index 5f799e612e03..048a8762cfb5 100644 --- a/Documentation/tty.txt +++ b/Documentation/tty.txt | |||
@@ -108,7 +108,9 @@ hardware driver through the function pointers within the tty->driver | |||
108 | structure: | 108 | structure: |
109 | 109 | ||
110 | write() Write a block of characters to the tty device. | 110 | write() Write a block of characters to the tty device. |
111 | Returns the number of characters accepted. | 111 | Returns the number of characters accepted. The |
112 | character buffer passed to this method is already | ||
113 | in kernel space. | ||
112 | 114 | ||
113 | put_char() Queues a character for writing to the tty device. | 115 | put_char() Queues a character for writing to the tty device. |
114 | If there is no room in the queue, the character is | 116 | If there is no room in the queue, the character is |