aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/00-INDEX2
-rw-r--r--Documentation/ABI/testing/sysfs-block-dm25
-rw-r--r--Documentation/ABI/testing/sysfs-bus-rpmsg75
-rw-r--r--Documentation/ABI/testing/sysfs-driver-samsung-laptop18
-rw-r--r--Documentation/ABI/testing/sysfs-kernel-mm-cleancache11
-rw-r--r--Documentation/DocBook/kgdb.tmpl17
-rw-r--r--Documentation/DocBook/media/v4l/biblio.xml20
-rw-r--r--Documentation/DocBook/media/v4l/compat.xml14
-rw-r--r--Documentation/DocBook/media/v4l/controls.xml220
-rw-r--r--Documentation/DocBook/media/v4l/selection-api.xml8
-rw-r--r--Documentation/DocBook/media/v4l/v4l2.xml19
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml256
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml9
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml16
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-g-selection.xml106
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-querycap.xml36
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml6
-rw-r--r--Documentation/EDID/1024x768.S44
-rw-r--r--Documentation/EDID/1280x1024.S44
-rw-r--r--Documentation/EDID/1680x1050.S44
-rw-r--r--Documentation/EDID/1920x1080.S44
-rw-r--r--Documentation/EDID/HOWTO.txt39
-rw-r--r--Documentation/EDID/Makefile26
-rw-r--r--Documentation/EDID/edid.S261
-rw-r--r--Documentation/EDID/hex1
-rw-r--r--Documentation/Makefile2
-rw-r--r--Documentation/backlight/lp855x-driver.txt78
-rw-r--r--Documentation/clk.txt233
-rw-r--r--Documentation/crc32.txt182
-rw-r--r--Documentation/device-mapper/thin-provisioning.txt65
-rw-r--r--Documentation/device-mapper/verity.txt194
-rw-r--r--Documentation/devicetree/bindings/arm/atmel-aic.txt38
-rw-r--r--Documentation/devicetree/bindings/arm/atmel-at91.txt92
-rw-r--r--Documentation/devicetree/bindings/arm/atmel-pmc.txt11
-rw-r--r--Documentation/devicetree/bindings/arm/fsl.txt22
-rw-r--r--Documentation/devicetree/bindings/arm/mrvl.txt6
-rw-r--r--Documentation/devicetree/bindings/arm/omap/intc.txt27
-rw-r--r--Documentation/devicetree/bindings/arm/spear.txt8
-rw-r--r--Documentation/devicetree/bindings/arm/tegra/emc.txt100
-rw-r--r--Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt19
-rw-r--r--Documentation/devicetree/bindings/arm/twd.txt48
-rw-r--r--Documentation/devicetree/bindings/arm/vexpress.txt146
-rw-r--r--Documentation/devicetree/bindings/dma/tegra20-apbdma.txt30
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio-omap.txt36
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio-twl4030.txt23
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio_atmel.txt20
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio_i2c.txt32
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio_nvidia.txt36
-rw-r--r--Documentation/devicetree/bindings/gpio/mrvl-gpio.txt23
-rw-r--r--Documentation/devicetree/bindings/gpio/sodaville.txt48
-rw-r--r--Documentation/devicetree/bindings/i2c/mrvl-i2c.txt37
-rw-r--r--Documentation/devicetree/bindings/i2c/sirf-i2c.txt19
-rw-r--r--Documentation/devicetree/bindings/input/matrix-keymap.txt19
-rw-r--r--Documentation/devicetree/bindings/input/tegra-kbc.txt17
-rw-r--r--Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt33
-rw-r--r--Documentation/devicetree/bindings/mtd/atmel-nand.txt41
-rw-r--r--Documentation/devicetree/bindings/mtd/nand.txt7
-rw-r--r--Documentation/devicetree/bindings/rtc/sa1100-rtc.txt17
-rw-r--r--Documentation/devicetree/bindings/serial/mrvl-serial.txt4
-rw-r--r--Documentation/devicetree/bindings/sound/alc5632.txt24
-rw-r--r--Documentation/devicetree/bindings/sound/imx-audmux.txt13
-rw-r--r--Documentation/devicetree/bindings/sound/sgtl5000.txt (renamed from Documentation/devicetree/bindings/sound/soc/codecs/fsl-sgtl5000.txt)0
-rw-r--r--Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt59
-rw-r--r--Documentation/devicetree/bindings/usb/atmel-usb.txt49
-rw-r--r--Documentation/devicetree/bindings/usb/tegra-usb.txt13
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt1
-rw-r--r--Documentation/dma-buf-sharing.txt120
-rw-r--r--Documentation/dvb/cards.txt1
-rw-r--r--Documentation/dvb/lmedm04.txt11
-rw-r--r--Documentation/edac.txt4
-rw-r--r--Documentation/feature-removal-schedule.txt14
-rw-r--r--Documentation/filesystems/ext4.txt8
-rw-r--r--Documentation/filesystems/nfs/idmapper.txt20
-rw-r--r--Documentation/filesystems/nfs/pnfs.txt54
-rw-r--r--Documentation/gpio.txt40
-rw-r--r--Documentation/hwmon/lm904
-rw-r--r--Documentation/hwmon/mc13783-adc50
-rw-r--r--Documentation/hwmon/mcp302122
-rw-r--r--Documentation/i2c/busses/i2c-i8011
-rw-r--r--Documentation/kernel-parameters.txt56
-rw-r--r--Documentation/laptops/asus-laptop.txt2
-rw-r--r--Documentation/laptops/sony-laptop.txt5
-rw-r--r--Documentation/leds/leds-lp5521.txt63
-rw-r--r--Documentation/pinctrl.txt311
-rw-r--r--Documentation/remoteproc.txt322
-rw-r--r--Documentation/rpmsg.txt293
-rw-r--r--Documentation/scsi/LICENSE.qla2xxx41
-rw-r--r--Documentation/scsi/bfa.txt82
-rw-r--r--Documentation/scsi/libsas.txt15
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt8
-rw-r--r--Documentation/sound/alsa/HD-Audio-Models.txt79
-rw-r--r--Documentation/sound/alsa/HD-Audio.txt7
-rw-r--r--Documentation/video4linux/CARDLIST.cx238851
-rw-r--r--Documentation/video4linux/CARDLIST.cx884
-rw-r--r--Documentation/video4linux/CARDLIST.em28xx10
-rw-r--r--Documentation/video4linux/CARDLIST.saa71341
-rw-r--r--Documentation/video4linux/CARDLIST.tuner3
-rw-r--r--Documentation/video4linux/fimc.txt178
-rw-r--r--Documentation/video4linux/gspca.txt1
-rw-r--r--Documentation/virtual/kvm/api.txt259
-rw-r--r--Documentation/virtual/kvm/ppc-pv.txt24
-rw-r--r--Documentation/vm/Makefile8
-rw-r--r--Documentation/vm/cleancache.txt41
-rw-r--r--Documentation/vm/hugepage-mmap.c91
-rw-r--r--Documentation/vm/hugepage-shm.c98
-rw-r--r--Documentation/vm/map_hugetlb.c77
-rw-r--r--Documentation/vm/page-types.c1102
-rw-r--r--Documentation/watchdog/00-INDEX19
-rw-r--r--Documentation/watchdog/convert_drivers_to_kernel_api.txt4
-rw-r--r--Documentation/watchdog/watchdog-kernel-api.txt11
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.
105cputopology.txt 105cputopology.txt
106 - documentation on how CPU topology info is exported via sysfs. 106 - documentation on how CPU topology info is exported via sysfs.
107crc32.txt
108 - brief tutorial on CRC computation
107cris/ 109cris/
108 - directory with info about Linux on CRIS architecture. 110 - directory with info about Linux on CRIS architecture.
109crypto/ 111crypto/
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 @@
1What: /sys/block/dm-<num>/dm/name
2Date: January 2009
3KernelVersion: 2.6.29
4Contact: dm-devel@redhat.com
5Description: Device-mapper device name.
6 Read-only string containing mapped device name.
7Users: util-linux, device-mapper udev rules
8
9What: /sys/block/dm-<num>/dm/uuid
10Date: January 2009
11KernelVersion: 2.6.29
12Contact: dm-devel@redhat.com
13Description: Device-mapper device UUID.
14 Read-only string containing DM-UUID or empty string
15 if DM-UUID is not set.
16Users: util-linux, device-mapper udev rules
17
18What: /sys/block/dm-<num>/dm/suspended
19Date: June 2009
20KernelVersion: 2.6.31
21Contact: dm-devel@redhat.com
22Description: Device-mapper device suspend state.
23 Contains the value 1 while the device is suspended.
24 Otherwise it contains 0. Read-only attribute.
25Users: 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 @@
1What: /sys/bus/rpmsg/devices/.../name
2Date: June 2011
3KernelVersion: 3.3
4Contact: Ohad Ben-Cohen <ohad@wizery.com>
5Description:
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
13What: /sys/bus/rpmsg/devices/.../src
14Date: June 2011
15KernelVersion: 3.3
16Contact: Ohad Ben-Cohen <ohad@wizery.com>
17Description:
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
31What: /sys/bus/rpmsg/devices/.../dst
32Date: June 2011
33KernelVersion: 3.3
34Contact: Ohad Ben-Cohen <ohad@wizery.com>
35Description:
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
53What: /sys/bus/rpmsg/devices/.../announce
54Date: June 2011
55KernelVersion: 3.3
56Contact: Ohad Ben-Cohen <ohad@wizery.com>
57Description:
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
21What: /sys/devices/platform/samsung/battery_life_extender
22Date: December 1, 2011
23KernelVersion: 3.3
24Contact: Corentin Chary <corentin.chary@gmail.com>
25Description: 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
31What: /sys/devices/platform/samsung/usb_charge
32Date: December 1, 2011
33KernelVersion: 3.3
34Contact: Corentin Chary <corentin.chary@gmail.com>
35Description: 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 @@
1What: /sys/kernel/mm/cleancache/
2Date: April 2011
3Contact: Dan Magenheimer <dan.magenheimer@oracle.com>
4Description:
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 &mdash; Digital Compression and Coding of Continous-Tone
139Still Images &mdash; 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
146url="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&nbsp;12M</abbrev> 152 <abbrev>SMPTE&nbsp;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
1286and reproducible audio bitstream. 0 = unmuted, 1 = muted.</entry> 1286and 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>&nbsp;</entry>
1291 <entry>enum&nbsp;v4l2_mpeg_audio_dec_playback</entry>
1292 </row><row><entry spanname="descr">Determines how monolingual audio should be played back.
1293Possible 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>&nbsp;</entry>
1300 <entry>Automatically determines the best playback mode.</entry>
1301 </row>
1302 <row>
1303 <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO</constant>&nbsp;</entry>
1304 <entry>Stereo playback.</entry>
1305 </row>
1306 <row>
1307 <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT</constant>&nbsp;</entry>
1308 <entry>Left channel playback.</entry>
1309 </row>
1310 <row>
1311 <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT</constant>&nbsp;</entry>
1312 <entry>Right channel playback.</entry>
1313 </row>
1314 <row>
1315 <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO</constant>&nbsp;</entry>
1316 <entry>Mono playback.</entry>
1317 </row>
1318 <row>
1319 <entry><constant>V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO</constant>&nbsp;</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>&nbsp;</entry>
1328 <entry>enum&nbsp;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>&nbsp;</entry> 1333 <entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_ENCODING</constant>&nbsp;</entry>
1291 <entry>enum&nbsp;v4l2_mpeg_video_encoding</entry> 1334 <entry>enum&nbsp;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>&nbsp;</entry>
1496 <entry>integer64</entry>
1497 </row><row><entry spanname="descr">This read-only control returns the
149833-bit video Presentation Time Stamp as defined in ITU T-REC-H.222.0 and ISO/IEC 13818-1 of
1499the 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>&nbsp;</entry>
1504 <entry>integer64</entry>
1505 </row><row><entry spanname="descr">This read-only control returns the
1506frame counter of the frame that is currently displayed (decoded). This value is reset to 0 whenever
1507the 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>&nbsp;</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
56For complete list of the available selection targets see table <xref
57linkend="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
192and the height of rectangles obtained using <constant> V4L2_SEL_TGT_CROP_ACTIVE 196and 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
128applications. --> 128applications. -->
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>
56interface 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
61decoder, <constant>VIDIOC_TRY_DECODER_CMD</constant> can be used to
62try a command without actually executing it. To send a command applications
63must initialize all fields of a &v4l2-decoder-cmd; and call
64<constant>VIDIOC_DECODER_CMD</constant> or <constant>VIDIOC_TRY_DECODER_CMD</constant>
65with a pointer to this structure.</para>
66
67 <para>The <structfield>cmd</structfield> field must contain the
68command code. Some commands use the <structfield>flags</structfield> field for
69additional information.
70</para>
71
72 <para>A <function>write</function>() or &VIDIOC-STREAMON; call sends an implicit
73START 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
77file descriptor sends an implicit immediate STOP command to the decoder, and all
78buffered data is discarded.</para>
79
80 <para>These ioctls are optional, not all drivers may support
81them. 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
101this 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.
125Negative numbers denote reverse playback, so -1000 does reverse playback at normal
126speed. 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
128just 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
137application. Possible values are <constant>V4L2_DEC_START_FMT_NONE</constant> if
138there are no format restrictions or <constant>V4L2_DEC_START_FMT_GOP</constant>
139if the decoder operates on full GOPs (<wordasword>Group Of Pictures</wordasword>).
140This is usually the case for reverse playback: the decoder needs full GOPs, which
141it can then play in reverse order. So to implement reverse playback the application
142must 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
159if the playback is already past that timestamp. Leave to 0 if you want to stop after the
160last 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
176applications 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
191running or paused, this command will just change the playback speed.
192That means that calling <constant>V4L2_DEC_CMD_START</constant> when
193the decoder was paused will <emphasis>not</emphasis> resume the decoder.
194You have to explicitly call <constant>V4L2_DEC_CMD_RESUME</constant> for that.
195This command has one flag:
196<constant>V4L2_DEC_CMD_START_MUTE_AUDIO</constant>. If set, then audio will
197be 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,
204this command does nothing. This command has two flags:
205if <constant>V4L2_DEC_CMD_STOP_TO_BLACK</constant> is set, then the decoder will
206set the picture to black after it stopped decoding. Otherwise the last image will
207repeat. If <constant>V4L2_DEC_CMD_STOP_IMMEDIATELY</constant> is set, then the decoder
208stops immediately (ignoring the <structfield>pts</structfield> value), otherwise it
209will keep decoding until timestamp >= pts or until the last of the pending data from
210its 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
217started yet, the driver will return an &EPERM;. When the decoder is
218already paused, this command does nothing. This command has one flag:
219if <constant>V4L2_DEC_CMD_PAUSE_TO_BLACK</constant> is set, then set the
220decoder 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
227decoder has not been started yet, the driver will return an &EPERM;.
228When the decoder is already running, this command does nothing. No
229flags 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
251the 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
74encoding will continue until the end of the current <wordasword>Group 74encoding will continue until the end of the current <wordasword>Group
75Of Pictures</wordasword>, otherwise it will stop immediately.</para> 75Of 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
78the encoder if it has not been started yet. After a STOP command, 78START 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
80buffered by the driver. When the buffer is empty, 80buffered 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
85to the encoder, and all buffered data is discarded.</para> 85file descriptor sends an implicit immediate STOP to the encoder, and all buffered
86data 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
88them. They were introduced in Linux 2.6.21.</para> 89them. 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.
63use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE 63Do 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
67setting <structfield> &v4l2-selection;::target </structfield> to value 67setting the value of &v4l2-selection; <structfield>target</structfield> field
68<constant> V4L2_SEL_TGT_CROP_ACTIVE </constant> (<constant> 68to <constant> V4L2_SEL_TGT_CROP_ACTIVE </constant> (<constant>
69V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref 69V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref
70linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional 70linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional
71targets. Fields <structfield> &v4l2-selection;::flags </structfield> and 71targets. 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
73must be filled with zeros. The driver fills the rest of the structure or 73with zeros. The driver fills the rest of the structure or
74returns &EINVAL; if incorrect buffer type or target was used. If cropping 74returns &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
76always equal to the bounds rectangle. Finally, structure <structfield> 76always 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
79units. The only exception are rectangles for images in raw formats, whose 79units. The only exception are rectangles for images in raw formats, whose
80coordinates are always expressed in pixels. </para> 80coordinates 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
84use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE 84use 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
88setting <structfield> &v4l2-selection;::target </structfield> to value 88setting 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>
90V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref 90V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref
91linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional 91linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional
92targets. Set desired active area into the field <structfield> 92targets. The &v4l2-rect; <structfield>r</structfield> rectangle need to be
93&v4l2-selection;::r </structfield>. Field <structfield> 93set 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
95zeros. The driver may adjust the rectangle coordinates. An application may 95coordinates of the requested rectangle. An application may
96introduce constraints to control rounding behaviour. Set the field 96introduce 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
148On success the field <structfield> &v4l2-selection;::r </structfield> contains 148On success the &v4l2-rect; <structfield>r</structfield> field contains
149the adjusted rectangle. When the parameters are unsuitable the application may 149the adjusted rectangle. When the parameters are unsuitable the application may
150modify the cropping (composing) or image parameters and repeat the cycle until 150modify the cropping (composing) or image parameters and repeat the cycle until
151satisfactory parameters have been negotiated. If constraints flags have to be 151satisfactory 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
282or <structfield> &v4l2-selection;::target </structfield> is not supported, or 286the selection target <structfield>target</structfield> is not supported,
283the <structfield> &v4l2-selection;::flags </structfield> are invalid.</para> 287or 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 294r</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
298Usually because streaming is in progress.</para> 302at 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
134this array to zero.</entry> 157this 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
277linkend="mmap">streaming</link> I/O method.</entry> 300linkend="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
115bounds or the value in the <structfield>type</structfield> field is 115bounds, the wrap_around value is not supported or the value in the <structfield>type</structfield> field is
116wrong.</para> 116wrong.</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 @@
1In the good old days when graphics parameters were configured explicitly
2in a file called xorg.conf, even broken hardware could be managed.
3
4Today, with the advent of Kernel Mode Setting, a graphics board is
5either correctly working because all components follow the standards -
6or the computer is unusable, because the screen remains dark after
7booting 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.
13Adding the kernel parameter "nomodeset" helps in most cases, but causes
14restrictions later on.
15
16As a remedy for such situations, the kernel configuration item
17CONFIG_DRM_LOAD_EDID_FIRMWARE was introduced. It allows to provide an
18individually prepared or corrected EDID data set in the /lib/firmware
19directory 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
21commonly used screen resolutions (1024x768, 1280x1024, 1680x1050,
221920x1080) as binary blobs, but the kernel source tree does not contain
23code to create these data. In order to elucidate the origin of the
24built-in binary EDID blobs and to facilitate the creation of individual
25data for a specific misbehaving monitor, commented sources and a
26Makefile environment are given here.
27
28To create binary EDID and C source code files from the existing data
29material, simply type "make".
30
31If you want to create your own EDID file, copy the file 1024x768.S and
32replace the settings with your own data. The CRC value in the last line
33 #define CRC 0x55
34is a bit tricky. After a first version of the binary data set is
35created, it must be be checked with the "edid-decode" utility which will
36most probably complain about a wrong CRC. Fortunately, the utility also
37displays the correct CRC which must then be inserted into the source
38file. After the make procedure is repeated, the EDID data set is ready
39to 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
2SOURCES := $(wildcard [0-9]*x[0-9]*.S)
3
4BIN := $(patsubst %.S, %.bin, $(SOURCES))
5
6IHEX := $(patsubst %.S, %.bin.ihex, $(SOURCES))
7
8CODE := $(patsubst %.S, %.c, $(SOURCES))
9
10all: $(BIN) $(IHEX) $(CODE)
11
12clean:
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 */
49header: .byte 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00
50
51mfg_id: .word swap16(mfgname2id(MFG_LNX1, MFG_LNX2, MFG_LNX3))
52
53prod_code: .word 0
54
55/* Serial number. 32 bits, little endian. */
56serial_number: .long SERIAL
57
58/* Week of manufacture */
59week: .byte WEEK
60
61/* Year of manufacture, less 1990. (1990-2245)
62 If week=255, it is the model year instead */
63year: .byte YEAR-1990
64
65version: .byte VERSION /* EDID version, usually 1 (for 1.3) */
66revision: .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. */
82video_parms: .byte 0x6d
83
84/* Maximum horizontal image size, in centimetres
85 (max 292 cm/115 in at 16:9 aspect ratio) */
86max_hor_size: .byte xsize/10
87
88/* Maximum vertical image size, in centimetres.
89 If either byte is 0, undefined (e.g. projector) */
90max_vert_size: .byte ysize/10
91
92/* Display gamma, minus 1, times 100 (range 1.00-3.5 */
93gamma: .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. */
104dsp_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 */
112red_green_lsb: .byte 0x5e
113
114/* Blue and white least-significant 2 bits */
115blue_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 */
119red_x_msb: .byte 0xa4
120
121/* Red y value most significant 8 bits */
122red_y_msb: .byte 0x59
123
124/* Green x and y value most significant 8 bits */
125green_x_y_msb: .byte 0x4a,0x98
126
127/* Blue x and y value most significant 8 bits */
128blue_x_y_msb: .byte 0x25,0x20
129
130/* Default white point x and y value most significant 8 bits */
131white_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 */
142estbl_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 */
152estbl_timing2: .byte ESTABLISHED_TIMINGS_BITS
153
154/* Bit 7 1152x870 @ 75 Hz (Apple Macintosh II)
155 Bits 6-0 Other manufacturer-specific display mod */
156estbl_timing3: .byte 0x00
157
158/* Standard timing */
159/* X resolution, less 31, divided by 8 (256-2288 pixels) */
160std_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) */
164std_vres: .byte (XY_RATIO<<6)+VFREQ-60
165 .fill 7,2,0x0101 /* Unused */
166
167descriptor1:
168/* Pixel clock in 10 kHz units. (0.-655.35 MHz, little-endian) */
169clock: .word CLOCK/10
170
171/* Horizontal active pixels 8 lsbits (0-4095) */
172x_act_lsb: .byte XPIX&0xff
173/* Horizontal blanking pixels 8 lsbits (0-4095)
174 End of active to start of next active. */
175x_blk_lsb: .byte XBLANK&0xff
176/* Bits 7-4 Horizontal active pixels 4 msbits
177 Bits 3-0 Horizontal blanking pixels 4 msbits */
178x_msbs: .byte msbs2(XPIX,XBLANK)
179
180/* Vertical active lines 8 lsbits (0-4095) */
181y_act_lsb: .byte YPIX&0xff
182/* Vertical blanking lines 8 lsbits (0-4095) */
183y_blk_lsb: .byte YBLANK&0xff
184/* Bits 7-4 Vertical active lines 4 msbits
185 Bits 3-0 Vertical blanking lines 4 msbits */
186y_msbs: .byte msbs2(YPIX,YBLANK)
187
188/* Horizontal sync offset pixels 8 lsbits (0-1023) From blanking start */
189x_snc_off_lsb: .byte XOFFSET&0xff
190/* Horizontal sync pulse width pixels 8 lsbits (0-1023) */
191x_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) */
194y_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 */
199xy_snc_msbs: .byte msbs4(XOFFSET,XPULSE,YOFFSET,YPULSE)
200
201/* Horizontal display size, mm, 8 lsbits (0-4095 mm, 161 in) */
202x_dsp_size: .byte xsize&0xff
203
204/* Vertical display size, mm, 8 lsbits (0-4095 mm, 161 in) */
205y_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 */
209dsp_size_mbsb: .byte msbs2(xsize,ysize)
210
211/* Horizontal border pixels (each side; total is twice this) */
212x_border: .byte 0
213/* Vertical border lines (each side; total is twice this) */
214y_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. */
229features: .byte 0x18+(VSYNC_POL<<2)+(HSYNC_POL<<1)
230
231descriptor2: .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 */
235start1: .ascii "Linux #0"
236end1: .byte 0x0a /* End marker */
237 .fill 12-(end1-start1), 1, 0x20 /* Padded spaces */
238descriptor3: .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 */
242start2: .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 */
251end2: .byte 0x0a /* End marker */
252 .fill 12-(end2-start2), 1, 0x20 /* Padded spaces */
253descriptor4: .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 */
257start3: .ascii TIMING_NAME
258end3: .byte 0x0a /* End marker */
259 .fill 12-(end3-start3), 1, 0x20 /* Padded spaces */
260extensions: .byte 0 /* Number of extensions to follow */
261checksum: .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 @@
1obj-m := DocBook/ accounting/ auxdisplay/ connector/ \ 1obj-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 @@
1Kernel driver lp855x
2====================
3
4Backlight driver for LP855x ICs
5
6Supported chips:
7 Texas Instruments LP8550, LP8551, LP8552, LP8553 and LP8556
8
9Author: Milo(Woogyom) Kim <milo.kim@ti.com>
10
11Description
12-----------
13
14* Brightness control
15
16Brightness can be controlled by the pwm input or the i2c command.
17The lp855x driver supports both cases.
18
19* Device attributes
20
211) bl_ctl_mode
22Backlight control mode.
23Value : pwm based or register based
24
252) chip_id
26The lp855x chip id.
27Value : lp8550/lp8551/lp8552/lp8553/lp8556
28
29Platform data for lp855x
30------------------------
31
32For 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
49example 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
54static struct lp855x_rom_data lp8552_eeprom_arr[] = {
55 {EEPROM_A5_ADDR, EEPROM_A5_VAL},
56};
57
58static 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
68example 2) lp8556 platform data : pwm input mode with default rom data
69
70static 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
4This document endeavours to explain the common clk framework details,
5and how to port a platform over to this framework. It is not yet a
6detailed explanation of the clock api in include/linux/clk.h, but
7perhaps someday it will include that information.
8
9 Part 1 - introduction and interface split
10
11The common clk framework is an interface to control the clock nodes
12available on various devices today. This may come in the form of clock
13gating, rate adjustment, muxing or other operations. This framework is
14enabled with the CONFIG_COMMON_CLK option.
15
16The interface itself is divided into two halves, each shielded from the
17details of its counterpart. First is the common definition of struct
18clk which unifies the framework-level accounting and infrastructure that
19has traditionally been duplicated across a variety of platforms. Second
20is a common implementation of the clk.h api, defined in
21drivers/clk/clk.c. Finally there is struct clk_ops, whose operations
22are invoked by the clk api implementation.
23
24The second half of the interface is comprised of the hardware-specific
25callbacks registered with struct clk_ops and the corresponding
26hardware-specific structures needed to model a particular clock. For
27the remainder of this document any reference to a callback in struct
28clk_ops, such as .enable or .set_rate, implies the hardware-specific
29implementation of that code. Likewise, references to struct clk_foo
30serve as a convenient shorthand for the implementation of the
31hardware-specific bits for the hypothetical "foo" hardware.
32
33Tying the two halves of this interface together is struct clk_hw, which
34is defined in struct clk_foo and pointed to within struct clk. This
35allows easy for navigation between the two discrete halves of the common
36clock interface.
37
38 Part 2 - common data structures and api
39
40Below is the common struct clk definition from
41include/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
55The members above make up the core of the clk tree topology. The clk
56api itself defines several driver-facing functions which operate on
57struct clk. That api is documented in include/linux/clk.h.
58
59Platforms and devices utilizing the common struct clk use the struct
60clk_ops pointer in struct clk to perform the hardware-specific parts of
61the 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
81The strength of the common struct clk comes from its .ops and .hw pointers
82which abstract the details of struct clk from the hardware-specific bits, and
83vice versa. To illustrate consider the simple gateable clk implementation in
84drivers/clk/clk-gate.c:
85
86struct clk_gate {
87 struct clk_hw hw;
88 void __iomem *reg;
89 u8 bit_idx;
90 ...
91};
92
93struct clk_gate contains struct clk_hw hw as well as hardware-specific
94knowledge about which register and bit controls this clk's gating.
95Nothing about clock topology or accounting, such as enable_count or
96notifier_count, is needed here. That is all handled by the common
97framework code and struct clk.
98
99Let'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
107The call graph for clk_enable is very simple:
108
109clk_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
116And the definition of clk_gate_set_bit:
117
118static 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
127Note that to_clk_gate is defined as:
128
129#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, clk)
130
131This pattern of abstraction is used for every clock hardware
132representation.
133
134 Part 4 - supporting your own clk hardware
135
136When implementing support for a new type of clock it only necessary to
137include the following header:
138
139#include <linux/clk-provider.h>
140
141include/linux/clk.h is included within that header and clk-private.h
142must never be included from the code which implements the operations for
143a clock. More on that below in Part 5.
144
145To construct a clk hardware structure for your platform you must define
146the following:
147
148struct clk_foo {
149 struct clk_hw hw;
150 ... hardware specific data goes here ...
151};
152
153To take advantage of your data you'll need to support valid operations
154for your clk:
155
156struct clk_ops clk_foo_ops {
157 .enable = &clk_foo_enable;
158 .disable = &clk_foo_disable;
159};
160
161Implement the above functions using container_of:
162
163#define to_clk_foo(_hw) container_of(_hw, struct clk_foo, hw)
164
165int 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
176Below is a matrix detailing which clk_ops are mandatory based upon the
177hardware capbilities of that clock. A cell marked as "y" means
178mandatory, a cell marked as "n" implies that either including that
179callback is invalid or otherwise uneccesary. Empty cells are either
180optional 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
203Finally, register your clock at run-time with a hardware-specific
204registration function. This function simply populates struct clk_foo's
205data and then passes the common struct clk parameters to the framework
206with a call to:
207
208clk_register(...)
209
210See the basic clock types in drivers/clk/clk-*.c for examples.
211
212 Part 5 - static initialization of clock data
213
214For platforms with many clocks (often numbering into the hundreds) it
215may be desirable to statically initialize some clock data. This
216presents a problem since the definition of struct clk should be hidden
217from everyone except for the clock core in drivers/clk/clk.c.
218
219To get around this problem struct clk's definition is exposed in
220include/linux/clk-private.h along with some macros for more easily
221initializing instances of the basic clock types. These clocks must
222still be initialized with the common clock framework via a call to
223__clk_init.
224
225clk-private.h must NEVER be included by code which implements struct
226clk_ops callbacks, nor must it be included by any logic which pokes
227around inside of struct clk at run-time. To do so is a layering
228violation.
229
230To better enforce this policy, always follow this simple rule: any
231statically initialized clock data MUST be defined in a separate file
232from the logic that implements its ops. Basically separate the logic
233from 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 @@
1A brief CRC tutorial.
2
3A CRC is a long-division remainder. You add the CRC to the message,
4and the whole thing (message+CRC) is a multiple of the given
5CRC polynomial. To check the CRC, you can either check that the
6CRC matches the recomputed value, *or* you can check that the
7remainder computed on the message+CRC is 0. This latter approach
8is used by a lot of hardware implementations, and is why so many
9protocols put the end-of-frame flag after the CRC.
10
11It'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
17Like all division, the remainder is always smaller than the divisor.
18To produce a 32-bit CRC, the divisor is actually a 33-bit CRC polynomial.
19Since it's 33 bits long, bit 32 is always going to be set, so usually the
20CRC is written in hex with the most significant bit omitted. (If you're
21familiar with the IEEE 754 floating-point format, it's the same idea.)
22
23Note that a CRC is computed over a string of *bits*, so you have
24to decide on the endianness of the bits within each byte. To get
25the best error-detecting properties, this should correspond to the
26order they're actually sent. For example, standard RS-232 serial is
27little-endian; the most significant bit (sometimes used for parity)
28is sent last. And when appending a CRC word to a message, you should
29do it in the right order, matching the endianness.
30
31Just like with ordinary division, you proceed one digit (bit) at a time.
32Each step of the division you take one more digit (bit) of the dividend
33and append it to the current remainder. Then you figure out the
34appropriate multiple of the divisor to subtract to being the remainder
35back into range. In binary, this is easy - it has to be either 0 or 1,
36and to make the XOR cancel, it's just a copy of bit 32 of the remainder.
37
38When computing a CRC, we don't care about the quotient, so we can
39throw the quotient bit away, but subtract the appropriate multiple of
40the polynomial from the remainder and we're back to where we started,
41ready to process the next bit.
42
43A big-endian CRC written this way would be coded like:
44for (i = 0; i < input_bits; i++) {
45 multiple = remainder & 0x80000000 ? CRCPOLY : 0;
46 remainder = (remainder << 1 | next_input_bit()) ^ multiple;
47}
48
49Notice how, to get at bit 32 of the shifted remainder, we look
50at bit 31 of the remainder *before* shifting it.
51
52But also notice how the next_input_bit() bits we're shifting into
53the remainder don't actually affect any decision-making until
5432 bits later. Thus, the first 32 cycles of this are pretty boring.
55Also, to add the CRC to a message, we need a 32-bit-long hole for it at
56the end, so we have to add 32 extra cycles shifting in zeros at the
57end of every message,
58
59These details lead to a standard trick: rearrange merging in the
60next_input_bit() until the moment it's needed. Then the first 32 cycles
61can be precomputed, and merging in the final 32 zero bits to make room
62for the CRC can be skipped entirely. This changes the code to:
63
64for (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
70With this optimization, the little-endian code is particularly simple:
71for (i = 0; i < input_bits; i++) {
72 remainder ^= next_input_bit();
73 multiple = (remainder & 1) ? CRCPOLY : 0;
74 remainder = (remainder >> 1) ^ multiple;
75}
76
77The most significant coefficient of the remainder polynomial is stored
78in the least significant bit of the binary "remainder" variable.
79The other details of endianness have been hidden in CRCPOLY (which must
80be bit-reversed) and next_input_bit().
81
82As 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.
84We can do it 8 bits at a time rather than 1 bit at a time:
85for (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
93Or in little-endian:
94for (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
102If the input is a multiple of 32 bits, you can even XOR in a 32-bit
103word at a time and increase the inner loop count to 32.
104
105You can also mix and match the two loop styles, for example doing the
106bulk of a message byte-at-a-time and adding bit-at-a-time processing
107for any fractional bytes at the end.
108
109To reduce the number of conditional branches, software commonly uses
110the byte-at-a-time table method, popularized by Dilip V. Sarwate,
111"Computation of Cyclic Redundancy Checks via Table Look-Up", Comm. ACM
112v.31 no.8 (August 1998) p. 1008-1013.
113
114Here, rather than just shifting one bit of the remainder to decide
115in the correct multiple to subtract, we can shift a byte at a time.
116This produces a 40-bit (rather than a 33-bit) intermediate remainder,
117and the correct multiple of the polynomial to subtract is found using
118a 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
122When space is more constrained, smaller tables can be used, e.g. two
1234-bit shifts followed by a lookup in a 16-entry table.
124
125It is not practical to process much more than 8 bits at a time using this
126technique, because tables larger than 256 entries use too much memory and,
127more importantly, too much of the L1 cache.
128
129To get higher software performance, a "slicing" technique can be used.
130See "High Octane CRC Generation with the Intel Slicing-by-8 Algorithm",
131ftp://download.intel.com/technology/comms/perfnet/download/slicing-by-8.pdf
132
133This does not change the number of table lookups, but does increase
134the parallelism. With the classic Sarwate algorithm, each table lookup
135must be completed before the index of the next can be computed.
136
137A "slicing by 2" technique would shift the remainder 16 bits at a time,
138producing a 48-bit intermediate remainder. Rather than doing a single
139lookup in a 65536-entry table, the two high bytes are looked up in
140two different 256-entry tables. Each contains the remainder required
141to cancel out the corresponding byte. The tables are different because the
142polynomials to cancel are different. One has non-zero coefficients from
143x^32 to x^39, while the other goes from x^40 to x^47.
144
145Since modern processors can handle many parallel memory operations, this
146takes barely longer than a single table look-up and thus performs almost
147twice as fast as the basic Sarwate algorithm.
148
149This can be extended to "slicing by 4" using 4 256-entry tables.
150Each step, 32 bits of data is fetched, XORed with the CRC, and the result
151broken into bytes and looked up in the tables. Because the 32-bit shift
152leaves the low-order bits of the intermediate remainder zero, the
153final CRC is simply the XOR of the 4 table look-ups.
154
155But this still enforces sequential execution: a second group of table
156look-ups cannot begin until the previous groups 4 table look-ups have all
157been completed. Thus, the processor's load/store unit is sometimes idle.
158
159To make maximum use of the processor, "slicing by 8" performs 8 look-ups
160in parallel. Each step, the 32-bit CRC is shifted 64 bits and XORed
161with 64 bits of input data. What is important to note is that 4 of
162those 8 bytes are simply copies of the input data; they do not depend
163on the previous CRC at all. Thus, those 4 table look-ups may commence
164immediately, without waiting for the previous loop iteration.
165
166By always having 4 loads in flight, a modern superscalar processor can
167be kept busy and make full use of its L1 cache.
168
169Two more details about CRC implementation in the real world:
170
171Normally, appending zero bits to a message which is already a multiple
172of a polynomial produces a larger multiple of that polynomial. Thus,
173a basic CRC will not detect appended zero bits (or bytes). To enable
174a CRC to detect this condition, it's common to invert the CRC before
175appending it. This makes the remainder of the message+crc come out not
176as zero, but some fixed non-zero value. (The CRC of the inversion
177pattern, 0xffffffff.)
178
179The same problem applies to zero bits prepended to the message, and a
180similar solution is used. Instead of starting the CRC computation with
181a remainder of 0, an initial remainder of all ones is used. As long as
182you 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
76As a guide, we suggest you calculate the number of bytes to use in the 76As a guide, we suggest you calculate the number of bytes to use in the
77metadata device as 48 * $data_dev_size / $data_block_size but round it up 77metadata device as 48 * $data_dev_size / $data_block_size but round it up
78to 2MB if the answer is smaller. The largest size supported is 16GB. 78to 2MB if the answer is smaller. If you're creating large numbers of
79snapshots which are recording large amounts of change, you may find you
80need to increase this.
79 81
80If you're creating large numbers of snapshots which are recording large 82The largest size supported is 16GB: If the device is larger,
81amounts of change, you may need find you need to increase this. 83a warning will be issued and the excess space will not be used.
82 84
83Reloading a pool table 85Reloading 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
172External snapshots
173------------------
174
175You can use an external _read only_ device as an origin for a
176thinly-provisioned volume. Any read to an unprovisioned area of the
177thin device will be passed through to the origin. Writes trigger
178the allocation of new blocks as usual.
179
180One use case for this is VM hosts that want to run guests on
181thinly-provisioned volumes but have the base image on another device
182(possibly shared between many VMs).
183
184You must not write to the origin device if you use this technique!
185Of course, you may write to the thin device and take internal snapshots
186of the thin volume.
187
188i) 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
195ii) 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
170Deactivation 204Deactivation
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
263i) Constructor 293i) 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
274The pool doesn't store any size against the thin devices. If you 309The pool doesn't store any size against the thin devices. If you
275load a thin target that is smaller than you've been using previously, 310load a thin target that is smaller than you've been using previously,
276then you'll have no access to blocks mapped beyond the end. If you 311then 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 @@
1dm-verity
2==========
3
4Device-Mapper's "verity" target provides transparent integrity checking of
5block devices using a cryptographic digest provided by the kernel crypto API.
6This target is read-only.
7
8Construction 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
65Theory of operation
66===================
67
68dm-verity is meant to be setup as part of a verified boot path. This
69may be anything ranging from a boot using tboot or trustedgrub to just
70booting from a known-good device (like a USB drive or CD).
71
72When a dm-verity device is configured, it is expected that the caller
73has been authenticated in some way (cryptographic signatures, etc).
74After instantiation, all hashes will be verified on-demand during
75disk access. If they cannot be verified up to the root node of the
76tree, the root hash, then the I/O will fail. This should identify
77tampering with any data on the device and the hash data.
78
79Cryptographic hashes are used to assert the integrity of the device on a
80per-block basis. This allows for a lightweight hash computation on first read
81into the page cache. Block hashes are stored linearly-aligned to the nearest
82block the size of a page.
83
84Hash Tree
85---------
86
87Each node in the tree is a cryptographic hash. If it is a leaf node, the hash
88is of some block data on disk. If it is an intermediary node, then the hash is
89of a number of child nodes.
90
91Each entry in the tree is a collection of neighboring nodes that fit in one
92block. The number is determined based on block_size and the size of the
93selected cryptographic digest algorithm. The hashes are linearly-ordered in
94this entry and any unaligned trailing space is ignored but included when
95calculating the parent node.
96
97The tree looks something like:
98
99alg = 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
110On-disk format
111==============
112
113Below is the recommended on-disk format. The verity kernel code does not
114read the on-disk header. It only reads the hash blocks which directly
115follow the header. It is expected that a user-space tool will verify the
116integrity of the verity_header and then call dmsetup with the correct
117parameters. Alternatively, the header can be omitted and the dmsetup
118parameters can be passed via the kernel command-line in a rooted chain
119of trust where the command-line is verified.
120
121The on-disk format is especially useful in cases where the hash blocks
122are on a separate partition. The magic number allows easy identification
123of the partition contents. Alternatively, the hash blocks can be stored
124in the same partition as the data to be verified. In such a configuration
125the filesystem on the partition would be sized a little smaller than
126the full-partition, leaving room for the hash blocks.
127
128struct 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
166Directly following the header (and with sector number padded to the next hash
167block 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
170Status
171======
172V (for Valid) is returned if every check performed so far was valid.
173If any check failed, C (for Corruption) is returned.
174
175Example
176=======
177
178Setup 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
185A command line tool veritysetup is available to compute or verify
186the hash tree or activate the kernel driver. This is available from
187the LVM2 upstream repository and may be supplied as a package called
188device-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
193veritysetup -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
3Required 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
19Examples:
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 @@
1Atmel AT91 device tree bindings.
2================================
3
4PIT 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
10TC/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
18Examples:
19
20One interrupt per TC block:
21 tcb0: timer@fff7c000 {
22 compatible = "atmel,at91rm9200-tcb";
23 reg = <0xfff7c000 0x100>;
24 interrupts = <18 4>;
25 };
26
27One 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
34RSTC 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
39Example:
40
41 rstc@fffffd00 {
42 compatible = "atmel,at91sam9260-rstc";
43 reg = <0xfffffd00 0x10>;
44 };
45
46RAMC 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
52Examples:
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
65SHDWC Shutdown Controller
66
67required 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
72optional 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
77optional at91sam9260 properties:
78- atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up.
79
80optional 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
84optional at91sam9x5 properties:
85- atmel,wakeup-rtc-timer: boolean to enable Real-time Clock Wake-up.
86
87Example:
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
3Required properties:
4- compatible: Should be "atmel,at91rm9200-pmc"
5- reg: Should contain PMC registers location and length
6
7Examples:
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:
28i.MX6 Quad SABRE Lite Board 28i.MX6 Quad SABRE Lite Board
29Required root node properties: 29Required root node properties:
30 - compatible = "fsl,imx6q-sabrelite", "fsl,imx6q"; 30 - compatible = "fsl,imx6q-sabrelite", "fsl,imx6q";
31
32Generic i.MX boards
33-------------------
34
35No iomux setup is done for these boards, so this must have been configured
36by the bootloader for boards to work with the generic bindings.
37
38i.MX27 generic board
39Required root node properties:
40 - compatible = "fsl,imx27";
41
42i.MX51 generic board
43Required root node properties:
44 - compatible = "fsl,imx51";
45
46i.MX53 generic board
47Required root node properties:
48 - compatible = "fsl,imx53";
49
50i.MX6q generic board
51Required 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 @@
1Marvell Platforms Device Tree Bindings
2----------------------------------------------------
3
4PXA168 Aspenite Board
5Required 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
3OMAP2/3 are using a TI interrupt controller that can support several
4configurable number of interrupts.
5
6Main 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
18Example:
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 @@
1ST SPEAr Platforms Device Tree Bindings
2---------------------------------------
3
4Boards with the ST SPEAr600 SoC shall have the following properties:
5
6Required root node property:
7
8compatible = "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 @@
1Embedded Memory Controller
2
3Properties:
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
14Child device nodes describe the memory settings for different configurations and clock rates.
15
16Example:
17
18 emc@7000f400 {
19 #address-cells = < 1 >;
20 #size-cells = < 0 >;
21 compatible = "nvidia,tegra20-emc";
22 reg = <0x7000f4000 0x200>;
23 }
24
25
26Embedded Memory Controller ram-code table
27
28If the emc node has the nvidia,use-ram-code property present, then the
29next level of nodes below the emc table are used to specify which settings
30apply for which ram-code settings.
31
32If the emc node lacks the nvidia,use-ram-code property, this level is omitted
33and the tables are stored directly under the emc node (see below).
34
35Properties:
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
43Embedded Memory Controller configuration table
44
45This is a table containing the EMC register settings for the various
46operating speeds of the memory controller. They are always located as
47subnodes of the emc controller node.
48
49There 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
64Properties:
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 @@
1NVIDIA Tegra Power Management Controller (PMC)
2
3Properties:
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
13Example:
14
15pmc@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
3ARM 11MP, Cortex-A5 and Cortex-A9 are often associated with a per-core
4Timer-Watchdog (aka TWD), which provides both a per-cpu local timer
5and watchdog.
6
7The TWD is usually attached to a GIC to deliver its two per-processor
8interrupts.
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
22Example:
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
42Example:
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 @@
1ARM Versatile Express boards family
2-----------------------------------
3
4ARM's Versatile Express platform consists of a motherboard and one
5or more daughterboards (tiles). The motherboard provides a set of
6peripherals. Processor and RAM "live" on the tiles.
7
8The motherboard and each core tile should be described by a separate
9Device Tree source file, with the tile's description including
10the motherboard file using a /include/ directive. As the motherboard
11can be initialized in one of two different configurations ("memory
12maps"), care must be taken to include the correct one.
13
14Required 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
35Optional 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
48Top-level standard "cpus" node is required. It must contain a node
49with 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
62The motherboard description file provides a single "motherboard" node
63using 2 address cells corresponding to the Static Memory Bus used
64between the motherboard and the tile. The first cell defines the Chip
65Select (CS) line number, the second cell address offset within the CS.
66All interrupt lines between the motherboard and the tile are active
67high and are described using single cell.
68
69Optional 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
80Motherboard .dtsi files provide a set of labelled peripherals that
81can 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
90Current Linux implementation requires a "arm,v2m_timer" alias
91pointing at one of the motherboard's SP804 timers, if it is to be
92used as the system timer. This alias should be defined in the
93motherboard files.
94
95The tile description must define "ranges", "interrupt-map-mask" and
96"interrupt-map" properties to translate the motherboard's address
97and interrupt space into one used by the tile's processor.
98
99Abbreviated 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
3Required 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
9Examples:
10
11apbdma: 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 @@
1OMAP GPIO controller bindings
2
3Required 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
22OMAP 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
27Example:
28
29gpio4: 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 @@
1twl4030 GPIO controller bindings
2
3Required 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
15Example:
16
17twl_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
3Required 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
12Example:
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 @@
1Device-Tree bindings for i2c gpio driver
2
3Required properties:
4 - compatible = "i2c-gpio";
5 - gpios: sda and scl gpio
6
7
8Optional 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
15Example nodes:
16
17i2c@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 @@
1NVIDIA Tegra 2 GPIO controller 1NVIDIA Tegra GPIO controller
2 2
3Required properties: 3Required 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
24Example:
25
26gpio: 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
3Required 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
12Example:
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 @@
1GPIO controller on CE4100 / Sodaville SoCs
2==========================================
3
4The bindings for CE4100's GPIO controller match the generic description
5which is covered by the gpio.txt file in this folder.
6
7The only additional property is the intel,muxctl property which holds the
8value which is written into the MUXCNTL register.
9
10There is no compatible property for now because the driver is probed via
11PCI id (vendor 0x8086 device 0x2e67).
12
13The 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
19Example 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
3Required 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
11Recommended 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
24Examples:
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 @@
1I2C for SiRFprimaII platforms
2
3Required 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
9Optional 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
13Examples :
14
15i2c0: 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 @@
1A simple common binding for matrix-connected key boards. Currently targeted at
2defining the keys in the scope of linux key codes since that is a stable and
3standardized interface at this time.
4
5Required 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
11Optional properties:
12Some users of this binding might choose to specify secondary keymaps for
13cases where there is a modifier key such as a Fn key. Proposed names
14for said properties are "linux,fn-keymap" or with another descriptive
15word for the modifier other from "Fn".
16
17Example:
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 @@
3Required properties: 3Required properties:
4- compatible: "nvidia,tegra20-kbc" 4- compatible: "nvidia,tegra20-kbc"
5 5
6Optional properties: 6Optional properties, in addition to those specified by the shared
7- debounce-delay: delay in milliseconds per row scan for debouncing 7matrix-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
12Example: 17Example:
13 18
14keyboard: keyboard { 19keyboard: 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
3The Highspeed MMC Host Controller on TI OMAP family
4provides an interface for MMC, SD, and SDIO types of memory cards.
5
6Required 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
14Optional properties:
15ti,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
18ti,bus-width: Number of data lines, default assumed is 1 if the property is missing.
19cd-gpios: GPIOs for card detection
20wp-gpios: GPIOs for write protection
21ti,non-removable: non-removable slot (like eMMC)
22ti,needs-special-reset: Requires a special softreset sequence
23
24Example:
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 @@
1Atmel NAND flash
2
3Required 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
15Optional 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
22Examples:
23nand0: 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
3Required 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
11Example:
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 @@
1PXA UART controller
2
3Required 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 @@
1ALC5632 audio CODEC
2
3This device supports I2C only.
4
5Required 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
16Example:
17
18alc5632: 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 @@
1Freescale Digital Audio Mux (AUDMUX) device
2
3Required 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
8Example:
9
10audmux@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 @@
1NVIDIA Tegra audio complex
2
3Required 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
40Example:
41
42sound {
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 @@
1Atmel SOC USB controllers
2
3OHCI
4
5Required 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
14usb0: ohci@00500000 {
15 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
16 reg = <0x00500000 0x100000>;
17 interrupts = <20 4>;
18 num-ports = <2>;
19};
20
21EHCI
22
23Required properties:
24 - compatible: Should be "atmel,at91sam9g45-ehci" for USB controllers
25 used in host mode.
26
27usb1: ehci@00800000 {
28 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
29 reg = <0x00800000 0x100000>;
30 interrupts = <22 4>;
31};
32
33AT91 USB device controller
34
35Required 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
40Optional properties:
41 - atmel,vbus-gpio: If present, specifies a gpio that needs to be
42 activated for the bus to be powered.
43
44usb1: 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
15Optional 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
34powervr Imagination Technologies 34powervr Imagination Technologies
35qcom Qualcomm, Inc. 35qcom Qualcomm, Inc.
36ramtron Ramtron International 36ramtron Ramtron International
37realtek Realtek Semiconductor Corp.
37samsung Samsung Semiconductor 38samsung Samsung Semiconductor
38sbs Smart Battery System 39sbs Smart Battery System
39schindler Schindler 40schindler 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]
33For this first version, A buffer shared using the dma_buf sharing API: 33For 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
39dma-buf operations for device dma only
40--------------------------------------
37 41
38The dma_buf buffer sharing API usage contains the following steps: 42The 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
222Miscellaneous notes: 226Kernel cpu access to a dma-buf buffer object
227--------------------------------------------
228
229The motivation to allow cpu access from the kernel to a dma-buf object from the
230importers 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
239Access to a dma_buf from the kernel context involves three steps:
240
2411. Prepare access, which invalidate any necessary caches and make the object
242 available for cpu access.
2432. Access the object page-by-page with the dma_buf map apis
2443. Finish access, which will flush any necessary cpu caches and free reserved
245 resources.
246
2471. 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
2692. 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
3033. 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
316Miscellaneous 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
226References: 339References:
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
66For LME2510C 66For LME2510C
67dd if=US290D.sys ibs=1 skip=33152 count=3697 of=dvb-usb-lme2510c-s0194.fw 67dd if=US290D.sys ibs=1 skip=33152 count=3697 of=dvb-usb-lme2510c-s0194.fw
68 68
69---------------------------------------------------------------------
70
71The m88rs2000 tuner driver can be found in windows/system32/drivers
72
73US2B0D.sys (dated 29 Jun 2010)
74
75dd if=US2B0D.sys ibs=1 skip=34432 count=3871 of=dvb-usb-lme2510c-rs2000.fw
76
77We need to modify id of rs2000 firmware or it will warm boot id 3344:1120.
78
79echo -ne \\xF0\\x22 | dd conv=notrunc bs=1 count=2 seek=266 of=dvb-usb-lme2510c-rs2000.fw
69 80
70Copy the firmware file(s) to /lib/firmware 81Copy 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
516What: The CAP9 SoC family will be removed
517When: 3.4
518Files: 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
524Why: The code is not actively maintained and platforms are now hard to find.
525Who: Nicolas Ferre <nicolas.ferre@atmel.com>
526 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
527
528----------------------------
529
530What: Low Performance USB Block driver ("CONFIG_BLK_DEV_UB") 516What: Low Performance USB Block driver ("CONFIG_BLK_DEV_UB")
531When: 3.6 517When: 3.6
532Why: This driver provides support for USB storage devices like "USB 518Why: 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
147journal=update Update the ext4 file system's journal to the current
148 format.
149
150journal_dev=devnum When the external journal device's major/minor numbers 147journal_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
359resize 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
364block_validity This options allows to enables/disables the in-kernel 356block_validity This options allows to enables/disables the in-kernel
365noblock_validity facility for tracking filesystem metadata blocks 357noblock_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=========
5Id mapper is used by NFS to translate user and group ids into names, and to 5Id mapper is used by NFS to translate user and group ids into names, and to
6translate user and group names into ids. Part of this translation involves 6translate user and group names into ids. Part of this translation involves
7performing an upcall to userspace to request the information. Id mapper will 7performing an upcall to userspace to request the information. There are two
8user request-key to perform this upcall and cache the result. The program 8ways 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 9or by placing a call to the rpc.idmap daemon.
10translation and initialize a key with the resulting information. 10
11NFS will attempt to call /sbin/request-key first. If this succeeds, the
12result will be cached using the generic request-key cache. This call should
13only fail if /etc/request-key.conf is not configured for the id_resolver key
14type, see the "Configuring" section below if you wish to use the request-key
15method.
16
17If the call to /sbin/request-key fails (if /etc/request-key.conf is not
18configured with the id_resolver key type), then the idmapper will ask the
19legacy rpc.idmap daemon for the id mapping. This result will be stored
20in 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===========
16Configuring 24Configuring
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
53bit which holds it in the pnfs_layout_hdr's list. When the final lseg 53bit which holds it in the pnfs_layout_hdr's list. When the final lseg
54is removed from the pnfs_layout_hdr's list, the NFS_LAYOUT_DESTROYED 54is removed from the pnfs_layout_hdr's list, the NFS_LAYOUT_DESTROYED
55bit is set, preventing any new lsegs from being added. 55bit is set, preventing any new lsegs from being added.
56
57layout drivers
58--------------
59
60PNFS utilizes what is called layout drivers. The STD defines 3 basic
61layout types: "files" "objects" and "blocks". For each of these types
62there is a layout-driver with a common function-vectors table which
63are called by the nfs-client pnfs-core to implement the different layout
64types.
65
66Files-layout-driver code is in: fs/nfs/nfs4filelayout.c && nfs4filelayoutdev.c
67Objects-layout-deriver code is in: fs/nfs/objlayout/.. directory
68Blocks-layout-deriver code is in: fs/nfs/blocklayout/.. directory
69
70objects-layout setup
71--------------------
72
73As part of the full STD implementation the objlayoutdriver.ko needs, at times,
74to automatically login to yet undiscovered iscsi/osd devices. For this the
75driver makes up-calles to a user-mode script called *osd_login*
76
77The path_name of the script to use is by default:
78 /sbin/osd_login.
79This name can be overridden by the Kernel module parameter:
80 objlayoutdriver.osd_login_prog
81
82If Kernel does not find the osd_login_prog path it will zero it out
83and will not attempt farther logins. An admin can then write new value
84to the objlayoutdriver.osd_login_prog Kernel parameter to re-enable it.
85
86The /sbin/osd_login is part of the nfs-utils package, and should usually
87be installed on distributions that support this Kernel version.
88
89The 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
106blocks-layout setup
107-------------------
108
109TODO: 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
271power management, such as by powering down unused chip sectors and, more 271power management, such as by powering down unused chip sectors and, more
272easily, gating off unused clocks. 272easily, gating off unused clocks.
273 273
274Note that requesting a GPIO does NOT cause it to be configured in any 274For GPIOs that use pins known to the pinctrl subsystem, that subsystem should
275way; it just marks that GPIO as in use. Separate code must handle any 275be informed of their use; a gpiolib driver's .request() operation may call
276pin setup (e.g. controlling which pin the GPIO uses, pullup/pulldown). 276pinctrl_request_gpio(), and a gpiolib driver's .free() operation may call
277pinctrl_free_gpio(). The pinctrl subsystem allows a pinctrl_request_gpio()
278to succeed concurrently with a pin or pingroup being "owned" by a device for
279pin multiplexing.
280
281Any programming of pin multiplexing hardware that is needed to route the
282GPIO signal to the appropriate pin should occur within a GPIO driver's
283.direction_input() or .direction_output() operations, and occur after any
284setup of an output GPIO's value. This allows a glitch-free migration from a
285pin's special function to GPIO. This is sometimes required when using a GPIO
286to implement a workaround on signals typically driven by a non-GPIO HW block.
287
288Some platforms allow some or all GPIO signals to be routed to different pins.
289Similarly, other aspects of the GPIO or pin may need to be configured, such as
290pullup/pulldown. Platform software should arrange that any such details are
291configured prior to gpio_request() being called for those GPIOs, e.g. using
292the pinctrl subsystem's mapping table, so that GPIO users need not be aware
293of these details.
277 294
278Also note that it's your responsibility to have stopped using a GPIO 295Also note that it's your responsibility to have stopped using a GPIO
279before you free it. 296before 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
306since GPIOF_INIT_* are only valid when configured as output, so group valid 325since GPIOF_INIT_* are only valid when configured as output, so group valid
307combinations as: 326combinations 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
313In the future, these flags can be extended to support more properties such 332When setting the flag as GPIOF_OPEN_DRAIN then it will assume that pins is
314as open-drain status. 333open drain type. Such pins will not be driven to 1 in output mode. It is
334require to connect pull-up on such pins. By enabling this flag, gpio lib will
335make the direction to input when it is asked to set value of 1 in output mode
336to make the pin HIGH. The pin is make to LOW by driving value 0 in output mode.
337
338When setting the flag as GPIOF_OPEN_SOURCE then it will assume that pins is
339open source type. Such pins will not be driven to 0 in output mode. It is
340require to connect pull-down on such pin. By enabling this flag, gpio lib will
341make the direction to input when it is asked to set value of 0 in output mode
342to make the pin LOW. The pin is make to HIGH by driving value 1 in output mode.
343
344In the future, these flags can be extended to support more properties.
315 345
316Further more, to ease the claim/release of multiple GPIOs, 'struct gpio' is 346Further more, to ease the claim/release of multiple GPIOs, 'struct gpio' is
317introduced to encapsulate all three fields as: 347introduced 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
122Author: Jean Delvare <khali@linux-fr.org> 126Author: 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
4Supported chips: 4Supported 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
9Authors: 12Authors:
10 Sascha Hauer <s.hauer@pengutronix.de> 13 Sascha Hauer <s.hauer@pengutronix.de>
@@ -13,20 +16,21 @@ Authors:
13Description 16Description
14----------- 17-----------
15 18
16The Freescale MC13783 is a Power Management and Audio Circuit. Among 19The Freescale MC13783 and MC13892 are Power Management and Audio Circuits.
17other things it contains a 10-bit A/D converter. The converter has 16 20Among other things they contain a 10-bit A/D converter. The converter has 16
18channels which can be used in different modes. 21(MC13783) resp. 12 (MC13892) channels which can be used in different modes. The
19The A/D converter has a resolution of 2.25mV. Channels 0-4 have 22A/D converter has a resolution of 2.25mV.
20a dedicated meaning with chip internal scaling applied. Channels 5-7
21can be used as general purpose inputs or alternatively in a dedicated
22mode. Channels 12-15 are occupied by the touchscreen if it's active.
23 23
24Currently the driver only supports channels 2 and 5-15 with no alternative 24Some channels can be used as General Purpose inputs or in a dedicated mode with
25modes for channels 5-7. 25a chip internal scaling applied .
26 26
27See this table for the meaning of the different channels and their chip 27Currently the driver only supports the Application Supply channel (BP / BPSNS),
28internal scaling: 28the General Purpose inputs and touchscreen.
29 29
30See the following tables for the meaning of the different channels and their
31chip internal scaling:
32
33MC13783:
30Channel Signal Input Range Scaling 34Channel Signal Input Range Scaling
31------------------------------------------------------------------------------- 35-------------------------------------------------------------------------------
320 Battery Voltage (BATT) 2.50 - 4.65V -2.40V 360 Battery Voltage (BATT) 2.50 - 4.65V -2.40V
@@ -34,7 +38,7 @@ Channel Signal Input Range Scaling
342 Application Supply (BP) 2.50 - 4.65V -2.40V 382 Application Supply (BP) 2.50 - 4.65V -2.40V
353 Charger Voltage (CHRGRAW) 0 - 10V / /5 393 Charger Voltage (CHRGRAW) 0 - 10V / /5
36 0 - 20V /10 40 0 - 20V /10
374 Charger Current (CHRGISNSP-CHRGISNSN) -0.25V - 0.25V x4 414 Charger Current (CHRGISNSP-CHRGISNSN) -0.25 - 0.25V x4
385 General Purpose ADIN5 / Battery Pack Thermistor 0 - 2.30V No 425 General Purpose ADIN5 / Battery Pack Thermistor 0 - 2.30V No
396 General Purpose ADIN6 / Backup Voltage (LICELL) 0 - 2.30V / No / 436 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
4813 General Purpose TSX2 / Touchscreen X-plate 2 0 - 2.30V No 5213 General Purpose TSX2 / Touchscreen X-plate 2 0 - 2.30V No
4914 General Purpose TSY1 / Touchscreen Y-plate 1 0 - 2.30V No 5314 General Purpose TSY1 / Touchscreen Y-plate 1 0 - 2.30V No
5015 General Purpose TSY2 / Touchscreen Y-plate 2 0 - 2.30V No 5415 General Purpose TSY2 / Touchscreen Y-plate 2 0 - 2.30V No
55
56MC13892:
57Channel Signal Input Range Scaling
58-------------------------------------------------------------------------------
590 Battery Voltage (BATT) 0 - 4.8V /2
601 Battery Current (BATT - BATTISNSCC) -60 - 60 mV x20
612 Application Supply (BPSNS) 0 - 4.8V /2
623 Charger Voltage (CHRGRAW) 0 - 12V / /5
63 0 - 20V /10
644 Charger Current (CHRGISNS-BPSNS) / -0.3 - 0.3V / x4 /
65 Touchscreen X-plate 1 0 - 2.4V No
665 General Purpose ADIN5 / Battery Pack Thermistor 0 - 2.4V No
676 General Purpose ADIN6 / Backup Voltage (LICELL) 0 - 2.4V / No
68 Backup Voltage (LICELL) 0 - 3.6V x2/3
697 General Purpose ADIN7 / UID / Die Temperature 0 - 2.4V / No /
70 0 - 4.8V /2
7112 General Purpose TSX1 / Touchscreen X-plate 1 0 - 2.4V No
7213 General Purpose TSX2 / Touchscreen X-plate 2 0 - 2.4V No
7314 General Purpose TSY1 / Touchscreen Y-plate 1 0 - 2.4V No
7415 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 @@
1Kernel driver MCP3021
2======================
3
4Supported chips:
5 * Microchip Technology MCP3021
6 Prefix: 'mcp3021'
7 Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21805a.pdf
8
9Author: Mingkai Hu
10
11Description
12-----------
13
14This driver implements support for the Microchip Technology MCP3021 chip.
15
16The Microchip Technology Inc. MCP3021 is a successive approximation A/D
17converter (ADC) with 10-bit resolution.
18This device provides one single-ended input with very low power consumption.
19Communication to the MCP3021 is performed using a 2-wire I2C compatible
20interface. Standard (100 kHz) and Fast (400 kHz) I2C modes are available.
21The default I2C device address is 0x4d (contact the Microchip factory for
22additional 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
25On Intel Patsburg and later chipsets, both the normal host SMBus controller 26On 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
45Usage 45Usage
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
17devices are created by the driver. Additionally, loading the driver with the 17devices are created by the driver. Additionally, loading the driver with the
18debug option will report all events in the kernel log. 18debug option will report all events in the kernel log.
19 19
20The "scancodes" passed to the input system (that can be remapped with udev)
21are indexes to the table "sony_laptop_input_keycode_map" in the sony-laptop.c
22module. For example the "FN/E" key combination (EJECTCD on some models)
23generates the scancode 20 (0x14).
24
20Backlight control: 25Backlight control:
21------------------ 26------------------
22If your laptop model supports it, you will find sysfs files in the 27If 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
43example platform data: 43example platform data:
44 44
45Note: chan_nr can have values between 0 and 2. 45Note: chan_nr can have values between 0 and 2.
46The name of each channel can be configurable.
47If 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
47static struct lp5521_led_config lp5521_led_config[] = { 50static 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
87If the current is set to 0 in the platform data, that channel is 93If the current is set to 0 in the platform data, that channel is
88disabled and it is not visible in the sysfs. 94disabled and it is not visible in the sysfs.
95
96The 'update_config' : CONFIG register (ADDR 08h)
97This value is platform-specific data.
98If 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
102example 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
108static 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
115LED patterns : LP5521 has autonomous operation without external control.
116Pattern data can be defined in the platform data.
117
118example of led pattern data :
119
120/* RGB(50,5,0) 500ms on, 500ms off, infinite loop */
121static u8 pattern_red[] = {
122 0x40, 0x32, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00,
123 };
124
125static u8 pattern_green[] = {
126 0x40, 0x05, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00,
127 };
128
129static 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
138static 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
146Then predefined led pattern(s) can be executed via the sysfs.
147To start the pattern #1,
148# echo 1 > /sys/bus/i2c/devices/xxxx/led_pattern
149(xxxx : i2c bus & slave address)
150To 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
206stable value when nothing is driving the rail it is connected to, or when it's 206stable value when nothing is driving the rail it is connected to, or when it's
207unconnected. 207unconnected.
208 208
209For example, a platform may do this: 209Pin configuration can be programmed either using the explicit APIs described
210immediately below, or by adding configuration entries into the mapping table;
211see section "Board/machine configuration" below.
212
213For example, a platform may do the following to pull up a pin to VDD:
214
215#include <linux/pinctrl/consumer.h>
210 216
211ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP); 217ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP);
212 218
213To pull up a pin to VDD. The pin configuration driver implements callbacks for 219The format and meaning of the configuration parameter, PLATFORM_X_PULL_UP
214changing pin configuration in the pin controller ops like this: 220above, is entirely defined by the pin controller driver.
221
222The pin configuration driver implements callbacks for changing pin
223configuration 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.
726All the above functions are mandatory to implement for a pinmux driver. 731All the above functions are mandatory to implement for a pinmux driver.
727 732
728 733
729Pinmux interaction with the GPIO subsystem 734Pin control interaction with the GPIO subsystem
730========================================== 735===============================================
731 736
732The public pinmux API contains two functions named pinmux_request_gpio() 737The public pinmux API contains two functions named pinctrl_request_gpio()
733and pinmux_free_gpio(). These two functions shall *ONLY* be called from 738and pinctrl_free_gpio(). These two functions shall *ONLY* be called from
734gpiolib-based drivers as part of their gpio_request() and 739gpiolib-based drivers as part of their gpio_request() and
735gpio_free() semantics. Likewise the pinmux_gpio_direction_[input|output] 740gpio_free() semantics. Likewise the pinctrl_gpio_direction_[input|output]
736shall only be called from within respective gpio_direction_[input|output] 741shall only be called from within respective gpio_direction_[input|output]
737gpiolib implementation. 742gpiolib implementation.
738 743
739NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be 744NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be
740muxed in. Instead, implement a proper gpiolib driver and have that driver 745controlled e.g. muxed in. Instead, implement a proper gpiolib driver and have
741request proper muxing for its pins. 746that driver request proper muxing and other control for its pins.
742 747
743The function list could become long, especially if you can convert every 748The function list could become long, especially if you can convert every
744individual pin into a GPIO pin independent of any other pins, and then try 749individual 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.
747In this case, the function array would become 64 entries for each GPIO 752In this case, the function array would become 64 entries for each GPIO
748setting and then the device functions. 753setting and then the device functions.
749 754
750For this reason there are two functions a pinmux driver can implement 755For this reason there are two functions a pin control driver can implement
751to enable only GPIO on an individual pin: .gpio_request_enable() and 756to 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
762will be passed along to this function. 767will be passed along to this function.
763 768
764Alternatively to using these special functions, it is fully allowed to use 769Alternatively to using these special functions, it is fully allowed to use
765named functions for each GPIO pin, the pinmux_request_gpio() will attempt to 770named functions for each GPIO pin, the pinctrl_request_gpio() will attempt to
766obtain the function "gpioN" where "N" is the global GPIO pin number if no 771obtain the function "gpioN" where "N" is the global GPIO pin number if no
767special GPIO-handler is registered. 772special GPIO-handler is registered.
768 773
769 774
770Pinmux board/machine configuration 775Board/machine configuration
771================================== 776==================================
772 777
773Boards and machines define how a certain complete running system is put 778Boards 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
775constrained and how the clock tree looks. Of course pinmux settings are also 780constrained and how the clock tree looks. Of course pinmux settings are also
776part of this. 781part of this.
777 782
778A pinmux config for a machine looks pretty much like a simple regulator 783A pin controller configuration for a machine looks pretty much like a simple
779configuration, so for the example array above we want to enable i2c and 784regulator configuration, so for the example array above we want to enable i2c
780spi on the second function mapping: 785and spi on the second function mapping:
781 786
782#include <linux/pinctrl/machine.h> 787#include <linux/pinctrl/machine.h>
783 788
784static const struct pinmux_map __initdata pmx_mapping[] = { 789static 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
806As you can see we may have several pin controllers on the system and thus 817As you can see we may have several pin controllers on the system and thus
807we need to specify which one of them that contain the functions we wish 818we need to specify which one of them that contain the functions we wish
808to map. The map can also use struct device * directly, so there is no 819to map.
809inherent need to use strings to specify .dev_name or .ctrl_dev_name, these
810are for the situation where you do not have a handle to the struct device *,
811for example if they are not yet instantiated or cumbersome to obtain.
812 820
813You register this pinmux mapping to the pinmux subsystem by simply: 821You 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
817Since the above construct is pretty common there is a helper macro to make 825Since the above construct is pretty common there is a helper macro to make
818it even more compact which assumes you want to use pinctrl-foo and position 826it even more compact which assumes you want to use pinctrl-foo and position
8190 for mapping, for example: 8270 for mapping, for example:
820 828
821static struct pinmux_map __initdata pmx_mapping[] = { 829static 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
833The mapping table may also contain pin configuration entries. It's common for
834each pin/group to have a number of configuration entries that affect it, so
835the table entries for configuration reference an array of config parameters
836and values. An example using the convenience macros is shown below:
837
838static unsigned long i2c_grp_configs[] = {
839 FOO_PIN_DRIVEN,
840 FOO_PIN_PULLUP,
841};
842
843static unsigned long i2c_pin_configs[] = {
844 FOO_OPEN_COLLECTOR,
845 FOO_SLEW_RATE_SLOW,
846};
847
848static 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
855Finally, some devices expect the mapping table to contain certain specific
856named states. When running on hardware that doesn't need any pin controller
857configuration, the mapping table must still contain those named states, in
858order to explicitly indicate that the states were provided and intended to
859be empty. Table entry macro PIN_MAP_DUMMY_STATE serves the purpose of defining
860a named state without causing any pin controller to be programmed:
861
862static 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
849This example mapping is used to switch between two positions for spi0 at 892This example mapping is used to switch between two positions for spi0 at
850runtime, as described further below under the heading "Runtime pinmuxing". 893runtime, as described further below under the heading "Runtime pinmuxing".
851 894
852Further it is possible to match several groups of pins to the same function 895Further it is possible for one named state to affect the muxing of several
853for a single device, say for example in the mmc0 example above, where you can 896groups of pins, say for example in the mmc0 example above, where you can
854additively expand the mmc0 bus from 2 to 4 to 8 pins. If we want to use all 897additively expand the mmc0 bus from 2 to 4 to 8 pins. If we want to use all
855three groups for a total of 2+2+4 = 8 pins (for an 8-bit MMC bus as is the 898three groups for a total of 2+2+4 = 8 pins (for an 8-bit MMC bus as is the
856case), we define a mapping like this: 899case), 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
902The result of grabbing this mapping from the device with something like 952The result of grabbing this mapping from the device with something like
903this (see next paragraph): 953this (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
959or more simply:
960
961 p = pinctrl_get_select(dev, "8bit");
906 962
907Will be that you activate all the three bottom records in the mapping at 963Will be that you activate all the three bottom records in the mapping at
908once. Since they share the same name, pin controller device, funcion and 964once. Since they share the same name, pin controller device, function and
909device, and since we allow multiple groups to match to a single device, they 965device, and since we allow multiple groups to match to a single device, they
910all get selected, and they all get enabled and disable simultaneously by the 966all get selected, and they all get enabled and disable simultaneously by the
911pinmux core. 967pinmux core.
@@ -914,97 +970,111 @@ pinmux core.
914Pinmux requests from drivers 970Pinmux requests from drivers
915============================ 971============================
916 972
917Generally it is discouraged to let individual drivers get and enable pinmuxes. 973Generally it is discouraged to let individual drivers get and enable pin
918So if possible, handle the pinmuxes in platform code or some other place where 974control. So if possible, handle the pin control in platform code or some other
919you have access to all the affected struct device * pointers. In some cases 975place where you have access to all the affected struct device * pointers. In
920where a driver needs to switch between different mux mappings at runtime 976some cases where a driver needs to e.g. switch between different mux mappings
921this is not possible. 977at runtime this is not possible.
922 978
923A driver may request a certain mux to be activated, usually just the default 979A driver may request a certain control state to be activated, usually just the
924mux like this: 980default state like this:
925 981
926#include <linux/pinctrl/pinmux.h> 982#include <linux/pinctrl/consumer.h>
927 983
928struct foo_state { 984struct foo_state {
929 struct pinmux *pmx; 985 struct pinctrl *p;
986 struct pinctrl_state *s;
930 ... 987 ...
931}; 988};
932 989
933foo_probe() 990foo_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
946foo_remove() 1016foo_remove()
947{ 1017{
948 pinmux_disable(state->pmx); 1018 pinctrl_put(state->p);
949 pinmux_put(state->pmx);
950} 1019}
951 1020
952If you want to grab a specific mux mapping and not just the first one found for 1021This get/lookup/select/put sequence can just as well be handled by bus drivers
953this device you can specify a specific mapping name, for example in the above
954example the second i2c0 setting: pinmux_get(&device, "spi0-pos-B");
955
956This get/enable/disable/put sequence can just as well be handled by bus drivers
957if you don't want each and every driver to handle it and you know the 1022if you don't want each and every driver to handle it and you know the
958arrangement on your bus. 1023arrangement on your bus.
959 1024
960The semantics of the get/enable respective disable/put is as follows: 1025The 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
974Usually the pinmux core handled the get/put pair and call out to the device 1044Usually the pin control core handled the get/put pair and call out to the
975drivers bookkeeping operations, like checking available functions and the 1045device drivers bookkeeping operations, like checking available functions and
976associated pins, whereas the enable/disable pass on to the pin controller 1046the associated pins, whereas the enable/disable pass on to the pin controller
977driver which takes care of activating and/or deactivating the mux setting by 1047driver which takes care of activating and/or deactivating the mux setting by
978quickly poking some registers. 1048quickly poking some registers.
979 1049
980The pins are allocated for your device when you issue the pinmux_get() call, 1050The pins are allocated for your device when you issue the pinctrl_get() call,
981after this you should be able to see this in the debugfs listing of all pins. 1051after this you should be able to see this in the debugfs listing of all pins.
982 1052
983 1053
984System pinmux hogging 1054System pin control hogging
985===================== 1055==========================
986 1056
987A system pinmux map entry, i.e. a pinmux setting that does not have a device 1057Pin control map entries can be hogged by the core when the pin controller
988associated with it, can be hogged by the core when the pin controller is 1058is registered. This means that the core will attempt to call pinctrl_get(),
989registered. This means that the core will attempt to call pinmux_get() and 1059lookup_state() and select_state() on it immediately after the pin control
990pinmux_enable() on it immediately after the pin control device has been 1060device has been registered.
991registered.
992 1061
993This is enabled by simply setting the .hog_on_boot field in the map to true, 1062This occurs for mapping table entries where the client device name is equal
994like this: 1063to 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
1003Since it may be common to request the core to hog a few always-applicable 1073Since it may be common to request the core to hog a few always-applicable
1004mux settings on the primary pin controller, there is a convenience macro for 1074mux settings on the primary pin controller, there is a convenience macro for
1005this: 1075this:
1006 1076
1007PINMUX_MAP_PRIMARY_SYS_HOG("POWERMAP", "power_func") 1077PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-foo", NULL /* group */, "power_func")
1008 1078
1009This gives the exact same result as the above construction. 1079This 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
1016an SPI port from one set of pins to another set of pins. Say for example for 1086an SPI port from one set of pins to another set of pins. Say for example for
1017spi0 in the example above, we expose two different groups of pins for the same 1087spi0 in the example above, we expose two different groups of pins for the same
1018function, but with different named in the mapping as described under 1088function, 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
1022This snippet first muxes the function in the pins defined by group A, enables 1092This snippet first muxes the function in the pins defined by group A, enables
1023it, disables and releases it, and muxes it in on the pins defined by group B: 1093it, disables and releases it, and muxes it in on the pins defined by group B:
1024 1094
1095#include <linux/pinctrl/consumer.h>
1096
1025foo_switch() 1097foo_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
1047The above has to be done from process context. 1132The 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 @@
1Remote Processor Framework
2
31. Introduction
4
5Modern SoCs typically have heterogeneous remote processor devices in asymmetric
6multiprocessing (AMP) configurations, which may be running different instances
7of operating system, whether it's Linux or any other flavor of real-time OS.
8
9OMAP4, for example, has dual Cortex-A9, dual Cortex-M3 and a C64x+ DSP.
10In a typical configuration, the dual cortex-A9 is running Linux in a SMP
11configuration, and each of the other three cores (two M3 cores and a DSP)
12is running its own instance of RTOS in an AMP configuration.
13
14The remoteproc framework allows different platforms/architectures to
15control (power on, load firmware, power off) those remote processors while
16abstracting the hardware differences, so the entire driver doesn't need to be
17duplicated. In addition, this framework also adds rpmsg virtio devices
18for remote processors that supports this kind of communication. This way,
19platform-specific remoteproc drivers only need to provide a few low-level
20handlers, and then all rpmsg drivers will then just work
21(for more information about the virtio-based rpmsg bus and its drivers,
22please read Documentation/rpmsg.txt).
23Registration of other types of virtio devices is now also possible. Firmwares
24just need to publish what kind of virtio devices do they support, and then
25remoteproc will add those devices. This makes it possible to reuse the
26existing virtio drivers with remote processor backends at a minimal development
27cost.
28
292. 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
793. Typical usage
80
81#include <linux/remoteproc.h>
82
83/* in case we were given a valid 'rproc' handle */
84int 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
1044. 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
1625. Implementation callbacks
163
164These callbacks should be provided by platform-specific remoteproc
165drivers:
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 */
173struct rproc_ops {
174 int (*start)(struct rproc *rproc);
175 int (*stop)(struct rproc *rproc);
176 void (*kick)(struct rproc *rproc, int vqid);
177};
178
179Every remoteproc implementation should at least provide the ->start and ->stop
180handlers. If rpmsg/virtio functionality is also desired, then the ->kick handler
181should be provided as well.
182
183The ->start() handler takes an rproc handle and should then power on the
184device and boot it (use rproc->priv to access platform-specific private data).
185The boot address, in case needed, can be found in rproc->bootaddr (remoteproc
186core puts there the ELF entry point).
187On success, 0 should be returned, and on failure, an appropriate error code.
188
189The ->stop() handler takes an rproc handle and powers the device down.
190On success, 0 is returned, and on failure, an appropriate error code.
191
192The ->kick() handler takes an rproc handle, and an index of a virtqueue
193where new message was placed in. Implementations should interrupt the remote
194processor and let it know it has pending messages. Notifying remote processors
195the exact virtqueue index to look in is optional: it is easy (and not
196too expensive) to go through the existing virtqueues and look for new buffers
197in the used rings.
198
1996. Binary Firmware Structure
200
201At this point remoteproc only supports ELF32 firmware binaries. However,
202it is quite expected that other platforms/devices which we'd want to
203support with this framework will be based on different binary formats.
204
205When those use cases show up, we will have to decouple the binary format
206from the framework core, so we can support several binary formats without
207duplicating common code.
208
209When the firmware is parsed, its various segments are loaded to memory
210according to the specified device address (might be a physical address
211if the remote processor is accessing memory directly).
212
213In addition to the standard ELF segments, most remote processors would
214also include a special section which we call "the resource table".
215
216The resource table contains system resources that the remote processor
217requires before it should be powered on, such as allocation of physically
218contiguous memory, or iommu mapping of certain on-chip peripherals.
219Remotecore will only power up the device after all the resource table's
220requirement are met.
221
222In addition to system resources, the resource table may also contain
223resource entries that publish the existence of supported features
224or configurations by the remote processor, such as trace buffers and
225supported virtio devices (and their configurations).
226
227The 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 */
241struct resource_table {
242 u32 ver;
243 u32 num;
244 u32 reserved[2];
245 u32 offset[0];
246} __packed;
247
248Immediately following this header are the resource entries themselves,
249each 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 */
260struct fw_rsc_hdr {
261 u32 type;
262 u8 data[0];
263} __packed;
264
265Some resources entries are mere announcements, where the host is informed
266of specific remoteproc configuration. Other entries require the host to
267do something (e.g. allocate a system resource). Sometimes a negotiation
268is expected, where the firmware requests a resource, and once allocated,
269the host should provide back its details (e.g. address of an allocated
270memory region).
271
272Here 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 */
291enum 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
299For more details regarding a specific resource type, please see its
300dedicated structure in include/linux/remoteproc.h.
301
302We also expect that platform-specific resource entries will show up
303at some point. When that happens, we could easily add a new RSC_PLATFORM
304type, and hand those resources to the platform-specific rproc driver to handle.
305
3067. Virtio and remoteproc
307
308The firmware should provide remoteproc information about virtio devices
309that it supports, and their configurations: a RSC_VDEV resource entry
310should specify the virtio device id (as in virtio_ids.h), virtio features,
311virtio config space, vrings information, etc.
312
313When a new remote processor is registered, the remoteproc framework
314will look for its resource table and will register the virtio devices
315it supports. A firmware may support any number of virtio devices, and
316of any type (a single remote processor can also easily support several
317rpmsg virtio devices this way, if desired).
318
319Of course, RSC_VDEV resource entries are only good enough for static
320allocation of virtio devices. Dynamic allocations will also be made possible
321using the rpmsg bus (similar to how we already do dynamic allocations of
322rpmsg 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 @@
1Remote Processor Messaging (rpmsg) Framework
2
3Note: this document describes the rpmsg bus and how to write rpmsg drivers.
4To learn how to add rpmsg support for new platforms, check out remoteproc.txt
5(also a resident of Documentation/).
6
71. Introduction
8
9Modern SoCs typically employ heterogeneous remote processor devices in
10asymmetric multiprocessing (AMP) configurations, which may be running
11different instances of operating system, whether it's Linux or any other
12flavor of real-time OS.
13
14OMAP4, for example, has dual Cortex-A9, dual Cortex-M3 and a C64x+ DSP.
15Typically, the dual cortex-A9 is running Linux in a SMP configuration,
16and each of the other three cores (two M3 cores and a DSP) is running
17its own instance of RTOS in an AMP configuration.
18
19Typically AMP remote processors employ dedicated DSP codecs and multimedia
20hardware accelerators, and therefore are often used to offload CPU-intensive
21multimedia tasks from the main application processor.
22
23These remote processors could also be used to control latency-sensitive
24sensors, drive random hardware blocks, or just perform background tasks
25while the main CPU is idling.
26
27Users of those remote processors can either be userland apps (e.g. multimedia
28frameworks talking with remote OMX components) or kernel drivers (controlling
29hardware accessible only by the remote processor, reserving kernel-controlled
30resources on behalf of the remote processor, etc..).
31
32Rpmsg is a virtio-based messaging bus that allows kernel drivers to communicate
33with remote processors available on the system. In turn, drivers could then
34expose appropriate user space interfaces, if needed.
35
36When writing a driver that exposes rpmsg communication to userland, please
37keep in mind that remote processors might have direct access to the
38system's physical memory and other sensitive hardware resources (e.g. on
39OMAP4, remote cores and hardware accelerators may have direct access to the
40physical memory, gpio banks, dma controllers, i2c bus, gptimers, mailbox
41devices, hwspinlocks, etc..). Moreover, those remote processors might be
42running RTOS where every task can access the entire memory/devices exposed
43to the processor. To minimize the risks of rogue (or buggy) userland code
44exploiting remote bugs, and by that taking over the system, it is often
45desired to limit userland to specific rpmsg channels (see definition below)
46it can send messages on, and if possible, minimize how much control
47it has over the content of the messages.
48
49Every rpmsg device is a communication channel with a remote processor (thus
50rpmsg devices are called channels). Channels are identified by a textual name
51and have a local ("source") rpmsg address, and remote ("destination") rpmsg
52address.
53
54When a driver starts listening on a channel, its rx callback is bound with
55a unique rpmsg local address (a 32-bit integer). This way when inbound messages
56arrive, the rpmsg core dispatches them to the appropriate driver according
57to their destination address (this is done by invoking the driver's rx handler
58with the payload of the inbound message).
59
60
612. 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
2063. Typical usage
207
208The following is a simple rpmsg driver, that sends an "hello!" message
209on probe(), and whenever it receives an incoming message, it dumps its
210content to the console.
211
212#include <linux/kernel.h>
213#include <linux/module.h>
214#include <linux/rpmsg.h>
215
216static 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
223static 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
239static void __devexit rpmsg_sample_remove(struct rpmsg_channel *rpdev)
240{
241 dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n");
242}
243
244static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = {
245 { .name = "rpmsg-client-sample" },
246 { },
247};
248MODULE_DEVICE_TABLE(rpmsg, rpmsg_driver_sample_id_table);
249
250static 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
259static int __init init(void)
260{
261 return register_rpmsg_driver(&rpmsg_sample_client);
262}
263module_init(init);
264
265static void __exit fini(void)
266{
267 unregister_rpmsg_driver(&rpmsg_sample_client);
268}
269module_exit(fini);
270
271Note: a similar sample which can be built and loaded can be found
272in samples/rpmsg/.
273
2744. Allocations of rpmsg channels:
275
276At this point we only support dynamic allocations of rpmsg channels.
277
278This is possible only with remote processors that have the VIRTIO_RPMSG_F_NS
279virtio device feature set. This feature bit means that the remote
280processor supports dynamic name service announcement messages.
281
282When this feature is enabled, creation of rpmsg devices (i.e. channels)
283is completely dynamic: the remote processor announces the existence of a
284remote rpmsg service by sending a name service message (which contains
285the name and rpmsg addr of the remote service, see struct rpmsg_ns_msg).
286
287This message is then handled by the rpmsg bus, which in turn dynamically
288creates and registers an rpmsg channel (which represents the remote service).
289If/when a relevant rpmsg driver is registered, it will be immediately probed
290by the bus, and can then start sending messages to the remote service.
291
292The plan is also to add static creation of rpmsg channels via the virtio
293config 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 @@
1Copyright (c) 2003-2011 QLogic Corporation 1Copyright (c) 2003-2011 QLogic Corporation
2QLogic Linux/ESX Fibre Channel HBA Driver 2QLogic Linux FC-FCoE Driver
3 3
4This program includes a device driver for Linux 2.6/ESX that may be 4This program includes a device driver for Linux 3.x.
5distributed with QLogic hardware specific firmware binary file.
6You may modify and redistribute the device driver code under the 5You may modify and redistribute the device driver code under the
7GNU General Public License (a copy of which is attached hereto as 6GNU General Public License (a copy of which is attached hereto as
8Exhibit A) published by the Free Software Foundation (version 2). 7Exhibit A) published by the Free Software Foundation (version 2).
9 8
10You may redistribute the hardware specific firmware binary file
11under 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
26REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE,
27THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY
28EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
30PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
31BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
33TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
35ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38POSSIBILITY OF SUCH DAMAGE.
39
40USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT
41CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR
42OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT,
43TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN
44ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN
45COMBINATION WITH THIS PROGRAM.
46 9
47 10
48EXHIBIT A 11EXHIBIT 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 @@
1Linux driver for Brocade FC/FCOE adapters
2
3
4Supported Hardware
5------------------
6
7bfa 3.0.2.2 driver supports all Brocade FC/FCOE adapters. Below is a list of
8adapter 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
31Firmware download
32-----------------
33
34The latest Firmware package for 3.0.2.2 bfa driver can be found at:
35
36http://www.brocade.com/services-support/drivers-downloads/adapters/Linux.page
37
38and 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
45Configuration & Management utility download
46-------------------------------------------
47
48The latest driver configuration & management utility for 3.0.2.2 bfa driver can
49be found at:
50
51http://www.brocade.com/services-support/drivers-downloads/adapters/Linux.page
52
53and 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
60Documentation
61-------------
62
63The latest Administration's Guide, Installation and Reference Manual,
64Troubleshooting Guide, and Release Notes for the corresponding out-of-box
65driver can be found at:
66
67http://www.brocade.com/services-support/drivers-downloads/adapters/Linux.page
68
69and use the following inbox and out-of-box driver version mapping to find
70the corresponding documentation:
71
72 Inbox Version Out-of-box Version
73
74 v3.0.2.2 v3.0.0.0
75
76
77Support
78-------
79
80For general product and support info, go to the Brocade website at:
81
82http://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
401When an external entity, entity other than the LLDD or the
402SAS Layer, wants to work with a struct domain_device, it
403_must_ call kobject_get() when getting a handle on the
404device and kobject_put() when it is done with the device.
405
406This 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
416DISCOVERY 401DISCOVERY
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
30ALC260 12ALC260
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
43ALC262 16ALC262
44====== 17======
@@ -70,55 +43,7 @@ ALC680
70 43
71ALC882/883/885/888/889 44ALC882/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
123ALC861/660 48ALC861/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
62for some VIA and ATI controllers. 0 is the default value for all other 62for some VIA controllers. The capture stream position is corrected
63by comparing both LPIB and position-buffer values.
64`position_fix=4` is another combination available for all controllers,
65and uses LPIB for the playback and the position-buffer for the capture
66streams.
670 is the default value for all other
63controllers, the automatic check and fallback to LPIB as described in 68controllers, the automatic check and fallback to LPIB as described in
64the above. If you get a problem of repeated sounds, this option might 69the above. If you get a problem of repeated sounds, this option might
65help. 70help.
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 @@
187186 -> Beholder BeholdTV 501 [5ace:5010] 187186 -> Beholder BeholdTV 501 [5ace:5010]
188187 -> Beholder BeholdTV 503 FM [5ace:5030] 188187 -> Beholder BeholdTV 503 FM [5ace:5030]
189188 -> Sensoray 811/911 [6000:0811,6000:0911] 189188 -> Sensoray 811/911 [6000:0811,6000:0911]
190189 -> 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
78tuner=78 - Philips FMD1216MEX MK3 Hybrid Tuner 78tuner=78 - Philips FMD1216MEX MK3 Hybrid Tuner
79tuner=79 - Philips PAL/SECAM multi (FM1216 MK5) 79tuner=79 - Philips PAL/SECAM multi (FM1216 MK5)
80tuner=80 - Philips FQ1216LME MK3 PAL/SECAM w/active loopthrough 80tuner=80 - Philips FQ1216LME MK3 PAL/SECAM w/active loopthrough
81tuner=81 - Xceive 4000 tuner
82tuner=81 - Partsnic (Daewoo) PTI-5NF05 81tuner=81 - Partsnic (Daewoo) PTI-5NF05
83tuner=82 - Philips CU1216L 82tuner=82 - Philips CU1216L
84tuner=83 - NXP TDA18271 83tuner=83 - NXP TDA18271
85tuner=84 - Sony BTF-Pxn01Z 84tuner=84 - Sony BTF-Pxn01Z
86tuner=85 - Philips FQ1236 MK5 85tuner=85 - Philips FQ1236 MK5
87tuner=86 - Tena TNF5337 MFD 86tuner=86 - Tena TNF5337 MFD
87tuner=87 - Xceive 4000 tuner
88tuner=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 @@
1Samsung S5P/EXYNOS4 FIMC driver
2
3Copyright (C) 2012 Samsung Electronics Co., Ltd.
4---------------------------------------------------------------------------
5
6The FIMC (Fully Interactive Mobile Camera) device available in Samsung
7SoC Application Processors is an integrated camera host interface, color
8space converter, image resizer and rotator. It's also capable of capturing
9data from LCD controller (FIMD) through the SoC internal writeback data
10path. There are multiple FIMC instances in the SoCs (up to 4), having
11slightly different capabilities, like pixel alignment constraints, rotator
12availability, LCD writeback support, etc. The driver is located at
13drivers/media/video/s5p-fimc directory.
14
151. Supported SoCs
16=================
17
18S5PC100 (mem-to-mem only), S5PV210, EXYNOS4210
19
202. 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
31Not currently supported:
32 - LCD writeback input
33 - per frame clock gating (mem-to-mem)
34
353. 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
554. User space interfaces
56========================
57
584.1. Media device interface
59
60The driver supports Media Controller API as defined at
61http://http://linuxtv.org/downloads/v4l-dvb-apis/media_common.html
62The media device driver name is "SAMSUNG S5P FIMC".
63
64The purpose of this interface is to allow changing assignment of FIMC instances
65to the SoC peripheral camera input at runtime and optionally to control internal
66connections of the MIPI-CSIS device(s) to the FIMC entities.
67
68The media device interface allows to configure the SoC for capturing image
69data from the sensor through more than one FIMC instance (e.g. for simultaneous
70viewfinder and still capture setup).
71Reconfiguration is done by enabling/disabling media links created by the driver
72during initialization. The internal device topology can be easily discovered
73through media entity and links enumeration.
74
754.2. Memory-to-memory video node
76
77V4L2 memory-to-memory interface at /dev/video? device node. This is standalone
78video device, it has no media pads. However please note the mem-to-mem and
79capture video node operation on same FIMC instance is not allowed. The driver
80detects such cases but the applications should prevent them to avoid an
81undefined behaviour.
82
834.3. Capture video node
84
85The driver supports V4L2 Video Capture Interface as defined at:
86http://linuxtv.org/downloads/v4l-dvb-apis/devices.html
87
88At the capture and mem-to-mem video nodes only the multi-planar API is
89supported. For more details see:
90http://linuxtv.org/downloads/v4l-dvb-apis/planar-apis.html
91
924.4. Camera capture subdevs
93
94Each FIMC instance exports a sub-device node (/dev/v4l-subdev?), a sub-device
95node is also created per each available and enabled at the platform level
96MIPI-CSI receiver device (currently up to two).
97
984.5. sysfs
99
100In order to enable more precise camera pipeline control through the sub-device
101API the driver creates a sysfs entry associated with "s5p-fimc-md" platform
102device. The entry path is: /sys/platform/devices/s5p-fimc-md/subdev_conf_mode.
103
104In typical use case there could be a following capture pipeline configuration:
105sensor subdev -> mipi-csi subdev -> fimc subdev -> video node
106
107When we configure these devices through sub-device API at user space, the
108configuration flow must be from left to right, and the video node is
109configured as last one.
110When we don't use sub-device user space API the whole configuration of all
111devices belonging to the pipeline is done at the video node driver.
112The sysfs entry allows to instruct the capture node driver not to configure
113the sub-devices (format, crop), to avoid resetting the subdevs' configuration
114when the last configuration steps at the video node is performed.
115
116For full sub-device control support (subdevs configured at user space before
117starting streaming):
118# echo "sub-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode
119
120For V4L2 video node control only (subdevs configured internally by the host
121driver):
122# echo "vid-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode
123This is a default option.
124
1255. Device mapping to video and subdev device nodes
126==================================================
127
128There are associated two video device nodes with each device instance in
129hardware - video capture and mem-to-mem and additionally a subdev node for
130more precise FIMC capture subsystem control. In addition a separate v4l2
131sub-device node is created per each MIPI-CSIS device.
132
133How to find out which /dev/video? or /dev/v4l-subdev? is assigned to which
134device?
135
136You 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
140or retrieve the information from /dev/media? with help of the media-ctl tool:
141# media-ctl -p
142
1436. Platform support
144===================
145
146The machine code (plat-s5p and arch/arm/mach-*) must select following options
147
148CONFIG_S5P_DEV_FIMC0 mandatory
149CONFIG_S5P_DEV_FIMC1 \
150CONFIG_S5P_DEV_FIMC2 | optional
151CONFIG_S5P_DEV_FIMC3 |
152CONFIG_S5P_SETUP_FIMC /
153CONFIG_S5P_SETUP_MIPIPHY \
154CONFIG_S5P_DEV_CSIS0 | optional for MIPI-CSI interface
155CONFIG_S5P_DEV_CSIS1 /
156
157Except that, relevant s5p_device_fimc? should be registered in the machine code
158in addition to a "s5p-fimc-md" platform device to which the media device driver
159is bound. The "s5p-fimc-md" device instance is required even if only mem-to-mem
160operation is used.
161
162The description of sensor(s) attached to FIMC/MIPI-CSIS camera inputs should be
163passed as the "s5p-fimc-md" device platform_data. The platform data structure
164is defined in file include/media/s5p_fimc.h.
165
1667. Build
167========
168
169This driver depends on following config options:
170PLAT_S5P,
171PM_RUNTIME,
172I2C,
173REGULATOR,
174VIDEO_V4L2_SUBDEV_API,
175
176If the driver is built as a loadable kernel module (CONFIG_VIDEO_SAMSUNG_S5P_FIMC=m)
177two modules are created (in addition to the core v4l2 modules): s5p-fimc.ko and
178optional 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
217sonixj 06f8:3004 Hercules Classic Silver 217sonixj 06f8:3004 Hercules Classic Silver
218sonixj 06f8:3008 Hercules Deluxe Optical Glass 218sonixj 06f8:3008 Hercules Deluxe Optical Glass
219pac7302 06f8:3009 Hercules Classic Link 219pac7302 06f8:3009 Hercules Classic Link
220pac7302 06f8:301b Hercules Link
220nw80x 0728:d001 AVerMedia Camguard 221nw80x 0728:d001 AVerMedia Camguard
221spca508 0733:0110 ViewQuest VQ110 222spca508 0733:0110 ViewQuest VQ110
222spca501 0733:0401 Intel Create and Share 223spca501 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.
95Capability: basic 95Capability: basic
96Architectures: all 96Architectures: all
97Type: system ioctl 97Type: system ioctl
98Parameters: none 98Parameters: machine type identifier (KVM_VM_*)
99Returns: a VM fd that can be used to control the new virtual machine. 99Returns: a VM fd that can be used to control the new virtual machine.
100 100
101The new VM has no virtual cpus and no memory. An mmap() of a VM fd 101The 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
103corresponds to guest physical address zero. Use of mmap() on a VM fd 103corresponds to guest physical address zero. Use of mmap() on a VM fd
104is discouraged if userspace memory allocation (KVM_CAP_USER_MEMORY) is 104is discouraged if userspace memory allocation (KVM_CAP_USER_MEMORY) is
105available. 105available.
106You most certainly want to use 0 as machine type.
107
108In order to create user controlled virtual machines on S390, check
109KVM_CAP_S390_UCONTROL and use the flag KVM_VM_S390_UCONTROL as
110privileged user (CAP_SYS_ADMIN).
106 111
1074.3 KVM_GET_MSR_INDEX_LIST 1124.3 KVM_GET_MSR_INDEX_LIST
108 113
@@ -213,6 +218,11 @@ allocation of vcpu ids. For example, if userspace wants
213single-threaded guest vcpus, it should make all vcpu ids be a multiple 218single-threaded guest vcpus, it should make all vcpu ids be a multiple
214of the number of vcpus per vcore. 219of the number of vcpus per vcore.
215 220
221For virtual cpus that have been created with S390 user controlled virtual
222machines, the resulting vcpu fd can be memory mapped at page offset
223KVM_S390_SIE_PAGE_OFFSET in order to obtain a memory map of the virtual
224cpu's hardware control block.
225
2164.8 KVM_GET_DIRTY_LOG (vm ioctl) 2264.8 KVM_GET_DIRTY_LOG (vm ioctl)
217 227
218Capability: basic 228Capability: 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
1176If KVM_DEV_ASSIGN_PCI_2_3 is set, the kernel will manage legacy INTx interrupts
1177via the PCI-2.3-compliant device-level mask, thus enable IRQ sharing with other
1178assigned devices or host devices. KVM_DEV_ASSIGN_MASK_INTX specifies the
1179guest's view on the INTx mask, see KVM_ASSIGN_SET_INTX_MASK for details.
1162 1180
1163The KVM_DEV_ASSIGN_ENABLE_IOMMU flag is a mandatory option to ensure 1181The KVM_DEV_ASSIGN_ENABLE_IOMMU flag is a mandatory option to ensure
1164isolation of the device. Usages not specifying this flag are deprecated. 1182isolation of the device. Usages not specifying this flag are deprecated.
@@ -1399,6 +1417,71 @@ The following flags are defined:
1399If datamatch flag is set, the event will be signaled only if the written value 1417If datamatch flag is set, the event will be signaled only if the written value
1400to the registered address is equal to datamatch in struct kvm_ioeventfd. 1418to the registered address is equal to datamatch in struct kvm_ioeventfd.
1401 1419
14204.59 KVM_DIRTY_TLB
1421
1422Capability: KVM_CAP_SW_TLB
1423Architectures: ppc
1424Type: vcpu ioctl
1425Parameters: struct kvm_dirty_tlb (in)
1426Returns: 0 on success, -1 on error
1427
1428struct kvm_dirty_tlb {
1429 __u64 bitmap;
1430 __u32 num_dirty;
1431};
1432
1433This must be called whenever userspace has changed an entry in the shared
1434TLB, prior to calling KVM_RUN on the associated vcpu.
1435
1436The "bitmap" field is the userspace address of an array. This array
1437consists of a number of bits, equal to the total number of TLB entries as
1438determined by the last successful call to KVM_CONFIG_TLB, rounded up to the
1439nearest multiple of 64.
1440
1441Each bit corresponds to one TLB entry, ordered the same as in the shared TLB
1442array.
1443
1444The array is little-endian: the bit 0 is the least significant bit of the
1445first byte, bit 8 is the least significant bit of the second byte, etc.
1446This avoids any complications with differing word sizes.
1447
1448The "num_dirty" field is a performance hint for KVM to determine whether it
1449should skip processing the bitmap and just invalidate everything. It must
1450be set to the number of set bits in the bitmap.
1451
14524.60 KVM_ASSIGN_SET_INTX_MASK
1453
1454Capability: KVM_CAP_PCI_2_3
1455Architectures: x86
1456Type: vm ioctl
1457Parameters: struct kvm_assigned_pci_dev (in)
1458Returns: 0 on success, -1 on error
1459
1460Allows userspace to mask PCI INTx interrupts from the assigned device. The
1461kernel will not deliver INTx interrupts to the guest between setting and
1462clearing of KVM_ASSIGN_SET_INTX_MASK via this interface. This enables use of
1463and emulation of PCI 2.3 INTx disable command register behavior.
1464
1465This may be used for both PCI 2.3 devices supporting INTx disable natively and
1466older devices lacking this support. Userspace is responsible for emulating the
1467read value of the INTx disable bit in the guest visible PCI command register.
1468When modifying the INTx disable state, userspace should precede updating the
1469physical device command register by calling this ioctl to inform the kernel of
1470the new intended INTx mask state.
1471
1472Note that the kernel uses the device INTx disable bit to internally manage the
1473device interrupt state for PCI 2.3 devices. Reads of this register may
1474therefore not match the expected value. Writes should always use the guest
1475intended INTx disable value rather than attempting to read-copy-update the
1476current physical device state. Races between user and kernel updates to the
1477INTx disable bit are handled lazily in the kernel. It's possible the device
1478may generate unintended interrupts, but they will not be injected into the
1479guest.
1480
1481See KVM_ASSIGN_DEV_IRQ for the data structure. The target device is specified
1482by assigned_dev_id. In the flags field, only KVM_DEV_ASSIGN_MASK_INTX is
1483evaluated.
1484
14024.62 KVM_CREATE_SPAPR_TCE 14854.62 KVM_CREATE_SPAPR_TCE
1403 1486
1404Capability: KVM_CAP_SPAPR_TCE 1487Capability: KVM_CAP_SPAPR_TCE
@@ -1491,6 +1574,101 @@ following algorithm:
1491Some guests configure the LINT1 NMI input to cause a panic, aiding in 1574Some guests configure the LINT1 NMI input to cause a panic, aiding in
1492debugging. 1575debugging.
1493 1576
15774.65 KVM_S390_UCAS_MAP
1578
1579Capability: KVM_CAP_S390_UCONTROL
1580Architectures: s390
1581Type: vcpu ioctl
1582Parameters: struct kvm_s390_ucas_mapping (in)
1583Returns: 0 in case of success
1584
1585The parameter is defined like this:
1586 struct kvm_s390_ucas_mapping {
1587 __u64 user_addr;
1588 __u64 vcpu_addr;
1589 __u64 length;
1590 };
1591
1592This ioctl maps the memory at "user_addr" with the length "length" to
1593the vcpu's address space starting at "vcpu_addr". All parameters need to
1594be alligned by 1 megabyte.
1595
15964.66 KVM_S390_UCAS_UNMAP
1597
1598Capability: KVM_CAP_S390_UCONTROL
1599Architectures: s390
1600Type: vcpu ioctl
1601Parameters: struct kvm_s390_ucas_mapping (in)
1602Returns: 0 in case of success
1603
1604The parameter is defined like this:
1605 struct kvm_s390_ucas_mapping {
1606 __u64 user_addr;
1607 __u64 vcpu_addr;
1608 __u64 length;
1609 };
1610
1611This 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.
1613All parameters need to be alligned by 1 megabyte.
1614
16154.67 KVM_S390_VCPU_FAULT
1616
1617Capability: KVM_CAP_S390_UCONTROL
1618Architectures: s390
1619Type: vcpu ioctl
1620Parameters: vcpu absolute address (in)
1621Returns: 0 in case of success
1622
1623This 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
1625space (for regular virtual machines). This only works for minor faults,
1626thus it's recommended to access subject memory page via the user page
1627table upfront. This is useful to handle validity intercepts for user
1628controlled virtual machines to fault in the virtual cpu's lowcore pages
1629prior to calling the KVM_RUN ioctl.
1630
16314.68 KVM_SET_ONE_REG
1632
1633Capability: KVM_CAP_ONE_REG
1634Architectures: all
1635Type: vcpu ioctl
1636Parameters: struct kvm_one_reg (in)
1637Returns: 0 on success, negative value on failure
1638
1639struct kvm_one_reg {
1640 __u64 id;
1641 __u64 addr;
1642};
1643
1644Using this ioctl, a single vcpu register can be set to a specific value
1645defined by user space with the passed in struct kvm_one_reg, where id
1646refers to the register identifier as described below and addr is a pointer
1647to a variable with the respective size. There can be architecture agnostic
1648and architecture specific registers. Each have their own range of operation
1649and their own constants and width. To keep track of the implemented
1650registers, find a list below:
1651
1652 Arch | Register | Width (bits)
1653 | |
1654 PPC | KVM_REG_PPC_HIOR | 64
1655
16564.69 KVM_GET_ONE_REG
1657
1658Capability: KVM_CAP_ONE_REG
1659Architectures: all
1660Type: vcpu ioctl
1661Parameters: struct kvm_one_reg (in and out)
1662Returns: 0 on success, negative value on failure
1663
1664This ioctl allows to receive the value of a single register implemented
1665in a vcpu. The register to read is indicated by the "id" field of the
1666kvm_one_reg struct passed in. On success, the register value can be found
1667at the memory location pointed to by "addr".
1668
1669The list of registers accessible using this interface is identical to the
1670list in 4.64.
1671
14945. The kvm_run structure 16725. The kvm_run structure
1495 1673
1496Application code obtains a pointer to the kvm_run structure by 1674Application code obtains a pointer to the kvm_run structure by
@@ -1651,6 +1829,20 @@ s390 specific.
1651 1829
1652s390 specific. 1830s390 specific.
1653 1831
1832 /* KVM_EXIT_S390_UCONTROL */
1833 struct {
1834 __u64 trans_exc_code;
1835 __u32 pgm_code;
1836 } s390_ucontrol;
1837
1838s390 specific. A page fault has occurred for a user controlled virtual
1839machine (KVM_VM_S390_UNCONTROL) on it's host page table that cannot be
1840resolved by the kernel.
1841The program code and the translation exception code that were placed
1842in the cpu's lowcore are presented here as defined by the z Architecture
1843Principles 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
1903If KVM_CAP_SYNC_REGS is defined, these fields allow userspace to access
1904certain guest registers without having to call SET/GET_*REGS. Thus we can
1905avoid some system call overhead if userspace has to handle the exit.
1906Userspace can query the validity of the structure by checking
1907kvm_valid_regs for specific bits. These bits are architecture specific
1908and usually define the validity of a groups of registers. (e.g. one bit
1909 for general purpose registers)
1910
1696}; 1911};
1697 1912
16986. Capabilities that can be enabled 19136. 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
1741HTAB invisible to the guest. 1956HTAB invisible to the guest.
1742 1957
1743When this capability is enabled, KVM_EXIT_PAPR_HCALL can occur. 1958When this capability is enabled, KVM_EXIT_PAPR_HCALL can occur.
1959
19606.3 KVM_CAP_SW_TLB
1961
1962Architectures: ppc
1963Parameters: args[0] is the address of a struct kvm_config_tlb
1964Returns: 0 on success; -1 on error
1965
1966struct kvm_config_tlb {
1967 __u64 params;
1968 __u64 array;
1969 __u32 mmu_type;
1970 __u32 array_len;
1971};
1972
1973Configures the virtual CPU's TLB array, establishing a shared memory area
1974between userspace and KVM. The "params" and "array" fields are userspace
1975addresses of mmu-type-specific data structures. The "array_len" field is an
1976safety mechanism, and should be set to the size in bytes of the memory that
1977userspace has reserved for the array. It must be at least the size dictated
1978by "mmu_type" and "params".
1979
1980While KVM_RUN is active, the shared region is under control of KVM. Its
1981contents are undefined, and any modification by userspace results in
1982boundedly undefined behavior.
1983
1984On return from KVM_RUN, the shared region will reflect the current state of
1985the guest's TLB. If userspace makes any changes, it must call KVM_DIRTY_TLB
1986to tell KVM which entries have been changed, prior to calling KVM_RUN again
1987on this vcpu.
1988
1989For 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,
81also define a new hypercall feature to indicate that the host can give you more 81also define a new hypercall feature to indicate that the host can give you more
82registers. Only if the host supports the additional features, make use of them. 82registers. Only if the host supports the additional features, make use of them.
83 83
84The magic page has the following layout as described in 84The magic page layout is described by struct kvm_vcpu_arch_shared
85arch/powerpc/include/asm/kvm_para.h: 85in arch/powerpc/include/asm/kvm_para.h.
86
87struct 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
104Additions to the page must only occur at the end. Struct fields are always 32
105or 64 bit aligned, depending on them being 32 or 64 bit wide respectively.
106 86
107Magic page features 87Magic 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.
2obj- := dummy.o
3
4# List of programs to build
5hostprogs-y := page-types hugepage-mmap hugepage-shm map_hugetlb
6
7# Tell kbuild to always build the programs
8always := $(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
46the pool id, a file key, and a page index into the file. (The combination 46the pool id, a file key, and a page index into the file. (The combination
47of a pool id, a file key, and an index is sometimes called a "handle".) 47of a pool id, a file key, and an index is sometimes called a "handle".)
48A "get_page" will copy the page, if found, from cleancache into kernel memory. 48A "get_page" will copy the page, if found, from cleancache into kernel memory.
49A "flush_page" will ensure the page no longer is present in cleancache; 49An "invalidate_page" will ensure the page no longer is present in cleancache;
50a "flush_inode" will flush all pages associated with the specified file; 50an "invalidate_inode" will invalidate all pages associated with the specified
51and, when a filesystem is unmounted, a "flush_fs" will flush all pages in 51file; and, when a filesystem is unmounted, an "invalidate_fs" will invalidate
52all files specified by the given pool id and also surrender the pool id. 52all pages in all files specified by the given pool id and also surrender
53the pool id.
53 54
54An "init_shared_fs", like init_fs, obtains a pool id but tells cleancache 55An "init_shared_fs", like init_fs, obtains a pool id but tells cleancache
55to treat the pool as shared using a 128-bit UUID as a key. On systems 56to 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
62cleancache implementation can simply disable shared_init by always 63cleancache implementation can simply disable shared_init by always
63returning a negative value. 64returning a negative value.
64 65
65If a get_page is successful on a non-shared pool, the page is flushed (thus 66If a get_page is successful on a non-shared pool, the page is invalidated
66making cleancache an "exclusive" cache). On a shared pool, the page 67(thus making cleancache an "exclusive" cache). On a shared pool, the page
67is NOT flushed on a successful get_page so that it remains accessible to 68is NOT invalidated on a successful get_page so that it remains accessible to
68other sharers. The kernel is responsible for ensuring coherency between 69other sharers. The kernel is responsible for ensuring coherency between
69cleancache (shared or not), the page cache, and the filesystem, using 70cleancache (shared or not), the page cache, and the filesystem, using
70cleancache flush operations as required. 71cleancache invalidate operations as required.
71 72
72Note that cleancache must enforce put-put-get coherency and get-get 73Note that cleancache must enforce put-put-get coherency and get-get
73coherency. For the former, if two puts are made to the same handle but 74coherency. 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
77never succeed unless preceded by a successful put with that handle. 78never succeed unless preceded by a successful put with that handle.
78 79
79Last, cleancache provides no SMP serialization guarantees; if two 80Last, cleancache provides no SMP serialization guarantees; if two
80different Linux threads are simultaneously putting and flushing a page 81different Linux threads are simultaneously putting and invalidating a page
81with the same handle, the results are indeterminate. Callers must 82with the same handle, the results are indeterminate. Callers must
82lock the page to ensure serial behavior. 83lock the page to ensure serial behavior.
83 84
84CLEANCACHE PERFORMANCE METRICS 85CLEANCACHE PERFORMANCE METRICS
85 86
86Cleancache monitoring is done by sysfs files in the 87If properly configured, monitoring of cleancache is done via debugfs in
87/sys/kernel/mm/cleancache directory. The effectiveness of cleancache 88the /sys/kernel/debug/mm/cleancache directory. The effectiveness of cleancache
88can be measured (across all filesystems) with: 89can be measured (across all filesystems) with:
89 90
90succ_gets - number of gets that were successful 91succ_gets - number of gets that were successful
91failed_gets - number of gets that failed 92failed_gets - number of gets that failed
92puts - number of puts attempted (all "succeed") 93puts - number of puts attempted (all "succeed")
93flushes - number of flushes attempted 94invalidates - number of invalidates attempted
94 95
95A backend implementation may provide additional metrics. 96A backend implementation may provide additional metrics.
96 97
@@ -143,7 +144,7 @@ systems.
143 144
144The core hooks for cleancache in VFS are in most cases a single line 145The core hooks for cleancache in VFS are in most cases a single line
145and the minimum set are placed precisely where needed to maintain 146and the minimum set are placed precisely where needed to maintain
146coherency (via cleancache_flush operations) between cleancache, 147coherency (via cleancache_invalidate operations) between cleancache,
147the page cache, and disk. All hooks compile into nothingness if 148the page cache, and disk. All hooks compile into nothingness if
148cleancache is config'ed off and turn into a function-pointer- 149cleancache is config'ed off and turn into a function-pointer-
149compare-to-NULL if config'ed on but no backend claims the ops 150compare-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
184transcendent memory. 185transcendent memory.
185 186
1864) Why is non-shared cleancache "exclusive"? And where is the 1874) 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
189The main reason is to free up space in transcendent memory and 190The main reason is to free up space in transcendent memory and
190to avoid unnecessary cleancache_flush calls. If you want inclusive, 191to avoid unnecessary cleancache_invalidate calls. If you want inclusive,
191the page can be "put" immediately following the "get". If 192the page can be "put" immediately following the "get". If
192put-after-get for inclusive becomes common, the interface could 193put-after-get for inclusive becomes common, the interface could
193be easily extended to add a "get_no_flush" call. 194be easily extended to add a "get_no_invalidate" call.
194 195
195The flush is done by the cleancache backend implementation. 196The invalidate is done by the cleancache backend implementation.
196 197
1975) What's the performance impact? 1985) 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
243inode/filehandle, the pool id could be eliminated. But, this 244inode/filehandle, the pool id could be eliminated. But, this
244won't work because cleancache retains pagecache data pages 245won't work because cleancache retains pagecache data pages
245persistently even when the inode has been pruned from the 246persistently even when the inode has been pruned from the
246inode unused list, and only flushes the data page if the file 247inode unused list, and only invalidates the data page if the file
247gets removed/truncated. So if cleancache used the inode kva, 248gets removed/truncated. So if cleancache used the inode kva,
248there would be potential coherency issues if/when the inode 249there would be potential coherency issues if/when the inode
249kva is reused for a different file. Alternately, if cleancache 250kva is reused for a different file. Alternately, if cleancache
250flushed the pages when the inode kva was freed, much of the value 251invalidated the pages when the inode kva was freed, much of the value
251of cleancache would be lost because the cache of pages in cleanache 252of cleancache would be lost because the cache of pages in cleanache
252is potentially much larger than the kernel pagecache and is most 253is potentially much larger than the kernel pagecache and is most
253useful if the pages survive inode cache removal. 254useful 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
38static void check_bytes(char *addr)
39{
40 printf("First hex is %x\n", *((unsigned int *)addr));
41}
42
43static 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
51static 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
63int 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
54int 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
34static void check_bytes(char *addr)
35{
36 printf("First hex is %x\n", *((unsigned int *)addr));
37}
38
39static 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
47static 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
59int 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
127static 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
169static const char *debugfs_known_mountpoints[] = {
170 "/sys/kernel/debug",
171 "/debug",
172 0,
173};
174
175/*
176 * data structures
177 */
178
179static int opt_raw; /* for kernel developers */
180static int opt_list; /* list pages (in ranges) */
181static int opt_no_summary; /* don't show summary */
182static pid_t opt_pid; /* process to walk */
183
184#define MAX_ADDR_RANGES 1024
185static int nr_addr_ranges;
186static unsigned long opt_offset[MAX_ADDR_RANGES];
187static unsigned long opt_size[MAX_ADDR_RANGES];
188
189#define MAX_VMAS 10240
190static int nr_vmas;
191static unsigned long pg_start[MAX_VMAS];
192static unsigned long pg_end[MAX_VMAS];
193
194#define MAX_BIT_FILTERS 64
195static int nr_bit_filters;
196static uint64_t opt_mask[MAX_BIT_FILTERS];
197static uint64_t opt_bits[MAX_BIT_FILTERS];
198
199static int page_size;
200
201static int pagemap_fd;
202static int kpageflags_fd;
203
204static int opt_hwpoison;
205static int opt_unpoison;
206
207static char hwpoison_debug_fs[MAX_PATH+1];
208static int hwpoison_inject_fd;
209static 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
216static unsigned long total_pages;
217static unsigned long nr_pages[HASH_SIZE];
218static 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
237static unsigned long pages2mb(unsigned long pages)
238{
239 return (pages * page_size) >> 20;
240}
241
242static 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
252static 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
268static 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
294static 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
301static 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
308static 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
325static 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
344static 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
368static 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
395static 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
403static 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
429static 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
446static 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
465static 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
477static 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 */
488static 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 */
501static 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
538static 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
566static 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
585static 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
599static 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
617static 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
644static 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 */
667static 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)
691static 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
716static 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
738static 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
748static 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
771static 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
780static 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
832static 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
844static 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
891static void parse_file(const char *name)
892{
893}
894
895static 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
929static 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
939static 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
959static 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
978static 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
1002static 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
1012static 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
1028int 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 @@
100-INDEX
2 - this file.
3convert_drivers_to_kernel_api.txt
4 - how-to for converting old watchdog drivers to the new kernel API.
5hpwdt.txt
6 - information on the HP iLO2 NMI watchdog
7pcwd-watchdog.txt
8 - documentation for Berkshire Products PC Watchdog ISA cards.
9src/
10 - directory holding watchdog related example programs.
11watchdog-api.txt
12 - description of the Linux Watchdog driver API.
13watchdog-kernel-api.txt
14 - description of the Linux WatchDog Timer Driver Core kernel API.
15watchdog-parameters.txt
16 - information on driver parameters (for drivers other than
17 the ones that have driver-specific files here)
18wdt.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 @@
1The Linux WatchDog Timer Driver Core kernel API. 1The Linux WatchDog Timer Driver Core kernel API.
2=============================================== 2===============================================
3Last reviewed: 29-Nov-2011 3Last reviewed: 16-Mar-2012
4 4
5Wim Van Sebroeck <wim@iguana.be> 5Wim 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