diff options
Diffstat (limited to 'Documentation')
110 files changed, 4948 insertions, 1850 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index a1a643272883..2214f123a976 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -104,6 +104,8 @@ cpuidle/ | |||
104 | - info on CPU_IDLE, CPU idle state management subsystem. | 104 | - info on CPU_IDLE, CPU idle state management subsystem. |
105 | cputopology.txt | 105 | cputopology.txt |
106 | - documentation on how CPU topology info is exported via sysfs. | 106 | - documentation on how CPU topology info is exported via sysfs. |
107 | crc32.txt | ||
108 | - brief tutorial on CRC computation | ||
107 | cris/ | 109 | cris/ |
108 | - directory with info about Linux on CRIS architecture. | 110 | - directory with info about Linux on CRIS architecture. |
109 | crypto/ | 111 | crypto/ |
diff --git a/Documentation/ABI/testing/sysfs-block-dm b/Documentation/ABI/testing/sysfs-block-dm new file mode 100644 index 000000000000..87ca5691e29b --- /dev/null +++ b/Documentation/ABI/testing/sysfs-block-dm | |||
@@ -0,0 +1,25 @@ | |||
1 | What: /sys/block/dm-<num>/dm/name | ||
2 | Date: January 2009 | ||
3 | KernelVersion: 2.6.29 | ||
4 | Contact: dm-devel@redhat.com | ||
5 | Description: Device-mapper device name. | ||
6 | Read-only string containing mapped device name. | ||
7 | Users: util-linux, device-mapper udev rules | ||
8 | |||
9 | What: /sys/block/dm-<num>/dm/uuid | ||
10 | Date: January 2009 | ||
11 | KernelVersion: 2.6.29 | ||
12 | Contact: dm-devel@redhat.com | ||
13 | Description: Device-mapper device UUID. | ||
14 | Read-only string containing DM-UUID or empty string | ||
15 | if DM-UUID is not set. | ||
16 | Users: util-linux, device-mapper udev rules | ||
17 | |||
18 | What: /sys/block/dm-<num>/dm/suspended | ||
19 | Date: June 2009 | ||
20 | KernelVersion: 2.6.31 | ||
21 | Contact: dm-devel@redhat.com | ||
22 | Description: Device-mapper device suspend state. | ||
23 | Contains the value 1 while the device is suspended. | ||
24 | Otherwise it contains 0. Read-only attribute. | ||
25 | Users: util-linux, device-mapper udev rules | ||
diff --git a/Documentation/ABI/testing/sysfs-bus-rpmsg b/Documentation/ABI/testing/sysfs-bus-rpmsg new file mode 100644 index 000000000000..189e419a5a2d --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-rpmsg | |||
@@ -0,0 +1,75 @@ | |||
1 | What: /sys/bus/rpmsg/devices/.../name | ||
2 | Date: June 2011 | ||
3 | KernelVersion: 3.3 | ||
4 | Contact: Ohad Ben-Cohen <ohad@wizery.com> | ||
5 | Description: | ||
6 | Every rpmsg device is a communication channel with a remote | ||
7 | processor. Channels are identified with a (textual) name, | ||
8 | which is maximum 32 bytes long (defined as RPMSG_NAME_SIZE in | ||
9 | rpmsg.h). | ||
10 | |||
11 | This sysfs entry contains the name of this channel. | ||
12 | |||
13 | What: /sys/bus/rpmsg/devices/.../src | ||
14 | Date: June 2011 | ||
15 | KernelVersion: 3.3 | ||
16 | Contact: Ohad Ben-Cohen <ohad@wizery.com> | ||
17 | Description: | ||
18 | Every rpmsg device is a communication channel with a remote | ||
19 | processor. Channels have a local ("source") rpmsg address, | ||
20 | and remote ("destination") rpmsg address. When an entity | ||
21 | starts listening on one end of a channel, it assigns it with | ||
22 | a unique rpmsg address (a 32 bits integer). This way when | ||
23 | inbound messages arrive to this address, the rpmsg core | ||
24 | dispatches them to the listening entity (a kernel driver). | ||
25 | |||
26 | This sysfs entry contains the src (local) rpmsg address | ||
27 | of this channel. If it contains 0xffffffff, then an address | ||
28 | wasn't assigned (can happen if no driver exists for this | ||
29 | channel). | ||
30 | |||
31 | What: /sys/bus/rpmsg/devices/.../dst | ||
32 | Date: June 2011 | ||
33 | KernelVersion: 3.3 | ||
34 | Contact: Ohad Ben-Cohen <ohad@wizery.com> | ||
35 | Description: | ||
36 | Every rpmsg device is a communication channel with a remote | ||
37 | processor. Channels have a local ("source") rpmsg address, | ||
38 | and remote ("destination") rpmsg address. When an entity | ||
39 | starts listening on one end of a channel, it assigns it with | ||
40 | a unique rpmsg address (a 32 bits integer). This way when | ||
41 | inbound messages arrive to this address, the rpmsg core | ||
42 | dispatches them to the listening entity. | ||
43 | |||
44 | This sysfs entry contains the dst (remote) rpmsg address | ||
45 | of this channel. If it contains 0xffffffff, then an address | ||
46 | wasn't assigned (can happen if the kernel driver that | ||
47 | is attached to this channel is exposing a service to the | ||
48 | remote processor. This make it a local rpmsg server, | ||
49 | and it is listening for inbound messages that may be sent | ||
50 | from any remote rpmsg client; it is not bound to a single | ||
51 | remote entity). | ||
52 | |||
53 | What: /sys/bus/rpmsg/devices/.../announce | ||
54 | Date: June 2011 | ||
55 | KernelVersion: 3.3 | ||
56 | Contact: Ohad Ben-Cohen <ohad@wizery.com> | ||
57 | Description: | ||
58 | Every rpmsg device is a communication channel with a remote | ||
59 | processor. Channels are identified by a textual name (see | ||
60 | /sys/bus/rpmsg/devices/.../name above) and have a local | ||
61 | ("source") rpmsg address, and remote ("destination") rpmsg | ||
62 | address. | ||
63 | |||
64 | A channel is first created when an entity, whether local | ||
65 | or remote, starts listening on it for messages (and is thus | ||
66 | called an rpmsg server). | ||
67 | |||
68 | When that happens, a "name service" announcement is sent | ||
69 | to the other processor, in order to let it know about the | ||
70 | creation of the channel (this way remote clients know they | ||
71 | can start sending messages). | ||
72 | |||
73 | This sysfs entry tells us whether the channel is a local | ||
74 | server channel that is announced (values are either | ||
75 | true or false). | ||
diff --git a/Documentation/ABI/testing/sysfs-driver-samsung-laptop b/Documentation/ABI/testing/sysfs-driver-samsung-laptop index e82e7c2b8f80..678819a3f8bf 100644 --- a/Documentation/ABI/testing/sysfs-driver-samsung-laptop +++ b/Documentation/ABI/testing/sysfs-driver-samsung-laptop | |||
@@ -17,3 +17,21 @@ Description: Some Samsung laptops have different "performance levels" | |||
17 | Specifically, not all support the "overclock" option, | 17 | Specifically, not all support the "overclock" option, |
18 | and it's still unknown if this value even changes | 18 | and it's still unknown if this value even changes |
19 | anything, other than making the user feel a bit better. | 19 | anything, other than making the user feel a bit better. |
20 | |||
21 | What: /sys/devices/platform/samsung/battery_life_extender | ||
22 | Date: December 1, 2011 | ||
23 | KernelVersion: 3.3 | ||
24 | Contact: Corentin Chary <corentin.chary@gmail.com> | ||
25 | Description: Max battery charge level can be modified, battery cycle | ||
26 | life can be extended by reducing the max battery charge | ||
27 | level. | ||
28 | 0 means normal battery mode (100% charge) | ||
29 | 1 means battery life extender mode (80% charge) | ||
30 | |||
31 | What: /sys/devices/platform/samsung/usb_charge | ||
32 | Date: December 1, 2011 | ||
33 | KernelVersion: 3.3 | ||
34 | Contact: Corentin Chary <corentin.chary@gmail.com> | ||
35 | Description: Use your USB ports to charge devices, even | ||
36 | when your laptop is powered off. | ||
37 | 1 means enabled, 0 means disabled. | ||
diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-cleancache b/Documentation/ABI/testing/sysfs-kernel-mm-cleancache deleted file mode 100644 index 662ae646ea12..000000000000 --- a/Documentation/ABI/testing/sysfs-kernel-mm-cleancache +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | What: /sys/kernel/mm/cleancache/ | ||
2 | Date: April 2011 | ||
3 | Contact: Dan Magenheimer <dan.magenheimer@oracle.com> | ||
4 | Description: | ||
5 | /sys/kernel/mm/cleancache/ contains a number of files which | ||
6 | record a count of various cleancache operations | ||
7 | (sum across all filesystems): | ||
8 | succ_gets | ||
9 | failed_gets | ||
10 | puts | ||
11 | flushes | ||
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl index d71b57fcf116..4ee4ba3509fc 100644 --- a/Documentation/DocBook/kgdb.tmpl +++ b/Documentation/DocBook/kgdb.tmpl | |||
@@ -362,6 +362,23 @@ | |||
362 | </para> | 362 | </para> |
363 | </para> | 363 | </para> |
364 | </sect1> | 364 | </sect1> |
365 | <sect1 id="kgdbreboot"> | ||
366 | <title>Run time parameter: kgdbreboot</title> | ||
367 | <para> The kgdbreboot feature allows you to change how the debugger | ||
368 | deals with the reboot notification. You have 3 choices for the | ||
369 | behavior. The default behavior is always set to 0.</para> | ||
370 | <orderedlist> | ||
371 | <listitem><para>echo -1 > /sys/module/debug_core/parameters/kgdbreboot</para> | ||
372 | <para>Ignore the reboot notification entirely.</para> | ||
373 | </listitem> | ||
374 | <listitem><para>echo 0 > /sys/module/debug_core/parameters/kgdbreboot</para> | ||
375 | <para>Send the detach message to any attached debugger client.</para> | ||
376 | </listitem> | ||
377 | <listitem><para>echo 1 > /sys/module/debug_core/parameters/kgdbreboot</para> | ||
378 | <para>Enter the debugger on reboot notify.</para> | ||
379 | </listitem> | ||
380 | </orderedlist> | ||
381 | </sect1> | ||
365 | </chapter> | 382 | </chapter> |
366 | <chapter id="usingKDB"> | 383 | <chapter id="usingKDB"> |
367 | <title>Using kdb</title> | 384 | <title>Using kdb</title> |
diff --git a/Documentation/DocBook/media/v4l/biblio.xml b/Documentation/DocBook/media/v4l/biblio.xml index cea6fd3ed428..7dc65c592a87 100644 --- a/Documentation/DocBook/media/v4l/biblio.xml +++ b/Documentation/DocBook/media/v4l/biblio.xml | |||
@@ -128,6 +128,26 @@ url="http://www.ijg.org">http://www.ijg.org</ulink>)</corpauthor> | |||
128 | <subtitle>Version 1.02</subtitle> | 128 | <subtitle>Version 1.02</subtitle> |
129 | </biblioentry> | 129 | </biblioentry> |
130 | 130 | ||
131 | <biblioentry id="itu-t81"> | ||
132 | <abbrev>ITU-T.81</abbrev> | ||
133 | <authorgroup> | ||
134 | <corpauthor>International Telecommunication Union | ||
135 | (<ulink url="http://www.itu.int">http://www.itu.int</ulink>)</corpauthor> | ||
136 | </authorgroup> | ||
137 | <title>ITU-T Recommendation T.81 | ||
138 | "Information Technology — Digital Compression and Coding of Continous-Tone | ||
139 | Still Images — Requirements and Guidelines"</title> | ||
140 | </biblioentry> | ||
141 | |||
142 | <biblioentry id="w3c-jpeg-jfif"> | ||
143 | <abbrev>W3C JPEG JFIF</abbrev> | ||
144 | <authorgroup> | ||
145 | <corpauthor>The World Wide Web Consortium (<ulink | ||
146 | url="http://www.w3.org/Graphics/JPEG">http://www.w3.org</ulink>)</corpauthor> | ||
147 | </authorgroup> | ||
148 | <title>JPEG JFIF</title> | ||
149 | </biblioentry> | ||
150 | |||
131 | <biblioentry id="smpte12m"> | 151 | <biblioentry id="smpte12m"> |
132 | <abbrev>SMPTE 12M</abbrev> | 152 | <abbrev>SMPTE 12M</abbrev> |
133 | <authorgroup> | 153 | <authorgroup> |
diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index a2485b3ff3d2..bce97c50391b 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml | |||
@@ -2393,6 +2393,20 @@ details.</para> | |||
2393 | to the <link linkend="control">User controls class</link>. | 2393 | to the <link linkend="control">User controls class</link>. |
2394 | </para> | 2394 | </para> |
2395 | </listitem> | 2395 | </listitem> |
2396 | <listitem> | ||
2397 | <para>Added the device_caps field to struct v4l2_capabilities and added the new | ||
2398 | V4L2_CAP_DEVICE_CAPS capability.</para> | ||
2399 | </listitem> | ||
2400 | </orderedlist> | ||
2401 | </section> | ||
2402 | |||
2403 | <section> | ||
2404 | <title>V4L2 in Linux 3.4</title> | ||
2405 | <orderedlist> | ||
2406 | <listitem> | ||
2407 | <para>Added <link linkend="jpeg-controls">JPEG compression control | ||
2408 | class</link>.</para> | ||
2409 | </listitem> | ||
2396 | </orderedlist> | 2410 | </orderedlist> |
2397 | </section> | 2411 | </section> |
2398 | 2412 | ||
diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index a1be37897ad7..b84f25e9cc87 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml | |||
@@ -1286,6 +1286,49 @@ produce a slight hiss, but in the encoder itself, guaranteeing a fixed | |||
1286 | and reproducible audio bitstream. 0 = unmuted, 1 = muted.</entry> | 1286 | and reproducible audio bitstream. 0 = unmuted, 1 = muted.</entry> |
1287 | </row> | 1287 | </row> |
1288 | <row><entry></entry></row> | 1288 | <row><entry></entry></row> |
1289 | <row id="v4l2-mpeg-audio-dec-playback"> | ||
1290 | <entry spanname="id"><constant>V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK</constant> </entry> | ||
1291 | <entry>enum v4l2_mpeg_audio_dec_playback</entry> | ||
1292 | </row><row><entry spanname="descr">Determines how monolingual audio should be played back. | ||
1293 | Possible values are:</entry> | ||
1294 | </row> | ||
1295 | <row> | ||
1296 | <entrytbl spanname="descr" cols="2"> | ||
1297 | <tbody valign="top"> | ||
1298 | <row> | ||
1299 | <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO</constant> </entry> | ||
1300 | <entry>Automatically determines the best playback mode.</entry> | ||
1301 | </row> | ||
1302 | <row> | ||
1303 | <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO</constant> </entry> | ||
1304 | <entry>Stereo playback.</entry> | ||
1305 | </row> | ||
1306 | <row> | ||
1307 | <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT</constant> </entry> | ||
1308 | <entry>Left channel playback.</entry> | ||
1309 | </row> | ||
1310 | <row> | ||
1311 | <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT</constant> </entry> | ||
1312 | <entry>Right channel playback.</entry> | ||
1313 | </row> | ||
1314 | <row> | ||
1315 | <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO</constant> </entry> | ||
1316 | <entry>Mono playback.</entry> | ||
1317 | </row> | ||
1318 | <row> | ||
1319 | <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO</constant> </entry> | ||
1320 | <entry>Stereo playback with swapped left and right channels.</entry> | ||
1321 | </row> | ||
1322 | </tbody> | ||
1323 | </entrytbl> | ||
1324 | </row> | ||
1325 | <row><entry></entry></row> | ||
1326 | <row id="v4l2-mpeg-audio-dec-multilingual-playback"> | ||
1327 | <entry spanname="id"><constant>V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK</constant> </entry> | ||
1328 | <entry>enum v4l2_mpeg_audio_dec_playback</entry> | ||
1329 | </row><row><entry spanname="descr">Determines how multilingual audio should be played back.</entry> | ||
1330 | </row> | ||
1331 | <row><entry></entry></row> | ||
1289 | <row id="v4l2-mpeg-video-encoding"> | 1332 | <row id="v4l2-mpeg-video-encoding"> |
1290 | <entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_ENCODING</constant> </entry> | 1333 | <entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_ENCODING</constant> </entry> |
1291 | <entry>enum v4l2_mpeg_video_encoding</entry> | 1334 | <entry>enum v4l2_mpeg_video_encoding</entry> |
@@ -1447,6 +1490,22 @@ of the video. The supplied 32-bit integer is interpreted as follows (bit | |||
1447 | </tbody> | 1490 | </tbody> |
1448 | </entrytbl> | 1491 | </entrytbl> |
1449 | </row> | 1492 | </row> |
1493 | <row><entry></entry></row> | ||
1494 | <row id="v4l2-mpeg-video-dec-pts"> | ||
1495 | <entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_DEC_PTS</constant> </entry> | ||
1496 | <entry>integer64</entry> | ||
1497 | </row><row><entry spanname="descr">This read-only control returns the | ||
1498 | 33-bit video Presentation Time Stamp as defined in ITU T-REC-H.222.0 and ISO/IEC 13818-1 of | ||
1499 | the currently displayed frame. This is the same PTS as is used in &VIDIOC-DECODER-CMD;.</entry> | ||
1500 | </row> | ||
1501 | <row><entry></entry></row> | ||
1502 | <row id="v4l2-mpeg-video-dec-frame"> | ||
1503 | <entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_DEC_FRAME</constant> </entry> | ||
1504 | <entry>integer64</entry> | ||
1505 | </row><row><entry spanname="descr">This read-only control returns the | ||
1506 | frame counter of the frame that is currently displayed (decoded). This value is reset to 0 whenever | ||
1507 | the decoder is started.</entry> | ||
1508 | </row> | ||
1450 | 1509 | ||
1451 | 1510 | ||
1452 | <row><entry></entry></row> | 1511 | <row><entry></entry></row> |
@@ -3377,6 +3436,167 @@ interface and may change in the future.</para> | |||
3377 | </tbody> | 3436 | </tbody> |
3378 | </tgroup> | 3437 | </tgroup> |
3379 | </table> | 3438 | </table> |
3439 | </section> | ||
3440 | |||
3441 | <section id="jpeg-controls"> | ||
3442 | <title>JPEG Control Reference</title> | ||
3443 | <para>The JPEG class includes controls for common features of JPEG | ||
3444 | encoders and decoders. Currently it includes features for codecs | ||
3445 | implementing progressive baseline DCT compression process with | ||
3446 | Huffman entrophy coding.</para> | ||
3447 | <table pgwide="1" frame="none" id="jpeg-control-id"> | ||
3448 | <title>JPEG Control IDs</title> | ||
3380 | 3449 | ||
3450 | <tgroup cols="4"> | ||
3451 | <colspec colname="c1" colwidth="1*" /> | ||
3452 | <colspec colname="c2" colwidth="6*" /> | ||
3453 | <colspec colname="c3" colwidth="2*" /> | ||
3454 | <colspec colname="c4" colwidth="6*" /> | ||
3455 | <spanspec namest="c1" nameend="c2" spanname="id" /> | ||
3456 | <spanspec namest="c2" nameend="c4" spanname="descr" /> | ||
3457 | <thead> | ||
3458 | <row> | ||
3459 | <entry spanname="id" align="left">ID</entry> | ||
3460 | <entry align="left">Type</entry> | ||
3461 | </row><row rowsep="1"><entry spanname="descr" align="left">Description</entry> | ||
3462 | </row> | ||
3463 | </thead> | ||
3464 | <tbody valign="top"> | ||
3465 | <row><entry></entry></row> | ||
3466 | <row> | ||
3467 | <entry spanname="id"><constant>V4L2_CID_JPEG_CLASS</constant> </entry> | ||
3468 | <entry>class</entry> | ||
3469 | </row><row><entry spanname="descr">The JPEG class descriptor. Calling | ||
3470 | &VIDIOC-QUERYCTRL; for this control will return a description of this | ||
3471 | control class. | ||
3472 | |||
3473 | </entry> | ||
3474 | </row> | ||
3475 | <row> | ||
3476 | <entry spanname="id"><constant>V4L2_CID_JPEG_CHROMA_SUBSAMPLING</constant></entry> | ||
3477 | <entry>menu</entry> | ||
3478 | </row> | ||
3479 | <row id="jpeg-chroma-subsampling-control"> | ||
3480 | <entry spanname="descr">The chroma subsampling factors describe how | ||
3481 | each component of an input image is sampled, in respect to maximum | ||
3482 | sample rate in each spatial dimension. See <xref linkend="itu-t81"/>, | ||
3483 | clause A.1.1. for more details. The <constant> | ||
3484 | V4L2_CID_JPEG_CHROMA_SUBSAMPLING</constant> control determines how | ||
3485 | Cb and Cr components are downsampled after coverting an input image | ||
3486 | from RGB to Y'CbCr color space. | ||
3487 | </entry> | ||
3488 | </row> | ||
3489 | <row> | ||
3490 | <entrytbl spanname="descr" cols="2"> | ||
3491 | <tbody valign="top"> | ||
3492 | <row> | ||
3493 | <entry><constant>V4L2_JPEG_CHROMA_SUBSAMPLING_444</constant> | ||
3494 | </entry><entry>No chroma subsampling, each pixel has | ||
3495 | Y, Cr and Cb values.</entry> | ||
3496 | </row> | ||
3497 | <row> | ||
3498 | <entry><constant>V4L2_JPEG_CHROMA_SUBSAMPLING_422</constant> | ||
3499 | </entry><entry>Horizontally subsample Cr, Cb components | ||
3500 | by a factor of 2.</entry> | ||
3501 | </row> | ||
3502 | <row> | ||
3503 | <entry><constant>V4L2_JPEG_CHROMA_SUBSAMPLING_420</constant> | ||
3504 | </entry><entry>Subsample Cr, Cb components horizontally | ||
3505 | and vertically by 2.</entry> | ||
3506 | </row> | ||
3507 | <row> | ||
3508 | <entry><constant>V4L2_JPEG_CHROMA_SUBSAMPLING_411</constant> | ||
3509 | </entry><entry>Horizontally subsample Cr, Cb components | ||
3510 | by a factor of 4.</entry> | ||
3511 | </row> | ||
3512 | <row> | ||
3513 | <entry><constant>V4L2_JPEG_CHROMA_SUBSAMPLING_410</constant> | ||
3514 | </entry><entry>Subsample Cr, Cb components horizontally | ||
3515 | by 4 and vertically by 2.</entry> | ||
3516 | </row> | ||
3517 | <row> | ||
3518 | <entry><constant>V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY</constant> | ||
3519 | </entry><entry>Use only luminance component.</entry> | ||
3520 | </row> | ||
3521 | </tbody> | ||
3522 | </entrytbl> | ||
3523 | </row> | ||
3524 | <row> | ||
3525 | <entry spanname="id"><constant>V4L2_CID_JPEG_RESTART_INTERVAL</constant> | ||
3526 | </entry><entry>integer</entry> | ||
3527 | </row> | ||
3528 | <row><entry spanname="descr"> | ||
3529 | The restart interval determines an interval of inserting RSTm | ||
3530 | markers (m = 0..7). The purpose of these markers is to additionally | ||
3531 | reinitialize the encoder process, in order to process blocks of | ||
3532 | an image independently. | ||
3533 | For the lossy compression processes the restart interval unit is | ||
3534 | MCU (Minimum Coded Unit) and its value is contained in DRI | ||
3535 | (Define Restart Interval) marker. If <constant> | ||
3536 | V4L2_CID_JPEG_RESTART_INTERVAL</constant> control is set to 0, | ||
3537 | DRI and RSTm markers will not be inserted. | ||
3538 | </entry> | ||
3539 | </row> | ||
3540 | <row id="jpeg-quality-control"> | ||
3541 | <entry spanname="id"><constant>V4L2_CID_JPEG_COMPRESION_QUALITY</constant></entry> | ||
3542 | <entry>integer</entry> | ||
3543 | </row> | ||
3544 | <row> | ||
3545 | <entry spanname="descr"> | ||
3546 | <constant>V4L2_CID_JPEG_COMPRESION_QUALITY</constant> control | ||
3547 | determines trade-off between image quality and size. | ||
3548 | It provides simpler method for applications to control image quality, | ||
3549 | without a need for direct reconfiguration of luminance and chrominance | ||
3550 | quantization tables. | ||
3551 | |||
3552 | In cases where a driver uses quantization tables configured directly | ||
3553 | by an application, using interfaces defined elsewhere, <constant> | ||
3554 | V4L2_CID_JPEG_COMPRESION_QUALITY</constant> control should be set | ||
3555 | by driver to 0. | ||
3556 | |||
3557 | <para>The value range of this control is driver-specific. Only | ||
3558 | positive, non-zero values are meaningful. The recommended range | ||
3559 | is 1 - 100, where larger values correspond to better image quality. | ||
3560 | </para> | ||
3561 | </entry> | ||
3562 | </row> | ||
3563 | <row id="jpeg-active-marker-control"> | ||
3564 | <entry spanname="id"><constant>V4L2_CID_JPEG_ACTIVE_MARKER</constant></entry> | ||
3565 | <entry>bitmask</entry> | ||
3566 | </row> | ||
3567 | <row> | ||
3568 | <entry spanname="descr">Specify which JPEG markers are included | ||
3569 | in compressed stream. This control is valid only for encoders. | ||
3570 | </entry> | ||
3571 | </row> | ||
3572 | <row> | ||
3573 | <entrytbl spanname="descr" cols="2"> | ||
3574 | <tbody valign="top"> | ||
3575 | <row> | ||
3576 | <entry><constant>V4L2_JPEG_ACTIVE_MARKER_APP0</constant></entry> | ||
3577 | <entry>Application data segment APP<subscript>0</subscript>.</entry> | ||
3578 | </row><row> | ||
3579 | <entry><constant>V4L2_JPEG_ACTIVE_MARKER_APP1</constant></entry> | ||
3580 | <entry>Application data segment APP<subscript>1</subscript>.</entry> | ||
3581 | </row><row> | ||
3582 | <entry><constant>V4L2_JPEG_ACTIVE_MARKER_COM</constant></entry> | ||
3583 | <entry>Comment segment.</entry> | ||
3584 | </row><row> | ||
3585 | <entry><constant>V4L2_JPEG_ACTIVE_MARKER_DQT</constant></entry> | ||
3586 | <entry>Quantization tables segment.</entry> | ||
3587 | </row><row> | ||
3588 | <entry><constant>V4L2_JPEG_ACTIVE_MARKER_DHT</constant></entry> | ||
3589 | <entry>Huffman tables segment.</entry> | ||
3590 | </row> | ||
3591 | </tbody> | ||
3592 | </entrytbl> | ||
3593 | </row> | ||
3594 | <row><entry></entry></row> | ||
3595 | </tbody> | ||
3596 | </tgroup> | ||
3597 | </table> | ||
3598 | <para>For more details about JPEG specification, refer | ||
3599 | to <xref linkend="itu-t81"/>, <xref linkend="jfif"/>, | ||
3600 | <xref linkend="w3c-jpeg-jfif"/>.</para> | ||
3381 | </section> | 3601 | </section> |
3382 | </section> | 3602 | </section> |
diff --git a/Documentation/DocBook/media/v4l/selection-api.xml b/Documentation/DocBook/media/v4l/selection-api.xml index 2f0bdb4d5551..b299e4779354 100644 --- a/Documentation/DocBook/media/v4l/selection-api.xml +++ b/Documentation/DocBook/media/v4l/selection-api.xml | |||
@@ -52,6 +52,10 @@ cropping and composing rectangles have the same size.</para> | |||
52 | </textobject> | 52 | </textobject> |
53 | </mediaobject> | 53 | </mediaobject> |
54 | </figure> | 54 | </figure> |
55 | |||
56 | For complete list of the available selection targets see table <xref | ||
57 | linkend="v4l2-sel-target"/> | ||
58 | |||
55 | </section> | 59 | </section> |
56 | 60 | ||
57 | <section> | 61 | <section> |
@@ -186,7 +190,7 @@ V4L2_SEL_TGT_COMPOSE_ACTIVE </constant> target.</para> | |||
186 | 190 | ||
187 | <section> | 191 | <section> |
188 | 192 | ||
189 | <title>Scaling control.</title> | 193 | <title>Scaling control</title> |
190 | 194 | ||
191 | <para>An application can detect if scaling is performed by comparing the width | 195 | <para>An application can detect if scaling is performed by comparing the width |
192 | and the height of rectangles obtained using <constant> V4L2_SEL_TGT_CROP_ACTIVE | 196 | and the height of rectangles obtained using <constant> V4L2_SEL_TGT_CROP_ACTIVE |
@@ -200,7 +204,7 @@ the scaling ratios using these values.</para> | |||
200 | 204 | ||
201 | <section> | 205 | <section> |
202 | 206 | ||
203 | <title>Comparison with old cropping API.</title> | 207 | <title>Comparison with old cropping API</title> |
204 | 208 | ||
205 | <para>The selection API was introduced to cope with deficiencies of previous | 209 | <para>The selection API was introduced to cope with deficiencies of previous |
206 | <link linkend="crop"> API </link>, that was designed to control simple capture | 210 | <link linkend="crop"> API </link>, that was designed to control simple capture |
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index e97c512861bb..8ae38876172e 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml | |||
@@ -128,6 +128,22 @@ structs, ioctls) must be noted in more detail in the history chapter | |||
128 | applications. --> | 128 | applications. --> |
129 | 129 | ||
130 | <revision> | 130 | <revision> |
131 | <revnumber>3.4</revnumber> | ||
132 | <date>2012-01-25</date> | ||
133 | <authorinitials>sn</authorinitials> | ||
134 | <revremark>Added <link linkend="jpeg-controls">JPEG compression | ||
135 | control class.</link> | ||
136 | </revremark> | ||
137 | </revision> | ||
138 | |||
139 | <revision> | ||
140 | <revnumber>3.3</revnumber> | ||
141 | <date>2012-01-11</date> | ||
142 | <authorinitials>hv</authorinitials> | ||
143 | <revremark>Added device_caps field to struct v4l2_capabilities.</revremark> | ||
144 | </revision> | ||
145 | |||
146 | <revision> | ||
131 | <revnumber>3.2</revnumber> | 147 | <revnumber>3.2</revnumber> |
132 | <date>2011-08-26</date> | 148 | <date>2011-08-26</date> |
133 | <authorinitials>hv</authorinitials> | 149 | <authorinitials>hv</authorinitials> |
@@ -417,7 +433,7 @@ and discussions on the V4L mailing list.</revremark> | |||
417 | </partinfo> | 433 | </partinfo> |
418 | 434 | ||
419 | <title>Video for Linux Two API Specification</title> | 435 | <title>Video for Linux Two API Specification</title> |
420 | <subtitle>Revision 3.2</subtitle> | 436 | <subtitle>Revision 3.3</subtitle> |
421 | 437 | ||
422 | <chapter id="common"> | 438 | <chapter id="common"> |
423 | &sub-common; | 439 | &sub-common; |
@@ -473,6 +489,7 @@ and discussions on the V4L mailing list.</revremark> | |||
473 | &sub-cropcap; | 489 | &sub-cropcap; |
474 | &sub-dbg-g-chip-ident; | 490 | &sub-dbg-g-chip-ident; |
475 | &sub-dbg-g-register; | 491 | &sub-dbg-g-register; |
492 | &sub-decoder-cmd; | ||
476 | &sub-dqevent; | 493 | &sub-dqevent; |
477 | &sub-encoder-cmd; | 494 | &sub-encoder-cmd; |
478 | &sub-enumaudio; | 495 | &sub-enumaudio; |
diff --git a/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml new file mode 100644 index 000000000000..74b87f6e480a --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml | |||
@@ -0,0 +1,256 @@ | |||
1 | <refentry id="vidioc-decoder-cmd"> | ||
2 | <refmeta> | ||
3 | <refentrytitle>ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD</refentrytitle> | ||
4 | &manvol; | ||
5 | </refmeta> | ||
6 | |||
7 | <refnamediv> | ||
8 | <refname>VIDIOC_DECODER_CMD</refname> | ||
9 | <refname>VIDIOC_TRY_DECODER_CMD</refname> | ||
10 | <refpurpose>Execute an decoder command</refpurpose> | ||
11 | </refnamediv> | ||
12 | |||
13 | <refsynopsisdiv> | ||
14 | <funcsynopsis> | ||
15 | <funcprototype> | ||
16 | <funcdef>int <function>ioctl</function></funcdef> | ||
17 | <paramdef>int <parameter>fd</parameter></paramdef> | ||
18 | <paramdef>int <parameter>request</parameter></paramdef> | ||
19 | <paramdef>struct v4l2_decoder_cmd *<parameter>argp</parameter></paramdef> | ||
20 | </funcprototype> | ||
21 | </funcsynopsis> | ||
22 | </refsynopsisdiv> | ||
23 | |||
24 | <refsect1> | ||
25 | <title>Arguments</title> | ||
26 | |||
27 | <variablelist> | ||
28 | <varlistentry> | ||
29 | <term><parameter>fd</parameter></term> | ||
30 | <listitem> | ||
31 | <para>&fd;</para> | ||
32 | </listitem> | ||
33 | </varlistentry> | ||
34 | <varlistentry> | ||
35 | <term><parameter>request</parameter></term> | ||
36 | <listitem> | ||
37 | <para>VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD</para> | ||
38 | </listitem> | ||
39 | </varlistentry> | ||
40 | <varlistentry> | ||
41 | <term><parameter>argp</parameter></term> | ||
42 | <listitem> | ||
43 | <para></para> | ||
44 | </listitem> | ||
45 | </varlistentry> | ||
46 | </variablelist> | ||
47 | </refsect1> | ||
48 | |||
49 | <refsect1> | ||
50 | <title>Description</title> | ||
51 | |||
52 | <note> | ||
53 | <title>Experimental</title> | ||
54 | |||
55 | <para>This is an <link linkend="experimental">experimental</link> | ||
56 | interface and may change in the future.</para> | ||
57 | </note> | ||
58 | |||
59 | <para>These ioctls control an audio/video (usually MPEG-) decoder. | ||
60 | <constant>VIDIOC_DECODER_CMD</constant> sends a command to the | ||
61 | decoder, <constant>VIDIOC_TRY_DECODER_CMD</constant> can be used to | ||
62 | try a command without actually executing it. To send a command applications | ||
63 | must initialize all fields of a &v4l2-decoder-cmd; and call | ||
64 | <constant>VIDIOC_DECODER_CMD</constant> or <constant>VIDIOC_TRY_DECODER_CMD</constant> | ||
65 | with a pointer to this structure.</para> | ||
66 | |||
67 | <para>The <structfield>cmd</structfield> field must contain the | ||
68 | command code. Some commands use the <structfield>flags</structfield> field for | ||
69 | additional information. | ||
70 | </para> | ||
71 | |||
72 | <para>A <function>write</function>() or &VIDIOC-STREAMON; call sends an implicit | ||
73 | START command to the decoder if it has not been started yet. | ||
74 | </para> | ||
75 | |||
76 | <para>A <function>close</function>() or &VIDIOC-STREAMOFF; call of a streaming | ||
77 | file descriptor sends an implicit immediate STOP command to the decoder, and all | ||
78 | buffered data is discarded.</para> | ||
79 | |||
80 | <para>These ioctls are optional, not all drivers may support | ||
81 | them. They were introduced in Linux 3.3.</para> | ||
82 | |||
83 | <table pgwide="1" frame="none" id="v4l2-decoder-cmd"> | ||
84 | <title>struct <structname>v4l2_decoder_cmd</structname></title> | ||
85 | <tgroup cols="5"> | ||
86 | &cs-str; | ||
87 | <tbody valign="top"> | ||
88 | <row> | ||
89 | <entry>__u32</entry> | ||
90 | <entry><structfield>cmd</structfield></entry> | ||
91 | <entry></entry> | ||
92 | <entry></entry> | ||
93 | <entry>The decoder command, see <xref linkend="decoder-cmds" />.</entry> | ||
94 | </row> | ||
95 | <row> | ||
96 | <entry>__u32</entry> | ||
97 | <entry><structfield>flags</structfield></entry> | ||
98 | <entry></entry> | ||
99 | <entry></entry> | ||
100 | <entry>Flags to go with the command. If no flags are defined for | ||
101 | this command, drivers and applications must set this field to zero.</entry> | ||
102 | </row> | ||
103 | <row> | ||
104 | <entry>union</entry> | ||
105 | <entry>(anonymous)</entry> | ||
106 | <entry></entry> | ||
107 | <entry></entry> | ||
108 | <entry></entry> | ||
109 | </row> | ||
110 | <row> | ||
111 | <entry></entry> | ||
112 | <entry>struct</entry> | ||
113 | <entry><structfield>start</structfield></entry> | ||
114 | <entry></entry> | ||
115 | <entry>Structure containing additional data for the | ||
116 | <constant>V4L2_DEC_CMD_START</constant> command.</entry> | ||
117 | </row> | ||
118 | <row> | ||
119 | <entry></entry> | ||
120 | <entry></entry> | ||
121 | <entry>__s32</entry> | ||
122 | <entry><structfield>speed</structfield></entry> | ||
123 | <entry>Playback speed and direction. The playback speed is defined as | ||
124 | <structfield>speed</structfield>/1000 of the normal speed. So 1000 is normal playback. | ||
125 | Negative numbers denote reverse playback, so -1000 does reverse playback at normal | ||
126 | speed. Speeds -1, 0 and 1 have special meanings: speed 0 is shorthand for 1000 | ||
127 | (normal playback). A speed of 1 steps just one frame forward, a speed of -1 steps | ||
128 | just one frame back. | ||
129 | </entry> | ||
130 | </row> | ||
131 | <row> | ||
132 | <entry></entry> | ||
133 | <entry></entry> | ||
134 | <entry>__u32</entry> | ||
135 | <entry><structfield>format</structfield></entry> | ||
136 | <entry>Format restrictions. This field is set by the driver, not the | ||
137 | application. Possible values are <constant>V4L2_DEC_START_FMT_NONE</constant> if | ||
138 | there are no format restrictions or <constant>V4L2_DEC_START_FMT_GOP</constant> | ||
139 | if the decoder operates on full GOPs (<wordasword>Group Of Pictures</wordasword>). | ||
140 | This is usually the case for reverse playback: the decoder needs full GOPs, which | ||
141 | it can then play in reverse order. So to implement reverse playback the application | ||
142 | must feed the decoder the last GOP in the video file, then the GOP before that, etc. etc. | ||
143 | </entry> | ||
144 | </row> | ||
145 | <row> | ||
146 | <entry></entry> | ||
147 | <entry>struct</entry> | ||
148 | <entry><structfield>stop</structfield></entry> | ||
149 | <entry></entry> | ||
150 | <entry>Structure containing additional data for the | ||
151 | <constant>V4L2_DEC_CMD_STOP</constant> command.</entry> | ||
152 | </row> | ||
153 | <row> | ||
154 | <entry></entry> | ||
155 | <entry></entry> | ||
156 | <entry>__u64</entry> | ||
157 | <entry><structfield>pts</structfield></entry> | ||
158 | <entry>Stop playback at this <structfield>pts</structfield> or immediately | ||
159 | if the playback is already past that timestamp. Leave to 0 if you want to stop after the | ||
160 | last frame was decoded. | ||
161 | </entry> | ||
162 | </row> | ||
163 | <row> | ||
164 | <entry></entry> | ||
165 | <entry>struct</entry> | ||
166 | <entry><structfield>raw</structfield></entry> | ||
167 | <entry></entry> | ||
168 | <entry></entry> | ||
169 | </row> | ||
170 | <row> | ||
171 | <entry></entry> | ||
172 | <entry></entry> | ||
173 | <entry>__u32</entry> | ||
174 | <entry><structfield>data</structfield>[16]</entry> | ||
175 | <entry>Reserved for future extensions. Drivers and | ||
176 | applications must set the array to zero.</entry> | ||
177 | </row> | ||
178 | </tbody> | ||
179 | </tgroup> | ||
180 | </table> | ||
181 | |||
182 | <table pgwide="1" frame="none" id="decoder-cmds"> | ||
183 | <title>Decoder Commands</title> | ||
184 | <tgroup cols="3"> | ||
185 | &cs-def; | ||
186 | <tbody valign="top"> | ||
187 | <row> | ||
188 | <entry><constant>V4L2_DEC_CMD_START</constant></entry> | ||
189 | <entry>0</entry> | ||
190 | <entry>Start the decoder. When the decoder is already | ||
191 | running or paused, this command will just change the playback speed. | ||
192 | That means that calling <constant>V4L2_DEC_CMD_START</constant> when | ||
193 | the decoder was paused will <emphasis>not</emphasis> resume the decoder. | ||
194 | You have to explicitly call <constant>V4L2_DEC_CMD_RESUME</constant> for that. | ||
195 | This command has one flag: | ||
196 | <constant>V4L2_DEC_CMD_START_MUTE_AUDIO</constant>. If set, then audio will | ||
197 | be muted when playing back at a non-standard speed. | ||
198 | </entry> | ||
199 | </row> | ||
200 | <row> | ||
201 | <entry><constant>V4L2_DEC_CMD_STOP</constant></entry> | ||
202 | <entry>1</entry> | ||
203 | <entry>Stop the decoder. When the decoder is already stopped, | ||
204 | this command does nothing. This command has two flags: | ||
205 | if <constant>V4L2_DEC_CMD_STOP_TO_BLACK</constant> is set, then the decoder will | ||
206 | set the picture to black after it stopped decoding. Otherwise the last image will | ||
207 | repeat. If <constant>V4L2_DEC_CMD_STOP_IMMEDIATELY</constant> is set, then the decoder | ||
208 | stops immediately (ignoring the <structfield>pts</structfield> value), otherwise it | ||
209 | will keep decoding until timestamp >= pts or until the last of the pending data from | ||
210 | its internal buffers was decoded. | ||
211 | </entry> | ||
212 | </row> | ||
213 | <row> | ||
214 | <entry><constant>V4L2_DEC_CMD_PAUSE</constant></entry> | ||
215 | <entry>2</entry> | ||
216 | <entry>Pause the decoder. When the decoder has not been | ||
217 | started yet, the driver will return an &EPERM;. When the decoder is | ||
218 | already paused, this command does nothing. This command has one flag: | ||
219 | if <constant>V4L2_DEC_CMD_PAUSE_TO_BLACK</constant> is set, then set the | ||
220 | decoder output to black when paused. | ||
221 | </entry> | ||
222 | </row> | ||
223 | <row> | ||
224 | <entry><constant>V4L2_DEC_CMD_RESUME</constant></entry> | ||
225 | <entry>3</entry> | ||
226 | <entry>Resume decoding after a PAUSE command. When the | ||
227 | decoder has not been started yet, the driver will return an &EPERM;. | ||
228 | When the decoder is already running, this command does nothing. No | ||
229 | flags are defined for this command.</entry> | ||
230 | </row> | ||
231 | </tbody> | ||
232 | </tgroup> | ||
233 | </table> | ||
234 | |||
235 | </refsect1> | ||
236 | |||
237 | <refsect1> | ||
238 | &return-value; | ||
239 | |||
240 | <variablelist> | ||
241 | <varlistentry> | ||
242 | <term><errorcode>EINVAL</errorcode></term> | ||
243 | <listitem> | ||
244 | <para>The <structfield>cmd</structfield> field is invalid.</para> | ||
245 | </listitem> | ||
246 | </varlistentry> | ||
247 | <varlistentry> | ||
248 | <term><errorcode>EPERM</errorcode></term> | ||
249 | <listitem> | ||
250 | <para>The application sent a PAUSE or RESUME command when | ||
251 | the decoder was not running.</para> | ||
252 | </listitem> | ||
253 | </varlistentry> | ||
254 | </variablelist> | ||
255 | </refsect1> | ||
256 | </refentry> | ||
diff --git a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml index af7f3f2a36dd..f431b3ba79bd 100644 --- a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml +++ b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml | |||
@@ -74,15 +74,16 @@ only used by the STOP command and contains one bit: If the | |||
74 | encoding will continue until the end of the current <wordasword>Group | 74 | encoding will continue until the end of the current <wordasword>Group |
75 | Of Pictures</wordasword>, otherwise it will stop immediately.</para> | 75 | Of Pictures</wordasword>, otherwise it will stop immediately.</para> |
76 | 76 | ||
77 | <para>A <function>read</function>() call sends a START command to | 77 | <para>A <function>read</function>() or &VIDIOC-STREAMON; call sends an implicit |
78 | the encoder if it has not been started yet. After a STOP command, | 78 | START command to the encoder if it has not been started yet. After a STOP command, |
79 | <function>read</function>() calls will read the remaining data | 79 | <function>read</function>() calls will read the remaining data |
80 | buffered by the driver. When the buffer is empty, | 80 | buffered by the driver. When the buffer is empty, |
81 | <function>read</function>() will return zero and the next | 81 | <function>read</function>() will return zero and the next |
82 | <function>read</function>() call will restart the encoder.</para> | 82 | <function>read</function>() call will restart the encoder.</para> |
83 | 83 | ||
84 | <para>A <function>close</function>() call sends an immediate STOP | 84 | <para>A <function>close</function>() or &VIDIOC-STREAMOFF; call of a streaming |
85 | to the encoder, and all buffered data is discarded.</para> | 85 | file descriptor sends an implicit immediate STOP to the encoder, and all buffered |
86 | data is discarded.</para> | ||
86 | 87 | ||
87 | <para>These ioctls are optional, not all drivers may support | 88 | <para>These ioctls are optional, not all drivers may support |
88 | them. They were introduced in Linux 2.6.21.</para> | 89 | them. They were introduced in Linux 2.6.21.</para> |
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml b/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml index 01ea24b84385..48748499c097 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml | |||
@@ -57,6 +57,11 @@ | |||
57 | <refsect1> | 57 | <refsect1> |
58 | <title>Description</title> | 58 | <title>Description</title> |
59 | 59 | ||
60 | <para>These ioctls are <emphasis role="bold">deprecated</emphasis>. | ||
61 | New drivers and applications should use <link linkend="jpeg-controls"> | ||
62 | JPEG class controls</link> for image quality and JPEG markers control. | ||
63 | </para> | ||
64 | |||
60 | <para>[to do]</para> | 65 | <para>[to do]</para> |
61 | 66 | ||
62 | <para>Ronald Bultje elaborates:</para> | 67 | <para>Ronald Bultje elaborates:</para> |
@@ -86,7 +91,10 @@ to add them.</para> | |||
86 | <row> | 91 | <row> |
87 | <entry>int</entry> | 92 | <entry>int</entry> |
88 | <entry><structfield>quality</structfield></entry> | 93 | <entry><structfield>quality</structfield></entry> |
89 | <entry></entry> | 94 | <entry>Deprecated. If <link linkend="jpeg-quality-control"><constant> |
95 | V4L2_CID_JPEG_IMAGE_QUALITY</constant></link> control is exposed by | ||
96 | a driver applications should use it instead and ignore this field. | ||
97 | </entry> | ||
90 | </row> | 98 | </row> |
91 | <row> | 99 | <row> |
92 | <entry>int</entry> | 100 | <entry>int</entry> |
@@ -116,7 +124,11 @@ to add them.</para> | |||
116 | <row> | 124 | <row> |
117 | <entry>__u32</entry> | 125 | <entry>__u32</entry> |
118 | <entry><structfield>jpeg_markers</structfield></entry> | 126 | <entry><structfield>jpeg_markers</structfield></entry> |
119 | <entry>See <xref linkend="jpeg-markers" />.</entry> | 127 | <entry>See <xref linkend="jpeg-markers"/>. Deprecated. |
128 | If <link linkend="jpeg-active-marker-control"><constant> | ||
129 | V4L2_CID_JPEG_ACTIVE_MARKER</constant></link> control | ||
130 | is exposed by a driver applications should use it instead | ||
131 | and ignore this field.</entry> | ||
120 | </row> | 132 | </row> |
121 | </tbody> | 133 | </tbody> |
122 | </tgroup> | 134 | </tgroup> |
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-selection.xml b/Documentation/DocBook/media/v4l/vidioc-g-selection.xml index a9d36e0c090e..bb04eff75f45 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-selection.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-selection.xml | |||
@@ -58,43 +58,43 @@ | |||
58 | 58 | ||
59 | <para>The ioctls are used to query and configure selection rectangles.</para> | 59 | <para>The ioctls are used to query and configure selection rectangles.</para> |
60 | 60 | ||
61 | <para> To query the cropping (composing) rectangle set <structfield> | 61 | <para> To query the cropping (composing) rectangle set &v4l2-selection; |
62 | &v4l2-selection;::type </structfield> to the respective buffer type. Do not | 62 | <structfield> type </structfield> field to the respective buffer type. |
63 | use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE | 63 | Do not use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE |
64 | </constant> instead of <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE | 64 | </constant> instead of <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE |
65 | </constant>. Use <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT </constant> instead of | 65 | </constant>. Use <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT </constant> instead of |
66 | <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE </constant>. The next step is | 66 | <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE </constant>. The next step is |
67 | setting <structfield> &v4l2-selection;::target </structfield> to value | 67 | setting the value of &v4l2-selection; <structfield>target</structfield> field |
68 | <constant> V4L2_SEL_TGT_CROP_ACTIVE </constant> (<constant> | 68 | to <constant> V4L2_SEL_TGT_CROP_ACTIVE </constant> (<constant> |
69 | V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref | 69 | V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref |
70 | linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional | 70 | linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional |
71 | targets. Fields <structfield> &v4l2-selection;::flags </structfield> and | 71 | targets. The <structfield>flags</structfield> and <structfield>reserved |
72 | <structfield> &v4l2-selection;::reserved </structfield> are ignored and they | 72 | </structfield> fields of &v4l2-selection; are ignored and they must be filled |
73 | must be filled with zeros. The driver fills the rest of the structure or | 73 | with zeros. The driver fills the rest of the structure or |
74 | returns &EINVAL; if incorrect buffer type or target was used. If cropping | 74 | returns &EINVAL; if incorrect buffer type or target was used. If cropping |
75 | (composing) is not supported then the active rectangle is not mutable and it is | 75 | (composing) is not supported then the active rectangle is not mutable and it is |
76 | always equal to the bounds rectangle. Finally, structure <structfield> | 76 | always equal to the bounds rectangle. Finally, the &v4l2-rect; |
77 | &v4l2-selection;::r </structfield> is filled with the current cropping | 77 | <structfield>r</structfield> rectangle is filled with the current cropping |
78 | (composing) coordinates. The coordinates are expressed in driver-dependent | 78 | (composing) coordinates. The coordinates are expressed in driver-dependent |
79 | units. The only exception are rectangles for images in raw formats, whose | 79 | units. The only exception are rectangles for images in raw formats, whose |
80 | coordinates are always expressed in pixels. </para> | 80 | coordinates are always expressed in pixels. </para> |
81 | 81 | ||
82 | <para> To change the cropping (composing) rectangle set <structfield> | 82 | <para> To change the cropping (composing) rectangle set the &v4l2-selection; |
83 | &v4l2-selection;::type </structfield> to the respective buffer type. Do not | 83 | <structfield>type</structfield> field to the respective buffer type. Do not |
84 | use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE | 84 | use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE |
85 | </constant> instead of <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE | 85 | </constant> instead of <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE |
86 | </constant>. Use <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT </constant> instead of | 86 | </constant>. Use <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT </constant> instead of |
87 | <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE </constant>. The next step is | 87 | <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE </constant>. The next step is |
88 | setting <structfield> &v4l2-selection;::target </structfield> to value | 88 | setting the value of &v4l2-selection; <structfield>target</structfield> to |
89 | <constant> V4L2_SEL_TGT_CROP_ACTIVE </constant> (<constant> | 89 | <constant>V4L2_SEL_TGT_CROP_ACTIVE</constant> (<constant> |
90 | V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref | 90 | V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref |
91 | linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional | 91 | linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional |
92 | targets. Set desired active area into the field <structfield> | 92 | targets. The &v4l2-rect; <structfield>r</structfield> rectangle need to be |
93 | &v4l2-selection;::r </structfield>. Field <structfield> | 93 | set to the desired active area. Field &v4l2-selection; <structfield> reserved |
94 | &v4l2-selection;::reserved </structfield> is ignored and must be filled with | 94 | </structfield> is ignored and must be filled with zeros. The driver may adjust |
95 | zeros. The driver may adjust the rectangle coordinates. An application may | 95 | coordinates of the requested rectangle. An application may |
96 | introduce constraints to control rounding behaviour. Set the field | 96 | introduce constraints to control rounding behaviour. The &v4l2-selection; |
97 | <structfield> &v4l2-selection;::flags </structfield> to one of values: | 97 | <structfield>flags</structfield> field must be set to one of the following: |
98 | 98 | ||
99 | <itemizedlist> | 99 | <itemizedlist> |
100 | <listitem> | 100 | <listitem> |
@@ -129,7 +129,7 @@ and vertical offset and sizes are chosen according to following priority: | |||
129 | 129 | ||
130 | <orderedlist> | 130 | <orderedlist> |
131 | <listitem> | 131 | <listitem> |
132 | <para>Satisfy constraints from <structfield>&v4l2-selection;::flags</structfield>.</para> | 132 | <para>Satisfy constraints from &v4l2-selection; <structfield>flags</structfield>.</para> |
133 | </listitem> | 133 | </listitem> |
134 | <listitem> | 134 | <listitem> |
135 | <para>Adjust width, height, left, and top to hardware limits and alignments.</para> | 135 | <para>Adjust width, height, left, and top to hardware limits and alignments.</para> |
@@ -145,7 +145,7 @@ and vertical offset and sizes are chosen according to following priority: | |||
145 | </listitem> | 145 | </listitem> |
146 | </orderedlist> | 146 | </orderedlist> |
147 | 147 | ||
148 | On success the field <structfield> &v4l2-selection;::r </structfield> contains | 148 | On success the &v4l2-rect; <structfield>r</structfield> field contains |
149 | the adjusted rectangle. When the parameters are unsuitable the application may | 149 | the adjusted rectangle. When the parameters are unsuitable the application may |
150 | modify the cropping (composing) or image parameters and repeat the cycle until | 150 | modify the cropping (composing) or image parameters and repeat the cycle until |
151 | satisfactory parameters have been negotiated. If constraints flags have to be | 151 | satisfactory parameters have been negotiated. If constraints flags have to be |
@@ -162,38 +162,38 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> | |||
162 | <tbody valign="top"> | 162 | <tbody valign="top"> |
163 | <row> | 163 | <row> |
164 | <entry><constant>V4L2_SEL_TGT_CROP_ACTIVE</constant></entry> | 164 | <entry><constant>V4L2_SEL_TGT_CROP_ACTIVE</constant></entry> |
165 | <entry>0</entry> | 165 | <entry>0x0000</entry> |
166 | <entry>area that is currently cropped by hardware</entry> | 166 | <entry>The area that is currently cropped by hardware.</entry> |
167 | </row> | 167 | </row> |
168 | <row> | 168 | <row> |
169 | <entry><constant>V4L2_SEL_TGT_CROP_DEFAULT</constant></entry> | 169 | <entry><constant>V4L2_SEL_TGT_CROP_DEFAULT</constant></entry> |
170 | <entry>1</entry> | 170 | <entry>0x0001</entry> |
171 | <entry>suggested cropping rectangle that covers the "whole picture"</entry> | 171 | <entry>Suggested cropping rectangle that covers the "whole picture".</entry> |
172 | </row> | 172 | </row> |
173 | <row> | 173 | <row> |
174 | <entry><constant>V4L2_SEL_TGT_CROP_BOUNDS</constant></entry> | 174 | <entry><constant>V4L2_SEL_TGT_CROP_BOUNDS</constant></entry> |
175 | <entry>2</entry> | 175 | <entry>0x0002</entry> |
176 | <entry>limits for the cropping rectangle</entry> | 176 | <entry>Limits for the cropping rectangle.</entry> |
177 | </row> | 177 | </row> |
178 | <row> | 178 | <row> |
179 | <entry><constant>V4L2_SEL_TGT_COMPOSE_ACTIVE</constant></entry> | 179 | <entry><constant>V4L2_SEL_TGT_COMPOSE_ACTIVE</constant></entry> |
180 | <entry>256</entry> | 180 | <entry>0x0100</entry> |
181 | <entry>area to which data are composed by hardware</entry> | 181 | <entry>The area to which data is composed by hardware.</entry> |
182 | </row> | 182 | </row> |
183 | <row> | 183 | <row> |
184 | <entry><constant>V4L2_SEL_TGT_COMPOSE_DEFAULT</constant></entry> | 184 | <entry><constant>V4L2_SEL_TGT_COMPOSE_DEFAULT</constant></entry> |
185 | <entry>257</entry> | 185 | <entry>0x0101</entry> |
186 | <entry>suggested composing rectangle that covers the "whole picture"</entry> | 186 | <entry>Suggested composing rectangle that covers the "whole picture".</entry> |
187 | </row> | 187 | </row> |
188 | <row> | 188 | <row> |
189 | <entry><constant>V4L2_SEL_TGT_COMPOSE_BOUNDS</constant></entry> | 189 | <entry><constant>V4L2_SEL_TGT_COMPOSE_BOUNDS</constant></entry> |
190 | <entry>258</entry> | 190 | <entry>0x0102</entry> |
191 | <entry>limits for the composing rectangle</entry> | 191 | <entry>Limits for the composing rectangle.</entry> |
192 | </row> | 192 | </row> |
193 | <row> | 193 | <row> |
194 | <entry><constant>V4L2_SEL_TGT_COMPOSE_PADDED</constant></entry> | 194 | <entry><constant>V4L2_SEL_TGT_COMPOSE_PADDED</constant></entry> |
195 | <entry>259</entry> | 195 | <entry>0x0103</entry> |
196 | <entry>the active area and all padding pixels that are inserted or modified by the hardware</entry> | 196 | <entry>The active area and all padding pixels that are inserted or modified by hardware.</entry> |
197 | </row> | 197 | </row> |
198 | </tbody> | 198 | </tbody> |
199 | </tgroup> | 199 | </tgroup> |
@@ -209,12 +209,14 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> | |||
209 | <row> | 209 | <row> |
210 | <entry><constant>V4L2_SEL_FLAG_GE</constant></entry> | 210 | <entry><constant>V4L2_SEL_FLAG_GE</constant></entry> |
211 | <entry>0x00000001</entry> | 211 | <entry>0x00000001</entry> |
212 | <entry>indicate that adjusted rectangle must contain a rectangle from <structfield>&v4l2-selection;::r</structfield></entry> | 212 | <entry>Indicates that the adjusted rectangle must contain the original |
213 | &v4l2-selection; <structfield>r</structfield> rectangle.</entry> | ||
213 | </row> | 214 | </row> |
214 | <row> | 215 | <row> |
215 | <entry><constant>V4L2_SEL_FLAG_LE</constant></entry> | 216 | <entry><constant>V4L2_SEL_FLAG_LE</constant></entry> |
216 | <entry>0x00000002</entry> | 217 | <entry>0x00000002</entry> |
217 | <entry>indicate that adjusted rectangle must be inside a rectangle from <structfield>&v4l2-selection;::r</structfield></entry> | 218 | <entry>Indicates that the adjusted rectangle must be inside the original |
219 | &v4l2-rect; <structfield>r</structfield> rectangle.</entry> | ||
218 | </row> | 220 | </row> |
219 | </tbody> | 221 | </tbody> |
220 | </tgroup> | 222 | </tgroup> |
@@ -245,27 +247,29 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> | |||
245 | <row> | 247 | <row> |
246 | <entry>__u32</entry> | 248 | <entry>__u32</entry> |
247 | <entry><structfield>type</structfield></entry> | 249 | <entry><structfield>type</structfield></entry> |
248 | <entry>Type of the buffer (from &v4l2-buf-type;)</entry> | 250 | <entry>Type of the buffer (from &v4l2-buf-type;).</entry> |
249 | </row> | 251 | </row> |
250 | <row> | 252 | <row> |
251 | <entry>__u32</entry> | 253 | <entry>__u32</entry> |
252 | <entry><structfield>target</structfield></entry> | 254 | <entry><structfield>target</structfield></entry> |
253 | <entry>used to select between <link linkend="v4l2-sel-target"> cropping and composing rectangles </link></entry> | 255 | <entry>Used to select between <link linkend="v4l2-sel-target"> cropping |
256 | and composing rectangles</link>.</entry> | ||
254 | </row> | 257 | </row> |
255 | <row> | 258 | <row> |
256 | <entry>__u32</entry> | 259 | <entry>__u32</entry> |
257 | <entry><structfield>flags</structfield></entry> | 260 | <entry><structfield>flags</structfield></entry> |
258 | <entry>control over coordinates adjustments, refer to <link linkend="v4l2-sel-flags">selection flags</link></entry> | 261 | <entry>Flags controlling the selection rectangle adjustments, refer to |
262 | <link linkend="v4l2-sel-flags">selection flags</link>.</entry> | ||
259 | </row> | 263 | </row> |
260 | <row> | 264 | <row> |
261 | <entry>&v4l2-rect;</entry> | 265 | <entry>&v4l2-rect;</entry> |
262 | <entry><structfield>r</structfield></entry> | 266 | <entry><structfield>r</structfield></entry> |
263 | <entry>selection rectangle</entry> | 267 | <entry>The selection rectangle.</entry> |
264 | </row> | 268 | </row> |
265 | <row> | 269 | <row> |
266 | <entry>__u32</entry> | 270 | <entry>__u32</entry> |
267 | <entry><structfield>reserved[9]</structfield></entry> | 271 | <entry><structfield>reserved[9]</structfield></entry> |
268 | <entry>Reserved fields for future use</entry> | 272 | <entry>Reserved fields for future use.</entry> |
269 | </row> | 273 | </row> |
270 | </tbody> | 274 | </tbody> |
271 | </tgroup> | 275 | </tgroup> |
@@ -278,24 +282,24 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> | |||
278 | <varlistentry> | 282 | <varlistentry> |
279 | <term><errorcode>EINVAL</errorcode></term> | 283 | <term><errorcode>EINVAL</errorcode></term> |
280 | <listitem> | 284 | <listitem> |
281 | <para>The buffer <structfield> &v4l2-selection;::type </structfield> | 285 | <para>Given buffer type <structfield>type</structfield> or |
282 | or <structfield> &v4l2-selection;::target </structfield> is not supported, or | 286 | the selection target <structfield>target</structfield> is not supported, |
283 | the <structfield> &v4l2-selection;::flags </structfield> are invalid.</para> | 287 | or the <structfield>flags</structfield> argument is not valid.</para> |
284 | </listitem> | 288 | </listitem> |
285 | </varlistentry> | 289 | </varlistentry> |
286 | <varlistentry> | 290 | <varlistentry> |
287 | <term><errorcode>ERANGE</errorcode></term> | 291 | <term><errorcode>ERANGE</errorcode></term> |
288 | <listitem> | 292 | <listitem> |
289 | <para>it is not possible to adjust a rectangle <structfield> | 293 | <para>It is not possible to adjust &v4l2-rect; <structfield> |
290 | &v4l2-selection;::r </structfield> that satisfies all contraints from | 294 | r</structfield> rectangle to satisfy all contraints given in the |
291 | <structfield> &v4l2-selection;::flags </structfield>.</para> | 295 | <structfield>flags</structfield> argument.</para> |
292 | </listitem> | 296 | </listitem> |
293 | </varlistentry> | 297 | </varlistentry> |
294 | <varlistentry> | 298 | <varlistentry> |
295 | <term><errorcode>EBUSY</errorcode></term> | 299 | <term><errorcode>EBUSY</errorcode></term> |
296 | <listitem> | 300 | <listitem> |
297 | <para>it is not possible to apply change of selection rectangle at the moment. | 301 | <para>It is not possible to apply change of the selection rectangle |
298 | Usually because streaming is in progress.</para> | 302 | at the moment. Usually because streaming is in progress.</para> |
299 | </listitem> | 303 | </listitem> |
300 | </varlistentry> | 304 | </varlistentry> |
301 | </variablelist> | 305 | </variablelist> |
diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml index e3664d6f2de4..4643505cd4ca 100644 --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml | |||
@@ -124,12 +124,35 @@ printf ("Version: %u.%u.%u\n", | |||
124 | <row> | 124 | <row> |
125 | <entry>__u32</entry> | 125 | <entry>__u32</entry> |
126 | <entry><structfield>capabilities</structfield></entry> | 126 | <entry><structfield>capabilities</structfield></entry> |
127 | <entry>Device capabilities, see <xref | 127 | <entry>Available capabilities of the physical device as a whole, see <xref |
128 | linkend="device-capabilities" />.</entry> | 128 | linkend="device-capabilities" />. The same physical device can export |
129 | multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and /dev/radioZ). | ||
130 | The <structfield>capabilities</structfield> field should contain a union | ||
131 | of all capabilities available around the several V4L2 devices exported | ||
132 | to userspace. | ||
133 | For all those devices the <structfield>capabilities</structfield> field | ||
134 | returns the same set of capabilities. This allows applications to open | ||
135 | just one of the devices (typically the video device) and discover whether | ||
136 | video, vbi and/or radio are also supported. | ||
137 | </entry> | ||
129 | </row> | 138 | </row> |
130 | <row> | 139 | <row> |
131 | <entry>__u32</entry> | 140 | <entry>__u32</entry> |
132 | <entry><structfield>reserved</structfield>[4]</entry> | 141 | <entry><structfield>device_caps</structfield></entry> |
142 | <entry>Device capabilities of the opened device, see <xref | ||
143 | linkend="device-capabilities" />. Should contain the available capabilities | ||
144 | of that specific device node. So, for example, <structfield>device_caps</structfield> | ||
145 | of a radio device will only contain radio related capabilities and | ||
146 | no video or vbi capabilities. This field is only set if the <structfield>capabilities</structfield> | ||
147 | field contains the <constant>V4L2_CAP_DEVICE_CAPS</constant> capability. | ||
148 | Only the <structfield>capabilities</structfield> field can have the | ||
149 | <constant>V4L2_CAP_DEVICE_CAPS</constant> capability, <structfield>device_caps</structfield> | ||
150 | will never set <constant>V4L2_CAP_DEVICE_CAPS</constant>. | ||
151 | </entry> | ||
152 | </row> | ||
153 | <row> | ||
154 | <entry>__u32</entry> | ||
155 | <entry><structfield>reserved</structfield>[3]</entry> | ||
133 | <entry>Reserved for future extensions. Drivers must set | 156 | <entry>Reserved for future extensions. Drivers must set |
134 | this array to zero.</entry> | 157 | this array to zero.</entry> |
135 | </row> | 158 | </row> |
@@ -276,6 +299,13 @@ linkend="async">asynchronous</link> I/O methods.</entry> | |||
276 | <entry>The device supports the <link | 299 | <entry>The device supports the <link |
277 | linkend="mmap">streaming</link> I/O method.</entry> | 300 | linkend="mmap">streaming</link> I/O method.</entry> |
278 | </row> | 301 | </row> |
302 | <row> | ||
303 | <entry><constant>V4L2_CAP_DEVICE_CAPS</constant></entry> | ||
304 | <entry>0x80000000</entry> | ||
305 | <entry>The driver fills the <structfield>device_caps</structfield> | ||
306 | field. This capability can only appear in the <structfield>capabilities</structfield> | ||
307 | field and never in the <structfield>device_caps</structfield> field.</entry> | ||
308 | </row> | ||
279 | </tbody> | 309 | </tbody> |
280 | </tgroup> | 310 | </tgroup> |
281 | </table> | 311 | </table> |
diff --git a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml index e013da845b11..18b1a8266f7c 100644 --- a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml +++ b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml | |||
@@ -96,8 +96,8 @@ field and the &v4l2-tuner; <structfield>index</structfield> field.</entry> | |||
96 | <row> | 96 | <row> |
97 | <entry>__u32</entry> | 97 | <entry>__u32</entry> |
98 | <entry><structfield>reserved</structfield>[7]</entry> | 98 | <entry><structfield>reserved</structfield>[7]</entry> |
99 | <entry>Reserved for future extensions. Drivers and | 99 | <entry>Reserved for future extensions. Applications |
100 | applications must set the array to zero.</entry> | 100 | must set the array to zero.</entry> |
101 | </row> | 101 | </row> |
102 | </tbody> | 102 | </tbody> |
103 | </tgroup> | 103 | </tgroup> |
@@ -112,7 +112,7 @@ field and the &v4l2-tuner; <structfield>index</structfield> field.</entry> | |||
112 | <term><errorcode>EINVAL</errorcode></term> | 112 | <term><errorcode>EINVAL</errorcode></term> |
113 | <listitem> | 113 | <listitem> |
114 | <para>The <structfield>tuner</structfield> index is out of | 114 | <para>The <structfield>tuner</structfield> index is out of |
115 | bounds or the value in the <structfield>type</structfield> field is | 115 | bounds, the wrap_around value is not supported or the value in the <structfield>type</structfield> field is |
116 | wrong.</para> | 116 | wrong.</para> |
117 | </listitem> | 117 | </listitem> |
118 | </varlistentry> | 118 | </varlistentry> |
diff --git a/Documentation/EDID/1024x768.S b/Documentation/EDID/1024x768.S new file mode 100644 index 000000000000..4b486fe31b32 --- /dev/null +++ b/Documentation/EDID/1024x768.S | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | 1024x768.S: EDID data set for standard 1024x768 60 Hz monitor | ||
3 | |||
4 | Copyright (C) 2011 Carsten Emde <C.Emde@osadl.org> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU General Public License | ||
8 | as published by the Free Software Foundation; either version 2 | ||
9 | of the License, or (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | /* EDID */ | ||
22 | #define VERSION 1 | ||
23 | #define REVISION 3 | ||
24 | |||
25 | /* Display */ | ||
26 | #define CLOCK 65000 /* kHz */ | ||
27 | #define XPIX 1024 | ||
28 | #define YPIX 768 | ||
29 | #define XY_RATIO XY_RATIO_4_3 | ||
30 | #define XBLANK 320 | ||
31 | #define YBLANK 38 | ||
32 | #define XOFFSET 8 | ||
33 | #define XPULSE 144 | ||
34 | #define YOFFSET (63+3) | ||
35 | #define YPULSE (63+6) | ||
36 | #define DPI 72 | ||
37 | #define VFREQ 60 /* Hz */ | ||
38 | #define TIMING_NAME "Linux XGA" | ||
39 | #define ESTABLISHED_TIMINGS_BITS 0x08 /* Bit 3 -> 1024x768 @60 Hz */ | ||
40 | #define HSYNC_POL 0 | ||
41 | #define VSYNC_POL 0 | ||
42 | #define CRC 0x55 | ||
43 | |||
44 | #include "edid.S" | ||
diff --git a/Documentation/EDID/1280x1024.S b/Documentation/EDID/1280x1024.S new file mode 100644 index 000000000000..a2799fe33a4d --- /dev/null +++ b/Documentation/EDID/1280x1024.S | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | 1280x1024.S: EDID data set for standard 1280x1024 60 Hz monitor | ||
3 | |||
4 | Copyright (C) 2011 Carsten Emde <C.Emde@osadl.org> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU General Public License | ||
8 | as published by the Free Software Foundation; either version 2 | ||
9 | of the License, or (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | /* EDID */ | ||
22 | #define VERSION 1 | ||
23 | #define REVISION 3 | ||
24 | |||
25 | /* Display */ | ||
26 | #define CLOCK 108000 /* kHz */ | ||
27 | #define XPIX 1280 | ||
28 | #define YPIX 1024 | ||
29 | #define XY_RATIO XY_RATIO_5_4 | ||
30 | #define XBLANK 408 | ||
31 | #define YBLANK 42 | ||
32 | #define XOFFSET 48 | ||
33 | #define XPULSE 112 | ||
34 | #define YOFFSET (63+1) | ||
35 | #define YPULSE (63+3) | ||
36 | #define DPI 72 | ||
37 | #define VFREQ 60 /* Hz */ | ||
38 | #define TIMING_NAME "Linux SXGA" | ||
39 | #define ESTABLISHED_TIMINGS_BITS 0x00 /* none */ | ||
40 | #define HSYNC_POL 1 | ||
41 | #define VSYNC_POL 1 | ||
42 | #define CRC 0xa0 | ||
43 | |||
44 | #include "edid.S" | ||
diff --git a/Documentation/EDID/1680x1050.S b/Documentation/EDID/1680x1050.S new file mode 100644 index 000000000000..96f67cafcf2e --- /dev/null +++ b/Documentation/EDID/1680x1050.S | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | 1680x1050.S: EDID data set for standard 1680x1050 60 Hz monitor | ||
3 | |||
4 | Copyright (C) 2012 Carsten Emde <C.Emde@osadl.org> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU General Public License | ||
8 | as published by the Free Software Foundation; either version 2 | ||
9 | of the License, or (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | /* EDID */ | ||
22 | #define VERSION 1 | ||
23 | #define REVISION 3 | ||
24 | |||
25 | /* Display */ | ||
26 | #define CLOCK 146250 /* kHz */ | ||
27 | #define XPIX 1680 | ||
28 | #define YPIX 1050 | ||
29 | #define XY_RATIO XY_RATIO_16_10 | ||
30 | #define XBLANK 560 | ||
31 | #define YBLANK 39 | ||
32 | #define XOFFSET 104 | ||
33 | #define XPULSE 176 | ||
34 | #define YOFFSET (63+3) | ||
35 | #define YPULSE (63+6) | ||
36 | #define DPI 96 | ||
37 | #define VFREQ 60 /* Hz */ | ||
38 | #define TIMING_NAME "Linux WSXGA" | ||
39 | #define ESTABLISHED_TIMINGS_BITS 0x00 /* none */ | ||
40 | #define HSYNC_POL 1 | ||
41 | #define VSYNC_POL 1 | ||
42 | #define CRC 0x26 | ||
43 | |||
44 | #include "edid.S" | ||
diff --git a/Documentation/EDID/1920x1080.S b/Documentation/EDID/1920x1080.S new file mode 100644 index 000000000000..36ed5d571d0a --- /dev/null +++ b/Documentation/EDID/1920x1080.S | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | 1920x1080.S: EDID data set for standard 1920x1080 60 Hz monitor | ||
3 | |||
4 | Copyright (C) 2012 Carsten Emde <C.Emde@osadl.org> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU General Public License | ||
8 | as published by the Free Software Foundation; either version 2 | ||
9 | of the License, or (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | /* EDID */ | ||
22 | #define VERSION 1 | ||
23 | #define REVISION 3 | ||
24 | |||
25 | /* Display */ | ||
26 | #define CLOCK 148500 /* kHz */ | ||
27 | #define XPIX 1920 | ||
28 | #define YPIX 1080 | ||
29 | #define XY_RATIO XY_RATIO_16_9 | ||
30 | #define XBLANK 280 | ||
31 | #define YBLANK 45 | ||
32 | #define XOFFSET 88 | ||
33 | #define XPULSE 44 | ||
34 | #define YOFFSET (63+4) | ||
35 | #define YPULSE (63+5) | ||
36 | #define DPI 96 | ||
37 | #define VFREQ 60 /* Hz */ | ||
38 | #define TIMING_NAME "Linux FHD" | ||
39 | #define ESTABLISHED_TIMINGS_BITS 0x00 /* none */ | ||
40 | #define HSYNC_POL 1 | ||
41 | #define VSYNC_POL 1 | ||
42 | #define CRC 0x05 | ||
43 | |||
44 | #include "edid.S" | ||
diff --git a/Documentation/EDID/HOWTO.txt b/Documentation/EDID/HOWTO.txt new file mode 100644 index 000000000000..75a9f2a0c43d --- /dev/null +++ b/Documentation/EDID/HOWTO.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | In the good old days when graphics parameters were configured explicitly | ||
2 | in a file called xorg.conf, even broken hardware could be managed. | ||
3 | |||
4 | Today, with the advent of Kernel Mode Setting, a graphics board is | ||
5 | either correctly working because all components follow the standards - | ||
6 | or the computer is unusable, because the screen remains dark after | ||
7 | booting or it displays the wrong area. Cases when this happens are: | ||
8 | - The graphics board does not recognize the monitor. | ||
9 | - The graphics board is unable to detect any EDID data. | ||
10 | - The graphics board incorrectly forwards EDID data to the driver. | ||
11 | - The monitor sends no or bogus EDID data. | ||
12 | - A KVM sends its own EDID data instead of querying the connected monitor. | ||
13 | Adding the kernel parameter "nomodeset" helps in most cases, but causes | ||
14 | restrictions later on. | ||
15 | |||
16 | As a remedy for such situations, the kernel configuration item | ||
17 | CONFIG_DRM_LOAD_EDID_FIRMWARE was introduced. It allows to provide an | ||
18 | individually prepared or corrected EDID data set in the /lib/firmware | ||
19 | directory from where it is loaded via the firmware interface. The code | ||
20 | (see drivers/gpu/drm/drm_edid_load.c) contains built-in data sets for | ||
21 | commonly used screen resolutions (1024x768, 1280x1024, 1680x1050, | ||
22 | 1920x1080) as binary blobs, but the kernel source tree does not contain | ||
23 | code to create these data. In order to elucidate the origin of the | ||
24 | built-in binary EDID blobs and to facilitate the creation of individual | ||
25 | data for a specific misbehaving monitor, commented sources and a | ||
26 | Makefile environment are given here. | ||
27 | |||
28 | To create binary EDID and C source code files from the existing data | ||
29 | material, simply type "make". | ||
30 | |||
31 | If you want to create your own EDID file, copy the file 1024x768.S and | ||
32 | replace the settings with your own data. The CRC value in the last line | ||
33 | #define CRC 0x55 | ||
34 | is a bit tricky. After a first version of the binary data set is | ||
35 | created, it must be be checked with the "edid-decode" utility which will | ||
36 | most probably complain about a wrong CRC. Fortunately, the utility also | ||
37 | displays the correct CRC which must then be inserted into the source | ||
38 | file. After the make procedure is repeated, the EDID data set is ready | ||
39 | to be used. | ||
diff --git a/Documentation/EDID/Makefile b/Documentation/EDID/Makefile new file mode 100644 index 000000000000..17763ca3f12b --- /dev/null +++ b/Documentation/EDID/Makefile | |||
@@ -0,0 +1,26 @@ | |||
1 | |||
2 | SOURCES := $(wildcard [0-9]*x[0-9]*.S) | ||
3 | |||
4 | BIN := $(patsubst %.S, %.bin, $(SOURCES)) | ||
5 | |||
6 | IHEX := $(patsubst %.S, %.bin.ihex, $(SOURCES)) | ||
7 | |||
8 | CODE := $(patsubst %.S, %.c, $(SOURCES)) | ||
9 | |||
10 | all: $(BIN) $(IHEX) $(CODE) | ||
11 | |||
12 | clean: | ||
13 | @rm -f *.o *.bin.ihex *.bin *.c | ||
14 | |||
15 | %.o: %.S | ||
16 | @cc -c $^ | ||
17 | |||
18 | %.bin: %.o | ||
19 | @objcopy -Obinary $^ $@ | ||
20 | |||
21 | %.bin.ihex: %.o | ||
22 | @objcopy -Oihex $^ $@ | ||
23 | @dos2unix $@ 2>/dev/null | ||
24 | |||
25 | %.c: %.bin | ||
26 | @echo "{" >$@; hexdump -f hex $^ >>$@; echo "};" >>$@ | ||
diff --git a/Documentation/EDID/edid.S b/Documentation/EDID/edid.S new file mode 100644 index 000000000000..ea97ae275fca --- /dev/null +++ b/Documentation/EDID/edid.S | |||
@@ -0,0 +1,261 @@ | |||
1 | /* | ||
2 | edid.S: EDID data template | ||
3 | |||
4 | Copyright (C) 2012 Carsten Emde <C.Emde@osadl.org> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU General Public License | ||
8 | as published by the Free Software Foundation; either version 2 | ||
9 | of the License, or (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | |||
22 | /* Manufacturer */ | ||
23 | #define MFG_LNX1 'L' | ||
24 | #define MFG_LNX2 'N' | ||
25 | #define MFG_LNX3 'X' | ||
26 | #define SERIAL 0 | ||
27 | #define YEAR 2012 | ||
28 | #define WEEK 5 | ||
29 | |||
30 | /* EDID 1.3 standard definitions */ | ||
31 | #define XY_RATIO_16_10 0b00 | ||
32 | #define XY_RATIO_4_3 0b01 | ||
33 | #define XY_RATIO_5_4 0b10 | ||
34 | #define XY_RATIO_16_9 0b11 | ||
35 | |||
36 | #define mfgname2id(v1,v2,v3) \ | ||
37 | ((((v1-'@')&0x1f)<<10)+(((v2-'@')&0x1f)<<5)+((v3-'@')&0x1f)) | ||
38 | #define swap16(v1) ((v1>>8)+((v1&0xff)<<8)) | ||
39 | #define msbs2(v1,v2) ((((v1>>8)&0x0f)<<4)+((v2>>8)&0x0f)) | ||
40 | #define msbs4(v1,v2,v3,v4) \ | ||
41 | (((v1&0x03)>>2)+((v2&0x03)>>4)+((v3&0x03)>>6)+((v4&0x03)>>8)) | ||
42 | #define pixdpi2mm(pix,dpi) ((pix*25)/dpi) | ||
43 | #define xsize pixdpi2mm(XPIX,DPI) | ||
44 | #define ysize pixdpi2mm(YPIX,DPI) | ||
45 | |||
46 | .data | ||
47 | |||
48 | /* Fixed header pattern */ | ||
49 | header: .byte 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00 | ||
50 | |||
51 | mfg_id: .word swap16(mfgname2id(MFG_LNX1, MFG_LNX2, MFG_LNX3)) | ||
52 | |||
53 | prod_code: .word 0 | ||
54 | |||
55 | /* Serial number. 32 bits, little endian. */ | ||
56 | serial_number: .long SERIAL | ||
57 | |||
58 | /* Week of manufacture */ | ||
59 | week: .byte WEEK | ||
60 | |||
61 | /* Year of manufacture, less 1990. (1990-2245) | ||
62 | If week=255, it is the model year instead */ | ||
63 | year: .byte YEAR-1990 | ||
64 | |||
65 | version: .byte VERSION /* EDID version, usually 1 (for 1.3) */ | ||
66 | revision: .byte REVISION /* EDID revision, usually 3 (for 1.3) */ | ||
67 | |||
68 | /* If Bit 7=1 Digital input. If set, the following bit definitions apply: | ||
69 | Bits 6-1 Reserved, must be 0 | ||
70 | Bit 0 Signal is compatible with VESA DFP 1.x TMDS CRGB, | ||
71 | 1 pixel per clock, up to 8 bits per color, MSB aligned, | ||
72 | If Bit 7=0 Analog input. If clear, the following bit definitions apply: | ||
73 | Bits 6-5 Video white and sync levels, relative to blank | ||
74 | 00=+0.7/-0.3 V; 01=+0.714/-0.286 V; | ||
75 | 10=+1.0/-0.4 V; 11=+0.7/0 V | ||
76 | Bit 4 Blank-to-black setup (pedestal) expected | ||
77 | Bit 3 Separate sync supported | ||
78 | Bit 2 Composite sync (on HSync) supported | ||
79 | Bit 1 Sync on green supported | ||
80 | Bit 0 VSync pulse must be serrated when somposite or | ||
81 | sync-on-green is used. */ | ||
82 | video_parms: .byte 0x6d | ||
83 | |||
84 | /* Maximum horizontal image size, in centimetres | ||
85 | (max 292 cm/115 in at 16:9 aspect ratio) */ | ||
86 | max_hor_size: .byte xsize/10 | ||
87 | |||
88 | /* Maximum vertical image size, in centimetres. | ||
89 | If either byte is 0, undefined (e.g. projector) */ | ||
90 | max_vert_size: .byte ysize/10 | ||
91 | |||
92 | /* Display gamma, minus 1, times 100 (range 1.00-3.5 */ | ||
93 | gamma: .byte 120 | ||
94 | |||
95 | /* Bit 7 DPMS standby supported | ||
96 | Bit 6 DPMS suspend supported | ||
97 | Bit 5 DPMS active-off supported | ||
98 | Bits 4-3 Display type: 00=monochrome; 01=RGB colour; | ||
99 | 10=non-RGB multicolour; 11=undefined | ||
100 | Bit 2 Standard sRGB colour space. Bytes 25-34 must contain | ||
101 | sRGB standard values. | ||
102 | Bit 1 Preferred timing mode specified in descriptor block 1. | ||
103 | Bit 0 GTF supported with default parameter values. */ | ||
104 | dsp_features: .byte 0xea | ||
105 | |||
106 | /* Chromaticity coordinates. */ | ||
107 | /* Red and green least-significant bits | ||
108 | Bits 7-6 Red x value least-significant 2 bits | ||
109 | Bits 5-4 Red y value least-significant 2 bits | ||
110 | Bits 3-2 Green x value lst-significant 2 bits | ||
111 | Bits 1-0 Green y value least-significant 2 bits */ | ||
112 | red_green_lsb: .byte 0x5e | ||
113 | |||
114 | /* Blue and white least-significant 2 bits */ | ||
115 | blue_white_lsb: .byte 0xc0 | ||
116 | |||
117 | /* Red x value most significant 8 bits. | ||
118 | 0-255 encodes 0-0.996 (255/256); 0-0.999 (1023/1024) with lsbits */ | ||
119 | red_x_msb: .byte 0xa4 | ||
120 | |||
121 | /* Red y value most significant 8 bits */ | ||
122 | red_y_msb: .byte 0x59 | ||
123 | |||
124 | /* Green x and y value most significant 8 bits */ | ||
125 | green_x_y_msb: .byte 0x4a,0x98 | ||
126 | |||
127 | /* Blue x and y value most significant 8 bits */ | ||
128 | blue_x_y_msb: .byte 0x25,0x20 | ||
129 | |||
130 | /* Default white point x and y value most significant 8 bits */ | ||
131 | white_x_y_msb: .byte 0x50,0x54 | ||
132 | |||
133 | /* Established timings */ | ||
134 | /* Bit 7 720x400 @ 70 Hz | ||
135 | Bit 6 720x400 @ 88 Hz | ||
136 | Bit 5 640x480 @ 60 Hz | ||
137 | Bit 4 640x480 @ 67 Hz | ||
138 | Bit 3 640x480 @ 72 Hz | ||
139 | Bit 2 640x480 @ 75 Hz | ||
140 | Bit 1 800x600 @ 56 Hz | ||
141 | Bit 0 800x600 @ 60 Hz */ | ||
142 | estbl_timing1: .byte 0x00 | ||
143 | |||
144 | /* Bit 7 800x600 @ 72 Hz | ||
145 | Bit 6 800x600 @ 75 Hz | ||
146 | Bit 5 832x624 @ 75 Hz | ||
147 | Bit 4 1024x768 @ 87 Hz, interlaced (1024x768) | ||
148 | Bit 3 1024x768 @ 60 Hz | ||
149 | Bit 2 1024x768 @ 72 Hz | ||
150 | Bit 1 1024x768 @ 75 Hz | ||
151 | Bit 0 1280x1024 @ 75 Hz */ | ||
152 | estbl_timing2: .byte ESTABLISHED_TIMINGS_BITS | ||
153 | |||
154 | /* Bit 7 1152x870 @ 75 Hz (Apple Macintosh II) | ||
155 | Bits 6-0 Other manufacturer-specific display mod */ | ||
156 | estbl_timing3: .byte 0x00 | ||
157 | |||
158 | /* Standard timing */ | ||
159 | /* X resolution, less 31, divided by 8 (256-2288 pixels) */ | ||
160 | std_xres: .byte (XPIX/8)-31 | ||
161 | /* Y resolution, X:Y pixel ratio | ||
162 | Bits 7-6 X:Y pixel ratio: 00=16:10; 01=4:3; 10=5:4; 11=16:9. | ||
163 | Bits 5-0 Vertical frequency, less 60 (60-123 Hz) */ | ||
164 | std_vres: .byte (XY_RATIO<<6)+VFREQ-60 | ||
165 | .fill 7,2,0x0101 /* Unused */ | ||
166 | |||
167 | descriptor1: | ||
168 | /* Pixel clock in 10 kHz units. (0.-655.35 MHz, little-endian) */ | ||
169 | clock: .word CLOCK/10 | ||
170 | |||
171 | /* Horizontal active pixels 8 lsbits (0-4095) */ | ||
172 | x_act_lsb: .byte XPIX&0xff | ||
173 | /* Horizontal blanking pixels 8 lsbits (0-4095) | ||
174 | End of active to start of next active. */ | ||
175 | x_blk_lsb: .byte XBLANK&0xff | ||
176 | /* Bits 7-4 Horizontal active pixels 4 msbits | ||
177 | Bits 3-0 Horizontal blanking pixels 4 msbits */ | ||
178 | x_msbs: .byte msbs2(XPIX,XBLANK) | ||
179 | |||
180 | /* Vertical active lines 8 lsbits (0-4095) */ | ||
181 | y_act_lsb: .byte YPIX&0xff | ||
182 | /* Vertical blanking lines 8 lsbits (0-4095) */ | ||
183 | y_blk_lsb: .byte YBLANK&0xff | ||
184 | /* Bits 7-4 Vertical active lines 4 msbits | ||
185 | Bits 3-0 Vertical blanking lines 4 msbits */ | ||
186 | y_msbs: .byte msbs2(YPIX,YBLANK) | ||
187 | |||
188 | /* Horizontal sync offset pixels 8 lsbits (0-1023) From blanking start */ | ||
189 | x_snc_off_lsb: .byte XOFFSET&0xff | ||
190 | /* Horizontal sync pulse width pixels 8 lsbits (0-1023) */ | ||
191 | x_snc_pls_lsb: .byte XPULSE&0xff | ||
192 | /* Bits 7-4 Vertical sync offset lines 4 lsbits -63) | ||
193 | Bits 3-0 Vertical sync pulse width lines 4 lsbits -63) */ | ||
194 | y_snc_lsb: .byte ((YOFFSET-63)<<4)+(YPULSE-63) | ||
195 | /* Bits 7-6 Horizontal sync offset pixels 2 msbits | ||
196 | Bits 5-4 Horizontal sync pulse width pixels 2 msbits | ||
197 | Bits 3-2 Vertical sync offset lines 2 msbits | ||
198 | Bits 1-0 Vertical sync pulse width lines 2 msbits */ | ||
199 | xy_snc_msbs: .byte msbs4(XOFFSET,XPULSE,YOFFSET,YPULSE) | ||
200 | |||
201 | /* Horizontal display size, mm, 8 lsbits (0-4095 mm, 161 in) */ | ||
202 | x_dsp_size: .byte xsize&0xff | ||
203 | |||
204 | /* Vertical display size, mm, 8 lsbits (0-4095 mm, 161 in) */ | ||
205 | y_dsp_size: .byte ysize&0xff | ||
206 | |||
207 | /* Bits 7-4 Horizontal display size, mm, 4 msbits | ||
208 | Bits 3-0 Vertical display size, mm, 4 msbits */ | ||
209 | dsp_size_mbsb: .byte msbs2(xsize,ysize) | ||
210 | |||
211 | /* Horizontal border pixels (each side; total is twice this) */ | ||
212 | x_border: .byte 0 | ||
213 | /* Vertical border lines (each side; total is twice this) */ | ||
214 | y_border: .byte 0 | ||
215 | |||
216 | /* Bit 7 Interlaced | ||
217 | Bits 6-5 Stereo mode: 00=No stereo; other values depend on bit 0: | ||
218 | Bit 0=0: 01=Field sequential, sync=1 during right; 10=similar, | ||
219 | sync=1 during left; 11=4-way interleaved stereo | ||
220 | Bit 0=1 2-way interleaved stereo: 01=Right image on even lines; | ||
221 | 10=Left image on even lines; 11=side-by-side | ||
222 | Bits 4-3 Sync type: 00=Analog composite; 01=Bipolar analog composite; | ||
223 | 10=Digital composite (on HSync); 11=Digital separate | ||
224 | Bit 2 If digital separate: Vertical sync polarity (1=positive) | ||
225 | Other types: VSync serrated (HSync during VSync) | ||
226 | Bit 1 If analog sync: Sync on all 3 RGB lines (else green only) | ||
227 | Digital: HSync polarity (1=positive) | ||
228 | Bit 0 2-way line-interleaved stereo, if bits 4-3 are not 00. */ | ||
229 | features: .byte 0x18+(VSYNC_POL<<2)+(HSYNC_POL<<1) | ||
230 | |||
231 | descriptor2: .byte 0,0 /* Not a detailed timing descriptor */ | ||
232 | .byte 0 /* Must be zero */ | ||
233 | .byte 0xff /* Descriptor is monitor serial number (text) */ | ||
234 | .byte 0 /* Must be zero */ | ||
235 | start1: .ascii "Linux #0" | ||
236 | end1: .byte 0x0a /* End marker */ | ||
237 | .fill 12-(end1-start1), 1, 0x20 /* Padded spaces */ | ||
238 | descriptor3: .byte 0,0 /* Not a detailed timing descriptor */ | ||
239 | .byte 0 /* Must be zero */ | ||
240 | .byte 0xfd /* Descriptor is monitor range limits */ | ||
241 | .byte 0 /* Must be zero */ | ||
242 | start2: .byte VFREQ-1 /* Minimum vertical field rate (1-255 Hz) */ | ||
243 | .byte VFREQ+1 /* Maximum vertical field rate (1-255 Hz) */ | ||
244 | .byte (CLOCK/(XPIX+XBLANK))-1 /* Minimum horizontal line rate | ||
245 | (1-255 kHz) */ | ||
246 | .byte (CLOCK/(XPIX+XBLANK))+1 /* Maximum horizontal line rate | ||
247 | (1-255 kHz) */ | ||
248 | .byte (CLOCK/10000)+1 /* Maximum pixel clock rate, rounded up | ||
249 | to 10 MHz multiple (10-2550 MHz) */ | ||
250 | .byte 0 /* No extended timing information type */ | ||
251 | end2: .byte 0x0a /* End marker */ | ||
252 | .fill 12-(end2-start2), 1, 0x20 /* Padded spaces */ | ||
253 | descriptor4: .byte 0,0 /* Not a detailed timing descriptor */ | ||
254 | .byte 0 /* Must be zero */ | ||
255 | .byte 0xfc /* Descriptor is text */ | ||
256 | .byte 0 /* Must be zero */ | ||
257 | start3: .ascii TIMING_NAME | ||
258 | end3: .byte 0x0a /* End marker */ | ||
259 | .fill 12-(end3-start3), 1, 0x20 /* Padded spaces */ | ||
260 | extensions: .byte 0 /* Number of extensions to follow */ | ||
261 | checksum: .byte CRC /* Sum of all bytes must be 0 */ | ||
diff --git a/Documentation/EDID/hex b/Documentation/EDID/hex new file mode 100644 index 000000000000..8873ebb618af --- /dev/null +++ b/Documentation/EDID/hex | |||
@@ -0,0 +1 @@ | |||
"\t" 8/1 "0x%02x, " "\n" | |||
diff --git a/Documentation/Makefile b/Documentation/Makefile index 9b4bc5c76f33..30b656ece7aa 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | obj-m := DocBook/ accounting/ auxdisplay/ connector/ \ | 1 | obj-m := DocBook/ accounting/ auxdisplay/ connector/ \ |
2 | filesystems/ filesystems/configfs/ ia64/ laptops/ networking/ \ | 2 | filesystems/ filesystems/configfs/ ia64/ laptops/ networking/ \ |
3 | pcmcia/ spi/ timers/ vm/ watchdog/src/ | 3 | pcmcia/ spi/ timers/ watchdog/src/ |
diff --git a/Documentation/backlight/lp855x-driver.txt b/Documentation/backlight/lp855x-driver.txt new file mode 100644 index 000000000000..f5e4caafab7d --- /dev/null +++ b/Documentation/backlight/lp855x-driver.txt | |||
@@ -0,0 +1,78 @@ | |||
1 | Kernel driver lp855x | ||
2 | ==================== | ||
3 | |||
4 | Backlight driver for LP855x ICs | ||
5 | |||
6 | Supported chips: | ||
7 | Texas Instruments LP8550, LP8551, LP8552, LP8553 and LP8556 | ||
8 | |||
9 | Author: Milo(Woogyom) Kim <milo.kim@ti.com> | ||
10 | |||
11 | Description | ||
12 | ----------- | ||
13 | |||
14 | * Brightness control | ||
15 | |||
16 | Brightness can be controlled by the pwm input or the i2c command. | ||
17 | The lp855x driver supports both cases. | ||
18 | |||
19 | * Device attributes | ||
20 | |||
21 | 1) bl_ctl_mode | ||
22 | Backlight control mode. | ||
23 | Value : pwm based or register based | ||
24 | |||
25 | 2) chip_id | ||
26 | The lp855x chip id. | ||
27 | Value : lp8550/lp8551/lp8552/lp8553/lp8556 | ||
28 | |||
29 | Platform data for lp855x | ||
30 | ------------------------ | ||
31 | |||
32 | For supporting platform specific data, the lp855x platform data can be used. | ||
33 | |||
34 | * name : Backlight driver name. If it is not defined, default name is set. | ||
35 | * mode : Brightness control mode. PWM or register based. | ||
36 | * device_control : Value of DEVICE CONTROL register. | ||
37 | * initial_brightness : Initial value of backlight brightness. | ||
38 | * pwm_data : Platform specific pwm generation functions. | ||
39 | Only valid when brightness is pwm input mode. | ||
40 | Functions should be implemented by PWM driver. | ||
41 | - pwm_set_intensity() : set duty of PWM | ||
42 | - pwm_get_intensity() : get current duty of PWM | ||
43 | * load_new_rom_data : | ||
44 | 0 : use default configuration data | ||
45 | 1 : update values of eeprom or eprom registers on loading driver | ||
46 | * size_program : Total size of lp855x_rom_data. | ||
47 | * rom_data : List of new eeprom/eprom registers. | ||
48 | |||
49 | example 1) lp8552 platform data : i2c register mode with new eeprom data | ||
50 | |||
51 | #define EEPROM_A5_ADDR 0xA5 | ||
52 | #define EEPROM_A5_VAL 0x4f /* EN_VSYNC=0 */ | ||
53 | |||
54 | static struct lp855x_rom_data lp8552_eeprom_arr[] = { | ||
55 | {EEPROM_A5_ADDR, EEPROM_A5_VAL}, | ||
56 | }; | ||
57 | |||
58 | static struct lp855x_platform_data lp8552_pdata = { | ||
59 | .name = "lcd-bl", | ||
60 | .mode = REGISTER_BASED, | ||
61 | .device_control = I2C_CONFIG(LP8552), | ||
62 | .initial_brightness = INITIAL_BRT, | ||
63 | .load_new_rom_data = 1, | ||
64 | .size_program = ARRAY_SIZE(lp8552_eeprom_arr), | ||
65 | .rom_data = lp8552_eeprom_arr, | ||
66 | }; | ||
67 | |||
68 | example 2) lp8556 platform data : pwm input mode with default rom data | ||
69 | |||
70 | static struct lp855x_platform_data lp8556_pdata = { | ||
71 | .mode = PWM_BASED, | ||
72 | .device_control = PWM_CONFIG(LP8556), | ||
73 | .initial_brightness = INITIAL_BRT, | ||
74 | .pwm_data = { | ||
75 | .pwm_set_intensity = platform_pwm_set_intensity, | ||
76 | .pwm_get_intensity = platform_pwm_get_intensity, | ||
77 | }, | ||
78 | }; | ||
diff --git a/Documentation/clk.txt b/Documentation/clk.txt new file mode 100644 index 000000000000..1943fae014fd --- /dev/null +++ b/Documentation/clk.txt | |||
@@ -0,0 +1,233 @@ | |||
1 | The Common Clk Framework | ||
2 | Mike Turquette <mturquette@ti.com> | ||
3 | |||
4 | This document endeavours to explain the common clk framework details, | ||
5 | and how to port a platform over to this framework. It is not yet a | ||
6 | detailed explanation of the clock api in include/linux/clk.h, but | ||
7 | perhaps someday it will include that information. | ||
8 | |||
9 | Part 1 - introduction and interface split | ||
10 | |||
11 | The common clk framework is an interface to control the clock nodes | ||
12 | available on various devices today. This may come in the form of clock | ||
13 | gating, rate adjustment, muxing or other operations. This framework is | ||
14 | enabled with the CONFIG_COMMON_CLK option. | ||
15 | |||
16 | The interface itself is divided into two halves, each shielded from the | ||
17 | details of its counterpart. First is the common definition of struct | ||
18 | clk which unifies the framework-level accounting and infrastructure that | ||
19 | has traditionally been duplicated across a variety of platforms. Second | ||
20 | is a common implementation of the clk.h api, defined in | ||
21 | drivers/clk/clk.c. Finally there is struct clk_ops, whose operations | ||
22 | are invoked by the clk api implementation. | ||
23 | |||
24 | The second half of the interface is comprised of the hardware-specific | ||
25 | callbacks registered with struct clk_ops and the corresponding | ||
26 | hardware-specific structures needed to model a particular clock. For | ||
27 | the remainder of this document any reference to a callback in struct | ||
28 | clk_ops, such as .enable or .set_rate, implies the hardware-specific | ||
29 | implementation of that code. Likewise, references to struct clk_foo | ||
30 | serve as a convenient shorthand for the implementation of the | ||
31 | hardware-specific bits for the hypothetical "foo" hardware. | ||
32 | |||
33 | Tying the two halves of this interface together is struct clk_hw, which | ||
34 | is defined in struct clk_foo and pointed to within struct clk. This | ||
35 | allows easy for navigation between the two discrete halves of the common | ||
36 | clock interface. | ||
37 | |||
38 | Part 2 - common data structures and api | ||
39 | |||
40 | Below is the common struct clk definition from | ||
41 | include/linux/clk-private.h, modified for brevity: | ||
42 | |||
43 | struct clk { | ||
44 | const char *name; | ||
45 | const struct clk_ops *ops; | ||
46 | struct clk_hw *hw; | ||
47 | char **parent_names; | ||
48 | struct clk **parents; | ||
49 | struct clk *parent; | ||
50 | struct hlist_head children; | ||
51 | struct hlist_node child_node; | ||
52 | ... | ||
53 | }; | ||
54 | |||
55 | The members above make up the core of the clk tree topology. The clk | ||
56 | api itself defines several driver-facing functions which operate on | ||
57 | struct clk. That api is documented in include/linux/clk.h. | ||
58 | |||
59 | Platforms and devices utilizing the common struct clk use the struct | ||
60 | clk_ops pointer in struct clk to perform the hardware-specific parts of | ||
61 | the operations defined in clk.h: | ||
62 | |||
63 | struct clk_ops { | ||
64 | int (*prepare)(struct clk_hw *hw); | ||
65 | void (*unprepare)(struct clk_hw *hw); | ||
66 | int (*enable)(struct clk_hw *hw); | ||
67 | void (*disable)(struct clk_hw *hw); | ||
68 | int (*is_enabled)(struct clk_hw *hw); | ||
69 | unsigned long (*recalc_rate)(struct clk_hw *hw, | ||
70 | unsigned long parent_rate); | ||
71 | long (*round_rate)(struct clk_hw *hw, unsigned long, | ||
72 | unsigned long *); | ||
73 | int (*set_parent)(struct clk_hw *hw, u8 index); | ||
74 | u8 (*get_parent)(struct clk_hw *hw); | ||
75 | int (*set_rate)(struct clk_hw *hw, unsigned long); | ||
76 | void (*init)(struct clk_hw *hw); | ||
77 | }; | ||
78 | |||
79 | Part 3 - hardware clk implementations | ||
80 | |||
81 | The strength of the common struct clk comes from its .ops and .hw pointers | ||
82 | which abstract the details of struct clk from the hardware-specific bits, and | ||
83 | vice versa. To illustrate consider the simple gateable clk implementation in | ||
84 | drivers/clk/clk-gate.c: | ||
85 | |||
86 | struct clk_gate { | ||
87 | struct clk_hw hw; | ||
88 | void __iomem *reg; | ||
89 | u8 bit_idx; | ||
90 | ... | ||
91 | }; | ||
92 | |||
93 | struct clk_gate contains struct clk_hw hw as well as hardware-specific | ||
94 | knowledge about which register and bit controls this clk's gating. | ||
95 | Nothing about clock topology or accounting, such as enable_count or | ||
96 | notifier_count, is needed here. That is all handled by the common | ||
97 | framework code and struct clk. | ||
98 | |||
99 | Let's walk through enabling this clk from driver code: | ||
100 | |||
101 | struct clk *clk; | ||
102 | clk = clk_get(NULL, "my_gateable_clk"); | ||
103 | |||
104 | clk_prepare(clk); | ||
105 | clk_enable(clk); | ||
106 | |||
107 | The call graph for clk_enable is very simple: | ||
108 | |||
109 | clk_enable(clk); | ||
110 | clk->ops->enable(clk->hw); | ||
111 | [resolves to...] | ||
112 | clk_gate_enable(hw); | ||
113 | [resolves struct clk gate with to_clk_gate(hw)] | ||
114 | clk_gate_set_bit(gate); | ||
115 | |||
116 | And the definition of clk_gate_set_bit: | ||
117 | |||
118 | static void clk_gate_set_bit(struct clk_gate *gate) | ||
119 | { | ||
120 | u32 reg; | ||
121 | |||
122 | reg = __raw_readl(gate->reg); | ||
123 | reg |= BIT(gate->bit_idx); | ||
124 | writel(reg, gate->reg); | ||
125 | } | ||
126 | |||
127 | Note that to_clk_gate is defined as: | ||
128 | |||
129 | #define to_clk_gate(_hw) container_of(_hw, struct clk_gate, clk) | ||
130 | |||
131 | This pattern of abstraction is used for every clock hardware | ||
132 | representation. | ||
133 | |||
134 | Part 4 - supporting your own clk hardware | ||
135 | |||
136 | When implementing support for a new type of clock it only necessary to | ||
137 | include the following header: | ||
138 | |||
139 | #include <linux/clk-provider.h> | ||
140 | |||
141 | include/linux/clk.h is included within that header and clk-private.h | ||
142 | must never be included from the code which implements the operations for | ||
143 | a clock. More on that below in Part 5. | ||
144 | |||
145 | To construct a clk hardware structure for your platform you must define | ||
146 | the following: | ||
147 | |||
148 | struct clk_foo { | ||
149 | struct clk_hw hw; | ||
150 | ... hardware specific data goes here ... | ||
151 | }; | ||
152 | |||
153 | To take advantage of your data you'll need to support valid operations | ||
154 | for your clk: | ||
155 | |||
156 | struct clk_ops clk_foo_ops { | ||
157 | .enable = &clk_foo_enable; | ||
158 | .disable = &clk_foo_disable; | ||
159 | }; | ||
160 | |||
161 | Implement the above functions using container_of: | ||
162 | |||
163 | #define to_clk_foo(_hw) container_of(_hw, struct clk_foo, hw) | ||
164 | |||
165 | int clk_foo_enable(struct clk_hw *hw) | ||
166 | { | ||
167 | struct clk_foo *foo; | ||
168 | |||
169 | foo = to_clk_foo(hw); | ||
170 | |||
171 | ... perform magic on foo ... | ||
172 | |||
173 | return 0; | ||
174 | }; | ||
175 | |||
176 | Below is a matrix detailing which clk_ops are mandatory based upon the | ||
177 | hardware capbilities of that clock. A cell marked as "y" means | ||
178 | mandatory, a cell marked as "n" implies that either including that | ||
179 | callback is invalid or otherwise uneccesary. Empty cells are either | ||
180 | optional or must be evaluated on a case-by-case basis. | ||
181 | |||
182 | clock hardware characteristics | ||
183 | ----------------------------------------------------------- | ||
184 | | gate | change rate | single parent | multiplexer | root | | ||
185 | |------|-------------|---------------|-------------|------| | ||
186 | .prepare | | | | | | | ||
187 | .unprepare | | | | | | | ||
188 | | | | | | | | ||
189 | .enable | y | | | | | | ||
190 | .disable | y | | | | | | ||
191 | .is_enabled | y | | | | | | ||
192 | | | | | | | | ||
193 | .recalc_rate | | y | | | | | ||
194 | .round_rate | | y | | | | | ||
195 | .set_rate | | y | | | | | ||
196 | | | | | | | | ||
197 | .set_parent | | | n | y | n | | ||
198 | .get_parent | | | n | y | n | | ||
199 | | | | | | | | ||
200 | .init | | | | | | | ||
201 | ----------------------------------------------------------- | ||
202 | |||
203 | Finally, register your clock at run-time with a hardware-specific | ||
204 | registration function. This function simply populates struct clk_foo's | ||
205 | data and then passes the common struct clk parameters to the framework | ||
206 | with a call to: | ||
207 | |||
208 | clk_register(...) | ||
209 | |||
210 | See the basic clock types in drivers/clk/clk-*.c for examples. | ||
211 | |||
212 | Part 5 - static initialization of clock data | ||
213 | |||
214 | For platforms with many clocks (often numbering into the hundreds) it | ||
215 | may be desirable to statically initialize some clock data. This | ||
216 | presents a problem since the definition of struct clk should be hidden | ||
217 | from everyone except for the clock core in drivers/clk/clk.c. | ||
218 | |||
219 | To get around this problem struct clk's definition is exposed in | ||
220 | include/linux/clk-private.h along with some macros for more easily | ||
221 | initializing instances of the basic clock types. These clocks must | ||
222 | still be initialized with the common clock framework via a call to | ||
223 | __clk_init. | ||
224 | |||
225 | clk-private.h must NEVER be included by code which implements struct | ||
226 | clk_ops callbacks, nor must it be included by any logic which pokes | ||
227 | around inside of struct clk at run-time. To do so is a layering | ||
228 | violation. | ||
229 | |||
230 | To better enforce this policy, always follow this simple rule: any | ||
231 | statically initialized clock data MUST be defined in a separate file | ||
232 | from the logic that implements its ops. Basically separate the logic | ||
233 | from the data and all is well. | ||
diff --git a/Documentation/crc32.txt b/Documentation/crc32.txt new file mode 100644 index 000000000000..a08a7dd9d625 --- /dev/null +++ b/Documentation/crc32.txt | |||
@@ -0,0 +1,182 @@ | |||
1 | A brief CRC tutorial. | ||
2 | |||
3 | A CRC is a long-division remainder. You add the CRC to the message, | ||
4 | and the whole thing (message+CRC) is a multiple of the given | ||
5 | CRC polynomial. To check the CRC, you can either check that the | ||
6 | CRC matches the recomputed value, *or* you can check that the | ||
7 | remainder computed on the message+CRC is 0. This latter approach | ||
8 | is used by a lot of hardware implementations, and is why so many | ||
9 | protocols put the end-of-frame flag after the CRC. | ||
10 | |||
11 | It's actually the same long division you learned in school, except that | ||
12 | - We're working in binary, so the digits are only 0 and 1, and | ||
13 | - When dividing polynomials, there are no carries. Rather than add and | ||
14 | subtract, we just xor. Thus, we tend to get a bit sloppy about | ||
15 | the difference between adding and subtracting. | ||
16 | |||
17 | Like all division, the remainder is always smaller than the divisor. | ||
18 | To produce a 32-bit CRC, the divisor is actually a 33-bit CRC polynomial. | ||
19 | Since it's 33 bits long, bit 32 is always going to be set, so usually the | ||
20 | CRC is written in hex with the most significant bit omitted. (If you're | ||
21 | familiar with the IEEE 754 floating-point format, it's the same idea.) | ||
22 | |||
23 | Note that a CRC is computed over a string of *bits*, so you have | ||
24 | to decide on the endianness of the bits within each byte. To get | ||
25 | the best error-detecting properties, this should correspond to the | ||
26 | order they're actually sent. For example, standard RS-232 serial is | ||
27 | little-endian; the most significant bit (sometimes used for parity) | ||
28 | is sent last. And when appending a CRC word to a message, you should | ||
29 | do it in the right order, matching the endianness. | ||
30 | |||
31 | Just like with ordinary division, you proceed one digit (bit) at a time. | ||
32 | Each step of the division you take one more digit (bit) of the dividend | ||
33 | and append it to the current remainder. Then you figure out the | ||
34 | appropriate multiple of the divisor to subtract to being the remainder | ||
35 | back into range. In binary, this is easy - it has to be either 0 or 1, | ||
36 | and to make the XOR cancel, it's just a copy of bit 32 of the remainder. | ||
37 | |||
38 | When computing a CRC, we don't care about the quotient, so we can | ||
39 | throw the quotient bit away, but subtract the appropriate multiple of | ||
40 | the polynomial from the remainder and we're back to where we started, | ||
41 | ready to process the next bit. | ||
42 | |||
43 | A big-endian CRC written this way would be coded like: | ||
44 | for (i = 0; i < input_bits; i++) { | ||
45 | multiple = remainder & 0x80000000 ? CRCPOLY : 0; | ||
46 | remainder = (remainder << 1 | next_input_bit()) ^ multiple; | ||
47 | } | ||
48 | |||
49 | Notice how, to get at bit 32 of the shifted remainder, we look | ||
50 | at bit 31 of the remainder *before* shifting it. | ||
51 | |||
52 | But also notice how the next_input_bit() bits we're shifting into | ||
53 | the remainder don't actually affect any decision-making until | ||
54 | 32 bits later. Thus, the first 32 cycles of this are pretty boring. | ||
55 | Also, to add the CRC to a message, we need a 32-bit-long hole for it at | ||
56 | the end, so we have to add 32 extra cycles shifting in zeros at the | ||
57 | end of every message, | ||
58 | |||
59 | These details lead to a standard trick: rearrange merging in the | ||
60 | next_input_bit() until the moment it's needed. Then the first 32 cycles | ||
61 | can be precomputed, and merging in the final 32 zero bits to make room | ||
62 | for the CRC can be skipped entirely. This changes the code to: | ||
63 | |||
64 | for (i = 0; i < input_bits; i++) { | ||
65 | remainder ^= next_input_bit() << 31; | ||
66 | multiple = (remainder & 0x80000000) ? CRCPOLY : 0; | ||
67 | remainder = (remainder << 1) ^ multiple; | ||
68 | } | ||
69 | |||
70 | With this optimization, the little-endian code is particularly simple: | ||
71 | for (i = 0; i < input_bits; i++) { | ||
72 | remainder ^= next_input_bit(); | ||
73 | multiple = (remainder & 1) ? CRCPOLY : 0; | ||
74 | remainder = (remainder >> 1) ^ multiple; | ||
75 | } | ||
76 | |||
77 | The most significant coefficient of the remainder polynomial is stored | ||
78 | in the least significant bit of the binary "remainder" variable. | ||
79 | The other details of endianness have been hidden in CRCPOLY (which must | ||
80 | be bit-reversed) and next_input_bit(). | ||
81 | |||
82 | As long as next_input_bit is returning the bits in a sensible order, we don't | ||
83 | *have* to wait until the last possible moment to merge in additional bits. | ||
84 | We can do it 8 bits at a time rather than 1 bit at a time: | ||
85 | for (i = 0; i < input_bytes; i++) { | ||
86 | remainder ^= next_input_byte() << 24; | ||
87 | for (j = 0; j < 8; j++) { | ||
88 | multiple = (remainder & 0x80000000) ? CRCPOLY : 0; | ||
89 | remainder = (remainder << 1) ^ multiple; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | Or in little-endian: | ||
94 | for (i = 0; i < input_bytes; i++) { | ||
95 | remainder ^= next_input_byte(); | ||
96 | for (j = 0; j < 8; j++) { | ||
97 | multiple = (remainder & 1) ? CRCPOLY : 0; | ||
98 | remainder = (remainder >> 1) ^ multiple; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | If the input is a multiple of 32 bits, you can even XOR in a 32-bit | ||
103 | word at a time and increase the inner loop count to 32. | ||
104 | |||
105 | You can also mix and match the two loop styles, for example doing the | ||
106 | bulk of a message byte-at-a-time and adding bit-at-a-time processing | ||
107 | for any fractional bytes at the end. | ||
108 | |||
109 | To reduce the number of conditional branches, software commonly uses | ||
110 | the byte-at-a-time table method, popularized by Dilip V. Sarwate, | ||
111 | "Computation of Cyclic Redundancy Checks via Table Look-Up", Comm. ACM | ||
112 | v.31 no.8 (August 1998) p. 1008-1013. | ||
113 | |||
114 | Here, rather than just shifting one bit of the remainder to decide | ||
115 | in the correct multiple to subtract, we can shift a byte at a time. | ||
116 | This produces a 40-bit (rather than a 33-bit) intermediate remainder, | ||
117 | and the correct multiple of the polynomial to subtract is found using | ||
118 | a 256-entry lookup table indexed by the high 8 bits. | ||
119 | |||
120 | (The table entries are simply the CRC-32 of the given one-byte messages.) | ||
121 | |||
122 | When space is more constrained, smaller tables can be used, e.g. two | ||
123 | 4-bit shifts followed by a lookup in a 16-entry table. | ||
124 | |||
125 | It is not practical to process much more than 8 bits at a time using this | ||
126 | technique, because tables larger than 256 entries use too much memory and, | ||
127 | more importantly, too much of the L1 cache. | ||
128 | |||
129 | To get higher software performance, a "slicing" technique can be used. | ||
130 | See "High Octane CRC Generation with the Intel Slicing-by-8 Algorithm", | ||
131 | ftp://download.intel.com/technology/comms/perfnet/download/slicing-by-8.pdf | ||
132 | |||
133 | This does not change the number of table lookups, but does increase | ||
134 | the parallelism. With the classic Sarwate algorithm, each table lookup | ||
135 | must be completed before the index of the next can be computed. | ||
136 | |||
137 | A "slicing by 2" technique would shift the remainder 16 bits at a time, | ||
138 | producing a 48-bit intermediate remainder. Rather than doing a single | ||
139 | lookup in a 65536-entry table, the two high bytes are looked up in | ||
140 | two different 256-entry tables. Each contains the remainder required | ||
141 | to cancel out the corresponding byte. The tables are different because the | ||
142 | polynomials to cancel are different. One has non-zero coefficients from | ||
143 | x^32 to x^39, while the other goes from x^40 to x^47. | ||
144 | |||
145 | Since modern processors can handle many parallel memory operations, this | ||
146 | takes barely longer than a single table look-up and thus performs almost | ||
147 | twice as fast as the basic Sarwate algorithm. | ||
148 | |||
149 | This can be extended to "slicing by 4" using 4 256-entry tables. | ||
150 | Each step, 32 bits of data is fetched, XORed with the CRC, and the result | ||
151 | broken into bytes and looked up in the tables. Because the 32-bit shift | ||
152 | leaves the low-order bits of the intermediate remainder zero, the | ||
153 | final CRC is simply the XOR of the 4 table look-ups. | ||
154 | |||
155 | But this still enforces sequential execution: a second group of table | ||
156 | look-ups cannot begin until the previous groups 4 table look-ups have all | ||
157 | been completed. Thus, the processor's load/store unit is sometimes idle. | ||
158 | |||
159 | To make maximum use of the processor, "slicing by 8" performs 8 look-ups | ||
160 | in parallel. Each step, the 32-bit CRC is shifted 64 bits and XORed | ||
161 | with 64 bits of input data. What is important to note is that 4 of | ||
162 | those 8 bytes are simply copies of the input data; they do not depend | ||
163 | on the previous CRC at all. Thus, those 4 table look-ups may commence | ||
164 | immediately, without waiting for the previous loop iteration. | ||
165 | |||
166 | By always having 4 loads in flight, a modern superscalar processor can | ||
167 | be kept busy and make full use of its L1 cache. | ||
168 | |||
169 | Two more details about CRC implementation in the real world: | ||
170 | |||
171 | Normally, appending zero bits to a message which is already a multiple | ||
172 | of a polynomial produces a larger multiple of that polynomial. Thus, | ||
173 | a basic CRC will not detect appended zero bits (or bytes). To enable | ||
174 | a CRC to detect this condition, it's common to invert the CRC before | ||
175 | appending it. This makes the remainder of the message+crc come out not | ||
176 | as zero, but some fixed non-zero value. (The CRC of the inversion | ||
177 | pattern, 0xffffffff.) | ||
178 | |||
179 | The same problem applies to zero bits prepended to the message, and a | ||
180 | similar solution is used. Instead of starting the CRC computation with | ||
181 | a remainder of 0, an initial remainder of all ones is used. As long as | ||
182 | you start the same way on decoding, it doesn't make a difference. | ||
diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.txt index 1ff044d87ca4..3370bc4d7b98 100644 --- a/Documentation/device-mapper/thin-provisioning.txt +++ b/Documentation/device-mapper/thin-provisioning.txt | |||
@@ -75,10 +75,12 @@ less sharing than average you'll need a larger-than-average metadata device. | |||
75 | 75 | ||
76 | As a guide, we suggest you calculate the number of bytes to use in the | 76 | As a guide, we suggest you calculate the number of bytes to use in the |
77 | metadata device as 48 * $data_dev_size / $data_block_size but round it up | 77 | metadata device as 48 * $data_dev_size / $data_block_size but round it up |
78 | to 2MB if the answer is smaller. The largest size supported is 16GB. | 78 | to 2MB if the answer is smaller. If you're creating large numbers of |
79 | snapshots which are recording large amounts of change, you may find you | ||
80 | need to increase this. | ||
79 | 81 | ||
80 | If you're creating large numbers of snapshots which are recording large | 82 | The largest size supported is 16GB: If the device is larger, |
81 | amounts of change, you may need find you need to increase this. | 83 | a warning will be issued and the excess space will not be used. |
82 | 84 | ||
83 | Reloading a pool table | 85 | Reloading a pool table |
84 | ---------------------- | 86 | ---------------------- |
@@ -167,6 +169,38 @@ ii) Using an internal snapshot. | |||
167 | 169 | ||
168 | dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 1" | 170 | dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 1" |
169 | 171 | ||
172 | External snapshots | ||
173 | ------------------ | ||
174 | |||
175 | You can use an external _read only_ device as an origin for a | ||
176 | thinly-provisioned volume. Any read to an unprovisioned area of the | ||
177 | thin device will be passed through to the origin. Writes trigger | ||
178 | the allocation of new blocks as usual. | ||
179 | |||
180 | One use case for this is VM hosts that want to run guests on | ||
181 | thinly-provisioned volumes but have the base image on another device | ||
182 | (possibly shared between many VMs). | ||
183 | |||
184 | You must not write to the origin device if you use this technique! | ||
185 | Of course, you may write to the thin device and take internal snapshots | ||
186 | of the thin volume. | ||
187 | |||
188 | i) Creating a snapshot of an external device | ||
189 | |||
190 | This is the same as creating a thin device. | ||
191 | You don't mention the origin at this stage. | ||
192 | |||
193 | dmsetup message /dev/mapper/pool 0 "create_thin 0" | ||
194 | |||
195 | ii) Using a snapshot of an external device. | ||
196 | |||
197 | Append an extra parameter to the thin target specifying the origin: | ||
198 | |||
199 | dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 0 /dev/image" | ||
200 | |||
201 | N.B. All descendants (internal snapshots) of this snapshot require the | ||
202 | same extra origin parameter. | ||
203 | |||
170 | Deactivation | 204 | Deactivation |
171 | ------------ | 205 | ------------ |
172 | 206 | ||
@@ -189,7 +223,13 @@ i) Constructor | |||
189 | <low water mark (blocks)> [<number of feature args> [<arg>]*] | 223 | <low water mark (blocks)> [<number of feature args> [<arg>]*] |
190 | 224 | ||
191 | Optional feature arguments: | 225 | Optional feature arguments: |
192 | - 'skip_block_zeroing': skips the zeroing of newly-provisioned blocks. | 226 | |
227 | skip_block_zeroing: Skip the zeroing of newly-provisioned blocks. | ||
228 | |||
229 | ignore_discard: Disable discard support. | ||
230 | |||
231 | no_discard_passdown: Don't pass discards down to the underlying | ||
232 | data device, but just remove the mapping. | ||
193 | 233 | ||
194 | Data block size must be between 64KB (128 sectors) and 1GB | 234 | Data block size must be between 64KB (128 sectors) and 1GB |
195 | (2097152 sectors) inclusive. | 235 | (2097152 sectors) inclusive. |
@@ -237,16 +277,6 @@ iii) Messages | |||
237 | 277 | ||
238 | Deletes a thin device. Irreversible. | 278 | Deletes a thin device. Irreversible. |
239 | 279 | ||
240 | trim <dev id> <new size in sectors> | ||
241 | |||
242 | Delete mappings from the end of a thin device. Irreversible. | ||
243 | You might want to use this if you're reducing the size of | ||
244 | your thinly-provisioned device. In many cases, due to the | ||
245 | sharing of blocks between devices, it is not possible to | ||
246 | determine in advance how much space 'trim' will release. (In | ||
247 | future a userspace tool might be able to perform this | ||
248 | calculation.) | ||
249 | |||
250 | set_transaction_id <current id> <new id> | 280 | set_transaction_id <current id> <new id> |
251 | 281 | ||
252 | Userland volume managers, such as LVM, need a way to | 282 | Userland volume managers, such as LVM, need a way to |
@@ -262,7 +292,7 @@ iii) Messages | |||
262 | 292 | ||
263 | i) Constructor | 293 | i) Constructor |
264 | 294 | ||
265 | thin <pool dev> <dev id> | 295 | thin <pool dev> <dev id> [<external origin dev>] |
266 | 296 | ||
267 | pool dev: | 297 | pool dev: |
268 | the thin-pool device, e.g. /dev/mapper/my_pool or 253:0 | 298 | the thin-pool device, e.g. /dev/mapper/my_pool or 253:0 |
@@ -271,6 +301,11 @@ i) Constructor | |||
271 | the internal device identifier of the device to be | 301 | the internal device identifier of the device to be |
272 | activated. | 302 | activated. |
273 | 303 | ||
304 | external origin dev: | ||
305 | an optional block device outside the pool to be treated as a | ||
306 | read-only snapshot origin: reads to unprovisioned areas of the | ||
307 | thin target will be mapped to this device. | ||
308 | |||
274 | The pool doesn't store any size against the thin devices. If you | 309 | The pool doesn't store any size against the thin devices. If you |
275 | load a thin target that is smaller than you've been using previously, | 310 | load a thin target that is smaller than you've been using previously, |
276 | then you'll have no access to blocks mapped beyond the end. If you | 311 | then you'll have no access to blocks mapped beyond the end. If you |
diff --git a/Documentation/device-mapper/verity.txt b/Documentation/device-mapper/verity.txt new file mode 100644 index 000000000000..32e48797a14f --- /dev/null +++ b/Documentation/device-mapper/verity.txt | |||
@@ -0,0 +1,194 @@ | |||
1 | dm-verity | ||
2 | ========== | ||
3 | |||
4 | Device-Mapper's "verity" target provides transparent integrity checking of | ||
5 | block devices using a cryptographic digest provided by the kernel crypto API. | ||
6 | This target is read-only. | ||
7 | |||
8 | Construction Parameters | ||
9 | ======================= | ||
10 | <version> <dev> <hash_dev> <hash_start> | ||
11 | <data_block_size> <hash_block_size> | ||
12 | <num_data_blocks> <hash_start_block> | ||
13 | <algorithm> <digest> <salt> | ||
14 | |||
15 | <version> | ||
16 | This is the version number of the on-disk format. | ||
17 | |||
18 | 0 is the original format used in the Chromium OS. | ||
19 | The salt is appended when hashing, digests are stored continuously and | ||
20 | the rest of the block is padded with zeros. | ||
21 | |||
22 | 1 is the current format that should be used for new devices. | ||
23 | The salt is prepended when hashing and each digest is | ||
24 | padded with zeros to the power of two. | ||
25 | |||
26 | <dev> | ||
27 | This is the device containing the data the integrity of which needs to be | ||
28 | checked. It may be specified as a path, like /dev/sdaX, or a device number, | ||
29 | <major>:<minor>. | ||
30 | |||
31 | <hash_dev> | ||
32 | This is the device that that supplies the hash tree data. It may be | ||
33 | specified similarly to the device path and may be the same device. If the | ||
34 | same device is used, the hash_start should be outside of the dm-verity | ||
35 | configured device size. | ||
36 | |||
37 | <data_block_size> | ||
38 | The block size on a data device. Each block corresponds to one digest on | ||
39 | the hash device. | ||
40 | |||
41 | <hash_block_size> | ||
42 | The size of a hash block. | ||
43 | |||
44 | <num_data_blocks> | ||
45 | The number of data blocks on the data device. Additional blocks are | ||
46 | inaccessible. You can place hashes to the same partition as data, in this | ||
47 | case hashes are placed after <num_data_blocks>. | ||
48 | |||
49 | <hash_start_block> | ||
50 | This is the offset, in <hash_block_size>-blocks, from the start of hash_dev | ||
51 | to the root block of the hash tree. | ||
52 | |||
53 | <algorithm> | ||
54 | The cryptographic hash algorithm used for this device. This should | ||
55 | be the name of the algorithm, like "sha1". | ||
56 | |||
57 | <digest> | ||
58 | The hexadecimal encoding of the cryptographic hash of the root hash block | ||
59 | and the salt. This hash should be trusted as there is no other authenticity | ||
60 | beyond this point. | ||
61 | |||
62 | <salt> | ||
63 | The hexadecimal encoding of the salt value. | ||
64 | |||
65 | Theory of operation | ||
66 | =================== | ||
67 | |||
68 | dm-verity is meant to be setup as part of a verified boot path. This | ||
69 | may be anything ranging from a boot using tboot or trustedgrub to just | ||
70 | booting from a known-good device (like a USB drive or CD). | ||
71 | |||
72 | When a dm-verity device is configured, it is expected that the caller | ||
73 | has been authenticated in some way (cryptographic signatures, etc). | ||
74 | After instantiation, all hashes will be verified on-demand during | ||
75 | disk access. If they cannot be verified up to the root node of the | ||
76 | tree, the root hash, then the I/O will fail. This should identify | ||
77 | tampering with any data on the device and the hash data. | ||
78 | |||
79 | Cryptographic hashes are used to assert the integrity of the device on a | ||
80 | per-block basis. This allows for a lightweight hash computation on first read | ||
81 | into the page cache. Block hashes are stored linearly-aligned to the nearest | ||
82 | block the size of a page. | ||
83 | |||
84 | Hash Tree | ||
85 | --------- | ||
86 | |||
87 | Each node in the tree is a cryptographic hash. If it is a leaf node, the hash | ||
88 | is of some block data on disk. If it is an intermediary node, then the hash is | ||
89 | of a number of child nodes. | ||
90 | |||
91 | Each entry in the tree is a collection of neighboring nodes that fit in one | ||
92 | block. The number is determined based on block_size and the size of the | ||
93 | selected cryptographic digest algorithm. The hashes are linearly-ordered in | ||
94 | this entry and any unaligned trailing space is ignored but included when | ||
95 | calculating the parent node. | ||
96 | |||
97 | The tree looks something like: | ||
98 | |||
99 | alg = sha256, num_blocks = 32768, block_size = 4096 | ||
100 | |||
101 | [ root ] | ||
102 | / . . . \ | ||
103 | [entry_0] [entry_1] | ||
104 | / . . . \ . . . \ | ||
105 | [entry_0_0] . . . [entry_0_127] . . . . [entry_1_127] | ||
106 | / ... \ / . . . \ / \ | ||
107 | blk_0 ... blk_127 blk_16256 blk_16383 blk_32640 . . . blk_32767 | ||
108 | |||
109 | |||
110 | On-disk format | ||
111 | ============== | ||
112 | |||
113 | Below is the recommended on-disk format. The verity kernel code does not | ||
114 | read the on-disk header. It only reads the hash blocks which directly | ||
115 | follow the header. It is expected that a user-space tool will verify the | ||
116 | integrity of the verity_header and then call dmsetup with the correct | ||
117 | parameters. Alternatively, the header can be omitted and the dmsetup | ||
118 | parameters can be passed via the kernel command-line in a rooted chain | ||
119 | of trust where the command-line is verified. | ||
120 | |||
121 | The on-disk format is especially useful in cases where the hash blocks | ||
122 | are on a separate partition. The magic number allows easy identification | ||
123 | of the partition contents. Alternatively, the hash blocks can be stored | ||
124 | in the same partition as the data to be verified. In such a configuration | ||
125 | the filesystem on the partition would be sized a little smaller than | ||
126 | the full-partition, leaving room for the hash blocks. | ||
127 | |||
128 | struct superblock { | ||
129 | uint8_t signature[8] | ||
130 | "verity\0\0"; | ||
131 | |||
132 | uint8_t version; | ||
133 | 1 - current format | ||
134 | |||
135 | uint8_t data_block_bits; | ||
136 | log2(data block size) | ||
137 | |||
138 | uint8_t hash_block_bits; | ||
139 | log2(hash block size) | ||
140 | |||
141 | uint8_t pad1[1]; | ||
142 | zero padding | ||
143 | |||
144 | uint16_t salt_size; | ||
145 | big-endian salt size | ||
146 | |||
147 | uint8_t pad2[2]; | ||
148 | zero padding | ||
149 | |||
150 | uint32_t data_blocks_hi; | ||
151 | big-endian high 32 bits of the 64-bit number of data blocks | ||
152 | |||
153 | uint32_t data_blocks_lo; | ||
154 | big-endian low 32 bits of the 64-bit number of data blocks | ||
155 | |||
156 | uint8_t algorithm[16]; | ||
157 | cryptographic algorithm | ||
158 | |||
159 | uint8_t salt[384]; | ||
160 | salt (the salt size is specified above) | ||
161 | |||
162 | uint8_t pad3[88]; | ||
163 | zero padding to 512-byte boundary | ||
164 | } | ||
165 | |||
166 | Directly following the header (and with sector number padded to the next hash | ||
167 | block boundary) are the hash blocks which are stored a depth at a time | ||
168 | (starting from the root), sorted in order of increasing index. | ||
169 | |||
170 | Status | ||
171 | ====== | ||
172 | V (for Valid) is returned if every check performed so far was valid. | ||
173 | If any check failed, C (for Corruption) is returned. | ||
174 | |||
175 | Example | ||
176 | ======= | ||
177 | |||
178 | Setup a device: | ||
179 | dmsetup create vroot --table \ | ||
180 | "0 2097152 "\ | ||
181 | "verity 1 /dev/sda1 /dev/sda2 4096 4096 2097152 1 "\ | ||
182 | "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\ | ||
183 | "1234000000000000000000000000000000000000000000000000000000000000" | ||
184 | |||
185 | A command line tool veritysetup is available to compute or verify | ||
186 | the hash tree or activate the kernel driver. This is available from | ||
187 | the LVM2 upstream repository and may be supplied as a package called | ||
188 | device-mapper-verity-tools: | ||
189 | git://sources.redhat.com/git/lvm2 | ||
190 | http://sourceware.org/git/?p=lvm2.git | ||
191 | http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/verity?cvsroot=lvm2 | ||
192 | |||
193 | veritysetup -a vroot /dev/sda1 /dev/sda2 \ | ||
194 | 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 | ||
diff --git a/Documentation/devicetree/bindings/arm/atmel-aic.txt b/Documentation/devicetree/bindings/arm/atmel-aic.txt new file mode 100644 index 000000000000..aabca4f83402 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/atmel-aic.txt | |||
@@ -0,0 +1,38 @@ | |||
1 | * Advanced Interrupt Controller (AIC) | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: Should be "atmel,<chip>-aic" | ||
5 | - interrupt-controller: Identifies the node as an interrupt controller. | ||
6 | - interrupt-parent: For single AIC system, it is an empty property. | ||
7 | - #interrupt-cells: The number of cells to define the interrupts. It sould be 2. | ||
8 | The first cell is the IRQ number (aka "Peripheral IDentifier" on datasheet). | ||
9 | The second cell is used to specify flags: | ||
10 | bits[3:0] trigger type and level flags: | ||
11 | 1 = low-to-high edge triggered. | ||
12 | 2 = high-to-low edge triggered. | ||
13 | 4 = active high level-sensitive. | ||
14 | 8 = active low level-sensitive. | ||
15 | Valid combinations are 1, 2, 3, 4, 8. | ||
16 | Default flag for internal sources should be set to 4 (active high). | ||
17 | - reg: Should contain AIC registers location and length | ||
18 | |||
19 | Examples: | ||
20 | /* | ||
21 | * AIC | ||
22 | */ | ||
23 | aic: interrupt-controller@fffff000 { | ||
24 | compatible = "atmel,at91rm9200-aic"; | ||
25 | interrupt-controller; | ||
26 | interrupt-parent; | ||
27 | #interrupt-cells = <2>; | ||
28 | reg = <0xfffff000 0x200>; | ||
29 | }; | ||
30 | |||
31 | /* | ||
32 | * An interrupt generating device that is wired to an AIC. | ||
33 | */ | ||
34 | dma: dma-controller@ffffec00 { | ||
35 | compatible = "atmel,at91sam9g45-dma"; | ||
36 | reg = <0xffffec00 0x200>; | ||
37 | interrupts = <21 4>; | ||
38 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt new file mode 100644 index 000000000000..ecc81e368715 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt | |||
@@ -0,0 +1,92 @@ | |||
1 | Atmel AT91 device tree bindings. | ||
2 | ================================ | ||
3 | |||
4 | PIT Timer required properties: | ||
5 | - compatible: Should be "atmel,at91sam9260-pit" | ||
6 | - reg: Should contain registers location and length | ||
7 | - interrupts: Should contain interrupt for the PIT which is the IRQ line | ||
8 | shared across all System Controller members. | ||
9 | |||
10 | TC/TCLIB Timer required properties: | ||
11 | - compatible: Should be "atmel,<chip>-pit". | ||
12 | <chip> can be "at91rm9200" or "at91sam9x5" | ||
13 | - reg: Should contain registers location and length | ||
14 | - interrupts: Should contain all interrupts for the TC block | ||
15 | Note that you can specify several interrupt cells if the TC | ||
16 | block has one interrupt per channel. | ||
17 | |||
18 | Examples: | ||
19 | |||
20 | One interrupt per TC block: | ||
21 | tcb0: timer@fff7c000 { | ||
22 | compatible = "atmel,at91rm9200-tcb"; | ||
23 | reg = <0xfff7c000 0x100>; | ||
24 | interrupts = <18 4>; | ||
25 | }; | ||
26 | |||
27 | One interrupt per TC channel in a TC block: | ||
28 | tcb1: timer@fffdc000 { | ||
29 | compatible = "atmel,at91rm9200-tcb"; | ||
30 | reg = <0xfffdc000 0x100>; | ||
31 | interrupts = <26 4 27 4 28 4>; | ||
32 | }; | ||
33 | |||
34 | RSTC Reset Controller required properties: | ||
35 | - compatible: Should be "atmel,<chip>-rstc". | ||
36 | <chip> can be "at91sam9260" or "at91sam9g45" | ||
37 | - reg: Should contain registers location and length | ||
38 | |||
39 | Example: | ||
40 | |||
41 | rstc@fffffd00 { | ||
42 | compatible = "atmel,at91sam9260-rstc"; | ||
43 | reg = <0xfffffd00 0x10>; | ||
44 | }; | ||
45 | |||
46 | RAMC SDRAM/DDR Controller required properties: | ||
47 | - compatible: Should be "atmel,at91sam9260-sdramc", | ||
48 | "atmel,at91sam9g45-ddramc", | ||
49 | - reg: Should contain registers location and length | ||
50 | For at91sam9263 and at91sam9g45 you must specify 2 entries. | ||
51 | |||
52 | Examples: | ||
53 | |||
54 | ramc0: ramc@ffffe800 { | ||
55 | compatible = "atmel,at91sam9g45-ddramc"; | ||
56 | reg = <0xffffe800 0x200>; | ||
57 | }; | ||
58 | |||
59 | ramc0: ramc@ffffe400 { | ||
60 | compatible = "atmel,at91sam9g45-ddramc"; | ||
61 | reg = <0xffffe400 0x200 | ||
62 | 0xffffe600 0x200>; | ||
63 | }; | ||
64 | |||
65 | SHDWC Shutdown Controller | ||
66 | |||
67 | required properties: | ||
68 | - compatible: Should be "atmel,<chip>-shdwc". | ||
69 | <chip> can be "at91sam9260", "at91sam9rl" or "at91sam9x5". | ||
70 | - reg: Should contain registers location and length | ||
71 | |||
72 | optional properties: | ||
73 | - atmel,wakeup-mode: String, operation mode of the wakeup mode. | ||
74 | Supported values are: "none", "high", "low", "any". | ||
75 | - atmel,wakeup-counter: Counter on Wake-up 0 (between 0x0 and 0xf). | ||
76 | |||
77 | optional at91sam9260 properties: | ||
78 | - atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up. | ||
79 | |||
80 | optional at91sam9rl properties: | ||
81 | - atmel,wakeup-rtc-timer: boolean to enable Real-time Clock Wake-up. | ||
82 | - atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up. | ||
83 | |||
84 | optional at91sam9x5 properties: | ||
85 | - atmel,wakeup-rtc-timer: boolean to enable Real-time Clock Wake-up. | ||
86 | |||
87 | Example: | ||
88 | |||
89 | rstc@fffffd00 { | ||
90 | compatible = "atmel,at91sam9260-rstc"; | ||
91 | reg = <0xfffffd00 0x10>; | ||
92 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/atmel-pmc.txt b/Documentation/devicetree/bindings/arm/atmel-pmc.txt new file mode 100644 index 000000000000..389bed5056e8 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/atmel-pmc.txt | |||
@@ -0,0 +1,11 @@ | |||
1 | * Power Management Controller (PMC) | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: Should be "atmel,at91rm9200-pmc" | ||
5 | - reg: Should contain PMC registers location and length | ||
6 | |||
7 | Examples: | ||
8 | pmc: pmc@fffffc00 { | ||
9 | compatible = "atmel,at91rm9200-pmc"; | ||
10 | reg = <0xfffffc00 0x100>; | ||
11 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/fsl.txt b/Documentation/devicetree/bindings/arm/fsl.txt index 54bdddadf1cf..bfbc771a65f8 100644 --- a/Documentation/devicetree/bindings/arm/fsl.txt +++ b/Documentation/devicetree/bindings/arm/fsl.txt | |||
@@ -28,3 +28,25 @@ Required root node properties: | |||
28 | i.MX6 Quad SABRE Lite Board | 28 | i.MX6 Quad SABRE Lite Board |
29 | Required root node properties: | 29 | Required root node properties: |
30 | - compatible = "fsl,imx6q-sabrelite", "fsl,imx6q"; | 30 | - compatible = "fsl,imx6q-sabrelite", "fsl,imx6q"; |
31 | |||
32 | Generic i.MX boards | ||
33 | ------------------- | ||
34 | |||
35 | No iomux setup is done for these boards, so this must have been configured | ||
36 | by the bootloader for boards to work with the generic bindings. | ||
37 | |||
38 | i.MX27 generic board | ||
39 | Required root node properties: | ||
40 | - compatible = "fsl,imx27"; | ||
41 | |||
42 | i.MX51 generic board | ||
43 | Required root node properties: | ||
44 | - compatible = "fsl,imx51"; | ||
45 | |||
46 | i.MX53 generic board | ||
47 | Required root node properties: | ||
48 | - compatible = "fsl,imx53"; | ||
49 | |||
50 | i.MX6q generic board | ||
51 | Required root node properties: | ||
52 | - compatible = "fsl,imx6q"; | ||
diff --git a/Documentation/devicetree/bindings/arm/mrvl.txt b/Documentation/devicetree/bindings/arm/mrvl.txt new file mode 100644 index 000000000000..d8de933e9d81 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/mrvl.txt | |||
@@ -0,0 +1,6 @@ | |||
1 | Marvell Platforms Device Tree Bindings | ||
2 | ---------------------------------------------------- | ||
3 | |||
4 | PXA168 Aspenite Board | ||
5 | Required root node properties: | ||
6 | - compatible = "mrvl,pxa168-aspenite", "mrvl,pxa168"; | ||
diff --git a/Documentation/devicetree/bindings/arm/omap/intc.txt b/Documentation/devicetree/bindings/arm/omap/intc.txt new file mode 100644 index 000000000000..f2583e6ec060 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/omap/intc.txt | |||
@@ -0,0 +1,27 @@ | |||
1 | * OMAP Interrupt Controller | ||
2 | |||
3 | OMAP2/3 are using a TI interrupt controller that can support several | ||
4 | configurable number of interrupts. | ||
5 | |||
6 | Main node required properties: | ||
7 | |||
8 | - compatible : should be: | ||
9 | "ti,omap2-intc" | ||
10 | - interrupt-controller : Identifies the node as an interrupt controller | ||
11 | - #interrupt-cells : Specifies the number of cells needed to encode an | ||
12 | interrupt source. The type shall be a <u32> and the value shall be 1. | ||
13 | |||
14 | The cell contains the interrupt number in the range [0-128]. | ||
15 | - ti,intc-size: Number of interrupts handled by the interrupt controller. | ||
16 | - reg: physical base address and size of the intc registers map. | ||
17 | |||
18 | Example: | ||
19 | |||
20 | intc: interrupt-controller@1 { | ||
21 | compatible = "ti,omap2-intc"; | ||
22 | interrupt-controller; | ||
23 | #interrupt-cells = <1>; | ||
24 | ti,intc-size = <96>; | ||
25 | reg = <0x48200000 0x1000>; | ||
26 | }; | ||
27 | |||
diff --git a/Documentation/devicetree/bindings/arm/spear.txt b/Documentation/devicetree/bindings/arm/spear.txt new file mode 100644 index 000000000000..f8e54f092328 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/spear.txt | |||
@@ -0,0 +1,8 @@ | |||
1 | ST SPEAr Platforms Device Tree Bindings | ||
2 | --------------------------------------- | ||
3 | |||
4 | Boards with the ST SPEAr600 SoC shall have the following properties: | ||
5 | |||
6 | Required root node property: | ||
7 | |||
8 | compatible = "st,spear600"; | ||
diff --git a/Documentation/devicetree/bindings/arm/tegra/emc.txt b/Documentation/devicetree/bindings/arm/tegra/emc.txt new file mode 100644 index 000000000000..09335f8eee00 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/tegra/emc.txt | |||
@@ -0,0 +1,100 @@ | |||
1 | Embedded Memory Controller | ||
2 | |||
3 | Properties: | ||
4 | - name : Should be emc | ||
5 | - #address-cells : Should be 1 | ||
6 | - #size-cells : Should be 0 | ||
7 | - compatible : Should contain "nvidia,tegra20-emc". | ||
8 | - reg : Offset and length of the register set for the device | ||
9 | - nvidia,use-ram-code : If present, the sub-nodes will be addressed | ||
10 | and chosen using the ramcode board selector. If omitted, only one | ||
11 | set of tables can be present and said tables will be used | ||
12 | irrespective of ram-code configuration. | ||
13 | |||
14 | Child device nodes describe the memory settings for different configurations and clock rates. | ||
15 | |||
16 | Example: | ||
17 | |||
18 | emc@7000f400 { | ||
19 | #address-cells = < 1 >; | ||
20 | #size-cells = < 0 >; | ||
21 | compatible = "nvidia,tegra20-emc"; | ||
22 | reg = <0x7000f4000 0x200>; | ||
23 | } | ||
24 | |||
25 | |||
26 | Embedded Memory Controller ram-code table | ||
27 | |||
28 | If the emc node has the nvidia,use-ram-code property present, then the | ||
29 | next level of nodes below the emc table are used to specify which settings | ||
30 | apply for which ram-code settings. | ||
31 | |||
32 | If the emc node lacks the nvidia,use-ram-code property, this level is omitted | ||
33 | and the tables are stored directly under the emc node (see below). | ||
34 | |||
35 | Properties: | ||
36 | |||
37 | - name : Should be emc-tables | ||
38 | - nvidia,ram-code : the binary representation of the ram-code board strappings | ||
39 | for which this node (and children) are valid. | ||
40 | |||
41 | |||
42 | |||
43 | Embedded Memory Controller configuration table | ||
44 | |||
45 | This is a table containing the EMC register settings for the various | ||
46 | operating speeds of the memory controller. They are always located as | ||
47 | subnodes of the emc controller node. | ||
48 | |||
49 | There are two ways of specifying which tables to use: | ||
50 | |||
51 | * The simplest is if there is just one set of tables in the device tree, | ||
52 | and they will always be used (based on which frequency is used). | ||
53 | This is the preferred method, especially when firmware can fill in | ||
54 | this information based on the specific system information and just | ||
55 | pass it on to the kernel. | ||
56 | |||
57 | * The slightly more complex one is when more than one memory configuration | ||
58 | might exist on the system. The Tegra20 platform handles this during | ||
59 | early boot by selecting one out of possible 4 memory settings based | ||
60 | on a 2-pin "ram code" bootstrap setting on the board. The values of | ||
61 | these strappings can be read through a register in the SoC, and thus | ||
62 | used to select which tables to use. | ||
63 | |||
64 | Properties: | ||
65 | - name : Should be emc-table | ||
66 | - compatible : Should contain "nvidia,tegra20-emc-table". | ||
67 | - reg : either an opaque enumerator to tell different tables apart, or | ||
68 | the valid frequency for which the table should be used (in kHz). | ||
69 | - clock-frequency : the clock frequency for the EMC at which this | ||
70 | table should be used (in kHz). | ||
71 | - nvidia,emc-registers : a 46 word array of EMC registers to be programmed | ||
72 | for operation at the 'clock-frequency' setting. | ||
73 | The order and contents of the registers are: | ||
74 | RC, RFC, RAS, RP, R2W, W2R, R2P, W2P, RD_RCD, WR_RCD, RRD, REXT, | ||
75 | WDV, QUSE, QRST, QSAFE, RDV, REFRESH, BURST_REFRESH_NUM, PDEX2WR, | ||
76 | PDEX2RD, PCHG2PDEN, ACT2PDEN, AR2PDEN, RW2PDEN, TXSR, TCKE, TFAW, | ||
77 | TRPAB, TCLKSTABLE, TCLKSTOP, TREFBW, QUSE_EXTRA, FBIO_CFG6, ODT_WRITE, | ||
78 | ODT_READ, FBIO_CFG5, CFG_DIG_DLL, DLL_XFORM_DQS, DLL_XFORM_QUSE, | ||
79 | ZCAL_REF_CNT, ZCAL_WAIT_CNT, AUTO_CAL_INTERVAL, CFG_CLKTRIM_0, | ||
80 | CFG_CLKTRIM_1, CFG_CLKTRIM_2 | ||
81 | |||
82 | emc-table@166000 { | ||
83 | reg = <166000>; | ||
84 | compatible = "nvidia,tegra20-emc-table"; | ||
85 | clock-frequency = < 166000 >; | ||
86 | nvidia,emc-registers = < 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
87 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
88 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
89 | 0 0 0 0 >; | ||
90 | }; | ||
91 | |||
92 | emc-table@333000 { | ||
93 | reg = <333000>; | ||
94 | compatible = "nvidia,tegra20-emc-table"; | ||
95 | clock-frequency = < 333000 >; | ||
96 | nvidia,emc-registers = < 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
97 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
98 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
99 | 0 0 0 0 >; | ||
100 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt new file mode 100644 index 000000000000..b5846e21cc2e --- /dev/null +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | NVIDIA Tegra Power Management Controller (PMC) | ||
2 | |||
3 | Properties: | ||
4 | - name : Should be pmc | ||
5 | - compatible : Should contain "nvidia,tegra<chip>-pmc". | ||
6 | - reg : Offset and length of the register set for the device | ||
7 | - nvidia,invert-interrupt : If present, inverts the PMU interrupt signal. | ||
8 | The PMU is an external Power Management Unit, whose interrupt output | ||
9 | signal is fed into the PMC. This signal is optionally inverted, and then | ||
10 | fed into the ARM GIC. The PMC is not involved in the detection or | ||
11 | handling of this interrupt signal, merely its inversion. | ||
12 | |||
13 | Example: | ||
14 | |||
15 | pmc@7000f400 { | ||
16 | compatible = "nvidia,tegra20-pmc"; | ||
17 | reg = <0x7000e400 0x400>; | ||
18 | nvidia,invert-interrupt; | ||
19 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/twd.txt b/Documentation/devicetree/bindings/arm/twd.txt new file mode 100644 index 000000000000..75b8610939fa --- /dev/null +++ b/Documentation/devicetree/bindings/arm/twd.txt | |||
@@ -0,0 +1,48 @@ | |||
1 | * ARM Timer Watchdog | ||
2 | |||
3 | ARM 11MP, Cortex-A5 and Cortex-A9 are often associated with a per-core | ||
4 | Timer-Watchdog (aka TWD), which provides both a per-cpu local timer | ||
5 | and watchdog. | ||
6 | |||
7 | The TWD is usually attached to a GIC to deliver its two per-processor | ||
8 | interrupts. | ||
9 | |||
10 | ** Timer node required properties: | ||
11 | |||
12 | - compatible : Should be one of: | ||
13 | "arm,cortex-a9-twd-timer" | ||
14 | "arm,cortex-a5-twd-timer" | ||
15 | "arm,arm11mp-twd-timer" | ||
16 | |||
17 | - interrupts : One interrupt to each core | ||
18 | |||
19 | - reg : Specify the base address and the size of the TWD timer | ||
20 | register window. | ||
21 | |||
22 | Example: | ||
23 | |||
24 | twd-timer@2c000600 { | ||
25 | compatible = "arm,arm11mp-twd-timer""; | ||
26 | reg = <0x2c000600 0x20>; | ||
27 | interrupts = <1 13 0xf01>; | ||
28 | }; | ||
29 | |||
30 | ** Watchdog node properties: | ||
31 | |||
32 | - compatible : Should be one of: | ||
33 | "arm,cortex-a9-twd-wdt" | ||
34 | "arm,cortex-a5-twd-wdt" | ||
35 | "arm,arm11mp-twd-wdt" | ||
36 | |||
37 | - interrupts : One interrupt to each core | ||
38 | |||
39 | - reg : Specify the base address and the size of the TWD watchdog | ||
40 | register window. | ||
41 | |||
42 | Example: | ||
43 | |||
44 | twd-watchdog@2c000620 { | ||
45 | compatible = "arm,arm11mp-twd-wdt"; | ||
46 | reg = <0x2c000620 0x20>; | ||
47 | interrupts = <1 14 0xf01>; | ||
48 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/vexpress.txt b/Documentation/devicetree/bindings/arm/vexpress.txt new file mode 100644 index 000000000000..ec8b50cbb2e8 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/vexpress.txt | |||
@@ -0,0 +1,146 @@ | |||
1 | ARM Versatile Express boards family | ||
2 | ----------------------------------- | ||
3 | |||
4 | ARM's Versatile Express platform consists of a motherboard and one | ||
5 | or more daughterboards (tiles). The motherboard provides a set of | ||
6 | peripherals. Processor and RAM "live" on the tiles. | ||
7 | |||
8 | The motherboard and each core tile should be described by a separate | ||
9 | Device Tree source file, with the tile's description including | ||
10 | the motherboard file using a /include/ directive. As the motherboard | ||
11 | can be initialized in one of two different configurations ("memory | ||
12 | maps"), care must be taken to include the correct one. | ||
13 | |||
14 | Required properties in the root node: | ||
15 | - compatible value: | ||
16 | compatible = "arm,vexpress,<model>", "arm,vexpress"; | ||
17 | where <model> is the full tile model name (as used in the tile's | ||
18 | Technical Reference Manual), eg.: | ||
19 | - for Coretile Express A5x2 (V2P-CA5s): | ||
20 | compatible = "arm,vexpress,v2p-ca5s", "arm,vexpress"; | ||
21 | - for Coretile Express A9x4 (V2P-CA9): | ||
22 | compatible = "arm,vexpress,v2p-ca9", "arm,vexpress"; | ||
23 | If a tile comes in several variants or can be used in more then one | ||
24 | configuration, the compatible value should be: | ||
25 | compatible = "arm,vexpress,<model>,<variant>", \ | ||
26 | "arm,vexpress,<model>", "arm,vexpress"; | ||
27 | eg: | ||
28 | - Coretile Express A15x2 (V2P-CA15) with Tech Chip 1: | ||
29 | compatible = "arm,vexpress,v2p-ca15,tc1", \ | ||
30 | "arm,vexpress,v2p-ca15", "arm,vexpress"; | ||
31 | - LogicTile Express 13MG (V2F-2XV6) running Cortex-A7 (3 cores) SMM: | ||
32 | compatible = "arm,vexpress,v2f-2xv6,ca7x3", \ | ||
33 | "arm,vexpress,v2f-2xv6", "arm,vexpress"; | ||
34 | |||
35 | Optional properties in the root node: | ||
36 | - tile model name (use name from the tile's Technical Reference | ||
37 | Manual, eg. "V2P-CA5s") | ||
38 | model = "<model>"; | ||
39 | - tile's HBI number (unique ARM's board model ID, visible on the | ||
40 | PCB's silkscreen) in hexadecimal transcription: | ||
41 | arm,hbi = <0xhbi> | ||
42 | eg: | ||
43 | - for Coretile Express A5x2 (V2P-CA5s) HBI-0191: | ||
44 | arm,hbi = <0x191>; | ||
45 | - Coretile Express A9x4 (V2P-CA9) HBI-0225: | ||
46 | arm,hbi = <0x225>; | ||
47 | |||
48 | Top-level standard "cpus" node is required. It must contain a node | ||
49 | with device_type = "cpu" property for every available core, eg.: | ||
50 | |||
51 | cpus { | ||
52 | #address-cells = <1>; | ||
53 | #size-cells = <0>; | ||
54 | |||
55 | cpu@0 { | ||
56 | device_type = "cpu"; | ||
57 | compatible = "arm,cortex-a5"; | ||
58 | reg = <0>; | ||
59 | }; | ||
60 | }; | ||
61 | |||
62 | The motherboard description file provides a single "motherboard" node | ||
63 | using 2 address cells corresponding to the Static Memory Bus used | ||
64 | between the motherboard and the tile. The first cell defines the Chip | ||
65 | Select (CS) line number, the second cell address offset within the CS. | ||
66 | All interrupt lines between the motherboard and the tile are active | ||
67 | high and are described using single cell. | ||
68 | |||
69 | Optional properties of the "motherboard" node: | ||
70 | - motherboard's memory map variant: | ||
71 | arm,v2m-memory-map = "<name>"; | ||
72 | where name is one of: | ||
73 | - "rs1" - for RS1 map (i.a. peripherals on CS3); this map is also | ||
74 | referred to as "ARM Cortex-A Series memory map": | ||
75 | arm,v2m-memory-map = "rs1"; | ||
76 | When this property is missing, the motherboard is using the original | ||
77 | memory map (also known as the "Legacy memory map", primarily used | ||
78 | with the original CoreTile Express A9x4) with peripherals on CS7. | ||
79 | |||
80 | Motherboard .dtsi files provide a set of labelled peripherals that | ||
81 | can be used to obtain required phandle in the tile's "aliases" node: | ||
82 | - UARTs, note that the numbers correspond to the physical connectors | ||
83 | on the motherboard's back panel: | ||
84 | v2m_serial0, v2m_serial1, v2m_serial2 and v2m_serial3 | ||
85 | - I2C controllers: | ||
86 | v2m_i2c_dvi and v2m_i2c_pcie | ||
87 | - SP804 timers: | ||
88 | v2m_timer01 and v2m_timer23 | ||
89 | |||
90 | Current Linux implementation requires a "arm,v2m_timer" alias | ||
91 | pointing at one of the motherboard's SP804 timers, if it is to be | ||
92 | used as the system timer. This alias should be defined in the | ||
93 | motherboard files. | ||
94 | |||
95 | The tile description must define "ranges", "interrupt-map-mask" and | ||
96 | "interrupt-map" properties to translate the motherboard's address | ||
97 | and interrupt space into one used by the tile's processor. | ||
98 | |||
99 | Abbreviated example: | ||
100 | |||
101 | /dts-v1/; | ||
102 | |||
103 | / { | ||
104 | model = "V2P-CA5s"; | ||
105 | arm,hbi = <0x225>; | ||
106 | compatible = "arm,vexpress-v2p-ca5s", "arm,vexpress"; | ||
107 | interrupt-parent = <&gic>; | ||
108 | #address-cells = <1>; | ||
109 | #size-cells = <1>; | ||
110 | |||
111 | chosen { }; | ||
112 | |||
113 | aliases { | ||
114 | serial0 = &v2m_serial0; | ||
115 | }; | ||
116 | |||
117 | cpus { | ||
118 | #address-cells = <1>; | ||
119 | #size-cells = <0>; | ||
120 | |||
121 | cpu@0 { | ||
122 | device_type = "cpu"; | ||
123 | compatible = "arm,cortex-a5"; | ||
124 | reg = <0>; | ||
125 | }; | ||
126 | }; | ||
127 | |||
128 | gic: interrupt-controller@2c001000 { | ||
129 | compatible = "arm,cortex-a9-gic"; | ||
130 | #interrupt-cells = <3>; | ||
131 | #address-cells = <0>; | ||
132 | interrupt-controller; | ||
133 | reg = <0x2c001000 0x1000>, | ||
134 | <0x2c000100 0x100>; | ||
135 | }; | ||
136 | |||
137 | motherboard { | ||
138 | /* CS0 is visible at 0x08000000 */ | ||
139 | ranges = <0 0 0x08000000 0x04000000>; | ||
140 | interrupt-map-mask = <0 0 63>; | ||
141 | /* Active high IRQ 0 is connected to GIC's SPI0 */ | ||
142 | interrupt-map = <0 0 0 &gic 0 0 4>; | ||
143 | }; | ||
144 | }; | ||
145 | |||
146 | /include/ "vexpress-v2m-rs1.dtsi" | ||
diff --git a/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt b/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt new file mode 100644 index 000000000000..90fa7da525b8 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt | |||
@@ -0,0 +1,30 @@ | |||
1 | * NVIDIA Tegra APB DMA controller | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: Should be "nvidia,<chip>-apbdma" | ||
5 | - reg: Should contain DMA registers location and length. This shuld include | ||
6 | all of the per-channel registers. | ||
7 | - interrupts: Should contain all of the per-channel DMA interrupts. | ||
8 | |||
9 | Examples: | ||
10 | |||
11 | apbdma: dma@6000a000 { | ||
12 | compatible = "nvidia,tegra20-apbdma"; | ||
13 | reg = <0x6000a000 0x1200>; | ||
14 | interrupts = < 0 136 0x04 | ||
15 | 0 137 0x04 | ||
16 | 0 138 0x04 | ||
17 | 0 139 0x04 | ||
18 | 0 140 0x04 | ||
19 | 0 141 0x04 | ||
20 | 0 142 0x04 | ||
21 | 0 143 0x04 | ||
22 | 0 144 0x04 | ||
23 | 0 145 0x04 | ||
24 | 0 146 0x04 | ||
25 | 0 147 0x04 | ||
26 | 0 148 0x04 | ||
27 | 0 149 0x04 | ||
28 | 0 150 0x04 | ||
29 | 0 151 0x04 >; | ||
30 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/gpio-omap.txt b/Documentation/devicetree/bindings/gpio/gpio-omap.txt new file mode 100644 index 000000000000..bff51a2fee1e --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-omap.txt | |||
@@ -0,0 +1,36 @@ | |||
1 | OMAP GPIO controller bindings | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: | ||
5 | - "ti,omap2-gpio" for OMAP2 controllers | ||
6 | - "ti,omap3-gpio" for OMAP3 controllers | ||
7 | - "ti,omap4-gpio" for OMAP4 controllers | ||
8 | - #gpio-cells : Should be two. | ||
9 | - first cell is the pin number | ||
10 | - second cell is used to specify optional parameters (unused) | ||
11 | - gpio-controller : Marks the device node as a GPIO controller. | ||
12 | - #interrupt-cells : Should be 2. | ||
13 | - interrupt-controller: Mark the device node as an interrupt controller | ||
14 | The first cell is the GPIO number. | ||
15 | The second cell is used to specify flags: | ||
16 | bits[3:0] trigger type and level flags: | ||
17 | 1 = low-to-high edge triggered. | ||
18 | 2 = high-to-low edge triggered. | ||
19 | 4 = active high level-sensitive. | ||
20 | 8 = active low level-sensitive. | ||
21 | |||
22 | OMAP specific properties: | ||
23 | - ti,hwmods: Name of the hwmod associated to the GPIO: | ||
24 | "gpio<X>", <X> being the 1-based instance number from the HW spec | ||
25 | |||
26 | |||
27 | Example: | ||
28 | |||
29 | gpio4: gpio4 { | ||
30 | compatible = "ti,omap4-gpio"; | ||
31 | ti,hwmods = "gpio4"; | ||
32 | #gpio-cells = <2>; | ||
33 | gpio-controller; | ||
34 | #interrupt-cells = <2>; | ||
35 | interrupt-controller; | ||
36 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt b/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt new file mode 100644 index 000000000000..16695d9cf1e8 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt | |||
@@ -0,0 +1,23 @@ | |||
1 | twl4030 GPIO controller bindings | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: | ||
5 | - "ti,twl4030-gpio" for twl4030 GPIO controller | ||
6 | - #gpio-cells : Should be two. | ||
7 | - first cell is the pin number | ||
8 | - second cell is used to specify optional parameters (unused) | ||
9 | - gpio-controller : Marks the device node as a GPIO controller. | ||
10 | - #interrupt-cells : Should be 2. | ||
11 | - interrupt-controller: Mark the device node as an interrupt controller | ||
12 | The first cell is the GPIO number. | ||
13 | The second cell is not used. | ||
14 | |||
15 | Example: | ||
16 | |||
17 | twl_gpio: gpio { | ||
18 | compatible = "ti,twl4030-gpio"; | ||
19 | #gpio-cells = <2>; | ||
20 | gpio-controller; | ||
21 | #interrupt-cells = <2>; | ||
22 | interrupt-controller; | ||
23 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/gpio_atmel.txt b/Documentation/devicetree/bindings/gpio/gpio_atmel.txt new file mode 100644 index 000000000000..66efc804806a --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio_atmel.txt | |||
@@ -0,0 +1,20 @@ | |||
1 | * Atmel GPIO controller (PIO) | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: "atmel,<chip>-gpio", where <chip> is at91rm9200 or at91sam9x5. | ||
5 | - reg: Should contain GPIO controller registers location and length | ||
6 | - interrupts: Should be the port interrupt shared by all the pins. | ||
7 | - #gpio-cells: Should be two. The first cell is the pin number and | ||
8 | the second cell is used to specify optional parameters (currently | ||
9 | unused). | ||
10 | - gpio-controller: Marks the device node as a GPIO controller. | ||
11 | |||
12 | Example: | ||
13 | pioA: gpio@fffff200 { | ||
14 | compatible = "atmel,at91rm9200-gpio"; | ||
15 | reg = <0xfffff200 0x100>; | ||
16 | interrupts = <2 4>; | ||
17 | #gpio-cells = <2>; | ||
18 | gpio-controller; | ||
19 | }; | ||
20 | |||
diff --git a/Documentation/devicetree/bindings/gpio/gpio_i2c.txt b/Documentation/devicetree/bindings/gpio/gpio_i2c.txt new file mode 100644 index 000000000000..4f8ec947c6bd --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio_i2c.txt | |||
@@ -0,0 +1,32 @@ | |||
1 | Device-Tree bindings for i2c gpio driver | ||
2 | |||
3 | Required properties: | ||
4 | - compatible = "i2c-gpio"; | ||
5 | - gpios: sda and scl gpio | ||
6 | |||
7 | |||
8 | Optional properties: | ||
9 | - i2c-gpio,sda-open-drain: sda as open drain | ||
10 | - i2c-gpio,scl-open-drain: scl as open drain | ||
11 | - i2c-gpio,scl-output-only: scl as output only | ||
12 | - i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform) | ||
13 | - i2c-gpio,timeout-ms: timeout to get data | ||
14 | |||
15 | Example nodes: | ||
16 | |||
17 | i2c@0 { | ||
18 | compatible = "i2c-gpio"; | ||
19 | gpios = <&pioA 23 0 /* sda */ | ||
20 | &pioA 24 0 /* scl */ | ||
21 | >; | ||
22 | i2c-gpio,sda-open-drain; | ||
23 | i2c-gpio,scl-open-drain; | ||
24 | i2c-gpio,delay-us = <2>; /* ~100 kHz */ | ||
25 | #address-cells = <1>; | ||
26 | #size-cells = <0>; | ||
27 | |||
28 | rv3029c2@56 { | ||
29 | compatible = "rv3029c2"; | ||
30 | reg = <0x56>; | ||
31 | }; | ||
32 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt b/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt index eb4b530d64e1..023c9526e5f8 100644 --- a/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt +++ b/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt | |||
@@ -1,8 +1,40 @@ | |||
1 | NVIDIA Tegra 2 GPIO controller | 1 | NVIDIA Tegra GPIO controller |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra20-gpio" | 4 | - compatible : "nvidia,tegra<chip>-gpio" |
5 | - reg : Physical base address and length of the controller's registers. | ||
6 | - interrupts : The interrupt outputs from the controller. For Tegra20, | ||
7 | there should be 7 interrupts specified, and for Tegra30, there should | ||
8 | be 8 interrupts specified. | ||
5 | - #gpio-cells : Should be two. The first cell is the pin number and the | 9 | - #gpio-cells : Should be two. The first cell is the pin number and the |
6 | second cell is used to specify optional parameters: | 10 | second cell is used to specify optional parameters: |
7 | - bit 0 specifies polarity (0 for normal, 1 for inverted) | 11 | - bit 0 specifies polarity (0 for normal, 1 for inverted) |
8 | - gpio-controller : Marks the device node as a GPIO controller. | 12 | - gpio-controller : Marks the device node as a GPIO controller. |
13 | - #interrupt-cells : Should be 2. | ||
14 | The first cell is the GPIO number. | ||
15 | The second cell is used to specify flags: | ||
16 | bits[3:0] trigger type and level flags: | ||
17 | 1 = low-to-high edge triggered. | ||
18 | 2 = high-to-low edge triggered. | ||
19 | 4 = active high level-sensitive. | ||
20 | 8 = active low level-sensitive. | ||
21 | Valid combinations are 1, 2, 3, 4, 8. | ||
22 | - interrupt-controller : Marks the device node as an interrupt controller. | ||
23 | |||
24 | Example: | ||
25 | |||
26 | gpio: gpio@6000d000 { | ||
27 | compatible = "nvidia,tegra20-gpio"; | ||
28 | reg = < 0x6000d000 0x1000 >; | ||
29 | interrupts = < 0 32 0x04 | ||
30 | 0 33 0x04 | ||
31 | 0 34 0x04 | ||
32 | 0 35 0x04 | ||
33 | 0 55 0x04 | ||
34 | 0 87 0x04 | ||
35 | 0 89 0x04 >; | ||
36 | #gpio-cells = <2>; | ||
37 | gpio-controller; | ||
38 | #interrupt-cells = <2>; | ||
39 | interrupt-controller; | ||
40 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt new file mode 100644 index 000000000000..1e34cfe5ebea --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt | |||
@@ -0,0 +1,23 @@ | |||
1 | * Marvell PXA GPIO controller | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : Should be "mrvl,pxa-gpio" or "mrvl,mmp-gpio" | ||
5 | - reg : Address and length of the register set for the device | ||
6 | - interrupts : Should be the port interrupt shared by all gpio pins, if | ||
7 | - interrupt-name : Should be the name of irq resource. | ||
8 | one number. | ||
9 | - gpio-controller : Marks the device node as a gpio controller. | ||
10 | - #gpio-cells : Should be one. It is the pin number. | ||
11 | |||
12 | Example: | ||
13 | |||
14 | gpio: gpio@d4019000 { | ||
15 | compatible = "mrvl,mmp-gpio", "mrvl,pxa-gpio"; | ||
16 | reg = <0xd4019000 0x1000>; | ||
17 | interrupts = <49>, <17>, <18>; | ||
18 | interrupt-name = "gpio_mux", "gpio0", "gpio1"; | ||
19 | gpio-controller; | ||
20 | #gpio-cells = <1>; | ||
21 | interrupt-controller; | ||
22 | #interrupt-cells = <1>; | ||
23 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/sodaville.txt b/Documentation/devicetree/bindings/gpio/sodaville.txt new file mode 100644 index 000000000000..563eff22b975 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/sodaville.txt | |||
@@ -0,0 +1,48 @@ | |||
1 | GPIO controller on CE4100 / Sodaville SoCs | ||
2 | ========================================== | ||
3 | |||
4 | The bindings for CE4100's GPIO controller match the generic description | ||
5 | which is covered by the gpio.txt file in this folder. | ||
6 | |||
7 | The only additional property is the intel,muxctl property which holds the | ||
8 | value which is written into the MUXCNTL register. | ||
9 | |||
10 | There is no compatible property for now because the driver is probed via | ||
11 | PCI id (vendor 0x8086 device 0x2e67). | ||
12 | |||
13 | The interrupt specifier consists of two cells encoded as follows: | ||
14 | - <1st cell>: The interrupt-number that identifies the interrupt source. | ||
15 | - <2nd cell>: The level-sense information, encoded as follows: | ||
16 | 4 - active high level-sensitive | ||
17 | 8 - active low level-sensitive | ||
18 | |||
19 | Example of the GPIO device and one user: | ||
20 | |||
21 | pcigpio: gpio@b,1 { | ||
22 | /* two cells for GPIO and interrupt */ | ||
23 | #gpio-cells = <2>; | ||
24 | #interrupt-cells = <2>; | ||
25 | compatible = "pci8086,2e67.2", | ||
26 | "pci8086,2e67", | ||
27 | "pciclassff0000", | ||
28 | "pciclassff00"; | ||
29 | |||
30 | reg = <0x15900 0x0 0x0 0x0 0x0>; | ||
31 | /* Interrupt line of the gpio device */ | ||
32 | interrupts = <15 1>; | ||
33 | /* It is an interrupt and GPIO controller itself */ | ||
34 | interrupt-controller; | ||
35 | gpio-controller; | ||
36 | intel,muxctl = <0>; | ||
37 | }; | ||
38 | |||
39 | testuser@20 { | ||
40 | compatible = "example,testuser"; | ||
41 | /* User the 11th GPIO line as an active high triggered | ||
42 | * level interrupt | ||
43 | */ | ||
44 | interrupts = <11 8>; | ||
45 | interrupt-parent = <&pcigpio>; | ||
46 | /* Use this GPIO also with the gpio functions */ | ||
47 | gpios = <&pcigpio 11 0>; | ||
48 | }; | ||
diff --git a/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt b/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt new file mode 100644 index 000000000000..071eb3caae91 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt | |||
@@ -0,0 +1,37 @@ | |||
1 | * I2C | ||
2 | |||
3 | Required properties : | ||
4 | |||
5 | - reg : Offset and length of the register set for the device | ||
6 | - compatible : should be "mrvl,mmp-twsi" where CHIP is the name of a | ||
7 | compatible processor, e.g. pxa168, pxa910, mmp2, mmp3. | ||
8 | For the pxa2xx/pxa3xx, an additional node "mrvl,pxa-i2c" is required | ||
9 | as shown in the example below. | ||
10 | |||
11 | Recommended properties : | ||
12 | |||
13 | - interrupts : <a b> where a is the interrupt number and b is a | ||
14 | field that represents an encoding of the sense and level | ||
15 | information for the interrupt. This should be encoded based on | ||
16 | the information in section 2) depending on the type of interrupt | ||
17 | controller you have. | ||
18 | - interrupt-parent : the phandle for the interrupt controller that | ||
19 | services interrupts for this device. | ||
20 | - mrvl,i2c-polling : Disable interrupt of i2c controller. Polling | ||
21 | status register of i2c controller instead. | ||
22 | - mrvl,i2c-fast-mode : Enable fast mode of i2c controller. | ||
23 | |||
24 | Examples: | ||
25 | twsi1: i2c@d4011000 { | ||
26 | compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c"; | ||
27 | reg = <0xd4011000 0x1000>; | ||
28 | interrupts = <7>; | ||
29 | mrvl,i2c-fast-mode; | ||
30 | }; | ||
31 | |||
32 | twsi2: i2c@d4025000 { | ||
33 | compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c"; | ||
34 | reg = <0xd4025000 0x1000>; | ||
35 | interrupts = <58>; | ||
36 | }; | ||
37 | |||
diff --git a/Documentation/devicetree/bindings/i2c/sirf-i2c.txt b/Documentation/devicetree/bindings/i2c/sirf-i2c.txt new file mode 100644 index 000000000000..7baf9e133fa8 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/sirf-i2c.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | I2C for SiRFprimaII platforms | ||
2 | |||
3 | Required properties : | ||
4 | - compatible : Must be "sirf,prima2-i2c" | ||
5 | - reg: physical base address of the controller and length of memory mapped | ||
6 | region. | ||
7 | - interrupts: interrupt number to the cpu. | ||
8 | |||
9 | Optional properties: | ||
10 | - clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. | ||
11 | The absence of the propoerty indicates the default frequency 100 kHz. | ||
12 | |||
13 | Examples : | ||
14 | |||
15 | i2c0: i2c@b00e0000 { | ||
16 | compatible = "sirf,prima2-i2c"; | ||
17 | reg = <0xb00e0000 0x10000>; | ||
18 | interrupts = <24>; | ||
19 | }; | ||
diff --git a/Documentation/devicetree/bindings/input/matrix-keymap.txt b/Documentation/devicetree/bindings/input/matrix-keymap.txt new file mode 100644 index 000000000000..3cd8b98ccd2d --- /dev/null +++ b/Documentation/devicetree/bindings/input/matrix-keymap.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | A simple common binding for matrix-connected key boards. Currently targeted at | ||
2 | defining the keys in the scope of linux key codes since that is a stable and | ||
3 | standardized interface at this time. | ||
4 | |||
5 | Required properties: | ||
6 | - linux,keymap: an array of packed 1-cell entries containing the equivalent | ||
7 | of row, column and linux key-code. The 32-bit big endian cell is packed | ||
8 | as: | ||
9 | row << 24 | column << 16 | key-code | ||
10 | |||
11 | Optional properties: | ||
12 | Some users of this binding might choose to specify secondary keymaps for | ||
13 | cases where there is a modifier key such as a Fn key. Proposed names | ||
14 | for said properties are "linux,fn-keymap" or with another descriptive | ||
15 | word for the modifier other from "Fn". | ||
16 | |||
17 | Example: | ||
18 | linux,keymap = < 0x00030012 | ||
19 | 0x0102003a >; | ||
diff --git a/Documentation/devicetree/bindings/input/tegra-kbc.txt b/Documentation/devicetree/bindings/input/tegra-kbc.txt index 5ecfa99089b4..72683be6de35 100644 --- a/Documentation/devicetree/bindings/input/tegra-kbc.txt +++ b/Documentation/devicetree/bindings/input/tegra-kbc.txt | |||
@@ -3,16 +3,21 @@ | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: "nvidia,tegra20-kbc" | 4 | - compatible: "nvidia,tegra20-kbc" |
5 | 5 | ||
6 | Optional properties: | 6 | Optional properties, in addition to those specified by the shared |
7 | - debounce-delay: delay in milliseconds per row scan for debouncing | 7 | matrix-keyboard bindings: |
8 | - repeat-delay: delay in milliseconds before repeat starts | 8 | |
9 | - ghost-filter: enable ghost filtering for this device | 9 | - linux,fn-keymap: a second keymap, same specification as the |
10 | - wakeup-source: configure keyboard as a wakeup source for suspend/resume | 10 | matrix-keyboard-controller spec but to be used when the KEY_FN modifier |
11 | key is pressed. | ||
12 | - nvidia,debounce-delay-ms: delay in milliseconds per row scan for debouncing | ||
13 | - nvidia,repeat-delay-ms: delay in milliseconds before repeat starts | ||
14 | - nvidia,ghost-filter: enable ghost filtering for this device | ||
15 | - nvidia,wakeup-source: configure keyboard as a wakeup source for suspend/resume | ||
11 | 16 | ||
12 | Example: | 17 | Example: |
13 | 18 | ||
14 | keyboard: keyboard { | 19 | keyboard: keyboard { |
15 | compatible = "nvidia,tegra20-kbc"; | 20 | compatible = "nvidia,tegra20-kbc"; |
16 | reg = <0x7000e200 0x100>; | 21 | reg = <0x7000e200 0x100>; |
17 | ghost-filter; | 22 | nvidia,ghost-filter; |
18 | }; | 23 | }; |
diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt new file mode 100644 index 000000000000..dbd4368ab8cc --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt | |||
@@ -0,0 +1,33 @@ | |||
1 | * TI Highspeed MMC host controller for OMAP | ||
2 | |||
3 | The Highspeed MMC Host Controller on TI OMAP family | ||
4 | provides an interface for MMC, SD, and SDIO types of memory cards. | ||
5 | |||
6 | Required properties: | ||
7 | - compatible: | ||
8 | Should be "ti,omap2-hsmmc", for OMAP2 controllers | ||
9 | Should be "ti,omap3-hsmmc", for OMAP3 controllers | ||
10 | Should be "ti,omap4-hsmmc", for OMAP4 controllers | ||
11 | - ti,hwmods: Must be "mmc<n>", n is controller instance starting 1 | ||
12 | - reg : should contain hsmmc registers location and length | ||
13 | |||
14 | Optional properties: | ||
15 | ti,dual-volt: boolean, supports dual voltage cards | ||
16 | <supply-name>-supply: phandle to the regulator device tree node | ||
17 | "supply-name" examples are "vmmc", "vmmc_aux" etc | ||
18 | ti,bus-width: Number of data lines, default assumed is 1 if the property is missing. | ||
19 | cd-gpios: GPIOs for card detection | ||
20 | wp-gpios: GPIOs for write protection | ||
21 | ti,non-removable: non-removable slot (like eMMC) | ||
22 | ti,needs-special-reset: Requires a special softreset sequence | ||
23 | |||
24 | Example: | ||
25 | mmc1: mmc@0x4809c000 { | ||
26 | compatible = "ti,omap4-hsmmc"; | ||
27 | reg = <0x4809c000 0x400>; | ||
28 | ti,hwmods = "mmc1"; | ||
29 | ti,dual-volt; | ||
30 | ti,bus-width = <4>; | ||
31 | vmmc-supply = <&vmmc>; /* phandle to regulator node */ | ||
32 | ti,non-removable; | ||
33 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt new file mode 100644 index 000000000000..5903ecf6e895 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt | |||
@@ -0,0 +1,41 @@ | |||
1 | Atmel NAND flash | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : "atmel,at91rm9200-nand". | ||
5 | - reg : should specify localbus address and size used for the chip, | ||
6 | and if availlable the ECC. | ||
7 | - atmel,nand-addr-offset : offset for the address latch. | ||
8 | - atmel,nand-cmd-offset : offset for the command latch. | ||
9 | - #address-cells, #size-cells : Must be present if the device has sub-nodes | ||
10 | representing partitions. | ||
11 | |||
12 | - gpios : specifies the gpio pins to control the NAND device. detect is an | ||
13 | optional gpio and may be set to 0 if not present. | ||
14 | |||
15 | Optional properties: | ||
16 | - nand-ecc-mode : String, operation mode of the NAND ecc mode, soft by default. | ||
17 | Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first", | ||
18 | "soft_bch". | ||
19 | - nand-bus-width : 8 or 16 bus width if not present 8 | ||
20 | - nand-on-flash-bbt: boolean to enable on flash bbt option if not present false | ||
21 | |||
22 | Examples: | ||
23 | nand0: nand@40000000,0 { | ||
24 | compatible = "atmel,at91rm9200-nand"; | ||
25 | #address-cells = <1>; | ||
26 | #size-cells = <1>; | ||
27 | reg = <0x40000000 0x10000000 | ||
28 | 0xffffe800 0x200 | ||
29 | >; | ||
30 | atmel,nand-addr-offset = <21>; | ||
31 | atmel,nand-cmd-offset = <22>; | ||
32 | nand-on-flash-bbt; | ||
33 | nand-ecc-mode = "soft"; | ||
34 | gpios = <&pioC 13 0 | ||
35 | &pioC 14 0 | ||
36 | 0 | ||
37 | >; | ||
38 | partition@0 { | ||
39 | ... | ||
40 | }; | ||
41 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt new file mode 100644 index 000000000000..03855c8c492a --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/nand.txt | |||
@@ -0,0 +1,7 @@ | |||
1 | * MTD generic binding | ||
2 | |||
3 | - nand-ecc-mode : String, operation mode of the NAND ecc mode. | ||
4 | Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first", | ||
5 | "soft_bch". | ||
6 | - nand-bus-width : 8 or 16 bus width if not present 8 | ||
7 | - nand-on-flash-bbt: boolean to enable on flash bbt option if not present false | ||
diff --git a/Documentation/devicetree/bindings/rtc/sa1100-rtc.txt b/Documentation/devicetree/bindings/rtc/sa1100-rtc.txt new file mode 100644 index 000000000000..0cda19ad4859 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/sa1100-rtc.txt | |||
@@ -0,0 +1,17 @@ | |||
1 | * Marvell Real Time Clock controller | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: should be "mrvl,sa1100-rtc" | ||
5 | - reg: physical base address of the controller and length of memory mapped | ||
6 | region. | ||
7 | - interrupts: Should be two. The first interrupt number is the rtc alarm | ||
8 | interrupt and the second interrupt number is the rtc hz interrupt. | ||
9 | - interrupt-names: Assign name of irq resource. | ||
10 | |||
11 | Example: | ||
12 | rtc: rtc@d4010000 { | ||
13 | compatible = "mrvl,mmp-rtc"; | ||
14 | reg = <0xd4010000 0x1000>; | ||
15 | interrupts = <5>, <6>; | ||
16 | interrupt-name = "rtc 1Hz", "rtc alarm"; | ||
17 | }; | ||
diff --git a/Documentation/devicetree/bindings/serial/mrvl-serial.txt b/Documentation/devicetree/bindings/serial/mrvl-serial.txt new file mode 100644 index 000000000000..d744340de887 --- /dev/null +++ b/Documentation/devicetree/bindings/serial/mrvl-serial.txt | |||
@@ -0,0 +1,4 @@ | |||
1 | PXA UART controller | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : should be "mrvl,mmp-uart" or "mrvl,pxa-uart". | ||
diff --git a/Documentation/devicetree/bindings/sound/alc5632.txt b/Documentation/devicetree/bindings/sound/alc5632.txt new file mode 100644 index 000000000000..8608f747dcfe --- /dev/null +++ b/Documentation/devicetree/bindings/sound/alc5632.txt | |||
@@ -0,0 +1,24 @@ | |||
1 | ALC5632 audio CODEC | ||
2 | |||
3 | This device supports I2C only. | ||
4 | |||
5 | Required properties: | ||
6 | |||
7 | - compatible : "realtek,alc5632" | ||
8 | |||
9 | - reg : the I2C address of the device. | ||
10 | |||
11 | - gpio-controller : Indicates this device is a GPIO controller. | ||
12 | |||
13 | - #gpio-cells : Should be two. The first cell is the pin number and the | ||
14 | second cell is used to specify optional parameters (currently unused). | ||
15 | |||
16 | Example: | ||
17 | |||
18 | alc5632: alc5632@1e { | ||
19 | compatible = "realtek,alc5632"; | ||
20 | reg = <0x1a>; | ||
21 | |||
22 | gpio-controller; | ||
23 | #gpio-cells = <2>; | ||
24 | }; | ||
diff --git a/Documentation/devicetree/bindings/sound/imx-audmux.txt b/Documentation/devicetree/bindings/sound/imx-audmux.txt new file mode 100644 index 000000000000..215aa9817213 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/imx-audmux.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | Freescale Digital Audio Mux (AUDMUX) device | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : "fsl,imx21-audmux" for AUDMUX version firstly used on i.MX21, | ||
5 | or "fsl,imx31-audmux" for the version firstly used on i.MX31. | ||
6 | - reg : Should contain AUDMUX registers location and length | ||
7 | |||
8 | Example: | ||
9 | |||
10 | audmux@021d8000 { | ||
11 | compatible = "fsl,imx6q-audmux", "fsl,imx31-audmux"; | ||
12 | reg = <0x021d8000 0x4000>; | ||
13 | }; | ||
diff --git a/Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt b/Documentation/devicetree/bindings/sound/sgtl5000.txt index 2c3cd413f042..2c3cd413f042 100644 --- a/Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/sgtl5000.txt | |||
diff --git a/Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt b/Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file mode 100644 index 000000000000..b77a97c9101e --- /dev/null +++ b/Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt | |||
@@ -0,0 +1,59 @@ | |||
1 | NVIDIA Tegra audio complex | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : "nvidia,tegra-audio-alc5632" | ||
5 | - nvidia,model : The user-visible name of this sound complex. | ||
6 | - nvidia,audio-routing : A list of the connections between audio components. | ||
7 | Each entry is a pair of strings, the first being the connection's sink, | ||
8 | the second being the connection's source. Valid names for sources and | ||
9 | sinks are the ALC5632's pins: | ||
10 | |||
11 | ALC5632 pins: | ||
12 | |||
13 | * SPK_OUTP | ||
14 | * SPK_OUTN | ||
15 | * HP_OUT_L | ||
16 | * HP_OUT_R | ||
17 | * AUX_OUT_P | ||
18 | * AUX_OUT_N | ||
19 | * LINE_IN_L | ||
20 | * LINE_IN_R | ||
21 | * PHONE_P | ||
22 | * PHONE_N | ||
23 | * MIC1_P | ||
24 | * MIC1_N | ||
25 | * MIC2_P | ||
26 | * MIC2_N | ||
27 | * MICBIAS1 | ||
28 | * DMICDAT | ||
29 | |||
30 | Board connectors: | ||
31 | |||
32 | * Headset Stereophone | ||
33 | * Int Spk | ||
34 | * Headset Mic | ||
35 | * Digital Mic | ||
36 | |||
37 | - nvidia,i2s-controller : The phandle of the Tegra I2S controller | ||
38 | - nvidia,audio-codec : The phandle of the ALC5632 audio codec | ||
39 | |||
40 | Example: | ||
41 | |||
42 | sound { | ||
43 | compatible = "nvidia,tegra-audio-alc5632-paz00", | ||
44 | "nvidia,tegra-audio-alc5632"; | ||
45 | |||
46 | nvidia,model = "Compal PAZ00"; | ||
47 | |||
48 | nvidia,audio-routing = | ||
49 | "Int Spk", "SPK_OUTP", | ||
50 | "Int Spk", "SPK_OUTN", | ||
51 | "Headset Mic","MICBIAS1", | ||
52 | "MIC1_N", "Headset Mic", | ||
53 | "MIC1_P", "Headset Mic", | ||
54 | "Headset Stereophone", "HP_OUT_R", | ||
55 | "Headset Stereophone", "HP_OUT_L"; | ||
56 | |||
57 | nvidia,i2s-controller = <&tegra_i2s1>; | ||
58 | nvidia,audio-codec = <&alc5632>; | ||
59 | }; | ||
diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt new file mode 100644 index 000000000000..60bd2150a3e6 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt | |||
@@ -0,0 +1,49 @@ | |||
1 | Atmel SOC USB controllers | ||
2 | |||
3 | OHCI | ||
4 | |||
5 | Required properties: | ||
6 | - compatible: Should be "atmel,at91rm9200-ohci" for USB controllers | ||
7 | used in host mode. | ||
8 | - num-ports: Number of ports. | ||
9 | - atmel,vbus-gpio: If present, specifies a gpio that needs to be | ||
10 | activated for the bus to be powered. | ||
11 | - atmel,oc-gpio: If present, specifies a gpio that needs to be | ||
12 | activated for the overcurrent detection. | ||
13 | |||
14 | usb0: ohci@00500000 { | ||
15 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | ||
16 | reg = <0x00500000 0x100000>; | ||
17 | interrupts = <20 4>; | ||
18 | num-ports = <2>; | ||
19 | }; | ||
20 | |||
21 | EHCI | ||
22 | |||
23 | Required properties: | ||
24 | - compatible: Should be "atmel,at91sam9g45-ehci" for USB controllers | ||
25 | used in host mode. | ||
26 | |||
27 | usb1: ehci@00800000 { | ||
28 | compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; | ||
29 | reg = <0x00800000 0x100000>; | ||
30 | interrupts = <22 4>; | ||
31 | }; | ||
32 | |||
33 | AT91 USB device controller | ||
34 | |||
35 | Required properties: | ||
36 | - compatible: Should be "atmel,at91rm9200-udc" | ||
37 | - reg: Address and length of the register set for the device | ||
38 | - interrupts: Should contain macb interrupt | ||
39 | |||
40 | Optional properties: | ||
41 | - atmel,vbus-gpio: If present, specifies a gpio that needs to be | ||
42 | activated for the bus to be powered. | ||
43 | |||
44 | usb1: gadget@fffa4000 { | ||
45 | compatible = "atmel,at91rm9200-udc"; | ||
46 | reg = <0xfffa4000 0x4000>; | ||
47 | interrupts = <10 4>; | ||
48 | atmel,vbus-gpio = <&pioC 5 0>; | ||
49 | }; | ||
diff --git a/Documentation/devicetree/bindings/usb/tegra-usb.txt b/Documentation/devicetree/bindings/usb/tegra-usb.txt index 035d63d5646d..007005ddbe12 100644 --- a/Documentation/devicetree/bindings/usb/tegra-usb.txt +++ b/Documentation/devicetree/bindings/usb/tegra-usb.txt | |||
@@ -11,3 +11,16 @@ Required properties : | |||
11 | - phy_type : Should be one of "ulpi" or "utmi". | 11 | - phy_type : Should be one of "ulpi" or "utmi". |
12 | - nvidia,vbus-gpio : If present, specifies a gpio that needs to be | 12 | - nvidia,vbus-gpio : If present, specifies a gpio that needs to be |
13 | activated for the bus to be powered. | 13 | activated for the bus to be powered. |
14 | |||
15 | Optional properties: | ||
16 | - dr_mode : dual role mode. Indicates the working mode for | ||
17 | nvidia,tegra20-ehci compatible controllers. Can be "host", "peripheral", | ||
18 | or "otg". Default to "host" if not defined for backward compatibility. | ||
19 | host means this is a host controller | ||
20 | peripheral means it is device controller | ||
21 | otg means it can operate as either ("on the go") | ||
22 | - nvidia,has-legacy-mode : boolean indicates whether this controller can | ||
23 | operate in legacy mode (as APX 2500 / 2600). In legacy mode some | ||
24 | registers are accessed through the APB_MISC base address instead of | ||
25 | the USB controller. Since this is a legacy issue it probably does not | ||
26 | warrant a compatible string of its own. | ||
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index a20008ab319a..82ac057a24a9 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
@@ -34,6 +34,7 @@ picochip Picochip Ltd | |||
34 | powervr Imagination Technologies | 34 | powervr Imagination Technologies |
35 | qcom Qualcomm, Inc. | 35 | qcom Qualcomm, Inc. |
36 | ramtron Ramtron International | 36 | ramtron Ramtron International |
37 | realtek Realtek Semiconductor Corp. | ||
37 | samsung Samsung Semiconductor | 38 | samsung Samsung Semiconductor |
38 | sbs Smart Battery System | 39 | sbs Smart Battery System |
39 | schindler Schindler | 40 | schindler Schindler |
diff --git a/Documentation/dma-buf-sharing.txt b/Documentation/dma-buf-sharing.txt index 225f96d88f55..3bbd5c51605a 100644 --- a/Documentation/dma-buf-sharing.txt +++ b/Documentation/dma-buf-sharing.txt | |||
@@ -32,8 +32,12 @@ The buffer-user | |||
32 | *IMPORTANT*: [see https://lkml.org/lkml/2011/12/20/211 for more details] | 32 | *IMPORTANT*: [see https://lkml.org/lkml/2011/12/20/211 for more details] |
33 | For this first version, A buffer shared using the dma_buf sharing API: | 33 | For this first version, A buffer shared using the dma_buf sharing API: |
34 | - *may* be exported to user space using "mmap" *ONLY* by exporter, outside of | 34 | - *may* be exported to user space using "mmap" *ONLY* by exporter, outside of |
35 | this framework. | 35 | this framework. |
36 | - may be used *ONLY* by importers that do not need CPU access to the buffer. | 36 | - with this new iteration of the dma-buf api cpu access from the kernel has been |
37 | enable, see below for the details. | ||
38 | |||
39 | dma-buf operations for device dma only | ||
40 | -------------------------------------- | ||
37 | 41 | ||
38 | The dma_buf buffer sharing API usage contains the following steps: | 42 | The dma_buf buffer sharing API usage contains the following steps: |
39 | 43 | ||
@@ -219,10 +223,120 @@ NOTES: | |||
219 | If the exporter chooses not to allow an attach() operation once a | 223 | If the exporter chooses not to allow an attach() operation once a |
220 | map_dma_buf() API has been called, it simply returns an error. | 224 | map_dma_buf() API has been called, it simply returns an error. |
221 | 225 | ||
222 | Miscellaneous notes: | 226 | Kernel cpu access to a dma-buf buffer object |
227 | -------------------------------------------- | ||
228 | |||
229 | The motivation to allow cpu access from the kernel to a dma-buf object from the | ||
230 | importers side are: | ||
231 | - fallback operations, e.g. if the devices is connected to a usb bus and the | ||
232 | kernel needs to shuffle the data around first before sending it away. | ||
233 | - full transparency for existing users on the importer side, i.e. userspace | ||
234 | should not notice the difference between a normal object from that subsystem | ||
235 | and an imported one backed by a dma-buf. This is really important for drm | ||
236 | opengl drivers that expect to still use all the existing upload/download | ||
237 | paths. | ||
238 | |||
239 | Access to a dma_buf from the kernel context involves three steps: | ||
240 | |||
241 | 1. Prepare access, which invalidate any necessary caches and make the object | ||
242 | available for cpu access. | ||
243 | 2. Access the object page-by-page with the dma_buf map apis | ||
244 | 3. Finish access, which will flush any necessary cpu caches and free reserved | ||
245 | resources. | ||
246 | |||
247 | 1. Prepare access | ||
248 | |||
249 | Before an importer can access a dma_buf object with the cpu from the kernel | ||
250 | context, it needs to notify the exporter of the access that is about to | ||
251 | happen. | ||
252 | |||
253 | Interface: | ||
254 | int dma_buf_begin_cpu_access(struct dma_buf *dmabuf, | ||
255 | size_t start, size_t len, | ||
256 | enum dma_data_direction direction) | ||
257 | |||
258 | This allows the exporter to ensure that the memory is actually available for | ||
259 | cpu access - the exporter might need to allocate or swap-in and pin the | ||
260 | backing storage. The exporter also needs to ensure that cpu access is | ||
261 | coherent for the given range and access direction. The range and access | ||
262 | direction can be used by the exporter to optimize the cache flushing, i.e. | ||
263 | access outside of the range or with a different direction (read instead of | ||
264 | write) might return stale or even bogus data (e.g. when the exporter needs to | ||
265 | copy the data to temporary storage). | ||
266 | |||
267 | This step might fail, e.g. in oom conditions. | ||
268 | |||
269 | 2. Accessing the buffer | ||
270 | |||
271 | To support dma_buf objects residing in highmem cpu access is page-based using | ||
272 | an api similar to kmap. Accessing a dma_buf is done in aligned chunks of | ||
273 | PAGE_SIZE size. Before accessing a chunk it needs to be mapped, which returns | ||
274 | a pointer in kernel virtual address space. Afterwards the chunk needs to be | ||
275 | unmapped again. There is no limit on how often a given chunk can be mapped | ||
276 | and unmapped, i.e. the importer does not need to call begin_cpu_access again | ||
277 | before mapping the same chunk again. | ||
278 | |||
279 | Interfaces: | ||
280 | void *dma_buf_kmap(struct dma_buf *, unsigned long); | ||
281 | void dma_buf_kunmap(struct dma_buf *, unsigned long, void *); | ||
282 | |||
283 | There are also atomic variants of these interfaces. Like for kmap they | ||
284 | facilitate non-blocking fast-paths. Neither the importer nor the exporter (in | ||
285 | the callback) is allowed to block when using these. | ||
286 | |||
287 | Interfaces: | ||
288 | void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long); | ||
289 | void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *); | ||
290 | |||
291 | For importers all the restrictions of using kmap apply, like the limited | ||
292 | supply of kmap_atomic slots. Hence an importer shall only hold onto at most 2 | ||
293 | atomic dma_buf kmaps at the same time (in any given process context). | ||
294 | |||
295 | dma_buf kmap calls outside of the range specified in begin_cpu_access are | ||
296 | undefined. If the range is not PAGE_SIZE aligned, kmap needs to succeed on | ||
297 | the partial chunks at the beginning and end but may return stale or bogus | ||
298 | data outside of the range (in these partial chunks). | ||
299 | |||
300 | Note that these calls need to always succeed. The exporter needs to complete | ||
301 | any preparations that might fail in begin_cpu_access. | ||
302 | |||
303 | 3. Finish access | ||
304 | |||
305 | When the importer is done accessing the range specified in begin_cpu_access, | ||
306 | it needs to announce this to the exporter (to facilitate cache flushing and | ||
307 | unpinning of any pinned resources). The result of of any dma_buf kmap calls | ||
308 | after end_cpu_access is undefined. | ||
309 | |||
310 | Interface: | ||
311 | void dma_buf_end_cpu_access(struct dma_buf *dma_buf, | ||
312 | size_t start, size_t len, | ||
313 | enum dma_data_direction dir); | ||
314 | |||
315 | |||
316 | Miscellaneous notes | ||
317 | ------------------- | ||
318 | |||
223 | - Any exporters or users of the dma-buf buffer sharing framework must have | 319 | - Any exporters or users of the dma-buf buffer sharing framework must have |
224 | a 'select DMA_SHARED_BUFFER' in their respective Kconfigs. | 320 | a 'select DMA_SHARED_BUFFER' in their respective Kconfigs. |
225 | 321 | ||
322 | - In order to avoid fd leaks on exec, the FD_CLOEXEC flag must be set | ||
323 | on the file descriptor. This is not just a resource leak, but a | ||
324 | potential security hole. It could give the newly exec'd application | ||
325 | access to buffers, via the leaked fd, to which it should otherwise | ||
326 | not be permitted access. | ||
327 | |||
328 | The problem with doing this via a separate fcntl() call, versus doing it | ||
329 | atomically when the fd is created, is that this is inherently racy in a | ||
330 | multi-threaded app[3]. The issue is made worse when it is library code | ||
331 | opening/creating the file descriptor, as the application may not even be | ||
332 | aware of the fd's. | ||
333 | |||
334 | To avoid this problem, userspace must have a way to request O_CLOEXEC | ||
335 | flag be set when the dma-buf fd is created. So any API provided by | ||
336 | the exporting driver to create a dmabuf fd must provide a way to let | ||
337 | userspace control setting of O_CLOEXEC flag passed in to dma_buf_fd(). | ||
338 | |||
226 | References: | 339 | References: |
227 | [1] struct dma_buf_ops in include/linux/dma-buf.h | 340 | [1] struct dma_buf_ops in include/linux/dma-buf.h |
228 | [2] All interfaces mentioned above defined in include/linux/dma-buf.h | 341 | [2] All interfaces mentioned above defined in include/linux/dma-buf.h |
342 | [3] https://lwn.net/Articles/236486/ | ||
diff --git a/Documentation/dvb/cards.txt b/Documentation/dvb/cards.txt index cc09187a5db7..97709e9a3076 100644 --- a/Documentation/dvb/cards.txt +++ b/Documentation/dvb/cards.txt | |||
@@ -119,4 +119,5 @@ o Cards based on the Phillips saa7134 PCI bridge: | |||
119 | - Compro Videomate DVB-T300 | 119 | - Compro Videomate DVB-T300 |
120 | - Compro Videomate DVB-T200 | 120 | - Compro Videomate DVB-T200 |
121 | - AVerMedia AVerTVHD MCE A180 | 121 | - AVerMedia AVerTVHD MCE A180 |
122 | - KWorld PC150-U ATSC Hybrid | ||
122 | 123 | ||
diff --git a/Documentation/dvb/lmedm04.txt b/Documentation/dvb/lmedm04.txt index 10b5f0411386..f4b720a14675 100644 --- a/Documentation/dvb/lmedm04.txt +++ b/Documentation/dvb/lmedm04.txt | |||
@@ -66,5 +66,16 @@ dd if=US290D.sys ibs=1 skip=36856 count=3976 of=dvb-usb-lme2510-s0194.fw | |||
66 | For LME2510C | 66 | For LME2510C |
67 | dd if=US290D.sys ibs=1 skip=33152 count=3697 of=dvb-usb-lme2510c-s0194.fw | 67 | dd if=US290D.sys ibs=1 skip=33152 count=3697 of=dvb-usb-lme2510c-s0194.fw |
68 | 68 | ||
69 | --------------------------------------------------------------------- | ||
70 | |||
71 | The m88rs2000 tuner driver can be found in windows/system32/drivers | ||
72 | |||
73 | US2B0D.sys (dated 29 Jun 2010) | ||
74 | |||
75 | dd if=US2B0D.sys ibs=1 skip=34432 count=3871 of=dvb-usb-lme2510c-rs2000.fw | ||
76 | |||
77 | We need to modify id of rs2000 firmware or it will warm boot id 3344:1120. | ||
78 | |||
79 | echo -ne \\xF0\\x22 | dd conv=notrunc bs=1 count=2 seek=266 of=dvb-usb-lme2510c-rs2000.fw | ||
69 | 80 | ||
70 | Copy the firmware file(s) to /lib/firmware | 81 | Copy the firmware file(s) to /lib/firmware |
diff --git a/Documentation/edac.txt b/Documentation/edac.txt index 249822cde82b..fdcc49fad8e1 100644 --- a/Documentation/edac.txt +++ b/Documentation/edac.txt | |||
@@ -334,8 +334,8 @@ Sdram memory scrubbing rate: | |||
334 | 334 | ||
335 | Reading the file will return the actual scrubbing rate employed. | 335 | Reading the file will return the actual scrubbing rate employed. |
336 | 336 | ||
337 | If configuration fails or memory scrubbing is not implemented, the value | 337 | If configuration fails or memory scrubbing is not implemented, accessing |
338 | of the attribute file will be -1. | 338 | that attribute will fail. |
339 | 339 | ||
340 | 340 | ||
341 | 341 | ||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 4bfd982f8080..0cad4803ffac 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -513,20 +513,6 @@ Who: Bjorn Helgaas <bhelgaas@google.com> | |||
513 | 513 | ||
514 | ---------------------------- | 514 | ---------------------------- |
515 | 515 | ||
516 | What: The CAP9 SoC family will be removed | ||
517 | When: 3.4 | ||
518 | Files: arch/arm/mach-at91/at91cap9.c | ||
519 | arch/arm/mach-at91/at91cap9_devices.c | ||
520 | arch/arm/mach-at91/include/mach/at91cap9.h | ||
521 | arch/arm/mach-at91/include/mach/at91cap9_matrix.h | ||
522 | arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h | ||
523 | arch/arm/mach-at91/board-cap9adk.c | ||
524 | Why: The code is not actively maintained and platforms are now hard to find. | ||
525 | Who: Nicolas Ferre <nicolas.ferre@atmel.com> | ||
526 | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | ||
527 | |||
528 | ---------------------------- | ||
529 | |||
530 | What: Low Performance USB Block driver ("CONFIG_BLK_DEV_UB") | 516 | What: Low Performance USB Block driver ("CONFIG_BLK_DEV_UB") |
531 | When: 3.6 | 517 | When: 3.6 |
532 | Why: This driver provides support for USB storage devices like "USB | 518 | Why: This driver provides support for USB storage devices like "USB |
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt index 8c10bf375c73..1b7f9acbcbbe 100644 --- a/Documentation/filesystems/ext4.txt +++ b/Documentation/filesystems/ext4.txt | |||
@@ -144,9 +144,6 @@ journal_async_commit Commit block can be written to disk without waiting | |||
144 | mount the device. This will enable 'journal_checksum' | 144 | mount the device. This will enable 'journal_checksum' |
145 | internally. | 145 | internally. |
146 | 146 | ||
147 | journal=update Update the ext4 file system's journal to the current | ||
148 | format. | ||
149 | |||
150 | journal_dev=devnum When the external journal device's major/minor numbers | 147 | journal_dev=devnum When the external journal device's major/minor numbers |
151 | have changed, this option allows the user to specify | 148 | have changed, this option allows the user to specify |
152 | the new journal location. The journal device is | 149 | the new journal location. The journal device is |
@@ -356,11 +353,6 @@ nouid32 Disables 32-bit UIDs and GIDs. This is for | |||
356 | interoperability with older kernels which only | 353 | interoperability with older kernels which only |
357 | store and expect 16-bit values. | 354 | store and expect 16-bit values. |
358 | 355 | ||
359 | resize Allows to resize filesystem to the end of the last | ||
360 | existing block group, further resize has to be done | ||
361 | with resize2fs either online, or offline. It can be | ||
362 | used only with conjunction with remount. | ||
363 | |||
364 | block_validity This options allows to enables/disables the in-kernel | 356 | block_validity This options allows to enables/disables the in-kernel |
365 | noblock_validity facility for tracking filesystem metadata blocks | 357 | noblock_validity facility for tracking filesystem metadata blocks |
366 | within internal data structures. This allows multi- | 358 | within internal data structures. This allows multi- |
diff --git a/Documentation/filesystems/nfs/idmapper.txt b/Documentation/filesystems/nfs/idmapper.txt index 120fd3cf7fd9..fe03d10bb79a 100644 --- a/Documentation/filesystems/nfs/idmapper.txt +++ b/Documentation/filesystems/nfs/idmapper.txt | |||
@@ -4,13 +4,21 @@ ID Mapper | |||
4 | ========= | 4 | ========= |
5 | Id mapper is used by NFS to translate user and group ids into names, and to | 5 | Id mapper is used by NFS to translate user and group ids into names, and to |
6 | translate user and group names into ids. Part of this translation involves | 6 | translate user and group names into ids. Part of this translation involves |
7 | performing an upcall to userspace to request the information. Id mapper will | 7 | performing an upcall to userspace to request the information. There are two |
8 | user request-key to perform this upcall and cache the result. The program | 8 | ways NFS could obtain this information: placing a call to /sbin/request-key |
9 | /usr/sbin/nfs.idmap should be called by request-key, and will perform the | 9 | or by placing a call to the rpc.idmap daemon. |
10 | translation and initialize a key with the resulting information. | 10 | |
11 | NFS will attempt to call /sbin/request-key first. If this succeeds, the | ||
12 | result will be cached using the generic request-key cache. This call should | ||
13 | only fail if /etc/request-key.conf is not configured for the id_resolver key | ||
14 | type, see the "Configuring" section below if you wish to use the request-key | ||
15 | method. | ||
16 | |||
17 | If the call to /sbin/request-key fails (if /etc/request-key.conf is not | ||
18 | configured with the id_resolver key type), then the idmapper will ask the | ||
19 | legacy rpc.idmap daemon for the id mapping. This result will be stored | ||
20 | in a custom NFS idmap cache. | ||
11 | 21 | ||
12 | NFS_USE_NEW_IDMAPPER must be selected when configuring the kernel to use this | ||
13 | feature. | ||
14 | 22 | ||
15 | =========== | 23 | =========== |
16 | Configuring | 24 | Configuring |
diff --git a/Documentation/filesystems/nfs/pnfs.txt b/Documentation/filesystems/nfs/pnfs.txt index 983e14abe7e9..c7919c6e3bea 100644 --- a/Documentation/filesystems/nfs/pnfs.txt +++ b/Documentation/filesystems/nfs/pnfs.txt | |||
@@ -53,3 +53,57 @@ lseg maintains an extra reference corresponding to the NFS_LSEG_VALID | |||
53 | bit which holds it in the pnfs_layout_hdr's list. When the final lseg | 53 | bit which holds it in the pnfs_layout_hdr's list. When the final lseg |
54 | is removed from the pnfs_layout_hdr's list, the NFS_LAYOUT_DESTROYED | 54 | is removed from the pnfs_layout_hdr's list, the NFS_LAYOUT_DESTROYED |
55 | bit is set, preventing any new lsegs from being added. | 55 | bit is set, preventing any new lsegs from being added. |
56 | |||
57 | layout drivers | ||
58 | -------------- | ||
59 | |||
60 | PNFS utilizes what is called layout drivers. The STD defines 3 basic | ||
61 | layout types: "files" "objects" and "blocks". For each of these types | ||
62 | there is a layout-driver with a common function-vectors table which | ||
63 | are called by the nfs-client pnfs-core to implement the different layout | ||
64 | types. | ||
65 | |||
66 | Files-layout-driver code is in: fs/nfs/nfs4filelayout.c && nfs4filelayoutdev.c | ||
67 | Objects-layout-deriver code is in: fs/nfs/objlayout/.. directory | ||
68 | Blocks-layout-deriver code is in: fs/nfs/blocklayout/.. directory | ||
69 | |||
70 | objects-layout setup | ||
71 | -------------------- | ||
72 | |||
73 | As part of the full STD implementation the objlayoutdriver.ko needs, at times, | ||
74 | to automatically login to yet undiscovered iscsi/osd devices. For this the | ||
75 | driver makes up-calles to a user-mode script called *osd_login* | ||
76 | |||
77 | The path_name of the script to use is by default: | ||
78 | /sbin/osd_login. | ||
79 | This name can be overridden by the Kernel module parameter: | ||
80 | objlayoutdriver.osd_login_prog | ||
81 | |||
82 | If Kernel does not find the osd_login_prog path it will zero it out | ||
83 | and will not attempt farther logins. An admin can then write new value | ||
84 | to the objlayoutdriver.osd_login_prog Kernel parameter to re-enable it. | ||
85 | |||
86 | The /sbin/osd_login is part of the nfs-utils package, and should usually | ||
87 | be installed on distributions that support this Kernel version. | ||
88 | |||
89 | The API to the login script is as follows: | ||
90 | Usage: $0 -u <URI> -o <OSDNAME> -s <SYSTEMID> | ||
91 | Options: | ||
92 | -u target uri e.g. iscsi://<ip>:<port> | ||
93 | (allways exists) | ||
94 | (More protocols can be defined in the future. | ||
95 | The client does not interpret this string it is | ||
96 | passed unchanged as recieved from the Server) | ||
97 | -o osdname of the requested target OSD | ||
98 | (Might be empty) | ||
99 | (A string which denotes the OSD name, there is a | ||
100 | limit of 64 chars on this string) | ||
101 | -s systemid of the requested target OSD | ||
102 | (Might be empty) | ||
103 | (This string, if not empty is always an hex | ||
104 | representation of the 20 bytes osd_system_id) | ||
105 | |||
106 | blocks-layout setup | ||
107 | ------------------- | ||
108 | |||
109 | TODO: Document the setup needs of the blocks layout driver | ||
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index 792faa3c06cf..620a07844e8c 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -271,9 +271,26 @@ Some platforms may also use knowledge about what GPIOs are active for | |||
271 | power management, such as by powering down unused chip sectors and, more | 271 | power management, such as by powering down unused chip sectors and, more |
272 | easily, gating off unused clocks. | 272 | easily, gating off unused clocks. |
273 | 273 | ||
274 | Note that requesting a GPIO does NOT cause it to be configured in any | 274 | For GPIOs that use pins known to the pinctrl subsystem, that subsystem should |
275 | way; it just marks that GPIO as in use. Separate code must handle any | 275 | be informed of their use; a gpiolib driver's .request() operation may call |
276 | pin setup (e.g. controlling which pin the GPIO uses, pullup/pulldown). | 276 | pinctrl_request_gpio(), and a gpiolib driver's .free() operation may call |
277 | pinctrl_free_gpio(). The pinctrl subsystem allows a pinctrl_request_gpio() | ||
278 | to succeed concurrently with a pin or pingroup being "owned" by a device for | ||
279 | pin multiplexing. | ||
280 | |||
281 | Any programming of pin multiplexing hardware that is needed to route the | ||
282 | GPIO signal to the appropriate pin should occur within a GPIO driver's | ||
283 | .direction_input() or .direction_output() operations, and occur after any | ||
284 | setup of an output GPIO's value. This allows a glitch-free migration from a | ||
285 | pin's special function to GPIO. This is sometimes required when using a GPIO | ||
286 | to implement a workaround on signals typically driven by a non-GPIO HW block. | ||
287 | |||
288 | Some platforms allow some or all GPIO signals to be routed to different pins. | ||
289 | Similarly, other aspects of the GPIO or pin may need to be configured, such as | ||
290 | pullup/pulldown. Platform software should arrange that any such details are | ||
291 | configured prior to gpio_request() being called for those GPIOs, e.g. using | ||
292 | the pinctrl subsystem's mapping table, so that GPIO users need not be aware | ||
293 | of these details. | ||
277 | 294 | ||
278 | Also note that it's your responsibility to have stopped using a GPIO | 295 | Also note that it's your responsibility to have stopped using a GPIO |
279 | before you free it. | 296 | before you free it. |
@@ -302,6 +319,8 @@ where 'flags' is currently defined to specify the following properties: | |||
302 | 319 | ||
303 | * GPIOF_INIT_LOW - as output, set initial level to LOW | 320 | * GPIOF_INIT_LOW - as output, set initial level to LOW |
304 | * GPIOF_INIT_HIGH - as output, set initial level to HIGH | 321 | * GPIOF_INIT_HIGH - as output, set initial level to HIGH |
322 | * GPIOF_OPEN_DRAIN - gpio pin is open drain type. | ||
323 | * GPIOF_OPEN_SOURCE - gpio pin is open source type. | ||
305 | 324 | ||
306 | since GPIOF_INIT_* are only valid when configured as output, so group valid | 325 | since GPIOF_INIT_* are only valid when configured as output, so group valid |
307 | combinations as: | 326 | combinations as: |
@@ -310,8 +329,19 @@ combinations as: | |||
310 | * GPIOF_OUT_INIT_LOW - configured as output, initial level LOW | 329 | * GPIOF_OUT_INIT_LOW - configured as output, initial level LOW |
311 | * GPIOF_OUT_INIT_HIGH - configured as output, initial level HIGH | 330 | * GPIOF_OUT_INIT_HIGH - configured as output, initial level HIGH |
312 | 331 | ||
313 | In the future, these flags can be extended to support more properties such | 332 | When setting the flag as GPIOF_OPEN_DRAIN then it will assume that pins is |
314 | as open-drain status. | 333 | open drain type. Such pins will not be driven to 1 in output mode. It is |
334 | require to connect pull-up on such pins. By enabling this flag, gpio lib will | ||
335 | make the direction to input when it is asked to set value of 1 in output mode | ||
336 | to make the pin HIGH. The pin is make to LOW by driving value 0 in output mode. | ||
337 | |||
338 | When setting the flag as GPIOF_OPEN_SOURCE then it will assume that pins is | ||
339 | open source type. Such pins will not be driven to 0 in output mode. It is | ||
340 | require to connect pull-down on such pin. By enabling this flag, gpio lib will | ||
341 | make the direction to input when it is asked to set value of 0 in output mode | ||
342 | to make the pin LOW. The pin is make to HIGH by driving value 1 in output mode. | ||
343 | |||
344 | In the future, these flags can be extended to support more properties. | ||
315 | 345 | ||
316 | Further more, to ease the claim/release of multiple GPIOs, 'struct gpio' is | 346 | Further more, to ease the claim/release of multiple GPIOs, 'struct gpio' is |
317 | introduced to encapsulate all three fields as: | 347 | introduced to encapsulate all three fields as: |
diff --git a/Documentation/hwmon/lm90 b/Documentation/hwmon/lm90 index 9cd14cfe6515..b466974e142f 100644 --- a/Documentation/hwmon/lm90 +++ b/Documentation/hwmon/lm90 | |||
@@ -118,6 +118,10 @@ Supported chips: | |||
118 | Addresses scanned: I2C 0x48 through 0x4F | 118 | Addresses scanned: I2C 0x48 through 0x4F |
119 | Datasheet: Publicly available at NXP website | 119 | Datasheet: Publicly available at NXP website |
120 | http://ics.nxp.com/products/interface/datasheet/sa56004x.pdf | 120 | http://ics.nxp.com/products/interface/datasheet/sa56004x.pdf |
121 | * GMT G781 | ||
122 | Prefix: 'g781' | ||
123 | Addresses scanned: I2C 0x4c, 0x4d | ||
124 | Datasheet: Not publicly available from GMT | ||
121 | 125 | ||
122 | Author: Jean Delvare <khali@linux-fr.org> | 126 | Author: Jean Delvare <khali@linux-fr.org> |
123 | 127 | ||
diff --git a/Documentation/hwmon/mc13783-adc b/Documentation/hwmon/mc13783-adc index 044531a86405..d0e7b3fa9e75 100644 --- a/Documentation/hwmon/mc13783-adc +++ b/Documentation/hwmon/mc13783-adc | |||
@@ -3,8 +3,11 @@ Kernel driver mc13783-adc | |||
3 | 3 | ||
4 | Supported chips: | 4 | Supported chips: |
5 | * Freescale Atlas MC13783 | 5 | * Freescale Atlas MC13783 |
6 | Prefix: 'mc13783_adc' | 6 | Prefix: 'mc13783' |
7 | Datasheet: http://www.freescale.com/files/rf_if/doc/data_sheet/MC13783.pdf?fsrch=1 | 7 | Datasheet: http://www.freescale.com/files/rf_if/doc/data_sheet/MC13783.pdf?fsrch=1 |
8 | * Freescale Atlas MC13892 | ||
9 | Prefix: 'mc13892' | ||
10 | Datasheet: http://cache.freescale.com/files/analog/doc/data_sheet/MC13892.pdf?fsrch=1&sr=1 | ||
8 | 11 | ||
9 | Authors: | 12 | Authors: |
10 | Sascha Hauer <s.hauer@pengutronix.de> | 13 | Sascha Hauer <s.hauer@pengutronix.de> |
@@ -13,20 +16,21 @@ Authors: | |||
13 | Description | 16 | Description |
14 | ----------- | 17 | ----------- |
15 | 18 | ||
16 | The Freescale MC13783 is a Power Management and Audio Circuit. Among | 19 | The Freescale MC13783 and MC13892 are Power Management and Audio Circuits. |
17 | other things it contains a 10-bit A/D converter. The converter has 16 | 20 | Among other things they contain a 10-bit A/D converter. The converter has 16 |
18 | channels which can be used in different modes. | 21 | (MC13783) resp. 12 (MC13892) channels which can be used in different modes. The |
19 | The A/D converter has a resolution of 2.25mV. Channels 0-4 have | 22 | A/D converter has a resolution of 2.25mV. |
20 | a dedicated meaning with chip internal scaling applied. Channels 5-7 | ||
21 | can be used as general purpose inputs or alternatively in a dedicated | ||
22 | mode. Channels 12-15 are occupied by the touchscreen if it's active. | ||
23 | 23 | ||
24 | Currently the driver only supports channels 2 and 5-15 with no alternative | 24 | Some channels can be used as General Purpose inputs or in a dedicated mode with |
25 | modes for channels 5-7. | 25 | a chip internal scaling applied . |
26 | 26 | ||
27 | See this table for the meaning of the different channels and their chip | 27 | Currently the driver only supports the Application Supply channel (BP / BPSNS), |
28 | internal scaling: | 28 | the General Purpose inputs and touchscreen. |
29 | 29 | ||
30 | See the following tables for the meaning of the different channels and their | ||
31 | chip internal scaling: | ||
32 | |||
33 | MC13783: | ||
30 | Channel Signal Input Range Scaling | 34 | Channel Signal Input Range Scaling |
31 | ------------------------------------------------------------------------------- | 35 | ------------------------------------------------------------------------------- |
32 | 0 Battery Voltage (BATT) 2.50 - 4.65V -2.40V | 36 | 0 Battery Voltage (BATT) 2.50 - 4.65V -2.40V |
@@ -34,7 +38,7 @@ Channel Signal Input Range Scaling | |||
34 | 2 Application Supply (BP) 2.50 - 4.65V -2.40V | 38 | 2 Application Supply (BP) 2.50 - 4.65V -2.40V |
35 | 3 Charger Voltage (CHRGRAW) 0 - 10V / /5 | 39 | 3 Charger Voltage (CHRGRAW) 0 - 10V / /5 |
36 | 0 - 20V /10 | 40 | 0 - 20V /10 |
37 | 4 Charger Current (CHRGISNSP-CHRGISNSN) -0.25V - 0.25V x4 | 41 | 4 Charger Current (CHRGISNSP-CHRGISNSN) -0.25 - 0.25V x4 |
38 | 5 General Purpose ADIN5 / Battery Pack Thermistor 0 - 2.30V No | 42 | 5 General Purpose ADIN5 / Battery Pack Thermistor 0 - 2.30V No |
39 | 6 General Purpose ADIN6 / Backup Voltage (LICELL) 0 - 2.30V / No / | 43 | 6 General Purpose ADIN6 / Backup Voltage (LICELL) 0 - 2.30V / No / |
40 | 1.50 - 3.50V -1.20V | 44 | 1.50 - 3.50V -1.20V |
@@ -48,3 +52,23 @@ Channel Signal Input Range Scaling | |||
48 | 13 General Purpose TSX2 / Touchscreen X-plate 2 0 - 2.30V No | 52 | 13 General Purpose TSX2 / Touchscreen X-plate 2 0 - 2.30V No |
49 | 14 General Purpose TSY1 / Touchscreen Y-plate 1 0 - 2.30V No | 53 | 14 General Purpose TSY1 / Touchscreen Y-plate 1 0 - 2.30V No |
50 | 15 General Purpose TSY2 / Touchscreen Y-plate 2 0 - 2.30V No | 54 | 15 General Purpose TSY2 / Touchscreen Y-plate 2 0 - 2.30V No |
55 | |||
56 | MC13892: | ||
57 | Channel Signal Input Range Scaling | ||
58 | ------------------------------------------------------------------------------- | ||
59 | 0 Battery Voltage (BATT) 0 - 4.8V /2 | ||
60 | 1 Battery Current (BATT - BATTISNSCC) -60 - 60 mV x20 | ||
61 | 2 Application Supply (BPSNS) 0 - 4.8V /2 | ||
62 | 3 Charger Voltage (CHRGRAW) 0 - 12V / /5 | ||
63 | 0 - 20V /10 | ||
64 | 4 Charger Current (CHRGISNS-BPSNS) / -0.3 - 0.3V / x4 / | ||
65 | Touchscreen X-plate 1 0 - 2.4V No | ||
66 | 5 General Purpose ADIN5 / Battery Pack Thermistor 0 - 2.4V No | ||
67 | 6 General Purpose ADIN6 / Backup Voltage (LICELL) 0 - 2.4V / No | ||
68 | Backup Voltage (LICELL) 0 - 3.6V x2/3 | ||
69 | 7 General Purpose ADIN7 / UID / Die Temperature 0 - 2.4V / No / | ||
70 | 0 - 4.8V /2 | ||
71 | 12 General Purpose TSX1 / Touchscreen X-plate 1 0 - 2.4V No | ||
72 | 13 General Purpose TSX2 / Touchscreen X-plate 2 0 - 2.4V No | ||
73 | 14 General Purpose TSY1 / Touchscreen Y-plate 1 0 - 2.4V No | ||
74 | 15 General Purpose TSY2 / Touchscreen Y-plate 2 0 - 2.4V No | ||
diff --git a/Documentation/hwmon/mcp3021 b/Documentation/hwmon/mcp3021 new file mode 100644 index 000000000000..325fd87e81b2 --- /dev/null +++ b/Documentation/hwmon/mcp3021 | |||
@@ -0,0 +1,22 @@ | |||
1 | Kernel driver MCP3021 | ||
2 | ====================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Microchip Technology MCP3021 | ||
6 | Prefix: 'mcp3021' | ||
7 | Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21805a.pdf | ||
8 | |||
9 | Author: Mingkai Hu | ||
10 | |||
11 | Description | ||
12 | ----------- | ||
13 | |||
14 | This driver implements support for the Microchip Technology MCP3021 chip. | ||
15 | |||
16 | The Microchip Technology Inc. MCP3021 is a successive approximation A/D | ||
17 | converter (ADC) with 10-bit resolution. | ||
18 | This device provides one single-ended input with very low power consumption. | ||
19 | Communication to the MCP3021 is performed using a 2-wire I2C compatible | ||
20 | interface. Standard (100 kHz) and Fast (400 kHz) I2C modes are available. | ||
21 | The default I2C device address is 0x4d (contact the Microchip factory for | ||
22 | additional address options). | ||
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 index 2871fd500349..71f55bbcefc8 100644 --- a/Documentation/i2c/busses/i2c-i801 +++ b/Documentation/i2c/busses/i2c-i801 | |||
@@ -20,6 +20,7 @@ Supported adapters: | |||
20 | * Intel Patsburg (PCH) | 20 | * Intel Patsburg (PCH) |
21 | * Intel DH89xxCC (PCH) | 21 | * Intel DH89xxCC (PCH) |
22 | * Intel Panther Point (PCH) | 22 | * Intel Panther Point (PCH) |
23 | * Intel Lynx Point (PCH) | ||
23 | Datasheets: Publicly available at the Intel website | 24 | Datasheets: Publicly available at the Intel website |
24 | 25 | ||
25 | On Intel Patsburg and later chipsets, both the normal host SMBus controller | 26 | On Intel Patsburg and later chipsets, both the normal host SMBus controller |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 7986d79d9d17..e2f8c297a8a4 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -713,6 +713,21 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
713 | The filter can be disabled or changed to another | 713 | The filter can be disabled or changed to another |
714 | driver later using sysfs. | 714 | driver later using sysfs. |
715 | 715 | ||
716 | drm_kms_helper.edid_firmware=[<connector>:]<file> | ||
717 | Broken monitors, graphic adapters and KVMs may | ||
718 | send no or incorrect EDID data sets. This parameter | ||
719 | allows to specify an EDID data set in the | ||
720 | /lib/firmware directory that is used instead. | ||
721 | Generic built-in EDID data sets are used, if one of | ||
722 | edid/1024x768.bin, edid/1280x1024.bin, | ||
723 | edid/1680x1050.bin, or edid/1920x1080.bin is given | ||
724 | and no file with the same name exists. Details and | ||
725 | instructions how to build your own EDID data are | ||
726 | available in Documentation/EDID/HOWTO.txt. An EDID | ||
727 | data set will only be used for a particular connector, | ||
728 | if its name and a colon are prepended to the EDID | ||
729 | name. | ||
730 | |||
716 | dscc4.setup= [NET] | 731 | dscc4.setup= [NET] |
717 | 732 | ||
718 | earlycon= [KNL] Output early console device and options. | 733 | earlycon= [KNL] Output early console device and options. |
@@ -1071,8 +1086,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
1071 | no_x2apic_optout | 1086 | no_x2apic_optout |
1072 | BIOS x2APIC opt-out request will be ignored | 1087 | BIOS x2APIC opt-out request will be ignored |
1073 | 1088 | ||
1074 | inttest= [IA-64] | ||
1075 | |||
1076 | iomem= Disable strict checking of access to MMIO memory | 1089 | iomem= Disable strict checking of access to MMIO memory |
1077 | strict regions from userspace. | 1090 | strict regions from userspace. |
1078 | relaxed | 1091 | relaxed |
@@ -1657,6 +1670,14 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
1657 | of returning the full 64-bit number. | 1670 | of returning the full 64-bit number. |
1658 | The default is to return 64-bit inode numbers. | 1671 | The default is to return 64-bit inode numbers. |
1659 | 1672 | ||
1673 | nfs.max_session_slots= | ||
1674 | [NFSv4.1] Sets the maximum number of session slots | ||
1675 | the client will attempt to negotiate with the server. | ||
1676 | This limits the number of simultaneous RPC requests | ||
1677 | that the client can send to the NFSv4.1 server. | ||
1678 | Note that there is little point in setting this | ||
1679 | value higher than the max_tcp_slot_table_limit. | ||
1680 | |||
1660 | nfs.nfs4_disable_idmapping= | 1681 | nfs.nfs4_disable_idmapping= |
1661 | [NFSv4] When set to the default of '1', this option | 1682 | [NFSv4] When set to the default of '1', this option |
1662 | ensures that both the RPC level authentication | 1683 | ensures that both the RPC level authentication |
@@ -1670,6 +1691,21 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
1670 | back to using the idmapper. | 1691 | back to using the idmapper. |
1671 | To turn off this behaviour, set the value to '0'. | 1692 | To turn off this behaviour, set the value to '0'. |
1672 | 1693 | ||
1694 | nfs.send_implementation_id = | ||
1695 | [NFSv4.1] Send client implementation identification | ||
1696 | information in exchange_id requests. | ||
1697 | If zero, no implementation identification information | ||
1698 | will be sent. | ||
1699 | The default is to send the implementation identification | ||
1700 | information. | ||
1701 | |||
1702 | |||
1703 | objlayoutdriver.osd_login_prog= | ||
1704 | [NFS] [OBJLAYOUT] sets the pathname to the program which | ||
1705 | is used to automatically discover and login into new | ||
1706 | osd-targets. Please see: | ||
1707 | Documentation/filesystems/pnfs.txt for more explanations | ||
1708 | |||
1673 | nmi_debug= [KNL,AVR32,SH] Specify one or more actions to take | 1709 | nmi_debug= [KNL,AVR32,SH] Specify one or more actions to take |
1674 | when a NMI is triggered. | 1710 | when a NMI is triggered. |
1675 | Format: [state][,regs][,debounce][,die] | 1711 | Format: [state][,regs][,debounce][,die] |
@@ -1833,6 +1869,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
1833 | shutdown the other cpus. Instead use the REBOOT_VECTOR | 1869 | shutdown the other cpus. Instead use the REBOOT_VECTOR |
1834 | irq. | 1870 | irq. |
1835 | 1871 | ||
1872 | nomodule Disable module load | ||
1873 | |||
1836 | nopat [X86] Disable PAT (page attribute table extension of | 1874 | nopat [X86] Disable PAT (page attribute table extension of |
1837 | pagetables) support. | 1875 | pagetables) support. |
1838 | 1876 | ||
@@ -2109,8 +2147,14 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
2109 | the default. | 2147 | the default. |
2110 | off: Turn ECRC off | 2148 | off: Turn ECRC off |
2111 | on: Turn ECRC on. | 2149 | on: Turn ECRC on. |
2112 | realloc reallocate PCI resources if allocations done by BIOS | 2150 | realloc= Enable/disable reallocating PCI bridge resources |
2113 | are erroneous. | 2151 | if allocations done by BIOS are too small to |
2152 | accommodate resources required by all child | ||
2153 | devices. | ||
2154 | off: Turn realloc off | ||
2155 | on: Turn realloc on | ||
2156 | realloc same as realloc=on | ||
2157 | noari do not use PCIe ARI. | ||
2114 | 2158 | ||
2115 | pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power | 2159 | pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power |
2116 | Management. | 2160 | Management. |
@@ -2118,6 +2162,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
2118 | force Enable ASPM even on devices that claim not to support it. | 2162 | force Enable ASPM even on devices that claim not to support it. |
2119 | WARNING: Forcing ASPM on may cause system lockups. | 2163 | WARNING: Forcing ASPM on may cause system lockups. |
2120 | 2164 | ||
2165 | pcie_hp= [PCIE] PCI Express Hotplug driver options: | ||
2166 | nomsi Do not use MSI for PCI Express Native Hotplug (this | ||
2167 | makes all PCIe ports use INTx for hotplug services). | ||
2168 | |||
2121 | pcie_ports= [PCIE] PCIe ports handling: | 2169 | pcie_ports= [PCIE] PCIe ports handling: |
2122 | auto Ask the BIOS whether or not to use native PCIe services | 2170 | auto Ask the BIOS whether or not to use native PCIe services |
2123 | associated with PCIe ports (PME, hot-plug, AER). Use | 2171 | associated with PCIe ports (PME, hot-plug, AER). Use |
diff --git a/Documentation/laptops/asus-laptop.txt b/Documentation/laptops/asus-laptop.txt index 803e51f6768b..a1e04d679289 100644 --- a/Documentation/laptops/asus-laptop.txt +++ b/Documentation/laptops/asus-laptop.txt | |||
@@ -45,7 +45,7 @@ Status | |||
45 | Usage | 45 | Usage |
46 | ----- | 46 | ----- |
47 | 47 | ||
48 | Try "modprobe asus_acpi". Check your dmesg (simply type dmesg). You should | 48 | Try "modprobe asus-laptop". Check your dmesg (simply type dmesg). You should |
49 | see some lines like this : | 49 | see some lines like this : |
50 | 50 | ||
51 | Asus Laptop Extras version 0.42 | 51 | Asus Laptop Extras version 0.42 |
diff --git a/Documentation/laptops/sony-laptop.txt b/Documentation/laptops/sony-laptop.txt index 2bd4e82e5d9f..0d5ac7f5287e 100644 --- a/Documentation/laptops/sony-laptop.txt +++ b/Documentation/laptops/sony-laptop.txt | |||
@@ -17,6 +17,11 @@ subsystem. See the logs of acpid or /proc/acpi/event and | |||
17 | devices are created by the driver. Additionally, loading the driver with the | 17 | devices are created by the driver. Additionally, loading the driver with the |
18 | debug option will report all events in the kernel log. | 18 | debug option will report all events in the kernel log. |
19 | 19 | ||
20 | The "scancodes" passed to the input system (that can be remapped with udev) | ||
21 | are indexes to the table "sony_laptop_input_keycode_map" in the sony-laptop.c | ||
22 | module. For example the "FN/E" key combination (EJECTCD on some models) | ||
23 | generates the scancode 20 (0x14). | ||
24 | |||
20 | Backlight control: | 25 | Backlight control: |
21 | ------------------ | 26 | ------------------ |
22 | If your laptop model supports it, you will find sysfs files in the | 27 | If your laptop model supports it, you will find sysfs files in the |
diff --git a/Documentation/leds/leds-lp5521.txt b/Documentation/leds/leds-lp5521.txt index c4d8d151e0fe..0e542ab3d4a0 100644 --- a/Documentation/leds/leds-lp5521.txt +++ b/Documentation/leds/leds-lp5521.txt | |||
@@ -43,17 +43,23 @@ Format: 10x mA i.e 10 means 1.0 mA | |||
43 | example platform data: | 43 | example platform data: |
44 | 44 | ||
45 | Note: chan_nr can have values between 0 and 2. | 45 | Note: chan_nr can have values between 0 and 2. |
46 | The name of each channel can be configurable. | ||
47 | If the name field is not defined, the default name will be set to 'xxxx:channelN' | ||
48 | (XXXX : pdata->label or i2c client name, N : channel number) | ||
46 | 49 | ||
47 | static struct lp5521_led_config lp5521_led_config[] = { | 50 | static struct lp5521_led_config lp5521_led_config[] = { |
48 | { | 51 | { |
52 | .name = "red", | ||
49 | .chan_nr = 0, | 53 | .chan_nr = 0, |
50 | .led_current = 50, | 54 | .led_current = 50, |
51 | .max_current = 130, | 55 | .max_current = 130, |
52 | }, { | 56 | }, { |
57 | .name = "green", | ||
53 | .chan_nr = 1, | 58 | .chan_nr = 1, |
54 | .led_current = 0, | 59 | .led_current = 0, |
55 | .max_current = 130, | 60 | .max_current = 130, |
56 | }, { | 61 | }, { |
62 | .name = "blue", | ||
57 | .chan_nr = 2, | 63 | .chan_nr = 2, |
58 | .led_current = 0, | 64 | .led_current = 0, |
59 | .max_current = 130, | 65 | .max_current = 130, |
@@ -86,3 +92,60 @@ static struct lp5521_platform_data lp5521_platform_data = { | |||
86 | 92 | ||
87 | If the current is set to 0 in the platform data, that channel is | 93 | If the current is set to 0 in the platform data, that channel is |
88 | disabled and it is not visible in the sysfs. | 94 | disabled and it is not visible in the sysfs. |
95 | |||
96 | The 'update_config' : CONFIG register (ADDR 08h) | ||
97 | This value is platform-specific data. | ||
98 | If update_config is not defined, the CONFIG register is set with | ||
99 | 'LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT'. | ||
100 | (Enable auto-powersave, set charge pump to auto, red to battery) | ||
101 | |||
102 | example of update_config : | ||
103 | |||
104 | #define LP5521_CONFIGS (LP5521_PWM_HF | LP5521_PWRSAVE_EN | \ | ||
105 | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT | \ | ||
106 | LP5521_CLK_INT) | ||
107 | |||
108 | static struct lp5521_platform_data lp5521_pdata = { | ||
109 | .led_config = lp5521_led_config, | ||
110 | .num_channels = ARRAY_SIZE(lp5521_led_config), | ||
111 | .clock_mode = LP5521_CLOCK_INT, | ||
112 | .update_config = LP5521_CONFIGS, | ||
113 | }; | ||
114 | |||
115 | LED patterns : LP5521 has autonomous operation without external control. | ||
116 | Pattern data can be defined in the platform data. | ||
117 | |||
118 | example of led pattern data : | ||
119 | |||
120 | /* RGB(50,5,0) 500ms on, 500ms off, infinite loop */ | ||
121 | static u8 pattern_red[] = { | ||
122 | 0x40, 0x32, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00, | ||
123 | }; | ||
124 | |||
125 | static u8 pattern_green[] = { | ||
126 | 0x40, 0x05, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00, | ||
127 | }; | ||
128 | |||
129 | static struct lp5521_led_pattern board_led_patterns[] = { | ||
130 | { | ||
131 | .r = pattern_red, | ||
132 | .g = pattern_green, | ||
133 | .size_r = ARRAY_SIZE(pattern_red), | ||
134 | .size_g = ARRAY_SIZE(pattern_green), | ||
135 | }, | ||
136 | }; | ||
137 | |||
138 | static struct lp5521_platform_data lp5521_platform_data = { | ||
139 | .led_config = lp5521_led_config, | ||
140 | .num_channels = ARRAY_SIZE(lp5521_led_config), | ||
141 | .clock_mode = LP5521_CLOCK_EXT, | ||
142 | .patterns = board_led_patterns, | ||
143 | .num_patterns = ARRAY_SIZE(board_led_patterns), | ||
144 | }; | ||
145 | |||
146 | Then predefined led pattern(s) can be executed via the sysfs. | ||
147 | To start the pattern #1, | ||
148 | # echo 1 > /sys/bus/i2c/devices/xxxx/led_pattern | ||
149 | (xxxx : i2c bus & slave address) | ||
150 | To end the pattern, | ||
151 | # echo 0 > /sys/bus/i2c/devices/xxxx/led_pattern | ||
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt index 150fd3833d0b..d97bccf46147 100644 --- a/Documentation/pinctrl.txt +++ b/Documentation/pinctrl.txt | |||
@@ -206,12 +206,21 @@ using a certain resistor value - pull up and pull down - so that the pin has a | |||
206 | stable value when nothing is driving the rail it is connected to, or when it's | 206 | stable value when nothing is driving the rail it is connected to, or when it's |
207 | unconnected. | 207 | unconnected. |
208 | 208 | ||
209 | For example, a platform may do this: | 209 | Pin configuration can be programmed either using the explicit APIs described |
210 | immediately below, or by adding configuration entries into the mapping table; | ||
211 | see section "Board/machine configuration" below. | ||
212 | |||
213 | For example, a platform may do the following to pull up a pin to VDD: | ||
214 | |||
215 | #include <linux/pinctrl/consumer.h> | ||
210 | 216 | ||
211 | ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP); | 217 | ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP); |
212 | 218 | ||
213 | To pull up a pin to VDD. The pin configuration driver implements callbacks for | 219 | The format and meaning of the configuration parameter, PLATFORM_X_PULL_UP |
214 | changing pin configuration in the pin controller ops like this: | 220 | above, is entirely defined by the pin controller driver. |
221 | |||
222 | The pin configuration driver implements callbacks for changing pin | ||
223 | configuration in the pin controller ops like this: | ||
215 | 224 | ||
216 | #include <linux/pinctrl/pinctrl.h> | 225 | #include <linux/pinctrl/pinctrl.h> |
217 | #include <linux/pinctrl/pinconf.h> | 226 | #include <linux/pinctrl/pinconf.h> |
@@ -492,14 +501,10 @@ Definitions: | |||
492 | {"map-i2c0", i2c0, pinctrl0, fi2c0, gi2c0} | 501 | {"map-i2c0", i2c0, pinctrl0, fi2c0, gi2c0} |
493 | } | 502 | } |
494 | 503 | ||
495 | Every map must be assigned a symbolic name, pin controller and function. | 504 | Every map must be assigned a state name, pin controller, device and |
496 | The group is not compulsory - if it is omitted the first group presented by | 505 | function. The group is not compulsory - if it is omitted the first group |
497 | the driver as applicable for the function will be selected, which is | 506 | presented by the driver as applicable for the function will be selected, |
498 | useful for simple cases. | 507 | which is useful for simple cases. |
499 | |||
500 | The device name is present in map entries tied to specific devices. Maps | ||
501 | without device names are referred to as SYSTEM pinmuxes, such as can be taken | ||
502 | by the machine implementation on boot and not tied to any specific device. | ||
503 | 508 | ||
504 | It is possible to map several groups to the same combination of device, | 509 | It is possible to map several groups to the same combination of device, |
505 | pin controller and function. This is for cases where a certain function on | 510 | pin controller and function. This is for cases where a certain function on |
@@ -726,19 +731,19 @@ same time. | |||
726 | All the above functions are mandatory to implement for a pinmux driver. | 731 | All the above functions are mandatory to implement for a pinmux driver. |
727 | 732 | ||
728 | 733 | ||
729 | Pinmux interaction with the GPIO subsystem | 734 | Pin control interaction with the GPIO subsystem |
730 | ========================================== | 735 | =============================================== |
731 | 736 | ||
732 | The public pinmux API contains two functions named pinmux_request_gpio() | 737 | The public pinmux API contains two functions named pinctrl_request_gpio() |
733 | and pinmux_free_gpio(). These two functions shall *ONLY* be called from | 738 | and pinctrl_free_gpio(). These two functions shall *ONLY* be called from |
734 | gpiolib-based drivers as part of their gpio_request() and | 739 | gpiolib-based drivers as part of their gpio_request() and |
735 | gpio_free() semantics. Likewise the pinmux_gpio_direction_[input|output] | 740 | gpio_free() semantics. Likewise the pinctrl_gpio_direction_[input|output] |
736 | shall only be called from within respective gpio_direction_[input|output] | 741 | shall only be called from within respective gpio_direction_[input|output] |
737 | gpiolib implementation. | 742 | gpiolib implementation. |
738 | 743 | ||
739 | NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be | 744 | NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be |
740 | muxed in. Instead, implement a proper gpiolib driver and have that driver | 745 | controlled e.g. muxed in. Instead, implement a proper gpiolib driver and have |
741 | request proper muxing for its pins. | 746 | that driver request proper muxing and other control for its pins. |
742 | 747 | ||
743 | The function list could become long, especially if you can convert every | 748 | The function list could become long, especially if you can convert every |
744 | individual pin into a GPIO pin independent of any other pins, and then try | 749 | individual pin into a GPIO pin independent of any other pins, and then try |
@@ -747,7 +752,7 @@ the approach to define every pin as a function. | |||
747 | In this case, the function array would become 64 entries for each GPIO | 752 | In this case, the function array would become 64 entries for each GPIO |
748 | setting and then the device functions. | 753 | setting and then the device functions. |
749 | 754 | ||
750 | For this reason there are two functions a pinmux driver can implement | 755 | For this reason there are two functions a pin control driver can implement |
751 | to enable only GPIO on an individual pin: .gpio_request_enable() and | 756 | to enable only GPIO on an individual pin: .gpio_request_enable() and |
752 | .gpio_disable_free(). | 757 | .gpio_disable_free(). |
753 | 758 | ||
@@ -762,12 +767,12 @@ gpiolib driver and the affected GPIO range, pin offset and desired direction | |||
762 | will be passed along to this function. | 767 | will be passed along to this function. |
763 | 768 | ||
764 | Alternatively to using these special functions, it is fully allowed to use | 769 | Alternatively to using these special functions, it is fully allowed to use |
765 | named functions for each GPIO pin, the pinmux_request_gpio() will attempt to | 770 | named functions for each GPIO pin, the pinctrl_request_gpio() will attempt to |
766 | obtain the function "gpioN" where "N" is the global GPIO pin number if no | 771 | obtain the function "gpioN" where "N" is the global GPIO pin number if no |
767 | special GPIO-handler is registered. | 772 | special GPIO-handler is registered. |
768 | 773 | ||
769 | 774 | ||
770 | Pinmux board/machine configuration | 775 | Board/machine configuration |
771 | ================================== | 776 | ================================== |
772 | 777 | ||
773 | Boards and machines define how a certain complete running system is put | 778 | Boards and machines define how a certain complete running system is put |
@@ -775,27 +780,33 @@ together, including how GPIOs and devices are muxed, how regulators are | |||
775 | constrained and how the clock tree looks. Of course pinmux settings are also | 780 | constrained and how the clock tree looks. Of course pinmux settings are also |
776 | part of this. | 781 | part of this. |
777 | 782 | ||
778 | A pinmux config for a machine looks pretty much like a simple regulator | 783 | A pin controller configuration for a machine looks pretty much like a simple |
779 | configuration, so for the example array above we want to enable i2c and | 784 | regulator configuration, so for the example array above we want to enable i2c |
780 | spi on the second function mapping: | 785 | and spi on the second function mapping: |
781 | 786 | ||
782 | #include <linux/pinctrl/machine.h> | 787 | #include <linux/pinctrl/machine.h> |
783 | 788 | ||
784 | static const struct pinmux_map __initdata pmx_mapping[] = { | 789 | static const struct pinctrl_map __initdata mapping[] = { |
785 | { | 790 | { |
786 | .ctrl_dev_name = "pinctrl-foo", | ||
787 | .function = "spi0", | ||
788 | .dev_name = "foo-spi.0", | 791 | .dev_name = "foo-spi.0", |
792 | .name = PINCTRL_STATE_DEFAULT, | ||
793 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
794 | .ctrl_dev_name = "pinctrl-foo", | ||
795 | .data.mux.function = "spi0", | ||
789 | }, | 796 | }, |
790 | { | 797 | { |
791 | .ctrl_dev_name = "pinctrl-foo", | ||
792 | .function = "i2c0", | ||
793 | .dev_name = "foo-i2c.0", | 798 | .dev_name = "foo-i2c.0", |
799 | .name = PINCTRL_STATE_DEFAULT, | ||
800 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
801 | .ctrl_dev_name = "pinctrl-foo", | ||
802 | .data.mux.function = "i2c0", | ||
794 | }, | 803 | }, |
795 | { | 804 | { |
796 | .ctrl_dev_name = "pinctrl-foo", | ||
797 | .function = "mmc0", | ||
798 | .dev_name = "foo-mmc.0", | 805 | .dev_name = "foo-mmc.0", |
806 | .name = PINCTRL_STATE_DEFAULT, | ||
807 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
808 | .ctrl_dev_name = "pinctrl-foo", | ||
809 | .data.mux.function = "mmc0", | ||
799 | }, | 810 | }, |
800 | }; | 811 | }; |
801 | 812 | ||
@@ -805,21 +816,51 @@ must match a function provided by the pinmux driver handling this pin range. | |||
805 | 816 | ||
806 | As you can see we may have several pin controllers on the system and thus | 817 | As you can see we may have several pin controllers on the system and thus |
807 | we need to specify which one of them that contain the functions we wish | 818 | we need to specify which one of them that contain the functions we wish |
808 | to map. The map can also use struct device * directly, so there is no | 819 | to map. |
809 | inherent need to use strings to specify .dev_name or .ctrl_dev_name, these | ||
810 | are for the situation where you do not have a handle to the struct device *, | ||
811 | for example if they are not yet instantiated or cumbersome to obtain. | ||
812 | 820 | ||
813 | You register this pinmux mapping to the pinmux subsystem by simply: | 821 | You register this pinmux mapping to the pinmux subsystem by simply: |
814 | 822 | ||
815 | ret = pinmux_register_mappings(pmx_mapping, ARRAY_SIZE(pmx_mapping)); | 823 | ret = pinctrl_register_mappings(mapping, ARRAY_SIZE(mapping)); |
816 | 824 | ||
817 | Since the above construct is pretty common there is a helper macro to make | 825 | Since the above construct is pretty common there is a helper macro to make |
818 | it even more compact which assumes you want to use pinctrl-foo and position | 826 | it even more compact which assumes you want to use pinctrl-foo and position |
819 | 0 for mapping, for example: | 827 | 0 for mapping, for example: |
820 | 828 | ||
821 | static struct pinmux_map __initdata pmx_mapping[] = { | 829 | static struct pinctrl_map __initdata mapping[] = { |
822 | PINMUX_MAP("I2CMAP", "pinctrl-foo", "i2c0", "foo-i2c.0"), | 830 | PIN_MAP_MUX_GROUP("foo-i2c.o", PINCTRL_STATE_DEFAULT, "pinctrl-foo", NULL, "i2c0"), |
831 | }; | ||
832 | |||
833 | The mapping table may also contain pin configuration entries. It's common for | ||
834 | each pin/group to have a number of configuration entries that affect it, so | ||
835 | the table entries for configuration reference an array of config parameters | ||
836 | and values. An example using the convenience macros is shown below: | ||
837 | |||
838 | static unsigned long i2c_grp_configs[] = { | ||
839 | FOO_PIN_DRIVEN, | ||
840 | FOO_PIN_PULLUP, | ||
841 | }; | ||
842 | |||
843 | static unsigned long i2c_pin_configs[] = { | ||
844 | FOO_OPEN_COLLECTOR, | ||
845 | FOO_SLEW_RATE_SLOW, | ||
846 | }; | ||
847 | |||
848 | static struct pinctrl_map __initdata mapping[] = { | ||
849 | PIN_MAP_MUX_GROUP("foo-i2c.0", PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0", "i2c0"), | ||
850 | PIN_MAP_MUX_CONFIGS_GROUP("foo-i2c.0", PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0", i2c_grp_configs), | ||
851 | PIN_MAP_MUX_CONFIGS_PIN("foo-i2c.0", PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0scl", i2c_pin_configs), | ||
852 | PIN_MAP_MUX_CONFIGS_PIN("foo-i2c.0", PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0sda", i2c_pin_configs), | ||
853 | }; | ||
854 | |||
855 | Finally, some devices expect the mapping table to contain certain specific | ||
856 | named states. When running on hardware that doesn't need any pin controller | ||
857 | configuration, the mapping table must still contain those named states, in | ||
858 | order to explicitly indicate that the states were provided and intended to | ||
859 | be empty. Table entry macro PIN_MAP_DUMMY_STATE serves the purpose of defining | ||
860 | a named state without causing any pin controller to be programmed: | ||
861 | |||
862 | static struct pinctrl_map __initdata mapping[] = { | ||
863 | PIN_MAP_DUMMY_STATE("foo-i2c.0", PINCTRL_STATE_DEFAULT), | ||
823 | }; | 864 | }; |
824 | 865 | ||
825 | 866 | ||
@@ -831,81 +872,96 @@ As it is possible to map a function to different groups of pins an optional | |||
831 | 872 | ||
832 | ... | 873 | ... |
833 | { | 874 | { |
875 | .dev_name = "foo-spi.0", | ||
834 | .name = "spi0-pos-A", | 876 | .name = "spi0-pos-A", |
877 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
835 | .ctrl_dev_name = "pinctrl-foo", | 878 | .ctrl_dev_name = "pinctrl-foo", |
836 | .function = "spi0", | 879 | .function = "spi0", |
837 | .group = "spi0_0_grp", | 880 | .group = "spi0_0_grp", |
838 | .dev_name = "foo-spi.0", | ||
839 | }, | 881 | }, |
840 | { | 882 | { |
883 | .dev_name = "foo-spi.0", | ||
841 | .name = "spi0-pos-B", | 884 | .name = "spi0-pos-B", |
885 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
842 | .ctrl_dev_name = "pinctrl-foo", | 886 | .ctrl_dev_name = "pinctrl-foo", |
843 | .function = "spi0", | 887 | .function = "spi0", |
844 | .group = "spi0_1_grp", | 888 | .group = "spi0_1_grp", |
845 | .dev_name = "foo-spi.0", | ||
846 | }, | 889 | }, |
847 | ... | 890 | ... |
848 | 891 | ||
849 | This example mapping is used to switch between two positions for spi0 at | 892 | This example mapping is used to switch between two positions for spi0 at |
850 | runtime, as described further below under the heading "Runtime pinmuxing". | 893 | runtime, as described further below under the heading "Runtime pinmuxing". |
851 | 894 | ||
852 | Further it is possible to match several groups of pins to the same function | 895 | Further it is possible for one named state to affect the muxing of several |
853 | for a single device, say for example in the mmc0 example above, where you can | 896 | groups of pins, say for example in the mmc0 example above, where you can |
854 | additively expand the mmc0 bus from 2 to 4 to 8 pins. If we want to use all | 897 | additively expand the mmc0 bus from 2 to 4 to 8 pins. If we want to use all |
855 | three groups for a total of 2+2+4 = 8 pins (for an 8-bit MMC bus as is the | 898 | three groups for a total of 2+2+4 = 8 pins (for an 8-bit MMC bus as is the |
856 | case), we define a mapping like this: | 899 | case), we define a mapping like this: |
857 | 900 | ||
858 | ... | 901 | ... |
859 | { | 902 | { |
903 | .dev_name = "foo-mmc.0", | ||
860 | .name = "2bit" | 904 | .name = "2bit" |
905 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
861 | .ctrl_dev_name = "pinctrl-foo", | 906 | .ctrl_dev_name = "pinctrl-foo", |
862 | .function = "mmc0", | 907 | .function = "mmc0", |
863 | .group = "mmc0_1_grp", | 908 | .group = "mmc0_1_grp", |
864 | .dev_name = "foo-mmc.0", | ||
865 | }, | 909 | }, |
866 | { | 910 | { |
911 | .dev_name = "foo-mmc.0", | ||
867 | .name = "4bit" | 912 | .name = "4bit" |
913 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
868 | .ctrl_dev_name = "pinctrl-foo", | 914 | .ctrl_dev_name = "pinctrl-foo", |
869 | .function = "mmc0", | 915 | .function = "mmc0", |
870 | .group = "mmc0_1_grp", | 916 | .group = "mmc0_1_grp", |
871 | .dev_name = "foo-mmc.0", | ||
872 | }, | 917 | }, |
873 | { | 918 | { |
919 | .dev_name = "foo-mmc.0", | ||
874 | .name = "4bit" | 920 | .name = "4bit" |
921 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
875 | .ctrl_dev_name = "pinctrl-foo", | 922 | .ctrl_dev_name = "pinctrl-foo", |
876 | .function = "mmc0", | 923 | .function = "mmc0", |
877 | .group = "mmc0_2_grp", | 924 | .group = "mmc0_2_grp", |
878 | .dev_name = "foo-mmc.0", | ||
879 | }, | 925 | }, |
880 | { | 926 | { |
927 | .dev_name = "foo-mmc.0", | ||
881 | .name = "8bit" | 928 | .name = "8bit" |
929 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
882 | .ctrl_dev_name = "pinctrl-foo", | 930 | .ctrl_dev_name = "pinctrl-foo", |
931 | .function = "mmc0", | ||
883 | .group = "mmc0_1_grp", | 932 | .group = "mmc0_1_grp", |
884 | .dev_name = "foo-mmc.0", | ||
885 | }, | 933 | }, |
886 | { | 934 | { |
935 | .dev_name = "foo-mmc.0", | ||
887 | .name = "8bit" | 936 | .name = "8bit" |
937 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
888 | .ctrl_dev_name = "pinctrl-foo", | 938 | .ctrl_dev_name = "pinctrl-foo", |
889 | .function = "mmc0", | 939 | .function = "mmc0", |
890 | .group = "mmc0_2_grp", | 940 | .group = "mmc0_2_grp", |
891 | .dev_name = "foo-mmc.0", | ||
892 | }, | 941 | }, |
893 | { | 942 | { |
943 | .dev_name = "foo-mmc.0", | ||
894 | .name = "8bit" | 944 | .name = "8bit" |
945 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
895 | .ctrl_dev_name = "pinctrl-foo", | 946 | .ctrl_dev_name = "pinctrl-foo", |
896 | .function = "mmc0", | 947 | .function = "mmc0", |
897 | .group = "mmc0_3_grp", | 948 | .group = "mmc0_3_grp", |
898 | .dev_name = "foo-mmc.0", | ||
899 | }, | 949 | }, |
900 | ... | 950 | ... |
901 | 951 | ||
902 | The result of grabbing this mapping from the device with something like | 952 | The result of grabbing this mapping from the device with something like |
903 | this (see next paragraph): | 953 | this (see next paragraph): |
904 | 954 | ||
905 | pmx = pinmux_get(&device, "8bit"); | 955 | p = pinctrl_get(dev); |
956 | s = pinctrl_lookup_state(p, "8bit"); | ||
957 | ret = pinctrl_select_state(p, s); | ||
958 | |||
959 | or more simply: | ||
960 | |||
961 | p = pinctrl_get_select(dev, "8bit"); | ||
906 | 962 | ||
907 | Will be that you activate all the three bottom records in the mapping at | 963 | Will be that you activate all the three bottom records in the mapping at |
908 | once. Since they share the same name, pin controller device, funcion and | 964 | once. Since they share the same name, pin controller device, function and |
909 | device, and since we allow multiple groups to match to a single device, they | 965 | device, and since we allow multiple groups to match to a single device, they |
910 | all get selected, and they all get enabled and disable simultaneously by the | 966 | all get selected, and they all get enabled and disable simultaneously by the |
911 | pinmux core. | 967 | pinmux core. |
@@ -914,97 +970,111 @@ pinmux core. | |||
914 | Pinmux requests from drivers | 970 | Pinmux requests from drivers |
915 | ============================ | 971 | ============================ |
916 | 972 | ||
917 | Generally it is discouraged to let individual drivers get and enable pinmuxes. | 973 | Generally it is discouraged to let individual drivers get and enable pin |
918 | So if possible, handle the pinmuxes in platform code or some other place where | 974 | control. So if possible, handle the pin control in platform code or some other |
919 | you have access to all the affected struct device * pointers. In some cases | 975 | place where you have access to all the affected struct device * pointers. In |
920 | where a driver needs to switch between different mux mappings at runtime | 976 | some cases where a driver needs to e.g. switch between different mux mappings |
921 | this is not possible. | 977 | at runtime this is not possible. |
922 | 978 | ||
923 | A driver may request a certain mux to be activated, usually just the default | 979 | A driver may request a certain control state to be activated, usually just the |
924 | mux like this: | 980 | default state like this: |
925 | 981 | ||
926 | #include <linux/pinctrl/pinmux.h> | 982 | #include <linux/pinctrl/consumer.h> |
927 | 983 | ||
928 | struct foo_state { | 984 | struct foo_state { |
929 | struct pinmux *pmx; | 985 | struct pinctrl *p; |
986 | struct pinctrl_state *s; | ||
930 | ... | 987 | ... |
931 | }; | 988 | }; |
932 | 989 | ||
933 | foo_probe() | 990 | foo_probe() |
934 | { | 991 | { |
935 | /* Allocate a state holder named "state" etc */ | 992 | /* Allocate a state holder named "foo" etc */ |
936 | struct pinmux pmx; | 993 | struct foo_state *foo = ...; |
994 | |||
995 | foo->p = pinctrl_get(&device); | ||
996 | if (IS_ERR(foo->p)) { | ||
997 | /* FIXME: clean up "foo" here */ | ||
998 | return PTR_ERR(foo->p); | ||
999 | } | ||
937 | 1000 | ||
938 | pmx = pinmux_get(&device, NULL); | 1001 | foo->s = pinctrl_lookup_state(foo->p, PINCTRL_STATE_DEFAULT); |
939 | if IS_ERR(pmx) | 1002 | if (IS_ERR(foo->s)) { |
940 | return PTR_ERR(pmx); | 1003 | pinctrl_put(foo->p); |
941 | pinmux_enable(pmx); | 1004 | /* FIXME: clean up "foo" here */ |
1005 | return PTR_ERR(s); | ||
1006 | } | ||
942 | 1007 | ||
943 | state->pmx = pmx; | 1008 | ret = pinctrl_select_state(foo->s); |
1009 | if (ret < 0) { | ||
1010 | pinctrl_put(foo->p); | ||
1011 | /* FIXME: clean up "foo" here */ | ||
1012 | return ret; | ||
1013 | } | ||
944 | } | 1014 | } |
945 | 1015 | ||
946 | foo_remove() | 1016 | foo_remove() |
947 | { | 1017 | { |
948 | pinmux_disable(state->pmx); | 1018 | pinctrl_put(state->p); |
949 | pinmux_put(state->pmx); | ||
950 | } | 1019 | } |
951 | 1020 | ||
952 | If you want to grab a specific mux mapping and not just the first one found for | 1021 | This get/lookup/select/put sequence can just as well be handled by bus drivers |
953 | this device you can specify a specific mapping name, for example in the above | ||
954 | example the second i2c0 setting: pinmux_get(&device, "spi0-pos-B"); | ||
955 | |||
956 | This get/enable/disable/put sequence can just as well be handled by bus drivers | ||
957 | if you don't want each and every driver to handle it and you know the | 1022 | if you don't want each and every driver to handle it and you know the |
958 | arrangement on your bus. | 1023 | arrangement on your bus. |
959 | 1024 | ||
960 | The semantics of the get/enable respective disable/put is as follows: | 1025 | The semantics of the pinctrl APIs are: |
1026 | |||
1027 | - pinctrl_get() is called in process context to obtain a handle to all pinctrl | ||
1028 | information for a given client device. It will allocate a struct from the | ||
1029 | kernel memory to hold the pinmux state. All mapping table parsing or similar | ||
1030 | slow operations take place within this API. | ||
961 | 1031 | ||
962 | - pinmux_get() is called in process context to reserve the pins affected with | 1032 | - pinctrl_lookup_state() is called in process context to obtain a handle to a |
963 | a certain mapping and set up the pinmux core and the driver. It will allocate | 1033 | specific state for a the client device. This operation may be slow too. |
964 | a struct from the kernel memory to hold the pinmux state. | ||
965 | 1034 | ||
966 | - pinmux_enable()/pinmux_disable() is quick and can be called from fastpath | 1035 | - pinctrl_select_state() programs pin controller hardware according to the |
967 | (irq context) when you quickly want to set up/tear down the hardware muxing | 1036 | definition of the state as given by the mapping table. In theory this is a |
968 | when running a device driver. Usually it will just poke some values into a | 1037 | fast-path operation, since it only involved blasting some register settings |
969 | register. | 1038 | into hardware. However, note that some pin controllers may have their |
1039 | registers on a slow/IRQ-based bus, so client devices should not assume they | ||
1040 | can call pinctrl_select_state() from non-blocking contexts. | ||
970 | 1041 | ||
971 | - pinmux_disable() is called in process context to tear down the pin requests | 1042 | - pinctrl_put() frees all information associated with a pinctrl handle. |
972 | and release the state holder struct for the mux setting. | ||
973 | 1043 | ||
974 | Usually the pinmux core handled the get/put pair and call out to the device | 1044 | Usually the pin control core handled the get/put pair and call out to the |
975 | drivers bookkeeping operations, like checking available functions and the | 1045 | device drivers bookkeeping operations, like checking available functions and |
976 | associated pins, whereas the enable/disable pass on to the pin controller | 1046 | the associated pins, whereas the enable/disable pass on to the pin controller |
977 | driver which takes care of activating and/or deactivating the mux setting by | 1047 | driver which takes care of activating and/or deactivating the mux setting by |
978 | quickly poking some registers. | 1048 | quickly poking some registers. |
979 | 1049 | ||
980 | The pins are allocated for your device when you issue the pinmux_get() call, | 1050 | The pins are allocated for your device when you issue the pinctrl_get() call, |
981 | after this you should be able to see this in the debugfs listing of all pins. | 1051 | after this you should be able to see this in the debugfs listing of all pins. |
982 | 1052 | ||
983 | 1053 | ||
984 | System pinmux hogging | 1054 | System pin control hogging |
985 | ===================== | 1055 | ========================== |
986 | 1056 | ||
987 | A system pinmux map entry, i.e. a pinmux setting that does not have a device | 1057 | Pin control map entries can be hogged by the core when the pin controller |
988 | associated with it, can be hogged by the core when the pin controller is | 1058 | is registered. This means that the core will attempt to call pinctrl_get(), |
989 | registered. This means that the core will attempt to call pinmux_get() and | 1059 | lookup_state() and select_state() on it immediately after the pin control |
990 | pinmux_enable() on it immediately after the pin control device has been | 1060 | device has been registered. |
991 | registered. | ||
992 | 1061 | ||
993 | This is enabled by simply setting the .hog_on_boot field in the map to true, | 1062 | This occurs for mapping table entries where the client device name is equal |
994 | like this: | 1063 | to the pin controller device name, and the state name is PINCTRL_STATE_DEFAULT. |
995 | 1064 | ||
996 | { | 1065 | { |
997 | .name = "POWERMAP" | 1066 | .dev_name = "pinctrl-foo", |
1067 | .name = PINCTRL_STATE_DEFAULT, | ||
1068 | .type = PIN_MAP_TYPE_MUX_GROUP, | ||
998 | .ctrl_dev_name = "pinctrl-foo", | 1069 | .ctrl_dev_name = "pinctrl-foo", |
999 | .function = "power_func", | 1070 | .function = "power_func", |
1000 | .hog_on_boot = true, | ||
1001 | }, | 1071 | }, |
1002 | 1072 | ||
1003 | Since it may be common to request the core to hog a few always-applicable | 1073 | Since it may be common to request the core to hog a few always-applicable |
1004 | mux settings on the primary pin controller, there is a convenience macro for | 1074 | mux settings on the primary pin controller, there is a convenience macro for |
1005 | this: | 1075 | this: |
1006 | 1076 | ||
1007 | PINMUX_MAP_PRIMARY_SYS_HOG("POWERMAP", "power_func") | 1077 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-foo", NULL /* group */, "power_func") |
1008 | 1078 | ||
1009 | This gives the exact same result as the above construction. | 1079 | This gives the exact same result as the above construction. |
1010 | 1080 | ||
@@ -1016,32 +1086,47 @@ It is possible to mux a certain function in and out at runtime, say to move | |||
1016 | an SPI port from one set of pins to another set of pins. Say for example for | 1086 | an SPI port from one set of pins to another set of pins. Say for example for |
1017 | spi0 in the example above, we expose two different groups of pins for the same | 1087 | spi0 in the example above, we expose two different groups of pins for the same |
1018 | function, but with different named in the mapping as described under | 1088 | function, but with different named in the mapping as described under |
1019 | "Advanced mapping" above. So we have two mappings named "spi0-pos-A" and | 1089 | "Advanced mapping" above. So that for an SPI device, we have two states named |
1020 | "spi0-pos-B". | 1090 | "pos-A" and "pos-B". |
1021 | 1091 | ||
1022 | This snippet first muxes the function in the pins defined by group A, enables | 1092 | This snippet first muxes the function in the pins defined by group A, enables |
1023 | it, disables and releases it, and muxes it in on the pins defined by group B: | 1093 | it, disables and releases it, and muxes it in on the pins defined by group B: |
1024 | 1094 | ||
1095 | #include <linux/pinctrl/consumer.h> | ||
1096 | |||
1025 | foo_switch() | 1097 | foo_switch() |
1026 | { | 1098 | { |
1027 | struct pinmux *pmx; | 1099 | struct pinctrl *p; |
1100 | struct pinctrl_state *s1, *s2; | ||
1101 | |||
1102 | /* Setup */ | ||
1103 | p = pinctrl_get(&device); | ||
1104 | if (IS_ERR(p)) | ||
1105 | ... | ||
1106 | |||
1107 | s1 = pinctrl_lookup_state(foo->p, "pos-A"); | ||
1108 | if (IS_ERR(s1)) | ||
1109 | ... | ||
1110 | |||
1111 | s2 = pinctrl_lookup_state(foo->p, "pos-B"); | ||
1112 | if (IS_ERR(s2)) | ||
1113 | ... | ||
1028 | 1114 | ||
1029 | /* Enable on position A */ | 1115 | /* Enable on position A */ |
1030 | pmx = pinmux_get(&device, "spi0-pos-A"); | 1116 | ret = pinctrl_select_state(s1); |
1031 | if IS_ERR(pmx) | 1117 | if (ret < 0) |
1032 | return PTR_ERR(pmx); | 1118 | ... |
1033 | pinmux_enable(pmx); | ||
1034 | 1119 | ||
1035 | /* This releases the pins again */ | 1120 | ... |
1036 | pinmux_disable(pmx); | ||
1037 | pinmux_put(pmx); | ||
1038 | 1121 | ||
1039 | /* Enable on position B */ | 1122 | /* Enable on position B */ |
1040 | pmx = pinmux_get(&device, "spi0-pos-B"); | 1123 | ret = pinctrl_select_state(s2); |
1041 | if IS_ERR(pmx) | 1124 | if (ret < 0) |
1042 | return PTR_ERR(pmx); | 1125 | ... |
1043 | pinmux_enable(pmx); | 1126 | |
1044 | ... | 1127 | ... |
1128 | |||
1129 | pinctrl_put(p); | ||
1045 | } | 1130 | } |
1046 | 1131 | ||
1047 | The above has to be done from process context. | 1132 | The above has to be done from process context. |
diff --git a/Documentation/remoteproc.txt b/Documentation/remoteproc.txt new file mode 100644 index 000000000000..70a048cd3fa3 --- /dev/null +++ b/Documentation/remoteproc.txt | |||
@@ -0,0 +1,322 @@ | |||
1 | Remote Processor Framework | ||
2 | |||
3 | 1. Introduction | ||
4 | |||
5 | Modern SoCs typically have heterogeneous remote processor devices in asymmetric | ||
6 | multiprocessing (AMP) configurations, which may be running different instances | ||
7 | of operating system, whether it's Linux or any other flavor of real-time OS. | ||
8 | |||
9 | OMAP4, for example, has dual Cortex-A9, dual Cortex-M3 and a C64x+ DSP. | ||
10 | In a typical configuration, the dual cortex-A9 is running Linux in a SMP | ||
11 | configuration, and each of the other three cores (two M3 cores and a DSP) | ||
12 | is running its own instance of RTOS in an AMP configuration. | ||
13 | |||
14 | The remoteproc framework allows different platforms/architectures to | ||
15 | control (power on, load firmware, power off) those remote processors while | ||
16 | abstracting the hardware differences, so the entire driver doesn't need to be | ||
17 | duplicated. In addition, this framework also adds rpmsg virtio devices | ||
18 | for remote processors that supports this kind of communication. This way, | ||
19 | platform-specific remoteproc drivers only need to provide a few low-level | ||
20 | handlers, and then all rpmsg drivers will then just work | ||
21 | (for more information about the virtio-based rpmsg bus and its drivers, | ||
22 | please read Documentation/rpmsg.txt). | ||
23 | Registration of other types of virtio devices is now also possible. Firmwares | ||
24 | just need to publish what kind of virtio devices do they support, and then | ||
25 | remoteproc will add those devices. This makes it possible to reuse the | ||
26 | existing virtio drivers with remote processor backends at a minimal development | ||
27 | cost. | ||
28 | |||
29 | 2. User API | ||
30 | |||
31 | int rproc_boot(struct rproc *rproc) | ||
32 | - Boot a remote processor (i.e. load its firmware, power it on, ...). | ||
33 | If the remote processor is already powered on, this function immediately | ||
34 | returns (successfully). | ||
35 | Returns 0 on success, and an appropriate error value otherwise. | ||
36 | Note: to use this function you should already have a valid rproc | ||
37 | handle. There are several ways to achieve that cleanly (devres, pdata, | ||
38 | the way remoteproc_rpmsg.c does this, or, if this becomes prevalent, we | ||
39 | might also consider using dev_archdata for this). See also | ||
40 | rproc_get_by_name() below. | ||
41 | |||
42 | void rproc_shutdown(struct rproc *rproc) | ||
43 | - Power off a remote processor (previously booted with rproc_boot()). | ||
44 | In case @rproc is still being used by an additional user(s), then | ||
45 | this function will just decrement the power refcount and exit, | ||
46 | without really powering off the device. | ||
47 | Every call to rproc_boot() must (eventually) be accompanied by a call | ||
48 | to rproc_shutdown(). Calling rproc_shutdown() redundantly is a bug. | ||
49 | Notes: | ||
50 | - we're not decrementing the rproc's refcount, only the power refcount. | ||
51 | which means that the @rproc handle stays valid even after | ||
52 | rproc_shutdown() returns, and users can still use it with a subsequent | ||
53 | rproc_boot(), if needed. | ||
54 | - don't call rproc_shutdown() to unroll rproc_get_by_name(), exactly | ||
55 | because rproc_shutdown() _does not_ decrement the refcount of @rproc. | ||
56 | To decrement the refcount of @rproc, use rproc_put() (but _only_ if | ||
57 | you acquired @rproc using rproc_get_by_name()). | ||
58 | |||
59 | struct rproc *rproc_get_by_name(const char *name) | ||
60 | - Find an rproc handle using the remote processor's name, and then | ||
61 | boot it. If it's already powered on, then just immediately return | ||
62 | (successfully). Returns the rproc handle on success, and NULL on failure. | ||
63 | This function increments the remote processor's refcount, so always | ||
64 | use rproc_put() to decrement it back once rproc isn't needed anymore. | ||
65 | Note: currently rproc_get_by_name() and rproc_put() are not used anymore | ||
66 | by the rpmsg bus and its drivers. We need to scrutinize the use cases | ||
67 | that still need them, and see if we can migrate them to use the non | ||
68 | name-based boot/shutdown interface. | ||
69 | |||
70 | void rproc_put(struct rproc *rproc) | ||
71 | - Decrement @rproc's power refcount and shut it down if it reaches zero | ||
72 | (essentially by just calling rproc_shutdown), and then decrement @rproc's | ||
73 | validity refcount too. | ||
74 | After this function returns, @rproc may _not_ be used anymore, and its | ||
75 | handle should be considered invalid. | ||
76 | This function should be called _iff_ the @rproc handle was grabbed by | ||
77 | calling rproc_get_by_name(). | ||
78 | |||
79 | 3. Typical usage | ||
80 | |||
81 | #include <linux/remoteproc.h> | ||
82 | |||
83 | /* in case we were given a valid 'rproc' handle */ | ||
84 | int dummy_rproc_example(struct rproc *my_rproc) | ||
85 | { | ||
86 | int ret; | ||
87 | |||
88 | /* let's power on and boot our remote processor */ | ||
89 | ret = rproc_boot(my_rproc); | ||
90 | if (ret) { | ||
91 | /* | ||
92 | * something went wrong. handle it and leave. | ||
93 | */ | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * our remote processor is now powered on... give it some work | ||
98 | */ | ||
99 | |||
100 | /* let's shut it down now */ | ||
101 | rproc_shutdown(my_rproc); | ||
102 | } | ||
103 | |||
104 | 4. API for implementors | ||
105 | |||
106 | struct rproc *rproc_alloc(struct device *dev, const char *name, | ||
107 | const struct rproc_ops *ops, | ||
108 | const char *firmware, int len) | ||
109 | - Allocate a new remote processor handle, but don't register | ||
110 | it yet. Required parameters are the underlying device, the | ||
111 | name of this remote processor, platform-specific ops handlers, | ||
112 | the name of the firmware to boot this rproc with, and the | ||
113 | length of private data needed by the allocating rproc driver (in bytes). | ||
114 | |||
115 | This function should be used by rproc implementations during | ||
116 | initialization of the remote processor. | ||
117 | After creating an rproc handle using this function, and when ready, | ||
118 | implementations should then call rproc_register() to complete | ||
119 | the registration of the remote processor. | ||
120 | On success, the new rproc is returned, and on failure, NULL. | ||
121 | |||
122 | Note: _never_ directly deallocate @rproc, even if it was not registered | ||
123 | yet. Instead, if you just need to unroll rproc_alloc(), use rproc_free(). | ||
124 | |||
125 | void rproc_free(struct rproc *rproc) | ||
126 | - Free an rproc handle that was allocated by rproc_alloc. | ||
127 | This function should _only_ be used if @rproc was only allocated, | ||
128 | but not registered yet. | ||
129 | If @rproc was already successfully registered (by calling | ||
130 | rproc_register()), then use rproc_unregister() instead. | ||
131 | |||
132 | int rproc_register(struct rproc *rproc) | ||
133 | - Register @rproc with the remoteproc framework, after it has been | ||
134 | allocated with rproc_alloc(). | ||
135 | This is called by the platform-specific rproc implementation, whenever | ||
136 | a new remote processor device is probed. | ||
137 | Returns 0 on success and an appropriate error code otherwise. | ||
138 | Note: this function initiates an asynchronous firmware loading | ||
139 | context, which will look for virtio devices supported by the rproc's | ||
140 | firmware. | ||
141 | If found, those virtio devices will be created and added, so as a result | ||
142 | of registering this remote processor, additional virtio drivers might get | ||
143 | probed. | ||
144 | |||
145 | int rproc_unregister(struct rproc *rproc) | ||
146 | - Unregister a remote processor, and decrement its refcount. | ||
147 | If its refcount drops to zero, then @rproc will be freed. If not, | ||
148 | it will be freed later once the last reference is dropped. | ||
149 | |||
150 | This function should be called when the platform specific rproc | ||
151 | implementation decides to remove the rproc device. it should | ||
152 | _only_ be called if a previous invocation of rproc_register() | ||
153 | has completed successfully. | ||
154 | |||
155 | After rproc_unregister() returns, @rproc is _not_ valid anymore and | ||
156 | it shouldn't be used. More specifically, don't call rproc_free() | ||
157 | or try to directly free @rproc after rproc_unregister() returns; | ||
158 | none of these are needed, and calling them is a bug. | ||
159 | |||
160 | Returns 0 on success and -EINVAL if @rproc isn't valid. | ||
161 | |||
162 | 5. Implementation callbacks | ||
163 | |||
164 | These callbacks should be provided by platform-specific remoteproc | ||
165 | drivers: | ||
166 | |||
167 | /** | ||
168 | * struct rproc_ops - platform-specific device handlers | ||
169 | * @start: power on the device and boot it | ||
170 | * @stop: power off the device | ||
171 | * @kick: kick a virtqueue (virtqueue id given as a parameter) | ||
172 | */ | ||
173 | struct rproc_ops { | ||
174 | int (*start)(struct rproc *rproc); | ||
175 | int (*stop)(struct rproc *rproc); | ||
176 | void (*kick)(struct rproc *rproc, int vqid); | ||
177 | }; | ||
178 | |||
179 | Every remoteproc implementation should at least provide the ->start and ->stop | ||
180 | handlers. If rpmsg/virtio functionality is also desired, then the ->kick handler | ||
181 | should be provided as well. | ||
182 | |||
183 | The ->start() handler takes an rproc handle and should then power on the | ||
184 | device and boot it (use rproc->priv to access platform-specific private data). | ||
185 | The boot address, in case needed, can be found in rproc->bootaddr (remoteproc | ||
186 | core puts there the ELF entry point). | ||
187 | On success, 0 should be returned, and on failure, an appropriate error code. | ||
188 | |||
189 | The ->stop() handler takes an rproc handle and powers the device down. | ||
190 | On success, 0 is returned, and on failure, an appropriate error code. | ||
191 | |||
192 | The ->kick() handler takes an rproc handle, and an index of a virtqueue | ||
193 | where new message was placed in. Implementations should interrupt the remote | ||
194 | processor and let it know it has pending messages. Notifying remote processors | ||
195 | the exact virtqueue index to look in is optional: it is easy (and not | ||
196 | too expensive) to go through the existing virtqueues and look for new buffers | ||
197 | in the used rings. | ||
198 | |||
199 | 6. Binary Firmware Structure | ||
200 | |||
201 | At this point remoteproc only supports ELF32 firmware binaries. However, | ||
202 | it is quite expected that other platforms/devices which we'd want to | ||
203 | support with this framework will be based on different binary formats. | ||
204 | |||
205 | When those use cases show up, we will have to decouple the binary format | ||
206 | from the framework core, so we can support several binary formats without | ||
207 | duplicating common code. | ||
208 | |||
209 | When the firmware is parsed, its various segments are loaded to memory | ||
210 | according to the specified device address (might be a physical address | ||
211 | if the remote processor is accessing memory directly). | ||
212 | |||
213 | In addition to the standard ELF segments, most remote processors would | ||
214 | also include a special section which we call "the resource table". | ||
215 | |||
216 | The resource table contains system resources that the remote processor | ||
217 | requires before it should be powered on, such as allocation of physically | ||
218 | contiguous memory, or iommu mapping of certain on-chip peripherals. | ||
219 | Remotecore will only power up the device after all the resource table's | ||
220 | requirement are met. | ||
221 | |||
222 | In addition to system resources, the resource table may also contain | ||
223 | resource entries that publish the existence of supported features | ||
224 | or configurations by the remote processor, such as trace buffers and | ||
225 | supported virtio devices (and their configurations). | ||
226 | |||
227 | The resource table begins with this header: | ||
228 | |||
229 | /** | ||
230 | * struct resource_table - firmware resource table header | ||
231 | * @ver: version number | ||
232 | * @num: number of resource entries | ||
233 | * @reserved: reserved (must be zero) | ||
234 | * @offset: array of offsets pointing at the various resource entries | ||
235 | * | ||
236 | * The header of the resource table, as expressed by this structure, | ||
237 | * contains a version number (should we need to change this format in the | ||
238 | * future), the number of available resource entries, and their offsets | ||
239 | * in the table. | ||
240 | */ | ||
241 | struct resource_table { | ||
242 | u32 ver; | ||
243 | u32 num; | ||
244 | u32 reserved[2]; | ||
245 | u32 offset[0]; | ||
246 | } __packed; | ||
247 | |||
248 | Immediately following this header are the resource entries themselves, | ||
249 | each of which begins with the following resource entry header: | ||
250 | |||
251 | /** | ||
252 | * struct fw_rsc_hdr - firmware resource entry header | ||
253 | * @type: resource type | ||
254 | * @data: resource data | ||
255 | * | ||
256 | * Every resource entry begins with a 'struct fw_rsc_hdr' header providing | ||
257 | * its @type. The content of the entry itself will immediately follow | ||
258 | * this header, and it should be parsed according to the resource type. | ||
259 | */ | ||
260 | struct fw_rsc_hdr { | ||
261 | u32 type; | ||
262 | u8 data[0]; | ||
263 | } __packed; | ||
264 | |||
265 | Some resources entries are mere announcements, where the host is informed | ||
266 | of specific remoteproc configuration. Other entries require the host to | ||
267 | do something (e.g. allocate a system resource). Sometimes a negotiation | ||
268 | is expected, where the firmware requests a resource, and once allocated, | ||
269 | the host should provide back its details (e.g. address of an allocated | ||
270 | memory region). | ||
271 | |||
272 | Here are the various resource types that are currently supported: | ||
273 | |||
274 | /** | ||
275 | * enum fw_resource_type - types of resource entries | ||
276 | * | ||
277 | * @RSC_CARVEOUT: request for allocation of a physically contiguous | ||
278 | * memory region. | ||
279 | * @RSC_DEVMEM: request to iommu_map a memory-based peripheral. | ||
280 | * @RSC_TRACE: announces the availability of a trace buffer into which | ||
281 | * the remote processor will be writing logs. | ||
282 | * @RSC_VDEV: declare support for a virtio device, and serve as its | ||
283 | * virtio header. | ||
284 | * @RSC_LAST: just keep this one at the end | ||
285 | * | ||
286 | * Please note that these values are used as indices to the rproc_handle_rsc | ||
287 | * lookup table, so please keep them sane. Moreover, @RSC_LAST is used to | ||
288 | * check the validity of an index before the lookup table is accessed, so | ||
289 | * please update it as needed. | ||
290 | */ | ||
291 | enum fw_resource_type { | ||
292 | RSC_CARVEOUT = 0, | ||
293 | RSC_DEVMEM = 1, | ||
294 | RSC_TRACE = 2, | ||
295 | RSC_VDEV = 3, | ||
296 | RSC_LAST = 4, | ||
297 | }; | ||
298 | |||
299 | For more details regarding a specific resource type, please see its | ||
300 | dedicated structure in include/linux/remoteproc.h. | ||
301 | |||
302 | We also expect that platform-specific resource entries will show up | ||
303 | at some point. When that happens, we could easily add a new RSC_PLATFORM | ||
304 | type, and hand those resources to the platform-specific rproc driver to handle. | ||
305 | |||
306 | 7. Virtio and remoteproc | ||
307 | |||
308 | The firmware should provide remoteproc information about virtio devices | ||
309 | that it supports, and their configurations: a RSC_VDEV resource entry | ||
310 | should specify the virtio device id (as in virtio_ids.h), virtio features, | ||
311 | virtio config space, vrings information, etc. | ||
312 | |||
313 | When a new remote processor is registered, the remoteproc framework | ||
314 | will look for its resource table and will register the virtio devices | ||
315 | it supports. A firmware may support any number of virtio devices, and | ||
316 | of any type (a single remote processor can also easily support several | ||
317 | rpmsg virtio devices this way, if desired). | ||
318 | |||
319 | Of course, RSC_VDEV resource entries are only good enough for static | ||
320 | allocation of virtio devices. Dynamic allocations will also be made possible | ||
321 | using the rpmsg bus (similar to how we already do dynamic allocations of | ||
322 | rpmsg channels; read more about it in rpmsg.txt). | ||
diff --git a/Documentation/rpmsg.txt b/Documentation/rpmsg.txt new file mode 100644 index 000000000000..409d9f964c5b --- /dev/null +++ b/Documentation/rpmsg.txt | |||
@@ -0,0 +1,293 @@ | |||
1 | Remote Processor Messaging (rpmsg) Framework | ||
2 | |||
3 | Note: this document describes the rpmsg bus and how to write rpmsg drivers. | ||
4 | To learn how to add rpmsg support for new platforms, check out remoteproc.txt | ||
5 | (also a resident of Documentation/). | ||
6 | |||
7 | 1. Introduction | ||
8 | |||
9 | Modern SoCs typically employ heterogeneous remote processor devices in | ||
10 | asymmetric multiprocessing (AMP) configurations, which may be running | ||
11 | different instances of operating system, whether it's Linux or any other | ||
12 | flavor of real-time OS. | ||
13 | |||
14 | OMAP4, for example, has dual Cortex-A9, dual Cortex-M3 and a C64x+ DSP. | ||
15 | Typically, the dual cortex-A9 is running Linux in a SMP configuration, | ||
16 | and each of the other three cores (two M3 cores and a DSP) is running | ||
17 | its own instance of RTOS in an AMP configuration. | ||
18 | |||
19 | Typically AMP remote processors employ dedicated DSP codecs and multimedia | ||
20 | hardware accelerators, and therefore are often used to offload CPU-intensive | ||
21 | multimedia tasks from the main application processor. | ||
22 | |||
23 | These remote processors could also be used to control latency-sensitive | ||
24 | sensors, drive random hardware blocks, or just perform background tasks | ||
25 | while the main CPU is idling. | ||
26 | |||
27 | Users of those remote processors can either be userland apps (e.g. multimedia | ||
28 | frameworks talking with remote OMX components) or kernel drivers (controlling | ||
29 | hardware accessible only by the remote processor, reserving kernel-controlled | ||
30 | resources on behalf of the remote processor, etc..). | ||
31 | |||
32 | Rpmsg is a virtio-based messaging bus that allows kernel drivers to communicate | ||
33 | with remote processors available on the system. In turn, drivers could then | ||
34 | expose appropriate user space interfaces, if needed. | ||
35 | |||
36 | When writing a driver that exposes rpmsg communication to userland, please | ||
37 | keep in mind that remote processors might have direct access to the | ||
38 | system's physical memory and other sensitive hardware resources (e.g. on | ||
39 | OMAP4, remote cores and hardware accelerators may have direct access to the | ||
40 | physical memory, gpio banks, dma controllers, i2c bus, gptimers, mailbox | ||
41 | devices, hwspinlocks, etc..). Moreover, those remote processors might be | ||
42 | running RTOS where every task can access the entire memory/devices exposed | ||
43 | to the processor. To minimize the risks of rogue (or buggy) userland code | ||
44 | exploiting remote bugs, and by that taking over the system, it is often | ||
45 | desired to limit userland to specific rpmsg channels (see definition below) | ||
46 | it can send messages on, and if possible, minimize how much control | ||
47 | it has over the content of the messages. | ||
48 | |||
49 | Every rpmsg device is a communication channel with a remote processor (thus | ||
50 | rpmsg devices are called channels). Channels are identified by a textual name | ||
51 | and have a local ("source") rpmsg address, and remote ("destination") rpmsg | ||
52 | address. | ||
53 | |||
54 | When a driver starts listening on a channel, its rx callback is bound with | ||
55 | a unique rpmsg local address (a 32-bit integer). This way when inbound messages | ||
56 | arrive, the rpmsg core dispatches them to the appropriate driver according | ||
57 | to their destination address (this is done by invoking the driver's rx handler | ||
58 | with the payload of the inbound message). | ||
59 | |||
60 | |||
61 | 2. User API | ||
62 | |||
63 | int rpmsg_send(struct rpmsg_channel *rpdev, void *data, int len); | ||
64 | - sends a message across to the remote processor on a given channel. | ||
65 | The caller should specify the channel, the data it wants to send, | ||
66 | and its length (in bytes). The message will be sent on the specified | ||
67 | channel, i.e. its source and destination address fields will be | ||
68 | set to the channel's src and dst addresses. | ||
69 | |||
70 | In case there are no TX buffers available, the function will block until | ||
71 | one becomes available (i.e. until the remote processor consumes | ||
72 | a tx buffer and puts it back on virtio's used descriptor ring), | ||
73 | or a timeout of 15 seconds elapses. When the latter happens, | ||
74 | -ERESTARTSYS is returned. | ||
75 | The function can only be called from a process context (for now). | ||
76 | Returns 0 on success and an appropriate error value on failure. | ||
77 | |||
78 | int rpmsg_sendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst); | ||
79 | - sends a message across to the remote processor on a given channel, | ||
80 | to a destination address provided by the caller. | ||
81 | The caller should specify the channel, the data it wants to send, | ||
82 | its length (in bytes), and an explicit destination address. | ||
83 | The message will then be sent to the remote processor to which the | ||
84 | channel belongs, using the channel's src address, and the user-provided | ||
85 | dst address (thus the channel's dst address will be ignored). | ||
86 | |||
87 | In case there are no TX buffers available, the function will block until | ||
88 | one becomes available (i.e. until the remote processor consumes | ||
89 | a tx buffer and puts it back on virtio's used descriptor ring), | ||
90 | or a timeout of 15 seconds elapses. When the latter happens, | ||
91 | -ERESTARTSYS is returned. | ||
92 | The function can only be called from a process context (for now). | ||
93 | Returns 0 on success and an appropriate error value on failure. | ||
94 | |||
95 | int rpmsg_send_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst, | ||
96 | void *data, int len); | ||
97 | - sends a message across to the remote processor, using the src and dst | ||
98 | addresses provided by the user. | ||
99 | The caller should specify the channel, the data it wants to send, | ||
100 | its length (in bytes), and explicit source and destination addresses. | ||
101 | The message will then be sent to the remote processor to which the | ||
102 | channel belongs, but the channel's src and dst addresses will be | ||
103 | ignored (and the user-provided addresses will be used instead). | ||
104 | |||
105 | In case there are no TX buffers available, the function will block until | ||
106 | one becomes available (i.e. until the remote processor consumes | ||
107 | a tx buffer and puts it back on virtio's used descriptor ring), | ||
108 | or a timeout of 15 seconds elapses. When the latter happens, | ||
109 | -ERESTARTSYS is returned. | ||
110 | The function can only be called from a process context (for now). | ||
111 | Returns 0 on success and an appropriate error value on failure. | ||
112 | |||
113 | int rpmsg_trysend(struct rpmsg_channel *rpdev, void *data, int len); | ||
114 | - sends a message across to the remote processor on a given channel. | ||
115 | The caller should specify the channel, the data it wants to send, | ||
116 | and its length (in bytes). The message will be sent on the specified | ||
117 | channel, i.e. its source and destination address fields will be | ||
118 | set to the channel's src and dst addresses. | ||
119 | |||
120 | In case there are no TX buffers available, the function will immediately | ||
121 | return -ENOMEM without waiting until one becomes available. | ||
122 | The function can only be called from a process context (for now). | ||
123 | Returns 0 on success and an appropriate error value on failure. | ||
124 | |||
125 | int rpmsg_trysendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst) | ||
126 | - sends a message across to the remote processor on a given channel, | ||
127 | to a destination address provided by the user. | ||
128 | The user should specify the channel, the data it wants to send, | ||
129 | its length (in bytes), and an explicit destination address. | ||
130 | The message will then be sent to the remote processor to which the | ||
131 | channel belongs, using the channel's src address, and the user-provided | ||
132 | dst address (thus the channel's dst address will be ignored). | ||
133 | |||
134 | In case there are no TX buffers available, the function will immediately | ||
135 | return -ENOMEM without waiting until one becomes available. | ||
136 | The function can only be called from a process context (for now). | ||
137 | Returns 0 on success and an appropriate error value on failure. | ||
138 | |||
139 | int rpmsg_trysend_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst, | ||
140 | void *data, int len); | ||
141 | - sends a message across to the remote processor, using source and | ||
142 | destination addresses provided by the user. | ||
143 | The user should specify the channel, the data it wants to send, | ||
144 | its length (in bytes), and explicit source and destination addresses. | ||
145 | The message will then be sent to the remote processor to which the | ||
146 | channel belongs, but the channel's src and dst addresses will be | ||
147 | ignored (and the user-provided addresses will be used instead). | ||
148 | |||
149 | In case there are no TX buffers available, the function will immediately | ||
150 | return -ENOMEM without waiting until one becomes available. | ||
151 | The function can only be called from a process context (for now). | ||
152 | Returns 0 on success and an appropriate error value on failure. | ||
153 | |||
154 | struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *rpdev, | ||
155 | void (*cb)(struct rpmsg_channel *, void *, int, void *, u32), | ||
156 | void *priv, u32 addr); | ||
157 | - every rpmsg address in the system is bound to an rx callback (so when | ||
158 | inbound messages arrive, they are dispatched by the rpmsg bus using the | ||
159 | appropriate callback handler) by means of an rpmsg_endpoint struct. | ||
160 | |||
161 | This function allows drivers to create such an endpoint, and by that, | ||
162 | bind a callback, and possibly some private data too, to an rpmsg address | ||
163 | (either one that is known in advance, or one that will be dynamically | ||
164 | assigned for them). | ||
165 | |||
166 | Simple rpmsg drivers need not call rpmsg_create_ept, because an endpoint | ||
167 | is already created for them when they are probed by the rpmsg bus | ||
168 | (using the rx callback they provide when they registered to the rpmsg bus). | ||
169 | |||
170 | So things should just work for simple drivers: they already have an | ||
171 | endpoint, their rx callback is bound to their rpmsg address, and when | ||
172 | relevant inbound messages arrive (i.e. messages which their dst address | ||
173 | equals to the src address of their rpmsg channel), the driver's handler | ||
174 | is invoked to process it. | ||
175 | |||
176 | That said, more complicated drivers might do need to allocate | ||
177 | additional rpmsg addresses, and bind them to different rx callbacks. | ||
178 | To accomplish that, those drivers need to call this function. | ||
179 | Drivers should provide their channel (so the new endpoint would bind | ||
180 | to the same remote processor their channel belongs to), an rx callback | ||
181 | function, an optional private data (which is provided back when the | ||
182 | rx callback is invoked), and an address they want to bind with the | ||
183 | callback. If addr is RPMSG_ADDR_ANY, then rpmsg_create_ept will | ||
184 | dynamically assign them an available rpmsg address (drivers should have | ||
185 | a very good reason why not to always use RPMSG_ADDR_ANY here). | ||
186 | |||
187 | Returns a pointer to the endpoint on success, or NULL on error. | ||
188 | |||
189 | void rpmsg_destroy_ept(struct rpmsg_endpoint *ept); | ||
190 | - destroys an existing rpmsg endpoint. user should provide a pointer | ||
191 | to an rpmsg endpoint that was previously created with rpmsg_create_ept(). | ||
192 | |||
193 | int register_rpmsg_driver(struct rpmsg_driver *rpdrv); | ||
194 | - registers an rpmsg driver with the rpmsg bus. user should provide | ||
195 | a pointer to an rpmsg_driver struct, which contains the driver's | ||
196 | ->probe() and ->remove() functions, an rx callback, and an id_table | ||
197 | specifying the names of the channels this driver is interested to | ||
198 | be probed with. | ||
199 | |||
200 | void unregister_rpmsg_driver(struct rpmsg_driver *rpdrv); | ||
201 | - unregisters an rpmsg driver from the rpmsg bus. user should provide | ||
202 | a pointer to a previously-registered rpmsg_driver struct. | ||
203 | Returns 0 on success, and an appropriate error value on failure. | ||
204 | |||
205 | |||
206 | 3. Typical usage | ||
207 | |||
208 | The following is a simple rpmsg driver, that sends an "hello!" message | ||
209 | on probe(), and whenever it receives an incoming message, it dumps its | ||
210 | content to the console. | ||
211 | |||
212 | #include <linux/kernel.h> | ||
213 | #include <linux/module.h> | ||
214 | #include <linux/rpmsg.h> | ||
215 | |||
216 | static void rpmsg_sample_cb(struct rpmsg_channel *rpdev, void *data, int len, | ||
217 | void *priv, u32 src) | ||
218 | { | ||
219 | print_hex_dump(KERN_INFO, "incoming message:", DUMP_PREFIX_NONE, | ||
220 | 16, 1, data, len, true); | ||
221 | } | ||
222 | |||
223 | static int rpmsg_sample_probe(struct rpmsg_channel *rpdev) | ||
224 | { | ||
225 | int err; | ||
226 | |||
227 | dev_info(&rpdev->dev, "chnl: 0x%x -> 0x%x\n", rpdev->src, rpdev->dst); | ||
228 | |||
229 | /* send a message on our channel */ | ||
230 | err = rpmsg_send(rpdev, "hello!", 6); | ||
231 | if (err) { | ||
232 | pr_err("rpmsg_send failed: %d\n", err); | ||
233 | return err; | ||
234 | } | ||
235 | |||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | static void __devexit rpmsg_sample_remove(struct rpmsg_channel *rpdev) | ||
240 | { | ||
241 | dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n"); | ||
242 | } | ||
243 | |||
244 | static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = { | ||
245 | { .name = "rpmsg-client-sample" }, | ||
246 | { }, | ||
247 | }; | ||
248 | MODULE_DEVICE_TABLE(rpmsg, rpmsg_driver_sample_id_table); | ||
249 | |||
250 | static struct rpmsg_driver rpmsg_sample_client = { | ||
251 | .drv.name = KBUILD_MODNAME, | ||
252 | .drv.owner = THIS_MODULE, | ||
253 | .id_table = rpmsg_driver_sample_id_table, | ||
254 | .probe = rpmsg_sample_probe, | ||
255 | .callback = rpmsg_sample_cb, | ||
256 | .remove = __devexit_p(rpmsg_sample_remove), | ||
257 | }; | ||
258 | |||
259 | static int __init init(void) | ||
260 | { | ||
261 | return register_rpmsg_driver(&rpmsg_sample_client); | ||
262 | } | ||
263 | module_init(init); | ||
264 | |||
265 | static void __exit fini(void) | ||
266 | { | ||
267 | unregister_rpmsg_driver(&rpmsg_sample_client); | ||
268 | } | ||
269 | module_exit(fini); | ||
270 | |||
271 | Note: a similar sample which can be built and loaded can be found | ||
272 | in samples/rpmsg/. | ||
273 | |||
274 | 4. Allocations of rpmsg channels: | ||
275 | |||
276 | At this point we only support dynamic allocations of rpmsg channels. | ||
277 | |||
278 | This is possible only with remote processors that have the VIRTIO_RPMSG_F_NS | ||
279 | virtio device feature set. This feature bit means that the remote | ||
280 | processor supports dynamic name service announcement messages. | ||
281 | |||
282 | When this feature is enabled, creation of rpmsg devices (i.e. channels) | ||
283 | is completely dynamic: the remote processor announces the existence of a | ||
284 | remote rpmsg service by sending a name service message (which contains | ||
285 | the name and rpmsg addr of the remote service, see struct rpmsg_ns_msg). | ||
286 | |||
287 | This message is then handled by the rpmsg bus, which in turn dynamically | ||
288 | creates and registers an rpmsg channel (which represents the remote service). | ||
289 | If/when a relevant rpmsg driver is registered, it will be immediately probed | ||
290 | by the bus, and can then start sending messages to the remote service. | ||
291 | |||
292 | The plan is also to add static creation of rpmsg channels via the virtio | ||
293 | config space, but it's not implemented yet. | ||
diff --git a/Documentation/scsi/LICENSE.qla2xxx b/Documentation/scsi/LICENSE.qla2xxx index 19e7cd4bba66..ce0fdf349a81 100644 --- a/Documentation/scsi/LICENSE.qla2xxx +++ b/Documentation/scsi/LICENSE.qla2xxx | |||
@@ -1,48 +1,11 @@ | |||
1 | Copyright (c) 2003-2011 QLogic Corporation | 1 | Copyright (c) 2003-2011 QLogic Corporation |
2 | QLogic Linux/ESX Fibre Channel HBA Driver | 2 | QLogic Linux FC-FCoE Driver |
3 | 3 | ||
4 | This program includes a device driver for Linux 2.6/ESX that may be | 4 | This program includes a device driver for Linux 3.x. |
5 | distributed with QLogic hardware specific firmware binary file. | ||
6 | You may modify and redistribute the device driver code under the | 5 | You may modify and redistribute the device driver code under the |
7 | GNU General Public License (a copy of which is attached hereto as | 6 | GNU General Public License (a copy of which is attached hereto as |
8 | Exhibit A) published by the Free Software Foundation (version 2). | 7 | Exhibit A) published by the Free Software Foundation (version 2). |
9 | 8 | ||
10 | You may redistribute the hardware specific firmware binary file | ||
11 | under the following terms: | ||
12 | |||
13 | 1. Redistribution of source code (only if applicable), | ||
14 | must retain the above copyright notice, this list of | ||
15 | conditions and the following disclaimer. | ||
16 | |||
17 | 2. Redistribution in binary form must reproduce the above | ||
18 | copyright notice, this list of conditions and the | ||
19 | following disclaimer in the documentation and/or other | ||
20 | materials provided with the distribution. | ||
21 | |||
22 | 3. The name of QLogic Corporation may not be used to | ||
23 | endorse or promote products derived from this software | ||
24 | without specific prior written permission | ||
25 | |||
26 | REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE, | ||
27 | THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY | ||
28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
30 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR | ||
31 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
32 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
33 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
35 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
36 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
37 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
38 | POSSIBILITY OF SUCH DAMAGE. | ||
39 | |||
40 | USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT | ||
41 | CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR | ||
42 | OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT, | ||
43 | TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN | ||
44 | ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN | ||
45 | COMBINATION WITH THIS PROGRAM. | ||
46 | 9 | ||
47 | 10 | ||
48 | EXHIBIT A | 11 | EXHIBIT A |
diff --git a/Documentation/scsi/bfa.txt b/Documentation/scsi/bfa.txt new file mode 100644 index 000000000000..f2d6e9d1791e --- /dev/null +++ b/Documentation/scsi/bfa.txt | |||
@@ -0,0 +1,82 @@ | |||
1 | Linux driver for Brocade FC/FCOE adapters | ||
2 | |||
3 | |||
4 | Supported Hardware | ||
5 | ------------------ | ||
6 | |||
7 | bfa 3.0.2.2 driver supports all Brocade FC/FCOE adapters. Below is a list of | ||
8 | adapter models with corresponding PCIIDs. | ||
9 | |||
10 | PCIID Model | ||
11 | |||
12 | 1657:0013:1657:0014 425 4Gbps dual port FC HBA | ||
13 | 1657:0013:1657:0014 825 8Gbps PCIe dual port FC HBA | ||
14 | 1657:0013:103c:1742 HP 82B 8Gbps PCIedual port FC HBA | ||
15 | 1657:0013:103c:1744 HP 42B 4Gbps dual port FC HBA | ||
16 | 1657:0017:1657:0014 415 4Gbps single port FC HBA | ||
17 | 1657:0017:1657:0014 815 8Gbps single port FC HBA | ||
18 | 1657:0017:103c:1741 HP 41B 4Gbps single port FC HBA | ||
19 | 1657:0017:103c 1743 HP 81B 8Gbps single port FC HBA | ||
20 | 1657:0021:103c:1779 804 8Gbps FC HBA for HP Bladesystem c-class | ||
21 | |||
22 | 1657:0014:1657:0014 1010 10Gbps single port CNA - FCOE | ||
23 | 1657:0014:1657:0014 1020 10Gbps dual port CNA - FCOE | ||
24 | 1657:0014:1657:0014 1007 10Gbps dual port CNA - FCOE | ||
25 | 1657:0014:1657:0014 1741 10Gbps dual port CNA - FCOE | ||
26 | |||
27 | 1657:0022:1657:0024 1860 16Gbps FC HBA | ||
28 | 1657:0022:1657:0022 1860 10Gbps CNA - FCOE | ||
29 | |||
30 | |||
31 | Firmware download | ||
32 | ----------------- | ||
33 | |||
34 | The latest Firmware package for 3.0.2.2 bfa driver can be found at: | ||
35 | |||
36 | http://www.brocade.com/services-support/drivers-downloads/adapters/Linux.page | ||
37 | |||
38 | and then click following respective util package link: | ||
39 | |||
40 | Version Link | ||
41 | |||
42 | v3.0.0.0 Linux Adapter Firmware package for RHEL 6.2, SLES 11SP2 | ||
43 | |||
44 | |||
45 | Configuration & Management utility download | ||
46 | ------------------------------------------- | ||
47 | |||
48 | The latest driver configuration & management utility for 3.0.2.2 bfa driver can | ||
49 | be found at: | ||
50 | |||
51 | http://www.brocade.com/services-support/drivers-downloads/adapters/Linux.page | ||
52 | |||
53 | and then click following respective util pacakge link | ||
54 | |||
55 | Version Link | ||
56 | |||
57 | v3.0.2.0 Linux Adapter Firmware package for RHEL 6.2, SLES 11SP2 | ||
58 | |||
59 | |||
60 | Documentation | ||
61 | ------------- | ||
62 | |||
63 | The latest Administration's Guide, Installation and Reference Manual, | ||
64 | Troubleshooting Guide, and Release Notes for the corresponding out-of-box | ||
65 | driver can be found at: | ||
66 | |||
67 | http://www.brocade.com/services-support/drivers-downloads/adapters/Linux.page | ||
68 | |||
69 | and use the following inbox and out-of-box driver version mapping to find | ||
70 | the corresponding documentation: | ||
71 | |||
72 | Inbox Version Out-of-box Version | ||
73 | |||
74 | v3.0.2.2 v3.0.0.0 | ||
75 | |||
76 | |||
77 | Support | ||
78 | ------- | ||
79 | |||
80 | For general product and support info, go to the Brocade website at: | ||
81 | |||
82 | http://www.brocade.com/services-support/index.page | ||
diff --git a/Documentation/scsi/libsas.txt b/Documentation/scsi/libsas.txt index aa54f54c4a50..3cc9c7843e15 100644 --- a/Documentation/scsi/libsas.txt +++ b/Documentation/scsi/libsas.txt | |||
@@ -398,21 +398,6 @@ struct sas_task { | |||
398 | task_done -- callback when the task has finished execution | 398 | task_done -- callback when the task has finished execution |
399 | }; | 399 | }; |
400 | 400 | ||
401 | When an external entity, entity other than the LLDD or the | ||
402 | SAS Layer, wants to work with a struct domain_device, it | ||
403 | _must_ call kobject_get() when getting a handle on the | ||
404 | device and kobject_put() when it is done with the device. | ||
405 | |||
406 | This does two things: | ||
407 | A) implements proper kfree() for the device; | ||
408 | B) increments/decrements the kref for all players: | ||
409 | domain_device | ||
410 | all domain_device's ... (if past an expander) | ||
411 | port | ||
412 | host adapter | ||
413 | pci device | ||
414 | and up the ladder, etc. | ||
415 | |||
416 | DISCOVERY | 401 | DISCOVERY |
417 | --------- | 402 | --------- |
418 | 403 | ||
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 12e3a0fb9bec..6f75ba3b8a39 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -860,7 +860,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
860 | 860 | ||
861 | [Multiple options for each card instance] | 861 | [Multiple options for each card instance] |
862 | model - force the model name | 862 | model - force the model name |
863 | position_fix - Fix DMA pointer (0 = auto, 1 = use LPIB, 2 = POSBUF) | 863 | position_fix - Fix DMA pointer (0 = auto, 1 = use LPIB, 2 = POSBUF, |
864 | 3 = VIACOMBO, 4 = COMBO) | ||
864 | probe_mask - Bitmask to probe codecs (default = -1, meaning all slots) | 865 | probe_mask - Bitmask to probe codecs (default = -1, meaning all slots) |
865 | When the bit 8 (0x100) is set, the lower 8 bits are used | 866 | When the bit 8 (0x100) is set, the lower 8 bits are used |
866 | as the "fixed" codec slots; i.e. the driver probes the | 867 | as the "fixed" codec slots; i.e. the driver probes the |
@@ -925,6 +926,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
925 | (Usually SD_LPIB register is more accurate than the | 926 | (Usually SD_LPIB register is more accurate than the |
926 | position buffer.) | 927 | position buffer.) |
927 | 928 | ||
929 | position_fix=3 is specific to VIA devices. The position | ||
930 | of the capture stream is checked from both LPIB and POSBUF | ||
931 | values. position_fix=4 is a combination mode, using LPIB | ||
932 | for playback and POSBUF for capture. | ||
933 | |||
928 | NB: If you get many "azx_get_response timeout" messages at | 934 | NB: If you get many "azx_get_response timeout" messages at |
929 | loading, it's likely a problem of interrupts (e.g. ACPI irq | 935 | loading, it's likely a problem of interrupts (e.g. ACPI irq |
930 | routing). Try to boot with options like "pci=noacpi". Also, you | 936 | routing). Try to boot with options like "pci=noacpi". Also, you |
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index c8c54544abc5..d97d992ced14 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt | |||
@@ -8,37 +8,10 @@ ALC880 | |||
8 | 5stack-digout 5-jack in back, 2-jack in front, a SPDIF out | 8 | 5stack-digout 5-jack in back, 2-jack in front, a SPDIF out |
9 | 6stack 6-jack in back, 2-jack in front | 9 | 6stack 6-jack in back, 2-jack in front |
10 | 6stack-digout 6-jack with a SPDIF out | 10 | 6stack-digout 6-jack with a SPDIF out |
11 | w810 3-jack | ||
12 | z71v 3-jack (HP shared SPDIF) | ||
13 | asus 3-jack (ASUS Mobo) | ||
14 | asus-w1v ASUS W1V | ||
15 | asus-dig ASUS with SPDIF out | ||
16 | asus-dig2 ASUS with SPDIF out (using GPIO2) | ||
17 | uniwill 3-jack | ||
18 | fujitsu Fujitsu Laptops (Pi1536) | ||
19 | F1734 2-jack | ||
20 | lg LG laptop (m1 express dual) | ||
21 | lg-lw LG LW20/LW25 laptop | ||
22 | tcl TCL S700 | ||
23 | clevo Clevo laptops (m520G, m665n) | ||
24 | medion Medion Rim 2150 | ||
25 | test for testing/debugging purpose, almost all controls can be | ||
26 | adjusted. Appearing only when compiled with | ||
27 | $CONFIG_SND_DEBUG=y | ||
28 | auto auto-config reading BIOS (default) | ||
29 | 11 | ||
30 | ALC260 | 12 | ALC260 |
31 | ====== | 13 | ====== |
32 | fujitsu Fujitsu S7020 | 14 | N/A |
33 | acer Acer TravelMate | ||
34 | will Will laptops (PB V7900) | ||
35 | replacer Replacer 672V | ||
36 | favorit100 Maxdata Favorit 100XS | ||
37 | basic fixed pin assignment (old default model) | ||
38 | test for testing/debugging purpose, almost all controls can | ||
39 | adjusted. Appearing only when compiled with | ||
40 | $CONFIG_SND_DEBUG=y | ||
41 | auto auto-config reading BIOS (default) | ||
42 | 15 | ||
43 | ALC262 | 16 | ALC262 |
44 | ====== | 17 | ====== |
@@ -70,55 +43,7 @@ ALC680 | |||
70 | 43 | ||
71 | ALC882/883/885/888/889 | 44 | ALC882/883/885/888/889 |
72 | ====================== | 45 | ====================== |
73 | 3stack-dig 3-jack with SPDIF I/O | 46 | N/A |
74 | 6stack-dig 6-jack digital with SPDIF I/O | ||
75 | arima Arima W820Di1 | ||
76 | targa Targa T8, MSI-1049 T8 | ||
77 | asus-a7j ASUS A7J | ||
78 | asus-a7m ASUS A7M | ||
79 | macpro MacPro support | ||
80 | mb5 Macbook 5,1 | ||
81 | macmini3 Macmini 3,1 | ||
82 | mba21 Macbook Air 2,1 | ||
83 | mbp3 Macbook Pro rev3 | ||
84 | imac24 iMac 24'' with jack detection | ||
85 | imac91 iMac 9,1 | ||
86 | w2jc ASUS W2JC | ||
87 | 3stack-2ch-dig 3-jack with SPDIF I/O (ALC883) | ||
88 | alc883-6stack-dig 6-jack digital with SPDIF I/O (ALC883) | ||
89 | 3stack-6ch 3-jack 6-channel | ||
90 | 3stack-6ch-dig 3-jack 6-channel with SPDIF I/O | ||
91 | 6stack-dig-demo 6-jack digital for Intel demo board | ||
92 | acer Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc) | ||
93 | acer-aspire Acer Aspire 9810 | ||
94 | acer-aspire-4930g Acer Aspire 4930G | ||
95 | acer-aspire-6530g Acer Aspire 6530G | ||
96 | acer-aspire-7730g Acer Aspire 7730G | ||
97 | acer-aspire-8930g Acer Aspire 8930G | ||
98 | medion Medion Laptops | ||
99 | targa-dig Targa/MSI | ||
100 | targa-2ch-dig Targa/MSI with 2-channel | ||
101 | targa-8ch-dig Targa/MSI with 8-channel (MSI GX620) | ||
102 | laptop-eapd 3-jack with SPDIF I/O and EAPD (Clevo M540JE, M550JE) | ||
103 | lenovo-101e Lenovo 101E | ||
104 | lenovo-nb0763 Lenovo NB0763 | ||
105 | lenovo-ms7195-dig Lenovo MS7195 | ||
106 | lenovo-sky Lenovo Sky | ||
107 | haier-w66 Haier W66 | ||
108 | 3stack-hp HP machines with 3stack (Lucknow, Samba boards) | ||
109 | 6stack-dell Dell machines with 6stack (Inspiron 530) | ||
110 | mitac Mitac 8252D | ||
111 | clevo-m540r Clevo M540R (6ch + digital) | ||
112 | clevo-m720 Clevo M720 laptop series | ||
113 | fujitsu-pi2515 Fujitsu AMILO Pi2515 | ||
114 | fujitsu-xa3530 Fujitsu AMILO XA3530 | ||
115 | 3stack-6ch-intel Intel DG33* boards | ||
116 | intel-alc889a Intel IbexPeak with ALC889A | ||
117 | intel-x58 Intel DX58 with ALC889 | ||
118 | asus-p5q ASUS P5Q-EM boards | ||
119 | mb31 MacBook 3,1 | ||
120 | sony-vaio-tt Sony VAIO TT | ||
121 | auto auto-config reading BIOS (default) | ||
122 | 47 | ||
123 | ALC861/660 | 48 | ALC861/660 |
124 | ========== | 49 | ========== |
diff --git a/Documentation/sound/alsa/HD-Audio.txt b/Documentation/sound/alsa/HD-Audio.txt index 91fee3b45fb8..7813c06a5c71 100644 --- a/Documentation/sound/alsa/HD-Audio.txt +++ b/Documentation/sound/alsa/HD-Audio.txt | |||
@@ -59,7 +59,12 @@ a case, you can change the default method via `position_fix` option. | |||
59 | `position_fix=1` means to use LPIB method explicitly. | 59 | `position_fix=1` means to use LPIB method explicitly. |
60 | `position_fix=2` means to use the position-buffer. | 60 | `position_fix=2` means to use the position-buffer. |
61 | `position_fix=3` means to use a combination of both methods, needed | 61 | `position_fix=3` means to use a combination of both methods, needed |
62 | for some VIA and ATI controllers. 0 is the default value for all other | 62 | for some VIA controllers. The capture stream position is corrected |
63 | by comparing both LPIB and position-buffer values. | ||
64 | `position_fix=4` is another combination available for all controllers, | ||
65 | and uses LPIB for the playback and the position-buffer for the capture | ||
66 | streams. | ||
67 | 0 is the default value for all other | ||
63 | controllers, the automatic check and fallback to LPIB as described in | 68 | controllers, the automatic check and fallback to LPIB as described in |
64 | the above. If you get a problem of repeated sounds, this option might | 69 | the above. If you get a problem of repeated sounds, this option might |
65 | help. | 70 | help. |
diff --git a/Documentation/video4linux/CARDLIST.cx23885 b/Documentation/video4linux/CARDLIST.cx23885 index 23584d0c6a75..f316d1816fcd 100644 --- a/Documentation/video4linux/CARDLIST.cx23885 +++ b/Documentation/video4linux/CARDLIST.cx23885 | |||
@@ -32,3 +32,4 @@ | |||
32 | 31 -> Leadtek Winfast PxDVR3200 H XC4000 [107d:6f39] | 32 | 31 -> Leadtek Winfast PxDVR3200 H XC4000 [107d:6f39] |
33 | 32 -> MPX-885 | 33 | 32 -> MPX-885 |
34 | 33 -> Mygica X8507 [14f1:8502] | 34 | 33 -> Mygica X8507 [14f1:8502] |
35 | 34 -> TerraTec Cinergy T PCIe Dual [153b:117e] | ||
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index eee18e6962b6..fa4b3f947468 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 | |||
@@ -59,7 +59,7 @@ | |||
59 | 58 -> Pinnacle PCTV HD 800i [11bd:0051] | 59 | 58 -> Pinnacle PCTV HD 800i [11bd:0051] |
60 | 59 -> DViCO FusionHDTV 5 PCI nano [18ac:d530] | 60 | 59 -> DViCO FusionHDTV 5 PCI nano [18ac:d530] |
61 | 60 -> Pinnacle Hybrid PCTV [12ab:1788] | 61 | 60 -> Pinnacle Hybrid PCTV [12ab:1788] |
62 | 61 -> Leadtek TV2000 XP Global [107d:6f18,107d:6618] | 62 | 61 -> Leadtek TV2000 XP Global [107d:6f18,107d:6618,107d:6619] |
63 | 62 -> PowerColor RA330 [14f1:ea3d] | 63 | 62 -> PowerColor RA330 [14f1:ea3d] |
64 | 63 -> Geniatech X8000-MT DVBT [14f1:8852] | 64 | 63 -> Geniatech X8000-MT DVBT [14f1:8852] |
65 | 64 -> DViCO FusionHDTV DVB-T PRO [18ac:db30] | 65 | 64 -> DViCO FusionHDTV DVB-T PRO [18ac:db30] |
@@ -87,3 +87,5 @@ | |||
87 | 86 -> TeVii S464 DVB-S/S2 [d464:9022] | 87 | 86 -> TeVii S464 DVB-S/S2 [d464:9022] |
88 | 87 -> Leadtek WinFast DTV2000 H PLUS [107d:6f42] | 88 | 87 -> Leadtek WinFast DTV2000 H PLUS [107d:6f42] |
89 | 88 -> Leadtek WinFast DTV1800 H (XC4000) [107d:6f38] | 89 | 88 -> Leadtek WinFast DTV1800 H (XC4000) [107d:6f38] |
90 | 89 -> Leadtek TV2000 XP Global (SC4100) [107d:6f36] | ||
91 | 90 -> Leadtek TV2000 XP Global (XC4100) [107d:6f43] | ||
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index e7be3ac49ead..d99262dda533 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx | |||
@@ -7,7 +7,7 @@ | |||
7 | 6 -> Terratec Cinergy 200 USB (em2800) | 7 | 6 -> Terratec Cinergy 200 USB (em2800) |
8 | 7 -> Leadtek Winfast USB II (em2800) [0413:6023] | 8 | 7 -> Leadtek Winfast USB II (em2800) [0413:6023] |
9 | 8 -> Kworld USB2800 (em2800) | 9 | 8 -> Kworld USB2800 (em2800) |
10 | 9 -> Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker (em2820/em2840) [1b80:e302,1b80:e304,2304:0207,2304:021a] | 10 | 9 -> Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker (em2820/em2840) [1b80:e302,1b80:e304,2304:0207,2304:021a,093b:a003] |
11 | 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500] | 11 | 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500] |
12 | 11 -> Terratec Hybrid XS (em2880) | 12 | 11 -> Terratec Hybrid XS (em2880) |
13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) | 13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) |
@@ -61,7 +61,7 @@ | |||
61 | 61 -> Pixelview PlayTV Box 4 USB 2.0 (em2820/em2840) | 61 | 61 -> Pixelview PlayTV Box 4 USB 2.0 (em2820/em2840) |
62 | 62 -> Gadmei TVR200 (em2820/em2840) | 62 | 62 -> Gadmei TVR200 (em2820/em2840) |
63 | 63 -> Kaiomy TVnPC U2 (em2860) [eb1a:e303] | 63 | 63 -> Kaiomy TVnPC U2 (em2860) [eb1a:e303] |
64 | 64 -> Easy Cap Capture DC-60 (em2860) | 64 | 64 -> Easy Cap Capture DC-60 (em2860) [1b80:e309] |
65 | 65 -> IO-DATA GV-MVP/SZ (em2820/em2840) [04bb:0515] | 65 | 65 -> IO-DATA GV-MVP/SZ (em2820/em2840) [04bb:0515] |
66 | 66 -> Empire dual TV (em2880) | 66 | 66 -> Empire dual TV (em2880) |
67 | 67 -> Terratec Grabby (em2860) [0ccd:0096,0ccd:10AF] | 67 | 67 -> Terratec Grabby (em2860) [0ccd:0096,0ccd:10AF] |
@@ -76,7 +76,11 @@ | |||
76 | 76 -> KWorld PlusTV 340U or UB435-Q (ATSC) (em2870) [1b80:a340] | 76 | 76 -> KWorld PlusTV 340U or UB435-Q (ATSC) (em2870) [1b80:a340] |
77 | 77 -> EM2874 Leadership ISDBT (em2874) | 77 | 77 -> EM2874 Leadership ISDBT (em2874) |
78 | 78 -> PCTV nanoStick T2 290e (em28174) | 78 | 78 -> PCTV nanoStick T2 290e (em28174) |
79 | 79 -> Terratec Cinergy H5 (em2884) [0ccd:10a2,0ccd:10ad] | 79 | 79 -> Terratec Cinergy H5 (em2884) [0ccd:008e,0ccd:00ac,0ccd:10a2,0ccd:10ad] |
80 | 80 -> PCTV DVB-S2 Stick (460e) (em28174) | 80 | 80 -> PCTV DVB-S2 Stick (460e) (em28174) |
81 | 81 -> Hauppauge WinTV HVR 930C (em2884) [2040:1605] | 81 | 81 -> Hauppauge WinTV HVR 930C (em2884) [2040:1605] |
82 | 82 -> Terratec Cinergy HTC Stick (em2884) [0ccd:00b2] | 82 | 82 -> Terratec Cinergy HTC Stick (em2884) [0ccd:00b2] |
83 | 83 -> Honestech Vidbox NW03 (em2860) [eb1a:5006] | ||
84 | 84 -> MaxMedia UB425-TC (em2874) [1b80:e425] | ||
85 | 85 -> PCTV QuatroStick (510e) (em2884) [2304:0242] | ||
86 | 86 -> PCTV QuatroStick nano (520e) (em2884) [2013:0251] | ||
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index e7ef38a19859..34f3b330e5f4 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -187,3 +187,4 @@ | |||
187 | 186 -> Beholder BeholdTV 501 [5ace:5010] | 187 | 186 -> Beholder BeholdTV 501 [5ace:5010] |
188 | 187 -> Beholder BeholdTV 503 FM [5ace:5030] | 188 | 187 -> Beholder BeholdTV 503 FM [5ace:5030] |
189 | 188 -> Sensoray 811/911 [6000:0811,6000:0911] | 189 | 188 -> Sensoray 811/911 [6000:0811,6000:0911] |
190 | 189 -> Kworld PC150-U [17de:a134] | ||
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index 6323b7a20719..c83f6e418879 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner | |||
@@ -78,10 +78,11 @@ tuner=77 - TCL tuner MF02GIP-5N-E | |||
78 | tuner=78 - Philips FMD1216MEX MK3 Hybrid Tuner | 78 | tuner=78 - Philips FMD1216MEX MK3 Hybrid Tuner |
79 | tuner=79 - Philips PAL/SECAM multi (FM1216 MK5) | 79 | tuner=79 - Philips PAL/SECAM multi (FM1216 MK5) |
80 | tuner=80 - Philips FQ1216LME MK3 PAL/SECAM w/active loopthrough | 80 | tuner=80 - Philips FQ1216LME MK3 PAL/SECAM w/active loopthrough |
81 | tuner=81 - Xceive 4000 tuner | ||
82 | tuner=81 - Partsnic (Daewoo) PTI-5NF05 | 81 | tuner=81 - Partsnic (Daewoo) PTI-5NF05 |
83 | tuner=82 - Philips CU1216L | 82 | tuner=82 - Philips CU1216L |
84 | tuner=83 - NXP TDA18271 | 83 | tuner=83 - NXP TDA18271 |
85 | tuner=84 - Sony BTF-Pxn01Z | 84 | tuner=84 - Sony BTF-Pxn01Z |
86 | tuner=85 - Philips FQ1236 MK5 | 85 | tuner=85 - Philips FQ1236 MK5 |
87 | tuner=86 - Tena TNF5337 MFD | 86 | tuner=86 - Tena TNF5337 MFD |
87 | tuner=87 - Xceive 4000 tuner | ||
88 | tuner=88 - Xceive 5000C tuner | ||
diff --git a/Documentation/video4linux/fimc.txt b/Documentation/video4linux/fimc.txt new file mode 100644 index 000000000000..eb049708f3e4 --- /dev/null +++ b/Documentation/video4linux/fimc.txt | |||
@@ -0,0 +1,178 @@ | |||
1 | Samsung S5P/EXYNOS4 FIMC driver | ||
2 | |||
3 | Copyright (C) 2012 Samsung Electronics Co., Ltd. | ||
4 | --------------------------------------------------------------------------- | ||
5 | |||
6 | The FIMC (Fully Interactive Mobile Camera) device available in Samsung | ||
7 | SoC Application Processors is an integrated camera host interface, color | ||
8 | space converter, image resizer and rotator. It's also capable of capturing | ||
9 | data from LCD controller (FIMD) through the SoC internal writeback data | ||
10 | path. There are multiple FIMC instances in the SoCs (up to 4), having | ||
11 | slightly different capabilities, like pixel alignment constraints, rotator | ||
12 | availability, LCD writeback support, etc. The driver is located at | ||
13 | drivers/media/video/s5p-fimc directory. | ||
14 | |||
15 | 1. Supported SoCs | ||
16 | ================= | ||
17 | |||
18 | S5PC100 (mem-to-mem only), S5PV210, EXYNOS4210 | ||
19 | |||
20 | 2. Supported features | ||
21 | ===================== | ||
22 | |||
23 | - camera parallel interface capture (ITU-R.BT601/565); | ||
24 | - camera serial interface capture (MIPI-CSI2); | ||
25 | - memory-to-memory processing (color space conversion, scaling, mirror | ||
26 | and rotation); | ||
27 | - dynamic pipeline re-configuration at runtime (re-attachment of any FIMC | ||
28 | instance to any parallel video input or any MIPI-CSI front-end); | ||
29 | - runtime PM and system wide suspend/resume | ||
30 | |||
31 | Not currently supported: | ||
32 | - LCD writeback input | ||
33 | - per frame clock gating (mem-to-mem) | ||
34 | |||
35 | 3. Files partitioning | ||
36 | ===================== | ||
37 | |||
38 | - media device driver | ||
39 | drivers/media/video/s5p-fimc/fimc-mdevice.[ch] | ||
40 | |||
41 | - camera capture video device driver | ||
42 | drivers/media/video/s5p-fimc/fimc-capture.c | ||
43 | |||
44 | - MIPI-CSI2 receiver subdev | ||
45 | drivers/media/video/s5p-fimc/mipi-csis.[ch] | ||
46 | |||
47 | - video post-processor (mem-to-mem) | ||
48 | drivers/media/video/s5p-fimc/fimc-core.c | ||
49 | |||
50 | - common files | ||
51 | drivers/media/video/s5p-fimc/fimc-core.h | ||
52 | drivers/media/video/s5p-fimc/fimc-reg.h | ||
53 | drivers/media/video/s5p-fimc/regs-fimc.h | ||
54 | |||
55 | 4. User space interfaces | ||
56 | ======================== | ||
57 | |||
58 | 4.1. Media device interface | ||
59 | |||
60 | The driver supports Media Controller API as defined at | ||
61 | http://http://linuxtv.org/downloads/v4l-dvb-apis/media_common.html | ||
62 | The media device driver name is "SAMSUNG S5P FIMC". | ||
63 | |||
64 | The purpose of this interface is to allow changing assignment of FIMC instances | ||
65 | to the SoC peripheral camera input at runtime and optionally to control internal | ||
66 | connections of the MIPI-CSIS device(s) to the FIMC entities. | ||
67 | |||
68 | The media device interface allows to configure the SoC for capturing image | ||
69 | data from the sensor through more than one FIMC instance (e.g. for simultaneous | ||
70 | viewfinder and still capture setup). | ||
71 | Reconfiguration is done by enabling/disabling media links created by the driver | ||
72 | during initialization. The internal device topology can be easily discovered | ||
73 | through media entity and links enumeration. | ||
74 | |||
75 | 4.2. Memory-to-memory video node | ||
76 | |||
77 | V4L2 memory-to-memory interface at /dev/video? device node. This is standalone | ||
78 | video device, it has no media pads. However please note the mem-to-mem and | ||
79 | capture video node operation on same FIMC instance is not allowed. The driver | ||
80 | detects such cases but the applications should prevent them to avoid an | ||
81 | undefined behaviour. | ||
82 | |||
83 | 4.3. Capture video node | ||
84 | |||
85 | The driver supports V4L2 Video Capture Interface as defined at: | ||
86 | http://linuxtv.org/downloads/v4l-dvb-apis/devices.html | ||
87 | |||
88 | At the capture and mem-to-mem video nodes only the multi-planar API is | ||
89 | supported. For more details see: | ||
90 | http://linuxtv.org/downloads/v4l-dvb-apis/planar-apis.html | ||
91 | |||
92 | 4.4. Camera capture subdevs | ||
93 | |||
94 | Each FIMC instance exports a sub-device node (/dev/v4l-subdev?), a sub-device | ||
95 | node is also created per each available and enabled at the platform level | ||
96 | MIPI-CSI receiver device (currently up to two). | ||
97 | |||
98 | 4.5. sysfs | ||
99 | |||
100 | In order to enable more precise camera pipeline control through the sub-device | ||
101 | API the driver creates a sysfs entry associated with "s5p-fimc-md" platform | ||
102 | device. The entry path is: /sys/platform/devices/s5p-fimc-md/subdev_conf_mode. | ||
103 | |||
104 | In typical use case there could be a following capture pipeline configuration: | ||
105 | sensor subdev -> mipi-csi subdev -> fimc subdev -> video node | ||
106 | |||
107 | When we configure these devices through sub-device API at user space, the | ||
108 | configuration flow must be from left to right, and the video node is | ||
109 | configured as last one. | ||
110 | When we don't use sub-device user space API the whole configuration of all | ||
111 | devices belonging to the pipeline is done at the video node driver. | ||
112 | The sysfs entry allows to instruct the capture node driver not to configure | ||
113 | the sub-devices (format, crop), to avoid resetting the subdevs' configuration | ||
114 | when the last configuration steps at the video node is performed. | ||
115 | |||
116 | For full sub-device control support (subdevs configured at user space before | ||
117 | starting streaming): | ||
118 | # echo "sub-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode | ||
119 | |||
120 | For V4L2 video node control only (subdevs configured internally by the host | ||
121 | driver): | ||
122 | # echo "vid-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode | ||
123 | This is a default option. | ||
124 | |||
125 | 5. Device mapping to video and subdev device nodes | ||
126 | ================================================== | ||
127 | |||
128 | There are associated two video device nodes with each device instance in | ||
129 | hardware - video capture and mem-to-mem and additionally a subdev node for | ||
130 | more precise FIMC capture subsystem control. In addition a separate v4l2 | ||
131 | sub-device node is created per each MIPI-CSIS device. | ||
132 | |||
133 | How to find out which /dev/video? or /dev/v4l-subdev? is assigned to which | ||
134 | device? | ||
135 | |||
136 | You can either grep through the kernel log to find relevant information, i.e. | ||
137 | # dmesg | grep -i fimc | ||
138 | (note that udev, if present, might still have rearranged the video nodes), | ||
139 | |||
140 | or retrieve the information from /dev/media? with help of the media-ctl tool: | ||
141 | # media-ctl -p | ||
142 | |||
143 | 6. Platform support | ||
144 | =================== | ||
145 | |||
146 | The machine code (plat-s5p and arch/arm/mach-*) must select following options | ||
147 | |||
148 | CONFIG_S5P_DEV_FIMC0 mandatory | ||
149 | CONFIG_S5P_DEV_FIMC1 \ | ||
150 | CONFIG_S5P_DEV_FIMC2 | optional | ||
151 | CONFIG_S5P_DEV_FIMC3 | | ||
152 | CONFIG_S5P_SETUP_FIMC / | ||
153 | CONFIG_S5P_SETUP_MIPIPHY \ | ||
154 | CONFIG_S5P_DEV_CSIS0 | optional for MIPI-CSI interface | ||
155 | CONFIG_S5P_DEV_CSIS1 / | ||
156 | |||
157 | Except that, relevant s5p_device_fimc? should be registered in the machine code | ||
158 | in addition to a "s5p-fimc-md" platform device to which the media device driver | ||
159 | is bound. The "s5p-fimc-md" device instance is required even if only mem-to-mem | ||
160 | operation is used. | ||
161 | |||
162 | The description of sensor(s) attached to FIMC/MIPI-CSIS camera inputs should be | ||
163 | passed as the "s5p-fimc-md" device platform_data. The platform data structure | ||
164 | is defined in file include/media/s5p_fimc.h. | ||
165 | |||
166 | 7. Build | ||
167 | ======== | ||
168 | |||
169 | This driver depends on following config options: | ||
170 | PLAT_S5P, | ||
171 | PM_RUNTIME, | ||
172 | I2C, | ||
173 | REGULATOR, | ||
174 | VIDEO_V4L2_SUBDEV_API, | ||
175 | |||
176 | If the driver is built as a loadable kernel module (CONFIG_VIDEO_SAMSUNG_S5P_FIMC=m) | ||
177 | two modules are created (in addition to the core v4l2 modules): s5p-fimc.ko and | ||
178 | optional s5p-csis.ko (MIPI-CSI receiver subdev). | ||
diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index f2060f0dc02c..e6c2842407a4 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt | |||
@@ -217,6 +217,7 @@ ov534_9 06f8:3003 Hercules Dualpix HD Weblog | |||
217 | sonixj 06f8:3004 Hercules Classic Silver | 217 | sonixj 06f8:3004 Hercules Classic Silver |
218 | sonixj 06f8:3008 Hercules Deluxe Optical Glass | 218 | sonixj 06f8:3008 Hercules Deluxe Optical Glass |
219 | pac7302 06f8:3009 Hercules Classic Link | 219 | pac7302 06f8:3009 Hercules Classic Link |
220 | pac7302 06f8:301b Hercules Link | ||
220 | nw80x 0728:d001 AVerMedia Camguard | 221 | nw80x 0728:d001 AVerMedia Camguard |
221 | spca508 0733:0110 ViewQuest VQ110 | 222 | spca508 0733:0110 ViewQuest VQ110 |
222 | spca501 0733:0401 Intel Create and Share | 223 | spca501 0733:0401 Intel Create and Share |
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index e1d94bf4056e..6386f8c0482e 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
@@ -95,7 +95,7 @@ described as 'basic' will be available. | |||
95 | Capability: basic | 95 | Capability: basic |
96 | Architectures: all | 96 | Architectures: all |
97 | Type: system ioctl | 97 | Type: system ioctl |
98 | Parameters: none | 98 | Parameters: machine type identifier (KVM_VM_*) |
99 | Returns: a VM fd that can be used to control the new virtual machine. | 99 | Returns: a VM fd that can be used to control the new virtual machine. |
100 | 100 | ||
101 | The new VM has no virtual cpus and no memory. An mmap() of a VM fd | 101 | The new VM has no virtual cpus and no memory. An mmap() of a VM fd |
@@ -103,6 +103,11 @@ will access the virtual machine's physical address space; offset zero | |||
103 | corresponds to guest physical address zero. Use of mmap() on a VM fd | 103 | corresponds to guest physical address zero. Use of mmap() on a VM fd |
104 | is discouraged if userspace memory allocation (KVM_CAP_USER_MEMORY) is | 104 | is discouraged if userspace memory allocation (KVM_CAP_USER_MEMORY) is |
105 | available. | 105 | available. |
106 | You most certainly want to use 0 as machine type. | ||
107 | |||
108 | In order to create user controlled virtual machines on S390, check | ||
109 | KVM_CAP_S390_UCONTROL and use the flag KVM_VM_S390_UCONTROL as | ||
110 | privileged user (CAP_SYS_ADMIN). | ||
106 | 111 | ||
107 | 4.3 KVM_GET_MSR_INDEX_LIST | 112 | 4.3 KVM_GET_MSR_INDEX_LIST |
108 | 113 | ||
@@ -213,6 +218,11 @@ allocation of vcpu ids. For example, if userspace wants | |||
213 | single-threaded guest vcpus, it should make all vcpu ids be a multiple | 218 | single-threaded guest vcpus, it should make all vcpu ids be a multiple |
214 | of the number of vcpus per vcore. | 219 | of the number of vcpus per vcore. |
215 | 220 | ||
221 | For virtual cpus that have been created with S390 user controlled virtual | ||
222 | machines, the resulting vcpu fd can be memory mapped at page offset | ||
223 | KVM_S390_SIE_PAGE_OFFSET in order to obtain a memory map of the virtual | ||
224 | cpu's hardware control block. | ||
225 | |||
216 | 4.8 KVM_GET_DIRTY_LOG (vm ioctl) | 226 | 4.8 KVM_GET_DIRTY_LOG (vm ioctl) |
217 | 227 | ||
218 | Capability: basic | 228 | Capability: basic |
@@ -1159,6 +1169,14 @@ following flags are specified: | |||
1159 | 1169 | ||
1160 | /* Depends on KVM_CAP_IOMMU */ | 1170 | /* Depends on KVM_CAP_IOMMU */ |
1161 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) | 1171 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) |
1172 | /* The following two depend on KVM_CAP_PCI_2_3 */ | ||
1173 | #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) | ||
1174 | #define KVM_DEV_ASSIGN_MASK_INTX (1 << 2) | ||
1175 | |||
1176 | If KVM_DEV_ASSIGN_PCI_2_3 is set, the kernel will manage legacy INTx interrupts | ||
1177 | via the PCI-2.3-compliant device-level mask, thus enable IRQ sharing with other | ||
1178 | assigned devices or host devices. KVM_DEV_ASSIGN_MASK_INTX specifies the | ||
1179 | guest's view on the INTx mask, see KVM_ASSIGN_SET_INTX_MASK for details. | ||
1162 | 1180 | ||
1163 | The KVM_DEV_ASSIGN_ENABLE_IOMMU flag is a mandatory option to ensure | 1181 | The KVM_DEV_ASSIGN_ENABLE_IOMMU flag is a mandatory option to ensure |
1164 | isolation of the device. Usages not specifying this flag are deprecated. | 1182 | isolation of the device. Usages not specifying this flag are deprecated. |
@@ -1399,6 +1417,71 @@ The following flags are defined: | |||
1399 | If datamatch flag is set, the event will be signaled only if the written value | 1417 | If datamatch flag is set, the event will be signaled only if the written value |
1400 | to the registered address is equal to datamatch in struct kvm_ioeventfd. | 1418 | to the registered address is equal to datamatch in struct kvm_ioeventfd. |
1401 | 1419 | ||
1420 | 4.59 KVM_DIRTY_TLB | ||
1421 | |||
1422 | Capability: KVM_CAP_SW_TLB | ||
1423 | Architectures: ppc | ||
1424 | Type: vcpu ioctl | ||
1425 | Parameters: struct kvm_dirty_tlb (in) | ||
1426 | Returns: 0 on success, -1 on error | ||
1427 | |||
1428 | struct kvm_dirty_tlb { | ||
1429 | __u64 bitmap; | ||
1430 | __u32 num_dirty; | ||
1431 | }; | ||
1432 | |||
1433 | This must be called whenever userspace has changed an entry in the shared | ||
1434 | TLB, prior to calling KVM_RUN on the associated vcpu. | ||
1435 | |||
1436 | The "bitmap" field is the userspace address of an array. This array | ||
1437 | consists of a number of bits, equal to the total number of TLB entries as | ||
1438 | determined by the last successful call to KVM_CONFIG_TLB, rounded up to the | ||
1439 | nearest multiple of 64. | ||
1440 | |||
1441 | Each bit corresponds to one TLB entry, ordered the same as in the shared TLB | ||
1442 | array. | ||
1443 | |||
1444 | The array is little-endian: the bit 0 is the least significant bit of the | ||
1445 | first byte, bit 8 is the least significant bit of the second byte, etc. | ||
1446 | This avoids any complications with differing word sizes. | ||
1447 | |||
1448 | The "num_dirty" field is a performance hint for KVM to determine whether it | ||
1449 | should skip processing the bitmap and just invalidate everything. It must | ||
1450 | be set to the number of set bits in the bitmap. | ||
1451 | |||
1452 | 4.60 KVM_ASSIGN_SET_INTX_MASK | ||
1453 | |||
1454 | Capability: KVM_CAP_PCI_2_3 | ||
1455 | Architectures: x86 | ||
1456 | Type: vm ioctl | ||
1457 | Parameters: struct kvm_assigned_pci_dev (in) | ||
1458 | Returns: 0 on success, -1 on error | ||
1459 | |||
1460 | Allows userspace to mask PCI INTx interrupts from the assigned device. The | ||
1461 | kernel will not deliver INTx interrupts to the guest between setting and | ||
1462 | clearing of KVM_ASSIGN_SET_INTX_MASK via this interface. This enables use of | ||
1463 | and emulation of PCI 2.3 INTx disable command register behavior. | ||
1464 | |||
1465 | This may be used for both PCI 2.3 devices supporting INTx disable natively and | ||
1466 | older devices lacking this support. Userspace is responsible for emulating the | ||
1467 | read value of the INTx disable bit in the guest visible PCI command register. | ||
1468 | When modifying the INTx disable state, userspace should precede updating the | ||
1469 | physical device command register by calling this ioctl to inform the kernel of | ||
1470 | the new intended INTx mask state. | ||
1471 | |||
1472 | Note that the kernel uses the device INTx disable bit to internally manage the | ||
1473 | device interrupt state for PCI 2.3 devices. Reads of this register may | ||
1474 | therefore not match the expected value. Writes should always use the guest | ||
1475 | intended INTx disable value rather than attempting to read-copy-update the | ||
1476 | current physical device state. Races between user and kernel updates to the | ||
1477 | INTx disable bit are handled lazily in the kernel. It's possible the device | ||
1478 | may generate unintended interrupts, but they will not be injected into the | ||
1479 | guest. | ||
1480 | |||
1481 | See KVM_ASSIGN_DEV_IRQ for the data structure. The target device is specified | ||
1482 | by assigned_dev_id. In the flags field, only KVM_DEV_ASSIGN_MASK_INTX is | ||
1483 | evaluated. | ||
1484 | |||
1402 | 4.62 KVM_CREATE_SPAPR_TCE | 1485 | 4.62 KVM_CREATE_SPAPR_TCE |
1403 | 1486 | ||
1404 | Capability: KVM_CAP_SPAPR_TCE | 1487 | Capability: KVM_CAP_SPAPR_TCE |
@@ -1491,6 +1574,101 @@ following algorithm: | |||
1491 | Some guests configure the LINT1 NMI input to cause a panic, aiding in | 1574 | Some guests configure the LINT1 NMI input to cause a panic, aiding in |
1492 | debugging. | 1575 | debugging. |
1493 | 1576 | ||
1577 | 4.65 KVM_S390_UCAS_MAP | ||
1578 | |||
1579 | Capability: KVM_CAP_S390_UCONTROL | ||
1580 | Architectures: s390 | ||
1581 | Type: vcpu ioctl | ||
1582 | Parameters: struct kvm_s390_ucas_mapping (in) | ||
1583 | Returns: 0 in case of success | ||
1584 | |||
1585 | The parameter is defined like this: | ||
1586 | struct kvm_s390_ucas_mapping { | ||
1587 | __u64 user_addr; | ||
1588 | __u64 vcpu_addr; | ||
1589 | __u64 length; | ||
1590 | }; | ||
1591 | |||
1592 | This ioctl maps the memory at "user_addr" with the length "length" to | ||
1593 | the vcpu's address space starting at "vcpu_addr". All parameters need to | ||
1594 | be alligned by 1 megabyte. | ||
1595 | |||
1596 | 4.66 KVM_S390_UCAS_UNMAP | ||
1597 | |||
1598 | Capability: KVM_CAP_S390_UCONTROL | ||
1599 | Architectures: s390 | ||
1600 | Type: vcpu ioctl | ||
1601 | Parameters: struct kvm_s390_ucas_mapping (in) | ||
1602 | Returns: 0 in case of success | ||
1603 | |||
1604 | The parameter is defined like this: | ||
1605 | struct kvm_s390_ucas_mapping { | ||
1606 | __u64 user_addr; | ||
1607 | __u64 vcpu_addr; | ||
1608 | __u64 length; | ||
1609 | }; | ||
1610 | |||
1611 | This ioctl unmaps the memory in the vcpu's address space starting at | ||
1612 | "vcpu_addr" with the length "length". The field "user_addr" is ignored. | ||
1613 | All parameters need to be alligned by 1 megabyte. | ||
1614 | |||
1615 | 4.67 KVM_S390_VCPU_FAULT | ||
1616 | |||
1617 | Capability: KVM_CAP_S390_UCONTROL | ||
1618 | Architectures: s390 | ||
1619 | Type: vcpu ioctl | ||
1620 | Parameters: vcpu absolute address (in) | ||
1621 | Returns: 0 in case of success | ||
1622 | |||
1623 | This call creates a page table entry on the virtual cpu's address space | ||
1624 | (for user controlled virtual machines) or the virtual machine's address | ||
1625 | space (for regular virtual machines). This only works for minor faults, | ||
1626 | thus it's recommended to access subject memory page via the user page | ||
1627 | table upfront. This is useful to handle validity intercepts for user | ||
1628 | controlled virtual machines to fault in the virtual cpu's lowcore pages | ||
1629 | prior to calling the KVM_RUN ioctl. | ||
1630 | |||
1631 | 4.68 KVM_SET_ONE_REG | ||
1632 | |||
1633 | Capability: KVM_CAP_ONE_REG | ||
1634 | Architectures: all | ||
1635 | Type: vcpu ioctl | ||
1636 | Parameters: struct kvm_one_reg (in) | ||
1637 | Returns: 0 on success, negative value on failure | ||
1638 | |||
1639 | struct kvm_one_reg { | ||
1640 | __u64 id; | ||
1641 | __u64 addr; | ||
1642 | }; | ||
1643 | |||
1644 | Using this ioctl, a single vcpu register can be set to a specific value | ||
1645 | defined by user space with the passed in struct kvm_one_reg, where id | ||
1646 | refers to the register identifier as described below and addr is a pointer | ||
1647 | to a variable with the respective size. There can be architecture agnostic | ||
1648 | and architecture specific registers. Each have their own range of operation | ||
1649 | and their own constants and width. To keep track of the implemented | ||
1650 | registers, find a list below: | ||
1651 | |||
1652 | Arch | Register | Width (bits) | ||
1653 | | | | ||
1654 | PPC | KVM_REG_PPC_HIOR | 64 | ||
1655 | |||
1656 | 4.69 KVM_GET_ONE_REG | ||
1657 | |||
1658 | Capability: KVM_CAP_ONE_REG | ||
1659 | Architectures: all | ||
1660 | Type: vcpu ioctl | ||
1661 | Parameters: struct kvm_one_reg (in and out) | ||
1662 | Returns: 0 on success, negative value on failure | ||
1663 | |||
1664 | This ioctl allows to receive the value of a single register implemented | ||
1665 | in a vcpu. The register to read is indicated by the "id" field of the | ||
1666 | kvm_one_reg struct passed in. On success, the register value can be found | ||
1667 | at the memory location pointed to by "addr". | ||
1668 | |||
1669 | The list of registers accessible using this interface is identical to the | ||
1670 | list in 4.64. | ||
1671 | |||
1494 | 5. The kvm_run structure | 1672 | 5. The kvm_run structure |
1495 | 1673 | ||
1496 | Application code obtains a pointer to the kvm_run structure by | 1674 | Application code obtains a pointer to the kvm_run structure by |
@@ -1651,6 +1829,20 @@ s390 specific. | |||
1651 | 1829 | ||
1652 | s390 specific. | 1830 | s390 specific. |
1653 | 1831 | ||
1832 | /* KVM_EXIT_S390_UCONTROL */ | ||
1833 | struct { | ||
1834 | __u64 trans_exc_code; | ||
1835 | __u32 pgm_code; | ||
1836 | } s390_ucontrol; | ||
1837 | |||
1838 | s390 specific. A page fault has occurred for a user controlled virtual | ||
1839 | machine (KVM_VM_S390_UNCONTROL) on it's host page table that cannot be | ||
1840 | resolved by the kernel. | ||
1841 | The program code and the translation exception code that were placed | ||
1842 | in the cpu's lowcore are presented here as defined by the z Architecture | ||
1843 | Principles of Operation Book in the Chapter for Dynamic Address Translation | ||
1844 | (DAT) | ||
1845 | |||
1654 | /* KVM_EXIT_DCR */ | 1846 | /* KVM_EXIT_DCR */ |
1655 | struct { | 1847 | struct { |
1656 | __u32 dcrn; | 1848 | __u32 dcrn; |
@@ -1693,6 +1885,29 @@ developer registration required to access it). | |||
1693 | /* Fix the size of the union. */ | 1885 | /* Fix the size of the union. */ |
1694 | char padding[256]; | 1886 | char padding[256]; |
1695 | }; | 1887 | }; |
1888 | |||
1889 | /* | ||
1890 | * shared registers between kvm and userspace. | ||
1891 | * kvm_valid_regs specifies the register classes set by the host | ||
1892 | * kvm_dirty_regs specified the register classes dirtied by userspace | ||
1893 | * struct kvm_sync_regs is architecture specific, as well as the | ||
1894 | * bits for kvm_valid_regs and kvm_dirty_regs | ||
1895 | */ | ||
1896 | __u64 kvm_valid_regs; | ||
1897 | __u64 kvm_dirty_regs; | ||
1898 | union { | ||
1899 | struct kvm_sync_regs regs; | ||
1900 | char padding[1024]; | ||
1901 | } s; | ||
1902 | |||
1903 | If KVM_CAP_SYNC_REGS is defined, these fields allow userspace to access | ||
1904 | certain guest registers without having to call SET/GET_*REGS. Thus we can | ||
1905 | avoid some system call overhead if userspace has to handle the exit. | ||
1906 | Userspace can query the validity of the structure by checking | ||
1907 | kvm_valid_regs for specific bits. These bits are architecture specific | ||
1908 | and usually define the validity of a groups of registers. (e.g. one bit | ||
1909 | for general purpose registers) | ||
1910 | |||
1696 | }; | 1911 | }; |
1697 | 1912 | ||
1698 | 6. Capabilities that can be enabled | 1913 | 6. Capabilities that can be enabled |
@@ -1741,3 +1956,45 @@ HTAB address part of SDR1 contains an HVA instead of a GPA, as PAPR keeps the | |||
1741 | HTAB invisible to the guest. | 1956 | HTAB invisible to the guest. |
1742 | 1957 | ||
1743 | When this capability is enabled, KVM_EXIT_PAPR_HCALL can occur. | 1958 | When this capability is enabled, KVM_EXIT_PAPR_HCALL can occur. |
1959 | |||
1960 | 6.3 KVM_CAP_SW_TLB | ||
1961 | |||
1962 | Architectures: ppc | ||
1963 | Parameters: args[0] is the address of a struct kvm_config_tlb | ||
1964 | Returns: 0 on success; -1 on error | ||
1965 | |||
1966 | struct kvm_config_tlb { | ||
1967 | __u64 params; | ||
1968 | __u64 array; | ||
1969 | __u32 mmu_type; | ||
1970 | __u32 array_len; | ||
1971 | }; | ||
1972 | |||
1973 | Configures the virtual CPU's TLB array, establishing a shared memory area | ||
1974 | between userspace and KVM. The "params" and "array" fields are userspace | ||
1975 | addresses of mmu-type-specific data structures. The "array_len" field is an | ||
1976 | safety mechanism, and should be set to the size in bytes of the memory that | ||
1977 | userspace has reserved for the array. It must be at least the size dictated | ||
1978 | by "mmu_type" and "params". | ||
1979 | |||
1980 | While KVM_RUN is active, the shared region is under control of KVM. Its | ||
1981 | contents are undefined, and any modification by userspace results in | ||
1982 | boundedly undefined behavior. | ||
1983 | |||
1984 | On return from KVM_RUN, the shared region will reflect the current state of | ||
1985 | the guest's TLB. If userspace makes any changes, it must call KVM_DIRTY_TLB | ||
1986 | to tell KVM which entries have been changed, prior to calling KVM_RUN again | ||
1987 | on this vcpu. | ||
1988 | |||
1989 | For mmu types KVM_MMU_FSL_BOOKE_NOHV and KVM_MMU_FSL_BOOKE_HV: | ||
1990 | - The "params" field is of type "struct kvm_book3e_206_tlb_params". | ||
1991 | - The "array" field points to an array of type "struct | ||
1992 | kvm_book3e_206_tlb_entry". | ||
1993 | - The array consists of all entries in the first TLB, followed by all | ||
1994 | entries in the second TLB. | ||
1995 | - Within a TLB, entries are ordered first by increasing set number. Within a | ||
1996 | set, entries are ordered by way (increasing ESEL). | ||
1997 | - The hash for determining set number in TLB0 is: (MAS2 >> 12) & (num_sets - 1) | ||
1998 | where "num_sets" is the tlb_sizes[] value divided by the tlb_ways[] value. | ||
1999 | - The tsize field of mas1 shall be set to 4K on TLB0, even though the | ||
2000 | hardware ignores this value for TLB0. | ||
diff --git a/Documentation/virtual/kvm/ppc-pv.txt b/Documentation/virtual/kvm/ppc-pv.txt index 2b7ce190cde4..6e7c37050930 100644 --- a/Documentation/virtual/kvm/ppc-pv.txt +++ b/Documentation/virtual/kvm/ppc-pv.txt | |||
@@ -81,28 +81,8 @@ additional registers to the magic page. If you add fields to the magic page, | |||
81 | also define a new hypercall feature to indicate that the host can give you more | 81 | also define a new hypercall feature to indicate that the host can give you more |
82 | registers. Only if the host supports the additional features, make use of them. | 82 | registers. Only if the host supports the additional features, make use of them. |
83 | 83 | ||
84 | The magic page has the following layout as described in | 84 | The magic page layout is described by struct kvm_vcpu_arch_shared |
85 | arch/powerpc/include/asm/kvm_para.h: | 85 | in arch/powerpc/include/asm/kvm_para.h. |
86 | |||
87 | struct kvm_vcpu_arch_shared { | ||
88 | __u64 scratch1; | ||
89 | __u64 scratch2; | ||
90 | __u64 scratch3; | ||
91 | __u64 critical; /* Guest may not get interrupts if == r1 */ | ||
92 | __u64 sprg0; | ||
93 | __u64 sprg1; | ||
94 | __u64 sprg2; | ||
95 | __u64 sprg3; | ||
96 | __u64 srr0; | ||
97 | __u64 srr1; | ||
98 | __u64 dar; | ||
99 | __u64 msr; | ||
100 | __u32 dsisr; | ||
101 | __u32 int_pending; /* Tells the guest if we have an interrupt */ | ||
102 | }; | ||
103 | |||
104 | Additions to the page must only occur at the end. Struct fields are always 32 | ||
105 | or 64 bit aligned, depending on them being 32 or 64 bit wide respectively. | ||
106 | 86 | ||
107 | Magic page features | 87 | Magic page features |
108 | =================== | 88 | =================== |
diff --git a/Documentation/vm/Makefile b/Documentation/vm/Makefile deleted file mode 100644 index 3fa4d0668864..000000000000 --- a/Documentation/vm/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := page-types hugepage-mmap hugepage-shm map_hugetlb | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/vm/cleancache.txt b/Documentation/vm/cleancache.txt index d5c615af10ba..142fbb0f325a 100644 --- a/Documentation/vm/cleancache.txt +++ b/Documentation/vm/cleancache.txt | |||
@@ -46,10 +46,11 @@ a negative return value indicates failure. A "put_page" will copy a | |||
46 | the pool id, a file key, and a page index into the file. (The combination | 46 | the pool id, a file key, and a page index into the file. (The combination |
47 | of a pool id, a file key, and an index is sometimes called a "handle".) | 47 | of a pool id, a file key, and an index is sometimes called a "handle".) |
48 | A "get_page" will copy the page, if found, from cleancache into kernel memory. | 48 | A "get_page" will copy the page, if found, from cleancache into kernel memory. |
49 | A "flush_page" will ensure the page no longer is present in cleancache; | 49 | An "invalidate_page" will ensure the page no longer is present in cleancache; |
50 | a "flush_inode" will flush all pages associated with the specified file; | 50 | an "invalidate_inode" will invalidate all pages associated with the specified |
51 | and, when a filesystem is unmounted, a "flush_fs" will flush all pages in | 51 | file; and, when a filesystem is unmounted, an "invalidate_fs" will invalidate |
52 | all files specified by the given pool id and also surrender the pool id. | 52 | all pages in all files specified by the given pool id and also surrender |
53 | the pool id. | ||
53 | 54 | ||
54 | An "init_shared_fs", like init_fs, obtains a pool id but tells cleancache | 55 | An "init_shared_fs", like init_fs, obtains a pool id but tells cleancache |
55 | to treat the pool as shared using a 128-bit UUID as a key. On systems | 56 | to treat the pool as shared using a 128-bit UUID as a key. On systems |
@@ -62,12 +63,12 @@ of the kernel (e.g. by "tools" that control cleancache). Or a | |||
62 | cleancache implementation can simply disable shared_init by always | 63 | cleancache implementation can simply disable shared_init by always |
63 | returning a negative value. | 64 | returning a negative value. |
64 | 65 | ||
65 | If a get_page is successful on a non-shared pool, the page is flushed (thus | 66 | If a get_page is successful on a non-shared pool, the page is invalidated |
66 | making cleancache an "exclusive" cache). On a shared pool, the page | 67 | (thus making cleancache an "exclusive" cache). On a shared pool, the page |
67 | is NOT flushed on a successful get_page so that it remains accessible to | 68 | is NOT invalidated on a successful get_page so that it remains accessible to |
68 | other sharers. The kernel is responsible for ensuring coherency between | 69 | other sharers. The kernel is responsible for ensuring coherency between |
69 | cleancache (shared or not), the page cache, and the filesystem, using | 70 | cleancache (shared or not), the page cache, and the filesystem, using |
70 | cleancache flush operations as required. | 71 | cleancache invalidate operations as required. |
71 | 72 | ||
72 | Note that cleancache must enforce put-put-get coherency and get-get | 73 | Note that cleancache must enforce put-put-get coherency and get-get |
73 | coherency. For the former, if two puts are made to the same handle but | 74 | coherency. For the former, if two puts are made to the same handle but |
@@ -77,20 +78,20 @@ if a get for a given handle fails, subsequent gets for that handle will | |||
77 | never succeed unless preceded by a successful put with that handle. | 78 | never succeed unless preceded by a successful put with that handle. |
78 | 79 | ||
79 | Last, cleancache provides no SMP serialization guarantees; if two | 80 | Last, cleancache provides no SMP serialization guarantees; if two |
80 | different Linux threads are simultaneously putting and flushing a page | 81 | different Linux threads are simultaneously putting and invalidating a page |
81 | with the same handle, the results are indeterminate. Callers must | 82 | with the same handle, the results are indeterminate. Callers must |
82 | lock the page to ensure serial behavior. | 83 | lock the page to ensure serial behavior. |
83 | 84 | ||
84 | CLEANCACHE PERFORMANCE METRICS | 85 | CLEANCACHE PERFORMANCE METRICS |
85 | 86 | ||
86 | Cleancache monitoring is done by sysfs files in the | 87 | If properly configured, monitoring of cleancache is done via debugfs in |
87 | /sys/kernel/mm/cleancache directory. The effectiveness of cleancache | 88 | the /sys/kernel/debug/mm/cleancache directory. The effectiveness of cleancache |
88 | can be measured (across all filesystems) with: | 89 | can be measured (across all filesystems) with: |
89 | 90 | ||
90 | succ_gets - number of gets that were successful | 91 | succ_gets - number of gets that were successful |
91 | failed_gets - number of gets that failed | 92 | failed_gets - number of gets that failed |
92 | puts - number of puts attempted (all "succeed") | 93 | puts - number of puts attempted (all "succeed") |
93 | flushes - number of flushes attempted | 94 | invalidates - number of invalidates attempted |
94 | 95 | ||
95 | A backend implementation may provide additional metrics. | 96 | A backend implementation may provide additional metrics. |
96 | 97 | ||
@@ -143,7 +144,7 @@ systems. | |||
143 | 144 | ||
144 | The core hooks for cleancache in VFS are in most cases a single line | 145 | The core hooks for cleancache in VFS are in most cases a single line |
145 | and the minimum set are placed precisely where needed to maintain | 146 | and the minimum set are placed precisely where needed to maintain |
146 | coherency (via cleancache_flush operations) between cleancache, | 147 | coherency (via cleancache_invalidate operations) between cleancache, |
147 | the page cache, and disk. All hooks compile into nothingness if | 148 | the page cache, and disk. All hooks compile into nothingness if |
148 | cleancache is config'ed off and turn into a function-pointer- | 149 | cleancache is config'ed off and turn into a function-pointer- |
149 | compare-to-NULL if config'ed on but no backend claims the ops | 150 | compare-to-NULL if config'ed on but no backend claims the ops |
@@ -184,15 +185,15 @@ or for real kernel-addressable RAM, it makes perfect sense for | |||
184 | transcendent memory. | 185 | transcendent memory. |
185 | 186 | ||
186 | 4) Why is non-shared cleancache "exclusive"? And where is the | 187 | 4) Why is non-shared cleancache "exclusive"? And where is the |
187 | page "flushed" after a "get"? (Minchan Kim) | 188 | page "invalidated" after a "get"? (Minchan Kim) |
188 | 189 | ||
189 | The main reason is to free up space in transcendent memory and | 190 | The main reason is to free up space in transcendent memory and |
190 | to avoid unnecessary cleancache_flush calls. If you want inclusive, | 191 | to avoid unnecessary cleancache_invalidate calls. If you want inclusive, |
191 | the page can be "put" immediately following the "get". If | 192 | the page can be "put" immediately following the "get". If |
192 | put-after-get for inclusive becomes common, the interface could | 193 | put-after-get for inclusive becomes common, the interface could |
193 | be easily extended to add a "get_no_flush" call. | 194 | be easily extended to add a "get_no_invalidate" call. |
194 | 195 | ||
195 | The flush is done by the cleancache backend implementation. | 196 | The invalidate is done by the cleancache backend implementation. |
196 | 197 | ||
197 | 5) What's the performance impact? | 198 | 5) What's the performance impact? |
198 | 199 | ||
@@ -222,7 +223,7 @@ Some points for a filesystem to consider: | |||
222 | as tmpfs should not enable cleancache) | 223 | as tmpfs should not enable cleancache) |
223 | - To ensure coherency/correctness, the FS must ensure that all | 224 | - To ensure coherency/correctness, the FS must ensure that all |
224 | file removal or truncation operations either go through VFS or | 225 | file removal or truncation operations either go through VFS or |
225 | add hooks to do the equivalent cleancache "flush" operations | 226 | add hooks to do the equivalent cleancache "invalidate" operations |
226 | - To ensure coherency/correctness, either inode numbers must | 227 | - To ensure coherency/correctness, either inode numbers must |
227 | be unique across the lifetime of the on-disk file OR the | 228 | be unique across the lifetime of the on-disk file OR the |
228 | FS must provide an "encode_fh" function. | 229 | FS must provide an "encode_fh" function. |
@@ -243,11 +244,11 @@ If cleancache would use the inode virtual address instead of | |||
243 | inode/filehandle, the pool id could be eliminated. But, this | 244 | inode/filehandle, the pool id could be eliminated. But, this |
244 | won't work because cleancache retains pagecache data pages | 245 | won't work because cleancache retains pagecache data pages |
245 | persistently even when the inode has been pruned from the | 246 | persistently even when the inode has been pruned from the |
246 | inode unused list, and only flushes the data page if the file | 247 | inode unused list, and only invalidates the data page if the file |
247 | gets removed/truncated. So if cleancache used the inode kva, | 248 | gets removed/truncated. So if cleancache used the inode kva, |
248 | there would be potential coherency issues if/when the inode | 249 | there would be potential coherency issues if/when the inode |
249 | kva is reused for a different file. Alternately, if cleancache | 250 | kva is reused for a different file. Alternately, if cleancache |
250 | flushed the pages when the inode kva was freed, much of the value | 251 | invalidated the pages when the inode kva was freed, much of the value |
251 | of cleancache would be lost because the cache of pages in cleanache | 252 | of cleancache would be lost because the cache of pages in cleanache |
252 | is potentially much larger than the kernel pagecache and is most | 253 | is potentially much larger than the kernel pagecache and is most |
253 | useful if the pages survive inode cache removal. | 254 | useful if the pages survive inode cache removal. |
diff --git a/Documentation/vm/hugepage-mmap.c b/Documentation/vm/hugepage-mmap.c deleted file mode 100644 index db0dd9a33d54..000000000000 --- a/Documentation/vm/hugepage-mmap.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * hugepage-mmap: | ||
3 | * | ||
4 | * Example of using huge page memory in a user application using the mmap | ||
5 | * system call. Before running this application, make sure that the | ||
6 | * administrator has mounted the hugetlbfs filesystem (on some directory | ||
7 | * like /mnt) using the command mount -t hugetlbfs nodev /mnt. In this | ||
8 | * example, the app is requesting memory of size 256MB that is backed by | ||
9 | * huge pages. | ||
10 | * | ||
11 | * For the ia64 architecture, the Linux kernel reserves Region number 4 for | ||
12 | * huge pages. That means that if one requires a fixed address, a huge page | ||
13 | * aligned address starting with 0x800000... will be required. If a fixed | ||
14 | * address is not required, the kernel will select an address in the proper | ||
15 | * range. | ||
16 | * Other architectures, such as ppc64, i386 or x86_64 are not so constrained. | ||
17 | */ | ||
18 | |||
19 | #include <stdlib.h> | ||
20 | #include <stdio.h> | ||
21 | #include <unistd.h> | ||
22 | #include <sys/mman.h> | ||
23 | #include <fcntl.h> | ||
24 | |||
25 | #define FILE_NAME "/mnt/hugepagefile" | ||
26 | #define LENGTH (256UL*1024*1024) | ||
27 | #define PROTECTION (PROT_READ | PROT_WRITE) | ||
28 | |||
29 | /* Only ia64 requires this */ | ||
30 | #ifdef __ia64__ | ||
31 | #define ADDR (void *)(0x8000000000000000UL) | ||
32 | #define FLAGS (MAP_SHARED | MAP_FIXED) | ||
33 | #else | ||
34 | #define ADDR (void *)(0x0UL) | ||
35 | #define FLAGS (MAP_SHARED) | ||
36 | #endif | ||
37 | |||
38 | static void check_bytes(char *addr) | ||
39 | { | ||
40 | printf("First hex is %x\n", *((unsigned int *)addr)); | ||
41 | } | ||
42 | |||
43 | static void write_bytes(char *addr) | ||
44 | { | ||
45 | unsigned long i; | ||
46 | |||
47 | for (i = 0; i < LENGTH; i++) | ||
48 | *(addr + i) = (char)i; | ||
49 | } | ||
50 | |||
51 | static void read_bytes(char *addr) | ||
52 | { | ||
53 | unsigned long i; | ||
54 | |||
55 | check_bytes(addr); | ||
56 | for (i = 0; i < LENGTH; i++) | ||
57 | if (*(addr + i) != (char)i) { | ||
58 | printf("Mismatch at %lu\n", i); | ||
59 | break; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | int main(void) | ||
64 | { | ||
65 | void *addr; | ||
66 | int fd; | ||
67 | |||
68 | fd = open(FILE_NAME, O_CREAT | O_RDWR, 0755); | ||
69 | if (fd < 0) { | ||
70 | perror("Open failed"); | ||
71 | exit(1); | ||
72 | } | ||
73 | |||
74 | addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, fd, 0); | ||
75 | if (addr == MAP_FAILED) { | ||
76 | perror("mmap"); | ||
77 | unlink(FILE_NAME); | ||
78 | exit(1); | ||
79 | } | ||
80 | |||
81 | printf("Returned address is %p\n", addr); | ||
82 | check_bytes(addr); | ||
83 | write_bytes(addr); | ||
84 | read_bytes(addr); | ||
85 | |||
86 | munmap(addr, LENGTH); | ||
87 | close(fd); | ||
88 | unlink(FILE_NAME); | ||
89 | |||
90 | return 0; | ||
91 | } | ||
diff --git a/Documentation/vm/hugepage-shm.c b/Documentation/vm/hugepage-shm.c deleted file mode 100644 index 07956d8592c9..000000000000 --- a/Documentation/vm/hugepage-shm.c +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * hugepage-shm: | ||
3 | * | ||
4 | * Example of using huge page memory in a user application using Sys V shared | ||
5 | * memory system calls. In this example the app is requesting 256MB of | ||
6 | * memory that is backed by huge pages. The application uses the flag | ||
7 | * SHM_HUGETLB in the shmget system call to inform the kernel that it is | ||
8 | * requesting huge pages. | ||
9 | * | ||
10 | * For the ia64 architecture, the Linux kernel reserves Region number 4 for | ||
11 | * huge pages. That means that if one requires a fixed address, a huge page | ||
12 | * aligned address starting with 0x800000... will be required. If a fixed | ||
13 | * address is not required, the kernel will select an address in the proper | ||
14 | * range. | ||
15 | * Other architectures, such as ppc64, i386 or x86_64 are not so constrained. | ||
16 | * | ||
17 | * Note: The default shared memory limit is quite low on many kernels, | ||
18 | * you may need to increase it via: | ||
19 | * | ||
20 | * echo 268435456 > /proc/sys/kernel/shmmax | ||
21 | * | ||
22 | * This will increase the maximum size per shared memory segment to 256MB. | ||
23 | * The other limit that you will hit eventually is shmall which is the | ||
24 | * total amount of shared memory in pages. To set it to 16GB on a system | ||
25 | * with a 4kB pagesize do: | ||
26 | * | ||
27 | * echo 4194304 > /proc/sys/kernel/shmall | ||
28 | */ | ||
29 | |||
30 | #include <stdlib.h> | ||
31 | #include <stdio.h> | ||
32 | #include <sys/types.h> | ||
33 | #include <sys/ipc.h> | ||
34 | #include <sys/shm.h> | ||
35 | #include <sys/mman.h> | ||
36 | |||
37 | #ifndef SHM_HUGETLB | ||
38 | #define SHM_HUGETLB 04000 | ||
39 | #endif | ||
40 | |||
41 | #define LENGTH (256UL*1024*1024) | ||
42 | |||
43 | #define dprintf(x) printf(x) | ||
44 | |||
45 | /* Only ia64 requires this */ | ||
46 | #ifdef __ia64__ | ||
47 | #define ADDR (void *)(0x8000000000000000UL) | ||
48 | #define SHMAT_FLAGS (SHM_RND) | ||
49 | #else | ||
50 | #define ADDR (void *)(0x0UL) | ||
51 | #define SHMAT_FLAGS (0) | ||
52 | #endif | ||
53 | |||
54 | int main(void) | ||
55 | { | ||
56 | int shmid; | ||
57 | unsigned long i; | ||
58 | char *shmaddr; | ||
59 | |||
60 | if ((shmid = shmget(2, LENGTH, | ||
61 | SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W)) < 0) { | ||
62 | perror("shmget"); | ||
63 | exit(1); | ||
64 | } | ||
65 | printf("shmid: 0x%x\n", shmid); | ||
66 | |||
67 | shmaddr = shmat(shmid, ADDR, SHMAT_FLAGS); | ||
68 | if (shmaddr == (char *)-1) { | ||
69 | perror("Shared memory attach failure"); | ||
70 | shmctl(shmid, IPC_RMID, NULL); | ||
71 | exit(2); | ||
72 | } | ||
73 | printf("shmaddr: %p\n", shmaddr); | ||
74 | |||
75 | dprintf("Starting the writes:\n"); | ||
76 | for (i = 0; i < LENGTH; i++) { | ||
77 | shmaddr[i] = (char)(i); | ||
78 | if (!(i % (1024 * 1024))) | ||
79 | dprintf("."); | ||
80 | } | ||
81 | dprintf("\n"); | ||
82 | |||
83 | dprintf("Starting the Check..."); | ||
84 | for (i = 0; i < LENGTH; i++) | ||
85 | if (shmaddr[i] != (char)i) | ||
86 | printf("\nIndex %lu mismatched\n", i); | ||
87 | dprintf("Done.\n"); | ||
88 | |||
89 | if (shmdt((const void *)shmaddr) != 0) { | ||
90 | perror("Detach failure"); | ||
91 | shmctl(shmid, IPC_RMID, NULL); | ||
92 | exit(3); | ||
93 | } | ||
94 | |||
95 | shmctl(shmid, IPC_RMID, NULL); | ||
96 | |||
97 | return 0; | ||
98 | } | ||
diff --git a/Documentation/vm/map_hugetlb.c b/Documentation/vm/map_hugetlb.c deleted file mode 100644 index eda1a6d3578a..000000000000 --- a/Documentation/vm/map_hugetlb.c +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /* | ||
2 | * Example of using hugepage memory in a user application using the mmap | ||
3 | * system call with MAP_HUGETLB flag. Before running this program make | ||
4 | * sure the administrator has allocated enough default sized huge pages | ||
5 | * to cover the 256 MB allocation. | ||
6 | * | ||
7 | * For ia64 architecture, Linux kernel reserves Region number 4 for hugepages. | ||
8 | * That means the addresses starting with 0x800000... will need to be | ||
9 | * specified. Specifying a fixed address is not required on ppc64, i386 | ||
10 | * or x86_64. | ||
11 | */ | ||
12 | #include <stdlib.h> | ||
13 | #include <stdio.h> | ||
14 | #include <unistd.h> | ||
15 | #include <sys/mman.h> | ||
16 | #include <fcntl.h> | ||
17 | |||
18 | #define LENGTH (256UL*1024*1024) | ||
19 | #define PROTECTION (PROT_READ | PROT_WRITE) | ||
20 | |||
21 | #ifndef MAP_HUGETLB | ||
22 | #define MAP_HUGETLB 0x40000 /* arch specific */ | ||
23 | #endif | ||
24 | |||
25 | /* Only ia64 requires this */ | ||
26 | #ifdef __ia64__ | ||
27 | #define ADDR (void *)(0x8000000000000000UL) | ||
28 | #define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_FIXED) | ||
29 | #else | ||
30 | #define ADDR (void *)(0x0UL) | ||
31 | #define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB) | ||
32 | #endif | ||
33 | |||
34 | static void check_bytes(char *addr) | ||
35 | { | ||
36 | printf("First hex is %x\n", *((unsigned int *)addr)); | ||
37 | } | ||
38 | |||
39 | static void write_bytes(char *addr) | ||
40 | { | ||
41 | unsigned long i; | ||
42 | |||
43 | for (i = 0; i < LENGTH; i++) | ||
44 | *(addr + i) = (char)i; | ||
45 | } | ||
46 | |||
47 | static void read_bytes(char *addr) | ||
48 | { | ||
49 | unsigned long i; | ||
50 | |||
51 | check_bytes(addr); | ||
52 | for (i = 0; i < LENGTH; i++) | ||
53 | if (*(addr + i) != (char)i) { | ||
54 | printf("Mismatch at %lu\n", i); | ||
55 | break; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | int main(void) | ||
60 | { | ||
61 | void *addr; | ||
62 | |||
63 | addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, 0, 0); | ||
64 | if (addr == MAP_FAILED) { | ||
65 | perror("mmap"); | ||
66 | exit(1); | ||
67 | } | ||
68 | |||
69 | printf("Returned address is %p\n", addr); | ||
70 | check_bytes(addr); | ||
71 | write_bytes(addr); | ||
72 | read_bytes(addr); | ||
73 | |||
74 | munmap(addr, LENGTH); | ||
75 | |||
76 | return 0; | ||
77 | } | ||
diff --git a/Documentation/vm/page-types.c b/Documentation/vm/page-types.c deleted file mode 100644 index 0b13f02d4059..000000000000 --- a/Documentation/vm/page-types.c +++ /dev/null | |||
@@ -1,1102 +0,0 @@ | |||
1 | /* | ||
2 | * page-types: Tool for querying page flags | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the Free | ||
6 | * Software Foundation; version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should find a copy of v2 of the GNU General Public License somewhere on | ||
14 | * your Linux system; if not, write to the Free Software Foundation, Inc., 59 | ||
15 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
16 | * | ||
17 | * Copyright (C) 2009 Intel corporation | ||
18 | * | ||
19 | * Authors: Wu Fengguang <fengguang.wu@intel.com> | ||
20 | */ | ||
21 | |||
22 | #define _LARGEFILE64_SOURCE | ||
23 | #include <stdio.h> | ||
24 | #include <stdlib.h> | ||
25 | #include <unistd.h> | ||
26 | #include <stdint.h> | ||
27 | #include <stdarg.h> | ||
28 | #include <string.h> | ||
29 | #include <getopt.h> | ||
30 | #include <limits.h> | ||
31 | #include <assert.h> | ||
32 | #include <sys/types.h> | ||
33 | #include <sys/errno.h> | ||
34 | #include <sys/fcntl.h> | ||
35 | #include <sys/mount.h> | ||
36 | #include <sys/statfs.h> | ||
37 | #include "../../include/linux/magic.h" | ||
38 | |||
39 | |||
40 | #ifndef MAX_PATH | ||
41 | # define MAX_PATH 256 | ||
42 | #endif | ||
43 | |||
44 | #ifndef STR | ||
45 | # define _STR(x) #x | ||
46 | # define STR(x) _STR(x) | ||
47 | #endif | ||
48 | |||
49 | /* | ||
50 | * pagemap kernel ABI bits | ||
51 | */ | ||
52 | |||
53 | #define PM_ENTRY_BYTES sizeof(uint64_t) | ||
54 | #define PM_STATUS_BITS 3 | ||
55 | #define PM_STATUS_OFFSET (64 - PM_STATUS_BITS) | ||
56 | #define PM_STATUS_MASK (((1LL << PM_STATUS_BITS) - 1) << PM_STATUS_OFFSET) | ||
57 | #define PM_STATUS(nr) (((nr) << PM_STATUS_OFFSET) & PM_STATUS_MASK) | ||
58 | #define PM_PSHIFT_BITS 6 | ||
59 | #define PM_PSHIFT_OFFSET (PM_STATUS_OFFSET - PM_PSHIFT_BITS) | ||
60 | #define PM_PSHIFT_MASK (((1LL << PM_PSHIFT_BITS) - 1) << PM_PSHIFT_OFFSET) | ||
61 | #define PM_PSHIFT(x) (((u64) (x) << PM_PSHIFT_OFFSET) & PM_PSHIFT_MASK) | ||
62 | #define PM_PFRAME_MASK ((1LL << PM_PSHIFT_OFFSET) - 1) | ||
63 | #define PM_PFRAME(x) ((x) & PM_PFRAME_MASK) | ||
64 | |||
65 | #define PM_PRESENT PM_STATUS(4LL) | ||
66 | #define PM_SWAP PM_STATUS(2LL) | ||
67 | |||
68 | |||
69 | /* | ||
70 | * kernel page flags | ||
71 | */ | ||
72 | |||
73 | #define KPF_BYTES 8 | ||
74 | #define PROC_KPAGEFLAGS "/proc/kpageflags" | ||
75 | |||
76 | /* copied from kpageflags_read() */ | ||
77 | #define KPF_LOCKED 0 | ||
78 | #define KPF_ERROR 1 | ||
79 | #define KPF_REFERENCED 2 | ||
80 | #define KPF_UPTODATE 3 | ||
81 | #define KPF_DIRTY 4 | ||
82 | #define KPF_LRU 5 | ||
83 | #define KPF_ACTIVE 6 | ||
84 | #define KPF_SLAB 7 | ||
85 | #define KPF_WRITEBACK 8 | ||
86 | #define KPF_RECLAIM 9 | ||
87 | #define KPF_BUDDY 10 | ||
88 | |||
89 | /* [11-20] new additions in 2.6.31 */ | ||
90 | #define KPF_MMAP 11 | ||
91 | #define KPF_ANON 12 | ||
92 | #define KPF_SWAPCACHE 13 | ||
93 | #define KPF_SWAPBACKED 14 | ||
94 | #define KPF_COMPOUND_HEAD 15 | ||
95 | #define KPF_COMPOUND_TAIL 16 | ||
96 | #define KPF_HUGE 17 | ||
97 | #define KPF_UNEVICTABLE 18 | ||
98 | #define KPF_HWPOISON 19 | ||
99 | #define KPF_NOPAGE 20 | ||
100 | #define KPF_KSM 21 | ||
101 | #define KPF_THP 22 | ||
102 | |||
103 | /* [32-] kernel hacking assistances */ | ||
104 | #define KPF_RESERVED 32 | ||
105 | #define KPF_MLOCKED 33 | ||
106 | #define KPF_MAPPEDTODISK 34 | ||
107 | #define KPF_PRIVATE 35 | ||
108 | #define KPF_PRIVATE_2 36 | ||
109 | #define KPF_OWNER_PRIVATE 37 | ||
110 | #define KPF_ARCH 38 | ||
111 | #define KPF_UNCACHED 39 | ||
112 | |||
113 | /* [48-] take some arbitrary free slots for expanding overloaded flags | ||
114 | * not part of kernel API | ||
115 | */ | ||
116 | #define KPF_READAHEAD 48 | ||
117 | #define KPF_SLOB_FREE 49 | ||
118 | #define KPF_SLUB_FROZEN 50 | ||
119 | #define KPF_SLUB_DEBUG 51 | ||
120 | |||
121 | #define KPF_ALL_BITS ((uint64_t)~0ULL) | ||
122 | #define KPF_HACKERS_BITS (0xffffULL << 32) | ||
123 | #define KPF_OVERLOADED_BITS (0xffffULL << 48) | ||
124 | #define BIT(name) (1ULL << KPF_##name) | ||
125 | #define BITS_COMPOUND (BIT(COMPOUND_HEAD) | BIT(COMPOUND_TAIL)) | ||
126 | |||
127 | static const char *page_flag_names[] = { | ||
128 | [KPF_LOCKED] = "L:locked", | ||
129 | [KPF_ERROR] = "E:error", | ||
130 | [KPF_REFERENCED] = "R:referenced", | ||
131 | [KPF_UPTODATE] = "U:uptodate", | ||
132 | [KPF_DIRTY] = "D:dirty", | ||
133 | [KPF_LRU] = "l:lru", | ||
134 | [KPF_ACTIVE] = "A:active", | ||
135 | [KPF_SLAB] = "S:slab", | ||
136 | [KPF_WRITEBACK] = "W:writeback", | ||
137 | [KPF_RECLAIM] = "I:reclaim", | ||
138 | [KPF_BUDDY] = "B:buddy", | ||
139 | |||
140 | [KPF_MMAP] = "M:mmap", | ||
141 | [KPF_ANON] = "a:anonymous", | ||
142 | [KPF_SWAPCACHE] = "s:swapcache", | ||
143 | [KPF_SWAPBACKED] = "b:swapbacked", | ||
144 | [KPF_COMPOUND_HEAD] = "H:compound_head", | ||
145 | [KPF_COMPOUND_TAIL] = "T:compound_tail", | ||
146 | [KPF_HUGE] = "G:huge", | ||
147 | [KPF_UNEVICTABLE] = "u:unevictable", | ||
148 | [KPF_HWPOISON] = "X:hwpoison", | ||
149 | [KPF_NOPAGE] = "n:nopage", | ||
150 | [KPF_KSM] = "x:ksm", | ||
151 | [KPF_THP] = "t:thp", | ||
152 | |||
153 | [KPF_RESERVED] = "r:reserved", | ||
154 | [KPF_MLOCKED] = "m:mlocked", | ||
155 | [KPF_MAPPEDTODISK] = "d:mappedtodisk", | ||
156 | [KPF_PRIVATE] = "P:private", | ||
157 | [KPF_PRIVATE_2] = "p:private_2", | ||
158 | [KPF_OWNER_PRIVATE] = "O:owner_private", | ||
159 | [KPF_ARCH] = "h:arch", | ||
160 | [KPF_UNCACHED] = "c:uncached", | ||
161 | |||
162 | [KPF_READAHEAD] = "I:readahead", | ||
163 | [KPF_SLOB_FREE] = "P:slob_free", | ||
164 | [KPF_SLUB_FROZEN] = "A:slub_frozen", | ||
165 | [KPF_SLUB_DEBUG] = "E:slub_debug", | ||
166 | }; | ||
167 | |||
168 | |||
169 | static const char *debugfs_known_mountpoints[] = { | ||
170 | "/sys/kernel/debug", | ||
171 | "/debug", | ||
172 | 0, | ||
173 | }; | ||
174 | |||
175 | /* | ||
176 | * data structures | ||
177 | */ | ||
178 | |||
179 | static int opt_raw; /* for kernel developers */ | ||
180 | static int opt_list; /* list pages (in ranges) */ | ||
181 | static int opt_no_summary; /* don't show summary */ | ||
182 | static pid_t opt_pid; /* process to walk */ | ||
183 | |||
184 | #define MAX_ADDR_RANGES 1024 | ||
185 | static int nr_addr_ranges; | ||
186 | static unsigned long opt_offset[MAX_ADDR_RANGES]; | ||
187 | static unsigned long opt_size[MAX_ADDR_RANGES]; | ||
188 | |||
189 | #define MAX_VMAS 10240 | ||
190 | static int nr_vmas; | ||
191 | static unsigned long pg_start[MAX_VMAS]; | ||
192 | static unsigned long pg_end[MAX_VMAS]; | ||
193 | |||
194 | #define MAX_BIT_FILTERS 64 | ||
195 | static int nr_bit_filters; | ||
196 | static uint64_t opt_mask[MAX_BIT_FILTERS]; | ||
197 | static uint64_t opt_bits[MAX_BIT_FILTERS]; | ||
198 | |||
199 | static int page_size; | ||
200 | |||
201 | static int pagemap_fd; | ||
202 | static int kpageflags_fd; | ||
203 | |||
204 | static int opt_hwpoison; | ||
205 | static int opt_unpoison; | ||
206 | |||
207 | static char hwpoison_debug_fs[MAX_PATH+1]; | ||
208 | static int hwpoison_inject_fd; | ||
209 | static int hwpoison_forget_fd; | ||
210 | |||
211 | #define HASH_SHIFT 13 | ||
212 | #define HASH_SIZE (1 << HASH_SHIFT) | ||
213 | #define HASH_MASK (HASH_SIZE - 1) | ||
214 | #define HASH_KEY(flags) (flags & HASH_MASK) | ||
215 | |||
216 | static unsigned long total_pages; | ||
217 | static unsigned long nr_pages[HASH_SIZE]; | ||
218 | static uint64_t page_flags[HASH_SIZE]; | ||
219 | |||
220 | |||
221 | /* | ||
222 | * helper functions | ||
223 | */ | ||
224 | |||
225 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
226 | |||
227 | #define min_t(type, x, y) ({ \ | ||
228 | type __min1 = (x); \ | ||
229 | type __min2 = (y); \ | ||
230 | __min1 < __min2 ? __min1 : __min2; }) | ||
231 | |||
232 | #define max_t(type, x, y) ({ \ | ||
233 | type __max1 = (x); \ | ||
234 | type __max2 = (y); \ | ||
235 | __max1 > __max2 ? __max1 : __max2; }) | ||
236 | |||
237 | static unsigned long pages2mb(unsigned long pages) | ||
238 | { | ||
239 | return (pages * page_size) >> 20; | ||
240 | } | ||
241 | |||
242 | static void fatal(const char *x, ...) | ||
243 | { | ||
244 | va_list ap; | ||
245 | |||
246 | va_start(ap, x); | ||
247 | vfprintf(stderr, x, ap); | ||
248 | va_end(ap); | ||
249 | exit(EXIT_FAILURE); | ||
250 | } | ||
251 | |||
252 | static int checked_open(const char *pathname, int flags) | ||
253 | { | ||
254 | int fd = open(pathname, flags); | ||
255 | |||
256 | if (fd < 0) { | ||
257 | perror(pathname); | ||
258 | exit(EXIT_FAILURE); | ||
259 | } | ||
260 | |||
261 | return fd; | ||
262 | } | ||
263 | |||
264 | /* | ||
265 | * pagemap/kpageflags routines | ||
266 | */ | ||
267 | |||
268 | static unsigned long do_u64_read(int fd, char *name, | ||
269 | uint64_t *buf, | ||
270 | unsigned long index, | ||
271 | unsigned long count) | ||
272 | { | ||
273 | long bytes; | ||
274 | |||
275 | if (index > ULONG_MAX / 8) | ||
276 | fatal("index overflow: %lu\n", index); | ||
277 | |||
278 | if (lseek(fd, index * 8, SEEK_SET) < 0) { | ||
279 | perror(name); | ||
280 | exit(EXIT_FAILURE); | ||
281 | } | ||
282 | |||
283 | bytes = read(fd, buf, count * 8); | ||
284 | if (bytes < 0) { | ||
285 | perror(name); | ||
286 | exit(EXIT_FAILURE); | ||
287 | } | ||
288 | if (bytes % 8) | ||
289 | fatal("partial read: %lu bytes\n", bytes); | ||
290 | |||
291 | return bytes / 8; | ||
292 | } | ||
293 | |||
294 | static unsigned long kpageflags_read(uint64_t *buf, | ||
295 | unsigned long index, | ||
296 | unsigned long pages) | ||
297 | { | ||
298 | return do_u64_read(kpageflags_fd, PROC_KPAGEFLAGS, buf, index, pages); | ||
299 | } | ||
300 | |||
301 | static unsigned long pagemap_read(uint64_t *buf, | ||
302 | unsigned long index, | ||
303 | unsigned long pages) | ||
304 | { | ||
305 | return do_u64_read(pagemap_fd, "/proc/pid/pagemap", buf, index, pages); | ||
306 | } | ||
307 | |||
308 | static unsigned long pagemap_pfn(uint64_t val) | ||
309 | { | ||
310 | unsigned long pfn; | ||
311 | |||
312 | if (val & PM_PRESENT) | ||
313 | pfn = PM_PFRAME(val); | ||
314 | else | ||
315 | pfn = 0; | ||
316 | |||
317 | return pfn; | ||
318 | } | ||
319 | |||
320 | |||
321 | /* | ||
322 | * page flag names | ||
323 | */ | ||
324 | |||
325 | static char *page_flag_name(uint64_t flags) | ||
326 | { | ||
327 | static char buf[65]; | ||
328 | int present; | ||
329 | int i, j; | ||
330 | |||
331 | for (i = 0, j = 0; i < ARRAY_SIZE(page_flag_names); i++) { | ||
332 | present = (flags >> i) & 1; | ||
333 | if (!page_flag_names[i]) { | ||
334 | if (present) | ||
335 | fatal("unknown flag bit %d\n", i); | ||
336 | continue; | ||
337 | } | ||
338 | buf[j++] = present ? page_flag_names[i][0] : '_'; | ||
339 | } | ||
340 | |||
341 | return buf; | ||
342 | } | ||
343 | |||
344 | static char *page_flag_longname(uint64_t flags) | ||
345 | { | ||
346 | static char buf[1024]; | ||
347 | int i, n; | ||
348 | |||
349 | for (i = 0, n = 0; i < ARRAY_SIZE(page_flag_names); i++) { | ||
350 | if (!page_flag_names[i]) | ||
351 | continue; | ||
352 | if ((flags >> i) & 1) | ||
353 | n += snprintf(buf + n, sizeof(buf) - n, "%s,", | ||
354 | page_flag_names[i] + 2); | ||
355 | } | ||
356 | if (n) | ||
357 | n--; | ||
358 | buf[n] = '\0'; | ||
359 | |||
360 | return buf; | ||
361 | } | ||
362 | |||
363 | |||
364 | /* | ||
365 | * page list and summary | ||
366 | */ | ||
367 | |||
368 | static void show_page_range(unsigned long voffset, | ||
369 | unsigned long offset, uint64_t flags) | ||
370 | { | ||
371 | static uint64_t flags0; | ||
372 | static unsigned long voff; | ||
373 | static unsigned long index; | ||
374 | static unsigned long count; | ||
375 | |||
376 | if (flags == flags0 && offset == index + count && | ||
377 | (!opt_pid || voffset == voff + count)) { | ||
378 | count++; | ||
379 | return; | ||
380 | } | ||
381 | |||
382 | if (count) { | ||
383 | if (opt_pid) | ||
384 | printf("%lx\t", voff); | ||
385 | printf("%lx\t%lx\t%s\n", | ||
386 | index, count, page_flag_name(flags0)); | ||
387 | } | ||
388 | |||
389 | flags0 = flags; | ||
390 | index = offset; | ||
391 | voff = voffset; | ||
392 | count = 1; | ||
393 | } | ||
394 | |||
395 | static void show_page(unsigned long voffset, | ||
396 | unsigned long offset, uint64_t flags) | ||
397 | { | ||
398 | if (opt_pid) | ||
399 | printf("%lx\t", voffset); | ||
400 | printf("%lx\t%s\n", offset, page_flag_name(flags)); | ||
401 | } | ||
402 | |||
403 | static void show_summary(void) | ||
404 | { | ||
405 | int i; | ||
406 | |||
407 | printf(" flags\tpage-count MB" | ||
408 | " symbolic-flags\t\t\tlong-symbolic-flags\n"); | ||
409 | |||
410 | for (i = 0; i < ARRAY_SIZE(nr_pages); i++) { | ||
411 | if (nr_pages[i]) | ||
412 | printf("0x%016llx\t%10lu %8lu %s\t%s\n", | ||
413 | (unsigned long long)page_flags[i], | ||
414 | nr_pages[i], | ||
415 | pages2mb(nr_pages[i]), | ||
416 | page_flag_name(page_flags[i]), | ||
417 | page_flag_longname(page_flags[i])); | ||
418 | } | ||
419 | |||
420 | printf(" total\t%10lu %8lu\n", | ||
421 | total_pages, pages2mb(total_pages)); | ||
422 | } | ||
423 | |||
424 | |||
425 | /* | ||
426 | * page flag filters | ||
427 | */ | ||
428 | |||
429 | static int bit_mask_ok(uint64_t flags) | ||
430 | { | ||
431 | int i; | ||
432 | |||
433 | for (i = 0; i < nr_bit_filters; i++) { | ||
434 | if (opt_bits[i] == KPF_ALL_BITS) { | ||
435 | if ((flags & opt_mask[i]) == 0) | ||
436 | return 0; | ||
437 | } else { | ||
438 | if ((flags & opt_mask[i]) != opt_bits[i]) | ||
439 | return 0; | ||
440 | } | ||
441 | } | ||
442 | |||
443 | return 1; | ||
444 | } | ||
445 | |||
446 | static uint64_t expand_overloaded_flags(uint64_t flags) | ||
447 | { | ||
448 | /* SLOB/SLUB overload several page flags */ | ||
449 | if (flags & BIT(SLAB)) { | ||
450 | if (flags & BIT(PRIVATE)) | ||
451 | flags ^= BIT(PRIVATE) | BIT(SLOB_FREE); | ||
452 | if (flags & BIT(ACTIVE)) | ||
453 | flags ^= BIT(ACTIVE) | BIT(SLUB_FROZEN); | ||
454 | if (flags & BIT(ERROR)) | ||
455 | flags ^= BIT(ERROR) | BIT(SLUB_DEBUG); | ||
456 | } | ||
457 | |||
458 | /* PG_reclaim is overloaded as PG_readahead in the read path */ | ||
459 | if ((flags & (BIT(RECLAIM) | BIT(WRITEBACK))) == BIT(RECLAIM)) | ||
460 | flags ^= BIT(RECLAIM) | BIT(READAHEAD); | ||
461 | |||
462 | return flags; | ||
463 | } | ||
464 | |||
465 | static uint64_t well_known_flags(uint64_t flags) | ||
466 | { | ||
467 | /* hide flags intended only for kernel hacker */ | ||
468 | flags &= ~KPF_HACKERS_BITS; | ||
469 | |||
470 | /* hide non-hugeTLB compound pages */ | ||
471 | if ((flags & BITS_COMPOUND) && !(flags & BIT(HUGE))) | ||
472 | flags &= ~BITS_COMPOUND; | ||
473 | |||
474 | return flags; | ||
475 | } | ||
476 | |||
477 | static uint64_t kpageflags_flags(uint64_t flags) | ||
478 | { | ||
479 | flags = expand_overloaded_flags(flags); | ||
480 | |||
481 | if (!opt_raw) | ||
482 | flags = well_known_flags(flags); | ||
483 | |||
484 | return flags; | ||
485 | } | ||
486 | |||
487 | /* verify that a mountpoint is actually a debugfs instance */ | ||
488 | static int debugfs_valid_mountpoint(const char *debugfs) | ||
489 | { | ||
490 | struct statfs st_fs; | ||
491 | |||
492 | if (statfs(debugfs, &st_fs) < 0) | ||
493 | return -ENOENT; | ||
494 | else if (st_fs.f_type != (long) DEBUGFS_MAGIC) | ||
495 | return -ENOENT; | ||
496 | |||
497 | return 0; | ||
498 | } | ||
499 | |||
500 | /* find the path to the mounted debugfs */ | ||
501 | static const char *debugfs_find_mountpoint(void) | ||
502 | { | ||
503 | const char **ptr; | ||
504 | char type[100]; | ||
505 | FILE *fp; | ||
506 | |||
507 | ptr = debugfs_known_mountpoints; | ||
508 | while (*ptr) { | ||
509 | if (debugfs_valid_mountpoint(*ptr) == 0) { | ||
510 | strcpy(hwpoison_debug_fs, *ptr); | ||
511 | return hwpoison_debug_fs; | ||
512 | } | ||
513 | ptr++; | ||
514 | } | ||
515 | |||
516 | /* give up and parse /proc/mounts */ | ||
517 | fp = fopen("/proc/mounts", "r"); | ||
518 | if (fp == NULL) | ||
519 | perror("Can't open /proc/mounts for read"); | ||
520 | |||
521 | while (fscanf(fp, "%*s %" | ||
522 | STR(MAX_PATH) | ||
523 | "s %99s %*s %*d %*d\n", | ||
524 | hwpoison_debug_fs, type) == 2) { | ||
525 | if (strcmp(type, "debugfs") == 0) | ||
526 | break; | ||
527 | } | ||
528 | fclose(fp); | ||
529 | |||
530 | if (strcmp(type, "debugfs") != 0) | ||
531 | return NULL; | ||
532 | |||
533 | return hwpoison_debug_fs; | ||
534 | } | ||
535 | |||
536 | /* mount the debugfs somewhere if it's not mounted */ | ||
537 | |||
538 | static void debugfs_mount(void) | ||
539 | { | ||
540 | const char **ptr; | ||
541 | |||
542 | /* see if it's already mounted */ | ||
543 | if (debugfs_find_mountpoint()) | ||
544 | return; | ||
545 | |||
546 | ptr = debugfs_known_mountpoints; | ||
547 | while (*ptr) { | ||
548 | if (mount(NULL, *ptr, "debugfs", 0, NULL) == 0) { | ||
549 | /* save the mountpoint */ | ||
550 | strcpy(hwpoison_debug_fs, *ptr); | ||
551 | break; | ||
552 | } | ||
553 | ptr++; | ||
554 | } | ||
555 | |||
556 | if (*ptr == NULL) { | ||
557 | perror("mount debugfs"); | ||
558 | exit(EXIT_FAILURE); | ||
559 | } | ||
560 | } | ||
561 | |||
562 | /* | ||
563 | * page actions | ||
564 | */ | ||
565 | |||
566 | static void prepare_hwpoison_fd(void) | ||
567 | { | ||
568 | char buf[MAX_PATH + 1]; | ||
569 | |||
570 | debugfs_mount(); | ||
571 | |||
572 | if (opt_hwpoison && !hwpoison_inject_fd) { | ||
573 | snprintf(buf, MAX_PATH, "%s/hwpoison/corrupt-pfn", | ||
574 | hwpoison_debug_fs); | ||
575 | hwpoison_inject_fd = checked_open(buf, O_WRONLY); | ||
576 | } | ||
577 | |||
578 | if (opt_unpoison && !hwpoison_forget_fd) { | ||
579 | snprintf(buf, MAX_PATH, "%s/hwpoison/unpoison-pfn", | ||
580 | hwpoison_debug_fs); | ||
581 | hwpoison_forget_fd = checked_open(buf, O_WRONLY); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | static int hwpoison_page(unsigned long offset) | ||
586 | { | ||
587 | char buf[100]; | ||
588 | int len; | ||
589 | |||
590 | len = sprintf(buf, "0x%lx\n", offset); | ||
591 | len = write(hwpoison_inject_fd, buf, len); | ||
592 | if (len < 0) { | ||
593 | perror("hwpoison inject"); | ||
594 | return len; | ||
595 | } | ||
596 | return 0; | ||
597 | } | ||
598 | |||
599 | static int unpoison_page(unsigned long offset) | ||
600 | { | ||
601 | char buf[100]; | ||
602 | int len; | ||
603 | |||
604 | len = sprintf(buf, "0x%lx\n", offset); | ||
605 | len = write(hwpoison_forget_fd, buf, len); | ||
606 | if (len < 0) { | ||
607 | perror("hwpoison forget"); | ||
608 | return len; | ||
609 | } | ||
610 | return 0; | ||
611 | } | ||
612 | |||
613 | /* | ||
614 | * page frame walker | ||
615 | */ | ||
616 | |||
617 | static int hash_slot(uint64_t flags) | ||
618 | { | ||
619 | int k = HASH_KEY(flags); | ||
620 | int i; | ||
621 | |||
622 | /* Explicitly reserve slot 0 for flags 0: the following logic | ||
623 | * cannot distinguish an unoccupied slot from slot (flags==0). | ||
624 | */ | ||
625 | if (flags == 0) | ||
626 | return 0; | ||
627 | |||
628 | /* search through the remaining (HASH_SIZE-1) slots */ | ||
629 | for (i = 1; i < ARRAY_SIZE(page_flags); i++, k++) { | ||
630 | if (!k || k >= ARRAY_SIZE(page_flags)) | ||
631 | k = 1; | ||
632 | if (page_flags[k] == 0) { | ||
633 | page_flags[k] = flags; | ||
634 | return k; | ||
635 | } | ||
636 | if (page_flags[k] == flags) | ||
637 | return k; | ||
638 | } | ||
639 | |||
640 | fatal("hash table full: bump up HASH_SHIFT?\n"); | ||
641 | exit(EXIT_FAILURE); | ||
642 | } | ||
643 | |||
644 | static void add_page(unsigned long voffset, | ||
645 | unsigned long offset, uint64_t flags) | ||
646 | { | ||
647 | flags = kpageflags_flags(flags); | ||
648 | |||
649 | if (!bit_mask_ok(flags)) | ||
650 | return; | ||
651 | |||
652 | if (opt_hwpoison) | ||
653 | hwpoison_page(offset); | ||
654 | if (opt_unpoison) | ||
655 | unpoison_page(offset); | ||
656 | |||
657 | if (opt_list == 1) | ||
658 | show_page_range(voffset, offset, flags); | ||
659 | else if (opt_list == 2) | ||
660 | show_page(voffset, offset, flags); | ||
661 | |||
662 | nr_pages[hash_slot(flags)]++; | ||
663 | total_pages++; | ||
664 | } | ||
665 | |||
666 | #define KPAGEFLAGS_BATCH (64 << 10) /* 64k pages */ | ||
667 | static void walk_pfn(unsigned long voffset, | ||
668 | unsigned long index, | ||
669 | unsigned long count) | ||
670 | { | ||
671 | uint64_t buf[KPAGEFLAGS_BATCH]; | ||
672 | unsigned long batch; | ||
673 | long pages; | ||
674 | unsigned long i; | ||
675 | |||
676 | while (count) { | ||
677 | batch = min_t(unsigned long, count, KPAGEFLAGS_BATCH); | ||
678 | pages = kpageflags_read(buf, index, batch); | ||
679 | if (pages == 0) | ||
680 | break; | ||
681 | |||
682 | for (i = 0; i < pages; i++) | ||
683 | add_page(voffset + i, index + i, buf[i]); | ||
684 | |||
685 | index += pages; | ||
686 | count -= pages; | ||
687 | } | ||
688 | } | ||
689 | |||
690 | #define PAGEMAP_BATCH (64 << 10) | ||
691 | static void walk_vma(unsigned long index, unsigned long count) | ||
692 | { | ||
693 | uint64_t buf[PAGEMAP_BATCH]; | ||
694 | unsigned long batch; | ||
695 | unsigned long pages; | ||
696 | unsigned long pfn; | ||
697 | unsigned long i; | ||
698 | |||
699 | while (count) { | ||
700 | batch = min_t(unsigned long, count, PAGEMAP_BATCH); | ||
701 | pages = pagemap_read(buf, index, batch); | ||
702 | if (pages == 0) | ||
703 | break; | ||
704 | |||
705 | for (i = 0; i < pages; i++) { | ||
706 | pfn = pagemap_pfn(buf[i]); | ||
707 | if (pfn) | ||
708 | walk_pfn(index + i, pfn, 1); | ||
709 | } | ||
710 | |||
711 | index += pages; | ||
712 | count -= pages; | ||
713 | } | ||
714 | } | ||
715 | |||
716 | static void walk_task(unsigned long index, unsigned long count) | ||
717 | { | ||
718 | const unsigned long end = index + count; | ||
719 | unsigned long start; | ||
720 | int i = 0; | ||
721 | |||
722 | while (index < end) { | ||
723 | |||
724 | while (pg_end[i] <= index) | ||
725 | if (++i >= nr_vmas) | ||
726 | return; | ||
727 | if (pg_start[i] >= end) | ||
728 | return; | ||
729 | |||
730 | start = max_t(unsigned long, pg_start[i], index); | ||
731 | index = min_t(unsigned long, pg_end[i], end); | ||
732 | |||
733 | assert(start < index); | ||
734 | walk_vma(start, index - start); | ||
735 | } | ||
736 | } | ||
737 | |||
738 | static void add_addr_range(unsigned long offset, unsigned long size) | ||
739 | { | ||
740 | if (nr_addr_ranges >= MAX_ADDR_RANGES) | ||
741 | fatal("too many addr ranges\n"); | ||
742 | |||
743 | opt_offset[nr_addr_ranges] = offset; | ||
744 | opt_size[nr_addr_ranges] = min_t(unsigned long, size, ULONG_MAX-offset); | ||
745 | nr_addr_ranges++; | ||
746 | } | ||
747 | |||
748 | static void walk_addr_ranges(void) | ||
749 | { | ||
750 | int i; | ||
751 | |||
752 | kpageflags_fd = checked_open(PROC_KPAGEFLAGS, O_RDONLY); | ||
753 | |||
754 | if (!nr_addr_ranges) | ||
755 | add_addr_range(0, ULONG_MAX); | ||
756 | |||
757 | for (i = 0; i < nr_addr_ranges; i++) | ||
758 | if (!opt_pid) | ||
759 | walk_pfn(0, opt_offset[i], opt_size[i]); | ||
760 | else | ||
761 | walk_task(opt_offset[i], opt_size[i]); | ||
762 | |||
763 | close(kpageflags_fd); | ||
764 | } | ||
765 | |||
766 | |||
767 | /* | ||
768 | * user interface | ||
769 | */ | ||
770 | |||
771 | static const char *page_flag_type(uint64_t flag) | ||
772 | { | ||
773 | if (flag & KPF_HACKERS_BITS) | ||
774 | return "(r)"; | ||
775 | if (flag & KPF_OVERLOADED_BITS) | ||
776 | return "(o)"; | ||
777 | return " "; | ||
778 | } | ||
779 | |||
780 | static void usage(void) | ||
781 | { | ||
782 | int i, j; | ||
783 | |||
784 | printf( | ||
785 | "page-types [options]\n" | ||
786 | " -r|--raw Raw mode, for kernel developers\n" | ||
787 | " -d|--describe flags Describe flags\n" | ||
788 | " -a|--addr addr-spec Walk a range of pages\n" | ||
789 | " -b|--bits bits-spec Walk pages with specified bits\n" | ||
790 | " -p|--pid pid Walk process address space\n" | ||
791 | #if 0 /* planned features */ | ||
792 | " -f|--file filename Walk file address space\n" | ||
793 | #endif | ||
794 | " -l|--list Show page details in ranges\n" | ||
795 | " -L|--list-each Show page details one by one\n" | ||
796 | " -N|--no-summary Don't show summary info\n" | ||
797 | " -X|--hwpoison hwpoison pages\n" | ||
798 | " -x|--unpoison unpoison pages\n" | ||
799 | " -h|--help Show this usage message\n" | ||
800 | "flags:\n" | ||
801 | " 0x10 bitfield format, e.g.\n" | ||
802 | " anon bit-name, e.g.\n" | ||
803 | " 0x10,anon comma-separated list, e.g.\n" | ||
804 | "addr-spec:\n" | ||
805 | " N one page at offset N (unit: pages)\n" | ||
806 | " N+M pages range from N to N+M-1\n" | ||
807 | " N,M pages range from N to M-1\n" | ||
808 | " N, pages range from N to end\n" | ||
809 | " ,M pages range from 0 to M-1\n" | ||
810 | "bits-spec:\n" | ||
811 | " bit1,bit2 (flags & (bit1|bit2)) != 0\n" | ||
812 | " bit1,bit2=bit1 (flags & (bit1|bit2)) == bit1\n" | ||
813 | " bit1,~bit2 (flags & (bit1|bit2)) == bit1\n" | ||
814 | " =bit1,bit2 flags == (bit1|bit2)\n" | ||
815 | "bit-names:\n" | ||
816 | ); | ||
817 | |||
818 | for (i = 0, j = 0; i < ARRAY_SIZE(page_flag_names); i++) { | ||
819 | if (!page_flag_names[i]) | ||
820 | continue; | ||
821 | printf("%16s%s", page_flag_names[i] + 2, | ||
822 | page_flag_type(1ULL << i)); | ||
823 | if (++j > 3) { | ||
824 | j = 0; | ||
825 | putchar('\n'); | ||
826 | } | ||
827 | } | ||
828 | printf("\n " | ||
829 | "(r) raw mode bits (o) overloaded bits\n"); | ||
830 | } | ||
831 | |||
832 | static unsigned long long parse_number(const char *str) | ||
833 | { | ||
834 | unsigned long long n; | ||
835 | |||
836 | n = strtoll(str, NULL, 0); | ||
837 | |||
838 | if (n == 0 && str[0] != '0') | ||
839 | fatal("invalid name or number: %s\n", str); | ||
840 | |||
841 | return n; | ||
842 | } | ||
843 | |||
844 | static void parse_pid(const char *str) | ||
845 | { | ||
846 | FILE *file; | ||
847 | char buf[5000]; | ||
848 | |||
849 | opt_pid = parse_number(str); | ||
850 | |||
851 | sprintf(buf, "/proc/%d/pagemap", opt_pid); | ||
852 | pagemap_fd = checked_open(buf, O_RDONLY); | ||
853 | |||
854 | sprintf(buf, "/proc/%d/maps", opt_pid); | ||
855 | file = fopen(buf, "r"); | ||
856 | if (!file) { | ||
857 | perror(buf); | ||
858 | exit(EXIT_FAILURE); | ||
859 | } | ||
860 | |||
861 | while (fgets(buf, sizeof(buf), file) != NULL) { | ||
862 | unsigned long vm_start; | ||
863 | unsigned long vm_end; | ||
864 | unsigned long long pgoff; | ||
865 | int major, minor; | ||
866 | char r, w, x, s; | ||
867 | unsigned long ino; | ||
868 | int n; | ||
869 | |||
870 | n = sscanf(buf, "%lx-%lx %c%c%c%c %llx %x:%x %lu", | ||
871 | &vm_start, | ||
872 | &vm_end, | ||
873 | &r, &w, &x, &s, | ||
874 | &pgoff, | ||
875 | &major, &minor, | ||
876 | &ino); | ||
877 | if (n < 10) { | ||
878 | fprintf(stderr, "unexpected line: %s\n", buf); | ||
879 | continue; | ||
880 | } | ||
881 | pg_start[nr_vmas] = vm_start / page_size; | ||
882 | pg_end[nr_vmas] = vm_end / page_size; | ||
883 | if (++nr_vmas >= MAX_VMAS) { | ||
884 | fprintf(stderr, "too many VMAs\n"); | ||
885 | break; | ||
886 | } | ||
887 | } | ||
888 | fclose(file); | ||
889 | } | ||
890 | |||
891 | static void parse_file(const char *name) | ||
892 | { | ||
893 | } | ||
894 | |||
895 | static void parse_addr_range(const char *optarg) | ||
896 | { | ||
897 | unsigned long offset; | ||
898 | unsigned long size; | ||
899 | char *p; | ||
900 | |||
901 | p = strchr(optarg, ','); | ||
902 | if (!p) | ||
903 | p = strchr(optarg, '+'); | ||
904 | |||
905 | if (p == optarg) { | ||
906 | offset = 0; | ||
907 | size = parse_number(p + 1); | ||
908 | } else if (p) { | ||
909 | offset = parse_number(optarg); | ||
910 | if (p[1] == '\0') | ||
911 | size = ULONG_MAX; | ||
912 | else { | ||
913 | size = parse_number(p + 1); | ||
914 | if (*p == ',') { | ||
915 | if (size < offset) | ||
916 | fatal("invalid range: %lu,%lu\n", | ||
917 | offset, size); | ||
918 | size -= offset; | ||
919 | } | ||
920 | } | ||
921 | } else { | ||
922 | offset = parse_number(optarg); | ||
923 | size = 1; | ||
924 | } | ||
925 | |||
926 | add_addr_range(offset, size); | ||
927 | } | ||
928 | |||
929 | static void add_bits_filter(uint64_t mask, uint64_t bits) | ||
930 | { | ||
931 | if (nr_bit_filters >= MAX_BIT_FILTERS) | ||
932 | fatal("too much bit filters\n"); | ||
933 | |||
934 | opt_mask[nr_bit_filters] = mask; | ||
935 | opt_bits[nr_bit_filters] = bits; | ||
936 | nr_bit_filters++; | ||
937 | } | ||
938 | |||
939 | static uint64_t parse_flag_name(const char *str, int len) | ||
940 | { | ||
941 | int i; | ||
942 | |||
943 | if (!*str || !len) | ||
944 | return 0; | ||
945 | |||
946 | if (len <= 8 && !strncmp(str, "compound", len)) | ||
947 | return BITS_COMPOUND; | ||
948 | |||
949 | for (i = 0; i < ARRAY_SIZE(page_flag_names); i++) { | ||
950 | if (!page_flag_names[i]) | ||
951 | continue; | ||
952 | if (!strncmp(str, page_flag_names[i] + 2, len)) | ||
953 | return 1ULL << i; | ||
954 | } | ||
955 | |||
956 | return parse_number(str); | ||
957 | } | ||
958 | |||
959 | static uint64_t parse_flag_names(const char *str, int all) | ||
960 | { | ||
961 | const char *p = str; | ||
962 | uint64_t flags = 0; | ||
963 | |||
964 | while (1) { | ||
965 | if (*p == ',' || *p == '=' || *p == '\0') { | ||
966 | if ((*str != '~') || (*str == '~' && all && *++str)) | ||
967 | flags |= parse_flag_name(str, p - str); | ||
968 | if (*p != ',') | ||
969 | break; | ||
970 | str = p + 1; | ||
971 | } | ||
972 | p++; | ||
973 | } | ||
974 | |||
975 | return flags; | ||
976 | } | ||
977 | |||
978 | static void parse_bits_mask(const char *optarg) | ||
979 | { | ||
980 | uint64_t mask; | ||
981 | uint64_t bits; | ||
982 | const char *p; | ||
983 | |||
984 | p = strchr(optarg, '='); | ||
985 | if (p == optarg) { | ||
986 | mask = KPF_ALL_BITS; | ||
987 | bits = parse_flag_names(p + 1, 0); | ||
988 | } else if (p) { | ||
989 | mask = parse_flag_names(optarg, 0); | ||
990 | bits = parse_flag_names(p + 1, 0); | ||
991 | } else if (strchr(optarg, '~')) { | ||
992 | mask = parse_flag_names(optarg, 1); | ||
993 | bits = parse_flag_names(optarg, 0); | ||
994 | } else { | ||
995 | mask = parse_flag_names(optarg, 0); | ||
996 | bits = KPF_ALL_BITS; | ||
997 | } | ||
998 | |||
999 | add_bits_filter(mask, bits); | ||
1000 | } | ||
1001 | |||
1002 | static void describe_flags(const char *optarg) | ||
1003 | { | ||
1004 | uint64_t flags = parse_flag_names(optarg, 0); | ||
1005 | |||
1006 | printf("0x%016llx\t%s\t%s\n", | ||
1007 | (unsigned long long)flags, | ||
1008 | page_flag_name(flags), | ||
1009 | page_flag_longname(flags)); | ||
1010 | } | ||
1011 | |||
1012 | static const struct option opts[] = { | ||
1013 | { "raw" , 0, NULL, 'r' }, | ||
1014 | { "pid" , 1, NULL, 'p' }, | ||
1015 | { "file" , 1, NULL, 'f' }, | ||
1016 | { "addr" , 1, NULL, 'a' }, | ||
1017 | { "bits" , 1, NULL, 'b' }, | ||
1018 | { "describe" , 1, NULL, 'd' }, | ||
1019 | { "list" , 0, NULL, 'l' }, | ||
1020 | { "list-each" , 0, NULL, 'L' }, | ||
1021 | { "no-summary", 0, NULL, 'N' }, | ||
1022 | { "hwpoison" , 0, NULL, 'X' }, | ||
1023 | { "unpoison" , 0, NULL, 'x' }, | ||
1024 | { "help" , 0, NULL, 'h' }, | ||
1025 | { NULL , 0, NULL, 0 } | ||
1026 | }; | ||
1027 | |||
1028 | int main(int argc, char *argv[]) | ||
1029 | { | ||
1030 | int c; | ||
1031 | |||
1032 | page_size = getpagesize(); | ||
1033 | |||
1034 | while ((c = getopt_long(argc, argv, | ||
1035 | "rp:f:a:b:d:lLNXxh", opts, NULL)) != -1) { | ||
1036 | switch (c) { | ||
1037 | case 'r': | ||
1038 | opt_raw = 1; | ||
1039 | break; | ||
1040 | case 'p': | ||
1041 | parse_pid(optarg); | ||
1042 | break; | ||
1043 | case 'f': | ||
1044 | parse_file(optarg); | ||
1045 | break; | ||
1046 | case 'a': | ||
1047 | parse_addr_range(optarg); | ||
1048 | break; | ||
1049 | case 'b': | ||
1050 | parse_bits_mask(optarg); | ||
1051 | break; | ||
1052 | case 'd': | ||
1053 | describe_flags(optarg); | ||
1054 | exit(0); | ||
1055 | case 'l': | ||
1056 | opt_list = 1; | ||
1057 | break; | ||
1058 | case 'L': | ||
1059 | opt_list = 2; | ||
1060 | break; | ||
1061 | case 'N': | ||
1062 | opt_no_summary = 1; | ||
1063 | break; | ||
1064 | case 'X': | ||
1065 | opt_hwpoison = 1; | ||
1066 | prepare_hwpoison_fd(); | ||
1067 | break; | ||
1068 | case 'x': | ||
1069 | opt_unpoison = 1; | ||
1070 | prepare_hwpoison_fd(); | ||
1071 | break; | ||
1072 | case 'h': | ||
1073 | usage(); | ||
1074 | exit(0); | ||
1075 | default: | ||
1076 | usage(); | ||
1077 | exit(1); | ||
1078 | } | ||
1079 | } | ||
1080 | |||
1081 | if (opt_list && opt_pid) | ||
1082 | printf("voffset\t"); | ||
1083 | if (opt_list == 1) | ||
1084 | printf("offset\tlen\tflags\n"); | ||
1085 | if (opt_list == 2) | ||
1086 | printf("offset\tflags\n"); | ||
1087 | |||
1088 | walk_addr_ranges(); | ||
1089 | |||
1090 | if (opt_list == 1) | ||
1091 | show_page_range(0, 0, 0); /* drain the buffer */ | ||
1092 | |||
1093 | if (opt_no_summary) | ||
1094 | return 0; | ||
1095 | |||
1096 | if (opt_list) | ||
1097 | printf("\n\n"); | ||
1098 | |||
1099 | show_summary(); | ||
1100 | |||
1101 | return 0; | ||
1102 | } | ||
diff --git a/Documentation/watchdog/00-INDEX b/Documentation/watchdog/00-INDEX deleted file mode 100644 index fc9082a1477a..000000000000 --- a/Documentation/watchdog/00-INDEX +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | 00-INDEX | ||
2 | - this file. | ||
3 | convert_drivers_to_kernel_api.txt | ||
4 | - how-to for converting old watchdog drivers to the new kernel API. | ||
5 | hpwdt.txt | ||
6 | - information on the HP iLO2 NMI watchdog | ||
7 | pcwd-watchdog.txt | ||
8 | - documentation for Berkshire Products PC Watchdog ISA cards. | ||
9 | src/ | ||
10 | - directory holding watchdog related example programs. | ||
11 | watchdog-api.txt | ||
12 | - description of the Linux Watchdog driver API. | ||
13 | watchdog-kernel-api.txt | ||
14 | - description of the Linux WatchDog Timer Driver Core kernel API. | ||
15 | watchdog-parameters.txt | ||
16 | - information on driver parameters (for drivers other than | ||
17 | the ones that have driver-specific files here) | ||
18 | wdt.txt | ||
19 | - description of the Watchdog Timer Interfaces for Linux. | ||
diff --git a/Documentation/watchdog/convert_drivers_to_kernel_api.txt b/Documentation/watchdog/convert_drivers_to_kernel_api.txt index be8119bb15d2..271b8850dde7 100644 --- a/Documentation/watchdog/convert_drivers_to_kernel_api.txt +++ b/Documentation/watchdog/convert_drivers_to_kernel_api.txt | |||
@@ -59,6 +59,10 @@ Here is a overview of the functions and probably needed actions: | |||
59 | WDIOC_GETTIMEOUT: | 59 | WDIOC_GETTIMEOUT: |
60 | No preparations needed | 60 | No preparations needed |
61 | 61 | ||
62 | WDIOC_GETTIMELEFT: | ||
63 | It needs get_timeleft() callback to be defined. Otherwise it | ||
64 | will return EOPNOTSUPP | ||
65 | |||
62 | Other IOCTLs can be served using the ioctl-callback. Note that this is mainly | 66 | Other IOCTLs can be served using the ioctl-callback. Note that this is mainly |
63 | intended for porting old drivers; new drivers should not invent private IOCTLs. | 67 | intended for porting old drivers; new drivers should not invent private IOCTLs. |
64 | Private IOCTLs are processed first. When the callback returns with | 68 | Private IOCTLs are processed first. When the callback returns with |
diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt index 9e162465b0cf..227f6cd0e5fa 100644 --- a/Documentation/watchdog/watchdog-kernel-api.txt +++ b/Documentation/watchdog/watchdog-kernel-api.txt | |||
@@ -1,6 +1,6 @@ | |||
1 | The Linux WatchDog Timer Driver Core kernel API. | 1 | The Linux WatchDog Timer Driver Core kernel API. |
2 | =============================================== | 2 | =============================================== |
3 | Last reviewed: 29-Nov-2011 | 3 | Last reviewed: 16-Mar-2012 |
4 | 4 | ||
5 | Wim Van Sebroeck <wim@iguana.be> | 5 | Wim Van Sebroeck <wim@iguana.be> |
6 | 6 | ||
@@ -77,6 +77,7 @@ struct watchdog_ops { | |||
77 | int (*ping)(struct watchdog_device *); | 77 | int (*ping)(struct watchdog_device *); |
78 | unsigned int (*status)(struct watchdog_device *); | 78 | unsigned int (*status)(struct watchdog_device *); |
79 | int (*set_timeout)(struct watchdog_device *, unsigned int); | 79 | int (*set_timeout)(struct watchdog_device *, unsigned int); |
80 | unsigned int (*get_timeleft)(struct watchdog_device *); | ||
80 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); | 81 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); |
81 | }; | 82 | }; |
82 | 83 | ||
@@ -117,11 +118,13 @@ they are supported. These optional routines/operations are: | |||
117 | status of the device is reported with watchdog WDIOF_* status flags/bits. | 118 | status of the device is reported with watchdog WDIOF_* status flags/bits. |
118 | * set_timeout: this routine checks and changes the timeout of the watchdog | 119 | * set_timeout: this routine checks and changes the timeout of the watchdog |
119 | timer device. It returns 0 on success, -EINVAL for "parameter out of range" | 120 | timer device. It returns 0 on success, -EINVAL for "parameter out of range" |
120 | and -EIO for "could not write value to the watchdog". On success the timeout | 121 | and -EIO for "could not write value to the watchdog". On success this |
121 | value of the watchdog_device will be changed to the value that was just used | 122 | routine should set the timeout value of the watchdog_device to the |
122 | to re-program the watchdog timer device. | 123 | achieved timeout value (which may be different from the requested one |
124 | because the watchdog does not necessarily has a 1 second resolution). | ||
123 | (Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the | 125 | (Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the |
124 | watchdog's info structure). | 126 | watchdog's info structure). |
127 | * get_timeleft: this routines returns the time that's left before a reset. | ||
125 | * ioctl: if this routine is present then it will be called first before we do | 128 | * ioctl: if this routine is present then it will be called first before we do |
126 | our own internal ioctl call handling. This routine should return -ENOIOCTLCMD | 129 | our own internal ioctl call handling. This routine should return -ENOIOCTLCMD |
127 | if a command is not supported. The parameters that are passed to the ioctl | 130 | if a command is not supported. The parameters that are passed to the ioctl |