diff options
606 files changed, 7901 insertions, 5696 deletions
diff --git a/Documentation/ABI/stable/sysfs-driver-usb-usbtmc b/Documentation/ABI/stable/sysfs-driver-usb-usbtmc index 2a7f9a00cb0a..e960cd027e1e 100644 --- a/Documentation/ABI/stable/sysfs-driver-usb-usbtmc +++ b/Documentation/ABI/stable/sysfs-driver-usb-usbtmc | |||
@@ -1,5 +1,5 @@ | |||
1 | What: /sys/bus/usb/drivers/usbtmc/devices/*/interface_capabilities | 1 | What: /sys/bus/usb/drivers/usbtmc/*/interface_capabilities |
2 | What: /sys/bus/usb/drivers/usbtmc/devices/*/device_capabilities | 2 | What: /sys/bus/usb/drivers/usbtmc/*/device_capabilities |
3 | Date: August 2008 | 3 | Date: August 2008 |
4 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 4 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
5 | Description: | 5 | Description: |
@@ -12,8 +12,8 @@ Description: | |||
12 | The files are read only. | 12 | The files are read only. |
13 | 13 | ||
14 | 14 | ||
15 | What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_interface_capabilities | 15 | What: /sys/bus/usb/drivers/usbtmc/*/usb488_interface_capabilities |
16 | What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_device_capabilities | 16 | What: /sys/bus/usb/drivers/usbtmc/*/usb488_device_capabilities |
17 | Date: August 2008 | 17 | Date: August 2008 |
18 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 18 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
19 | Description: | 19 | Description: |
@@ -27,7 +27,7 @@ Description: | |||
27 | The files are read only. | 27 | The files are read only. |
28 | 28 | ||
29 | 29 | ||
30 | What: /sys/bus/usb/drivers/usbtmc/devices/*/TermChar | 30 | What: /sys/bus/usb/drivers/usbtmc/*/TermChar |
31 | Date: August 2008 | 31 | Date: August 2008 |
32 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 32 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
33 | Description: | 33 | Description: |
@@ -40,7 +40,7 @@ Description: | |||
40 | sent to the device or not. | 40 | sent to the device or not. |
41 | 41 | ||
42 | 42 | ||
43 | What: /sys/bus/usb/drivers/usbtmc/devices/*/TermCharEnabled | 43 | What: /sys/bus/usb/drivers/usbtmc/*/TermCharEnabled |
44 | Date: August 2008 | 44 | Date: August 2008 |
45 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 45 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
46 | Description: | 46 | Description: |
@@ -51,7 +51,7 @@ Description: | |||
51 | published by the USB-IF. | 51 | published by the USB-IF. |
52 | 52 | ||
53 | 53 | ||
54 | What: /sys/bus/usb/drivers/usbtmc/devices/*/auto_abort | 54 | What: /sys/bus/usb/drivers/usbtmc/*/auto_abort |
55 | Date: August 2008 | 55 | Date: August 2008 |
56 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 56 | Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
57 | Description: | 57 | Description: |
diff --git a/Documentation/ABI/testing/sysfs-block-rssd b/Documentation/ABI/testing/sysfs-block-rssd new file mode 100644 index 000000000000..d535757799fe --- /dev/null +++ b/Documentation/ABI/testing/sysfs-block-rssd | |||
@@ -0,0 +1,18 @@ | |||
1 | What: /sys/block/rssd*/registers | ||
2 | Date: March 2012 | ||
3 | KernelVersion: 3.3 | ||
4 | Contact: Asai Thambi S P <asamymuthupa@micron.com> | ||
5 | Description: This is a read-only file. Dumps below driver information and | ||
6 | hardware registers. | ||
7 | - S ACTive | ||
8 | - Command Issue | ||
9 | - Allocated | ||
10 | - Completed | ||
11 | - PORT IRQ STAT | ||
12 | - HOST IRQ STAT | ||
13 | |||
14 | What: /sys/block/rssd*/status | ||
15 | Date: April 2012 | ||
16 | KernelVersion: 3.4 | ||
17 | Contact: Asai Thambi S P <asamymuthupa@micron.com> | ||
18 | Description: This is a read-only file. Indicates the status of the device. | ||
diff --git a/Documentation/ABI/testing/sysfs-cfq-target-latency b/Documentation/ABI/testing/sysfs-cfq-target-latency new file mode 100644 index 000000000000..df0f7828c5e3 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-cfq-target-latency | |||
@@ -0,0 +1,8 @@ | |||
1 | What: /sys/block/<device>/iosched/target_latency | ||
2 | Date: March 2012 | ||
3 | contact: Tao Ma <boyu.mt@taobao.com> | ||
4 | Description: | ||
5 | The /sys/block/<device>/iosched/target_latency only exists | ||
6 | when the user sets cfq to /sys/block/<device>/scheduler. | ||
7 | It contains an estimated latency time for the cfq. cfq will | ||
8 | use it to calculate the time slice used for every task. | ||
diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml index 3fd3ce5df270..5274c24d11e0 100644 --- a/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml +++ b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml | |||
@@ -1,6 +1,6 @@ | |||
1 | <refentry id="V4L2-PIX-FMT-NV12M"> | 1 | <refentry id="V4L2-PIX-FMT-NV12M"> |
2 | <refmeta> | 2 | <refmeta> |
3 | <refentrytitle>V4L2_PIX_FMT_NV12M ('NV12M')</refentrytitle> | 3 | <refentrytitle>V4L2_PIX_FMT_NV12M ('NM12')</refentrytitle> |
4 | &manvol; | 4 | &manvol; |
5 | </refmeta> | 5 | </refmeta> |
6 | <refnamediv> | 6 | <refnamediv> |
diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml index 9957863daf18..60308f1eefdf 100644 --- a/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml +++ b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml | |||
@@ -1,6 +1,6 @@ | |||
1 | <refentry id="V4L2-PIX-FMT-YUV420M"> | 1 | <refentry id="V4L2-PIX-FMT-YUV420M"> |
2 | <refmeta> | 2 | <refmeta> |
3 | <refentrytitle>V4L2_PIX_FMT_YUV420M ('YU12M')</refentrytitle> | 3 | <refentrytitle>V4L2_PIX_FMT_YUV420M ('YM12')</refentrytitle> |
4 | &manvol; | 4 | &manvol; |
5 | </refmeta> | 5 | </refmeta> |
6 | <refnamediv> | 6 | <refnamediv> |
diff --git a/Documentation/arm/OMAP/DSS b/Documentation/arm/OMAP/DSS index 888ae7b83ae4..a564ceea9e98 100644 --- a/Documentation/arm/OMAP/DSS +++ b/Documentation/arm/OMAP/DSS | |||
@@ -47,6 +47,51 @@ flexible way to enable non-common multi-display configuration. In addition to | |||
47 | modelling the hardware overlays, omapdss supports virtual overlays and overlay | 47 | modelling the hardware overlays, omapdss supports virtual overlays and overlay |
48 | managers. These can be used when updating a display with CPU or system DMA. | 48 | managers. These can be used when updating a display with CPU or system DMA. |
49 | 49 | ||
50 | omapdss driver support for audio | ||
51 | -------------------------------- | ||
52 | There exist several display technologies and standards that support audio as | ||
53 | well. Hence, it is relevant to update the DSS device driver to provide an audio | ||
54 | interface that may be used by an audio driver or any other driver interested in | ||
55 | the functionality. | ||
56 | |||
57 | The audio_enable function is intended to prepare the relevant | ||
58 | IP for playback (e.g., enabling an audio FIFO, taking in/out of reset | ||
59 | some IP, enabling companion chips, etc). It is intended to be called before | ||
60 | audio_start. The audio_disable function performs the reverse operation and is | ||
61 | intended to be called after audio_stop. | ||
62 | |||
63 | While a given DSS device driver may support audio, it is possible that for | ||
64 | certain configurations audio is not supported (e.g., an HDMI display using a | ||
65 | VESA video timing). The audio_supported function is intended to query whether | ||
66 | the current configuration of the display supports audio. | ||
67 | |||
68 | The audio_config function is intended to configure all the relevant audio | ||
69 | parameters of the display. In order to make the function independent of any | ||
70 | specific DSS device driver, a struct omap_dss_audio is defined. Its purpose | ||
71 | is to contain all the required parameters for audio configuration. At the | ||
72 | moment, such structure contains pointers to IEC-60958 channel status word | ||
73 | and CEA-861 audio infoframe structures. This should be enough to support | ||
74 | HDMI and DisplayPort, as both are based on CEA-861 and IEC-60958. | ||
75 | |||
76 | The audio_enable/disable, audio_config and audio_supported functions could be | ||
77 | implemented as functions that may sleep. Hence, they should not be called | ||
78 | while holding a spinlock or a readlock. | ||
79 | |||
80 | The audio_start/audio_stop function is intended to effectively start/stop audio | ||
81 | playback after the configuration has taken place. These functions are designed | ||
82 | to be used in an atomic context. Hence, audio_start should return quickly and be | ||
83 | called only after all the needed resources for audio playback (audio FIFOs, | ||
84 | DMA channels, companion chips, etc) have been enabled to begin data transfers. | ||
85 | audio_stop is designed to only stop the audio transfers. The resources used | ||
86 | for playback are released using audio_disable. | ||
87 | |||
88 | The enum omap_dss_audio_state may be used to help the implementations of | ||
89 | the interface to keep track of the audio state. The initial state is _DISABLED; | ||
90 | then, the state transitions to _CONFIGURED, and then, when it is ready to | ||
91 | play audio, to _ENABLED. The state _PLAYING is used when the audio is being | ||
92 | rendered. | ||
93 | |||
94 | |||
50 | Panel and controller drivers | 95 | Panel and controller drivers |
51 | ---------------------------- | 96 | ---------------------------- |
52 | 97 | ||
@@ -156,6 +201,7 @@ timings Display timings (pixclock,xres/hfp/hbp/hsw,yres/vfp/vbp/vsw) | |||
156 | "pal" and "ntsc" | 201 | "pal" and "ntsc" |
157 | panel_name | 202 | panel_name |
158 | tear_elim Tearing elimination 0=off, 1=on | 203 | tear_elim Tearing elimination 0=off, 1=on |
204 | output_type Output type (video encoder only): "composite" or "svideo" | ||
159 | 205 | ||
160 | There are also some debugfs files at <debugfs>/omapdss/ which show information | 206 | There are also some debugfs files at <debugfs>/omapdss/ which show information |
161 | about clocks and registers. | 207 | about clocks and registers. |
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 4c95c0034a4b..9b1067afb224 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
@@ -34,8 +34,7 @@ Current Status: linux-2.6.34-mmotm(development version of 2010/April) | |||
34 | 34 | ||
35 | Features: | 35 | Features: |
36 | - accounting anonymous pages, file caches, swap caches usage and limiting them. | 36 | - accounting anonymous pages, file caches, swap caches usage and limiting them. |
37 | - private LRU and reclaim routine. (system's global LRU and private LRU | 37 | - pages are linked to per-memcg LRU exclusively, and there is no global LRU. |
38 | work independently from each other) | ||
39 | - optionally, memory+swap usage can be accounted and limited. | 38 | - optionally, memory+swap usage can be accounted and limited. |
40 | - hierarchical accounting | 39 | - hierarchical accounting |
41 | - soft limit | 40 | - soft limit |
@@ -154,7 +153,7 @@ updated. page_cgroup has its own LRU on cgroup. | |||
154 | 2.2.1 Accounting details | 153 | 2.2.1 Accounting details |
155 | 154 | ||
156 | All mapped anon pages (RSS) and cache pages (Page Cache) are accounted. | 155 | All mapped anon pages (RSS) and cache pages (Page Cache) are accounted. |
157 | Some pages which are never reclaimable and will not be on the global LRU | 156 | Some pages which are never reclaimable and will not be on the LRU |
158 | are not accounted. We just account pages under usual VM management. | 157 | are not accounted. We just account pages under usual VM management. |
159 | 158 | ||
160 | RSS pages are accounted at page_fault unless they've already been accounted | 159 | RSS pages are accounted at page_fault unless they've already been accounted |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 709e08e9a222..03ca210406ed 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -531,3 +531,11 @@ Why: There appear to be no production users of the get_robust_list syscall, | |||
531 | of ASLR. It was only ever intended for debugging, so it should be | 531 | of ASLR. It was only ever intended for debugging, so it should be |
532 | removed. | 532 | removed. |
533 | Who: Kees Cook <keescook@chromium.org> | 533 | Who: Kees Cook <keescook@chromium.org> |
534 | |||
535 | ---------------------------- | ||
536 | |||
537 | What: setitimer accepts user NULL pointer (value) | ||
538 | When: 3.6 | ||
539 | Why: setitimer is not returning -EFAULT if user pointer is NULL. This | ||
540 | violates the spec. | ||
541 | Who: Sasikantha Babu <sasikanth.v19@gmail.com> | ||
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index e916e3d36488..0d0492028082 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -114,7 +114,7 @@ members are defined: | |||
114 | struct file_system_type { | 114 | struct file_system_type { |
115 | const char *name; | 115 | const char *name; |
116 | int fs_flags; | 116 | int fs_flags; |
117 | struct dentry (*mount) (struct file_system_type *, int, | 117 | struct dentry *(*mount) (struct file_system_type *, int, |
118 | const char *, void *); | 118 | const char *, void *); |
119 | void (*kill_sb) (struct super_block *); | 119 | void (*kill_sb) (struct super_block *); |
120 | struct module *owner; | 120 | struct module *owner; |
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index d97d992ced14..03f7897c6414 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt | |||
@@ -43,7 +43,9 @@ ALC680 | |||
43 | 43 | ||
44 | ALC882/883/885/888/889 | 44 | ALC882/883/885/888/889 |
45 | ====================== | 45 | ====================== |
46 | N/A | 46 | acer-aspire-4930g Acer Aspire 4930G/5930G/6530G/6930G/7730G |
47 | acer-aspire-8930g Acer Aspire 8330G/6935G | ||
48 | acer-aspire Acer Aspire others | ||
47 | 49 | ||
48 | ALC861/660 | 50 | ALC861/660 |
49 | ========== | 51 | ========== |
diff --git a/Documentation/usb/URB.txt b/Documentation/usb/URB.txt index 8ffce746d496..00d2c644068e 100644 --- a/Documentation/usb/URB.txt +++ b/Documentation/usb/URB.txt | |||
@@ -168,6 +168,28 @@ that if the completion handler or anyone else tries to resubmit it | |||
168 | they will get a -EPERM error. Thus you can be sure that when | 168 | they will get a -EPERM error. Thus you can be sure that when |
169 | usb_kill_urb() returns, the URB is totally idle. | 169 | usb_kill_urb() returns, the URB is totally idle. |
170 | 170 | ||
171 | There is a lifetime issue to consider. An URB may complete at any | ||
172 | time, and the completion handler may free the URB. If this happens | ||
173 | while usb_unlink_urb or usb_kill_urb is running, it will cause a | ||
174 | memory-access violation. The driver is responsible for avoiding this, | ||
175 | which often means some sort of lock will be needed to prevent the URB | ||
176 | from being deallocated while it is still in use. | ||
177 | |||
178 | On the other hand, since usb_unlink_urb may end up calling the | ||
179 | completion handler, the handler must not take any lock that is held | ||
180 | when usb_unlink_urb is invoked. The general solution to this problem | ||
181 | is to increment the URB's reference count while holding the lock, then | ||
182 | drop the lock and call usb_unlink_urb or usb_kill_urb, and then | ||
183 | decrement the URB's reference count. You increment the reference | ||
184 | count by calling | ||
185 | |||
186 | struct urb *usb_get_urb(struct urb *urb) | ||
187 | |||
188 | (ignore the return value; it is the same as the argument) and | ||
189 | decrement the reference count by calling usb_free_urb. Of course, | ||
190 | none of this is necessary if there's no danger of the URB being freed | ||
191 | by the completion handler. | ||
192 | |||
171 | 193 | ||
172 | 1.7. What about the completion handler? | 194 | 1.7. What about the completion handler? |
173 | 195 | ||
diff --git a/Documentation/usb/usbmon.txt b/Documentation/usb/usbmon.txt index 5335fa8b06eb..c42bb9cd3b43 100644 --- a/Documentation/usb/usbmon.txt +++ b/Documentation/usb/usbmon.txt | |||
@@ -183,10 +183,10 @@ An input control transfer to get a port status. | |||
183 | d5ea89a0 3575914555 S Ci:1:001:0 s a3 00 0000 0003 0004 4 < | 183 | d5ea89a0 3575914555 S Ci:1:001:0 s a3 00 0000 0003 0004 4 < |
184 | d5ea89a0 3575914560 C Ci:1:001:0 0 4 = 01050000 | 184 | d5ea89a0 3575914560 C Ci:1:001:0 0 4 = 01050000 |
185 | 185 | ||
186 | An output bulk transfer to send a SCSI command 0x5E in a 31-byte Bulk wrapper | 186 | An output bulk transfer to send a SCSI command 0x28 (READ_10) in a 31-byte |
187 | to a storage device at address 5: | 187 | Bulk wrapper to a storage device at address 5: |
188 | 188 | ||
189 | dd65f0e8 4128379752 S Bo:1:005:2 -115 31 = 55534243 5e000000 00000000 00000600 00000000 00000000 00000000 000000 | 189 | dd65f0e8 4128379752 S Bo:1:005:2 -115 31 = 55534243 ad000000 00800000 80010a28 20000000 20000040 00000000 000000 |
190 | dd65f0e8 4128379808 C Bo:1:005:2 0 31 > | 190 | dd65f0e8 4128379808 C Bo:1:005:2 0 31 > |
191 | 191 | ||
192 | * Raw binary format and API | 192 | * Raw binary format and API |
diff --git a/MAINTAINERS b/MAINTAINERS index 2dcfca850639..1a2f8f5823e0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1521,8 +1521,8 @@ M: Gustavo Padovan <gustavo@padovan.org> | |||
1521 | M: Johan Hedberg <johan.hedberg@gmail.com> | 1521 | M: Johan Hedberg <johan.hedberg@gmail.com> |
1522 | L: linux-bluetooth@vger.kernel.org | 1522 | L: linux-bluetooth@vger.kernel.org |
1523 | W: http://www.bluez.org/ | 1523 | W: http://www.bluez.org/ |
1524 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth.git | 1524 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git |
1525 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jh/bluetooth.git | 1525 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git |
1526 | S: Maintained | 1526 | S: Maintained |
1527 | F: drivers/bluetooth/ | 1527 | F: drivers/bluetooth/ |
1528 | 1528 | ||
@@ -1532,8 +1532,8 @@ M: Gustavo Padovan <gustavo@padovan.org> | |||
1532 | M: Johan Hedberg <johan.hedberg@gmail.com> | 1532 | M: Johan Hedberg <johan.hedberg@gmail.com> |
1533 | L: linux-bluetooth@vger.kernel.org | 1533 | L: linux-bluetooth@vger.kernel.org |
1534 | W: http://www.bluez.org/ | 1534 | W: http://www.bluez.org/ |
1535 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth.git | 1535 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git |
1536 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jh/bluetooth.git | 1536 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git |
1537 | S: Maintained | 1537 | S: Maintained |
1538 | F: net/bluetooth/ | 1538 | F: net/bluetooth/ |
1539 | F: include/net/bluetooth/ | 1539 | F: include/net/bluetooth/ |
@@ -2321,9 +2321,9 @@ S: Supported | |||
2321 | F: drivers/acpi/dock.c | 2321 | F: drivers/acpi/dock.c |
2322 | 2322 | ||
2323 | DOCUMENTATION | 2323 | DOCUMENTATION |
2324 | M: Randy Dunlap <rdunlap@xenotime.net> | 2324 | M: Rob Landley <rob@landley.net> |
2325 | L: linux-doc@vger.kernel.org | 2325 | L: linux-doc@vger.kernel.org |
2326 | T: quilt http://xenotime.net/kernel-doc-patches/current/ | 2326 | T: TBD |
2327 | S: Maintained | 2327 | S: Maintained |
2328 | F: Documentation/ | 2328 | F: Documentation/ |
2329 | 2329 | ||
@@ -4533,8 +4533,7 @@ S: Supported | |||
4533 | F: drivers/net/ethernet/myricom/myri10ge/ | 4533 | F: drivers/net/ethernet/myricom/myri10ge/ |
4534 | 4534 | ||
4535 | NATSEMI ETHERNET DRIVER (DP8381x) | 4535 | NATSEMI ETHERNET DRIVER (DP8381x) |
4536 | M: Tim Hockin <thockin@hockin.org> | 4536 | S: Orphan |
4537 | S: Maintained | ||
4538 | F: drivers/net/ethernet/natsemi/natsemi.c | 4537 | F: drivers/net/ethernet/natsemi/natsemi.c |
4539 | 4538 | ||
4540 | NATIVE INSTRUMENTS USB SOUND INTERFACE DRIVER | 4539 | NATIVE INSTRUMENTS USB SOUND INTERFACE DRIVER |
@@ -4803,6 +4802,7 @@ F: arch/arm/mach-omap2/clockdomain2xxx_3xxx.c | |||
4803 | F: arch/arm/mach-omap2/clockdomain44xx.c | 4802 | F: arch/arm/mach-omap2/clockdomain44xx.c |
4804 | 4803 | ||
4805 | OMAP AUDIO SUPPORT | 4804 | OMAP AUDIO SUPPORT |
4805 | M: Peter Ujfalusi <peter.ujfalusi@ti.com> | ||
4806 | M: Jarkko Nikula <jarkko.nikula@bitmer.com> | 4806 | M: Jarkko Nikula <jarkko.nikula@bitmer.com> |
4807 | L: alsa-devel@alsa-project.org (subscribers-only) | 4807 | L: alsa-devel@alsa-project.org (subscribers-only) |
4808 | L: linux-omap@vger.kernel.org | 4808 | L: linux-omap@vger.kernel.org |
@@ -5117,6 +5117,11 @@ F: drivers/i2c/busses/i2c-pca-* | |||
5117 | F: include/linux/i2c-algo-pca.h | 5117 | F: include/linux/i2c-algo-pca.h |
5118 | F: include/linux/i2c-pca-platform.h | 5118 | F: include/linux/i2c-pca-platform.h |
5119 | 5119 | ||
5120 | PCDP - PRIMARY CONSOLE AND DEBUG PORT | ||
5121 | M: Khalid Aziz <khalid.aziz@hp.com> | ||
5122 | S: Maintained | ||
5123 | F: drivers/firmware/pcdp.* | ||
5124 | |||
5120 | PCI ERROR RECOVERY | 5125 | PCI ERROR RECOVERY |
5121 | M: Linas Vepstas <linasvepstas@gmail.com> | 5126 | M: Linas Vepstas <linasvepstas@gmail.com> |
5122 | L: linux-pci@vger.kernel.org | 5127 | L: linux-pci@vger.kernel.org |
@@ -6466,6 +6471,7 @@ S: Odd Fixes | |||
6466 | F: drivers/staging/olpc_dcon/ | 6471 | F: drivers/staging/olpc_dcon/ |
6467 | 6472 | ||
6468 | STAGING - OZMO DEVICES USB OVER WIFI DRIVER | 6473 | STAGING - OZMO DEVICES USB OVER WIFI DRIVER |
6474 | M: Rupesh Gujare <rgujare@ozmodevices.com> | ||
6469 | M: Chris Kelly <ckelly@ozmodevices.com> | 6475 | M: Chris Kelly <ckelly@ozmodevices.com> |
6470 | S: Maintained | 6476 | S: Maintained |
6471 | F: drivers/staging/ozwpan/ | 6477 | F: drivers/staging/ozwpan/ |
@@ -7461,8 +7467,7 @@ F: include/linux/wm97xx.h | |||
7461 | 7467 | ||
7462 | WOLFSON MICROELECTRONICS DRIVERS | 7468 | WOLFSON MICROELECTRONICS DRIVERS |
7463 | M: Mark Brown <broonie@opensource.wolfsonmicro.com> | 7469 | M: Mark Brown <broonie@opensource.wolfsonmicro.com> |
7464 | M: Ian Lartey <ian@opensource.wolfsonmicro.com> | 7470 | L: patches@opensource.wolfsonmicro.com |
7465 | M: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | ||
7466 | T: git git://opensource.wolfsonmicro.com/linux-2.6-asoc | 7471 | T: git git://opensource.wolfsonmicro.com/linux-2.6-asoc |
7467 | T: git git://opensource.wolfsonmicro.com/linux-2.6-audioplus | 7472 | T: git git://opensource.wolfsonmicro.com/linux-2.6-audioplus |
7468 | W: http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices | 7473 | W: http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 4 | 2 | PATCHLEVEL = 4 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index f62251e82ffa..3bb7ffeae3bc 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <asm/barrier.h> | 5 | #include <asm/barrier.h> |
6 | #include <asm/cmpxchg.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * Atomic operations that C can't guarantee us. Useful for | 9 | * Atomic operations that C can't guarantee us. Useful for |
@@ -168,73 +169,6 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) | |||
168 | return result; | 169 | return result; |
169 | } | 170 | } |
170 | 171 | ||
171 | /* | ||
172 | * Atomic exchange routines. | ||
173 | */ | ||
174 | |||
175 | #define __ASM__MB | ||
176 | #define ____xchg(type, args...) __xchg ## type ## _local(args) | ||
177 | #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args) | ||
178 | #include <asm/xchg.h> | ||
179 | |||
180 | #define xchg_local(ptr,x) \ | ||
181 | ({ \ | ||
182 | __typeof__(*(ptr)) _x_ = (x); \ | ||
183 | (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \ | ||
184 | sizeof(*(ptr))); \ | ||
185 | }) | ||
186 | |||
187 | #define cmpxchg_local(ptr, o, n) \ | ||
188 | ({ \ | ||
189 | __typeof__(*(ptr)) _o_ = (o); \ | ||
190 | __typeof__(*(ptr)) _n_ = (n); \ | ||
191 | (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ | ||
192 | (unsigned long)_n_, \ | ||
193 | sizeof(*(ptr))); \ | ||
194 | }) | ||
195 | |||
196 | #define cmpxchg64_local(ptr, o, n) \ | ||
197 | ({ \ | ||
198 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
199 | cmpxchg_local((ptr), (o), (n)); \ | ||
200 | }) | ||
201 | |||
202 | #ifdef CONFIG_SMP | ||
203 | #undef __ASM__MB | ||
204 | #define __ASM__MB "\tmb\n" | ||
205 | #endif | ||
206 | #undef ____xchg | ||
207 | #undef ____cmpxchg | ||
208 | #define ____xchg(type, args...) __xchg ##type(args) | ||
209 | #define ____cmpxchg(type, args...) __cmpxchg ##type(args) | ||
210 | #include <asm/xchg.h> | ||
211 | |||
212 | #define xchg(ptr,x) \ | ||
213 | ({ \ | ||
214 | __typeof__(*(ptr)) _x_ = (x); \ | ||
215 | (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \ | ||
216 | sizeof(*(ptr))); \ | ||
217 | }) | ||
218 | |||
219 | #define cmpxchg(ptr, o, n) \ | ||
220 | ({ \ | ||
221 | __typeof__(*(ptr)) _o_ = (o); \ | ||
222 | __typeof__(*(ptr)) _n_ = (n); \ | ||
223 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
224 | (unsigned long)_n_, sizeof(*(ptr)));\ | ||
225 | }) | ||
226 | |||
227 | #define cmpxchg64(ptr, o, n) \ | ||
228 | ({ \ | ||
229 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
230 | cmpxchg((ptr), (o), (n)); \ | ||
231 | }) | ||
232 | |||
233 | #undef __ASM__MB | ||
234 | #undef ____cmpxchg | ||
235 | |||
236 | #define __HAVE_ARCH_CMPXCHG 1 | ||
237 | |||
238 | #define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) | 172 | #define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) |
239 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) | 173 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) |
240 | 174 | ||
diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h new file mode 100644 index 000000000000..429e8cd0d78e --- /dev/null +++ b/arch/alpha/include/asm/cmpxchg.h | |||
@@ -0,0 +1,71 @@ | |||
1 | #ifndef _ALPHA_CMPXCHG_H | ||
2 | #define _ALPHA_CMPXCHG_H | ||
3 | |||
4 | /* | ||
5 | * Atomic exchange routines. | ||
6 | */ | ||
7 | |||
8 | #define __ASM__MB | ||
9 | #define ____xchg(type, args...) __xchg ## type ## _local(args) | ||
10 | #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args) | ||
11 | #include <asm/xchg.h> | ||
12 | |||
13 | #define xchg_local(ptr, x) \ | ||
14 | ({ \ | ||
15 | __typeof__(*(ptr)) _x_ = (x); \ | ||
16 | (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \ | ||
17 | sizeof(*(ptr))); \ | ||
18 | }) | ||
19 | |||
20 | #define cmpxchg_local(ptr, o, n) \ | ||
21 | ({ \ | ||
22 | __typeof__(*(ptr)) _o_ = (o); \ | ||
23 | __typeof__(*(ptr)) _n_ = (n); \ | ||
24 | (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ | ||
25 | (unsigned long)_n_, \ | ||
26 | sizeof(*(ptr))); \ | ||
27 | }) | ||
28 | |||
29 | #define cmpxchg64_local(ptr, o, n) \ | ||
30 | ({ \ | ||
31 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
32 | cmpxchg_local((ptr), (o), (n)); \ | ||
33 | }) | ||
34 | |||
35 | #ifdef CONFIG_SMP | ||
36 | #undef __ASM__MB | ||
37 | #define __ASM__MB "\tmb\n" | ||
38 | #endif | ||
39 | #undef ____xchg | ||
40 | #undef ____cmpxchg | ||
41 | #define ____xchg(type, args...) __xchg ##type(args) | ||
42 | #define ____cmpxchg(type, args...) __cmpxchg ##type(args) | ||
43 | #include <asm/xchg.h> | ||
44 | |||
45 | #define xchg(ptr, x) \ | ||
46 | ({ \ | ||
47 | __typeof__(*(ptr)) _x_ = (x); \ | ||
48 | (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \ | ||
49 | sizeof(*(ptr))); \ | ||
50 | }) | ||
51 | |||
52 | #define cmpxchg(ptr, o, n) \ | ||
53 | ({ \ | ||
54 | __typeof__(*(ptr)) _o_ = (o); \ | ||
55 | __typeof__(*(ptr)) _n_ = (n); \ | ||
56 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
57 | (unsigned long)_n_, sizeof(*(ptr)));\ | ||
58 | }) | ||
59 | |||
60 | #define cmpxchg64(ptr, o, n) \ | ||
61 | ({ \ | ||
62 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
63 | cmpxchg((ptr), (o), (n)); \ | ||
64 | }) | ||
65 | |||
66 | #undef __ASM__MB | ||
67 | #undef ____cmpxchg | ||
68 | |||
69 | #define __HAVE_ARCH_CMPXCHG 1 | ||
70 | |||
71 | #endif /* _ALPHA_CMPXCHG_H */ | ||
diff --git a/arch/alpha/include/asm/xchg.h b/arch/alpha/include/asm/xchg.h index 1d1b436fbff2..0ca9724597c1 100644 --- a/arch/alpha/include/asm/xchg.h +++ b/arch/alpha/include/asm/xchg.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _ALPHA_ATOMIC_H | 1 | #ifndef _ALPHA_CMPXCHG_H |
2 | #error Do not include xchg.h directly! | 2 | #error Do not include xchg.h directly! |
3 | #else | 3 | #else |
4 | /* | 4 | /* |
5 | * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code | 5 | * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code |
6 | * except that local version do not have the expensive memory barrier. | 6 | * except that local version do not have the expensive memory barrier. |
7 | * So this file is included twice from asm/system.h. | 7 | * So this file is included twice from asm/cmpxchg.h. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* | 10 | /* |
diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index 6ce11c481178..797f04bedb47 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c | |||
@@ -77,6 +77,8 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space) | |||
77 | } else if (atag->hdr.tag == ATAG_MEM) { | 77 | } else if (atag->hdr.tag == ATAG_MEM) { |
78 | if (memcount >= sizeof(mem_reg_property)/4) | 78 | if (memcount >= sizeof(mem_reg_property)/4) |
79 | continue; | 79 | continue; |
80 | if (!atag->u.mem.size) | ||
81 | continue; | ||
80 | mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start); | 82 | mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start); |
81 | mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size); | 83 | mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size); |
82 | } else if (atag->hdr.tag == ATAG_INITRD2) { | 84 | } else if (atag->hdr.tag == ATAG_INITRD2) { |
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 5f6045f1766c..dc7e8ce8e6be 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
@@ -273,7 +273,7 @@ restart: adr r0, LC0 | |||
273 | add r0, r0, #0x100 | 273 | add r0, r0, #0x100 |
274 | mov r1, r6 | 274 | mov r1, r6 |
275 | sub r2, sp, r6 | 275 | sub r2, sp, r6 |
276 | blne atags_to_fdt | 276 | bleq atags_to_fdt |
277 | 277 | ||
278 | ldmfd sp!, {r0-r3, ip, lr} | 278 | ldmfd sp!, {r0-r3, ip, lr} |
279 | sub sp, sp, #0x10000 | 279 | sub sp, sp, #0x10000 |
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi index 799ad1889b51..773ef484037a 100644 --- a/arch/arm/boot/dts/at91sam9g20.dtsi +++ b/arch/arm/boot/dts/at91sam9g20.dtsi | |||
@@ -55,7 +55,6 @@ | |||
55 | #interrupt-cells = <2>; | 55 | #interrupt-cells = <2>; |
56 | compatible = "atmel,at91rm9200-aic"; | 56 | compatible = "atmel,at91rm9200-aic"; |
57 | interrupt-controller; | 57 | interrupt-controller; |
58 | interrupt-parent; | ||
59 | reg = <0xfffff000 0x200>; | 58 | reg = <0xfffff000 0x200>; |
60 | }; | 59 | }; |
61 | 60 | ||
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index 9e6eb6ecea0e..c8042147eaa2 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi | |||
@@ -56,7 +56,6 @@ | |||
56 | #interrupt-cells = <2>; | 56 | #interrupt-cells = <2>; |
57 | compatible = "atmel,at91rm9200-aic"; | 57 | compatible = "atmel,at91rm9200-aic"; |
58 | interrupt-controller; | 58 | interrupt-controller; |
59 | interrupt-parent; | ||
60 | reg = <0xfffff000 0x200>; | 59 | reg = <0xfffff000 0x200>; |
61 | }; | 60 | }; |
62 | 61 | ||
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 70ab3a4e026f..dd4ed748469a 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -54,7 +54,6 @@ | |||
54 | #interrupt-cells = <2>; | 54 | #interrupt-cells = <2>; |
55 | compatible = "atmel,at91rm9200-aic"; | 55 | compatible = "atmel,at91rm9200-aic"; |
56 | interrupt-controller; | 56 | interrupt-controller; |
57 | interrupt-parent; | ||
58 | reg = <0xfffff000 0x200>; | 57 | reg = <0xfffff000 0x200>; |
59 | }; | 58 | }; |
60 | 59 | ||
diff --git a/arch/arm/boot/dts/db8500.dtsi b/arch/arm/boot/dts/db8500.dtsi index d73dce645667..14bc30705099 100644 --- a/arch/arm/boot/dts/db8500.dtsi +++ b/arch/arm/boot/dts/db8500.dtsi | |||
@@ -24,7 +24,6 @@ | |||
24 | #interrupt-cells = <3>; | 24 | #interrupt-cells = <3>; |
25 | #address-cells = <1>; | 25 | #address-cells = <1>; |
26 | interrupt-controller; | 26 | interrupt-controller; |
27 | interrupt-parent; | ||
28 | reg = <0xa0411000 0x1000>, | 27 | reg = <0xa0411000 0x1000>, |
29 | <0xa0410100 0x100>; | 28 | <0xa0410100 0x100>; |
30 | }; | 29 | }; |
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts index 37c0ff9c8b90..83e72294aefb 100644 --- a/arch/arm/boot/dts/highbank.dts +++ b/arch/arm/boot/dts/highbank.dts | |||
@@ -89,7 +89,6 @@ | |||
89 | #size-cells = <0>; | 89 | #size-cells = <0>; |
90 | #address-cells = <1>; | 90 | #address-cells = <1>; |
91 | interrupt-controller; | 91 | interrupt-controller; |
92 | interrupt-parent; | ||
93 | reg = <0xfff11000 0x1000>, | 92 | reg = <0xfff11000 0x1000>, |
94 | <0xfff10100 0x100>; | 93 | <0xfff10100 0x100>; |
95 | }; | 94 | }; |
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c index 7a66311f3066..7e288f96cedf 100644 --- a/arch/arm/common/vic.c +++ b/arch/arm/common/vic.c | |||
@@ -427,19 +427,18 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent) | |||
427 | 427 | ||
428 | /* | 428 | /* |
429 | * Handle each interrupt in a single VIC. Returns non-zero if we've | 429 | * Handle each interrupt in a single VIC. Returns non-zero if we've |
430 | * handled at least one interrupt. This does a single read of the | 430 | * handled at least one interrupt. This reads the status register |
431 | * status register and handles all interrupts in order from LSB first. | 431 | * before handling each interrupt, which is necessary given that |
432 | * handle_IRQ may briefly re-enable interrupts for soft IRQ handling. | ||
432 | */ | 433 | */ |
433 | static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs) | 434 | static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs) |
434 | { | 435 | { |
435 | u32 stat, irq; | 436 | u32 stat, irq; |
436 | int handled = 0; | 437 | int handled = 0; |
437 | 438 | ||
438 | stat = readl_relaxed(vic->base + VIC_IRQ_STATUS); | 439 | while ((stat = readl_relaxed(vic->base + VIC_IRQ_STATUS))) { |
439 | while (stat) { | ||
440 | irq = ffs(stat) - 1; | 440 | irq = ffs(stat) - 1; |
441 | handle_IRQ(irq_find_mapping(vic->domain, irq), regs); | 441 | handle_IRQ(irq_find_mapping(vic->domain, irq), regs); |
442 | stat &= ~(1 << irq); | ||
443 | handled = 1; | 442 | handled = 1; |
444 | } | 443 | } |
445 | 444 | ||
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index b5ac644e12af..6b31cb60daab 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig | |||
@@ -112,6 +112,7 @@ CONFIG_WATCHDOG=y | |||
112 | CONFIG_IMX2_WDT=y | 112 | CONFIG_IMX2_WDT=y |
113 | CONFIG_MFD_MC13XXX=y | 113 | CONFIG_MFD_MC13XXX=y |
114 | CONFIG_REGULATOR=y | 114 | CONFIG_REGULATOR=y |
115 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
115 | CONFIG_REGULATOR_MC13783=y | 116 | CONFIG_REGULATOR_MC13783=y |
116 | CONFIG_REGULATOR_MC13892=y | 117 | CONFIG_REGULATOR_MC13892=y |
117 | CONFIG_FB=y | 118 | CONFIG_FB=y |
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig index 889d73ac1ae1..7e84f453e8a6 100644 --- a/arch/arm/configs/u8500_defconfig +++ b/arch/arm/configs/u8500_defconfig | |||
@@ -8,8 +8,6 @@ CONFIG_MODULE_UNLOAD=y | |||
8 | # CONFIG_LBDAF is not set | 8 | # CONFIG_LBDAF is not set |
9 | # CONFIG_BLK_DEV_BSG is not set | 9 | # CONFIG_BLK_DEV_BSG is not set |
10 | CONFIG_ARCH_U8500=y | 10 | CONFIG_ARCH_U8500=y |
11 | CONFIG_UX500_SOC_DB5500=y | ||
12 | CONFIG_UX500_SOC_DB8500=y | ||
13 | CONFIG_MACH_HREFV60=y | 11 | CONFIG_MACH_HREFV60=y |
14 | CONFIG_MACH_SNOWBALL=y | 12 | CONFIG_MACH_SNOWBALL=y |
15 | CONFIG_MACH_U5500=y | 13 | CONFIG_MACH_U5500=y |
@@ -39,7 +37,6 @@ CONFIG_CAIF=y | |||
39 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 37 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
40 | CONFIG_BLK_DEV_RAM=y | 38 | CONFIG_BLK_DEV_RAM=y |
41 | CONFIG_BLK_DEV_RAM_SIZE=65536 | 39 | CONFIG_BLK_DEV_RAM_SIZE=65536 |
42 | CONFIG_MISC_DEVICES=y | ||
43 | CONFIG_AB8500_PWM=y | 40 | CONFIG_AB8500_PWM=y |
44 | CONFIG_SENSORS_BH1780=y | 41 | CONFIG_SENSORS_BH1780=y |
45 | CONFIG_NETDEVICES=y | 42 | CONFIG_NETDEVICES=y |
@@ -65,16 +62,18 @@ CONFIG_SERIAL_AMBA_PL011=y | |||
65 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | 62 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y |
66 | CONFIG_HW_RANDOM=y | 63 | CONFIG_HW_RANDOM=y |
67 | CONFIG_HW_RANDOM_NOMADIK=y | 64 | CONFIG_HW_RANDOM_NOMADIK=y |
68 | CONFIG_I2C=y | ||
69 | CONFIG_I2C_NOMADIK=y | ||
70 | CONFIG_SPI=y | 65 | CONFIG_SPI=y |
71 | CONFIG_SPI_PL022=y | 66 | CONFIG_SPI_PL022=y |
72 | CONFIG_GPIO_STMPE=y | 67 | CONFIG_GPIO_STMPE=y |
73 | CONFIG_GPIO_TC3589X=y | 68 | CONFIG_GPIO_TC3589X=y |
69 | CONFIG_POWER_SUPPLY=y | ||
70 | CONFIG_AB8500_BM=y | ||
71 | CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y | ||
74 | CONFIG_MFD_STMPE=y | 72 | CONFIG_MFD_STMPE=y |
75 | CONFIG_MFD_TC3589X=y | 73 | CONFIG_MFD_TC3589X=y |
76 | CONFIG_AB5500_CORE=y | 74 | CONFIG_AB5500_CORE=y |
77 | CONFIG_AB8500_CORE=y | 75 | CONFIG_AB8500_CORE=y |
76 | CONFIG_REGULATOR=y | ||
78 | CONFIG_REGULATOR_AB8500=y | 77 | CONFIG_REGULATOR_AB8500=y |
79 | # CONFIG_HID_SUPPORT is not set | 78 | # CONFIG_HID_SUPPORT is not set |
80 | CONFIG_USB_GADGET=y | 79 | CONFIG_USB_GADGET=y |
diff --git a/arch/arm/include/asm/jump_label.h b/arch/arm/include/asm/jump_label.h index 5c5ca2ea62b0..bfc198c75913 100644 --- a/arch/arm/include/asm/jump_label.h +++ b/arch/arm/include/asm/jump_label.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #define JUMP_LABEL_NOP "nop" | 14 | #define JUMP_LABEL_NOP "nop" |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | static __always_inline bool arch_static_branch(struct jump_label_key *key) | 17 | static __always_inline bool arch_static_branch(struct static_key *key) |
18 | { | 18 | { |
19 | asm goto("1:\n\t" | 19 | asm goto("1:\n\t" |
20 | JUMP_LABEL_NOP "\n\t" | 20 | JUMP_LABEL_NOP "\n\t" |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index b91411371ae1..ebfac782593f 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -523,7 +523,21 @@ int __init arm_add_memory(phys_addr_t start, unsigned long size) | |||
523 | */ | 523 | */ |
524 | size -= start & ~PAGE_MASK; | 524 | size -= start & ~PAGE_MASK; |
525 | bank->start = PAGE_ALIGN(start); | 525 | bank->start = PAGE_ALIGN(start); |
526 | bank->size = size & PAGE_MASK; | 526 | |
527 | #ifndef CONFIG_LPAE | ||
528 | if (bank->start + size < bank->start) { | ||
529 | printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " | ||
530 | "32-bit physical address space\n", (long long)start); | ||
531 | /* | ||
532 | * To ensure bank->start + bank->size is representable in | ||
533 | * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB. | ||
534 | * This means we lose a page after masking. | ||
535 | */ | ||
536 | size = ULONG_MAX - bank->start; | ||
537 | } | ||
538 | #endif | ||
539 | |||
540 | bank->size = size & PAGE_MASK; | ||
527 | 541 | ||
528 | /* | 542 | /* |
529 | * Check whether this memory region has non-zero size or | 543 | * Check whether this memory region has non-zero size or |
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index fef42b21cecb..5b150afb995b 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
@@ -118,10 +118,14 @@ static int twd_cpufreq_transition(struct notifier_block *nb, | |||
118 | * The twd clock events must be reprogrammed to account for the new | 118 | * The twd clock events must be reprogrammed to account for the new |
119 | * frequency. The timer is local to a cpu, so cross-call to the | 119 | * frequency. The timer is local to a cpu, so cross-call to the |
120 | * changing cpu. | 120 | * changing cpu. |
121 | * | ||
122 | * Only wait for it to finish, if the cpu is active to avoid | ||
123 | * deadlock when cpu1 is spinning on while(!cpu_active(cpu1)) during | ||
124 | * booting of that cpu. | ||
121 | */ | 125 | */ |
122 | if (state == CPUFREQ_POSTCHANGE || state == CPUFREQ_RESUMECHANGE) | 126 | if (state == CPUFREQ_POSTCHANGE || state == CPUFREQ_RESUMECHANGE) |
123 | smp_call_function_single(freqs->cpu, twd_update_frequency, | 127 | smp_call_function_single(freqs->cpu, twd_update_frequency, |
124 | NULL, 1); | 128 | NULL, cpu_active(freqs->cpu)); |
125 | 129 | ||
126 | return NOTIFY_OK; | 130 | return NOTIFY_OK; |
127 | } | 131 | } |
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index 99ce5c955e39..05774e5b1cba 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
@@ -1173,7 +1173,6 @@ void __init at91_add_device_serial(void) | |||
1173 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | 1173 | printk(KERN_INFO "AT91: No default serial console defined.\n"); |
1174 | } | 1174 | } |
1175 | #else | 1175 | #else |
1176 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) {} | ||
1177 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | 1176 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} |
1178 | void __init at91_set_serial_console(unsigned portnr) {} | 1177 | void __init at91_set_serial_console(unsigned portnr) {} |
1179 | void __init at91_add_device_serial(void) {} | 1178 | void __init at91_add_device_serial(void) {} |
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index dd7f782b0b91..104ca40d8d18 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
25 | #include <linux/clockchips.h> | 25 | #include <linux/clockchips.h> |
26 | #include <linux/export.h> | ||
26 | 27 | ||
27 | #include <asm/mach/time.h> | 28 | #include <asm/mach/time.h> |
28 | 29 | ||
@@ -176,6 +177,7 @@ static struct clock_event_device clkevt = { | |||
176 | }; | 177 | }; |
177 | 178 | ||
178 | void __iomem *at91_st_base; | 179 | void __iomem *at91_st_base; |
180 | EXPORT_SYMBOL_GPL(at91_st_base); | ||
179 | 181 | ||
180 | void __init at91rm9200_ioremap_st(u32 addr) | 182 | void __init at91rm9200_ioremap_st(u32 addr) |
181 | { | 183 | { |
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c index 11cbaa8946fe..b2e4fe21f346 100644 --- a/arch/arm/mach-at91/board-rm9200ek.c +++ b/arch/arm/mach-at91/board-rm9200ek.c | |||
@@ -117,7 +117,7 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | #define EK_FLASH_BASE AT91_CHIPSELECT_0 | 119 | #define EK_FLASH_BASE AT91_CHIPSELECT_0 |
120 | #define EK_FLASH_SIZE SZ_2M | 120 | #define EK_FLASH_SIZE SZ_8M |
121 | 121 | ||
122 | static struct physmap_flash_data ek_flash_data = { | 122 | static struct physmap_flash_data ek_flash_data = { |
123 | .width = 2, | 123 | .width = 2, |
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index c3f994462864..065fed342424 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -85,8 +85,6 @@ static struct resource dm9000_resource[] = { | |||
85 | .flags = IORESOURCE_MEM | 85 | .flags = IORESOURCE_MEM |
86 | }, | 86 | }, |
87 | [2] = { | 87 | [2] = { |
88 | .start = AT91_PIN_PC11, | ||
89 | .end = AT91_PIN_PC11, | ||
90 | .flags = IORESOURCE_IRQ | 88 | .flags = IORESOURCE_IRQ |
91 | | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE, | 89 | | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE, |
92 | } | 90 | } |
@@ -130,6 +128,8 @@ static struct sam9_smc_config __initdata dm9000_smc_config = { | |||
130 | 128 | ||
131 | static void __init ek_add_device_dm9000(void) | 129 | static void __init ek_add_device_dm9000(void) |
132 | { | 130 | { |
131 | struct resource *r = &dm9000_resource[2]; | ||
132 | |||
133 | /* Configure chip-select 2 (DM9000) */ | 133 | /* Configure chip-select 2 (DM9000) */ |
134 | sam9_smc_configure(0, 2, &dm9000_smc_config); | 134 | sam9_smc_configure(0, 2, &dm9000_smc_config); |
135 | 135 | ||
@@ -139,6 +139,7 @@ static void __init ek_add_device_dm9000(void) | |||
139 | /* Configure Interrupt pin as input, no pull-up */ | 139 | /* Configure Interrupt pin as input, no pull-up */ |
140 | at91_set_gpio_input(AT91_PIN_PC11, 0); | 140 | at91_set_gpio_input(AT91_PIN_PC11, 0); |
141 | 141 | ||
142 | r->start = r->end = gpio_to_irq(AT91_PIN_PC11); | ||
142 | platform_device_register(&dm9000_device); | 143 | platform_device_register(&dm9000_device); |
143 | } | 144 | } |
144 | #else | 145 | #else |
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index a0f4d7424cdc..6b692824c988 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "generic.h" | 35 | #include "generic.h" |
36 | 36 | ||
37 | void __iomem *at91_pmc_base; | 37 | void __iomem *at91_pmc_base; |
38 | EXPORT_SYMBOL_GPL(at91_pmc_base); | ||
38 | 39 | ||
39 | /* | 40 | /* |
40 | * There's a lot more which can be done with clocks, including cpufreq | 41 | * There's a lot more which can be done with clocks, including cpufreq |
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h index 36604782a78f..ea2c57a86ca6 100644 --- a/arch/arm/mach-at91/include/mach/at91_pmc.h +++ b/arch/arm/mach-at91/include/mach/at91_pmc.h | |||
@@ -25,7 +25,7 @@ extern void __iomem *at91_pmc_base; | |||
25 | #define at91_pmc_write(field, value) \ | 25 | #define at91_pmc_write(field, value) \ |
26 | __raw_writel(value, at91_pmc_base + field) | 26 | __raw_writel(value, at91_pmc_base + field) |
27 | #else | 27 | #else |
28 | .extern at91_aic_base | 28 | .extern at91_pmc_base |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ | 31 | #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ |
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 97cc04dc8073..f44a2e7272e3 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -54,6 +54,7 @@ void __init at91_init_interrupts(unsigned int *priority) | |||
54 | } | 54 | } |
55 | 55 | ||
56 | void __iomem *at91_ramc_base[2]; | 56 | void __iomem *at91_ramc_base[2]; |
57 | EXPORT_SYMBOL_GPL(at91_ramc_base); | ||
57 | 58 | ||
58 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) | 59 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) |
59 | { | 60 | { |
@@ -292,6 +293,7 @@ void __init at91_ioremap_rstc(u32 base_addr) | |||
292 | } | 293 | } |
293 | 294 | ||
294 | void __iomem *at91_matrix_base; | 295 | void __iomem *at91_matrix_base; |
296 | EXPORT_SYMBOL_GPL(at91_matrix_base); | ||
295 | 297 | ||
296 | void __init at91_ioremap_matrix(u32 base_addr) | 298 | void __init at91_ioremap_matrix(u32 base_addr) |
297 | { | 299 | { |
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c index 22e4e0a28ad1..adbfb1994582 100644 --- a/arch/arm/mach-bcmring/core.c +++ b/arch/arm/mach-bcmring/core.c | |||
@@ -52,8 +52,8 @@ | |||
52 | #include <mach/csp/chipcHw_inline.h> | 52 | #include <mach/csp/chipcHw_inline.h> |
53 | #include <mach/csp/tmrHw_reg.h> | 53 | #include <mach/csp/tmrHw_reg.h> |
54 | 54 | ||
55 | static AMBA_APB_DEVICE(uartA, "uarta", MM_ADDR_IO_UARTA, { IRQ_UARTA }, NULL); | 55 | static AMBA_APB_DEVICE(uartA, "uartA", 0, MM_ADDR_IO_UARTA, {IRQ_UARTA}, NULL); |
56 | static AMBA_APB_DEVICE(uartB, "uartb", MM_ADDR_IO_UARTB, { IRQ_UARTB }, NULL); | 56 | static AMBA_APB_DEVICE(uartB, "uartB", 0, MM_ADDR_IO_UARTB, {IRQ_UARTB}, NULL); |
57 | 57 | ||
58 | static struct clk pll1_clk = { | 58 | static struct clk pll1_clk = { |
59 | .name = "PLL1", | 59 | .name = "PLL1", |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 0491ceef1cda..e81c35f936b5 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -368,6 +368,7 @@ comment "Flattened Device Tree based board for EXYNOS SoCs" | |||
368 | 368 | ||
369 | config MACH_EXYNOS4_DT | 369 | config MACH_EXYNOS4_DT |
370 | bool "Samsung Exynos4 Machine using device tree" | 370 | bool "Samsung Exynos4 Machine using device tree" |
371 | depends on ARCH_EXYNOS4 | ||
371 | select CPU_EXYNOS4210 | 372 | select CPU_EXYNOS4210 |
372 | select USE_OF | 373 | select USE_OF |
373 | select ARM_AMBA | 374 | select ARM_AMBA |
@@ -380,6 +381,7 @@ config MACH_EXYNOS4_DT | |||
380 | 381 | ||
381 | config MACH_EXYNOS5_DT | 382 | config MACH_EXYNOS5_DT |
382 | bool "SAMSUNG EXYNOS5 Machine using device tree" | 383 | bool "SAMSUNG EXYNOS5 Machine using device tree" |
384 | depends on ARCH_EXYNOS5 | ||
383 | select SOC_EXYNOS5250 | 385 | select SOC_EXYNOS5250 |
384 | select USE_OF | 386 | select USE_OF |
385 | select ARM_AMBA | 387 | select ARM_AMBA |
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h index 9bee8535d9e0..591e78521a9f 100644 --- a/arch/arm/mach-exynos/include/mach/irqs.h +++ b/arch/arm/mach-exynos/include/mach/irqs.h | |||
@@ -212,6 +212,8 @@ | |||
212 | #define IRQ_MFC EXYNOS4_IRQ_MFC | 212 | #define IRQ_MFC EXYNOS4_IRQ_MFC |
213 | #define IRQ_SDO EXYNOS4_IRQ_SDO | 213 | #define IRQ_SDO EXYNOS4_IRQ_SDO |
214 | 214 | ||
215 | #define IRQ_I2S0 EXYNOS4_IRQ_I2S0 | ||
216 | |||
215 | #define IRQ_ADC EXYNOS4_IRQ_ADC0 | 217 | #define IRQ_ADC EXYNOS4_IRQ_ADC0 |
216 | #define IRQ_TC EXYNOS4_IRQ_PEN0 | 218 | #define IRQ_TC EXYNOS4_IRQ_PEN0 |
217 | 219 | ||
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index 024d38ff1718..6e6d11ff352a 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h | |||
@@ -89,6 +89,10 @@ | |||
89 | #define EXYNOS4_PA_MDMA1 0x12840000 | 89 | #define EXYNOS4_PA_MDMA1 0x12840000 |
90 | #define EXYNOS4_PA_PDMA0 0x12680000 | 90 | #define EXYNOS4_PA_PDMA0 0x12680000 |
91 | #define EXYNOS4_PA_PDMA1 0x12690000 | 91 | #define EXYNOS4_PA_PDMA1 0x12690000 |
92 | #define EXYNOS5_PA_MDMA0 0x10800000 | ||
93 | #define EXYNOS5_PA_MDMA1 0x11C10000 | ||
94 | #define EXYNOS5_PA_PDMA0 0x121A0000 | ||
95 | #define EXYNOS5_PA_PDMA1 0x121B0000 | ||
92 | 96 | ||
93 | #define EXYNOS4_PA_SYSMMU_MDMA 0x10A40000 | 97 | #define EXYNOS4_PA_SYSMMU_MDMA 0x10A40000 |
94 | #define EXYNOS4_PA_SYSMMU_SSS 0x10A50000 | 98 | #define EXYNOS4_PA_SYSMMU_SSS 0x10A50000 |
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h index e141c1fd68d8..d9578a58ae7f 100644 --- a/arch/arm/mach-exynos/include/mach/regs-clock.h +++ b/arch/arm/mach-exynos/include/mach/regs-clock.h | |||
@@ -255,9 +255,15 @@ | |||
255 | 255 | ||
256 | /* For EXYNOS5250 */ | 256 | /* For EXYNOS5250 */ |
257 | 257 | ||
258 | #define EXYNOS5_APLL_LOCK EXYNOS_CLKREG(0x00000) | ||
258 | #define EXYNOS5_APLL_CON0 EXYNOS_CLKREG(0x00100) | 259 | #define EXYNOS5_APLL_CON0 EXYNOS_CLKREG(0x00100) |
259 | #define EXYNOS5_CLKSRC_CPU EXYNOS_CLKREG(0x00200) | 260 | #define EXYNOS5_CLKSRC_CPU EXYNOS_CLKREG(0x00200) |
261 | #define EXYNOS5_CLKMUX_STATCPU EXYNOS_CLKREG(0x00400) | ||
260 | #define EXYNOS5_CLKDIV_CPU0 EXYNOS_CLKREG(0x00500) | 262 | #define EXYNOS5_CLKDIV_CPU0 EXYNOS_CLKREG(0x00500) |
263 | #define EXYNOS5_CLKDIV_CPU1 EXYNOS_CLKREG(0x00504) | ||
264 | #define EXYNOS5_CLKDIV_STATCPU0 EXYNOS_CLKREG(0x00600) | ||
265 | #define EXYNOS5_CLKDIV_STATCPU1 EXYNOS_CLKREG(0x00604) | ||
266 | |||
261 | #define EXYNOS5_MPLL_CON0 EXYNOS_CLKREG(0x04100) | 267 | #define EXYNOS5_MPLL_CON0 EXYNOS_CLKREG(0x04100) |
262 | #define EXYNOS5_CLKSRC_CORE1 EXYNOS_CLKREG(0x04204) | 268 | #define EXYNOS5_CLKSRC_CORE1 EXYNOS_CLKREG(0x04204) |
263 | 269 | ||
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index 0d26f50081ad..4711c8920e37 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c | |||
@@ -45,7 +45,7 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { | |||
45 | "exynos4210-uart.3", NULL), | 45 | "exynos4210-uart.3", NULL), |
46 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), | 46 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), |
47 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), | 47 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), |
48 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.2", NULL), | 48 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), |
49 | {}, | 49 | {}, |
50 | }; | 50 | }; |
51 | 51 | ||
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c index e1e640e5b52a..d109aeb5903e 100644 --- a/arch/arm/mach-exynos/mach-nuri.c +++ b/arch/arm/mach-exynos/mach-nuri.c | |||
@@ -311,49 +311,7 @@ static struct i2c_board_info i2c1_devs[] __initdata = { | |||
311 | }; | 311 | }; |
312 | 312 | ||
313 | /* TSP */ | 313 | /* TSP */ |
314 | static u8 mxt_init_vals[] = { | ||
315 | /* MXT_GEN_COMMAND(6) */ | ||
316 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
317 | /* MXT_GEN_POWER(7) */ | ||
318 | 0x20, 0xff, 0x32, | ||
319 | /* MXT_GEN_ACQUIRE(8) */ | ||
320 | 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23, | ||
321 | /* MXT_TOUCH_MULTI(9) */ | ||
322 | 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, | ||
323 | 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, | ||
324 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
325 | 0x00, | ||
326 | /* MXT_TOUCH_KEYARRAY(15) */ | ||
327 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, | ||
328 | 0x00, | ||
329 | /* MXT_SPT_GPIOPWM(19) */ | ||
330 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
331 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
332 | /* MXT_PROCI_GRIPFACE(20) */ | ||
333 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04, | ||
334 | 0x0f, 0x0a, | ||
335 | /* MXT_PROCG_NOISE(22) */ | ||
336 | 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00, | ||
337 | 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03, | ||
338 | /* MXT_TOUCH_PROXIMITY(23) */ | ||
339 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
340 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
341 | /* MXT_PROCI_ONETOUCH(24) */ | ||
342 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
343 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
344 | /* MXT_SPT_SELFTEST(25) */ | ||
345 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
346 | 0x00, 0x00, 0x00, 0x00, | ||
347 | /* MXT_PROCI_TWOTOUCH(27) */ | ||
348 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
349 | /* MXT_SPT_CTECONFIG(28) */ | ||
350 | 0x00, 0x00, 0x02, 0x08, 0x10, 0x00, | ||
351 | }; | ||
352 | |||
353 | static struct mxt_platform_data mxt_platform_data = { | 314 | static struct mxt_platform_data mxt_platform_data = { |
354 | .config = mxt_init_vals, | ||
355 | .config_length = ARRAY_SIZE(mxt_init_vals), | ||
356 | |||
357 | .x_line = 18, | 315 | .x_line = 18, |
358 | .y_line = 11, | 316 | .y_line = 11, |
359 | .x_size = 1024, | 317 | .x_size = 1024, |
@@ -575,7 +533,7 @@ static struct regulator_init_data __initdata max8997_ldo7_data = { | |||
575 | 533 | ||
576 | static struct regulator_init_data __initdata max8997_ldo8_data = { | 534 | static struct regulator_init_data __initdata max8997_ldo8_data = { |
577 | .constraints = { | 535 | .constraints = { |
578 | .name = "VUSB/VDAC_3.3V_C210", | 536 | .name = "VUSB+VDAC_3.3V_C210", |
579 | .min_uV = 3300000, | 537 | .min_uV = 3300000, |
580 | .max_uV = 3300000, | 538 | .max_uV = 3300000, |
581 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | 539 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
@@ -1351,6 +1309,7 @@ static struct platform_device *nuri_devices[] __initdata = { | |||
1351 | 1309 | ||
1352 | static void __init nuri_map_io(void) | 1310 | static void __init nuri_map_io(void) |
1353 | { | 1311 | { |
1312 | clk_xusbxti.rate = 24000000; | ||
1354 | exynos_init_io(NULL, 0); | 1313 | exynos_init_io(NULL, 0); |
1355 | s3c24xx_init_clocks(24000000); | 1314 | s3c24xx_init_clocks(24000000); |
1356 | s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); | 1315 | s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); |
@@ -1383,7 +1342,6 @@ static void __init nuri_machine_init(void) | |||
1383 | nuri_camera_init(); | 1342 | nuri_camera_init(); |
1384 | 1343 | ||
1385 | nuri_ehci_init(); | 1344 | nuri_ehci_init(); |
1386 | clk_xusbxti.rate = 24000000; | ||
1387 | 1345 | ||
1388 | /* Last */ | 1346 | /* Last */ |
1389 | platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); | 1347 | platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); |
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index 879c539923cf..6fb0db78f38e 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
30 | 30 | ||
31 | #include <plat/regs-serial.h> | 31 | #include <plat/regs-serial.h> |
32 | #include <plat/clock.h> | ||
32 | #include <plat/cpu.h> | 33 | #include <plat/cpu.h> |
33 | #include <plat/devs.h> | 34 | #include <plat/devs.h> |
34 | #include <plat/iic.h> | 35 | #include <plat/iic.h> |
@@ -1061,6 +1062,7 @@ static struct platform_device *universal_devices[] __initdata = { | |||
1061 | 1062 | ||
1062 | static void __init universal_map_io(void) | 1063 | static void __init universal_map_io(void) |
1063 | { | 1064 | { |
1065 | clk_xusbxti.rate = 24000000; | ||
1064 | exynos_init_io(NULL, 0); | 1066 | exynos_init_io(NULL, 0); |
1065 | s3c24xx_init_clocks(24000000); | 1067 | s3c24xx_init_clocks(24000000); |
1066 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); | 1068 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); |
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c index 861ceb8232d6..ed38d03c61f2 100644 --- a/arch/arm/mach-imx/imx27-dt.c +++ b/arch/arm/mach-imx/imx27-dt.c | |||
@@ -35,7 +35,7 @@ static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = { | |||
35 | static int __init imx27_avic_add_irq_domain(struct device_node *np, | 35 | static int __init imx27_avic_add_irq_domain(struct device_node *np, |
36 | struct device_node *interrupt_parent) | 36 | struct device_node *interrupt_parent) |
37 | { | 37 | { |
38 | irq_domain_add_simple(np, 0); | 38 | irq_domain_add_legacy(np, 64, 0, 0, &irq_domain_simple_ops, NULL); |
39 | return 0; | 39 | return 0; |
40 | } | 40 | } |
41 | 41 | ||
@@ -44,7 +44,9 @@ static int __init imx27_gpio_add_irq_domain(struct device_node *np, | |||
44 | { | 44 | { |
45 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; | 45 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
46 | 46 | ||
47 | irq_domain_add_simple(np, gpio_irq_base); | 47 | gpio_irq_base -= 32; |
48 | irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, | ||
49 | NULL); | ||
48 | 50 | ||
49 | return 0; | 51 | return 0; |
50 | } | 52 | } |
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c index 05250aed61fb..e10f3914fcfe 100644 --- a/arch/arm/mach-imx/mm-imx5.c +++ b/arch/arm/mach-imx/mm-imx5.c | |||
@@ -35,7 +35,7 @@ static void imx5_idle(void) | |||
35 | } | 35 | } |
36 | clk_enable(gpc_dvfs_clk); | 36 | clk_enable(gpc_dvfs_clk); |
37 | mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); | 37 | mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); |
38 | if (tzic_enable_wake() != 0) | 38 | if (!tzic_enable_wake()) |
39 | cpu_do_idle(); | 39 | cpu_do_idle(); |
40 | clk_disable(gpc_dvfs_clk); | 40 | clk_disable(gpc_dvfs_clk); |
41 | } | 41 | } |
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c index 3698a370d636..26aac363a064 100644 --- a/arch/arm/mach-msm/board-halibut.c +++ b/arch/arm/mach-msm/board-halibut.c | |||
@@ -86,9 +86,6 @@ static void __init halibut_init(void) | |||
86 | static void __init halibut_fixup(struct tag *tags, char **cmdline, | 86 | static void __init halibut_fixup(struct tag *tags, char **cmdline, |
87 | struct meminfo *mi) | 87 | struct meminfo *mi) |
88 | { | 88 | { |
89 | mi->nr_banks=1; | ||
90 | mi->bank[0].start = PHYS_OFFSET; | ||
91 | mi->bank[0].size = (101*1024*1024); | ||
92 | } | 89 | } |
93 | 90 | ||
94 | static void __init halibut_map_io(void) | 91 | static void __init halibut_map_io(void) |
diff --git a/arch/arm/mach-msm/board-trout-panel.c b/arch/arm/mach-msm/board-trout-panel.c index 25105c1027fe..89bf6b426699 100644 --- a/arch/arm/mach-msm/board-trout-panel.c +++ b/arch/arm/mach-msm/board-trout-panel.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/mach-types.h> | 14 | #include <asm/mach-types.h> |
15 | #include <asm/system_info.h> | ||
15 | 16 | ||
16 | #include <mach/msm_fb.h> | 17 | #include <mach/msm_fb.h> |
17 | #include <mach/vreg.h> | 18 | #include <mach/vreg.h> |
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c index 5414f76ec0a9..d4060a37e23d 100644 --- a/arch/arm/mach-msm/board-trout.c +++ b/arch/arm/mach-msm/board-trout.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/clkdev.h> | 20 | #include <linux/clkdev.h> |
21 | 21 | ||
22 | #include <asm/system_info.h> | ||
22 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
23 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
24 | #include <asm/mach/map.h> | 25 | #include <asm/mach/map.h> |
diff --git a/arch/arm/mach-msm/proc_comm.c b/arch/arm/mach-msm/proc_comm.c index 67e701c7f183..9980dc736e7b 100644 --- a/arch/arm/mach-msm/proc_comm.c +++ b/arch/arm/mach-msm/proc_comm.c | |||
@@ -121,7 +121,7 @@ int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2) | |||
121 | * and unknown state. This function should be called early to | 121 | * and unknown state. This function should be called early to |
122 | * wait on the ARM9. | 122 | * wait on the ARM9. |
123 | */ | 123 | */ |
124 | void __init proc_comm_boot_wait(void) | 124 | void __devinit proc_comm_boot_wait(void) |
125 | { | 125 | { |
126 | void __iomem *base = MSM_SHARED_RAM_BASE; | 126 | void __iomem *base = MSM_SHARED_RAM_BASE; |
127 | 127 | ||
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c index 087dba0df47e..e9cc52d4cb28 100644 --- a/arch/arm/mach-omap1/mux.c +++ b/arch/arm/mach-omap1/mux.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | 29 | ||
30 | #include <mach/hardware.h> | ||
30 | 31 | ||
31 | #include <plat/mux.h> | 32 | #include <plat/mux.h> |
32 | 33 | ||
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c index 6e90665a7c47..fb202af01d0d 100644 --- a/arch/arm/mach-omap1/timer.c +++ b/arch/arm/mach-omap1/timer.c | |||
@@ -47,9 +47,9 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev, | |||
47 | int n = (pdev->id - 1) << 1; | 47 | int n = (pdev->id - 1) << 1; |
48 | u32 l; | 48 | u32 l; |
49 | 49 | ||
50 | l = __raw_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); | 50 | l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); |
51 | l |= source << n; | 51 | l |= source << n; |
52 | __raw_writel(l, MOD_CONF_CTRL_1); | 52 | omap_writel(l, MOD_CONF_CTRL_1); |
53 | 53 | ||
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index da75f239873e..37abb0d49b51 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <plat/dma.h> | 37 | #include <plat/dma.h> |
38 | #include <plat/gpmc.h> | 38 | #include <plat/gpmc.h> |
39 | #include <video/omapdss.h> | 39 | #include <video/omapdss.h> |
40 | #include <video/omap-panel-dvi.h> | 40 | #include <video/omap-panel-tfp410.h> |
41 | 41 | ||
42 | #include <plat/gpmc-smc91x.h> | 42 | #include <plat/gpmc-smc91x.h> |
43 | 43 | ||
@@ -113,9 +113,6 @@ static struct gpio sdp3430_dss_gpios[] __initdata = { | |||
113 | {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"}, | 113 | {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"}, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | static int lcd_enabled; | ||
117 | static int dvi_enabled; | ||
118 | |||
119 | static void __init sdp3430_display_init(void) | 116 | static void __init sdp3430_display_init(void) |
120 | { | 117 | { |
121 | int r; | 118 | int r; |
@@ -129,44 +126,18 @@ static void __init sdp3430_display_init(void) | |||
129 | 126 | ||
130 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) | 127 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) |
131 | { | 128 | { |
132 | if (dvi_enabled) { | ||
133 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | ||
134 | return -EINVAL; | ||
135 | } | ||
136 | |||
137 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1); | 129 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1); |
138 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1); | 130 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1); |
139 | 131 | ||
140 | lcd_enabled = 1; | ||
141 | |||
142 | return 0; | 132 | return 0; |
143 | } | 133 | } |
144 | 134 | ||
145 | static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev) | 135 | static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev) |
146 | { | 136 | { |
147 | lcd_enabled = 0; | ||
148 | |||
149 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0); | 137 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0); |
150 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0); | 138 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0); |
151 | } | 139 | } |
152 | 140 | ||
153 | static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) | ||
154 | { | ||
155 | if (lcd_enabled) { | ||
156 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | ||
157 | return -EINVAL; | ||
158 | } | ||
159 | |||
160 | dvi_enabled = 1; | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev) | ||
166 | { | ||
167 | dvi_enabled = 0; | ||
168 | } | ||
169 | |||
170 | static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev) | 141 | static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev) |
171 | { | 142 | { |
172 | return 0; | 143 | return 0; |
@@ -186,15 +157,14 @@ static struct omap_dss_device sdp3430_lcd_device = { | |||
186 | .platform_disable = sdp3430_panel_disable_lcd, | 157 | .platform_disable = sdp3430_panel_disable_lcd, |
187 | }; | 158 | }; |
188 | 159 | ||
189 | static struct panel_dvi_platform_data dvi_panel = { | 160 | static struct tfp410_platform_data dvi_panel = { |
190 | .platform_enable = sdp3430_panel_enable_dvi, | 161 | .power_down_gpio = -1, |
191 | .platform_disable = sdp3430_panel_disable_dvi, | ||
192 | }; | 162 | }; |
193 | 163 | ||
194 | static struct omap_dss_device sdp3430_dvi_device = { | 164 | static struct omap_dss_device sdp3430_dvi_device = { |
195 | .name = "dvi", | 165 | .name = "dvi", |
196 | .type = OMAP_DISPLAY_TYPE_DPI, | 166 | .type = OMAP_DISPLAY_TYPE_DPI, |
197 | .driver_name = "dvi", | 167 | .driver_name = "tfp410", |
198 | .data = &dvi_panel, | 168 | .data = &dvi_panel, |
199 | .phy.dpi.data_lines = 24, | 169 | .phy.dpi.data_lines = 24, |
200 | }; | 170 | }; |
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index a39fc4bbd2b8..b4ad706c145a 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/usb/otg.h> | 20 | #include <linux/usb/otg.h> |
21 | #include <linux/spi/spi.h> | 21 | #include <linux/spi/spi.h> |
22 | #include <linux/i2c/twl.h> | 22 | #include <linux/i2c/twl.h> |
23 | #include <linux/mfd/twl6040.h> | ||
23 | #include <linux/gpio_keys.h> | 24 | #include <linux/gpio_keys.h> |
24 | #include <linux/regulator/machine.h> | 25 | #include <linux/regulator/machine.h> |
25 | #include <linux/regulator/fixed.h> | 26 | #include <linux/regulator/fixed.h> |
@@ -560,7 +561,7 @@ static struct regulator_init_data sdp4430_vusim = { | |||
560 | }, | 561 | }, |
561 | }; | 562 | }; |
562 | 563 | ||
563 | static struct twl4030_codec_data twl6040_codec = { | 564 | static struct twl6040_codec_data twl6040_codec = { |
564 | /* single-step ramp for headset and handsfree */ | 565 | /* single-step ramp for headset and handsfree */ |
565 | .hs_left_step = 0x0f, | 566 | .hs_left_step = 0x0f, |
566 | .hs_right_step = 0x0f, | 567 | .hs_right_step = 0x0f, |
@@ -568,7 +569,7 @@ static struct twl4030_codec_data twl6040_codec = { | |||
568 | .hf_right_step = 0x1d, | 569 | .hf_right_step = 0x1d, |
569 | }; | 570 | }; |
570 | 571 | ||
571 | static struct twl4030_vibra_data twl6040_vibra = { | 572 | static struct twl6040_vibra_data twl6040_vibra = { |
572 | .vibldrv_res = 8, | 573 | .vibldrv_res = 8, |
573 | .vibrdrv_res = 3, | 574 | .vibrdrv_res = 3, |
574 | .viblmotor_res = 10, | 575 | .viblmotor_res = 10, |
@@ -577,16 +578,14 @@ static struct twl4030_vibra_data twl6040_vibra = { | |||
577 | .vddvibr_uV = 0, /* fixed volt supply - VBAT */ | 578 | .vddvibr_uV = 0, /* fixed volt supply - VBAT */ |
578 | }; | 579 | }; |
579 | 580 | ||
580 | static struct twl4030_audio_data twl6040_audio = { | 581 | static struct twl6040_platform_data twl6040_data = { |
581 | .codec = &twl6040_codec, | 582 | .codec = &twl6040_codec, |
582 | .vibra = &twl6040_vibra, | 583 | .vibra = &twl6040_vibra, |
583 | .audpwron_gpio = 127, | 584 | .audpwron_gpio = 127, |
584 | .naudint_irq = OMAP44XX_IRQ_SYS_2N, | ||
585 | .irq_base = TWL6040_CODEC_IRQ_BASE, | 585 | .irq_base = TWL6040_CODEC_IRQ_BASE, |
586 | }; | 586 | }; |
587 | 587 | ||
588 | static struct twl4030_platform_data sdp4430_twldata = { | 588 | static struct twl4030_platform_data sdp4430_twldata = { |
589 | .audio = &twl6040_audio, | ||
590 | /* Regulators */ | 589 | /* Regulators */ |
591 | .vusim = &sdp4430_vusim, | 590 | .vusim = &sdp4430_vusim, |
592 | .vaux1 = &sdp4430_vaux1, | 591 | .vaux1 = &sdp4430_vaux1, |
@@ -617,7 +616,8 @@ static int __init omap4_i2c_init(void) | |||
617 | TWL_COMMON_REGULATOR_VCXIO | | 616 | TWL_COMMON_REGULATOR_VCXIO | |
618 | TWL_COMMON_REGULATOR_VUSB | | 617 | TWL_COMMON_REGULATOR_VUSB | |
619 | TWL_COMMON_REGULATOR_CLK32KG); | 618 | TWL_COMMON_REGULATOR_CLK32KG); |
620 | omap4_pmic_init("twl6030", &sdp4430_twldata); | 619 | omap4_pmic_init("twl6030", &sdp4430_twldata, |
620 | &twl6040_data, OMAP44XX_IRQ_SYS_2N); | ||
621 | omap_register_i2c_bus(2, 400, NULL, 0); | 621 | omap_register_i2c_bus(2, 400, NULL, 0); |
622 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, | 622 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, |
623 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); | 623 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); |
@@ -666,6 +666,10 @@ static struct nokia_dsi_panel_data dsi1_panel = { | |||
666 | .use_ext_te = false, | 666 | .use_ext_te = false, |
667 | .ext_te_gpio = 101, | 667 | .ext_te_gpio = 101, |
668 | .esd_interval = 0, | 668 | .esd_interval = 0, |
669 | .pin_config = { | ||
670 | .num_pins = 6, | ||
671 | .pins = { 0, 1, 2, 3, 4, 5 }, | ||
672 | }, | ||
669 | }; | 673 | }; |
670 | 674 | ||
671 | static struct omap_dss_device sdp4430_lcd_device = { | 675 | static struct omap_dss_device sdp4430_lcd_device = { |
@@ -674,13 +678,6 @@ static struct omap_dss_device sdp4430_lcd_device = { | |||
674 | .type = OMAP_DISPLAY_TYPE_DSI, | 678 | .type = OMAP_DISPLAY_TYPE_DSI, |
675 | .data = &dsi1_panel, | 679 | .data = &dsi1_panel, |
676 | .phy.dsi = { | 680 | .phy.dsi = { |
677 | .clk_lane = 1, | ||
678 | .clk_pol = 0, | ||
679 | .data1_lane = 2, | ||
680 | .data1_pol = 0, | ||
681 | .data2_lane = 3, | ||
682 | .data2_pol = 0, | ||
683 | |||
684 | .module = 0, | 681 | .module = 0, |
685 | }, | 682 | }, |
686 | 683 | ||
@@ -715,6 +712,10 @@ static struct nokia_dsi_panel_data dsi2_panel = { | |||
715 | .use_ext_te = false, | 712 | .use_ext_te = false, |
716 | .ext_te_gpio = 103, | 713 | .ext_te_gpio = 103, |
717 | .esd_interval = 0, | 714 | .esd_interval = 0, |
715 | .pin_config = { | ||
716 | .num_pins = 6, | ||
717 | .pins = { 0, 1, 2, 3, 4, 5 }, | ||
718 | }, | ||
718 | }; | 719 | }; |
719 | 720 | ||
720 | static struct omap_dss_device sdp4430_lcd2_device = { | 721 | static struct omap_dss_device sdp4430_lcd2_device = { |
@@ -723,12 +724,6 @@ static struct omap_dss_device sdp4430_lcd2_device = { | |||
723 | .type = OMAP_DISPLAY_TYPE_DSI, | 724 | .type = OMAP_DISPLAY_TYPE_DSI, |
724 | .data = &dsi2_panel, | 725 | .data = &dsi2_panel, |
725 | .phy.dsi = { | 726 | .phy.dsi = { |
726 | .clk_lane = 1, | ||
727 | .clk_pol = 0, | ||
728 | .data1_lane = 2, | ||
729 | .data1_pol = 0, | ||
730 | .data2_lane = 3, | ||
731 | .data2_pol = 0, | ||
732 | 727 | ||
733 | .module = 1, | 728 | .module = 1, |
734 | }, | 729 | }, |
@@ -758,21 +753,6 @@ static struct omap_dss_device sdp4430_lcd2_device = { | |||
758 | .channel = OMAP_DSS_CHANNEL_LCD2, | 753 | .channel = OMAP_DSS_CHANNEL_LCD2, |
759 | }; | 754 | }; |
760 | 755 | ||
761 | static void sdp4430_lcd_init(void) | ||
762 | { | ||
763 | int r; | ||
764 | |||
765 | r = gpio_request_one(dsi1_panel.reset_gpio, GPIOF_DIR_OUT, | ||
766 | "lcd1_reset_gpio"); | ||
767 | if (r) | ||
768 | pr_err("%s: Could not get lcd1_reset_gpio\n", __func__); | ||
769 | |||
770 | r = gpio_request_one(dsi2_panel.reset_gpio, GPIOF_DIR_OUT, | ||
771 | "lcd2_reset_gpio"); | ||
772 | if (r) | ||
773 | pr_err("%s: Could not get lcd2_reset_gpio\n", __func__); | ||
774 | } | ||
775 | |||
776 | static struct omap_dss_hdmi_data sdp4430_hdmi_data = { | 756 | static struct omap_dss_hdmi_data sdp4430_hdmi_data = { |
777 | .hpd_gpio = HDMI_GPIO_HPD, | 757 | .hpd_gpio = HDMI_GPIO_HPD, |
778 | }; | 758 | }; |
@@ -858,7 +838,6 @@ static void __init omap_4430sdp_display_init(void) | |||
858 | if (r) | 838 | if (r) |
859 | pr_err("%s: Could not get display_sel GPIO\n", __func__); | 839 | pr_err("%s: Could not get display_sel GPIO\n", __func__); |
860 | 840 | ||
861 | sdp4430_lcd_init(); | ||
862 | sdp4430_picodlp_init(); | 841 | sdp4430_picodlp_init(); |
863 | omap_display_init(&sdp4430_dss_data); | 842 | omap_display_init(&sdp4430_dss_data); |
864 | /* | 843 | /* |
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index 3645285a3e2b..99790eb646e8 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <plat/usb.h> | 37 | #include <plat/usb.h> |
38 | #include <video/omapdss.h> | 38 | #include <video/omapdss.h> |
39 | #include <video/omap-panel-generic-dpi.h> | 39 | #include <video/omap-panel-generic-dpi.h> |
40 | #include <video/omap-panel-dvi.h> | 40 | #include <video/omap-panel-tfp410.h> |
41 | 41 | ||
42 | #include "am35xx-emac.h" | 42 | #include "am35xx-emac.h" |
43 | #include "mux.h" | 43 | #include "mux.h" |
@@ -207,31 +207,14 @@ static struct omap_dss_device am3517_evm_tv_device = { | |||
207 | .platform_disable = am3517_evm_panel_disable_tv, | 207 | .platform_disable = am3517_evm_panel_disable_tv, |
208 | }; | 208 | }; |
209 | 209 | ||
210 | static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev) | 210 | static struct tfp410_platform_data dvi_panel = { |
211 | { | 211 | .power_down_gpio = -1, |
212 | if (lcd_enabled) { | ||
213 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | ||
214 | return -EINVAL; | ||
215 | } | ||
216 | dvi_enabled = 1; | ||
217 | |||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev) | ||
222 | { | ||
223 | dvi_enabled = 0; | ||
224 | } | ||
225 | |||
226 | static struct panel_dvi_platform_data dvi_panel = { | ||
227 | .platform_enable = am3517_evm_panel_enable_dvi, | ||
228 | .platform_disable = am3517_evm_panel_disable_dvi, | ||
229 | }; | 212 | }; |
230 | 213 | ||
231 | static struct omap_dss_device am3517_evm_dvi_device = { | 214 | static struct omap_dss_device am3517_evm_dvi_device = { |
232 | .type = OMAP_DISPLAY_TYPE_DPI, | 215 | .type = OMAP_DISPLAY_TYPE_DPI, |
233 | .name = "dvi", | 216 | .name = "dvi", |
234 | .driver_name = "dvi", | 217 | .driver_name = "tfp410", |
235 | .data = &dvi_panel, | 218 | .data = &dvi_panel, |
236 | .phy.dpi.data_lines = 24, | 219 | .phy.dpi.data_lines = 24, |
237 | }; | 220 | }; |
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index 909a8b91b564..45746cb56c68 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <plat/usb.h> | 44 | #include <plat/usb.h> |
45 | #include <video/omapdss.h> | 45 | #include <video/omapdss.h> |
46 | #include <video/omap-panel-generic-dpi.h> | 46 | #include <video/omap-panel-generic-dpi.h> |
47 | #include <video/omap-panel-dvi.h> | 47 | #include <video/omap-panel-tfp410.h> |
48 | #include <plat/mcspi.h> | 48 | #include <plat/mcspi.h> |
49 | 49 | ||
50 | #include <mach/hardware.h> | 50 | #include <mach/hardware.h> |
@@ -218,25 +218,6 @@ static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev) | |||
218 | gpio_set_value(CM_T35_LCD_EN_GPIO, 0); | 218 | gpio_set_value(CM_T35_LCD_EN_GPIO, 0); |
219 | } | 219 | } |
220 | 220 | ||
221 | static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) | ||
222 | { | ||
223 | if (lcd_enabled) { | ||
224 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | ||
225 | return -EINVAL; | ||
226 | } | ||
227 | |||
228 | gpio_set_value(CM_T35_DVI_EN_GPIO, 0); | ||
229 | dvi_enabled = 1; | ||
230 | |||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev) | ||
235 | { | ||
236 | gpio_set_value(CM_T35_DVI_EN_GPIO, 1); | ||
237 | dvi_enabled = 0; | ||
238 | } | ||
239 | |||
240 | static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev) | 221 | static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev) |
241 | { | 222 | { |
242 | return 0; | 223 | return 0; |
@@ -260,15 +241,14 @@ static struct omap_dss_device cm_t35_lcd_device = { | |||
260 | .phy.dpi.data_lines = 18, | 241 | .phy.dpi.data_lines = 18, |
261 | }; | 242 | }; |
262 | 243 | ||
263 | static struct panel_dvi_platform_data dvi_panel = { | 244 | static struct tfp410_platform_data dvi_panel = { |
264 | .platform_enable = cm_t35_panel_enable_dvi, | 245 | .power_down_gpio = CM_T35_DVI_EN_GPIO, |
265 | .platform_disable = cm_t35_panel_disable_dvi, | ||
266 | }; | 246 | }; |
267 | 247 | ||
268 | static struct omap_dss_device cm_t35_dvi_device = { | 248 | static struct omap_dss_device cm_t35_dvi_device = { |
269 | .name = "dvi", | 249 | .name = "dvi", |
270 | .type = OMAP_DISPLAY_TYPE_DPI, | 250 | .type = OMAP_DISPLAY_TYPE_DPI, |
271 | .driver_name = "dvi", | 251 | .driver_name = "tfp410", |
272 | .data = &dvi_panel, | 252 | .data = &dvi_panel, |
273 | .phy.dpi.data_lines = 24, | 253 | .phy.dpi.data_lines = 24, |
274 | }; | 254 | }; |
@@ -316,7 +296,6 @@ static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = { | |||
316 | static struct gpio cm_t35_dss_gpios[] __initdata = { | 296 | static struct gpio cm_t35_dss_gpios[] __initdata = { |
317 | { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" }, | 297 | { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" }, |
318 | { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" }, | 298 | { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" }, |
319 | { CM_T35_DVI_EN_GPIO, GPIOF_OUT_INIT_HIGH, "dvi enable" }, | ||
320 | }; | 299 | }; |
321 | 300 | ||
322 | static void __init cm_t35_init_display(void) | 301 | static void __init cm_t35_init_display(void) |
@@ -335,7 +314,6 @@ static void __init cm_t35_init_display(void) | |||
335 | 314 | ||
336 | gpio_export(CM_T35_LCD_EN_GPIO, 0); | 315 | gpio_export(CM_T35_LCD_EN_GPIO, 0); |
337 | gpio_export(CM_T35_LCD_BL_GPIO, 0); | 316 | gpio_export(CM_T35_LCD_BL_GPIO, 0); |
338 | gpio_export(CM_T35_DVI_EN_GPIO, 0); | ||
339 | 317 | ||
340 | msleep(50); | 318 | msleep(50); |
341 | gpio_set_value(CM_T35_LCD_EN_GPIO, 1); | 319 | gpio_set_value(CM_T35_LCD_EN_GPIO, 1); |
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index a2010f07de31..b063f0d2faa6 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #include <plat/usb.h> | 47 | #include <plat/usb.h> |
48 | #include <video/omapdss.h> | 48 | #include <video/omapdss.h> |
49 | #include <video/omap-panel-generic-dpi.h> | 49 | #include <video/omap-panel-generic-dpi.h> |
50 | #include <video/omap-panel-dvi.h> | 50 | #include <video/omap-panel-tfp410.h> |
51 | 51 | ||
52 | #include <plat/mcspi.h> | 52 | #include <plat/mcspi.h> |
53 | #include <linux/input/matrix_keypad.h> | 53 | #include <linux/input/matrix_keypad.h> |
@@ -118,19 +118,6 @@ static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev) | |||
118 | gpio_set_value_cansleep(dssdev->reset_gpio, 0); | 118 | gpio_set_value_cansleep(dssdev->reset_gpio, 0); |
119 | } | 119 | } |
120 | 120 | ||
121 | static int devkit8000_panel_enable_dvi(struct omap_dss_device *dssdev) | ||
122 | { | ||
123 | if (gpio_is_valid(dssdev->reset_gpio)) | ||
124 | gpio_set_value_cansleep(dssdev->reset_gpio, 1); | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev) | ||
129 | { | ||
130 | if (gpio_is_valid(dssdev->reset_gpio)) | ||
131 | gpio_set_value_cansleep(dssdev->reset_gpio, 0); | ||
132 | } | ||
133 | |||
134 | static struct regulator_consumer_supply devkit8000_vmmc1_supply[] = { | 121 | static struct regulator_consumer_supply devkit8000_vmmc1_supply[] = { |
135 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), | 122 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), |
136 | }; | 123 | }; |
@@ -154,15 +141,14 @@ static struct omap_dss_device devkit8000_lcd_device = { | |||
154 | .phy.dpi.data_lines = 24, | 141 | .phy.dpi.data_lines = 24, |
155 | }; | 142 | }; |
156 | 143 | ||
157 | static struct panel_dvi_platform_data dvi_panel = { | 144 | static struct tfp410_platform_data dvi_panel = { |
158 | .platform_enable = devkit8000_panel_enable_dvi, | 145 | .power_down_gpio = -1, |
159 | .platform_disable = devkit8000_panel_disable_dvi, | ||
160 | }; | 146 | }; |
161 | 147 | ||
162 | static struct omap_dss_device devkit8000_dvi_device = { | 148 | static struct omap_dss_device devkit8000_dvi_device = { |
163 | .name = "dvi", | 149 | .name = "dvi", |
164 | .type = OMAP_DISPLAY_TYPE_DPI, | 150 | .type = OMAP_DISPLAY_TYPE_DPI, |
165 | .driver_name = "dvi", | 151 | .driver_name = "tfp410", |
166 | .data = &dvi_panel, | 152 | .data = &dvi_panel, |
167 | .phy.dpi.data_lines = 24, | 153 | .phy.dpi.data_lines = 24, |
168 | }; | 154 | }; |
@@ -244,13 +230,7 @@ static int devkit8000_twl_gpio_setup(struct device *dev, | |||
244 | } | 230 | } |
245 | 231 | ||
246 | /* gpio + 7 is "DVI_PD" (out, active low) */ | 232 | /* gpio + 7 is "DVI_PD" (out, active low) */ |
247 | devkit8000_dvi_device.reset_gpio = gpio + 7; | 233 | dvi_panel.power_down_gpio = gpio + 7; |
248 | ret = gpio_request_one(devkit8000_dvi_device.reset_gpio, | ||
249 | GPIOF_OUT_INIT_LOW, "DVI PowerDown"); | ||
250 | if (ret < 0) { | ||
251 | devkit8000_dvi_device.reset_gpio = -EINVAL; | ||
252 | printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n"); | ||
253 | } | ||
254 | 234 | ||
255 | return 0; | 235 | return 0; |
256 | } | 236 | } |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 74e1687b5170..098d183a0086 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -137,7 +137,7 @@ static struct twl4030_platform_data sdp4430_twldata = { | |||
137 | 137 | ||
138 | static void __init omap4_i2c_init(void) | 138 | static void __init omap4_i2c_init(void) |
139 | { | 139 | { |
140 | omap4_pmic_init("twl6030", &sdp4430_twldata); | 140 | omap4_pmic_init("twl6030", &sdp4430_twldata, NULL, 0); |
141 | } | 141 | } |
142 | 142 | ||
143 | static void __init omap4_init(void) | 143 | static void __init omap4_init(void) |
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 930c0d380435..04816c96e829 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <plat/gpmc.h> | 32 | #include <plat/gpmc.h> |
33 | #include <plat/usb.h> | 33 | #include <plat/usb.h> |
34 | #include <video/omapdss.h> | 34 | #include <video/omapdss.h> |
35 | #include <video/omap-panel-dvi.h> | 35 | #include <video/omap-panel-tfp410.h> |
36 | #include <plat/onenand.h> | 36 | #include <plat/onenand.h> |
37 | 37 | ||
38 | #include "mux.h" | 38 | #include "mux.h" |
@@ -444,28 +444,15 @@ static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = { | |||
444 | .setup = igep_twl_gpio_setup, | 444 | .setup = igep_twl_gpio_setup, |
445 | }; | 445 | }; |
446 | 446 | ||
447 | static int igep2_enable_dvi(struct omap_dss_device *dssdev) | 447 | static struct tfp410_platform_data dvi_panel = { |
448 | { | 448 | .i2c_bus_num = 3, |
449 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1); | 449 | .power_down_gpio = IGEP2_GPIO_DVI_PUP, |
450 | |||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | static void igep2_disable_dvi(struct omap_dss_device *dssdev) | ||
455 | { | ||
456 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0); | ||
457 | } | ||
458 | |||
459 | static struct panel_dvi_platform_data dvi_panel = { | ||
460 | .platform_enable = igep2_enable_dvi, | ||
461 | .platform_disable = igep2_disable_dvi, | ||
462 | .i2c_bus_num = 3, | ||
463 | }; | 450 | }; |
464 | 451 | ||
465 | static struct omap_dss_device igep2_dvi_device = { | 452 | static struct omap_dss_device igep2_dvi_device = { |
466 | .type = OMAP_DISPLAY_TYPE_DPI, | 453 | .type = OMAP_DISPLAY_TYPE_DPI, |
467 | .name = "dvi", | 454 | .name = "dvi", |
468 | .driver_name = "dvi", | 455 | .driver_name = "tfp410", |
469 | .data = &dvi_panel, | 456 | .data = &dvi_panel, |
470 | .phy.dpi.data_lines = 24, | 457 | .phy.dpi.data_lines = 24, |
471 | }; | 458 | }; |
@@ -480,14 +467,6 @@ static struct omap_dss_board_info igep2_dss_data = { | |||
480 | .default_device = &igep2_dvi_device, | 467 | .default_device = &igep2_dvi_device, |
481 | }; | 468 | }; |
482 | 469 | ||
483 | static void __init igep2_display_init(void) | ||
484 | { | ||
485 | int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH, | ||
486 | "GPIO_DVI_PUP"); | ||
487 | if (err) | ||
488 | pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); | ||
489 | } | ||
490 | |||
491 | static struct platform_device *igep_devices[] __initdata = { | 470 | static struct platform_device *igep_devices[] __initdata = { |
492 | &igep_vwlan_device, | 471 | &igep_vwlan_device, |
493 | }; | 472 | }; |
@@ -668,7 +647,6 @@ static void __init igep_init(void) | |||
668 | 647 | ||
669 | if (machine_is_igep0020()) { | 648 | if (machine_is_igep0020()) { |
670 | omap_display_init(&igep2_dss_data); | 649 | omap_display_init(&igep2_dss_data); |
671 | igep2_display_init(); | ||
672 | igep2_init_smsc911x(); | 650 | igep2_init_smsc911x(); |
673 | usbhs_init(&igep2_usbhs_bdata); | 651 | usbhs_init(&igep2_usbhs_bdata); |
674 | } else { | 652 | } else { |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 7be8d659d91d..8ede8d20d7b2 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <plat/board.h> | 42 | #include <plat/board.h> |
43 | #include "common.h" | 43 | #include "common.h" |
44 | #include <video/omapdss.h> | 44 | #include <video/omapdss.h> |
45 | #include <video/omap-panel-dvi.h> | 45 | #include <video/omap-panel-tfp410.h> |
46 | #include <plat/gpmc.h> | 46 | #include <plat/gpmc.h> |
47 | #include <plat/nand.h> | 47 | #include <plat/nand.h> |
48 | #include <plat/usb.h> | 48 | #include <plat/usb.h> |
@@ -189,33 +189,17 @@ static struct mtd_partition omap3beagle_nand_partitions[] = { | |||
189 | 189 | ||
190 | /* DSS */ | 190 | /* DSS */ |
191 | 191 | ||
192 | static int beagle_enable_dvi(struct omap_dss_device *dssdev) | 192 | static struct tfp410_platform_data dvi_panel = { |
193 | { | ||
194 | if (gpio_is_valid(dssdev->reset_gpio)) | ||
195 | gpio_set_value(dssdev->reset_gpio, 1); | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static void beagle_disable_dvi(struct omap_dss_device *dssdev) | ||
201 | { | ||
202 | if (gpio_is_valid(dssdev->reset_gpio)) | ||
203 | gpio_set_value(dssdev->reset_gpio, 0); | ||
204 | } | ||
205 | |||
206 | static struct panel_dvi_platform_data dvi_panel = { | ||
207 | .platform_enable = beagle_enable_dvi, | ||
208 | .platform_disable = beagle_disable_dvi, | ||
209 | .i2c_bus_num = 3, | 193 | .i2c_bus_num = 3, |
194 | .power_down_gpio = -1, | ||
210 | }; | 195 | }; |
211 | 196 | ||
212 | static struct omap_dss_device beagle_dvi_device = { | 197 | static struct omap_dss_device beagle_dvi_device = { |
213 | .type = OMAP_DISPLAY_TYPE_DPI, | 198 | .type = OMAP_DISPLAY_TYPE_DPI, |
214 | .name = "dvi", | 199 | .name = "dvi", |
215 | .driver_name = "dvi", | 200 | .driver_name = "tfp410", |
216 | .data = &dvi_panel, | 201 | .data = &dvi_panel, |
217 | .phy.dpi.data_lines = 24, | 202 | .phy.dpi.data_lines = 24, |
218 | .reset_gpio = -EINVAL, | ||
219 | }; | 203 | }; |
220 | 204 | ||
221 | static struct omap_dss_device beagle_tv_device = { | 205 | static struct omap_dss_device beagle_tv_device = { |
@@ -236,16 +220,6 @@ static struct omap_dss_board_info beagle_dss_data = { | |||
236 | .default_device = &beagle_dvi_device, | 220 | .default_device = &beagle_dvi_device, |
237 | }; | 221 | }; |
238 | 222 | ||
239 | static void __init beagle_display_init(void) | ||
240 | { | ||
241 | int r; | ||
242 | |||
243 | r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW, | ||
244 | "DVI reset"); | ||
245 | if (r < 0) | ||
246 | printk(KERN_ERR "Unable to get DVI reset GPIO\n"); | ||
247 | } | ||
248 | |||
249 | #include "sdram-micron-mt46h32m32lf-6.h" | 223 | #include "sdram-micron-mt46h32m32lf-6.h" |
250 | 224 | ||
251 | static struct omap2_hsmmc_info mmc[] = { | 225 | static struct omap2_hsmmc_info mmc[] = { |
@@ -309,7 +283,7 @@ static int beagle_twl_gpio_setup(struct device *dev, | |||
309 | if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) | 283 | if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) |
310 | pr_err("%s: unable to configure EHCI_nOC\n", __func__); | 284 | pr_err("%s: unable to configure EHCI_nOC\n", __func__); |
311 | } | 285 | } |
312 | beagle_dvi_device.reset_gpio = beagle_config.reset_gpio; | 286 | dvi_panel.power_down_gpio = beagle_config.reset_gpio; |
313 | 287 | ||
314 | gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, | 288 | gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, |
315 | "nEN_USB_PWR"); | 289 | "nEN_USB_PWR"); |
@@ -552,7 +526,6 @@ static void __init omap3_beagle_init(void) | |||
552 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 526 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
553 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | 527 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
554 | 528 | ||
555 | beagle_display_init(); | ||
556 | beagle_opp_init(); | 529 | beagle_opp_init(); |
557 | } | 530 | } |
558 | 531 | ||
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 49df12735b41..9919d6c1a531 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "common.h" | 46 | #include "common.h" |
47 | #include <plat/mcspi.h> | 47 | #include <plat/mcspi.h> |
48 | #include <video/omapdss.h> | 48 | #include <video/omapdss.h> |
49 | #include <video/omap-panel-dvi.h> | 49 | #include <video/omap-panel-tfp410.h> |
50 | 50 | ||
51 | #include "mux.h" | 51 | #include "mux.h" |
52 | #include "sdram-micron-mt46h32m32lf-6.h" | 52 | #include "sdram-micron-mt46h32m32lf-6.h" |
@@ -219,35 +219,14 @@ static struct omap_dss_device omap3_evm_tv_device = { | |||
219 | .platform_disable = omap3_evm_disable_tv, | 219 | .platform_disable = omap3_evm_disable_tv, |
220 | }; | 220 | }; |
221 | 221 | ||
222 | static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev) | 222 | static struct tfp410_platform_data dvi_panel = { |
223 | { | 223 | .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO, |
224 | if (lcd_enabled) { | ||
225 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | ||
226 | return -EINVAL; | ||
227 | } | ||
228 | |||
229 | gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 1); | ||
230 | |||
231 | dvi_enabled = 1; | ||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev) | ||
236 | { | ||
237 | gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 0); | ||
238 | |||
239 | dvi_enabled = 0; | ||
240 | } | ||
241 | |||
242 | static struct panel_dvi_platform_data dvi_panel = { | ||
243 | .platform_enable = omap3_evm_enable_dvi, | ||
244 | .platform_disable = omap3_evm_disable_dvi, | ||
245 | }; | 224 | }; |
246 | 225 | ||
247 | static struct omap_dss_device omap3_evm_dvi_device = { | 226 | static struct omap_dss_device omap3_evm_dvi_device = { |
248 | .name = "dvi", | 227 | .name = "dvi", |
249 | .type = OMAP_DISPLAY_TYPE_DPI, | 228 | .type = OMAP_DISPLAY_TYPE_DPI, |
250 | .driver_name = "dvi", | 229 | .driver_name = "tfp410", |
251 | .data = &dvi_panel, | 230 | .data = &dvi_panel, |
252 | .phy.dpi.data_lines = 24, | 231 | .phy.dpi.data_lines = 24, |
253 | }; | 232 | }; |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index 4dffc95bddd2..4396bae91677 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <plat/usb.h> | 42 | #include <plat/usb.h> |
43 | #include <video/omapdss.h> | 43 | #include <video/omapdss.h> |
44 | #include <video/omap-panel-generic-dpi.h> | 44 | #include <video/omap-panel-generic-dpi.h> |
45 | #include <video/omap-panel-dvi.h> | 45 | #include <video/omap-panel-tfp410.h> |
46 | 46 | ||
47 | #include <plat/mcspi.h> | 47 | #include <plat/mcspi.h> |
48 | #include <linux/input/matrix_keypad.h> | 48 | #include <linux/input/matrix_keypad.h> |
@@ -92,9 +92,6 @@ static inline void __init omap3stalker_init_eth(void) | |||
92 | #define LCD_PANEL_BKLIGHT_GPIO 210 | 92 | #define LCD_PANEL_BKLIGHT_GPIO 210 |
93 | #define ENABLE_VPLL2_DEV_GRP 0xE0 | 93 | #define ENABLE_VPLL2_DEV_GRP 0xE0 |
94 | 94 | ||
95 | static int lcd_enabled; | ||
96 | static int dvi_enabled; | ||
97 | |||
98 | static void __init omap3_stalker_display_init(void) | 95 | static void __init omap3_stalker_display_init(void) |
99 | { | 96 | { |
100 | return; | 97 | return; |
@@ -122,32 +119,14 @@ static struct omap_dss_device omap3_stalker_tv_device = { | |||
122 | .platform_disable = omap3_stalker_disable_tv, | 119 | .platform_disable = omap3_stalker_disable_tv, |
123 | }; | 120 | }; |
124 | 121 | ||
125 | static int omap3_stalker_enable_dvi(struct omap_dss_device *dssdev) | 122 | static struct tfp410_platform_data dvi_panel = { |
126 | { | 123 | .power_down_gpio = DSS_ENABLE_GPIO, |
127 | if (lcd_enabled) { | ||
128 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | ||
129 | return -EINVAL; | ||
130 | } | ||
131 | gpio_set_value(DSS_ENABLE_GPIO, 1); | ||
132 | dvi_enabled = 1; | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static void omap3_stalker_disable_dvi(struct omap_dss_device *dssdev) | ||
137 | { | ||
138 | gpio_set_value(DSS_ENABLE_GPIO, 0); | ||
139 | dvi_enabled = 0; | ||
140 | } | ||
141 | |||
142 | static struct panel_dvi_platform_data dvi_panel = { | ||
143 | .platform_enable = omap3_stalker_enable_dvi, | ||
144 | .platform_disable = omap3_stalker_disable_dvi, | ||
145 | }; | 124 | }; |
146 | 125 | ||
147 | static struct omap_dss_device omap3_stalker_dvi_device = { | 126 | static struct omap_dss_device omap3_stalker_dvi_device = { |
148 | .name = "dvi", | 127 | .name = "dvi", |
149 | .type = OMAP_DISPLAY_TYPE_DPI, | 128 | .type = OMAP_DISPLAY_TYPE_DPI, |
150 | .driver_name = "dvi", | 129 | .driver_name = "tfp410", |
151 | .data = &dvi_panel, | 130 | .data = &dvi_panel, |
152 | .phy.dpi.data_lines = 24, | 131 | .phy.dpi.data_lines = 24, |
153 | }; | 132 | }; |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index d8c0e89f0126..b26cd15f3c8b 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
26 | #include <linux/usb/otg.h> | 26 | #include <linux/usb/otg.h> |
27 | #include <linux/i2c/twl.h> | 27 | #include <linux/i2c/twl.h> |
28 | #include <linux/mfd/twl6040.h> | ||
28 | #include <linux/regulator/machine.h> | 29 | #include <linux/regulator/machine.h> |
29 | #include <linux/regulator/fixed.h> | 30 | #include <linux/regulator/fixed.h> |
30 | #include <linux/wl12xx.h> | 31 | #include <linux/wl12xx.h> |
@@ -41,7 +42,7 @@ | |||
41 | #include "common.h" | 42 | #include "common.h" |
42 | #include <plat/usb.h> | 43 | #include <plat/usb.h> |
43 | #include <plat/mmc.h> | 44 | #include <plat/mmc.h> |
44 | #include <video/omap-panel-dvi.h> | 45 | #include <video/omap-panel-tfp410.h> |
45 | 46 | ||
46 | #include "hsmmc.h" | 47 | #include "hsmmc.h" |
47 | #include "control.h" | 48 | #include "control.h" |
@@ -284,7 +285,7 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) | |||
284 | return 0; | 285 | return 0; |
285 | } | 286 | } |
286 | 287 | ||
287 | static struct twl4030_codec_data twl6040_codec = { | 288 | static struct twl6040_codec_data twl6040_codec = { |
288 | /* single-step ramp for headset and handsfree */ | 289 | /* single-step ramp for headset and handsfree */ |
289 | .hs_left_step = 0x0f, | 290 | .hs_left_step = 0x0f, |
290 | .hs_right_step = 0x0f, | 291 | .hs_right_step = 0x0f, |
@@ -292,17 +293,14 @@ static struct twl4030_codec_data twl6040_codec = { | |||
292 | .hf_right_step = 0x1d, | 293 | .hf_right_step = 0x1d, |
293 | }; | 294 | }; |
294 | 295 | ||
295 | static struct twl4030_audio_data twl6040_audio = { | 296 | static struct twl6040_platform_data twl6040_data = { |
296 | .codec = &twl6040_codec, | 297 | .codec = &twl6040_codec, |
297 | .audpwron_gpio = 127, | 298 | .audpwron_gpio = 127, |
298 | .naudint_irq = OMAP44XX_IRQ_SYS_2N, | ||
299 | .irq_base = TWL6040_CODEC_IRQ_BASE, | 299 | .irq_base = TWL6040_CODEC_IRQ_BASE, |
300 | }; | 300 | }; |
301 | 301 | ||
302 | /* Panda board uses the common PMIC configuration */ | 302 | /* Panda board uses the common PMIC configuration */ |
303 | static struct twl4030_platform_data omap4_panda_twldata = { | 303 | static struct twl4030_platform_data omap4_panda_twldata; |
304 | .audio = &twl6040_audio, | ||
305 | }; | ||
306 | 304 | ||
307 | /* | 305 | /* |
308 | * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM | 306 | * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM |
@@ -326,7 +324,8 @@ static int __init omap4_panda_i2c_init(void) | |||
326 | TWL_COMMON_REGULATOR_VCXIO | | 324 | TWL_COMMON_REGULATOR_VCXIO | |
327 | TWL_COMMON_REGULATOR_VUSB | | 325 | TWL_COMMON_REGULATOR_VUSB | |
328 | TWL_COMMON_REGULATOR_CLK32KG); | 326 | TWL_COMMON_REGULATOR_CLK32KG); |
329 | omap4_pmic_init("twl6030", &omap4_panda_twldata); | 327 | omap4_pmic_init("twl6030", &omap4_panda_twldata, |
328 | &twl6040_data, OMAP44XX_IRQ_SYS_2N); | ||
330 | omap_register_i2c_bus(2, 400, NULL, 0); | 329 | omap_register_i2c_bus(2, 400, NULL, 0); |
331 | /* | 330 | /* |
332 | * Bus 3 is attached to the DVI port where devices like the pico DLP | 331 | * Bus 3 is attached to the DVI port where devices like the pico DLP |
@@ -421,46 +420,22 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
421 | /* Display DVI */ | 420 | /* Display DVI */ |
422 | #define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0 | 421 | #define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0 |
423 | 422 | ||
424 | static int omap4_panda_enable_dvi(struct omap_dss_device *dssdev) | ||
425 | { | ||
426 | gpio_set_value(dssdev->reset_gpio, 1); | ||
427 | return 0; | ||
428 | } | ||
429 | |||
430 | static void omap4_panda_disable_dvi(struct omap_dss_device *dssdev) | ||
431 | { | ||
432 | gpio_set_value(dssdev->reset_gpio, 0); | ||
433 | } | ||
434 | |||
435 | /* Using generic display panel */ | 423 | /* Using generic display panel */ |
436 | static struct panel_dvi_platform_data omap4_dvi_panel = { | 424 | static struct tfp410_platform_data omap4_dvi_panel = { |
437 | .platform_enable = omap4_panda_enable_dvi, | 425 | .i2c_bus_num = 3, |
438 | .platform_disable = omap4_panda_disable_dvi, | 426 | .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, |
439 | .i2c_bus_num = 3, | ||
440 | }; | 427 | }; |
441 | 428 | ||
442 | struct omap_dss_device omap4_panda_dvi_device = { | 429 | struct omap_dss_device omap4_panda_dvi_device = { |
443 | .type = OMAP_DISPLAY_TYPE_DPI, | 430 | .type = OMAP_DISPLAY_TYPE_DPI, |
444 | .name = "dvi", | 431 | .name = "dvi", |
445 | .driver_name = "dvi", | 432 | .driver_name = "tfp410", |
446 | .data = &omap4_dvi_panel, | 433 | .data = &omap4_dvi_panel, |
447 | .phy.dpi.data_lines = 24, | 434 | .phy.dpi.data_lines = 24, |
448 | .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, | 435 | .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, |
449 | .channel = OMAP_DSS_CHANNEL_LCD2, | 436 | .channel = OMAP_DSS_CHANNEL_LCD2, |
450 | }; | 437 | }; |
451 | 438 | ||
452 | int __init omap4_panda_dvi_init(void) | ||
453 | { | ||
454 | int r; | ||
455 | |||
456 | /* Requesting TFP410 DVI GPIO and disabling it, at bootup */ | ||
457 | r = gpio_request_one(omap4_panda_dvi_device.reset_gpio, | ||
458 | GPIOF_OUT_INIT_LOW, "DVI PD"); | ||
459 | if (r) | ||
460 | pr_err("Failed to get DVI powerdown GPIO\n"); | ||
461 | |||
462 | return r; | ||
463 | } | ||
464 | 439 | ||
465 | static struct gpio panda_hdmi_gpios[] = { | 440 | static struct gpio panda_hdmi_gpios[] = { |
466 | { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" }, | 441 | { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" }, |
@@ -512,11 +487,6 @@ static struct omap_dss_board_info omap4_panda_dss_data = { | |||
512 | 487 | ||
513 | void __init omap4_panda_display_init(void) | 488 | void __init omap4_panda_display_init(void) |
514 | { | 489 | { |
515 | int r; | ||
516 | |||
517 | r = omap4_panda_dvi_init(); | ||
518 | if (r) | ||
519 | pr_err("error initializing panda DVI\n"); | ||
520 | 490 | ||
521 | omap_display_init(&omap4_panda_dss_data); | 491 | omap_display_init(&omap4_panda_dss_data); |
522 | 492 | ||
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index 33aa3910b09e..5527c1979a16 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "common.h" | 46 | #include "common.h" |
47 | #include <video/omapdss.h> | 47 | #include <video/omapdss.h> |
48 | #include <video/omap-panel-generic-dpi.h> | 48 | #include <video/omap-panel-generic-dpi.h> |
49 | #include <video/omap-panel-dvi.h> | 49 | #include <video/omap-panel-tfp410.h> |
50 | #include <plat/gpmc.h> | 50 | #include <plat/gpmc.h> |
51 | #include <mach/hardware.h> | 51 | #include <mach/hardware.h> |
52 | #include <plat/nand.h> | 52 | #include <plat/nand.h> |
@@ -167,32 +167,15 @@ static void __init overo_display_init(void) | |||
167 | gpio_export(OVERO_GPIO_LCD_BL, 0); | 167 | gpio_export(OVERO_GPIO_LCD_BL, 0); |
168 | } | 168 | } |
169 | 169 | ||
170 | static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) | 170 | static struct tfp410_platform_data dvi_panel = { |
171 | { | ||
172 | if (lcd_enabled) { | ||
173 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | ||
174 | return -EINVAL; | ||
175 | } | ||
176 | dvi_enabled = 1; | ||
177 | |||
178 | return 0; | ||
179 | } | ||
180 | |||
181 | static void overo_panel_disable_dvi(struct omap_dss_device *dssdev) | ||
182 | { | ||
183 | dvi_enabled = 0; | ||
184 | } | ||
185 | |||
186 | static struct panel_dvi_platform_data dvi_panel = { | ||
187 | .platform_enable = overo_panel_enable_dvi, | ||
188 | .platform_disable = overo_panel_disable_dvi, | ||
189 | .i2c_bus_num = 3, | 171 | .i2c_bus_num = 3, |
172 | .power_down_gpio = -1, | ||
190 | }; | 173 | }; |
191 | 174 | ||
192 | static struct omap_dss_device overo_dvi_device = { | 175 | static struct omap_dss_device overo_dvi_device = { |
193 | .name = "dvi", | 176 | .name = "dvi", |
194 | .type = OMAP_DISPLAY_TYPE_DPI, | 177 | .type = OMAP_DISPLAY_TYPE_DPI, |
195 | .driver_name = "dvi", | 178 | .driver_name = "tfp410", |
196 | .data = &dvi_panel, | 179 | .data = &dvi_panel, |
197 | .phy.dpi.data_lines = 24, | 180 | .phy.dpi.data_lines = 24, |
198 | }; | 181 | }; |
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c index 7072e0d651b1..3d9d746b221a 100644 --- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c +++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | |||
@@ -165,83 +165,3 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate) | |||
165 | 165 | ||
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | |||
169 | #ifdef CONFIG_CPU_FREQ | ||
170 | /* | ||
171 | * Walk PRCM rate table and fillout cpufreq freq_table | ||
172 | * XXX This should be replaced by an OPP layer in the near future | ||
173 | */ | ||
174 | static struct cpufreq_frequency_table *freq_table; | ||
175 | |||
176 | void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) | ||
177 | { | ||
178 | const struct prcm_config *prcm; | ||
179 | int i = 0; | ||
180 | int tbl_sz = 0; | ||
181 | |||
182 | if (!cpu_is_omap24xx()) | ||
183 | return; | ||
184 | |||
185 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
186 | if (!(prcm->flags & cpu_mask)) | ||
187 | continue; | ||
188 | if (prcm->xtal_speed != sclk->rate) | ||
189 | continue; | ||
190 | |||
191 | /* don't put bypass rates in table */ | ||
192 | if (prcm->dpll_speed == prcm->xtal_speed) | ||
193 | continue; | ||
194 | |||
195 | tbl_sz++; | ||
196 | } | ||
197 | |||
198 | /* | ||
199 | * XXX Ensure that we're doing what CPUFreq expects for this error | ||
200 | * case and the following one | ||
201 | */ | ||
202 | if (tbl_sz == 0) { | ||
203 | pr_warning("%s: no matching entries in rate_table\n", | ||
204 | __func__); | ||
205 | return; | ||
206 | } | ||
207 | |||
208 | /* Include the CPUFREQ_TABLE_END terminator entry */ | ||
209 | tbl_sz++; | ||
210 | |||
211 | freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) * tbl_sz, | ||
212 | GFP_ATOMIC); | ||
213 | if (!freq_table) { | ||
214 | pr_err("%s: could not kzalloc frequency table\n", __func__); | ||
215 | return; | ||
216 | } | ||
217 | |||
218 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
219 | if (!(prcm->flags & cpu_mask)) | ||
220 | continue; | ||
221 | if (prcm->xtal_speed != sclk->rate) | ||
222 | continue; | ||
223 | |||
224 | /* don't put bypass rates in table */ | ||
225 | if (prcm->dpll_speed == prcm->xtal_speed) | ||
226 | continue; | ||
227 | |||
228 | freq_table[i].index = i; | ||
229 | freq_table[i].frequency = prcm->mpu_speed / 1000; | ||
230 | i++; | ||
231 | } | ||
232 | |||
233 | freq_table[i].index = i; | ||
234 | freq_table[i].frequency = CPUFREQ_TABLE_END; | ||
235 | |||
236 | *table = &freq_table[0]; | ||
237 | } | ||
238 | |||
239 | void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table) | ||
240 | { | ||
241 | if (!cpu_is_omap24xx()) | ||
242 | return; | ||
243 | |||
244 | kfree(freq_table); | ||
245 | } | ||
246 | |||
247 | #endif | ||
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index f57ed5baeccf..d9f4931513f9 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -536,10 +536,5 @@ struct clk_functions omap2_clk_functions = { | |||
536 | .clk_set_rate = omap2_clk_set_rate, | 536 | .clk_set_rate = omap2_clk_set_rate, |
537 | .clk_set_parent = omap2_clk_set_parent, | 537 | .clk_set_parent = omap2_clk_set_parent, |
538 | .clk_disable_unused = omap2_clk_disable_unused, | 538 | .clk_disable_unused = omap2_clk_disable_unused, |
539 | #ifdef CONFIG_CPU_FREQ | ||
540 | /* These will be removed when the OPP code is integrated */ | ||
541 | .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table, | ||
542 | .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table, | ||
543 | #endif | ||
544 | }; | 539 | }; |
545 | 540 | ||
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index b8c2a686481c..a1bb23a23351 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -146,14 +146,6 @@ extern const struct clksel_rate gpt_sys_rates[]; | |||
146 | extern const struct clksel_rate gfx_l3_rates[]; | 146 | extern const struct clksel_rate gfx_l3_rates[]; |
147 | extern const struct clksel_rate dsp_ick_rates[]; | 147 | extern const struct clksel_rate dsp_ick_rates[]; |
148 | 148 | ||
149 | #if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_CPU_FREQ) | ||
150 | extern void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table); | ||
151 | extern void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table); | ||
152 | #else | ||
153 | #define omap2_clk_init_cpufreq_table 0 | ||
154 | #define omap2_clk_exit_cpufreq_table 0 | ||
155 | #endif | ||
156 | |||
157 | extern const struct clkops clkops_omap2_iclk_dflt_wait; | 149 | extern const struct clkops clkops_omap2_iclk_dflt_wait; |
158 | extern const struct clkops clkops_omap2_iclk_dflt; | 150 | extern const struct clkops clkops_omap2_iclk_dflt; |
159 | extern const struct clkops clkops_omap2_iclk_idle_only; | 151 | extern const struct clkops clkops_omap2_iclk_idle_only; |
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index db5a88a36c63..54d49ddb9b81 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -180,16 +180,133 @@ static void omap_dsi_disable_pads(int dsi_id, unsigned lane_mask) | |||
180 | omap4_dsi_mux_pads(dsi_id, 0); | 180 | omap4_dsi_mux_pads(dsi_id, 0); |
181 | } | 181 | } |
182 | 182 | ||
183 | static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput) | ||
184 | { | ||
185 | return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput); | ||
186 | } | ||
187 | |||
188 | static struct platform_device *create_dss_pdev(const char *pdev_name, | ||
189 | int pdev_id, const char *oh_name, void *pdata, int pdata_len, | ||
190 | struct platform_device *parent) | ||
191 | { | ||
192 | struct platform_device *pdev; | ||
193 | struct omap_device *od; | ||
194 | struct omap_hwmod *ohs[1]; | ||
195 | struct omap_hwmod *oh; | ||
196 | int r; | ||
197 | |||
198 | oh = omap_hwmod_lookup(oh_name); | ||
199 | if (!oh) { | ||
200 | pr_err("Could not look up %s\n", oh_name); | ||
201 | r = -ENODEV; | ||
202 | goto err; | ||
203 | } | ||
204 | |||
205 | pdev = platform_device_alloc(pdev_name, pdev_id); | ||
206 | if (!pdev) { | ||
207 | pr_err("Could not create pdev for %s\n", pdev_name); | ||
208 | r = -ENOMEM; | ||
209 | goto err; | ||
210 | } | ||
211 | |||
212 | if (parent != NULL) | ||
213 | pdev->dev.parent = &parent->dev; | ||
214 | |||
215 | if (pdev->id != -1) | ||
216 | dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); | ||
217 | else | ||
218 | dev_set_name(&pdev->dev, "%s", pdev->name); | ||
219 | |||
220 | ohs[0] = oh; | ||
221 | od = omap_device_alloc(pdev, ohs, 1, NULL, 0); | ||
222 | if (!od) { | ||
223 | pr_err("Could not alloc omap_device for %s\n", pdev_name); | ||
224 | r = -ENOMEM; | ||
225 | goto err; | ||
226 | } | ||
227 | |||
228 | r = platform_device_add_data(pdev, pdata, pdata_len); | ||
229 | if (r) { | ||
230 | pr_err("Could not set pdata for %s\n", pdev_name); | ||
231 | goto err; | ||
232 | } | ||
233 | |||
234 | r = omap_device_register(pdev); | ||
235 | if (r) { | ||
236 | pr_err("Could not register omap_device for %s\n", pdev_name); | ||
237 | goto err; | ||
238 | } | ||
239 | |||
240 | return pdev; | ||
241 | |||
242 | err: | ||
243 | return ERR_PTR(r); | ||
244 | } | ||
245 | |||
246 | static struct platform_device *create_simple_dss_pdev(const char *pdev_name, | ||
247 | int pdev_id, void *pdata, int pdata_len, | ||
248 | struct platform_device *parent) | ||
249 | { | ||
250 | struct platform_device *pdev; | ||
251 | int r; | ||
252 | |||
253 | pdev = platform_device_alloc(pdev_name, pdev_id); | ||
254 | if (!pdev) { | ||
255 | pr_err("Could not create pdev for %s\n", pdev_name); | ||
256 | r = -ENOMEM; | ||
257 | goto err; | ||
258 | } | ||
259 | |||
260 | if (parent != NULL) | ||
261 | pdev->dev.parent = &parent->dev; | ||
262 | |||
263 | if (pdev->id != -1) | ||
264 | dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); | ||
265 | else | ||
266 | dev_set_name(&pdev->dev, "%s", pdev->name); | ||
267 | |||
268 | r = platform_device_add_data(pdev, pdata, pdata_len); | ||
269 | if (r) { | ||
270 | pr_err("Could not set pdata for %s\n", pdev_name); | ||
271 | goto err; | ||
272 | } | ||
273 | |||
274 | r = omap_device_register(pdev); | ||
275 | if (r) { | ||
276 | pr_err("Could not register omap_device for %s\n", pdev_name); | ||
277 | goto err; | ||
278 | } | ||
279 | |||
280 | return pdev; | ||
281 | |||
282 | err: | ||
283 | return ERR_PTR(r); | ||
284 | } | ||
285 | |||
183 | int __init omap_display_init(struct omap_dss_board_info *board_data) | 286 | int __init omap_display_init(struct omap_dss_board_info *board_data) |
184 | { | 287 | { |
185 | int r = 0; | 288 | int r = 0; |
186 | struct omap_hwmod *oh; | ||
187 | struct platform_device *pdev; | 289 | struct platform_device *pdev; |
188 | int i, oh_count; | 290 | int i, oh_count; |
189 | struct omap_display_platform_data pdata; | ||
190 | const struct omap_dss_hwmod_data *curr_dss_hwmod; | 291 | const struct omap_dss_hwmod_data *curr_dss_hwmod; |
292 | struct platform_device *dss_pdev; | ||
293 | |||
294 | /* create omapdss device */ | ||
295 | |||
296 | board_data->dsi_enable_pads = omap_dsi_enable_pads; | ||
297 | board_data->dsi_disable_pads = omap_dsi_disable_pads; | ||
298 | board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; | ||
299 | board_data->set_min_bus_tput = omap_dss_set_min_bus_tput; | ||
300 | |||
301 | omap_display_device.dev.platform_data = board_data; | ||
302 | |||
303 | r = platform_device_register(&omap_display_device); | ||
304 | if (r < 0) { | ||
305 | pr_err("Unable to register omapdss device\n"); | ||
306 | return r; | ||
307 | } | ||
191 | 308 | ||
192 | memset(&pdata, 0, sizeof(pdata)); | 309 | /* create devices for dss hwmods */ |
193 | 310 | ||
194 | if (cpu_is_omap24xx()) { | 311 | if (cpu_is_omap24xx()) { |
195 | curr_dss_hwmod = omap2_dss_hwmod_data; | 312 | curr_dss_hwmod = omap2_dss_hwmod_data; |
@@ -202,39 +319,58 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) | |||
202 | oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); | 319 | oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); |
203 | } | 320 | } |
204 | 321 | ||
205 | if (board_data->dsi_enable_pads == NULL) | 322 | /* |
206 | board_data->dsi_enable_pads = omap_dsi_enable_pads; | 323 | * First create the pdev for dss_core, which is used as a parent device |
207 | if (board_data->dsi_disable_pads == NULL) | 324 | * by the other dss pdevs. Note: dss_core has to be the first item in |
208 | board_data->dsi_disable_pads = omap_dsi_disable_pads; | 325 | * the hwmod list. |
209 | 326 | */ | |
210 | pdata.board_data = board_data; | 327 | dss_pdev = create_dss_pdev(curr_dss_hwmod[0].dev_name, |
211 | pdata.board_data->get_context_loss_count = | 328 | curr_dss_hwmod[0].id, |
212 | omap_pm_get_dev_context_loss_count; | 329 | curr_dss_hwmod[0].oh_name, |
213 | 330 | board_data, sizeof(*board_data), | |
214 | for (i = 0; i < oh_count; i++) { | 331 | NULL); |
215 | oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name); | 332 | |
216 | if (!oh) { | 333 | if (IS_ERR(dss_pdev)) { |
217 | pr_err("Could not look up %s\n", | 334 | pr_err("Could not build omap_device for %s\n", |
218 | curr_dss_hwmod[i].oh_name); | 335 | curr_dss_hwmod[0].oh_name); |
219 | return -ENODEV; | 336 | |
337 | return PTR_ERR(dss_pdev); | ||
338 | } | ||
339 | |||
340 | for (i = 1; i < oh_count; i++) { | ||
341 | pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name, | ||
342 | curr_dss_hwmod[i].id, | ||
343 | curr_dss_hwmod[i].oh_name, | ||
344 | board_data, sizeof(*board_data), | ||
345 | dss_pdev); | ||
346 | |||
347 | if (IS_ERR(pdev)) { | ||
348 | pr_err("Could not build omap_device for %s\n", | ||
349 | curr_dss_hwmod[i].oh_name); | ||
350 | |||
351 | return PTR_ERR(pdev); | ||
220 | } | 352 | } |
353 | } | ||
221 | 354 | ||
222 | pdev = omap_device_build(curr_dss_hwmod[i].dev_name, | 355 | /* Create devices for DPI and SDI */ |
223 | curr_dss_hwmod[i].id, oh, &pdata, | ||
224 | sizeof(struct omap_display_platform_data), | ||
225 | NULL, 0, 0); | ||
226 | 356 | ||
227 | if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n", | 357 | pdev = create_simple_dss_pdev("omapdss_dpi", -1, |
228 | curr_dss_hwmod[i].oh_name)) | 358 | board_data, sizeof(*board_data), dss_pdev); |
229 | return -ENODEV; | 359 | if (IS_ERR(pdev)) { |
360 | pr_err("Could not build platform_device for omapdss_dpi\n"); | ||
361 | return PTR_ERR(pdev); | ||
230 | } | 362 | } |
231 | omap_display_device.dev.platform_data = board_data; | ||
232 | 363 | ||
233 | r = platform_device_register(&omap_display_device); | 364 | if (cpu_is_omap34xx()) { |
234 | if (r < 0) | 365 | pdev = create_simple_dss_pdev("omapdss_sdi", -1, |
235 | printk(KERN_ERR "Unable to register OMAP-Display device\n"); | 366 | board_data, sizeof(*board_data), dss_pdev); |
367 | if (IS_ERR(pdev)) { | ||
368 | pr_err("Could not build platform_device for omapdss_sdi\n"); | ||
369 | return PTR_ERR(pdev); | ||
370 | } | ||
371 | } | ||
236 | 372 | ||
237 | return r; | 373 | return 0; |
238 | } | 374 | } |
239 | 375 | ||
240 | static void dispc_disable_outputs(void) | 376 | static void dispc_disable_outputs(void) |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 2c27fdb61e66..7144ae651d3d 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -1422,6 +1422,9 @@ static int _ocp_softreset(struct omap_hwmod *oh) | |||
1422 | goto dis_opt_clks; | 1422 | goto dis_opt_clks; |
1423 | _write_sysconfig(v, oh); | 1423 | _write_sysconfig(v, oh); |
1424 | 1424 | ||
1425 | if (oh->class->sysc->srst_udelay) | ||
1426 | udelay(oh->class->sysc->srst_udelay); | ||
1427 | |||
1425 | if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS) | 1428 | if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS) |
1426 | omap_test_timeout((omap_hwmod_read(oh, | 1429 | omap_test_timeout((omap_hwmod_read(oh, |
1427 | oh->class->sysc->syss_offs) | 1430 | oh->class->sysc->syss_offs) |
@@ -1903,10 +1906,20 @@ void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs) | |||
1903 | */ | 1906 | */ |
1904 | int omap_hwmod_softreset(struct omap_hwmod *oh) | 1907 | int omap_hwmod_softreset(struct omap_hwmod *oh) |
1905 | { | 1908 | { |
1906 | if (!oh) | 1909 | u32 v; |
1910 | int ret; | ||
1911 | |||
1912 | if (!oh || !(oh->_sysc_cache)) | ||
1907 | return -EINVAL; | 1913 | return -EINVAL; |
1908 | 1914 | ||
1909 | return _ocp_softreset(oh); | 1915 | v = oh->_sysc_cache; |
1916 | ret = _set_softreset(oh, &v); | ||
1917 | if (ret) | ||
1918 | goto error; | ||
1919 | _write_sysconfig(v, oh); | ||
1920 | |||
1921 | error: | ||
1922 | return ret; | ||
1910 | } | 1923 | } |
1911 | 1924 | ||
1912 | /** | 1925 | /** |
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index a5409ce3f323..a6bde34e443a 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c | |||
@@ -1000,7 +1000,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__dss_venc = { | |||
1000 | .flags = OMAP_FIREWALL_L4, | 1000 | .flags = OMAP_FIREWALL_L4, |
1001 | } | 1001 | } |
1002 | }, | 1002 | }, |
1003 | .flags = OCPIF_SWSUP_IDLE, | ||
1004 | .user = OCP_USER_MPU | OCP_USER_SDMA, | 1003 | .user = OCP_USER_MPU | OCP_USER_SDMA, |
1005 | }; | 1004 | }; |
1006 | 1005 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index c4f56cb60d7d..04a3885f4475 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c | |||
@@ -1049,7 +1049,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__dss_venc = { | |||
1049 | .slave = &omap2430_dss_venc_hwmod, | 1049 | .slave = &omap2430_dss_venc_hwmod, |
1050 | .clk = "dss_ick", | 1050 | .clk = "dss_ick", |
1051 | .addr = omap2_dss_venc_addrs, | 1051 | .addr = omap2_dss_venc_addrs, |
1052 | .flags = OCPIF_SWSUP_IDLE, | ||
1053 | .user = OCP_USER_MPU | OCP_USER_SDMA, | 1052 | .user = OCP_USER_MPU | OCP_USER_SDMA, |
1054 | }; | 1053 | }; |
1055 | 1054 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 34b9766d1d23..db86ce90c69f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -1676,7 +1676,6 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_venc = { | |||
1676 | .flags = OMAP_FIREWALL_L4, | 1676 | .flags = OMAP_FIREWALL_L4, |
1677 | } | 1677 | } |
1678 | }, | 1678 | }, |
1679 | .flags = OCPIF_SWSUP_IDLE, | ||
1680 | .user = OCP_USER_MPU | OCP_USER_SDMA, | 1679 | .user = OCP_USER_MPU | OCP_USER_SDMA, |
1681 | }; | 1680 | }; |
1682 | 1681 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index cc9bd106a854..6abc75753e42 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -2594,6 +2594,15 @@ static struct omap_hwmod omap44xx_ipu_hwmod = { | |||
2594 | static struct omap_hwmod_class_sysconfig omap44xx_iss_sysc = { | 2594 | static struct omap_hwmod_class_sysconfig omap44xx_iss_sysc = { |
2595 | .rev_offs = 0x0000, | 2595 | .rev_offs = 0x0000, |
2596 | .sysc_offs = 0x0010, | 2596 | .sysc_offs = 0x0010, |
2597 | /* | ||
2598 | * ISS needs 100 OCP clk cycles delay after a softreset before | ||
2599 | * accessing sysconfig again. | ||
2600 | * The lowest frequency at the moment for L3 bus is 100 MHz, so | ||
2601 | * 1usec delay is needed. Add an x2 margin to be safe (2 usecs). | ||
2602 | * | ||
2603 | * TODO: Indicate errata when available. | ||
2604 | */ | ||
2605 | .srst_udelay = 2, | ||
2597 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS | | 2606 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS | |
2598 | SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), | 2607 | SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), |
2599 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | 2608 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 0cdd359a128e..9fc2f44188cb 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -108,8 +108,14 @@ static void omap_uart_set_noidle(struct platform_device *pdev) | |||
108 | static void omap_uart_set_smartidle(struct platform_device *pdev) | 108 | static void omap_uart_set_smartidle(struct platform_device *pdev) |
109 | { | 109 | { |
110 | struct omap_device *od = to_omap_device(pdev); | 110 | struct omap_device *od = to_omap_device(pdev); |
111 | u8 idlemode; | ||
111 | 112 | ||
112 | omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_SMART); | 113 | if (od->hwmods[0]->class->sysc->idlemodes & SIDLE_SMART_WKUP) |
114 | idlemode = HWMOD_IDLEMODE_SMART_WKUP; | ||
115 | else | ||
116 | idlemode = HWMOD_IDLEMODE_SMART; | ||
117 | |||
118 | omap_hwmod_set_slave_idlemode(od->hwmods[0], idlemode); | ||
113 | } | 119 | } |
114 | 120 | ||
115 | #else | 121 | #else |
@@ -120,124 +126,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} | |||
120 | #endif /* CONFIG_PM */ | 126 | #endif /* CONFIG_PM */ |
121 | 127 | ||
122 | #ifdef CONFIG_OMAP_MUX | 128 | #ifdef CONFIG_OMAP_MUX |
123 | static struct omap_device_pad default_uart1_pads[] __initdata = { | ||
124 | { | ||
125 | .name = "uart1_cts.uart1_cts", | ||
126 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
127 | }, | ||
128 | { | ||
129 | .name = "uart1_rts.uart1_rts", | ||
130 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
131 | }, | ||
132 | { | ||
133 | .name = "uart1_tx.uart1_tx", | ||
134 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
135 | }, | ||
136 | { | ||
137 | .name = "uart1_rx.uart1_rx", | ||
138 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
139 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
140 | .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
141 | }, | ||
142 | }; | ||
143 | |||
144 | static struct omap_device_pad default_uart2_pads[] __initdata = { | ||
145 | { | ||
146 | .name = "uart2_cts.uart2_cts", | ||
147 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
148 | }, | ||
149 | { | ||
150 | .name = "uart2_rts.uart2_rts", | ||
151 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
152 | }, | ||
153 | { | ||
154 | .name = "uart2_tx.uart2_tx", | ||
155 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
156 | }, | ||
157 | { | ||
158 | .name = "uart2_rx.uart2_rx", | ||
159 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
160 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
161 | .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
162 | }, | ||
163 | }; | ||
164 | |||
165 | static struct omap_device_pad default_uart3_pads[] __initdata = { | ||
166 | { | ||
167 | .name = "uart3_cts_rctx.uart3_cts_rctx", | ||
168 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
169 | }, | ||
170 | { | ||
171 | .name = "uart3_rts_sd.uart3_rts_sd", | ||
172 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
173 | }, | ||
174 | { | ||
175 | .name = "uart3_tx_irtx.uart3_tx_irtx", | ||
176 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
177 | }, | ||
178 | { | ||
179 | .name = "uart3_rx_irrx.uart3_rx_irrx", | ||
180 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
181 | .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, | ||
182 | .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, | ||
183 | }, | ||
184 | }; | ||
185 | |||
186 | static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { | ||
187 | { | ||
188 | .name = "gpmc_wait2.uart4_tx", | ||
189 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
190 | }, | ||
191 | { | ||
192 | .name = "gpmc_wait3.uart4_rx", | ||
193 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
194 | .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, | ||
195 | .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, | ||
196 | }, | ||
197 | }; | ||
198 | |||
199 | static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { | ||
200 | { | ||
201 | .name = "uart4_tx.uart4_tx", | ||
202 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
203 | }, | ||
204 | { | ||
205 | .name = "uart4_rx.uart4_rx", | ||
206 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
207 | .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, | ||
208 | .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, | ||
209 | }, | ||
210 | }; | ||
211 | |||
212 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) | 129 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) |
213 | { | 130 | { |
214 | switch (bdata->id) { | ||
215 | case 0: | ||
216 | bdata->pads = default_uart1_pads; | ||
217 | bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); | ||
218 | break; | ||
219 | case 1: | ||
220 | bdata->pads = default_uart2_pads; | ||
221 | bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); | ||
222 | break; | ||
223 | case 2: | ||
224 | bdata->pads = default_uart3_pads; | ||
225 | bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); | ||
226 | break; | ||
227 | case 3: | ||
228 | if (cpu_is_omap44xx()) { | ||
229 | bdata->pads = default_omap4_uart4_pads; | ||
230 | bdata->pads_cnt = | ||
231 | ARRAY_SIZE(default_omap4_uart4_pads); | ||
232 | } else if (cpu_is_omap3630()) { | ||
233 | bdata->pads = default_omap36xx_uart4_pads; | ||
234 | bdata->pads_cnt = | ||
235 | ARRAY_SIZE(default_omap36xx_uart4_pads); | ||
236 | } | ||
237 | break; | ||
238 | default: | ||
239 | break; | ||
240 | } | ||
241 | } | 131 | } |
242 | #else | 132 | #else |
243 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} | 133 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} |
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 4b57757bf9d1..7a7b89304c48 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c | |||
@@ -37,6 +37,16 @@ static struct i2c_board_info __initdata pmic_i2c_board_info = { | |||
37 | .flags = I2C_CLIENT_WAKE, | 37 | .flags = I2C_CLIENT_WAKE, |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static struct i2c_board_info __initdata omap4_i2c1_board_info[] = { | ||
41 | { | ||
42 | .addr = 0x48, | ||
43 | .flags = I2C_CLIENT_WAKE, | ||
44 | }, | ||
45 | { | ||
46 | I2C_BOARD_INFO("twl6040", 0x4b), | ||
47 | }, | ||
48 | }; | ||
49 | |||
40 | void __init omap_pmic_init(int bus, u32 clkrate, | 50 | void __init omap_pmic_init(int bus, u32 clkrate, |
41 | const char *pmic_type, int pmic_irq, | 51 | const char *pmic_type, int pmic_irq, |
42 | struct twl4030_platform_data *pmic_data) | 52 | struct twl4030_platform_data *pmic_data) |
@@ -49,14 +59,31 @@ void __init omap_pmic_init(int bus, u32 clkrate, | |||
49 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); | 59 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); |
50 | } | 60 | } |
51 | 61 | ||
62 | void __init omap4_pmic_init(const char *pmic_type, | ||
63 | struct twl4030_platform_data *pmic_data, | ||
64 | struct twl6040_platform_data *twl6040_data, int twl6040_irq) | ||
65 | { | ||
66 | /* PMIC part*/ | ||
67 | strncpy(omap4_i2c1_board_info[0].type, pmic_type, | ||
68 | sizeof(omap4_i2c1_board_info[0].type)); | ||
69 | omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N; | ||
70 | omap4_i2c1_board_info[0].platform_data = pmic_data; | ||
71 | |||
72 | /* TWL6040 audio IC part */ | ||
73 | omap4_i2c1_board_info[1].irq = twl6040_irq; | ||
74 | omap4_i2c1_board_info[1].platform_data = twl6040_data; | ||
75 | |||
76 | omap_register_i2c_bus(1, 400, omap4_i2c1_board_info, 2); | ||
77 | |||
78 | } | ||
79 | |||
52 | void __init omap_pmic_late_init(void) | 80 | void __init omap_pmic_late_init(void) |
53 | { | 81 | { |
54 | /* Init the OMAP TWL parameters (if PMIC has been registerd) */ | 82 | /* Init the OMAP TWL parameters (if PMIC has been registerd) */ |
55 | if (!pmic_i2c_board_info.irq) | 83 | if (pmic_i2c_board_info.irq) |
56 | return; | 84 | omap3_twl_init(); |
57 | 85 | if (omap4_i2c1_board_info[0].irq) | |
58 | omap3_twl_init(); | 86 | omap4_twl_init(); |
59 | omap4_twl_init(); | ||
60 | } | 87 | } |
61 | 88 | ||
62 | #if defined(CONFIG_ARCH_OMAP3) | 89 | #if defined(CONFIG_ARCH_OMAP3) |
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h index 275dde8cb27a..09627483a57f 100644 --- a/arch/arm/mach-omap2/twl-common.h +++ b/arch/arm/mach-omap2/twl-common.h | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | struct twl4030_platform_data; | 31 | struct twl4030_platform_data; |
32 | struct twl6040_platform_data; | ||
32 | 33 | ||
33 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, | 34 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, |
34 | struct twl4030_platform_data *pmic_data); | 35 | struct twl4030_platform_data *pmic_data); |
@@ -46,12 +47,9 @@ static inline void omap3_pmic_init(const char *pmic_type, | |||
46 | omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); | 47 | omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); |
47 | } | 48 | } |
48 | 49 | ||
49 | static inline void omap4_pmic_init(const char *pmic_type, | 50 | void omap4_pmic_init(const char *pmic_type, |
50 | struct twl4030_platform_data *pmic_data) | 51 | struct twl4030_platform_data *pmic_data, |
51 | { | 52 | struct twl6040_platform_data *audio_data, int twl6040_irq); |
52 | /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */ | ||
53 | omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data); | ||
54 | } | ||
55 | 53 | ||
56 | void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, | 54 | void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, |
57 | u32 pdata_flags, u32 regulators_flags); | 55 | u32 pdata_flags, u32 regulators_flags); |
diff --git a/arch/arm/mach-s5pv210/dma.c b/arch/arm/mach-s5pv210/dma.c index 86ce62f66190..b8337e248b09 100644 --- a/arch/arm/mach-s5pv210/dma.c +++ b/arch/arm/mach-s5pv210/dma.c | |||
@@ -33,8 +33,6 @@ | |||
33 | #include <mach/irqs.h> | 33 | #include <mach/irqs.h> |
34 | #include <mach/dma.h> | 34 | #include <mach/dma.h> |
35 | 35 | ||
36 | static u64 dma_dmamask = DMA_BIT_MASK(32); | ||
37 | |||
38 | static u8 pdma0_peri[] = { | 36 | static u8 pdma0_peri[] = { |
39 | DMACH_UART0_RX, | 37 | DMACH_UART0_RX, |
40 | DMACH_UART0_TX, | 38 | DMACH_UART0_TX, |
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c index 7b91bbf887fe..af528f9e97f9 100644 --- a/arch/arm/mach-s5pv210/mach-aquila.c +++ b/arch/arm/mach-s5pv210/mach-aquila.c | |||
@@ -480,8 +480,8 @@ static struct wm8994_pdata wm8994_platform_data = { | |||
480 | .gpio_defaults[8] = 0x0100, | 480 | .gpio_defaults[8] = 0x0100, |
481 | .gpio_defaults[9] = 0x0100, | 481 | .gpio_defaults[9] = 0x0100, |
482 | .gpio_defaults[10] = 0x0100, | 482 | .gpio_defaults[10] = 0x0100, |
483 | .ldo[0] = { S5PV210_MP03(6), NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */ | 483 | .ldo[0] = { S5PV210_MP03(6), &wm8994_ldo1_data }, /* XM0FRNB_2 */ |
484 | .ldo[1] = { 0, NULL, &wm8994_ldo2_data }, | 484 | .ldo[1] = { 0, &wm8994_ldo2_data }, |
485 | }; | 485 | }; |
486 | 486 | ||
487 | /* GPIO I2C PMIC */ | 487 | /* GPIO I2C PMIC */ |
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index 07a840de9a38..9c4720e43f7b 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c | |||
@@ -678,8 +678,8 @@ static struct wm8994_pdata wm8994_platform_data = { | |||
678 | .gpio_defaults[8] = 0x0100, | 678 | .gpio_defaults[8] = 0x0100, |
679 | .gpio_defaults[9] = 0x0100, | 679 | .gpio_defaults[9] = 0x0100, |
680 | .gpio_defaults[10] = 0x0100, | 680 | .gpio_defaults[10] = 0x0100, |
681 | .ldo[0] = { S5PV210_MP03(6), NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */ | 681 | .ldo[0] = { S5PV210_MP03(6), &wm8994_ldo1_data }, /* XM0FRNB_2 */ |
682 | .ldo[1] = { 0, NULL, &wm8994_ldo2_data }, | 682 | .ldo[1] = { 0, &wm8994_ldo2_data }, |
683 | }; | 683 | }; |
684 | 684 | ||
685 | /* GPIO I2C PMIC */ | 685 | /* GPIO I2C PMIC */ |
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index 880d02ec89d4..ef7099eea0f2 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig | |||
@@ -17,6 +17,7 @@ config UX500_SOC_DB5500 | |||
17 | config UX500_SOC_DB8500 | 17 | config UX500_SOC_DB8500 |
18 | bool | 18 | bool |
19 | select MFD_DB8500_PRCMU | 19 | select MFD_DB8500_PRCMU |
20 | select REGULATOR | ||
20 | select REGULATOR_DB8500_PRCMU | 21 | select REGULATOR_DB8500_PRCMU |
21 | select CPU_FREQ_TABLE if CPU_FREQ | 22 | select CPU_FREQ_TABLE if CPU_FREQ |
22 | 23 | ||
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index d2058ef8345f..eff5842f6232 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c | |||
@@ -99,7 +99,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
99 | */ | 99 | */ |
100 | write_pen_release(cpu_logical_map(cpu)); | 100 | write_pen_release(cpu_logical_map(cpu)); |
101 | 101 | ||
102 | gic_raise_softirq(cpumask_of(cpu), 1); | 102 | smp_send_reschedule(cpu); |
103 | 103 | ||
104 | timeout = jiffies + (1 * HZ); | 104 | timeout = jiffies + (1 * HZ); |
105 | while (time_before(jiffies, timeout)) { | 105 | while (time_before(jiffies, timeout)) { |
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 7edef9121632..7c8a7d8467bf 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -723,7 +723,7 @@ config CPU_HIGH_VECTOR | |||
723 | bool "Select the High exception vector" | 723 | bool "Select the High exception vector" |
724 | help | 724 | help |
725 | Say Y here to select high exception vector(0xFFFF0000~). | 725 | Say Y here to select high exception vector(0xFFFF0000~). |
726 | The exception vector can be vary depending on the platform | 726 | The exception vector can vary depending on the platform |
727 | design in nommu mode. If your platform needs to select | 727 | design in nommu mode. If your platform needs to select |
728 | high exception vector, say Y. | 728 | high exception vector, say Y. |
729 | Otherwise or if you are unsure, say N, and the low exception | 729 | Otherwise or if you are unsure, say N, and the low exception |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 9055b5a84ec5..f07467533365 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
@@ -320,7 +320,7 @@ retry: | |||
320 | */ | 320 | */ |
321 | 321 | ||
322 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); | 322 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); |
323 | if (flags & FAULT_FLAG_ALLOW_RETRY) { | 323 | if (!(fault & VM_FAULT_ERROR) && flags & FAULT_FLAG_ALLOW_RETRY) { |
324 | if (fault & VM_FAULT_MAJOR) { | 324 | if (fault & VM_FAULT_MAJOR) { |
325 | tsk->maj_flt++; | 325 | tsk->maj_flt++; |
326 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, | 326 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, |
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index 6486d2f253cd..d51225f90ae2 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/sections.h> | 13 | #include <asm/sections.h> |
14 | #include <asm/page.h> | 14 | #include <asm/page.h> |
15 | #include <asm/setup.h> | 15 | #include <asm/setup.h> |
16 | #include <asm/traps.h> | ||
16 | #include <asm/mach/arch.h> | 17 | #include <asm/mach/arch.h> |
17 | 18 | ||
18 | #include "mm.h" | 19 | #include "mm.h" |
@@ -39,6 +40,7 @@ void __init sanity_check_meminfo(void) | |||
39 | */ | 40 | */ |
40 | void __init paging_init(struct machine_desc *mdesc) | 41 | void __init paging_init(struct machine_desc *mdesc) |
41 | { | 42 | { |
43 | early_trap_init((void *)CONFIG_VECTORS_BASE); | ||
42 | bootmem_init(); | 44 | bootmem_init(); |
43 | } | 45 | } |
44 | 46 | ||
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index f1c8486f7501..c2e2b66f72b5 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -255,6 +255,18 @@ __v7_setup: | |||
255 | mcr p15, 0, r5, c10, c2, 0 @ write PRRR | 255 | mcr p15, 0, r5, c10, c2, 0 @ write PRRR |
256 | mcr p15, 0, r6, c10, c2, 1 @ write NMRR | 256 | mcr p15, 0, r6, c10, c2, 1 @ write NMRR |
257 | #endif | 257 | #endif |
258 | #ifndef CONFIG_ARM_THUMBEE | ||
259 | mrc p15, 0, r0, c0, c1, 0 @ read ID_PFR0 for ThumbEE | ||
260 | and r0, r0, #(0xf << 12) @ ThumbEE enabled field | ||
261 | teq r0, #(1 << 12) @ check if ThumbEE is present | ||
262 | bne 1f | ||
263 | mov r5, #0 | ||
264 | mcr p14, 6, r5, c1, c0, 0 @ Initialize TEEHBR to 0 | ||
265 | mrc p14, 6, r0, c0, c0, 0 @ load TEECR | ||
266 | orr r0, r0, #1 @ set the 1st bit in order to | ||
267 | mcr p14, 6, r0, c0, c0, 0 @ stop userspace TEEHBR access | ||
268 | 1: | ||
269 | #endif | ||
258 | adr r5, v7_crval | 270 | adr r5, v7_crval |
259 | ldmia r5, {r5, r6} | 271 | ldmia r5, {r5, r6} |
260 | #ifdef CONFIG_CPU_ENDIAN_BE8 | 272 | #ifdef CONFIG_CPU_ENDIAN_BE8 |
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 8506cbb7fea4..62ec5c452792 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -398,32 +398,6 @@ struct clk dummy_ck = { | |||
398 | .ops = &clkops_null, | 398 | .ops = &clkops_null, |
399 | }; | 399 | }; |
400 | 400 | ||
401 | #ifdef CONFIG_CPU_FREQ | ||
402 | void clk_init_cpufreq_table(struct cpufreq_frequency_table **table) | ||
403 | { | ||
404 | unsigned long flags; | ||
405 | |||
406 | if (!arch_clock || !arch_clock->clk_init_cpufreq_table) | ||
407 | return; | ||
408 | |||
409 | spin_lock_irqsave(&clockfw_lock, flags); | ||
410 | arch_clock->clk_init_cpufreq_table(table); | ||
411 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
412 | } | ||
413 | |||
414 | void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table) | ||
415 | { | ||
416 | unsigned long flags; | ||
417 | |||
418 | if (!arch_clock || !arch_clock->clk_exit_cpufreq_table) | ||
419 | return; | ||
420 | |||
421 | spin_lock_irqsave(&clockfw_lock, flags); | ||
422 | arch_clock->clk_exit_cpufreq_table(table); | ||
423 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
424 | } | ||
425 | #endif | ||
426 | |||
427 | /* | 401 | /* |
428 | * | 402 | * |
429 | */ | 403 | */ |
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h index 240a7b9fd946..d0ef57c1d71b 100644 --- a/arch/arm/plat-omap/include/plat/clock.h +++ b/arch/arm/plat-omap/include/plat/clock.h | |||
@@ -272,8 +272,6 @@ struct clk { | |||
272 | #endif | 272 | #endif |
273 | }; | 273 | }; |
274 | 274 | ||
275 | struct cpufreq_frequency_table; | ||
276 | |||
277 | struct clk_functions { | 275 | struct clk_functions { |
278 | int (*clk_enable)(struct clk *clk); | 276 | int (*clk_enable)(struct clk *clk); |
279 | void (*clk_disable)(struct clk *clk); | 277 | void (*clk_disable)(struct clk *clk); |
@@ -283,10 +281,6 @@ struct clk_functions { | |||
283 | void (*clk_allow_idle)(struct clk *clk); | 281 | void (*clk_allow_idle)(struct clk *clk); |
284 | void (*clk_deny_idle)(struct clk *clk); | 282 | void (*clk_deny_idle)(struct clk *clk); |
285 | void (*clk_disable_unused)(struct clk *clk); | 283 | void (*clk_disable_unused)(struct clk *clk); |
286 | #ifdef CONFIG_CPU_FREQ | ||
287 | void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **); | ||
288 | void (*clk_exit_cpufreq_table)(struct cpufreq_frequency_table **); | ||
289 | #endif | ||
290 | }; | 284 | }; |
291 | 285 | ||
292 | extern int mpurate; | 286 | extern int mpurate; |
@@ -301,10 +295,6 @@ extern void recalculate_root_clocks(void); | |||
301 | extern unsigned long followparent_recalc(struct clk *clk); | 295 | extern unsigned long followparent_recalc(struct clk *clk); |
302 | extern void clk_enable_init_clocks(void); | 296 | extern void clk_enable_init_clocks(void); |
303 | unsigned long omap_fixed_divisor_recalc(struct clk *clk); | 297 | unsigned long omap_fixed_divisor_recalc(struct clk *clk); |
304 | #ifdef CONFIG_CPU_FREQ | ||
305 | extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table); | ||
306 | extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table); | ||
307 | #endif | ||
308 | extern struct clk *omap_clk_get_by_name(const char *name); | 298 | extern struct clk *omap_clk_get_by_name(const char *name); |
309 | extern int omap_clk_enable_autoidle_all(void); | 299 | extern int omap_clk_enable_autoidle_all(void); |
310 | extern int omap_clk_disable_autoidle_all(void); | 300 | extern int omap_clk_disable_autoidle_all(void); |
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 8070145ccb98..3f26db4ee8e6 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -305,6 +305,7 @@ struct omap_hwmod_sysc_fields { | |||
305 | * @rev_offs: IP block revision register offset (from module base addr) | 305 | * @rev_offs: IP block revision register offset (from module base addr) |
306 | * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) | 306 | * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) |
307 | * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) | 307 | * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) |
308 | * @srst_udelay: Delay needed after doing a softreset in usecs | ||
308 | * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART} | 309 | * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART} |
309 | * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported | 310 | * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported |
310 | * @clockact: the default value of the module CLOCKACTIVITY bits | 311 | * @clockact: the default value of the module CLOCKACTIVITY bits |
@@ -330,9 +331,10 @@ struct omap_hwmod_class_sysconfig { | |||
330 | u16 sysc_offs; | 331 | u16 sysc_offs; |
331 | u16 syss_offs; | 332 | u16 syss_offs; |
332 | u16 sysc_flags; | 333 | u16 sysc_flags; |
334 | struct omap_hwmod_sysc_fields *sysc_fields; | ||
335 | u8 srst_udelay; | ||
333 | u8 idlemodes; | 336 | u8 idlemodes; |
334 | u8 clockact; | 337 | u8 clockact; |
335 | struct omap_hwmod_sysc_fields *sysc_fields; | ||
336 | }; | 338 | }; |
337 | 339 | ||
338 | /** | 340 | /** |
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index eec98afa0f83..f9a8c5341ee9 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
@@ -348,7 +348,6 @@ u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc, | |||
348 | sdrc_actim_ctrl_b_1, sdrc_mr_1); | 348 | sdrc_actim_ctrl_b_1, sdrc_mr_1); |
349 | } | 349 | } |
350 | 350 | ||
351 | #ifdef CONFIG_PM | ||
352 | void omap3_sram_restore_context(void) | 351 | void omap3_sram_restore_context(void) |
353 | { | 352 | { |
354 | omap_sram_ceil = omap_sram_base + omap_sram_size; | 353 | omap_sram_ceil = omap_sram_base + omap_sram_size; |
@@ -358,17 +357,18 @@ void omap3_sram_restore_context(void) | |||
358 | omap3_sram_configure_core_dpll_sz); | 357 | omap3_sram_configure_core_dpll_sz); |
359 | omap_push_sram_idle(); | 358 | omap_push_sram_idle(); |
360 | } | 359 | } |
361 | #endif /* CONFIG_PM */ | ||
362 | |||
363 | #endif /* CONFIG_ARCH_OMAP3 */ | ||
364 | 360 | ||
365 | static inline int omap34xx_sram_init(void) | 361 | static inline int omap34xx_sram_init(void) |
366 | { | 362 | { |
367 | #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) | ||
368 | omap3_sram_restore_context(); | 363 | omap3_sram_restore_context(); |
369 | #endif | ||
370 | return 0; | 364 | return 0; |
371 | } | 365 | } |
366 | #else | ||
367 | static inline int omap34xx_sram_init(void) | ||
368 | { | ||
369 | return 0; | ||
370 | } | ||
371 | #endif /* CONFIG_ARCH_OMAP3 */ | ||
372 | 372 | ||
373 | static inline int am33xx_sram_init(void) | 373 | static inline int am33xx_sram_init(void) |
374 | { | 374 | { |
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 71553f410016..a0ffc77da809 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -302,6 +302,7 @@ comment "Power management" | |||
302 | config SAMSUNG_PM_DEBUG | 302 | config SAMSUNG_PM_DEBUG |
303 | bool "S3C2410 PM Suspend debug" | 303 | bool "S3C2410 PM Suspend debug" |
304 | depends on PM | 304 | depends on PM |
305 | select DEBUG_LL | ||
305 | help | 306 | help |
306 | Say Y here if you want verbose debugging from the PM Suspend and | 307 | Say Y here if you want verbose debugging from the PM Suspend and |
307 | Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt> | 308 | Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt> |
diff --git a/arch/c6x/include/asm/irq.h b/arch/c6x/include/asm/irq.h index f13b78d5e1ca..ab4577f93d96 100644 --- a/arch/c6x/include/asm/irq.h +++ b/arch/c6x/include/asm/irq.h | |||
@@ -42,10 +42,6 @@ | |||
42 | /* This number is used when no interrupt has been assigned */ | 42 | /* This number is used when no interrupt has been assigned */ |
43 | #define NO_IRQ 0 | 43 | #define NO_IRQ 0 |
44 | 44 | ||
45 | struct irq_data; | ||
46 | extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); | ||
47 | extern irq_hw_number_t virq_to_hw(unsigned int virq); | ||
48 | |||
49 | extern void __init init_pic_c64xplus(void); | 45 | extern void __init init_pic_c64xplus(void); |
50 | 46 | ||
51 | extern void init_IRQ(void); | 47 | extern void init_IRQ(void); |
diff --git a/arch/c6x/kernel/irq.c b/arch/c6x/kernel/irq.c index 65b8ddf54b44..c90fb5e82ad7 100644 --- a/arch/c6x/kernel/irq.c +++ b/arch/c6x/kernel/irq.c | |||
@@ -130,16 +130,3 @@ int arch_show_interrupts(struct seq_file *p, int prec) | |||
130 | seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count); | 130 | seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count); |
131 | return 0; | 131 | return 0; |
132 | } | 132 | } |
133 | |||
134 | irq_hw_number_t irqd_to_hwirq(struct irq_data *d) | ||
135 | { | ||
136 | return d->hwirq; | ||
137 | } | ||
138 | EXPORT_SYMBOL_GPL(irqd_to_hwirq); | ||
139 | |||
140 | irq_hw_number_t virq_to_hw(unsigned int virq) | ||
141 | { | ||
142 | struct irq_data *irq_data = irq_get_irq_data(virq); | ||
143 | return WARN_ON(!irq_data) ? 0 : irq_data->hwirq; | ||
144 | } | ||
145 | EXPORT_SYMBOL_GPL(virq_to_hw); | ||
diff --git a/arch/ia64/include/asm/cmpxchg.h b/arch/ia64/include/asm/cmpxchg.h index 4c96187e2049..4f37dbbb8640 100644 --- a/arch/ia64/include/asm/cmpxchg.h +++ b/arch/ia64/include/asm/cmpxchg.h | |||
@@ -1 +1,147 @@ | |||
1 | #include <asm/intrinsics.h> | 1 | #ifndef _ASM_IA64_CMPXCHG_H |
2 | #define _ASM_IA64_CMPXCHG_H | ||
3 | |||
4 | /* | ||
5 | * Compare/Exchange, forked from asm/intrinsics.h | ||
6 | * which was: | ||
7 | * | ||
8 | * Copyright (C) 2002-2003 Hewlett-Packard Co | ||
9 | * David Mosberger-Tang <davidm@hpl.hp.com> | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASSEMBLY__ | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | /* include compiler specific intrinsics */ | ||
16 | #include <asm/ia64regs.h> | ||
17 | #ifdef __INTEL_COMPILER | ||
18 | # include <asm/intel_intrin.h> | ||
19 | #else | ||
20 | # include <asm/gcc_intrin.h> | ||
21 | #endif | ||
22 | |||
23 | /* | ||
24 | * This function doesn't exist, so you'll get a linker error if | ||
25 | * something tries to do an invalid xchg(). | ||
26 | */ | ||
27 | extern void ia64_xchg_called_with_bad_pointer(void); | ||
28 | |||
29 | #define __xchg(x, ptr, size) \ | ||
30 | ({ \ | ||
31 | unsigned long __xchg_result; \ | ||
32 | \ | ||
33 | switch (size) { \ | ||
34 | case 1: \ | ||
35 | __xchg_result = ia64_xchg1((__u8 *)ptr, x); \ | ||
36 | break; \ | ||
37 | \ | ||
38 | case 2: \ | ||
39 | __xchg_result = ia64_xchg2((__u16 *)ptr, x); \ | ||
40 | break; \ | ||
41 | \ | ||
42 | case 4: \ | ||
43 | __xchg_result = ia64_xchg4((__u32 *)ptr, x); \ | ||
44 | break; \ | ||
45 | \ | ||
46 | case 8: \ | ||
47 | __xchg_result = ia64_xchg8((__u64 *)ptr, x); \ | ||
48 | break; \ | ||
49 | default: \ | ||
50 | ia64_xchg_called_with_bad_pointer(); \ | ||
51 | } \ | ||
52 | __xchg_result; \ | ||
53 | }) | ||
54 | |||
55 | #define xchg(ptr, x) \ | ||
56 | ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr)))) | ||
57 | |||
58 | /* | ||
59 | * Atomic compare and exchange. Compare OLD with MEM, if identical, | ||
60 | * store NEW in MEM. Return the initial value in MEM. Success is | ||
61 | * indicated by comparing RETURN with OLD. | ||
62 | */ | ||
63 | |||
64 | #define __HAVE_ARCH_CMPXCHG 1 | ||
65 | |||
66 | /* | ||
67 | * This function doesn't exist, so you'll get a linker error | ||
68 | * if something tries to do an invalid cmpxchg(). | ||
69 | */ | ||
70 | extern long ia64_cmpxchg_called_with_bad_pointer(void); | ||
71 | |||
72 | #define ia64_cmpxchg(sem, ptr, old, new, size) \ | ||
73 | ({ \ | ||
74 | __u64 _o_, _r_; \ | ||
75 | \ | ||
76 | switch (size) { \ | ||
77 | case 1: \ | ||
78 | _o_ = (__u8) (long) (old); \ | ||
79 | break; \ | ||
80 | case 2: \ | ||
81 | _o_ = (__u16) (long) (old); \ | ||
82 | break; \ | ||
83 | case 4: \ | ||
84 | _o_ = (__u32) (long) (old); \ | ||
85 | break; \ | ||
86 | case 8: \ | ||
87 | _o_ = (__u64) (long) (old); \ | ||
88 | break; \ | ||
89 | default: \ | ||
90 | break; \ | ||
91 | } \ | ||
92 | switch (size) { \ | ||
93 | case 1: \ | ||
94 | _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \ | ||
95 | break; \ | ||
96 | \ | ||
97 | case 2: \ | ||
98 | _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \ | ||
99 | break; \ | ||
100 | \ | ||
101 | case 4: \ | ||
102 | _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \ | ||
103 | break; \ | ||
104 | \ | ||
105 | case 8: \ | ||
106 | _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \ | ||
107 | break; \ | ||
108 | \ | ||
109 | default: \ | ||
110 | _r_ = ia64_cmpxchg_called_with_bad_pointer(); \ | ||
111 | break; \ | ||
112 | } \ | ||
113 | (__typeof__(old)) _r_; \ | ||
114 | }) | ||
115 | |||
116 | #define cmpxchg_acq(ptr, o, n) \ | ||
117 | ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr))) | ||
118 | #define cmpxchg_rel(ptr, o, n) \ | ||
119 | ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr))) | ||
120 | |||
121 | /* for compatibility with other platforms: */ | ||
122 | #define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) | ||
123 | #define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) | ||
124 | |||
125 | #define cmpxchg_local cmpxchg | ||
126 | #define cmpxchg64_local cmpxchg64 | ||
127 | |||
128 | #ifdef CONFIG_IA64_DEBUG_CMPXCHG | ||
129 | # define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128; | ||
130 | # define CMPXCHG_BUGCHECK(v) \ | ||
131 | do { \ | ||
132 | if (_cmpxchg_bugcheck_count-- <= 0) { \ | ||
133 | void *ip; \ | ||
134 | extern int printk(const char *fmt, ...); \ | ||
135 | ip = (void *) ia64_getreg(_IA64_REG_IP); \ | ||
136 | printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v));\ | ||
137 | break; \ | ||
138 | } \ | ||
139 | } while (0) | ||
140 | #else /* !CONFIG_IA64_DEBUG_CMPXCHG */ | ||
141 | # define CMPXCHG_BUGCHECK_DECL | ||
142 | # define CMPXCHG_BUGCHECK(v) | ||
143 | #endif /* !CONFIG_IA64_DEBUG_CMPXCHG */ | ||
144 | |||
145 | #endif /* !__ASSEMBLY__ */ | ||
146 | |||
147 | #endif /* _ASM_IA64_CMPXCHG_H */ | ||
diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h index 0ab82cc2dc8f..d2bf1fd5e44f 100644 --- a/arch/ia64/include/asm/futex.h +++ b/arch/ia64/include/asm/futex.h | |||
@@ -106,15 +106,16 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
106 | return -EFAULT; | 106 | return -EFAULT; |
107 | 107 | ||
108 | { | 108 | { |
109 | register unsigned long r8 __asm ("r8") = 0; | 109 | register unsigned long r8 __asm ("r8"); |
110 | unsigned long prev; | 110 | unsigned long prev; |
111 | __asm__ __volatile__( | 111 | __asm__ __volatile__( |
112 | " mf;; \n" | 112 | " mf;; \n" |
113 | " mov ar.ccv=%3;; \n" | 113 | " mov %0=r0 \n" |
114 | "[1:] cmpxchg4.acq %0=[%1],%2,ar.ccv \n" | 114 | " mov ar.ccv=%4;; \n" |
115 | "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n" | ||
115 | " .xdata4 \"__ex_table\", 1b-., 2f-. \n" | 116 | " .xdata4 \"__ex_table\", 1b-., 2f-. \n" |
116 | "[2:]" | 117 | "[2:]" |
117 | : "=r" (prev) | 118 | : "=r" (r8), "=r" (prev) |
118 | : "r" (uaddr), "r" (newval), | 119 | : "r" (uaddr), "r" (newval), |
119 | "rO" ((long) (unsigned) oldval) | 120 | "rO" ((long) (unsigned) oldval) |
120 | : "memory"); | 121 | : "memory"); |
diff --git a/arch/ia64/include/asm/intrinsics.h b/arch/ia64/include/asm/intrinsics.h index e4076b511829..d129e367e764 100644 --- a/arch/ia64/include/asm/intrinsics.h +++ b/arch/ia64/include/asm/intrinsics.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #else | 18 | #else |
19 | # include <asm/gcc_intrin.h> | 19 | # include <asm/gcc_intrin.h> |
20 | #endif | 20 | #endif |
21 | #include <asm/cmpxchg.h> | ||
21 | 22 | ||
22 | #define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I) | 23 | #define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I) |
23 | 24 | ||
@@ -81,119 +82,6 @@ extern unsigned long __bad_increment_for_ia64_fetch_and_add (void); | |||
81 | 82 | ||
82 | #define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */ | 83 | #define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */ |
83 | 84 | ||
84 | /* | ||
85 | * This function doesn't exist, so you'll get a linker error if | ||
86 | * something tries to do an invalid xchg(). | ||
87 | */ | ||
88 | extern void ia64_xchg_called_with_bad_pointer (void); | ||
89 | |||
90 | #define __xchg(x,ptr,size) \ | ||
91 | ({ \ | ||
92 | unsigned long __xchg_result; \ | ||
93 | \ | ||
94 | switch (size) { \ | ||
95 | case 1: \ | ||
96 | __xchg_result = ia64_xchg1((__u8 *)ptr, x); \ | ||
97 | break; \ | ||
98 | \ | ||
99 | case 2: \ | ||
100 | __xchg_result = ia64_xchg2((__u16 *)ptr, x); \ | ||
101 | break; \ | ||
102 | \ | ||
103 | case 4: \ | ||
104 | __xchg_result = ia64_xchg4((__u32 *)ptr, x); \ | ||
105 | break; \ | ||
106 | \ | ||
107 | case 8: \ | ||
108 | __xchg_result = ia64_xchg8((__u64 *)ptr, x); \ | ||
109 | break; \ | ||
110 | default: \ | ||
111 | ia64_xchg_called_with_bad_pointer(); \ | ||
112 | } \ | ||
113 | __xchg_result; \ | ||
114 | }) | ||
115 | |||
116 | #define xchg(ptr,x) \ | ||
117 | ((__typeof__(*(ptr))) __xchg ((unsigned long) (x), (ptr), sizeof(*(ptr)))) | ||
118 | |||
119 | /* | ||
120 | * Atomic compare and exchange. Compare OLD with MEM, if identical, | ||
121 | * store NEW in MEM. Return the initial value in MEM. Success is | ||
122 | * indicated by comparing RETURN with OLD. | ||
123 | */ | ||
124 | |||
125 | #define __HAVE_ARCH_CMPXCHG 1 | ||
126 | |||
127 | /* | ||
128 | * This function doesn't exist, so you'll get a linker error | ||
129 | * if something tries to do an invalid cmpxchg(). | ||
130 | */ | ||
131 | extern long ia64_cmpxchg_called_with_bad_pointer (void); | ||
132 | |||
133 | #define ia64_cmpxchg(sem,ptr,old,new,size) \ | ||
134 | ({ \ | ||
135 | __u64 _o_, _r_; \ | ||
136 | \ | ||
137 | switch (size) { \ | ||
138 | case 1: _o_ = (__u8 ) (long) (old); break; \ | ||
139 | case 2: _o_ = (__u16) (long) (old); break; \ | ||
140 | case 4: _o_ = (__u32) (long) (old); break; \ | ||
141 | case 8: _o_ = (__u64) (long) (old); break; \ | ||
142 | default: break; \ | ||
143 | } \ | ||
144 | switch (size) { \ | ||
145 | case 1: \ | ||
146 | _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \ | ||
147 | break; \ | ||
148 | \ | ||
149 | case 2: \ | ||
150 | _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \ | ||
151 | break; \ | ||
152 | \ | ||
153 | case 4: \ | ||
154 | _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \ | ||
155 | break; \ | ||
156 | \ | ||
157 | case 8: \ | ||
158 | _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \ | ||
159 | break; \ | ||
160 | \ | ||
161 | default: \ | ||
162 | _r_ = ia64_cmpxchg_called_with_bad_pointer(); \ | ||
163 | break; \ | ||
164 | } \ | ||
165 | (__typeof__(old)) _r_; \ | ||
166 | }) | ||
167 | |||
168 | #define cmpxchg_acq(ptr, o, n) \ | ||
169 | ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr))) | ||
170 | #define cmpxchg_rel(ptr, o, n) \ | ||
171 | ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr))) | ||
172 | |||
173 | /* for compatibility with other platforms: */ | ||
174 | #define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) | ||
175 | #define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) | ||
176 | |||
177 | #define cmpxchg_local cmpxchg | ||
178 | #define cmpxchg64_local cmpxchg64 | ||
179 | |||
180 | #ifdef CONFIG_IA64_DEBUG_CMPXCHG | ||
181 | # define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128; | ||
182 | # define CMPXCHG_BUGCHECK(v) \ | ||
183 | do { \ | ||
184 | if (_cmpxchg_bugcheck_count-- <= 0) { \ | ||
185 | void *ip; \ | ||
186 | extern int printk(const char *fmt, ...); \ | ||
187 | ip = (void *) ia64_getreg(_IA64_REG_IP); \ | ||
188 | printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v)); \ | ||
189 | break; \ | ||
190 | } \ | ||
191 | } while (0) | ||
192 | #else /* !CONFIG_IA64_DEBUG_CMPXCHG */ | ||
193 | # define CMPXCHG_BUGCHECK_DECL | ||
194 | # define CMPXCHG_BUGCHECK(v) | ||
195 | #endif /* !CONFIG_IA64_DEBUG_CMPXCHG */ | ||
196 | |||
197 | #endif | 85 | #endif |
198 | 86 | ||
199 | #ifdef __KERNEL__ | 87 | #ifdef __KERNEL__ |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 9d0fd7d5bb82..f00ba025375d 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -604,12 +604,6 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f) | |||
604 | spin_unlock(&(x)->ctx_lock); | 604 | spin_unlock(&(x)->ctx_lock); |
605 | } | 605 | } |
606 | 606 | ||
607 | static inline unsigned int | ||
608 | pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct) | ||
609 | { | ||
610 | return do_munmap(mm, addr, len); | ||
611 | } | ||
612 | |||
613 | static inline unsigned long | 607 | static inline unsigned long |
614 | pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) | 608 | pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) |
615 | { | 609 | { |
@@ -1458,8 +1452,9 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu) | |||
1458 | * a PROTECT_CTX() section. | 1452 | * a PROTECT_CTX() section. |
1459 | */ | 1453 | */ |
1460 | static int | 1454 | static int |
1461 | pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long size) | 1455 | pfm_remove_smpl_mapping(void *vaddr, unsigned long size) |
1462 | { | 1456 | { |
1457 | struct task_struct *task = current; | ||
1463 | int r; | 1458 | int r; |
1464 | 1459 | ||
1465 | /* sanity checks */ | 1460 | /* sanity checks */ |
@@ -1473,13 +1468,8 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz | |||
1473 | /* | 1468 | /* |
1474 | * does the actual unmapping | 1469 | * does the actual unmapping |
1475 | */ | 1470 | */ |
1476 | down_write(&task->mm->mmap_sem); | 1471 | r = vm_munmap((unsigned long)vaddr, size); |
1477 | 1472 | ||
1478 | DPRINT(("down_write done smpl_vaddr=%p size=%lu\n", vaddr, size)); | ||
1479 | |||
1480 | r = pfm_do_munmap(task->mm, (unsigned long)vaddr, size, 0); | ||
1481 | |||
1482 | up_write(&task->mm->mmap_sem); | ||
1483 | if (r !=0) { | 1473 | if (r !=0) { |
1484 | printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); | 1474 | printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); |
1485 | } | 1475 | } |
@@ -1945,7 +1935,7 @@ pfm_flush(struct file *filp, fl_owner_t id) | |||
1945 | * because some VM function reenables interrupts. | 1935 | * because some VM function reenables interrupts. |
1946 | * | 1936 | * |
1947 | */ | 1937 | */ |
1948 | if (smpl_buf_vaddr) pfm_remove_smpl_mapping(current, smpl_buf_vaddr, smpl_buf_size); | 1938 | if (smpl_buf_vaddr) pfm_remove_smpl_mapping(smpl_buf_vaddr, smpl_buf_size); |
1949 | 1939 | ||
1950 | return 0; | 1940 | return 0; |
1951 | } | 1941 | } |
diff --git a/arch/m68k/configs/m5275evb_defconfig b/arch/m68k/configs/m5275evb_defconfig index 33c32aeca12b..a1230e82bb1e 100644 --- a/arch/m68k/configs/m5275evb_defconfig +++ b/arch/m68k/configs/m5275evb_defconfig | |||
@@ -49,7 +49,6 @@ CONFIG_BLK_DEV_RAM=y | |||
49 | CONFIG_NETDEVICES=y | 49 | CONFIG_NETDEVICES=y |
50 | CONFIG_NET_ETHERNET=y | 50 | CONFIG_NET_ETHERNET=y |
51 | CONFIG_FEC=y | 51 | CONFIG_FEC=y |
52 | CONFIG_FEC2=y | ||
53 | # CONFIG_NETDEV_1000 is not set | 52 | # CONFIG_NETDEV_1000 is not set |
54 | # CONFIG_NETDEV_10000 is not set | 53 | # CONFIG_NETDEV_10000 is not set |
55 | CONFIG_PPP=y | 54 | CONFIG_PPP=y |
diff --git a/arch/m68k/platform/527x/config.c b/arch/m68k/platform/527x/config.c index 7ed848c3b848..f91a53294c35 100644 --- a/arch/m68k/platform/527x/config.c +++ b/arch/m68k/platform/527x/config.c | |||
@@ -74,9 +74,7 @@ static void __init m527x_fec_init(void) | |||
74 | writew(par | 0xf00, MCF_IPSBAR + 0x100082); | 74 | writew(par | 0xf00, MCF_IPSBAR + 0x100082); |
75 | v = readb(MCF_IPSBAR + 0x100078); | 75 | v = readb(MCF_IPSBAR + 0x100078); |
76 | writeb(v | 0xc0, MCF_IPSBAR + 0x100078); | 76 | writeb(v | 0xc0, MCF_IPSBAR + 0x100078); |
77 | #endif | ||
78 | 77 | ||
79 | #ifdef CONFIG_FEC2 | ||
80 | /* Set multi-function pins to ethernet mode for fec1 */ | 78 | /* Set multi-function pins to ethernet mode for fec1 */ |
81 | par = readw(MCF_IPSBAR + 0x100082); | 79 | par = readw(MCF_IPSBAR + 0x100082); |
82 | writew(par | 0xa0, MCF_IPSBAR + 0x100082); | 80 | writew(par | 0xa0, MCF_IPSBAR + 0x100082); |
diff --git a/arch/m68k/platform/68EZ328/Makefile b/arch/m68k/platform/68EZ328/Makefile index ee97735a242c..b44d799b1115 100644 --- a/arch/m68k/platform/68EZ328/Makefile +++ b/arch/m68k/platform/68EZ328/Makefile | |||
@@ -3,9 +3,3 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := config.o | 5 | obj-y := config.o |
6 | |||
7 | extra-y := bootlogo.rh | ||
8 | |||
9 | $(obj)/bootlogo.rh: $(src)/bootlogo.h | ||
10 | perl $(src)/../68328/bootlogo.pl < $(src)/bootlogo.h \ | ||
11 | > $(obj)/bootlogo.rh | ||
diff --git a/arch/m68k/platform/68VZ328/Makefile b/arch/m68k/platform/68VZ328/Makefile index 447ffa0fd7c7..a49d75e65489 100644 --- a/arch/m68k/platform/68VZ328/Makefile +++ b/arch/m68k/platform/68VZ328/Makefile | |||
@@ -3,14 +3,9 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := config.o | 5 | obj-y := config.o |
6 | logo-$(UCDIMM) := bootlogo.rh | 6 | extra-$(DRAGEN2):= screen.h |
7 | logo-$(DRAGEN2) := screen.h | ||
8 | extra-y := $(logo-y) | ||
9 | |||
10 | $(obj)/bootlogo.rh: $(src)/../68EZ328/bootlogo.h | ||
11 | perl $(src)/bootlogo.pl < $(src)/../68328/bootlogo.h > $(obj)/bootlogo.rh | ||
12 | 7 | ||
13 | $(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl | 8 | $(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl |
14 | perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h | 9 | perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h |
15 | 10 | ||
16 | clean-files := $(obj)/screen.h $(obj)/bootlogo.rh | 11 | clean-files := $(obj)/screen.h |
diff --git a/arch/m68k/platform/68EZ328/bootlogo.h b/arch/m68k/platform/68VZ328/bootlogo.h index e842bdae5839..b38e2b255142 100644 --- a/arch/m68k/platform/68EZ328/bootlogo.h +++ b/arch/m68k/platform/68VZ328/bootlogo.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #define splash_width 640 | 1 | #define splash_width 640 |
2 | #define splash_height 480 | 2 | #define splash_height 480 |
3 | static unsigned char splash_bits[] = { | 3 | unsigned char __attribute__ ((aligned(16))) bootlogo_bits[] = { |
4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c index fa50c48292ff..7af97362b95c 100644 --- a/arch/m68k/platform/coldfire/device.c +++ b/arch/m68k/platform/coldfire/device.c | |||
@@ -114,7 +114,7 @@ static struct resource mcf_fec1_resources[] = { | |||
114 | 114 | ||
115 | static struct platform_device mcf_fec1 = { | 115 | static struct platform_device mcf_fec1 = { |
116 | .name = "fec", | 116 | .name = "fec", |
117 | .id = 0, | 117 | .id = 1, |
118 | .num_resources = ARRAY_SIZE(mcf_fec1_resources), | 118 | .num_resources = ARRAY_SIZE(mcf_fec1_resources), |
119 | .resource = mcf_fec1_resources, | 119 | .resource = mcf_fec1_resources, |
120 | }; | 120 | }; |
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index cf417e510736..e648af92ced1 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h | |||
@@ -33,8 +33,6 @@ extern atomic_t ppc_n_lost_interrupts; | |||
33 | /* Same thing, used by the generic IRQ code */ | 33 | /* Same thing, used by the generic IRQ code */ |
34 | #define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS | 34 | #define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS |
35 | 35 | ||
36 | struct irq_data; | ||
37 | extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); | ||
38 | extern irq_hw_number_t virq_to_hw(unsigned int virq); | 36 | extern irq_hw_number_t virq_to_hw(unsigned int virq); |
39 | 37 | ||
40 | /** | 38 | /** |
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 3e57a00b8cba..ba3aeb4bc06a 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -206,40 +206,43 @@ reenable_mmu: /* re-enable mmu so we can */ | |||
206 | andi. r10,r10,MSR_EE /* Did EE change? */ | 206 | andi. r10,r10,MSR_EE /* Did EE change? */ |
207 | beq 1f | 207 | beq 1f |
208 | 208 | ||
209 | /* Save handler and return address into the 2 unused words | ||
210 | * of the STACK_FRAME_OVERHEAD (sneak sneak sneak). Everything | ||
211 | * else can be recovered from the pt_regs except r3 which for | ||
212 | * normal interrupts has been set to pt_regs and for syscalls | ||
213 | * is an argument, so we temporarily use ORIG_GPR3 to save it | ||
214 | */ | ||
215 | stw r9,8(r1) | ||
216 | stw r11,12(r1) | ||
217 | stw r3,ORIG_GPR3(r1) | ||
218 | /* | 209 | /* |
219 | * The trace_hardirqs_off will use CALLER_ADDR0 and CALLER_ADDR1. | 210 | * The trace_hardirqs_off will use CALLER_ADDR0 and CALLER_ADDR1. |
220 | * If from user mode there is only one stack frame on the stack, and | 211 | * If from user mode there is only one stack frame on the stack, and |
221 | * accessing CALLER_ADDR1 will cause oops. So we need create a dummy | 212 | * accessing CALLER_ADDR1 will cause oops. So we need create a dummy |
222 | * stack frame to make trace_hardirqs_off happy. | 213 | * stack frame to make trace_hardirqs_off happy. |
214 | * | ||
215 | * This is handy because we also need to save a bunch of GPRs, | ||
216 | * r3 can be different from GPR3(r1) at this point, r9 and r11 | ||
217 | * contains the old MSR and handler address respectively, | ||
218 | * r4 & r5 can contain page fault arguments that need to be passed | ||
219 | * along as well. r12, CCR, CTR, XER etc... are left clobbered as | ||
220 | * they aren't useful past this point (aren't syscall arguments), | ||
221 | * the rest is restored from the exception frame. | ||
223 | */ | 222 | */ |
223 | stwu r1,-32(r1) | ||
224 | stw r9,8(r1) | ||
225 | stw r11,12(r1) | ||
226 | stw r3,16(r1) | ||
227 | stw r4,20(r1) | ||
228 | stw r5,24(r1) | ||
224 | andi. r12,r12,MSR_PR | 229 | andi. r12,r12,MSR_PR |
225 | beq 11f | 230 | b 11f |
226 | stwu r1,-16(r1) | ||
227 | bl trace_hardirqs_off | 231 | bl trace_hardirqs_off |
228 | addi r1,r1,16 | ||
229 | b 12f | 232 | b 12f |
230 | |||
231 | 11: | 233 | 11: |
232 | bl trace_hardirqs_off | 234 | bl trace_hardirqs_off |
233 | 12: | 235 | 12: |
236 | lwz r5,24(r1) | ||
237 | lwz r4,20(r1) | ||
238 | lwz r3,16(r1) | ||
239 | lwz r11,12(r1) | ||
240 | lwz r9,8(r1) | ||
241 | addi r1,r1,32 | ||
234 | lwz r0,GPR0(r1) | 242 | lwz r0,GPR0(r1) |
235 | lwz r3,ORIG_GPR3(r1) | ||
236 | lwz r4,GPR4(r1) | ||
237 | lwz r5,GPR5(r1) | ||
238 | lwz r6,GPR6(r1) | 243 | lwz r6,GPR6(r1) |
239 | lwz r7,GPR7(r1) | 244 | lwz r7,GPR7(r1) |
240 | lwz r8,GPR8(r1) | 245 | lwz r8,GPR8(r1) |
241 | lwz r9,8(r1) | ||
242 | lwz r11,12(r1) | ||
243 | 1: mtctr r11 | 246 | 1: mtctr r11 |
244 | mtlr r9 | 247 | mtlr r9 |
245 | bctr /* jump to handler */ | 248 | bctr /* jump to handler */ |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 243dbabfe74d..5ec1b2354ca6 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -560,12 +560,6 @@ void do_softirq(void) | |||
560 | local_irq_restore(flags); | 560 | local_irq_restore(flags); |
561 | } | 561 | } |
562 | 562 | ||
563 | irq_hw_number_t irqd_to_hwirq(struct irq_data *d) | ||
564 | { | ||
565 | return d->hwirq; | ||
566 | } | ||
567 | EXPORT_SYMBOL_GPL(irqd_to_hwirq); | ||
568 | |||
569 | irq_hw_number_t virq_to_hw(unsigned int virq) | 563 | irq_hw_number_t virq_to_hw(unsigned int virq) |
570 | { | 564 | { |
571 | struct irq_data *irq_data = irq_get_irq_data(virq); | 565 | struct irq_data *irq_data = irq_get_irq_data(virq); |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index f88698c0f332..4937c9690090 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -1235,7 +1235,7 @@ void __ppc64_runlatch_on(void) | |||
1235 | ctrl |= CTRL_RUNLATCH; | 1235 | ctrl |= CTRL_RUNLATCH; |
1236 | mtspr(SPRN_CTRLT, ctrl); | 1236 | mtspr(SPRN_CTRLT, ctrl); |
1237 | 1237 | ||
1238 | ti->local_flags |= TLF_RUNLATCH; | 1238 | ti->local_flags |= _TLF_RUNLATCH; |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | /* Called with hard IRQs off */ | 1241 | /* Called with hard IRQs off */ |
@@ -1244,7 +1244,7 @@ void __ppc64_runlatch_off(void) | |||
1244 | struct thread_info *ti = current_thread_info(); | 1244 | struct thread_info *ti = current_thread_info(); |
1245 | unsigned long ctrl; | 1245 | unsigned long ctrl; |
1246 | 1246 | ||
1247 | ti->local_flags &= ~TLF_RUNLATCH; | 1247 | ti->local_flags &= ~_TLF_RUNLATCH; |
1248 | 1248 | ||
1249 | ctrl = mfspr(SPRN_CTRLF); | 1249 | ctrl = mfspr(SPRN_CTRLF); |
1250 | ctrl &= ~CTRL_RUNLATCH; | 1250 | ctrl &= ~CTRL_RUNLATCH; |
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index db360fc4cf0e..d09f3e8e6867 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c | |||
@@ -392,7 +392,7 @@ static int axon_msi_probe(struct platform_device *device) | |||
392 | } | 392 | } |
393 | memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); | 393 | memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); |
394 | 394 | ||
395 | msic->irq_domain = irq_domain_add_nomap(dn, &msic_host_ops, msic); | 395 | msic->irq_domain = irq_domain_add_nomap(dn, 0, &msic_host_ops, msic); |
396 | if (!msic->irq_domain) { | 396 | if (!msic->irq_domain) { |
397 | printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n", | 397 | printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n", |
398 | dn->full_name); | 398 | dn->full_name); |
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c index e5c3a2c6090d..f9a48af335cb 100644 --- a/arch/powerpc/platforms/cell/beat_interrupt.c +++ b/arch/powerpc/platforms/cell/beat_interrupt.c | |||
@@ -239,7 +239,7 @@ void __init beatic_init_IRQ(void) | |||
239 | ppc_md.get_irq = beatic_get_irq; | 239 | ppc_md.get_irq = beatic_get_irq; |
240 | 240 | ||
241 | /* Allocate an irq host */ | 241 | /* Allocate an irq host */ |
242 | beatic_host = irq_domain_add_nomap(NULL, &beatic_pic_host_ops, NULL); | 242 | beatic_host = irq_domain_add_nomap(NULL, 0, &beatic_pic_host_ops, NULL); |
243 | BUG_ON(beatic_host == NULL); | 243 | BUG_ON(beatic_host == NULL); |
244 | irq_set_default_host(beatic_host); | 244 | irq_set_default_host(beatic_host); |
245 | } | 245 | } |
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index a81e5a88fbdf..b4ddaa3fbb29 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -192,7 +192,7 @@ static int psurge_secondary_ipi_init(void) | |||
192 | { | 192 | { |
193 | int rc = -ENOMEM; | 193 | int rc = -ENOMEM; |
194 | 194 | ||
195 | psurge_host = irq_domain_add_nomap(NULL, &psurge_host_ops, NULL); | 195 | psurge_host = irq_domain_add_nomap(NULL, 0, &psurge_host_ops, NULL); |
196 | 196 | ||
197 | if (psurge_host) | 197 | if (psurge_host) |
198 | psurge_secondary_virq = irq_create_direct_mapping(psurge_host); | 198 | psurge_secondary_virq = irq_create_direct_mapping(psurge_host); |
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c index 2a4ff86cc21f..5f3b23220b8e 100644 --- a/arch/powerpc/platforms/ps3/interrupt.c +++ b/arch/powerpc/platforms/ps3/interrupt.c | |||
@@ -753,9 +753,8 @@ void __init ps3_init_IRQ(void) | |||
753 | unsigned cpu; | 753 | unsigned cpu; |
754 | struct irq_domain *host; | 754 | struct irq_domain *host; |
755 | 755 | ||
756 | host = irq_domain_add_nomap(NULL, &ps3_host_ops, NULL); | 756 | host = irq_domain_add_nomap(NULL, PS3_PLUG_MAX + 1, &ps3_host_ops, NULL); |
757 | irq_set_default_host(host); | 757 | irq_set_default_host(host); |
758 | irq_set_virq_count(PS3_PLUG_MAX + 1); | ||
759 | 758 | ||
760 | for_each_possible_cpu(cpu) { | 759 | for_each_possible_cpu(cpu) { |
761 | struct ps3_private *pd = &per_cpu(ps3_private, cpu); | 760 | struct ps3_private *pd = &per_cpu(ps3_private, cpu); |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 2b7c0fbe578e..9015060919a0 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -90,7 +90,6 @@ config S390 | |||
90 | select HAVE_KERNEL_XZ | 90 | select HAVE_KERNEL_XZ |
91 | select HAVE_ARCH_MUTEX_CPU_RELAX | 91 | select HAVE_ARCH_MUTEX_CPU_RELAX |
92 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 | 92 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 |
93 | select HAVE_RCU_TABLE_FREE if SMP | ||
94 | select ARCH_SAVE_PAGE_KEYS if HIBERNATION | 93 | select ARCH_SAVE_PAGE_KEYS if HIBERNATION |
95 | select HAVE_MEMBLOCK | 94 | select HAVE_MEMBLOCK |
96 | select HAVE_MEMBLOCK_NODE_MAP | 95 | select HAVE_MEMBLOCK_NODE_MAP |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 6cf8e26b3137..1957a9dd256d 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -1,8 +1,12 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | 1 | CONFIG_EXPERIMENTAL=y |
2 | CONFIG_SYSVIPC=y | 2 | CONFIG_SYSVIPC=y |
3 | CONFIG_POSIX_MQUEUE=y | 3 | CONFIG_POSIX_MQUEUE=y |
4 | CONFIG_FHANDLE=y | ||
5 | CONFIG_TASKSTATS=y | ||
6 | CONFIG_TASK_DELAY_ACCT=y | ||
7 | CONFIG_TASK_XACCT=y | ||
8 | CONFIG_TASK_IO_ACCOUNTING=y | ||
4 | CONFIG_AUDIT=y | 9 | CONFIG_AUDIT=y |
5 | CONFIG_RCU_TRACE=y | ||
6 | CONFIG_IKCONFIG=y | 10 | CONFIG_IKCONFIG=y |
7 | CONFIG_IKCONFIG_PROC=y | 11 | CONFIG_IKCONFIG_PROC=y |
8 | CONFIG_CGROUPS=y | 12 | CONFIG_CGROUPS=y |
@@ -14,16 +18,22 @@ CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y | |||
14 | CONFIG_CGROUP_SCHED=y | 18 | CONFIG_CGROUP_SCHED=y |
15 | CONFIG_RT_GROUP_SCHED=y | 19 | CONFIG_RT_GROUP_SCHED=y |
16 | CONFIG_BLK_CGROUP=y | 20 | CONFIG_BLK_CGROUP=y |
21 | CONFIG_NAMESPACES=y | ||
17 | CONFIG_BLK_DEV_INITRD=y | 22 | CONFIG_BLK_DEV_INITRD=y |
18 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 23 | CONFIG_RD_BZIP2=y |
24 | CONFIG_RD_LZMA=y | ||
25 | CONFIG_RD_XZ=y | ||
26 | CONFIG_RD_LZO=y | ||
27 | CONFIG_EXPERT=y | ||
19 | # CONFIG_COMPAT_BRK is not set | 28 | # CONFIG_COMPAT_BRK is not set |
20 | CONFIG_SLAB=y | ||
21 | CONFIG_PROFILING=y | 29 | CONFIG_PROFILING=y |
22 | CONFIG_OPROFILE=y | 30 | CONFIG_OPROFILE=y |
23 | CONFIG_KPROBES=y | 31 | CONFIG_KPROBES=y |
24 | CONFIG_MODULES=y | 32 | CONFIG_MODULES=y |
25 | CONFIG_MODULE_UNLOAD=y | 33 | CONFIG_MODULE_UNLOAD=y |
26 | CONFIG_MODVERSIONS=y | 34 | CONFIG_MODVERSIONS=y |
35 | CONFIG_PARTITION_ADVANCED=y | ||
36 | CONFIG_IBM_PARTITION=y | ||
27 | CONFIG_DEFAULT_DEADLINE=y | 37 | CONFIG_DEFAULT_DEADLINE=y |
28 | CONFIG_NO_HZ=y | 38 | CONFIG_NO_HZ=y |
29 | CONFIG_HIGH_RES_TIMERS=y | 39 | CONFIG_HIGH_RES_TIMERS=y |
@@ -34,18 +44,15 @@ CONFIG_KSM=y | |||
34 | CONFIG_BINFMT_MISC=m | 44 | CONFIG_BINFMT_MISC=m |
35 | CONFIG_CMM=m | 45 | CONFIG_CMM=m |
36 | CONFIG_HZ_100=y | 46 | CONFIG_HZ_100=y |
37 | CONFIG_KEXEC=y | 47 | CONFIG_CRASH_DUMP=y |
38 | CONFIG_PM=y | ||
39 | CONFIG_HIBERNATION=y | 48 | CONFIG_HIBERNATION=y |
40 | CONFIG_PACKET=y | 49 | CONFIG_PACKET=y |
41 | CONFIG_UNIX=y | 50 | CONFIG_UNIX=y |
42 | CONFIG_NET_KEY=y | 51 | CONFIG_NET_KEY=y |
43 | CONFIG_AFIUCV=m | ||
44 | CONFIG_INET=y | 52 | CONFIG_INET=y |
45 | CONFIG_IP_MULTICAST=y | 53 | CONFIG_IP_MULTICAST=y |
46 | # CONFIG_INET_LRO is not set | 54 | # CONFIG_INET_LRO is not set |
47 | CONFIG_IPV6=y | 55 | CONFIG_IPV6=y |
48 | CONFIG_NET_SCTPPROBE=m | ||
49 | CONFIG_L2TP=m | 56 | CONFIG_L2TP=m |
50 | CONFIG_L2TP_DEBUGFS=m | 57 | CONFIG_L2TP_DEBUGFS=m |
51 | CONFIG_VLAN_8021Q=y | 58 | CONFIG_VLAN_8021Q=y |
@@ -84,15 +91,14 @@ CONFIG_SCSI_CONSTANTS=y | |||
84 | CONFIG_SCSI_LOGGING=y | 91 | CONFIG_SCSI_LOGGING=y |
85 | CONFIG_SCSI_SCAN_ASYNC=y | 92 | CONFIG_SCSI_SCAN_ASYNC=y |
86 | CONFIG_ZFCP=y | 93 | CONFIG_ZFCP=y |
87 | CONFIG_ZFCP_DIF=y | ||
88 | CONFIG_NETDEVICES=y | 94 | CONFIG_NETDEVICES=y |
89 | CONFIG_DUMMY=m | ||
90 | CONFIG_BONDING=m | 95 | CONFIG_BONDING=m |
96 | CONFIG_DUMMY=m | ||
91 | CONFIG_EQUALIZER=m | 97 | CONFIG_EQUALIZER=m |
92 | CONFIG_TUN=m | 98 | CONFIG_TUN=m |
93 | CONFIG_NET_ETHERNET=y | ||
94 | CONFIG_VIRTIO_NET=y | 99 | CONFIG_VIRTIO_NET=y |
95 | CONFIG_RAW_DRIVER=m | 100 | CONFIG_RAW_DRIVER=m |
101 | CONFIG_VIRTIO_BALLOON=y | ||
96 | CONFIG_EXT2_FS=y | 102 | CONFIG_EXT2_FS=y |
97 | CONFIG_EXT3_FS=y | 103 | CONFIG_EXT3_FS=y |
98 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 104 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
@@ -103,27 +109,21 @@ CONFIG_PROC_KCORE=y | |||
103 | CONFIG_TMPFS=y | 109 | CONFIG_TMPFS=y |
104 | CONFIG_TMPFS_POSIX_ACL=y | 110 | CONFIG_TMPFS_POSIX_ACL=y |
105 | # CONFIG_NETWORK_FILESYSTEMS is not set | 111 | # CONFIG_NETWORK_FILESYSTEMS is not set |
106 | CONFIG_PARTITION_ADVANCED=y | ||
107 | CONFIG_IBM_PARTITION=y | ||
108 | CONFIG_DLM=m | ||
109 | CONFIG_MAGIC_SYSRQ=y | 112 | CONFIG_MAGIC_SYSRQ=y |
110 | CONFIG_DEBUG_KERNEL=y | ||
111 | CONFIG_TIMER_STATS=y | 113 | CONFIG_TIMER_STATS=y |
112 | CONFIG_PROVE_LOCKING=y | 114 | CONFIG_PROVE_LOCKING=y |
113 | CONFIG_PROVE_RCU=y | 115 | CONFIG_PROVE_RCU=y |
114 | CONFIG_LOCK_STAT=y | 116 | CONFIG_LOCK_STAT=y |
115 | CONFIG_DEBUG_LOCKDEP=y | 117 | CONFIG_DEBUG_LOCKDEP=y |
116 | CONFIG_DEBUG_SPINLOCK_SLEEP=y | ||
117 | CONFIG_DEBUG_LIST=y | 118 | CONFIG_DEBUG_LIST=y |
118 | CONFIG_DEBUG_NOTIFIERS=y | 119 | CONFIG_DEBUG_NOTIFIERS=y |
119 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | 120 | CONFIG_RCU_TRACE=y |
120 | CONFIG_KPROBES_SANITY_TEST=y | 121 | CONFIG_KPROBES_SANITY_TEST=y |
121 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y | 122 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y |
122 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m | 123 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m |
123 | CONFIG_LATENCYTOP=y | 124 | CONFIG_LATENCYTOP=y |
124 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
125 | CONFIG_DEBUG_PAGEALLOC=y | 125 | CONFIG_DEBUG_PAGEALLOC=y |
126 | # CONFIG_FTRACE is not set | 126 | CONFIG_BLK_DEV_IO_TRACE=y |
127 | # CONFIG_STRICT_DEVMEM is not set | 127 | # CONFIG_STRICT_DEVMEM is not set |
128 | CONFIG_CRYPTO_NULL=m | 128 | CONFIG_CRYPTO_NULL=m |
129 | CONFIG_CRYPTO_CRYPTD=m | 129 | CONFIG_CRYPTO_CRYPTD=m |
@@ -173,4 +173,3 @@ CONFIG_CRYPTO_SHA512_S390=m | |||
173 | CONFIG_CRYPTO_DES_S390=m | 173 | CONFIG_CRYPTO_DES_S390=m |
174 | CONFIG_CRYPTO_AES_S390=m | 174 | CONFIG_CRYPTO_AES_S390=m |
175 | CONFIG_CRC7=m | 175 | CONFIG_CRC7=m |
176 | CONFIG_VIRTIO_BALLOON=y | ||
diff --git a/arch/s390/include/asm/facility.h b/arch/s390/include/asm/facility.h index 1e5b27edc0c9..2ee66a65f2d4 100644 --- a/arch/s390/include/asm/facility.h +++ b/arch/s390/include/asm/facility.h | |||
@@ -38,12 +38,11 @@ static inline void stfle(u64 *stfle_fac_list, int size) | |||
38 | unsigned long nr; | 38 | unsigned long nr; |
39 | 39 | ||
40 | preempt_disable(); | 40 | preempt_disable(); |
41 | S390_lowcore.stfl_fac_list = 0; | ||
42 | asm volatile( | 41 | asm volatile( |
43 | " .insn s,0xb2b10000,0(0)\n" /* stfl */ | 42 | " .insn s,0xb2b10000,0(0)\n" /* stfl */ |
44 | "0:\n" | 43 | "0:\n" |
45 | EX_TABLE(0b, 0b) | 44 | EX_TABLE(0b, 0b) |
46 | : "=m" (S390_lowcore.stfl_fac_list)); | 45 | : "+m" (S390_lowcore.stfl_fac_list)); |
47 | nr = 4; /* bytes stored by stfl */ | 46 | nr = 4; /* bytes stored by stfl */ |
48 | memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); | 47 | memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); |
49 | if (S390_lowcore.stfl_fac_list & 0x01000000) { | 48 | if (S390_lowcore.stfl_fac_list & 0x01000000) { |
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 8eef9b5b3cf4..78e3041919de 100644 --- a/arch/s390/include/asm/pgalloc.h +++ b/arch/s390/include/asm/pgalloc.h | |||
@@ -22,10 +22,7 @@ void crst_table_free(struct mm_struct *, unsigned long *); | |||
22 | 22 | ||
23 | unsigned long *page_table_alloc(struct mm_struct *, unsigned long); | 23 | unsigned long *page_table_alloc(struct mm_struct *, unsigned long); |
24 | void page_table_free(struct mm_struct *, unsigned long *); | 24 | void page_table_free(struct mm_struct *, unsigned long *); |
25 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
26 | void page_table_free_rcu(struct mmu_gather *, unsigned long *); | 25 | void page_table_free_rcu(struct mmu_gather *, unsigned long *); |
27 | void __tlb_remove_table(void *_table); | ||
28 | #endif | ||
29 | 26 | ||
30 | static inline void clear_table(unsigned long *s, unsigned long val, size_t n) | 27 | static inline void clear_table(unsigned long *s, unsigned long val, size_t n) |
31 | { | 28 | { |
diff --git a/arch/s390/include/asm/swab.h b/arch/s390/include/asm/swab.h index 6bdee21c077e..a3e4ebb32090 100644 --- a/arch/s390/include/asm/swab.h +++ b/arch/s390/include/asm/swab.h | |||
@@ -77,7 +77,7 @@ static inline __u16 __arch_swab16p(const __u16 *x) | |||
77 | 77 | ||
78 | asm volatile( | 78 | asm volatile( |
79 | #ifndef __s390x__ | 79 | #ifndef __s390x__ |
80 | " icm %0,2,%O+1(%R1)\n" | 80 | " icm %0,2,%O1+1(%R1)\n" |
81 | " ic %0,%1\n" | 81 | " ic %0,%1\n" |
82 | : "=&d" (result) : "Q" (*x) : "cc"); | 82 | : "=&d" (result) : "Q" (*x) : "cc"); |
83 | #else /* __s390x__ */ | 83 | #else /* __s390x__ */ |
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index c687a2c83462..775a5eea8f9e 100644 --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h | |||
@@ -30,14 +30,10 @@ | |||
30 | 30 | ||
31 | struct mmu_gather { | 31 | struct mmu_gather { |
32 | struct mm_struct *mm; | 32 | struct mm_struct *mm; |
33 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
34 | struct mmu_table_batch *batch; | 33 | struct mmu_table_batch *batch; |
35 | #endif | ||
36 | unsigned int fullmm; | 34 | unsigned int fullmm; |
37 | unsigned int need_flush; | ||
38 | }; | 35 | }; |
39 | 36 | ||
40 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
41 | struct mmu_table_batch { | 37 | struct mmu_table_batch { |
42 | struct rcu_head rcu; | 38 | struct rcu_head rcu; |
43 | unsigned int nr; | 39 | unsigned int nr; |
@@ -49,7 +45,6 @@ struct mmu_table_batch { | |||
49 | 45 | ||
50 | extern void tlb_table_flush(struct mmu_gather *tlb); | 46 | extern void tlb_table_flush(struct mmu_gather *tlb); |
51 | extern void tlb_remove_table(struct mmu_gather *tlb, void *table); | 47 | extern void tlb_remove_table(struct mmu_gather *tlb, void *table); |
52 | #endif | ||
53 | 48 | ||
54 | static inline void tlb_gather_mmu(struct mmu_gather *tlb, | 49 | static inline void tlb_gather_mmu(struct mmu_gather *tlb, |
55 | struct mm_struct *mm, | 50 | struct mm_struct *mm, |
@@ -57,29 +52,20 @@ static inline void tlb_gather_mmu(struct mmu_gather *tlb, | |||
57 | { | 52 | { |
58 | tlb->mm = mm; | 53 | tlb->mm = mm; |
59 | tlb->fullmm = full_mm_flush; | 54 | tlb->fullmm = full_mm_flush; |
60 | tlb->need_flush = 0; | ||
61 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
62 | tlb->batch = NULL; | 55 | tlb->batch = NULL; |
63 | #endif | ||
64 | if (tlb->fullmm) | 56 | if (tlb->fullmm) |
65 | __tlb_flush_mm(mm); | 57 | __tlb_flush_mm(mm); |
66 | } | 58 | } |
67 | 59 | ||
68 | static inline void tlb_flush_mmu(struct mmu_gather *tlb) | 60 | static inline void tlb_flush_mmu(struct mmu_gather *tlb) |
69 | { | 61 | { |
70 | if (!tlb->need_flush) | ||
71 | return; | ||
72 | tlb->need_flush = 0; | ||
73 | __tlb_flush_mm(tlb->mm); | ||
74 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
75 | tlb_table_flush(tlb); | 62 | tlb_table_flush(tlb); |
76 | #endif | ||
77 | } | 63 | } |
78 | 64 | ||
79 | static inline void tlb_finish_mmu(struct mmu_gather *tlb, | 65 | static inline void tlb_finish_mmu(struct mmu_gather *tlb, |
80 | unsigned long start, unsigned long end) | 66 | unsigned long start, unsigned long end) |
81 | { | 67 | { |
82 | tlb_flush_mmu(tlb); | 68 | tlb_table_flush(tlb); |
83 | } | 69 | } |
84 | 70 | ||
85 | /* | 71 | /* |
@@ -105,10 +91,8 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) | |||
105 | static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, | 91 | static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, |
106 | unsigned long address) | 92 | unsigned long address) |
107 | { | 93 | { |
108 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
109 | if (!tlb->fullmm) | 94 | if (!tlb->fullmm) |
110 | return page_table_free_rcu(tlb, (unsigned long *) pte); | 95 | return page_table_free_rcu(tlb, (unsigned long *) pte); |
111 | #endif | ||
112 | page_table_free(tlb->mm, (unsigned long *) pte); | 96 | page_table_free(tlb->mm, (unsigned long *) pte); |
113 | } | 97 | } |
114 | 98 | ||
@@ -125,10 +109,8 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, | |||
125 | #ifdef __s390x__ | 109 | #ifdef __s390x__ |
126 | if (tlb->mm->context.asce_limit <= (1UL << 31)) | 110 | if (tlb->mm->context.asce_limit <= (1UL << 31)) |
127 | return; | 111 | return; |
128 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
129 | if (!tlb->fullmm) | 112 | if (!tlb->fullmm) |
130 | return tlb_remove_table(tlb, pmd); | 113 | return tlb_remove_table(tlb, pmd); |
131 | #endif | ||
132 | crst_table_free(tlb->mm, (unsigned long *) pmd); | 114 | crst_table_free(tlb->mm, (unsigned long *) pmd); |
133 | #endif | 115 | #endif |
134 | } | 116 | } |
@@ -146,10 +128,8 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, | |||
146 | #ifdef __s390x__ | 128 | #ifdef __s390x__ |
147 | if (tlb->mm->context.asce_limit <= (1UL << 42)) | 129 | if (tlb->mm->context.asce_limit <= (1UL << 42)) |
148 | return; | 130 | return; |
149 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
150 | if (!tlb->fullmm) | 131 | if (!tlb->fullmm) |
151 | return tlb_remove_table(tlb, pud); | 132 | return tlb_remove_table(tlb, pud); |
152 | #endif | ||
153 | crst_table_free(tlb->mm, (unsigned long *) pud); | 133 | crst_table_free(tlb->mm, (unsigned long *) pud); |
154 | #endif | 134 | #endif |
155 | } | 135 | } |
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S index c27a0727f930..adccd908ebc7 100644 --- a/arch/s390/kernel/head.S +++ b/arch/s390/kernel/head.S | |||
@@ -474,9 +474,9 @@ ENTRY(startup_kdump) | |||
474 | stck __LC_LAST_UPDATE_CLOCK | 474 | stck __LC_LAST_UPDATE_CLOCK |
475 | spt 5f-.LPG0(%r13) | 475 | spt 5f-.LPG0(%r13) |
476 | mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) | 476 | mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) |
477 | xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST | ||
477 | #ifndef CONFIG_MARCH_G5 | 478 | #ifndef CONFIG_MARCH_G5 |
478 | # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} | 479 | # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} |
479 | xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST | ||
480 | .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list | 480 | .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list |
481 | tm __LC_STFL_FAC_LIST,0x01 # stfle available ? | 481 | tm __LC_STFL_FAC_LIST,0x01 # stfle available ? |
482 | jz 0f | 482 | jz 0f |
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c index 1c2cdd59ccd0..8a22c27219dd 100644 --- a/arch/s390/kernel/irq.c +++ b/arch/s390/kernel/irq.c | |||
@@ -118,9 +118,10 @@ asmlinkage void do_softirq(void) | |||
118 | "a" (__do_softirq) | 118 | "a" (__do_softirq) |
119 | : "0", "1", "2", "3", "4", "5", "14", | 119 | : "0", "1", "2", "3", "4", "5", "14", |
120 | "cc", "memory" ); | 120 | "cc", "memory" ); |
121 | } else | 121 | } else { |
122 | /* We are already on the async stack. */ | 122 | /* We are already on the async stack. */ |
123 | __do_softirq(); | 123 | __do_softirq(); |
124 | } | ||
124 | } | 125 | } |
125 | 126 | ||
126 | local_irq_restore(flags); | 127 | local_irq_restore(flags); |
@@ -192,11 +193,12 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler) | |||
192 | int index = ext_hash(code); | 193 | int index = ext_hash(code); |
193 | 194 | ||
194 | spin_lock_irqsave(&ext_int_hash_lock, flags); | 195 | spin_lock_irqsave(&ext_int_hash_lock, flags); |
195 | list_for_each_entry_rcu(p, &ext_int_hash[index], entry) | 196 | list_for_each_entry_rcu(p, &ext_int_hash[index], entry) { |
196 | if (p->code == code && p->handler == handler) { | 197 | if (p->code == code && p->handler == handler) { |
197 | list_del_rcu(&p->entry); | 198 | list_del_rcu(&p->entry); |
198 | kfree_rcu(p, rcu); | 199 | kfree_rcu(p, rcu); |
199 | } | 200 | } |
201 | } | ||
200 | spin_unlock_irqrestore(&ext_int_hash_lock, flags); | 202 | spin_unlock_irqrestore(&ext_int_hash_lock, flags); |
201 | return 0; | 203 | return 0; |
202 | } | 204 | } |
@@ -211,9 +213,10 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code, | |||
211 | 213 | ||
212 | old_regs = set_irq_regs(regs); | 214 | old_regs = set_irq_regs(regs); |
213 | irq_enter(); | 215 | irq_enter(); |
214 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) | 216 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) { |
215 | /* Serve timer interrupts first. */ | 217 | /* Serve timer interrupts first. */ |
216 | clock_comparator_work(); | 218 | clock_comparator_work(); |
219 | } | ||
217 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; | 220 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; |
218 | if (ext_code.code != 0x1004) | 221 | if (ext_code.code != 0x1004) |
219 | __get_cpu_var(s390_idle).nohz_delay = 1; | 222 | __get_cpu_var(s390_idle).nohz_delay = 1; |
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c index 46405086479c..cb019f429e88 100644 --- a/arch/s390/kernel/perf_cpum_cf.c +++ b/arch/s390/kernel/perf_cpum_cf.c | |||
@@ -178,7 +178,7 @@ static void cpumf_pmu_enable(struct pmu *pmu) | |||
178 | err = lcctl(cpuhw->state); | 178 | err = lcctl(cpuhw->state); |
179 | if (err) { | 179 | if (err) { |
180 | pr_err("Enabling the performance measuring unit " | 180 | pr_err("Enabling the performance measuring unit " |
181 | "failed with rc=%lx\n", err); | 181 | "failed with rc=%x\n", err); |
182 | return; | 182 | return; |
183 | } | 183 | } |
184 | 184 | ||
@@ -203,7 +203,7 @@ static void cpumf_pmu_disable(struct pmu *pmu) | |||
203 | err = lcctl(inactive); | 203 | err = lcctl(inactive); |
204 | if (err) { | 204 | if (err) { |
205 | pr_err("Disabling the performance measuring unit " | 205 | pr_err("Disabling the performance measuring unit " |
206 | "failed with rc=%lx\n", err); | 206 | "failed with rc=%x\n", err); |
207 | return; | 207 | return; |
208 | } | 208 | } |
209 | 209 | ||
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c index 7bb15fcca75e..e1335dc2b1b7 100644 --- a/arch/s390/mm/maccess.c +++ b/arch/s390/mm/maccess.c | |||
@@ -61,21 +61,14 @@ long probe_kernel_write(void *dst, const void *src, size_t size) | |||
61 | return copied < 0 ? -EFAULT : 0; | 61 | return copied < 0 ? -EFAULT : 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | /* | 64 | static int __memcpy_real(void *dest, void *src, size_t count) |
65 | * Copy memory in real mode (kernel to kernel) | ||
66 | */ | ||
67 | int memcpy_real(void *dest, void *src, size_t count) | ||
68 | { | 65 | { |
69 | register unsigned long _dest asm("2") = (unsigned long) dest; | 66 | register unsigned long _dest asm("2") = (unsigned long) dest; |
70 | register unsigned long _len1 asm("3") = (unsigned long) count; | 67 | register unsigned long _len1 asm("3") = (unsigned long) count; |
71 | register unsigned long _src asm("4") = (unsigned long) src; | 68 | register unsigned long _src asm("4") = (unsigned long) src; |
72 | register unsigned long _len2 asm("5") = (unsigned long) count; | 69 | register unsigned long _len2 asm("5") = (unsigned long) count; |
73 | unsigned long flags; | ||
74 | int rc = -EFAULT; | 70 | int rc = -EFAULT; |
75 | 71 | ||
76 | if (!count) | ||
77 | return 0; | ||
78 | flags = __arch_local_irq_stnsm(0xf8UL); | ||
79 | asm volatile ( | 72 | asm volatile ( |
80 | "0: mvcle %1,%2,0x0\n" | 73 | "0: mvcle %1,%2,0x0\n" |
81 | "1: jo 0b\n" | 74 | "1: jo 0b\n" |
@@ -86,7 +79,23 @@ int memcpy_real(void *dest, void *src, size_t count) | |||
86 | "+d" (_len2), "=m" (*((long *) dest)) | 79 | "+d" (_len2), "=m" (*((long *) dest)) |
87 | : "m" (*((long *) src)) | 80 | : "m" (*((long *) src)) |
88 | : "cc", "memory"); | 81 | : "cc", "memory"); |
89 | arch_local_irq_restore(flags); | 82 | return rc; |
83 | } | ||
84 | |||
85 | /* | ||
86 | * Copy memory in real mode (kernel to kernel) | ||
87 | */ | ||
88 | int memcpy_real(void *dest, void *src, size_t count) | ||
89 | { | ||
90 | unsigned long flags; | ||
91 | int rc; | ||
92 | |||
93 | if (!count) | ||
94 | return 0; | ||
95 | local_irq_save(flags); | ||
96 | __arch_local_irq_stnsm(0xfbUL); | ||
97 | rc = __memcpy_real(dest, src, count); | ||
98 | local_irq_restore(flags); | ||
90 | return rc; | 99 | return rc; |
91 | } | 100 | } |
92 | 101 | ||
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 373adf69b01c..6e765bf00670 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -678,8 +678,6 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) | |||
678 | } | 678 | } |
679 | } | 679 | } |
680 | 680 | ||
681 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
682 | |||
683 | static void __page_table_free_rcu(void *table, unsigned bit) | 681 | static void __page_table_free_rcu(void *table, unsigned bit) |
684 | { | 682 | { |
685 | struct page *page; | 683 | struct page *page; |
@@ -733,7 +731,66 @@ void __tlb_remove_table(void *_table) | |||
733 | free_pages((unsigned long) table, ALLOC_ORDER); | 731 | free_pages((unsigned long) table, ALLOC_ORDER); |
734 | } | 732 | } |
735 | 733 | ||
736 | #endif | 734 | static void tlb_remove_table_smp_sync(void *arg) |
735 | { | ||
736 | /* Simply deliver the interrupt */ | ||
737 | } | ||
738 | |||
739 | static void tlb_remove_table_one(void *table) | ||
740 | { | ||
741 | /* | ||
742 | * This isn't an RCU grace period and hence the page-tables cannot be | ||
743 | * assumed to be actually RCU-freed. | ||
744 | * | ||
745 | * It is however sufficient for software page-table walkers that rely | ||
746 | * on IRQ disabling. See the comment near struct mmu_table_batch. | ||
747 | */ | ||
748 | smp_call_function(tlb_remove_table_smp_sync, NULL, 1); | ||
749 | __tlb_remove_table(table); | ||
750 | } | ||
751 | |||
752 | static void tlb_remove_table_rcu(struct rcu_head *head) | ||
753 | { | ||
754 | struct mmu_table_batch *batch; | ||
755 | int i; | ||
756 | |||
757 | batch = container_of(head, struct mmu_table_batch, rcu); | ||
758 | |||
759 | for (i = 0; i < batch->nr; i++) | ||
760 | __tlb_remove_table(batch->tables[i]); | ||
761 | |||
762 | free_page((unsigned long)batch); | ||
763 | } | ||
764 | |||
765 | void tlb_table_flush(struct mmu_gather *tlb) | ||
766 | { | ||
767 | struct mmu_table_batch **batch = &tlb->batch; | ||
768 | |||
769 | if (*batch) { | ||
770 | __tlb_flush_mm(tlb->mm); | ||
771 | call_rcu_sched(&(*batch)->rcu, tlb_remove_table_rcu); | ||
772 | *batch = NULL; | ||
773 | } | ||
774 | } | ||
775 | |||
776 | void tlb_remove_table(struct mmu_gather *tlb, void *table) | ||
777 | { | ||
778 | struct mmu_table_batch **batch = &tlb->batch; | ||
779 | |||
780 | if (*batch == NULL) { | ||
781 | *batch = (struct mmu_table_batch *) | ||
782 | __get_free_page(GFP_NOWAIT | __GFP_NOWARN); | ||
783 | if (*batch == NULL) { | ||
784 | __tlb_flush_mm(tlb->mm); | ||
785 | tlb_remove_table_one(table); | ||
786 | return; | ||
787 | } | ||
788 | (*batch)->nr = 0; | ||
789 | } | ||
790 | (*batch)->tables[(*batch)->nr++] = table; | ||
791 | if ((*batch)->nr == MAX_TABLE_BATCH) | ||
792 | tlb_table_flush(tlb); | ||
793 | } | ||
737 | 794 | ||
738 | /* | 795 | /* |
739 | * switch on pgstes for its userspace process (for kvm) | 796 | * switch on pgstes for its userspace process (for kvm) |
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c index fea13c7b1aee..b93c2c9ccb1d 100644 --- a/arch/sparc/kernel/ds.c +++ b/arch/sparc/kernel/ds.c | |||
@@ -1264,4 +1264,4 @@ static int __init ds_init(void) | |||
1264 | return vio_register_driver(&ds_driver); | 1264 | return vio_register_driver(&ds_driver); |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | subsys_initcall(ds_init); | 1267 | fs_initcall(ds_init); |
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c index aba6b958b2a5..19f56058742b 100644 --- a/arch/sparc/kernel/leon_pci.c +++ b/arch/sparc/kernel/leon_pci.c | |||
@@ -45,7 +45,6 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info) | |||
45 | 45 | ||
46 | void __devinit pcibios_fixup_bus(struct pci_bus *pbus) | 46 | void __devinit pcibios_fixup_bus(struct pci_bus *pbus) |
47 | { | 47 | { |
48 | struct leon_pci_info *info = pbus->sysdata; | ||
49 | struct pci_dev *dev; | 48 | struct pci_dev *dev; |
50 | int i, has_io, has_mem; | 49 | int i, has_io, has_mem; |
51 | u16 cmd; | 50 | u16 cmd; |
@@ -111,18 +110,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
111 | return pci_enable_resources(dev, mask); | 110 | return pci_enable_resources(dev, mask); |
112 | } | 111 | } |
113 | 112 | ||
114 | struct device_node *pci_device_to_OF_node(struct pci_dev *pdev) | ||
115 | { | ||
116 | /* | ||
117 | * Currently the OpenBoot nodes are not connected with the PCI device, | ||
118 | * this is because the LEON PROM does not create PCI nodes. Eventually | ||
119 | * this will change and the same approach as pcic.c can be used to | ||
120 | * match PROM nodes with pci devices. | ||
121 | */ | ||
122 | return NULL; | ||
123 | } | ||
124 | EXPORT_SYMBOL(pci_device_to_OF_node); | ||
125 | |||
126 | void __devinit pcibios_update_irq(struct pci_dev *dev, int irq) | 113 | void __devinit pcibios_update_irq(struct pci_dev *dev, int irq) |
127 | { | 114 | { |
128 | #ifdef CONFIG_PCI_DEBUG | 115 | #ifdef CONFIG_PCI_DEBUG |
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 1210fde18740..160cac9c4036 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/pm.h> | 23 | #include <linux/pm.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/gfp.h> | 25 | #include <linux/gfp.h> |
26 | #include <linux/cpu.h> | ||
26 | 27 | ||
27 | #include <asm/cacheflush.h> | 28 | #include <asm/cacheflush.h> |
28 | #include <asm/tlbflush.h> | 29 | #include <asm/tlbflush.h> |
@@ -78,6 +79,8 @@ void __cpuinit leon_callin(void) | |||
78 | local_flush_tlb_all(); | 79 | local_flush_tlb_all(); |
79 | leon_configure_cache_smp(); | 80 | leon_configure_cache_smp(); |
80 | 81 | ||
82 | notify_cpu_starting(cpuid); | ||
83 | |||
81 | /* Get our local ticker going. */ | 84 | /* Get our local ticker going. */ |
82 | smp_setup_percpu_timer(); | 85 | smp_setup_percpu_timer(); |
83 | 86 | ||
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S index 77f1b95e0806..9171fc238def 100644 --- a/arch/sparc/kernel/rtrap_64.S +++ b/arch/sparc/kernel/rtrap_64.S | |||
@@ -20,11 +20,6 @@ | |||
20 | 20 | ||
21 | .text | 21 | .text |
22 | .align 32 | 22 | .align 32 |
23 | __handle_softirq: | ||
24 | call do_softirq | ||
25 | nop | ||
26 | ba,a,pt %xcc, __handle_softirq_continue | ||
27 | nop | ||
28 | __handle_preemption: | 23 | __handle_preemption: |
29 | call schedule | 24 | call schedule |
30 | wrpr %g0, RTRAP_PSTATE, %pstate | 25 | wrpr %g0, RTRAP_PSTATE, %pstate |
@@ -89,9 +84,7 @@ rtrap: | |||
89 | cmp %l1, 0 | 84 | cmp %l1, 0 |
90 | 85 | ||
91 | /* mm/ultra.S:xcall_report_regs KNOWS about this load. */ | 86 | /* mm/ultra.S:xcall_report_regs KNOWS about this load. */ |
92 | bne,pn %icc, __handle_softirq | ||
93 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 | 87 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 |
94 | __handle_softirq_continue: | ||
95 | rtrap_xcall: | 88 | rtrap_xcall: |
96 | sethi %hi(0xf << 20), %l4 | 89 | sethi %hi(0xf << 20), %l4 |
97 | and %l1, %l4, %l4 | 90 | and %l1, %l4, %l4 |
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index 232df9949530..3ee51f189a55 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c | |||
@@ -566,15 +566,10 @@ out: | |||
566 | 566 | ||
567 | SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len) | 567 | SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len) |
568 | { | 568 | { |
569 | long ret; | ||
570 | |||
571 | if (invalid_64bit_range(addr, len)) | 569 | if (invalid_64bit_range(addr, len)) |
572 | return -EINVAL; | 570 | return -EINVAL; |
573 | 571 | ||
574 | down_write(¤t->mm->mmap_sem); | 572 | return vm_munmap(addr, len); |
575 | ret = do_munmap(current->mm, addr, len); | ||
576 | up_write(¤t->mm->mmap_sem); | ||
577 | return ret; | ||
578 | } | 573 | } |
579 | 574 | ||
580 | extern unsigned long do_mremap(unsigned long addr, | 575 | extern unsigned long do_mremap(unsigned long addr, |
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c index 7705c6731e28..df3155a17991 100644 --- a/arch/sparc/mm/fault_32.c +++ b/arch/sparc/mm/fault_32.c | |||
@@ -225,6 +225,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | |||
225 | unsigned long g2; | 225 | unsigned long g2; |
226 | int from_user = !(regs->psr & PSR_PS); | 226 | int from_user = !(regs->psr & PSR_PS); |
227 | int fault, code; | 227 | int fault, code; |
228 | unsigned int flags = (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | | ||
229 | (write ? FAULT_FLAG_WRITE : 0)); | ||
228 | 230 | ||
229 | if(text_fault) | 231 | if(text_fault) |
230 | address = regs->pc; | 232 | address = regs->pc; |
@@ -251,6 +253,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | |||
251 | 253 | ||
252 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); | 254 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); |
253 | 255 | ||
256 | retry: | ||
254 | down_read(&mm->mmap_sem); | 257 | down_read(&mm->mmap_sem); |
255 | 258 | ||
256 | /* | 259 | /* |
@@ -289,7 +292,11 @@ good_area: | |||
289 | * make sure we exit gracefully rather than endlessly redo | 292 | * make sure we exit gracefully rather than endlessly redo |
290 | * the fault. | 293 | * the fault. |
291 | */ | 294 | */ |
292 | fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); | 295 | fault = handle_mm_fault(mm, vma, address, flags); |
296 | |||
297 | if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) | ||
298 | return; | ||
299 | |||
293 | if (unlikely(fault & VM_FAULT_ERROR)) { | 300 | if (unlikely(fault & VM_FAULT_ERROR)) { |
294 | if (fault & VM_FAULT_OOM) | 301 | if (fault & VM_FAULT_OOM) |
295 | goto out_of_memory; | 302 | goto out_of_memory; |
@@ -297,13 +304,29 @@ good_area: | |||
297 | goto do_sigbus; | 304 | goto do_sigbus; |
298 | BUG(); | 305 | BUG(); |
299 | } | 306 | } |
300 | if (fault & VM_FAULT_MAJOR) { | 307 | |
301 | current->maj_flt++; | 308 | if (flags & FAULT_FLAG_ALLOW_RETRY) { |
302 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address); | 309 | if (fault & VM_FAULT_MAJOR) { |
303 | } else { | 310 | current->maj_flt++; |
304 | current->min_flt++; | 311 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, |
305 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); | 312 | 1, regs, address); |
313 | } else { | ||
314 | current->min_flt++; | ||
315 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, | ||
316 | 1, regs, address); | ||
317 | } | ||
318 | if (fault & VM_FAULT_RETRY) { | ||
319 | flags &= ~FAULT_FLAG_ALLOW_RETRY; | ||
320 | |||
321 | /* No need to up_read(&mm->mmap_sem) as we would | ||
322 | * have already released it in __lock_page_or_retry | ||
323 | * in mm/filemap.c. | ||
324 | */ | ||
325 | |||
326 | goto retry; | ||
327 | } | ||
306 | } | 328 | } |
329 | |||
307 | up_read(&mm->mmap_sem); | 330 | up_read(&mm->mmap_sem); |
308 | return; | 331 | return; |
309 | 332 | ||
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c index 504c0622f729..1fe0429b6314 100644 --- a/arch/sparc/mm/fault_64.c +++ b/arch/sparc/mm/fault_64.c | |||
@@ -279,6 +279,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) | |||
279 | unsigned int insn = 0; | 279 | unsigned int insn = 0; |
280 | int si_code, fault_code, fault; | 280 | int si_code, fault_code, fault; |
281 | unsigned long address, mm_rss; | 281 | unsigned long address, mm_rss; |
282 | unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; | ||
282 | 283 | ||
283 | fault_code = get_thread_fault_code(); | 284 | fault_code = get_thread_fault_code(); |
284 | 285 | ||
@@ -333,6 +334,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) | |||
333 | insn = get_fault_insn(regs, insn); | 334 | insn = get_fault_insn(regs, insn); |
334 | goto handle_kernel_fault; | 335 | goto handle_kernel_fault; |
335 | } | 336 | } |
337 | |||
338 | retry: | ||
336 | down_read(&mm->mmap_sem); | 339 | down_read(&mm->mmap_sem); |
337 | } | 340 | } |
338 | 341 | ||
@@ -423,7 +426,12 @@ good_area: | |||
423 | goto bad_area; | 426 | goto bad_area; |
424 | } | 427 | } |
425 | 428 | ||
426 | fault = handle_mm_fault(mm, vma, address, (fault_code & FAULT_CODE_WRITE) ? FAULT_FLAG_WRITE : 0); | 429 | flags |= ((fault_code & FAULT_CODE_WRITE) ? FAULT_FLAG_WRITE : 0); |
430 | fault = handle_mm_fault(mm, vma, address, flags); | ||
431 | |||
432 | if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) | ||
433 | return; | ||
434 | |||
427 | if (unlikely(fault & VM_FAULT_ERROR)) { | 435 | if (unlikely(fault & VM_FAULT_ERROR)) { |
428 | if (fault & VM_FAULT_OOM) | 436 | if (fault & VM_FAULT_OOM) |
429 | goto out_of_memory; | 437 | goto out_of_memory; |
@@ -431,12 +439,27 @@ good_area: | |||
431 | goto do_sigbus; | 439 | goto do_sigbus; |
432 | BUG(); | 440 | BUG(); |
433 | } | 441 | } |
434 | if (fault & VM_FAULT_MAJOR) { | 442 | |
435 | current->maj_flt++; | 443 | if (flags & FAULT_FLAG_ALLOW_RETRY) { |
436 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address); | 444 | if (fault & VM_FAULT_MAJOR) { |
437 | } else { | 445 | current->maj_flt++; |
438 | current->min_flt++; | 446 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, |
439 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); | 447 | 1, regs, address); |
448 | } else { | ||
449 | current->min_flt++; | ||
450 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, | ||
451 | 1, regs, address); | ||
452 | } | ||
453 | if (fault & VM_FAULT_RETRY) { | ||
454 | flags &= ~FAULT_FLAG_ALLOW_RETRY; | ||
455 | |||
456 | /* No need to up_read(&mm->mmap_sem) as we would | ||
457 | * have already released it in __lock_page_or_retry | ||
458 | * in mm/filemap.c. | ||
459 | */ | ||
460 | |||
461 | goto retry; | ||
462 | } | ||
440 | } | 463 | } |
441 | up_read(&mm->mmap_sem); | 464 | up_read(&mm->mmap_sem); |
442 | 465 | ||
diff --git a/arch/tile/kernel/proc.c b/arch/tile/kernel/proc.c index 7a9327046404..446a7f52cc11 100644 --- a/arch/tile/kernel/proc.c +++ b/arch/tile/kernel/proc.c | |||
@@ -146,7 +146,6 @@ static ctl_table unaligned_table[] = { | |||
146 | }, | 146 | }, |
147 | {} | 147 | {} |
148 | }; | 148 | }; |
149 | #endif | ||
150 | 149 | ||
151 | static struct ctl_path tile_path[] = { | 150 | static struct ctl_path tile_path[] = { |
152 | { .procname = "tile" }, | 151 | { .procname = "tile" }, |
@@ -155,10 +154,9 @@ static struct ctl_path tile_path[] = { | |||
155 | 154 | ||
156 | static int __init proc_sys_tile_init(void) | 155 | static int __init proc_sys_tile_init(void) |
157 | { | 156 | { |
158 | #ifndef __tilegx__ /* FIXME: GX: no support for unaligned access yet */ | ||
159 | register_sysctl_paths(tile_path, unaligned_table); | 157 | register_sysctl_paths(tile_path, unaligned_table); |
160 | #endif | ||
161 | return 0; | 158 | return 0; |
162 | } | 159 | } |
163 | 160 | ||
164 | arch_initcall(proc_sys_tile_init); | 161 | arch_initcall(proc_sys_tile_init); |
162 | #endif | ||
diff --git a/arch/tile/kernel/single_step.c b/arch/tile/kernel/single_step.c index 9efbc1391b3c..89529c9f0605 100644 --- a/arch/tile/kernel/single_step.c +++ b/arch/tile/kernel/single_step.c | |||
@@ -346,12 +346,10 @@ void single_step_once(struct pt_regs *regs) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | /* allocate a cache line of writable, executable memory */ | 348 | /* allocate a cache line of writable, executable memory */ |
349 | down_write(¤t->mm->mmap_sem); | 349 | buffer = (void __user *) vm_mmap(NULL, 0, 64, |
350 | buffer = (void __user *) do_mmap(NULL, 0, 64, | ||
351 | PROT_EXEC | PROT_READ | PROT_WRITE, | 350 | PROT_EXEC | PROT_READ | PROT_WRITE, |
352 | MAP_PRIVATE | MAP_ANONYMOUS, | 351 | MAP_PRIVATE | MAP_ANONYMOUS, |
353 | 0); | 352 | 0); |
354 | up_write(¤t->mm->mmap_sem); | ||
355 | 353 | ||
356 | if (IS_ERR((void __force *)buffer)) { | 354 | if (IS_ERR((void __force *)buffer)) { |
357 | kfree(state); | 355 | kfree(state); |
diff --git a/arch/tile/kernel/smpboot.c b/arch/tile/kernel/smpboot.c index b949edcec200..172aef7d3159 100644 --- a/arch/tile/kernel/smpboot.c +++ b/arch/tile/kernel/smpboot.c | |||
@@ -196,6 +196,8 @@ void __cpuinit online_secondary(void) | |||
196 | /* This must be done before setting cpu_online_mask */ | 196 | /* This must be done before setting cpu_online_mask */ |
197 | wmb(); | 197 | wmb(); |
198 | 198 | ||
199 | notify_cpu_starting(smp_processor_id()); | ||
200 | |||
199 | /* | 201 | /* |
200 | * We need to hold call_lock, so there is no inconsistency | 202 | * We need to hold call_lock, so there is no inconsistency |
201 | * between the time smp_call_function() determines number of | 203 | * between the time smp_call_function() determines number of |
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h index dc36b222100b..6673508f3426 100644 --- a/arch/um/drivers/cow.h +++ b/arch/um/drivers/cow.h | |||
@@ -3,41 +3,6 @@ | |||
3 | 3 | ||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | #if defined(__KERNEL__) | ||
7 | |||
8 | # include <asm/byteorder.h> | ||
9 | |||
10 | # if defined(__BIG_ENDIAN) | ||
11 | # define ntohll(x) (x) | ||
12 | # define htonll(x) (x) | ||
13 | # elif defined(__LITTLE_ENDIAN) | ||
14 | # define ntohll(x) be64_to_cpu(x) | ||
15 | # define htonll(x) cpu_to_be64(x) | ||
16 | # else | ||
17 | # error "Could not determine byte order" | ||
18 | # endif | ||
19 | |||
20 | #else | ||
21 | /* For the definition of ntohl, htonl and __BYTE_ORDER */ | ||
22 | #include <endian.h> | ||
23 | #include <netinet/in.h> | ||
24 | #if defined(__BYTE_ORDER) | ||
25 | |||
26 | # if __BYTE_ORDER == __BIG_ENDIAN | ||
27 | # define ntohll(x) (x) | ||
28 | # define htonll(x) (x) | ||
29 | # elif __BYTE_ORDER == __LITTLE_ENDIAN | ||
30 | # define ntohll(x) bswap_64(x) | ||
31 | # define htonll(x) bswap_64(x) | ||
32 | # else | ||
33 | # error "Could not determine byte order: __BYTE_ORDER uncorrectly defined" | ||
34 | # endif | ||
35 | |||
36 | #else /* ! defined(__BYTE_ORDER) */ | ||
37 | # error "Could not determine byte order: __BYTE_ORDER not defined" | ||
38 | #endif | ||
39 | #endif /* ! defined(__KERNEL__) */ | ||
40 | |||
41 | extern int init_cow_file(int fd, char *cow_file, char *backing_file, | 6 | extern int init_cow_file(int fd, char *cow_file, char *backing_file, |
42 | int sectorsize, int alignment, int *bitmap_offset_out, | 7 | int sectorsize, int alignment, int *bitmap_offset_out, |
43 | unsigned long *bitmap_len_out, int *data_offset_out); | 8 | unsigned long *bitmap_len_out, int *data_offset_out); |
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c index 9cbb426c0b91..0ee9cc6cc4c7 100644 --- a/arch/um/drivers/cow_user.c +++ b/arch/um/drivers/cow_user.c | |||
@@ -8,11 +8,10 @@ | |||
8 | * that. | 8 | * that. |
9 | */ | 9 | */ |
10 | #include <unistd.h> | 10 | #include <unistd.h> |
11 | #include <byteswap.h> | ||
12 | #include <errno.h> | 11 | #include <errno.h> |
13 | #include <string.h> | 12 | #include <string.h> |
14 | #include <arpa/inet.h> | 13 | #include <arpa/inet.h> |
15 | #include <asm/types.h> | 14 | #include <endian.h> |
16 | #include "cow.h" | 15 | #include "cow.h" |
17 | #include "cow_sys.h" | 16 | #include "cow_sys.h" |
18 | 17 | ||
@@ -214,8 +213,8 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, | |||
214 | "header\n"); | 213 | "header\n"); |
215 | goto out; | 214 | goto out; |
216 | } | 215 | } |
217 | header->magic = htonl(COW_MAGIC); | 216 | header->magic = htobe32(COW_MAGIC); |
218 | header->version = htonl(COW_VERSION); | 217 | header->version = htobe32(COW_VERSION); |
219 | 218 | ||
220 | err = -EINVAL; | 219 | err = -EINVAL; |
221 | if (strlen(backing_file) > sizeof(header->backing_file) - 1) { | 220 | if (strlen(backing_file) > sizeof(header->backing_file) - 1) { |
@@ -246,10 +245,10 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, | |||
246 | goto out_free; | 245 | goto out_free; |
247 | } | 246 | } |
248 | 247 | ||
249 | header->mtime = htonl(modtime); | 248 | header->mtime = htobe32(modtime); |
250 | header->size = htonll(*size); | 249 | header->size = htobe64(*size); |
251 | header->sectorsize = htonl(sectorsize); | 250 | header->sectorsize = htobe32(sectorsize); |
252 | header->alignment = htonl(alignment); | 251 | header->alignment = htobe32(alignment); |
253 | header->cow_format = COW_BITMAP; | 252 | header->cow_format = COW_BITMAP; |
254 | 253 | ||
255 | err = cow_write_file(fd, header, sizeof(*header)); | 254 | err = cow_write_file(fd, header, sizeof(*header)); |
@@ -301,8 +300,8 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg, | |||
301 | magic = header->v1.magic; | 300 | magic = header->v1.magic; |
302 | if (magic == COW_MAGIC) | 301 | if (magic == COW_MAGIC) |
303 | version = header->v1.version; | 302 | version = header->v1.version; |
304 | else if (magic == ntohl(COW_MAGIC)) | 303 | else if (magic == be32toh(COW_MAGIC)) |
305 | version = ntohl(header->v1.version); | 304 | version = be32toh(header->v1.version); |
306 | /* No error printed because the non-COW case comes through here */ | 305 | /* No error printed because the non-COW case comes through here */ |
307 | else goto out; | 306 | else goto out; |
308 | 307 | ||
@@ -327,9 +326,9 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg, | |||
327 | "header\n"); | 326 | "header\n"); |
328 | goto out; | 327 | goto out; |
329 | } | 328 | } |
330 | *mtime_out = ntohl(header->v2.mtime); | 329 | *mtime_out = be32toh(header->v2.mtime); |
331 | *size_out = ntohll(header->v2.size); | 330 | *size_out = be64toh(header->v2.size); |
332 | *sectorsize_out = ntohl(header->v2.sectorsize); | 331 | *sectorsize_out = be32toh(header->v2.sectorsize); |
333 | *bitmap_offset_out = sizeof(header->v2); | 332 | *bitmap_offset_out = sizeof(header->v2); |
334 | *align_out = *sectorsize_out; | 333 | *align_out = *sectorsize_out; |
335 | file = header->v2.backing_file; | 334 | file = header->v2.backing_file; |
@@ -341,10 +340,10 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg, | |||
341 | "header\n"); | 340 | "header\n"); |
342 | goto out; | 341 | goto out; |
343 | } | 342 | } |
344 | *mtime_out = ntohl(header->v3.mtime); | 343 | *mtime_out = be32toh(header->v3.mtime); |
345 | *size_out = ntohll(header->v3.size); | 344 | *size_out = be64toh(header->v3.size); |
346 | *sectorsize_out = ntohl(header->v3.sectorsize); | 345 | *sectorsize_out = be32toh(header->v3.sectorsize); |
347 | *align_out = ntohl(header->v3.alignment); | 346 | *align_out = be32toh(header->v3.alignment); |
348 | if (*align_out == 0) { | 347 | if (*align_out == 0) { |
349 | cow_printf("read_cow_header - invalid COW header, " | 348 | cow_printf("read_cow_header - invalid COW header, " |
350 | "align == 0\n"); | 349 | "align == 0\n"); |
@@ -366,16 +365,16 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg, | |||
366 | * this was used until Dec2005 - 64bits are needed to represent | 365 | * this was used until Dec2005 - 64bits are needed to represent |
367 | * 2038+. I.e. we can safely do this truncating cast. | 366 | * 2038+. I.e. we can safely do this truncating cast. |
368 | * | 367 | * |
369 | * Additionally, we must use ntohl() instead of ntohll(), since | 368 | * Additionally, we must use be32toh() instead of be64toh(), since |
370 | * the program used to use the former (tested - I got mtime | 369 | * the program used to use the former (tested - I got mtime |
371 | * mismatch "0 vs whatever"). | 370 | * mismatch "0 vs whatever"). |
372 | * | 371 | * |
373 | * Ever heard about bug-to-bug-compatibility ? ;-) */ | 372 | * Ever heard about bug-to-bug-compatibility ? ;-) */ |
374 | *mtime_out = (time32_t) ntohl(header->v3_b.mtime); | 373 | *mtime_out = (time32_t) be32toh(header->v3_b.mtime); |
375 | 374 | ||
376 | *size_out = ntohll(header->v3_b.size); | 375 | *size_out = be64toh(header->v3_b.size); |
377 | *sectorsize_out = ntohl(header->v3_b.sectorsize); | 376 | *sectorsize_out = be32toh(header->v3_b.sectorsize); |
378 | *align_out = ntohl(header->v3_b.alignment); | 377 | *align_out = be32toh(header->v3_b.alignment); |
379 | if (*align_out == 0) { | 378 | if (*align_out == 0) { |
380 | cow_printf("read_cow_header - invalid COW header, " | 379 | cow_printf("read_cow_header - invalid COW header, " |
381 | "align == 0\n"); | 380 | "align == 0\n"); |
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index e672bd6d43e3..43b39d61b538 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/workqueue.h> | 22 | #include <linux/workqueue.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
25 | #include <asm/switch_to.h> | ||
25 | 26 | ||
26 | #include "init.h" | 27 | #include "init.h" |
27 | #include "irq_kern.h" | 28 | #include "irq_kern.h" |
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild index 8419f5cf2ac7..fff24352255d 100644 --- a/arch/um/include/asm/Kbuild +++ b/arch/um/include/asm/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h | 1 | generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h |
2 | generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h | 2 | generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h |
3 | generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h | 3 | generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h |
4 | generic-y += switch_to.h | ||
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index 492bc4c1b62b..65a1c3d690ea 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile | |||
@@ -3,9 +3,10 @@ | |||
3 | # Licensed under the GPL | 3 | # Licensed under the GPL |
4 | # | 4 | # |
5 | 5 | ||
6 | CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START) \ | 6 | CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START) \ |
7 | -DELF_ARCH=$(LDS_ELF_ARCH) \ | 7 | -DELF_ARCH=$(LDS_ELF_ARCH) \ |
8 | -DELF_FORMAT=$(LDS_ELF_FORMAT) | 8 | -DELF_FORMAT=$(LDS_ELF_FORMAT) \ |
9 | $(LDS_EXTRA) | ||
9 | extra-y := vmlinux.lds | 10 | extra-y := vmlinux.lds |
10 | clean-files := | 11 | clean-files := |
11 | 12 | ||
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index f386d04a84a5..2b73dedb44ca 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -88,11 +88,8 @@ static inline void set_current(struct task_struct *task) | |||
88 | 88 | ||
89 | extern void arch_switch_to(struct task_struct *to); | 89 | extern void arch_switch_to(struct task_struct *to); |
90 | 90 | ||
91 | void *_switch_to(void *prev, void *next, void *last) | 91 | void *__switch_to(struct task_struct *from, struct task_struct *to) |
92 | { | 92 | { |
93 | struct task_struct *from = prev; | ||
94 | struct task_struct *to = next; | ||
95 | |||
96 | to->thread.prev_sched = from; | 93 | to->thread.prev_sched = from; |
97 | set_current(to); | 94 | set_current(to); |
98 | 95 | ||
@@ -111,7 +108,6 @@ void *_switch_to(void *prev, void *next, void *last) | |||
111 | } while (current->thread.saved_task); | 108 | } while (current->thread.saved_task); |
112 | 109 | ||
113 | return current->thread.prev_sched; | 110 | return current->thread.prev_sched; |
114 | |||
115 | } | 111 | } |
116 | 112 | ||
117 | void interrupt_end(void) | 113 | void interrupt_end(void) |
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index 4947b319f53a..0a49ef0c2bf4 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c | |||
@@ -103,7 +103,6 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm) | |||
103 | 103 | ||
104 | void uml_setup_stubs(struct mm_struct *mm) | 104 | void uml_setup_stubs(struct mm_struct *mm) |
105 | { | 105 | { |
106 | struct page **pages; | ||
107 | int err, ret; | 106 | int err, ret; |
108 | 107 | ||
109 | if (!skas_needs_stub) | 108 | if (!skas_needs_stub) |
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um index 4be406abeefd..36b62bc52638 100644 --- a/arch/x86/Makefile.um +++ b/arch/x86/Makefile.um | |||
@@ -14,6 +14,9 @@ LINK-y += $(call cc-option,-m32) | |||
14 | 14 | ||
15 | export LDFLAGS | 15 | export LDFLAGS |
16 | 16 | ||
17 | LDS_EXTRA := -Ui386 | ||
18 | export LDS_EXTRA | ||
19 | |||
17 | # First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. | 20 | # First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. |
18 | include $(srctree)/arch/x86/Makefile_32.cpu | 21 | include $(srctree)/arch/x86/Makefile_32.cpu |
19 | 22 | ||
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index d511d951a052..4824fb45560f 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -119,9 +119,7 @@ static void set_brk(unsigned long start, unsigned long end) | |||
119 | end = PAGE_ALIGN(end); | 119 | end = PAGE_ALIGN(end); |
120 | if (end <= start) | 120 | if (end <= start) |
121 | return; | 121 | return; |
122 | down_write(¤t->mm->mmap_sem); | 122 | vm_brk(start, end - start); |
123 | do_brk(start, end - start); | ||
124 | up_write(¤t->mm->mmap_sem); | ||
125 | } | 123 | } |
126 | 124 | ||
127 | #ifdef CORE_DUMP | 125 | #ifdef CORE_DUMP |
@@ -332,9 +330,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
332 | pos = 32; | 330 | pos = 32; |
333 | map_size = ex.a_text+ex.a_data; | 331 | map_size = ex.a_text+ex.a_data; |
334 | 332 | ||
335 | down_write(¤t->mm->mmap_sem); | 333 | error = vm_brk(text_addr & PAGE_MASK, map_size); |
336 | error = do_brk(text_addr & PAGE_MASK, map_size); | ||
337 | up_write(¤t->mm->mmap_sem); | ||
338 | 334 | ||
339 | if (error != (text_addr & PAGE_MASK)) { | 335 | if (error != (text_addr & PAGE_MASK)) { |
340 | send_sig(SIGKILL, current, 0); | 336 | send_sig(SIGKILL, current, 0); |
@@ -373,9 +369,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
373 | if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { | 369 | if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { |
374 | loff_t pos = fd_offset; | 370 | loff_t pos = fd_offset; |
375 | 371 | ||
376 | down_write(¤t->mm->mmap_sem); | 372 | vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); |
377 | do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); | ||
378 | up_write(¤t->mm->mmap_sem); | ||
379 | bprm->file->f_op->read(bprm->file, | 373 | bprm->file->f_op->read(bprm->file, |
380 | (char __user *)N_TXTADDR(ex), | 374 | (char __user *)N_TXTADDR(ex), |
381 | ex.a_text+ex.a_data, &pos); | 375 | ex.a_text+ex.a_data, &pos); |
@@ -385,26 +379,22 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
385 | goto beyond_if; | 379 | goto beyond_if; |
386 | } | 380 | } |
387 | 381 | ||
388 | down_write(¤t->mm->mmap_sem); | 382 | error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, |
389 | error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, | ||
390 | PROT_READ | PROT_EXEC, | 383 | PROT_READ | PROT_EXEC, |
391 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | | 384 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | |
392 | MAP_EXECUTABLE | MAP_32BIT, | 385 | MAP_EXECUTABLE | MAP_32BIT, |
393 | fd_offset); | 386 | fd_offset); |
394 | up_write(¤t->mm->mmap_sem); | ||
395 | 387 | ||
396 | if (error != N_TXTADDR(ex)) { | 388 | if (error != N_TXTADDR(ex)) { |
397 | send_sig(SIGKILL, current, 0); | 389 | send_sig(SIGKILL, current, 0); |
398 | return error; | 390 | return error; |
399 | } | 391 | } |
400 | 392 | ||
401 | down_write(¤t->mm->mmap_sem); | 393 | error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data, |
402 | error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data, | ||
403 | PROT_READ | PROT_WRITE | PROT_EXEC, | 394 | PROT_READ | PROT_WRITE | PROT_EXEC, |
404 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | | 395 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | |
405 | MAP_EXECUTABLE | MAP_32BIT, | 396 | MAP_EXECUTABLE | MAP_32BIT, |
406 | fd_offset + ex.a_text); | 397 | fd_offset + ex.a_text); |
407 | up_write(¤t->mm->mmap_sem); | ||
408 | if (error != N_DATADDR(ex)) { | 398 | if (error != N_DATADDR(ex)) { |
409 | send_sig(SIGKILL, current, 0); | 399 | send_sig(SIGKILL, current, 0); |
410 | return error; | 400 | return error; |
@@ -476,9 +466,7 @@ static int load_aout_library(struct file *file) | |||
476 | error_time = jiffies; | 466 | error_time = jiffies; |
477 | } | 467 | } |
478 | #endif | 468 | #endif |
479 | down_write(¤t->mm->mmap_sem); | 469 | vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); |
480 | do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); | ||
481 | up_write(¤t->mm->mmap_sem); | ||
482 | 470 | ||
483 | file->f_op->read(file, (char __user *)start_addr, | 471 | file->f_op->read(file, (char __user *)start_addr, |
484 | ex.a_text + ex.a_data, &pos); | 472 | ex.a_text + ex.a_data, &pos); |
@@ -490,12 +478,10 @@ static int load_aout_library(struct file *file) | |||
490 | goto out; | 478 | goto out; |
491 | } | 479 | } |
492 | /* Now use mmap to map the library into memory. */ | 480 | /* Now use mmap to map the library into memory. */ |
493 | down_write(¤t->mm->mmap_sem); | 481 | error = vm_mmap(file, start_addr, ex.a_text + ex.a_data, |
494 | error = do_mmap(file, start_addr, ex.a_text + ex.a_data, | ||
495 | PROT_READ | PROT_WRITE | PROT_EXEC, | 482 | PROT_READ | PROT_WRITE | PROT_EXEC, |
496 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT, | 483 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT, |
497 | N_TXTOFF(ex)); | 484 | N_TXTOFF(ex)); |
498 | up_write(¤t->mm->mmap_sem); | ||
499 | retval = error; | 485 | retval = error; |
500 | if (error != start_addr) | 486 | if (error != start_addr) |
501 | goto out; | 487 | goto out; |
@@ -503,9 +489,7 @@ static int load_aout_library(struct file *file) | |||
503 | len = PAGE_ALIGN(ex.a_text + ex.a_data); | 489 | len = PAGE_ALIGN(ex.a_text + ex.a_data); |
504 | bss = ex.a_text + ex.a_data + ex.a_bss; | 490 | bss = ex.a_text + ex.a_data + ex.a_bss; |
505 | if (bss > len) { | 491 | if (bss > len) { |
506 | down_write(¤t->mm->mmap_sem); | 492 | error = vm_brk(start_addr + len, bss - len); |
507 | error = do_brk(start_addr + len, bss - len); | ||
508 | up_write(¤t->mm->mmap_sem); | ||
509 | retval = error; | 493 | retval = error; |
510 | if (error != start_addr + len) | 494 | if (error != start_addr + len) |
511 | goto out; | 495 | goto out; |
diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h index b3b733262909..99480e55973d 100644 --- a/arch/x86/include/asm/cmpxchg.h +++ b/arch/x86/include/asm/cmpxchg.h | |||
@@ -43,7 +43,7 @@ extern void __add_wrong_size(void) | |||
43 | switch (sizeof(*(ptr))) { \ | 43 | switch (sizeof(*(ptr))) { \ |
44 | case __X86_CASE_B: \ | 44 | case __X86_CASE_B: \ |
45 | asm volatile (lock #op "b %b0, %1\n" \ | 45 | asm volatile (lock #op "b %b0, %1\n" \ |
46 | : "+r" (__ret), "+m" (*(ptr)) \ | 46 | : "+q" (__ret), "+m" (*(ptr)) \ |
47 | : : "memory", "cc"); \ | 47 | : : "memory", "cc"); \ |
48 | break; \ | 48 | break; \ |
49 | case __X86_CASE_W: \ | 49 | case __X86_CASE_W: \ |
@@ -173,7 +173,7 @@ extern void __add_wrong_size(void) | |||
173 | switch (sizeof(*(ptr))) { \ | 173 | switch (sizeof(*(ptr))) { \ |
174 | case __X86_CASE_B: \ | 174 | case __X86_CASE_B: \ |
175 | asm volatile (lock "addb %b1, %0\n" \ | 175 | asm volatile (lock "addb %b1, %0\n" \ |
176 | : "+m" (*(ptr)) : "ri" (inc) \ | 176 | : "+m" (*(ptr)) : "qi" (inc) \ |
177 | : "memory", "cc"); \ | 177 | : "memory", "cc"); \ |
178 | break; \ | 178 | break; \ |
179 | case __X86_CASE_W: \ | 179 | case __X86_CASE_W: \ |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 8be5f54d9360..e0544597cfe7 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -557,6 +557,8 @@ struct __large_struct { unsigned long buf[100]; }; | |||
557 | 557 | ||
558 | extern unsigned long | 558 | extern unsigned long |
559 | copy_from_user_nmi(void *to, const void __user *from, unsigned long n); | 559 | copy_from_user_nmi(void *to, const void __user *from, unsigned long n); |
560 | extern __must_check long | ||
561 | strncpy_from_user(char *dst, const char __user *src, long count); | ||
560 | 562 | ||
561 | /* | 563 | /* |
562 | * movsl can be slow when source and dest are not both 8-byte aligned | 564 | * movsl can be slow when source and dest are not both 8-byte aligned |
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h index 566e803cc602..8084bc73b18c 100644 --- a/arch/x86/include/asm/uaccess_32.h +++ b/arch/x86/include/asm/uaccess_32.h | |||
@@ -213,11 +213,6 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
213 | return n; | 213 | return n; |
214 | } | 214 | } |
215 | 215 | ||
216 | long __must_check strncpy_from_user(char *dst, const char __user *src, | ||
217 | long count); | ||
218 | long __must_check __strncpy_from_user(char *dst, | ||
219 | const char __user *src, long count); | ||
220 | |||
221 | /** | 216 | /** |
222 | * strlen_user: - Get the size of a string in user space. | 217 | * strlen_user: - Get the size of a string in user space. |
223 | * @str: The string to measure. | 218 | * @str: The string to measure. |
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h index 1c66d30971ad..fcd4b6f3ef02 100644 --- a/arch/x86/include/asm/uaccess_64.h +++ b/arch/x86/include/asm/uaccess_64.h | |||
@@ -208,10 +208,6 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size) | |||
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | __must_check long | ||
212 | strncpy_from_user(char *dst, const char __user *src, long count); | ||
213 | __must_check long | ||
214 | __strncpy_from_user(char *dst, const char __user *src, long count); | ||
215 | __must_check long strnlen_user(const char __user *str, long n); | 211 | __must_check long strnlen_user(const char __user *str, long n); |
216 | __must_check long __strnlen_user(const char __user *str, long n); | 212 | __must_check long __strnlen_user(const char __user *str, long n); |
217 | __must_check long strlen_user(const char __user *str); | 213 | __must_check long strlen_user(const char __user *str); |
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c index f386dc49f988..7515cf0e1805 100644 --- a/arch/x86/kernel/vsyscall_64.c +++ b/arch/x86/kernel/vsyscall_64.c | |||
@@ -216,9 +216,9 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address) | |||
216 | current_thread_info()->sig_on_uaccess_error = 1; | 216 | current_thread_info()->sig_on_uaccess_error = 1; |
217 | 217 | ||
218 | /* | 218 | /* |
219 | * 0 is a valid user pointer (in the access_ok sense) on 32-bit and | 219 | * NULL is a valid user pointer (in the access_ok sense) on 32-bit and |
220 | * 64-bit, so we don't need to special-case it here. For all the | 220 | * 64-bit, so we don't need to special-case it here. For all the |
221 | * vsyscalls, 0 means "don't write anything" not "write it at | 221 | * vsyscalls, NULL means "don't write anything" not "write it at |
222 | * address 0". | 222 | * address 0". |
223 | */ | 223 | */ |
224 | ret = -EFAULT; | 224 | ret = -EFAULT; |
@@ -247,7 +247,7 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address) | |||
247 | 247 | ||
248 | ret = sys_getcpu((unsigned __user *)regs->di, | 248 | ret = sys_getcpu((unsigned __user *)regs->di, |
249 | (unsigned __user *)regs->si, | 249 | (unsigned __user *)regs->si, |
250 | 0); | 250 | NULL); |
251 | break; | 251 | break; |
252 | } | 252 | } |
253 | 253 | ||
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 173df38dbda5..2e88438ffd83 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c | |||
@@ -459,17 +459,17 @@ void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu) | |||
459 | pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1); | 459 | pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1); |
460 | 460 | ||
461 | if (pmu->version == 1) { | 461 | if (pmu->version == 1) { |
462 | pmu->global_ctrl = (1 << pmu->nr_arch_gp_counters) - 1; | 462 | pmu->nr_arch_fixed_counters = 0; |
463 | return; | 463 | } else { |
464 | pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), | ||
465 | X86_PMC_MAX_FIXED); | ||
466 | pmu->counter_bitmask[KVM_PMC_FIXED] = | ||
467 | ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1; | ||
464 | } | 468 | } |
465 | 469 | ||
466 | pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), | 470 | pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) | |
467 | X86_PMC_MAX_FIXED); | 471 | (((1ull << pmu->nr_arch_fixed_counters) - 1) << X86_PMC_IDX_FIXED); |
468 | pmu->counter_bitmask[KVM_PMC_FIXED] = | 472 | pmu->global_ctrl_mask = ~pmu->global_ctrl; |
469 | ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1; | ||
470 | pmu->global_ctrl_mask = ~(((1 << pmu->nr_arch_gp_counters) - 1) | ||
471 | | (((1ull << pmu->nr_arch_fixed_counters) - 1) | ||
472 | << X86_PMC_IDX_FIXED)); | ||
473 | } | 473 | } |
474 | 474 | ||
475 | void kvm_pmu_init(struct kvm_vcpu *vcpu) | 475 | void kvm_pmu_init(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ad85adfef843..4ff0ab9bc3c8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2210,9 +2210,12 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) | |||
2210 | msr = find_msr_entry(vmx, msr_index); | 2210 | msr = find_msr_entry(vmx, msr_index); |
2211 | if (msr) { | 2211 | if (msr) { |
2212 | msr->data = data; | 2212 | msr->data = data; |
2213 | if (msr - vmx->guest_msrs < vmx->save_nmsrs) | 2213 | if (msr - vmx->guest_msrs < vmx->save_nmsrs) { |
2214 | preempt_disable(); | ||
2214 | kvm_set_shared_msr(msr->index, msr->data, | 2215 | kvm_set_shared_msr(msr->index, msr->data, |
2215 | msr->mask); | 2216 | msr->mask); |
2217 | preempt_enable(); | ||
2218 | } | ||
2216 | break; | 2219 | break; |
2217 | } | 2220 | } |
2218 | ret = kvm_set_msr_common(vcpu, msr_index, data); | 2221 | ret = kvm_set_msr_common(vcpu, msr_index, data); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 4044ce0bf7c1..91a5e989abcf 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -6336,13 +6336,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, | |||
6336 | if (npages && !old.rmap) { | 6336 | if (npages && !old.rmap) { |
6337 | unsigned long userspace_addr; | 6337 | unsigned long userspace_addr; |
6338 | 6338 | ||
6339 | down_write(¤t->mm->mmap_sem); | 6339 | userspace_addr = vm_mmap(NULL, 0, |
6340 | userspace_addr = do_mmap(NULL, 0, | ||
6341 | npages * PAGE_SIZE, | 6340 | npages * PAGE_SIZE, |
6342 | PROT_READ | PROT_WRITE, | 6341 | PROT_READ | PROT_WRITE, |
6343 | map_flags, | 6342 | map_flags, |
6344 | 0); | 6343 | 0); |
6345 | up_write(¤t->mm->mmap_sem); | ||
6346 | 6344 | ||
6347 | if (IS_ERR((void *)userspace_addr)) | 6345 | if (IS_ERR((void *)userspace_addr)) |
6348 | return PTR_ERR((void *)userspace_addr); | 6346 | return PTR_ERR((void *)userspace_addr); |
@@ -6366,10 +6364,8 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, | |||
6366 | if (!user_alloc && !old.user_alloc && old.rmap && !npages) { | 6364 | if (!user_alloc && !old.user_alloc && old.rmap && !npages) { |
6367 | int ret; | 6365 | int ret; |
6368 | 6366 | ||
6369 | down_write(¤t->mm->mmap_sem); | 6367 | ret = vm_munmap(old.userspace_addr, |
6370 | ret = do_munmap(current->mm, old.userspace_addr, | ||
6371 | old.npages * PAGE_SIZE); | 6368 | old.npages * PAGE_SIZE); |
6372 | up_write(¤t->mm->mmap_sem); | ||
6373 | if (ret < 0) | 6369 | if (ret < 0) |
6374 | printk(KERN_WARNING | 6370 | printk(KERN_WARNING |
6375 | "kvm_vm_ioctl_set_memory_region: " | 6371 | "kvm_vm_ioctl_set_memory_region: " |
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c index 25feb1ae71c5..b1e6c4b2e8eb 100644 --- a/arch/x86/lib/insn.c +++ b/arch/x86/lib/insn.c | |||
@@ -379,8 +379,8 @@ err_out: | |||
379 | return; | 379 | return; |
380 | } | 380 | } |
381 | 381 | ||
382 | /* Decode moffset16/32/64 */ | 382 | /* Decode moffset16/32/64. Return 0 if failed */ |
383 | static void __get_moffset(struct insn *insn) | 383 | static int __get_moffset(struct insn *insn) |
384 | { | 384 | { |
385 | switch (insn->addr_bytes) { | 385 | switch (insn->addr_bytes) { |
386 | case 2: | 386 | case 2: |
@@ -397,15 +397,19 @@ static void __get_moffset(struct insn *insn) | |||
397 | insn->moffset2.value = get_next(int, insn); | 397 | insn->moffset2.value = get_next(int, insn); |
398 | insn->moffset2.nbytes = 4; | 398 | insn->moffset2.nbytes = 4; |
399 | break; | 399 | break; |
400 | default: /* opnd_bytes must be modified manually */ | ||
401 | goto err_out; | ||
400 | } | 402 | } |
401 | insn->moffset1.got = insn->moffset2.got = 1; | 403 | insn->moffset1.got = insn->moffset2.got = 1; |
402 | 404 | ||
405 | return 1; | ||
406 | |||
403 | err_out: | 407 | err_out: |
404 | return; | 408 | return 0; |
405 | } | 409 | } |
406 | 410 | ||
407 | /* Decode imm v32(Iz) */ | 411 | /* Decode imm v32(Iz). Return 0 if failed */ |
408 | static void __get_immv32(struct insn *insn) | 412 | static int __get_immv32(struct insn *insn) |
409 | { | 413 | { |
410 | switch (insn->opnd_bytes) { | 414 | switch (insn->opnd_bytes) { |
411 | case 2: | 415 | case 2: |
@@ -417,14 +421,18 @@ static void __get_immv32(struct insn *insn) | |||
417 | insn->immediate.value = get_next(int, insn); | 421 | insn->immediate.value = get_next(int, insn); |
418 | insn->immediate.nbytes = 4; | 422 | insn->immediate.nbytes = 4; |
419 | break; | 423 | break; |
424 | default: /* opnd_bytes must be modified manually */ | ||
425 | goto err_out; | ||
420 | } | 426 | } |
421 | 427 | ||
428 | return 1; | ||
429 | |||
422 | err_out: | 430 | err_out: |
423 | return; | 431 | return 0; |
424 | } | 432 | } |
425 | 433 | ||
426 | /* Decode imm v64(Iv/Ov) */ | 434 | /* Decode imm v64(Iv/Ov), Return 0 if failed */ |
427 | static void __get_immv(struct insn *insn) | 435 | static int __get_immv(struct insn *insn) |
428 | { | 436 | { |
429 | switch (insn->opnd_bytes) { | 437 | switch (insn->opnd_bytes) { |
430 | case 2: | 438 | case 2: |
@@ -441,15 +449,18 @@ static void __get_immv(struct insn *insn) | |||
441 | insn->immediate2.value = get_next(int, insn); | 449 | insn->immediate2.value = get_next(int, insn); |
442 | insn->immediate2.nbytes = 4; | 450 | insn->immediate2.nbytes = 4; |
443 | break; | 451 | break; |
452 | default: /* opnd_bytes must be modified manually */ | ||
453 | goto err_out; | ||
444 | } | 454 | } |
445 | insn->immediate1.got = insn->immediate2.got = 1; | 455 | insn->immediate1.got = insn->immediate2.got = 1; |
446 | 456 | ||
457 | return 1; | ||
447 | err_out: | 458 | err_out: |
448 | return; | 459 | return 0; |
449 | } | 460 | } |
450 | 461 | ||
451 | /* Decode ptr16:16/32(Ap) */ | 462 | /* Decode ptr16:16/32(Ap) */ |
452 | static void __get_immptr(struct insn *insn) | 463 | static int __get_immptr(struct insn *insn) |
453 | { | 464 | { |
454 | switch (insn->opnd_bytes) { | 465 | switch (insn->opnd_bytes) { |
455 | case 2: | 466 | case 2: |
@@ -462,14 +473,17 @@ static void __get_immptr(struct insn *insn) | |||
462 | break; | 473 | break; |
463 | case 8: | 474 | case 8: |
464 | /* ptr16:64 is not exist (no segment) */ | 475 | /* ptr16:64 is not exist (no segment) */ |
465 | return; | 476 | return 0; |
477 | default: /* opnd_bytes must be modified manually */ | ||
478 | goto err_out; | ||
466 | } | 479 | } |
467 | insn->immediate2.value = get_next(unsigned short, insn); | 480 | insn->immediate2.value = get_next(unsigned short, insn); |
468 | insn->immediate2.nbytes = 2; | 481 | insn->immediate2.nbytes = 2; |
469 | insn->immediate1.got = insn->immediate2.got = 1; | 482 | insn->immediate1.got = insn->immediate2.got = 1; |
470 | 483 | ||
484 | return 1; | ||
471 | err_out: | 485 | err_out: |
472 | return; | 486 | return 0; |
473 | } | 487 | } |
474 | 488 | ||
475 | /** | 489 | /** |
@@ -489,7 +503,8 @@ void insn_get_immediate(struct insn *insn) | |||
489 | insn_get_displacement(insn); | 503 | insn_get_displacement(insn); |
490 | 504 | ||
491 | if (inat_has_moffset(insn->attr)) { | 505 | if (inat_has_moffset(insn->attr)) { |
492 | __get_moffset(insn); | 506 | if (!__get_moffset(insn)) |
507 | goto err_out; | ||
493 | goto done; | 508 | goto done; |
494 | } | 509 | } |
495 | 510 | ||
@@ -517,16 +532,20 @@ void insn_get_immediate(struct insn *insn) | |||
517 | insn->immediate2.nbytes = 4; | 532 | insn->immediate2.nbytes = 4; |
518 | break; | 533 | break; |
519 | case INAT_IMM_PTR: | 534 | case INAT_IMM_PTR: |
520 | __get_immptr(insn); | 535 | if (!__get_immptr(insn)) |
536 | goto err_out; | ||
521 | break; | 537 | break; |
522 | case INAT_IMM_VWORD32: | 538 | case INAT_IMM_VWORD32: |
523 | __get_immv32(insn); | 539 | if (!__get_immv32(insn)) |
540 | goto err_out; | ||
524 | break; | 541 | break; |
525 | case INAT_IMM_VWORD: | 542 | case INAT_IMM_VWORD: |
526 | __get_immv(insn); | 543 | if (!__get_immv(insn)) |
544 | goto err_out; | ||
527 | break; | 545 | break; |
528 | default: | 546 | default: |
529 | break; | 547 | /* Here, insn must have an immediate, but failed */ |
548 | goto err_out; | ||
530 | } | 549 | } |
531 | if (inat_has_second_immediate(insn->attr)) { | 550 | if (inat_has_second_immediate(insn->attr)) { |
532 | insn->immediate2.value = get_next(char, insn); | 551 | insn->immediate2.value = get_next(char, insn); |
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c index 97be9cb54483..d6ae30bbd7bb 100644 --- a/arch/x86/lib/usercopy.c +++ b/arch/x86/lib/usercopy.c | |||
@@ -7,6 +7,8 @@ | |||
7 | #include <linux/highmem.h> | 7 | #include <linux/highmem.h> |
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | 9 | ||
10 | #include <asm/word-at-a-time.h> | ||
11 | |||
10 | /* | 12 | /* |
11 | * best effort, GUP based copy_from_user() that is NMI-safe | 13 | * best effort, GUP based copy_from_user() that is NMI-safe |
12 | */ | 14 | */ |
@@ -41,3 +43,104 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n) | |||
41 | return len; | 43 | return len; |
42 | } | 44 | } |
43 | EXPORT_SYMBOL_GPL(copy_from_user_nmi); | 45 | EXPORT_SYMBOL_GPL(copy_from_user_nmi); |
46 | |||
47 | static inline unsigned long count_bytes(unsigned long mask) | ||
48 | { | ||
49 | mask = (mask - 1) & ~mask; | ||
50 | mask >>= 7; | ||
51 | return count_masked_bytes(mask); | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * Do a strncpy, return length of string without final '\0'. | ||
56 | * 'count' is the user-supplied count (return 'count' if we | ||
57 | * hit it), 'max' is the address space maximum (and we return | ||
58 | * -EFAULT if we hit it). | ||
59 | */ | ||
60 | static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max) | ||
61 | { | ||
62 | long res = 0; | ||
63 | |||
64 | /* | ||
65 | * Truncate 'max' to the user-specified limit, so that | ||
66 | * we only have one limit we need to check in the loop | ||
67 | */ | ||
68 | if (max > count) | ||
69 | max = count; | ||
70 | |||
71 | while (max >= sizeof(unsigned long)) { | ||
72 | unsigned long c; | ||
73 | |||
74 | /* Fall back to byte-at-a-time if we get a page fault */ | ||
75 | if (unlikely(__get_user(c,(unsigned long __user *)(src+res)))) | ||
76 | break; | ||
77 | /* This can write a few bytes past the NUL character, but that's ok */ | ||
78 | *(unsigned long *)(dst+res) = c; | ||
79 | c = has_zero(c); | ||
80 | if (c) | ||
81 | return res + count_bytes(c); | ||
82 | res += sizeof(unsigned long); | ||
83 | max -= sizeof(unsigned long); | ||
84 | } | ||
85 | |||
86 | while (max) { | ||
87 | char c; | ||
88 | |||
89 | if (unlikely(__get_user(c,src+res))) | ||
90 | return -EFAULT; | ||
91 | dst[res] = c; | ||
92 | if (!c) | ||
93 | return res; | ||
94 | res++; | ||
95 | max--; | ||
96 | } | ||
97 | |||
98 | /* | ||
99 | * Uhhuh. We hit 'max'. But was that the user-specified maximum | ||
100 | * too? If so, that's ok - we got as much as the user asked for. | ||
101 | */ | ||
102 | if (res >= count) | ||
103 | return res; | ||
104 | |||
105 | /* | ||
106 | * Nope: we hit the address space limit, and we still had more | ||
107 | * characters the caller would have wanted. That's an EFAULT. | ||
108 | */ | ||
109 | return -EFAULT; | ||
110 | } | ||
111 | |||
112 | /** | ||
113 | * strncpy_from_user: - Copy a NUL terminated string from userspace. | ||
114 | * @dst: Destination address, in kernel space. This buffer must be at | ||
115 | * least @count bytes long. | ||
116 | * @src: Source address, in user space. | ||
117 | * @count: Maximum number of bytes to copy, including the trailing NUL. | ||
118 | * | ||
119 | * Copies a NUL-terminated string from userspace to kernel space. | ||
120 | * | ||
121 | * On success, returns the length of the string (not including the trailing | ||
122 | * NUL). | ||
123 | * | ||
124 | * If access to userspace fails, returns -EFAULT (some data may have been | ||
125 | * copied). | ||
126 | * | ||
127 | * If @count is smaller than the length of the string, copies @count bytes | ||
128 | * and returns @count. | ||
129 | */ | ||
130 | long | ||
131 | strncpy_from_user(char *dst, const char __user *src, long count) | ||
132 | { | ||
133 | unsigned long max_addr, src_addr; | ||
134 | |||
135 | if (unlikely(count <= 0)) | ||
136 | return 0; | ||
137 | |||
138 | max_addr = current_thread_info()->addr_limit.seg; | ||
139 | src_addr = (unsigned long)src; | ||
140 | if (likely(src_addr < max_addr)) { | ||
141 | unsigned long max = max_addr - src_addr; | ||
142 | return do_strncpy_from_user(dst, src, count, max); | ||
143 | } | ||
144 | return -EFAULT; | ||
145 | } | ||
146 | EXPORT_SYMBOL(strncpy_from_user); | ||
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index d9b094ca7aaa..ef2a6a5d78e3 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c | |||
@@ -33,93 +33,6 @@ static inline int __movsl_is_ok(unsigned long a1, unsigned long a2, unsigned lon | |||
33 | __movsl_is_ok((unsigned long)(a1), (unsigned long)(a2), (n)) | 33 | __movsl_is_ok((unsigned long)(a1), (unsigned long)(a2), (n)) |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Copy a null terminated string from userspace. | ||
37 | */ | ||
38 | |||
39 | #define __do_strncpy_from_user(dst, src, count, res) \ | ||
40 | do { \ | ||
41 | int __d0, __d1, __d2; \ | ||
42 | might_fault(); \ | ||
43 | __asm__ __volatile__( \ | ||
44 | " testl %1,%1\n" \ | ||
45 | " jz 2f\n" \ | ||
46 | "0: lodsb\n" \ | ||
47 | " stosb\n" \ | ||
48 | " testb %%al,%%al\n" \ | ||
49 | " jz 1f\n" \ | ||
50 | " decl %1\n" \ | ||
51 | " jnz 0b\n" \ | ||
52 | "1: subl %1,%0\n" \ | ||
53 | "2:\n" \ | ||
54 | ".section .fixup,\"ax\"\n" \ | ||
55 | "3: movl %5,%0\n" \ | ||
56 | " jmp 2b\n" \ | ||
57 | ".previous\n" \ | ||
58 | _ASM_EXTABLE(0b,3b) \ | ||
59 | : "=&d"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \ | ||
60 | "=&D" (__d2) \ | ||
61 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ | ||
62 | : "memory"); \ | ||
63 | } while (0) | ||
64 | |||
65 | /** | ||
66 | * __strncpy_from_user: - Copy a NUL terminated string from userspace, with less checking. | ||
67 | * @dst: Destination address, in kernel space. This buffer must be at | ||
68 | * least @count bytes long. | ||
69 | * @src: Source address, in user space. | ||
70 | * @count: Maximum number of bytes to copy, including the trailing NUL. | ||
71 | * | ||
72 | * Copies a NUL-terminated string from userspace to kernel space. | ||
73 | * Caller must check the specified block with access_ok() before calling | ||
74 | * this function. | ||
75 | * | ||
76 | * On success, returns the length of the string (not including the trailing | ||
77 | * NUL). | ||
78 | * | ||
79 | * If access to userspace fails, returns -EFAULT (some data may have been | ||
80 | * copied). | ||
81 | * | ||
82 | * If @count is smaller than the length of the string, copies @count bytes | ||
83 | * and returns @count. | ||
84 | */ | ||
85 | long | ||
86 | __strncpy_from_user(char *dst, const char __user *src, long count) | ||
87 | { | ||
88 | long res; | ||
89 | __do_strncpy_from_user(dst, src, count, res); | ||
90 | return res; | ||
91 | } | ||
92 | EXPORT_SYMBOL(__strncpy_from_user); | ||
93 | |||
94 | /** | ||
95 | * strncpy_from_user: - Copy a NUL terminated string from userspace. | ||
96 | * @dst: Destination address, in kernel space. This buffer must be at | ||
97 | * least @count bytes long. | ||
98 | * @src: Source address, in user space. | ||
99 | * @count: Maximum number of bytes to copy, including the trailing NUL. | ||
100 | * | ||
101 | * Copies a NUL-terminated string from userspace to kernel space. | ||
102 | * | ||
103 | * On success, returns the length of the string (not including the trailing | ||
104 | * NUL). | ||
105 | * | ||
106 | * If access to userspace fails, returns -EFAULT (some data may have been | ||
107 | * copied). | ||
108 | * | ||
109 | * If @count is smaller than the length of the string, copies @count bytes | ||
110 | * and returns @count. | ||
111 | */ | ||
112 | long | ||
113 | strncpy_from_user(char *dst, const char __user *src, long count) | ||
114 | { | ||
115 | long res = -EFAULT; | ||
116 | if (access_ok(VERIFY_READ, src, 1)) | ||
117 | __do_strncpy_from_user(dst, src, count, res); | ||
118 | return res; | ||
119 | } | ||
120 | EXPORT_SYMBOL(strncpy_from_user); | ||
121 | |||
122 | /* | ||
123 | * Zero Userspace | 36 | * Zero Userspace |
124 | */ | 37 | */ |
125 | 38 | ||
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c index b7c2849ffb66..0d0326f388c0 100644 --- a/arch/x86/lib/usercopy_64.c +++ b/arch/x86/lib/usercopy_64.c | |||
@@ -9,55 +9,6 @@ | |||
9 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * Copy a null terminated string from userspace. | ||
13 | */ | ||
14 | |||
15 | #define __do_strncpy_from_user(dst,src,count,res) \ | ||
16 | do { \ | ||
17 | long __d0, __d1, __d2; \ | ||
18 | might_fault(); \ | ||
19 | __asm__ __volatile__( \ | ||
20 | " testq %1,%1\n" \ | ||
21 | " jz 2f\n" \ | ||
22 | "0: lodsb\n" \ | ||
23 | " stosb\n" \ | ||
24 | " testb %%al,%%al\n" \ | ||
25 | " jz 1f\n" \ | ||
26 | " decq %1\n" \ | ||
27 | " jnz 0b\n" \ | ||
28 | "1: subq %1,%0\n" \ | ||
29 | "2:\n" \ | ||
30 | ".section .fixup,\"ax\"\n" \ | ||
31 | "3: movq %5,%0\n" \ | ||
32 | " jmp 2b\n" \ | ||
33 | ".previous\n" \ | ||
34 | _ASM_EXTABLE(0b,3b) \ | ||
35 | : "=&r"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \ | ||
36 | "=&D" (__d2) \ | ||
37 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ | ||
38 | : "memory"); \ | ||
39 | } while (0) | ||
40 | |||
41 | long | ||
42 | __strncpy_from_user(char *dst, const char __user *src, long count) | ||
43 | { | ||
44 | long res; | ||
45 | __do_strncpy_from_user(dst, src, count, res); | ||
46 | return res; | ||
47 | } | ||
48 | EXPORT_SYMBOL(__strncpy_from_user); | ||
49 | |||
50 | long | ||
51 | strncpy_from_user(char *dst, const char __user *src, long count) | ||
52 | { | ||
53 | long res = -EFAULT; | ||
54 | if (access_ok(VERIFY_READ, src, 1)) | ||
55 | return __strncpy_from_user(dst, src, count); | ||
56 | return res; | ||
57 | } | ||
58 | EXPORT_SYMBOL(strncpy_from_user); | ||
59 | |||
60 | /* | ||
61 | * Zero Userspace | 12 | * Zero Userspace |
62 | */ | 13 | */ |
63 | 14 | ||
diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h new file mode 100644 index 000000000000..7d01b8c56c00 --- /dev/null +++ b/arch/x86/um/asm/barrier.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef _ASM_UM_BARRIER_H_ | ||
2 | #define _ASM_UM_BARRIER_H_ | ||
3 | |||
4 | #include <asm/asm.h> | ||
5 | #include <asm/segment.h> | ||
6 | #include <asm/cpufeature.h> | ||
7 | #include <asm/cmpxchg.h> | ||
8 | #include <asm/nops.h> | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/irqflags.h> | ||
12 | |||
13 | /* | ||
14 | * Force strict CPU ordering. | ||
15 | * And yes, this is required on UP too when we're talking | ||
16 | * to devices. | ||
17 | */ | ||
18 | #ifdef CONFIG_X86_32 | ||
19 | |||
20 | #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2) | ||
21 | #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2) | ||
22 | #define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM) | ||
23 | |||
24 | #else /* CONFIG_X86_32 */ | ||
25 | |||
26 | #define mb() asm volatile("mfence" : : : "memory") | ||
27 | #define rmb() asm volatile("lfence" : : : "memory") | ||
28 | #define wmb() asm volatile("sfence" : : : "memory") | ||
29 | |||
30 | #endif /* CONFIG_X86_32 */ | ||
31 | |||
32 | #define read_barrier_depends() do { } while (0) | ||
33 | |||
34 | #ifdef CONFIG_SMP | ||
35 | |||
36 | #define smp_mb() mb() | ||
37 | #ifdef CONFIG_X86_PPRO_FENCE | ||
38 | #define smp_rmb() rmb() | ||
39 | #else /* CONFIG_X86_PPRO_FENCE */ | ||
40 | #define smp_rmb() barrier() | ||
41 | #endif /* CONFIG_X86_PPRO_FENCE */ | ||
42 | |||
43 | #ifdef CONFIG_X86_OOSTORE | ||
44 | #define smp_wmb() wmb() | ||
45 | #else /* CONFIG_X86_OOSTORE */ | ||
46 | #define smp_wmb() barrier() | ||
47 | #endif /* CONFIG_X86_OOSTORE */ | ||
48 | |||
49 | #define smp_read_barrier_depends() read_barrier_depends() | ||
50 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | ||
51 | |||
52 | #else /* CONFIG_SMP */ | ||
53 | |||
54 | #define smp_mb() barrier() | ||
55 | #define smp_rmb() barrier() | ||
56 | #define smp_wmb() barrier() | ||
57 | #define smp_read_barrier_depends() do { } while (0) | ||
58 | #define set_mb(var, value) do { var = value; barrier(); } while (0) | ||
59 | |||
60 | #endif /* CONFIG_SMP */ | ||
61 | |||
62 | /* | ||
63 | * Stop RDTSC speculation. This is needed when you need to use RDTSC | ||
64 | * (or get_cycles or vread that possibly accesses the TSC) in a defined | ||
65 | * code region. | ||
66 | * | ||
67 | * (Could use an alternative three way for this if there was one.) | ||
68 | */ | ||
69 | static inline void rdtsc_barrier(void) | ||
70 | { | ||
71 | alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC); | ||
72 | alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); | ||
73 | } | ||
74 | |||
75 | #endif | ||
diff --git a/arch/x86/um/asm/system.h b/arch/x86/um/asm/system.h deleted file mode 100644 index a459fd9b7598..000000000000 --- a/arch/x86/um/asm/system.h +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | #ifndef _ASM_X86_SYSTEM_H_ | ||
2 | #define _ASM_X86_SYSTEM_H_ | ||
3 | |||
4 | #include <asm/asm.h> | ||
5 | #include <asm/segment.h> | ||
6 | #include <asm/cpufeature.h> | ||
7 | #include <asm/cmpxchg.h> | ||
8 | #include <asm/nops.h> | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/irqflags.h> | ||
12 | |||
13 | /* entries in ARCH_DLINFO: */ | ||
14 | #ifdef CONFIG_IA32_EMULATION | ||
15 | # define AT_VECTOR_SIZE_ARCH 2 | ||
16 | #else | ||
17 | # define AT_VECTOR_SIZE_ARCH 1 | ||
18 | #endif | ||
19 | |||
20 | extern unsigned long arch_align_stack(unsigned long sp); | ||
21 | |||
22 | void default_idle(void); | ||
23 | |||
24 | /* | ||
25 | * Force strict CPU ordering. | ||
26 | * And yes, this is required on UP too when we're talking | ||
27 | * to devices. | ||
28 | */ | ||
29 | #ifdef CONFIG_X86_32 | ||
30 | /* | ||
31 | * Some non-Intel clones support out of order store. wmb() ceases to be a | ||
32 | * nop for these. | ||
33 | */ | ||
34 | #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2) | ||
35 | #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2) | ||
36 | #define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM) | ||
37 | #else | ||
38 | #define mb() asm volatile("mfence":::"memory") | ||
39 | #define rmb() asm volatile("lfence":::"memory") | ||
40 | #define wmb() asm volatile("sfence" ::: "memory") | ||
41 | #endif | ||
42 | |||
43 | /** | ||
44 | * read_barrier_depends - Flush all pending reads that subsequents reads | ||
45 | * depend on. | ||
46 | * | ||
47 | * No data-dependent reads from memory-like regions are ever reordered | ||
48 | * over this barrier. All reads preceding this primitive are guaranteed | ||
49 | * to access memory (but not necessarily other CPUs' caches) before any | ||
50 | * reads following this primitive that depend on the data return by | ||
51 | * any of the preceding reads. This primitive is much lighter weight than | ||
52 | * rmb() on most CPUs, and is never heavier weight than is | ||
53 | * rmb(). | ||
54 | * | ||
55 | * These ordering constraints are respected by both the local CPU | ||
56 | * and the compiler. | ||
57 | * | ||
58 | * Ordering is not guaranteed by anything other than these primitives, | ||
59 | * not even by data dependencies. See the documentation for | ||
60 | * memory_barrier() for examples and URLs to more information. | ||
61 | * | ||
62 | * For example, the following code would force ordering (the initial | ||
63 | * value of "a" is zero, "b" is one, and "p" is "&a"): | ||
64 | * | ||
65 | * <programlisting> | ||
66 | * CPU 0 CPU 1 | ||
67 | * | ||
68 | * b = 2; | ||
69 | * memory_barrier(); | ||
70 | * p = &b; q = p; | ||
71 | * read_barrier_depends(); | ||
72 | * d = *q; | ||
73 | * </programlisting> | ||
74 | * | ||
75 | * because the read of "*q" depends on the read of "p" and these | ||
76 | * two reads are separated by a read_barrier_depends(). However, | ||
77 | * the following code, with the same initial values for "a" and "b": | ||
78 | * | ||
79 | * <programlisting> | ||
80 | * CPU 0 CPU 1 | ||
81 | * | ||
82 | * a = 2; | ||
83 | * memory_barrier(); | ||
84 | * b = 3; y = b; | ||
85 | * read_barrier_depends(); | ||
86 | * x = a; | ||
87 | * </programlisting> | ||
88 | * | ||
89 | * does not enforce ordering, since there is no data dependency between | ||
90 | * the read of "a" and the read of "b". Therefore, on some CPUs, such | ||
91 | * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() | ||
92 | * in cases like this where there are no data dependencies. | ||
93 | **/ | ||
94 | |||
95 | #define read_barrier_depends() do { } while (0) | ||
96 | |||
97 | #ifdef CONFIG_SMP | ||
98 | #define smp_mb() mb() | ||
99 | #ifdef CONFIG_X86_PPRO_FENCE | ||
100 | # define smp_rmb() rmb() | ||
101 | #else | ||
102 | # define smp_rmb() barrier() | ||
103 | #endif | ||
104 | #ifdef CONFIG_X86_OOSTORE | ||
105 | # define smp_wmb() wmb() | ||
106 | #else | ||
107 | # define smp_wmb() barrier() | ||
108 | #endif | ||
109 | #define smp_read_barrier_depends() read_barrier_depends() | ||
110 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | ||
111 | #else | ||
112 | #define smp_mb() barrier() | ||
113 | #define smp_rmb() barrier() | ||
114 | #define smp_wmb() barrier() | ||
115 | #define smp_read_barrier_depends() do { } while (0) | ||
116 | #define set_mb(var, value) do { var = value; barrier(); } while (0) | ||
117 | #endif | ||
118 | |||
119 | /* | ||
120 | * Stop RDTSC speculation. This is needed when you need to use RDTSC | ||
121 | * (or get_cycles or vread that possibly accesses the TSC) in a defined | ||
122 | * code region. | ||
123 | * | ||
124 | * (Could use an alternative three way for this if there was one.) | ||
125 | */ | ||
126 | static inline void rdtsc_barrier(void) | ||
127 | { | ||
128 | alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC); | ||
129 | alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); | ||
130 | } | ||
131 | |||
132 | extern void *_switch_to(void *prev, void *next, void *last); | ||
133 | #define switch_to(prev, next, last) prev = _switch_to(prev, next, last) | ||
134 | |||
135 | #endif | ||
diff --git a/block/blk-core.c b/block/blk-core.c index 3a78b00edd71..1f61b74867e4 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -483,7 +483,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) | |||
483 | if (!q) | 483 | if (!q) |
484 | return NULL; | 484 | return NULL; |
485 | 485 | ||
486 | q->id = ida_simple_get(&blk_queue_ida, 0, 0, GFP_KERNEL); | 486 | q->id = ida_simple_get(&blk_queue_ida, 0, 0, gfp_mask); |
487 | if (q->id < 0) | 487 | if (q->id < 0) |
488 | goto fail_q; | 488 | goto fail_q; |
489 | 489 | ||
@@ -1277,7 +1277,8 @@ static bool attempt_plug_merge(struct request_queue *q, struct bio *bio, | |||
1277 | list_for_each_entry_reverse(rq, &plug->list, queuelist) { | 1277 | list_for_each_entry_reverse(rq, &plug->list, queuelist) { |
1278 | int el_ret; | 1278 | int el_ret; |
1279 | 1279 | ||
1280 | (*request_count)++; | 1280 | if (rq->q == q) |
1281 | (*request_count)++; | ||
1281 | 1282 | ||
1282 | if (rq->q != q || !blk_rq_merge_ok(rq, bio)) | 1283 | if (rq->q != q || !blk_rq_merge_ok(rq, bio)) |
1283 | continue; | 1284 | continue; |
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 5eed6a76721d..f2ddb94626bd 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -1218,7 +1218,7 @@ void blk_throtl_drain(struct request_queue *q) | |||
1218 | struct bio_list bl; | 1218 | struct bio_list bl; |
1219 | struct bio *bio; | 1219 | struct bio *bio; |
1220 | 1220 | ||
1221 | WARN_ON_ONCE(!queue_is_locked(q)); | 1221 | queue_lockdep_assert_held(q); |
1222 | 1222 | ||
1223 | bio_list_init(&bl); | 1223 | bio_list_init(&bl); |
1224 | 1224 | ||
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 457295253566..3c38536bd52c 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -295,6 +295,7 @@ struct cfq_data { | |||
295 | unsigned int cfq_slice_idle; | 295 | unsigned int cfq_slice_idle; |
296 | unsigned int cfq_group_idle; | 296 | unsigned int cfq_group_idle; |
297 | unsigned int cfq_latency; | 297 | unsigned int cfq_latency; |
298 | unsigned int cfq_target_latency; | ||
298 | 299 | ||
299 | /* | 300 | /* |
300 | * Fallback dummy cfqq for extreme OOM conditions | 301 | * Fallback dummy cfqq for extreme OOM conditions |
@@ -604,7 +605,7 @@ cfq_group_slice(struct cfq_data *cfqd, struct cfq_group *cfqg) | |||
604 | { | 605 | { |
605 | struct cfq_rb_root *st = &cfqd->grp_service_tree; | 606 | struct cfq_rb_root *st = &cfqd->grp_service_tree; |
606 | 607 | ||
607 | return cfq_target_latency * cfqg->weight / st->total_weight; | 608 | return cfqd->cfq_target_latency * cfqg->weight / st->total_weight; |
608 | } | 609 | } |
609 | 610 | ||
610 | static inline unsigned | 611 | static inline unsigned |
@@ -2271,7 +2272,8 @@ new_workload: | |||
2271 | * to have higher weight. A more accurate thing would be to | 2272 | * to have higher weight. A more accurate thing would be to |
2272 | * calculate system wide asnc/sync ratio. | 2273 | * calculate system wide asnc/sync ratio. |
2273 | */ | 2274 | */ |
2274 | tmp = cfq_target_latency * cfqg_busy_async_queues(cfqd, cfqg); | 2275 | tmp = cfqd->cfq_target_latency * |
2276 | cfqg_busy_async_queues(cfqd, cfqg); | ||
2275 | tmp = tmp/cfqd->busy_queues; | 2277 | tmp = tmp/cfqd->busy_queues; |
2276 | slice = min_t(unsigned, slice, tmp); | 2278 | slice = min_t(unsigned, slice, tmp); |
2277 | 2279 | ||
@@ -3737,6 +3739,7 @@ static void *cfq_init_queue(struct request_queue *q) | |||
3737 | cfqd->cfq_back_penalty = cfq_back_penalty; | 3739 | cfqd->cfq_back_penalty = cfq_back_penalty; |
3738 | cfqd->cfq_slice[0] = cfq_slice_async; | 3740 | cfqd->cfq_slice[0] = cfq_slice_async; |
3739 | cfqd->cfq_slice[1] = cfq_slice_sync; | 3741 | cfqd->cfq_slice[1] = cfq_slice_sync; |
3742 | cfqd->cfq_target_latency = cfq_target_latency; | ||
3740 | cfqd->cfq_slice_async_rq = cfq_slice_async_rq; | 3743 | cfqd->cfq_slice_async_rq = cfq_slice_async_rq; |
3741 | cfqd->cfq_slice_idle = cfq_slice_idle; | 3744 | cfqd->cfq_slice_idle = cfq_slice_idle; |
3742 | cfqd->cfq_group_idle = cfq_group_idle; | 3745 | cfqd->cfq_group_idle = cfq_group_idle; |
@@ -3788,6 +3791,7 @@ SHOW_FUNCTION(cfq_slice_sync_show, cfqd->cfq_slice[1], 1); | |||
3788 | SHOW_FUNCTION(cfq_slice_async_show, cfqd->cfq_slice[0], 1); | 3791 | SHOW_FUNCTION(cfq_slice_async_show, cfqd->cfq_slice[0], 1); |
3789 | SHOW_FUNCTION(cfq_slice_async_rq_show, cfqd->cfq_slice_async_rq, 0); | 3792 | SHOW_FUNCTION(cfq_slice_async_rq_show, cfqd->cfq_slice_async_rq, 0); |
3790 | SHOW_FUNCTION(cfq_low_latency_show, cfqd->cfq_latency, 0); | 3793 | SHOW_FUNCTION(cfq_low_latency_show, cfqd->cfq_latency, 0); |
3794 | SHOW_FUNCTION(cfq_target_latency_show, cfqd->cfq_target_latency, 1); | ||
3791 | #undef SHOW_FUNCTION | 3795 | #undef SHOW_FUNCTION |
3792 | 3796 | ||
3793 | #define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ | 3797 | #define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ |
@@ -3821,6 +3825,7 @@ STORE_FUNCTION(cfq_slice_async_store, &cfqd->cfq_slice[0], 1, UINT_MAX, 1); | |||
3821 | STORE_FUNCTION(cfq_slice_async_rq_store, &cfqd->cfq_slice_async_rq, 1, | 3825 | STORE_FUNCTION(cfq_slice_async_rq_store, &cfqd->cfq_slice_async_rq, 1, |
3822 | UINT_MAX, 0); | 3826 | UINT_MAX, 0); |
3823 | STORE_FUNCTION(cfq_low_latency_store, &cfqd->cfq_latency, 0, 1, 0); | 3827 | STORE_FUNCTION(cfq_low_latency_store, &cfqd->cfq_latency, 0, 1, 0); |
3828 | STORE_FUNCTION(cfq_target_latency_store, &cfqd->cfq_target_latency, 1, UINT_MAX, 1); | ||
3824 | #undef STORE_FUNCTION | 3829 | #undef STORE_FUNCTION |
3825 | 3830 | ||
3826 | #define CFQ_ATTR(name) \ | 3831 | #define CFQ_ATTR(name) \ |
@@ -3838,6 +3843,7 @@ static struct elv_fs_entry cfq_attrs[] = { | |||
3838 | CFQ_ATTR(slice_idle), | 3843 | CFQ_ATTR(slice_idle), |
3839 | CFQ_ATTR(group_idle), | 3844 | CFQ_ATTR(group_idle), |
3840 | CFQ_ATTR(low_latency), | 3845 | CFQ_ATTR(low_latency), |
3846 | CFQ_ATTR(target_latency), | ||
3841 | __ATTR_NULL | 3847 | __ATTR_NULL |
3842 | }; | 3848 | }; |
3843 | 3849 | ||
diff --git a/crypto/Kconfig b/crypto/Kconfig index 21ff9d015432..8e84225c096b 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
@@ -627,7 +627,7 @@ config CRYPTO_BLOWFISH_COMMON | |||
627 | 627 | ||
628 | config CRYPTO_BLOWFISH_X86_64 | 628 | config CRYPTO_BLOWFISH_X86_64 |
629 | tristate "Blowfish cipher algorithm (x86_64)" | 629 | tristate "Blowfish cipher algorithm (x86_64)" |
630 | depends on (X86 || UML_X86) && 64BIT | 630 | depends on X86 && 64BIT |
631 | select CRYPTO_ALGAPI | 631 | select CRYPTO_ALGAPI |
632 | select CRYPTO_BLOWFISH_COMMON | 632 | select CRYPTO_BLOWFISH_COMMON |
633 | help | 633 | help |
@@ -657,7 +657,7 @@ config CRYPTO_CAMELLIA | |||
657 | 657 | ||
658 | config CRYPTO_CAMELLIA_X86_64 | 658 | config CRYPTO_CAMELLIA_X86_64 |
659 | tristate "Camellia cipher algorithm (x86_64)" | 659 | tristate "Camellia cipher algorithm (x86_64)" |
660 | depends on (X86 || UML_X86) && 64BIT | 660 | depends on X86 && 64BIT |
661 | depends on CRYPTO | 661 | depends on CRYPTO |
662 | select CRYPTO_ALGAPI | 662 | select CRYPTO_ALGAPI |
663 | select CRYPTO_LRW | 663 | select CRYPTO_LRW |
@@ -893,7 +893,7 @@ config CRYPTO_TWOFISH_X86_64 | |||
893 | 893 | ||
894 | config CRYPTO_TWOFISH_X86_64_3WAY | 894 | config CRYPTO_TWOFISH_X86_64_3WAY |
895 | tristate "Twofish cipher algorithm (x86_64, 3-way parallel)" | 895 | tristate "Twofish cipher algorithm (x86_64, 3-way parallel)" |
896 | depends on (X86 || UML_X86) && 64BIT | 896 | depends on X86 && 64BIT |
897 | select CRYPTO_ALGAPI | 897 | select CRYPTO_ALGAPI |
898 | select CRYPTO_TWOFISH_COMMON | 898 | select CRYPTO_TWOFISH_COMMON |
899 | select CRYPTO_TWOFISH_X86_64 | 899 | select CRYPTO_TWOFISH_X86_64 |
diff --git a/crypto/sha512_generic.c b/crypto/sha512_generic.c index 107f6f7be5e1..dd30f40af9f5 100644 --- a/crypto/sha512_generic.c +++ b/crypto/sha512_generic.c | |||
@@ -174,7 +174,7 @@ sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len) | |||
174 | index = sctx->count[0] & 0x7f; | 174 | index = sctx->count[0] & 0x7f; |
175 | 175 | ||
176 | /* Update number of bytes */ | 176 | /* Update number of bytes */ |
177 | if (!(sctx->count[0] += len)) | 177 | if ((sctx->count[0] += len) < len) |
178 | sctx->count[1]++; | 178 | sctx->count[1]++; |
179 | 179 | ||
180 | part_len = 128 - index; | 180 | part_len = 128 - index; |
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index ab513a972c95..a716fede4f25 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c | |||
@@ -74,7 +74,8 @@ acpi_status acpi_reset(void) | |||
74 | 74 | ||
75 | /* Check if the reset register is supported */ | 75 | /* Check if the reset register is supported */ |
76 | 76 | ||
77 | if (!reset_reg->address) { | 77 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || |
78 | !reset_reg->address) { | ||
78 | return_ACPI_STATUS(AE_NOT_EXIST); | 79 | return_ACPI_STATUS(AE_NOT_EXIST); |
79 | } | 80 | } |
80 | 81 | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index ba14fb93c929..c3881b2eb8b2 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -607,8 +607,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, | |||
607 | 607 | ||
608 | acpi_irq_handler = handler; | 608 | acpi_irq_handler = handler; |
609 | acpi_irq_context = context; | 609 | acpi_irq_context = context; |
610 | if (request_threaded_irq(irq, NULL, acpi_irq, IRQF_SHARED, "acpi", | 610 | if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) { |
611 | acpi_irq)) { | ||
612 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); | 611 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); |
613 | acpi_irq_handler = NULL; | 612 | acpi_irq_handler = NULL; |
614 | return AE_NOT_ACQUIRED; | 613 | return AE_NOT_ACQUIRED; |
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index c1d612435939..a6c77e8b37bd 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c | |||
@@ -23,7 +23,8 @@ void acpi_reboot(void) | |||
23 | /* Is the reset register supported? The spec says we should be | 23 | /* Is the reset register supported? The spec says we should be |
24 | * checking the bit width and bit offset, but Windows ignores | 24 | * checking the bit width and bit offset, but Windows ignores |
25 | * these fields */ | 25 | * these fields */ |
26 | /* Ignore also acpi_gbl_FADT.flags.ACPI_FADT_RESET_REGISTER */ | 26 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER)) |
27 | return; | ||
27 | 28 | ||
28 | reset_value = acpi_gbl_FADT.reset_value; | 29 | reset_value = acpi_gbl_FADT.reset_value; |
29 | 30 | ||
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 01c2cf4efcdd..cc273226dbd0 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
@@ -247,8 +247,7 @@ static int amba_pm_restore(struct device *dev) | |||
247 | /* | 247 | /* |
248 | * Hooks to provide runtime PM of the pclk (bus clock). It is safe to | 248 | * Hooks to provide runtime PM of the pclk (bus clock). It is safe to |
249 | * enable/disable the bus clock at runtime PM suspend/resume as this | 249 | * enable/disable the bus clock at runtime PM suspend/resume as this |
250 | * does not result in loss of context. However, disabling vcore power | 250 | * does not result in loss of context. |
251 | * would do, so we leave that to the driver. | ||
252 | */ | 251 | */ |
253 | static int amba_pm_runtime_suspend(struct device *dev) | 252 | static int amba_pm_runtime_suspend(struct device *dev) |
254 | { | 253 | { |
@@ -354,39 +353,6 @@ static void amba_put_disable_pclk(struct amba_device *pcdev) | |||
354 | clk_put(pclk); | 353 | clk_put(pclk); |
355 | } | 354 | } |
356 | 355 | ||
357 | static int amba_get_enable_vcore(struct amba_device *pcdev) | ||
358 | { | ||
359 | struct regulator *vcore = regulator_get(&pcdev->dev, "vcore"); | ||
360 | int ret; | ||
361 | |||
362 | pcdev->vcore = vcore; | ||
363 | |||
364 | if (IS_ERR(vcore)) { | ||
365 | /* It is OK not to supply a vcore regulator */ | ||
366 | if (PTR_ERR(vcore) == -ENODEV) | ||
367 | return 0; | ||
368 | return PTR_ERR(vcore); | ||
369 | } | ||
370 | |||
371 | ret = regulator_enable(vcore); | ||
372 | if (ret) { | ||
373 | regulator_put(vcore); | ||
374 | pcdev->vcore = ERR_PTR(-ENODEV); | ||
375 | } | ||
376 | |||
377 | return ret; | ||
378 | } | ||
379 | |||
380 | static void amba_put_disable_vcore(struct amba_device *pcdev) | ||
381 | { | ||
382 | struct regulator *vcore = pcdev->vcore; | ||
383 | |||
384 | if (!IS_ERR(vcore)) { | ||
385 | regulator_disable(vcore); | ||
386 | regulator_put(vcore); | ||
387 | } | ||
388 | } | ||
389 | |||
390 | /* | 356 | /* |
391 | * These are the device model conversion veneers; they convert the | 357 | * These are the device model conversion veneers; they convert the |
392 | * device model structures to our more specific structures. | 358 | * device model structures to our more specific structures. |
@@ -399,10 +365,6 @@ static int amba_probe(struct device *dev) | |||
399 | int ret; | 365 | int ret; |
400 | 366 | ||
401 | do { | 367 | do { |
402 | ret = amba_get_enable_vcore(pcdev); | ||
403 | if (ret) | ||
404 | break; | ||
405 | |||
406 | ret = amba_get_enable_pclk(pcdev); | 368 | ret = amba_get_enable_pclk(pcdev); |
407 | if (ret) | 369 | if (ret) |
408 | break; | 370 | break; |
@@ -420,7 +382,6 @@ static int amba_probe(struct device *dev) | |||
420 | pm_runtime_put_noidle(dev); | 382 | pm_runtime_put_noidle(dev); |
421 | 383 | ||
422 | amba_put_disable_pclk(pcdev); | 384 | amba_put_disable_pclk(pcdev); |
423 | amba_put_disable_vcore(pcdev); | ||
424 | } while (0); | 385 | } while (0); |
425 | 386 | ||
426 | return ret; | 387 | return ret; |
@@ -442,7 +403,6 @@ static int amba_remove(struct device *dev) | |||
442 | pm_runtime_put_noidle(dev); | 403 | pm_runtime_put_noidle(dev); |
443 | 404 | ||
444 | amba_put_disable_pclk(pcdev); | 405 | amba_put_disable_pclk(pcdev); |
445 | amba_put_disable_vcore(pcdev); | ||
446 | 406 | ||
447 | return ret; | 407 | return ret; |
448 | } | 408 | } |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 68013f96729f..7857e8fd0a3e 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -329,6 +329,8 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
329 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 329 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
330 | /* SATA Controller IDE (Lynx Point) */ | 330 | /* SATA Controller IDE (Lynx Point) */ |
331 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 331 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
332 | /* SATA Controller IDE (DH89xxCC) */ | ||
333 | { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
332 | { } /* terminate list */ | 334 | { } /* terminate list */ |
333 | }; | 335 | }; |
334 | 336 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index e0bda9ff89cd..28db50b57b91 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -95,7 +95,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev); | |||
95 | static void ata_dev_xfermask(struct ata_device *dev); | 95 | static void ata_dev_xfermask(struct ata_device *dev); |
96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); | 96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); |
97 | 97 | ||
98 | unsigned int ata_print_id = 1; | 98 | atomic_t ata_print_id = ATOMIC_INIT(1); |
99 | 99 | ||
100 | struct ata_force_param { | 100 | struct ata_force_param { |
101 | const char *name; | 101 | const char *name; |
@@ -6029,7 +6029,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6029 | 6029 | ||
6030 | /* give ports names and add SCSI hosts */ | 6030 | /* give ports names and add SCSI hosts */ |
6031 | for (i = 0; i < host->n_ports; i++) | 6031 | for (i = 0; i < host->n_ports; i++) |
6032 | host->ports[i]->print_id = ata_print_id++; | 6032 | host->ports[i]->print_id = atomic_inc_return(&ata_print_id); |
6033 | 6033 | ||
6034 | 6034 | ||
6035 | /* Create associated sysfs transport objects */ | 6035 | /* Create associated sysfs transport objects */ |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 1ee00c8b5b04..93dabdcd2cbe 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3843,7 +3843,7 @@ int ata_sas_async_port_init(struct ata_port *ap) | |||
3843 | int rc = ap->ops->port_start(ap); | 3843 | int rc = ap->ops->port_start(ap); |
3844 | 3844 | ||
3845 | if (!rc) { | 3845 | if (!rc) { |
3846 | ap->print_id = ata_print_id++; | 3846 | ap->print_id = atomic_inc_return(&ata_print_id); |
3847 | __ata_port_probe(ap); | 3847 | __ata_port_probe(ap); |
3848 | } | 3848 | } |
3849 | 3849 | ||
@@ -3867,7 +3867,7 @@ int ata_sas_port_init(struct ata_port *ap) | |||
3867 | int rc = ap->ops->port_start(ap); | 3867 | int rc = ap->ops->port_start(ap); |
3868 | 3868 | ||
3869 | if (!rc) { | 3869 | if (!rc) { |
3870 | ap->print_id = ata_print_id++; | 3870 | ap->print_id = atomic_inc_return(&ata_print_id); |
3871 | rc = ata_port_probe(ap); | 3871 | rc = ata_port_probe(ap); |
3872 | } | 3872 | } |
3873 | 3873 | ||
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index 74aaee30e264..c34190485377 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c | |||
@@ -294,6 +294,7 @@ int ata_tport_add(struct device *parent, | |||
294 | device_enable_async_suspend(dev); | 294 | device_enable_async_suspend(dev); |
295 | pm_runtime_set_active(dev); | 295 | pm_runtime_set_active(dev); |
296 | pm_runtime_enable(dev); | 296 | pm_runtime_enable(dev); |
297 | pm_runtime_forbid(dev); | ||
297 | 298 | ||
298 | transport_add_device(dev); | 299 | transport_add_device(dev); |
299 | transport_configure_device(dev); | 300 | transport_configure_device(dev); |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 2e26fcaf635b..9d0fd0b71852 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -53,7 +53,7 @@ enum { | |||
53 | ATA_DNXFER_QUIET = (1 << 31), | 53 | ATA_DNXFER_QUIET = (1 << 31), |
54 | }; | 54 | }; |
55 | 55 | ||
56 | extern unsigned int ata_print_id; | 56 | extern atomic_t ata_print_id; |
57 | extern int atapi_passthru16; | 57 | extern int atapi_passthru16; |
58 | extern int libata_fua; | 58 | extern int libata_fua; |
59 | extern int libata_noacpi; | 59 | extern int libata_noacpi; |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 38950ea8398a..7336d4a7ab31 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -4025,7 +4025,8 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4025 | struct ata_host *host; | 4025 | struct ata_host *host; |
4026 | struct mv_host_priv *hpriv; | 4026 | struct mv_host_priv *hpriv; |
4027 | struct resource *res; | 4027 | struct resource *res; |
4028 | int n_ports, rc; | 4028 | int n_ports = 0; |
4029 | int rc; | ||
4029 | 4030 | ||
4030 | ata_print_version_once(&pdev->dev, DRV_VERSION); | 4031 | ata_print_version_once(&pdev->dev, DRV_VERSION); |
4031 | 4032 | ||
diff --git a/drivers/base/soc.c b/drivers/base/soc.c index 05f150382da8..ba29b2e73d48 100644 --- a/drivers/base/soc.c +++ b/drivers/base/soc.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/sys_soc.h> | 15 | #include <linux/sys_soc.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | 17 | ||
18 | static DEFINE_IDR(soc_ida); | 18 | static DEFINE_IDA(soc_ida); |
19 | static DEFINE_SPINLOCK(soc_lock); | 19 | static DEFINE_SPINLOCK(soc_lock); |
20 | 20 | ||
21 | static ssize_t soc_info_get(struct device *dev, | 21 | static ssize_t soc_info_get(struct device *dev, |
@@ -168,8 +168,6 @@ void soc_device_unregister(struct soc_device *soc_dev) | |||
168 | 168 | ||
169 | static int __init soc_bus_register(void) | 169 | static int __init soc_bus_register(void) |
170 | { | 170 | { |
171 | spin_lock_init(&soc_lock); | ||
172 | |||
173 | return bus_register(&soc_bus_type); | 171 | return bus_register(&soc_bus_type); |
174 | } | 172 | } |
175 | core_initcall(soc_bus_register); | 173 | core_initcall(soc_bus_register); |
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig index c1172dafdffa..fb7c80fb721e 100644 --- a/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig | |||
@@ -29,7 +29,7 @@ config BCMA_HOST_PCI | |||
29 | 29 | ||
30 | config BCMA_DRIVER_PCI_HOSTMODE | 30 | config BCMA_DRIVER_PCI_HOSTMODE |
31 | bool "Driver for PCI core working in hostmode" | 31 | bool "Driver for PCI core working in hostmode" |
32 | depends on BCMA && MIPS | 32 | depends on BCMA && MIPS && BCMA_HOST_PCI |
33 | help | 33 | help |
34 | PCI core hostmode operation (external PCI bus). | 34 | PCI core hostmode operation (external PCI bus). |
35 | 35 | ||
diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c index 4e20bcfa7ec5..d2097a11c3c7 100644 --- a/drivers/bcma/driver_pci_host.c +++ b/drivers/bcma/driver_pci_host.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "bcma_private.h" | 12 | #include "bcma_private.h" |
13 | #include <linux/pci.h> | ||
13 | #include <linux/export.h> | 14 | #include <linux/export.h> |
14 | #include <linux/bcma/bcma.h> | 15 | #include <linux/bcma/bcma.h> |
15 | #include <asm/paccess.h> | 16 | #include <asm/paccess.h> |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index e820b68d2f6c..acda773b3720 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -866,6 +866,7 @@ cciss_scsi_detect(ctlr_info_t *h) | |||
866 | sh->can_queue = cciss_tape_cmds; | 866 | sh->can_queue = cciss_tape_cmds; |
867 | sh->sg_tablesize = h->maxsgentries; | 867 | sh->sg_tablesize = h->maxsgentries; |
868 | sh->max_cmd_len = MAX_COMMAND_SIZE; | 868 | sh->max_cmd_len = MAX_COMMAND_SIZE; |
869 | sh->max_sectors = h->cciss_max_sectors; | ||
869 | 870 | ||
870 | ((struct cciss_scsi_adapter_data_t *) | 871 | ((struct cciss_scsi_adapter_data_t *) |
871 | h->scsi_ctlr)->scsi_host = sh; | 872 | h->scsi_ctlr)->scsi_host = sh; |
@@ -1410,7 +1411,7 @@ static void cciss_scatter_gather(ctlr_info_t *h, CommandList_struct *c, | |||
1410 | /* track how many SG entries we are using */ | 1411 | /* track how many SG entries we are using */ |
1411 | if (request_nsgs > h->maxSG) | 1412 | if (request_nsgs > h->maxSG) |
1412 | h->maxSG = request_nsgs; | 1413 | h->maxSG = request_nsgs; |
1413 | c->Header.SGTotal = (__u8) request_nsgs + chained; | 1414 | c->Header.SGTotal = (u16) request_nsgs + chained; |
1414 | if (request_nsgs > h->max_cmd_sgentries) | 1415 | if (request_nsgs > h->max_cmd_sgentries) |
1415 | c->Header.SGList = h->max_cmd_sgentries; | 1416 | c->Header.SGList = h->max_cmd_sgentries; |
1416 | else | 1417 | else |
diff --git a/drivers/block/mtip32xx/Kconfig b/drivers/block/mtip32xx/Kconfig index b5dd14e072f2..0ba837fc62a8 100644 --- a/drivers/block/mtip32xx/Kconfig +++ b/drivers/block/mtip32xx/Kconfig | |||
@@ -4,6 +4,6 @@ | |||
4 | 4 | ||
5 | config BLK_DEV_PCIESSD_MTIP32XX | 5 | config BLK_DEV_PCIESSD_MTIP32XX |
6 | tristate "Block Device Driver for Micron PCIe SSDs" | 6 | tristate "Block Device Driver for Micron PCIe SSDs" |
7 | depends on HOTPLUG_PCI_PCIE | 7 | depends on PCI |
8 | help | 8 | help |
9 | This enables the block driver for Micron PCIe SSDs. | 9 | This enables the block driver for Micron PCIe SSDs. |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 8eb81c96608f..00f9fc992090 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/idr.h> | 36 | #include <linux/idr.h> |
37 | #include <linux/kthread.h> | 37 | #include <linux/kthread.h> |
38 | #include <../drivers/ata/ahci.h> | 38 | #include <../drivers/ata/ahci.h> |
39 | #include <linux/export.h> | ||
39 | #include "mtip32xx.h" | 40 | #include "mtip32xx.h" |
40 | 41 | ||
41 | #define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) | 42 | #define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) |
@@ -44,6 +45,7 @@ | |||
44 | #define HW_PORT_PRIV_DMA_SZ \ | 45 | #define HW_PORT_PRIV_DMA_SZ \ |
45 | (HW_CMD_SLOT_SZ + HW_CMD_TBL_AR_SZ + AHCI_RX_FIS_SZ) | 46 | (HW_CMD_SLOT_SZ + HW_CMD_TBL_AR_SZ + AHCI_RX_FIS_SZ) |
46 | 47 | ||
48 | #define HOST_CAP_NZDMA (1 << 19) | ||
47 | #define HOST_HSORG 0xFC | 49 | #define HOST_HSORG 0xFC |
48 | #define HSORG_DISABLE_SLOTGRP_INTR (1<<24) | 50 | #define HSORG_DISABLE_SLOTGRP_INTR (1<<24) |
49 | #define HSORG_DISABLE_SLOTGRP_PXIS (1<<16) | 51 | #define HSORG_DISABLE_SLOTGRP_PXIS (1<<16) |
@@ -139,6 +141,12 @@ static void mtip_command_cleanup(struct driver_data *dd) | |||
139 | int group = 0, commandslot = 0, commandindex = 0; | 141 | int group = 0, commandslot = 0, commandindex = 0; |
140 | struct mtip_cmd *command; | 142 | struct mtip_cmd *command; |
141 | struct mtip_port *port = dd->port; | 143 | struct mtip_port *port = dd->port; |
144 | static int in_progress; | ||
145 | |||
146 | if (in_progress) | ||
147 | return; | ||
148 | |||
149 | in_progress = 1; | ||
142 | 150 | ||
143 | for (group = 0; group < 4; group++) { | 151 | for (group = 0; group < 4; group++) { |
144 | for (commandslot = 0; commandslot < 32; commandslot++) { | 152 | for (commandslot = 0; commandslot < 32; commandslot++) { |
@@ -165,7 +173,8 @@ static void mtip_command_cleanup(struct driver_data *dd) | |||
165 | 173 | ||
166 | up(&port->cmd_slot); | 174 | up(&port->cmd_slot); |
167 | 175 | ||
168 | atomic_set(&dd->drv_cleanup_done, true); | 176 | set_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag); |
177 | in_progress = 0; | ||
169 | } | 178 | } |
170 | 179 | ||
171 | /* | 180 | /* |
@@ -262,6 +271,9 @@ static int hba_reset_nosleep(struct driver_data *dd) | |||
262 | && time_before(jiffies, timeout)) | 271 | && time_before(jiffies, timeout)) |
263 | mdelay(1); | 272 | mdelay(1); |
264 | 273 | ||
274 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) | ||
275 | return -1; | ||
276 | |||
265 | if (readl(dd->mmio + HOST_CTL) & HOST_RESET) | 277 | if (readl(dd->mmio + HOST_CTL) & HOST_RESET) |
266 | return -1; | 278 | return -1; |
267 | 279 | ||
@@ -294,6 +306,10 @@ static inline void mtip_issue_ncq_command(struct mtip_port *port, int tag) | |||
294 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); | 306 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); |
295 | 307 | ||
296 | spin_unlock_irqrestore(&port->cmd_issue_lock, flags); | 308 | spin_unlock_irqrestore(&port->cmd_issue_lock, flags); |
309 | |||
310 | /* Set the command's timeout value.*/ | ||
311 | port->commands[tag].comp_time = jiffies + msecs_to_jiffies( | ||
312 | MTIP_NCQ_COMMAND_TIMEOUT_MS); | ||
297 | } | 313 | } |
298 | 314 | ||
299 | /* | 315 | /* |
@@ -420,7 +436,12 @@ static void mtip_init_port(struct mtip_port *port) | |||
420 | writel(0xFFFFFFFF, port->completed[i]); | 436 | writel(0xFFFFFFFF, port->completed[i]); |
421 | 437 | ||
422 | /* Clear any pending interrupts for this port */ | 438 | /* Clear any pending interrupts for this port */ |
423 | writel(readl(port->mmio + PORT_IRQ_STAT), port->mmio + PORT_IRQ_STAT); | 439 | writel(readl(port->dd->mmio + PORT_IRQ_STAT), |
440 | port->dd->mmio + PORT_IRQ_STAT); | ||
441 | |||
442 | /* Clear any pending interrupts on the HBA. */ | ||
443 | writel(readl(port->dd->mmio + HOST_IRQ_STAT), | ||
444 | port->dd->mmio + HOST_IRQ_STAT); | ||
424 | 445 | ||
425 | /* Enable port interrupts */ | 446 | /* Enable port interrupts */ |
426 | writel(DEF_PORT_IRQ, port->mmio + PORT_IRQ_MASK); | 447 | writel(DEF_PORT_IRQ, port->mmio + PORT_IRQ_MASK); |
@@ -447,6 +468,9 @@ static void mtip_restart_port(struct mtip_port *port) | |||
447 | && time_before(jiffies, timeout)) | 468 | && time_before(jiffies, timeout)) |
448 | ; | 469 | ; |
449 | 470 | ||
471 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
472 | return; | ||
473 | |||
450 | /* | 474 | /* |
451 | * Chip quirk: escalate to hba reset if | 475 | * Chip quirk: escalate to hba reset if |
452 | * PxCMD.CR not clear after 500 ms | 476 | * PxCMD.CR not clear after 500 ms |
@@ -475,6 +499,9 @@ static void mtip_restart_port(struct mtip_port *port) | |||
475 | while (time_before(jiffies, timeout)) | 499 | while (time_before(jiffies, timeout)) |
476 | ; | 500 | ; |
477 | 501 | ||
502 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
503 | return; | ||
504 | |||
478 | /* Clear PxSCTL.DET */ | 505 | /* Clear PxSCTL.DET */ |
479 | writel(readl(port->mmio + PORT_SCR_CTL) & ~1, | 506 | writel(readl(port->mmio + PORT_SCR_CTL) & ~1, |
480 | port->mmio + PORT_SCR_CTL); | 507 | port->mmio + PORT_SCR_CTL); |
@@ -486,15 +513,35 @@ static void mtip_restart_port(struct mtip_port *port) | |||
486 | && time_before(jiffies, timeout)) | 513 | && time_before(jiffies, timeout)) |
487 | ; | 514 | ; |
488 | 515 | ||
516 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
517 | return; | ||
518 | |||
489 | if ((readl(port->mmio + PORT_SCR_STAT) & 0x01) == 0) | 519 | if ((readl(port->mmio + PORT_SCR_STAT) & 0x01) == 0) |
490 | dev_warn(&port->dd->pdev->dev, | 520 | dev_warn(&port->dd->pdev->dev, |
491 | "COM reset failed\n"); | 521 | "COM reset failed\n"); |
492 | 522 | ||
493 | /* Clear SError, the PxSERR.DIAG.x should be set so clear it */ | 523 | mtip_init_port(port); |
494 | writel(readl(port->mmio + PORT_SCR_ERR), port->mmio + PORT_SCR_ERR); | 524 | mtip_start_port(port); |
495 | 525 | ||
496 | /* Enable the DMA engine */ | 526 | } |
497 | mtip_enable_engine(port, 1); | 527 | |
528 | /* | ||
529 | * Helper function for tag logging | ||
530 | */ | ||
531 | static void print_tags(struct driver_data *dd, | ||
532 | char *msg, | ||
533 | unsigned long *tagbits, | ||
534 | int cnt) | ||
535 | { | ||
536 | unsigned char tagmap[128]; | ||
537 | int group, tagmap_len = 0; | ||
538 | |||
539 | memset(tagmap, 0, sizeof(tagmap)); | ||
540 | for (group = SLOTBITS_IN_LONGS; group > 0; group--) | ||
541 | tagmap_len = sprintf(tagmap + tagmap_len, "%016lX ", | ||
542 | tagbits[group-1]); | ||
543 | dev_warn(&dd->pdev->dev, | ||
544 | "%d command(s) %s: tagmap [%s]", cnt, msg, tagmap); | ||
498 | } | 545 | } |
499 | 546 | ||
500 | /* | 547 | /* |
@@ -514,15 +561,18 @@ static void mtip_timeout_function(unsigned long int data) | |||
514 | int tag, cmdto_cnt = 0; | 561 | int tag, cmdto_cnt = 0; |
515 | unsigned int bit, group; | 562 | unsigned int bit, group; |
516 | unsigned int num_command_slots = port->dd->slot_groups * 32; | 563 | unsigned int num_command_slots = port->dd->slot_groups * 32; |
564 | unsigned long to, tagaccum[SLOTBITS_IN_LONGS]; | ||
517 | 565 | ||
518 | if (unlikely(!port)) | 566 | if (unlikely(!port)) |
519 | return; | 567 | return; |
520 | 568 | ||
521 | if (atomic_read(&port->dd->resumeflag) == true) { | 569 | if (test_bit(MTIP_DDF_RESUME_BIT, &port->dd->dd_flag)) { |
522 | mod_timer(&port->cmd_timer, | 570 | mod_timer(&port->cmd_timer, |
523 | jiffies + msecs_to_jiffies(30000)); | 571 | jiffies + msecs_to_jiffies(30000)); |
524 | return; | 572 | return; |
525 | } | 573 | } |
574 | /* clear the tag accumulator */ | ||
575 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); | ||
526 | 576 | ||
527 | for (tag = 0; tag < num_command_slots; tag++) { | 577 | for (tag = 0; tag < num_command_slots; tag++) { |
528 | /* | 578 | /* |
@@ -540,12 +590,10 @@ static void mtip_timeout_function(unsigned long int data) | |||
540 | command = &port->commands[tag]; | 590 | command = &port->commands[tag]; |
541 | fis = (struct host_to_dev_fis *) command->command; | 591 | fis = (struct host_to_dev_fis *) command->command; |
542 | 592 | ||
543 | dev_warn(&port->dd->pdev->dev, | 593 | set_bit(tag, tagaccum); |
544 | "Timeout for command tag %d\n", tag); | ||
545 | |||
546 | cmdto_cnt++; | 594 | cmdto_cnt++; |
547 | if (cmdto_cnt == 1) | 595 | if (cmdto_cnt == 1) |
548 | set_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags); | 596 | set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
549 | 597 | ||
550 | /* | 598 | /* |
551 | * Clear the completed bit. This should prevent | 599 | * Clear the completed bit. This should prevent |
@@ -578,15 +626,29 @@ static void mtip_timeout_function(unsigned long int data) | |||
578 | } | 626 | } |
579 | } | 627 | } |
580 | 628 | ||
581 | if (cmdto_cnt) { | 629 | if (cmdto_cnt && !test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { |
582 | dev_warn(&port->dd->pdev->dev, | 630 | print_tags(port->dd, "timed out", tagaccum, cmdto_cnt); |
583 | "%d commands timed out: restarting port", | 631 | |
584 | cmdto_cnt); | ||
585 | mtip_restart_port(port); | 632 | mtip_restart_port(port); |
586 | clear_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags); | 633 | clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
587 | wake_up_interruptible(&port->svc_wait); | 634 | wake_up_interruptible(&port->svc_wait); |
588 | } | 635 | } |
589 | 636 | ||
637 | if (port->ic_pause_timer) { | ||
638 | to = port->ic_pause_timer + msecs_to_jiffies(1000); | ||
639 | if (time_after(jiffies, to)) { | ||
640 | if (!test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { | ||
641 | port->ic_pause_timer = 0; | ||
642 | clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | ||
643 | clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
644 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); | ||
645 | wake_up_interruptible(&port->svc_wait); | ||
646 | } | ||
647 | |||
648 | |||
649 | } | ||
650 | } | ||
651 | |||
590 | /* Restart the timer */ | 652 | /* Restart the timer */ |
591 | mod_timer(&port->cmd_timer, | 653 | mod_timer(&port->cmd_timer, |
592 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); | 654 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); |
@@ -681,23 +743,18 @@ static void mtip_completion(struct mtip_port *port, | |||
681 | complete(waiting); | 743 | complete(waiting); |
682 | } | 744 | } |
683 | 745 | ||
684 | /* | 746 | static void mtip_null_completion(struct mtip_port *port, |
685 | * Helper function for tag logging | 747 | int tag, |
686 | */ | 748 | void *data, |
687 | static void print_tags(struct driver_data *dd, | 749 | int status) |
688 | char *msg, | ||
689 | unsigned long *tagbits) | ||
690 | { | 750 | { |
691 | unsigned int tag, count = 0; | 751 | return; |
692 | |||
693 | for (tag = 0; tag < (dd->slot_groups) * 32; tag++) { | ||
694 | if (test_bit(tag, tagbits)) | ||
695 | count++; | ||
696 | } | ||
697 | if (count) | ||
698 | dev_info(&dd->pdev->dev, "%s [%i tags]\n", msg, count); | ||
699 | } | 752 | } |
700 | 753 | ||
754 | static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer, | ||
755 | dma_addr_t buffer_dma, unsigned int sectors); | ||
756 | static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, | ||
757 | struct smart_attr *attrib); | ||
701 | /* | 758 | /* |
702 | * Handle an error. | 759 | * Handle an error. |
703 | * | 760 | * |
@@ -708,12 +765,16 @@ static void print_tags(struct driver_data *dd, | |||
708 | */ | 765 | */ |
709 | static void mtip_handle_tfe(struct driver_data *dd) | 766 | static void mtip_handle_tfe(struct driver_data *dd) |
710 | { | 767 | { |
711 | int group, tag, bit, reissue; | 768 | int group, tag, bit, reissue, rv; |
712 | struct mtip_port *port; | 769 | struct mtip_port *port; |
713 | struct mtip_cmd *command; | 770 | struct mtip_cmd *cmd; |
714 | u32 completed; | 771 | u32 completed; |
715 | struct host_to_dev_fis *fis; | 772 | struct host_to_dev_fis *fis; |
716 | unsigned long tagaccum[SLOTBITS_IN_LONGS]; | 773 | unsigned long tagaccum[SLOTBITS_IN_LONGS]; |
774 | unsigned int cmd_cnt = 0; | ||
775 | unsigned char *buf; | ||
776 | char *fail_reason = NULL; | ||
777 | int fail_all_ncq_write = 0, fail_all_ncq_cmds = 0; | ||
717 | 778 | ||
718 | dev_warn(&dd->pdev->dev, "Taskfile error\n"); | 779 | dev_warn(&dd->pdev->dev, "Taskfile error\n"); |
719 | 780 | ||
@@ -722,8 +783,11 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
722 | /* Stop the timer to prevent command timeouts. */ | 783 | /* Stop the timer to prevent command timeouts. */ |
723 | del_timer(&port->cmd_timer); | 784 | del_timer(&port->cmd_timer); |
724 | 785 | ||
786 | /* clear the tag accumulator */ | ||
787 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); | ||
788 | |||
725 | /* Set eh_active */ | 789 | /* Set eh_active */ |
726 | set_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags); | 790 | set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
727 | 791 | ||
728 | /* Loop through all the groups */ | 792 | /* Loop through all the groups */ |
729 | for (group = 0; group < dd->slot_groups; group++) { | 793 | for (group = 0; group < dd->slot_groups; group++) { |
@@ -732,9 +796,6 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
732 | /* clear completed status register in the hardware.*/ | 796 | /* clear completed status register in the hardware.*/ |
733 | writel(completed, port->completed[group]); | 797 | writel(completed, port->completed[group]); |
734 | 798 | ||
735 | /* clear the tag accumulator */ | ||
736 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); | ||
737 | |||
738 | /* Process successfully completed commands */ | 799 | /* Process successfully completed commands */ |
739 | for (bit = 0; bit < 32 && completed; bit++) { | 800 | for (bit = 0; bit < 32 && completed; bit++) { |
740 | if (!(completed & (1<<bit))) | 801 | if (!(completed & (1<<bit))) |
@@ -745,13 +806,14 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
745 | if (tag == MTIP_TAG_INTERNAL) | 806 | if (tag == MTIP_TAG_INTERNAL) |
746 | continue; | 807 | continue; |
747 | 808 | ||
748 | command = &port->commands[tag]; | 809 | cmd = &port->commands[tag]; |
749 | if (likely(command->comp_func)) { | 810 | if (likely(cmd->comp_func)) { |
750 | set_bit(tag, tagaccum); | 811 | set_bit(tag, tagaccum); |
751 | atomic_set(&port->commands[tag].active, 0); | 812 | cmd_cnt++; |
752 | command->comp_func(port, | 813 | atomic_set(&cmd->active, 0); |
814 | cmd->comp_func(port, | ||
753 | tag, | 815 | tag, |
754 | command->comp_data, | 816 | cmd->comp_data, |
755 | 0); | 817 | 0); |
756 | } else { | 818 | } else { |
757 | dev_err(&port->dd->pdev->dev, | 819 | dev_err(&port->dd->pdev->dev, |
@@ -765,12 +827,45 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
765 | } | 827 | } |
766 | } | 828 | } |
767 | } | 829 | } |
768 | print_tags(dd, "TFE tags completed:", tagaccum); | 830 | |
831 | print_tags(dd, "completed (TFE)", tagaccum, cmd_cnt); | ||
769 | 832 | ||
770 | /* Restart the port */ | 833 | /* Restart the port */ |
771 | mdelay(20); | 834 | mdelay(20); |
772 | mtip_restart_port(port); | 835 | mtip_restart_port(port); |
773 | 836 | ||
837 | /* Trying to determine the cause of the error */ | ||
838 | rv = mtip_read_log_page(dd->port, ATA_LOG_SATA_NCQ, | ||
839 | dd->port->log_buf, | ||
840 | dd->port->log_buf_dma, 1); | ||
841 | if (rv) { | ||
842 | dev_warn(&dd->pdev->dev, | ||
843 | "Error in READ LOG EXT (10h) command\n"); | ||
844 | /* non-critical error, don't fail the load */ | ||
845 | } else { | ||
846 | buf = (unsigned char *)dd->port->log_buf; | ||
847 | if (buf[259] & 0x1) { | ||
848 | dev_info(&dd->pdev->dev, | ||
849 | "Write protect bit is set.\n"); | ||
850 | set_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag); | ||
851 | fail_all_ncq_write = 1; | ||
852 | fail_reason = "write protect"; | ||
853 | } | ||
854 | if (buf[288] == 0xF7) { | ||
855 | dev_info(&dd->pdev->dev, | ||
856 | "Exceeded Tmax, drive in thermal shutdown.\n"); | ||
857 | set_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag); | ||
858 | fail_all_ncq_cmds = 1; | ||
859 | fail_reason = "thermal shutdown"; | ||
860 | } | ||
861 | if (buf[288] == 0xBF) { | ||
862 | dev_info(&dd->pdev->dev, | ||
863 | "Drive indicates rebuild has failed.\n"); | ||
864 | fail_all_ncq_cmds = 1; | ||
865 | fail_reason = "rebuild failed"; | ||
866 | } | ||
867 | } | ||
868 | |||
774 | /* clear the tag accumulator */ | 869 | /* clear the tag accumulator */ |
775 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); | 870 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); |
776 | 871 | ||
@@ -779,32 +874,47 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
779 | for (bit = 0; bit < 32; bit++) { | 874 | for (bit = 0; bit < 32; bit++) { |
780 | reissue = 1; | 875 | reissue = 1; |
781 | tag = (group << 5) + bit; | 876 | tag = (group << 5) + bit; |
877 | cmd = &port->commands[tag]; | ||
782 | 878 | ||
783 | /* If the active bit is set re-issue the command */ | 879 | /* If the active bit is set re-issue the command */ |
784 | if (atomic_read(&port->commands[tag].active) == 0) | 880 | if (atomic_read(&cmd->active) == 0) |
785 | continue; | 881 | continue; |
786 | 882 | ||
787 | fis = (struct host_to_dev_fis *) | 883 | fis = (struct host_to_dev_fis *)cmd->command; |
788 | port->commands[tag].command; | ||
789 | 884 | ||
790 | /* Should re-issue? */ | 885 | /* Should re-issue? */ |
791 | if (tag == MTIP_TAG_INTERNAL || | 886 | if (tag == MTIP_TAG_INTERNAL || |
792 | fis->command == ATA_CMD_SET_FEATURES) | 887 | fis->command == ATA_CMD_SET_FEATURES) |
793 | reissue = 0; | 888 | reissue = 0; |
889 | else { | ||
890 | if (fail_all_ncq_cmds || | ||
891 | (fail_all_ncq_write && | ||
892 | fis->command == ATA_CMD_FPDMA_WRITE)) { | ||
893 | dev_warn(&dd->pdev->dev, | ||
894 | " Fail: %s w/tag %d [%s].\n", | ||
895 | fis->command == ATA_CMD_FPDMA_WRITE ? | ||
896 | "write" : "read", | ||
897 | tag, | ||
898 | fail_reason != NULL ? | ||
899 | fail_reason : "unknown"); | ||
900 | atomic_set(&cmd->active, 0); | ||
901 | if (cmd->comp_func) { | ||
902 | cmd->comp_func(port, tag, | ||
903 | cmd->comp_data, | ||
904 | -ENODATA); | ||
905 | } | ||
906 | continue; | ||
907 | } | ||
908 | } | ||
794 | 909 | ||
795 | /* | 910 | /* |
796 | * First check if this command has | 911 | * First check if this command has |
797 | * exceeded its retries. | 912 | * exceeded its retries. |
798 | */ | 913 | */ |
799 | if (reissue && | 914 | if (reissue && (cmd->retries-- > 0)) { |
800 | (port->commands[tag].retries-- > 0)) { | ||
801 | 915 | ||
802 | set_bit(tag, tagaccum); | 916 | set_bit(tag, tagaccum); |
803 | 917 | ||
804 | /* Update the timeout value. */ | ||
805 | port->commands[tag].comp_time = | ||
806 | jiffies + msecs_to_jiffies( | ||
807 | MTIP_NCQ_COMMAND_TIMEOUT_MS); | ||
808 | /* Re-issue the command. */ | 918 | /* Re-issue the command. */ |
809 | mtip_issue_ncq_command(port, tag); | 919 | mtip_issue_ncq_command(port, tag); |
810 | 920 | ||
@@ -814,13 +924,13 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
814 | /* Retire a command that will not be reissued */ | 924 | /* Retire a command that will not be reissued */ |
815 | dev_warn(&port->dd->pdev->dev, | 925 | dev_warn(&port->dd->pdev->dev, |
816 | "retiring tag %d\n", tag); | 926 | "retiring tag %d\n", tag); |
817 | atomic_set(&port->commands[tag].active, 0); | 927 | atomic_set(&cmd->active, 0); |
818 | 928 | ||
819 | if (port->commands[tag].comp_func) | 929 | if (cmd->comp_func) |
820 | port->commands[tag].comp_func( | 930 | cmd->comp_func( |
821 | port, | 931 | port, |
822 | tag, | 932 | tag, |
823 | port->commands[tag].comp_data, | 933 | cmd->comp_data, |
824 | PORT_IRQ_TF_ERR); | 934 | PORT_IRQ_TF_ERR); |
825 | else | 935 | else |
826 | dev_warn(&port->dd->pdev->dev, | 936 | dev_warn(&port->dd->pdev->dev, |
@@ -828,10 +938,10 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
828 | tag); | 938 | tag); |
829 | } | 939 | } |
830 | } | 940 | } |
831 | print_tags(dd, "TFE tags reissued:", tagaccum); | 941 | print_tags(dd, "reissued (TFE)", tagaccum, cmd_cnt); |
832 | 942 | ||
833 | /* clear eh_active */ | 943 | /* clear eh_active */ |
834 | clear_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags); | 944 | clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
835 | wake_up_interruptible(&port->svc_wait); | 945 | wake_up_interruptible(&port->svc_wait); |
836 | 946 | ||
837 | mod_timer(&port->cmd_timer, | 947 | mod_timer(&port->cmd_timer, |
@@ -899,7 +1009,7 @@ static inline void mtip_process_legacy(struct driver_data *dd, u32 port_stat) | |||
899 | struct mtip_port *port = dd->port; | 1009 | struct mtip_port *port = dd->port; |
900 | struct mtip_cmd *cmd = &port->commands[MTIP_TAG_INTERNAL]; | 1010 | struct mtip_cmd *cmd = &port->commands[MTIP_TAG_INTERNAL]; |
901 | 1011 | ||
902 | if (test_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags) && | 1012 | if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags) && |
903 | (cmd != NULL) && !(readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | 1013 | (cmd != NULL) && !(readl(port->cmd_issue[MTIP_TAG_INTERNAL]) |
904 | & (1 << MTIP_TAG_INTERNAL))) { | 1014 | & (1 << MTIP_TAG_INTERNAL))) { |
905 | if (cmd->comp_func) { | 1015 | if (cmd->comp_func) { |
@@ -911,8 +1021,6 @@ static inline void mtip_process_legacy(struct driver_data *dd, u32 port_stat) | |||
911 | } | 1021 | } |
912 | } | 1022 | } |
913 | 1023 | ||
914 | dev_warn(&dd->pdev->dev, "IRQ status 0x%x ignored.\n", port_stat); | ||
915 | |||
916 | return; | 1024 | return; |
917 | } | 1025 | } |
918 | 1026 | ||
@@ -968,6 +1076,9 @@ static inline irqreturn_t mtip_handle_irq(struct driver_data *data) | |||
968 | /* don't proceed further */ | 1076 | /* don't proceed further */ |
969 | return IRQ_HANDLED; | 1077 | return IRQ_HANDLED; |
970 | } | 1078 | } |
1079 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1080 | &dd->dd_flag)) | ||
1081 | return rv; | ||
971 | 1082 | ||
972 | mtip_process_errors(dd, port_stat & PORT_IRQ_ERR); | 1083 | mtip_process_errors(dd, port_stat & PORT_IRQ_ERR); |
973 | } | 1084 | } |
@@ -1015,6 +1126,39 @@ static void mtip_issue_non_ncq_command(struct mtip_port *port, int tag) | |||
1015 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); | 1126 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); |
1016 | } | 1127 | } |
1017 | 1128 | ||
1129 | static bool mtip_pause_ncq(struct mtip_port *port, | ||
1130 | struct host_to_dev_fis *fis) | ||
1131 | { | ||
1132 | struct host_to_dev_fis *reply; | ||
1133 | unsigned long task_file_data; | ||
1134 | |||
1135 | reply = port->rxfis + RX_FIS_D2H_REG; | ||
1136 | task_file_data = readl(port->mmio+PORT_TFDATA); | ||
1137 | |||
1138 | if ((task_file_data & 1) || (fis->command == ATA_CMD_SEC_ERASE_UNIT)) | ||
1139 | return false; | ||
1140 | |||
1141 | if (fis->command == ATA_CMD_SEC_ERASE_PREP) { | ||
1142 | set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | ||
1143 | port->ic_pause_timer = jiffies; | ||
1144 | return true; | ||
1145 | } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) && | ||
1146 | (fis->features == 0x03)) { | ||
1147 | set_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
1148 | port->ic_pause_timer = jiffies; | ||
1149 | return true; | ||
1150 | } else if ((fis->command == ATA_CMD_SEC_ERASE_UNIT) || | ||
1151 | ((fis->command == 0xFC) && | ||
1152 | (fis->features == 0x27 || fis->features == 0x72 || | ||
1153 | fis->features == 0x62 || fis->features == 0x26))) { | ||
1154 | /* Com reset after secure erase or lowlevel format */ | ||
1155 | mtip_restart_port(port); | ||
1156 | return false; | ||
1157 | } | ||
1158 | |||
1159 | return false; | ||
1160 | } | ||
1161 | |||
1018 | /* | 1162 | /* |
1019 | * Wait for port to quiesce | 1163 | * Wait for port to quiesce |
1020 | * | 1164 | * |
@@ -1033,11 +1177,13 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) | |||
1033 | 1177 | ||
1034 | to = jiffies + msecs_to_jiffies(timeout); | 1178 | to = jiffies + msecs_to_jiffies(timeout); |
1035 | do { | 1179 | do { |
1036 | if (test_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags) && | 1180 | if (test_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags) && |
1037 | test_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags)) { | 1181 | test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) { |
1038 | msleep(20); | 1182 | msleep(20); |
1039 | continue; /* svc thd is actively issuing commands */ | 1183 | continue; /* svc thd is actively issuing commands */ |
1040 | } | 1184 | } |
1185 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
1186 | return -EFAULT; | ||
1041 | /* | 1187 | /* |
1042 | * Ignore s_active bit 0 of array element 0. | 1188 | * Ignore s_active bit 0 of array element 0. |
1043 | * This bit will always be set | 1189 | * This bit will always be set |
@@ -1074,7 +1220,7 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) | |||
1074 | * -EAGAIN Time out waiting for command to complete. | 1220 | * -EAGAIN Time out waiting for command to complete. |
1075 | */ | 1221 | */ |
1076 | static int mtip_exec_internal_command(struct mtip_port *port, | 1222 | static int mtip_exec_internal_command(struct mtip_port *port, |
1077 | void *fis, | 1223 | struct host_to_dev_fis *fis, |
1078 | int fis_len, | 1224 | int fis_len, |
1079 | dma_addr_t buffer, | 1225 | dma_addr_t buffer, |
1080 | int buf_len, | 1226 | int buf_len, |
@@ -1084,8 +1230,9 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1084 | { | 1230 | { |
1085 | struct mtip_cmd_sg *command_sg; | 1231 | struct mtip_cmd_sg *command_sg; |
1086 | DECLARE_COMPLETION_ONSTACK(wait); | 1232 | DECLARE_COMPLETION_ONSTACK(wait); |
1087 | int rv = 0; | 1233 | int rv = 0, ready2go = 1; |
1088 | struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL]; | 1234 | struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL]; |
1235 | unsigned long to; | ||
1089 | 1236 | ||
1090 | /* Make sure the buffer is 8 byte aligned. This is asic specific. */ | 1237 | /* Make sure the buffer is 8 byte aligned. This is asic specific. */ |
1091 | if (buffer & 0x00000007) { | 1238 | if (buffer & 0x00000007) { |
@@ -1094,23 +1241,38 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1094 | return -EFAULT; | 1241 | return -EFAULT; |
1095 | } | 1242 | } |
1096 | 1243 | ||
1097 | /* Only one internal command should be running at a time */ | 1244 | to = jiffies + msecs_to_jiffies(timeout); |
1098 | if (test_and_set_bit(MTIP_TAG_INTERNAL, port->allocated)) { | 1245 | do { |
1246 | ready2go = !test_and_set_bit(MTIP_TAG_INTERNAL, | ||
1247 | port->allocated); | ||
1248 | if (ready2go) | ||
1249 | break; | ||
1250 | mdelay(100); | ||
1251 | } while (time_before(jiffies, to)); | ||
1252 | if (!ready2go) { | ||
1099 | dev_warn(&port->dd->pdev->dev, | 1253 | dev_warn(&port->dd->pdev->dev, |
1100 | "Internal command already active\n"); | 1254 | "Internal cmd active. new cmd [%02X]\n", fis->command); |
1101 | return -EBUSY; | 1255 | return -EBUSY; |
1102 | } | 1256 | } |
1103 | set_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags); | 1257 | set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
1258 | port->ic_pause_timer = 0; | ||
1259 | |||
1260 | if (fis->command == ATA_CMD_SEC_ERASE_UNIT) | ||
1261 | clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | ||
1262 | else if (fis->command == ATA_CMD_DOWNLOAD_MICRO) | ||
1263 | clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
1104 | 1264 | ||
1105 | if (atomic == GFP_KERNEL) { | 1265 | if (atomic == GFP_KERNEL) { |
1106 | /* wait for io to complete if non atomic */ | 1266 | if (fis->command != ATA_CMD_STANDBYNOW1) { |
1107 | if (mtip_quiesce_io(port, 5000) < 0) { | 1267 | /* wait for io to complete if non atomic */ |
1108 | dev_warn(&port->dd->pdev->dev, | 1268 | if (mtip_quiesce_io(port, 5000) < 0) { |
1109 | "Failed to quiesce IO\n"); | 1269 | dev_warn(&port->dd->pdev->dev, |
1110 | release_slot(port, MTIP_TAG_INTERNAL); | 1270 | "Failed to quiesce IO\n"); |
1111 | clear_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags); | 1271 | release_slot(port, MTIP_TAG_INTERNAL); |
1112 | wake_up_interruptible(&port->svc_wait); | 1272 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
1113 | return -EBUSY; | 1273 | wake_up_interruptible(&port->svc_wait); |
1274 | return -EBUSY; | ||
1275 | } | ||
1114 | } | 1276 | } |
1115 | 1277 | ||
1116 | /* Set the completion function and data for the command. */ | 1278 | /* Set the completion function and data for the command. */ |
@@ -1120,7 +1282,7 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1120 | } else { | 1282 | } else { |
1121 | /* Clear completion - we're going to poll */ | 1283 | /* Clear completion - we're going to poll */ |
1122 | int_cmd->comp_data = NULL; | 1284 | int_cmd->comp_data = NULL; |
1123 | int_cmd->comp_func = NULL; | 1285 | int_cmd->comp_func = mtip_null_completion; |
1124 | } | 1286 | } |
1125 | 1287 | ||
1126 | /* Copy the command to the command table */ | 1288 | /* Copy the command to the command table */ |
@@ -1159,6 +1321,12 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1159 | "Internal command did not complete [%d] " | 1321 | "Internal command did not complete [%d] " |
1160 | "within timeout of %lu ms\n", | 1322 | "within timeout of %lu ms\n", |
1161 | atomic, timeout); | 1323 | atomic, timeout); |
1324 | if (mtip_check_surprise_removal(port->dd->pdev) || | ||
1325 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1326 | &port->dd->dd_flag)) { | ||
1327 | rv = -ENXIO; | ||
1328 | goto exec_ic_exit; | ||
1329 | } | ||
1162 | rv = -EAGAIN; | 1330 | rv = -EAGAIN; |
1163 | } | 1331 | } |
1164 | 1332 | ||
@@ -1166,31 +1334,59 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1166 | & (1 << MTIP_TAG_INTERNAL)) { | 1334 | & (1 << MTIP_TAG_INTERNAL)) { |
1167 | dev_warn(&port->dd->pdev->dev, | 1335 | dev_warn(&port->dd->pdev->dev, |
1168 | "Retiring internal command but CI is 1.\n"); | 1336 | "Retiring internal command but CI is 1.\n"); |
1337 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1338 | &port->dd->dd_flag)) { | ||
1339 | hba_reset_nosleep(port->dd); | ||
1340 | rv = -ENXIO; | ||
1341 | } else { | ||
1342 | mtip_restart_port(port); | ||
1343 | rv = -EAGAIN; | ||
1344 | } | ||
1345 | goto exec_ic_exit; | ||
1169 | } | 1346 | } |
1170 | 1347 | ||
1171 | } else { | 1348 | } else { |
1172 | /* Spin for <timeout> checking if command still outstanding */ | 1349 | /* Spin for <timeout> checking if command still outstanding */ |
1173 | timeout = jiffies + msecs_to_jiffies(timeout); | 1350 | timeout = jiffies + msecs_to_jiffies(timeout); |
1174 | 1351 | while ((readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | |
1175 | while ((readl( | 1352 | & (1 << MTIP_TAG_INTERNAL)) |
1176 | port->cmd_issue[MTIP_TAG_INTERNAL]) | 1353 | && time_before(jiffies, timeout)) { |
1177 | & (1 << MTIP_TAG_INTERNAL)) | 1354 | if (mtip_check_surprise_removal(port->dd->pdev)) { |
1178 | && time_before(jiffies, timeout)) | 1355 | rv = -ENXIO; |
1179 | ; | 1356 | goto exec_ic_exit; |
1357 | } | ||
1358 | if ((fis->command != ATA_CMD_STANDBYNOW1) && | ||
1359 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1360 | &port->dd->dd_flag)) { | ||
1361 | rv = -ENXIO; | ||
1362 | goto exec_ic_exit; | ||
1363 | } | ||
1364 | } | ||
1180 | 1365 | ||
1181 | if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | 1366 | if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) |
1182 | & (1 << MTIP_TAG_INTERNAL)) { | 1367 | & (1 << MTIP_TAG_INTERNAL)) { |
1183 | dev_err(&port->dd->pdev->dev, | 1368 | dev_err(&port->dd->pdev->dev, |
1184 | "Internal command did not complete [%d]\n", | 1369 | "Internal command did not complete [atomic]\n"); |
1185 | atomic); | ||
1186 | rv = -EAGAIN; | 1370 | rv = -EAGAIN; |
1371 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1372 | &port->dd->dd_flag)) { | ||
1373 | hba_reset_nosleep(port->dd); | ||
1374 | rv = -ENXIO; | ||
1375 | } else { | ||
1376 | mtip_restart_port(port); | ||
1377 | rv = -EAGAIN; | ||
1378 | } | ||
1187 | } | 1379 | } |
1188 | } | 1380 | } |
1189 | 1381 | exec_ic_exit: | |
1190 | /* Clear the allocated and active bits for the internal command. */ | 1382 | /* Clear the allocated and active bits for the internal command. */ |
1191 | atomic_set(&int_cmd->active, 0); | 1383 | atomic_set(&int_cmd->active, 0); |
1192 | release_slot(port, MTIP_TAG_INTERNAL); | 1384 | release_slot(port, MTIP_TAG_INTERNAL); |
1193 | clear_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags); | 1385 | if (rv >= 0 && mtip_pause_ncq(port, fis)) { |
1386 | /* NCQ paused */ | ||
1387 | return rv; | ||
1388 | } | ||
1389 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); | ||
1194 | wake_up_interruptible(&port->svc_wait); | 1390 | wake_up_interruptible(&port->svc_wait); |
1195 | 1391 | ||
1196 | return rv; | 1392 | return rv; |
@@ -1240,6 +1436,9 @@ static int mtip_get_identify(struct mtip_port *port, void __user *user_buffer) | |||
1240 | int rv = 0; | 1436 | int rv = 0; |
1241 | struct host_to_dev_fis fis; | 1437 | struct host_to_dev_fis fis; |
1242 | 1438 | ||
1439 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
1440 | return -EFAULT; | ||
1441 | |||
1243 | /* Build the FIS. */ | 1442 | /* Build the FIS. */ |
1244 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); | 1443 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); |
1245 | fis.type = 0x27; | 1444 | fis.type = 0x27; |
@@ -1313,6 +1512,7 @@ static int mtip_standby_immediate(struct mtip_port *port) | |||
1313 | { | 1512 | { |
1314 | int rv; | 1513 | int rv; |
1315 | struct host_to_dev_fis fis; | 1514 | struct host_to_dev_fis fis; |
1515 | unsigned long start; | ||
1316 | 1516 | ||
1317 | /* Build the FIS. */ | 1517 | /* Build the FIS. */ |
1318 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); | 1518 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); |
@@ -1320,15 +1520,150 @@ static int mtip_standby_immediate(struct mtip_port *port) | |||
1320 | fis.opts = 1 << 7; | 1520 | fis.opts = 1 << 7; |
1321 | fis.command = ATA_CMD_STANDBYNOW1; | 1521 | fis.command = ATA_CMD_STANDBYNOW1; |
1322 | 1522 | ||
1323 | /* Execute the command. Use a 15-second timeout for large drives. */ | 1523 | start = jiffies; |
1324 | rv = mtip_exec_internal_command(port, | 1524 | rv = mtip_exec_internal_command(port, |
1325 | &fis, | 1525 | &fis, |
1326 | 5, | 1526 | 5, |
1327 | 0, | 1527 | 0, |
1328 | 0, | 1528 | 0, |
1329 | 0, | 1529 | 0, |
1330 | GFP_KERNEL, | 1530 | GFP_ATOMIC, |
1331 | 15000); | 1531 | 15000); |
1532 | dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n", | ||
1533 | jiffies_to_msecs(jiffies - start)); | ||
1534 | if (rv) | ||
1535 | dev_warn(&port->dd->pdev->dev, | ||
1536 | "STANDBY IMMEDIATE command failed.\n"); | ||
1537 | |||
1538 | return rv; | ||
1539 | } | ||
1540 | |||
1541 | /* | ||
1542 | * Issue a READ LOG EXT command to the device. | ||
1543 | * | ||
1544 | * @port pointer to the port structure. | ||
1545 | * @page page number to fetch | ||
1546 | * @buffer pointer to buffer | ||
1547 | * @buffer_dma dma address corresponding to @buffer | ||
1548 | * @sectors page length to fetch, in sectors | ||
1549 | * | ||
1550 | * return value | ||
1551 | * @rv return value from mtip_exec_internal_command() | ||
1552 | */ | ||
1553 | static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer, | ||
1554 | dma_addr_t buffer_dma, unsigned int sectors) | ||
1555 | { | ||
1556 | struct host_to_dev_fis fis; | ||
1557 | |||
1558 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); | ||
1559 | fis.type = 0x27; | ||
1560 | fis.opts = 1 << 7; | ||
1561 | fis.command = ATA_CMD_READ_LOG_EXT; | ||
1562 | fis.sect_count = sectors & 0xFF; | ||
1563 | fis.sect_cnt_ex = (sectors >> 8) & 0xFF; | ||
1564 | fis.lba_low = page; | ||
1565 | fis.lba_mid = 0; | ||
1566 | fis.device = ATA_DEVICE_OBS; | ||
1567 | |||
1568 | memset(buffer, 0, sectors * ATA_SECT_SIZE); | ||
1569 | |||
1570 | return mtip_exec_internal_command(port, | ||
1571 | &fis, | ||
1572 | 5, | ||
1573 | buffer_dma, | ||
1574 | sectors * ATA_SECT_SIZE, | ||
1575 | 0, | ||
1576 | GFP_ATOMIC, | ||
1577 | MTIP_INTERNAL_COMMAND_TIMEOUT_MS); | ||
1578 | } | ||
1579 | |||
1580 | /* | ||
1581 | * Issue a SMART READ DATA command to the device. | ||
1582 | * | ||
1583 | * @port pointer to the port structure. | ||
1584 | * @buffer pointer to buffer | ||
1585 | * @buffer_dma dma address corresponding to @buffer | ||
1586 | * | ||
1587 | * return value | ||
1588 | * @rv return value from mtip_exec_internal_command() | ||
1589 | */ | ||
1590 | static int mtip_get_smart_data(struct mtip_port *port, u8 *buffer, | ||
1591 | dma_addr_t buffer_dma) | ||
1592 | { | ||
1593 | struct host_to_dev_fis fis; | ||
1594 | |||
1595 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); | ||
1596 | fis.type = 0x27; | ||
1597 | fis.opts = 1 << 7; | ||
1598 | fis.command = ATA_CMD_SMART; | ||
1599 | fis.features = 0xD0; | ||
1600 | fis.sect_count = 1; | ||
1601 | fis.lba_mid = 0x4F; | ||
1602 | fis.lba_hi = 0xC2; | ||
1603 | fis.device = ATA_DEVICE_OBS; | ||
1604 | |||
1605 | return mtip_exec_internal_command(port, | ||
1606 | &fis, | ||
1607 | 5, | ||
1608 | buffer_dma, | ||
1609 | ATA_SECT_SIZE, | ||
1610 | 0, | ||
1611 | GFP_ATOMIC, | ||
1612 | 15000); | ||
1613 | } | ||
1614 | |||
1615 | /* | ||
1616 | * Get the value of a smart attribute | ||
1617 | * | ||
1618 | * @port pointer to the port structure | ||
1619 | * @id attribute number | ||
1620 | * @attrib pointer to return attrib information corresponding to @id | ||
1621 | * | ||
1622 | * return value | ||
1623 | * -EINVAL NULL buffer passed or unsupported attribute @id. | ||
1624 | * -EPERM Identify data not valid, SMART not supported or not enabled | ||
1625 | */ | ||
1626 | static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, | ||
1627 | struct smart_attr *attrib) | ||
1628 | { | ||
1629 | int rv, i; | ||
1630 | struct smart_attr *pattr; | ||
1631 | |||
1632 | if (!attrib) | ||
1633 | return -EINVAL; | ||
1634 | |||
1635 | if (!port->identify_valid) { | ||
1636 | dev_warn(&port->dd->pdev->dev, "IDENTIFY DATA not valid\n"); | ||
1637 | return -EPERM; | ||
1638 | } | ||
1639 | if (!(port->identify[82] & 0x1)) { | ||
1640 | dev_warn(&port->dd->pdev->dev, "SMART not supported\n"); | ||
1641 | return -EPERM; | ||
1642 | } | ||
1643 | if (!(port->identify[85] & 0x1)) { | ||
1644 | dev_warn(&port->dd->pdev->dev, "SMART not enabled\n"); | ||
1645 | return -EPERM; | ||
1646 | } | ||
1647 | |||
1648 | memset(port->smart_buf, 0, ATA_SECT_SIZE); | ||
1649 | rv = mtip_get_smart_data(port, port->smart_buf, port->smart_buf_dma); | ||
1650 | if (rv) { | ||
1651 | dev_warn(&port->dd->pdev->dev, "Failed to ge SMART data\n"); | ||
1652 | return rv; | ||
1653 | } | ||
1654 | |||
1655 | pattr = (struct smart_attr *)(port->smart_buf + 2); | ||
1656 | for (i = 0; i < 29; i++, pattr++) | ||
1657 | if (pattr->attr_id == id) { | ||
1658 | memcpy(attrib, pattr, sizeof(struct smart_attr)); | ||
1659 | break; | ||
1660 | } | ||
1661 | |||
1662 | if (i == 29) { | ||
1663 | dev_warn(&port->dd->pdev->dev, | ||
1664 | "Query for invalid SMART attribute ID\n"); | ||
1665 | rv = -EINVAL; | ||
1666 | } | ||
1332 | 1667 | ||
1333 | return rv; | 1668 | return rv; |
1334 | } | 1669 | } |
@@ -1504,10 +1839,7 @@ static int exec_drive_task(struct mtip_port *port, u8 *command) | |||
1504 | fis.cyl_hi = command[5]; | 1839 | fis.cyl_hi = command[5]; |
1505 | fis.device = command[6] & ~0x10; /* Clear the dev bit*/ | 1840 | fis.device = command[6] & ~0x10; /* Clear the dev bit*/ |
1506 | 1841 | ||
1507 | 1842 | dbg_printk(MTIP_DRV_NAME " %s: User Command: cmd %x, feat %x, nsect %x, sect %x, lcyl %x, hcyl %x, sel %x\n", | |
1508 | dbg_printk(MTIP_DRV_NAME "%s: User Command: cmd %x, feat %x, " | ||
1509 | "nsect %x, sect %x, lcyl %x, " | ||
1510 | "hcyl %x, sel %x\n", | ||
1511 | __func__, | 1843 | __func__, |
1512 | command[0], | 1844 | command[0], |
1513 | command[1], | 1845 | command[1], |
@@ -1534,8 +1866,7 @@ static int exec_drive_task(struct mtip_port *port, u8 *command) | |||
1534 | command[4] = reply->cyl_low; | 1866 | command[4] = reply->cyl_low; |
1535 | command[5] = reply->cyl_hi; | 1867 | command[5] = reply->cyl_hi; |
1536 | 1868 | ||
1537 | dbg_printk(MTIP_DRV_NAME "%s: Completion Status: stat %x, " | 1869 | dbg_printk(MTIP_DRV_NAME " %s: Completion Status: stat %x, err %x , cyl_lo %x cyl_hi %x\n", |
1538 | "err %x , cyl_lo %x cyl_hi %x\n", | ||
1539 | __func__, | 1870 | __func__, |
1540 | command[0], | 1871 | command[0], |
1541 | command[1], | 1872 | command[1], |
@@ -1578,7 +1909,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command, | |||
1578 | } | 1909 | } |
1579 | 1910 | ||
1580 | dbg_printk(MTIP_DRV_NAME | 1911 | dbg_printk(MTIP_DRV_NAME |
1581 | "%s: User Command: cmd %x, sect %x, " | 1912 | " %s: User Command: cmd %x, sect %x, " |
1582 | "feat %x, sectcnt %x\n", | 1913 | "feat %x, sectcnt %x\n", |
1583 | __func__, | 1914 | __func__, |
1584 | command[0], | 1915 | command[0], |
@@ -1607,7 +1938,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command, | |||
1607 | command[2] = command[3]; | 1938 | command[2] = command[3]; |
1608 | 1939 | ||
1609 | dbg_printk(MTIP_DRV_NAME | 1940 | dbg_printk(MTIP_DRV_NAME |
1610 | "%s: Completion Status: stat %x, " | 1941 | " %s: Completion Status: stat %x, " |
1611 | "err %x, cmd %x\n", | 1942 | "err %x, cmd %x\n", |
1612 | __func__, | 1943 | __func__, |
1613 | command[0], | 1944 | command[0], |
@@ -1810,9 +2141,10 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1810 | } | 2141 | } |
1811 | 2142 | ||
1812 | dbg_printk(MTIP_DRV_NAME | 2143 | dbg_printk(MTIP_DRV_NAME |
1813 | "taskfile: cmd %x, feat %x, nsect %x," | 2144 | " %s: cmd %x, feat %x, nsect %x," |
1814 | " sect/lbal %x, lcyl/lbam %x, hcyl/lbah %x," | 2145 | " sect/lbal %x, lcyl/lbam %x, hcyl/lbah %x," |
1815 | " head/dev %x\n", | 2146 | " head/dev %x\n", |
2147 | __func__, | ||
1816 | fis.command, | 2148 | fis.command, |
1817 | fis.features, | 2149 | fis.features, |
1818 | fis.sect_count, | 2150 | fis.sect_count, |
@@ -1823,8 +2155,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1823 | 2155 | ||
1824 | switch (fis.command) { | 2156 | switch (fis.command) { |
1825 | case ATA_CMD_DOWNLOAD_MICRO: | 2157 | case ATA_CMD_DOWNLOAD_MICRO: |
1826 | /* Change timeout for Download Microcode to 60 seconds.*/ | 2158 | /* Change timeout for Download Microcode to 2 minutes */ |
1827 | timeout = 60000; | 2159 | timeout = 120000; |
1828 | break; | 2160 | break; |
1829 | case ATA_CMD_SEC_ERASE_UNIT: | 2161 | case ATA_CMD_SEC_ERASE_UNIT: |
1830 | /* Change timeout for Security Erase Unit to 4 minutes.*/ | 2162 | /* Change timeout for Security Erase Unit to 4 minutes.*/ |
@@ -1840,8 +2172,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1840 | timeout = 10000; | 2172 | timeout = 10000; |
1841 | break; | 2173 | break; |
1842 | case ATA_CMD_SMART: | 2174 | case ATA_CMD_SMART: |
1843 | /* Change timeout for vendor unique command to 10 secs */ | 2175 | /* Change timeout for vendor unique command to 15 secs */ |
1844 | timeout = 10000; | 2176 | timeout = 15000; |
1845 | break; | 2177 | break; |
1846 | default: | 2178 | default: |
1847 | timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS; | 2179 | timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS; |
@@ -1903,18 +2235,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1903 | req_task->hob_ports[1] = reply->features_ex; | 2235 | req_task->hob_ports[1] = reply->features_ex; |
1904 | req_task->hob_ports[2] = reply->sect_cnt_ex; | 2236 | req_task->hob_ports[2] = reply->sect_cnt_ex; |
1905 | } | 2237 | } |
1906 | |||
1907 | /* Com rest after secure erase or lowlevel format */ | ||
1908 | if (((fis.command == ATA_CMD_SEC_ERASE_UNIT) || | ||
1909 | ((fis.command == 0xFC) && | ||
1910 | (fis.features == 0x27 || fis.features == 0x72 || | ||
1911 | fis.features == 0x62 || fis.features == 0x26))) && | ||
1912 | !(reply->command & 1)) { | ||
1913 | mtip_restart_port(dd->port); | ||
1914 | } | ||
1915 | |||
1916 | dbg_printk(MTIP_DRV_NAME | 2238 | dbg_printk(MTIP_DRV_NAME |
1917 | "%s: Completion: stat %x," | 2239 | " %s: Completion: stat %x," |
1918 | "err %x, sect_cnt %x, lbalo %x," | 2240 | "err %x, sect_cnt %x, lbalo %x," |
1919 | "lbamid %x, lbahi %x, dev %x\n", | 2241 | "lbamid %x, lbahi %x, dev %x\n", |
1920 | __func__, | 2242 | __func__, |
@@ -2080,14 +2402,10 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | |||
2080 | struct host_to_dev_fis *fis; | 2402 | struct host_to_dev_fis *fis; |
2081 | struct mtip_port *port = dd->port; | 2403 | struct mtip_port *port = dd->port; |
2082 | struct mtip_cmd *command = &port->commands[tag]; | 2404 | struct mtip_cmd *command = &port->commands[tag]; |
2405 | int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | ||
2083 | 2406 | ||
2084 | /* Map the scatter list for DMA access */ | 2407 | /* Map the scatter list for DMA access */ |
2085 | if (dir == READ) | 2408 | nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir); |
2086 | nents = dma_map_sg(&dd->pdev->dev, command->sg, | ||
2087 | nents, DMA_FROM_DEVICE); | ||
2088 | else | ||
2089 | nents = dma_map_sg(&dd->pdev->dev, command->sg, | ||
2090 | nents, DMA_TO_DEVICE); | ||
2091 | 2409 | ||
2092 | command->scatter_ents = nents; | 2410 | command->scatter_ents = nents; |
2093 | 2411 | ||
@@ -2127,7 +2445,7 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | |||
2127 | */ | 2445 | */ |
2128 | command->comp_data = dd; | 2446 | command->comp_data = dd; |
2129 | command->comp_func = mtip_async_complete; | 2447 | command->comp_func = mtip_async_complete; |
2130 | command->direction = (dir == READ ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 2448 | command->direction = dma_dir; |
2131 | 2449 | ||
2132 | /* | 2450 | /* |
2133 | * Set the completion function and data for the command passed | 2451 | * Set the completion function and data for the command passed |
@@ -2140,19 +2458,16 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | |||
2140 | * To prevent this command from being issued | 2458 | * To prevent this command from being issued |
2141 | * if an internal command is in progress or error handling is active. | 2459 | * if an internal command is in progress or error handling is active. |
2142 | */ | 2460 | */ |
2143 | if (unlikely(test_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags) || | 2461 | if (port->flags & MTIP_PF_PAUSE_IO) { |
2144 | test_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags))) { | ||
2145 | set_bit(tag, port->cmds_to_issue); | 2462 | set_bit(tag, port->cmds_to_issue); |
2146 | set_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags); | 2463 | set_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags); |
2147 | return; | 2464 | return; |
2148 | } | 2465 | } |
2149 | 2466 | ||
2150 | /* Issue the command to the hardware */ | 2467 | /* Issue the command to the hardware */ |
2151 | mtip_issue_ncq_command(port, tag); | 2468 | mtip_issue_ncq_command(port, tag); |
2152 | 2469 | ||
2153 | /* Set the command's timeout value.*/ | 2470 | return; |
2154 | port->commands[tag].comp_time = jiffies + msecs_to_jiffies( | ||
2155 | MTIP_NCQ_COMMAND_TIMEOUT_MS); | ||
2156 | } | 2471 | } |
2157 | 2472 | ||
2158 | /* | 2473 | /* |
@@ -2191,6 +2506,10 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd, | |||
2191 | down(&dd->port->cmd_slot); | 2506 | down(&dd->port->cmd_slot); |
2192 | *tag = get_slot(dd->port); | 2507 | *tag = get_slot(dd->port); |
2193 | 2508 | ||
2509 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) { | ||
2510 | up(&dd->port->cmd_slot); | ||
2511 | return NULL; | ||
2512 | } | ||
2194 | if (unlikely(*tag < 0)) | 2513 | if (unlikely(*tag < 0)) |
2195 | return NULL; | 2514 | return NULL; |
2196 | 2515 | ||
@@ -2207,7 +2526,7 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd, | |||
2207 | * return value | 2526 | * return value |
2208 | * The size, in bytes, of the data copied into buf. | 2527 | * The size, in bytes, of the data copied into buf. |
2209 | */ | 2528 | */ |
2210 | static ssize_t hw_show_registers(struct device *dev, | 2529 | static ssize_t mtip_hw_show_registers(struct device *dev, |
2211 | struct device_attribute *attr, | 2530 | struct device_attribute *attr, |
2212 | char *buf) | 2531 | char *buf) |
2213 | { | 2532 | { |
@@ -2216,7 +2535,7 @@ static ssize_t hw_show_registers(struct device *dev, | |||
2216 | int size = 0; | 2535 | int size = 0; |
2217 | int n; | 2536 | int n; |
2218 | 2537 | ||
2219 | size += sprintf(&buf[size], "%s:\ns_active:\n", __func__); | 2538 | size += sprintf(&buf[size], "S ACTive:\n"); |
2220 | 2539 | ||
2221 | for (n = 0; n < dd->slot_groups; n++) | 2540 | for (n = 0; n < dd->slot_groups; n++) |
2222 | size += sprintf(&buf[size], "0x%08x\n", | 2541 | size += sprintf(&buf[size], "0x%08x\n", |
@@ -2240,20 +2559,39 @@ static ssize_t hw_show_registers(struct device *dev, | |||
2240 | group_allocated); | 2559 | group_allocated); |
2241 | } | 2560 | } |
2242 | 2561 | ||
2243 | size += sprintf(&buf[size], "completed:\n"); | 2562 | size += sprintf(&buf[size], "Completed:\n"); |
2244 | 2563 | ||
2245 | for (n = 0; n < dd->slot_groups; n++) | 2564 | for (n = 0; n < dd->slot_groups; n++) |
2246 | size += sprintf(&buf[size], "0x%08x\n", | 2565 | size += sprintf(&buf[size], "0x%08x\n", |
2247 | readl(dd->port->completed[n])); | 2566 | readl(dd->port->completed[n])); |
2248 | 2567 | ||
2249 | size += sprintf(&buf[size], "PORT_IRQ_STAT 0x%08x\n", | 2568 | size += sprintf(&buf[size], "PORT IRQ STAT : 0x%08x\n", |
2250 | readl(dd->port->mmio + PORT_IRQ_STAT)); | 2569 | readl(dd->port->mmio + PORT_IRQ_STAT)); |
2251 | size += sprintf(&buf[size], "HOST_IRQ_STAT 0x%08x\n", | 2570 | size += sprintf(&buf[size], "HOST IRQ STAT : 0x%08x\n", |
2252 | readl(dd->mmio + HOST_IRQ_STAT)); | 2571 | readl(dd->mmio + HOST_IRQ_STAT)); |
2253 | 2572 | ||
2254 | return size; | 2573 | return size; |
2255 | } | 2574 | } |
2256 | static DEVICE_ATTR(registers, S_IRUGO, hw_show_registers, NULL); | 2575 | |
2576 | static ssize_t mtip_hw_show_status(struct device *dev, | ||
2577 | struct device_attribute *attr, | ||
2578 | char *buf) | ||
2579 | { | ||
2580 | struct driver_data *dd = dev_to_disk(dev)->private_data; | ||
2581 | int size = 0; | ||
2582 | |||
2583 | if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag)) | ||
2584 | size += sprintf(buf, "%s", "thermal_shutdown\n"); | ||
2585 | else if (test_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag)) | ||
2586 | size += sprintf(buf, "%s", "write_protect\n"); | ||
2587 | else | ||
2588 | size += sprintf(buf, "%s", "online\n"); | ||
2589 | |||
2590 | return size; | ||
2591 | } | ||
2592 | |||
2593 | static DEVICE_ATTR(registers, S_IRUGO, mtip_hw_show_registers, NULL); | ||
2594 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); | ||
2257 | 2595 | ||
2258 | /* | 2596 | /* |
2259 | * Create the sysfs related attributes. | 2597 | * Create the sysfs related attributes. |
@@ -2272,7 +2610,10 @@ static int mtip_hw_sysfs_init(struct driver_data *dd, struct kobject *kobj) | |||
2272 | 2610 | ||
2273 | if (sysfs_create_file(kobj, &dev_attr_registers.attr)) | 2611 | if (sysfs_create_file(kobj, &dev_attr_registers.attr)) |
2274 | dev_warn(&dd->pdev->dev, | 2612 | dev_warn(&dd->pdev->dev, |
2275 | "Error creating registers sysfs entry\n"); | 2613 | "Error creating 'registers' sysfs entry\n"); |
2614 | if (sysfs_create_file(kobj, &dev_attr_status.attr)) | ||
2615 | dev_warn(&dd->pdev->dev, | ||
2616 | "Error creating 'status' sysfs entry\n"); | ||
2276 | return 0; | 2617 | return 0; |
2277 | } | 2618 | } |
2278 | 2619 | ||
@@ -2292,6 +2633,7 @@ static int mtip_hw_sysfs_exit(struct driver_data *dd, struct kobject *kobj) | |||
2292 | return -EINVAL; | 2633 | return -EINVAL; |
2293 | 2634 | ||
2294 | sysfs_remove_file(kobj, &dev_attr_registers.attr); | 2635 | sysfs_remove_file(kobj, &dev_attr_registers.attr); |
2636 | sysfs_remove_file(kobj, &dev_attr_status.attr); | ||
2295 | 2637 | ||
2296 | return 0; | 2638 | return 0; |
2297 | } | 2639 | } |
@@ -2384,10 +2726,12 @@ static int mtip_ftl_rebuild_poll(struct driver_data *dd) | |||
2384 | "FTL rebuild in progress. Polling for completion.\n"); | 2726 | "FTL rebuild in progress. Polling for completion.\n"); |
2385 | 2727 | ||
2386 | start = jiffies; | 2728 | start = jiffies; |
2387 | dd->ftlrebuildflag = 1; | ||
2388 | timeout = jiffies + msecs_to_jiffies(MTIP_FTL_REBUILD_TIMEOUT_MS); | 2729 | timeout = jiffies + msecs_to_jiffies(MTIP_FTL_REBUILD_TIMEOUT_MS); |
2389 | 2730 | ||
2390 | do { | 2731 | do { |
2732 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
2733 | &dd->dd_flag))) | ||
2734 | return -EFAULT; | ||
2391 | if (mtip_check_surprise_removal(dd->pdev)) | 2735 | if (mtip_check_surprise_removal(dd->pdev)) |
2392 | return -EFAULT; | 2736 | return -EFAULT; |
2393 | 2737 | ||
@@ -2408,22 +2752,17 @@ static int mtip_ftl_rebuild_poll(struct driver_data *dd) | |||
2408 | dev_warn(&dd->pdev->dev, | 2752 | dev_warn(&dd->pdev->dev, |
2409 | "FTL rebuild complete (%d secs).\n", | 2753 | "FTL rebuild complete (%d secs).\n", |
2410 | jiffies_to_msecs(jiffies - start) / 1000); | 2754 | jiffies_to_msecs(jiffies - start) / 1000); |
2411 | dd->ftlrebuildflag = 0; | ||
2412 | mtip_block_initialize(dd); | 2755 | mtip_block_initialize(dd); |
2413 | break; | 2756 | return 0; |
2414 | } | 2757 | } |
2415 | ssleep(10); | 2758 | ssleep(10); |
2416 | } while (time_before(jiffies, timeout)); | 2759 | } while (time_before(jiffies, timeout)); |
2417 | 2760 | ||
2418 | /* Check for timeout */ | 2761 | /* Check for timeout */ |
2419 | if (dd->ftlrebuildflag) { | 2762 | dev_err(&dd->pdev->dev, |
2420 | dev_err(&dd->pdev->dev, | ||
2421 | "Timed out waiting for FTL rebuild to complete (%d secs).\n", | 2763 | "Timed out waiting for FTL rebuild to complete (%d secs).\n", |
2422 | jiffies_to_msecs(jiffies - start) / 1000); | 2764 | jiffies_to_msecs(jiffies - start) / 1000); |
2423 | return -EFAULT; | 2765 | return -EFAULT; |
2424 | } | ||
2425 | |||
2426 | return 0; | ||
2427 | } | 2766 | } |
2428 | 2767 | ||
2429 | /* | 2768 | /* |
@@ -2448,14 +2787,17 @@ static int mtip_service_thread(void *data) | |||
2448 | * is in progress nor error handling is active | 2787 | * is in progress nor error handling is active |
2449 | */ | 2788 | */ |
2450 | wait_event_interruptible(port->svc_wait, (port->flags) && | 2789 | wait_event_interruptible(port->svc_wait, (port->flags) && |
2451 | !test_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags) && | 2790 | !(port->flags & MTIP_PF_PAUSE_IO)); |
2452 | !test_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags)); | ||
2453 | 2791 | ||
2454 | if (kthread_should_stop()) | 2792 | if (kthread_should_stop()) |
2455 | break; | 2793 | break; |
2456 | 2794 | ||
2457 | set_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags); | 2795 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, |
2458 | if (test_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags)) { | 2796 | &dd->dd_flag))) |
2797 | break; | ||
2798 | |||
2799 | set_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags); | ||
2800 | if (test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) { | ||
2459 | slot = 1; | 2801 | slot = 1; |
2460 | /* used to restrict the loop to one iteration */ | 2802 | /* used to restrict the loop to one iteration */ |
2461 | slot_start = num_cmd_slots; | 2803 | slot_start = num_cmd_slots; |
@@ -2480,21 +2822,19 @@ static int mtip_service_thread(void *data) | |||
2480 | /* Issue the command to the hardware */ | 2822 | /* Issue the command to the hardware */ |
2481 | mtip_issue_ncq_command(port, slot); | 2823 | mtip_issue_ncq_command(port, slot); |
2482 | 2824 | ||
2483 | /* Set the command's timeout value.*/ | ||
2484 | port->commands[slot].comp_time = jiffies + | ||
2485 | msecs_to_jiffies(MTIP_NCQ_COMMAND_TIMEOUT_MS); | ||
2486 | |||
2487 | clear_bit(slot, port->cmds_to_issue); | 2825 | clear_bit(slot, port->cmds_to_issue); |
2488 | } | 2826 | } |
2489 | 2827 | ||
2490 | clear_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags); | 2828 | clear_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags); |
2491 | } else if (test_bit(MTIP_FLAG_REBUILD_BIT, &port->flags)) { | 2829 | } else if (test_bit(MTIP_PF_REBUILD_BIT, &port->flags)) { |
2492 | mtip_ftl_rebuild_poll(dd); | 2830 | if (!mtip_ftl_rebuild_poll(dd)) |
2493 | clear_bit(MTIP_FLAG_REBUILD_BIT, &port->flags); | 2831 | set_bit(MTIP_DDF_REBUILD_FAILED_BIT, |
2832 | &dd->dd_flag); | ||
2833 | clear_bit(MTIP_PF_REBUILD_BIT, &port->flags); | ||
2494 | } | 2834 | } |
2495 | clear_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags); | 2835 | clear_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags); |
2496 | 2836 | ||
2497 | if (test_bit(MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT, &port->flags)) | 2837 | if (test_bit(MTIP_PF_SVC_THD_STOP_BIT, &port->flags)) |
2498 | break; | 2838 | break; |
2499 | } | 2839 | } |
2500 | return 0; | 2840 | return 0; |
@@ -2513,6 +2853,9 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2513 | int i; | 2853 | int i; |
2514 | int rv; | 2854 | int rv; |
2515 | unsigned int num_command_slots; | 2855 | unsigned int num_command_slots; |
2856 | unsigned long timeout, timetaken; | ||
2857 | unsigned char *buf; | ||
2858 | struct smart_attr attr242; | ||
2516 | 2859 | ||
2517 | dd->mmio = pcim_iomap_table(dd->pdev)[MTIP_ABAR]; | 2860 | dd->mmio = pcim_iomap_table(dd->pdev)[MTIP_ABAR]; |
2518 | 2861 | ||
@@ -2547,7 +2890,7 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2547 | /* Allocate memory for the command list. */ | 2890 | /* Allocate memory for the command list. */ |
2548 | dd->port->command_list = | 2891 | dd->port->command_list = |
2549 | dmam_alloc_coherent(&dd->pdev->dev, | 2892 | dmam_alloc_coherent(&dd->pdev->dev, |
2550 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2), | 2893 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4), |
2551 | &dd->port->command_list_dma, | 2894 | &dd->port->command_list_dma, |
2552 | GFP_KERNEL); | 2895 | GFP_KERNEL); |
2553 | if (!dd->port->command_list) { | 2896 | if (!dd->port->command_list) { |
@@ -2560,7 +2903,7 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2560 | /* Clear the memory we have allocated. */ | 2903 | /* Clear the memory we have allocated. */ |
2561 | memset(dd->port->command_list, | 2904 | memset(dd->port->command_list, |
2562 | 0, | 2905 | 0, |
2563 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2)); | 2906 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4)); |
2564 | 2907 | ||
2565 | /* Setup the addresse of the RX FIS. */ | 2908 | /* Setup the addresse of the RX FIS. */ |
2566 | dd->port->rxfis = dd->port->command_list + HW_CMD_SLOT_SZ; | 2909 | dd->port->rxfis = dd->port->command_list + HW_CMD_SLOT_SZ; |
@@ -2576,10 +2919,19 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2576 | dd->port->identify_dma = dd->port->command_tbl_dma + | 2919 | dd->port->identify_dma = dd->port->command_tbl_dma + |
2577 | HW_CMD_TBL_AR_SZ; | 2920 | HW_CMD_TBL_AR_SZ; |
2578 | 2921 | ||
2579 | /* Setup the address of the sector buffer. */ | 2922 | /* Setup the address of the sector buffer - for some non-ncq cmds */ |
2580 | dd->port->sector_buffer = (void *) dd->port->identify + ATA_SECT_SIZE; | 2923 | dd->port->sector_buffer = (void *) dd->port->identify + ATA_SECT_SIZE; |
2581 | dd->port->sector_buffer_dma = dd->port->identify_dma + ATA_SECT_SIZE; | 2924 | dd->port->sector_buffer_dma = dd->port->identify_dma + ATA_SECT_SIZE; |
2582 | 2925 | ||
2926 | /* Setup the address of the log buf - for read log command */ | ||
2927 | dd->port->log_buf = (void *)dd->port->sector_buffer + ATA_SECT_SIZE; | ||
2928 | dd->port->log_buf_dma = dd->port->sector_buffer_dma + ATA_SECT_SIZE; | ||
2929 | |||
2930 | /* Setup the address of the smart buf - for smart read data command */ | ||
2931 | dd->port->smart_buf = (void *)dd->port->log_buf + ATA_SECT_SIZE; | ||
2932 | dd->port->smart_buf_dma = dd->port->log_buf_dma + ATA_SECT_SIZE; | ||
2933 | |||
2934 | |||
2583 | /* Point the command headers at the command tables. */ | 2935 | /* Point the command headers at the command tables. */ |
2584 | for (i = 0; i < num_command_slots; i++) { | 2936 | for (i = 0; i < num_command_slots; i++) { |
2585 | dd->port->commands[i].command_header = | 2937 | dd->port->commands[i].command_header = |
@@ -2623,14 +2975,43 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2623 | dd->port->mmio + i*0x80 + PORT_SDBV; | 2975 | dd->port->mmio + i*0x80 + PORT_SDBV; |
2624 | } | 2976 | } |
2625 | 2977 | ||
2626 | /* Reset the HBA. */ | 2978 | timetaken = jiffies; |
2627 | if (mtip_hba_reset(dd) < 0) { | 2979 | timeout = jiffies + msecs_to_jiffies(30000); |
2628 | dev_err(&dd->pdev->dev, | 2980 | while (((readl(dd->port->mmio + PORT_SCR_STAT) & 0x0F) != 0x03) && |
2629 | "Card did not reset within timeout\n"); | 2981 | time_before(jiffies, timeout)) { |
2630 | rv = -EIO; | 2982 | mdelay(100); |
2983 | } | ||
2984 | if (unlikely(mtip_check_surprise_removal(dd->pdev))) { | ||
2985 | timetaken = jiffies - timetaken; | ||
2986 | dev_warn(&dd->pdev->dev, | ||
2987 | "Surprise removal detected at %u ms\n", | ||
2988 | jiffies_to_msecs(timetaken)); | ||
2989 | rv = -ENODEV; | ||
2990 | goto out2 ; | ||
2991 | } | ||
2992 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) { | ||
2993 | timetaken = jiffies - timetaken; | ||
2994 | dev_warn(&dd->pdev->dev, | ||
2995 | "Removal detected at %u ms\n", | ||
2996 | jiffies_to_msecs(timetaken)); | ||
2997 | rv = -EFAULT; | ||
2631 | goto out2; | 2998 | goto out2; |
2632 | } | 2999 | } |
2633 | 3000 | ||
3001 | /* Conditionally reset the HBA. */ | ||
3002 | if (!(readl(dd->mmio + HOST_CAP) & HOST_CAP_NZDMA)) { | ||
3003 | if (mtip_hba_reset(dd) < 0) { | ||
3004 | dev_err(&dd->pdev->dev, | ||
3005 | "Card did not reset within timeout\n"); | ||
3006 | rv = -EIO; | ||
3007 | goto out2; | ||
3008 | } | ||
3009 | } else { | ||
3010 | /* Clear any pending interrupts on the HBA */ | ||
3011 | writel(readl(dd->mmio + HOST_IRQ_STAT), | ||
3012 | dd->mmio + HOST_IRQ_STAT); | ||
3013 | } | ||
3014 | |||
2634 | mtip_init_port(dd->port); | 3015 | mtip_init_port(dd->port); |
2635 | mtip_start_port(dd->port); | 3016 | mtip_start_port(dd->port); |
2636 | 3017 | ||
@@ -2660,6 +3041,12 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2660 | mod_timer(&dd->port->cmd_timer, | 3041 | mod_timer(&dd->port->cmd_timer, |
2661 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); | 3042 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); |
2662 | 3043 | ||
3044 | |||
3045 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) { | ||
3046 | rv = -EFAULT; | ||
3047 | goto out3; | ||
3048 | } | ||
3049 | |||
2663 | if (mtip_get_identify(dd->port, NULL) < 0) { | 3050 | if (mtip_get_identify(dd->port, NULL) < 0) { |
2664 | rv = -EFAULT; | 3051 | rv = -EFAULT; |
2665 | goto out3; | 3052 | goto out3; |
@@ -2667,10 +3054,47 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2667 | 3054 | ||
2668 | if (*(dd->port->identify + MTIP_FTL_REBUILD_OFFSET) == | 3055 | if (*(dd->port->identify + MTIP_FTL_REBUILD_OFFSET) == |
2669 | MTIP_FTL_REBUILD_MAGIC) { | 3056 | MTIP_FTL_REBUILD_MAGIC) { |
2670 | set_bit(MTIP_FLAG_REBUILD_BIT, &dd->port->flags); | 3057 | set_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags); |
2671 | return MTIP_FTL_REBUILD_MAGIC; | 3058 | return MTIP_FTL_REBUILD_MAGIC; |
2672 | } | 3059 | } |
2673 | mtip_dump_identify(dd->port); | 3060 | mtip_dump_identify(dd->port); |
3061 | |||
3062 | /* check write protect, over temp and rebuild statuses */ | ||
3063 | rv = mtip_read_log_page(dd->port, ATA_LOG_SATA_NCQ, | ||
3064 | dd->port->log_buf, | ||
3065 | dd->port->log_buf_dma, 1); | ||
3066 | if (rv) { | ||
3067 | dev_warn(&dd->pdev->dev, | ||
3068 | "Error in READ LOG EXT (10h) command\n"); | ||
3069 | /* non-critical error, don't fail the load */ | ||
3070 | } else { | ||
3071 | buf = (unsigned char *)dd->port->log_buf; | ||
3072 | if (buf[259] & 0x1) { | ||
3073 | dev_info(&dd->pdev->dev, | ||
3074 | "Write protect bit is set.\n"); | ||
3075 | set_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag); | ||
3076 | } | ||
3077 | if (buf[288] == 0xF7) { | ||
3078 | dev_info(&dd->pdev->dev, | ||
3079 | "Exceeded Tmax, drive in thermal shutdown.\n"); | ||
3080 | set_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag); | ||
3081 | } | ||
3082 | if (buf[288] == 0xBF) { | ||
3083 | dev_info(&dd->pdev->dev, | ||
3084 | "Drive indicates rebuild has failed.\n"); | ||
3085 | /* TODO */ | ||
3086 | } | ||
3087 | } | ||
3088 | |||
3089 | /* get write protect progess */ | ||
3090 | memset(&attr242, 0, sizeof(struct smart_attr)); | ||
3091 | if (mtip_get_smart_attr(dd->port, 242, &attr242)) | ||
3092 | dev_warn(&dd->pdev->dev, | ||
3093 | "Unable to check write protect progress\n"); | ||
3094 | else | ||
3095 | dev_info(&dd->pdev->dev, | ||
3096 | "Write protect progress: %d%% (%d blocks)\n", | ||
3097 | attr242.cur, attr242.data); | ||
2674 | return rv; | 3098 | return rv; |
2675 | 3099 | ||
2676 | out3: | 3100 | out3: |
@@ -2688,7 +3112,7 @@ out2: | |||
2688 | 3112 | ||
2689 | /* Free the command/command header memory. */ | 3113 | /* Free the command/command header memory. */ |
2690 | dmam_free_coherent(&dd->pdev->dev, | 3114 | dmam_free_coherent(&dd->pdev->dev, |
2691 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2), | 3115 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4), |
2692 | dd->port->command_list, | 3116 | dd->port->command_list, |
2693 | dd->port->command_list_dma); | 3117 | dd->port->command_list_dma); |
2694 | out1: | 3118 | out1: |
@@ -2712,9 +3136,12 @@ static int mtip_hw_exit(struct driver_data *dd) | |||
2712 | * Send standby immediate (E0h) to the drive so that it | 3136 | * Send standby immediate (E0h) to the drive so that it |
2713 | * saves its state. | 3137 | * saves its state. |
2714 | */ | 3138 | */ |
2715 | if (atomic_read(&dd->drv_cleanup_done) != true) { | 3139 | if (!test_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag)) { |
2716 | 3140 | ||
2717 | mtip_standby_immediate(dd->port); | 3141 | if (!test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags)) |
3142 | if (mtip_standby_immediate(dd->port)) | ||
3143 | dev_warn(&dd->pdev->dev, | ||
3144 | "STANDBY IMMEDIATE failed\n"); | ||
2718 | 3145 | ||
2719 | /* de-initialize the port. */ | 3146 | /* de-initialize the port. */ |
2720 | mtip_deinit_port(dd->port); | 3147 | mtip_deinit_port(dd->port); |
@@ -2734,7 +3161,7 @@ static int mtip_hw_exit(struct driver_data *dd) | |||
2734 | 3161 | ||
2735 | /* Free the command/command header memory. */ | 3162 | /* Free the command/command header memory. */ |
2736 | dmam_free_coherent(&dd->pdev->dev, | 3163 | dmam_free_coherent(&dd->pdev->dev, |
2737 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2), | 3164 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4), |
2738 | dd->port->command_list, | 3165 | dd->port->command_list, |
2739 | dd->port->command_list_dma); | 3166 | dd->port->command_list_dma); |
2740 | /* Free the memory allocated for the for structure. */ | 3167 | /* Free the memory allocated for the for structure. */ |
@@ -2892,6 +3319,9 @@ static int mtip_block_ioctl(struct block_device *dev, | |||
2892 | if (!dd) | 3319 | if (!dd) |
2893 | return -ENOTTY; | 3320 | return -ENOTTY; |
2894 | 3321 | ||
3322 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) | ||
3323 | return -ENOTTY; | ||
3324 | |||
2895 | switch (cmd) { | 3325 | switch (cmd) { |
2896 | case BLKFLSBUF: | 3326 | case BLKFLSBUF: |
2897 | return -ENOTTY; | 3327 | return -ENOTTY; |
@@ -2927,6 +3357,9 @@ static int mtip_block_compat_ioctl(struct block_device *dev, | |||
2927 | if (!dd) | 3357 | if (!dd) |
2928 | return -ENOTTY; | 3358 | return -ENOTTY; |
2929 | 3359 | ||
3360 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) | ||
3361 | return -ENOTTY; | ||
3362 | |||
2930 | switch (cmd) { | 3363 | switch (cmd) { |
2931 | case BLKFLSBUF: | 3364 | case BLKFLSBUF: |
2932 | return -ENOTTY; | 3365 | return -ENOTTY; |
@@ -3049,6 +3482,24 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) | |||
3049 | int nents = 0; | 3482 | int nents = 0; |
3050 | int tag = 0; | 3483 | int tag = 0; |
3051 | 3484 | ||
3485 | if (unlikely(dd->dd_flag & MTIP_DDF_STOP_IO)) { | ||
3486 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
3487 | &dd->dd_flag))) { | ||
3488 | bio_endio(bio, -ENXIO); | ||
3489 | return; | ||
3490 | } | ||
3491 | if (unlikely(test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag))) { | ||
3492 | bio_endio(bio, -ENODATA); | ||
3493 | return; | ||
3494 | } | ||
3495 | if (unlikely(test_bit(MTIP_DDF_WRITE_PROTECT_BIT, | ||
3496 | &dd->dd_flag) && | ||
3497 | bio_data_dir(bio))) { | ||
3498 | bio_endio(bio, -ENODATA); | ||
3499 | return; | ||
3500 | } | ||
3501 | } | ||
3502 | |||
3052 | if (unlikely(!bio_has_data(bio))) { | 3503 | if (unlikely(!bio_has_data(bio))) { |
3053 | blk_queue_flush(queue, 0); | 3504 | blk_queue_flush(queue, 0); |
3054 | bio_endio(bio, 0); | 3505 | bio_endio(bio, 0); |
@@ -3061,7 +3512,7 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) | |||
3061 | 3512 | ||
3062 | if (unlikely((bio)->bi_vcnt > MTIP_MAX_SG)) { | 3513 | if (unlikely((bio)->bi_vcnt > MTIP_MAX_SG)) { |
3063 | dev_warn(&dd->pdev->dev, | 3514 | dev_warn(&dd->pdev->dev, |
3064 | "Maximum number of SGL entries exceeded"); | 3515 | "Maximum number of SGL entries exceeded\n"); |
3065 | bio_io_error(bio); | 3516 | bio_io_error(bio); |
3066 | mtip_hw_release_scatterlist(dd, tag); | 3517 | mtip_hw_release_scatterlist(dd, tag); |
3067 | return; | 3518 | return; |
@@ -3210,8 +3661,10 @@ skip_create_disk: | |||
3210 | kobject_put(kobj); | 3661 | kobject_put(kobj); |
3211 | } | 3662 | } |
3212 | 3663 | ||
3213 | if (dd->mtip_svc_handler) | 3664 | if (dd->mtip_svc_handler) { |
3665 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); | ||
3214 | return rv; /* service thread created for handling rebuild */ | 3666 | return rv; /* service thread created for handling rebuild */ |
3667 | } | ||
3215 | 3668 | ||
3216 | start_service_thread: | 3669 | start_service_thread: |
3217 | sprintf(thd_name, "mtip_svc_thd_%02d", index); | 3670 | sprintf(thd_name, "mtip_svc_thd_%02d", index); |
@@ -3220,12 +3673,15 @@ start_service_thread: | |||
3220 | dd, thd_name); | 3673 | dd, thd_name); |
3221 | 3674 | ||
3222 | if (IS_ERR(dd->mtip_svc_handler)) { | 3675 | if (IS_ERR(dd->mtip_svc_handler)) { |
3223 | printk(KERN_ERR "mtip32xx: service thread failed to start\n"); | 3676 | dev_err(&dd->pdev->dev, "service thread failed to start\n"); |
3224 | dd->mtip_svc_handler = NULL; | 3677 | dd->mtip_svc_handler = NULL; |
3225 | rv = -EFAULT; | 3678 | rv = -EFAULT; |
3226 | goto kthread_run_error; | 3679 | goto kthread_run_error; |
3227 | } | 3680 | } |
3228 | 3681 | ||
3682 | if (wait_for_rebuild == MTIP_FTL_REBUILD_MAGIC) | ||
3683 | rv = wait_for_rebuild; | ||
3684 | |||
3229 | return rv; | 3685 | return rv; |
3230 | 3686 | ||
3231 | kthread_run_error: | 3687 | kthread_run_error: |
@@ -3266,16 +3722,18 @@ static int mtip_block_remove(struct driver_data *dd) | |||
3266 | struct kobject *kobj; | 3722 | struct kobject *kobj; |
3267 | 3723 | ||
3268 | if (dd->mtip_svc_handler) { | 3724 | if (dd->mtip_svc_handler) { |
3269 | set_bit(MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT, &dd->port->flags); | 3725 | set_bit(MTIP_PF_SVC_THD_STOP_BIT, &dd->port->flags); |
3270 | wake_up_interruptible(&dd->port->svc_wait); | 3726 | wake_up_interruptible(&dd->port->svc_wait); |
3271 | kthread_stop(dd->mtip_svc_handler); | 3727 | kthread_stop(dd->mtip_svc_handler); |
3272 | } | 3728 | } |
3273 | 3729 | ||
3274 | /* Clean up the sysfs attributes managed by the protocol layer. */ | 3730 | /* Clean up the sysfs attributes, if created */ |
3275 | kobj = kobject_get(&disk_to_dev(dd->disk)->kobj); | 3731 | if (test_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag)) { |
3276 | if (kobj) { | 3732 | kobj = kobject_get(&disk_to_dev(dd->disk)->kobj); |
3277 | mtip_hw_sysfs_exit(dd, kobj); | 3733 | if (kobj) { |
3278 | kobject_put(kobj); | 3734 | mtip_hw_sysfs_exit(dd, kobj); |
3735 | kobject_put(kobj); | ||
3736 | } | ||
3279 | } | 3737 | } |
3280 | 3738 | ||
3281 | /* | 3739 | /* |
@@ -3283,6 +3741,11 @@ static int mtip_block_remove(struct driver_data *dd) | |||
3283 | * from /dev | 3741 | * from /dev |
3284 | */ | 3742 | */ |
3285 | del_gendisk(dd->disk); | 3743 | del_gendisk(dd->disk); |
3744 | |||
3745 | spin_lock(&rssd_index_lock); | ||
3746 | ida_remove(&rssd_index_ida, dd->index); | ||
3747 | spin_unlock(&rssd_index_lock); | ||
3748 | |||
3286 | blk_cleanup_queue(dd->queue); | 3749 | blk_cleanup_queue(dd->queue); |
3287 | dd->disk = NULL; | 3750 | dd->disk = NULL; |
3288 | dd->queue = NULL; | 3751 | dd->queue = NULL; |
@@ -3312,6 +3775,11 @@ static int mtip_block_shutdown(struct driver_data *dd) | |||
3312 | 3775 | ||
3313 | /* Delete our gendisk structure, and cleanup the blk queue. */ | 3776 | /* Delete our gendisk structure, and cleanup the blk queue. */ |
3314 | del_gendisk(dd->disk); | 3777 | del_gendisk(dd->disk); |
3778 | |||
3779 | spin_lock(&rssd_index_lock); | ||
3780 | ida_remove(&rssd_index_ida, dd->index); | ||
3781 | spin_unlock(&rssd_index_lock); | ||
3782 | |||
3315 | blk_cleanup_queue(dd->queue); | 3783 | blk_cleanup_queue(dd->queue); |
3316 | dd->disk = NULL; | 3784 | dd->disk = NULL; |
3317 | dd->queue = NULL; | 3785 | dd->queue = NULL; |
@@ -3359,11 +3827,6 @@ static int mtip_pci_probe(struct pci_dev *pdev, | |||
3359 | return -ENOMEM; | 3827 | return -ENOMEM; |
3360 | } | 3828 | } |
3361 | 3829 | ||
3362 | /* Set the atomic variable as 1 in case of SRSI */ | ||
3363 | atomic_set(&dd->drv_cleanup_done, true); | ||
3364 | |||
3365 | atomic_set(&dd->resumeflag, false); | ||
3366 | |||
3367 | /* Attach the private data to this PCI device. */ | 3830 | /* Attach the private data to this PCI device. */ |
3368 | pci_set_drvdata(pdev, dd); | 3831 | pci_set_drvdata(pdev, dd); |
3369 | 3832 | ||
@@ -3420,7 +3883,8 @@ static int mtip_pci_probe(struct pci_dev *pdev, | |||
3420 | * instance number. | 3883 | * instance number. |
3421 | */ | 3884 | */ |
3422 | instance++; | 3885 | instance++; |
3423 | 3886 | if (rv != MTIP_FTL_REBUILD_MAGIC) | |
3887 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); | ||
3424 | goto done; | 3888 | goto done; |
3425 | 3889 | ||
3426 | block_initialize_err: | 3890 | block_initialize_err: |
@@ -3434,9 +3898,6 @@ iomap_err: | |||
3434 | pci_set_drvdata(pdev, NULL); | 3898 | pci_set_drvdata(pdev, NULL); |
3435 | return rv; | 3899 | return rv; |
3436 | done: | 3900 | done: |
3437 | /* Set the atomic variable as 0 in case of SRSI */ | ||
3438 | atomic_set(&dd->drv_cleanup_done, true); | ||
3439 | |||
3440 | return rv; | 3901 | return rv; |
3441 | } | 3902 | } |
3442 | 3903 | ||
@@ -3452,8 +3913,10 @@ static void mtip_pci_remove(struct pci_dev *pdev) | |||
3452 | struct driver_data *dd = pci_get_drvdata(pdev); | 3913 | struct driver_data *dd = pci_get_drvdata(pdev); |
3453 | int counter = 0; | 3914 | int counter = 0; |
3454 | 3915 | ||
3916 | set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag); | ||
3917 | |||
3455 | if (mtip_check_surprise_removal(pdev)) { | 3918 | if (mtip_check_surprise_removal(pdev)) { |
3456 | while (atomic_read(&dd->drv_cleanup_done) == false) { | 3919 | while (!test_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag)) { |
3457 | counter++; | 3920 | counter++; |
3458 | msleep(20); | 3921 | msleep(20); |
3459 | if (counter == 10) { | 3922 | if (counter == 10) { |
@@ -3463,8 +3926,6 @@ static void mtip_pci_remove(struct pci_dev *pdev) | |||
3463 | } | 3926 | } |
3464 | } | 3927 | } |
3465 | } | 3928 | } |
3466 | /* Set the atomic variable as 1 in case of SRSI */ | ||
3467 | atomic_set(&dd->drv_cleanup_done, true); | ||
3468 | 3929 | ||
3469 | /* Clean up the block layer. */ | 3930 | /* Clean up the block layer. */ |
3470 | mtip_block_remove(dd); | 3931 | mtip_block_remove(dd); |
@@ -3493,7 +3954,7 @@ static int mtip_pci_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
3493 | return -EFAULT; | 3954 | return -EFAULT; |
3494 | } | 3955 | } |
3495 | 3956 | ||
3496 | atomic_set(&dd->resumeflag, true); | 3957 | set_bit(MTIP_DDF_RESUME_BIT, &dd->dd_flag); |
3497 | 3958 | ||
3498 | /* Disable ports & interrupts then send standby immediate */ | 3959 | /* Disable ports & interrupts then send standby immediate */ |
3499 | rv = mtip_block_suspend(dd); | 3960 | rv = mtip_block_suspend(dd); |
@@ -3559,7 +4020,7 @@ static int mtip_pci_resume(struct pci_dev *pdev) | |||
3559 | dev_err(&pdev->dev, "Unable to resume\n"); | 4020 | dev_err(&pdev->dev, "Unable to resume\n"); |
3560 | 4021 | ||
3561 | err: | 4022 | err: |
3562 | atomic_set(&dd->resumeflag, false); | 4023 | clear_bit(MTIP_DDF_RESUME_BIT, &dd->dd_flag); |
3563 | 4024 | ||
3564 | return rv; | 4025 | return rv; |
3565 | } | 4026 | } |
@@ -3608,18 +4069,25 @@ MODULE_DEVICE_TABLE(pci, mtip_pci_tbl); | |||
3608 | */ | 4069 | */ |
3609 | static int __init mtip_init(void) | 4070 | static int __init mtip_init(void) |
3610 | { | 4071 | { |
4072 | int error; | ||
4073 | |||
3611 | printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); | 4074 | printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); |
3612 | 4075 | ||
3613 | /* Allocate a major block device number to use with this driver. */ | 4076 | /* Allocate a major block device number to use with this driver. */ |
3614 | mtip_major = register_blkdev(0, MTIP_DRV_NAME); | 4077 | error = register_blkdev(0, MTIP_DRV_NAME); |
3615 | if (mtip_major < 0) { | 4078 | if (error <= 0) { |
3616 | printk(KERN_ERR "Unable to register block device (%d)\n", | 4079 | printk(KERN_ERR "Unable to register block device (%d)\n", |
3617 | mtip_major); | 4080 | error); |
3618 | return -EBUSY; | 4081 | return -EBUSY; |
3619 | } | 4082 | } |
4083 | mtip_major = error; | ||
3620 | 4084 | ||
3621 | /* Register our PCI operations. */ | 4085 | /* Register our PCI operations. */ |
3622 | return pci_register_driver(&mtip_pci_driver); | 4086 | error = pci_register_driver(&mtip_pci_driver); |
4087 | if (error) | ||
4088 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); | ||
4089 | |||
4090 | return error; | ||
3623 | } | 4091 | } |
3624 | 4092 | ||
3625 | /* | 4093 | /* |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index e0554a8f2233..4ef58336310a 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -34,8 +34,8 @@ | |||
34 | /* offset of Device Control register in PCIe extended capabilites space */ | 34 | /* offset of Device Control register in PCIe extended capabilites space */ |
35 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 | 35 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 |
36 | 36 | ||
37 | /* # of times to retry timed out IOs */ | 37 | /* # of times to retry timed out/failed IOs */ |
38 | #define MTIP_MAX_RETRIES 5 | 38 | #define MTIP_MAX_RETRIES 2 |
39 | 39 | ||
40 | /* Various timeout values in ms */ | 40 | /* Various timeout values in ms */ |
41 | #define MTIP_NCQ_COMMAND_TIMEOUT_MS 5000 | 41 | #define MTIP_NCQ_COMMAND_TIMEOUT_MS 5000 |
@@ -114,12 +114,41 @@ | |||
114 | #define __force_bit2int (unsigned int __force) | 114 | #define __force_bit2int (unsigned int __force) |
115 | 115 | ||
116 | /* below are bit numbers in 'flags' defined in mtip_port */ | 116 | /* below are bit numbers in 'flags' defined in mtip_port */ |
117 | #define MTIP_FLAG_IC_ACTIVE_BIT 0 | 117 | #define MTIP_PF_IC_ACTIVE_BIT 0 /* pio/ioctl */ |
118 | #define MTIP_FLAG_EH_ACTIVE_BIT 1 | 118 | #define MTIP_PF_EH_ACTIVE_BIT 1 /* error handling */ |
119 | #define MTIP_FLAG_SVC_THD_ACTIVE_BIT 2 | 119 | #define MTIP_PF_SE_ACTIVE_BIT 2 /* secure erase */ |
120 | #define MTIP_FLAG_ISSUE_CMDS_BIT 4 | 120 | #define MTIP_PF_DM_ACTIVE_BIT 3 /* download microcde */ |
121 | #define MTIP_FLAG_REBUILD_BIT 5 | 121 | #define MTIP_PF_PAUSE_IO ((1 << MTIP_PF_IC_ACTIVE_BIT) | \ |
122 | #define MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT 8 | 122 | (1 << MTIP_PF_EH_ACTIVE_BIT) | \ |
123 | (1 << MTIP_PF_SE_ACTIVE_BIT) | \ | ||
124 | (1 << MTIP_PF_DM_ACTIVE_BIT)) | ||
125 | |||
126 | #define MTIP_PF_SVC_THD_ACTIVE_BIT 4 | ||
127 | #define MTIP_PF_ISSUE_CMDS_BIT 5 | ||
128 | #define MTIP_PF_REBUILD_BIT 6 | ||
129 | #define MTIP_PF_SVC_THD_STOP_BIT 8 | ||
130 | |||
131 | /* below are bit numbers in 'dd_flag' defined in driver_data */ | ||
132 | #define MTIP_DDF_REMOVE_PENDING_BIT 1 | ||
133 | #define MTIP_DDF_OVER_TEMP_BIT 2 | ||
134 | #define MTIP_DDF_WRITE_PROTECT_BIT 3 | ||
135 | #define MTIP_DDF_STOP_IO ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ | ||
136 | (1 << MTIP_DDF_OVER_TEMP_BIT) | \ | ||
137 | (1 << MTIP_DDF_WRITE_PROTECT_BIT)) | ||
138 | |||
139 | #define MTIP_DDF_CLEANUP_BIT 5 | ||
140 | #define MTIP_DDF_RESUME_BIT 6 | ||
141 | #define MTIP_DDF_INIT_DONE_BIT 7 | ||
142 | #define MTIP_DDF_REBUILD_FAILED_BIT 8 | ||
143 | |||
144 | __packed struct smart_attr{ | ||
145 | u8 attr_id; | ||
146 | u16 flags; | ||
147 | u8 cur; | ||
148 | u8 worst; | ||
149 | u32 data; | ||
150 | u8 res[3]; | ||
151 | }; | ||
123 | 152 | ||
124 | /* Register Frame Information Structure (FIS), host to device. */ | 153 | /* Register Frame Information Structure (FIS), host to device. */ |
125 | struct host_to_dev_fis { | 154 | struct host_to_dev_fis { |
@@ -345,6 +374,12 @@ struct mtip_port { | |||
345 | * when the command slot and all associated data structures | 374 | * when the command slot and all associated data structures |
346 | * are no longer needed. | 375 | * are no longer needed. |
347 | */ | 376 | */ |
377 | u16 *log_buf; | ||
378 | dma_addr_t log_buf_dma; | ||
379 | |||
380 | u8 *smart_buf; | ||
381 | dma_addr_t smart_buf_dma; | ||
382 | |||
348 | unsigned long allocated[SLOTBITS_IN_LONGS]; | 383 | unsigned long allocated[SLOTBITS_IN_LONGS]; |
349 | /* | 384 | /* |
350 | * used to queue commands when an internal command is in progress | 385 | * used to queue commands when an internal command is in progress |
@@ -368,6 +403,7 @@ struct mtip_port { | |||
368 | * Timer used to complete commands that have been active for too long. | 403 | * Timer used to complete commands that have been active for too long. |
369 | */ | 404 | */ |
370 | struct timer_list cmd_timer; | 405 | struct timer_list cmd_timer; |
406 | unsigned long ic_pause_timer; | ||
371 | /* | 407 | /* |
372 | * Semaphore used to block threads if there are no | 408 | * Semaphore used to block threads if there are no |
373 | * command slots available. | 409 | * command slots available. |
@@ -404,13 +440,9 @@ struct driver_data { | |||
404 | 440 | ||
405 | unsigned slot_groups; /* number of slot groups the product supports */ | 441 | unsigned slot_groups; /* number of slot groups the product supports */ |
406 | 442 | ||
407 | atomic_t drv_cleanup_done; /* Atomic variable for SRSI */ | ||
408 | |||
409 | unsigned long index; /* Index to determine the disk name */ | 443 | unsigned long index; /* Index to determine the disk name */ |
410 | 444 | ||
411 | unsigned int ftlrebuildflag; /* FTL rebuild flag */ | 445 | unsigned long dd_flag; /* NOTE: use atomic bit operations on this */ |
412 | |||
413 | atomic_t resumeflag; /* Atomic variable to track suspend/resume */ | ||
414 | 446 | ||
415 | struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ | 447 | struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ |
416 | }; | 448 | }; |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index c4a60badf252..0d39f2f4294a 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -351,6 +351,7 @@ static void virtblk_config_changed_work(struct work_struct *work) | |||
351 | cap_str_10, cap_str_2); | 351 | cap_str_10, cap_str_2); |
352 | 352 | ||
353 | set_capacity(vblk->disk, capacity); | 353 | set_capacity(vblk->disk, capacity); |
354 | revalidate_disk(vblk->disk); | ||
354 | done: | 355 | done: |
355 | mutex_unlock(&vblk->config_lock); | 356 | mutex_unlock(&vblk->config_lock); |
356 | } | 357 | } |
@@ -374,6 +375,34 @@ static int init_vq(struct virtio_blk *vblk) | |||
374 | return err; | 375 | return err; |
375 | } | 376 | } |
376 | 377 | ||
378 | /* | ||
379 | * Legacy naming scheme used for virtio devices. We are stuck with it for | ||
380 | * virtio blk but don't ever use it for any new driver. | ||
381 | */ | ||
382 | static int virtblk_name_format(char *prefix, int index, char *buf, int buflen) | ||
383 | { | ||
384 | const int base = 'z' - 'a' + 1; | ||
385 | char *begin = buf + strlen(prefix); | ||
386 | char *end = buf + buflen; | ||
387 | char *p; | ||
388 | int unit; | ||
389 | |||
390 | p = end - 1; | ||
391 | *p = '\0'; | ||
392 | unit = base; | ||
393 | do { | ||
394 | if (p == begin) | ||
395 | return -EINVAL; | ||
396 | *--p = 'a' + (index % unit); | ||
397 | index = (index / unit) - 1; | ||
398 | } while (index >= 0); | ||
399 | |||
400 | memmove(begin, p, end - p); | ||
401 | memcpy(buf, prefix, strlen(prefix)); | ||
402 | |||
403 | return 0; | ||
404 | } | ||
405 | |||
377 | static int __devinit virtblk_probe(struct virtio_device *vdev) | 406 | static int __devinit virtblk_probe(struct virtio_device *vdev) |
378 | { | 407 | { |
379 | struct virtio_blk *vblk; | 408 | struct virtio_blk *vblk; |
@@ -442,18 +471,7 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
442 | 471 | ||
443 | q->queuedata = vblk; | 472 | q->queuedata = vblk; |
444 | 473 | ||
445 | if (index < 26) { | 474 | virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); |
446 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); | ||
447 | } else if (index < (26 + 1) * 26) { | ||
448 | sprintf(vblk->disk->disk_name, "vd%c%c", | ||
449 | 'a' + index / 26 - 1, 'a' + index % 26); | ||
450 | } else { | ||
451 | const unsigned int m1 = (index / 26 - 1) / 26 - 1; | ||
452 | const unsigned int m2 = (index / 26 - 1) % 26; | ||
453 | const unsigned int m3 = index % 26; | ||
454 | sprintf(vblk->disk->disk_name, "vd%c%c%c", | ||
455 | 'a' + m1, 'a' + m2, 'a' + m3); | ||
456 | } | ||
457 | 475 | ||
458 | vblk->disk->major = major; | 476 | vblk->disk->major = major; |
459 | vblk->disk->first_minor = index_to_minor(index); | 477 | vblk->disk->first_minor = index_to_minor(index); |
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 0088bf60f368..73f196ca713f 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -321,6 +321,7 @@ struct seg_buf { | |||
321 | static void xen_blkbk_unmap(struct pending_req *req) | 321 | static void xen_blkbk_unmap(struct pending_req *req) |
322 | { | 322 | { |
323 | struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 323 | struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
324 | struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
324 | unsigned int i, invcount = 0; | 325 | unsigned int i, invcount = 0; |
325 | grant_handle_t handle; | 326 | grant_handle_t handle; |
326 | int ret; | 327 | int ret; |
@@ -332,25 +333,12 @@ static void xen_blkbk_unmap(struct pending_req *req) | |||
332 | gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i), | 333 | gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i), |
333 | GNTMAP_host_map, handle); | 334 | GNTMAP_host_map, handle); |
334 | pending_handle(req, i) = BLKBACK_INVALID_HANDLE; | 335 | pending_handle(req, i) = BLKBACK_INVALID_HANDLE; |
336 | pages[invcount] = virt_to_page(vaddr(req, i)); | ||
335 | invcount++; | 337 | invcount++; |
336 | } | 338 | } |
337 | 339 | ||
338 | ret = HYPERVISOR_grant_table_op( | 340 | ret = gnttab_unmap_refs(unmap, pages, invcount, false); |
339 | GNTTABOP_unmap_grant_ref, unmap, invcount); | ||
340 | BUG_ON(ret); | 341 | BUG_ON(ret); |
341 | /* | ||
342 | * Note, we use invcount, so nr->pages, so we can't index | ||
343 | * using vaddr(req, i). | ||
344 | */ | ||
345 | for (i = 0; i < invcount; i++) { | ||
346 | ret = m2p_remove_override( | ||
347 | virt_to_page(unmap[i].host_addr), false); | ||
348 | if (ret) { | ||
349 | pr_alert(DRV_PFX "Failed to remove M2P override for %lx\n", | ||
350 | (unsigned long)unmap[i].host_addr); | ||
351 | continue; | ||
352 | } | ||
353 | } | ||
354 | } | 342 | } |
355 | 343 | ||
356 | static int xen_blkbk_map(struct blkif_request *req, | 344 | static int xen_blkbk_map(struct blkif_request *req, |
@@ -378,7 +366,7 @@ static int xen_blkbk_map(struct blkif_request *req, | |||
378 | pending_req->blkif->domid); | 366 | pending_req->blkif->domid); |
379 | } | 367 | } |
380 | 368 | ||
381 | ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nseg); | 369 | ret = gnttab_map_refs(map, NULL, &blkbk->pending_page(pending_req, 0), nseg); |
382 | BUG_ON(ret); | 370 | BUG_ON(ret); |
383 | 371 | ||
384 | /* | 372 | /* |
@@ -398,15 +386,6 @@ static int xen_blkbk_map(struct blkif_request *req, | |||
398 | if (ret) | 386 | if (ret) |
399 | continue; | 387 | continue; |
400 | 388 | ||
401 | ret = m2p_add_override(PFN_DOWN(map[i].dev_bus_addr), | ||
402 | blkbk->pending_page(pending_req, i), NULL); | ||
403 | if (ret) { | ||
404 | pr_alert(DRV_PFX "Failed to install M2P override for %lx (ret: %d)\n", | ||
405 | (unsigned long)map[i].dev_bus_addr, ret); | ||
406 | /* We could switch over to GNTTABOP_copy */ | ||
407 | continue; | ||
408 | } | ||
409 | |||
410 | seg[i].buf = map[i].dev_bus_addr | | 389 | seg[i].buf = map[i].dev_bus_addr | |
411 | (req->u.rw.seg[i].first_sect << 9); | 390 | (req->u.rw.seg[i].first_sect << 9); |
412 | } | 391 | } |
@@ -419,21 +398,18 @@ static int dispatch_discard_io(struct xen_blkif *blkif, | |||
419 | int err = 0; | 398 | int err = 0; |
420 | int status = BLKIF_RSP_OKAY; | 399 | int status = BLKIF_RSP_OKAY; |
421 | struct block_device *bdev = blkif->vbd.bdev; | 400 | struct block_device *bdev = blkif->vbd.bdev; |
401 | unsigned long secure; | ||
422 | 402 | ||
423 | blkif->st_ds_req++; | 403 | blkif->st_ds_req++; |
424 | 404 | ||
425 | xen_blkif_get(blkif); | 405 | xen_blkif_get(blkif); |
426 | if (blkif->blk_backend_type == BLKIF_BACKEND_PHY || | 406 | secure = (blkif->vbd.discard_secure && |
427 | blkif->blk_backend_type == BLKIF_BACKEND_FILE) { | 407 | (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ? |
428 | unsigned long secure = (blkif->vbd.discard_secure && | 408 | BLKDEV_DISCARD_SECURE : 0; |
429 | (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ? | 409 | |
430 | BLKDEV_DISCARD_SECURE : 0; | 410 | err = blkdev_issue_discard(bdev, req->u.discard.sector_number, |
431 | err = blkdev_issue_discard(bdev, | 411 | req->u.discard.nr_sectors, |
432 | req->u.discard.sector_number, | 412 | GFP_KERNEL, secure); |
433 | req->u.discard.nr_sectors, | ||
434 | GFP_KERNEL, secure); | ||
435 | } else | ||
436 | err = -EOPNOTSUPP; | ||
437 | 413 | ||
438 | if (err == -EOPNOTSUPP) { | 414 | if (err == -EOPNOTSUPP) { |
439 | pr_debug(DRV_PFX "discard op failed, not supported\n"); | 415 | pr_debug(DRV_PFX "discard op failed, not supported\n"); |
@@ -830,7 +806,7 @@ static int __init xen_blkif_init(void) | |||
830 | int i, mmap_pages; | 806 | int i, mmap_pages; |
831 | int rc = 0; | 807 | int rc = 0; |
832 | 808 | ||
833 | if (!xen_pv_domain()) | 809 | if (!xen_domain()) |
834 | return -ENODEV; | 810 | return -ENODEV; |
835 | 811 | ||
836 | blkbk = kzalloc(sizeof(struct xen_blkbk), GFP_KERNEL); | 812 | blkbk = kzalloc(sizeof(struct xen_blkbk), GFP_KERNEL); |
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index d0ee7edc9be8..773cf27dc23f 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h | |||
@@ -146,11 +146,6 @@ enum blkif_protocol { | |||
146 | BLKIF_PROTOCOL_X86_64 = 3, | 146 | BLKIF_PROTOCOL_X86_64 = 3, |
147 | }; | 147 | }; |
148 | 148 | ||
149 | enum blkif_backend_type { | ||
150 | BLKIF_BACKEND_PHY = 1, | ||
151 | BLKIF_BACKEND_FILE = 2, | ||
152 | }; | ||
153 | |||
154 | struct xen_vbd { | 149 | struct xen_vbd { |
155 | /* What the domain refers to this vbd as. */ | 150 | /* What the domain refers to this vbd as. */ |
156 | blkif_vdev_t handle; | 151 | blkif_vdev_t handle; |
@@ -177,7 +172,6 @@ struct xen_blkif { | |||
177 | unsigned int irq; | 172 | unsigned int irq; |
178 | /* Comms information. */ | 173 | /* Comms information. */ |
179 | enum blkif_protocol blk_protocol; | 174 | enum blkif_protocol blk_protocol; |
180 | enum blkif_backend_type blk_backend_type; | ||
181 | union blkif_back_rings blk_rings; | 175 | union blkif_back_rings blk_rings; |
182 | void *blk_ring; | 176 | void *blk_ring; |
183 | /* The VBD attached to this interface. */ | 177 | /* The VBD attached to this interface. */ |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 24a2fb57e5d0..4f66171c6683 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -381,72 +381,49 @@ int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt, | |||
381 | err = xenbus_printf(xbt, dev->nodename, "feature-flush-cache", | 381 | err = xenbus_printf(xbt, dev->nodename, "feature-flush-cache", |
382 | "%d", state); | 382 | "%d", state); |
383 | if (err) | 383 | if (err) |
384 | xenbus_dev_fatal(dev, err, "writing feature-flush-cache"); | 384 | dev_warn(&dev->dev, "writing feature-flush-cache (%d)", err); |
385 | 385 | ||
386 | return err; | 386 | return err; |
387 | } | 387 | } |
388 | 388 | ||
389 | int xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) | 389 | static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) |
390 | { | 390 | { |
391 | struct xenbus_device *dev = be->dev; | 391 | struct xenbus_device *dev = be->dev; |
392 | struct xen_blkif *blkif = be->blkif; | 392 | struct xen_blkif *blkif = be->blkif; |
393 | char *type; | ||
394 | int err; | 393 | int err; |
395 | int state = 0; | 394 | int state = 0; |
395 | struct block_device *bdev = be->blkif->vbd.bdev; | ||
396 | struct request_queue *q = bdev_get_queue(bdev); | ||
396 | 397 | ||
397 | type = xenbus_read(XBT_NIL, dev->nodename, "type", NULL); | 398 | if (blk_queue_discard(q)) { |
398 | if (!IS_ERR(type)) { | 399 | err = xenbus_printf(xbt, dev->nodename, |
399 | if (strncmp(type, "file", 4) == 0) { | 400 | "discard-granularity", "%u", |
400 | state = 1; | 401 | q->limits.discard_granularity); |
401 | blkif->blk_backend_type = BLKIF_BACKEND_FILE; | 402 | if (err) { |
403 | dev_warn(&dev->dev, "writing discard-granularity (%d)", err); | ||
404 | return; | ||
402 | } | 405 | } |
403 | if (strncmp(type, "phy", 3) == 0) { | 406 | err = xenbus_printf(xbt, dev->nodename, |
404 | struct block_device *bdev = be->blkif->vbd.bdev; | 407 | "discard-alignment", "%u", |
405 | struct request_queue *q = bdev_get_queue(bdev); | 408 | q->limits.discard_alignment); |
406 | if (blk_queue_discard(q)) { | 409 | if (err) { |
407 | err = xenbus_printf(xbt, dev->nodename, | 410 | dev_warn(&dev->dev, "writing discard-alignment (%d)", err); |
408 | "discard-granularity", "%u", | 411 | return; |
409 | q->limits.discard_granularity); | 412 | } |
410 | if (err) { | 413 | state = 1; |
411 | xenbus_dev_fatal(dev, err, | 414 | /* Optional. */ |
412 | "writing discard-granularity"); | 415 | err = xenbus_printf(xbt, dev->nodename, |
413 | goto kfree; | 416 | "discard-secure", "%d", |
414 | } | 417 | blkif->vbd.discard_secure); |
415 | err = xenbus_printf(xbt, dev->nodename, | 418 | if (err) { |
416 | "discard-alignment", "%u", | 419 | dev_warn(&dev->dev, "writing discard-secure (%d)", err); |
417 | q->limits.discard_alignment); | 420 | return; |
418 | if (err) { | ||
419 | xenbus_dev_fatal(dev, err, | ||
420 | "writing discard-alignment"); | ||
421 | goto kfree; | ||
422 | } | ||
423 | state = 1; | ||
424 | blkif->blk_backend_type = BLKIF_BACKEND_PHY; | ||
425 | } | ||
426 | /* Optional. */ | ||
427 | err = xenbus_printf(xbt, dev->nodename, | ||
428 | "discard-secure", "%d", | ||
429 | blkif->vbd.discard_secure); | ||
430 | if (err) { | ||
431 | xenbus_dev_fatal(dev, err, | ||
432 | "writting discard-secure"); | ||
433 | goto kfree; | ||
434 | } | ||
435 | } | 421 | } |
436 | } else { | ||
437 | err = PTR_ERR(type); | ||
438 | xenbus_dev_fatal(dev, err, "reading type"); | ||
439 | goto out; | ||
440 | } | 422 | } |
441 | |||
442 | err = xenbus_printf(xbt, dev->nodename, "feature-discard", | 423 | err = xenbus_printf(xbt, dev->nodename, "feature-discard", |
443 | "%d", state); | 424 | "%d", state); |
444 | if (err) | 425 | if (err) |
445 | xenbus_dev_fatal(dev, err, "writing feature-discard"); | 426 | dev_warn(&dev->dev, "writing feature-discard (%d)", err); |
446 | kfree: | ||
447 | kfree(type); | ||
448 | out: | ||
449 | return err; | ||
450 | } | 427 | } |
451 | int xen_blkbk_barrier(struct xenbus_transaction xbt, | 428 | int xen_blkbk_barrier(struct xenbus_transaction xbt, |
452 | struct backend_info *be, int state) | 429 | struct backend_info *be, int state) |
@@ -457,7 +434,7 @@ int xen_blkbk_barrier(struct xenbus_transaction xbt, | |||
457 | err = xenbus_printf(xbt, dev->nodename, "feature-barrier", | 434 | err = xenbus_printf(xbt, dev->nodename, "feature-barrier", |
458 | "%d", state); | 435 | "%d", state); |
459 | if (err) | 436 | if (err) |
460 | xenbus_dev_fatal(dev, err, "writing feature-barrier"); | 437 | dev_warn(&dev->dev, "writing feature-barrier (%d)", err); |
461 | 438 | ||
462 | return err; | 439 | return err; |
463 | } | 440 | } |
@@ -689,14 +666,12 @@ again: | |||
689 | return; | 666 | return; |
690 | } | 667 | } |
691 | 668 | ||
692 | err = xen_blkbk_flush_diskcache(xbt, be, be->blkif->vbd.flush_support); | 669 | /* If we can't advertise it is OK. */ |
693 | if (err) | 670 | xen_blkbk_flush_diskcache(xbt, be, be->blkif->vbd.flush_support); |
694 | goto abort; | ||
695 | 671 | ||
696 | err = xen_blkbk_discard(xbt, be); | 672 | xen_blkbk_discard(xbt, be); |
697 | 673 | ||
698 | /* If we can't advertise it is OK. */ | 674 | xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); |
699 | err = xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); | ||
700 | 675 | ||
701 | err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", | 676 | err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", |
702 | (unsigned long long)vbd_sz(&be->blkif->vbd)); | 677 | (unsigned long long)vbd_sz(&be->blkif->vbd)); |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 98cbeba8cd53..4e86393a09cf 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
44 | #include <linux/mutex.h> | 44 | #include <linux/mutex.h> |
45 | #include <linux/scatterlist.h> | 45 | #include <linux/scatterlist.h> |
46 | #include <linux/bitmap.h> | ||
46 | 47 | ||
47 | #include <xen/xen.h> | 48 | #include <xen/xen.h> |
48 | #include <xen/xenbus.h> | 49 | #include <xen/xenbus.h> |
@@ -81,6 +82,7 @@ static const struct block_device_operations xlvbd_block_fops; | |||
81 | */ | 82 | */ |
82 | struct blkfront_info | 83 | struct blkfront_info |
83 | { | 84 | { |
85 | spinlock_t io_lock; | ||
84 | struct mutex mutex; | 86 | struct mutex mutex; |
85 | struct xenbus_device *xbdev; | 87 | struct xenbus_device *xbdev; |
86 | struct gendisk *gd; | 88 | struct gendisk *gd; |
@@ -105,8 +107,6 @@ struct blkfront_info | |||
105 | int is_ready; | 107 | int is_ready; |
106 | }; | 108 | }; |
107 | 109 | ||
108 | static DEFINE_SPINLOCK(blkif_io_lock); | ||
109 | |||
110 | static unsigned int nr_minors; | 110 | static unsigned int nr_minors; |
111 | static unsigned long *minors; | 111 | static unsigned long *minors; |
112 | static DEFINE_SPINLOCK(minor_lock); | 112 | static DEFINE_SPINLOCK(minor_lock); |
@@ -177,8 +177,7 @@ static int xlbd_reserve_minors(unsigned int minor, unsigned int nr) | |||
177 | 177 | ||
178 | spin_lock(&minor_lock); | 178 | spin_lock(&minor_lock); |
179 | if (find_next_bit(minors, end, minor) >= end) { | 179 | if (find_next_bit(minors, end, minor) >= end) { |
180 | for (; minor < end; ++minor) | 180 | bitmap_set(minors, minor, nr); |
181 | __set_bit(minor, minors); | ||
182 | rc = 0; | 181 | rc = 0; |
183 | } else | 182 | } else |
184 | rc = -EBUSY; | 183 | rc = -EBUSY; |
@@ -193,8 +192,7 @@ static void xlbd_release_minors(unsigned int minor, unsigned int nr) | |||
193 | 192 | ||
194 | BUG_ON(end > nr_minors); | 193 | BUG_ON(end > nr_minors); |
195 | spin_lock(&minor_lock); | 194 | spin_lock(&minor_lock); |
196 | for (; minor < end; ++minor) | 195 | bitmap_clear(minors, minor, nr); |
197 | __clear_bit(minor, minors); | ||
198 | spin_unlock(&minor_lock); | 196 | spin_unlock(&minor_lock); |
199 | } | 197 | } |
200 | 198 | ||
@@ -419,7 +417,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) | |||
419 | struct request_queue *rq; | 417 | struct request_queue *rq; |
420 | struct blkfront_info *info = gd->private_data; | 418 | struct blkfront_info *info = gd->private_data; |
421 | 419 | ||
422 | rq = blk_init_queue(do_blkif_request, &blkif_io_lock); | 420 | rq = blk_init_queue(do_blkif_request, &info->io_lock); |
423 | if (rq == NULL) | 421 | if (rq == NULL) |
424 | return -1; | 422 | return -1; |
425 | 423 | ||
@@ -636,14 +634,14 @@ static void xlvbd_release_gendisk(struct blkfront_info *info) | |||
636 | if (info->rq == NULL) | 634 | if (info->rq == NULL) |
637 | return; | 635 | return; |
638 | 636 | ||
639 | spin_lock_irqsave(&blkif_io_lock, flags); | 637 | spin_lock_irqsave(&info->io_lock, flags); |
640 | 638 | ||
641 | /* No more blkif_request(). */ | 639 | /* No more blkif_request(). */ |
642 | blk_stop_queue(info->rq); | 640 | blk_stop_queue(info->rq); |
643 | 641 | ||
644 | /* No more gnttab callback work. */ | 642 | /* No more gnttab callback work. */ |
645 | gnttab_cancel_free_callback(&info->callback); | 643 | gnttab_cancel_free_callback(&info->callback); |
646 | spin_unlock_irqrestore(&blkif_io_lock, flags); | 644 | spin_unlock_irqrestore(&info->io_lock, flags); |
647 | 645 | ||
648 | /* Flush gnttab callback work. Must be done with no locks held. */ | 646 | /* Flush gnttab callback work. Must be done with no locks held. */ |
649 | flush_work_sync(&info->work); | 647 | flush_work_sync(&info->work); |
@@ -675,16 +673,16 @@ static void blkif_restart_queue(struct work_struct *work) | |||
675 | { | 673 | { |
676 | struct blkfront_info *info = container_of(work, struct blkfront_info, work); | 674 | struct blkfront_info *info = container_of(work, struct blkfront_info, work); |
677 | 675 | ||
678 | spin_lock_irq(&blkif_io_lock); | 676 | spin_lock_irq(&info->io_lock); |
679 | if (info->connected == BLKIF_STATE_CONNECTED) | 677 | if (info->connected == BLKIF_STATE_CONNECTED) |
680 | kick_pending_request_queues(info); | 678 | kick_pending_request_queues(info); |
681 | spin_unlock_irq(&blkif_io_lock); | 679 | spin_unlock_irq(&info->io_lock); |
682 | } | 680 | } |
683 | 681 | ||
684 | static void blkif_free(struct blkfront_info *info, int suspend) | 682 | static void blkif_free(struct blkfront_info *info, int suspend) |
685 | { | 683 | { |
686 | /* Prevent new requests being issued until we fix things up. */ | 684 | /* Prevent new requests being issued until we fix things up. */ |
687 | spin_lock_irq(&blkif_io_lock); | 685 | spin_lock_irq(&info->io_lock); |
688 | info->connected = suspend ? | 686 | info->connected = suspend ? |
689 | BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED; | 687 | BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED; |
690 | /* No more blkif_request(). */ | 688 | /* No more blkif_request(). */ |
@@ -692,7 +690,7 @@ static void blkif_free(struct blkfront_info *info, int suspend) | |||
692 | blk_stop_queue(info->rq); | 690 | blk_stop_queue(info->rq); |
693 | /* No more gnttab callback work. */ | 691 | /* No more gnttab callback work. */ |
694 | gnttab_cancel_free_callback(&info->callback); | 692 | gnttab_cancel_free_callback(&info->callback); |
695 | spin_unlock_irq(&blkif_io_lock); | 693 | spin_unlock_irq(&info->io_lock); |
696 | 694 | ||
697 | /* Flush gnttab callback work. Must be done with no locks held. */ | 695 | /* Flush gnttab callback work. Must be done with no locks held. */ |
698 | flush_work_sync(&info->work); | 696 | flush_work_sync(&info->work); |
@@ -728,10 +726,10 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
728 | struct blkfront_info *info = (struct blkfront_info *)dev_id; | 726 | struct blkfront_info *info = (struct blkfront_info *)dev_id; |
729 | int error; | 727 | int error; |
730 | 728 | ||
731 | spin_lock_irqsave(&blkif_io_lock, flags); | 729 | spin_lock_irqsave(&info->io_lock, flags); |
732 | 730 | ||
733 | if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) { | 731 | if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) { |
734 | spin_unlock_irqrestore(&blkif_io_lock, flags); | 732 | spin_unlock_irqrestore(&info->io_lock, flags); |
735 | return IRQ_HANDLED; | 733 | return IRQ_HANDLED; |
736 | } | 734 | } |
737 | 735 | ||
@@ -816,7 +814,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
816 | 814 | ||
817 | kick_pending_request_queues(info); | 815 | kick_pending_request_queues(info); |
818 | 816 | ||
819 | spin_unlock_irqrestore(&blkif_io_lock, flags); | 817 | spin_unlock_irqrestore(&info->io_lock, flags); |
820 | 818 | ||
821 | return IRQ_HANDLED; | 819 | return IRQ_HANDLED; |
822 | } | 820 | } |
@@ -991,6 +989,7 @@ static int blkfront_probe(struct xenbus_device *dev, | |||
991 | } | 989 | } |
992 | 990 | ||
993 | mutex_init(&info->mutex); | 991 | mutex_init(&info->mutex); |
992 | spin_lock_init(&info->io_lock); | ||
994 | info->xbdev = dev; | 993 | info->xbdev = dev; |
995 | info->vdevice = vdevice; | 994 | info->vdevice = vdevice; |
996 | info->connected = BLKIF_STATE_DISCONNECTED; | 995 | info->connected = BLKIF_STATE_DISCONNECTED; |
@@ -1068,7 +1067,7 @@ static int blkif_recover(struct blkfront_info *info) | |||
1068 | 1067 | ||
1069 | xenbus_switch_state(info->xbdev, XenbusStateConnected); | 1068 | xenbus_switch_state(info->xbdev, XenbusStateConnected); |
1070 | 1069 | ||
1071 | spin_lock_irq(&blkif_io_lock); | 1070 | spin_lock_irq(&info->io_lock); |
1072 | 1071 | ||
1073 | /* Now safe for us to use the shared ring */ | 1072 | /* Now safe for us to use the shared ring */ |
1074 | info->connected = BLKIF_STATE_CONNECTED; | 1073 | info->connected = BLKIF_STATE_CONNECTED; |
@@ -1079,7 +1078,7 @@ static int blkif_recover(struct blkfront_info *info) | |||
1079 | /* Kick any other new requests queued since we resumed */ | 1078 | /* Kick any other new requests queued since we resumed */ |
1080 | kick_pending_request_queues(info); | 1079 | kick_pending_request_queues(info); |
1081 | 1080 | ||
1082 | spin_unlock_irq(&blkif_io_lock); | 1081 | spin_unlock_irq(&info->io_lock); |
1083 | 1082 | ||
1084 | return 0; | 1083 | return 0; |
1085 | } | 1084 | } |
@@ -1277,10 +1276,10 @@ static void blkfront_connect(struct blkfront_info *info) | |||
1277 | xenbus_switch_state(info->xbdev, XenbusStateConnected); | 1276 | xenbus_switch_state(info->xbdev, XenbusStateConnected); |
1278 | 1277 | ||
1279 | /* Kick pending requests. */ | 1278 | /* Kick pending requests. */ |
1280 | spin_lock_irq(&blkif_io_lock); | 1279 | spin_lock_irq(&info->io_lock); |
1281 | info->connected = BLKIF_STATE_CONNECTED; | 1280 | info->connected = BLKIF_STATE_CONNECTED; |
1282 | kick_pending_request_queues(info); | 1281 | kick_pending_request_queues(info); |
1283 | spin_unlock_irq(&blkif_io_lock); | 1282 | spin_unlock_irq(&info->io_lock); |
1284 | 1283 | ||
1285 | add_disk(info->gd); | 1284 | add_disk(info->gd); |
1286 | 1285 | ||
@@ -1410,7 +1409,6 @@ static int blkif_release(struct gendisk *disk, fmode_t mode) | |||
1410 | mutex_lock(&blkfront_mutex); | 1409 | mutex_lock(&blkfront_mutex); |
1411 | 1410 | ||
1412 | bdev = bdget_disk(disk, 0); | 1411 | bdev = bdget_disk(disk, 0); |
1413 | bdput(bdev); | ||
1414 | 1412 | ||
1415 | if (bdev->bd_openers) | 1413 | if (bdev->bd_openers) |
1416 | goto out; | 1414 | goto out; |
@@ -1441,6 +1439,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode) | |||
1441 | } | 1439 | } |
1442 | 1440 | ||
1443 | out: | 1441 | out: |
1442 | bdput(bdev); | ||
1444 | mutex_unlock(&blkfront_mutex); | 1443 | mutex_unlock(&blkfront_mutex); |
1445 | return 0; | 1444 | return 0; |
1446 | } | 1445 | } |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 48442476ec00..ae9edca7b56d 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -72,7 +72,9 @@ static struct usb_device_id ath3k_table[] = { | |||
72 | 72 | ||
73 | /* Atheros AR3012 with sflash firmware*/ | 73 | /* Atheros AR3012 with sflash firmware*/ |
74 | { USB_DEVICE(0x0CF3, 0x3004) }, | 74 | { USB_DEVICE(0x0CF3, 0x3004) }, |
75 | { USB_DEVICE(0x0CF3, 0x311D) }, | ||
75 | { USB_DEVICE(0x13d3, 0x3375) }, | 76 | { USB_DEVICE(0x13d3, 0x3375) }, |
77 | { USB_DEVICE(0x04CA, 0x3005) }, | ||
76 | 78 | ||
77 | /* Atheros AR5BBU12 with sflash firmware */ | 79 | /* Atheros AR5BBU12 with sflash firmware */ |
78 | { USB_DEVICE(0x0489, 0xE02C) }, | 80 | { USB_DEVICE(0x0489, 0xE02C) }, |
@@ -89,7 +91,9 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
89 | 91 | ||
90 | /* Atheros AR3012 with sflash firmware*/ | 92 | /* Atheros AR3012 with sflash firmware*/ |
91 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 93 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
94 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | ||
92 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 95 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
96 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
93 | 97 | ||
94 | { } /* Terminating entry */ | 98 | { } /* Terminating entry */ |
95 | }; | 99 | }; |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 480cad920048..3311b812a0c6 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -61,7 +61,7 @@ static struct usb_device_id btusb_table[] = { | |||
61 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, | 61 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, |
62 | 62 | ||
63 | /* Broadcom SoftSailing reporting vendor specific */ | 63 | /* Broadcom SoftSailing reporting vendor specific */ |
64 | { USB_DEVICE(0x05ac, 0x21e1) }, | 64 | { USB_DEVICE(0x0a5c, 0x21e1) }, |
65 | 65 | ||
66 | /* Apple MacBookPro 7,1 */ | 66 | /* Apple MacBookPro 7,1 */ |
67 | { USB_DEVICE(0x05ac, 0x8213) }, | 67 | { USB_DEVICE(0x05ac, 0x8213) }, |
@@ -103,6 +103,7 @@ static struct usb_device_id btusb_table[] = { | |||
103 | /* Broadcom BCM20702A0 */ | 103 | /* Broadcom BCM20702A0 */ |
104 | { USB_DEVICE(0x0a5c, 0x21e3) }, | 104 | { USB_DEVICE(0x0a5c, 0x21e3) }, |
105 | { USB_DEVICE(0x0a5c, 0x21e6) }, | 105 | { USB_DEVICE(0x0a5c, 0x21e6) }, |
106 | { USB_DEVICE(0x0a5c, 0x21e8) }, | ||
106 | { USB_DEVICE(0x0a5c, 0x21f3) }, | 107 | { USB_DEVICE(0x0a5c, 0x21f3) }, |
107 | { USB_DEVICE(0x413c, 0x8197) }, | 108 | { USB_DEVICE(0x413c, 0x8197) }, |
108 | 109 | ||
@@ -129,7 +130,9 @@ static struct usb_device_id blacklist_table[] = { | |||
129 | 130 | ||
130 | /* Atheros 3012 with sflash firmware */ | 131 | /* Atheros 3012 with sflash firmware */ |
131 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 132 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
133 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | ||
132 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 134 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
135 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
133 | 136 | ||
134 | /* Atheros AR5BBU12 with sflash firmware */ | 137 | /* Atheros AR5BBU12 with sflash firmware */ |
135 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 138 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index fd5adb408f44..98a8c05d4f23 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -299,11 +299,11 @@ static void hci_uart_tty_close(struct tty_struct *tty) | |||
299 | hci_uart_close(hdev); | 299 | hci_uart_close(hdev); |
300 | 300 | ||
301 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { | 301 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { |
302 | hu->proto->close(hu); | ||
303 | if (hdev) { | 302 | if (hdev) { |
304 | hci_unregister_dev(hdev); | 303 | hci_unregister_dev(hdev); |
305 | hci_free_dev(hdev); | 304 | hci_free_dev(hdev); |
306 | } | 305 | } |
306 | hu->proto->close(hu); | ||
307 | } | 307 | } |
308 | 308 | ||
309 | kfree(hu); | 309 | kfree(hu); |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 3845ab44c330..dfd7876f127c 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -906,8 +906,8 @@ int hpet_alloc(struct hpet_data *hdp) | |||
906 | hpetp->hp_which, hdp->hd_phys_address, | 906 | hpetp->hp_which, hdp->hd_phys_address, |
907 | hpetp->hp_ntimer > 1 ? "s" : ""); | 907 | hpetp->hp_ntimer > 1 ? "s" : ""); |
908 | for (i = 0; i < hpetp->hp_ntimer; i++) | 908 | for (i = 0; i < hpetp->hp_ntimer; i++) |
909 | printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); | 909 | printk(KERN_CONT "%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); |
910 | printk("\n"); | 910 | printk(KERN_CONT "\n"); |
911 | 911 | ||
912 | temp = hpetp->hp_tick_freq; | 912 | temp = hpetp->hp_tick_freq; |
913 | remainder = do_div(temp, 1000000); | 913 | remainder = do_div(temp, 1000000); |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 54ca8b23cde3..4ec04a754733 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1260,10 +1260,15 @@ static int proc_do_uuid(ctl_table *table, int write, | |||
1260 | uuid = table->data; | 1260 | uuid = table->data; |
1261 | if (!uuid) { | 1261 | if (!uuid) { |
1262 | uuid = tmp_uuid; | 1262 | uuid = tmp_uuid; |
1263 | uuid[8] = 0; | ||
1264 | } | ||
1265 | if (uuid[8] == 0) | ||
1266 | generate_random_uuid(uuid); | 1263 | generate_random_uuid(uuid); |
1264 | } else { | ||
1265 | static DEFINE_SPINLOCK(bootid_spinlock); | ||
1266 | |||
1267 | spin_lock(&bootid_spinlock); | ||
1268 | if (!uuid[8]) | ||
1269 | generate_random_uuid(uuid); | ||
1270 | spin_unlock(&bootid_spinlock); | ||
1271 | } | ||
1267 | 1272 | ||
1268 | sprintf(buf, "%pU", uuid); | 1273 | sprintf(buf, "%pU", uuid); |
1269 | 1274 | ||
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index 82e882028fcf..6b5cf02c35c8 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/async.h> | ||
27 | #include <asm/io.h> | 26 | #include <asm/io.h> |
28 | 27 | ||
29 | /* | 28 | /* |
@@ -180,15 +179,17 @@ static int verify_pmtmr_rate(void) | |||
180 | /* Number of reads we try to get two different values */ | 179 | /* Number of reads we try to get two different values */ |
181 | #define ACPI_PM_READ_CHECKS 10000 | 180 | #define ACPI_PM_READ_CHECKS 10000 |
182 | 181 | ||
183 | static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie) | 182 | static int __init init_acpi_pm_clocksource(void) |
184 | { | 183 | { |
185 | cycle_t value1, value2; | 184 | cycle_t value1, value2; |
186 | unsigned int i, j = 0; | 185 | unsigned int i, j = 0; |
187 | 186 | ||
187 | if (!pmtmr_ioport) | ||
188 | return -ENODEV; | ||
188 | 189 | ||
189 | /* "verify" this timing source: */ | 190 | /* "verify" this timing source: */ |
190 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { | 191 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { |
191 | usleep_range(100 * j, 100 * j + 100); | 192 | udelay(100 * j); |
192 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); | 193 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
193 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { | 194 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { |
194 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); | 195 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
@@ -202,34 +203,25 @@ static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie | |||
202 | " 0x%#llx, 0x%#llx - aborting.\n", | 203 | " 0x%#llx, 0x%#llx - aborting.\n", |
203 | value1, value2); | 204 | value1, value2); |
204 | pmtmr_ioport = 0; | 205 | pmtmr_ioport = 0; |
205 | return; | 206 | return -EINVAL; |
206 | } | 207 | } |
207 | if (i == ACPI_PM_READ_CHECKS) { | 208 | if (i == ACPI_PM_READ_CHECKS) { |
208 | printk(KERN_INFO "PM-Timer failed consistency check " | 209 | printk(KERN_INFO "PM-Timer failed consistency check " |
209 | " (0x%#llx) - aborting.\n", value1); | 210 | " (0x%#llx) - aborting.\n", value1); |
210 | pmtmr_ioport = 0; | 211 | pmtmr_ioport = 0; |
211 | return; | 212 | return -ENODEV; |
212 | } | 213 | } |
213 | } | 214 | } |
214 | 215 | ||
215 | if (verify_pmtmr_rate() != 0){ | 216 | if (verify_pmtmr_rate() != 0){ |
216 | pmtmr_ioport = 0; | 217 | pmtmr_ioport = 0; |
217 | return; | 218 | return -ENODEV; |
218 | } | 219 | } |
219 | 220 | ||
220 | clocksource_register_hz(&clocksource_acpi_pm, | 221 | return clocksource_register_hz(&clocksource_acpi_pm, |
221 | PMTMR_TICKS_PER_SEC); | 222 | PMTMR_TICKS_PER_SEC); |
222 | } | 223 | } |
223 | 224 | ||
224 | static int __init init_acpi_pm_clocksource(void) | ||
225 | { | ||
226 | if (!pmtmr_ioport) | ||
227 | return -ENODEV; | ||
228 | |||
229 | async_schedule(acpi_pm_clocksource_async, NULL); | ||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | /* We use fs_initcall because we want the PCI fixups to have run | 225 | /* We use fs_initcall because we want the PCI fixups to have run |
234 | * but we still need to load before device_initcall | 226 | * but we still need to load before device_initcall |
235 | */ | 227 | */ |
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index ffbb44685915..5961e6415f08 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | config ARM_OMAP2PLUS_CPUFREQ | 5 | config ARM_OMAP2PLUS_CPUFREQ |
6 | bool "TI OMAP2+" | 6 | bool "TI OMAP2+" |
7 | depends on ARCH_OMAP2PLUS | ||
7 | default ARCH_OMAP2PLUS | 8 | default ARCH_OMAP2PLUS |
8 | select CPU_FREQ_TABLE | 9 | select CPU_FREQ_TABLE |
9 | 10 | ||
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 0053d7ebb5ca..8f3f74ce8c7f 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/gfp.h> | 20 | #include <linux/gfp.h> |
21 | #include <linux/module.h> | ||
21 | 22 | ||
22 | #include <crypto/ctr.h> | 23 | #include <crypto/ctr.h> |
23 | #include <crypto/des.h> | 24 | #include <crypto/des.h> |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index dc641c796526..921039e56f87 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
@@ -124,6 +124,9 @@ struct talitos_private { | |||
124 | void __iomem *reg; | 124 | void __iomem *reg; |
125 | int irq[2]; | 125 | int irq[2]; |
126 | 126 | ||
127 | /* SEC global registers lock */ | ||
128 | spinlock_t reg_lock ____cacheline_aligned; | ||
129 | |||
127 | /* SEC version geometry (from device tree node) */ | 130 | /* SEC version geometry (from device tree node) */ |
128 | unsigned int num_channels; | 131 | unsigned int num_channels; |
129 | unsigned int chfifo_len; | 132 | unsigned int chfifo_len; |
@@ -412,6 +415,7 @@ static void talitos_done_##name(unsigned long data) \ | |||
412 | { \ | 415 | { \ |
413 | struct device *dev = (struct device *)data; \ | 416 | struct device *dev = (struct device *)data; \ |
414 | struct talitos_private *priv = dev_get_drvdata(dev); \ | 417 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
418 | unsigned long flags; \ | ||
415 | \ | 419 | \ |
416 | if (ch_done_mask & 1) \ | 420 | if (ch_done_mask & 1) \ |
417 | flush_channel(dev, 0, 0, 0); \ | 421 | flush_channel(dev, 0, 0, 0); \ |
@@ -427,8 +431,10 @@ static void talitos_done_##name(unsigned long data) \ | |||
427 | out: \ | 431 | out: \ |
428 | /* At this point, all completed channels have been processed */ \ | 432 | /* At this point, all completed channels have been processed */ \ |
429 | /* Unmask done interrupts for channels completed later on. */ \ | 433 | /* Unmask done interrupts for channels completed later on. */ \ |
434 | spin_lock_irqsave(&priv->reg_lock, flags); \ | ||
430 | setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ | 435 | setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ |
431 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ | 436 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ |
437 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ | ||
432 | } | 438 | } |
433 | DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) | 439 | DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) |
434 | DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) | 440 | DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) |
@@ -619,22 +625,28 @@ static irqreturn_t talitos_interrupt_##name(int irq, void *data) \ | |||
619 | struct device *dev = data; \ | 625 | struct device *dev = data; \ |
620 | struct talitos_private *priv = dev_get_drvdata(dev); \ | 626 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
621 | u32 isr, isr_lo; \ | 627 | u32 isr, isr_lo; \ |
628 | unsigned long flags; \ | ||
622 | \ | 629 | \ |
630 | spin_lock_irqsave(&priv->reg_lock, flags); \ | ||
623 | isr = in_be32(priv->reg + TALITOS_ISR); \ | 631 | isr = in_be32(priv->reg + TALITOS_ISR); \ |
624 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ | 632 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ |
625 | /* Acknowledge interrupt */ \ | 633 | /* Acknowledge interrupt */ \ |
626 | out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ | 634 | out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ |
627 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ | 635 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ |
628 | \ | 636 | \ |
629 | if (unlikely((isr & ~TALITOS_ISR_4CHDONE) & ch_err_mask || isr_lo)) \ | 637 | if (unlikely(isr & ch_err_mask || isr_lo)) { \ |
630 | talitos_error(dev, isr, isr_lo); \ | 638 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ |
631 | else \ | 639 | talitos_error(dev, isr & ch_err_mask, isr_lo); \ |
640 | } \ | ||
641 | else { \ | ||
632 | if (likely(isr & ch_done_mask)) { \ | 642 | if (likely(isr & ch_done_mask)) { \ |
633 | /* mask further done interrupts. */ \ | 643 | /* mask further done interrupts. */ \ |
634 | clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ | 644 | clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ |
635 | /* done_task will unmask done interrupts at exit */ \ | 645 | /* done_task will unmask done interrupts at exit */ \ |
636 | tasklet_schedule(&priv->done_task[tlet]); \ | 646 | tasklet_schedule(&priv->done_task[tlet]); \ |
637 | } \ | 647 | } \ |
648 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ | ||
649 | } \ | ||
638 | \ | 650 | \ |
639 | return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ | 651 | return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ |
640 | IRQ_NONE; \ | 652 | IRQ_NONE; \ |
@@ -2719,6 +2731,8 @@ static int talitos_probe(struct platform_device *ofdev) | |||
2719 | 2731 | ||
2720 | priv->ofdev = ofdev; | 2732 | priv->ofdev = ofdev; |
2721 | 2733 | ||
2734 | spin_lock_init(&priv->reg_lock); | ||
2735 | |||
2722 | err = talitos_probe_irq(ofdev); | 2736 | err = talitos_probe_irq(ofdev); |
2723 | if (err) | 2737 | if (err) |
2724 | goto err_out; | 2738 | goto err_out; |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index cf9da362d64f..ef378b5b17e4 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -91,11 +91,10 @@ config DW_DMAC | |||
91 | 91 | ||
92 | config AT_HDMAC | 92 | config AT_HDMAC |
93 | tristate "Atmel AHB DMA support" | 93 | tristate "Atmel AHB DMA support" |
94 | depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 | 94 | depends on ARCH_AT91 |
95 | select DMA_ENGINE | 95 | select DMA_ENGINE |
96 | help | 96 | help |
97 | Support the Atmel AHB DMA controller. This can be integrated in | 97 | Support the Atmel AHB DMA controller. |
98 | chips such as the Atmel AT91SAM9RL. | ||
99 | 98 | ||
100 | config FSL_DMA | 99 | config FSL_DMA |
101 | tristate "Freescale Elo and Elo Plus DMA support" | 100 | tristate "Freescale Elo and Elo Plus DMA support" |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 767bcc31b365..2397f6f451b1 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -332,6 +332,20 @@ struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type) | |||
332 | } | 332 | } |
333 | EXPORT_SYMBOL(dma_find_channel); | 333 | EXPORT_SYMBOL(dma_find_channel); |
334 | 334 | ||
335 | /* | ||
336 | * net_dma_find_channel - find a channel for net_dma | ||
337 | * net_dma has alignment requirements | ||
338 | */ | ||
339 | struct dma_chan *net_dma_find_channel(void) | ||
340 | { | ||
341 | struct dma_chan *chan = dma_find_channel(DMA_MEMCPY); | ||
342 | if (chan && !is_dma_copy_aligned(chan->device, 1, 1, 1)) | ||
343 | return NULL; | ||
344 | |||
345 | return chan; | ||
346 | } | ||
347 | EXPORT_SYMBOL(net_dma_find_channel); | ||
348 | |||
335 | /** | 349 | /** |
336 | * dma_issue_pending_all - flush all pending operations across all channels | 350 | * dma_issue_pending_all - flush all pending operations across all channels |
337 | */ | 351 | */ |
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 31493d80e0e9..73b2b65cb1de 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
@@ -546,9 +546,9 @@ void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, | |||
546 | PCI_DMA_TODEVICE, flags, 0); | 546 | PCI_DMA_TODEVICE, flags, 0); |
547 | } | 547 | } |
548 | 548 | ||
549 | unsigned long ioat_get_current_completion(struct ioat_chan_common *chan) | 549 | dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan) |
550 | { | 550 | { |
551 | unsigned long phys_complete; | 551 | dma_addr_t phys_complete; |
552 | u64 completion; | 552 | u64 completion; |
553 | 553 | ||
554 | completion = *chan->completion; | 554 | completion = *chan->completion; |
@@ -569,7 +569,7 @@ unsigned long ioat_get_current_completion(struct ioat_chan_common *chan) | |||
569 | } | 569 | } |
570 | 570 | ||
571 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | 571 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, |
572 | unsigned long *phys_complete) | 572 | dma_addr_t *phys_complete) |
573 | { | 573 | { |
574 | *phys_complete = ioat_get_current_completion(chan); | 574 | *phys_complete = ioat_get_current_completion(chan); |
575 | if (*phys_complete == chan->last_completion) | 575 | if (*phys_complete == chan->last_completion) |
@@ -580,14 +580,14 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | |||
580 | return true; | 580 | return true; |
581 | } | 581 | } |
582 | 582 | ||
583 | static void __cleanup(struct ioat_dma_chan *ioat, unsigned long phys_complete) | 583 | static void __cleanup(struct ioat_dma_chan *ioat, dma_addr_t phys_complete) |
584 | { | 584 | { |
585 | struct ioat_chan_common *chan = &ioat->base; | 585 | struct ioat_chan_common *chan = &ioat->base; |
586 | struct list_head *_desc, *n; | 586 | struct list_head *_desc, *n; |
587 | struct dma_async_tx_descriptor *tx; | 587 | struct dma_async_tx_descriptor *tx; |
588 | 588 | ||
589 | dev_dbg(to_dev(chan), "%s: phys_complete: %lx\n", | 589 | dev_dbg(to_dev(chan), "%s: phys_complete: %llx\n", |
590 | __func__, phys_complete); | 590 | __func__, (unsigned long long) phys_complete); |
591 | list_for_each_safe(_desc, n, &ioat->used_desc) { | 591 | list_for_each_safe(_desc, n, &ioat->used_desc) { |
592 | struct ioat_desc_sw *desc; | 592 | struct ioat_desc_sw *desc; |
593 | 593 | ||
@@ -652,7 +652,7 @@ static void __cleanup(struct ioat_dma_chan *ioat, unsigned long phys_complete) | |||
652 | static void ioat1_cleanup(struct ioat_dma_chan *ioat) | 652 | static void ioat1_cleanup(struct ioat_dma_chan *ioat) |
653 | { | 653 | { |
654 | struct ioat_chan_common *chan = &ioat->base; | 654 | struct ioat_chan_common *chan = &ioat->base; |
655 | unsigned long phys_complete; | 655 | dma_addr_t phys_complete; |
656 | 656 | ||
657 | prefetch(chan->completion); | 657 | prefetch(chan->completion); |
658 | 658 | ||
@@ -698,7 +698,7 @@ static void ioat1_timer_event(unsigned long data) | |||
698 | mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); | 698 | mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); |
699 | spin_unlock_bh(&ioat->desc_lock); | 699 | spin_unlock_bh(&ioat->desc_lock); |
700 | } else if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { | 700 | } else if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { |
701 | unsigned long phys_complete; | 701 | dma_addr_t phys_complete; |
702 | 702 | ||
703 | spin_lock_bh(&ioat->desc_lock); | 703 | spin_lock_bh(&ioat->desc_lock); |
704 | /* if we haven't made progress and we have already | 704 | /* if we haven't made progress and we have already |
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index c7888bccd974..5e8fe01ba69d 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
@@ -88,7 +88,7 @@ struct ioatdma_device { | |||
88 | struct ioat_chan_common { | 88 | struct ioat_chan_common { |
89 | struct dma_chan common; | 89 | struct dma_chan common; |
90 | void __iomem *reg_base; | 90 | void __iomem *reg_base; |
91 | unsigned long last_completion; | 91 | dma_addr_t last_completion; |
92 | spinlock_t cleanup_lock; | 92 | spinlock_t cleanup_lock; |
93 | unsigned long state; | 93 | unsigned long state; |
94 | #define IOAT_COMPLETION_PENDING 0 | 94 | #define IOAT_COMPLETION_PENDING 0 |
@@ -310,7 +310,7 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device); | |||
310 | void __devexit ioat_dma_remove(struct ioatdma_device *device); | 310 | void __devexit ioat_dma_remove(struct ioatdma_device *device); |
311 | struct dca_provider * __devinit ioat_dca_init(struct pci_dev *pdev, | 311 | struct dca_provider * __devinit ioat_dca_init(struct pci_dev *pdev, |
312 | void __iomem *iobase); | 312 | void __iomem *iobase); |
313 | unsigned long ioat_get_current_completion(struct ioat_chan_common *chan); | 313 | dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan); |
314 | void ioat_init_channel(struct ioatdma_device *device, | 314 | void ioat_init_channel(struct ioatdma_device *device, |
315 | struct ioat_chan_common *chan, int idx); | 315 | struct ioat_chan_common *chan, int idx); |
316 | enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, | 316 | enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, |
@@ -318,7 +318,7 @@ enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, | |||
318 | void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, | 318 | void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, |
319 | size_t len, struct ioat_dma_descriptor *hw); | 319 | size_t len, struct ioat_dma_descriptor *hw); |
320 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | 320 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, |
321 | unsigned long *phys_complete); | 321 | dma_addr_t *phys_complete); |
322 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); | 322 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); |
323 | void ioat_kobject_del(struct ioatdma_device *device); | 323 | void ioat_kobject_del(struct ioatdma_device *device); |
324 | extern const struct sysfs_ops ioat_sysfs_ops; | 324 | extern const struct sysfs_ops ioat_sysfs_ops; |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index e8e110ff3d96..86895760b598 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -128,7 +128,7 @@ static void ioat2_start_null_desc(struct ioat2_dma_chan *ioat) | |||
128 | spin_unlock_bh(&ioat->prep_lock); | 128 | spin_unlock_bh(&ioat->prep_lock); |
129 | } | 129 | } |
130 | 130 | ||
131 | static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | 131 | static void __cleanup(struct ioat2_dma_chan *ioat, dma_addr_t phys_complete) |
132 | { | 132 | { |
133 | struct ioat_chan_common *chan = &ioat->base; | 133 | struct ioat_chan_common *chan = &ioat->base; |
134 | struct dma_async_tx_descriptor *tx; | 134 | struct dma_async_tx_descriptor *tx; |
@@ -179,7 +179,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | |||
179 | static void ioat2_cleanup(struct ioat2_dma_chan *ioat) | 179 | static void ioat2_cleanup(struct ioat2_dma_chan *ioat) |
180 | { | 180 | { |
181 | struct ioat_chan_common *chan = &ioat->base; | 181 | struct ioat_chan_common *chan = &ioat->base; |
182 | unsigned long phys_complete; | 182 | dma_addr_t phys_complete; |
183 | 183 | ||
184 | spin_lock_bh(&chan->cleanup_lock); | 184 | spin_lock_bh(&chan->cleanup_lock); |
185 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 185 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -260,7 +260,7 @@ int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo) | |||
260 | static void ioat2_restart_channel(struct ioat2_dma_chan *ioat) | 260 | static void ioat2_restart_channel(struct ioat2_dma_chan *ioat) |
261 | { | 261 | { |
262 | struct ioat_chan_common *chan = &ioat->base; | 262 | struct ioat_chan_common *chan = &ioat->base; |
263 | unsigned long phys_complete; | 263 | dma_addr_t phys_complete; |
264 | 264 | ||
265 | ioat2_quiesce(chan, 0); | 265 | ioat2_quiesce(chan, 0); |
266 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 266 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -275,7 +275,7 @@ void ioat2_timer_event(unsigned long data) | |||
275 | struct ioat_chan_common *chan = &ioat->base; | 275 | struct ioat_chan_common *chan = &ioat->base; |
276 | 276 | ||
277 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { | 277 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { |
278 | unsigned long phys_complete; | 278 | dma_addr_t phys_complete; |
279 | u64 status; | 279 | u64 status; |
280 | 280 | ||
281 | status = ioat_chansts(chan); | 281 | status = ioat_chansts(chan); |
@@ -572,9 +572,9 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order) | |||
572 | */ | 572 | */ |
573 | struct ioat_chan_common *chan = &ioat->base; | 573 | struct ioat_chan_common *chan = &ioat->base; |
574 | struct dma_chan *c = &chan->common; | 574 | struct dma_chan *c = &chan->common; |
575 | const u16 curr_size = ioat2_ring_size(ioat); | 575 | const u32 curr_size = ioat2_ring_size(ioat); |
576 | const u16 active = ioat2_ring_active(ioat); | 576 | const u16 active = ioat2_ring_active(ioat); |
577 | const u16 new_size = 1 << order; | 577 | const u32 new_size = 1 << order; |
578 | struct ioat_ring_ent **ring; | 578 | struct ioat_ring_ent **ring; |
579 | u16 i; | 579 | u16 i; |
580 | 580 | ||
diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h index a2c413b2b8d8..be2a55b95c23 100644 --- a/drivers/dma/ioat/dma_v2.h +++ b/drivers/dma/ioat/dma_v2.h | |||
@@ -74,7 +74,7 @@ static inline struct ioat2_dma_chan *to_ioat2_chan(struct dma_chan *c) | |||
74 | return container_of(chan, struct ioat2_dma_chan, base); | 74 | return container_of(chan, struct ioat2_dma_chan, base); |
75 | } | 75 | } |
76 | 76 | ||
77 | static inline u16 ioat2_ring_size(struct ioat2_dma_chan *ioat) | 77 | static inline u32 ioat2_ring_size(struct ioat2_dma_chan *ioat) |
78 | { | 78 | { |
79 | return 1 << ioat->alloc_order; | 79 | return 1 << ioat->alloc_order; |
80 | } | 80 | } |
@@ -91,7 +91,7 @@ static inline u16 ioat2_ring_pending(struct ioat2_dma_chan *ioat) | |||
91 | return CIRC_CNT(ioat->head, ioat->issued, ioat2_ring_size(ioat)); | 91 | return CIRC_CNT(ioat->head, ioat->issued, ioat2_ring_size(ioat)); |
92 | } | 92 | } |
93 | 93 | ||
94 | static inline u16 ioat2_ring_space(struct ioat2_dma_chan *ioat) | 94 | static inline u32 ioat2_ring_space(struct ioat2_dma_chan *ioat) |
95 | { | 95 | { |
96 | return ioat2_ring_size(ioat) - ioat2_ring_active(ioat); | 96 | return ioat2_ring_size(ioat) - ioat2_ring_active(ioat); |
97 | } | 97 | } |
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 2c4476c0e405..f7f1dc62c15c 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -257,7 +257,7 @@ static bool desc_has_ext(struct ioat_ring_ent *desc) | |||
257 | * The difference from the dma_v2.c __cleanup() is that this routine | 257 | * The difference from the dma_v2.c __cleanup() is that this routine |
258 | * handles extended descriptors and dma-unmapping raid operations. | 258 | * handles extended descriptors and dma-unmapping raid operations. |
259 | */ | 259 | */ |
260 | static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | 260 | static void __cleanup(struct ioat2_dma_chan *ioat, dma_addr_t phys_complete) |
261 | { | 261 | { |
262 | struct ioat_chan_common *chan = &ioat->base; | 262 | struct ioat_chan_common *chan = &ioat->base; |
263 | struct ioat_ring_ent *desc; | 263 | struct ioat_ring_ent *desc; |
@@ -314,7 +314,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | |||
314 | static void ioat3_cleanup(struct ioat2_dma_chan *ioat) | 314 | static void ioat3_cleanup(struct ioat2_dma_chan *ioat) |
315 | { | 315 | { |
316 | struct ioat_chan_common *chan = &ioat->base; | 316 | struct ioat_chan_common *chan = &ioat->base; |
317 | unsigned long phys_complete; | 317 | dma_addr_t phys_complete; |
318 | 318 | ||
319 | spin_lock_bh(&chan->cleanup_lock); | 319 | spin_lock_bh(&chan->cleanup_lock); |
320 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 320 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -333,7 +333,7 @@ static void ioat3_cleanup_event(unsigned long data) | |||
333 | static void ioat3_restart_channel(struct ioat2_dma_chan *ioat) | 333 | static void ioat3_restart_channel(struct ioat2_dma_chan *ioat) |
334 | { | 334 | { |
335 | struct ioat_chan_common *chan = &ioat->base; | 335 | struct ioat_chan_common *chan = &ioat->base; |
336 | unsigned long phys_complete; | 336 | dma_addr_t phys_complete; |
337 | 337 | ||
338 | ioat2_quiesce(chan, 0); | 338 | ioat2_quiesce(chan, 0); |
339 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 339 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -348,7 +348,7 @@ static void ioat3_timer_event(unsigned long data) | |||
348 | struct ioat_chan_common *chan = &ioat->base; | 348 | struct ioat_chan_common *chan = &ioat->base; |
349 | 349 | ||
350 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { | 350 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { |
351 | unsigned long phys_complete; | 351 | dma_addr_t phys_complete; |
352 | u64 status; | 352 | u64 status; |
353 | 353 | ||
354 | status = ioat_chansts(chan); | 354 | status = ioat_chansts(chan); |
@@ -1149,6 +1149,44 @@ static int ioat3_reset_hw(struct ioat_chan_common *chan) | |||
1149 | return ioat2_reset_sync(chan, msecs_to_jiffies(200)); | 1149 | return ioat2_reset_sync(chan, msecs_to_jiffies(200)); |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | static bool is_jf_ioat(struct pci_dev *pdev) | ||
1153 | { | ||
1154 | switch (pdev->device) { | ||
1155 | case PCI_DEVICE_ID_INTEL_IOAT_JSF0: | ||
1156 | case PCI_DEVICE_ID_INTEL_IOAT_JSF1: | ||
1157 | case PCI_DEVICE_ID_INTEL_IOAT_JSF2: | ||
1158 | case PCI_DEVICE_ID_INTEL_IOAT_JSF3: | ||
1159 | case PCI_DEVICE_ID_INTEL_IOAT_JSF4: | ||
1160 | case PCI_DEVICE_ID_INTEL_IOAT_JSF5: | ||
1161 | case PCI_DEVICE_ID_INTEL_IOAT_JSF6: | ||
1162 | case PCI_DEVICE_ID_INTEL_IOAT_JSF7: | ||
1163 | case PCI_DEVICE_ID_INTEL_IOAT_JSF8: | ||
1164 | case PCI_DEVICE_ID_INTEL_IOAT_JSF9: | ||
1165 | return true; | ||
1166 | default: | ||
1167 | return false; | ||
1168 | } | ||
1169 | } | ||
1170 | |||
1171 | static bool is_snb_ioat(struct pci_dev *pdev) | ||
1172 | { | ||
1173 | switch (pdev->device) { | ||
1174 | case PCI_DEVICE_ID_INTEL_IOAT_SNB0: | ||
1175 | case PCI_DEVICE_ID_INTEL_IOAT_SNB1: | ||
1176 | case PCI_DEVICE_ID_INTEL_IOAT_SNB2: | ||
1177 | case PCI_DEVICE_ID_INTEL_IOAT_SNB3: | ||
1178 | case PCI_DEVICE_ID_INTEL_IOAT_SNB4: | ||
1179 | case PCI_DEVICE_ID_INTEL_IOAT_SNB5: | ||
1180 | case PCI_DEVICE_ID_INTEL_IOAT_SNB6: | ||
1181 | case PCI_DEVICE_ID_INTEL_IOAT_SNB7: | ||
1182 | case PCI_DEVICE_ID_INTEL_IOAT_SNB8: | ||
1183 | case PCI_DEVICE_ID_INTEL_IOAT_SNB9: | ||
1184 | return true; | ||
1185 | default: | ||
1186 | return false; | ||
1187 | } | ||
1188 | } | ||
1189 | |||
1152 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | 1190 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) |
1153 | { | 1191 | { |
1154 | struct pci_dev *pdev = device->pdev; | 1192 | struct pci_dev *pdev = device->pdev; |
@@ -1169,6 +1207,9 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
1169 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; | 1207 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; |
1170 | dma->device_free_chan_resources = ioat2_free_chan_resources; | 1208 | dma->device_free_chan_resources = ioat2_free_chan_resources; |
1171 | 1209 | ||
1210 | if (is_jf_ioat(pdev) || is_snb_ioat(pdev)) | ||
1211 | dma->copy_align = 6; | ||
1212 | |||
1172 | dma_cap_set(DMA_INTERRUPT, dma->cap_mask); | 1213 | dma_cap_set(DMA_INTERRUPT, dma->cap_mask); |
1173 | dma->device_prep_dma_interrupt = ioat3_prep_interrupt_lock; | 1214 | dma->device_prep_dma_interrupt = ioat3_prep_interrupt_lock; |
1174 | 1215 | ||
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index da6c4c2c066a..79e3eba29702 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -1252,8 +1252,8 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device) | |||
1252 | struct page **pq_hw = &pq[IOP_ADMA_NUM_SRC_TEST+2]; | 1252 | struct page **pq_hw = &pq[IOP_ADMA_NUM_SRC_TEST+2]; |
1253 | /* address conversion buffers (dma_map / page_address) */ | 1253 | /* address conversion buffers (dma_map / page_address) */ |
1254 | void *pq_sw[IOP_ADMA_NUM_SRC_TEST+2]; | 1254 | void *pq_sw[IOP_ADMA_NUM_SRC_TEST+2]; |
1255 | dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST]; | 1255 | dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST+2]; |
1256 | dma_addr_t pq_dest[2]; | 1256 | dma_addr_t *pq_dest = &pq_src[IOP_ADMA_NUM_SRC_TEST]; |
1257 | 1257 | ||
1258 | int i; | 1258 | int i; |
1259 | struct dma_async_tx_descriptor *tx; | 1259 | struct dma_async_tx_descriptor *tx; |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index edadbdad31d0..e03653d69357 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -430,7 +430,7 @@ config GPIO_ML_IOH | |||
430 | 430 | ||
431 | config GPIO_SODAVILLE | 431 | config GPIO_SODAVILLE |
432 | bool "Intel Sodaville GPIO support" | 432 | bool "Intel Sodaville GPIO support" |
433 | depends on X86 && PCI && OF && BROKEN | 433 | depends on X86 && PCI && OF |
434 | select GPIO_GENERIC | 434 | select GPIO_GENERIC |
435 | select GENERIC_IRQ_CHIP | 435 | select GENERIC_IRQ_CHIP |
436 | help | 436 | help |
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c index 9ad1703d1408..ae5d7f12ce66 100644 --- a/drivers/gpio/gpio-adp5588.c +++ b/drivers/gpio/gpio-adp5588.c | |||
@@ -252,7 +252,7 @@ static irqreturn_t adp5588_irq_handler(int irq, void *devid) | |||
252 | if (ret < 0) | 252 | if (ret < 0) |
253 | memset(dev->irq_stat, 0, ARRAY_SIZE(dev->irq_stat)); | 253 | memset(dev->irq_stat, 0, ARRAY_SIZE(dev->irq_stat)); |
254 | 254 | ||
255 | for (bank = 0; bank <= ADP5588_BANK(ADP5588_MAXGPIO); | 255 | for (bank = 0, bit = 0; bank <= ADP5588_BANK(ADP5588_MAXGPIO); |
256 | bank++, bit = 0) { | 256 | bank++, bit = 0) { |
257 | pending = dev->irq_stat[bank] & dev->irq_mask[bank]; | 257 | pending = dev->irq_stat[bank] & dev->irq_mask[bank]; |
258 | 258 | ||
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 46277877b7ec..19d6fc0229c3 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -2382,8 +2382,8 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { | |||
2382 | #endif | 2382 | #endif |
2383 | }; | 2383 | }; |
2384 | 2384 | ||
2385 | static struct samsung_gpio_chip exynos5_gpios_1[] = { | ||
2386 | #ifdef CONFIG_ARCH_EXYNOS5 | 2385 | #ifdef CONFIG_ARCH_EXYNOS5 |
2386 | static struct samsung_gpio_chip exynos5_gpios_1[] = { | ||
2387 | { | 2387 | { |
2388 | .chip = { | 2388 | .chip = { |
2389 | .base = EXYNOS5_GPA0(0), | 2389 | .base = EXYNOS5_GPA0(0), |
@@ -2541,11 +2541,11 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = { | |||
2541 | .to_irq = samsung_gpiolib_to_irq, | 2541 | .to_irq = samsung_gpiolib_to_irq, |
2542 | }, | 2542 | }, |
2543 | }, | 2543 | }, |
2544 | #endif | ||
2545 | }; | 2544 | }; |
2545 | #endif | ||
2546 | 2546 | ||
2547 | static struct samsung_gpio_chip exynos5_gpios_2[] = { | ||
2548 | #ifdef CONFIG_ARCH_EXYNOS5 | 2547 | #ifdef CONFIG_ARCH_EXYNOS5 |
2548 | static struct samsung_gpio_chip exynos5_gpios_2[] = { | ||
2549 | { | 2549 | { |
2550 | .chip = { | 2550 | .chip = { |
2551 | .base = EXYNOS5_GPE0(0), | 2551 | .base = EXYNOS5_GPE0(0), |
@@ -2602,11 +2602,11 @@ static struct samsung_gpio_chip exynos5_gpios_2[] = { | |||
2602 | 2602 | ||
2603 | }, | 2603 | }, |
2604 | }, | 2604 | }, |
2605 | #endif | ||
2606 | }; | 2605 | }; |
2606 | #endif | ||
2607 | 2607 | ||
2608 | static struct samsung_gpio_chip exynos5_gpios_3[] = { | ||
2609 | #ifdef CONFIG_ARCH_EXYNOS5 | 2608 | #ifdef CONFIG_ARCH_EXYNOS5 |
2609 | static struct samsung_gpio_chip exynos5_gpios_3[] = { | ||
2610 | { | 2610 | { |
2611 | .chip = { | 2611 | .chip = { |
2612 | .base = EXYNOS5_GPV0(0), | 2612 | .base = EXYNOS5_GPV0(0), |
@@ -2638,11 +2638,11 @@ static struct samsung_gpio_chip exynos5_gpios_3[] = { | |||
2638 | .label = "GPV4", | 2638 | .label = "GPV4", |
2639 | }, | 2639 | }, |
2640 | }, | 2640 | }, |
2641 | #endif | ||
2642 | }; | 2641 | }; |
2642 | #endif | ||
2643 | 2643 | ||
2644 | static struct samsung_gpio_chip exynos5_gpios_4[] = { | ||
2645 | #ifdef CONFIG_ARCH_EXYNOS5 | 2644 | #ifdef CONFIG_ARCH_EXYNOS5 |
2645 | static struct samsung_gpio_chip exynos5_gpios_4[] = { | ||
2646 | { | 2646 | { |
2647 | .chip = { | 2647 | .chip = { |
2648 | .base = EXYNOS5_GPZ(0), | 2648 | .base = EXYNOS5_GPZ(0), |
@@ -2650,8 +2650,8 @@ static struct samsung_gpio_chip exynos5_gpios_4[] = { | |||
2650 | .label = "GPZ", | 2650 | .label = "GPZ", |
2651 | }, | 2651 | }, |
2652 | }, | 2652 | }, |
2653 | #endif | ||
2654 | }; | 2653 | }; |
2654 | #endif | ||
2655 | 2655 | ||
2656 | 2656 | ||
2657 | #if defined(CONFIG_ARCH_EXYNOS) && defined(CONFIG_OF) | 2657 | #if defined(CONFIG_ARCH_EXYNOS) && defined(CONFIG_OF) |
diff --git a/drivers/gpio/gpio-sodaville.c b/drivers/gpio/gpio-sodaville.c index 9ba15d31d242..031e5d24837d 100644 --- a/drivers/gpio/gpio-sodaville.c +++ b/drivers/gpio/gpio-sodaville.c | |||
@@ -41,7 +41,7 @@ | |||
41 | struct sdv_gpio_chip_data { | 41 | struct sdv_gpio_chip_data { |
42 | int irq_base; | 42 | int irq_base; |
43 | void __iomem *gpio_pub_base; | 43 | void __iomem *gpio_pub_base; |
44 | struct irq_domain id; | 44 | struct irq_domain *id; |
45 | struct irq_chip_generic *gc; | 45 | struct irq_chip_generic *gc; |
46 | struct bgpio_chip bgpio; | 46 | struct bgpio_chip bgpio; |
47 | }; | 47 | }; |
@@ -51,10 +51,9 @@ static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type) | |||
51 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 51 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
52 | struct sdv_gpio_chip_data *sd = gc->private; | 52 | struct sdv_gpio_chip_data *sd = gc->private; |
53 | void __iomem *type_reg; | 53 | void __iomem *type_reg; |
54 | u32 irq_offs = d->irq - sd->irq_base; | ||
55 | u32 reg; | 54 | u32 reg; |
56 | 55 | ||
57 | if (irq_offs < 8) | 56 | if (d->hwirq < 8) |
58 | type_reg = sd->gpio_pub_base + GPIT1R0; | 57 | type_reg = sd->gpio_pub_base + GPIT1R0; |
59 | else | 58 | else |
60 | type_reg = sd->gpio_pub_base + GPIT1R1; | 59 | type_reg = sd->gpio_pub_base + GPIT1R1; |
@@ -63,11 +62,11 @@ static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type) | |||
63 | 62 | ||
64 | switch (type) { | 63 | switch (type) { |
65 | case IRQ_TYPE_LEVEL_HIGH: | 64 | case IRQ_TYPE_LEVEL_HIGH: |
66 | reg &= ~BIT(4 * (irq_offs % 8)); | 65 | reg &= ~BIT(4 * (d->hwirq % 8)); |
67 | break; | 66 | break; |
68 | 67 | ||
69 | case IRQ_TYPE_LEVEL_LOW: | 68 | case IRQ_TYPE_LEVEL_LOW: |
70 | reg |= BIT(4 * (irq_offs % 8)); | 69 | reg |= BIT(4 * (d->hwirq % 8)); |
71 | break; | 70 | break; |
72 | 71 | ||
73 | default: | 72 | default: |
@@ -91,7 +90,7 @@ static irqreturn_t sdv_gpio_pub_irq_handler(int irq, void *data) | |||
91 | u32 irq_bit = __fls(irq_stat); | 90 | u32 irq_bit = __fls(irq_stat); |
92 | 91 | ||
93 | irq_stat &= ~BIT(irq_bit); | 92 | irq_stat &= ~BIT(irq_bit); |
94 | generic_handle_irq(sd->irq_base + irq_bit); | 93 | generic_handle_irq(irq_find_mapping(sd->id, irq_bit)); |
95 | } | 94 | } |
96 | 95 | ||
97 | return IRQ_HANDLED; | 96 | return IRQ_HANDLED; |
@@ -127,7 +126,7 @@ static int sdv_xlate(struct irq_domain *h, struct device_node *node, | |||
127 | } | 126 | } |
128 | 127 | ||
129 | static struct irq_domain_ops irq_domain_sdv_ops = { | 128 | static struct irq_domain_ops irq_domain_sdv_ops = { |
130 | .dt_translate = sdv_xlate, | 129 | .xlate = sdv_xlate, |
131 | }; | 130 | }; |
132 | 131 | ||
133 | static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, | 132 | static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, |
@@ -149,10 +148,6 @@ static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, | |||
149 | if (ret) | 148 | if (ret) |
150 | goto out_free_desc; | 149 | goto out_free_desc; |
151 | 150 | ||
152 | sd->id.irq_base = sd->irq_base; | ||
153 | sd->id.of_node = of_node_get(pdev->dev.of_node); | ||
154 | sd->id.ops = &irq_domain_sdv_ops; | ||
155 | |||
156 | /* | 151 | /* |
157 | * This gpio irq controller latches level irqs. Testing shows that if | 152 | * This gpio irq controller latches level irqs. Testing shows that if |
158 | * we unmask & ACK the IRQ before the source of the interrupt is gone | 153 | * we unmask & ACK the IRQ before the source of the interrupt is gone |
@@ -179,7 +174,10 @@ static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, | |||
179 | IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, | 174 | IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, |
180 | IRQ_LEVEL | IRQ_NOPROBE); | 175 | IRQ_LEVEL | IRQ_NOPROBE); |
181 | 176 | ||
182 | irq_domain_add(&sd->id); | 177 | sd->id = irq_domain_add_legacy(pdev->dev.of_node, SDV_NUM_PUB_GPIOS, |
178 | sd->irq_base, 0, &irq_domain_sdv_ops, sd); | ||
179 | if (!sd->id) | ||
180 | goto out_free_irq; | ||
183 | return 0; | 181 | return 0; |
184 | out_free_irq: | 182 | out_free_irq: |
185 | free_irq(pdev->irq, sd); | 183 | free_irq(pdev->irq, sd); |
@@ -260,7 +258,6 @@ static void sdv_gpio_remove(struct pci_dev *pdev) | |||
260 | { | 258 | { |
261 | struct sdv_gpio_chip_data *sd = pci_get_drvdata(pdev); | 259 | struct sdv_gpio_chip_data *sd = pci_get_drvdata(pdev); |
262 | 260 | ||
263 | irq_domain_del(&sd->id); | ||
264 | free_irq(pdev->irq, sd); | 261 | free_irq(pdev->irq, sd); |
265 | irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); | 262 | irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); |
266 | 263 | ||
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 30372f7b2d45..348b367debeb 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -1510,8 +1510,8 @@ int drm_freebufs(struct drm_device *dev, void *data, | |||
1510 | * \param arg pointer to a drm_buf_map structure. | 1510 | * \param arg pointer to a drm_buf_map structure. |
1511 | * \return zero on success or a negative number on failure. | 1511 | * \return zero on success or a negative number on failure. |
1512 | * | 1512 | * |
1513 | * Maps the AGP, SG or PCI buffer region with do_mmap(), and copies information | 1513 | * Maps the AGP, SG or PCI buffer region with vm_mmap(), and copies information |
1514 | * about each buffer into user space. For PCI buffers, it calls do_mmap() with | 1514 | * about each buffer into user space. For PCI buffers, it calls vm_mmap() with |
1515 | * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls | 1515 | * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls |
1516 | * drm_mmap_dma(). | 1516 | * drm_mmap_dma(). |
1517 | */ | 1517 | */ |
@@ -1553,18 +1553,14 @@ int drm_mapbufs(struct drm_device *dev, void *data, | |||
1553 | retcode = -EINVAL; | 1553 | retcode = -EINVAL; |
1554 | goto done; | 1554 | goto done; |
1555 | } | 1555 | } |
1556 | down_write(¤t->mm->mmap_sem); | 1556 | virtual = vm_mmap(file_priv->filp, 0, map->size, |
1557 | virtual = do_mmap(file_priv->filp, 0, map->size, | ||
1558 | PROT_READ | PROT_WRITE, | 1557 | PROT_READ | PROT_WRITE, |
1559 | MAP_SHARED, | 1558 | MAP_SHARED, |
1560 | token); | 1559 | token); |
1561 | up_write(¤t->mm->mmap_sem); | ||
1562 | } else { | 1560 | } else { |
1563 | down_write(¤t->mm->mmap_sem); | 1561 | virtual = vm_mmap(file_priv->filp, 0, dma->byte_count, |
1564 | virtual = do_mmap(file_priv->filp, 0, dma->byte_count, | ||
1565 | PROT_READ | PROT_WRITE, | 1562 | PROT_READ | PROT_WRITE, |
1566 | MAP_SHARED, 0); | 1563 | MAP_SHARED, 0); |
1567 | up_write(¤t->mm->mmap_sem); | ||
1568 | } | 1564 | } |
1569 | if (virtual > -1024UL) { | 1565 | if (virtual > -1024UL) { |
1570 | /* Real error */ | 1566 | /* Real error */ |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d3aaeb6ae236..c79870a75c2f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -3335,10 +3335,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, | |||
3335 | 3335 | ||
3336 | ret = crtc->funcs->page_flip(crtc, fb, e); | 3336 | ret = crtc->funcs->page_flip(crtc, fb, e); |
3337 | if (ret) { | 3337 | if (ret) { |
3338 | spin_lock_irqsave(&dev->event_lock, flags); | 3338 | if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { |
3339 | file_priv->event_space += sizeof e->event; | 3339 | spin_lock_irqsave(&dev->event_lock, flags); |
3340 | spin_unlock_irqrestore(&dev->event_lock, flags); | 3340 | file_priv->event_space += sizeof e->event; |
3341 | kfree(e); | 3341 | spin_unlock_irqrestore(&dev->event_lock, flags); |
3342 | kfree(e); | ||
3343 | } | ||
3342 | } | 3344 | } |
3343 | 3345 | ||
3344 | out: | 3346 | out: |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index cdfbf27b2b3c..123de28f94ef 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -507,12 +507,12 @@ int drm_release(struct inode *inode, struct file *filp) | |||
507 | 507 | ||
508 | drm_events_release(file_priv); | 508 | drm_events_release(file_priv); |
509 | 509 | ||
510 | if (dev->driver->driver_features & DRIVER_GEM) | ||
511 | drm_gem_release(dev, file_priv); | ||
512 | |||
513 | if (dev->driver->driver_features & DRIVER_MODESET) | 510 | if (dev->driver->driver_features & DRIVER_MODESET) |
514 | drm_fb_release(file_priv); | 511 | drm_fb_release(file_priv); |
515 | 512 | ||
513 | if (dev->driver->driver_features & DRIVER_GEM) | ||
514 | drm_gem_release(dev, file_priv); | ||
515 | |||
516 | mutex_lock(&dev->ctxlist_mutex); | 516 | mutex_lock(&dev->ctxlist_mutex); |
517 | if (!list_empty(&dev->ctxlist)) { | 517 | if (!list_empty(&dev->ctxlist)) { |
518 | struct drm_ctx_list *pos, *n; | 518 | struct drm_ctx_list *pos, *n; |
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c index c8c83dad2ce1..37c9a523dd1c 100644 --- a/drivers/gpu/drm/drm_usb.c +++ b/drivers/gpu/drm/drm_usb.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "drmP.h" | 1 | #include "drmP.h" |
2 | #include <linux/usb.h> | 2 | #include <linux/usb.h> |
3 | #include <linux/export.h> | 3 | #include <linux/module.h> |
4 | 4 | ||
5 | int drm_get_usb_dev(struct usb_interface *interface, | 5 | int drm_get_usb_dev(struct usb_interface *interface, |
6 | const struct usb_device_id *id, | 6 | const struct usb_device_id *id, |
@@ -114,3 +114,7 @@ void drm_usb_exit(struct drm_driver *driver, | |||
114 | usb_deregister(udriver); | 114 | usb_deregister(udriver); |
115 | } | 115 | } |
116 | EXPORT_SYMBOL(drm_usb_exit); | 116 | EXPORT_SYMBOL(drm_usb_exit); |
117 | |||
118 | MODULE_AUTHOR("David Airlie"); | ||
119 | MODULE_DESCRIPTION("USB DRM support"); | ||
120 | MODULE_LICENSE("GPL and additional rights"); | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 4a3a5f72ed4a..de8d2090bce3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c | |||
@@ -34,14 +34,14 @@ | |||
34 | static int lowlevel_buffer_allocate(struct drm_device *dev, | 34 | static int lowlevel_buffer_allocate(struct drm_device *dev, |
35 | unsigned int flags, struct exynos_drm_gem_buf *buf) | 35 | unsigned int flags, struct exynos_drm_gem_buf *buf) |
36 | { | 36 | { |
37 | dma_addr_t start_addr, end_addr; | 37 | dma_addr_t start_addr; |
38 | unsigned int npages, page_size, i = 0; | 38 | unsigned int npages, page_size, i = 0; |
39 | struct scatterlist *sgl; | 39 | struct scatterlist *sgl; |
40 | int ret = 0; | 40 | int ret = 0; |
41 | 41 | ||
42 | DRM_DEBUG_KMS("%s\n", __FILE__); | 42 | DRM_DEBUG_KMS("%s\n", __FILE__); |
43 | 43 | ||
44 | if (flags & EXYNOS_BO_NONCONTIG) { | 44 | if (IS_NONCONTIG_BUFFER(flags)) { |
45 | DRM_DEBUG_KMS("not support allocation type.\n"); | 45 | DRM_DEBUG_KMS("not support allocation type.\n"); |
46 | return -EINVAL; | 46 | return -EINVAL; |
47 | } | 47 | } |
@@ -52,13 +52,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
52 | } | 52 | } |
53 | 53 | ||
54 | if (buf->size >= SZ_1M) { | 54 | if (buf->size >= SZ_1M) { |
55 | npages = (buf->size >> SECTION_SHIFT) + 1; | 55 | npages = buf->size >> SECTION_SHIFT; |
56 | page_size = SECTION_SIZE; | 56 | page_size = SECTION_SIZE; |
57 | } else if (buf->size >= SZ_64K) { | 57 | } else if (buf->size >= SZ_64K) { |
58 | npages = (buf->size >> 16) + 1; | 58 | npages = buf->size >> 16; |
59 | page_size = SZ_64K; | 59 | page_size = SZ_64K; |
60 | } else { | 60 | } else { |
61 | npages = (buf->size >> PAGE_SHIFT) + 1; | 61 | npages = buf->size >> PAGE_SHIFT; |
62 | page_size = PAGE_SIZE; | 62 | page_size = PAGE_SIZE; |
63 | } | 63 | } |
64 | 64 | ||
@@ -76,26 +76,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
76 | return -ENOMEM; | 76 | return -ENOMEM; |
77 | } | 77 | } |
78 | 78 | ||
79 | buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size, | 79 | buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size, |
80 | &buf->dma_addr, GFP_KERNEL); | 80 | &buf->dma_addr, GFP_KERNEL); |
81 | if (!buf->kvaddr) { | 81 | if (!buf->kvaddr) { |
82 | DRM_ERROR("failed to allocate buffer.\n"); | 82 | DRM_ERROR("failed to allocate buffer.\n"); |
83 | ret = -ENOMEM; | 83 | ret = -ENOMEM; |
84 | goto err1; | 84 | goto err1; |
85 | } | 85 | } |
86 | |||
87 | start_addr = buf->dma_addr; | ||
88 | end_addr = buf->dma_addr + buf->size; | ||
89 | |||
90 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); | ||
91 | if (!buf->pages) { | ||
92 | DRM_ERROR("failed to allocate pages.\n"); | ||
93 | ret = -ENOMEM; | ||
94 | goto err2; | ||
95 | } | ||
96 | |||
97 | start_addr = buf->dma_addr; | ||
98 | end_addr = buf->dma_addr + buf->size; | ||
99 | 86 | ||
100 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); | 87 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); |
101 | if (!buf->pages) { | 88 | if (!buf->pages) { |
@@ -105,23 +92,17 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
105 | } | 92 | } |
106 | 93 | ||
107 | sgl = buf->sgt->sgl; | 94 | sgl = buf->sgt->sgl; |
95 | start_addr = buf->dma_addr; | ||
108 | 96 | ||
109 | while (i < npages) { | 97 | while (i < npages) { |
110 | buf->pages[i] = phys_to_page(start_addr); | 98 | buf->pages[i] = phys_to_page(start_addr); |
111 | sg_set_page(sgl, buf->pages[i], page_size, 0); | 99 | sg_set_page(sgl, buf->pages[i], page_size, 0); |
112 | sg_dma_address(sgl) = start_addr; | 100 | sg_dma_address(sgl) = start_addr; |
113 | start_addr += page_size; | 101 | start_addr += page_size; |
114 | if (end_addr - start_addr < page_size) | ||
115 | break; | ||
116 | sgl = sg_next(sgl); | 102 | sgl = sg_next(sgl); |
117 | i++; | 103 | i++; |
118 | } | 104 | } |
119 | 105 | ||
120 | buf->pages[i] = phys_to_page(start_addr); | ||
121 | |||
122 | sgl = sg_next(sgl); | ||
123 | sg_set_page(sgl, buf->pages[i+1], end_addr - start_addr, 0); | ||
124 | |||
125 | DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", | 106 | DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", |
126 | (unsigned long)buf->kvaddr, | 107 | (unsigned long)buf->kvaddr, |
127 | (unsigned long)buf->dma_addr, | 108 | (unsigned long)buf->dma_addr, |
@@ -150,7 +131,7 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, | |||
150 | * non-continuous memory would be released by exynos | 131 | * non-continuous memory would be released by exynos |
151 | * gem framework. | 132 | * gem framework. |
152 | */ | 133 | */ |
153 | if (flags & EXYNOS_BO_NONCONTIG) { | 134 | if (IS_NONCONTIG_BUFFER(flags)) { |
154 | DRM_DEBUG_KMS("not support allocation type.\n"); | 135 | DRM_DEBUG_KMS("not support allocation type.\n"); |
155 | return; | 136 | return; |
156 | } | 137 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 411832e8e17a..eaf630dc5dba 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c | |||
@@ -54,16 +54,18 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev, | |||
54 | * | 54 | * |
55 | * P.S. note that this driver is considered for modularization. | 55 | * P.S. note that this driver is considered for modularization. |
56 | */ | 56 | */ |
57 | ret = subdrv->probe(dev, subdrv->manager.dev); | 57 | ret = subdrv->probe(dev, subdrv->dev); |
58 | if (ret) | 58 | if (ret) |
59 | return ret; | 59 | return ret; |
60 | } | 60 | } |
61 | 61 | ||
62 | if (subdrv->is_local) | 62 | if (!subdrv->manager) |
63 | return 0; | 63 | return 0; |
64 | 64 | ||
65 | subdrv->manager->dev = subdrv->dev; | ||
66 | |||
65 | /* create and initialize a encoder for this sub driver. */ | 67 | /* create and initialize a encoder for this sub driver. */ |
66 | encoder = exynos_drm_encoder_create(dev, &subdrv->manager, | 68 | encoder = exynos_drm_encoder_create(dev, subdrv->manager, |
67 | (1 << MAX_CRTC) - 1); | 69 | (1 << MAX_CRTC) - 1); |
68 | if (!encoder) { | 70 | if (!encoder) { |
69 | DRM_ERROR("failed to create encoder\n"); | 71 | DRM_ERROR("failed to create encoder\n"); |
@@ -186,7 +188,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) | |||
186 | 188 | ||
187 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | 189 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
188 | if (subdrv->open) { | 190 | if (subdrv->open) { |
189 | ret = subdrv->open(dev, subdrv->manager.dev, file); | 191 | ret = subdrv->open(dev, subdrv->dev, file); |
190 | if (ret) | 192 | if (ret) |
191 | goto err; | 193 | goto err; |
192 | } | 194 | } |
@@ -197,7 +199,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) | |||
197 | err: | 199 | err: |
198 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { | 200 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { |
199 | if (subdrv->close) | 201 | if (subdrv->close) |
200 | subdrv->close(dev, subdrv->manager.dev, file); | 202 | subdrv->close(dev, subdrv->dev, file); |
201 | } | 203 | } |
202 | return ret; | 204 | return ret; |
203 | } | 205 | } |
@@ -209,7 +211,7 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) | |||
209 | 211 | ||
210 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | 212 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
211 | if (subdrv->close) | 213 | if (subdrv->close) |
212 | subdrv->close(dev, subdrv->manager.dev, file); | 214 | subdrv->close(dev, subdrv->dev, file); |
213 | } | 215 | } |
214 | } | 216 | } |
215 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); | 217 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index fbd0a232c93d..1d814175cd49 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -225,24 +225,25 @@ struct exynos_drm_private { | |||
225 | * Exynos drm sub driver structure. | 225 | * Exynos drm sub driver structure. |
226 | * | 226 | * |
227 | * @list: sub driver has its own list object to register to exynos drm driver. | 227 | * @list: sub driver has its own list object to register to exynos drm driver. |
228 | * @dev: pointer to device object for subdrv device driver. | ||
228 | * @drm_dev: pointer to drm_device and this pointer would be set | 229 | * @drm_dev: pointer to drm_device and this pointer would be set |
229 | * when sub driver calls exynos_drm_subdrv_register(). | 230 | * when sub driver calls exynos_drm_subdrv_register(). |
230 | * @is_local: appear encoder and connector disrelated device. | 231 | * @manager: subdrv has its own manager to control a hardware appropriately |
232 | * and we can access a hardware drawing on this manager. | ||
231 | * @probe: this callback would be called by exynos drm driver after | 233 | * @probe: this callback would be called by exynos drm driver after |
232 | * subdrv is registered to it. | 234 | * subdrv is registered to it. |
233 | * @remove: this callback is used to release resources created | 235 | * @remove: this callback is used to release resources created |
234 | * by probe callback. | 236 | * by probe callback. |
235 | * @open: this would be called with drm device file open. | 237 | * @open: this would be called with drm device file open. |
236 | * @close: this would be called with drm device file close. | 238 | * @close: this would be called with drm device file close. |
237 | * @manager: subdrv has its own manager to control a hardware appropriately | ||
238 | * and we can access a hardware drawing on this manager. | ||
239 | * @encoder: encoder object owned by this sub driver. | 239 | * @encoder: encoder object owned by this sub driver. |
240 | * @connector: connector object owned by this sub driver. | 240 | * @connector: connector object owned by this sub driver. |
241 | */ | 241 | */ |
242 | struct exynos_drm_subdrv { | 242 | struct exynos_drm_subdrv { |
243 | struct list_head list; | 243 | struct list_head list; |
244 | struct device *dev; | ||
244 | struct drm_device *drm_dev; | 245 | struct drm_device *drm_dev; |
245 | bool is_local; | 246 | struct exynos_drm_manager *manager; |
246 | 247 | ||
247 | int (*probe)(struct drm_device *drm_dev, struct device *dev); | 248 | int (*probe)(struct drm_device *drm_dev, struct device *dev); |
248 | void (*remove)(struct drm_device *dev); | 249 | void (*remove)(struct drm_device *dev); |
@@ -251,7 +252,6 @@ struct exynos_drm_subdrv { | |||
251 | void (*close)(struct drm_device *drm_dev, struct device *dev, | 252 | void (*close)(struct drm_device *drm_dev, struct device *dev, |
252 | struct drm_file *file); | 253 | struct drm_file *file); |
253 | 254 | ||
254 | struct exynos_drm_manager manager; | ||
255 | struct drm_encoder *encoder; | 255 | struct drm_encoder *encoder; |
256 | struct drm_connector *connector; | 256 | struct drm_connector *connector; |
257 | }; | 257 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index ecb6db229700..29fdbfeb43cb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -172,7 +172,7 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) | |||
172 | static void fimd_apply(struct device *subdrv_dev) | 172 | static void fimd_apply(struct device *subdrv_dev) |
173 | { | 173 | { |
174 | struct fimd_context *ctx = get_fimd_context(subdrv_dev); | 174 | struct fimd_context *ctx = get_fimd_context(subdrv_dev); |
175 | struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | 175 | struct exynos_drm_manager *mgr = ctx->subdrv.manager; |
176 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; | 176 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
177 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; | 177 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
178 | struct fimd_win_data *win_data; | 178 | struct fimd_win_data *win_data; |
@@ -577,6 +577,13 @@ static struct exynos_drm_overlay_ops fimd_overlay_ops = { | |||
577 | .disable = fimd_win_disable, | 577 | .disable = fimd_win_disable, |
578 | }; | 578 | }; |
579 | 579 | ||
580 | static struct exynos_drm_manager fimd_manager = { | ||
581 | .pipe = -1, | ||
582 | .ops = &fimd_manager_ops, | ||
583 | .overlay_ops = &fimd_overlay_ops, | ||
584 | .display_ops = &fimd_display_ops, | ||
585 | }; | ||
586 | |||
580 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) | 587 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) |
581 | { | 588 | { |
582 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | 589 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
@@ -628,7 +635,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | |||
628 | struct fimd_context *ctx = (struct fimd_context *)dev_id; | 635 | struct fimd_context *ctx = (struct fimd_context *)dev_id; |
629 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 636 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
630 | struct drm_device *drm_dev = subdrv->drm_dev; | 637 | struct drm_device *drm_dev = subdrv->drm_dev; |
631 | struct exynos_drm_manager *manager = &subdrv->manager; | 638 | struct exynos_drm_manager *manager = subdrv->manager; |
632 | u32 val; | 639 | u32 val; |
633 | 640 | ||
634 | val = readl(ctx->regs + VIDINTCON1); | 641 | val = readl(ctx->regs + VIDINTCON1); |
@@ -744,7 +751,7 @@ static void fimd_clear_win(struct fimd_context *ctx, int win) | |||
744 | static int fimd_power_on(struct fimd_context *ctx, bool enable) | 751 | static int fimd_power_on(struct fimd_context *ctx, bool enable) |
745 | { | 752 | { |
746 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 753 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
747 | struct device *dev = subdrv->manager.dev; | 754 | struct device *dev = subdrv->dev; |
748 | 755 | ||
749 | DRM_DEBUG_KMS("%s\n", __FILE__); | 756 | DRM_DEBUG_KMS("%s\n", __FILE__); |
750 | 757 | ||
@@ -867,13 +874,10 @@ static int __devinit fimd_probe(struct platform_device *pdev) | |||
867 | 874 | ||
868 | subdrv = &ctx->subdrv; | 875 | subdrv = &ctx->subdrv; |
869 | 876 | ||
877 | subdrv->dev = dev; | ||
878 | subdrv->manager = &fimd_manager; | ||
870 | subdrv->probe = fimd_subdrv_probe; | 879 | subdrv->probe = fimd_subdrv_probe; |
871 | subdrv->remove = fimd_subdrv_remove; | 880 | subdrv->remove = fimd_subdrv_remove; |
872 | subdrv->manager.pipe = -1; | ||
873 | subdrv->manager.ops = &fimd_manager_ops; | ||
874 | subdrv->manager.overlay_ops = &fimd_overlay_ops; | ||
875 | subdrv->manager.display_ops = &fimd_display_ops; | ||
876 | subdrv->manager.dev = dev; | ||
877 | 881 | ||
878 | mutex_init(&ctx->lock); | 882 | mutex_init(&ctx->lock); |
879 | 883 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index fa1aa94a3d8e..392ce71ed6a1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
@@ -56,9 +56,28 @@ static unsigned int convert_to_vm_err_msg(int msg) | |||
56 | return out_msg; | 56 | return out_msg; |
57 | } | 57 | } |
58 | 58 | ||
59 | static unsigned int mask_gem_flags(unsigned int flags) | 59 | static int check_gem_flags(unsigned int flags) |
60 | { | 60 | { |
61 | return flags &= EXYNOS_BO_NONCONTIG; | 61 | if (flags & ~(EXYNOS_BO_MASK)) { |
62 | DRM_ERROR("invalid flags.\n"); | ||
63 | return -EINVAL; | ||
64 | } | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static unsigned long roundup_gem_size(unsigned long size, unsigned int flags) | ||
70 | { | ||
71 | if (!IS_NONCONTIG_BUFFER(flags)) { | ||
72 | if (size >= SZ_1M) | ||
73 | return roundup(size, SECTION_SIZE); | ||
74 | else if (size >= SZ_64K) | ||
75 | return roundup(size, SZ_64K); | ||
76 | else | ||
77 | goto out; | ||
78 | } | ||
79 | out: | ||
80 | return roundup(size, PAGE_SIZE); | ||
62 | } | 81 | } |
63 | 82 | ||
64 | static struct page **exynos_gem_get_pages(struct drm_gem_object *obj, | 83 | static struct page **exynos_gem_get_pages(struct drm_gem_object *obj, |
@@ -319,10 +338,17 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | |||
319 | struct exynos_drm_gem_buf *buf; | 338 | struct exynos_drm_gem_buf *buf; |
320 | int ret; | 339 | int ret; |
321 | 340 | ||
322 | size = roundup(size, PAGE_SIZE); | 341 | if (!size) { |
323 | DRM_DEBUG_KMS("%s: size = 0x%lx\n", __FILE__, size); | 342 | DRM_ERROR("invalid size.\n"); |
343 | return ERR_PTR(-EINVAL); | ||
344 | } | ||
324 | 345 | ||
325 | flags = mask_gem_flags(flags); | 346 | size = roundup_gem_size(size, flags); |
347 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
348 | |||
349 | ret = check_gem_flags(flags); | ||
350 | if (ret) | ||
351 | return ERR_PTR(ret); | ||
326 | 352 | ||
327 | buf = exynos_drm_init_buf(dev, size); | 353 | buf = exynos_drm_init_buf(dev, size); |
328 | if (!buf) | 354 | if (!buf) |
@@ -331,7 +357,7 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | |||
331 | exynos_gem_obj = exynos_drm_gem_init(dev, size); | 357 | exynos_gem_obj = exynos_drm_gem_init(dev, size); |
332 | if (!exynos_gem_obj) { | 358 | if (!exynos_gem_obj) { |
333 | ret = -ENOMEM; | 359 | ret = -ENOMEM; |
334 | goto err; | 360 | goto err_fini_buf; |
335 | } | 361 | } |
336 | 362 | ||
337 | exynos_gem_obj->buffer = buf; | 363 | exynos_gem_obj->buffer = buf; |
@@ -347,18 +373,19 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | |||
347 | ret = exynos_drm_gem_get_pages(&exynos_gem_obj->base); | 373 | ret = exynos_drm_gem_get_pages(&exynos_gem_obj->base); |
348 | if (ret < 0) { | 374 | if (ret < 0) { |
349 | drm_gem_object_release(&exynos_gem_obj->base); | 375 | drm_gem_object_release(&exynos_gem_obj->base); |
350 | goto err; | 376 | goto err_fini_buf; |
351 | } | 377 | } |
352 | } else { | 378 | } else { |
353 | ret = exynos_drm_alloc_buf(dev, buf, flags); | 379 | ret = exynos_drm_alloc_buf(dev, buf, flags); |
354 | if (ret < 0) { | 380 | if (ret < 0) { |
355 | drm_gem_object_release(&exynos_gem_obj->base); | 381 | drm_gem_object_release(&exynos_gem_obj->base); |
356 | goto err; | 382 | goto err_fini_buf; |
357 | } | 383 | } |
358 | } | 384 | } |
359 | 385 | ||
360 | return exynos_gem_obj; | 386 | return exynos_gem_obj; |
361 | err: | 387 | |
388 | err_fini_buf: | ||
362 | exynos_drm_fini_buf(dev, buf); | 389 | exynos_drm_fini_buf(dev, buf); |
363 | return ERR_PTR(ret); | 390 | return ERR_PTR(ret); |
364 | } | 391 | } |
@@ -554,10 +581,8 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
554 | obj->filp->f_op = &exynos_drm_gem_fops; | 581 | obj->filp->f_op = &exynos_drm_gem_fops; |
555 | obj->filp->private_data = obj; | 582 | obj->filp->private_data = obj; |
556 | 583 | ||
557 | down_write(¤t->mm->mmap_sem); | 584 | addr = vm_mmap(obj->filp, 0, args->size, |
558 | addr = do_mmap(obj->filp, 0, args->size, | ||
559 | PROT_READ | PROT_WRITE, MAP_SHARED, 0); | 585 | PROT_READ | PROT_WRITE, MAP_SHARED, 0); |
560 | up_write(¤t->mm->mmap_sem); | ||
561 | 586 | ||
562 | drm_gem_object_unreference_unlocked(obj); | 587 | drm_gem_object_unreference_unlocked(obj); |
563 | 588 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index e40fbad8b705..4ed842039505 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #define to_exynos_gem_obj(x) container_of(x,\ | 29 | #define to_exynos_gem_obj(x) container_of(x,\ |
30 | struct exynos_drm_gem_obj, base) | 30 | struct exynos_drm_gem_obj, base) |
31 | 31 | ||
32 | #define IS_NONCONTIG_BUFFER(f) (f & EXYNOS_BO_NONCONTIG) | ||
33 | |||
32 | /* | 34 | /* |
33 | * exynos drm gem buffer structure. | 35 | * exynos drm gem buffer structure. |
34 | * | 36 | * |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 14eb26b0ba1c..3424463676e0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
@@ -30,9 +30,8 @@ | |||
30 | struct drm_hdmi_context, subdrv); | 30 | struct drm_hdmi_context, subdrv); |
31 | 31 | ||
32 | /* these callback points shoud be set by specific drivers. */ | 32 | /* these callback points shoud be set by specific drivers. */ |
33 | static struct exynos_hdmi_display_ops *hdmi_display_ops; | 33 | static struct exynos_hdmi_ops *hdmi_ops; |
34 | static struct exynos_hdmi_manager_ops *hdmi_manager_ops; | 34 | static struct exynos_mixer_ops *mixer_ops; |
35 | static struct exynos_hdmi_overlay_ops *hdmi_overlay_ops; | ||
36 | 35 | ||
37 | struct drm_hdmi_context { | 36 | struct drm_hdmi_context { |
38 | struct exynos_drm_subdrv subdrv; | 37 | struct exynos_drm_subdrv subdrv; |
@@ -40,31 +39,20 @@ struct drm_hdmi_context { | |||
40 | struct exynos_drm_hdmi_context *mixer_ctx; | 39 | struct exynos_drm_hdmi_context *mixer_ctx; |
41 | }; | 40 | }; |
42 | 41 | ||
43 | void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | 42 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops) |
44 | *display_ops) | ||
45 | { | 43 | { |
46 | DRM_DEBUG_KMS("%s\n", __FILE__); | 44 | DRM_DEBUG_KMS("%s\n", __FILE__); |
47 | 45 | ||
48 | if (display_ops) | 46 | if (ops) |
49 | hdmi_display_ops = display_ops; | 47 | hdmi_ops = ops; |
50 | } | 48 | } |
51 | 49 | ||
52 | void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | 50 | void exynos_mixer_ops_register(struct exynos_mixer_ops *ops) |
53 | *manager_ops) | ||
54 | { | 51 | { |
55 | DRM_DEBUG_KMS("%s\n", __FILE__); | 52 | DRM_DEBUG_KMS("%s\n", __FILE__); |
56 | 53 | ||
57 | if (manager_ops) | 54 | if (ops) |
58 | hdmi_manager_ops = manager_ops; | 55 | mixer_ops = ops; |
59 | } | ||
60 | |||
61 | void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | ||
62 | *overlay_ops) | ||
63 | { | ||
64 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
65 | |||
66 | if (overlay_ops) | ||
67 | hdmi_overlay_ops = overlay_ops; | ||
68 | } | 56 | } |
69 | 57 | ||
70 | static bool drm_hdmi_is_connected(struct device *dev) | 58 | static bool drm_hdmi_is_connected(struct device *dev) |
@@ -73,8 +61,8 @@ static bool drm_hdmi_is_connected(struct device *dev) | |||
73 | 61 | ||
74 | DRM_DEBUG_KMS("%s\n", __FILE__); | 62 | DRM_DEBUG_KMS("%s\n", __FILE__); |
75 | 63 | ||
76 | if (hdmi_display_ops && hdmi_display_ops->is_connected) | 64 | if (hdmi_ops && hdmi_ops->is_connected) |
77 | return hdmi_display_ops->is_connected(ctx->hdmi_ctx->ctx); | 65 | return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx); |
78 | 66 | ||
79 | return false; | 67 | return false; |
80 | } | 68 | } |
@@ -86,9 +74,9 @@ static int drm_hdmi_get_edid(struct device *dev, | |||
86 | 74 | ||
87 | DRM_DEBUG_KMS("%s\n", __FILE__); | 75 | DRM_DEBUG_KMS("%s\n", __FILE__); |
88 | 76 | ||
89 | if (hdmi_display_ops && hdmi_display_ops->get_edid) | 77 | if (hdmi_ops && hdmi_ops->get_edid) |
90 | return hdmi_display_ops->get_edid(ctx->hdmi_ctx->ctx, | 78 | return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector, edid, |
91 | connector, edid, len); | 79 | len); |
92 | 80 | ||
93 | return 0; | 81 | return 0; |
94 | } | 82 | } |
@@ -99,9 +87,8 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) | |||
99 | 87 | ||
100 | DRM_DEBUG_KMS("%s\n", __FILE__); | 88 | DRM_DEBUG_KMS("%s\n", __FILE__); |
101 | 89 | ||
102 | if (hdmi_display_ops && hdmi_display_ops->check_timing) | 90 | if (hdmi_ops && hdmi_ops->check_timing) |
103 | return hdmi_display_ops->check_timing(ctx->hdmi_ctx->ctx, | 91 | return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing); |
104 | timing); | ||
105 | 92 | ||
106 | return 0; | 93 | return 0; |
107 | } | 94 | } |
@@ -112,8 +99,8 @@ static int drm_hdmi_power_on(struct device *dev, int mode) | |||
112 | 99 | ||
113 | DRM_DEBUG_KMS("%s\n", __FILE__); | 100 | DRM_DEBUG_KMS("%s\n", __FILE__); |
114 | 101 | ||
115 | if (hdmi_display_ops && hdmi_display_ops->power_on) | 102 | if (hdmi_ops && hdmi_ops->power_on) |
116 | return hdmi_display_ops->power_on(ctx->hdmi_ctx->ctx, mode); | 103 | return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode); |
117 | 104 | ||
118 | return 0; | 105 | return 0; |
119 | } | 106 | } |
@@ -130,13 +117,13 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) | |||
130 | { | 117 | { |
131 | struct drm_hdmi_context *ctx = to_context(subdrv_dev); | 118 | struct drm_hdmi_context *ctx = to_context(subdrv_dev); |
132 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 119 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
133 | struct exynos_drm_manager *manager = &subdrv->manager; | 120 | struct exynos_drm_manager *manager = subdrv->manager; |
134 | 121 | ||
135 | DRM_DEBUG_KMS("%s\n", __FILE__); | 122 | DRM_DEBUG_KMS("%s\n", __FILE__); |
136 | 123 | ||
137 | if (hdmi_overlay_ops && hdmi_overlay_ops->enable_vblank) | 124 | if (mixer_ops && mixer_ops->enable_vblank) |
138 | return hdmi_overlay_ops->enable_vblank(ctx->mixer_ctx->ctx, | 125 | return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx, |
139 | manager->pipe); | 126 | manager->pipe); |
140 | 127 | ||
141 | return 0; | 128 | return 0; |
142 | } | 129 | } |
@@ -147,8 +134,8 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) | |||
147 | 134 | ||
148 | DRM_DEBUG_KMS("%s\n", __FILE__); | 135 | DRM_DEBUG_KMS("%s\n", __FILE__); |
149 | 136 | ||
150 | if (hdmi_overlay_ops && hdmi_overlay_ops->disable_vblank) | 137 | if (mixer_ops && mixer_ops->disable_vblank) |
151 | return hdmi_overlay_ops->disable_vblank(ctx->mixer_ctx->ctx); | 138 | return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx); |
152 | } | 139 | } |
153 | 140 | ||
154 | static void drm_hdmi_mode_fixup(struct device *subdrv_dev, | 141 | static void drm_hdmi_mode_fixup(struct device *subdrv_dev, |
@@ -160,9 +147,9 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, | |||
160 | 147 | ||
161 | DRM_DEBUG_KMS("%s\n", __FILE__); | 148 | DRM_DEBUG_KMS("%s\n", __FILE__); |
162 | 149 | ||
163 | if (hdmi_manager_ops && hdmi_manager_ops->mode_fixup) | 150 | if (hdmi_ops && hdmi_ops->mode_fixup) |
164 | hdmi_manager_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, | 151 | hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, mode, |
165 | mode, adjusted_mode); | 152 | adjusted_mode); |
166 | } | 153 | } |
167 | 154 | ||
168 | static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) | 155 | static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) |
@@ -171,8 +158,8 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) | |||
171 | 158 | ||
172 | DRM_DEBUG_KMS("%s\n", __FILE__); | 159 | DRM_DEBUG_KMS("%s\n", __FILE__); |
173 | 160 | ||
174 | if (hdmi_manager_ops && hdmi_manager_ops->mode_set) | 161 | if (hdmi_ops && hdmi_ops->mode_set) |
175 | hdmi_manager_ops->mode_set(ctx->hdmi_ctx->ctx, mode); | 162 | hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode); |
176 | } | 163 | } |
177 | 164 | ||
178 | static void drm_hdmi_get_max_resol(struct device *subdrv_dev, | 165 | static void drm_hdmi_get_max_resol(struct device *subdrv_dev, |
@@ -182,9 +169,8 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, | |||
182 | 169 | ||
183 | DRM_DEBUG_KMS("%s\n", __FILE__); | 170 | DRM_DEBUG_KMS("%s\n", __FILE__); |
184 | 171 | ||
185 | if (hdmi_manager_ops && hdmi_manager_ops->get_max_resol) | 172 | if (hdmi_ops && hdmi_ops->get_max_resol) |
186 | hdmi_manager_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, | 173 | hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, height); |
187 | height); | ||
188 | } | 174 | } |
189 | 175 | ||
190 | static void drm_hdmi_commit(struct device *subdrv_dev) | 176 | static void drm_hdmi_commit(struct device *subdrv_dev) |
@@ -193,8 +179,8 @@ static void drm_hdmi_commit(struct device *subdrv_dev) | |||
193 | 179 | ||
194 | DRM_DEBUG_KMS("%s\n", __FILE__); | 180 | DRM_DEBUG_KMS("%s\n", __FILE__); |
195 | 181 | ||
196 | if (hdmi_manager_ops && hdmi_manager_ops->commit) | 182 | if (hdmi_ops && hdmi_ops->commit) |
197 | hdmi_manager_ops->commit(ctx->hdmi_ctx->ctx); | 183 | hdmi_ops->commit(ctx->hdmi_ctx->ctx); |
198 | } | 184 | } |
199 | 185 | ||
200 | static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) | 186 | static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) |
@@ -209,8 +195,8 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) | |||
209 | case DRM_MODE_DPMS_STANDBY: | 195 | case DRM_MODE_DPMS_STANDBY: |
210 | case DRM_MODE_DPMS_SUSPEND: | 196 | case DRM_MODE_DPMS_SUSPEND: |
211 | case DRM_MODE_DPMS_OFF: | 197 | case DRM_MODE_DPMS_OFF: |
212 | if (hdmi_manager_ops && hdmi_manager_ops->disable) | 198 | if (hdmi_ops && hdmi_ops->disable) |
213 | hdmi_manager_ops->disable(ctx->hdmi_ctx->ctx); | 199 | hdmi_ops->disable(ctx->hdmi_ctx->ctx); |
214 | break; | 200 | break; |
215 | default: | 201 | default: |
216 | DRM_DEBUG_KMS("unkown dps mode: %d\n", mode); | 202 | DRM_DEBUG_KMS("unkown dps mode: %d\n", mode); |
@@ -235,8 +221,8 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, | |||
235 | 221 | ||
236 | DRM_DEBUG_KMS("%s\n", __FILE__); | 222 | DRM_DEBUG_KMS("%s\n", __FILE__); |
237 | 223 | ||
238 | if (hdmi_overlay_ops && hdmi_overlay_ops->win_mode_set) | 224 | if (mixer_ops && mixer_ops->win_mode_set) |
239 | hdmi_overlay_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); | 225 | mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); |
240 | } | 226 | } |
241 | 227 | ||
242 | static void drm_mixer_commit(struct device *subdrv_dev, int zpos) | 228 | static void drm_mixer_commit(struct device *subdrv_dev, int zpos) |
@@ -245,8 +231,8 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) | |||
245 | 231 | ||
246 | DRM_DEBUG_KMS("%s\n", __FILE__); | 232 | DRM_DEBUG_KMS("%s\n", __FILE__); |
247 | 233 | ||
248 | if (hdmi_overlay_ops && hdmi_overlay_ops->win_commit) | 234 | if (mixer_ops && mixer_ops->win_commit) |
249 | hdmi_overlay_ops->win_commit(ctx->mixer_ctx->ctx, zpos); | 235 | mixer_ops->win_commit(ctx->mixer_ctx->ctx, zpos); |
250 | } | 236 | } |
251 | 237 | ||
252 | static void drm_mixer_disable(struct device *subdrv_dev, int zpos) | 238 | static void drm_mixer_disable(struct device *subdrv_dev, int zpos) |
@@ -255,8 +241,8 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) | |||
255 | 241 | ||
256 | DRM_DEBUG_KMS("%s\n", __FILE__); | 242 | DRM_DEBUG_KMS("%s\n", __FILE__); |
257 | 243 | ||
258 | if (hdmi_overlay_ops && hdmi_overlay_ops->win_disable) | 244 | if (mixer_ops && mixer_ops->win_disable) |
259 | hdmi_overlay_ops->win_disable(ctx->mixer_ctx->ctx, zpos); | 245 | mixer_ops->win_disable(ctx->mixer_ctx->ctx, zpos); |
260 | } | 246 | } |
261 | 247 | ||
262 | static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { | 248 | static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { |
@@ -265,6 +251,12 @@ static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { | |||
265 | .disable = drm_mixer_disable, | 251 | .disable = drm_mixer_disable, |
266 | }; | 252 | }; |
267 | 253 | ||
254 | static struct exynos_drm_manager hdmi_manager = { | ||
255 | .pipe = -1, | ||
256 | .ops = &drm_hdmi_manager_ops, | ||
257 | .overlay_ops = &drm_hdmi_overlay_ops, | ||
258 | .display_ops = &drm_hdmi_display_ops, | ||
259 | }; | ||
268 | 260 | ||
269 | static int hdmi_subdrv_probe(struct drm_device *drm_dev, | 261 | static int hdmi_subdrv_probe(struct drm_device *drm_dev, |
270 | struct device *dev) | 262 | struct device *dev) |
@@ -332,12 +324,9 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) | |||
332 | 324 | ||
333 | subdrv = &ctx->subdrv; | 325 | subdrv = &ctx->subdrv; |
334 | 326 | ||
327 | subdrv->dev = dev; | ||
328 | subdrv->manager = &hdmi_manager; | ||
335 | subdrv->probe = hdmi_subdrv_probe; | 329 | subdrv->probe = hdmi_subdrv_probe; |
336 | subdrv->manager.pipe = -1; | ||
337 | subdrv->manager.ops = &drm_hdmi_manager_ops; | ||
338 | subdrv->manager.overlay_ops = &drm_hdmi_overlay_ops; | ||
339 | subdrv->manager.display_ops = &drm_hdmi_display_ops; | ||
340 | subdrv->manager.dev = dev; | ||
341 | 330 | ||
342 | platform_set_drvdata(pdev, subdrv); | 331 | platform_set_drvdata(pdev, subdrv); |
343 | 332 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index 44497cfb6c74..f3ae192c8dcf 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h | |||
@@ -38,15 +38,15 @@ struct exynos_drm_hdmi_context { | |||
38 | void *ctx; | 38 | void *ctx; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct exynos_hdmi_display_ops { | 41 | struct exynos_hdmi_ops { |
42 | /* display */ | ||
42 | bool (*is_connected)(void *ctx); | 43 | bool (*is_connected)(void *ctx); |
43 | int (*get_edid)(void *ctx, struct drm_connector *connector, | 44 | int (*get_edid)(void *ctx, struct drm_connector *connector, |
44 | u8 *edid, int len); | 45 | u8 *edid, int len); |
45 | int (*check_timing)(void *ctx, void *timing); | 46 | int (*check_timing)(void *ctx, void *timing); |
46 | int (*power_on)(void *ctx, int mode); | 47 | int (*power_on)(void *ctx, int mode); |
47 | }; | ||
48 | 48 | ||
49 | struct exynos_hdmi_manager_ops { | 49 | /* manager */ |
50 | void (*mode_fixup)(void *ctx, struct drm_connector *connector, | 50 | void (*mode_fixup)(void *ctx, struct drm_connector *connector, |
51 | struct drm_display_mode *mode, | 51 | struct drm_display_mode *mode, |
52 | struct drm_display_mode *adjusted_mode); | 52 | struct drm_display_mode *adjusted_mode); |
@@ -57,22 +57,17 @@ struct exynos_hdmi_manager_ops { | |||
57 | void (*disable)(void *ctx); | 57 | void (*disable)(void *ctx); |
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct exynos_hdmi_overlay_ops { | 60 | struct exynos_mixer_ops { |
61 | /* manager */ | ||
61 | int (*enable_vblank)(void *ctx, int pipe); | 62 | int (*enable_vblank)(void *ctx, int pipe); |
62 | void (*disable_vblank)(void *ctx); | 63 | void (*disable_vblank)(void *ctx); |
64 | |||
65 | /* overlay */ | ||
63 | void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); | 66 | void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); |
64 | void (*win_commit)(void *ctx, int zpos); | 67 | void (*win_commit)(void *ctx, int zpos); |
65 | void (*win_disable)(void *ctx, int zpos); | 68 | void (*win_disable)(void *ctx, int zpos); |
66 | }; | 69 | }; |
67 | 70 | ||
68 | extern struct platform_driver hdmi_driver; | 71 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops); |
69 | extern struct platform_driver mixer_driver; | 72 | void exynos_mixer_ops_register(struct exynos_mixer_ops *ops); |
70 | |||
71 | void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | ||
72 | *display_ops); | ||
73 | void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | ||
74 | *manager_ops); | ||
75 | void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | ||
76 | *overlay_ops); | ||
77 | |||
78 | #endif | 73 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index c277a3a445f5..f92fe4c6174a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c | |||
@@ -24,6 +24,10 @@ struct exynos_plane { | |||
24 | 24 | ||
25 | static const uint32_t formats[] = { | 25 | static const uint32_t formats[] = { |
26 | DRM_FORMAT_XRGB8888, | 26 | DRM_FORMAT_XRGB8888, |
27 | DRM_FORMAT_ARGB8888, | ||
28 | DRM_FORMAT_NV12, | ||
29 | DRM_FORMAT_NV12M, | ||
30 | DRM_FORMAT_NV12MT, | ||
27 | }; | 31 | }; |
28 | 32 | ||
29 | static int | 33 | static int |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 8e1339f9fe1f..7b9c153dceb6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -199,7 +199,7 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) | |||
199 | static void vidi_apply(struct device *subdrv_dev) | 199 | static void vidi_apply(struct device *subdrv_dev) |
200 | { | 200 | { |
201 | struct vidi_context *ctx = get_vidi_context(subdrv_dev); | 201 | struct vidi_context *ctx = get_vidi_context(subdrv_dev); |
202 | struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | 202 | struct exynos_drm_manager *mgr = ctx->subdrv.manager; |
203 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; | 203 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
204 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; | 204 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
205 | struct vidi_win_data *win_data; | 205 | struct vidi_win_data *win_data; |
@@ -374,6 +374,13 @@ static struct exynos_drm_overlay_ops vidi_overlay_ops = { | |||
374 | .disable = vidi_win_disable, | 374 | .disable = vidi_win_disable, |
375 | }; | 375 | }; |
376 | 376 | ||
377 | static struct exynos_drm_manager vidi_manager = { | ||
378 | .pipe = -1, | ||
379 | .ops = &vidi_manager_ops, | ||
380 | .overlay_ops = &vidi_overlay_ops, | ||
381 | .display_ops = &vidi_display_ops, | ||
382 | }; | ||
383 | |||
377 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) | 384 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) |
378 | { | 385 | { |
379 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | 386 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
@@ -425,7 +432,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work) | |||
425 | struct vidi_context *ctx = container_of(work, struct vidi_context, | 432 | struct vidi_context *ctx = container_of(work, struct vidi_context, |
426 | work); | 433 | work); |
427 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 434 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
428 | struct exynos_drm_manager *manager = &subdrv->manager; | 435 | struct exynos_drm_manager *manager = subdrv->manager; |
429 | 436 | ||
430 | if (manager->pipe < 0) | 437 | if (manager->pipe < 0) |
431 | return; | 438 | return; |
@@ -471,7 +478,7 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev) | |||
471 | static int vidi_power_on(struct vidi_context *ctx, bool enable) | 478 | static int vidi_power_on(struct vidi_context *ctx, bool enable) |
472 | { | 479 | { |
473 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 480 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
474 | struct device *dev = subdrv->manager.dev; | 481 | struct device *dev = subdrv->dev; |
475 | 482 | ||
476 | DRM_DEBUG_KMS("%s\n", __FILE__); | 483 | DRM_DEBUG_KMS("%s\n", __FILE__); |
477 | 484 | ||
@@ -611,13 +618,10 @@ static int __devinit vidi_probe(struct platform_device *pdev) | |||
611 | ctx->raw_edid = (struct edid *)fake_edid_info; | 618 | ctx->raw_edid = (struct edid *)fake_edid_info; |
612 | 619 | ||
613 | subdrv = &ctx->subdrv; | 620 | subdrv = &ctx->subdrv; |
621 | subdrv->dev = dev; | ||
622 | subdrv->manager = &vidi_manager; | ||
614 | subdrv->probe = vidi_subdrv_probe; | 623 | subdrv->probe = vidi_subdrv_probe; |
615 | subdrv->remove = vidi_subdrv_remove; | 624 | subdrv->remove = vidi_subdrv_remove; |
616 | subdrv->manager.pipe = -1; | ||
617 | subdrv->manager.ops = &vidi_manager_ops; | ||
618 | subdrv->manager.overlay_ops = &vidi_overlay_ops; | ||
619 | subdrv->manager.display_ops = &vidi_display_ops; | ||
620 | subdrv->manager.dev = dev; | ||
621 | 625 | ||
622 | mutex_init(&ctx->lock); | 626 | mutex_init(&ctx->lock); |
623 | 627 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 575a8cbd3533..b00353876458 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #include "exynos_hdmi.h" | 41 | #include "exynos_hdmi.h" |
42 | 42 | ||
43 | #define HDMI_OVERLAY_NUMBER 3 | ||
44 | #define MAX_WIDTH 1920 | 43 | #define MAX_WIDTH 1920 |
45 | #define MAX_HEIGHT 1080 | 44 | #define MAX_HEIGHT 1080 |
46 | #define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) | 45 | #define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) |
@@ -1194,7 +1193,7 @@ static int hdmi_conf_index(struct hdmi_context *hdata, | |||
1194 | 1193 | ||
1195 | static bool hdmi_is_connected(void *ctx) | 1194 | static bool hdmi_is_connected(void *ctx) |
1196 | { | 1195 | { |
1197 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1196 | struct hdmi_context *hdata = ctx; |
1198 | u32 val = hdmi_reg_read(hdata, HDMI_HPD_STATUS); | 1197 | u32 val = hdmi_reg_read(hdata, HDMI_HPD_STATUS); |
1199 | 1198 | ||
1200 | if (val) | 1199 | if (val) |
@@ -1207,7 +1206,7 @@ static int hdmi_get_edid(void *ctx, struct drm_connector *connector, | |||
1207 | u8 *edid, int len) | 1206 | u8 *edid, int len) |
1208 | { | 1207 | { |
1209 | struct edid *raw_edid; | 1208 | struct edid *raw_edid; |
1210 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1209 | struct hdmi_context *hdata = ctx; |
1211 | 1210 | ||
1212 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1211 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
1213 | 1212 | ||
@@ -1275,7 +1274,7 @@ static int hdmi_v14_check_timing(struct fb_videomode *check_timing) | |||
1275 | 1274 | ||
1276 | static int hdmi_check_timing(void *ctx, void *timing) | 1275 | static int hdmi_check_timing(void *ctx, void *timing) |
1277 | { | 1276 | { |
1278 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1277 | struct hdmi_context *hdata = ctx; |
1279 | struct fb_videomode *check_timing = timing; | 1278 | struct fb_videomode *check_timing = timing; |
1280 | 1279 | ||
1281 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1280 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
@@ -1312,13 +1311,6 @@ static int hdmi_display_power_on(void *ctx, int mode) | |||
1312 | return 0; | 1311 | return 0; |
1313 | } | 1312 | } |
1314 | 1313 | ||
1315 | static struct exynos_hdmi_display_ops display_ops = { | ||
1316 | .is_connected = hdmi_is_connected, | ||
1317 | .get_edid = hdmi_get_edid, | ||
1318 | .check_timing = hdmi_check_timing, | ||
1319 | .power_on = hdmi_display_power_on, | ||
1320 | }; | ||
1321 | |||
1322 | static void hdmi_set_acr(u32 freq, u8 *acr) | 1314 | static void hdmi_set_acr(u32 freq, u8 *acr) |
1323 | { | 1315 | { |
1324 | u32 n, cts; | 1316 | u32 n, cts; |
@@ -1914,7 +1906,7 @@ static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector, | |||
1914 | struct drm_display_mode *adjusted_mode) | 1906 | struct drm_display_mode *adjusted_mode) |
1915 | { | 1907 | { |
1916 | struct drm_display_mode *m; | 1908 | struct drm_display_mode *m; |
1917 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1909 | struct hdmi_context *hdata = ctx; |
1918 | int index; | 1910 | int index; |
1919 | 1911 | ||
1920 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1912 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
@@ -1951,7 +1943,7 @@ static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector, | |||
1951 | 1943 | ||
1952 | static void hdmi_mode_set(void *ctx, void *mode) | 1944 | static void hdmi_mode_set(void *ctx, void *mode) |
1953 | { | 1945 | { |
1954 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1946 | struct hdmi_context *hdata = ctx; |
1955 | int conf_idx; | 1947 | int conf_idx; |
1956 | 1948 | ||
1957 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1949 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
@@ -1974,7 +1966,7 @@ static void hdmi_get_max_resol(void *ctx, unsigned int *width, | |||
1974 | 1966 | ||
1975 | static void hdmi_commit(void *ctx) | 1967 | static void hdmi_commit(void *ctx) |
1976 | { | 1968 | { |
1977 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1969 | struct hdmi_context *hdata = ctx; |
1978 | 1970 | ||
1979 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1971 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
1980 | 1972 | ||
@@ -1985,7 +1977,7 @@ static void hdmi_commit(void *ctx) | |||
1985 | 1977 | ||
1986 | static void hdmi_disable(void *ctx) | 1978 | static void hdmi_disable(void *ctx) |
1987 | { | 1979 | { |
1988 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1980 | struct hdmi_context *hdata = ctx; |
1989 | 1981 | ||
1990 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1982 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
1991 | 1983 | ||
@@ -1996,7 +1988,14 @@ static void hdmi_disable(void *ctx) | |||
1996 | } | 1988 | } |
1997 | } | 1989 | } |
1998 | 1990 | ||
1999 | static struct exynos_hdmi_manager_ops manager_ops = { | 1991 | static struct exynos_hdmi_ops hdmi_ops = { |
1992 | /* display */ | ||
1993 | .is_connected = hdmi_is_connected, | ||
1994 | .get_edid = hdmi_get_edid, | ||
1995 | .check_timing = hdmi_check_timing, | ||
1996 | .power_on = hdmi_display_power_on, | ||
1997 | |||
1998 | /* manager */ | ||
2000 | .mode_fixup = hdmi_mode_fixup, | 1999 | .mode_fixup = hdmi_mode_fixup, |
2001 | .mode_set = hdmi_mode_set, | 2000 | .mode_set = hdmi_mode_set, |
2002 | .get_max_resol = hdmi_get_max_resol, | 2001 | .get_max_resol = hdmi_get_max_resol, |
@@ -2020,7 +2019,7 @@ static void hdmi_hotplug_func(struct work_struct *work) | |||
2020 | static irqreturn_t hdmi_irq_handler(int irq, void *arg) | 2019 | static irqreturn_t hdmi_irq_handler(int irq, void *arg) |
2021 | { | 2020 | { |
2022 | struct exynos_drm_hdmi_context *ctx = arg; | 2021 | struct exynos_drm_hdmi_context *ctx = arg; |
2023 | struct hdmi_context *hdata = (struct hdmi_context *)ctx->ctx; | 2022 | struct hdmi_context *hdata = ctx->ctx; |
2024 | u32 intc_flag; | 2023 | u32 intc_flag; |
2025 | 2024 | ||
2026 | intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); | 2025 | intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); |
@@ -2173,7 +2172,7 @@ static int hdmi_runtime_suspend(struct device *dev) | |||
2173 | 2172 | ||
2174 | DRM_DEBUG_KMS("%s\n", __func__); | 2173 | DRM_DEBUG_KMS("%s\n", __func__); |
2175 | 2174 | ||
2176 | hdmi_resource_poweroff((struct hdmi_context *)ctx->ctx); | 2175 | hdmi_resource_poweroff(ctx->ctx); |
2177 | 2176 | ||
2178 | return 0; | 2177 | return 0; |
2179 | } | 2178 | } |
@@ -2184,7 +2183,7 @@ static int hdmi_runtime_resume(struct device *dev) | |||
2184 | 2183 | ||
2185 | DRM_DEBUG_KMS("%s\n", __func__); | 2184 | DRM_DEBUG_KMS("%s\n", __func__); |
2186 | 2185 | ||
2187 | hdmi_resource_poweron((struct hdmi_context *)ctx->ctx); | 2186 | hdmi_resource_poweron(ctx->ctx); |
2188 | 2187 | ||
2189 | return 0; | 2188 | return 0; |
2190 | } | 2189 | } |
@@ -2322,8 +2321,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) | |||
2322 | hdata->irq = res->start; | 2321 | hdata->irq = res->start; |
2323 | 2322 | ||
2324 | /* register specific callbacks to common hdmi. */ | 2323 | /* register specific callbacks to common hdmi. */ |
2325 | exynos_drm_display_ops_register(&display_ops); | 2324 | exynos_hdmi_ops_register(&hdmi_ops); |
2326 | exynos_drm_manager_ops_register(&manager_ops); | ||
2327 | 2325 | ||
2328 | hdmi_resource_poweron(hdata); | 2326 | hdmi_resource_poweron(hdata); |
2329 | 2327 | ||
@@ -2351,7 +2349,7 @@ err_data: | |||
2351 | static int __devexit hdmi_remove(struct platform_device *pdev) | 2349 | static int __devexit hdmi_remove(struct platform_device *pdev) |
2352 | { | 2350 | { |
2353 | struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); | 2351 | struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); |
2354 | struct hdmi_context *hdata = (struct hdmi_context *)ctx->ctx; | 2352 | struct hdmi_context *hdata = ctx->ctx; |
2355 | 2353 | ||
2356 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 2354 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
2357 | 2355 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4d5f41e19527..e15438c01129 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -37,7 +37,8 @@ | |||
37 | #include "exynos_drm_drv.h" | 37 | #include "exynos_drm_drv.h" |
38 | #include "exynos_drm_hdmi.h" | 38 | #include "exynos_drm_hdmi.h" |
39 | 39 | ||
40 | #define HDMI_OVERLAY_NUMBER 3 | 40 | #define MIXER_WIN_NR 3 |
41 | #define MIXER_DEFAULT_WIN 0 | ||
41 | 42 | ||
42 | #define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) | 43 | #define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) |
43 | 44 | ||
@@ -75,16 +76,12 @@ struct mixer_resources { | |||
75 | }; | 76 | }; |
76 | 77 | ||
77 | struct mixer_context { | 78 | struct mixer_context { |
78 | struct fb_videomode *default_timing; | ||
79 | unsigned int default_win; | ||
80 | unsigned int default_bpp; | ||
81 | unsigned int irq; | 79 | unsigned int irq; |
82 | int pipe; | 80 | int pipe; |
83 | bool interlace; | 81 | bool interlace; |
84 | bool vp_enabled; | ||
85 | 82 | ||
86 | struct mixer_resources mixer_res; | 83 | struct mixer_resources mixer_res; |
87 | struct hdmi_win_data win_data[HDMI_OVERLAY_NUMBER]; | 84 | struct hdmi_win_data win_data[MIXER_WIN_NR]; |
88 | }; | 85 | }; |
89 | 86 | ||
90 | static const u8 filter_y_horiz_tap8[] = { | 87 | static const u8 filter_y_horiz_tap8[] = { |
@@ -643,9 +640,9 @@ static void mixer_win_mode_set(void *ctx, | |||
643 | 640 | ||
644 | win = overlay->zpos; | 641 | win = overlay->zpos; |
645 | if (win == DEFAULT_ZPOS) | 642 | if (win == DEFAULT_ZPOS) |
646 | win = mixer_ctx->default_win; | 643 | win = MIXER_DEFAULT_WIN; |
647 | 644 | ||
648 | if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | 645 | if (win < 0 || win > MIXER_WIN_NR) { |
649 | DRM_ERROR("overlay plane[%d] is wrong\n", win); | 646 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
650 | return; | 647 | return; |
651 | } | 648 | } |
@@ -683,9 +680,9 @@ static void mixer_win_commit(void *ctx, int zpos) | |||
683 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); | 680 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); |
684 | 681 | ||
685 | if (win == DEFAULT_ZPOS) | 682 | if (win == DEFAULT_ZPOS) |
686 | win = mixer_ctx->default_win; | 683 | win = MIXER_DEFAULT_WIN; |
687 | 684 | ||
688 | if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | 685 | if (win < 0 || win > MIXER_WIN_NR) { |
689 | DRM_ERROR("overlay plane[%d] is wrong\n", win); | 686 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
690 | return; | 687 | return; |
691 | } | 688 | } |
@@ -706,9 +703,9 @@ static void mixer_win_disable(void *ctx, int zpos) | |||
706 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); | 703 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); |
707 | 704 | ||
708 | if (win == DEFAULT_ZPOS) | 705 | if (win == DEFAULT_ZPOS) |
709 | win = mixer_ctx->default_win; | 706 | win = MIXER_DEFAULT_WIN; |
710 | 707 | ||
711 | if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | 708 | if (win < 0 || win > MIXER_WIN_NR) { |
712 | DRM_ERROR("overlay plane[%d] is wrong\n", win); | 709 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
713 | return; | 710 | return; |
714 | } | 711 | } |
@@ -722,9 +719,12 @@ static void mixer_win_disable(void *ctx, int zpos) | |||
722 | spin_unlock_irqrestore(&res->reg_slock, flags); | 719 | spin_unlock_irqrestore(&res->reg_slock, flags); |
723 | } | 720 | } |
724 | 721 | ||
725 | static struct exynos_hdmi_overlay_ops overlay_ops = { | 722 | static struct exynos_mixer_ops mixer_ops = { |
723 | /* manager */ | ||
726 | .enable_vblank = mixer_enable_vblank, | 724 | .enable_vblank = mixer_enable_vblank, |
727 | .disable_vblank = mixer_disable_vblank, | 725 | .disable_vblank = mixer_disable_vblank, |
726 | |||
727 | /* overlay */ | ||
728 | .win_mode_set = mixer_win_mode_set, | 728 | .win_mode_set = mixer_win_mode_set, |
729 | .win_commit = mixer_win_commit, | 729 | .win_commit = mixer_win_commit, |
730 | .win_disable = mixer_win_disable, | 730 | .win_disable = mixer_win_disable, |
@@ -771,8 +771,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) | |||
771 | static irqreturn_t mixer_irq_handler(int irq, void *arg) | 771 | static irqreturn_t mixer_irq_handler(int irq, void *arg) |
772 | { | 772 | { |
773 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; | 773 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; |
774 | struct mixer_context *ctx = | 774 | struct mixer_context *ctx = drm_hdmi_ctx->ctx; |
775 | (struct mixer_context *)drm_hdmi_ctx->ctx; | ||
776 | struct mixer_resources *res = &ctx->mixer_res; | 775 | struct mixer_resources *res = &ctx->mixer_res; |
777 | u32 val, val_base; | 776 | u32 val, val_base; |
778 | 777 | ||
@@ -902,7 +901,7 @@ static int mixer_runtime_resume(struct device *dev) | |||
902 | 901 | ||
903 | DRM_DEBUG_KMS("resume - start\n"); | 902 | DRM_DEBUG_KMS("resume - start\n"); |
904 | 903 | ||
905 | mixer_resource_poweron((struct mixer_context *)ctx->ctx); | 904 | mixer_resource_poweron(ctx->ctx); |
906 | 905 | ||
907 | return 0; | 906 | return 0; |
908 | } | 907 | } |
@@ -913,7 +912,7 @@ static int mixer_runtime_suspend(struct device *dev) | |||
913 | 912 | ||
914 | DRM_DEBUG_KMS("suspend - start\n"); | 913 | DRM_DEBUG_KMS("suspend - start\n"); |
915 | 914 | ||
916 | mixer_resource_poweroff((struct mixer_context *)ctx->ctx); | 915 | mixer_resource_poweroff(ctx->ctx); |
917 | 916 | ||
918 | return 0; | 917 | return 0; |
919 | } | 918 | } |
@@ -926,8 +925,7 @@ static const struct dev_pm_ops mixer_pm_ops = { | |||
926 | static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, | 925 | static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, |
927 | struct platform_device *pdev) | 926 | struct platform_device *pdev) |
928 | { | 927 | { |
929 | struct mixer_context *mixer_ctx = | 928 | struct mixer_context *mixer_ctx = ctx->ctx; |
930 | (struct mixer_context *)ctx->ctx; | ||
931 | struct device *dev = &pdev->dev; | 929 | struct device *dev = &pdev->dev; |
932 | struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; | 930 | struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; |
933 | struct resource *res; | 931 | struct resource *res; |
@@ -1076,7 +1074,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) | |||
1076 | goto fail; | 1074 | goto fail; |
1077 | 1075 | ||
1078 | /* register specific callback point to common hdmi. */ | 1076 | /* register specific callback point to common hdmi. */ |
1079 | exynos_drm_overlay_ops_register(&overlay_ops); | 1077 | exynos_mixer_ops_register(&mixer_ops); |
1080 | 1078 | ||
1081 | mixer_resource_poweron(ctx); | 1079 | mixer_resource_poweron(ctx); |
1082 | 1080 | ||
@@ -1093,7 +1091,7 @@ static int mixer_remove(struct platform_device *pdev) | |||
1093 | struct device *dev = &pdev->dev; | 1091 | struct device *dev = &pdev->dev; |
1094 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = | 1092 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = |
1095 | platform_get_drvdata(pdev); | 1093 | platform_get_drvdata(pdev); |
1096 | struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx; | 1094 | struct mixer_context *ctx = drm_hdmi_ctx->ctx; |
1097 | 1095 | ||
1098 | dev_info(dev, "remove successful\n"); | 1096 | dev_info(dev, "remove successful\n"); |
1099 | 1097 | ||
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.h b/drivers/gpu/drm/gma500/mdfld_dsi_output.h index 21071cef92a4..36eb0744841c 100644 --- a/drivers/gpu/drm/gma500/mdfld_dsi_output.h +++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #define __MDFLD_DSI_OUTPUT_H__ | 29 | #define __MDFLD_DSI_OUTPUT_H__ |
30 | 30 | ||
31 | #include <linux/backlight.h> | 31 | #include <linux/backlight.h> |
32 | #include <linux/version.h> | ||
33 | #include <drm/drmP.h> | 32 | #include <drm/drmP.h> |
34 | #include <drm/drm.h> | 33 | #include <drm/drm.h> |
35 | #include <drm/drm_crtc.h> | 34 | #include <drm/drm_crtc.h> |
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 2c8a60c3b98e..f920fb5e42b6 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -129,6 +129,7 @@ static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv) | |||
129 | if (buf_priv->currently_mapped == I810_BUF_MAPPED) | 129 | if (buf_priv->currently_mapped == I810_BUF_MAPPED) |
130 | return -EINVAL; | 130 | return -EINVAL; |
131 | 131 | ||
132 | /* This is all entirely broken */ | ||
132 | down_write(¤t->mm->mmap_sem); | 133 | down_write(¤t->mm->mmap_sem); |
133 | old_fops = file_priv->filp->f_op; | 134 | old_fops = file_priv->filp->f_op; |
134 | file_priv->filp->f_op = &i810_buffer_fops; | 135 | file_priv->filp->f_op = &i810_buffer_fops; |
@@ -157,11 +158,8 @@ static int i810_unmap_buffer(struct drm_buf *buf) | |||
157 | if (buf_priv->currently_mapped != I810_BUF_MAPPED) | 158 | if (buf_priv->currently_mapped != I810_BUF_MAPPED) |
158 | return -EINVAL; | 159 | return -EINVAL; |
159 | 160 | ||
160 | down_write(¤t->mm->mmap_sem); | 161 | retcode = vm_munmap((unsigned long)buf_priv->virtual, |
161 | retcode = do_munmap(current->mm, | ||
162 | (unsigned long)buf_priv->virtual, | ||
163 | (size_t) buf->total); | 162 | (size_t) buf->total); |
164 | up_write(¤t->mm->mmap_sem); | ||
165 | 163 | ||
166 | buf_priv->currently_mapped = I810_BUF_UNMAPPED; | 164 | buf_priv->currently_mapped = I810_BUF_UNMAPPED; |
167 | buf_priv->virtual = NULL; | 165 | buf_priv->virtual = NULL; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index dfa55e7478fb..ae8a64f9f845 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(semaphores, | |||
64 | "Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))"); | 64 | "Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))"); |
65 | 65 | ||
66 | int i915_enable_rc6 __read_mostly = -1; | 66 | int i915_enable_rc6 __read_mostly = -1; |
67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | 67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0400); |
68 | MODULE_PARM_DESC(i915_enable_rc6, | 68 | MODULE_PARM_DESC(i915_enable_rc6, |
69 | "Enable power-saving render C-state 6. " | 69 | "Enable power-saving render C-state 6. " |
70 | "Different stages can be selected via bitmask values " | 70 | "Different stages can be selected via bitmask values " |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 4c65c639f772..0d1e4b7b4b99 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1087,11 +1087,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
1087 | if (obj == NULL) | 1087 | if (obj == NULL) |
1088 | return -ENOENT; | 1088 | return -ENOENT; |
1089 | 1089 | ||
1090 | down_write(¤t->mm->mmap_sem); | 1090 | addr = vm_mmap(obj->filp, 0, args->size, |
1091 | addr = do_mmap(obj->filp, 0, args->size, | ||
1092 | PROT_READ | PROT_WRITE, MAP_SHARED, | 1091 | PROT_READ | PROT_WRITE, MAP_SHARED, |
1093 | args->offset); | 1092 | args->offset); |
1094 | up_write(¤t->mm->mmap_sem); | ||
1095 | drm_gem_object_unreference_unlocked(obj); | 1093 | drm_gem_object_unreference_unlocked(obj); |
1096 | if (IS_ERR((void *)addr)) | 1094 | if (IS_ERR((void *)addr)) |
1097 | return addr; | 1095 | return addr; |
@@ -1493,6 +1491,7 @@ i915_gem_object_move_off_active(struct drm_i915_gem_object *obj) | |||
1493 | { | 1491 | { |
1494 | list_del_init(&obj->ring_list); | 1492 | list_del_init(&obj->ring_list); |
1495 | obj->last_rendering_seqno = 0; | 1493 | obj->last_rendering_seqno = 0; |
1494 | obj->last_fenced_seqno = 0; | ||
1496 | } | 1495 | } |
1497 | 1496 | ||
1498 | static void | 1497 | static void |
@@ -1521,6 +1520,7 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj) | |||
1521 | BUG_ON(!list_empty(&obj->gpu_write_list)); | 1520 | BUG_ON(!list_empty(&obj->gpu_write_list)); |
1522 | BUG_ON(!obj->active); | 1521 | BUG_ON(!obj->active); |
1523 | obj->ring = NULL; | 1522 | obj->ring = NULL; |
1523 | obj->last_fenced_ring = NULL; | ||
1524 | 1524 | ||
1525 | i915_gem_object_move_off_active(obj); | 1525 | i915_gem_object_move_off_active(obj); |
1526 | obj->fenced_gpu_access = false; | 1526 | obj->fenced_gpu_access = false; |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 2abf4eb94039..b4bb1ef77ddc 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -3728,6 +3728,9 @@ | |||
3728 | #define GT_FIFO_FREE_ENTRIES 0x120008 | 3728 | #define GT_FIFO_FREE_ENTRIES 0x120008 |
3729 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 | 3729 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 |
3730 | 3730 | ||
3731 | #define GEN6_UCGCTL1 0x9400 | ||
3732 | # define GEN6_BLBUNIT_CLOCK_GATE_DISABLE (1 << 5) | ||
3733 | |||
3731 | #define GEN6_UCGCTL2 0x9404 | 3734 | #define GEN6_UCGCTL2 0x9404 |
3732 | # define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13) | 3735 | # define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13) |
3733 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) | 3736 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 91b35fd1db8c..5908cd563400 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2245,6 +2245,33 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
2245 | } | 2245 | } |
2246 | 2246 | ||
2247 | static int | 2247 | static int |
2248 | intel_finish_fb(struct drm_framebuffer *old_fb) | ||
2249 | { | ||
2250 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | ||
2251 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; | ||
2252 | bool was_interruptible = dev_priv->mm.interruptible; | ||
2253 | int ret; | ||
2254 | |||
2255 | wait_event(dev_priv->pending_flip_queue, | ||
2256 | atomic_read(&dev_priv->mm.wedged) || | ||
2257 | atomic_read(&obj->pending_flip) == 0); | ||
2258 | |||
2259 | /* Big Hammer, we also need to ensure that any pending | ||
2260 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | ||
2261 | * current scanout is retired before unpinning the old | ||
2262 | * framebuffer. | ||
2263 | * | ||
2264 | * This should only fail upon a hung GPU, in which case we | ||
2265 | * can safely continue. | ||
2266 | */ | ||
2267 | dev_priv->mm.interruptible = false; | ||
2268 | ret = i915_gem_object_finish_gpu(obj); | ||
2269 | dev_priv->mm.interruptible = was_interruptible; | ||
2270 | |||
2271 | return ret; | ||
2272 | } | ||
2273 | |||
2274 | static int | ||
2248 | intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | 2275 | intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, |
2249 | struct drm_framebuffer *old_fb) | 2276 | struct drm_framebuffer *old_fb) |
2250 | { | 2277 | { |
@@ -2282,25 +2309,8 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
2282 | return ret; | 2309 | return ret; |
2283 | } | 2310 | } |
2284 | 2311 | ||
2285 | if (old_fb) { | 2312 | if (old_fb) |
2286 | struct drm_i915_private *dev_priv = dev->dev_private; | 2313 | intel_finish_fb(old_fb); |
2287 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | ||
2288 | |||
2289 | wait_event(dev_priv->pending_flip_queue, | ||
2290 | atomic_read(&dev_priv->mm.wedged) || | ||
2291 | atomic_read(&obj->pending_flip) == 0); | ||
2292 | |||
2293 | /* Big Hammer, we also need to ensure that any pending | ||
2294 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | ||
2295 | * current scanout is retired before unpinning the old | ||
2296 | * framebuffer. | ||
2297 | * | ||
2298 | * This should only fail upon a hung GPU, in which case we | ||
2299 | * can safely continue. | ||
2300 | */ | ||
2301 | ret = i915_gem_object_finish_gpu(obj); | ||
2302 | (void) ret; | ||
2303 | } | ||
2304 | 2314 | ||
2305 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, | 2315 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, |
2306 | LEAVE_ATOMIC_MODE_SET); | 2316 | LEAVE_ATOMIC_MODE_SET); |
@@ -3371,6 +3381,23 @@ static void intel_crtc_disable(struct drm_crtc *crtc) | |||
3371 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; | 3381 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; |
3372 | struct drm_device *dev = crtc->dev; | 3382 | struct drm_device *dev = crtc->dev; |
3373 | 3383 | ||
3384 | /* Flush any pending WAITs before we disable the pipe. Note that | ||
3385 | * we need to drop the struct_mutex in order to acquire it again | ||
3386 | * during the lowlevel dpms routines around a couple of the | ||
3387 | * operations. It does not look trivial nor desirable to move | ||
3388 | * that locking higher. So instead we leave a window for the | ||
3389 | * submission of further commands on the fb before we can actually | ||
3390 | * disable it. This race with userspace exists anyway, and we can | ||
3391 | * only rely on the pipe being disabled by userspace after it | ||
3392 | * receives the hotplug notification and has flushed any pending | ||
3393 | * batches. | ||
3394 | */ | ||
3395 | if (crtc->fb) { | ||
3396 | mutex_lock(&dev->struct_mutex); | ||
3397 | intel_finish_fb(crtc->fb); | ||
3398 | mutex_unlock(&dev->struct_mutex); | ||
3399 | } | ||
3400 | |||
3374 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); | 3401 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); |
3375 | assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); | 3402 | assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); |
3376 | assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); | 3403 | assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); |
@@ -3451,8 +3478,11 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, | |||
3451 | return false; | 3478 | return false; |
3452 | } | 3479 | } |
3453 | 3480 | ||
3454 | /* All interlaced capable intel hw wants timings in frames. */ | 3481 | /* All interlaced capable intel hw wants timings in frames. Note though |
3455 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 3482 | * that intel_lvds_mode_fixup does some funny tricks with the crtc |
3483 | * timings, so we need to be careful not to clobber these.*/ | ||
3484 | if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET)) | ||
3485 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
3456 | 3486 | ||
3457 | return true; | 3487 | return true; |
3458 | } | 3488 | } |
@@ -7438,7 +7468,13 @@ static int intel_gen6_queue_flip(struct drm_device *dev, | |||
7438 | OUT_RING(fb->pitches[0] | obj->tiling_mode); | 7468 | OUT_RING(fb->pitches[0] | obj->tiling_mode); |
7439 | OUT_RING(obj->gtt_offset); | 7469 | OUT_RING(obj->gtt_offset); |
7440 | 7470 | ||
7441 | pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; | 7471 | /* Contrary to the suggestions in the documentation, |
7472 | * "Enable Panel Fitter" does not seem to be required when page | ||
7473 | * flipping with a non-native mode, and worse causes a normal | ||
7474 | * modeset to fail. | ||
7475 | * pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; | ||
7476 | */ | ||
7477 | pf = 0; | ||
7442 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; | 7478 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; |
7443 | OUT_RING(pf | pipesrc); | 7479 | OUT_RING(pf | pipesrc); |
7444 | ADVANCE_LP_RING(); | 7480 | ADVANCE_LP_RING(); |
@@ -8529,6 +8565,10 @@ static void gen6_init_clock_gating(struct drm_device *dev) | |||
8529 | I915_WRITE(WM2_LP_ILK, 0); | 8565 | I915_WRITE(WM2_LP_ILK, 0); |
8530 | I915_WRITE(WM1_LP_ILK, 0); | 8566 | I915_WRITE(WM1_LP_ILK, 0); |
8531 | 8567 | ||
8568 | I915_WRITE(GEN6_UCGCTL1, | ||
8569 | I915_READ(GEN6_UCGCTL1) | | ||
8570 | GEN6_BLBUNIT_CLOCK_GATE_DISABLE); | ||
8571 | |||
8532 | /* According to the BSpec vol1g, bit 12 (RCPBUNIT) clock | 8572 | /* According to the BSpec vol1g, bit 12 (RCPBUNIT) clock |
8533 | * gating disable must be set. Failure to set it results in | 8573 | * gating disable must be set. Failure to set it results in |
8534 | * flickering pixels due to Z write ordering failures after | 8574 | * flickering pixels due to Z write ordering failures after |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 110552ff302c..4b637919f74f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -219,14 +219,38 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes) | |||
219 | return (max_link_clock * max_lanes * 8) / 10; | 219 | return (max_link_clock * max_lanes * 8) / 10; |
220 | } | 220 | } |
221 | 221 | ||
222 | static bool | ||
223 | intel_dp_adjust_dithering(struct intel_dp *intel_dp, | ||
224 | struct drm_display_mode *mode, | ||
225 | struct drm_display_mode *adjusted_mode) | ||
226 | { | ||
227 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); | ||
228 | int max_lanes = intel_dp_max_lane_count(intel_dp); | ||
229 | int max_rate, mode_rate; | ||
230 | |||
231 | mode_rate = intel_dp_link_required(mode->clock, 24); | ||
232 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); | ||
233 | |||
234 | if (mode_rate > max_rate) { | ||
235 | mode_rate = intel_dp_link_required(mode->clock, 18); | ||
236 | if (mode_rate > max_rate) | ||
237 | return false; | ||
238 | |||
239 | if (adjusted_mode) | ||
240 | adjusted_mode->private_flags | ||
241 | |= INTEL_MODE_DP_FORCE_6BPC; | ||
242 | |||
243 | return true; | ||
244 | } | ||
245 | |||
246 | return true; | ||
247 | } | ||
248 | |||
222 | static int | 249 | static int |
223 | intel_dp_mode_valid(struct drm_connector *connector, | 250 | intel_dp_mode_valid(struct drm_connector *connector, |
224 | struct drm_display_mode *mode) | 251 | struct drm_display_mode *mode) |
225 | { | 252 | { |
226 | struct intel_dp *intel_dp = intel_attached_dp(connector); | 253 | struct intel_dp *intel_dp = intel_attached_dp(connector); |
227 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); | ||
228 | int max_lanes = intel_dp_max_lane_count(intel_dp); | ||
229 | int max_rate, mode_rate; | ||
230 | 254 | ||
231 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 255 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
232 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) | 256 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) |
@@ -236,16 +260,8 @@ intel_dp_mode_valid(struct drm_connector *connector, | |||
236 | return MODE_PANEL; | 260 | return MODE_PANEL; |
237 | } | 261 | } |
238 | 262 | ||
239 | mode_rate = intel_dp_link_required(mode->clock, 24); | 263 | if (!intel_dp_adjust_dithering(intel_dp, mode, NULL)) |
240 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); | 264 | return MODE_CLOCK_HIGH; |
241 | |||
242 | if (mode_rate > max_rate) { | ||
243 | mode_rate = intel_dp_link_required(mode->clock, 18); | ||
244 | if (mode_rate > max_rate) | ||
245 | return MODE_CLOCK_HIGH; | ||
246 | else | ||
247 | mode->private_flags |= INTEL_MODE_DP_FORCE_6BPC; | ||
248 | } | ||
249 | 265 | ||
250 | if (mode->clock < 10000) | 266 | if (mode->clock < 10000) |
251 | return MODE_CLOCK_LOW; | 267 | return MODE_CLOCK_LOW; |
@@ -672,7 +688,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
672 | int lane_count, clock; | 688 | int lane_count, clock; |
673 | int max_lane_count = intel_dp_max_lane_count(intel_dp); | 689 | int max_lane_count = intel_dp_max_lane_count(intel_dp); |
674 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; | 690 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; |
675 | int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; | 691 | int bpp; |
676 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; | 692 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; |
677 | 693 | ||
678 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 694 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
@@ -686,6 +702,11 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
686 | mode->clock = intel_dp->panel_fixed_mode->clock; | 702 | mode->clock = intel_dp->panel_fixed_mode->clock; |
687 | } | 703 | } |
688 | 704 | ||
705 | if (!intel_dp_adjust_dithering(intel_dp, mode, adjusted_mode)) | ||
706 | return false; | ||
707 | |||
708 | bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; | ||
709 | |||
689 | for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { | 710 | for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { |
690 | for (clock = 0; clock <= max_clock; clock++) { | 711 | for (clock = 0; clock <= max_clock; clock++) { |
691 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); | 712 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 5a14149b3794..715afa153025 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -105,6 +105,10 @@ | |||
105 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) | 105 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) |
106 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) | 106 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) |
107 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) | 107 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) |
108 | /* This flag must be set by the encoder's mode_fixup if it changes the crtc | ||
109 | * timings in the mode to prevent the crtc fixup from overwriting them. | ||
110 | * Currently only lvds needs that. */ | ||
111 | #define INTEL_MODE_CRTC_TIMINGS_SET (0x20) | ||
108 | 112 | ||
109 | static inline void | 113 | static inline void |
110 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, | 114 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 19ecd78b8a2c..6e9ee33fd412 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -279,6 +279,8 @@ void intel_fb_restore_mode(struct drm_device *dev) | |||
279 | struct drm_mode_config *config = &dev->mode_config; | 279 | struct drm_mode_config *config = &dev->mode_config; |
280 | struct drm_plane *plane; | 280 | struct drm_plane *plane; |
281 | 281 | ||
282 | mutex_lock(&dev->mode_config.mutex); | ||
283 | |||
282 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); | 284 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); |
283 | if (ret) | 285 | if (ret) |
284 | DRM_DEBUG("failed to restore crtc mode\n"); | 286 | DRM_DEBUG("failed to restore crtc mode\n"); |
@@ -286,4 +288,6 @@ void intel_fb_restore_mode(struct drm_device *dev) | |||
286 | /* Be sure to shut off any planes that may be active */ | 288 | /* Be sure to shut off any planes that may be active */ |
287 | list_for_each_entry(plane, &config->plane_list, head) | 289 | list_for_each_entry(plane, &config->plane_list, head) |
288 | plane->funcs->disable_plane(plane); | 290 | plane->funcs->disable_plane(plane); |
291 | |||
292 | mutex_unlock(&dev->mode_config.mutex); | ||
289 | } | 293 | } |
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 601c86e664af..8fdc95700218 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -390,7 +390,7 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
390 | bus->has_gpio = intel_gpio_setup(bus, i); | 390 | bus->has_gpio = intel_gpio_setup(bus, i); |
391 | 391 | ||
392 | /* XXX force bit banging until GMBUS is fully debugged */ | 392 | /* XXX force bit banging until GMBUS is fully debugged */ |
393 | if (bus->has_gpio && IS_GEN2(dev)) | 393 | if (bus->has_gpio) |
394 | bus->force_bit = true; | 394 | bus->force_bit = true; |
395 | } | 395 | } |
396 | 396 | ||
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 95db2e988227..30e2c82101de 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -187,6 +187,8 @@ centre_horizontally(struct drm_display_mode *mode, | |||
187 | 187 | ||
188 | mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; | 188 | mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; |
189 | mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; | 189 | mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; |
190 | |||
191 | mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET; | ||
190 | } | 192 | } |
191 | 193 | ||
192 | static void | 194 | static void |
@@ -208,6 +210,8 @@ centre_vertically(struct drm_display_mode *mode, | |||
208 | 210 | ||
209 | mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; | 211 | mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; |
210 | mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; | 212 | mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; |
213 | |||
214 | mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET; | ||
211 | } | 215 | } |
212 | 216 | ||
213 | static inline u32 panel_fitter_scaling(u32 source, u32 target) | 217 | static inline u32 panel_fitter_scaling(u32 source, u32 target) |
@@ -283,6 +287,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
283 | for_each_pipe(pipe) | 287 | for_each_pipe(pipe) |
284 | I915_WRITE(BCLRPAT(pipe), 0); | 288 | I915_WRITE(BCLRPAT(pipe), 0); |
285 | 289 | ||
290 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
291 | |||
286 | switch (intel_lvds->fitting_mode) { | 292 | switch (intel_lvds->fitting_mode) { |
287 | case DRM_MODE_SCALE_CENTER: | 293 | case DRM_MODE_SCALE_CENTER: |
288 | /* | 294 | /* |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 230a141dbea3..48177ec4720e 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -47,8 +47,6 @@ intel_fixed_panel_mode(struct drm_display_mode *fixed_mode, | |||
47 | adjusted_mode->vtotal = fixed_mode->vtotal; | 47 | adjusted_mode->vtotal = fixed_mode->vtotal; |
48 | 48 | ||
49 | adjusted_mode->clock = fixed_mode->clock; | 49 | adjusted_mode->clock = fixed_mode->clock; |
50 | |||
51 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
52 | } | 50 | } |
53 | 51 | ||
54 | /* adjusted_mode has been preset to be the panel's fixed mode */ | 52 | /* adjusted_mode has been preset to be the panel's fixed mode */ |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index e25581a9f60f..f75806e5bff5 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1038,7 +1038,7 @@ int intel_init_ring_buffer(struct drm_device *dev, | |||
1038 | * of the buffer. | 1038 | * of the buffer. |
1039 | */ | 1039 | */ |
1040 | ring->effective_size = ring->size; | 1040 | ring->effective_size = ring->size; |
1041 | if (IS_I830(ring->dev)) | 1041 | if (IS_I830(ring->dev) || IS_845G(ring->dev)) |
1042 | ring->effective_size -= 128; | 1042 | ring->effective_size -= 128; |
1043 | 1043 | ||
1044 | return 0; | 1044 | return 0; |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index a464771a7240..e90dfb625c42 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -95,7 +95,6 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, | |||
95 | /* must disable */ | 95 | /* must disable */ |
96 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; | 96 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; |
97 | sprctl |= SPRITE_ENABLE; | 97 | sprctl |= SPRITE_ENABLE; |
98 | sprctl |= SPRITE_DEST_KEY; | ||
99 | 98 | ||
100 | /* Sizes are 0 based */ | 99 | /* Sizes are 0 based */ |
101 | src_w--; | 100 | src_w--; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 34d591b7d4ef..da3e7c3abab7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -235,6 +235,7 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile) | |||
235 | return -EPERM; | 235 | return -EPERM; |
236 | 236 | ||
237 | strncpy(string, profile, sizeof(string)); | 237 | strncpy(string, profile, sizeof(string)); |
238 | string[sizeof(string) - 1] = 0; | ||
238 | if ((ptr = strchr(string, '\n'))) | 239 | if ((ptr = strchr(string, '\n'))) |
239 | *ptr = '\0'; | 240 | *ptr = '\0'; |
240 | 241 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c index a7844ab6a50c..274640212475 100644 --- a/drivers/gpu/drm/nouveau/nv50_sor.c +++ b/drivers/gpu/drm/nouveau/nv50_sor.c | |||
@@ -42,7 +42,7 @@ nv50_sor_dp_lane_map(struct drm_device *dev, struct dcb_entry *dcb, u8 lane) | |||
42 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 42 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
43 | static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ | 43 | static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ |
44 | static const u8 nv50[] = { 16, 8, 0, 24 }; | 44 | static const u8 nv50[] = { 16, 8, 0, 24 }; |
45 | if (dev_priv->card_type == 0xaf) | 45 | if (dev_priv->chipset == 0xaf) |
46 | return nvaf[lane]; | 46 | return nvaf[lane]; |
47 | return nv50[lane]; | 47 | return nv50[lane]; |
48 | } | 48 | } |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index e607c4d7dd98..2d39f9977e00 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -230,6 +230,10 @@ atombios_dvo_setup(struct drm_encoder *encoder, int action) | |||
230 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | 230 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | /* some R4xx chips have the wrong frev */ | ||
234 | if (rdev->family <= CHIP_RV410) | ||
235 | frev = 1; | ||
236 | |||
233 | switch (frev) { | 237 | switch (frev) { |
234 | case 1: | 238 | case 1: |
235 | switch (crev) { | 239 | switch (crev) { |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 81801c176aa5..fe33d35dae8c 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -2553,7 +2553,7 @@ static void r100_pll_errata_after_data(struct radeon_device *rdev) | |||
2553 | * or the chip could hang on a subsequent access | 2553 | * or the chip could hang on a subsequent access |
2554 | */ | 2554 | */ |
2555 | if (rdev->pll_errata & CHIP_ERRATA_PLL_DELAY) { | 2555 | if (rdev->pll_errata & CHIP_ERRATA_PLL_DELAY) { |
2556 | udelay(5000); | 2556 | mdelay(5); |
2557 | } | 2557 | } |
2558 | 2558 | ||
2559 | /* This function is required to workaround a hardware bug in some (all?) | 2559 | /* This function is required to workaround a hardware bug in some (all?) |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 391bd2636a80..c8187c4b6ae8 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1135,7 +1135,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc | |||
1135 | } | 1135 | } |
1136 | if (rdev->flags & RADEON_IS_AGP) { | 1136 | if (rdev->flags & RADEON_IS_AGP) { |
1137 | size_bf = mc->gtt_start; | 1137 | size_bf = mc->gtt_start; |
1138 | size_af = 0xFFFFFFFF - mc->gtt_end + 1; | 1138 | size_af = 0xFFFFFFFF - mc->gtt_end; |
1139 | if (size_bf > size_af) { | 1139 | if (size_bf > size_af) { |
1140 | if (mc->mc_vram_size > size_bf) { | 1140 | if (mc->mc_vram_size > size_bf) { |
1141 | dev_warn(rdev->dev, "limiting VRAM\n"); | 1141 | dev_warn(rdev->dev, "limiting VRAM\n"); |
@@ -1149,7 +1149,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc | |||
1149 | mc->real_vram_size = size_af; | 1149 | mc->real_vram_size = size_af; |
1150 | mc->mc_vram_size = size_af; | 1150 | mc->mc_vram_size = size_af; |
1151 | } | 1151 | } |
1152 | mc->vram_start = mc->gtt_end; | 1152 | mc->vram_start = mc->gtt_end + 1; |
1153 | } | 1153 | } |
1154 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 1154 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
1155 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", | 1155 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", |
@@ -2839,7 +2839,7 @@ void r600_rlc_stop(struct radeon_device *rdev) | |||
2839 | /* r7xx asics need to soft reset RLC before halting */ | 2839 | /* r7xx asics need to soft reset RLC before halting */ |
2840 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_RLC); | 2840 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_RLC); |
2841 | RREG32(SRBM_SOFT_RESET); | 2841 | RREG32(SRBM_SOFT_RESET); |
2842 | udelay(15000); | 2842 | mdelay(15); |
2843 | WREG32(SRBM_SOFT_RESET, 0); | 2843 | WREG32(SRBM_SOFT_RESET, 0); |
2844 | RREG32(SRBM_SOFT_RESET); | 2844 | RREG32(SRBM_SOFT_RESET); |
2845 | } | 2845 | } |
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c index 84c546250955..75ed17c96115 100644 --- a/drivers/gpu/drm/radeon/r600_cp.c +++ b/drivers/gpu/drm/radeon/r600_cp.c | |||
@@ -407,7 +407,7 @@ static void r600_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
407 | 407 | ||
408 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 408 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
409 | RADEON_READ(R600_GRBM_SOFT_RESET); | 409 | RADEON_READ(R600_GRBM_SOFT_RESET); |
410 | DRM_UDELAY(15000); | 410 | mdelay(15); |
411 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); | 411 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); |
412 | 412 | ||
413 | fw_data = (const __be32 *)dev_priv->me_fw->data; | 413 | fw_data = (const __be32 *)dev_priv->me_fw->data; |
@@ -500,7 +500,7 @@ static void r700_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
500 | 500 | ||
501 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 501 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
502 | RADEON_READ(R600_GRBM_SOFT_RESET); | 502 | RADEON_READ(R600_GRBM_SOFT_RESET); |
503 | DRM_UDELAY(15000); | 503 | mdelay(15); |
504 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); | 504 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); |
505 | 505 | ||
506 | fw_data = (const __be32 *)dev_priv->pfp_fw->data; | 506 | fw_data = (const __be32 *)dev_priv->pfp_fw->data; |
@@ -1797,7 +1797,7 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev, | |||
1797 | 1797 | ||
1798 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 1798 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
1799 | RADEON_READ(R600_GRBM_SOFT_RESET); | 1799 | RADEON_READ(R600_GRBM_SOFT_RESET); |
1800 | DRM_UDELAY(15000); | 1800 | mdelay(15); |
1801 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); | 1801 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); |
1802 | 1802 | ||
1803 | 1803 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index 6ae0c75f016a..9c6b29a41927 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
@@ -633,7 +633,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
633 | tmp &= ~(R300_SCLK_FORCE_VAP); | 633 | tmp &= ~(R300_SCLK_FORCE_VAP); |
634 | tmp |= RADEON_SCLK_FORCE_CP; | 634 | tmp |= RADEON_SCLK_FORCE_CP; |
635 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); | 635 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); |
636 | udelay(15000); | 636 | mdelay(15); |
637 | 637 | ||
638 | tmp = RREG32_PLL(R300_SCLK_CNTL2); | 638 | tmp = RREG32_PLL(R300_SCLK_CNTL2); |
639 | tmp &= ~(R300_SCLK_FORCE_TCL | | 639 | tmp &= ~(R300_SCLK_FORCE_TCL | |
@@ -651,12 +651,12 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
651 | tmp |= (RADEON_ENGIN_DYNCLK_MODE | | 651 | tmp |= (RADEON_ENGIN_DYNCLK_MODE | |
652 | (0x01 << RADEON_ACTIVE_HILO_LAT_SHIFT)); | 652 | (0x01 << RADEON_ACTIVE_HILO_LAT_SHIFT)); |
653 | WREG32_PLL(RADEON_CLK_PWRMGT_CNTL, tmp); | 653 | WREG32_PLL(RADEON_CLK_PWRMGT_CNTL, tmp); |
654 | udelay(15000); | 654 | mdelay(15); |
655 | 655 | ||
656 | tmp = RREG32_PLL(RADEON_CLK_PIN_CNTL); | 656 | tmp = RREG32_PLL(RADEON_CLK_PIN_CNTL); |
657 | tmp |= RADEON_SCLK_DYN_START_CNTL; | 657 | tmp |= RADEON_SCLK_DYN_START_CNTL; |
658 | WREG32_PLL(RADEON_CLK_PIN_CNTL, tmp); | 658 | WREG32_PLL(RADEON_CLK_PIN_CNTL, tmp); |
659 | udelay(15000); | 659 | mdelay(15); |
660 | 660 | ||
661 | /* When DRI is enabled, setting DYN_STOP_LAT to zero can cause some R200 | 661 | /* When DRI is enabled, setting DYN_STOP_LAT to zero can cause some R200 |
662 | to lockup randomly, leave them as set by BIOS. | 662 | to lockup randomly, leave them as set by BIOS. |
@@ -696,7 +696,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
696 | tmp |= RADEON_SCLK_MORE_FORCEON; | 696 | tmp |= RADEON_SCLK_MORE_FORCEON; |
697 | } | 697 | } |
698 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); | 698 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); |
699 | udelay(15000); | 699 | mdelay(15); |
700 | } | 700 | } |
701 | 701 | ||
702 | /* RV200::A11 A12, RV250::A11 A12 */ | 702 | /* RV200::A11 A12, RV250::A11 A12 */ |
@@ -709,7 +709,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
709 | tmp |= RADEON_TCL_BYPASS_DISABLE; | 709 | tmp |= RADEON_TCL_BYPASS_DISABLE; |
710 | WREG32_PLL(RADEON_PLL_PWRMGT_CNTL, tmp); | 710 | WREG32_PLL(RADEON_PLL_PWRMGT_CNTL, tmp); |
711 | } | 711 | } |
712 | udelay(15000); | 712 | mdelay(15); |
713 | 713 | ||
714 | /*enable dynamic mode for display clocks (PIXCLK and PIX2CLK) */ | 714 | /*enable dynamic mode for display clocks (PIXCLK and PIX2CLK) */ |
715 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 715 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
@@ -722,14 +722,14 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
722 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); | 722 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); |
723 | 723 | ||
724 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 724 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
725 | udelay(15000); | 725 | mdelay(15); |
726 | 726 | ||
727 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); | 727 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); |
728 | tmp |= (RADEON_PIXCLK_ALWAYS_ONb | | 728 | tmp |= (RADEON_PIXCLK_ALWAYS_ONb | |
729 | RADEON_PIXCLK_DAC_ALWAYS_ONb); | 729 | RADEON_PIXCLK_DAC_ALWAYS_ONb); |
730 | 730 | ||
731 | WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp); | 731 | WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp); |
732 | udelay(15000); | 732 | mdelay(15); |
733 | } | 733 | } |
734 | } else { | 734 | } else { |
735 | /* Turn everything OFF (ForceON to everything) */ | 735 | /* Turn everything OFF (ForceON to everything) */ |
@@ -861,7 +861,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
861 | } | 861 | } |
862 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); | 862 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); |
863 | 863 | ||
864 | udelay(16000); | 864 | mdelay(16); |
865 | 865 | ||
866 | if ((rdev->family == CHIP_R300) || | 866 | if ((rdev->family == CHIP_R300) || |
867 | (rdev->family == CHIP_R350)) { | 867 | (rdev->family == CHIP_R350)) { |
@@ -870,7 +870,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
870 | R300_SCLK_FORCE_GA | | 870 | R300_SCLK_FORCE_GA | |
871 | R300_SCLK_FORCE_CBA); | 871 | R300_SCLK_FORCE_CBA); |
872 | WREG32_PLL(R300_SCLK_CNTL2, tmp); | 872 | WREG32_PLL(R300_SCLK_CNTL2, tmp); |
873 | udelay(16000); | 873 | mdelay(16); |
874 | } | 874 | } |
875 | 875 | ||
876 | if (rdev->flags & RADEON_IS_IGP) { | 876 | if (rdev->flags & RADEON_IS_IGP) { |
@@ -878,7 +878,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
878 | tmp &= ~(RADEON_FORCEON_MCLKA | | 878 | tmp &= ~(RADEON_FORCEON_MCLKA | |
879 | RADEON_FORCEON_YCLKA); | 879 | RADEON_FORCEON_YCLKA); |
880 | WREG32_PLL(RADEON_MCLK_CNTL, tmp); | 880 | WREG32_PLL(RADEON_MCLK_CNTL, tmp); |
881 | udelay(16000); | 881 | mdelay(16); |
882 | } | 882 | } |
883 | 883 | ||
884 | if ((rdev->family == CHIP_RV200) || | 884 | if ((rdev->family == CHIP_RV200) || |
@@ -887,7 +887,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
887 | tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL); | 887 | tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL); |
888 | tmp |= RADEON_SCLK_MORE_FORCEON; | 888 | tmp |= RADEON_SCLK_MORE_FORCEON; |
889 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); | 889 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); |
890 | udelay(16000); | 890 | mdelay(16); |
891 | } | 891 | } |
892 | 892 | ||
893 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 893 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
@@ -900,7 +900,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
900 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); | 900 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); |
901 | 901 | ||
902 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 902 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
903 | udelay(16000); | 903 | mdelay(16); |
904 | 904 | ||
905 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); | 905 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); |
906 | tmp &= ~(RADEON_PIXCLK_ALWAYS_ONb | | 906 | tmp &= ~(RADEON_PIXCLK_ALWAYS_ONb | |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 81fc100be7e1..2cad9fde92fc 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -2845,7 +2845,7 @@ bool radeon_combios_external_tmds_setup(struct drm_encoder *encoder) | |||
2845 | case 4: | 2845 | case 4: |
2846 | val = RBIOS16(index); | 2846 | val = RBIOS16(index); |
2847 | index += 2; | 2847 | index += 2; |
2848 | udelay(val * 1000); | 2848 | mdelay(val); |
2849 | break; | 2849 | break; |
2850 | case 6: | 2850 | case 6: |
2851 | slave_addr = id & 0xff; | 2851 | slave_addr = id & 0xff; |
@@ -3044,7 +3044,7 @@ static void combios_parse_pll_table(struct drm_device *dev, uint16_t offset) | |||
3044 | udelay(150); | 3044 | udelay(150); |
3045 | break; | 3045 | break; |
3046 | case 2: | 3046 | case 2: |
3047 | udelay(1000); | 3047 | mdelay(1); |
3048 | break; | 3048 | break; |
3049 | case 3: | 3049 | case 3: |
3050 | while (tmp--) { | 3050 | while (tmp--) { |
@@ -3075,13 +3075,13 @@ static void combios_parse_pll_table(struct drm_device *dev, uint16_t offset) | |||
3075 | /*mclk_cntl |= 0x00001111;*//* ??? */ | 3075 | /*mclk_cntl |= 0x00001111;*//* ??? */ |
3076 | WREG32_PLL(RADEON_MCLK_CNTL, | 3076 | WREG32_PLL(RADEON_MCLK_CNTL, |
3077 | mclk_cntl); | 3077 | mclk_cntl); |
3078 | udelay(10000); | 3078 | mdelay(10); |
3079 | #endif | 3079 | #endif |
3080 | WREG32_PLL | 3080 | WREG32_PLL |
3081 | (RADEON_CLK_PWRMGT_CNTL, | 3081 | (RADEON_CLK_PWRMGT_CNTL, |
3082 | tmp & | 3082 | tmp & |
3083 | ~RADEON_CG_NO1_DEBUG_0); | 3083 | ~RADEON_CG_NO1_DEBUG_0); |
3084 | udelay(10000); | 3084 | mdelay(10); |
3085 | } | 3085 | } |
3086 | break; | 3086 | break; |
3087 | default: | 3087 | default: |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index bd05156edbdb..3c2e7a000a2a 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -970,7 +970,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
970 | 970 | ||
971 | encoder = obj_to_encoder(obj); | 971 | encoder = obj_to_encoder(obj); |
972 | 972 | ||
973 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC || | 973 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC && |
974 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) | 974 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) |
975 | continue; | 975 | continue; |
976 | 976 | ||
@@ -1000,6 +1000,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1000 | * cases the DVI port is actually a virtual KVM port connected to the service | 1000 | * cases the DVI port is actually a virtual KVM port connected to the service |
1001 | * processor. | 1001 | * processor. |
1002 | */ | 1002 | */ |
1003 | out: | ||
1003 | if ((!rdev->is_atom_bios) && | 1004 | if ((!rdev->is_atom_bios) && |
1004 | (ret == connector_status_disconnected) && | 1005 | (ret == connector_status_disconnected) && |
1005 | rdev->mode_info.bios_hardcoded_edid_size) { | 1006 | rdev->mode_info.bios_hardcoded_edid_size) { |
@@ -1007,7 +1008,6 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1007 | ret = connector_status_connected; | 1008 | ret = connector_status_connected; |
1008 | } | 1009 | } |
1009 | 1010 | ||
1010 | out: | ||
1011 | /* updated in get modes as well since we need to know if it's analog or digital */ | 1011 | /* updated in get modes as well since we need to know if it's analog or digital */ |
1012 | radeon_connector_update_scratch_regs(connector, ret); | 1012 | radeon_connector_update_scratch_regs(connector, ret); |
1013 | return ret; | 1013 | return ret; |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index 85bcfc8923a7..3edec1c198e3 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
@@ -900,6 +900,10 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | |||
900 | struct radeon_i2c_chan *i2c; | 900 | struct radeon_i2c_chan *i2c; |
901 | int ret; | 901 | int ret; |
902 | 902 | ||
903 | /* don't add the mm_i2c bus unless hw_i2c is enabled */ | ||
904 | if (rec->mm_i2c && (radeon_hw_i2c == 0)) | ||
905 | return NULL; | ||
906 | |||
903 | i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL); | 907 | i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL); |
904 | if (i2c == NULL) | 908 | if (i2c == NULL) |
905 | return NULL; | 909 | return NULL; |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 66d5fe1c8174..65060b77c805 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -147,6 +147,12 @@ static bool radeon_msi_ok(struct radeon_device *rdev) | |||
147 | (rdev->pdev->subsystem_device == 0x01fd)) | 147 | (rdev->pdev->subsystem_device == 0x01fd)) |
148 | return true; | 148 | return true; |
149 | 149 | ||
150 | /* RV515 seems to have MSI issues where it loses | ||
151 | * MSI rearms occasionally. This leads to lockups and freezes. | ||
152 | * disable it by default. | ||
153 | */ | ||
154 | if (rdev->family == CHIP_RV515) | ||
155 | return false; | ||
150 | if (rdev->flags & RADEON_IS_IGP) { | 156 | if (rdev->flags & RADEON_IS_IGP) { |
151 | /* APUs work fine with MSIs */ | 157 | /* APUs work fine with MSIs */ |
152 | if (rdev->family >= CHIP_PALM) | 158 | if (rdev->family >= CHIP_PALM) |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 2f46e0c8df53..42db254f6bb0 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -88,7 +88,7 @@ static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) | |||
88 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); | 88 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); |
89 | lvds_pll_cntl |= RADEON_LVDS_PLL_EN; | 89 | lvds_pll_cntl |= RADEON_LVDS_PLL_EN; |
90 | WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); | 90 | WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); |
91 | udelay(1000); | 91 | mdelay(1); |
92 | 92 | ||
93 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); | 93 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); |
94 | lvds_pll_cntl &= ~RADEON_LVDS_PLL_RESET; | 94 | lvds_pll_cntl &= ~RADEON_LVDS_PLL_RESET; |
@@ -101,7 +101,7 @@ static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) | |||
101 | (backlight_level << RADEON_LVDS_BL_MOD_LEVEL_SHIFT)); | 101 | (backlight_level << RADEON_LVDS_BL_MOD_LEVEL_SHIFT)); |
102 | if (is_mac) | 102 | if (is_mac) |
103 | lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; | 103 | lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; |
104 | udelay(panel_pwr_delay * 1000); | 104 | mdelay(panel_pwr_delay); |
105 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); | 105 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); |
106 | break; | 106 | break; |
107 | case DRM_MODE_DPMS_STANDBY: | 107 | case DRM_MODE_DPMS_STANDBY: |
@@ -118,10 +118,10 @@ static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) | |||
118 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); | 118 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); |
119 | lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON); | 119 | lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON); |
120 | } | 120 | } |
121 | udelay(panel_pwr_delay * 1000); | 121 | mdelay(panel_pwr_delay); |
122 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); | 122 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); |
123 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); | 123 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); |
124 | udelay(panel_pwr_delay * 1000); | 124 | mdelay(panel_pwr_delay); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | 127 | ||
@@ -656,7 +656,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | |||
656 | 656 | ||
657 | WREG32(RADEON_DAC_MACRO_CNTL, tmp); | 657 | WREG32(RADEON_DAC_MACRO_CNTL, tmp); |
658 | 658 | ||
659 | udelay(2000); | 659 | mdelay(2); |
660 | 660 | ||
661 | if (RREG32(RADEON_DAC_CNTL) & RADEON_DAC_CMP_OUTPUT) | 661 | if (RREG32(RADEON_DAC_CNTL) & RADEON_DAC_CMP_OUTPUT) |
662 | found = connector_status_connected; | 662 | found = connector_status_connected; |
@@ -1499,7 +1499,7 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1499 | tmp = dac_cntl2 | RADEON_DAC2_DAC2_CLK_SEL | RADEON_DAC2_CMP_EN; | 1499 | tmp = dac_cntl2 | RADEON_DAC2_DAC2_CLK_SEL | RADEON_DAC2_CMP_EN; |
1500 | WREG32(RADEON_DAC_CNTL2, tmp); | 1500 | WREG32(RADEON_DAC_CNTL2, tmp); |
1501 | 1501 | ||
1502 | udelay(10000); | 1502 | mdelay(10); |
1503 | 1503 | ||
1504 | if (ASIC_IS_R300(rdev)) { | 1504 | if (ASIC_IS_R300(rdev)) { |
1505 | if (RREG32(RADEON_DAC_CNTL2) & RADEON_DAC2_CMP_OUT_B) | 1505 | if (RREG32(RADEON_DAC_CNTL2) & RADEON_DAC2_CMP_OUT_B) |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index c62ae4be3845..cdab1aeaed6e 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -969,7 +969,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
969 | } | 969 | } |
970 | if (rdev->flags & RADEON_IS_AGP) { | 970 | if (rdev->flags & RADEON_IS_AGP) { |
971 | size_bf = mc->gtt_start; | 971 | size_bf = mc->gtt_start; |
972 | size_af = 0xFFFFFFFF - mc->gtt_end + 1; | 972 | size_af = 0xFFFFFFFF - mc->gtt_end; |
973 | if (size_bf > size_af) { | 973 | if (size_bf > size_af) { |
974 | if (mc->mc_vram_size > size_bf) { | 974 | if (mc->mc_vram_size > size_bf) { |
975 | dev_warn(rdev->dev, "limiting VRAM\n"); | 975 | dev_warn(rdev->dev, "limiting VRAM\n"); |
@@ -983,7 +983,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
983 | mc->real_vram_size = size_af; | 983 | mc->real_vram_size = size_af; |
984 | mc->mc_vram_size = size_af; | 984 | mc->mc_vram_size = size_af; |
985 | } | 985 | } |
986 | mc->vram_start = mc->gtt_end; | 986 | mc->vram_start = mc->gtt_end + 1; |
987 | } | 987 | } |
988 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 988 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
989 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", | 989 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index ac7a199ffece..27bda986fc2b 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2999,8 +2999,8 @@ int si_rlc_init(struct radeon_device *rdev) | |||
2999 | } | 2999 | } |
3000 | r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, | 3000 | r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, |
3001 | &rdev->rlc.save_restore_gpu_addr); | 3001 | &rdev->rlc.save_restore_gpu_addr); |
3002 | radeon_bo_unreserve(rdev->rlc.save_restore_obj); | ||
3002 | if (r) { | 3003 | if (r) { |
3003 | radeon_bo_unreserve(rdev->rlc.save_restore_obj); | ||
3004 | dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); | 3004 | dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); |
3005 | si_rlc_fini(rdev); | 3005 | si_rlc_fini(rdev); |
3006 | return r; | 3006 | return r; |
@@ -3023,9 +3023,8 @@ int si_rlc_init(struct radeon_device *rdev) | |||
3023 | } | 3023 | } |
3024 | r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, | 3024 | r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, |
3025 | &rdev->rlc.clear_state_gpu_addr); | 3025 | &rdev->rlc.clear_state_gpu_addr); |
3026 | radeon_bo_unreserve(rdev->rlc.clear_state_obj); | ||
3026 | if (r) { | 3027 | if (r) { |
3027 | |||
3028 | radeon_bo_unreserve(rdev->rlc.clear_state_obj); | ||
3029 | dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); | 3028 | dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); |
3030 | si_rlc_fini(rdev); | 3029 | si_rlc_fini(rdev); |
3031 | return r; | 3030 | return r; |
diff --git a/drivers/gpu/drm/savage/savage_state.c b/drivers/gpu/drm/savage/savage_state.c index 031aaaf79ac2..b6d8608375cd 100644 --- a/drivers/gpu/drm/savage/savage_state.c +++ b/drivers/gpu/drm/savage/savage_state.c | |||
@@ -988,7 +988,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ | |||
988 | * for locking on FreeBSD. | 988 | * for locking on FreeBSD. |
989 | */ | 989 | */ |
990 | if (cmdbuf->size) { | 990 | if (cmdbuf->size) { |
991 | kcmd_addr = kmalloc(cmdbuf->size * 8, GFP_KERNEL); | 991 | kcmd_addr = kmalloc_array(cmdbuf->size, 8, GFP_KERNEL); |
992 | if (kcmd_addr == NULL) | 992 | if (kcmd_addr == NULL) |
993 | return -ENOMEM; | 993 | return -ENOMEM; |
994 | 994 | ||
@@ -1015,8 +1015,8 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ | |||
1015 | cmdbuf->vb_addr = kvb_addr; | 1015 | cmdbuf->vb_addr = kvb_addr; |
1016 | } | 1016 | } |
1017 | if (cmdbuf->nbox) { | 1017 | if (cmdbuf->nbox) { |
1018 | kbox_addr = kmalloc(cmdbuf->nbox * sizeof(struct drm_clip_rect), | 1018 | kbox_addr = kmalloc_array(cmdbuf->nbox, sizeof(struct drm_clip_rect), |
1019 | GFP_KERNEL); | 1019 | GFP_KERNEL); |
1020 | if (kbox_addr == NULL) { | 1020 | if (kbox_addr == NULL) { |
1021 | ret = -ENOMEM; | 1021 | ret = -ENOMEM; |
1022 | goto done; | 1022 | goto done; |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index a3d033252995..ffddcba32af6 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -34,7 +34,7 @@ config HID | |||
34 | config HID_BATTERY_STRENGTH | 34 | config HID_BATTERY_STRENGTH |
35 | bool | 35 | bool |
36 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY | 36 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY |
37 | default y | 37 | default n |
38 | 38 | ||
39 | config HIDRAW | 39 | config HIDRAW |
40 | bool "/dev/hidraw raw HID device support" | 40 | bool "/dev/hidraw raw HID device support" |
diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c index de47039c708c..9f85f827607f 100644 --- a/drivers/hid/hid-tivo.c +++ b/drivers/hid/hid-tivo.c | |||
@@ -62,7 +62,7 @@ static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
62 | 62 | ||
63 | static const struct hid_device_id tivo_devices[] = { | 63 | static const struct hid_device_id tivo_devices[] = { |
64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ | 64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ |
65 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, | 65 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, | 66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
67 | { } | 67 | { } |
68 | }; | 68 | }; |
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c index 145f13580ff0..9140236a0182 100644 --- a/drivers/hwmon/acpi_power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c | |||
@@ -391,6 +391,7 @@ static ssize_t show_str(struct device *dev, | |||
391 | break; | 391 | break; |
392 | default: | 392 | default: |
393 | BUG(); | 393 | BUG(); |
394 | val = ""; | ||
394 | } | 395 | } |
395 | 396 | ||
396 | return sprintf(buf, "%s\n", val); | 397 | return sprintf(buf, "%s\n", val); |
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c index 7765e4f74ec5..1958f03efd7a 100644 --- a/drivers/hwmon/ads1015.c +++ b/drivers/hwmon/ads1015.c | |||
@@ -59,14 +59,11 @@ struct ads1015_data { | |||
59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; | 59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | 62 | static int ads1015_read_adc(struct i2c_client *client, unsigned int channel) |
63 | int *value) | ||
64 | { | 63 | { |
65 | u16 config; | 64 | u16 config; |
66 | s16 conversion; | ||
67 | struct ads1015_data *data = i2c_get_clientdata(client); | 65 | struct ads1015_data *data = i2c_get_clientdata(client); |
68 | unsigned int pga = data->channel_data[channel].pga; | 66 | unsigned int pga = data->channel_data[channel].pga; |
69 | int fullscale; | ||
70 | unsigned int data_rate = data->channel_data[channel].data_rate; | 67 | unsigned int data_rate = data->channel_data[channel].data_rate; |
71 | unsigned int conversion_time_ms; | 68 | unsigned int conversion_time_ms; |
72 | int res; | 69 | int res; |
@@ -78,7 +75,6 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
78 | if (res < 0) | 75 | if (res < 0) |
79 | goto err_unlock; | 76 | goto err_unlock; |
80 | config = res; | 77 | config = res; |
81 | fullscale = fullscale_table[pga]; | ||
82 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); | 78 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); |
83 | 79 | ||
84 | /* setup and start single conversion */ | 80 | /* setup and start single conversion */ |
@@ -105,33 +101,36 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
105 | } | 101 | } |
106 | 102 | ||
107 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); | 103 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); |
108 | if (res < 0) | ||
109 | goto err_unlock; | ||
110 | conversion = res; | ||
111 | |||
112 | mutex_unlock(&data->update_lock); | ||
113 | |||
114 | *value = DIV_ROUND_CLOSEST(conversion * fullscale, 0x7ff0); | ||
115 | |||
116 | return 0; | ||
117 | 104 | ||
118 | err_unlock: | 105 | err_unlock: |
119 | mutex_unlock(&data->update_lock); | 106 | mutex_unlock(&data->update_lock); |
120 | return res; | 107 | return res; |
121 | } | 108 | } |
122 | 109 | ||
110 | static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel, | ||
111 | s16 reg) | ||
112 | { | ||
113 | struct ads1015_data *data = i2c_get_clientdata(client); | ||
114 | unsigned int pga = data->channel_data[channel].pga; | ||
115 | int fullscale = fullscale_table[pga]; | ||
116 | |||
117 | return DIV_ROUND_CLOSEST(reg * fullscale, 0x7ff0); | ||
118 | } | ||
119 | |||
123 | /* sysfs callback function */ | 120 | /* sysfs callback function */ |
124 | static ssize_t show_in(struct device *dev, struct device_attribute *da, | 121 | static ssize_t show_in(struct device *dev, struct device_attribute *da, |
125 | char *buf) | 122 | char *buf) |
126 | { | 123 | { |
127 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 124 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
128 | struct i2c_client *client = to_i2c_client(dev); | 125 | struct i2c_client *client = to_i2c_client(dev); |
129 | int in; | ||
130 | int res; | 126 | int res; |
127 | int index = attr->index; | ||
131 | 128 | ||
132 | res = ads1015_read_value(client, attr->index, &in); | 129 | res = ads1015_read_adc(client, index); |
130 | if (res < 0) | ||
131 | return res; | ||
133 | 132 | ||
134 | return (res < 0) ? res : sprintf(buf, "%d\n", in); | 133 | return sprintf(buf, "%d\n", ads1015_reg_to_mv(client, index, res)); |
135 | } | 134 | } |
136 | 135 | ||
137 | static const struct sensor_device_attribute ads1015_in[] = { | 136 | static const struct sensor_device_attribute ads1015_in[] = { |
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index b7494af1e4a9..37a8fc92b44a 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -122,6 +122,38 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
122 | return true; | 122 | return true; |
123 | } | 123 | } |
124 | 124 | ||
125 | /* | ||
126 | * Newer BKDG versions have an updated recommendation on how to properly | ||
127 | * initialize the running average range (was: 0xE, now: 0x9). This avoids | ||
128 | * counter saturations resulting in bogus power readings. | ||
129 | * We correct this value ourselves to cope with older BIOSes. | ||
130 | */ | ||
131 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) | ||
132 | { | ||
133 | u32 val; | ||
134 | const struct pci_device_id affected_device = { | ||
135 | PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }; | ||
136 | |||
137 | /* | ||
138 | * let this quirk apply only to the current version of the | ||
139 | * northbridge, since future versions may change the behavior | ||
140 | */ | ||
141 | if (!pci_match_id(&affected_device, pdev)) | ||
142 | return; | ||
143 | |||
144 | pci_bus_read_config_dword(pdev->bus, | ||
145 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
146 | REG_TDP_RUNNING_AVERAGE, &val); | ||
147 | if ((val & 0xf) != 0xe) | ||
148 | return; | ||
149 | |||
150 | val &= ~0xf; | ||
151 | val |= 0x9; | ||
152 | pci_bus_write_config_dword(pdev->bus, | ||
153 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
154 | REG_TDP_RUNNING_AVERAGE, val); | ||
155 | } | ||
156 | |||
125 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | 157 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
126 | struct fam15h_power_data *data) | 158 | struct fam15h_power_data *data) |
127 | { | 159 | { |
@@ -155,6 +187,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev, | |||
155 | struct device *dev; | 187 | struct device *dev; |
156 | int err; | 188 | int err; |
157 | 189 | ||
190 | /* | ||
191 | * though we ignore every other northbridge, we still have to | ||
192 | * do the tweaking on _each_ node in MCM processors as the counters | ||
193 | * are working hand-in-hand | ||
194 | */ | ||
195 | tweak_runavg_range(pdev); | ||
196 | |||
158 | if (!fam15h_power_is_internal_node0(pdev)) { | 197 | if (!fam15h_power_is_internal_node0(pdev)) { |
159 | err = -ENODEV; | 198 | err = -ENODEV; |
160 | goto exit; | 199 | goto exit; |
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index be51037363c8..29b319db573e 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
@@ -710,13 +710,13 @@ static u16 pmbus_data2reg(struct pmbus_data *data, | |||
710 | * If a negative value is stored in any of the referenced registers, this value | 710 | * If a negative value is stored in any of the referenced registers, this value |
711 | * reflects an error code which will be returned. | 711 | * reflects an error code which will be returned. |
712 | */ | 712 | */ |
713 | static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | 713 | static int pmbus_get_boolean(struct pmbus_data *data, int index) |
714 | { | 714 | { |
715 | u8 s1 = (index >> 24) & 0xff; | 715 | u8 s1 = (index >> 24) & 0xff; |
716 | u8 s2 = (index >> 16) & 0xff; | 716 | u8 s2 = (index >> 16) & 0xff; |
717 | u8 reg = (index >> 8) & 0xff; | 717 | u8 reg = (index >> 8) & 0xff; |
718 | u8 mask = index & 0xff; | 718 | u8 mask = index & 0xff; |
719 | int status; | 719 | int ret, status; |
720 | u8 regval; | 720 | u8 regval; |
721 | 721 | ||
722 | status = data->status[reg]; | 722 | status = data->status[reg]; |
@@ -725,7 +725,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | |||
725 | 725 | ||
726 | regval = status & mask; | 726 | regval = status & mask; |
727 | if (!s1 && !s2) | 727 | if (!s1 && !s2) |
728 | *val = !!regval; | 728 | ret = !!regval; |
729 | else { | 729 | else { |
730 | long v1, v2; | 730 | long v1, v2; |
731 | struct pmbus_sensor *sensor1, *sensor2; | 731 | struct pmbus_sensor *sensor1, *sensor2; |
@@ -739,9 +739,9 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | |||
739 | 739 | ||
740 | v1 = pmbus_reg2data(data, sensor1); | 740 | v1 = pmbus_reg2data(data, sensor1); |
741 | v2 = pmbus_reg2data(data, sensor2); | 741 | v2 = pmbus_reg2data(data, sensor2); |
742 | *val = !!(regval && v1 >= v2); | 742 | ret = !!(regval && v1 >= v2); |
743 | } | 743 | } |
744 | return 0; | 744 | return ret; |
745 | } | 745 | } |
746 | 746 | ||
747 | static ssize_t pmbus_show_boolean(struct device *dev, | 747 | static ssize_t pmbus_show_boolean(struct device *dev, |
@@ -750,11 +750,10 @@ static ssize_t pmbus_show_boolean(struct device *dev, | |||
750 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 750 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
751 | struct pmbus_data *data = pmbus_update_device(dev); | 751 | struct pmbus_data *data = pmbus_update_device(dev); |
752 | int val; | 752 | int val; |
753 | int err; | ||
754 | 753 | ||
755 | err = pmbus_get_boolean(data, attr->index, &val); | 754 | val = pmbus_get_boolean(data, attr->index); |
756 | if (err) | 755 | if (val < 0) |
757 | return err; | 756 | return val; |
758 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 757 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
759 | } | 758 | } |
760 | 759 | ||
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index d3b778da3f86..c5f6be478bad 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
@@ -343,10 +343,11 @@ exit: | |||
343 | return err; | 343 | return err; |
344 | } | 344 | } |
345 | 345 | ||
346 | static int __init smsc47b397_find(unsigned short *addr) | 346 | static int __init smsc47b397_find(void) |
347 | { | 347 | { |
348 | u8 id, rev; | 348 | u8 id, rev; |
349 | char *name; | 349 | char *name; |
350 | unsigned short addr; | ||
350 | 351 | ||
351 | superio_enter(); | 352 | superio_enter(); |
352 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); | 353 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
@@ -370,14 +371,14 @@ static int __init smsc47b397_find(unsigned short *addr) | |||
370 | rev = superio_inb(SUPERIO_REG_DEVREV); | 371 | rev = superio_inb(SUPERIO_REG_DEVREV); |
371 | 372 | ||
372 | superio_select(SUPERIO_REG_LD8); | 373 | superio_select(SUPERIO_REG_LD8); |
373 | *addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) | 374 | addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) |
374 | | superio_inb(SUPERIO_REG_BASE_LSB); | 375 | | superio_inb(SUPERIO_REG_BASE_LSB); |
375 | 376 | ||
376 | pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", | 377 | pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", |
377 | name, *addr, rev); | 378 | name, addr, rev); |
378 | 379 | ||
379 | superio_exit(); | 380 | superio_exit(); |
380 | return 0; | 381 | return addr; |
381 | } | 382 | } |
382 | 383 | ||
383 | static int __init smsc47b397_init(void) | 384 | static int __init smsc47b397_init(void) |
@@ -385,9 +386,10 @@ static int __init smsc47b397_init(void) | |||
385 | unsigned short address; | 386 | unsigned short address; |
386 | int ret; | 387 | int ret; |
387 | 388 | ||
388 | ret = smsc47b397_find(&address); | 389 | ret = smsc47b397_find(); |
389 | if (ret) | 390 | if (ret < 0) |
390 | return ret; | 391 | return ret; |
392 | address = ret; | ||
391 | 393 | ||
392 | ret = platform_driver_register(&smsc47b397_driver); | 394 | ret = platform_driver_register(&smsc47b397_driver); |
393 | if (ret) | 395 | if (ret) |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index c590c1469793..b5aa38dd7ab9 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -491,10 +491,10 @@ static const struct attribute_group smsc47m1_group = { | |||
491 | .attrs = smsc47m1_attributes, | 491 | .attrs = smsc47m1_attributes, |
492 | }; | 492 | }; |
493 | 493 | ||
494 | static int __init smsc47m1_find(unsigned short *addr, | 494 | static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
495 | struct smsc47m1_sio_data *sio_data) | ||
496 | { | 495 | { |
497 | u8 val; | 496 | u8 val; |
497 | unsigned short addr; | ||
498 | 498 | ||
499 | superio_enter(); | 499 | superio_enter(); |
500 | val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); | 500 | val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
@@ -546,9 +546,9 @@ static int __init smsc47m1_find(unsigned short *addr, | |||
546 | } | 546 | } |
547 | 547 | ||
548 | superio_select(); | 548 | superio_select(); |
549 | *addr = (superio_inb(SUPERIO_REG_BASE) << 8) | 549 | addr = (superio_inb(SUPERIO_REG_BASE) << 8) |
550 | | superio_inb(SUPERIO_REG_BASE + 1); | 550 | | superio_inb(SUPERIO_REG_BASE + 1); |
551 | if (*addr == 0) { | 551 | if (addr == 0) { |
552 | pr_info("Device address not set, will not use\n"); | 552 | pr_info("Device address not set, will not use\n"); |
553 | superio_exit(); | 553 | superio_exit(); |
554 | return -ENODEV; | 554 | return -ENODEV; |
@@ -565,7 +565,7 @@ static int __init smsc47m1_find(unsigned short *addr, | |||
565 | } | 565 | } |
566 | 566 | ||
567 | superio_exit(); | 567 | superio_exit(); |
568 | return 0; | 568 | return addr; |
569 | } | 569 | } |
570 | 570 | ||
571 | /* Restore device to its initial state */ | 571 | /* Restore device to its initial state */ |
@@ -938,13 +938,15 @@ static int __init sm_smsc47m1_init(void) | |||
938 | unsigned short address; | 938 | unsigned short address; |
939 | struct smsc47m1_sio_data sio_data; | 939 | struct smsc47m1_sio_data sio_data; |
940 | 940 | ||
941 | if (smsc47m1_find(&address, &sio_data)) | 941 | err = smsc47m1_find(&sio_data); |
942 | return -ENODEV; | 942 | if (err < 0) |
943 | return err; | ||
944 | address = err; | ||
943 | 945 | ||
944 | /* Sets global pdev as a side effect */ | 946 | /* Sets global pdev as a side effect */ |
945 | err = smsc47m1_device_add(address, &sio_data); | 947 | err = smsc47m1_device_add(address, &sio_data); |
946 | if (err) | 948 | if (err) |
947 | goto exit; | 949 | return err; |
948 | 950 | ||
949 | err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); | 951 | err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); |
950 | if (err) | 952 | if (err) |
@@ -955,7 +957,6 @@ static int __init sm_smsc47m1_init(void) | |||
955 | exit_device: | 957 | exit_device: |
956 | platform_device_unregister(pdev); | 958 | platform_device_unregister(pdev); |
957 | smsc47m1_restore(&sio_data); | 959 | smsc47m1_restore(&sio_data); |
958 | exit: | ||
959 | return err; | 960 | return err; |
960 | } | 961 | } |
961 | 962 | ||
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 37f42113af31..00e8f213f56e 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c | |||
@@ -182,7 +182,6 @@ static int i2c_dw_pci_resume(struct device *dev) | |||
182 | pci_restore_state(pdev); | 182 | pci_restore_state(pdev); |
183 | 183 | ||
184 | i2c_dw_init(i2c); | 184 | i2c_dw_init(i2c); |
185 | i2c_dw_enable(i2c); | ||
186 | return 0; | 185 | return 0; |
187 | } | 186 | } |
188 | 187 | ||
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 83b720ef6c34..246fdc151652 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -179,7 +179,7 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, | |||
179 | { | 179 | { |
180 | struct ib_port_attr attr; | 180 | struct ib_port_attr attr; |
181 | char *speed = ""; | 181 | char *speed = ""; |
182 | int rate = -1; /* in deci-Gb/sec */ | 182 | int rate; /* in deci-Gb/sec */ |
183 | ssize_t ret; | 183 | ssize_t ret; |
184 | 184 | ||
185 | ret = ib_query_port(p->ibdev, p->port_num, &attr); | 185 | ret = ib_query_port(p->ibdev, p->port_num, &attr); |
@@ -187,9 +187,6 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, | |||
187 | return ret; | 187 | return ret; |
188 | 188 | ||
189 | switch (attr.active_speed) { | 189 | switch (attr.active_speed) { |
190 | case IB_SPEED_SDR: | ||
191 | rate = 25; | ||
192 | break; | ||
193 | case IB_SPEED_DDR: | 190 | case IB_SPEED_DDR: |
194 | speed = " DDR"; | 191 | speed = " DDR"; |
195 | rate = 50; | 192 | rate = 50; |
@@ -210,6 +207,10 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, | |||
210 | speed = " EDR"; | 207 | speed = " EDR"; |
211 | rate = 250; | 208 | rate = 250; |
212 | break; | 209 | break; |
210 | case IB_SPEED_SDR: | ||
211 | default: /* default to SDR for invalid rates */ | ||
212 | rate = 25; | ||
213 | break; | ||
213 | } | 214 | } |
214 | 215 | ||
215 | rate *= ib_width_enum_to_int(attr.active_width); | 216 | rate *= ib_width_enum_to_int(attr.active_width); |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 75d305629300..669673e81439 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -253,6 +253,11 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port, | |||
253 | if (out_mad->data[15] & 0x1) | 253 | if (out_mad->data[15] & 0x1) |
254 | props->active_speed = IB_SPEED_FDR10; | 254 | props->active_speed = IB_SPEED_FDR10; |
255 | } | 255 | } |
256 | |||
257 | /* Avoid wrong speed value returned by FW if the IB link is down. */ | ||
258 | if (props->state == IB_PORT_DOWN) | ||
259 | props->active_speed = IB_SPEED_SDR; | ||
260 | |||
256 | out: | 261 | out: |
257 | kfree(in_mad); | 262 | kfree(in_mad); |
258 | kfree(out_mad); | 263 | kfree(out_mad); |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 69e2ad06e515..daf21b899999 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -3232,6 +3232,7 @@ static void srpt_add_one(struct ib_device *device) | |||
3232 | srq_attr.attr.max_wr = sdev->srq_size; | 3232 | srq_attr.attr.max_wr = sdev->srq_size; |
3233 | srq_attr.attr.max_sge = 1; | 3233 | srq_attr.attr.max_sge = 1; |
3234 | srq_attr.attr.srq_limit = 0; | 3234 | srq_attr.attr.srq_limit = 0; |
3235 | srq_attr.srq_type = IB_SRQT_BASIC; | ||
3235 | 3236 | ||
3236 | sdev->srq = ib_create_srq(sdev->pd, &srq_attr); | 3237 | sdev->srq = ib_create_srq(sdev->pd, &srq_attr); |
3237 | if (IS_ERR(sdev->srq)) | 3238 | if (IS_ERR(sdev->srq)) |
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 2d787796bf50..7faf4a7fcaa9 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -380,8 +380,7 @@ config INPUT_TWL4030_VIBRA | |||
380 | 380 | ||
381 | config INPUT_TWL6040_VIBRA | 381 | config INPUT_TWL6040_VIBRA |
382 | tristate "Support for TWL6040 Vibrator" | 382 | tristate "Support for TWL6040 Vibrator" |
383 | depends on TWL4030_CORE | 383 | depends on TWL6040_CORE |
384 | select TWL6040_CORE | ||
385 | select INPUT_FF_MEMLESS | 384 | select INPUT_FF_MEMLESS |
386 | help | 385 | help |
387 | This option enables support for TWL6040 Vibrator Driver. | 386 | This option enables support for TWL6040 Vibrator Driver. |
diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c index 34aebb8cd080..3c843cd725fa 100644 --- a/drivers/input/misc/da9052_onkey.c +++ b/drivers/input/misc/da9052_onkey.c | |||
@@ -95,7 +95,8 @@ static int __devinit da9052_onkey_probe(struct platform_device *pdev) | |||
95 | input_dev = input_allocate_device(); | 95 | input_dev = input_allocate_device(); |
96 | if (!onkey || !input_dev) { | 96 | if (!onkey || !input_dev) { |
97 | dev_err(&pdev->dev, "Failed to allocate memory\n"); | 97 | dev_err(&pdev->dev, "Failed to allocate memory\n"); |
98 | return -ENOMEM; | 98 | error = -ENOMEM; |
99 | goto err_free_mem; | ||
99 | } | 100 | } |
100 | 101 | ||
101 | onkey->input = input_dev; | 102 | onkey->input = input_dev; |
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index 45874fed523a..14e94f56cb7d 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
31 | #include <linux/i2c/twl.h> | 31 | #include <linux/input.h> |
32 | #include <linux/mfd/twl6040.h> | 32 | #include <linux/mfd/twl6040.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
@@ -257,7 +257,7 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); | |||
257 | 257 | ||
258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) | 258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) |
259 | { | 259 | { |
260 | struct twl4030_vibra_data *pdata = pdev->dev.platform_data; | 260 | struct twl6040_vibra_data *pdata = pdev->dev.platform_data; |
261 | struct vibra_info *info; | 261 | struct vibra_info *info; |
262 | int ret; | 262 | int ret; |
263 | 263 | ||
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index d2c0db159b18..479011004a11 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -486,7 +486,6 @@ static void elantech_input_sync_v4(struct psmouse *psmouse) | |||
486 | unsigned char *packet = psmouse->packet; | 486 | unsigned char *packet = psmouse->packet; |
487 | 487 | ||
488 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); | 488 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); |
489 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); | ||
490 | input_mt_report_pointer_emulation(dev, true); | 489 | input_mt_report_pointer_emulation(dev, true); |
491 | input_sync(dev); | 490 | input_sync(dev); |
492 | } | 491 | } |
@@ -967,6 +966,7 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
967 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) | 966 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) |
968 | return -1; | 967 | return -1; |
969 | 968 | ||
969 | __set_bit(INPUT_PROP_POINTER, dev->propbit); | ||
970 | __set_bit(EV_KEY, dev->evbit); | 970 | __set_bit(EV_KEY, dev->evbit); |
971 | __set_bit(EV_ABS, dev->evbit); | 971 | __set_bit(EV_ABS, dev->evbit); |
972 | __clear_bit(EV_REL, dev->evbit); | 972 | __clear_bit(EV_REL, dev->evbit); |
@@ -1017,7 +1017,9 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
1017 | */ | 1017 | */ |
1018 | psmouse_warn(psmouse, "couldn't query resolution data.\n"); | 1018 | psmouse_warn(psmouse, "couldn't query resolution data.\n"); |
1019 | } | 1019 | } |
1020 | 1020 | /* v4 is clickpad, with only one button. */ | |
1021 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); | ||
1022 | __clear_bit(BTN_RIGHT, dev->keybit); | ||
1021 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); | 1023 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); |
1022 | /* For X to recognize me as touchpad. */ | 1024 | /* For X to recognize me as touchpad. */ |
1023 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); | 1025 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); |
@@ -1245,6 +1247,8 @@ static void elantech_disconnect(struct psmouse *psmouse) | |||
1245 | */ | 1247 | */ |
1246 | static int elantech_reconnect(struct psmouse *psmouse) | 1248 | static int elantech_reconnect(struct psmouse *psmouse) |
1247 | { | 1249 | { |
1250 | psmouse_reset(psmouse); | ||
1251 | |||
1248 | if (elantech_detect(psmouse, 0)) | 1252 | if (elantech_detect(psmouse, 0)) |
1249 | return -1; | 1253 | return -1; |
1250 | 1254 | ||
@@ -1324,6 +1328,8 @@ int elantech_init(struct psmouse *psmouse) | |||
1324 | if (!etd) | 1328 | if (!etd) |
1325 | return -ENOMEM; | 1329 | return -ENOMEM; |
1326 | 1330 | ||
1331 | psmouse_reset(psmouse); | ||
1332 | |||
1327 | etd->parity[0] = 1; | 1333 | etd->parity[0] = 1; |
1328 | for (i = 1; i < 256; i++) | 1334 | for (i = 1; i < 256; i++) |
1329 | etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; | 1335 | etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; |
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index a9ad8e1402be..39fe9b737cae 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c | |||
@@ -12,9 +12,9 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/input-polldev.h> | 14 | #include <linux/input-polldev.h> |
15 | #include <linux/gpio.h> | ||
15 | #include <linux/gpio_mouse.h> | 16 | #include <linux/gpio_mouse.h> |
16 | 17 | ||
17 | #include <asm/gpio.h> | ||
18 | 18 | ||
19 | /* | 19 | /* |
20 | * Timer function which is run every scan_ms ms when the device is opened. | 20 | * Timer function which is run every scan_ms ms when the device is opened. |
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index a977bfaa6821..661a0ca3b3d6 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
@@ -741,6 +741,14 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) | |||
741 | } | 741 | } |
742 | } else { | 742 | } else { |
743 | /* SFAC packet */ | 743 | /* SFAC packet */ |
744 | if ((packet[0] & (FSP_PB0_LBTN|FSP_PB0_PHY_BTN)) == | ||
745 | FSP_PB0_LBTN) { | ||
746 | /* On-pad click in SFAC mode should be handled | ||
747 | * by userspace. On-pad clicks in MFMC mode | ||
748 | * are real clickpad clicks, and not ignored. | ||
749 | */ | ||
750 | packet[0] &= ~FSP_PB0_LBTN; | ||
751 | } | ||
744 | 752 | ||
745 | /* no multi-finger information */ | 753 | /* no multi-finger information */ |
746 | ad->last_mt_fgr = 0; | 754 | ad->last_mt_fgr = 0; |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 22b218018137..f3102494237d 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -304,7 +304,7 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
304 | return 0; | 304 | return 0; |
305 | 305 | ||
306 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { | 306 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { |
307 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); | 307 | psmouse_warn(psmouse, "failed to get extended button data\n"); |
308 | button_info = 0; | 308 | button_info = 0; |
309 | } | 309 | } |
310 | 310 | ||
@@ -326,16 +326,18 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
326 | 326 | ||
327 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); | 327 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); |
328 | if (error) { | 328 | if (error) { |
329 | printk(KERN_ERR | 329 | psmouse_err(psmouse, |
330 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", | 330 | "failed to create sysfs attributes, error: %d\n", |
331 | error); | 331 | error); |
332 | kfree(psmouse->private); | 332 | kfree(psmouse->private); |
333 | psmouse->private = NULL; | 333 | psmouse->private = NULL; |
334 | return -1; | 334 | return -1; |
335 | } | 335 | } |
336 | 336 | ||
337 | printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", | 337 | psmouse_info(psmouse, |
338 | firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f); | 338 | "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", |
339 | firmware_id, | ||
340 | (button_info & 0xf0) >> 4, button_info & 0x0f); | ||
339 | 341 | ||
340 | return 0; | 342 | return 0; |
341 | } | 343 | } |
diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index 6c6f6d8ea9b4..f7eda3d00fad 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/input/touchscreen/tps6507x_ts.c | ||
3 | * | ||
4 | * Touchscreen driver for the tps6507x chip. | 2 | * Touchscreen driver for the tps6507x chip. |
5 | * | 3 | * |
6 | * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com) | 4 | * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com) |
@@ -376,4 +374,4 @@ module_platform_driver(tps6507x_ts_driver); | |||
376 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); | 374 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); |
377 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); | 375 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); |
378 | MODULE_LICENSE("GPL v2"); | 376 | MODULE_LICENSE("GPL v2"); |
379 | MODULE_ALIAS("platform:tps6507x-tsc"); | 377 | MODULE_ALIAS("platform:tps6507x-ts"); |
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index b3d6ac17272d..a6d9fd2858f7 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -176,7 +176,7 @@ static void if_close(struct tty_struct *tty, struct file *filp) | |||
176 | struct cardstate *cs = tty->driver_data; | 176 | struct cardstate *cs = tty->driver_data; |
177 | 177 | ||
178 | if (!cs) { /* happens if we didn't find cs in open */ | 178 | if (!cs) { /* happens if we didn't find cs in open */ |
179 | printk(KERN_DEBUG "%s: no cardstate\n", __func__); | 179 | gig_dbg(DEBUG_IF, "%s: no cardstate", __func__); |
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | 182 | ||
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c index 800243b6037e..64ad702a2ecc 100644 --- a/drivers/leds/leds-atmel-pwm.c +++ b/drivers/leds/leds-atmel-pwm.c | |||
@@ -35,7 +35,7 @@ static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b) | |||
35 | * NOTE: we reuse the platform_data structure of GPIO leds, | 35 | * NOTE: we reuse the platform_data structure of GPIO leds, |
36 | * but repurpose its "gpio" number as a PWM channel number. | 36 | * but repurpose its "gpio" number as a PWM channel number. |
37 | */ | 37 | */ |
38 | static int __init pwmled_probe(struct platform_device *pdev) | 38 | static int __devinit pwmled_probe(struct platform_device *pdev) |
39 | { | 39 | { |
40 | const struct gpio_led_platform_data *pdata; | 40 | const struct gpio_led_platform_data *pdata; |
41 | struct pwmled *leds; | 41 | struct pwmled *leds; |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 3d0dfa7a89a2..97e73e555d11 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -539,9 +539,6 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) | |||
539 | bitmap->events_cleared = bitmap->mddev->events; | 539 | bitmap->events_cleared = bitmap->mddev->events; |
540 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); | 540 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); |
541 | 541 | ||
542 | bitmap->flags |= BITMAP_HOSTENDIAN; | ||
543 | sb->version = cpu_to_le32(BITMAP_MAJOR_HOSTENDIAN); | ||
544 | |||
545 | kunmap_atomic(sb); | 542 | kunmap_atomic(sb); |
546 | 543 | ||
547 | return 0; | 544 | return 0; |
@@ -1788,7 +1785,9 @@ int bitmap_load(struct mddev *mddev) | |||
1788 | * re-add of a missing device */ | 1785 | * re-add of a missing device */ |
1789 | start = mddev->recovery_cp; | 1786 | start = mddev->recovery_cp; |
1790 | 1787 | ||
1788 | mutex_lock(&mddev->bitmap_info.mutex); | ||
1791 | err = bitmap_init_from_disk(bitmap, start); | 1789 | err = bitmap_init_from_disk(bitmap, start); |
1790 | mutex_unlock(&mddev->bitmap_info.mutex); | ||
1792 | 1791 | ||
1793 | if (err) | 1792 | if (err) |
1794 | goto out; | 1793 | goto out; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d35e4c991e38..15dd59b84e94 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1712,6 +1712,7 @@ static int process_checks(struct r1bio *r1_bio) | |||
1712 | struct r1conf *conf = mddev->private; | 1712 | struct r1conf *conf = mddev->private; |
1713 | int primary; | 1713 | int primary; |
1714 | int i; | 1714 | int i; |
1715 | int vcnt; | ||
1715 | 1716 | ||
1716 | for (primary = 0; primary < conf->raid_disks * 2; primary++) | 1717 | for (primary = 0; primary < conf->raid_disks * 2; primary++) |
1717 | if (r1_bio->bios[primary]->bi_end_io == end_sync_read && | 1718 | if (r1_bio->bios[primary]->bi_end_io == end_sync_read && |
@@ -1721,9 +1722,9 @@ static int process_checks(struct r1bio *r1_bio) | |||
1721 | break; | 1722 | break; |
1722 | } | 1723 | } |
1723 | r1_bio->read_disk = primary; | 1724 | r1_bio->read_disk = primary; |
1725 | vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9); | ||
1724 | for (i = 0; i < conf->raid_disks * 2; i++) { | 1726 | for (i = 0; i < conf->raid_disks * 2; i++) { |
1725 | int j; | 1727 | int j; |
1726 | int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9); | ||
1727 | struct bio *pbio = r1_bio->bios[primary]; | 1728 | struct bio *pbio = r1_bio->bios[primary]; |
1728 | struct bio *sbio = r1_bio->bios[i]; | 1729 | struct bio *sbio = r1_bio->bios[i]; |
1729 | int size; | 1730 | int size; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index fff782189e48..c8dbb84d5357 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1788,6 +1788,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1788 | struct r10conf *conf = mddev->private; | 1788 | struct r10conf *conf = mddev->private; |
1789 | int i, first; | 1789 | int i, first; |
1790 | struct bio *tbio, *fbio; | 1790 | struct bio *tbio, *fbio; |
1791 | int vcnt; | ||
1791 | 1792 | ||
1792 | atomic_set(&r10_bio->remaining, 1); | 1793 | atomic_set(&r10_bio->remaining, 1); |
1793 | 1794 | ||
@@ -1802,10 +1803,10 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1802 | first = i; | 1803 | first = i; |
1803 | fbio = r10_bio->devs[i].bio; | 1804 | fbio = r10_bio->devs[i].bio; |
1804 | 1805 | ||
1806 | vcnt = (r10_bio->sectors + (PAGE_SIZE >> 9) - 1) >> (PAGE_SHIFT - 9); | ||
1805 | /* now find blocks with errors */ | 1807 | /* now find blocks with errors */ |
1806 | for (i=0 ; i < conf->copies ; i++) { | 1808 | for (i=0 ; i < conf->copies ; i++) { |
1807 | int j, d; | 1809 | int j, d; |
1808 | int vcnt = r10_bio->sectors >> (PAGE_SHIFT-9); | ||
1809 | 1810 | ||
1810 | tbio = r10_bio->devs[i].bio; | 1811 | tbio = r10_bio->devs[i].bio; |
1811 | 1812 | ||
@@ -1871,7 +1872,6 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1871 | */ | 1872 | */ |
1872 | for (i = 0; i < conf->copies; i++) { | 1873 | for (i = 0; i < conf->copies; i++) { |
1873 | int j, d; | 1874 | int j, d; |
1874 | int vcnt = r10_bio->sectors >> (PAGE_SHIFT-9); | ||
1875 | 1875 | ||
1876 | tbio = r10_bio->devs[i].repl_bio; | 1876 | tbio = r10_bio->devs[i].repl_bio; |
1877 | if (!tbio || !tbio->bi_end_io) | 1877 | if (!tbio || !tbio->bi_end_io) |
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index 7f98984e4fad..eab2ea424200 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c | |||
@@ -54,6 +54,7 @@ struct xc5000_priv { | |||
54 | struct list_head hybrid_tuner_instance_list; | 54 | struct list_head hybrid_tuner_instance_list; |
55 | 55 | ||
56 | u32 if_khz; | 56 | u32 if_khz; |
57 | u32 xtal_khz; | ||
57 | u32 freq_hz; | 58 | u32 freq_hz; |
58 | u32 bandwidth; | 59 | u32 bandwidth; |
59 | u8 video_standard; | 60 | u8 video_standard; |
@@ -214,9 +215,9 @@ static const struct xc5000_fw_cfg xc5000a_1_6_114 = { | |||
214 | .size = 12401, | 215 | .size = 12401, |
215 | }; | 216 | }; |
216 | 217 | ||
217 | static const struct xc5000_fw_cfg xc5000c_41_024_5_31875 = { | 218 | static const struct xc5000_fw_cfg xc5000c_41_024_5 = { |
218 | .name = "dvb-fe-xc5000c-41.024.5-31875.fw", | 219 | .name = "dvb-fe-xc5000c-41.024.5.fw", |
219 | .size = 16503, | 220 | .size = 16497, |
220 | }; | 221 | }; |
221 | 222 | ||
222 | static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) | 223 | static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) |
@@ -226,7 +227,7 @@ static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) | |||
226 | case XC5000A: | 227 | case XC5000A: |
227 | return &xc5000a_1_6_114; | 228 | return &xc5000a_1_6_114; |
228 | case XC5000C: | 229 | case XC5000C: |
229 | return &xc5000c_41_024_5_31875; | 230 | return &xc5000c_41_024_5; |
230 | } | 231 | } |
231 | } | 232 | } |
232 | 233 | ||
@@ -572,6 +573,31 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode) | |||
572 | return found; | 573 | return found; |
573 | } | 574 | } |
574 | 575 | ||
576 | static int xc_set_xtal(struct dvb_frontend *fe) | ||
577 | { | ||
578 | struct xc5000_priv *priv = fe->tuner_priv; | ||
579 | int ret = XC_RESULT_SUCCESS; | ||
580 | |||
581 | switch (priv->chip_id) { | ||
582 | default: | ||
583 | case XC5000A: | ||
584 | /* 32.000 MHz xtal is default */ | ||
585 | break; | ||
586 | case XC5000C: | ||
587 | switch (priv->xtal_khz) { | ||
588 | default: | ||
589 | case 32000: | ||
590 | /* 32.000 MHz xtal is default */ | ||
591 | break; | ||
592 | case 31875: | ||
593 | /* 31.875 MHz xtal configuration */ | ||
594 | ret = xc_write_reg(priv, 0x000f, 0x8081); | ||
595 | break; | ||
596 | } | ||
597 | break; | ||
598 | } | ||
599 | return ret; | ||
600 | } | ||
575 | 601 | ||
576 | static int xc5000_fwupload(struct dvb_frontend *fe) | 602 | static int xc5000_fwupload(struct dvb_frontend *fe) |
577 | { | 603 | { |
@@ -603,6 +629,8 @@ static int xc5000_fwupload(struct dvb_frontend *fe) | |||
603 | } else { | 629 | } else { |
604 | printk(KERN_INFO "xc5000: firmware uploading...\n"); | 630 | printk(KERN_INFO "xc5000: firmware uploading...\n"); |
605 | ret = xc_load_i2c_sequence(fe, fw->data); | 631 | ret = xc_load_i2c_sequence(fe, fw->data); |
632 | if (XC_RESULT_SUCCESS == ret) | ||
633 | ret = xc_set_xtal(fe); | ||
606 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); | 634 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); |
607 | } | 635 | } |
608 | 636 | ||
@@ -1164,6 +1192,9 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | |||
1164 | priv->if_khz = cfg->if_khz; | 1192 | priv->if_khz = cfg->if_khz; |
1165 | } | 1193 | } |
1166 | 1194 | ||
1195 | if (priv->xtal_khz == 0) | ||
1196 | priv->xtal_khz = cfg->xtal_khz; | ||
1197 | |||
1167 | if (priv->radio_input == 0) | 1198 | if (priv->radio_input == 0) |
1168 | priv->radio_input = cfg->radio_input; | 1199 | priv->radio_input = cfg->radio_input; |
1169 | 1200 | ||
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h index 3396f8e02b40..39a73bf01406 100644 --- a/drivers/media/common/tuners/xc5000.h +++ b/drivers/media/common/tuners/xc5000.h | |||
@@ -34,6 +34,7 @@ struct xc5000_config { | |||
34 | u8 i2c_address; | 34 | u8 i2c_address; |
35 | u32 if_khz; | 35 | u32 if_khz; |
36 | u8 radio_input; | 36 | u8 radio_input; |
37 | u32 xtal_khz; | ||
37 | 38 | ||
38 | int chip_id; | 39 | int chip_id; |
39 | }; | 40 | }; |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 4555baa383b2..0f64d7182657 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -143,10 +143,12 @@ struct dvb_frontend_private { | |||
143 | static void dvb_frontend_wakeup(struct dvb_frontend *fe); | 143 | static void dvb_frontend_wakeup(struct dvb_frontend *fe); |
144 | static int dtv_get_frontend(struct dvb_frontend *fe, | 144 | static int dtv_get_frontend(struct dvb_frontend *fe, |
145 | struct dvb_frontend_parameters *p_out); | 145 | struct dvb_frontend_parameters *p_out); |
146 | static int dtv_property_legacy_params_sync(struct dvb_frontend *fe, | ||
147 | struct dvb_frontend_parameters *p); | ||
146 | 148 | ||
147 | static bool has_get_frontend(struct dvb_frontend *fe) | 149 | static bool has_get_frontend(struct dvb_frontend *fe) |
148 | { | 150 | { |
149 | return fe->ops.get_frontend; | 151 | return fe->ops.get_frontend != NULL; |
150 | } | 152 | } |
151 | 153 | ||
152 | /* | 154 | /* |
@@ -697,6 +699,7 @@ restart: | |||
697 | fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; | 699 | fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; |
698 | fepriv->delay = HZ / 2; | 700 | fepriv->delay = HZ / 2; |
699 | } | 701 | } |
702 | dtv_property_legacy_params_sync(fe, &fepriv->parameters_out); | ||
700 | fe->ops.read_status(fe, &s); | 703 | fe->ops.read_status(fe, &s); |
701 | if (s != fepriv->status) { | 704 | if (s != fepriv->status) { |
702 | dvb_frontend_add_event(fe, s); /* update event list */ | 705 | dvb_frontend_add_event(fe, s); /* update event list */ |
@@ -1443,6 +1446,28 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) | |||
1443 | __func__); | 1446 | __func__); |
1444 | return -EINVAL; | 1447 | return -EINVAL; |
1445 | } | 1448 | } |
1449 | /* | ||
1450 | * Get a delivery system that is compatible with DVBv3 | ||
1451 | * NOTE: in order for this to work with softwares like Kaffeine that | ||
1452 | * uses a DVBv5 call for DVB-S2 and a DVBv3 call to go back to | ||
1453 | * DVB-S, drivers that support both should put the SYS_DVBS entry | ||
1454 | * before the SYS_DVBS2, otherwise it won't switch back to DVB-S. | ||
1455 | * The real fix is that userspace applications should not use DVBv3 | ||
1456 | * and not trust on calling FE_SET_FRONTEND to switch the delivery | ||
1457 | * system. | ||
1458 | */ | ||
1459 | ncaps = 0; | ||
1460 | while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) { | ||
1461 | if (fe->ops.delsys[ncaps] == desired_system) { | ||
1462 | delsys = desired_system; | ||
1463 | break; | ||
1464 | } | ||
1465 | ncaps++; | ||
1466 | } | ||
1467 | if (delsys == SYS_UNDEFINED) { | ||
1468 | dprintk("%s() Couldn't find a delivery system that matches %d\n", | ||
1469 | __func__, desired_system); | ||
1470 | } | ||
1446 | } else { | 1471 | } else { |
1447 | /* | 1472 | /* |
1448 | * This is a DVBv5 call. So, it likely knows the supported | 1473 | * This is a DVBv5 call. So, it likely knows the supported |
@@ -1491,9 +1516,10 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) | |||
1491 | __func__); | 1516 | __func__); |
1492 | return -EINVAL; | 1517 | return -EINVAL; |
1493 | } | 1518 | } |
1494 | c->delivery_system = delsys; | ||
1495 | } | 1519 | } |
1496 | 1520 | ||
1521 | c->delivery_system = delsys; | ||
1522 | |||
1497 | /* | 1523 | /* |
1498 | * The DVBv3 or DVBv5 call is requesting a different system. So, | 1524 | * The DVBv3 or DVBv5 call is requesting a different system. So, |
1499 | * emulation is needed. | 1525 | * emulation is needed. |
@@ -1833,6 +1859,13 @@ static int dtv_set_frontend(struct dvb_frontend *fe) | |||
1833 | return -EINVAL; | 1859 | return -EINVAL; |
1834 | 1860 | ||
1835 | /* | 1861 | /* |
1862 | * Initialize output parameters to match the values given by | ||
1863 | * the user. FE_SET_FRONTEND triggers an initial frontend event | ||
1864 | * with status = 0, which copies output parameters to userspace. | ||
1865 | */ | ||
1866 | dtv_property_legacy_params_sync(fe, &fepriv->parameters_out); | ||
1867 | |||
1868 | /* | ||
1836 | * Be sure that the bandwidth will be filled for all | 1869 | * Be sure that the bandwidth will be filled for all |
1837 | * non-satellite systems, as tuners need to know what | 1870 | * non-satellite systems, as tuners need to know what |
1838 | * low pass/Nyquist half filter should be applied, in | 1871 | * low pass/Nyquist half filter should be applied, in |
diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c index 3b7b102f20ae..482d249ca7f3 100644 --- a/drivers/media/dvb/dvb-usb/it913x.c +++ b/drivers/media/dvb/dvb-usb/it913x.c | |||
@@ -238,12 +238,27 @@ static int it913x_read_reg(struct usb_device *udev, u32 reg) | |||
238 | 238 | ||
239 | static u32 it913x_query(struct usb_device *udev, u8 pro) | 239 | static u32 it913x_query(struct usb_device *udev, u8 pro) |
240 | { | 240 | { |
241 | int ret; | 241 | int ret, i; |
242 | u8 data[4]; | 242 | u8 data[4]; |
243 | ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, | 243 | u8 ver; |
244 | 0x1222, 0, &data[0], 3); | 244 | |
245 | for (i = 0; i < 5; i++) { | ||
246 | ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, | ||
247 | 0x1222, 0, &data[0], 3); | ||
248 | ver = data[0]; | ||
249 | if (ver > 0 && ver < 3) | ||
250 | break; | ||
251 | msleep(100); | ||
252 | } | ||
245 | 253 | ||
246 | it913x_config.chip_ver = data[0]; | 254 | if (ver < 1 || ver > 2) { |
255 | info("Failed to identify chip version applying 1"); | ||
256 | it913x_config.chip_ver = 0x1; | ||
257 | it913x_config.chip_type = 0x9135; | ||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | it913x_config.chip_ver = ver; | ||
247 | it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; | 262 | it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; |
248 | 263 | ||
249 | info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, | 264 | info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, |
@@ -660,30 +675,41 @@ static int it913x_download_firmware(struct usb_device *udev, | |||
660 | if ((packet_size > min_pkt) || (i == fw->size)) { | 675 | if ((packet_size > min_pkt) || (i == fw->size)) { |
661 | fw_data = (u8 *)(fw->data + pos); | 676 | fw_data = (u8 *)(fw->data + pos); |
662 | pos += packet_size; | 677 | pos += packet_size; |
663 | if (packet_size > 0) | 678 | if (packet_size > 0) { |
664 | ret |= it913x_io(udev, WRITE_DATA, | 679 | ret = it913x_io(udev, WRITE_DATA, |
665 | DEV_0, CMD_SCATTER_WRITE, 0, | 680 | DEV_0, CMD_SCATTER_WRITE, 0, |
666 | 0, fw_data, packet_size); | 681 | 0, fw_data, packet_size); |
682 | if (ret < 0) | ||
683 | break; | ||
684 | } | ||
667 | udelay(1000); | 685 | udelay(1000); |
668 | } | 686 | } |
669 | } | 687 | } |
670 | i++; | 688 | i++; |
671 | } | 689 | } |
672 | 690 | ||
673 | ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0); | ||
674 | |||
675 | msleep(100); | ||
676 | |||
677 | if (ret < 0) | 691 | if (ret < 0) |
678 | info("FRM Firmware Download Failed (%04x)" , ret); | 692 | info("FRM Firmware Download Failed (%d)" , ret); |
679 | else | 693 | else |
680 | info("FRM Firmware Download Completed - Resetting Device"); | 694 | info("FRM Firmware Download Completed - Resetting Device"); |
681 | 695 | ||
682 | ret |= it913x_return_status(udev); | 696 | msleep(30); |
697 | |||
698 | ret = it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0); | ||
699 | if (ret < 0) | ||
700 | info("FRM Device not responding to reboot"); | ||
701 | |||
702 | ret = it913x_return_status(udev); | ||
703 | if (ret == 0) { | ||
704 | info("FRM Failed to reboot device"); | ||
705 | return -ENODEV; | ||
706 | } | ||
683 | 707 | ||
684 | msleep(30); | 708 | msleep(30); |
685 | 709 | ||
686 | ret |= it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); | 710 | ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); |
711 | |||
712 | msleep(30); | ||
687 | 713 | ||
688 | /* Tuner function */ | 714 | /* Tuner function */ |
689 | if (it913x_config.dual_mode) | 715 | if (it913x_config.dual_mode) |
@@ -901,5 +927,5 @@ module_usb_driver(it913x_driver); | |||
901 | 927 | ||
902 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); | 928 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); |
903 | MODULE_DESCRIPTION("it913x USB 2 Driver"); | 929 | MODULE_DESCRIPTION("it913x USB 2 Driver"); |
904 | MODULE_VERSION("1.27"); | 930 | MODULE_VERSION("1.28"); |
905 | MODULE_LICENSE("GPL"); | 931 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index 36d11756492f..a414b1f2b6a5 100644 --- a/drivers/media/dvb/frontends/drxk_hard.c +++ b/drivers/media/dvb/frontends/drxk_hard.c | |||
@@ -1520,8 +1520,10 @@ static int scu_command(struct drxk_state *state, | |||
1520 | dprintk(1, "\n"); | 1520 | dprintk(1, "\n"); |
1521 | 1521 | ||
1522 | if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || | 1522 | if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || |
1523 | ((resultLen > 0) && (result == NULL))) | 1523 | ((resultLen > 0) && (result == NULL))) { |
1524 | goto error; | 1524 | printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__); |
1525 | return status; | ||
1526 | } | ||
1525 | 1527 | ||
1526 | mutex_lock(&state->mutex); | 1528 | mutex_lock(&state->mutex); |
1527 | 1529 | ||
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index b09c5fae489b..af526586fa26 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c | |||
@@ -1046,6 +1046,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
1046 | goto exit_unregister_led; | 1046 | goto exit_unregister_led; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | data->dev->driver_type = RC_DRIVER_IR_RAW; | ||
1049 | data->dev->driver_name = WBCIR_NAME; | 1050 | data->dev->driver_name = WBCIR_NAME; |
1050 | data->dev->input_name = WBCIR_NAME; | 1051 | data->dev->input_name = WBCIR_NAME; |
1051 | data->dev->input_phys = "wbcir/cir0"; | 1052 | data->dev->input_phys = "wbcir/cir0"; |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index f2479c5c0eb2..ce1e7ba940f6 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -492,7 +492,7 @@ config VIDEO_VS6624 | |||
492 | 492 | ||
493 | config VIDEO_MT9M032 | 493 | config VIDEO_MT9M032 |
494 | tristate "MT9M032 camera sensor support" | 494 | tristate "MT9M032 camera sensor support" |
495 | depends on I2C && VIDEO_V4L2 | 495 | depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API |
496 | select VIDEO_APTINA_PLL | 496 | select VIDEO_APTINA_PLL |
497 | ---help--- | 497 | ---help--- |
498 | This driver supports MT9M032 camera sensors from Aptina, monochrome | 498 | This driver supports MT9M032 camera sensors from Aptina, monochrome |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 5452beef8e11..989e556913ed 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1763,13 +1763,13 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1763 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); | 1763 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); |
1764 | if (iarg > AUDIO_STEREO_SWAPPED) | 1764 | if (iarg > AUDIO_STEREO_SWAPPED) |
1765 | return -EINVAL; | 1765 | return -EINVAL; |
1766 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg); | 1766 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg + 1); |
1767 | 1767 | ||
1768 | case AUDIO_BILINGUAL_CHANNEL_SELECT: | 1768 | case AUDIO_BILINGUAL_CHANNEL_SELECT: |
1769 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); | 1769 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); |
1770 | if (iarg > AUDIO_STEREO_SWAPPED) | 1770 | if (iarg > AUDIO_STEREO_SWAPPED) |
1771 | return -EINVAL; | 1771 | return -EINVAL; |
1772 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg); | 1772 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg + 1); |
1773 | 1773 | ||
1774 | default: | 1774 | default: |
1775 | return -EINVAL; | 1775 | return -EINVAL; |
diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c index 7636672c3548..645973c5feb0 100644 --- a/drivers/media/video/mt9m032.c +++ b/drivers/media/video/mt9m032.c | |||
@@ -392,10 +392,11 @@ static int mt9m032_set_pad_format(struct v4l2_subdev *subdev, | |||
392 | } | 392 | } |
393 | 393 | ||
394 | /* Scaling is not supported, the format is thus fixed. */ | 394 | /* Scaling is not supported, the format is thus fixed. */ |
395 | ret = mt9m032_get_pad_format(subdev, fh, fmt); | 395 | fmt->format = *__mt9m032_get_pad_format(sensor, fh, fmt->which); |
396 | ret = 0; | ||
396 | 397 | ||
397 | done: | 398 | done: |
398 | mutex_lock(&sensor->lock); | 399 | mutex_unlock(&sensor->lock); |
399 | return ret; | 400 | return ret; |
400 | } | 401 | } |
401 | 402 | ||
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 4a44f9a1bae0..b76b0ac0958f 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
@@ -468,22 +468,30 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, | |||
468 | spin_unlock_irqrestore(&stream->clock.lock, flags); | 468 | spin_unlock_irqrestore(&stream->clock.lock, flags); |
469 | } | 469 | } |
470 | 470 | ||
471 | static int uvc_video_clock_init(struct uvc_streaming *stream) | 471 | static void uvc_video_clock_reset(struct uvc_streaming *stream) |
472 | { | 472 | { |
473 | struct uvc_clock *clock = &stream->clock; | 473 | struct uvc_clock *clock = &stream->clock; |
474 | 474 | ||
475 | spin_lock_init(&clock->lock); | ||
476 | clock->head = 0; | 475 | clock->head = 0; |
477 | clock->count = 0; | 476 | clock->count = 0; |
478 | clock->size = 32; | ||
479 | clock->last_sof = -1; | 477 | clock->last_sof = -1; |
480 | clock->sof_offset = -1; | 478 | clock->sof_offset = -1; |
479 | } | ||
480 | |||
481 | static int uvc_video_clock_init(struct uvc_streaming *stream) | ||
482 | { | ||
483 | struct uvc_clock *clock = &stream->clock; | ||
484 | |||
485 | spin_lock_init(&clock->lock); | ||
486 | clock->size = 32; | ||
481 | 487 | ||
482 | clock->samples = kmalloc(clock->size * sizeof(*clock->samples), | 488 | clock->samples = kmalloc(clock->size * sizeof(*clock->samples), |
483 | GFP_KERNEL); | 489 | GFP_KERNEL); |
484 | if (clock->samples == NULL) | 490 | if (clock->samples == NULL) |
485 | return -ENOMEM; | 491 | return -ENOMEM; |
486 | 492 | ||
493 | uvc_video_clock_reset(stream); | ||
494 | |||
487 | return 0; | 495 | return 0; |
488 | } | 496 | } |
489 | 497 | ||
@@ -1424,8 +1432,6 @@ static void uvc_uninit_video(struct uvc_streaming *stream, int free_buffers) | |||
1424 | 1432 | ||
1425 | if (free_buffers) | 1433 | if (free_buffers) |
1426 | uvc_free_urb_buffers(stream); | 1434 | uvc_free_urb_buffers(stream); |
1427 | |||
1428 | uvc_video_clock_cleanup(stream); | ||
1429 | } | 1435 | } |
1430 | 1436 | ||
1431 | /* | 1437 | /* |
@@ -1555,10 +1561,6 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags) | |||
1555 | 1561 | ||
1556 | uvc_video_stats_start(stream); | 1562 | uvc_video_stats_start(stream); |
1557 | 1563 | ||
1558 | ret = uvc_video_clock_init(stream); | ||
1559 | if (ret < 0) | ||
1560 | return ret; | ||
1561 | |||
1562 | if (intf->num_altsetting > 1) { | 1564 | if (intf->num_altsetting > 1) { |
1563 | struct usb_host_endpoint *best_ep = NULL; | 1565 | struct usb_host_endpoint *best_ep = NULL; |
1564 | unsigned int best_psize = 3 * 1024; | 1566 | unsigned int best_psize = 3 * 1024; |
@@ -1683,6 +1685,8 @@ int uvc_video_resume(struct uvc_streaming *stream, int reset) | |||
1683 | 1685 | ||
1684 | stream->frozen = 0; | 1686 | stream->frozen = 0; |
1685 | 1687 | ||
1688 | uvc_video_clock_reset(stream); | ||
1689 | |||
1686 | ret = uvc_commit_video(stream, &stream->ctrl); | 1690 | ret = uvc_commit_video(stream, &stream->ctrl); |
1687 | if (ret < 0) { | 1691 | if (ret < 0) { |
1688 | uvc_queue_enable(&stream->queue, 0); | 1692 | uvc_queue_enable(&stream->queue, 0); |
@@ -1819,25 +1823,35 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable) | |||
1819 | uvc_uninit_video(stream, 1); | 1823 | uvc_uninit_video(stream, 1); |
1820 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | 1824 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); |
1821 | uvc_queue_enable(&stream->queue, 0); | 1825 | uvc_queue_enable(&stream->queue, 0); |
1826 | uvc_video_clock_cleanup(stream); | ||
1822 | return 0; | 1827 | return 0; |
1823 | } | 1828 | } |
1824 | 1829 | ||
1825 | ret = uvc_queue_enable(&stream->queue, 1); | 1830 | ret = uvc_video_clock_init(stream); |
1826 | if (ret < 0) | 1831 | if (ret < 0) |
1827 | return ret; | 1832 | return ret; |
1828 | 1833 | ||
1834 | ret = uvc_queue_enable(&stream->queue, 1); | ||
1835 | if (ret < 0) | ||
1836 | goto error_queue; | ||
1837 | |||
1829 | /* Commit the streaming parameters. */ | 1838 | /* Commit the streaming parameters. */ |
1830 | ret = uvc_commit_video(stream, &stream->ctrl); | 1839 | ret = uvc_commit_video(stream, &stream->ctrl); |
1831 | if (ret < 0) { | 1840 | if (ret < 0) |
1832 | uvc_queue_enable(&stream->queue, 0); | 1841 | goto error_commit; |
1833 | return ret; | ||
1834 | } | ||
1835 | 1842 | ||
1836 | ret = uvc_init_video(stream, GFP_KERNEL); | 1843 | ret = uvc_init_video(stream, GFP_KERNEL); |
1837 | if (ret < 0) { | 1844 | if (ret < 0) |
1838 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | 1845 | goto error_video; |
1839 | uvc_queue_enable(&stream->queue, 0); | 1846 | |
1840 | } | 1847 | return 0; |
1848 | |||
1849 | error_video: | ||
1850 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | ||
1851 | error_commit: | ||
1852 | uvc_queue_enable(&stream->queue, 0); | ||
1853 | error_queue: | ||
1854 | uvc_video_clock_cleanup(stream); | ||
1841 | 1855 | ||
1842 | return ret; | 1856 | return ret; |
1843 | } | 1857 | } |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 29f463cc09cb..11e44386fa9b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -268,10 +268,17 @@ config TWL6030_PWM | |||
268 | This is used to control charging LED brightness. | 268 | This is used to control charging LED brightness. |
269 | 269 | ||
270 | config TWL6040_CORE | 270 | config TWL6040_CORE |
271 | bool | 271 | bool "Support for TWL6040 audio codec" |
272 | depends on TWL4030_CORE && GENERIC_HARDIRQS | 272 | depends on I2C=y && GENERIC_HARDIRQS |
273 | select MFD_CORE | 273 | select MFD_CORE |
274 | select REGMAP_I2C | ||
274 | default n | 275 | default n |
276 | help | ||
277 | Say yes here if you want support for Texas Instruments TWL6040 audio | ||
278 | codec. | ||
279 | This driver provides common support for accessing the device, | ||
280 | additional drivers must be enabled in order to use the | ||
281 | functionality of the device (audio, vibra). | ||
275 | 282 | ||
276 | config MFD_STMPE | 283 | config MFD_STMPE |
277 | bool "Support STMicroelectronics STMPE" | 284 | bool "Support STMicroelectronics STMPE" |
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 1895cf9fab8c..1582c3d95257 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -527,7 +527,9 @@ static void asic3_gpio_set(struct gpio_chip *chip, | |||
527 | 527 | ||
528 | static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 528 | static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
529 | { | 529 | { |
530 | return (offset < ASIC3_NUM_GPIOS) ? IRQ_BOARD_START + offset : -ENXIO; | 530 | struct asic3 *asic = container_of(chip, struct asic3, gpio); |
531 | |||
532 | return (offset < ASIC3_NUM_GPIOS) ? asic->irq_base + offset : -ENXIO; | ||
531 | } | 533 | } |
532 | 534 | ||
533 | static __init int asic3_gpio_probe(struct platform_device *pdev, | 535 | static __init int asic3_gpio_probe(struct platform_device *pdev, |
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index ebc1e8658226..5be32489714f 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c | |||
@@ -2788,6 +2788,7 @@ static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { | |||
2788 | .constraints = { | 2788 | .constraints = { |
2789 | .name = "db8500-vape", | 2789 | .name = "db8500-vape", |
2790 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | 2790 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
2791 | .always_on = true, | ||
2791 | }, | 2792 | }, |
2792 | .consumer_supplies = db8500_vape_consumers, | 2793 | .consumer_supplies = db8500_vape_consumers, |
2793 | .num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers), | 2794 | .num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers), |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 95a2e546a489..c8aae6640e64 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/gpio.h> | ||
29 | #include <plat/usb.h> | 28 | #include <plat/usb.h> |
30 | #include <linux/pm_runtime.h> | 29 | #include <linux/pm_runtime.h> |
31 | 30 | ||
@@ -502,19 +501,6 @@ static void omap_usbhs_init(struct device *dev) | |||
502 | pm_runtime_get_sync(dev); | 501 | pm_runtime_get_sync(dev); |
503 | spin_lock_irqsave(&omap->lock, flags); | 502 | spin_lock_irqsave(&omap->lock, flags); |
504 | 503 | ||
505 | if (pdata->ehci_data->phy_reset) { | ||
506 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
507 | gpio_request_one(pdata->ehci_data->reset_gpio_port[0], | ||
508 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
509 | |||
510 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
511 | gpio_request_one(pdata->ehci_data->reset_gpio_port[1], | ||
512 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
513 | |||
514 | /* Hold the PHY in RESET for enough time till DIR is high */ | ||
515 | udelay(10); | ||
516 | } | ||
517 | |||
518 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); | 504 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); |
519 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); | 505 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); |
520 | 506 | ||
@@ -593,39 +579,10 @@ static void omap_usbhs_init(struct device *dev) | |||
593 | usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); | 579 | usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); |
594 | } | 580 | } |
595 | 581 | ||
596 | if (pdata->ehci_data->phy_reset) { | ||
597 | /* Hold the PHY in RESET for enough time till | ||
598 | * PHY is settled and ready | ||
599 | */ | ||
600 | udelay(10); | ||
601 | |||
602 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
603 | gpio_set_value | ||
604 | (pdata->ehci_data->reset_gpio_port[0], 1); | ||
605 | |||
606 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
607 | gpio_set_value | ||
608 | (pdata->ehci_data->reset_gpio_port[1], 1); | ||
609 | } | ||
610 | |||
611 | spin_unlock_irqrestore(&omap->lock, flags); | 582 | spin_unlock_irqrestore(&omap->lock, flags); |
612 | pm_runtime_put_sync(dev); | 583 | pm_runtime_put_sync(dev); |
613 | } | 584 | } |
614 | 585 | ||
615 | static void omap_usbhs_deinit(struct device *dev) | ||
616 | { | ||
617 | struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); | ||
618 | struct usbhs_omap_platform_data *pdata = &omap->platdata; | ||
619 | |||
620 | if (pdata->ehci_data->phy_reset) { | ||
621 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
622 | gpio_free(pdata->ehci_data->reset_gpio_port[0]); | ||
623 | |||
624 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
625 | gpio_free(pdata->ehci_data->reset_gpio_port[1]); | ||
626 | } | ||
627 | } | ||
628 | |||
629 | 586 | ||
630 | /** | 587 | /** |
631 | * usbhs_omap_probe - initialize TI-based HCDs | 588 | * usbhs_omap_probe - initialize TI-based HCDs |
@@ -860,7 +817,6 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev) | |||
860 | { | 817 | { |
861 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); | 818 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); |
862 | 819 | ||
863 | omap_usbhs_deinit(&pdev->dev); | ||
864 | iounmap(omap->tll_base); | 820 | iounmap(omap->tll_base); |
865 | iounmap(omap->uhh_base); | 821 | iounmap(omap->uhh_base); |
866 | clk_put(omap->init_60m_fclk); | 822 | clk_put(omap->init_60m_fclk); |
diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c index 99ef944c621d..44afae0a69ce 100644 --- a/drivers/mfd/rc5t583.c +++ b/drivers/mfd/rc5t583.c | |||
@@ -80,44 +80,6 @@ static struct mfd_cell rc5t583_subdevs[] = { | |||
80 | {.name = "rc5t583-key", } | 80 | {.name = "rc5t583-key", } |
81 | }; | 81 | }; |
82 | 82 | ||
83 | int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) | ||
84 | { | ||
85 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
86 | return regmap_write(rc5t583->regmap, reg, val); | ||
87 | } | ||
88 | |||
89 | int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val) | ||
90 | { | ||
91 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
92 | unsigned int ival; | ||
93 | int ret; | ||
94 | ret = regmap_read(rc5t583->regmap, reg, &ival); | ||
95 | if (!ret) | ||
96 | *val = (uint8_t)ival; | ||
97 | return ret; | ||
98 | } | ||
99 | |||
100 | int rc5t583_set_bits(struct device *dev, unsigned int reg, | ||
101 | unsigned int bit_mask) | ||
102 | { | ||
103 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
104 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask); | ||
105 | } | ||
106 | |||
107 | int rc5t583_clear_bits(struct device *dev, unsigned int reg, | ||
108 | unsigned int bit_mask) | ||
109 | { | ||
110 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
111 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0); | ||
112 | } | ||
113 | |||
114 | int rc5t583_update(struct device *dev, unsigned int reg, | ||
115 | unsigned int val, unsigned int mask) | ||
116 | { | ||
117 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
118 | return regmap_update_bits(rc5t583->regmap, reg, mask, val); | ||
119 | } | ||
120 | |||
121 | static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, | 83 | static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, |
122 | int id, int ext_pwr, int slots) | 84 | int id, int ext_pwr, int slots) |
123 | { | 85 | { |
@@ -197,6 +159,7 @@ int rc5t583_ext_power_req_config(struct device *dev, int ds_id, | |||
197 | ds_id, ext_pwr_req); | 159 | ds_id, ext_pwr_req); |
198 | return 0; | 160 | return 0; |
199 | } | 161 | } |
162 | EXPORT_SYMBOL(rc5t583_ext_power_req_config); | ||
200 | 163 | ||
201 | static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, | 164 | static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, |
202 | struct rc5t583_platform_data *pdata) | 165 | struct rc5t583_platform_data *pdata) |
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c index b2d8e512d3cb..2d6bedadca09 100644 --- a/drivers/mfd/twl6040-core.c +++ b/drivers/mfd/twl6040-core.c | |||
@@ -30,7 +30,9 @@ | |||
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/gpio.h> | 31 | #include <linux/gpio.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/i2c/twl.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/regmap.h> | ||
35 | #include <linux/err.h> | ||
34 | #include <linux/mfd/core.h> | 36 | #include <linux/mfd/core.h> |
35 | #include <linux/mfd/twl6040.h> | 37 | #include <linux/mfd/twl6040.h> |
36 | 38 | ||
@@ -39,7 +41,7 @@ | |||
39 | int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) | 41 | int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) |
40 | { | 42 | { |
41 | int ret; | 43 | int ret; |
42 | u8 val = 0; | 44 | unsigned int val; |
43 | 45 | ||
44 | mutex_lock(&twl6040->io_mutex); | 46 | mutex_lock(&twl6040->io_mutex); |
45 | /* Vibra control registers from cache */ | 47 | /* Vibra control registers from cache */ |
@@ -47,7 +49,7 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) | |||
47 | reg == TWL6040_REG_VIBCTLR)) { | 49 | reg == TWL6040_REG_VIBCTLR)) { |
48 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; | 50 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; |
49 | } else { | 51 | } else { |
50 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 52 | ret = regmap_read(twl6040->regmap, reg, &val); |
51 | if (ret < 0) { | 53 | if (ret < 0) { |
52 | mutex_unlock(&twl6040->io_mutex); | 54 | mutex_unlock(&twl6040->io_mutex); |
53 | return ret; | 55 | return ret; |
@@ -64,7 +66,7 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val) | |||
64 | int ret; | 66 | int ret; |
65 | 67 | ||
66 | mutex_lock(&twl6040->io_mutex); | 68 | mutex_lock(&twl6040->io_mutex); |
67 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | 69 | ret = regmap_write(twl6040->regmap, reg, val); |
68 | /* Cache the vibra control registers */ | 70 | /* Cache the vibra control registers */ |
69 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) | 71 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) |
70 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; | 72 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; |
@@ -77,16 +79,9 @@ EXPORT_SYMBOL(twl6040_reg_write); | |||
77 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 79 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
78 | { | 80 | { |
79 | int ret; | 81 | int ret; |
80 | u8 val; | ||
81 | 82 | ||
82 | mutex_lock(&twl6040->io_mutex); | 83 | mutex_lock(&twl6040->io_mutex); |
83 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 84 | ret = regmap_update_bits(twl6040->regmap, reg, mask, mask); |
84 | if (ret) | ||
85 | goto out; | ||
86 | |||
87 | val |= mask; | ||
88 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | ||
89 | out: | ||
90 | mutex_unlock(&twl6040->io_mutex); | 85 | mutex_unlock(&twl6040->io_mutex); |
91 | return ret; | 86 | return ret; |
92 | } | 87 | } |
@@ -95,16 +90,9 @@ EXPORT_SYMBOL(twl6040_set_bits); | |||
95 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 90 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
96 | { | 91 | { |
97 | int ret; | 92 | int ret; |
98 | u8 val; | ||
99 | 93 | ||
100 | mutex_lock(&twl6040->io_mutex); | 94 | mutex_lock(&twl6040->io_mutex); |
101 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 95 | ret = regmap_update_bits(twl6040->regmap, reg, mask, 0); |
102 | if (ret) | ||
103 | goto out; | ||
104 | |||
105 | val &= ~mask; | ||
106 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | ||
107 | out: | ||
108 | mutex_unlock(&twl6040->io_mutex); | 96 | mutex_unlock(&twl6040->io_mutex); |
109 | return ret; | 97 | return ret; |
110 | } | 98 | } |
@@ -494,32 +482,58 @@ static struct resource twl6040_codec_rsrc[] = { | |||
494 | }, | 482 | }, |
495 | }; | 483 | }; |
496 | 484 | ||
497 | static int __devinit twl6040_probe(struct platform_device *pdev) | 485 | static bool twl6040_readable_reg(struct device *dev, unsigned int reg) |
498 | { | 486 | { |
499 | struct twl4030_audio_data *pdata = pdev->dev.platform_data; | 487 | /* Register 0 is not readable */ |
488 | if (!reg) | ||
489 | return false; | ||
490 | return true; | ||
491 | } | ||
492 | |||
493 | static struct regmap_config twl6040_regmap_config = { | ||
494 | .reg_bits = 8, | ||
495 | .val_bits = 8, | ||
496 | .max_register = TWL6040_REG_STATUS, /* 0x2e */ | ||
497 | |||
498 | .readable_reg = twl6040_readable_reg, | ||
499 | }; | ||
500 | |||
501 | static int __devinit twl6040_probe(struct i2c_client *client, | ||
502 | const struct i2c_device_id *id) | ||
503 | { | ||
504 | struct twl6040_platform_data *pdata = client->dev.platform_data; | ||
500 | struct twl6040 *twl6040; | 505 | struct twl6040 *twl6040; |
501 | struct mfd_cell *cell = NULL; | 506 | struct mfd_cell *cell = NULL; |
502 | int ret, children = 0; | 507 | int ret, children = 0; |
503 | 508 | ||
504 | if (!pdata) { | 509 | if (!pdata) { |
505 | dev_err(&pdev->dev, "Platform data is missing\n"); | 510 | dev_err(&client->dev, "Platform data is missing\n"); |
506 | return -EINVAL; | 511 | return -EINVAL; |
507 | } | 512 | } |
508 | 513 | ||
509 | /* In order to operate correctly we need valid interrupt config */ | 514 | /* In order to operate correctly we need valid interrupt config */ |
510 | if (!pdata->naudint_irq || !pdata->irq_base) { | 515 | if (!client->irq || !pdata->irq_base) { |
511 | dev_err(&pdev->dev, "Invalid IRQ configuration\n"); | 516 | dev_err(&client->dev, "Invalid IRQ configuration\n"); |
512 | return -EINVAL; | 517 | return -EINVAL; |
513 | } | 518 | } |
514 | 519 | ||
515 | twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL); | 520 | twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040), |
516 | if (!twl6040) | 521 | GFP_KERNEL); |
517 | return -ENOMEM; | 522 | if (!twl6040) { |
523 | ret = -ENOMEM; | ||
524 | goto err; | ||
525 | } | ||
526 | |||
527 | twl6040->regmap = regmap_init_i2c(client, &twl6040_regmap_config); | ||
528 | if (IS_ERR(twl6040->regmap)) { | ||
529 | ret = PTR_ERR(twl6040->regmap); | ||
530 | goto err; | ||
531 | } | ||
518 | 532 | ||
519 | platform_set_drvdata(pdev, twl6040); | 533 | i2c_set_clientdata(client, twl6040); |
520 | 534 | ||
521 | twl6040->dev = &pdev->dev; | 535 | twl6040->dev = &client->dev; |
522 | twl6040->irq = pdata->naudint_irq; | 536 | twl6040->irq = client->irq; |
523 | twl6040->irq_base = pdata->irq_base; | 537 | twl6040->irq_base = pdata->irq_base; |
524 | 538 | ||
525 | mutex_init(&twl6040->mutex); | 539 | mutex_init(&twl6040->mutex); |
@@ -588,12 +602,12 @@ static int __devinit twl6040_probe(struct platform_device *pdev) | |||
588 | } | 602 | } |
589 | 603 | ||
590 | if (children) { | 604 | if (children) { |
591 | ret = mfd_add_devices(&pdev->dev, pdev->id, twl6040->cells, | 605 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, |
592 | children, NULL, 0); | 606 | children, NULL, 0); |
593 | if (ret) | 607 | if (ret) |
594 | goto mfd_err; | 608 | goto mfd_err; |
595 | } else { | 609 | } else { |
596 | dev_err(&pdev->dev, "No platform data found for children\n"); | 610 | dev_err(&client->dev, "No platform data found for children\n"); |
597 | ret = -ENODEV; | 611 | ret = -ENODEV; |
598 | goto mfd_err; | 612 | goto mfd_err; |
599 | } | 613 | } |
@@ -608,14 +622,15 @@ gpio2_err: | |||
608 | if (gpio_is_valid(twl6040->audpwron)) | 622 | if (gpio_is_valid(twl6040->audpwron)) |
609 | gpio_free(twl6040->audpwron); | 623 | gpio_free(twl6040->audpwron); |
610 | gpio1_err: | 624 | gpio1_err: |
611 | platform_set_drvdata(pdev, NULL); | 625 | i2c_set_clientdata(client, NULL); |
612 | kfree(twl6040); | 626 | regmap_exit(twl6040->regmap); |
627 | err: | ||
613 | return ret; | 628 | return ret; |
614 | } | 629 | } |
615 | 630 | ||
616 | static int __devexit twl6040_remove(struct platform_device *pdev) | 631 | static int __devexit twl6040_remove(struct i2c_client *client) |
617 | { | 632 | { |
618 | struct twl6040 *twl6040 = platform_get_drvdata(pdev); | 633 | struct twl6040 *twl6040 = i2c_get_clientdata(client); |
619 | 634 | ||
620 | if (twl6040->power_count) | 635 | if (twl6040->power_count) |
621 | twl6040_power(twl6040, 0); | 636 | twl6040_power(twl6040, 0); |
@@ -626,23 +641,30 @@ static int __devexit twl6040_remove(struct platform_device *pdev) | |||
626 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); | 641 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); |
627 | twl6040_irq_exit(twl6040); | 642 | twl6040_irq_exit(twl6040); |
628 | 643 | ||
629 | mfd_remove_devices(&pdev->dev); | 644 | mfd_remove_devices(&client->dev); |
630 | platform_set_drvdata(pdev, NULL); | 645 | i2c_set_clientdata(client, NULL); |
631 | kfree(twl6040); | 646 | regmap_exit(twl6040->regmap); |
632 | 647 | ||
633 | return 0; | 648 | return 0; |
634 | } | 649 | } |
635 | 650 | ||
636 | static struct platform_driver twl6040_driver = { | 651 | static const struct i2c_device_id twl6040_i2c_id[] = { |
652 | { "twl6040", 0, }, | ||
653 | { }, | ||
654 | }; | ||
655 | MODULE_DEVICE_TABLE(i2c, twl6040_i2c_id); | ||
656 | |||
657 | static struct i2c_driver twl6040_driver = { | ||
658 | .driver = { | ||
659 | .name = "twl6040", | ||
660 | .owner = THIS_MODULE, | ||
661 | }, | ||
637 | .probe = twl6040_probe, | 662 | .probe = twl6040_probe, |
638 | .remove = __devexit_p(twl6040_remove), | 663 | .remove = __devexit_p(twl6040_remove), |
639 | .driver = { | 664 | .id_table = twl6040_i2c_id, |
640 | .owner = THIS_MODULE, | ||
641 | .name = "twl6040", | ||
642 | }, | ||
643 | }; | 665 | }; |
644 | 666 | ||
645 | module_platform_driver(twl6040_driver); | 667 | module_i2c_driver(twl6040_driver); |
646 | 668 | ||
647 | MODULE_DESCRIPTION("TWL6040 MFD"); | 669 | MODULE_DESCRIPTION("TWL6040 MFD"); |
648 | MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); | 670 | MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index b1809650b7aa..dabec556ebb8 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -873,7 +873,7 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | |||
873 | { | 873 | { |
874 | struct mmc_blk_data *md = mq->data; | 874 | struct mmc_blk_data *md = mq->data; |
875 | struct mmc_card *card = md->queue.card; | 875 | struct mmc_card *card = md->queue.card; |
876 | unsigned int from, nr, arg; | 876 | unsigned int from, nr, arg, trim_arg, erase_arg; |
877 | int err = 0, type = MMC_BLK_SECDISCARD; | 877 | int err = 0, type = MMC_BLK_SECDISCARD; |
878 | 878 | ||
879 | if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { | 879 | if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { |
@@ -881,20 +881,26 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | |||
881 | goto out; | 881 | goto out; |
882 | } | 882 | } |
883 | 883 | ||
884 | from = blk_rq_pos(req); | ||
885 | nr = blk_rq_sectors(req); | ||
886 | |||
884 | /* The sanitize operation is supported at v4.5 only */ | 887 | /* The sanitize operation is supported at v4.5 only */ |
885 | if (mmc_can_sanitize(card)) { | 888 | if (mmc_can_sanitize(card)) { |
886 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 889 | erase_arg = MMC_ERASE_ARG; |
887 | EXT_CSD_SANITIZE_START, 1, 0); | 890 | trim_arg = MMC_TRIM_ARG; |
888 | goto out; | 891 | } else { |
892 | erase_arg = MMC_SECURE_ERASE_ARG; | ||
893 | trim_arg = MMC_SECURE_TRIM1_ARG; | ||
889 | } | 894 | } |
890 | 895 | ||
891 | from = blk_rq_pos(req); | 896 | if (mmc_erase_group_aligned(card, from, nr)) |
892 | nr = blk_rq_sectors(req); | 897 | arg = erase_arg; |
893 | 898 | else if (mmc_can_trim(card)) | |
894 | if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) | 899 | arg = trim_arg; |
895 | arg = MMC_SECURE_TRIM1_ARG; | 900 | else { |
896 | else | 901 | err = -EINVAL; |
897 | arg = MMC_SECURE_ERASE_ARG; | 902 | goto out; |
903 | } | ||
898 | retry: | 904 | retry: |
899 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | 905 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { |
900 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 906 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
@@ -904,25 +910,41 @@ retry: | |||
904 | INAND_CMD38_ARG_SECERASE, | 910 | INAND_CMD38_ARG_SECERASE, |
905 | 0); | 911 | 0); |
906 | if (err) | 912 | if (err) |
907 | goto out; | 913 | goto out_retry; |
908 | } | 914 | } |
915 | |||
909 | err = mmc_erase(card, from, nr, arg); | 916 | err = mmc_erase(card, from, nr, arg); |
910 | if (!err && arg == MMC_SECURE_TRIM1_ARG) { | 917 | if (err == -EIO) |
918 | goto out_retry; | ||
919 | if (err) | ||
920 | goto out; | ||
921 | |||
922 | if (arg == MMC_SECURE_TRIM1_ARG) { | ||
911 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | 923 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { |
912 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 924 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
913 | INAND_CMD38_ARG_EXT_CSD, | 925 | INAND_CMD38_ARG_EXT_CSD, |
914 | INAND_CMD38_ARG_SECTRIM2, | 926 | INAND_CMD38_ARG_SECTRIM2, |
915 | 0); | 927 | 0); |
916 | if (err) | 928 | if (err) |
917 | goto out; | 929 | goto out_retry; |
918 | } | 930 | } |
931 | |||
919 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); | 932 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); |
933 | if (err == -EIO) | ||
934 | goto out_retry; | ||
935 | if (err) | ||
936 | goto out; | ||
920 | } | 937 | } |
921 | out: | 938 | |
922 | if (err == -EIO && !mmc_blk_reset(md, card->host, type)) | 939 | if (mmc_can_sanitize(card)) |
940 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
941 | EXT_CSD_SANITIZE_START, 1, 0); | ||
942 | out_retry: | ||
943 | if (err && !mmc_blk_reset(md, card->host, type)) | ||
923 | goto retry; | 944 | goto retry; |
924 | if (!err) | 945 | if (!err) |
925 | mmc_blk_reset_success(md, type); | 946 | mmc_blk_reset_success(md, type); |
947 | out: | ||
926 | spin_lock_irq(&md->lock); | 948 | spin_lock_irq(&md->lock); |
927 | __blk_end_request(req, err, blk_rq_bytes(req)); | 949 | __blk_end_request(req, err, blk_rq_bytes(req)); |
928 | spin_unlock_irq(&md->lock); | 950 | spin_unlock_irq(&md->lock); |
@@ -1802,7 +1824,7 @@ static void mmc_blk_remove(struct mmc_card *card) | |||
1802 | } | 1824 | } |
1803 | 1825 | ||
1804 | #ifdef CONFIG_PM | 1826 | #ifdef CONFIG_PM |
1805 | static int mmc_blk_suspend(struct mmc_card *card, pm_message_t state) | 1827 | static int mmc_blk_suspend(struct mmc_card *card) |
1806 | { | 1828 | { |
1807 | struct mmc_blk_data *part_md; | 1829 | struct mmc_blk_data *part_md; |
1808 | struct mmc_blk_data *md = mmc_get_drvdata(card); | 1830 | struct mmc_blk_data *md = mmc_get_drvdata(card); |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 2517547b4366..996f8e36e23d 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -139,7 +139,7 @@ static void mmc_queue_setup_discard(struct request_queue *q, | |||
139 | 139 | ||
140 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); | 140 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); |
141 | q->limits.max_discard_sectors = max_discard; | 141 | q->limits.max_discard_sectors = max_discard; |
142 | if (card->erased_byte == 0) | 142 | if (card->erased_byte == 0 && !mmc_can_discard(card)) |
143 | q->limits.discard_zeroes_data = 1; | 143 | q->limits.discard_zeroes_data = 1; |
144 | q->limits.discard_granularity = card->pref_erase << 9; | 144 | q->limits.discard_granularity = card->pref_erase << 9; |
145 | /* granularity must not be greater than max. discard */ | 145 | /* granularity must not be greater than max. discard */ |
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 3f606068d552..c60cee92a2b2 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -122,14 +122,14 @@ static int mmc_bus_remove(struct device *dev) | |||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | static int mmc_bus_suspend(struct device *dev, pm_message_t state) | 125 | static int mmc_bus_suspend(struct device *dev) |
126 | { | 126 | { |
127 | struct mmc_driver *drv = to_mmc_driver(dev->driver); | 127 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
128 | struct mmc_card *card = mmc_dev_to_card(dev); | 128 | struct mmc_card *card = mmc_dev_to_card(dev); |
129 | int ret = 0; | 129 | int ret = 0; |
130 | 130 | ||
131 | if (dev->driver && drv->suspend) | 131 | if (dev->driver && drv->suspend) |
132 | ret = drv->suspend(card, state); | 132 | ret = drv->suspend(card); |
133 | return ret; | 133 | return ret; |
134 | } | 134 | } |
135 | 135 | ||
@@ -165,20 +165,14 @@ static int mmc_runtime_idle(struct device *dev) | |||
165 | return pm_runtime_suspend(dev); | 165 | return pm_runtime_suspend(dev); |
166 | } | 166 | } |
167 | 167 | ||
168 | #endif /* !CONFIG_PM_RUNTIME */ | ||
169 | |||
168 | static const struct dev_pm_ops mmc_bus_pm_ops = { | 170 | static const struct dev_pm_ops mmc_bus_pm_ops = { |
169 | .runtime_suspend = mmc_runtime_suspend, | 171 | SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, |
170 | .runtime_resume = mmc_runtime_resume, | 172 | mmc_runtime_idle) |
171 | .runtime_idle = mmc_runtime_idle, | 173 | SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume) |
172 | }; | 174 | }; |
173 | 175 | ||
174 | #define MMC_PM_OPS_PTR (&mmc_bus_pm_ops) | ||
175 | |||
176 | #else /* !CONFIG_PM_RUNTIME */ | ||
177 | |||
178 | #define MMC_PM_OPS_PTR NULL | ||
179 | |||
180 | #endif /* !CONFIG_PM_RUNTIME */ | ||
181 | |||
182 | static struct bus_type mmc_bus_type = { | 176 | static struct bus_type mmc_bus_type = { |
183 | .name = "mmc", | 177 | .name = "mmc", |
184 | .dev_attrs = mmc_dev_attrs, | 178 | .dev_attrs = mmc_dev_attrs, |
@@ -186,9 +180,7 @@ static struct bus_type mmc_bus_type = { | |||
186 | .uevent = mmc_bus_uevent, | 180 | .uevent = mmc_bus_uevent, |
187 | .probe = mmc_bus_probe, | 181 | .probe = mmc_bus_probe, |
188 | .remove = mmc_bus_remove, | 182 | .remove = mmc_bus_remove, |
189 | .suspend = mmc_bus_suspend, | 183 | .pm = &mmc_bus_pm_ops, |
190 | .resume = mmc_bus_resume, | ||
191 | .pm = MMC_PM_OPS_PTR, | ||
192 | }; | 184 | }; |
193 | 185 | ||
194 | int mmc_register_bus(void) | 186 | int mmc_register_bus(void) |
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c index 29de31e260dd..2c14be73254c 100644 --- a/drivers/mmc/core/cd-gpio.c +++ b/drivers/mmc/core/cd-gpio.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/gpio.h> | 12 | #include <linux/gpio.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/jiffies.h> | 14 | #include <linux/jiffies.h> |
15 | #include <linux/mmc/cd-gpio.h> | ||
15 | #include <linux/mmc/host.h> | 16 | #include <linux/mmc/host.h> |
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 7474c47b9c08..ba821fe70bca 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1409,7 +1409,10 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card, | |||
1409 | { | 1409 | { |
1410 | unsigned int erase_timeout; | 1410 | unsigned int erase_timeout; |
1411 | 1411 | ||
1412 | if (card->ext_csd.erase_group_def & 1) { | 1412 | if (arg == MMC_DISCARD_ARG || |
1413 | (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) { | ||
1414 | erase_timeout = card->ext_csd.trim_timeout; | ||
1415 | } else if (card->ext_csd.erase_group_def & 1) { | ||
1413 | /* High Capacity Erase Group Size uses HC timeouts */ | 1416 | /* High Capacity Erase Group Size uses HC timeouts */ |
1414 | if (arg == MMC_TRIM_ARG) | 1417 | if (arg == MMC_TRIM_ARG) |
1415 | erase_timeout = card->ext_csd.trim_timeout; | 1418 | erase_timeout = card->ext_csd.trim_timeout; |
@@ -1681,8 +1684,6 @@ int mmc_can_trim(struct mmc_card *card) | |||
1681 | { | 1684 | { |
1682 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) | 1685 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) |
1683 | return 1; | 1686 | return 1; |
1684 | if (mmc_can_discard(card)) | ||
1685 | return 1; | ||
1686 | return 0; | 1687 | return 0; |
1687 | } | 1688 | } |
1688 | EXPORT_SYMBOL(mmc_can_trim); | 1689 | EXPORT_SYMBOL(mmc_can_trim); |
@@ -1701,6 +1702,8 @@ EXPORT_SYMBOL(mmc_can_discard); | |||
1701 | 1702 | ||
1702 | int mmc_can_sanitize(struct mmc_card *card) | 1703 | int mmc_can_sanitize(struct mmc_card *card) |
1703 | { | 1704 | { |
1705 | if (!mmc_can_trim(card) && !mmc_can_erase(card)) | ||
1706 | return 0; | ||
1704 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) | 1707 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) |
1705 | return 1; | 1708 | return 1; |
1706 | return 0; | 1709 | return 0; |
@@ -2235,6 +2238,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) | |||
2235 | mmc_card_is_removable(host)) | 2238 | mmc_card_is_removable(host)) |
2236 | return err; | 2239 | return err; |
2237 | 2240 | ||
2241 | mmc_claim_host(host); | ||
2238 | if (card && mmc_card_mmc(card) && | 2242 | if (card && mmc_card_mmc(card) && |
2239 | (card->ext_csd.cache_size > 0)) { | 2243 | (card->ext_csd.cache_size > 0)) { |
2240 | enable = !!enable; | 2244 | enable = !!enable; |
@@ -2252,6 +2256,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) | |||
2252 | card->ext_csd.cache_ctrl = enable; | 2256 | card->ext_csd.cache_ctrl = enable; |
2253 | } | 2257 | } |
2254 | } | 2258 | } |
2259 | mmc_release_host(host); | ||
2255 | 2260 | ||
2256 | return err; | 2261 | return err; |
2257 | } | 2262 | } |
@@ -2269,49 +2274,32 @@ int mmc_suspend_host(struct mmc_host *host) | |||
2269 | 2274 | ||
2270 | cancel_delayed_work(&host->detect); | 2275 | cancel_delayed_work(&host->detect); |
2271 | mmc_flush_scheduled_work(); | 2276 | mmc_flush_scheduled_work(); |
2272 | if (mmc_try_claim_host(host)) { | ||
2273 | err = mmc_cache_ctrl(host, 0); | ||
2274 | mmc_release_host(host); | ||
2275 | } else { | ||
2276 | err = -EBUSY; | ||
2277 | } | ||
2278 | 2277 | ||
2278 | err = mmc_cache_ctrl(host, 0); | ||
2279 | if (err) | 2279 | if (err) |
2280 | goto out; | 2280 | goto out; |
2281 | 2281 | ||
2282 | mmc_bus_get(host); | 2282 | mmc_bus_get(host); |
2283 | if (host->bus_ops && !host->bus_dead) { | 2283 | if (host->bus_ops && !host->bus_dead) { |
2284 | 2284 | ||
2285 | /* | 2285 | if (host->bus_ops->suspend) |
2286 | * A long response time is not acceptable for device drivers | 2286 | err = host->bus_ops->suspend(host); |
2287 | * when doing suspend. Prevent mmc_claim_host in the suspend | ||
2288 | * sequence, to potentially wait "forever" by trying to | ||
2289 | * pre-claim the host. | ||
2290 | */ | ||
2291 | if (mmc_try_claim_host(host)) { | ||
2292 | if (host->bus_ops->suspend) { | ||
2293 | err = host->bus_ops->suspend(host); | ||
2294 | } | ||
2295 | mmc_release_host(host); | ||
2296 | 2287 | ||
2297 | if (err == -ENOSYS || !host->bus_ops->resume) { | 2288 | if (err == -ENOSYS || !host->bus_ops->resume) { |
2298 | /* | 2289 | /* |
2299 | * We simply "remove" the card in this case. | 2290 | * We simply "remove" the card in this case. |
2300 | * It will be redetected on resume. (Calling | 2291 | * It will be redetected on resume. (Calling |
2301 | * bus_ops->remove() with a claimed host can | 2292 | * bus_ops->remove() with a claimed host can |
2302 | * deadlock.) | 2293 | * deadlock.) |
2303 | */ | 2294 | */ |
2304 | if (host->bus_ops->remove) | 2295 | if (host->bus_ops->remove) |
2305 | host->bus_ops->remove(host); | 2296 | host->bus_ops->remove(host); |
2306 | mmc_claim_host(host); | 2297 | mmc_claim_host(host); |
2307 | mmc_detach_bus(host); | 2298 | mmc_detach_bus(host); |
2308 | mmc_power_off(host); | 2299 | mmc_power_off(host); |
2309 | mmc_release_host(host); | 2300 | mmc_release_host(host); |
2310 | host->pm_flags = 0; | 2301 | host->pm_flags = 0; |
2311 | err = 0; | 2302 | err = 0; |
2312 | } | ||
2313 | } else { | ||
2314 | err = -EBUSY; | ||
2315 | } | 2303 | } |
2316 | } | 2304 | } |
2317 | mmc_bus_put(host); | 2305 | mmc_bus_put(host); |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index bf3c9b456aaf..ab3fc4617107 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -526,8 +526,10 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data) | |||
526 | return -ENODEV; | 526 | return -ENODEV; |
527 | 527 | ||
528 | sg_len = dw_mci_pre_dma_transfer(host, data, 0); | 528 | sg_len = dw_mci_pre_dma_transfer(host, data, 0); |
529 | if (sg_len < 0) | 529 | if (sg_len < 0) { |
530 | host->dma_ops->stop(host); | ||
530 | return sg_len; | 531 | return sg_len; |
532 | } | ||
531 | 533 | ||
532 | host->using_dma = 1; | 534 | host->using_dma = 1; |
533 | 535 | ||
@@ -1879,7 +1881,8 @@ static void dw_mci_init_dma(struct dw_mci *host) | |||
1879 | if (!host->dma_ops) | 1881 | if (!host->dma_ops) |
1880 | goto no_dma; | 1882 | goto no_dma; |
1881 | 1883 | ||
1882 | if (host->dma_ops->init) { | 1884 | if (host->dma_ops->init && host->dma_ops->start && |
1885 | host->dma_ops->stop && host->dma_ops->cleanup) { | ||
1883 | if (host->dma_ops->init(host)) { | 1886 | if (host->dma_ops->init(host)) { |
1884 | dev_err(&host->dev, "%s: Unable to initialize " | 1887 | dev_err(&host->dev, "%s: Unable to initialize " |
1885 | "DMA Controller.\n", __func__); | 1888 | "DMA Controller.\n", __func__); |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 5c2b1c10af9c..56d4499d4388 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -249,7 +249,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, | |||
249 | * the pbias cell programming support is still missing when | 249 | * the pbias cell programming support is still missing when |
250 | * booting with Device tree | 250 | * booting with Device tree |
251 | */ | 251 | */ |
252 | if (of_have_populated_dt() && !vdd) | 252 | if (dev->of_node && !vdd) |
253 | return 0; | 253 | return 0; |
254 | 254 | ||
255 | if (mmc_slot(host).before_set_reg) | 255 | if (mmc_slot(host).before_set_reg) |
@@ -1549,7 +1549,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1549 | * can't be allowed when booting with device | 1549 | * can't be allowed when booting with device |
1550 | * tree. | 1550 | * tree. |
1551 | */ | 1551 | */ |
1552 | (!of_have_populated_dt())) { | 1552 | !host->dev->of_node) { |
1553 | /* | 1553 | /* |
1554 | * The mmc_select_voltage fn of the core does | 1554 | * The mmc_select_voltage fn of the core does |
1555 | * not seem to set the power_mode to | 1555 | * not seem to set the power_mode to |
@@ -1741,7 +1741,7 @@ static const struct of_device_id omap_mmc_of_match[] = { | |||
1741 | .data = &omap4_reg_offset, | 1741 | .data = &omap4_reg_offset, |
1742 | }, | 1742 | }, |
1743 | {}, | 1743 | {}, |
1744 | } | 1744 | }; |
1745 | MODULE_DEVICE_TABLE(of, omap_mmc_of_match); | 1745 | MODULE_DEVICE_TABLE(of, omap_mmc_of_match); |
1746 | 1746 | ||
1747 | static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) | 1747 | static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 6193a0d7bde5..8abdaf6697a8 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -467,8 +467,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
467 | clk_prepare_enable(clk); | 467 | clk_prepare_enable(clk); |
468 | pltfm_host->clk = clk; | 468 | pltfm_host->clk = clk; |
469 | 469 | ||
470 | if (!is_imx25_esdhc(imx_data)) | 470 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
471 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; | ||
472 | 471 | ||
473 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) | 472 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) |
474 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ | 473 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 9aa77f3f04a8..ccefdebeff14 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -147,7 +147,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable) | |||
147 | u32 present, irqs; | 147 | u32 present, irqs; |
148 | 148 | ||
149 | if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || | 149 | if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || |
150 | !mmc_card_is_removable(host->mmc)) | 150 | (host->mmc->caps & MMC_CAP_NONREMOVABLE)) |
151 | return; | 151 | return; |
152 | 152 | ||
153 | present = sdhci_readl(host, SDHCI_PRESENT_STATE) & | 153 | present = sdhci_readl(host, SDHCI_PRESENT_STATE) & |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 94eb05b1afdf..58fc65f5c817 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -106,16 +106,14 @@ static int mtdchar_open(struct inode *inode, struct file *file) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | if (mtd->type == MTD_ABSENT) { | 108 | if (mtd->type == MTD_ABSENT) { |
109 | put_mtd_device(mtd); | ||
110 | ret = -ENODEV; | 109 | ret = -ENODEV; |
111 | goto out; | 110 | goto out1; |
112 | } | 111 | } |
113 | 112 | ||
114 | mtd_ino = iget_locked(mnt->mnt_sb, devnum); | 113 | mtd_ino = iget_locked(mnt->mnt_sb, devnum); |
115 | if (!mtd_ino) { | 114 | if (!mtd_ino) { |
116 | put_mtd_device(mtd); | ||
117 | ret = -ENOMEM; | 115 | ret = -ENOMEM; |
118 | goto out; | 116 | goto out1; |
119 | } | 117 | } |
120 | if (mtd_ino->i_state & I_NEW) { | 118 | if (mtd_ino->i_state & I_NEW) { |
121 | mtd_ino->i_private = mtd; | 119 | mtd_ino->i_private = mtd; |
@@ -127,23 +125,25 @@ static int mtdchar_open(struct inode *inode, struct file *file) | |||
127 | 125 | ||
128 | /* You can't open it RW if it's not a writeable device */ | 126 | /* You can't open it RW if it's not a writeable device */ |
129 | if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) { | 127 | if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) { |
130 | iput(mtd_ino); | ||
131 | put_mtd_device(mtd); | ||
132 | ret = -EACCES; | 128 | ret = -EACCES; |
133 | goto out; | 129 | goto out2; |
134 | } | 130 | } |
135 | 131 | ||
136 | mfi = kzalloc(sizeof(*mfi), GFP_KERNEL); | 132 | mfi = kzalloc(sizeof(*mfi), GFP_KERNEL); |
137 | if (!mfi) { | 133 | if (!mfi) { |
138 | iput(mtd_ino); | ||
139 | put_mtd_device(mtd); | ||
140 | ret = -ENOMEM; | 134 | ret = -ENOMEM; |
141 | goto out; | 135 | goto out2; |
142 | } | 136 | } |
143 | mfi->ino = mtd_ino; | 137 | mfi->ino = mtd_ino; |
144 | mfi->mtd = mtd; | 138 | mfi->mtd = mtd; |
145 | file->private_data = mfi; | 139 | file->private_data = mfi; |
140 | mutex_unlock(&mtd_mutex); | ||
141 | return 0; | ||
146 | 142 | ||
143 | out2: | ||
144 | iput(mtd_ino); | ||
145 | out1: | ||
146 | put_mtd_device(mtd); | ||
147 | out: | 147 | out: |
148 | mutex_unlock(&mtd_mutex); | 148 | mutex_unlock(&mtd_mutex); |
149 | simple_release_fs(&mnt, &count); | 149 | simple_release_fs(&mnt, &count); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 215eb2536b1e..2504ab005589 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -118,15 +118,13 @@ void ath9k_ps_restore(struct ath_softc *sc) | |||
118 | if (--sc->ps_usecount != 0) | 118 | if (--sc->ps_usecount != 0) |
119 | goto unlock; | 119 | goto unlock; |
120 | 120 | ||
121 | if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) | 121 | if (sc->ps_idle && (sc->ps_flags & PS_WAIT_FOR_TX_ACK)) |
122 | goto unlock; | ||
123 | |||
124 | if (sc->ps_idle) | ||
125 | mode = ATH9K_PM_FULL_SLEEP; | 122 | mode = ATH9K_PM_FULL_SLEEP; |
126 | else if (sc->ps_enabled && | 123 | else if (sc->ps_enabled && |
127 | !(sc->ps_flags & (PS_WAIT_FOR_BEACON | | 124 | !(sc->ps_flags & (PS_WAIT_FOR_BEACON | |
128 | PS_WAIT_FOR_CAB | | 125 | PS_WAIT_FOR_CAB | |
129 | PS_WAIT_FOR_PSPOLL_DATA))) | 126 | PS_WAIT_FOR_PSPOLL_DATA | |
127 | PS_WAIT_FOR_TX_ACK))) | ||
130 | mode = ATH9K_PM_NETWORK_SLEEP; | 128 | mode = ATH9K_PM_NETWORK_SLEEP; |
131 | else | 129 | else |
132 | goto unlock; | 130 | goto unlock; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index fc9901e027c1..90cc5e772650 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1062,11 +1062,6 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1062 | 1062 | ||
1063 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); | 1063 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); |
1064 | 1064 | ||
1065 | /* | ||
1066 | * Register the extra components. | ||
1067 | */ | ||
1068 | rt2x00rfkill_register(rt2x00dev); | ||
1069 | |||
1070 | return 0; | 1065 | return 0; |
1071 | } | 1066 | } |
1072 | 1067 | ||
@@ -1210,6 +1205,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1210 | rt2x00link_register(rt2x00dev); | 1205 | rt2x00link_register(rt2x00dev); |
1211 | rt2x00leds_register(rt2x00dev); | 1206 | rt2x00leds_register(rt2x00dev); |
1212 | rt2x00debug_register(rt2x00dev); | 1207 | rt2x00debug_register(rt2x00dev); |
1208 | rt2x00rfkill_register(rt2x00dev); | ||
1213 | 1209 | ||
1214 | return 0; | 1210 | return 0; |
1215 | 1211 | ||
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 510023554e5f..e54488db0e10 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
@@ -838,7 +838,10 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw, | |||
838 | __le16 fc = hdr->frame_control; | 838 | __le16 fc = hdr->frame_control; |
839 | 839 | ||
840 | txrate = ieee80211_get_tx_rate(hw, info); | 840 | txrate = ieee80211_get_tx_rate(hw, info); |
841 | tcb_desc->hw_rate = txrate->hw_value; | 841 | if (txrate) |
842 | tcb_desc->hw_rate = txrate->hw_value; | ||
843 | else | ||
844 | tcb_desc->hw_rate = 0; | ||
842 | 845 | ||
843 | if (ieee80211_is_data(fc)) { | 846 | if (ieee80211_is_data(fc)) { |
844 | /* | 847 | /* |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 07dd38efe62a..288b035a3579 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -912,8 +912,13 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) | |||
912 | memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); | 912 | memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); |
913 | ring = &rtlpci->tx_ring[BEACON_QUEUE]; | 913 | ring = &rtlpci->tx_ring[BEACON_QUEUE]; |
914 | pskb = __skb_dequeue(&ring->queue); | 914 | pskb = __skb_dequeue(&ring->queue); |
915 | if (pskb) | 915 | if (pskb) { |
916 | struct rtl_tx_desc *entry = &ring->desc[ring->idx]; | ||
917 | pci_unmap_single(rtlpci->pdev, rtlpriv->cfg->ops->get_desc( | ||
918 | (u8 *) entry, true, HW_DESC_TXBUFF_ADDR), | ||
919 | pskb->len, PCI_DMA_TODEVICE); | ||
916 | kfree_skb(pskb); | 920 | kfree_skb(pskb); |
921 | } | ||
917 | 922 | ||
918 | /*NB: the beacon data buffer must be 32-bit aligned. */ | 923 | /*NB: the beacon data buffer must be 32-bit aligned. */ |
919 | pskb = ieee80211_beacon_get(hw, mac->vif); | 924 | pskb = ieee80211_beacon_get(hw, mac->vif); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c index 4898c502974d..480862c07f92 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c | |||
@@ -91,7 +91,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) | |||
91 | u8 tid; | 91 | u8 tid; |
92 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 92 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
93 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 93 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
94 | static int header_print; | ||
95 | 94 | ||
96 | rtlpriv->dm.dm_initialgain_enable = true; | 95 | rtlpriv->dm.dm_initialgain_enable = true; |
97 | rtlpriv->dm.dm_flag = 0; | 96 | rtlpriv->dm.dm_flag = 0; |
@@ -171,10 +170,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) | |||
171 | for (tid = 0; tid < 8; tid++) | 170 | for (tid = 0; tid < 8; tid++) |
172 | skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]); | 171 | skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]); |
173 | 172 | ||
174 | /* Only load firmware for first MAC */ | ||
175 | if (header_print) | ||
176 | return 0; | ||
177 | |||
178 | /* for firmware buf */ | 173 | /* for firmware buf */ |
179 | rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); | 174 | rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); |
180 | if (!rtlpriv->rtlhal.pfirmware) { | 175 | if (!rtlpriv->rtlhal.pfirmware) { |
@@ -186,7 +181,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) | |||
186 | rtlpriv->max_fw_size = 0x8000; | 181 | rtlpriv->max_fw_size = 0x8000; |
187 | pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); | 182 | pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); |
188 | pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); | 183 | pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); |
189 | header_print++; | ||
190 | 184 | ||
191 | /* request fw */ | 185 | /* request fw */ |
192 | err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, | 186 | err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 2e1e352864bb..d04dbda13f5a 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -124,46 +124,38 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request, | |||
124 | return status; | 124 | return status; |
125 | } | 125 | } |
126 | 126 | ||
127 | static u32 _usb_read_sync(struct usb_device *udev, u32 addr, u16 len) | 127 | static u32 _usb_read_sync(struct rtl_priv *rtlpriv, u32 addr, u16 len) |
128 | { | 128 | { |
129 | struct device *dev = rtlpriv->io.dev; | ||
130 | struct usb_device *udev = to_usb_device(dev); | ||
129 | u8 request; | 131 | u8 request; |
130 | u16 wvalue; | 132 | u16 wvalue; |
131 | u16 index; | 133 | u16 index; |
132 | u32 *data; | 134 | __le32 *data = &rtlpriv->usb_data[rtlpriv->usb_data_index]; |
133 | u32 ret; | ||
134 | 135 | ||
135 | data = kmalloc(sizeof(u32), GFP_KERNEL); | ||
136 | if (!data) | ||
137 | return -ENOMEM; | ||
138 | request = REALTEK_USB_VENQT_CMD_REQ; | 136 | request = REALTEK_USB_VENQT_CMD_REQ; |
139 | index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */ | 137 | index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */ |
140 | 138 | ||
141 | wvalue = (u16)addr; | 139 | wvalue = (u16)addr; |
142 | _usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len); | 140 | _usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len); |
143 | ret = le32_to_cpu(*data); | 141 | if (++rtlpriv->usb_data_index >= RTL_USB_MAX_RX_COUNT) |
144 | kfree(data); | 142 | rtlpriv->usb_data_index = 0; |
145 | return ret; | 143 | return le32_to_cpu(*data); |
146 | } | 144 | } |
147 | 145 | ||
148 | static u8 _usb_read8_sync(struct rtl_priv *rtlpriv, u32 addr) | 146 | static u8 _usb_read8_sync(struct rtl_priv *rtlpriv, u32 addr) |
149 | { | 147 | { |
150 | struct device *dev = rtlpriv->io.dev; | 148 | return (u8)_usb_read_sync(rtlpriv, addr, 1); |
151 | |||
152 | return (u8)_usb_read_sync(to_usb_device(dev), addr, 1); | ||
153 | } | 149 | } |
154 | 150 | ||
155 | static u16 _usb_read16_sync(struct rtl_priv *rtlpriv, u32 addr) | 151 | static u16 _usb_read16_sync(struct rtl_priv *rtlpriv, u32 addr) |
156 | { | 152 | { |
157 | struct device *dev = rtlpriv->io.dev; | 153 | return (u16)_usb_read_sync(rtlpriv, addr, 2); |
158 | |||
159 | return (u16)_usb_read_sync(to_usb_device(dev), addr, 2); | ||
160 | } | 154 | } |
161 | 155 | ||
162 | static u32 _usb_read32_sync(struct rtl_priv *rtlpriv, u32 addr) | 156 | static u32 _usb_read32_sync(struct rtl_priv *rtlpriv, u32 addr) |
163 | { | 157 | { |
164 | struct device *dev = rtlpriv->io.dev; | 158 | return _usb_read_sync(rtlpriv, addr, 4); |
165 | |||
166 | return _usb_read_sync(to_usb_device(dev), addr, 4); | ||
167 | } | 159 | } |
168 | 160 | ||
169 | static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val, | 161 | static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val, |
@@ -955,6 +947,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf, | |||
955 | return -ENOMEM; | 947 | return -ENOMEM; |
956 | } | 948 | } |
957 | rtlpriv = hw->priv; | 949 | rtlpriv = hw->priv; |
950 | rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32), | ||
951 | GFP_KERNEL); | ||
952 | if (!rtlpriv->usb_data) | ||
953 | return -ENOMEM; | ||
954 | rtlpriv->usb_data_index = 0; | ||
958 | init_completion(&rtlpriv->firmware_loading_complete); | 955 | init_completion(&rtlpriv->firmware_loading_complete); |
959 | SET_IEEE80211_DEV(hw, &intf->dev); | 956 | SET_IEEE80211_DEV(hw, &intf->dev); |
960 | udev = interface_to_usbdev(intf); | 957 | udev = interface_to_usbdev(intf); |
@@ -1025,6 +1022,7 @@ void rtl_usb_disconnect(struct usb_interface *intf) | |||
1025 | /* rtl_deinit_rfkill(hw); */ | 1022 | /* rtl_deinit_rfkill(hw); */ |
1026 | rtl_usb_deinit(hw); | 1023 | rtl_usb_deinit(hw); |
1027 | rtl_deinit_core(hw); | 1024 | rtl_deinit_core(hw); |
1025 | kfree(rtlpriv->usb_data); | ||
1028 | rtlpriv->cfg->ops->deinit_sw_leds(hw); | 1026 | rtlpriv->cfg->ops->deinit_sw_leds(hw); |
1029 | rtlpriv->cfg->ops->deinit_sw_vars(hw); | 1027 | rtlpriv->cfg->ops->deinit_sw_vars(hw); |
1030 | _rtl_usb_io_handler_release(hw); | 1028 | _rtl_usb_io_handler_release(hw); |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index b591614c3b9b..28ebc69218a3 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -67,7 +67,7 @@ | |||
67 | #define QOS_QUEUE_NUM 4 | 67 | #define QOS_QUEUE_NUM 4 |
68 | #define RTL_MAC80211_NUM_QUEUE 5 | 68 | #define RTL_MAC80211_NUM_QUEUE 5 |
69 | #define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 | 69 | #define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 |
70 | 70 | #define RTL_USB_MAX_RX_COUNT 100 | |
71 | #define QBSS_LOAD_SIZE 5 | 71 | #define QBSS_LOAD_SIZE 5 |
72 | #define MAX_WMMELE_LENGTH 64 | 72 | #define MAX_WMMELE_LENGTH 64 |
73 | 73 | ||
@@ -1629,6 +1629,10 @@ struct rtl_priv { | |||
1629 | interface or hardware */ | 1629 | interface or hardware */ |
1630 | unsigned long status; | 1630 | unsigned long status; |
1631 | 1631 | ||
1632 | /* data buffer pointer for USB reads */ | ||
1633 | __le32 *usb_data; | ||
1634 | int usb_data_index; | ||
1635 | |||
1632 | /*This must be the last item so | 1636 | /*This must be the last item so |
1633 | that it points to the data allocated | 1637 | that it points to the data allocated |
1634 | beyond this structure like: | 1638 | beyond this structure like: |
diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c index bba81216b4db..bf984b6dc477 100644 --- a/drivers/of/gpio.c +++ b/drivers/of/gpio.c | |||
@@ -140,7 +140,7 @@ int of_gpio_simple_xlate(struct gpio_chip *gc, | |||
140 | if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) | 140 | if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) |
141 | return -EINVAL; | 141 | return -EINVAL; |
142 | 142 | ||
143 | if (gpiospec->args[0] > gc->ngpio) | 143 | if (gpiospec->args[0] >= gc->ngpio) |
144 | return -EINVAL; | 144 | return -EINVAL; |
145 | 145 | ||
146 | if (flags) | 146 | if (flags) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 815674415267..111569ccab43 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -967,16 +967,59 @@ pci_save_state(struct pci_dev *dev) | |||
967 | return 0; | 967 | return 0; |
968 | } | 968 | } |
969 | 969 | ||
970 | static void pci_restore_config_dword(struct pci_dev *pdev, int offset, | ||
971 | u32 saved_val, int retry) | ||
972 | { | ||
973 | u32 val; | ||
974 | |||
975 | pci_read_config_dword(pdev, offset, &val); | ||
976 | if (val == saved_val) | ||
977 | return; | ||
978 | |||
979 | for (;;) { | ||
980 | dev_dbg(&pdev->dev, "restoring config space at offset " | ||
981 | "%#x (was %#x, writing %#x)\n", offset, val, saved_val); | ||
982 | pci_write_config_dword(pdev, offset, saved_val); | ||
983 | if (retry-- <= 0) | ||
984 | return; | ||
985 | |||
986 | pci_read_config_dword(pdev, offset, &val); | ||
987 | if (val == saved_val) | ||
988 | return; | ||
989 | |||
990 | mdelay(1); | ||
991 | } | ||
992 | } | ||
993 | |||
994 | static void pci_restore_config_space_range(struct pci_dev *pdev, | ||
995 | int start, int end, int retry) | ||
996 | { | ||
997 | int index; | ||
998 | |||
999 | for (index = end; index >= start; index--) | ||
1000 | pci_restore_config_dword(pdev, 4 * index, | ||
1001 | pdev->saved_config_space[index], | ||
1002 | retry); | ||
1003 | } | ||
1004 | |||
1005 | static void pci_restore_config_space(struct pci_dev *pdev) | ||
1006 | { | ||
1007 | if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) { | ||
1008 | pci_restore_config_space_range(pdev, 10, 15, 0); | ||
1009 | /* Restore BARs before the command register. */ | ||
1010 | pci_restore_config_space_range(pdev, 4, 9, 10); | ||
1011 | pci_restore_config_space_range(pdev, 0, 3, 0); | ||
1012 | } else { | ||
1013 | pci_restore_config_space_range(pdev, 0, 15, 0); | ||
1014 | } | ||
1015 | } | ||
1016 | |||
970 | /** | 1017 | /** |
971 | * pci_restore_state - Restore the saved state of a PCI device | 1018 | * pci_restore_state - Restore the saved state of a PCI device |
972 | * @dev: - PCI device that we're dealing with | 1019 | * @dev: - PCI device that we're dealing with |
973 | */ | 1020 | */ |
974 | void pci_restore_state(struct pci_dev *dev) | 1021 | void pci_restore_state(struct pci_dev *dev) |
975 | { | 1022 | { |
976 | int i; | ||
977 | u32 val; | ||
978 | int tries; | ||
979 | |||
980 | if (!dev->state_saved) | 1023 | if (!dev->state_saved) |
981 | return; | 1024 | return; |
982 | 1025 | ||
@@ -984,24 +1027,8 @@ void pci_restore_state(struct pci_dev *dev) | |||
984 | pci_restore_pcie_state(dev); | 1027 | pci_restore_pcie_state(dev); |
985 | pci_restore_ats_state(dev); | 1028 | pci_restore_ats_state(dev); |
986 | 1029 | ||
987 | /* | 1030 | pci_restore_config_space(dev); |
988 | * The Base Address register should be programmed before the command | 1031 | |
989 | * register(s) | ||
990 | */ | ||
991 | for (i = 15; i >= 0; i--) { | ||
992 | pci_read_config_dword(dev, i * 4, &val); | ||
993 | tries = 10; | ||
994 | while (tries && val != dev->saved_config_space[i]) { | ||
995 | dev_dbg(&dev->dev, "restoring config " | ||
996 | "space at offset %#x (was %#x, writing %#x)\n", | ||
997 | i, val, (int)dev->saved_config_space[i]); | ||
998 | pci_write_config_dword(dev,i * 4, | ||
999 | dev->saved_config_space[i]); | ||
1000 | pci_read_config_dword(dev, i * 4, &val); | ||
1001 | mdelay(10); | ||
1002 | tries--; | ||
1003 | } | ||
1004 | } | ||
1005 | pci_restore_pcix_state(dev); | 1032 | pci_restore_pcix_state(dev); |
1006 | pci_restore_msi_state(dev); | 1033 | pci_restore_msi_state(dev); |
1007 | pci_restore_iov_state(dev); | 1034 | pci_restore_iov_state(dev); |
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index ec3b8cc188af..df6296c5f47b 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -908,10 +908,6 @@ static int pinctrl_groups_show(struct seq_file *s, void *what) | |||
908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | 908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; |
909 | unsigned selector = 0; | 909 | unsigned selector = 0; |
910 | 910 | ||
911 | /* No grouping */ | ||
912 | if (!ops) | ||
913 | return 0; | ||
914 | |||
915 | mutex_lock(&pinctrl_mutex); | 911 | mutex_lock(&pinctrl_mutex); |
916 | 912 | ||
917 | seq_puts(s, "registered pin groups:\n"); | 913 | seq_puts(s, "registered pin groups:\n"); |
@@ -1225,6 +1221,19 @@ static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev) | |||
1225 | 1221 | ||
1226 | #endif | 1222 | #endif |
1227 | 1223 | ||
1224 | static int pinctrl_check_ops(struct pinctrl_dev *pctldev) | ||
1225 | { | ||
1226 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | ||
1227 | |||
1228 | if (!ops || | ||
1229 | !ops->list_groups || | ||
1230 | !ops->get_group_name || | ||
1231 | !ops->get_group_pins) | ||
1232 | return -EINVAL; | ||
1233 | |||
1234 | return 0; | ||
1235 | } | ||
1236 | |||
1228 | /** | 1237 | /** |
1229 | * pinctrl_register() - register a pin controller device | 1238 | * pinctrl_register() - register a pin controller device |
1230 | * @pctldesc: descriptor for this pin controller | 1239 | * @pctldesc: descriptor for this pin controller |
@@ -1256,6 +1265,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
1256 | INIT_LIST_HEAD(&pctldev->gpio_ranges); | 1265 | INIT_LIST_HEAD(&pctldev->gpio_ranges); |
1257 | pctldev->dev = dev; | 1266 | pctldev->dev = dev; |
1258 | 1267 | ||
1268 | /* check core ops for sanity */ | ||
1269 | ret = pinctrl_check_ops(pctldev); | ||
1270 | if (ret) { | ||
1271 | pr_err("%s pinctrl ops lacks necessary functions\n", | ||
1272 | pctldesc->name); | ||
1273 | goto out_err; | ||
1274 | } | ||
1275 | |||
1259 | /* If we're implementing pinmuxing, check the ops for sanity */ | 1276 | /* If we're implementing pinmuxing, check the ops for sanity */ |
1260 | if (pctldesc->pmxops) { | 1277 | if (pctldesc->pmxops) { |
1261 | ret = pinmux_check_ops(pctldev); | 1278 | ret = pinmux_check_ops(pctldev); |
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 53969af17558..81fd606e47bc 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
@@ -214,7 +214,7 @@ static struct of_device_id __devinitdata of_anatop_regulator_match_tbl[] = { | |||
214 | { /* end */ } | 214 | { /* end */ } |
215 | }; | 215 | }; |
216 | 216 | ||
217 | static struct platform_driver anatop_regulator = { | 217 | static struct platform_driver anatop_regulator_driver = { |
218 | .driver = { | 218 | .driver = { |
219 | .name = "anatop_regulator", | 219 | .name = "anatop_regulator", |
220 | .owner = THIS_MODULE, | 220 | .owner = THIS_MODULE, |
@@ -226,13 +226,13 @@ static struct platform_driver anatop_regulator = { | |||
226 | 226 | ||
227 | static int __init anatop_regulator_init(void) | 227 | static int __init anatop_regulator_init(void) |
228 | { | 228 | { |
229 | return platform_driver_register(&anatop_regulator); | 229 | return platform_driver_register(&anatop_regulator_driver); |
230 | } | 230 | } |
231 | postcore_initcall(anatop_regulator_init); | 231 | postcore_initcall(anatop_regulator_init); |
232 | 232 | ||
233 | static void __exit anatop_regulator_exit(void) | 233 | static void __exit anatop_regulator_exit(void) |
234 | { | 234 | { |
235 | platform_driver_unregister(&anatop_regulator); | 235 | platform_driver_unregister(&anatop_regulator_driver); |
236 | } | 236 | } |
237 | module_exit(anatop_regulator_exit); | 237 | module_exit(anatop_regulator_exit); |
238 | 238 | ||
diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 550292304b0f..c9f890b088da 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c | |||
@@ -213,7 +213,6 @@ static struct platform_driver efi_rtc_driver = { | |||
213 | .name = "rtc-efi", | 213 | .name = "rtc-efi", |
214 | .owner = THIS_MODULE, | 214 | .owner = THIS_MODULE, |
215 | }, | 215 | }, |
216 | .probe = efi_rtc_probe, | ||
217 | .remove = __exit_p(efi_rtc_remove), | 216 | .remove = __exit_p(efi_rtc_remove), |
218 | }; | 217 | }; |
219 | 218 | ||
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 692de7360e94..684ef4bbfce4 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
@@ -339,8 +339,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
339 | dev_dbg(&adev->dev, "revision = 0x%01x\n", ldata->hw_revision); | 339 | dev_dbg(&adev->dev, "revision = 0x%01x\n", ldata->hw_revision); |
340 | 340 | ||
341 | /* Enable the clockwatch on ST Variants */ | 341 | /* Enable the clockwatch on ST Variants */ |
342 | if ((ldata->hw_designer == AMBA_VENDOR_ST) && | 342 | if (ldata->hw_designer == AMBA_VENDOR_ST) |
343 | (ldata->hw_revision > 1)) | ||
344 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, | 343 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, |
345 | ldata->base + RTC_CR); | 344 | ldata->base + RTC_CR); |
346 | 345 | ||
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index 7f8e6c247935..33b6ba0afa0d 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c | |||
@@ -122,6 +122,7 @@ static const struct rtc_class_ops r9701_rtc_ops = { | |||
122 | static int __devinit r9701_probe(struct spi_device *spi) | 122 | static int __devinit r9701_probe(struct spi_device *spi) |
123 | { | 123 | { |
124 | struct rtc_device *rtc; | 124 | struct rtc_device *rtc; |
125 | struct rtc_time dt; | ||
125 | unsigned char tmp; | 126 | unsigned char tmp; |
126 | int res; | 127 | int res; |
127 | 128 | ||
@@ -132,6 +133,27 @@ static int __devinit r9701_probe(struct spi_device *spi) | |||
132 | return -ENODEV; | 133 | return -ENODEV; |
133 | } | 134 | } |
134 | 135 | ||
136 | /* | ||
137 | * The device seems to be present. Now check if the registers | ||
138 | * contain invalid values. If so, try to write a default date: | ||
139 | * 2000/1/1 00:00:00 | ||
140 | */ | ||
141 | r9701_get_datetime(&spi->dev, &dt); | ||
142 | if (rtc_valid_tm(&dt)) { | ||
143 | dev_info(&spi->dev, "trying to repair invalid date/time\n"); | ||
144 | dt.tm_sec = 0; | ||
145 | dt.tm_min = 0; | ||
146 | dt.tm_hour = 0; | ||
147 | dt.tm_mday = 1; | ||
148 | dt.tm_mon = 0; | ||
149 | dt.tm_year = 100; | ||
150 | |||
151 | if (r9701_set_datetime(&spi->dev, &dt)) { | ||
152 | dev_err(&spi->dev, "cannot repair RTC register\n"); | ||
153 | return -ENODEV; | ||
154 | } | ||
155 | } | ||
156 | |||
135 | rtc = rtc_device_register("r9701", | 157 | rtc = rtc_device_register("r9701", |
136 | &spi->dev, &r9701_rtc_ops, THIS_MODULE); | 158 | &spi->dev, &r9701_rtc_ops, THIS_MODULE); |
137 | if (IS_ERR(rtc)) | 159 | if (IS_ERR(rtc)) |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 9ccea134a996..3f3a29752369 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -40,6 +40,10 @@ enum s3c_cpu_type { | |||
40 | TYPE_S3C64XX, | 40 | TYPE_S3C64XX, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | struct s3c_rtc_drv_data { | ||
44 | int cpu_type; | ||
45 | }; | ||
46 | |||
43 | /* I have yet to find an S3C implementation with more than one | 47 | /* I have yet to find an S3C implementation with more than one |
44 | * of these rtc blocks in */ | 48 | * of these rtc blocks in */ |
45 | 49 | ||
@@ -446,10 +450,12 @@ static const struct of_device_id s3c_rtc_dt_match[]; | |||
446 | static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) | 450 | static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) |
447 | { | 451 | { |
448 | #ifdef CONFIG_OF | 452 | #ifdef CONFIG_OF |
453 | struct s3c_rtc_drv_data *data; | ||
449 | if (pdev->dev.of_node) { | 454 | if (pdev->dev.of_node) { |
450 | const struct of_device_id *match; | 455 | const struct of_device_id *match; |
451 | match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); | 456 | match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); |
452 | return match->data; | 457 | data = (struct s3c_rtc_drv_data *) match->data; |
458 | return data->cpu_type; | ||
453 | } | 459 | } |
454 | #endif | 460 | #endif |
455 | return platform_get_device_id(pdev)->driver_data; | 461 | return platform_get_device_id(pdev)->driver_data; |
@@ -664,20 +670,27 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
664 | #define s3c_rtc_resume NULL | 670 | #define s3c_rtc_resume NULL |
665 | #endif | 671 | #endif |
666 | 672 | ||
673 | static struct s3c_rtc_drv_data s3c_rtc_drv_data_array[] = { | ||
674 | [TYPE_S3C2410] = { TYPE_S3C2410 }, | ||
675 | [TYPE_S3C2416] = { TYPE_S3C2416 }, | ||
676 | [TYPE_S3C2443] = { TYPE_S3C2443 }, | ||
677 | [TYPE_S3C64XX] = { TYPE_S3C64XX }, | ||
678 | }; | ||
679 | |||
667 | #ifdef CONFIG_OF | 680 | #ifdef CONFIG_OF |
668 | static const struct of_device_id s3c_rtc_dt_match[] = { | 681 | static const struct of_device_id s3c_rtc_dt_match[] = { |
669 | { | 682 | { |
670 | .compatible = "samsung,s3c2410-rtc" | 683 | .compatible = "samsung,s3c2410-rtc", |
671 | .data = TYPE_S3C2410, | 684 | .data = &s3c_rtc_drv_data_array[TYPE_S3C2410], |
672 | }, { | 685 | }, { |
673 | .compatible = "samsung,s3c2416-rtc" | 686 | .compatible = "samsung,s3c2416-rtc", |
674 | .data = TYPE_S3C2416, | 687 | .data = &s3c_rtc_drv_data_array[TYPE_S3C2416], |
675 | }, { | 688 | }, { |
676 | .compatible = "samsung,s3c2443-rtc" | 689 | .compatible = "samsung,s3c2443-rtc", |
677 | .data = TYPE_S3C2443, | 690 | .data = &s3c_rtc_drv_data_array[TYPE_S3C2443], |
678 | }, { | 691 | }, { |
679 | .compatible = "samsung,s3c6410-rtc" | 692 | .compatible = "samsung,s3c6410-rtc", |
680 | .data = TYPE_S3C64XX, | 693 | .data = &s3c_rtc_drv_data_array[TYPE_S3C64XX], |
681 | }, | 694 | }, |
682 | {}, | 695 | {}, |
683 | }; | 696 | }; |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 4c2c6df2a9ef..258abeabf624 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -112,6 +112,7 @@ static const u8 twl6030_rtc_reg_map[] = { | |||
112 | #define BIT_RTC_CTRL_REG_TEST_MODE_M 0x10 | 112 | #define BIT_RTC_CTRL_REG_TEST_MODE_M 0x10 |
113 | #define BIT_RTC_CTRL_REG_SET_32_COUNTER_M 0x20 | 113 | #define BIT_RTC_CTRL_REG_SET_32_COUNTER_M 0x20 |
114 | #define BIT_RTC_CTRL_REG_GET_TIME_M 0x40 | 114 | #define BIT_RTC_CTRL_REG_GET_TIME_M 0x40 |
115 | #define BIT_RTC_CTRL_REG_RTC_V_OPT 0x80 | ||
115 | 116 | ||
116 | /* RTC_STATUS_REG bitfields */ | 117 | /* RTC_STATUS_REG bitfields */ |
117 | #define BIT_RTC_STATUS_REG_RUN_M 0x02 | 118 | #define BIT_RTC_STATUS_REG_RUN_M 0x02 |
@@ -235,25 +236,57 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
235 | unsigned char rtc_data[ALL_TIME_REGS + 1]; | 236 | unsigned char rtc_data[ALL_TIME_REGS + 1]; |
236 | int ret; | 237 | int ret; |
237 | u8 save_control; | 238 | u8 save_control; |
239 | u8 rtc_control; | ||
238 | 240 | ||
239 | ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG); | 241 | ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG); |
240 | if (ret < 0) | 242 | if (ret < 0) { |
243 | dev_err(dev, "%s: reading CTRL_REG, error %d\n", __func__, ret); | ||
241 | return ret; | 244 | return ret; |
245 | } | ||
246 | /* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */ | ||
247 | if (twl_class_is_6030()) { | ||
248 | if (save_control & BIT_RTC_CTRL_REG_GET_TIME_M) { | ||
249 | save_control &= ~BIT_RTC_CTRL_REG_GET_TIME_M; | ||
250 | ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); | ||
251 | if (ret < 0) { | ||
252 | dev_err(dev, "%s clr GET_TIME, error %d\n", | ||
253 | __func__, ret); | ||
254 | return ret; | ||
255 | } | ||
256 | } | ||
257 | } | ||
242 | 258 | ||
243 | save_control |= BIT_RTC_CTRL_REG_GET_TIME_M; | 259 | /* Copy RTC counting registers to static registers or latches */ |
260 | rtc_control = save_control | BIT_RTC_CTRL_REG_GET_TIME_M; | ||
244 | 261 | ||
245 | ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); | 262 | /* for twl6030/32 enable read access to static shadowed registers */ |
246 | if (ret < 0) | 263 | if (twl_class_is_6030()) |
264 | rtc_control |= BIT_RTC_CTRL_REG_RTC_V_OPT; | ||
265 | |||
266 | ret = twl_rtc_write_u8(rtc_control, REG_RTC_CTRL_REG); | ||
267 | if (ret < 0) { | ||
268 | dev_err(dev, "%s: writing CTRL_REG, error %d\n", __func__, ret); | ||
247 | return ret; | 269 | return ret; |
270 | } | ||
248 | 271 | ||
249 | ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data, | 272 | ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data, |
250 | (rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS); | 273 | (rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS); |
251 | 274 | ||
252 | if (ret < 0) { | 275 | if (ret < 0) { |
253 | dev_err(dev, "rtc_read_time error %d\n", ret); | 276 | dev_err(dev, "%s: reading data, error %d\n", __func__, ret); |
254 | return ret; | 277 | return ret; |
255 | } | 278 | } |
256 | 279 | ||
280 | /* for twl6030 restore original state of rtc control register */ | ||
281 | if (twl_class_is_6030()) { | ||
282 | ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); | ||
283 | if (ret < 0) { | ||
284 | dev_err(dev, "%s: restore CTRL_REG, error %d\n", | ||
285 | __func__, ret); | ||
286 | return ret; | ||
287 | } | ||
288 | } | ||
289 | |||
257 | tm->tm_sec = bcd2bin(rtc_data[0]); | 290 | tm->tm_sec = bcd2bin(rtc_data[0]); |
258 | tm->tm_min = bcd2bin(rtc_data[1]); | 291 | tm->tm_min = bcd2bin(rtc_data[1]); |
259 | tm->tm_hour = bcd2bin(rtc_data[2]); | 292 | tm->tm_hour = bcd2bin(rtc_data[2]); |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index c21871a4e73d..bc2e8a7c265b 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -2844,6 +2844,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2844 | sector_t recid, trkid; | 2844 | sector_t recid, trkid; |
2845 | unsigned int offs; | 2845 | unsigned int offs; |
2846 | unsigned int count, count_to_trk_end; | 2846 | unsigned int count, count_to_trk_end; |
2847 | int ret; | ||
2847 | 2848 | ||
2848 | basedev = block->base; | 2849 | basedev = block->base; |
2849 | if (rq_data_dir(req) == READ) { | 2850 | if (rq_data_dir(req) == READ) { |
@@ -2884,8 +2885,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2884 | 2885 | ||
2885 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); | 2886 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); |
2886 | if (IS_ERR(itcw)) { | 2887 | if (IS_ERR(itcw)) { |
2887 | dasd_sfree_request(cqr, startdev); | 2888 | ret = -EINVAL; |
2888 | return ERR_PTR(-EINVAL); | 2889 | goto out_error; |
2889 | } | 2890 | } |
2890 | cqr->cpaddr = itcw_get_tcw(itcw); | 2891 | cqr->cpaddr = itcw_get_tcw(itcw); |
2891 | if (prepare_itcw(itcw, first_trk, last_trk, | 2892 | if (prepare_itcw(itcw, first_trk, last_trk, |
@@ -2897,8 +2898,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2897 | /* Clock not in sync and XRC is enabled. | 2898 | /* Clock not in sync and XRC is enabled. |
2898 | * Try again later. | 2899 | * Try again later. |
2899 | */ | 2900 | */ |
2900 | dasd_sfree_request(cqr, startdev); | 2901 | ret = -EAGAIN; |
2901 | return ERR_PTR(-EAGAIN); | 2902 | goto out_error; |
2902 | } | 2903 | } |
2903 | len_to_track_end = 0; | 2904 | len_to_track_end = 0; |
2904 | /* | 2905 | /* |
@@ -2937,8 +2938,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2937 | tidaw_flags = 0; | 2938 | tidaw_flags = 0; |
2938 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, | 2939 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, |
2939 | dst, part_len); | 2940 | dst, part_len); |
2940 | if (IS_ERR(last_tidaw)) | 2941 | if (IS_ERR(last_tidaw)) { |
2941 | return ERR_PTR(-EINVAL); | 2942 | ret = -EINVAL; |
2943 | goto out_error; | ||
2944 | } | ||
2942 | dst += part_len; | 2945 | dst += part_len; |
2943 | } | 2946 | } |
2944 | } | 2947 | } |
@@ -2947,8 +2950,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2947 | dst = page_address(bv->bv_page) + bv->bv_offset; | 2950 | dst = page_address(bv->bv_page) + bv->bv_offset; |
2948 | last_tidaw = itcw_add_tidaw(itcw, 0x00, | 2951 | last_tidaw = itcw_add_tidaw(itcw, 0x00, |
2949 | dst, bv->bv_len); | 2952 | dst, bv->bv_len); |
2950 | if (IS_ERR(last_tidaw)) | 2953 | if (IS_ERR(last_tidaw)) { |
2951 | return ERR_PTR(-EINVAL); | 2954 | ret = -EINVAL; |
2955 | goto out_error; | ||
2956 | } | ||
2952 | } | 2957 | } |
2953 | } | 2958 | } |
2954 | last_tidaw->flags |= TIDAW_FLAGS_LAST; | 2959 | last_tidaw->flags |= TIDAW_FLAGS_LAST; |
@@ -2968,6 +2973,9 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2968 | cqr->buildclk = get_clock(); | 2973 | cqr->buildclk = get_clock(); |
2969 | cqr->status = DASD_CQR_FILLED; | 2974 | cqr->status = DASD_CQR_FILLED; |
2970 | return cqr; | 2975 | return cqr; |
2976 | out_error: | ||
2977 | dasd_sfree_request(cqr, startdev); | ||
2978 | return ERR_PTR(ret); | ||
2971 | } | 2979 | } |
2972 | 2980 | ||
2973 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, | 2981 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, |
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index 85f4a9a5d12e..73bef0bd394c 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c | |||
@@ -903,7 +903,7 @@ static int ur_set_online(struct ccw_device *cdev) | |||
903 | goto fail_urdev_put; | 903 | goto fail_urdev_put; |
904 | } | 904 | } |
905 | 905 | ||
906 | cdev_init(urd->char_device, &ur_fops); | 906 | urd->char_device->ops = &ur_fops; |
907 | urd->char_device->dev = MKDEV(major, minor); | 907 | urd->char_device->dev = MKDEV(major, minor); |
908 | urd->char_device->owner = ur_fops.owner; | 908 | urd->char_device->owner = ur_fops.owner; |
909 | 909 | ||
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 2cfcbffa41fd..386f0c53bea7 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -835,7 +835,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, | |||
835 | 835 | ||
836 | scsi_eh_restore_cmnd(scmd, &ses); | 836 | scsi_eh_restore_cmnd(scmd, &ses); |
837 | 837 | ||
838 | if (sdrv->eh_action) | 838 | if (sdrv && sdrv->eh_action) |
839 | rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn); | 839 | rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn); |
840 | 840 | ||
841 | return rtn; | 841 | return rtn; |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 31bfba805cf4..9b2901feaf78 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -653,7 +653,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
653 | dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n", | 653 | dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n", |
654 | rx_buf_count); | 654 | rx_buf_count); |
655 | if (t->tx_buf) | 655 | if (t->tx_buf) |
656 | dma_unmap_single(NULL, t->tx_dma, t->len, | 656 | dma_unmap_single(&spi->dev, t->tx_dma, t->len, |
657 | DMA_TO_DEVICE); | 657 | DMA_TO_DEVICE); |
658 | return -ENOMEM; | 658 | return -ENOMEM; |
659 | } | 659 | } |
@@ -692,10 +692,10 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
692 | if (spicfg->io_type == SPI_IO_TYPE_DMA) { | 692 | if (spicfg->io_type == SPI_IO_TYPE_DMA) { |
693 | 693 | ||
694 | if (t->tx_buf) | 694 | if (t->tx_buf) |
695 | dma_unmap_single(NULL, t->tx_dma, t->len, | 695 | dma_unmap_single(&spi->dev, t->tx_dma, t->len, |
696 | DMA_TO_DEVICE); | 696 | DMA_TO_DEVICE); |
697 | 697 | ||
698 | dma_unmap_single(NULL, t->rx_dma, rx_buf_count, | 698 | dma_unmap_single(&spi->dev, t->rx_dma, rx_buf_count, |
699 | DMA_FROM_DEVICE); | 699 | DMA_FROM_DEVICE); |
700 | 700 | ||
701 | clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN); | 701 | clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN); |
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 24cacff57786..5f748c0d96bd 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct spi_device *spi) | |||
139 | static void fsl_spi_chipselect(struct spi_device *spi, int value) | 139 | static void fsl_spi_chipselect(struct spi_device *spi, int value) |
140 | { | 140 | { |
141 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | 141 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); |
142 | struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data; | 142 | struct fsl_spi_platform_data *pdata; |
143 | bool pol = spi->mode & SPI_CS_HIGH; | 143 | bool pol = spi->mode & SPI_CS_HIGH; |
144 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 144 | struct spi_mpc8xxx_cs *cs = spi->controller_state; |
145 | 145 | ||
146 | pdata = spi->dev.parent->parent->platform_data; | ||
147 | |||
146 | if (value == BITBANG_CS_INACTIVE) { | 148 | if (value == BITBANG_CS_INACTIVE) { |
147 | if (pdata->cs_control) | 149 | if (pdata->cs_control) |
148 | pdata->cs_control(spi, !pol); | 150 | pdata->cs_control(spi, !pol); |
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 31054e3de4c1..570f22053be8 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -83,7 +83,7 @@ struct spi_imx_data { | |||
83 | struct spi_bitbang bitbang; | 83 | struct spi_bitbang bitbang; |
84 | 84 | ||
85 | struct completion xfer_done; | 85 | struct completion xfer_done; |
86 | void *base; | 86 | void __iomem *base; |
87 | int irq; | 87 | int irq; |
88 | struct clk *clk; | 88 | struct clk *clk; |
89 | unsigned long spi_clk; | 89 | unsigned long spi_clk; |
@@ -766,8 +766,12 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
766 | } | 766 | } |
767 | 767 | ||
768 | ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs); | 768 | ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs); |
769 | if (ret < 0) | 769 | if (ret < 0) { |
770 | num_cs = mxc_platform_info->num_chipselect; | 770 | if (mxc_platform_info) |
771 | num_cs = mxc_platform_info->num_chipselect; | ||
772 | else | ||
773 | return ret; | ||
774 | } | ||
771 | 775 | ||
772 | master = spi_alloc_master(&pdev->dev, | 776 | master = spi_alloc_master(&pdev->dev, |
773 | sizeof(struct spi_imx_data) + sizeof(int) * num_cs); | 777 | sizeof(struct spi_imx_data) + sizeof(int) * num_cs); |
@@ -784,7 +788,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
784 | 788 | ||
785 | for (i = 0; i < master->num_chipselect; i++) { | 789 | for (i = 0; i < master->num_chipselect; i++) { |
786 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); | 790 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); |
787 | if (cs_gpio < 0) | 791 | if (cs_gpio < 0 && mxc_platform_info) |
788 | cs_gpio = mxc_platform_info->chipselect[i]; | 792 | cs_gpio = mxc_platform_info->chipselect[i]; |
789 | 793 | ||
790 | spi_imx->chipselect[i] = cs_gpio; | 794 | spi_imx->chipselect[i] = cs_gpio; |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 96f0da66b185..09c925aaf320 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -2195,7 +2195,6 @@ static int pl022_runtime_suspend(struct device *dev) | |||
2195 | struct pl022 *pl022 = dev_get_drvdata(dev); | 2195 | struct pl022 *pl022 = dev_get_drvdata(dev); |
2196 | 2196 | ||
2197 | clk_disable(pl022->clk); | 2197 | clk_disable(pl022->clk); |
2198 | amba_vcore_disable(pl022->adev); | ||
2199 | 2198 | ||
2200 | return 0; | 2199 | return 0; |
2201 | } | 2200 | } |
@@ -2204,7 +2203,6 @@ static int pl022_runtime_resume(struct device *dev) | |||
2204 | { | 2203 | { |
2205 | struct pl022 *pl022 = dev_get_drvdata(dev); | 2204 | struct pl022 *pl022 = dev_get_drvdata(dev); |
2206 | 2205 | ||
2207 | amba_vcore_enable(pl022->adev); | ||
2208 | clk_enable(pl022->clk); | 2206 | clk_enable(pl022->clk); |
2209 | 2207 | ||
2210 | return 0; | 2208 | return 0; |
diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 08a3b1133d29..eb1dee26bda3 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig | |||
@@ -27,13 +27,14 @@ config ANDROID_LOGGER | |||
27 | 27 | ||
28 | config ANDROID_PERSISTENT_RAM | 28 | config ANDROID_PERSISTENT_RAM |
29 | bool | 29 | bool |
30 | depends on HAVE_MEMBLOCK | ||
30 | select REED_SOLOMON | 31 | select REED_SOLOMON |
31 | select REED_SOLOMON_ENC8 | 32 | select REED_SOLOMON_ENC8 |
32 | select REED_SOLOMON_DEC8 | 33 | select REED_SOLOMON_DEC8 |
33 | 34 | ||
34 | config ANDROID_RAM_CONSOLE | 35 | config ANDROID_RAM_CONSOLE |
35 | bool "Android RAM buffer console" | 36 | bool "Android RAM buffer console" |
36 | depends on !S390 && !UML | 37 | depends on !S390 && !UML && HAVE_MEMBLOCK |
37 | select ANDROID_PERSISTENT_RAM | 38 | select ANDROID_PERSISTENT_RAM |
38 | default n | 39 | default n |
39 | 40 | ||
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 052b43e4e505..b91e4bc332a7 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c | |||
@@ -55,7 +55,6 @@ static int lowmem_minfree[6] = { | |||
55 | }; | 55 | }; |
56 | static int lowmem_minfree_size = 4; | 56 | static int lowmem_minfree_size = 4; |
57 | 57 | ||
58 | static struct task_struct *lowmem_deathpending; | ||
59 | static unsigned long lowmem_deathpending_timeout; | 58 | static unsigned long lowmem_deathpending_timeout; |
60 | 59 | ||
61 | #define lowmem_print(level, x...) \ | 60 | #define lowmem_print(level, x...) \ |
@@ -64,24 +63,6 @@ static unsigned long lowmem_deathpending_timeout; | |||
64 | printk(x); \ | 63 | printk(x); \ |
65 | } while (0) | 64 | } while (0) |
66 | 65 | ||
67 | static int | ||
68 | task_notify_func(struct notifier_block *self, unsigned long val, void *data); | ||
69 | |||
70 | static struct notifier_block task_nb = { | ||
71 | .notifier_call = task_notify_func, | ||
72 | }; | ||
73 | |||
74 | static int | ||
75 | task_notify_func(struct notifier_block *self, unsigned long val, void *data) | ||
76 | { | ||
77 | struct task_struct *task = data; | ||
78 | |||
79 | if (task == lowmem_deathpending) | ||
80 | lowmem_deathpending = NULL; | ||
81 | |||
82 | return NOTIFY_OK; | ||
83 | } | ||
84 | |||
85 | static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | 66 | static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) |
86 | { | 67 | { |
87 | struct task_struct *tsk; | 68 | struct task_struct *tsk; |
@@ -97,19 +78,6 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | |||
97 | int other_file = global_page_state(NR_FILE_PAGES) - | 78 | int other_file = global_page_state(NR_FILE_PAGES) - |
98 | global_page_state(NR_SHMEM); | 79 | global_page_state(NR_SHMEM); |
99 | 80 | ||
100 | /* | ||
101 | * If we already have a death outstanding, then | ||
102 | * bail out right away; indicating to vmscan | ||
103 | * that we have nothing further to offer on | ||
104 | * this pass. | ||
105 | * | ||
106 | * Note: Currently you need CONFIG_PROFILING | ||
107 | * for this to work correctly. | ||
108 | */ | ||
109 | if (lowmem_deathpending && | ||
110 | time_before_eq(jiffies, lowmem_deathpending_timeout)) | ||
111 | return 0; | ||
112 | |||
113 | if (lowmem_adj_size < array_size) | 81 | if (lowmem_adj_size < array_size) |
114 | array_size = lowmem_adj_size; | 82 | array_size = lowmem_adj_size; |
115 | if (lowmem_minfree_size < array_size) | 83 | if (lowmem_minfree_size < array_size) |
@@ -148,6 +116,12 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | |||
148 | if (!p) | 116 | if (!p) |
149 | continue; | 117 | continue; |
150 | 118 | ||
119 | if (test_tsk_thread_flag(p, TIF_MEMDIE) && | ||
120 | time_before_eq(jiffies, lowmem_deathpending_timeout)) { | ||
121 | task_unlock(p); | ||
122 | rcu_read_unlock(); | ||
123 | return 0; | ||
124 | } | ||
151 | oom_score_adj = p->signal->oom_score_adj; | 125 | oom_score_adj = p->signal->oom_score_adj; |
152 | if (oom_score_adj < min_score_adj) { | 126 | if (oom_score_adj < min_score_adj) { |
153 | task_unlock(p); | 127 | task_unlock(p); |
@@ -174,15 +148,9 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | |||
174 | lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n", | 148 | lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n", |
175 | selected->pid, selected->comm, | 149 | selected->pid, selected->comm, |
176 | selected_oom_score_adj, selected_tasksize); | 150 | selected_oom_score_adj, selected_tasksize); |
177 | /* | ||
178 | * If CONFIG_PROFILING is off, then we don't want to stall | ||
179 | * the killer by setting lowmem_deathpending. | ||
180 | */ | ||
181 | #ifdef CONFIG_PROFILING | ||
182 | lowmem_deathpending = selected; | ||
183 | lowmem_deathpending_timeout = jiffies + HZ; | 151 | lowmem_deathpending_timeout = jiffies + HZ; |
184 | #endif | ||
185 | send_sig(SIGKILL, selected, 0); | 152 | send_sig(SIGKILL, selected, 0); |
153 | set_tsk_thread_flag(selected, TIF_MEMDIE); | ||
186 | rem -= selected_tasksize; | 154 | rem -= selected_tasksize; |
187 | } | 155 | } |
188 | lowmem_print(4, "lowmem_shrink %lu, %x, return %d\n", | 156 | lowmem_print(4, "lowmem_shrink %lu, %x, return %d\n", |
@@ -198,7 +166,6 @@ static struct shrinker lowmem_shrinker = { | |||
198 | 166 | ||
199 | static int __init lowmem_init(void) | 167 | static int __init lowmem_init(void) |
200 | { | 168 | { |
201 | task_handoff_register(&task_nb); | ||
202 | register_shrinker(&lowmem_shrinker); | 169 | register_shrinker(&lowmem_shrinker); |
203 | return 0; | 170 | return 0; |
204 | } | 171 | } |
@@ -206,7 +173,6 @@ static int __init lowmem_init(void) | |||
206 | static void __exit lowmem_exit(void) | 173 | static void __exit lowmem_exit(void) |
207 | { | 174 | { |
208 | unregister_shrinker(&lowmem_shrinker); | 175 | unregister_shrinker(&lowmem_shrinker); |
209 | task_handoff_unregister(&task_nb); | ||
210 | } | 176 | } |
211 | 177 | ||
212 | module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR); | 178 | module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR); |
diff --git a/drivers/staging/android/persistent_ram.c b/drivers/staging/android/persistent_ram.c index e08f2574e30a..8d8c1e33e0ff 100644 --- a/drivers/staging/android/persistent_ram.c +++ b/drivers/staging/android/persistent_ram.c | |||
@@ -399,12 +399,12 @@ static __init | |||
399 | struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | 399 | struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) |
400 | { | 400 | { |
401 | struct persistent_ram_zone *prz; | 401 | struct persistent_ram_zone *prz; |
402 | int ret; | 402 | int ret = -ENOMEM; |
403 | 403 | ||
404 | prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL); | 404 | prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL); |
405 | if (!prz) { | 405 | if (!prz) { |
406 | pr_err("persistent_ram: failed to allocate persistent ram zone\n"); | 406 | pr_err("persistent_ram: failed to allocate persistent ram zone\n"); |
407 | return ERR_PTR(-ENOMEM); | 407 | goto err; |
408 | } | 408 | } |
409 | 409 | ||
410 | INIT_LIST_HEAD(&prz->node); | 410 | INIT_LIST_HEAD(&prz->node); |
@@ -412,13 +412,13 @@ struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | |||
412 | ret = persistent_ram_buffer_init(dev_name(dev), prz); | 412 | ret = persistent_ram_buffer_init(dev_name(dev), prz); |
413 | if (ret) { | 413 | if (ret) { |
414 | pr_err("persistent_ram: failed to initialize buffer\n"); | 414 | pr_err("persistent_ram: failed to initialize buffer\n"); |
415 | return ERR_PTR(ret); | 415 | goto err; |
416 | } | 416 | } |
417 | 417 | ||
418 | prz->ecc = ecc; | 418 | prz->ecc = ecc; |
419 | ret = persistent_ram_init_ecc(prz, prz->buffer_size); | 419 | ret = persistent_ram_init_ecc(prz, prz->buffer_size); |
420 | if (ret) | 420 | if (ret) |
421 | return ERR_PTR(ret); | 421 | goto err; |
422 | 422 | ||
423 | if (prz->buffer->sig == PERSISTENT_RAM_SIG) { | 423 | if (prz->buffer->sig == PERSISTENT_RAM_SIG) { |
424 | if (buffer_size(prz) > prz->buffer_size || | 424 | if (buffer_size(prz) > prz->buffer_size || |
@@ -442,6 +442,9 @@ struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | |||
442 | atomic_set(&prz->buffer->size, 0); | 442 | atomic_set(&prz->buffer->size, 0); |
443 | 443 | ||
444 | return prz; | 444 | return prz; |
445 | err: | ||
446 | kfree(prz); | ||
447 | return ERR_PTR(ret); | ||
445 | } | 448 | } |
446 | 449 | ||
447 | struct persistent_ram_zone * __init | 450 | struct persistent_ram_zone * __init |
diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index bc723eff11af..45c522cbe784 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c | |||
@@ -85,7 +85,7 @@ static int timed_gpio_probe(struct platform_device *pdev) | |||
85 | struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; | 85 | struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; |
86 | struct timed_gpio *cur_gpio; | 86 | struct timed_gpio *cur_gpio; |
87 | struct timed_gpio_data *gpio_data, *gpio_dat; | 87 | struct timed_gpio_data *gpio_data, *gpio_dat; |
88 | int i, j, ret = 0; | 88 | int i, ret; |
89 | 89 | ||
90 | if (!pdata) | 90 | if (!pdata) |
91 | return -EBUSY; | 91 | return -EBUSY; |
@@ -108,18 +108,12 @@ static int timed_gpio_probe(struct platform_device *pdev) | |||
108 | gpio_dat->dev.get_time = gpio_get_time; | 108 | gpio_dat->dev.get_time = gpio_get_time; |
109 | gpio_dat->dev.enable = gpio_enable; | 109 | gpio_dat->dev.enable = gpio_enable; |
110 | ret = gpio_request(cur_gpio->gpio, cur_gpio->name); | 110 | ret = gpio_request(cur_gpio->gpio, cur_gpio->name); |
111 | if (ret >= 0) { | 111 | if (ret < 0) |
112 | ret = timed_output_dev_register(&gpio_dat->dev); | 112 | goto err_out; |
113 | if (ret < 0) | 113 | ret = timed_output_dev_register(&gpio_dat->dev); |
114 | gpio_free(cur_gpio->gpio); | ||
115 | } | ||
116 | if (ret < 0) { | 114 | if (ret < 0) { |
117 | for (j = 0; j < i; j++) { | 115 | gpio_free(cur_gpio->gpio); |
118 | timed_output_dev_unregister(&gpio_data[i].dev); | 116 | goto err_out; |
119 | gpio_free(gpio_data[i].gpio); | ||
120 | } | ||
121 | kfree(gpio_data); | ||
122 | return ret; | ||
123 | } | 117 | } |
124 | 118 | ||
125 | gpio_dat->gpio = cur_gpio->gpio; | 119 | gpio_dat->gpio = cur_gpio->gpio; |
@@ -131,6 +125,15 @@ static int timed_gpio_probe(struct platform_device *pdev) | |||
131 | platform_set_drvdata(pdev, gpio_data); | 125 | platform_set_drvdata(pdev, gpio_data); |
132 | 126 | ||
133 | return 0; | 127 | return 0; |
128 | |||
129 | err_out: | ||
130 | while (--i >= 0) { | ||
131 | timed_output_dev_unregister(&gpio_data[i].dev); | ||
132 | gpio_free(gpio_data[i].gpio); | ||
133 | } | ||
134 | kfree(gpio_data); | ||
135 | |||
136 | return ret; | ||
134 | } | 137 | } |
135 | 138 | ||
136 | static int timed_gpio_remove(struct platform_device *pdev) | 139 | static int timed_gpio_remove(struct platform_device *pdev) |
diff --git a/drivers/staging/iio/inkern.c b/drivers/staging/iio/inkern.c index de2c8ea64965..ef07a02bf542 100644 --- a/drivers/staging/iio/inkern.c +++ b/drivers/staging/iio/inkern.c | |||
@@ -82,6 +82,7 @@ int iio_map_array_unregister(struct iio_dev *indio_dev, | |||
82 | ret = -ENODEV; | 82 | ret = -ENODEV; |
83 | goto error_ret; | 83 | goto error_ret; |
84 | } | 84 | } |
85 | i++; | ||
85 | } | 86 | } |
86 | error_ret: | 87 | error_ret: |
87 | mutex_unlock(&iio_map_list_lock); | 88 | mutex_unlock(&iio_map_list_lock); |
diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c index d5ddac3d8831..ebc2d0840caf 100644 --- a/drivers/staging/iio/magnetometer/ak8975.c +++ b/drivers/staging/iio/magnetometer/ak8975.c | |||
@@ -108,7 +108,8 @@ static const int ak8975_index_to_reg[] = { | |||
108 | static int ak8975_write_data(struct i2c_client *client, | 108 | static int ak8975_write_data(struct i2c_client *client, |
109 | u8 reg, u8 val, u8 mask, u8 shift) | 109 | u8 reg, u8 val, u8 mask, u8 shift) |
110 | { | 110 | { |
111 | struct ak8975_data *data = i2c_get_clientdata(client); | 111 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
112 | struct ak8975_data *data = iio_priv(indio_dev); | ||
112 | u8 regval; | 113 | u8 regval; |
113 | int ret; | 114 | int ret; |
114 | 115 | ||
@@ -159,7 +160,8 @@ static int ak8975_read_data(struct i2c_client *client, | |||
159 | */ | 160 | */ |
160 | static int ak8975_setup(struct i2c_client *client) | 161 | static int ak8975_setup(struct i2c_client *client) |
161 | { | 162 | { |
162 | struct ak8975_data *data = i2c_get_clientdata(client); | 163 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
164 | struct ak8975_data *data = iio_priv(indio_dev); | ||
163 | u8 device_id; | 165 | u8 device_id; |
164 | int ret; | 166 | int ret; |
165 | 167 | ||
@@ -509,6 +511,7 @@ static int ak8975_probe(struct i2c_client *client, | |||
509 | goto exit_gpio; | 511 | goto exit_gpio; |
510 | } | 512 | } |
511 | data = iio_priv(indio_dev); | 513 | data = iio_priv(indio_dev); |
514 | i2c_set_clientdata(client, indio_dev); | ||
512 | /* Perform some basic start-of-day setup of the device. */ | 515 | /* Perform some basic start-of-day setup of the device. */ |
513 | err = ak8975_setup(client); | 516 | err = ak8975_setup(client); |
514 | if (err < 0) { | 517 | if (err < 0) { |
@@ -516,7 +519,6 @@ static int ak8975_probe(struct i2c_client *client, | |||
516 | goto exit_free_iio; | 519 | goto exit_free_iio; |
517 | } | 520 | } |
518 | 521 | ||
519 | i2c_set_clientdata(client, indio_dev); | ||
520 | data->client = client; | 522 | data->client = client; |
521 | mutex_init(&data->lock); | 523 | mutex_init(&data->lock); |
522 | data->eoc_irq = client->irq; | 524 | data->eoc_irq = client->irq; |
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c index 91dd3da70cb4..e00b416c4d33 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.c +++ b/drivers/staging/iio/magnetometer/hmc5843.c | |||
@@ -521,7 +521,9 @@ static int hmc5843_detect(struct i2c_client *client, | |||
521 | /* Called when we have found a new HMC5843. */ | 521 | /* Called when we have found a new HMC5843. */ |
522 | static void hmc5843_init_client(struct i2c_client *client) | 522 | static void hmc5843_init_client(struct i2c_client *client) |
523 | { | 523 | { |
524 | struct hmc5843_data *data = i2c_get_clientdata(client); | 524 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
525 | struct hmc5843_data *data = iio_priv(indio_dev); | ||
526 | |||
525 | hmc5843_set_meas_conf(client, data->meas_conf); | 527 | hmc5843_set_meas_conf(client, data->meas_conf); |
526 | hmc5843_set_rate(client, data->rate); | 528 | hmc5843_set_rate(client, data->rate); |
527 | hmc5843_configure(client, data->operating_mode); | 529 | hmc5843_configure(client, data->operating_mode); |
diff --git a/drivers/staging/media/as102/as102_fw.c b/drivers/staging/media/as102/as102_fw.c index 43ebc43e6b9a..1075fb1df0d9 100644 --- a/drivers/staging/media/as102/as102_fw.c +++ b/drivers/staging/media/as102/as102_fw.c | |||
@@ -165,7 +165,7 @@ error: | |||
165 | int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap) | 165 | int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap) |
166 | { | 166 | { |
167 | int errno = -EFAULT; | 167 | int errno = -EFAULT; |
168 | const struct firmware *firmware; | 168 | const struct firmware *firmware = NULL; |
169 | unsigned char *cmd_buf = NULL; | 169 | unsigned char *cmd_buf = NULL; |
170 | char *fw1, *fw2; | 170 | char *fw1, *fw2; |
171 | struct usb_device *dev = bus_adap->usb_dev; | 171 | struct usb_device *dev = bus_adap->usb_dev; |
diff --git a/drivers/staging/omapdrm/omap_drv.c b/drivers/staging/omapdrm/omap_drv.c index 3df5b4c58ecd..620b8d54223d 100644 --- a/drivers/staging/omapdrm/omap_drv.c +++ b/drivers/staging/omapdrm/omap_drv.c | |||
@@ -803,9 +803,6 @@ static void pdev_shutdown(struct platform_device *device) | |||
803 | static int pdev_probe(struct platform_device *device) | 803 | static int pdev_probe(struct platform_device *device) |
804 | { | 804 | { |
805 | DBG("%s", device->name); | 805 | DBG("%s", device->name); |
806 | if (platform_driver_register(&omap_dmm_driver)) | ||
807 | dev_err(&device->dev, "DMM registration failed\n"); | ||
808 | |||
809 | return drm_platform_init(&omap_drm_driver, device); | 806 | return drm_platform_init(&omap_drm_driver, device); |
810 | } | 807 | } |
811 | 808 | ||
@@ -833,6 +830,10 @@ struct platform_driver pdev = { | |||
833 | static int __init omap_drm_init(void) | 830 | static int __init omap_drm_init(void) |
834 | { | 831 | { |
835 | DBG("init"); | 832 | DBG("init"); |
833 | if (platform_driver_register(&omap_dmm_driver)) { | ||
834 | /* we can continue on without DMM.. so not fatal */ | ||
835 | dev_err(NULL, "DMM registration failed\n"); | ||
836 | } | ||
836 | return platform_driver_register(&pdev); | 837 | return platform_driver_register(&pdev); |
837 | } | 838 | } |
838 | 839 | ||
diff --git a/drivers/staging/ozwpan/TODO b/drivers/staging/ozwpan/TODO index f7a9c122f596..c2d30a7112f3 100644 --- a/drivers/staging/ozwpan/TODO +++ b/drivers/staging/ozwpan/TODO | |||
@@ -8,5 +8,7 @@ TODO: | |||
8 | - code review by USB developer community. | 8 | - code review by USB developer community. |
9 | - testing with as many devices as possible. | 9 | - testing with as many devices as possible. |
10 | 10 | ||
11 | Please send any patches for this driver to Chris Kelly <ckelly@ozmodevices.com> | 11 | Please send any patches for this driver to |
12 | Rupesh Gujare <rgujare@ozmodevices.com> | ||
13 | Chris Kelly <ckelly@ozmodevices.com> | ||
12 | and Greg Kroah-Hartman <gregkh@linuxfoundation.org>. | 14 | and Greg Kroah-Hartman <gregkh@linuxfoundation.org>. |
diff --git a/drivers/staging/ramster/Kconfig b/drivers/staging/ramster/Kconfig index 8b57b87edda4..4af1f8d4b953 100644 --- a/drivers/staging/ramster/Kconfig +++ b/drivers/staging/ramster/Kconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | # Dependency on CONFIG_BROKEN is because there is a commit dependency | ||
2 | # on a cleancache naming change to be submitted by Konrad Wilk | ||
3 | # a39c00ded70339603ffe1b0ffdf3ade85bcf009a "Merge branch 'stable/cleancache.v13' | ||
4 | # into linux-next. Once this commit is present, BROKEN can be removed | ||
5 | config RAMSTER | 1 | config RAMSTER |
6 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" | 2 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" |
7 | depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM && BROKEN | 3 | depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM |
8 | select LZO_COMPRESS | 4 | select LZO_COMPRESS |
9 | select LZO_DECOMPRESS | 5 | select LZO_DECOMPRESS |
10 | default n | 6 | default n |
diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c index 66341dff8c99..f9a4498984cc 100644 --- a/drivers/staging/rts_pstor/ms.c +++ b/drivers/staging/rts_pstor/ms.c | |||
@@ -3498,7 +3498,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 | |||
3498 | 3498 | ||
3499 | log_blk++; | 3499 | log_blk++; |
3500 | 3500 | ||
3501 | for (seg_no = 0; seg_no < sizeof(ms_start_idx)/2; seg_no++) { | 3501 | for (seg_no = 0; seg_no < ARRAY_SIZE(ms_start_idx) - 1; |
3502 | seg_no++) { | ||
3502 | if (log_blk < ms_start_idx[seg_no+1]) | 3503 | if (log_blk < ms_start_idx[seg_no+1]) |
3503 | break; | 3504 | break; |
3504 | } | 3505 | } |
diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c index a7feb3e328a0..1dccd933a7e4 100644 --- a/drivers/staging/rts_pstor/rtsx.c +++ b/drivers/staging/rts_pstor/rtsx.c | |||
@@ -1000,6 +1000,11 @@ static int __devinit rtsx_probe(struct pci_dev *pci, | |||
1000 | 1000 | ||
1001 | rtsx_init_chip(dev->chip); | 1001 | rtsx_init_chip(dev->chip); |
1002 | 1002 | ||
1003 | /* set the supported max_lun and max_id for the scsi host | ||
1004 | * NOTE: the minimal value of max_id is 1 */ | ||
1005 | host->max_id = 1; | ||
1006 | host->max_lun = dev->chip->max_lun; | ||
1007 | |||
1003 | /* Start up our control thread */ | 1008 | /* Start up our control thread */ |
1004 | th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME); | 1009 | th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME); |
1005 | if (IS_ERR(th)) { | 1010 | if (IS_ERR(th)) { |
diff --git a/drivers/staging/rts_pstor/rtsx_transport.c b/drivers/staging/rts_pstor/rtsx_transport.c index 4e3d2c106af0..9b2e5c99870f 100644 --- a/drivers/staging/rts_pstor/rtsx_transport.c +++ b/drivers/staging/rts_pstor/rtsx_transport.c | |||
@@ -335,6 +335,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
335 | int sg_cnt, i, resid; | 335 | int sg_cnt, i, resid; |
336 | int err = 0; | 336 | int err = 0; |
337 | long timeleft; | 337 | long timeleft; |
338 | struct scatterlist *sg_ptr; | ||
338 | u32 val = TRIG_DMA; | 339 | u32 val = TRIG_DMA; |
339 | 340 | ||
340 | if ((sg == NULL) || (num_sg <= 0) || !offset || !index) | 341 | if ((sg == NULL) || (num_sg <= 0) || !offset || !index) |
@@ -371,7 +372,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
371 | sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); | 372 | sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); |
372 | 373 | ||
373 | resid = size; | 374 | resid = size; |
374 | 375 | sg_ptr = sg; | |
375 | chip->sgi = 0; | 376 | chip->sgi = 0; |
376 | /* Usually the next entry will be @sg@ + 1, but if this sg element | 377 | /* Usually the next entry will be @sg@ + 1, but if this sg element |
377 | * is part of a chained scatterlist, it could jump to the start of | 378 | * is part of a chained scatterlist, it could jump to the start of |
@@ -379,14 +380,14 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
379 | * the proper sg | 380 | * the proper sg |
380 | */ | 381 | */ |
381 | for (i = 0; i < *index; i++) | 382 | for (i = 0; i < *index; i++) |
382 | sg = sg_next(sg); | 383 | sg_ptr = sg_next(sg_ptr); |
383 | for (i = *index; i < sg_cnt; i++) { | 384 | for (i = *index; i < sg_cnt; i++) { |
384 | dma_addr_t addr; | 385 | dma_addr_t addr; |
385 | unsigned int len; | 386 | unsigned int len; |
386 | u8 option; | 387 | u8 option; |
387 | 388 | ||
388 | addr = sg_dma_address(sg); | 389 | addr = sg_dma_address(sg_ptr); |
389 | len = sg_dma_len(sg); | 390 | len = sg_dma_len(sg_ptr); |
390 | 391 | ||
391 | RTSX_DEBUGP("DMA addr: 0x%x, Len: 0x%x\n", | 392 | RTSX_DEBUGP("DMA addr: 0x%x, Len: 0x%x\n", |
392 | (unsigned int)addr, len); | 393 | (unsigned int)addr, len); |
@@ -415,7 +416,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
415 | if (!resid) | 416 | if (!resid) |
416 | break; | 417 | break; |
417 | 418 | ||
418 | sg = sg_next(sg); | 419 | sg_ptr = sg_next(sg_ptr); |
419 | } | 420 | } |
420 | 421 | ||
421 | RTSX_DEBUGP("SG table count = %d\n", chip->sgi); | 422 | RTSX_DEBUGP("SG table count = %d\n", chip->sgi); |
diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c index ad54c2e5c932..f1701bc6e312 100644 --- a/drivers/staging/sep/sep_main.c +++ b/drivers/staging/sep/sep_main.c | |||
@@ -3114,7 +3114,7 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
3114 | current->pid); | 3114 | current->pid); |
3115 | if (1 == test_bit(SEP_LEGACY_SENDMSG_DONE_OFFSET, | 3115 | if (1 == test_bit(SEP_LEGACY_SENDMSG_DONE_OFFSET, |
3116 | &call_status->status)) { | 3116 | &call_status->status)) { |
3117 | dev_warn(&sep->pdev->dev, | 3117 | dev_dbg(&sep->pdev->dev, |
3118 | "[PID%d] dcb prep needed before send msg\n", | 3118 | "[PID%d] dcb prep needed before send msg\n", |
3119 | current->pid); | 3119 | current->pid); |
3120 | error = -EPROTO; | 3120 | error = -EPROTO; |
@@ -3122,9 +3122,9 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
3122 | } | 3122 | } |
3123 | 3123 | ||
3124 | if (!arg) { | 3124 | if (!arg) { |
3125 | dev_warn(&sep->pdev->dev, | 3125 | dev_dbg(&sep->pdev->dev, |
3126 | "[PID%d] dcb null arg\n", current->pid); | 3126 | "[PID%d] dcb null arg\n", current->pid); |
3127 | error = EINVAL; | 3127 | error = -EINVAL; |
3128 | goto end_function; | 3128 | goto end_function; |
3129 | } | 3129 | } |
3130 | 3130 | ||
diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 9fedc442a779..573c80003f0c 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c | |||
@@ -35,10 +35,10 @@ static int vector[PIO2_CARDS_MAX]; | |||
35 | static int vector_num; | 35 | static int vector_num; |
36 | static int level[PIO2_CARDS_MAX]; | 36 | static int level[PIO2_CARDS_MAX]; |
37 | static int level_num; | 37 | static int level_num; |
38 | static const char *variant[PIO2_CARDS_MAX]; | 38 | static char *variant[PIO2_CARDS_MAX]; |
39 | static int variant_num; | 39 | static int variant_num; |
40 | 40 | ||
41 | static int loopback; | 41 | static bool loopback; |
42 | 42 | ||
43 | static int pio2_match(struct vme_dev *); | 43 | static int pio2_match(struct vme_dev *); |
44 | static int __devinit pio2_probe(struct vme_dev *); | 44 | static int __devinit pio2_probe(struct vme_dev *); |
diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c index 0ff8d7bbf2a7..774b0d4a7e06 100644 --- a/drivers/staging/vt6655/key.c +++ b/drivers/staging/vt6655/key.c | |||
@@ -655,6 +655,9 @@ bool KeybSetDefaultKey ( | |||
655 | return (false); | 655 | return (false); |
656 | } | 656 | } |
657 | 657 | ||
658 | if (uKeyLength > MAX_KEY_LEN) | ||
659 | return false; | ||
660 | |||
658 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true; | 661 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true; |
659 | for(ii=0;ii<ETH_ALEN;ii++) | 662 | for(ii=0;ii<ETH_ALEN;ii++) |
660 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; | 663 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; |
diff --git a/drivers/staging/vt6656/ioctl.c b/drivers/staging/vt6656/ioctl.c index 1463d76895f0..d59456c29df1 100644 --- a/drivers/staging/vt6656/ioctl.c +++ b/drivers/staging/vt6656/ioctl.c | |||
@@ -565,7 +565,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) | |||
565 | result = -ENOMEM; | 565 | result = -ENOMEM; |
566 | break; | 566 | break; |
567 | } | 567 | } |
568 | pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC); | 568 | pNodeList = kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC); |
569 | if (pNodeList == NULL) { | 569 | if (pNodeList == NULL) { |
570 | result = -ENOMEM; | 570 | result = -ENOMEM; |
571 | break; | 571 | break; |
@@ -601,6 +601,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) | |||
601 | } | 601 | } |
602 | } | 602 | } |
603 | if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) { | 603 | if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) { |
604 | kfree(pNodeList); | ||
604 | result = -EFAULT; | 605 | result = -EFAULT; |
605 | break; | 606 | break; |
606 | } | 607 | } |
diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 27bb523c8a97..ee62a06a75f4 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c | |||
@@ -684,6 +684,9 @@ BOOL KeybSetDefaultKey( | |||
684 | return (FALSE); | 684 | return (FALSE); |
685 | } | 685 | } |
686 | 686 | ||
687 | if (uKeyLength > MAX_KEY_LEN) | ||
688 | return false; | ||
689 | |||
687 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; | 690 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; |
688 | for (ii = 0; ii < ETH_ALEN; ii++) | 691 | for (ii = 0; ii < ETH_ALEN; ii++) |
689 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; | 692 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; |
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 94d5c35e22fb..3650bbff7686 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c | |||
@@ -61,7 +61,7 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension, | |||
61 | } | 61 | } |
62 | temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); | 62 | temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); |
63 | /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ | 63 | /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ |
64 | if ((temp & 0x88) == 0x80) | 64 | if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08)) |
65 | data = 0; /* DDR */ | 65 | data = 0; /* DDR */ |
66 | else | 66 | else |
67 | data = 1; /* DDRII */ | 67 | data = 1; /* DDRII */ |
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 2919924213c4..60d4adf99923 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c | |||
@@ -152,6 +152,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) | |||
152 | pVBInfo->pXGINew_CR97 = &XG20_CR97; | 152 | pVBInfo->pXGINew_CR97 = &XG20_CR97; |
153 | 153 | ||
154 | if (ChipType == XG27) { | 154 | if (ChipType == XG27) { |
155 | unsigned char temp; | ||
155 | pVBInfo->MCLKData | 156 | pVBInfo->MCLKData |
156 | = (struct SiS_MCLKData *) XGI27New_MCLKData; | 157 | = (struct SiS_MCLKData *) XGI27New_MCLKData; |
157 | pVBInfo->CR40 = XGI27_cr41; | 158 | pVBInfo->CR40 = XGI27_cr41; |
@@ -162,7 +163,13 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) | |||
162 | pVBInfo->pCRDE = XG27_CRDE; | 163 | pVBInfo->pCRDE = XG27_CRDE; |
163 | pVBInfo->pSR40 = &XG27_SR40; | 164 | pVBInfo->pSR40 = &XG27_SR40; |
164 | pVBInfo->pSR41 = &XG27_SR41; | 165 | pVBInfo->pSR41 = &XG27_SR41; |
166 | pVBInfo->SR15 = XG27_SR13; | ||
165 | 167 | ||
168 | /*Z11m DDR*/ | ||
169 | temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); | ||
170 | /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ | ||
171 | if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08)) | ||
172 | pVBInfo->pXGINew_CR97 = &Z11m_CR97; | ||
166 | } | 173 | } |
167 | 174 | ||
168 | if (ChipType >= XG20) { | 175 | if (ChipType >= XG20) { |
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index dddf261ed53d..e8d6f674b274 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h | |||
@@ -33,6 +33,13 @@ static struct XGI_ECLKDataStruct XGI340_ECLKData[] = { | |||
33 | {0x5c, 0x23, 0x01, 166} | 33 | {0x5c, 0x23, 0x01, 166} |
34 | }; | 34 | }; |
35 | 35 | ||
36 | static unsigned char XG27_SR13[4][8] = { | ||
37 | {0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */ | ||
38 | {0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */ | ||
39 | {0x32, 0x32, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR18 */ | ||
40 | {0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00} /* SR1B */ | ||
41 | }; | ||
42 | |||
36 | static unsigned char XGI340_SR13[4][8] = { | 43 | static unsigned char XGI340_SR13[4][8] = { |
37 | {0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */ | 44 | {0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */ |
38 | {0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */ | 45 | {0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */ |
@@ -71,7 +78,7 @@ static unsigned char XGI27_cr41[24][8] = { | |||
71 | {0x20, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0 CR41 */ | 78 | {0x20, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0 CR41 */ |
72 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 1 CR8A */ | 79 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 1 CR8A */ |
73 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 2 CR8B */ | 80 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 2 CR8B */ |
74 | {0xB5, 0x13, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 3 CR40[7], | 81 | {0xB3, 0x13, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 3 CR40[7], |
75 | CR99[2:0], | 82 | CR99[2:0], |
76 | CR45[3:0]*/ | 83 | CR45[3:0]*/ |
77 | {0xf0, 0xf5, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 4 CR59 */ | 84 | {0xf0, 0xf5, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 4 CR59 */ |
@@ -2803,6 +2810,8 @@ static unsigned char XG27_CRDE[2]; | |||
2803 | static unsigned char XG27_SR40 = 0x04 ; | 2810 | static unsigned char XG27_SR40 = 0x04 ; |
2804 | static unsigned char XG27_SR41 = 0x00 ; | 2811 | static unsigned char XG27_SR41 = 0x00 ; |
2805 | 2812 | ||
2813 | static unsigned char Z11m_CR97 = 0x80 ; | ||
2814 | |||
2806 | static struct XGI330_VCLKDataStruct XGI_VCLKData[] = { | 2815 | static struct XGI330_VCLKDataStruct XGI_VCLKData[] = { |
2807 | /* SR2B,SR2C,SR2D */ | 2816 | /* SR2B,SR2C,SR2D */ |
2808 | {0x1B, 0xE1, 25}, /* 00 (25.175MHz) */ | 2817 | {0x1B, 0xE1, 25}, /* 00 (25.175MHz) */ |
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 09caa4f2687e..917461c66014 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c | |||
@@ -267,33 +267,39 @@ static unsigned long obj_idx_to_offset(struct page *page, | |||
267 | return off + obj_idx * class_size; | 267 | return off + obj_idx * class_size; |
268 | } | 268 | } |
269 | 269 | ||
270 | static void reset_page(struct page *page) | ||
271 | { | ||
272 | clear_bit(PG_private, &page->flags); | ||
273 | clear_bit(PG_private_2, &page->flags); | ||
274 | set_page_private(page, 0); | ||
275 | page->mapping = NULL; | ||
276 | page->freelist = NULL; | ||
277 | reset_page_mapcount(page); | ||
278 | } | ||
279 | |||
270 | static void free_zspage(struct page *first_page) | 280 | static void free_zspage(struct page *first_page) |
271 | { | 281 | { |
272 | struct page *nextp, *tmp; | 282 | struct page *nextp, *tmp, *head_extra; |
273 | 283 | ||
274 | BUG_ON(!is_first_page(first_page)); | 284 | BUG_ON(!is_first_page(first_page)); |
275 | BUG_ON(first_page->inuse); | 285 | BUG_ON(first_page->inuse); |
276 | 286 | ||
277 | nextp = (struct page *)page_private(first_page); | 287 | head_extra = (struct page *)page_private(first_page); |
278 | 288 | ||
279 | clear_bit(PG_private, &first_page->flags); | 289 | reset_page(first_page); |
280 | clear_bit(PG_private_2, &first_page->flags); | ||
281 | set_page_private(first_page, 0); | ||
282 | first_page->mapping = NULL; | ||
283 | first_page->freelist = NULL; | ||
284 | reset_page_mapcount(first_page); | ||
285 | __free_page(first_page); | 290 | __free_page(first_page); |
286 | 291 | ||
287 | /* zspage with only 1 system page */ | 292 | /* zspage with only 1 system page */ |
288 | if (!nextp) | 293 | if (!head_extra) |
289 | return; | 294 | return; |
290 | 295 | ||
291 | list_for_each_entry_safe(nextp, tmp, &nextp->lru, lru) { | 296 | list_for_each_entry_safe(nextp, tmp, &head_extra->lru, lru) { |
292 | list_del(&nextp->lru); | 297 | list_del(&nextp->lru); |
293 | clear_bit(PG_private_2, &nextp->flags); | 298 | reset_page(nextp); |
294 | nextp->index = 0; | ||
295 | __free_page(nextp); | 299 | __free_page(nextp); |
296 | } | 300 | } |
301 | reset_page(head_extra); | ||
302 | __free_page(head_extra); | ||
297 | } | 303 | } |
298 | 304 | ||
299 | /* Initialize a newly allocated zspage */ | 305 | /* Initialize a newly allocated zspage */ |
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 24145c30c9b0..6cc4358f68c1 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -1073,8 +1073,10 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state, | |||
1073 | (new_serial.close_delay != port->close_delay) || | 1073 | (new_serial.close_delay != port->close_delay) || |
1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || | 1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || |
1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != | 1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != |
1076 | (port->flags & ~ASYNC_USR_MASK))) | 1076 | (port->flags & ~ASYNC_USR_MASK))) { |
1077 | tty_unlock(); | ||
1077 | return -EPERM; | 1078 | return -EPERM; |
1079 | } | ||
1078 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | | 1080 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | |
1079 | (new_serial.flags & ASYNC_USR_MASK)); | 1081 | (new_serial.flags & ASYNC_USR_MASK)); |
1080 | state->custom_divisor = new_serial.custom_divisor; | 1082 | state->custom_divisor = new_serial.custom_divisor; |
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c index 5b149b466ec8..5c27f7e6c9f1 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250.c | |||
@@ -1572,13 +1572,11 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id) | |||
1572 | do { | 1572 | do { |
1573 | struct uart_8250_port *up; | 1573 | struct uart_8250_port *up; |
1574 | struct uart_port *port; | 1574 | struct uart_port *port; |
1575 | bool skip; | ||
1576 | 1575 | ||
1577 | up = list_entry(l, struct uart_8250_port, list); | 1576 | up = list_entry(l, struct uart_8250_port, list); |
1578 | port = &up->port; | 1577 | port = &up->port; |
1579 | skip = pass_counter && up->port.flags & UPF_IIR_ONCE; | ||
1580 | 1578 | ||
1581 | if (!skip && port->handle_irq(port)) { | 1579 | if (port->handle_irq(port)) { |
1582 | handled = 1; | 1580 | handled = 1; |
1583 | end = NULL; | 1581 | end = NULL; |
1584 | } else if (end == NULL) | 1582 | } else if (end == NULL) |
@@ -2037,10 +2035,12 @@ static int serial8250_startup(struct uart_port *port) | |||
2037 | spin_unlock_irqrestore(&port->lock, flags); | 2035 | spin_unlock_irqrestore(&port->lock, flags); |
2038 | 2036 | ||
2039 | /* | 2037 | /* |
2040 | * If the interrupt is not reasserted, setup a timer to | 2038 | * If the interrupt is not reasserted, or we otherwise |
2041 | * kick the UART on a regular basis. | 2039 | * don't trust the iir, setup a timer to kick the UART |
2040 | * on a regular basis. | ||
2042 | */ | 2041 | */ |
2043 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { | 2042 | if ((!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) || |
2043 | up->port.flags & UPF_BUG_THRE) { | ||
2044 | up->bugs |= UART_BUG_THRE; | 2044 | up->bugs |= UART_BUG_THRE; |
2045 | pr_debug("ttyS%d - using backup timer\n", | 2045 | pr_debug("ttyS%d - using backup timer\n", |
2046 | serial_index(port)); | 2046 | serial_index(port)); |
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index da2b0b0a183f..858dca865d6a 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
@@ -1096,7 +1096,7 @@ static int kt_serial_setup(struct serial_private *priv, | |||
1096 | const struct pciserial_board *board, | 1096 | const struct pciserial_board *board, |
1097 | struct uart_port *port, int idx) | 1097 | struct uart_port *port, int idx) |
1098 | { | 1098 | { |
1099 | port->flags |= UPF_IIR_ONCE; | 1099 | port->flags |= UPF_BUG_THRE; |
1100 | return skip_tx_en_setup(priv, board, port, idx); | 1100 | return skip_tx_en_setup(priv, board, port, idx); |
1101 | } | 1101 | } |
1102 | 1102 | ||
@@ -1118,18 +1118,6 @@ pci_xr17c154_setup(struct serial_private *priv, | |||
1118 | return pci_default_setup(priv, board, port, idx); | 1118 | return pci_default_setup(priv, board, port, idx); |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | static int try_enable_msi(struct pci_dev *dev) | ||
1122 | { | ||
1123 | /* use msi if available, but fallback to legacy otherwise */ | ||
1124 | pci_enable_msi(dev); | ||
1125 | return 0; | ||
1126 | } | ||
1127 | |||
1128 | static void disable_msi(struct pci_dev *dev) | ||
1129 | { | ||
1130 | pci_disable_msi(dev); | ||
1131 | } | ||
1132 | |||
1133 | #define PCI_VENDOR_ID_SBSMODULARIO 0x124B | 1121 | #define PCI_VENDOR_ID_SBSMODULARIO 0x124B |
1134 | #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B | 1122 | #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B |
1135 | #define PCI_DEVICE_ID_OCTPRO 0x0001 | 1123 | #define PCI_DEVICE_ID_OCTPRO 0x0001 |
@@ -1249,9 +1237,7 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
1249 | .device = PCI_DEVICE_ID_INTEL_PATSBURG_KT, | 1237 | .device = PCI_DEVICE_ID_INTEL_PATSBURG_KT, |
1250 | .subvendor = PCI_ANY_ID, | 1238 | .subvendor = PCI_ANY_ID, |
1251 | .subdevice = PCI_ANY_ID, | 1239 | .subdevice = PCI_ANY_ID, |
1252 | .init = try_enable_msi, | ||
1253 | .setup = kt_serial_setup, | 1240 | .setup = kt_serial_setup, |
1254 | .exit = disable_msi, | ||
1255 | }, | 1241 | }, |
1256 | /* | 1242 | /* |
1257 | * ITE | 1243 | * ITE |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 665beb68f670..070b442c1f81 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1041,7 +1041,7 @@ config SERIAL_OMAP | |||
1041 | 1041 | ||
1042 | config SERIAL_OMAP_CONSOLE | 1042 | config SERIAL_OMAP_CONSOLE |
1043 | bool "Console on OMAP serial port" | 1043 | bool "Console on OMAP serial port" |
1044 | depends on SERIAL_OMAP | 1044 | depends on SERIAL_OMAP=y |
1045 | select SERIAL_CORE_CONSOLE | 1045 | select SERIAL_CORE_CONSOLE |
1046 | help | 1046 | help |
1047 | Select this option if you would like to use omap serial port as | 1047 | Select this option if you would like to use omap serial port as |
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index e7903751e058..1f0330915d5a 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
@@ -556,7 +556,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
556 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 556 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
557 | if (res_mem) | 557 | if (res_mem) |
558 | port->mapbase = res_mem->start; | 558 | port->mapbase = res_mem->start; |
559 | else if (platp->mapbase) | 559 | else if (platp) |
560 | port->mapbase = platp->mapbase; | 560 | port->mapbase = platp->mapbase; |
561 | else | 561 | else |
562 | return -EINVAL; | 562 | return -EINVAL; |
@@ -564,7 +564,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
564 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 564 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
565 | if (res_irq) | 565 | if (res_irq) |
566 | port->irq = res_irq->start; | 566 | port->irq = res_irq->start; |
567 | else if (platp->irq) | 567 | else if (platp) |
568 | port->irq = platp->irq; | 568 | port->irq = platp->irq; |
569 | 569 | ||
570 | /* Check platform data first so we can override device node data */ | 570 | /* Check platform data first so we can override device node data */ |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 0c65c9e66986..3d569cd68f58 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -1946,10 +1946,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
1946 | goto unmap; | 1946 | goto unmap; |
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | /* Ensure interrupts from this UART are masked and cleared */ | ||
1950 | writew(0, uap->port.membase + UART011_IMSC); | ||
1951 | writew(0xffff, uap->port.membase + UART011_ICR); | ||
1952 | |||
1953 | uap->vendor = vendor; | 1949 | uap->vendor = vendor; |
1954 | uap->lcrh_rx = vendor->lcrh_rx; | 1950 | uap->lcrh_rx = vendor->lcrh_rx; |
1955 | uap->lcrh_tx = vendor->lcrh_tx; | 1951 | uap->lcrh_tx = vendor->lcrh_tx; |
@@ -1967,6 +1963,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
1967 | uap->port.line = i; | 1963 | uap->port.line = i; |
1968 | pl011_dma_probe(uap); | 1964 | pl011_dma_probe(uap); |
1969 | 1965 | ||
1966 | /* Ensure interrupts from this UART are masked and cleared */ | ||
1967 | writew(0, uap->port.membase + UART011_IMSC); | ||
1968 | writew(0xffff, uap->port.membase + UART011_ICR); | ||
1969 | |||
1970 | snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev)); | 1970 | snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev)); |
1971 | 1971 | ||
1972 | amba_ports[i] = uap; | 1972 | amba_ports[i] = uap; |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index f9a6be7a9bed..3d7e1ee2fa57 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -389,6 +389,8 @@ static void atmel_start_rx(struct uart_port *port) | |||
389 | { | 389 | { |
390 | UART_PUT_CR(port, ATMEL_US_RSTSTA); /* reset status and receiver */ | 390 | UART_PUT_CR(port, ATMEL_US_RSTSTA); /* reset status and receiver */ |
391 | 391 | ||
392 | UART_PUT_CR(port, ATMEL_US_RXEN); | ||
393 | |||
392 | if (atmel_use_dma_rx(port)) { | 394 | if (atmel_use_dma_rx(port)) { |
393 | /* enable PDC controller */ | 395 | /* enable PDC controller */ |
394 | UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | | 396 | UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | |
@@ -404,6 +406,8 @@ static void atmel_start_rx(struct uart_port *port) | |||
404 | */ | 406 | */ |
405 | static void atmel_stop_rx(struct uart_port *port) | 407 | static void atmel_stop_rx(struct uart_port *port) |
406 | { | 408 | { |
409 | UART_PUT_CR(port, ATMEL_US_RXDIS); | ||
410 | |||
407 | if (atmel_use_dma_rx(port)) { | 411 | if (atmel_use_dma_rx(port)) { |
408 | /* disable PDC receive */ | 412 | /* disable PDC receive */ |
409 | UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS); | 413 | UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS); |
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index e6c3dbd781d6..836fe2731234 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
@@ -154,10 +154,9 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | |||
154 | port->x_char = 0; | 154 | port->x_char = 0; |
155 | return IRQ_HANDLED; | 155 | return IRQ_HANDLED; |
156 | } | 156 | } |
157 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { | 157 | |
158 | clps711xuart_stop_tx(port); | 158 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) |
159 | return IRQ_HANDLED; | 159 | goto disable_tx_irq; |
160 | } | ||
161 | 160 | ||
162 | count = port->fifosize >> 1; | 161 | count = port->fifosize >> 1; |
163 | do { | 162 | do { |
@@ -171,8 +170,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | |||
171 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 170 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
172 | uart_write_wakeup(port); | 171 | uart_write_wakeup(port); |
173 | 172 | ||
174 | if (uart_circ_empty(xmit)) | 173 | if (uart_circ_empty(xmit)) { |
175 | clps711xuart_stop_tx(port); | 174 | disable_tx_irq: |
175 | disable_irq_nosync(TX_IRQ(port)); | ||
176 | tx_enabled(port) = 0; | ||
177 | } | ||
176 | 178 | ||
177 | return IRQ_HANDLED; | 179 | return IRQ_HANDLED; |
178 | } | 180 | } |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 0121486ac4fa..d00b38eb268e 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -1381,29 +1381,24 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1381 | return -ENODEV; | 1381 | return -ENODEV; |
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | if (!request_mem_region(mem->start, resource_size(mem), | 1384 | if (!devm_request_mem_region(&pdev->dev, mem->start, resource_size(mem), |
1385 | pdev->dev.driver->name)) { | 1385 | pdev->dev.driver->name)) { |
1386 | dev_err(&pdev->dev, "memory region already claimed\n"); | 1386 | dev_err(&pdev->dev, "memory region already claimed\n"); |
1387 | return -EBUSY; | 1387 | return -EBUSY; |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); | 1390 | dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); |
1391 | if (!dma_rx) { | 1391 | if (!dma_rx) |
1392 | ret = -EINVAL; | 1392 | return -ENXIO; |
1393 | goto err; | ||
1394 | } | ||
1395 | 1393 | ||
1396 | dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); | 1394 | dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); |
1397 | if (!dma_tx) { | 1395 | if (!dma_tx) |
1398 | ret = -EINVAL; | 1396 | return -ENXIO; |
1399 | goto err; | 1397 | |
1400 | } | 1398 | up = devm_kzalloc(&pdev->dev, sizeof(*up), GFP_KERNEL); |
1399 | if (!up) | ||
1400 | return -ENOMEM; | ||
1401 | 1401 | ||
1402 | up = kzalloc(sizeof(*up), GFP_KERNEL); | ||
1403 | if (up == NULL) { | ||
1404 | ret = -ENOMEM; | ||
1405 | goto do_release_region; | ||
1406 | } | ||
1407 | up->pdev = pdev; | 1402 | up->pdev = pdev; |
1408 | up->port.dev = &pdev->dev; | 1403 | up->port.dev = &pdev->dev; |
1409 | up->port.type = PORT_OMAP; | 1404 | up->port.type = PORT_OMAP; |
@@ -1423,16 +1418,17 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1423 | dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", | 1418 | dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", |
1424 | up->port.line); | 1419 | up->port.line); |
1425 | ret = -ENODEV; | 1420 | ret = -ENODEV; |
1426 | goto err; | 1421 | goto err_port_line; |
1427 | } | 1422 | } |
1428 | 1423 | ||
1429 | sprintf(up->name, "OMAP UART%d", up->port.line); | 1424 | sprintf(up->name, "OMAP UART%d", up->port.line); |
1430 | up->port.mapbase = mem->start; | 1425 | up->port.mapbase = mem->start; |
1431 | up->port.membase = ioremap(mem->start, resource_size(mem)); | 1426 | up->port.membase = devm_ioremap(&pdev->dev, mem->start, |
1427 | resource_size(mem)); | ||
1432 | if (!up->port.membase) { | 1428 | if (!up->port.membase) { |
1433 | dev_err(&pdev->dev, "can't ioremap UART\n"); | 1429 | dev_err(&pdev->dev, "can't ioremap UART\n"); |
1434 | ret = -ENOMEM; | 1430 | ret = -ENOMEM; |
1435 | goto err; | 1431 | goto err_ioremap; |
1436 | } | 1432 | } |
1437 | 1433 | ||
1438 | up->port.flags = omap_up_info->flags; | 1434 | up->port.flags = omap_up_info->flags; |
@@ -1478,16 +1474,19 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1478 | 1474 | ||
1479 | ret = uart_add_one_port(&serial_omap_reg, &up->port); | 1475 | ret = uart_add_one_port(&serial_omap_reg, &up->port); |
1480 | if (ret != 0) | 1476 | if (ret != 0) |
1481 | goto do_release_region; | 1477 | goto err_add_port; |
1482 | 1478 | ||
1483 | pm_runtime_put(&pdev->dev); | 1479 | pm_runtime_put(&pdev->dev); |
1484 | platform_set_drvdata(pdev, up); | 1480 | platform_set_drvdata(pdev, up); |
1485 | return 0; | 1481 | return 0; |
1486 | err: | 1482 | |
1483 | err_add_port: | ||
1484 | pm_runtime_put(&pdev->dev); | ||
1485 | pm_runtime_disable(&pdev->dev); | ||
1486 | err_ioremap: | ||
1487 | err_port_line: | ||
1487 | dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n", | 1488 | dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n", |
1488 | pdev->id, __func__, ret); | 1489 | pdev->id, __func__, ret); |
1489 | do_release_region: | ||
1490 | release_mem_region(mem->start, resource_size(mem)); | ||
1491 | return ret; | 1490 | return ret; |
1492 | } | 1491 | } |
1493 | 1492 | ||
@@ -1499,8 +1498,6 @@ static int serial_omap_remove(struct platform_device *dev) | |||
1499 | pm_runtime_disable(&up->pdev->dev); | 1498 | pm_runtime_disable(&up->pdev->dev); |
1500 | uart_remove_one_port(&serial_omap_reg, &up->port); | 1499 | uart_remove_one_port(&serial_omap_reg, &up->port); |
1501 | pm_qos_remove_request(&up->pm_qos_request); | 1500 | pm_qos_remove_request(&up->pm_qos_request); |
1502 | |||
1503 | kfree(up); | ||
1504 | } | 1501 | } |
1505 | 1502 | ||
1506 | platform_set_drvdata(dev, NULL); | 1503 | platform_set_drvdata(dev, NULL); |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 08b9962b8fda..c2816f494807 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -210,6 +210,7 @@ enum { | |||
210 | #define CMITC_UARTCLK 192000000 /* 192.0000 MHz */ | 210 | #define CMITC_UARTCLK 192000000 /* 192.0000 MHz */ |
211 | #define FRI2_64_UARTCLK 64000000 /* 64.0000 MHz */ | 211 | #define FRI2_64_UARTCLK 64000000 /* 64.0000 MHz */ |
212 | #define FRI2_48_UARTCLK 48000000 /* 48.0000 MHz */ | 212 | #define FRI2_48_UARTCLK 48000000 /* 48.0000 MHz */ |
213 | #define NTC1_UARTCLK 64000000 /* 64.0000 MHz */ | ||
213 | 214 | ||
214 | struct pch_uart_buffer { | 215 | struct pch_uart_buffer { |
215 | unsigned char *buf; | 216 | unsigned char *buf; |
@@ -384,6 +385,12 @@ static int pch_uart_get_uartclk(void) | |||
384 | if (cmp && strstr(cmp, "Fish River Island II")) | 385 | if (cmp && strstr(cmp, "Fish River Island II")) |
385 | return FRI2_48_UARTCLK; | 386 | return FRI2_48_UARTCLK; |
386 | 387 | ||
388 | /* Kontron COMe-mTT10 (nanoETXexpress-TT) */ | ||
389 | cmp = dmi_get_system_info(DMI_BOARD_NAME); | ||
390 | if (cmp && (strstr(cmp, "COMe-mTT") || | ||
391 | strstr(cmp, "nanoETXexpress-TT"))) | ||
392 | return NTC1_UARTCLK; | ||
393 | |||
387 | return DEFAULT_UARTCLK; | 394 | return DEFAULT_UARTCLK; |
388 | } | 395 | } |
389 | 396 | ||
@@ -1440,9 +1447,11 @@ static int pch_uart_verify_port(struct uart_port *port, | |||
1440 | __func__); | 1447 | __func__); |
1441 | return -EOPNOTSUPP; | 1448 | return -EOPNOTSUPP; |
1442 | #endif | 1449 | #endif |
1443 | priv->use_dma = 1; | ||
1444 | priv->use_dma_flag = 1; | 1450 | priv->use_dma_flag = 1; |
1445 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); | 1451 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); |
1452 | if (!priv->use_dma) | ||
1453 | pch_request_dma(port); | ||
1454 | priv->use_dma = 1; | ||
1446 | } | 1455 | } |
1447 | 1456 | ||
1448 | return 0; | 1457 | return 0; |
@@ -1651,6 +1660,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, | |||
1651 | } | 1660 | } |
1652 | 1661 | ||
1653 | pci_enable_msi(pdev); | 1662 | pci_enable_msi(pdev); |
1663 | pci_set_master(pdev); | ||
1654 | 1664 | ||
1655 | iobase = pci_resource_start(pdev, 0); | 1665 | iobase = pci_resource_start(pdev, 0); |
1656 | mapbase = pci_resource_start(pdev, 1); | 1666 | mapbase = pci_resource_start(pdev, 1); |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index de249d265bec..d8b0aee35632 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -982,6 +982,7 @@ static void s3c24xx_serial_resetport(struct uart_port *port, | |||
982 | 982 | ||
983 | ucon &= ucon_mask; | 983 | ucon &= ucon_mask; |
984 | wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); | 984 | wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); |
985 | wr_regl(port, S3C2410_ULCON, cfg->ulcon); | ||
985 | 986 | ||
986 | /* reset both fifos */ | 987 | /* reset both fifos */ |
987 | wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); | 988 | wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); |
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 3bdd4b19dd06..2156188db4a6 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -2932,11 +2932,10 @@ static int __init con_init(void) | |||
2932 | gotoxy(vc, vc->vc_x, vc->vc_y); | 2932 | gotoxy(vc, vc->vc_x, vc->vc_y); |
2933 | csi_J(vc, 0); | 2933 | csi_J(vc, 0); |
2934 | update_screen(vc); | 2934 | update_screen(vc); |
2935 | pr_info("Console: %s %s %dx%d", | 2935 | pr_info("Console: %s %s %dx%d\n", |
2936 | vc->vc_can_do_color ? "colour" : "mono", | 2936 | vc->vc_can_do_color ? "colour" : "mono", |
2937 | display_desc, vc->vc_cols, vc->vc_rows); | 2937 | display_desc, vc->vc_cols, vc->vc_rows); |
2938 | printable = 1; | 2938 | printable = 1; |
2939 | printk("\n"); | ||
2940 | 2939 | ||
2941 | console_unlock(); | 2940 | console_unlock(); |
2942 | 2941 | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index cbd8f5f80596..76316a33061b 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -2,14 +2,6 @@ | |||
2 | # USB device configuration | 2 | # USB device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig USB_SUPPORT | ||
6 | bool "USB support" | ||
7 | depends on HAS_IOMEM | ||
8 | default y | ||
9 | ---help--- | ||
10 | This option adds core support for Universal Serial Bus (USB). | ||
11 | You will also need drivers from the following menu to make use of it. | ||
12 | |||
13 | # many non-PCI SOC chips embed OHCI | 5 | # many non-PCI SOC chips embed OHCI |
14 | config USB_ARCH_HAS_OHCI | 6 | config USB_ARCH_HAS_OHCI |
15 | boolean | 7 | boolean |
@@ -63,6 +55,14 @@ config USB_ARCH_HAS_XHCI | |||
63 | boolean | 55 | boolean |
64 | default PCI | 56 | default PCI |
65 | 57 | ||
58 | menuconfig USB_SUPPORT | ||
59 | bool "USB support" | ||
60 | depends on HAS_IOMEM | ||
61 | default y | ||
62 | ---help--- | ||
63 | This option adds core support for Universal Serial Bus (USB). | ||
64 | You will also need drivers from the following menu to make use of it. | ||
65 | |||
66 | if USB_SUPPORT | 66 | if USB_SUPPORT |
67 | 67 | ||
68 | config USB_COMMON | 68 | config USB_COMMON |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index f8e2d6d52e5c..9a56635dc19c 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1189,8 +1189,13 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | |||
1189 | if (status == 0) { | 1189 | if (status == 0) { |
1190 | status = usb_suspend_device(udev, msg); | 1190 | status = usb_suspend_device(udev, msg); |
1191 | 1191 | ||
1192 | /* Again, ignore errors during system sleep transitions */ | 1192 | /* |
1193 | if (!PMSG_IS_AUTO(msg)) | 1193 | * Ignore errors from non-root-hub devices during |
1194 | * system sleep transitions. For the most part, | ||
1195 | * these devices should go to low power anyway when | ||
1196 | * the entire bus is suspended. | ||
1197 | */ | ||
1198 | if (udev->parent && !PMSG_IS_AUTO(msg)) | ||
1194 | status = 0; | 1199 | status = 0; |
1195 | } | 1200 | } |
1196 | 1201 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 9d7fc9a39933..140d3e11f212 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1978,6 +1978,18 @@ int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg) | |||
1978 | if (status == 0) { | 1978 | if (status == 0) { |
1979 | usb_set_device_state(rhdev, USB_STATE_SUSPENDED); | 1979 | usb_set_device_state(rhdev, USB_STATE_SUSPENDED); |
1980 | hcd->state = HC_STATE_SUSPENDED; | 1980 | hcd->state = HC_STATE_SUSPENDED; |
1981 | |||
1982 | /* Did we race with a root-hub wakeup event? */ | ||
1983 | if (rhdev->do_remote_wakeup) { | ||
1984 | char buffer[6]; | ||
1985 | |||
1986 | status = hcd->driver->hub_status_data(hcd, buffer); | ||
1987 | if (status != 0) { | ||
1988 | dev_dbg(&rhdev->dev, "suspend raced with wakeup event\n"); | ||
1989 | hcd_bus_resume(rhdev, PMSG_AUTO_RESUME); | ||
1990 | status = -EBUSY; | ||
1991 | } | ||
1992 | } | ||
1981 | } else { | 1993 | } else { |
1982 | spin_lock_irq(&hcd_root_hub_lock); | 1994 | spin_lock_irq(&hcd_root_hub_lock); |
1983 | if (!HCD_DEAD(hcd)) { | 1995 | if (!HCD_DEAD(hcd)) { |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 28664eb7f555..ec6c97dadbe4 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1667,7 +1667,6 @@ void usb_disconnect(struct usb_device **pdev) | |||
1667 | { | 1667 | { |
1668 | struct usb_device *udev = *pdev; | 1668 | struct usb_device *udev = *pdev; |
1669 | int i; | 1669 | int i; |
1670 | struct usb_hcd *hcd = bus_to_hcd(udev->bus); | ||
1671 | 1670 | ||
1672 | /* mark the device as inactive, so any further urb submissions for | 1671 | /* mark the device as inactive, so any further urb submissions for |
1673 | * this device (and any of its children) will fail immediately. | 1672 | * this device (and any of its children) will fail immediately. |
@@ -1690,9 +1689,7 @@ void usb_disconnect(struct usb_device **pdev) | |||
1690 | * so that the hardware is now fully quiesced. | 1689 | * so that the hardware is now fully quiesced. |
1691 | */ | 1690 | */ |
1692 | dev_dbg (&udev->dev, "unregistering device\n"); | 1691 | dev_dbg (&udev->dev, "unregistering device\n"); |
1693 | mutex_lock(hcd->bandwidth_mutex); | ||
1694 | usb_disable_device(udev, 0); | 1692 | usb_disable_device(udev, 0); |
1695 | mutex_unlock(hcd->bandwidth_mutex); | ||
1696 | usb_hcd_synchronize_unlinks(udev); | 1693 | usb_hcd_synchronize_unlinks(udev); |
1697 | 1694 | ||
1698 | usb_remove_ep_devs(&udev->ep0); | 1695 | usb_remove_ep_devs(&udev->ep0); |
@@ -3163,6 +3160,22 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
3163 | if (retval) | 3160 | if (retval) |
3164 | goto fail; | 3161 | goto fail; |
3165 | 3162 | ||
3163 | /* | ||
3164 | * Some superspeed devices have finished the link training process | ||
3165 | * and attached to a superspeed hub port, but the device descriptor | ||
3166 | * got from those devices show they aren't superspeed devices. Warm | ||
3167 | * reset the port attached by the devices can fix them. | ||
3168 | */ | ||
3169 | if ((udev->speed == USB_SPEED_SUPER) && | ||
3170 | (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300)) { | ||
3171 | dev_err(&udev->dev, "got a wrong device descriptor, " | ||
3172 | "warm reset device\n"); | ||
3173 | hub_port_reset(hub, port1, udev, | ||
3174 | HUB_BH_RESET_TIME, true); | ||
3175 | retval = -EINVAL; | ||
3176 | goto fail; | ||
3177 | } | ||
3178 | |||
3166 | if (udev->descriptor.bMaxPacketSize0 == 0xff || | 3179 | if (udev->descriptor.bMaxPacketSize0 == 0xff || |
3167 | udev->speed == USB_SPEED_SUPER) | 3180 | udev->speed == USB_SPEED_SUPER) |
3168 | i = 512; | 3181 | i = 512; |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index b3bdfede45e6..ca717da3be95 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -308,7 +308,8 @@ static void sg_complete(struct urb *urb) | |||
308 | retval = usb_unlink_urb(io->urbs [i]); | 308 | retval = usb_unlink_urb(io->urbs [i]); |
309 | if (retval != -EINPROGRESS && | 309 | if (retval != -EINPROGRESS && |
310 | retval != -ENODEV && | 310 | retval != -ENODEV && |
311 | retval != -EBUSY) | 311 | retval != -EBUSY && |
312 | retval != -EIDRM) | ||
312 | dev_err(&io->dev->dev, | 313 | dev_err(&io->dev->dev, |
313 | "%s, unlink --> %d\n", | 314 | "%s, unlink --> %d\n", |
314 | __func__, retval); | 315 | __func__, retval); |
@@ -317,7 +318,6 @@ static void sg_complete(struct urb *urb) | |||
317 | } | 318 | } |
318 | spin_lock(&io->lock); | 319 | spin_lock(&io->lock); |
319 | } | 320 | } |
320 | urb->dev = NULL; | ||
321 | 321 | ||
322 | /* on the last completion, signal usb_sg_wait() */ | 322 | /* on the last completion, signal usb_sg_wait() */ |
323 | io->bytes += urb->actual_length; | 323 | io->bytes += urb->actual_length; |
@@ -524,7 +524,6 @@ void usb_sg_wait(struct usb_sg_request *io) | |||
524 | case -ENXIO: /* hc didn't queue this one */ | 524 | case -ENXIO: /* hc didn't queue this one */ |
525 | case -EAGAIN: | 525 | case -EAGAIN: |
526 | case -ENOMEM: | 526 | case -ENOMEM: |
527 | io->urbs[i]->dev = NULL; | ||
528 | retval = 0; | 527 | retval = 0; |
529 | yield(); | 528 | yield(); |
530 | break; | 529 | break; |
@@ -542,7 +541,6 @@ void usb_sg_wait(struct usb_sg_request *io) | |||
542 | 541 | ||
543 | /* fail any uncompleted urbs */ | 542 | /* fail any uncompleted urbs */ |
544 | default: | 543 | default: |
545 | io->urbs[i]->dev = NULL; | ||
546 | io->urbs[i]->status = retval; | 544 | io->urbs[i]->status = retval; |
547 | dev_dbg(&io->dev->dev, "%s, submit --> %d\n", | 545 | dev_dbg(&io->dev->dev, "%s, submit --> %d\n", |
548 | __func__, retval); | 546 | __func__, retval); |
@@ -593,7 +591,10 @@ void usb_sg_cancel(struct usb_sg_request *io) | |||
593 | if (!io->urbs [i]->dev) | 591 | if (!io->urbs [i]->dev) |
594 | continue; | 592 | continue; |
595 | retval = usb_unlink_urb(io->urbs [i]); | 593 | retval = usb_unlink_urb(io->urbs [i]); |
596 | if (retval != -EINPROGRESS && retval != -EBUSY) | 594 | if (retval != -EINPROGRESS |
595 | && retval != -ENODEV | ||
596 | && retval != -EBUSY | ||
597 | && retval != -EIDRM) | ||
597 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", | 598 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", |
598 | __func__, retval); | 599 | __func__, retval); |
599 | } | 600 | } |
@@ -1135,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, | |||
1135 | * Deallocates hcd/hardware state for the endpoints (nuking all or most | 1136 | * Deallocates hcd/hardware state for the endpoints (nuking all or most |
1136 | * pending urbs) and usbcore state for the interfaces, so that usbcore | 1137 | * pending urbs) and usbcore state for the interfaces, so that usbcore |
1137 | * must usb_set_configuration() before any interfaces could be used. | 1138 | * must usb_set_configuration() before any interfaces could be used. |
1138 | * | ||
1139 | * Must be called with hcd->bandwidth_mutex held. | ||
1140 | */ | 1139 | */ |
1141 | void usb_disable_device(struct usb_device *dev, int skip_ep0) | 1140 | void usb_disable_device(struct usb_device *dev, int skip_ep0) |
1142 | { | 1141 | { |
@@ -1189,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1189 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); | 1188 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); |
1190 | } | 1189 | } |
1191 | /* Remove endpoints from the host controller internal state */ | 1190 | /* Remove endpoints from the host controller internal state */ |
1191 | mutex_lock(hcd->bandwidth_mutex); | ||
1192 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | 1192 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
1193 | mutex_unlock(hcd->bandwidth_mutex); | ||
1193 | /* Second pass: remove endpoint pointers */ | 1194 | /* Second pass: remove endpoint pointers */ |
1194 | } | 1195 | } |
1195 | for (i = skip_ep0; i < 16; ++i) { | 1196 | for (i = skip_ep0; i < 16; ++i) { |
@@ -1749,7 +1750,6 @@ free_interfaces: | |||
1749 | /* if it's already configured, clear out old state first. | 1750 | /* if it's already configured, clear out old state first. |
1750 | * getting rid of old interfaces means unbinding their drivers. | 1751 | * getting rid of old interfaces means unbinding their drivers. |
1751 | */ | 1752 | */ |
1752 | mutex_lock(hcd->bandwidth_mutex); | ||
1753 | if (dev->state != USB_STATE_ADDRESS) | 1753 | if (dev->state != USB_STATE_ADDRESS) |
1754 | usb_disable_device(dev, 1); /* Skip ep0 */ | 1754 | usb_disable_device(dev, 1); /* Skip ep0 */ |
1755 | 1755 | ||
@@ -1762,6 +1762,7 @@ free_interfaces: | |||
1762 | * host controller will not allow submissions to dropped endpoints. If | 1762 | * host controller will not allow submissions to dropped endpoints. If |
1763 | * this call fails, the device state is unchanged. | 1763 | * this call fails, the device state is unchanged. |
1764 | */ | 1764 | */ |
1765 | mutex_lock(hcd->bandwidth_mutex); | ||
1765 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); | 1766 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); |
1766 | if (ret < 0) { | 1767 | if (ret < 0) { |
1767 | mutex_unlock(hcd->bandwidth_mutex); | 1768 | mutex_unlock(hcd->bandwidth_mutex); |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 7239a73c1b8c..cd9b3a2cd8a7 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -539,6 +539,10 @@ EXPORT_SYMBOL_GPL(usb_submit_urb); | |||
539 | * never submitted, or it was unlinked before, or the hardware is already | 539 | * never submitted, or it was unlinked before, or the hardware is already |
540 | * finished with it), even if the completion handler has not yet run. | 540 | * finished with it), even if the completion handler has not yet run. |
541 | * | 541 | * |
542 | * The URB must not be deallocated while this routine is running. In | ||
543 | * particular, when a driver calls this routine, it must insure that the | ||
544 | * completion handler cannot deallocate the URB. | ||
545 | * | ||
542 | * Unlinking and Endpoint Queues: | 546 | * Unlinking and Endpoint Queues: |
543 | * | 547 | * |
544 | * [The behaviors and guarantees described below do not apply to virtual | 548 | * [The behaviors and guarantees described below do not apply to virtual |
@@ -603,6 +607,10 @@ EXPORT_SYMBOL_GPL(usb_unlink_urb); | |||
603 | * with error -EPERM. Thus even if the URB's completion handler always | 607 | * with error -EPERM. Thus even if the URB's completion handler always |
604 | * tries to resubmit, it will not succeed and the URB will become idle. | 608 | * tries to resubmit, it will not succeed and the URB will become idle. |
605 | * | 609 | * |
610 | * The URB must not be deallocated while this routine is running. In | ||
611 | * particular, when a driver calls this routine, it must insure that the | ||
612 | * completion handler cannot deallocate the URB. | ||
613 | * | ||
606 | * This routine may not be used in an interrupt context (such as a bottom | 614 | * This routine may not be used in an interrupt context (such as a bottom |
607 | * half or a completion handler), or when holding a spinlock, or in other | 615 | * half or a completion handler), or when holding a spinlock, or in other |
608 | * situations where the caller can't schedule(). | 616 | * situations where the caller can't schedule(). |
@@ -640,6 +648,10 @@ EXPORT_SYMBOL_GPL(usb_kill_urb); | |||
640 | * with error -EPERM. Thus even if the URB's completion handler always | 648 | * with error -EPERM. Thus even if the URB's completion handler always |
641 | * tries to resubmit, it will not succeed and the URB will become idle. | 649 | * tries to resubmit, it will not succeed and the URB will become idle. |
642 | * | 650 | * |
651 | * The URB must not be deallocated while this routine is running. In | ||
652 | * particular, when a driver calls this routine, it must insure that the | ||
653 | * completion handler cannot deallocate the URB. | ||
654 | * | ||
643 | * This routine may not be used in an interrupt context (such as a bottom | 655 | * This routine may not be used in an interrupt context (such as a bottom |
644 | * half or a completion handler), or when holding a spinlock, or in other | 656 | * half or a completion handler), or when holding a spinlock, or in other |
645 | * situations where the caller can't schedule(). | 657 | * situations where the caller can't schedule(). |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7bd815a507e8..99b58d84553a 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -206,11 +206,11 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc) | |||
206 | 206 | ||
207 | for (i = 0; i < dwc->num_event_buffers; i++) { | 207 | for (i = 0; i < dwc->num_event_buffers; i++) { |
208 | evt = dwc->ev_buffs[i]; | 208 | evt = dwc->ev_buffs[i]; |
209 | if (evt) { | 209 | if (evt) |
210 | dwc3_free_one_event_buffer(dwc, evt); | 210 | dwc3_free_one_event_buffer(dwc, evt); |
211 | dwc->ev_buffs[i] = NULL; | ||
212 | } | ||
213 | } | 211 | } |
212 | |||
213 | kfree(dwc->ev_buffs); | ||
214 | } | 214 | } |
215 | 215 | ||
216 | /** | 216 | /** |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 25910e251c04..3584a169886f 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -353,6 +353,9 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc, | |||
353 | 353 | ||
354 | dwc->test_mode_nr = wIndex >> 8; | 354 | dwc->test_mode_nr = wIndex >> 8; |
355 | dwc->test_mode = true; | 355 | dwc->test_mode = true; |
356 | break; | ||
357 | default: | ||
358 | return -EINVAL; | ||
356 | } | 359 | } |
357 | break; | 360 | break; |
358 | 361 | ||
@@ -559,15 +562,20 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
559 | length = trb->size & DWC3_TRB_SIZE_MASK; | 562 | length = trb->size & DWC3_TRB_SIZE_MASK; |
560 | 563 | ||
561 | if (dwc->ep0_bounced) { | 564 | if (dwc->ep0_bounced) { |
565 | unsigned transfer_size = ur->length; | ||
566 | unsigned maxp = ep0->endpoint.maxpacket; | ||
567 | |||
568 | transfer_size += (maxp - (transfer_size % maxp)); | ||
562 | transferred = min_t(u32, ur->length, | 569 | transferred = min_t(u32, ur->length, |
563 | ep0->endpoint.maxpacket - length); | 570 | transfer_size - length); |
564 | memcpy(ur->buf, dwc->ep0_bounce, transferred); | 571 | memcpy(ur->buf, dwc->ep0_bounce, transferred); |
565 | dwc->ep0_bounced = false; | 572 | dwc->ep0_bounced = false; |
566 | } else { | 573 | } else { |
567 | transferred = ur->length - length; | 574 | transferred = ur->length - length; |
568 | ur->actual += transferred; | ||
569 | } | 575 | } |
570 | 576 | ||
577 | ur->actual += transferred; | ||
578 | |||
571 | if ((epnum & 1) && ur->actual < ur->length) { | 579 | if ((epnum & 1) && ur->actual < ur->length) { |
572 | /* for some reason we did not get everything out */ | 580 | /* for some reason we did not get everything out */ |
573 | 581 | ||
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 0c935d7c65bd..9d7bcd910074 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1863,8 +1863,8 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1863 | mod_timer(&udc->vbus_timer, | 1863 | mod_timer(&udc->vbus_timer, |
1864 | jiffies + VBUS_POLL_TIMEOUT); | 1864 | jiffies + VBUS_POLL_TIMEOUT); |
1865 | } else { | 1865 | } else { |
1866 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, | 1866 | if (request_irq(gpio_to_irq(udc->board.vbus_pin), |
1867 | 0, driver_name, udc)) { | 1867 | at91_vbus_irq, 0, driver_name, udc)) { |
1868 | DBG("request vbus irq %d failed\n", | 1868 | DBG("request vbus irq %d failed\n", |
1869 | udc->board.vbus_pin); | 1869 | udc->board.vbus_pin); |
1870 | retval = -EBUSY; | 1870 | retval = -EBUSY; |
@@ -1886,7 +1886,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1886 | return 0; | 1886 | return 0; |
1887 | fail4: | 1887 | fail4: |
1888 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) | 1888 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) |
1889 | free_irq(udc->board.vbus_pin, udc); | 1889 | free_irq(gpio_to_irq(udc->board.vbus_pin), udc); |
1890 | fail3: | 1890 | fail3: |
1891 | if (gpio_is_valid(udc->board.vbus_pin)) | 1891 | if (gpio_is_valid(udc->board.vbus_pin)) |
1892 | gpio_free(udc->board.vbus_pin); | 1892 | gpio_free(udc->board.vbus_pin); |
@@ -1924,7 +1924,7 @@ static int __exit at91udc_remove(struct platform_device *pdev) | |||
1924 | device_init_wakeup(&pdev->dev, 0); | 1924 | device_init_wakeup(&pdev->dev, 0); |
1925 | remove_debug_file(udc); | 1925 | remove_debug_file(udc); |
1926 | if (gpio_is_valid(udc->board.vbus_pin)) { | 1926 | if (gpio_is_valid(udc->board.vbus_pin)) { |
1927 | free_irq(udc->board.vbus_pin, udc); | 1927 | free_irq(gpio_to_irq(udc->board.vbus_pin), udc); |
1928 | gpio_free(udc->board.vbus_pin); | 1928 | gpio_free(udc->board.vbus_pin); |
1929 | } | 1929 | } |
1930 | free_irq(udc->udp_irq, udc); | 1930 | free_irq(udc->udp_irq, udc); |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 1cbba70836bc..f52cb1ae45d9 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value) | |||
712 | if (code == FUNCTIONFS_INTERFACE_REVMAP) { | 712 | if (code == FUNCTIONFS_INTERFACE_REVMAP) { |
713 | struct ffs_function *func = ffs->func; | 713 | struct ffs_function *func = ffs->func; |
714 | ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; | 714 | ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; |
715 | } else if (gadget->ops->ioctl) { | 715 | } else if (gadget && gadget->ops->ioctl) { |
716 | ret = gadget->ops->ioctl(gadget, code, value); | 716 | ret = gadget->ops->ioctl(gadget, code, value); |
717 | } else { | 717 | } else { |
718 | ret = -ENOTTY; | 718 | ret = -ENOTTY; |
@@ -1382,6 +1382,7 @@ static void functionfs_unbind(struct ffs_data *ffs) | |||
1382 | ffs->ep0req = NULL; | 1382 | ffs->ep0req = NULL; |
1383 | ffs->gadget = NULL; | 1383 | ffs->gadget = NULL; |
1384 | ffs_data_put(ffs); | 1384 | ffs_data_put(ffs); |
1385 | clear_bit(FFS_FL_BOUND, &ffs->flags); | ||
1385 | } | 1386 | } |
1386 | } | 1387 | } |
1387 | 1388 | ||
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 7b1cf18df5e3..52343654f5df 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -500,6 +500,7 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) | |||
500 | if (buf) { | 500 | if (buf) { |
501 | memcpy(req->buf, buf, n); | 501 | memcpy(req->buf, buf, n); |
502 | req->complete = rndis_response_complete; | 502 | req->complete = rndis_response_complete; |
503 | req->context = rndis; | ||
503 | rndis_free_response(rndis->config, buf); | 504 | rndis_free_response(rndis->config, buf); |
504 | value = n; | 505 | value = n; |
505 | } | 506 | } |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 5f94e79cd6b9..55abfb6bd612 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -730,7 +730,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) | |||
730 | : (1 << (ep_index(ep))); | 730 | : (1 << (ep_index(ep))); |
731 | 731 | ||
732 | /* check if the pipe is empty */ | 732 | /* check if the pipe is empty */ |
733 | if (!(list_empty(&ep->queue))) { | 733 | if (!(list_empty(&ep->queue)) && !(ep_index(ep) == 0)) { |
734 | /* Add td to the end */ | 734 | /* Add td to the end */ |
735 | struct fsl_req *lastreq; | 735 | struct fsl_req *lastreq; |
736 | lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); | 736 | lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); |
@@ -918,10 +918,6 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
918 | return -ENOMEM; | 918 | return -ENOMEM; |
919 | } | 919 | } |
920 | 920 | ||
921 | /* Update ep0 state */ | ||
922 | if ((ep_index(ep) == 0)) | ||
923 | udc->ep0_state = DATA_STATE_XMIT; | ||
924 | |||
925 | /* irq handler advances the queue */ | 921 | /* irq handler advances the queue */ |
926 | if (req != NULL) | 922 | if (req != NULL) |
927 | list_add_tail(&req->queue, &ep->queue); | 923 | list_add_tail(&req->queue, &ep->queue); |
@@ -1279,7 +1275,8 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction) | |||
1279 | udc->ep0_dir = USB_DIR_OUT; | 1275 | udc->ep0_dir = USB_DIR_OUT; |
1280 | 1276 | ||
1281 | ep = &udc->eps[0]; | 1277 | ep = &udc->eps[0]; |
1282 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | 1278 | if (udc->ep0_state != DATA_STATE_XMIT) |
1279 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | ||
1283 | 1280 | ||
1284 | req->ep = ep; | 1281 | req->ep = ep; |
1285 | req->req.length = 0; | 1282 | req->req.length = 0; |
@@ -1384,6 +1381,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value, | |||
1384 | 1381 | ||
1385 | list_add_tail(&req->queue, &ep->queue); | 1382 | list_add_tail(&req->queue, &ep->queue); |
1386 | udc->ep0_state = DATA_STATE_XMIT; | 1383 | udc->ep0_state = DATA_STATE_XMIT; |
1384 | if (ep0_prime_status(udc, EP_DIR_OUT)) | ||
1385 | ep0stall(udc); | ||
1386 | |||
1387 | return; | 1387 | return; |
1388 | stall: | 1388 | stall: |
1389 | ep0stall(udc); | 1389 | ep0stall(udc); |
@@ -1492,6 +1492,14 @@ static void setup_received_irq(struct fsl_udc *udc, | |||
1492 | spin_lock(&udc->lock); | 1492 | spin_lock(&udc->lock); |
1493 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) | 1493 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) |
1494 | ? DATA_STATE_XMIT : DATA_STATE_RECV; | 1494 | ? DATA_STATE_XMIT : DATA_STATE_RECV; |
1495 | /* | ||
1496 | * If the data stage is IN, send status prime immediately. | ||
1497 | * See 2.0 Spec chapter 8.5.3.3 for detail. | ||
1498 | */ | ||
1499 | if (udc->ep0_state == DATA_STATE_XMIT) | ||
1500 | if (ep0_prime_status(udc, EP_DIR_OUT)) | ||
1501 | ep0stall(udc); | ||
1502 | |||
1495 | } else { | 1503 | } else { |
1496 | /* No data phase, IN status from gadget */ | 1504 | /* No data phase, IN status from gadget */ |
1497 | udc->ep0_dir = USB_DIR_IN; | 1505 | udc->ep0_dir = USB_DIR_IN; |
@@ -1520,9 +1528,8 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0, | |||
1520 | 1528 | ||
1521 | switch (udc->ep0_state) { | 1529 | switch (udc->ep0_state) { |
1522 | case DATA_STATE_XMIT: | 1530 | case DATA_STATE_XMIT: |
1523 | /* receive status phase */ | 1531 | /* already primed at setup_received_irq */ |
1524 | if (ep0_prime_status(udc, EP_DIR_OUT)) | 1532 | udc->ep0_state = WAIT_FOR_OUT_STATUS; |
1525 | ep0stall(udc); | ||
1526 | break; | 1533 | break; |
1527 | case DATA_STATE_RECV: | 1534 | case DATA_STATE_RECV: |
1528 | /* send status phase */ | 1535 | /* send status phase */ |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 331cd6729d3c..a85eaf40b948 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -161,7 +161,7 @@ static struct usb_composite_driver gfs_driver = { | |||
161 | static struct ffs_data *gfs_ffs_data; | 161 | static struct ffs_data *gfs_ffs_data; |
162 | static unsigned long gfs_registered; | 162 | static unsigned long gfs_registered; |
163 | 163 | ||
164 | static int gfs_init(void) | 164 | static int __init gfs_init(void) |
165 | { | 165 | { |
166 | ENTER(); | 166 | ENTER(); |
167 | 167 | ||
@@ -169,7 +169,7 @@ static int gfs_init(void) | |||
169 | } | 169 | } |
170 | module_init(gfs_init); | 170 | module_init(gfs_init); |
171 | 171 | ||
172 | static void gfs_exit(void) | 172 | static void __exit gfs_exit(void) |
173 | { | 173 | { |
174 | ENTER(); | 174 | ENTER(); |
175 | 175 | ||
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 8793f32bab11..e58b16442971 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1574,7 +1574,6 @@ static void destroy_ep_files (struct dev_data *dev) | |||
1574 | DBG (dev, "%s %d\n", __func__, dev->state); | 1574 | DBG (dev, "%s %d\n", __func__, dev->state); |
1575 | 1575 | ||
1576 | /* dev->state must prevent interference */ | 1576 | /* dev->state must prevent interference */ |
1577 | restart: | ||
1578 | spin_lock_irq (&dev->lock); | 1577 | spin_lock_irq (&dev->lock); |
1579 | while (!list_empty(&dev->epfiles)) { | 1578 | while (!list_empty(&dev->epfiles)) { |
1580 | struct ep_data *ep; | 1579 | struct ep_data *ep; |
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 69295ba9d99a..105b206cd844 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -340,7 +340,7 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) | |||
340 | /* currently we allocate TX FIFOs for all possible endpoints, | 340 | /* currently we allocate TX FIFOs for all possible endpoints, |
341 | * and assume that they are all the same size. */ | 341 | * and assume that they are all the same size. */ |
342 | 342 | ||
343 | for (ep = 0; ep <= 15; ep++) { | 343 | for (ep = 1; ep <= 15; ep++) { |
344 | val = addr; | 344 | val = addr; |
345 | val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; | 345 | val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; |
346 | addr += size; | 346 | addr += size; |
@@ -741,7 +741,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg, | |||
741 | /* write size / packets */ | 741 | /* write size / packets */ |
742 | writel(epsize, hsotg->regs + epsize_reg); | 742 | writel(epsize, hsotg->regs + epsize_reg); |
743 | 743 | ||
744 | if (using_dma(hsotg)) { | 744 | if (using_dma(hsotg) && !continuing) { |
745 | unsigned int dma_reg; | 745 | unsigned int dma_reg; |
746 | 746 | ||
747 | /* write DMA address to control register, buffer already | 747 | /* write DMA address to control register, buffer already |
@@ -1696,10 +1696,12 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg, | |||
1696 | reg |= mpsval; | 1696 | reg |= mpsval; |
1697 | writel(reg, regs + S3C_DIEPCTL(ep)); | 1697 | writel(reg, regs + S3C_DIEPCTL(ep)); |
1698 | 1698 | ||
1699 | reg = readl(regs + S3C_DOEPCTL(ep)); | 1699 | if (ep) { |
1700 | reg &= ~S3C_DxEPCTL_MPS_MASK; | 1700 | reg = readl(regs + S3C_DOEPCTL(ep)); |
1701 | reg |= mpsval; | 1701 | reg &= ~S3C_DxEPCTL_MPS_MASK; |
1702 | writel(reg, regs + S3C_DOEPCTL(ep)); | 1702 | reg |= mpsval; |
1703 | writel(reg, regs + S3C_DOEPCTL(ep)); | ||
1704 | } | ||
1703 | 1705 | ||
1704 | return; | 1706 | return; |
1705 | 1707 | ||
@@ -1919,7 +1921,8 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx, | |||
1919 | ints & S3C_DIEPMSK_TxFIFOEmpty) { | 1921 | ints & S3C_DIEPMSK_TxFIFOEmpty) { |
1920 | dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", | 1922 | dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", |
1921 | __func__, idx); | 1923 | __func__, idx); |
1922 | s3c_hsotg_trytx(hsotg, hs_ep); | 1924 | if (!using_dma(hsotg)) |
1925 | s3c_hsotg_trytx(hsotg, hs_ep); | ||
1923 | } | 1926 | } |
1924 | } | 1927 | } |
1925 | } | 1928 | } |
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 56da49f31d6c..2fa9865babed 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -264,8 +264,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | |||
264 | if (udc_is_newstyle(udc)) { | 264 | if (udc_is_newstyle(udc)) { |
265 | udc->driver->disconnect(udc->gadget); | 265 | udc->driver->disconnect(udc->gadget); |
266 | udc->driver->unbind(udc->gadget); | 266 | udc->driver->unbind(udc->gadget); |
267 | usb_gadget_udc_stop(udc->gadget, udc->driver); | ||
268 | usb_gadget_disconnect(udc->gadget); | 267 | usb_gadget_disconnect(udc->gadget); |
268 | usb_gadget_udc_stop(udc->gadget, udc->driver); | ||
269 | } else { | 269 | } else { |
270 | usb_gadget_stop(udc->gadget, udc->driver); | 270 | usb_gadget_stop(udc->gadget, udc->driver); |
271 | } | 271 | } |
@@ -411,8 +411,12 @@ static ssize_t usb_udc_softconn_store(struct device *dev, | |||
411 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); | 411 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); |
412 | 412 | ||
413 | if (sysfs_streq(buf, "connect")) { | 413 | if (sysfs_streq(buf, "connect")) { |
414 | if (udc_is_newstyle(udc)) | ||
415 | usb_gadget_udc_start(udc->gadget, udc->driver); | ||
414 | usb_gadget_connect(udc->gadget); | 416 | usb_gadget_connect(udc->gadget); |
415 | } else if (sysfs_streq(buf, "disconnect")) { | 417 | } else if (sysfs_streq(buf, "disconnect")) { |
418 | if (udc_is_newstyle(udc)) | ||
419 | usb_gadget_udc_stop(udc->gadget, udc->driver); | ||
416 | usb_gadget_disconnect(udc->gadget); | 420 | usb_gadget_disconnect(udc->gadget); |
417 | } else { | 421 | } else { |
418 | dev_err(dev, "unsupported command '%s'\n", buf); | 422 | dev_err(dev, "unsupported command '%s'\n", buf); |
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c index d776adb2da67..0cdf89d32a15 100644 --- a/drivers/usb/gadget/uvc_queue.c +++ b/drivers/usb/gadget/uvc_queue.c | |||
@@ -543,11 +543,11 @@ done: | |||
543 | return ret; | 543 | return ret; |
544 | } | 544 | } |
545 | 545 | ||
546 | /* called with queue->irqlock held.. */ | ||
546 | static struct uvc_buffer * | 547 | static struct uvc_buffer * |
547 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) | 548 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) |
548 | { | 549 | { |
549 | struct uvc_buffer *nextbuf; | 550 | struct uvc_buffer *nextbuf; |
550 | unsigned long flags; | ||
551 | 551 | ||
552 | if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && | 552 | if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && |
553 | buf->buf.length != buf->buf.bytesused) { | 553 | buf->buf.length != buf->buf.bytesused) { |
@@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) | |||
556 | return buf; | 556 | return buf; |
557 | } | 557 | } |
558 | 558 | ||
559 | spin_lock_irqsave(&queue->irqlock, flags); | ||
560 | list_del(&buf->queue); | 559 | list_del(&buf->queue); |
561 | if (!list_empty(&queue->irqqueue)) | 560 | if (!list_empty(&queue->irqqueue)) |
562 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, | 561 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, |
563 | queue); | 562 | queue); |
564 | else | 563 | else |
565 | nextbuf = NULL; | 564 | nextbuf = NULL; |
566 | spin_unlock_irqrestore(&queue->irqlock, flags); | ||
567 | 565 | ||
568 | buf->buf.sequence = queue->sequence++; | 566 | buf->buf.sequence = queue->sequence++; |
569 | do_gettimeofday(&buf->buf.timestamp); | 567 | do_gettimeofday(&buf->buf.timestamp); |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 3e7345172e03..d0a84bd3f3eb 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -218,6 +218,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | |||
218 | u32 portsc; | 218 | u32 portsc; |
219 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | 219 | struct usb_hcd *hcd = ehci_to_hcd(ehci); |
220 | void __iomem *non_ehci = hcd->regs; | 220 | void __iomem *non_ehci = hcd->regs; |
221 | struct fsl_usb2_platform_data *pdata; | ||
222 | |||
223 | pdata = hcd->self.controller->platform_data; | ||
221 | 224 | ||
222 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); | 225 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); |
223 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); | 226 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); |
@@ -234,7 +237,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | |||
234 | /* fall through */ | 237 | /* fall through */ |
235 | case FSL_USB2_PHY_UTMI: | 238 | case FSL_USB2_PHY_UTMI: |
236 | /* enable UTMI PHY */ | 239 | /* enable UTMI PHY */ |
237 | setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); | 240 | if (pdata->have_sysif_regs) |
241 | setbits32(non_ehci + FSL_SOC_USB_CTRL, | ||
242 | CTRL_UTMI_PHY_EN); | ||
238 | portsc |= PORT_PTS_UTMI; | 243 | portsc |= PORT_PTS_UTMI; |
239 | break; | 244 | break; |
240 | case FSL_USB2_PHY_NONE: | 245 | case FSL_USB2_PHY_NONE: |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 057cdda7a489..4a3bc5b7a06f 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -347,6 +347,8 @@ static int ehci_reset (struct ehci_hcd *ehci) | |||
347 | if (ehci->debug) | 347 | if (ehci->debug) |
348 | dbgp_external_startup(); | 348 | dbgp_external_startup(); |
349 | 349 | ||
350 | ehci->port_c_suspend = ehci->suspended_ports = | ||
351 | ehci->resuming_ports = 0; | ||
350 | return retval; | 352 | return retval; |
351 | } | 353 | } |
352 | 354 | ||
@@ -856,8 +858,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
856 | goto dead; | 858 | goto dead; |
857 | } | 859 | } |
858 | 860 | ||
861 | /* | ||
862 | * We don't use STS_FLR, but some controllers don't like it to | ||
863 | * remain on, so mask it out along with the other status bits. | ||
864 | */ | ||
865 | masked_status = status & (INTR_MASK | STS_FLR); | ||
866 | |||
859 | /* Shared IRQ? */ | 867 | /* Shared IRQ? */ |
860 | masked_status = status & INTR_MASK; | ||
861 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { | 868 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { |
862 | spin_unlock(&ehci->lock); | 869 | spin_unlock(&ehci->lock); |
863 | return IRQ_NONE; | 870 | return IRQ_NONE; |
@@ -908,7 +915,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
908 | pcd_status = status; | 915 | pcd_status = status; |
909 | 916 | ||
910 | /* resume root hub? */ | 917 | /* resume root hub? */ |
911 | if (!(cmd & CMD_RUN)) | 918 | if (ehci->rh_state == EHCI_RH_SUSPENDED) |
912 | usb_hcd_resume_root_hub(hcd); | 919 | usb_hcd_resume_root_hub(hcd); |
913 | 920 | ||
914 | /* get per-port change detect bits */ | 921 | /* get per-port change detect bits */ |
@@ -939,6 +946,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
939 | * like usb_port_resume() does. | 946 | * like usb_port_resume() does. |
940 | */ | 947 | */ |
941 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); | 948 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); |
949 | set_bit(i, &ehci->resuming_ports); | ||
942 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 950 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
943 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | 951 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); |
944 | } | 952 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 256fbd42e48c..38fe07623152 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -223,15 +223,10 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
223 | * remote wakeup, we must fail the suspend. | 223 | * remote wakeup, we must fail the suspend. |
224 | */ | 224 | */ |
225 | if (hcd->self.root_hub->do_remote_wakeup) { | 225 | if (hcd->self.root_hub->do_remote_wakeup) { |
226 | port = HCS_N_PORTS(ehci->hcs_params); | 226 | if (ehci->resuming_ports) { |
227 | while (port--) { | 227 | spin_unlock_irq(&ehci->lock); |
228 | if (ehci->reset_done[port] != 0) { | 228 | ehci_dbg(ehci, "suspend failed because a port is resuming\n"); |
229 | spin_unlock_irq(&ehci->lock); | 229 | return -EBUSY; |
230 | ehci_dbg(ehci, "suspend failed because " | ||
231 | "port %d is resuming\n", | ||
232 | port + 1); | ||
233 | return -EBUSY; | ||
234 | } | ||
235 | } | 230 | } |
236 | } | 231 | } |
237 | 232 | ||
@@ -554,16 +549,12 @@ static int | |||
554 | ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | 549 | ehci_hub_status_data (struct usb_hcd *hcd, char *buf) |
555 | { | 550 | { |
556 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 551 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
557 | u32 temp, status = 0; | 552 | u32 temp, status; |
558 | u32 mask; | 553 | u32 mask; |
559 | int ports, i, retval = 1; | 554 | int ports, i, retval = 1; |
560 | unsigned long flags; | 555 | unsigned long flags; |
561 | u32 ppcd = 0; | 556 | u32 ppcd = 0; |
562 | 557 | ||
563 | /* if !USB_SUSPEND, root hub timers won't get shut down ... */ | ||
564 | if (ehci->rh_state != EHCI_RH_RUNNING) | ||
565 | return 0; | ||
566 | |||
567 | /* init status to no-changes */ | 558 | /* init status to no-changes */ |
568 | buf [0] = 0; | 559 | buf [0] = 0; |
569 | ports = HCS_N_PORTS (ehci->hcs_params); | 560 | ports = HCS_N_PORTS (ehci->hcs_params); |
@@ -572,6 +563,11 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
572 | retval++; | 563 | retval++; |
573 | } | 564 | } |
574 | 565 | ||
566 | /* Inform the core about resumes-in-progress by returning | ||
567 | * a non-zero value even if there are no status changes. | ||
568 | */ | ||
569 | status = ehci->resuming_ports; | ||
570 | |||
575 | /* Some boards (mostly VIA?) report bogus overcurrent indications, | 571 | /* Some boards (mostly VIA?) report bogus overcurrent indications, |
576 | * causing massive log spam unless we completely ignore them. It | 572 | * causing massive log spam unless we completely ignore them. It |
577 | * may be relevant that VIA VT8235 controllers, where PORT_POWER is | 573 | * may be relevant that VIA VT8235 controllers, where PORT_POWER is |
@@ -846,6 +842,7 @@ static int ehci_hub_control ( | |||
846 | ehci_writel(ehci, | 842 | ehci_writel(ehci, |
847 | temp & ~(PORT_RWC_BITS | PORT_RESUME), | 843 | temp & ~(PORT_RWC_BITS | PORT_RESUME), |
848 | status_reg); | 844 | status_reg); |
845 | clear_bit(wIndex, &ehci->resuming_ports); | ||
849 | retval = handshake(ehci, status_reg, | 846 | retval = handshake(ehci, status_reg, |
850 | PORT_RESUME, 0, 2000 /* 2msec */); | 847 | PORT_RESUME, 0, 2000 /* 2msec */); |
851 | if (retval != 0) { | 848 | if (retval != 0) { |
@@ -864,6 +861,7 @@ static int ehci_hub_control ( | |||
864 | ehci->reset_done[wIndex])) { | 861 | ehci->reset_done[wIndex])) { |
865 | status |= USB_PORT_STAT_C_RESET << 16; | 862 | status |= USB_PORT_STAT_C_RESET << 16; |
866 | ehci->reset_done [wIndex] = 0; | 863 | ehci->reset_done [wIndex] = 0; |
864 | clear_bit(wIndex, &ehci->resuming_ports); | ||
867 | 865 | ||
868 | /* force reset to complete */ | 866 | /* force reset to complete */ |
869 | ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), | 867 | ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), |
@@ -884,8 +882,10 @@ static int ehci_hub_control ( | |||
884 | ehci_readl(ehci, status_reg)); | 882 | ehci_readl(ehci, status_reg)); |
885 | } | 883 | } |
886 | 884 | ||
887 | if (!(temp & (PORT_RESUME|PORT_RESET))) | 885 | if (!(temp & (PORT_RESUME|PORT_RESET))) { |
888 | ehci->reset_done[wIndex] = 0; | 886 | ehci->reset_done[wIndex] = 0; |
887 | clear_bit(wIndex, &ehci->resuming_ports); | ||
888 | } | ||
889 | 889 | ||
890 | /* transfer dedicated ports to the companion hc */ | 890 | /* transfer dedicated ports to the companion hc */ |
891 | if ((temp & PORT_CONNECT) && | 891 | if ((temp & PORT_CONNECT) && |
@@ -920,6 +920,7 @@ static int ehci_hub_control ( | |||
920 | status |= USB_PORT_STAT_SUSPEND; | 920 | status |= USB_PORT_STAT_SUSPEND; |
921 | } else if (test_bit(wIndex, &ehci->suspended_ports)) { | 921 | } else if (test_bit(wIndex, &ehci->suspended_ports)) { |
922 | clear_bit(wIndex, &ehci->suspended_ports); | 922 | clear_bit(wIndex, &ehci->suspended_ports); |
923 | clear_bit(wIndex, &ehci->resuming_ports); | ||
923 | ehci->reset_done[wIndex] = 0; | 924 | ehci->reset_done[wIndex] = 0; |
924 | if (temp & PORT_PE) | 925 | if (temp & PORT_PE) |
925 | set_bit(wIndex, &ehci->port_c_suspend); | 926 | set_bit(wIndex, &ehci->port_c_suspend); |
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index bba9850f32f0..5c78f9e71466 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <plat/usb.h> | 42 | #include <plat/usb.h> |
43 | #include <linux/regulator/consumer.h> | 43 | #include <linux/regulator/consumer.h> |
44 | #include <linux/pm_runtime.h> | 44 | #include <linux/pm_runtime.h> |
45 | #include <linux/gpio.h> | ||
45 | 46 | ||
46 | /* EHCI Register Set */ | 47 | /* EHCI Register Set */ |
47 | #define EHCI_INSNREG04 (0xA0) | 48 | #define EHCI_INSNREG04 (0xA0) |
@@ -191,6 +192,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
191 | } | 192 | } |
192 | } | 193 | } |
193 | 194 | ||
195 | if (pdata->phy_reset) { | ||
196 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
197 | gpio_request_one(pdata->reset_gpio_port[0], | ||
198 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
199 | |||
200 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
201 | gpio_request_one(pdata->reset_gpio_port[1], | ||
202 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
203 | |||
204 | /* Hold the PHY in RESET for enough time till DIR is high */ | ||
205 | udelay(10); | ||
206 | } | ||
207 | |||
194 | pm_runtime_enable(dev); | 208 | pm_runtime_enable(dev); |
195 | pm_runtime_get_sync(dev); | 209 | pm_runtime_get_sync(dev); |
196 | 210 | ||
@@ -237,6 +251,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
237 | /* root ports should always stay powered */ | 251 | /* root ports should always stay powered */ |
238 | ehci_port_power(omap_ehci, 1); | 252 | ehci_port_power(omap_ehci, 1); |
239 | 253 | ||
254 | if (pdata->phy_reset) { | ||
255 | /* Hold the PHY in RESET for enough time till | ||
256 | * PHY is settled and ready | ||
257 | */ | ||
258 | udelay(10); | ||
259 | |||
260 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
261 | gpio_set_value(pdata->reset_gpio_port[0], 1); | ||
262 | |||
263 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
264 | gpio_set_value(pdata->reset_gpio_port[1], 1); | ||
265 | } | ||
266 | |||
240 | return 0; | 267 | return 0; |
241 | 268 | ||
242 | err_add_hcd: | 269 | err_add_hcd: |
@@ -259,8 +286,9 @@ err_io: | |||
259 | */ | 286 | */ |
260 | static int ehci_hcd_omap_remove(struct platform_device *pdev) | 287 | static int ehci_hcd_omap_remove(struct platform_device *pdev) |
261 | { | 288 | { |
262 | struct device *dev = &pdev->dev; | 289 | struct device *dev = &pdev->dev; |
263 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 290 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
291 | struct ehci_hcd_omap_platform_data *pdata = dev->platform_data; | ||
264 | 292 | ||
265 | usb_remove_hcd(hcd); | 293 | usb_remove_hcd(hcd); |
266 | disable_put_regulator(dev->platform_data); | 294 | disable_put_regulator(dev->platform_data); |
@@ -269,6 +297,13 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) | |||
269 | pm_runtime_put_sync(dev); | 297 | pm_runtime_put_sync(dev); |
270 | pm_runtime_disable(dev); | 298 | pm_runtime_disable(dev); |
271 | 299 | ||
300 | if (pdata->phy_reset) { | ||
301 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
302 | gpio_free(pdata->reset_gpio_port[0]); | ||
303 | |||
304 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
305 | gpio_free(pdata->reset_gpio_port[1]); | ||
306 | } | ||
272 | return 0; | 307 | return 0; |
273 | } | 308 | } |
274 | 309 | ||
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 3de48a2d7955..86183366647f 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -224,6 +224,7 @@ static int tegra_ehci_hub_control( | |||
224 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); | 224 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); |
225 | /* start resume signalling */ | 225 | /* start resume signalling */ |
226 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); | 226 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); |
227 | set_bit(wIndex-1, &ehci->resuming_ports); | ||
227 | 228 | ||
228 | spin_unlock_irqrestore(&ehci->lock, flags); | 229 | spin_unlock_irqrestore(&ehci->lock, flags); |
229 | msleep(20); | 230 | msleep(20); |
@@ -236,6 +237,7 @@ static int tegra_ehci_hub_control( | |||
236 | pr_err("%s: timeout waiting for SUSPEND\n", __func__); | 237 | pr_err("%s: timeout waiting for SUSPEND\n", __func__); |
237 | 238 | ||
238 | ehci->reset_done[wIndex-1] = 0; | 239 | ehci->reset_done[wIndex-1] = 0; |
240 | clear_bit(wIndex-1, &ehci->resuming_ports); | ||
239 | 241 | ||
240 | tegra->port_resuming = 1; | 242 | tegra->port_resuming = 1; |
241 | goto done; | 243 | goto done; |
@@ -729,7 +731,6 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
729 | err = -ENODEV; | 731 | err = -ENODEV; |
730 | goto fail; | 732 | goto fail; |
731 | } | 733 | } |
732 | set_irq_flags(irq, IRQF_VALID); | ||
733 | 734 | ||
734 | #ifdef CONFIG_USB_OTG_UTILS | 735 | #ifdef CONFIG_USB_OTG_UTILS |
735 | if (pdata->operating_mode == TEGRA_USB_OTG) { | 736 | if (pdata->operating_mode == TEGRA_USB_OTG) { |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 8f9acbc96fde..2694ed6558d2 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -117,6 +117,8 @@ struct ehci_hcd { /* one per controller */ | |||
117 | the change-suspend feature turned on */ | 117 | the change-suspend feature turned on */ |
118 | unsigned long suspended_ports; /* which ports are | 118 | unsigned long suspended_ports; /* which ports are |
119 | suspended */ | 119 | suspended */ |
120 | unsigned long resuming_ports; /* which ports have | ||
121 | started to resume */ | ||
120 | 122 | ||
121 | /* per-HC memory pools (could be per-bus, but ...) */ | 123 | /* per-HC memory pools (could be per-bus, but ...) */ |
122 | struct dma_pool *qh_pool; /* qh per active urb */ | 124 | struct dma_pool *qh_pool; /* qh per active urb */ |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 09f597ad6e00..13ebeca8e73e 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -94,7 +94,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
94 | 94 | ||
95 | /*-------------------------------------------------------------------------*/ | 95 | /*-------------------------------------------------------------------------*/ |
96 | 96 | ||
97 | static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | 97 | static void __devexit usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); |
98 | 98 | ||
99 | /* configure so an HC device and id are always provided */ | 99 | /* configure so an HC device and id are always provided */ |
100 | /* always called with process context; sleeping is OK */ | 100 | /* always called with process context; sleeping is OK */ |
@@ -108,7 +108,7 @@ static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | |||
108 | * then invokes the start() method for the HCD associated with it | 108 | * then invokes the start() method for the HCD associated with it |
109 | * through the hotplug entry's driver_data. | 109 | * through the hotplug entry's driver_data. |
110 | */ | 110 | */ |
111 | static int usb_hcd_at91_probe(const struct hc_driver *driver, | 111 | static int __devinit usb_hcd_at91_probe(const struct hc_driver *driver, |
112 | struct platform_device *pdev) | 112 | struct platform_device *pdev) |
113 | { | 113 | { |
114 | int retval; | 114 | int retval; |
@@ -203,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
203 | * context, "rmmod" or something similar. | 203 | * context, "rmmod" or something similar. |
204 | * | 204 | * |
205 | */ | 205 | */ |
206 | static void usb_hcd_at91_remove(struct usb_hcd *hcd, | 206 | static void __devexit usb_hcd_at91_remove(struct usb_hcd *hcd, |
207 | struct platform_device *pdev) | 207 | struct platform_device *pdev) |
208 | { | 208 | { |
209 | usb_remove_hcd(hcd); | 209 | usb_remove_hcd(hcd); |
@@ -545,7 +545,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev) | |||
545 | 545 | ||
546 | /*-------------------------------------------------------------------------*/ | 546 | /*-------------------------------------------------------------------------*/ |
547 | 547 | ||
548 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | 548 | static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
549 | { | 549 | { |
550 | struct at91_usbh_data *pdata; | 550 | struct at91_usbh_data *pdata; |
551 | int i; | 551 | int i; |
@@ -620,7 +620,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
620 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | 620 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); |
621 | } | 621 | } |
622 | 622 | ||
623 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | 623 | static int __devexit ohci_hcd_at91_drv_remove(struct platform_device *pdev) |
624 | { | 624 | { |
625 | struct at91_usbh_data *pdata = pdev->dev.platform_data; | 625 | struct at91_usbh_data *pdata = pdev->dev.platform_data; |
626 | int i; | 626 | int i; |
@@ -696,7 +696,7 @@ MODULE_ALIAS("platform:at91_ohci"); | |||
696 | 696 | ||
697 | static struct platform_driver ohci_hcd_at91_driver = { | 697 | static struct platform_driver ohci_hcd_at91_driver = { |
698 | .probe = ohci_hcd_at91_drv_probe, | 698 | .probe = ohci_hcd_at91_drv_probe, |
699 | .remove = ohci_hcd_at91_drv_remove, | 699 | .remove = __devexit_p(ohci_hcd_at91_drv_remove), |
700 | .shutdown = usb_hcd_platform_shutdown, | 700 | .shutdown = usb_hcd_platform_shutdown, |
701 | .suspend = ohci_hcd_at91_drv_suspend, | 701 | .suspend = ohci_hcd_at91_drv_suspend, |
702 | .resume = ohci_hcd_at91_drv_resume, | 702 | .resume = ohci_hcd_at91_drv_resume, |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 11de5f1be981..32dada8c8b4f 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -825,9 +825,13 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev) | |||
825 | } | 825 | } |
826 | } | 826 | } |
827 | 827 | ||
828 | /* Disable any BIOS SMIs */ | 828 | val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); |
829 | writel(XHCI_LEGACY_DISABLE_SMI, | 829 | /* Mask off (turn off) any enabled SMIs */ |
830 | base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); | 830 | val &= XHCI_LEGACY_DISABLE_SMI; |
831 | /* Mask all SMI events bits, RW1C */ | ||
832 | val |= XHCI_LEGACY_SMI_EVENTS; | ||
833 | /* Disable any BIOS SMIs and clear all SMI events*/ | ||
834 | writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); | ||
831 | 835 | ||
832 | if (usb_is_intel_switchable_xhci(pdev)) | 836 | if (usb_is_intel_switchable_xhci(pdev)) |
833 | usb_enable_xhci_ports(pdev); | 837 | usb_enable_xhci_ports(pdev); |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 045cde4cbc3d..768d54295a20 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -196,11 +196,12 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
196 | status = get_hub_status_data(uhci, buf); | 196 | status = get_hub_status_data(uhci, buf); |
197 | 197 | ||
198 | switch (uhci->rh_state) { | 198 | switch (uhci->rh_state) { |
199 | case UHCI_RH_SUSPENDING: | ||
200 | case UHCI_RH_SUSPENDED: | 199 | case UHCI_RH_SUSPENDED: |
201 | /* if port change, ask to be resumed */ | 200 | /* if port change, ask to be resumed */ |
202 | if (status || uhci->resuming_ports) | 201 | if (status || uhci->resuming_ports) { |
202 | status = 1; | ||
203 | usb_hcd_resume_root_hub(hcd); | 203 | usb_hcd_resume_root_hub(hcd); |
204 | } | ||
204 | break; | 205 | break; |
205 | 206 | ||
206 | case UHCI_RH_AUTO_STOPPED: | 207 | case UHCI_RH_AUTO_STOPPED: |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index e9b0f043455d..4b436f5a4171 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -119,7 +119,7 @@ static void xhci_print_command_reg(struct xhci_hcd *xhci) | |||
119 | xhci_dbg(xhci, " Event Interrupts %s\n", | 119 | xhci_dbg(xhci, " Event Interrupts %s\n", |
120 | (temp & CMD_EIE) ? "enabled " : "disabled"); | 120 | (temp & CMD_EIE) ? "enabled " : "disabled"); |
121 | xhci_dbg(xhci, " Host System Error Interrupts %s\n", | 121 | xhci_dbg(xhci, " Host System Error Interrupts %s\n", |
122 | (temp & CMD_EIE) ? "enabled " : "disabled"); | 122 | (temp & CMD_HSEIE) ? "enabled " : "disabled"); |
123 | xhci_dbg(xhci, " HC has %sfinished light reset\n", | 123 | xhci_dbg(xhci, " HC has %sfinished light reset\n", |
124 | (temp & CMD_LRESET) ? "not " : ""); | 124 | (temp & CMD_LRESET) ? "not " : ""); |
125 | } | 125 | } |
diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h index c7f33123d4c0..377f4242dabb 100644 --- a/drivers/usb/host/xhci-ext-caps.h +++ b/drivers/usb/host/xhci-ext-caps.h | |||
@@ -62,8 +62,9 @@ | |||
62 | /* USB Legacy Support Control and Status Register - section 7.1.2 */ | 62 | /* USB Legacy Support Control and Status Register - section 7.1.2 */ |
63 | /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ | 63 | /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ |
64 | #define XHCI_LEGACY_CONTROL_OFFSET (0x04) | 64 | #define XHCI_LEGACY_CONTROL_OFFSET (0x04) |
65 | /* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ | 65 | /* bits 1:3, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ |
66 | #define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17)) | 66 | #define XHCI_LEGACY_DISABLE_SMI ((0x7 << 1) + (0xff << 5) + (0x7 << 17)) |
67 | #define XHCI_LEGACY_SMI_EVENTS (0x7 << 29) | ||
67 | 68 | ||
68 | /* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ | 69 | /* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ |
69 | #define XHCI_L1C (1 << 16) | 70 | #define XHCI_L1C (1 << 16) |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index cae4c6f2845a..68eaa908ac8e 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1796,11 +1796,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1796 | int i; | 1796 | int i; |
1797 | 1797 | ||
1798 | /* Free the Event Ring Segment Table and the actual Event Ring */ | 1798 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
1799 | if (xhci->ir_set) { | ||
1800 | xhci_writel(xhci, 0, &xhci->ir_set->erst_size); | ||
1801 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_base); | ||
1802 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue); | ||
1803 | } | ||
1804 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | 1799 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
1805 | if (xhci->erst.entries) | 1800 | if (xhci->erst.entries) |
1806 | dma_free_coherent(&pdev->dev, size, | 1801 | dma_free_coherent(&pdev->dev, size, |
@@ -1812,7 +1807,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1812 | xhci->event_ring = NULL; | 1807 | xhci->event_ring = NULL; |
1813 | xhci_dbg(xhci, "Freed event ring\n"); | 1808 | xhci_dbg(xhci, "Freed event ring\n"); |
1814 | 1809 | ||
1815 | xhci_write_64(xhci, 0, &xhci->op_regs->cmd_ring); | ||
1816 | if (xhci->cmd_ring) | 1810 | if (xhci->cmd_ring) |
1817 | xhci_ring_free(xhci, xhci->cmd_ring); | 1811 | xhci_ring_free(xhci, xhci->cmd_ring); |
1818 | xhci->cmd_ring = NULL; | 1812 | xhci->cmd_ring = NULL; |
@@ -1841,7 +1835,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1841 | xhci->medium_streams_pool = NULL; | 1835 | xhci->medium_streams_pool = NULL; |
1842 | xhci_dbg(xhci, "Freed medium stream array pool\n"); | 1836 | xhci_dbg(xhci, "Freed medium stream array pool\n"); |
1843 | 1837 | ||
1844 | xhci_write_64(xhci, 0, &xhci->op_regs->dcbaa_ptr); | ||
1845 | if (xhci->dcbaa) | 1838 | if (xhci->dcbaa) |
1846 | dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), | 1839 | dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), |
1847 | xhci->dcbaa, xhci->dcbaa->dma); | 1840 | xhci->dcbaa, xhci->dcbaa->dma); |
@@ -2459,6 +2452,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2459 | 2452 | ||
2460 | fail: | 2453 | fail: |
2461 | xhci_warn(xhci, "Couldn't initialize memory\n"); | 2454 | xhci_warn(xhci, "Couldn't initialize memory\n"); |
2455 | xhci_halt(xhci); | ||
2456 | xhci_reset(xhci); | ||
2462 | xhci_mem_cleanup(xhci); | 2457 | xhci_mem_cleanup(xhci); |
2463 | return -ENOMEM; | 2458 | return -ENOMEM; |
2464 | } | 2459 | } |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index ef98b38626fb..7a856a767e77 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -95,6 +95,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
95 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 95 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
96 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); | 96 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); |
97 | } | 97 | } |
98 | if (pdev->vendor == PCI_VENDOR_ID_VIA) | ||
99 | xhci->quirks |= XHCI_RESET_ON_RESUME; | ||
98 | } | 100 | } |
99 | 101 | ||
100 | /* called during probe() after chip reset completes */ | 102 | /* called during probe() after chip reset completes */ |
@@ -326,7 +328,7 @@ int __init xhci_register_pci(void) | |||
326 | return pci_register_driver(&xhci_pci_driver); | 328 | return pci_register_driver(&xhci_pci_driver); |
327 | } | 329 | } |
328 | 330 | ||
329 | void __exit xhci_unregister_pci(void) | 331 | void xhci_unregister_pci(void) |
330 | { | 332 | { |
331 | pci_unregister_driver(&xhci_pci_driver); | 333 | pci_unregister_driver(&xhci_pci_driver); |
332 | } | 334 | } |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 6bd9d53062eb..3d9422f16a20 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -2417,7 +2417,7 @@ hw_died: | |||
2417 | u32 irq_pending; | 2417 | u32 irq_pending; |
2418 | /* Acknowledge the PCI interrupt */ | 2418 | /* Acknowledge the PCI interrupt */ |
2419 | irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 2419 | irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
2420 | irq_pending |= 0x3; | 2420 | irq_pending |= IMAN_IP; |
2421 | xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); | 2421 | xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); |
2422 | } | 2422 | } |
2423 | 2423 | ||
@@ -2734,7 +2734,7 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2734 | urb->dev->speed == USB_SPEED_FULL) | 2734 | urb->dev->speed == USB_SPEED_FULL) |
2735 | urb->interval /= 8; | 2735 | urb->interval /= 8; |
2736 | } | 2736 | } |
2737 | return xhci_queue_bulk_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); | 2737 | return xhci_queue_bulk_tx(xhci, mem_flags, urb, slot_id, ep_index); |
2738 | } | 2738 | } |
2739 | 2739 | ||
2740 | /* | 2740 | /* |
@@ -3514,7 +3514,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3514 | } | 3514 | } |
3515 | ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free; | 3515 | ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free; |
3516 | 3516 | ||
3517 | return xhci_queue_isoc_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); | 3517 | return xhci_queue_isoc_tx(xhci, mem_flags, urb, slot_id, ep_index); |
3518 | } | 3518 | } |
3519 | 3519 | ||
3520 | /**** Command Ring Operations ****/ | 3520 | /**** Command Ring Operations ****/ |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e1963d4a430f..36641a7f2371 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -106,6 +106,9 @@ int xhci_halt(struct xhci_hcd *xhci) | |||
106 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); | 106 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); |
107 | if (!ret) | 107 | if (!ret) |
108 | xhci->xhc_state |= XHCI_STATE_HALTED; | 108 | xhci->xhc_state |= XHCI_STATE_HALTED; |
109 | else | ||
110 | xhci_warn(xhci, "Host not halted after %u microseconds.\n", | ||
111 | XHCI_MAX_HALT_USEC); | ||
109 | return ret; | 112 | return ret; |
110 | } | 113 | } |
111 | 114 | ||
@@ -664,11 +667,11 @@ static void xhci_save_registers(struct xhci_hcd *xhci) | |||
664 | xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); | 667 | xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); |
665 | xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); | 668 | xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); |
666 | xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); | 669 | xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); |
667 | xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | ||
668 | xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); | ||
669 | xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); | 670 | xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); |
670 | xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); | 671 | xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); |
671 | xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); | 672 | xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); |
673 | xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | ||
674 | xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); | ||
672 | } | 675 | } |
673 | 676 | ||
674 | static void xhci_restore_registers(struct xhci_hcd *xhci) | 677 | static void xhci_restore_registers(struct xhci_hcd *xhci) |
@@ -677,10 +680,11 @@ static void xhci_restore_registers(struct xhci_hcd *xhci) | |||
677 | xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); | 680 | xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); |
678 | xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); | 681 | xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); |
679 | xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); | 682 | xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); |
680 | xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); | ||
681 | xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); | ||
682 | xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); | 683 | xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); |
683 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); | 684 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); |
685 | xhci_write_64(xhci, xhci->s3.erst_dequeue, &xhci->ir_set->erst_dequeue); | ||
686 | xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); | ||
687 | xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); | ||
684 | } | 688 | } |
685 | 689 | ||
686 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) | 690 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 91074fdab3eb..3d69c4b2b542 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -205,6 +205,10 @@ struct xhci_op_regs { | |||
205 | #define CMD_PM_INDEX (1 << 11) | 205 | #define CMD_PM_INDEX (1 << 11) |
206 | /* bits 12:31 are reserved (and should be preserved on writes). */ | 206 | /* bits 12:31 are reserved (and should be preserved on writes). */ |
207 | 207 | ||
208 | /* IMAN - Interrupt Management Register */ | ||
209 | #define IMAN_IP (1 << 1) | ||
210 | #define IMAN_IE (1 << 0) | ||
211 | |||
208 | /* USBSTS - USB status - status bitmasks */ | 212 | /* USBSTS - USB status - status bitmasks */ |
209 | /* HC not running - set to 1 when run/stop bit is cleared. */ | 213 | /* HC not running - set to 1 when run/stop bit is cleared. */ |
210 | #define STS_HALT XHCI_STS_HALT | 214 | #define STS_HALT XHCI_STS_HALT |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 959145baf3cf..9dcb68f04f03 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -423,7 +423,7 @@ alloc_sglist(int nents, int max, int vary) | |||
423 | unsigned i; | 423 | unsigned i; |
424 | unsigned size = max; | 424 | unsigned size = max; |
425 | 425 | ||
426 | sg = kmalloc(nents * sizeof *sg, GFP_KERNEL); | 426 | sg = kmalloc_array(nents, sizeof *sg, GFP_KERNEL); |
427 | if (!sg) | 427 | if (!sg) |
428 | return NULL; | 428 | return NULL; |
429 | sg_init_table(sg, nents); | 429 | sg_init_table(sg, nents); |
@@ -904,6 +904,9 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param) | |||
904 | struct ctrl_ctx context; | 904 | struct ctrl_ctx context; |
905 | int i; | 905 | int i; |
906 | 906 | ||
907 | if (param->sglen == 0 || param->iterations > UINT_MAX / param->sglen) | ||
908 | return -EOPNOTSUPP; | ||
909 | |||
907 | spin_lock_init(&context.lock); | 910 | spin_lock_init(&context.lock); |
908 | context.dev = dev; | 911 | context.dev = dev; |
909 | init_completion(&context.complete); | 912 | init_completion(&context.complete); |
@@ -1981,8 +1984,6 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf) | |||
1981 | 1984 | ||
1982 | /* queued control messaging */ | 1985 | /* queued control messaging */ |
1983 | case 10: | 1986 | case 10: |
1984 | if (param->sglen == 0) | ||
1985 | break; | ||
1986 | retval = 0; | 1987 | retval = 0; |
1987 | dev_info(&intf->dev, | 1988 | dev_info(&intf->dev, |
1988 | "TEST 10: queue %d control calls, %d times\n", | 1989 | "TEST 10: queue %d control calls, %d times\n", |
@@ -2276,6 +2277,8 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2276 | if (status < 0) { | 2277 | if (status < 0) { |
2277 | WARNING(dev, "couldn't get endpoints, %d\n", | 2278 | WARNING(dev, "couldn't get endpoints, %d\n", |
2278 | status); | 2279 | status); |
2280 | kfree(dev->buf); | ||
2281 | kfree(dev); | ||
2279 | return status; | 2282 | return status; |
2280 | } | 2283 | } |
2281 | /* may find bulk or ISO pipes */ | 2284 | /* may find bulk or ISO pipes */ |
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 897edda42270..70201462e19c 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
@@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref) | |||
99 | usb_put_dev(dev->udev); | 99 | usb_put_dev(dev->udev); |
100 | if (dev->cntl_urb) { | 100 | if (dev->cntl_urb) { |
101 | usb_kill_urb(dev->cntl_urb); | 101 | usb_kill_urb(dev->cntl_urb); |
102 | if (dev->cntl_req) | 102 | kfree(dev->cntl_req); |
103 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | ||
104 | dev->cntl_req, dev->cntl_urb->setup_dma); | ||
105 | if (dev->cntl_buffer) | 103 | if (dev->cntl_buffer) |
106 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | 104 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, |
107 | dev->cntl_buffer, dev->cntl_urb->transfer_dma); | 105 | dev->cntl_buffer, dev->cntl_urb->transfer_dma); |
@@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
234 | } | 232 | } |
235 | 233 | ||
236 | /* allocate buffer for control req */ | 234 | /* allocate buffer for control req */ |
237 | dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, | 235 | dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL); |
238 | GFP_KERNEL, | ||
239 | &dev->cntl_urb->setup_dma); | ||
240 | if (!dev->cntl_req) { | 236 | if (!dev->cntl_req) { |
241 | err("Could not allocate cntl_req"); | 237 | err("Could not allocate cntl_req"); |
242 | goto error; | 238 | goto error; |
@@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
286 | usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), | 282 | usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), |
287 | dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, | 283 | dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, |
288 | dev, 1); | 284 | dev, 1); |
289 | dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 285 | dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
290 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { | 286 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { |
291 | retval = -EIO; | 287 | retval = -EIO; |
292 | err("Could not submitting URB"); | 288 | err("Could not submitting URB"); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 0f8b82918a40..66aaccf04490 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -137,6 +137,9 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) | |||
137 | int i = 0; | 137 | int i = 0; |
138 | u8 r; | 138 | u8 r; |
139 | u8 power; | 139 | u8 power; |
140 | int ret; | ||
141 | |||
142 | pm_runtime_get_sync(phy->io_dev); | ||
140 | 143 | ||
141 | /* Make sure the transceiver is not in low power mode */ | 144 | /* Make sure the transceiver is not in low power mode */ |
142 | power = musb_readb(addr, MUSB_POWER); | 145 | power = musb_readb(addr, MUSB_POWER); |
@@ -154,15 +157,22 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) | |||
154 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) | 157 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
155 | & MUSB_ULPI_REG_CMPLT)) { | 158 | & MUSB_ULPI_REG_CMPLT)) { |
156 | i++; | 159 | i++; |
157 | if (i == 10000) | 160 | if (i == 10000) { |
158 | return -ETIMEDOUT; | 161 | ret = -ETIMEDOUT; |
162 | goto out; | ||
163 | } | ||
159 | 164 | ||
160 | } | 165 | } |
161 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); | 166 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); |
162 | r &= ~MUSB_ULPI_REG_CMPLT; | 167 | r &= ~MUSB_ULPI_REG_CMPLT; |
163 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); | 168 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); |
164 | 169 | ||
165 | return musb_readb(addr, MUSB_ULPI_REG_DATA); | 170 | ret = musb_readb(addr, MUSB_ULPI_REG_DATA); |
171 | |||
172 | out: | ||
173 | pm_runtime_put(phy->io_dev); | ||
174 | |||
175 | return ret; | ||
166 | } | 176 | } |
167 | 177 | ||
168 | static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | 178 | static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) |
@@ -171,6 +181,9 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | |||
171 | int i = 0; | 181 | int i = 0; |
172 | u8 r = 0; | 182 | u8 r = 0; |
173 | u8 power; | 183 | u8 power; |
184 | int ret = 0; | ||
185 | |||
186 | pm_runtime_get_sync(phy->io_dev); | ||
174 | 187 | ||
175 | /* Make sure the transceiver is not in low power mode */ | 188 | /* Make sure the transceiver is not in low power mode */ |
176 | power = musb_readb(addr, MUSB_POWER); | 189 | power = musb_readb(addr, MUSB_POWER); |
@@ -184,15 +197,20 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | |||
184 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) | 197 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
185 | & MUSB_ULPI_REG_CMPLT)) { | 198 | & MUSB_ULPI_REG_CMPLT)) { |
186 | i++; | 199 | i++; |
187 | if (i == 10000) | 200 | if (i == 10000) { |
188 | return -ETIMEDOUT; | 201 | ret = -ETIMEDOUT; |
202 | goto out; | ||
203 | } | ||
189 | } | 204 | } |
190 | 205 | ||
191 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); | 206 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); |
192 | r &= ~MUSB_ULPI_REG_CMPLT; | 207 | r &= ~MUSB_ULPI_REG_CMPLT; |
193 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); | 208 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); |
194 | 209 | ||
195 | return 0; | 210 | out: |
211 | pm_runtime_put(phy->io_dev); | ||
212 | |||
213 | return ret; | ||
196 | } | 214 | } |
197 | #else | 215 | #else |
198 | #define musb_ulpi_read NULL | 216 | #define musb_ulpi_read NULL |
@@ -1904,14 +1922,17 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1904 | 1922 | ||
1905 | if (!musb->isr) { | 1923 | if (!musb->isr) { |
1906 | status = -ENODEV; | 1924 | status = -ENODEV; |
1907 | goto fail3; | 1925 | goto fail2; |
1908 | } | 1926 | } |
1909 | 1927 | ||
1910 | if (!musb->xceiv->io_ops) { | 1928 | if (!musb->xceiv->io_ops) { |
1929 | musb->xceiv->io_dev = musb->controller; | ||
1911 | musb->xceiv->io_priv = musb->mregs; | 1930 | musb->xceiv->io_priv = musb->mregs; |
1912 | musb->xceiv->io_ops = &musb_ulpi_access; | 1931 | musb->xceiv->io_ops = &musb_ulpi_access; |
1913 | } | 1932 | } |
1914 | 1933 | ||
1934 | pm_runtime_get_sync(musb->controller); | ||
1935 | |||
1915 | #ifndef CONFIG_MUSB_PIO_ONLY | 1936 | #ifndef CONFIG_MUSB_PIO_ONLY |
1916 | if (use_dma && dev->dma_mask) { | 1937 | if (use_dma && dev->dma_mask) { |
1917 | struct dma_controller *c; | 1938 | struct dma_controller *c; |
@@ -2023,6 +2044,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2023 | goto fail5; | 2044 | goto fail5; |
2024 | #endif | 2045 | #endif |
2025 | 2046 | ||
2047 | pm_runtime_put(musb->controller); | ||
2048 | |||
2026 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", | 2049 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", |
2027 | ({char *s; | 2050 | ({char *s; |
2028 | switch (musb->board_mode) { | 2051 | switch (musb->board_mode) { |
@@ -2047,6 +2070,9 @@ fail4: | |||
2047 | musb_gadget_cleanup(musb); | 2070 | musb_gadget_cleanup(musb); |
2048 | 2071 | ||
2049 | fail3: | 2072 | fail3: |
2073 | pm_runtime_put_sync(musb->controller); | ||
2074 | |||
2075 | fail2: | ||
2050 | if (musb->irq_wake) | 2076 | if (musb->irq_wake) |
2051 | device_init_wakeup(dev, 0); | 2077 | device_init_wakeup(dev, 0); |
2052 | musb_platform_exit(musb); | 2078 | musb_platform_exit(musb); |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 79cb0af779fa..ef8d744800ac 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2098,7 +2098,7 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) | |||
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | /* turn off DMA requests, discard state, stop polling ... */ | 2100 | /* turn off DMA requests, discard state, stop polling ... */ |
2101 | if (is_in) { | 2101 | if (ep->epnum && is_in) { |
2102 | /* giveback saves bulk toggle */ | 2102 | /* giveback saves bulk toggle */ |
2103 | csr = musb_h_flush_rxfifo(ep, 0); | 2103 | csr = musb_h_flush_rxfifo(ep, 0); |
2104 | 2104 | ||
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 2ae0bb309994..c7785e81254c 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work) | |||
282 | 282 | ||
283 | static int omap2430_musb_init(struct musb *musb) | 283 | static int omap2430_musb_init(struct musb *musb) |
284 | { | 284 | { |
285 | u32 l, status = 0; | 285 | u32 l; |
286 | int status = 0; | ||
286 | struct device *dev = musb->controller; | 287 | struct device *dev = musb->controller; |
287 | struct musb_hdrc_platform_data *plat = dev->platform_data; | 288 | struct musb_hdrc_platform_data *plat = dev->platform_data; |
288 | struct omap_musb_board_data *data = plat->board_data; | 289 | struct omap_musb_board_data *data = plat->board_data; |
@@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
301 | 302 | ||
302 | status = pm_runtime_get_sync(dev); | 303 | status = pm_runtime_get_sync(dev); |
303 | if (status < 0) { | 304 | if (status < 0) { |
304 | dev_err(dev, "pm_runtime_get_sync FAILED"); | 305 | dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); |
305 | goto err1; | 306 | goto err1; |
306 | } | 307 | } |
307 | 308 | ||
@@ -333,6 +334,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
333 | 334 | ||
334 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); | 335 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); |
335 | 336 | ||
337 | pm_runtime_put_noidle(musb->controller); | ||
336 | return 0; | 338 | return 0; |
337 | 339 | ||
338 | err1: | 340 | err1: |
@@ -452,14 +454,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev) | |||
452 | goto err2; | 454 | goto err2; |
453 | } | 455 | } |
454 | 456 | ||
457 | pm_runtime_enable(&pdev->dev); | ||
458 | |||
455 | ret = platform_device_add(musb); | 459 | ret = platform_device_add(musb); |
456 | if (ret) { | 460 | if (ret) { |
457 | dev_err(&pdev->dev, "failed to register musb device\n"); | 461 | dev_err(&pdev->dev, "failed to register musb device\n"); |
458 | goto err2; | 462 | goto err2; |
459 | } | 463 | } |
460 | 464 | ||
461 | pm_runtime_enable(&pdev->dev); | ||
462 | |||
463 | return 0; | 465 | return 0; |
464 | 466 | ||
465 | err2: | 467 | err2: |
@@ -478,7 +480,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev) | |||
478 | 480 | ||
479 | platform_device_del(glue->musb); | 481 | platform_device_del(glue->musb); |
480 | platform_device_put(glue->musb); | 482 | platform_device_put(glue->musb); |
481 | pm_runtime_put(&pdev->dev); | ||
482 | kfree(glue); | 483 | kfree(glue); |
483 | 484 | ||
484 | return 0; | 485 | return 0; |
@@ -491,11 +492,13 @@ static int omap2430_runtime_suspend(struct device *dev) | |||
491 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 492 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
492 | struct musb *musb = glue_to_musb(glue); | 493 | struct musb *musb = glue_to_musb(glue); |
493 | 494 | ||
494 | musb->context.otg_interfsel = musb_readl(musb->mregs, | 495 | if (musb) { |
495 | OTG_INTERFSEL); | 496 | musb->context.otg_interfsel = musb_readl(musb->mregs, |
497 | OTG_INTERFSEL); | ||
496 | 498 | ||
497 | omap2430_low_level_exit(musb); | 499 | omap2430_low_level_exit(musb); |
498 | usb_phy_set_suspend(musb->xceiv, 1); | 500 | usb_phy_set_suspend(musb->xceiv, 1); |
501 | } | ||
499 | 502 | ||
500 | return 0; | 503 | return 0; |
501 | } | 504 | } |
@@ -505,11 +508,13 @@ static int omap2430_runtime_resume(struct device *dev) | |||
505 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 508 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
506 | struct musb *musb = glue_to_musb(glue); | 509 | struct musb *musb = glue_to_musb(glue); |
507 | 510 | ||
508 | omap2430_low_level_init(musb); | 511 | if (musb) { |
509 | musb_writel(musb->mregs, OTG_INTERFSEL, | 512 | omap2430_low_level_init(musb); |
510 | musb->context.otg_interfsel); | 513 | musb_writel(musb->mregs, OTG_INTERFSEL, |
514 | musb->context.otg_interfsel); | ||
511 | 515 | ||
512 | usb_phy_set_suspend(musb->xceiv, 0); | 516 | usb_phy_set_suspend(musb->xceiv, 0); |
517 | } | ||
513 | 518 | ||
514 | return 0; | 519 | return 0; |
515 | } | 520 | } |
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 7f547dc3a590..ed8adb052ca7 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c | |||
@@ -60,8 +60,6 @@ static int usb_serial_device_probe(struct device *dev) | |||
60 | retval = -ENODEV; | 60 | retval = -ENODEV; |
61 | goto exit; | 61 | goto exit; |
62 | } | 62 | } |
63 | if (port->dev_state != PORT_REGISTERING) | ||
64 | goto exit; | ||
65 | 63 | ||
66 | driver = port->serial->type; | 64 | driver = port->serial->type; |
67 | if (driver->port_probe) { | 65 | if (driver->port_probe) { |
@@ -98,9 +96,6 @@ static int usb_serial_device_remove(struct device *dev) | |||
98 | if (!port) | 96 | if (!port) |
99 | return -ENODEV; | 97 | return -ENODEV; |
100 | 98 | ||
101 | if (port->dev_state != PORT_UNREGISTERING) | ||
102 | return retval; | ||
103 | |||
104 | device_remove_file(&port->dev, &dev_attr_port_number); | 99 | device_remove_file(&port->dev, &dev_attr_port_number); |
105 | 100 | ||
106 | driver = port->serial->type; | 101 | driver = port->serial->type; |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 0310e2df59f5..ec30f95ef399 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -287,7 +287,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, | |||
287 | /* Issue the request, attempting to read 'size' bytes */ | 287 | /* Issue the request, attempting to read 'size' bytes */ |
288 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 288 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
289 | request, REQTYPE_DEVICE_TO_HOST, 0x0000, | 289 | request, REQTYPE_DEVICE_TO_HOST, 0x0000, |
290 | port_priv->bInterfaceNumber, buf, size, 300); | 290 | port_priv->bInterfaceNumber, buf, size, |
291 | USB_CTRL_GET_TIMEOUT); | ||
291 | 292 | ||
292 | /* Convert data into an array of integers */ | 293 | /* Convert data into an array of integers */ |
293 | for (i = 0; i < length; i++) | 294 | for (i = 0; i < length; i++) |
@@ -340,12 +341,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, | |||
340 | result = usb_control_msg(serial->dev, | 341 | result = usb_control_msg(serial->dev, |
341 | usb_sndctrlpipe(serial->dev, 0), | 342 | usb_sndctrlpipe(serial->dev, 0), |
342 | request, REQTYPE_HOST_TO_DEVICE, 0x0000, | 343 | request, REQTYPE_HOST_TO_DEVICE, 0x0000, |
343 | port_priv->bInterfaceNumber, buf, size, 300); | 344 | port_priv->bInterfaceNumber, buf, size, |
345 | USB_CTRL_SET_TIMEOUT); | ||
344 | } else { | 346 | } else { |
345 | result = usb_control_msg(serial->dev, | 347 | result = usb_control_msg(serial->dev, |
346 | usb_sndctrlpipe(serial->dev, 0), | 348 | usb_sndctrlpipe(serial->dev, 0), |
347 | request, REQTYPE_HOST_TO_DEVICE, data[0], | 349 | request, REQTYPE_HOST_TO_DEVICE, data[0], |
348 | port_priv->bInterfaceNumber, NULL, 0, 300); | 350 | port_priv->bInterfaceNumber, NULL, 0, |
351 | USB_CTRL_SET_TIMEOUT); | ||
349 | } | 352 | } |
350 | 353 | ||
351 | kfree(buf); | 354 | kfree(buf); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ff8605b4b4be..02e7f2d32d52 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -75,7 +75,8 @@ struct ftdi_private { | |||
75 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 75 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
76 | struct async_icount icount; | 76 | struct async_icount icount; |
77 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | 77 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ |
78 | char prev_status, diff_status; /* Used for TIOCMIWAIT */ | 78 | char prev_status; /* Used for TIOCMIWAIT */ |
79 | bool dev_gone; /* Used to abort TIOCMIWAIT */ | ||
79 | char transmit_empty; /* If transmitter is empty or not */ | 80 | char transmit_empty; /* If transmitter is empty or not */ |
80 | struct usb_serial_port *port; | 81 | struct usb_serial_port *port; |
81 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface | 82 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface |
@@ -1681,6 +1682,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
1681 | init_waitqueue_head(&priv->delta_msr_wait); | 1682 | init_waitqueue_head(&priv->delta_msr_wait); |
1682 | 1683 | ||
1683 | priv->flags = ASYNC_LOW_LATENCY; | 1684 | priv->flags = ASYNC_LOW_LATENCY; |
1685 | priv->dev_gone = false; | ||
1684 | 1686 | ||
1685 | if (quirk && quirk->port_probe) | 1687 | if (quirk && quirk->port_probe) |
1686 | quirk->port_probe(priv); | 1688 | quirk->port_probe(priv); |
@@ -1839,6 +1841,9 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port) | |||
1839 | 1841 | ||
1840 | dbg("%s", __func__); | 1842 | dbg("%s", __func__); |
1841 | 1843 | ||
1844 | priv->dev_gone = true; | ||
1845 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1846 | |||
1842 | remove_sysfs_attrs(port); | 1847 | remove_sysfs_attrs(port); |
1843 | 1848 | ||
1844 | kref_put(&priv->kref, ftdi_sio_priv_release); | 1849 | kref_put(&priv->kref, ftdi_sio_priv_release); |
@@ -1982,17 +1987,19 @@ static int ftdi_process_packet(struct tty_struct *tty, | |||
1982 | N.B. packet may be processed more than once, but differences | 1987 | N.B. packet may be processed more than once, but differences |
1983 | are only processed once. */ | 1988 | are only processed once. */ |
1984 | status = packet[0] & FTDI_STATUS_B0_MASK; | 1989 | status = packet[0] & FTDI_STATUS_B0_MASK; |
1985 | if (status & FTDI_RS0_CTS) | ||
1986 | priv->icount.cts++; | ||
1987 | if (status & FTDI_RS0_DSR) | ||
1988 | priv->icount.dsr++; | ||
1989 | if (status & FTDI_RS0_RI) | ||
1990 | priv->icount.rng++; | ||
1991 | if (status & FTDI_RS0_RLSD) | ||
1992 | priv->icount.dcd++; | ||
1993 | if (status != priv->prev_status) { | 1990 | if (status != priv->prev_status) { |
1994 | priv->diff_status |= status ^ priv->prev_status; | 1991 | char diff_status = status ^ priv->prev_status; |
1995 | wake_up_interruptible(&priv->delta_msr_wait); | 1992 | |
1993 | if (diff_status & FTDI_RS0_CTS) | ||
1994 | priv->icount.cts++; | ||
1995 | if (diff_status & FTDI_RS0_DSR) | ||
1996 | priv->icount.dsr++; | ||
1997 | if (diff_status & FTDI_RS0_RI) | ||
1998 | priv->icount.rng++; | ||
1999 | if (diff_status & FTDI_RS0_RLSD) | ||
2000 | priv->icount.dcd++; | ||
2001 | |||
2002 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1996 | priv->prev_status = status; | 2003 | priv->prev_status = status; |
1997 | } | 2004 | } |
1998 | 2005 | ||
@@ -2395,15 +2402,12 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2395 | */ | 2402 | */ |
2396 | case TIOCMIWAIT: | 2403 | case TIOCMIWAIT: |
2397 | cprev = priv->icount; | 2404 | cprev = priv->icount; |
2398 | while (1) { | 2405 | while (!priv->dev_gone) { |
2399 | interruptible_sleep_on(&priv->delta_msr_wait); | 2406 | interruptible_sleep_on(&priv->delta_msr_wait); |
2400 | /* see if a signal did it */ | 2407 | /* see if a signal did it */ |
2401 | if (signal_pending(current)) | 2408 | if (signal_pending(current)) |
2402 | return -ERESTARTSYS; | 2409 | return -ERESTARTSYS; |
2403 | cnow = priv->icount; | 2410 | cnow = priv->icount; |
2404 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | ||
2405 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | ||
2406 | return -EIO; /* no change => error */ | ||
2407 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | 2411 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
2408 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | 2412 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
2409 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || | 2413 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || |
@@ -2412,7 +2416,7 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2412 | } | 2416 | } |
2413 | cprev = cnow; | 2417 | cprev = cnow; |
2414 | } | 2418 | } |
2415 | /* not reached */ | 2419 | return -EIO; |
2416 | break; | 2420 | break; |
2417 | case TIOCSERGETLSR: | 2421 | case TIOCSERGETLSR: |
2418 | return get_lsr_info(port, (struct serial_struct __user *)arg); | 2422 | return get_lsr_info(port, (struct serial_struct __user *)arg); |
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 6e1622f2a297..08d16e8c002d 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -27,8 +27,8 @@ | |||
27 | 27 | ||
28 | /* Product information. */ | 28 | /* Product information. */ |
29 | #define FOCUS_VENDOR_ID 0x0C2E | 29 | #define FOCUS_VENDOR_ID 0x0C2E |
30 | #define FOCUS_PRODUCT_ID 0x0720 | 30 | #define FOCUS_PRODUCT_ID_BI 0x0720 |
31 | #define FOCUS_PRODUCT_ID_UNI 0x0710 | 31 | #define FOCUS_PRODUCT_ID_UNI 0x0700 |
32 | 32 | ||
33 | #define METROUSB_SET_REQUEST_TYPE 0x40 | 33 | #define METROUSB_SET_REQUEST_TYPE 0x40 |
34 | #define METROUSB_SET_MODEM_CTRL_REQUEST 10 | 34 | #define METROUSB_SET_MODEM_CTRL_REQUEST 10 |
@@ -47,7 +47,7 @@ struct metrousb_private { | |||
47 | 47 | ||
48 | /* Device table list. */ | 48 | /* Device table list. */ |
49 | static struct usb_device_id id_table[] = { | 49 | static struct usb_device_id id_table[] = { |
50 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID) }, | 50 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_BI) }, |
51 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, | 51 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, |
52 | { }, /* Terminating entry. */ | 52 | { }, /* Terminating entry. */ |
53 | }; | 53 | }; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 836cfa9a515f..f4465ccddc35 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -708,6 +708,7 @@ static const struct usb_device_id option_ids[] = { | |||
708 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, | 708 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, |
709 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, | 709 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, |
710 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, | 710 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, |
711 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED) }, | ||
711 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, | 712 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, |
712 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, | 713 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, |
713 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) }, | 714 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) }, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index ff4a174fa5de..a1a9062954c4 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -420,7 +420,7 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
420 | control = priv->line_control; | 420 | control = priv->line_control; |
421 | if ((cflag & CBAUD) == B0) | 421 | if ((cflag & CBAUD) == B0) |
422 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); | 422 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); |
423 | else | 423 | else if ((old_termios->c_cflag & CBAUD) == B0) |
424 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); | 424 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); |
425 | if (control != priv->line_control) { | 425 | if (control != priv->line_control) { |
426 | control = priv->line_control; | 426 | control = priv->line_control; |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index f14465a83dd1..8c8bf806f6fa 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = { | |||
221 | }; | 221 | }; |
222 | 222 | ||
223 | /* 'blacklist' of interfaces not served by this driver */ | 223 | /* 'blacklist' of interfaces not served by this driver */ |
224 | static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 }; | 224 | static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 }; |
225 | static const struct sierra_iface_info direct_ip_interface_blacklist = { | 225 | static const struct sierra_iface_info direct_ip_interface_blacklist = { |
226 | .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), | 226 | .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), |
227 | .ifaceinfo = direct_ip_non_serial_ifaces, | 227 | .ifaceinfo = direct_ip_non_serial_ifaces, |
@@ -298,6 +298,9 @@ static const struct usb_device_id id_table[] = { | |||
298 | /* Sierra Wireless HSPA Non-Composite Device */ | 298 | /* Sierra Wireless HSPA Non-Composite Device */ |
299 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 299 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
300 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | 300 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ |
301 | { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */ | ||
302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
303 | }, | ||
301 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 304 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ |
302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 305 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
303 | }, | 306 | }, |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 69230f01056a..97355a15bbea 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1059,6 +1059,12 @@ int usb_serial_probe(struct usb_interface *interface, | |||
1059 | serial->attached = 1; | 1059 | serial->attached = 1; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | /* Avoid race with tty_open and serial_install by setting the | ||
1063 | * disconnected flag and not clearing it until all ports have been | ||
1064 | * registered. | ||
1065 | */ | ||
1066 | serial->disconnected = 1; | ||
1067 | |||
1062 | if (get_free_serial(serial, num_ports, &minor) == NULL) { | 1068 | if (get_free_serial(serial, num_ports, &minor) == NULL) { |
1063 | dev_err(&interface->dev, "No more free serial devices\n"); | 1069 | dev_err(&interface->dev, "No more free serial devices\n"); |
1064 | goto probe_error; | 1070 | goto probe_error; |
@@ -1070,19 +1076,16 @@ int usb_serial_probe(struct usb_interface *interface, | |||
1070 | port = serial->port[i]; | 1076 | port = serial->port[i]; |
1071 | dev_set_name(&port->dev, "ttyUSB%d", port->number); | 1077 | dev_set_name(&port->dev, "ttyUSB%d", port->number); |
1072 | dbg ("%s - registering %s", __func__, dev_name(&port->dev)); | 1078 | dbg ("%s - registering %s", __func__, dev_name(&port->dev)); |
1073 | port->dev_state = PORT_REGISTERING; | ||
1074 | device_enable_async_suspend(&port->dev); | 1079 | device_enable_async_suspend(&port->dev); |
1075 | 1080 | ||
1076 | retval = device_add(&port->dev); | 1081 | retval = device_add(&port->dev); |
1077 | if (retval) { | 1082 | if (retval) |
1078 | dev_err(&port->dev, "Error registering port device, " | 1083 | dev_err(&port->dev, "Error registering port device, " |
1079 | "continuing\n"); | 1084 | "continuing\n"); |
1080 | port->dev_state = PORT_UNREGISTERED; | ||
1081 | } else { | ||
1082 | port->dev_state = PORT_REGISTERED; | ||
1083 | } | ||
1084 | } | 1085 | } |
1085 | 1086 | ||
1087 | serial->disconnected = 0; | ||
1088 | |||
1086 | usb_serial_console_init(debug, minor); | 1089 | usb_serial_console_init(debug, minor); |
1087 | 1090 | ||
1088 | exit: | 1091 | exit: |
@@ -1124,22 +1127,8 @@ void usb_serial_disconnect(struct usb_interface *interface) | |||
1124 | } | 1127 | } |
1125 | kill_traffic(port); | 1128 | kill_traffic(port); |
1126 | cancel_work_sync(&port->work); | 1129 | cancel_work_sync(&port->work); |
1127 | if (port->dev_state == PORT_REGISTERED) { | 1130 | if (device_is_registered(&port->dev)) |
1128 | |||
1129 | /* Make sure the port is bound so that the | ||
1130 | * driver's port_remove method is called. | ||
1131 | */ | ||
1132 | if (!port->dev.driver) { | ||
1133 | int rc; | ||
1134 | |||
1135 | port->dev.driver = | ||
1136 | &serial->type->driver; | ||
1137 | rc = device_bind_driver(&port->dev); | ||
1138 | } | ||
1139 | port->dev_state = PORT_UNREGISTERING; | ||
1140 | device_del(&port->dev); | 1131 | device_del(&port->dev); |
1141 | port->dev_state = PORT_UNREGISTERED; | ||
1142 | } | ||
1143 | } | 1132 | } |
1144 | } | 1133 | } |
1145 | serial->type->disconnect(serial); | 1134 | serial->type->disconnect(serial); |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index c18538e4a6db..2653e73db623 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -132,6 +132,35 @@ static struct us_unusual_dev for_dynamic_ids = | |||
132 | #undef COMPLIANT_DEV | 132 | #undef COMPLIANT_DEV |
133 | #undef USUAL_DEV | 133 | #undef USUAL_DEV |
134 | 134 | ||
135 | #ifdef CONFIG_LOCKDEP | ||
136 | |||
137 | static struct lock_class_key us_interface_key[USB_MAXINTERFACES]; | ||
138 | |||
139 | static void us_set_lock_class(struct mutex *mutex, | ||
140 | struct usb_interface *intf) | ||
141 | { | ||
142 | struct usb_device *udev = interface_to_usbdev(intf); | ||
143 | struct usb_host_config *config = udev->actconfig; | ||
144 | int i; | ||
145 | |||
146 | for (i = 0; i < config->desc.bNumInterfaces; i++) { | ||
147 | if (config->interface[i] == intf) | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | BUG_ON(i == config->desc.bNumInterfaces); | ||
152 | |||
153 | lockdep_set_class(mutex, &us_interface_key[i]); | ||
154 | } | ||
155 | |||
156 | #else | ||
157 | |||
158 | static void us_set_lock_class(struct mutex *mutex, | ||
159 | struct usb_interface *intf) | ||
160 | { | ||
161 | } | ||
162 | |||
163 | #endif | ||
135 | 164 | ||
136 | #ifdef CONFIG_PM /* Minimal support for suspend and resume */ | 165 | #ifdef CONFIG_PM /* Minimal support for suspend and resume */ |
137 | 166 | ||
@@ -895,6 +924,7 @@ int usb_stor_probe1(struct us_data **pus, | |||
895 | *pus = us = host_to_us(host); | 924 | *pus = us = host_to_us(host); |
896 | memset(us, 0, sizeof(struct us_data)); | 925 | memset(us, 0, sizeof(struct us_data)); |
897 | mutex_init(&(us->dev_mutex)); | 926 | mutex_init(&(us->dev_mutex)); |
927 | us_set_lock_class(&us->dev_mutex, intf); | ||
898 | init_completion(&us->cmnd_ready); | 928 | init_completion(&us->cmnd_ready); |
899 | init_completion(&(us->notify)); | 929 | init_completion(&(us->notify)); |
900 | init_waitqueue_head(&us->delay_wait); | 930 | init_waitqueue_head(&us->delay_wait); |
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c index 66797e9c5010..810c90ae2c55 100644 --- a/drivers/uwb/hwa-rc.c +++ b/drivers/uwb/hwa-rc.c | |||
@@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb) | |||
645 | dev_err(dev, "NEEP: URB error %d\n", urb->status); | 645 | dev_err(dev, "NEEP: URB error %d\n", urb->status); |
646 | } | 646 | } |
647 | result = usb_submit_urb(urb, GFP_ATOMIC); | 647 | result = usb_submit_urb(urb, GFP_ATOMIC); |
648 | if (result < 0) { | 648 | if (result < 0 && result != -ENODEV && result != -EPERM) { |
649 | /* ignoring unrecoverable errors */ | ||
649 | dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", | 650 | dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", |
650 | result); | 651 | result); |
651 | goto error; | 652 | goto error; |
diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c index a269937be1b8..8cb71bb333c2 100644 --- a/drivers/uwb/neh.c +++ b/drivers/uwb/neh.c | |||
@@ -107,6 +107,7 @@ struct uwb_rc_neh { | |||
107 | u8 evt_type; | 107 | u8 evt_type; |
108 | __le16 evt; | 108 | __le16 evt; |
109 | u8 context; | 109 | u8 context; |
110 | u8 completed; | ||
110 | uwb_rc_cmd_cb_f cb; | 111 | uwb_rc_cmd_cb_f cb; |
111 | void *arg; | 112 | void *arg; |
112 | 113 | ||
@@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | |||
409 | struct device *dev = &rc->uwb_dev.dev; | 410 | struct device *dev = &rc->uwb_dev.dev; |
410 | struct uwb_rc_neh *neh; | 411 | struct uwb_rc_neh *neh; |
411 | struct uwb_rceb *notif; | 412 | struct uwb_rceb *notif; |
413 | unsigned long flags; | ||
412 | 414 | ||
413 | if (rceb->bEventContext == 0) { | 415 | if (rceb->bEventContext == 0) { |
414 | notif = kmalloc(size, GFP_ATOMIC); | 416 | notif = kmalloc(size, GFP_ATOMIC); |
@@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | |||
422 | } else { | 424 | } else { |
423 | neh = uwb_rc_neh_lookup(rc, rceb); | 425 | neh = uwb_rc_neh_lookup(rc, rceb); |
424 | if (neh) { | 426 | if (neh) { |
425 | del_timer_sync(&neh->timer); | 427 | spin_lock_irqsave(&rc->neh_lock, flags); |
428 | /* to guard against a timeout */ | ||
429 | neh->completed = 1; | ||
430 | del_timer(&neh->timer); | ||
431 | spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
426 | uwb_rc_neh_cb(neh, rceb, size); | 432 | uwb_rc_neh_cb(neh, rceb, size); |
427 | } else | 433 | } else |
428 | dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", | 434 | dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", |
@@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg) | |||
568 | unsigned long flags; | 574 | unsigned long flags; |
569 | 575 | ||
570 | spin_lock_irqsave(&rc->neh_lock, flags); | 576 | spin_lock_irqsave(&rc->neh_lock, flags); |
577 | if (neh->completed) { | ||
578 | spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
579 | return; | ||
580 | } | ||
571 | if (neh->context) | 581 | if (neh->context) |
572 | __uwb_rc_neh_rm(rc, neh); | 582 | __uwb_rc_neh_rm(rc, neh); |
573 | else | 583 | else |
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index fc9a1d75281f..3de00d9fae2e 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c | |||
@@ -155,7 +155,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) | |||
155 | 155 | ||
156 | vhost_test_stop(n, &private); | 156 | vhost_test_stop(n, &private); |
157 | vhost_test_flush(n); | 157 | vhost_test_flush(n); |
158 | vhost_dev_cleanup(&n->dev); | 158 | vhost_dev_cleanup(&n->dev, false); |
159 | /* We do an extra flush before freeing memory, | 159 | /* We do an extra flush before freeing memory, |
160 | * since jobs can re-queue themselves. */ | 160 | * since jobs can re-queue themselves. */ |
161 | vhost_test_flush(n); | 161 | vhost_test_flush(n); |
diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig index 1e7536d9a8fc..b48f95f0dfe2 100644 --- a/drivers/video/omap/Kconfig +++ b/drivers/video/omap/Kconfig | |||
@@ -39,14 +39,6 @@ config FB_OMAP_LCD_MIPID | |||
39 | the Mobile Industry Processor Interface DBI-C/DCS | 39 | the Mobile Industry Processor Interface DBI-C/DCS |
40 | specification. (Supported LCDs: Philips LPH8923, Sharp LS041Y3) | 40 | specification. (Supported LCDs: Philips LPH8923, Sharp LS041Y3) |
41 | 41 | ||
42 | config FB_OMAP_BOOTLOADER_INIT | ||
43 | bool "Check bootloader initialization" | ||
44 | depends on FB_OMAP | ||
45 | help | ||
46 | Say Y here if you want to enable checking if the bootloader has | ||
47 | already initialized the display controller. In this case the | ||
48 | driver will skip the initialization. | ||
49 | |||
50 | config FB_OMAP_CONSISTENT_DMA_SIZE | 42 | config FB_OMAP_CONSISTENT_DMA_SIZE |
51 | int "Consistent DMA memory size (MB)" | 43 | int "Consistent DMA memory size (MB)" |
52 | depends on FB_OMAP | 44 | depends on FB_OMAP |
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig index 408a9927be92..c3853c92279b 100644 --- a/drivers/video/omap2/displays/Kconfig +++ b/drivers/video/omap2/displays/Kconfig | |||
@@ -10,12 +10,12 @@ config PANEL_GENERIC_DPI | |||
10 | Supports LCD Panel used in TI SDP3430 and EVM boards, | 10 | Supports LCD Panel used in TI SDP3430 and EVM boards, |
11 | OMAP3517 EVM boards and CM-T35. | 11 | OMAP3517 EVM boards and CM-T35. |
12 | 12 | ||
13 | config PANEL_DVI | 13 | config PANEL_TFP410 |
14 | tristate "DVI output" | 14 | tristate "TFP410 DPI-to-DVI chip" |
15 | depends on OMAP2_DSS_DPI && I2C | 15 | depends on OMAP2_DSS_DPI && I2C |
16 | help | 16 | help |
17 | Driver for external monitors, connected via DVI. The driver uses i2c | 17 | Driver for TFP410 DPI-to-DVI chip. The driver uses i2c to read EDID |
18 | to read EDID information from the monitor. | 18 | information from the monitor. |
19 | 19 | ||
20 | config PANEL_LGPHILIPS_LB035Q02 | 20 | config PANEL_LGPHILIPS_LB035Q02 |
21 | tristate "LG.Philips LB035Q02 LCD Panel" | 21 | tristate "LG.Philips LB035Q02 LCD Panel" |
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile index fbfafc6eebb4..58a5176b07b0 100644 --- a/drivers/video/omap2/displays/Makefile +++ b/drivers/video/omap2/displays/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o | 1 | obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o |
2 | obj-$(CONFIG_PANEL_DVI) += panel-dvi.o | 2 | obj-$(CONFIG_PANEL_TFP410) += panel-tfp410.o |
3 | obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o | 3 | obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o |
4 | obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o | 4 | obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o |
5 | obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o | 5 | obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o |
diff --git a/drivers/video/omap2/displays/panel-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c index d26f37ac69d8..c98f2c16f744 100644 --- a/drivers/video/omap2/displays/panel-acx565akm.c +++ b/drivers/video/omap2/displays/panel-acx565akm.c | |||
@@ -738,12 +738,6 @@ static void acx_panel_set_timings(struct omap_dss_device *dssdev, | |||
738 | } | 738 | } |
739 | } | 739 | } |
740 | 740 | ||
741 | static void acx_panel_get_timings(struct omap_dss_device *dssdev, | ||
742 | struct omap_video_timings *timings) | ||
743 | { | ||
744 | *timings = dssdev->panel.timings; | ||
745 | } | ||
746 | |||
747 | static int acx_panel_check_timings(struct omap_dss_device *dssdev, | 741 | static int acx_panel_check_timings(struct omap_dss_device *dssdev, |
748 | struct omap_video_timings *timings) | 742 | struct omap_video_timings *timings) |
749 | { | 743 | { |
@@ -761,7 +755,6 @@ static struct omap_dss_driver acx_panel_driver = { | |||
761 | .resume = acx_panel_resume, | 755 | .resume = acx_panel_resume, |
762 | 756 | ||
763 | .set_timings = acx_panel_set_timings, | 757 | .set_timings = acx_panel_set_timings, |
764 | .get_timings = acx_panel_get_timings, | ||
765 | .check_timings = acx_panel_check_timings, | 758 | .check_timings = acx_panel_check_timings, |
766 | 759 | ||
767 | .get_recommended_bpp = acx_get_recommended_bpp, | 760 | .get_recommended_bpp = acx_get_recommended_bpp, |
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c index 30fe4dfeb227..e42f9dc22123 100644 --- a/drivers/video/omap2/displays/panel-generic-dpi.c +++ b/drivers/video/omap2/displays/panel-generic-dpi.c | |||
@@ -386,6 +386,106 @@ static struct panel_config generic_dpi_panels[] = { | |||
386 | 386 | ||
387 | .name = "innolux_at080tn52", | 387 | .name = "innolux_at080tn52", |
388 | }, | 388 | }, |
389 | |||
390 | /* Mitsubishi AA084SB01 */ | ||
391 | { | ||
392 | { | ||
393 | .x_res = 800, | ||
394 | .y_res = 600, | ||
395 | .pixel_clock = 40000, | ||
396 | |||
397 | .hsw = 1, | ||
398 | .hfp = 254, | ||
399 | .hbp = 1, | ||
400 | |||
401 | .vsw = 1, | ||
402 | .vfp = 26, | ||
403 | .vbp = 1, | ||
404 | }, | ||
405 | .config = OMAP_DSS_LCD_TFT, | ||
406 | .name = "mitsubishi_aa084sb01", | ||
407 | }, | ||
408 | /* EDT ET0500G0DH6 */ | ||
409 | { | ||
410 | { | ||
411 | .x_res = 800, | ||
412 | .y_res = 480, | ||
413 | .pixel_clock = 33260, | ||
414 | |||
415 | .hsw = 128, | ||
416 | .hfp = 216, | ||
417 | .hbp = 40, | ||
418 | |||
419 | .vsw = 2, | ||
420 | .vfp = 35, | ||
421 | .vbp = 10, | ||
422 | }, | ||
423 | .config = OMAP_DSS_LCD_TFT, | ||
424 | .name = "edt_et0500g0dh6", | ||
425 | }, | ||
426 | |||
427 | /* Prime-View PD050VL1 */ | ||
428 | { | ||
429 | { | ||
430 | .x_res = 640, | ||
431 | .y_res = 480, | ||
432 | |||
433 | .pixel_clock = 25000, | ||
434 | |||
435 | .hsw = 96, | ||
436 | .hfp = 18, | ||
437 | .hbp = 46, | ||
438 | |||
439 | .vsw = 2, | ||
440 | .vfp = 10, | ||
441 | .vbp = 33, | ||
442 | }, | ||
443 | .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
444 | OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC, | ||
445 | .name = "primeview_pd050vl1", | ||
446 | }, | ||
447 | |||
448 | /* Prime-View PM070WL4 */ | ||
449 | { | ||
450 | { | ||
451 | .x_res = 800, | ||
452 | .y_res = 480, | ||
453 | |||
454 | .pixel_clock = 32000, | ||
455 | |||
456 | .hsw = 128, | ||
457 | .hfp = 42, | ||
458 | .hbp = 86, | ||
459 | |||
460 | .vsw = 2, | ||
461 | .vfp = 10, | ||
462 | .vbp = 33, | ||
463 | }, | ||
464 | .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
465 | OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC, | ||
466 | .name = "primeview_pm070wl4", | ||
467 | }, | ||
468 | |||
469 | /* Prime-View PD104SLF */ | ||
470 | { | ||
471 | { | ||
472 | .x_res = 800, | ||
473 | .y_res = 600, | ||
474 | |||
475 | .pixel_clock = 40000, | ||
476 | |||
477 | .hsw = 128, | ||
478 | .hfp = 42, | ||
479 | .hbp = 86, | ||
480 | |||
481 | .vsw = 4, | ||
482 | .vfp = 1, | ||
483 | .vbp = 23, | ||
484 | }, | ||
485 | .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
486 | OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC, | ||
487 | .name = "primeview_pd104slf", | ||
488 | }, | ||
389 | }; | 489 | }; |
390 | 490 | ||
391 | struct panel_drv_data { | 491 | struct panel_drv_data { |
@@ -549,12 +649,6 @@ static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev, | |||
549 | dpi_set_timings(dssdev, timings); | 649 | dpi_set_timings(dssdev, timings); |
550 | } | 650 | } |
551 | 651 | ||
552 | static void generic_dpi_panel_get_timings(struct omap_dss_device *dssdev, | ||
553 | struct omap_video_timings *timings) | ||
554 | { | ||
555 | *timings = dssdev->panel.timings; | ||
556 | } | ||
557 | |||
558 | static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev, | 652 | static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev, |
559 | struct omap_video_timings *timings) | 653 | struct omap_video_timings *timings) |
560 | { | 654 | { |
@@ -571,7 +665,6 @@ static struct omap_dss_driver dpi_driver = { | |||
571 | .resume = generic_dpi_panel_resume, | 665 | .resume = generic_dpi_panel_resume, |
572 | 666 | ||
573 | .set_timings = generic_dpi_panel_set_timings, | 667 | .set_timings = generic_dpi_panel_set_timings, |
574 | .get_timings = generic_dpi_panel_get_timings, | ||
575 | .check_timings = generic_dpi_panel_check_timings, | 668 | .check_timings = generic_dpi_panel_check_timings, |
576 | 669 | ||
577 | .driver = { | 670 | .driver = { |
diff --git a/drivers/video/omap2/displays/panel-n8x0.c b/drivers/video/omap2/displays/panel-n8x0.c index dc9408dc93d1..4a34cdc1371b 100644 --- a/drivers/video/omap2/displays/panel-n8x0.c +++ b/drivers/video/omap2/displays/panel-n8x0.c | |||
@@ -610,12 +610,6 @@ static int n8x0_panel_resume(struct omap_dss_device *dssdev) | |||
610 | return 0; | 610 | return 0; |
611 | } | 611 | } |
612 | 612 | ||
613 | static void n8x0_panel_get_timings(struct omap_dss_device *dssdev, | ||
614 | struct omap_video_timings *timings) | ||
615 | { | ||
616 | *timings = dssdev->panel.timings; | ||
617 | } | ||
618 | |||
619 | static void n8x0_panel_get_resolution(struct omap_dss_device *dssdev, | 613 | static void n8x0_panel_get_resolution(struct omap_dss_device *dssdev, |
620 | u16 *xres, u16 *yres) | 614 | u16 *xres, u16 *yres) |
621 | { | 615 | { |
@@ -678,8 +672,6 @@ static struct omap_dss_driver n8x0_panel_driver = { | |||
678 | .get_resolution = n8x0_panel_get_resolution, | 672 | .get_resolution = n8x0_panel_get_resolution, |
679 | .get_recommended_bpp = omapdss_default_get_recommended_bpp, | 673 | .get_recommended_bpp = omapdss_default_get_recommended_bpp, |
680 | 674 | ||
681 | .get_timings = n8x0_panel_get_timings, | ||
682 | |||
683 | .driver = { | 675 | .driver = { |
684 | .name = "n8x0_panel", | 676 | .name = "n8x0_panel", |
685 | .owner = THIS_MODULE, | 677 | .owner = THIS_MODULE, |
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 0f21fa5a16ae..2ce9992f403b 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
31 | #include <linux/workqueue.h> | 31 | #include <linux/workqueue.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/regulator/consumer.h> | ||
34 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
35 | 34 | ||
36 | #include <video/omapdss.h> | 35 | #include <video/omapdss.h> |
@@ -55,73 +54,6 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable); | |||
55 | 54 | ||
56 | static int taal_panel_reset(struct omap_dss_device *dssdev); | 55 | static int taal_panel_reset(struct omap_dss_device *dssdev); |
57 | 56 | ||
58 | struct panel_regulator { | ||
59 | struct regulator *regulator; | ||
60 | const char *name; | ||
61 | int min_uV; | ||
62 | int max_uV; | ||
63 | }; | ||
64 | |||
65 | static void free_regulators(struct panel_regulator *regulators, int n) | ||
66 | { | ||
67 | int i; | ||
68 | |||
69 | for (i = 0; i < n; i++) { | ||
70 | /* disable/put in reverse order */ | ||
71 | regulator_disable(regulators[n - i - 1].regulator); | ||
72 | regulator_put(regulators[n - i - 1].regulator); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | static int init_regulators(struct omap_dss_device *dssdev, | ||
77 | struct panel_regulator *regulators, int n) | ||
78 | { | ||
79 | int r, i, v; | ||
80 | |||
81 | for (i = 0; i < n; i++) { | ||
82 | struct regulator *reg; | ||
83 | |||
84 | reg = regulator_get(&dssdev->dev, regulators[i].name); | ||
85 | if (IS_ERR(reg)) { | ||
86 | dev_err(&dssdev->dev, "failed to get regulator %s\n", | ||
87 | regulators[i].name); | ||
88 | r = PTR_ERR(reg); | ||
89 | goto err; | ||
90 | } | ||
91 | |||
92 | /* FIXME: better handling of fixed vs. variable regulators */ | ||
93 | v = regulator_get_voltage(reg); | ||
94 | if (v < regulators[i].min_uV || v > regulators[i].max_uV) { | ||
95 | r = regulator_set_voltage(reg, regulators[i].min_uV, | ||
96 | regulators[i].max_uV); | ||
97 | if (r) { | ||
98 | dev_err(&dssdev->dev, | ||
99 | "failed to set regulator %s voltage\n", | ||
100 | regulators[i].name); | ||
101 | regulator_put(reg); | ||
102 | goto err; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | r = regulator_enable(reg); | ||
107 | if (r) { | ||
108 | dev_err(&dssdev->dev, "failed to enable regulator %s\n", | ||
109 | regulators[i].name); | ||
110 | regulator_put(reg); | ||
111 | goto err; | ||
112 | } | ||
113 | |||
114 | regulators[i].regulator = reg; | ||
115 | } | ||
116 | |||
117 | return 0; | ||
118 | |||
119 | err: | ||
120 | free_regulators(regulators, i); | ||
121 | |||
122 | return r; | ||
123 | } | ||
124 | |||
125 | /** | 57 | /** |
126 | * struct panel_config - panel configuration | 58 | * struct panel_config - panel configuration |
127 | * @name: panel name | 59 | * @name: panel name |
@@ -150,8 +82,6 @@ struct panel_config { | |||
150 | unsigned int low; | 82 | unsigned int low; |
151 | } reset_sequence; | 83 | } reset_sequence; |
152 | 84 | ||
153 | struct panel_regulator *regulators; | ||
154 | int num_regulators; | ||
155 | }; | 85 | }; |
156 | 86 | ||
157 | enum { | 87 | enum { |
@@ -577,12 +507,6 @@ static const struct backlight_ops taal_bl_ops = { | |||
577 | .update_status = taal_bl_update_status, | 507 | .update_status = taal_bl_update_status, |
578 | }; | 508 | }; |
579 | 509 | ||
580 | static void taal_get_timings(struct omap_dss_device *dssdev, | ||
581 | struct omap_video_timings *timings) | ||
582 | { | ||
583 | *timings = dssdev->panel.timings; | ||
584 | } | ||
585 | |||
586 | static void taal_get_resolution(struct omap_dss_device *dssdev, | 510 | static void taal_get_resolution(struct omap_dss_device *dssdev, |
587 | u16 *xres, u16 *yres) | 511 | u16 *xres, u16 *yres) |
588 | { | 512 | { |
@@ -977,11 +901,6 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
977 | 901 | ||
978 | atomic_set(&td->do_update, 0); | 902 | atomic_set(&td->do_update, 0); |
979 | 903 | ||
980 | r = init_regulators(dssdev, panel_config->regulators, | ||
981 | panel_config->num_regulators); | ||
982 | if (r) | ||
983 | goto err_reg; | ||
984 | |||
985 | td->workqueue = create_singlethread_workqueue("taal_esd"); | 904 | td->workqueue = create_singlethread_workqueue("taal_esd"); |
986 | if (td->workqueue == NULL) { | 905 | if (td->workqueue == NULL) { |
987 | dev_err(&dssdev->dev, "can't create ESD workqueue\n"); | 906 | dev_err(&dssdev->dev, "can't create ESD workqueue\n"); |
@@ -993,6 +912,15 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
993 | 912 | ||
994 | dev_set_drvdata(&dssdev->dev, td); | 913 | dev_set_drvdata(&dssdev->dev, td); |
995 | 914 | ||
915 | if (gpio_is_valid(panel_data->reset_gpio)) { | ||
916 | r = gpio_request_one(panel_data->reset_gpio, GPIOF_OUT_INIT_LOW, | ||
917 | "taal rst"); | ||
918 | if (r) { | ||
919 | dev_err(&dssdev->dev, "failed to request reset gpio\n"); | ||
920 | goto err_rst_gpio; | ||
921 | } | ||
922 | } | ||
923 | |||
996 | taal_hw_reset(dssdev); | 924 | taal_hw_reset(dssdev); |
997 | 925 | ||
998 | if (panel_data->use_dsi_backlight) { | 926 | if (panel_data->use_dsi_backlight) { |
@@ -1073,10 +1001,11 @@ err_gpio: | |||
1073 | if (bldev != NULL) | 1001 | if (bldev != NULL) |
1074 | backlight_device_unregister(bldev); | 1002 | backlight_device_unregister(bldev); |
1075 | err_bl: | 1003 | err_bl: |
1004 | if (gpio_is_valid(panel_data->reset_gpio)) | ||
1005 | gpio_free(panel_data->reset_gpio); | ||
1006 | err_rst_gpio: | ||
1076 | destroy_workqueue(td->workqueue); | 1007 | destroy_workqueue(td->workqueue); |
1077 | err_wq: | 1008 | err_wq: |
1078 | free_regulators(panel_config->regulators, panel_config->num_regulators); | ||
1079 | err_reg: | ||
1080 | kfree(td); | 1009 | kfree(td); |
1081 | err: | 1010 | err: |
1082 | return r; | 1011 | return r; |
@@ -1113,8 +1042,8 @@ static void __exit taal_remove(struct omap_dss_device *dssdev) | |||
1113 | /* reset, to be sure that the panel is in a valid state */ | 1042 | /* reset, to be sure that the panel is in a valid state */ |
1114 | taal_hw_reset(dssdev); | 1043 | taal_hw_reset(dssdev); |
1115 | 1044 | ||
1116 | free_regulators(td->panel_config->regulators, | 1045 | if (gpio_is_valid(panel_data->reset_gpio)) |
1117 | td->panel_config->num_regulators); | 1046 | gpio_free(panel_data->reset_gpio); |
1118 | 1047 | ||
1119 | kfree(td); | 1048 | kfree(td); |
1120 | } | 1049 | } |
@@ -1122,9 +1051,16 @@ static void __exit taal_remove(struct omap_dss_device *dssdev) | |||
1122 | static int taal_power_on(struct omap_dss_device *dssdev) | 1051 | static int taal_power_on(struct omap_dss_device *dssdev) |
1123 | { | 1052 | { |
1124 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 1053 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
1054 | struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev); | ||
1125 | u8 id1, id2, id3; | 1055 | u8 id1, id2, id3; |
1126 | int r; | 1056 | int r; |
1127 | 1057 | ||
1058 | r = omapdss_dsi_configure_pins(dssdev, &panel_data->pin_config); | ||
1059 | if (r) { | ||
1060 | dev_err(&dssdev->dev, "failed to configure DSI pins\n"); | ||
1061 | goto err0; | ||
1062 | }; | ||
1063 | |||
1128 | r = omapdss_dsi_display_enable(dssdev); | 1064 | r = omapdss_dsi_display_enable(dssdev); |
1129 | if (r) { | 1065 | if (r) { |
1130 | dev_err(&dssdev->dev, "failed to enable DSI\n"); | 1066 | dev_err(&dssdev->dev, "failed to enable DSI\n"); |
@@ -1887,8 +1823,6 @@ static struct omap_dss_driver taal_driver = { | |||
1887 | .run_test = taal_run_test, | 1823 | .run_test = taal_run_test, |
1888 | .memory_read = taal_memory_read, | 1824 | .memory_read = taal_memory_read, |
1889 | 1825 | ||
1890 | .get_timings = taal_get_timings, | ||
1891 | |||
1892 | .driver = { | 1826 | .driver = { |
1893 | .name = "taal", | 1827 | .name = "taal", |
1894 | .owner = THIS_MODULE, | 1828 | .owner = THIS_MODULE, |
diff --git a/drivers/video/omap2/displays/panel-dvi.c b/drivers/video/omap2/displays/panel-tfp410.c index 03eb14af33e0..bff306e041ca 100644 --- a/drivers/video/omap2/displays/panel-dvi.c +++ b/drivers/video/omap2/displays/panel-tfp410.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * DVI output support | 2 | * TFP410 DPI-to-DVI chip |
3 | * | 3 | * |
4 | * Copyright (C) 2011 Texas Instruments Inc | 4 | * Copyright (C) 2011 Texas Instruments Inc |
5 | * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> | 5 | * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> |
@@ -21,11 +21,12 @@ | |||
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <video/omapdss.h> | 22 | #include <video/omapdss.h> |
23 | #include <linux/i2c.h> | 23 | #include <linux/i2c.h> |
24 | #include <linux/gpio.h> | ||
24 | #include <drm/drm_edid.h> | 25 | #include <drm/drm_edid.h> |
25 | 26 | ||
26 | #include <video/omap-panel-dvi.h> | 27 | #include <video/omap-panel-tfp410.h> |
27 | 28 | ||
28 | static const struct omap_video_timings panel_dvi_default_timings = { | 29 | static const struct omap_video_timings tfp410_default_timings = { |
29 | .x_res = 640, | 30 | .x_res = 640, |
30 | .y_res = 480, | 31 | .y_res = 480, |
31 | 32 | ||
@@ -44,17 +45,15 @@ struct panel_drv_data { | |||
44 | struct omap_dss_device *dssdev; | 45 | struct omap_dss_device *dssdev; |
45 | 46 | ||
46 | struct mutex lock; | 47 | struct mutex lock; |
47 | }; | ||
48 | 48 | ||
49 | static inline struct panel_dvi_platform_data | 49 | int pd_gpio; |
50 | *get_pdata(const struct omap_dss_device *dssdev) | 50 | |
51 | { | 51 | struct i2c_adapter *i2c_adapter; |
52 | return dssdev->data; | 52 | }; |
53 | } | ||
54 | 53 | ||
55 | static int panel_dvi_power_on(struct omap_dss_device *dssdev) | 54 | static int tfp410_power_on(struct omap_dss_device *dssdev) |
56 | { | 55 | { |
57 | struct panel_dvi_platform_data *pdata = get_pdata(dssdev); | 56 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
58 | int r; | 57 | int r; |
59 | 58 | ||
60 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) | 59 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) |
@@ -64,72 +63,111 @@ static int panel_dvi_power_on(struct omap_dss_device *dssdev) | |||
64 | if (r) | 63 | if (r) |
65 | goto err0; | 64 | goto err0; |
66 | 65 | ||
67 | if (pdata->platform_enable) { | 66 | if (gpio_is_valid(ddata->pd_gpio)) |
68 | r = pdata->platform_enable(dssdev); | 67 | gpio_set_value_cansleep(ddata->pd_gpio, 1); |
69 | if (r) | ||
70 | goto err1; | ||
71 | } | ||
72 | 68 | ||
73 | return 0; | 69 | return 0; |
74 | err1: | ||
75 | omapdss_dpi_display_disable(dssdev); | ||
76 | err0: | 70 | err0: |
77 | return r; | 71 | return r; |
78 | } | 72 | } |
79 | 73 | ||
80 | static void panel_dvi_power_off(struct omap_dss_device *dssdev) | 74 | static void tfp410_power_off(struct omap_dss_device *dssdev) |
81 | { | 75 | { |
82 | struct panel_dvi_platform_data *pdata = get_pdata(dssdev); | 76 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
83 | 77 | ||
84 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | 78 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) |
85 | return; | 79 | return; |
86 | 80 | ||
87 | if (pdata->platform_disable) | 81 | if (gpio_is_valid(ddata->pd_gpio)) |
88 | pdata->platform_disable(dssdev); | 82 | gpio_set_value_cansleep(ddata->pd_gpio, 0); |
89 | 83 | ||
90 | omapdss_dpi_display_disable(dssdev); | 84 | omapdss_dpi_display_disable(dssdev); |
91 | } | 85 | } |
92 | 86 | ||
93 | static int panel_dvi_probe(struct omap_dss_device *dssdev) | 87 | static int tfp410_probe(struct omap_dss_device *dssdev) |
94 | { | 88 | { |
95 | struct panel_drv_data *ddata; | 89 | struct panel_drv_data *ddata; |
90 | int r; | ||
91 | int i2c_bus_num; | ||
96 | 92 | ||
97 | ddata = kzalloc(sizeof(*ddata), GFP_KERNEL); | 93 | ddata = devm_kzalloc(&dssdev->dev, sizeof(*ddata), GFP_KERNEL); |
98 | if (!ddata) | 94 | if (!ddata) |
99 | return -ENOMEM; | 95 | return -ENOMEM; |
100 | 96 | ||
101 | dssdev->panel.timings = panel_dvi_default_timings; | 97 | dssdev->panel.timings = tfp410_default_timings; |
102 | dssdev->panel.config = OMAP_DSS_LCD_TFT; | 98 | dssdev->panel.config = OMAP_DSS_LCD_TFT; |
103 | 99 | ||
104 | ddata->dssdev = dssdev; | 100 | ddata->dssdev = dssdev; |
105 | mutex_init(&ddata->lock); | 101 | mutex_init(&ddata->lock); |
106 | 102 | ||
103 | if (dssdev->data) { | ||
104 | struct tfp410_platform_data *pdata = dssdev->data; | ||
105 | |||
106 | ddata->pd_gpio = pdata->power_down_gpio; | ||
107 | i2c_bus_num = pdata->i2c_bus_num; | ||
108 | } else { | ||
109 | ddata->pd_gpio = -1; | ||
110 | i2c_bus_num = -1; | ||
111 | } | ||
112 | |||
113 | if (gpio_is_valid(ddata->pd_gpio)) { | ||
114 | r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW, | ||
115 | "tfp410 pd"); | ||
116 | if (r) { | ||
117 | dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n", | ||
118 | ddata->pd_gpio); | ||
119 | return r; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | if (i2c_bus_num != -1) { | ||
124 | struct i2c_adapter *adapter; | ||
125 | |||
126 | adapter = i2c_get_adapter(i2c_bus_num); | ||
127 | if (!adapter) { | ||
128 | dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n", | ||
129 | i2c_bus_num); | ||
130 | r = -EINVAL; | ||
131 | goto err_i2c; | ||
132 | } | ||
133 | |||
134 | ddata->i2c_adapter = adapter; | ||
135 | } | ||
136 | |||
107 | dev_set_drvdata(&dssdev->dev, ddata); | 137 | dev_set_drvdata(&dssdev->dev, ddata); |
108 | 138 | ||
109 | return 0; | 139 | return 0; |
140 | err_i2c: | ||
141 | if (gpio_is_valid(ddata->pd_gpio)) | ||
142 | gpio_free(ddata->pd_gpio); | ||
143 | return r; | ||
110 | } | 144 | } |
111 | 145 | ||
112 | static void __exit panel_dvi_remove(struct omap_dss_device *dssdev) | 146 | static void __exit tfp410_remove(struct omap_dss_device *dssdev) |
113 | { | 147 | { |
114 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 148 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
115 | 149 | ||
116 | mutex_lock(&ddata->lock); | 150 | mutex_lock(&ddata->lock); |
117 | 151 | ||
152 | if (ddata->i2c_adapter) | ||
153 | i2c_put_adapter(ddata->i2c_adapter); | ||
154 | |||
155 | if (gpio_is_valid(ddata->pd_gpio)) | ||
156 | gpio_free(ddata->pd_gpio); | ||
157 | |||
118 | dev_set_drvdata(&dssdev->dev, NULL); | 158 | dev_set_drvdata(&dssdev->dev, NULL); |
119 | 159 | ||
120 | mutex_unlock(&ddata->lock); | 160 | mutex_unlock(&ddata->lock); |
121 | |||
122 | kfree(ddata); | ||
123 | } | 161 | } |
124 | 162 | ||
125 | static int panel_dvi_enable(struct omap_dss_device *dssdev) | 163 | static int tfp410_enable(struct omap_dss_device *dssdev) |
126 | { | 164 | { |
127 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 165 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
128 | int r; | 166 | int r; |
129 | 167 | ||
130 | mutex_lock(&ddata->lock); | 168 | mutex_lock(&ddata->lock); |
131 | 169 | ||
132 | r = panel_dvi_power_on(dssdev); | 170 | r = tfp410_power_on(dssdev); |
133 | if (r == 0) | 171 | if (r == 0) |
134 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 172 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
135 | 173 | ||
@@ -138,26 +176,26 @@ static int panel_dvi_enable(struct omap_dss_device *dssdev) | |||
138 | return r; | 176 | return r; |
139 | } | 177 | } |
140 | 178 | ||
141 | static void panel_dvi_disable(struct omap_dss_device *dssdev) | 179 | static void tfp410_disable(struct omap_dss_device *dssdev) |
142 | { | 180 | { |
143 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 181 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
144 | 182 | ||
145 | mutex_lock(&ddata->lock); | 183 | mutex_lock(&ddata->lock); |
146 | 184 | ||
147 | panel_dvi_power_off(dssdev); | 185 | tfp410_power_off(dssdev); |
148 | 186 | ||
149 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | 187 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; |
150 | 188 | ||
151 | mutex_unlock(&ddata->lock); | 189 | mutex_unlock(&ddata->lock); |
152 | } | 190 | } |
153 | 191 | ||
154 | static int panel_dvi_suspend(struct omap_dss_device *dssdev) | 192 | static int tfp410_suspend(struct omap_dss_device *dssdev) |
155 | { | 193 | { |
156 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 194 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
157 | 195 | ||
158 | mutex_lock(&ddata->lock); | 196 | mutex_lock(&ddata->lock); |
159 | 197 | ||
160 | panel_dvi_power_off(dssdev); | 198 | tfp410_power_off(dssdev); |
161 | 199 | ||
162 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | 200 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; |
163 | 201 | ||
@@ -166,14 +204,14 @@ static int panel_dvi_suspend(struct omap_dss_device *dssdev) | |||
166 | return 0; | 204 | return 0; |
167 | } | 205 | } |
168 | 206 | ||
169 | static int panel_dvi_resume(struct omap_dss_device *dssdev) | 207 | static int tfp410_resume(struct omap_dss_device *dssdev) |
170 | { | 208 | { |
171 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 209 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
172 | int r; | 210 | int r; |
173 | 211 | ||
174 | mutex_lock(&ddata->lock); | 212 | mutex_lock(&ddata->lock); |
175 | 213 | ||
176 | r = panel_dvi_power_on(dssdev); | 214 | r = tfp410_power_on(dssdev); |
177 | if (r == 0) | 215 | if (r == 0) |
178 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 216 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
179 | 217 | ||
@@ -182,7 +220,7 @@ static int panel_dvi_resume(struct omap_dss_device *dssdev) | |||
182 | return r; | 220 | return r; |
183 | } | 221 | } |
184 | 222 | ||
185 | static void panel_dvi_set_timings(struct omap_dss_device *dssdev, | 223 | static void tfp410_set_timings(struct omap_dss_device *dssdev, |
186 | struct omap_video_timings *timings) | 224 | struct omap_video_timings *timings) |
187 | { | 225 | { |
188 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 226 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
@@ -192,7 +230,7 @@ static void panel_dvi_set_timings(struct omap_dss_device *dssdev, | |||
192 | mutex_unlock(&ddata->lock); | 230 | mutex_unlock(&ddata->lock); |
193 | } | 231 | } |
194 | 232 | ||
195 | static void panel_dvi_get_timings(struct omap_dss_device *dssdev, | 233 | static void tfp410_get_timings(struct omap_dss_device *dssdev, |
196 | struct omap_video_timings *timings) | 234 | struct omap_video_timings *timings) |
197 | { | 235 | { |
198 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 236 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
@@ -202,7 +240,7 @@ static void panel_dvi_get_timings(struct omap_dss_device *dssdev, | |||
202 | mutex_unlock(&ddata->lock); | 240 | mutex_unlock(&ddata->lock); |
203 | } | 241 | } |
204 | 242 | ||
205 | static int panel_dvi_check_timings(struct omap_dss_device *dssdev, | 243 | static int tfp410_check_timings(struct omap_dss_device *dssdev, |
206 | struct omap_video_timings *timings) | 244 | struct omap_video_timings *timings) |
207 | { | 245 | { |
208 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 246 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
@@ -216,7 +254,7 @@ static int panel_dvi_check_timings(struct omap_dss_device *dssdev, | |||
216 | } | 254 | } |
217 | 255 | ||
218 | 256 | ||
219 | static int panel_dvi_ddc_read(struct i2c_adapter *adapter, | 257 | static int tfp410_ddc_read(struct i2c_adapter *adapter, |
220 | unsigned char *buf, u16 count, u8 offset) | 258 | unsigned char *buf, u16 count, u8 offset) |
221 | { | 259 | { |
222 | int r, retries; | 260 | int r, retries; |
@@ -247,31 +285,21 @@ static int panel_dvi_ddc_read(struct i2c_adapter *adapter, | |||
247 | return r < 0 ? r : -EIO; | 285 | return r < 0 ? r : -EIO; |
248 | } | 286 | } |
249 | 287 | ||
250 | static int panel_dvi_read_edid(struct omap_dss_device *dssdev, | 288 | static int tfp410_read_edid(struct omap_dss_device *dssdev, |
251 | u8 *edid, int len) | 289 | u8 *edid, int len) |
252 | { | 290 | { |
253 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 291 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
254 | struct panel_dvi_platform_data *pdata = get_pdata(dssdev); | ||
255 | struct i2c_adapter *adapter; | ||
256 | int r, l, bytes_read; | 292 | int r, l, bytes_read; |
257 | 293 | ||
258 | mutex_lock(&ddata->lock); | 294 | mutex_lock(&ddata->lock); |
259 | 295 | ||
260 | if (pdata->i2c_bus_num == 0) { | 296 | if (!ddata->i2c_adapter) { |
261 | r = -ENODEV; | 297 | r = -ENODEV; |
262 | goto err; | 298 | goto err; |
263 | } | 299 | } |
264 | 300 | ||
265 | adapter = i2c_get_adapter(pdata->i2c_bus_num); | ||
266 | if (!adapter) { | ||
267 | dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n", | ||
268 | pdata->i2c_bus_num); | ||
269 | r = -EINVAL; | ||
270 | goto err; | ||
271 | } | ||
272 | |||
273 | l = min(EDID_LENGTH, len); | 301 | l = min(EDID_LENGTH, len); |
274 | r = panel_dvi_ddc_read(adapter, edid, l, 0); | 302 | r = tfp410_ddc_read(ddata->i2c_adapter, edid, l, 0); |
275 | if (r) | 303 | if (r) |
276 | goto err; | 304 | goto err; |
277 | 305 | ||
@@ -281,7 +309,7 @@ static int panel_dvi_read_edid(struct omap_dss_device *dssdev, | |||
281 | if (len > EDID_LENGTH && edid[0x7e] > 0) { | 309 | if (len > EDID_LENGTH && edid[0x7e] > 0) { |
282 | l = min(EDID_LENGTH, len - EDID_LENGTH); | 310 | l = min(EDID_LENGTH, len - EDID_LENGTH); |
283 | 311 | ||
284 | r = panel_dvi_ddc_read(adapter, edid + EDID_LENGTH, | 312 | r = tfp410_ddc_read(ddata->i2c_adapter, edid + EDID_LENGTH, |
285 | l, EDID_LENGTH); | 313 | l, EDID_LENGTH); |
286 | if (r) | 314 | if (r) |
287 | goto err; | 315 | goto err; |
@@ -298,24 +326,18 @@ err: | |||
298 | return r; | 326 | return r; |
299 | } | 327 | } |
300 | 328 | ||
301 | static bool panel_dvi_detect(struct omap_dss_device *dssdev) | 329 | static bool tfp410_detect(struct omap_dss_device *dssdev) |
302 | { | 330 | { |
303 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 331 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
304 | struct panel_dvi_platform_data *pdata = get_pdata(dssdev); | ||
305 | struct i2c_adapter *adapter; | ||
306 | unsigned char out; | 332 | unsigned char out; |
307 | int r; | 333 | int r; |
308 | 334 | ||
309 | mutex_lock(&ddata->lock); | 335 | mutex_lock(&ddata->lock); |
310 | 336 | ||
311 | if (pdata->i2c_bus_num == 0) | 337 | if (!ddata->i2c_adapter) |
312 | goto out; | ||
313 | |||
314 | adapter = i2c_get_adapter(pdata->i2c_bus_num); | ||
315 | if (!adapter) | ||
316 | goto out; | 338 | goto out; |
317 | 339 | ||
318 | r = panel_dvi_ddc_read(adapter, &out, 1, 0); | 340 | r = tfp410_ddc_read(ddata->i2c_adapter, &out, 1, 0); |
319 | 341 | ||
320 | mutex_unlock(&ddata->lock); | 342 | mutex_unlock(&ddata->lock); |
321 | 343 | ||
@@ -326,38 +348,38 @@ out: | |||
326 | return true; | 348 | return true; |
327 | } | 349 | } |
328 | 350 | ||
329 | static struct omap_dss_driver panel_dvi_driver = { | 351 | static struct omap_dss_driver tfp410_driver = { |
330 | .probe = panel_dvi_probe, | 352 | .probe = tfp410_probe, |
331 | .remove = __exit_p(panel_dvi_remove), | 353 | .remove = __exit_p(tfp410_remove), |
332 | 354 | ||
333 | .enable = panel_dvi_enable, | 355 | .enable = tfp410_enable, |
334 | .disable = panel_dvi_disable, | 356 | .disable = tfp410_disable, |
335 | .suspend = panel_dvi_suspend, | 357 | .suspend = tfp410_suspend, |
336 | .resume = panel_dvi_resume, | 358 | .resume = tfp410_resume, |
337 | 359 | ||
338 | .set_timings = panel_dvi_set_timings, | 360 | .set_timings = tfp410_set_timings, |
339 | .get_timings = panel_dvi_get_timings, | 361 | .get_timings = tfp410_get_timings, |
340 | .check_timings = panel_dvi_check_timings, | 362 | .check_timings = tfp410_check_timings, |
341 | 363 | ||
342 | .read_edid = panel_dvi_read_edid, | 364 | .read_edid = tfp410_read_edid, |
343 | .detect = panel_dvi_detect, | 365 | .detect = tfp410_detect, |
344 | 366 | ||
345 | .driver = { | 367 | .driver = { |
346 | .name = "dvi", | 368 | .name = "tfp410", |
347 | .owner = THIS_MODULE, | 369 | .owner = THIS_MODULE, |
348 | }, | 370 | }, |
349 | }; | 371 | }; |
350 | 372 | ||
351 | static int __init panel_dvi_init(void) | 373 | static int __init tfp410_init(void) |
352 | { | 374 | { |
353 | return omap_dss_register_driver(&panel_dvi_driver); | 375 | return omap_dss_register_driver(&tfp410_driver); |
354 | } | 376 | } |
355 | 377 | ||
356 | static void __exit panel_dvi_exit(void) | 378 | static void __exit tfp410_exit(void) |
357 | { | 379 | { |
358 | omap_dss_unregister_driver(&panel_dvi_driver); | 380 | omap_dss_unregister_driver(&tfp410_driver); |
359 | } | 381 | } |
360 | 382 | ||
361 | module_init(panel_dvi_init); | 383 | module_init(tfp410_init); |
362 | module_exit(panel_dvi_exit); | 384 | module_exit(tfp410_exit); |
363 | MODULE_LICENSE("GPL"); | 385 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c index 32f3fcd7f0f0..4b6448b3c31f 100644 --- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c +++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c | |||
@@ -272,13 +272,16 @@ static const struct omap_video_timings tpo_td043_timings = { | |||
272 | static int tpo_td043_power_on(struct tpo_td043_device *tpo_td043) | 272 | static int tpo_td043_power_on(struct tpo_td043_device *tpo_td043) |
273 | { | 273 | { |
274 | int nreset_gpio = tpo_td043->nreset_gpio; | 274 | int nreset_gpio = tpo_td043->nreset_gpio; |
275 | int r; | ||
275 | 276 | ||
276 | if (tpo_td043->powered_on) | 277 | if (tpo_td043->powered_on) |
277 | return 0; | 278 | return 0; |
278 | 279 | ||
279 | regulator_enable(tpo_td043->vcc_reg); | 280 | r = regulator_enable(tpo_td043->vcc_reg); |
281 | if (r != 0) | ||
282 | return r; | ||
280 | 283 | ||
281 | /* wait for regulator to stabilize */ | 284 | /* wait for panel to stabilize */ |
282 | msleep(160); | 285 | msleep(160); |
283 | 286 | ||
284 | if (gpio_is_valid(nreset_gpio)) | 287 | if (gpio_is_valid(nreset_gpio)) |
@@ -470,6 +473,18 @@ static void tpo_td043_remove(struct omap_dss_device *dssdev) | |||
470 | gpio_free(nreset_gpio); | 473 | gpio_free(nreset_gpio); |
471 | } | 474 | } |
472 | 475 | ||
476 | static void tpo_td043_set_timings(struct omap_dss_device *dssdev, | ||
477 | struct omap_video_timings *timings) | ||
478 | { | ||
479 | dpi_set_timings(dssdev, timings); | ||
480 | } | ||
481 | |||
482 | static int tpo_td043_check_timings(struct omap_dss_device *dssdev, | ||
483 | struct omap_video_timings *timings) | ||
484 | { | ||
485 | return dpi_check_timings(dssdev, timings); | ||
486 | } | ||
487 | |||
473 | static struct omap_dss_driver tpo_td043_driver = { | 488 | static struct omap_dss_driver tpo_td043_driver = { |
474 | .probe = tpo_td043_probe, | 489 | .probe = tpo_td043_probe, |
475 | .remove = tpo_td043_remove, | 490 | .remove = tpo_td043_remove, |
@@ -481,6 +496,9 @@ static struct omap_dss_driver tpo_td043_driver = { | |||
481 | .set_mirror = tpo_td043_set_hmirror, | 496 | .set_mirror = tpo_td043_set_hmirror, |
482 | .get_mirror = tpo_td043_get_hmirror, | 497 | .get_mirror = tpo_td043_get_hmirror, |
483 | 498 | ||
499 | .set_timings = tpo_td043_set_timings, | ||
500 | .check_timings = tpo_td043_check_timings, | ||
501 | |||
484 | .driver = { | 502 | .driver = { |
485 | .name = "tpo_td043mtea1_panel", | 503 | .name = "tpo_td043mtea1_panel", |
486 | .owner = THIS_MODULE, | 504 | .owner = THIS_MODULE, |
diff --git a/drivers/video/omap2/dss/Kconfig b/drivers/video/omap2/dss/Kconfig index 7be7c06a249e..43324e5ed25f 100644 --- a/drivers/video/omap2/dss/Kconfig +++ b/drivers/video/omap2/dss/Kconfig | |||
@@ -68,6 +68,10 @@ config OMAP4_DSS_HDMI | |||
68 | HDMI Interface. This adds the High Definition Multimedia Interface. | 68 | HDMI Interface. This adds the High Definition Multimedia Interface. |
69 | See http://www.hdmi.org/ for HDMI specification. | 69 | See http://www.hdmi.org/ for HDMI specification. |
70 | 70 | ||
71 | config OMAP4_DSS_HDMI_AUDIO | ||
72 | bool | ||
73 | depends on OMAP4_DSS_HDMI | ||
74 | |||
71 | config OMAP2_DSS_SDI | 75 | config OMAP2_DSS_SDI |
72 | bool "SDI support" | 76 | bool "SDI support" |
73 | depends on ARCH_OMAP3 | 77 | depends on ARCH_OMAP3 |
@@ -90,15 +94,6 @@ config OMAP2_DSS_DSI | |||
90 | 94 | ||
91 | See http://www.mipi.org/ for DSI spesifications. | 95 | See http://www.mipi.org/ for DSI spesifications. |
92 | 96 | ||
93 | config OMAP2_DSS_FAKE_VSYNC | ||
94 | bool "Fake VSYNC irq from manual update displays" | ||
95 | default n | ||
96 | help | ||
97 | If this is selected, DSI will generate a fake DISPC VSYNC interrupt | ||
98 | when DSI has sent a frame. This is only needed with DSI or RFBI | ||
99 | displays using manual mode, and you want VSYNC to, for example, | ||
100 | time animation. | ||
101 | |||
102 | config OMAP2_DSS_MIN_FCK_PER_PCK | 97 | config OMAP2_DSS_MIN_FCK_PER_PCK |
103 | int "Minimum FCK/PCK ratio (for scaling)" | 98 | int "Minimum FCK/PCK ratio (for scaling)" |
104 | range 0 32 | 99 | range 0 32 |
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index b10b3bc1931e..ab22cc224f3e 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c | |||
@@ -99,6 +99,11 @@ struct mgr_priv_data { | |||
99 | 99 | ||
100 | /* If true, a display is enabled using this manager */ | 100 | /* If true, a display is enabled using this manager */ |
101 | bool enabled; | 101 | bool enabled; |
102 | |||
103 | bool extra_info_dirty; | ||
104 | bool shadow_extra_info_dirty; | ||
105 | |||
106 | struct omap_video_timings timings; | ||
102 | }; | 107 | }; |
103 | 108 | ||
104 | static struct { | 109 | static struct { |
@@ -176,7 +181,7 @@ static bool mgr_manual_update(struct omap_overlay_manager *mgr) | |||
176 | } | 181 | } |
177 | 182 | ||
178 | static int dss_check_settings_low(struct omap_overlay_manager *mgr, | 183 | static int dss_check_settings_low(struct omap_overlay_manager *mgr, |
179 | struct omap_dss_device *dssdev, bool applying) | 184 | bool applying) |
180 | { | 185 | { |
181 | struct omap_overlay_info *oi; | 186 | struct omap_overlay_info *oi; |
182 | struct omap_overlay_manager_info *mi; | 187 | struct omap_overlay_manager_info *mi; |
@@ -187,6 +192,9 @@ static int dss_check_settings_low(struct omap_overlay_manager *mgr, | |||
187 | 192 | ||
188 | mp = get_mgr_priv(mgr); | 193 | mp = get_mgr_priv(mgr); |
189 | 194 | ||
195 | if (!mp->enabled) | ||
196 | return 0; | ||
197 | |||
190 | if (applying && mp->user_info_dirty) | 198 | if (applying && mp->user_info_dirty) |
191 | mi = &mp->user_info; | 199 | mi = &mp->user_info; |
192 | else | 200 | else |
@@ -206,26 +214,24 @@ static int dss_check_settings_low(struct omap_overlay_manager *mgr, | |||
206 | ois[ovl->id] = oi; | 214 | ois[ovl->id] = oi; |
207 | } | 215 | } |
208 | 216 | ||
209 | return dss_mgr_check(mgr, dssdev, mi, ois); | 217 | return dss_mgr_check(mgr, mi, &mp->timings, ois); |
210 | } | 218 | } |
211 | 219 | ||
212 | /* | 220 | /* |
213 | * check manager and overlay settings using overlay_info from data->info | 221 | * check manager and overlay settings using overlay_info from data->info |
214 | */ | 222 | */ |
215 | static int dss_check_settings(struct omap_overlay_manager *mgr, | 223 | static int dss_check_settings(struct omap_overlay_manager *mgr) |
216 | struct omap_dss_device *dssdev) | ||
217 | { | 224 | { |
218 | return dss_check_settings_low(mgr, dssdev, false); | 225 | return dss_check_settings_low(mgr, false); |
219 | } | 226 | } |
220 | 227 | ||
221 | /* | 228 | /* |
222 | * check manager and overlay settings using overlay_info from ovl->info if | 229 | * check manager and overlay settings using overlay_info from ovl->info if |
223 | * dirty and from data->info otherwise | 230 | * dirty and from data->info otherwise |
224 | */ | 231 | */ |
225 | static int dss_check_settings_apply(struct omap_overlay_manager *mgr, | 232 | static int dss_check_settings_apply(struct omap_overlay_manager *mgr) |
226 | struct omap_dss_device *dssdev) | ||
227 | { | 233 | { |
228 | return dss_check_settings_low(mgr, dssdev, true); | 234 | return dss_check_settings_low(mgr, true); |
229 | } | 235 | } |
230 | 236 | ||
231 | static bool need_isr(void) | 237 | static bool need_isr(void) |
@@ -261,6 +267,20 @@ static bool need_isr(void) | |||
261 | if (mp->shadow_info_dirty) | 267 | if (mp->shadow_info_dirty) |
262 | return true; | 268 | return true; |
263 | 269 | ||
270 | /* | ||
271 | * NOTE: we don't check extra_info flags for disabled | ||
272 | * managers, once the manager is enabled, the extra_info | ||
273 | * related manager changes will be taken in by HW. | ||
274 | */ | ||
275 | |||
276 | /* to write new values to registers */ | ||
277 | if (mp->extra_info_dirty) | ||
278 | return true; | ||
279 | |||
280 | /* to set GO bit */ | ||
281 | if (mp->shadow_extra_info_dirty) | ||
282 | return true; | ||
283 | |||
264 | list_for_each_entry(ovl, &mgr->overlays, list) { | 284 | list_for_each_entry(ovl, &mgr->overlays, list) { |
265 | struct ovl_priv_data *op; | 285 | struct ovl_priv_data *op; |
266 | 286 | ||
@@ -305,7 +325,7 @@ static bool need_go(struct omap_overlay_manager *mgr) | |||
305 | 325 | ||
306 | mp = get_mgr_priv(mgr); | 326 | mp = get_mgr_priv(mgr); |
307 | 327 | ||
308 | if (mp->shadow_info_dirty) | 328 | if (mp->shadow_info_dirty || mp->shadow_extra_info_dirty) |
309 | return true; | 329 | return true; |
310 | 330 | ||
311 | list_for_each_entry(ovl, &mgr->overlays, list) { | 331 | list_for_each_entry(ovl, &mgr->overlays, list) { |
@@ -320,20 +340,16 @@ static bool need_go(struct omap_overlay_manager *mgr) | |||
320 | /* returns true if an extra_info field is currently being updated */ | 340 | /* returns true if an extra_info field is currently being updated */ |
321 | static bool extra_info_update_ongoing(void) | 341 | static bool extra_info_update_ongoing(void) |
322 | { | 342 | { |
323 | const int num_ovls = omap_dss_get_num_overlays(); | 343 | const int num_mgrs = dss_feat_get_num_mgrs(); |
324 | struct ovl_priv_data *op; | ||
325 | struct omap_overlay *ovl; | ||
326 | struct mgr_priv_data *mp; | ||
327 | int i; | 344 | int i; |
328 | 345 | ||
329 | for (i = 0; i < num_ovls; ++i) { | 346 | for (i = 0; i < num_mgrs; ++i) { |
330 | ovl = omap_dss_get_overlay(i); | 347 | struct omap_overlay_manager *mgr; |
331 | op = get_ovl_priv(ovl); | 348 | struct omap_overlay *ovl; |
332 | 349 | struct mgr_priv_data *mp; | |
333 | if (!ovl->manager) | ||
334 | continue; | ||
335 | 350 | ||
336 | mp = get_mgr_priv(ovl->manager); | 351 | mgr = omap_dss_get_overlay_manager(i); |
352 | mp = get_mgr_priv(mgr); | ||
337 | 353 | ||
338 | if (!mp->enabled) | 354 | if (!mp->enabled) |
339 | continue; | 355 | continue; |
@@ -341,8 +357,15 @@ static bool extra_info_update_ongoing(void) | |||
341 | if (!mp->updating) | 357 | if (!mp->updating) |
342 | continue; | 358 | continue; |
343 | 359 | ||
344 | if (op->extra_info_dirty || op->shadow_extra_info_dirty) | 360 | if (mp->extra_info_dirty || mp->shadow_extra_info_dirty) |
345 | return true; | 361 | return true; |
362 | |||
363 | list_for_each_entry(ovl, &mgr->overlays, list) { | ||
364 | struct ovl_priv_data *op = get_ovl_priv(ovl); | ||
365 | |||
366 | if (op->extra_info_dirty || op->shadow_extra_info_dirty) | ||
367 | return true; | ||
368 | } | ||
346 | } | 369 | } |
347 | 370 | ||
348 | return false; | 371 | return false; |
@@ -525,11 +548,13 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl) | |||
525 | 548 | ||
526 | oi = &op->info; | 549 | oi = &op->info; |
527 | 550 | ||
551 | mp = get_mgr_priv(ovl->manager); | ||
552 | |||
528 | replication = dss_use_replication(ovl->manager->device, oi->color_mode); | 553 | replication = dss_use_replication(ovl->manager->device, oi->color_mode); |
529 | 554 | ||
530 | ilace = ovl->manager->device->type == OMAP_DISPLAY_TYPE_VENC; | 555 | ilace = ovl->manager->device->type == OMAP_DISPLAY_TYPE_VENC; |
531 | 556 | ||
532 | r = dispc_ovl_setup(ovl->id, oi, ilace, replication); | 557 | r = dispc_ovl_setup(ovl->id, oi, ilace, replication, &mp->timings); |
533 | if (r) { | 558 | if (r) { |
534 | /* | 559 | /* |
535 | * We can't do much here, as this function can be called from | 560 | * We can't do much here, as this function can be called from |
@@ -543,8 +568,6 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl) | |||
543 | return; | 568 | return; |
544 | } | 569 | } |
545 | 570 | ||
546 | mp = get_mgr_priv(ovl->manager); | ||
547 | |||
548 | op->info_dirty = false; | 571 | op->info_dirty = false; |
549 | if (mp->updating) | 572 | if (mp->updating) |
550 | op->shadow_info_dirty = true; | 573 | op->shadow_info_dirty = true; |
@@ -601,6 +624,22 @@ static void dss_mgr_write_regs(struct omap_overlay_manager *mgr) | |||
601 | } | 624 | } |
602 | } | 625 | } |
603 | 626 | ||
627 | static void dss_mgr_write_regs_extra(struct omap_overlay_manager *mgr) | ||
628 | { | ||
629 | struct mgr_priv_data *mp = get_mgr_priv(mgr); | ||
630 | |||
631 | DSSDBGF("%d", mgr->id); | ||
632 | |||
633 | if (!mp->extra_info_dirty) | ||
634 | return; | ||
635 | |||
636 | dispc_mgr_set_timings(mgr->id, &mp->timings); | ||
637 | |||
638 | mp->extra_info_dirty = false; | ||
639 | if (mp->updating) | ||
640 | mp->shadow_extra_info_dirty = true; | ||
641 | } | ||
642 | |||
604 | static void dss_write_regs_common(void) | 643 | static void dss_write_regs_common(void) |
605 | { | 644 | { |
606 | const int num_mgrs = omap_dss_get_num_overlay_managers(); | 645 | const int num_mgrs = omap_dss_get_num_overlay_managers(); |
@@ -646,7 +685,7 @@ static void dss_write_regs(void) | |||
646 | if (!mp->enabled || mgr_manual_update(mgr) || mp->busy) | 685 | if (!mp->enabled || mgr_manual_update(mgr) || mp->busy) |
647 | continue; | 686 | continue; |
648 | 687 | ||
649 | r = dss_check_settings(mgr, mgr->device); | 688 | r = dss_check_settings(mgr); |
650 | if (r) { | 689 | if (r) { |
651 | DSSERR("cannot write registers for manager %s: " | 690 | DSSERR("cannot write registers for manager %s: " |
652 | "illegal configuration\n", mgr->name); | 691 | "illegal configuration\n", mgr->name); |
@@ -654,6 +693,7 @@ static void dss_write_regs(void) | |||
654 | } | 693 | } |
655 | 694 | ||
656 | dss_mgr_write_regs(mgr); | 695 | dss_mgr_write_regs(mgr); |
696 | dss_mgr_write_regs_extra(mgr); | ||
657 | } | 697 | } |
658 | } | 698 | } |
659 | 699 | ||
@@ -693,6 +733,7 @@ static void mgr_clear_shadow_dirty(struct omap_overlay_manager *mgr) | |||
693 | 733 | ||
694 | mp = get_mgr_priv(mgr); | 734 | mp = get_mgr_priv(mgr); |
695 | mp->shadow_info_dirty = false; | 735 | mp->shadow_info_dirty = false; |
736 | mp->shadow_extra_info_dirty = false; | ||
696 | 737 | ||
697 | list_for_each_entry(ovl, &mgr->overlays, list) { | 738 | list_for_each_entry(ovl, &mgr->overlays, list) { |
698 | op = get_ovl_priv(ovl); | 739 | op = get_ovl_priv(ovl); |
@@ -711,7 +752,7 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr) | |||
711 | 752 | ||
712 | WARN_ON(mp->updating); | 753 | WARN_ON(mp->updating); |
713 | 754 | ||
714 | r = dss_check_settings(mgr, mgr->device); | 755 | r = dss_check_settings(mgr); |
715 | if (r) { | 756 | if (r) { |
716 | DSSERR("cannot start manual update: illegal configuration\n"); | 757 | DSSERR("cannot start manual update: illegal configuration\n"); |
717 | spin_unlock_irqrestore(&data_lock, flags); | 758 | spin_unlock_irqrestore(&data_lock, flags); |
@@ -719,6 +760,7 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr) | |||
719 | } | 760 | } |
720 | 761 | ||
721 | dss_mgr_write_regs(mgr); | 762 | dss_mgr_write_regs(mgr); |
763 | dss_mgr_write_regs_extra(mgr); | ||
722 | 764 | ||
723 | dss_write_regs_common(); | 765 | dss_write_regs_common(); |
724 | 766 | ||
@@ -857,7 +899,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) | |||
857 | 899 | ||
858 | spin_lock_irqsave(&data_lock, flags); | 900 | spin_lock_irqsave(&data_lock, flags); |
859 | 901 | ||
860 | r = dss_check_settings_apply(mgr, mgr->device); | 902 | r = dss_check_settings_apply(mgr); |
861 | if (r) { | 903 | if (r) { |
862 | spin_unlock_irqrestore(&data_lock, flags); | 904 | spin_unlock_irqrestore(&data_lock, flags); |
863 | DSSERR("failed to apply settings: illegal configuration.\n"); | 905 | DSSERR("failed to apply settings: illegal configuration.\n"); |
@@ -918,16 +960,13 @@ static void dss_ovl_setup_fifo(struct omap_overlay *ovl, | |||
918 | bool use_fifo_merge) | 960 | bool use_fifo_merge) |
919 | { | 961 | { |
920 | struct ovl_priv_data *op = get_ovl_priv(ovl); | 962 | struct ovl_priv_data *op = get_ovl_priv(ovl); |
921 | struct omap_dss_device *dssdev; | ||
922 | u32 fifo_low, fifo_high; | 963 | u32 fifo_low, fifo_high; |
923 | 964 | ||
924 | if (!op->enabled && !op->enabling) | 965 | if (!op->enabled && !op->enabling) |
925 | return; | 966 | return; |
926 | 967 | ||
927 | dssdev = ovl->manager->device; | ||
928 | |||
929 | dispc_ovl_compute_fifo_thresholds(ovl->id, &fifo_low, &fifo_high, | 968 | dispc_ovl_compute_fifo_thresholds(ovl->id, &fifo_low, &fifo_high, |
930 | use_fifo_merge); | 969 | use_fifo_merge, ovl_manual_update(ovl)); |
931 | 970 | ||
932 | dss_apply_ovl_fifo_thresholds(ovl, fifo_low, fifo_high); | 971 | dss_apply_ovl_fifo_thresholds(ovl, fifo_low, fifo_high); |
933 | } | 972 | } |
@@ -1050,7 +1089,7 @@ int dss_mgr_enable(struct omap_overlay_manager *mgr) | |||
1050 | 1089 | ||
1051 | mp->enabled = true; | 1090 | mp->enabled = true; |
1052 | 1091 | ||
1053 | r = dss_check_settings(mgr, mgr->device); | 1092 | r = dss_check_settings(mgr); |
1054 | if (r) { | 1093 | if (r) { |
1055 | DSSERR("failed to enable manager %d: check_settings failed\n", | 1094 | DSSERR("failed to enable manager %d: check_settings failed\n", |
1056 | mgr->id); | 1095 | mgr->id); |
@@ -1225,6 +1264,35 @@ err: | |||
1225 | return r; | 1264 | return r; |
1226 | } | 1265 | } |
1227 | 1266 | ||
1267 | static void dss_apply_mgr_timings(struct omap_overlay_manager *mgr, | ||
1268 | struct omap_video_timings *timings) | ||
1269 | { | ||
1270 | struct mgr_priv_data *mp = get_mgr_priv(mgr); | ||
1271 | |||
1272 | mp->timings = *timings; | ||
1273 | mp->extra_info_dirty = true; | ||
1274 | } | ||
1275 | |||
1276 | void dss_mgr_set_timings(struct omap_overlay_manager *mgr, | ||
1277 | struct omap_video_timings *timings) | ||
1278 | { | ||
1279 | unsigned long flags; | ||
1280 | |||
1281 | mutex_lock(&apply_lock); | ||
1282 | |||
1283 | spin_lock_irqsave(&data_lock, flags); | ||
1284 | |||
1285 | dss_apply_mgr_timings(mgr, timings); | ||
1286 | |||
1287 | dss_write_regs(); | ||
1288 | dss_set_go_bits(); | ||
1289 | |||
1290 | spin_unlock_irqrestore(&data_lock, flags); | ||
1291 | |||
1292 | wait_pending_extra_info_updates(); | ||
1293 | |||
1294 | mutex_unlock(&apply_lock); | ||
1295 | } | ||
1228 | 1296 | ||
1229 | int dss_ovl_set_info(struct omap_overlay *ovl, | 1297 | int dss_ovl_set_info(struct omap_overlay *ovl, |
1230 | struct omap_overlay_info *info) | 1298 | struct omap_overlay_info *info) |
@@ -1393,7 +1461,7 @@ int dss_ovl_enable(struct omap_overlay *ovl) | |||
1393 | 1461 | ||
1394 | op->enabling = true; | 1462 | op->enabling = true; |
1395 | 1463 | ||
1396 | r = dss_check_settings(ovl->manager, ovl->manager->device); | 1464 | r = dss_check_settings(ovl->manager); |
1397 | if (r) { | 1465 | if (r) { |
1398 | DSSERR("failed to enable overlay %d: check_settings failed\n", | 1466 | DSSERR("failed to enable overlay %d: check_settings failed\n", |
1399 | ovl->id); | 1467 | ovl->id); |
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index e8a120771ac6..72ded9cd2cb0 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
@@ -43,6 +43,8 @@ static struct { | |||
43 | 43 | ||
44 | struct regulator *vdds_dsi_reg; | 44 | struct regulator *vdds_dsi_reg; |
45 | struct regulator *vdds_sdi_reg; | 45 | struct regulator *vdds_sdi_reg; |
46 | |||
47 | const char *default_display_name; | ||
46 | } core; | 48 | } core; |
47 | 49 | ||
48 | static char *def_disp_name; | 50 | static char *def_disp_name; |
@@ -54,9 +56,6 @@ bool dss_debug; | |||
54 | module_param_named(debug, dss_debug, bool, 0644); | 56 | module_param_named(debug, dss_debug, bool, 0644); |
55 | #endif | 57 | #endif |
56 | 58 | ||
57 | static int omap_dss_register_device(struct omap_dss_device *); | ||
58 | static void omap_dss_unregister_device(struct omap_dss_device *); | ||
59 | |||
60 | /* REGULATORS */ | 59 | /* REGULATORS */ |
61 | 60 | ||
62 | struct regulator *dss_get_vdds_dsi(void) | 61 | struct regulator *dss_get_vdds_dsi(void) |
@@ -87,6 +86,51 @@ struct regulator *dss_get_vdds_sdi(void) | |||
87 | return reg; | 86 | return reg; |
88 | } | 87 | } |
89 | 88 | ||
89 | int dss_get_ctx_loss_count(struct device *dev) | ||
90 | { | ||
91 | struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; | ||
92 | int cnt; | ||
93 | |||
94 | if (!board_data->get_context_loss_count) | ||
95 | return -ENOENT; | ||
96 | |||
97 | cnt = board_data->get_context_loss_count(dev); | ||
98 | |||
99 | WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); | ||
100 | |||
101 | return cnt; | ||
102 | } | ||
103 | |||
104 | int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask) | ||
105 | { | ||
106 | struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; | ||
107 | |||
108 | if (!board_data->dsi_enable_pads) | ||
109 | return -ENOENT; | ||
110 | |||
111 | return board_data->dsi_enable_pads(dsi_id, lane_mask); | ||
112 | } | ||
113 | |||
114 | void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask) | ||
115 | { | ||
116 | struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; | ||
117 | |||
118 | if (!board_data->dsi_enable_pads) | ||
119 | return; | ||
120 | |||
121 | return board_data->dsi_disable_pads(dsi_id, lane_mask); | ||
122 | } | ||
123 | |||
124 | int dss_set_min_bus_tput(struct device *dev, unsigned long tput) | ||
125 | { | ||
126 | struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; | ||
127 | |||
128 | if (pdata->set_min_bus_tput) | ||
129 | return pdata->set_min_bus_tput(dev, tput); | ||
130 | else | ||
131 | return 0; | ||
132 | } | ||
133 | |||
90 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) | 134 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) |
91 | static int dss_debug_show(struct seq_file *s, void *unused) | 135 | static int dss_debug_show(struct seq_file *s, void *unused) |
92 | { | 136 | { |
@@ -121,34 +165,6 @@ static int dss_initialize_debugfs(void) | |||
121 | debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, | 165 | debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, |
122 | &dss_debug_dump_clocks, &dss_debug_fops); | 166 | &dss_debug_dump_clocks, &dss_debug_fops); |
123 | 167 | ||
124 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | ||
125 | debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir, | ||
126 | &dispc_dump_irqs, &dss_debug_fops); | ||
127 | #endif | ||
128 | |||
129 | #if defined(CONFIG_OMAP2_DSS_DSI) && defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS) | ||
130 | dsi_create_debugfs_files_irq(dss_debugfs_dir, &dss_debug_fops); | ||
131 | #endif | ||
132 | |||
133 | debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir, | ||
134 | &dss_dump_regs, &dss_debug_fops); | ||
135 | debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir, | ||
136 | &dispc_dump_regs, &dss_debug_fops); | ||
137 | #ifdef CONFIG_OMAP2_DSS_RFBI | ||
138 | debugfs_create_file("rfbi", S_IRUGO, dss_debugfs_dir, | ||
139 | &rfbi_dump_regs, &dss_debug_fops); | ||
140 | #endif | ||
141 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
142 | dsi_create_debugfs_files_reg(dss_debugfs_dir, &dss_debug_fops); | ||
143 | #endif | ||
144 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
145 | debugfs_create_file("venc", S_IRUGO, dss_debugfs_dir, | ||
146 | &venc_dump_regs, &dss_debug_fops); | ||
147 | #endif | ||
148 | #ifdef CONFIG_OMAP4_DSS_HDMI | ||
149 | debugfs_create_file("hdmi", S_IRUGO, dss_debugfs_dir, | ||
150 | &hdmi_dump_regs, &dss_debug_fops); | ||
151 | #endif | ||
152 | return 0; | 168 | return 0; |
153 | } | 169 | } |
154 | 170 | ||
@@ -157,6 +173,19 @@ static void dss_uninitialize_debugfs(void) | |||
157 | if (dss_debugfs_dir) | 173 | if (dss_debugfs_dir) |
158 | debugfs_remove_recursive(dss_debugfs_dir); | 174 | debugfs_remove_recursive(dss_debugfs_dir); |
159 | } | 175 | } |
176 | |||
177 | int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) | ||
178 | { | ||
179 | struct dentry *d; | ||
180 | |||
181 | d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, | ||
182 | write, &dss_debug_fops); | ||
183 | |||
184 | if (IS_ERR(d)) | ||
185 | return PTR_ERR(d); | ||
186 | |||
187 | return 0; | ||
188 | } | ||
160 | #else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ | 189 | #else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ |
161 | static inline int dss_initialize_debugfs(void) | 190 | static inline int dss_initialize_debugfs(void) |
162 | { | 191 | { |
@@ -165,14 +194,18 @@ static inline int dss_initialize_debugfs(void) | |||
165 | static inline void dss_uninitialize_debugfs(void) | 194 | static inline void dss_uninitialize_debugfs(void) |
166 | { | 195 | { |
167 | } | 196 | } |
197 | static inline int dss_debugfs_create_file(const char *name, | ||
198 | void (*write)(struct seq_file *)) | ||
199 | { | ||
200 | return 0; | ||
201 | } | ||
168 | #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ | 202 | #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ |
169 | 203 | ||
170 | /* PLATFORM DEVICE */ | 204 | /* PLATFORM DEVICE */ |
171 | static int omap_dss_probe(struct platform_device *pdev) | 205 | static int __init omap_dss_probe(struct platform_device *pdev) |
172 | { | 206 | { |
173 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | 207 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; |
174 | int r; | 208 | int r; |
175 | int i; | ||
176 | 209 | ||
177 | core.pdev = pdev; | 210 | core.pdev = pdev; |
178 | 211 | ||
@@ -187,28 +220,13 @@ static int omap_dss_probe(struct platform_device *pdev) | |||
187 | if (r) | 220 | if (r) |
188 | goto err_debugfs; | 221 | goto err_debugfs; |
189 | 222 | ||
190 | for (i = 0; i < pdata->num_devices; ++i) { | 223 | if (def_disp_name) |
191 | struct omap_dss_device *dssdev = pdata->devices[i]; | 224 | core.default_display_name = def_disp_name; |
192 | 225 | else if (pdata->default_device) | |
193 | r = omap_dss_register_device(dssdev); | 226 | core.default_display_name = pdata->default_device->name; |
194 | if (r) { | ||
195 | DSSERR("device %d %s register failed %d\n", i, | ||
196 | dssdev->name ?: "unnamed", r); | ||
197 | |||
198 | while (--i >= 0) | ||
199 | omap_dss_unregister_device(pdata->devices[i]); | ||
200 | |||
201 | goto err_register; | ||
202 | } | ||
203 | |||
204 | if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0) | ||
205 | pdata->default_device = dssdev; | ||
206 | } | ||
207 | 227 | ||
208 | return 0; | 228 | return 0; |
209 | 229 | ||
210 | err_register: | ||
211 | dss_uninitialize_debugfs(); | ||
212 | err_debugfs: | 230 | err_debugfs: |
213 | 231 | ||
214 | return r; | 232 | return r; |
@@ -216,17 +234,11 @@ err_debugfs: | |||
216 | 234 | ||
217 | static int omap_dss_remove(struct platform_device *pdev) | 235 | static int omap_dss_remove(struct platform_device *pdev) |
218 | { | 236 | { |
219 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
220 | int i; | ||
221 | |||
222 | dss_uninitialize_debugfs(); | 237 | dss_uninitialize_debugfs(); |
223 | 238 | ||
224 | dss_uninit_overlays(pdev); | 239 | dss_uninit_overlays(pdev); |
225 | dss_uninit_overlay_managers(pdev); | 240 | dss_uninit_overlay_managers(pdev); |
226 | 241 | ||
227 | for (i = 0; i < pdata->num_devices; ++i) | ||
228 | omap_dss_unregister_device(pdata->devices[i]); | ||
229 | |||
230 | return 0; | 242 | return 0; |
231 | } | 243 | } |
232 | 244 | ||
@@ -251,7 +263,6 @@ static int omap_dss_resume(struct platform_device *pdev) | |||
251 | } | 263 | } |
252 | 264 | ||
253 | static struct platform_driver omap_dss_driver = { | 265 | static struct platform_driver omap_dss_driver = { |
254 | .probe = omap_dss_probe, | ||
255 | .remove = omap_dss_remove, | 266 | .remove = omap_dss_remove, |
256 | .shutdown = omap_dss_shutdown, | 267 | .shutdown = omap_dss_shutdown, |
257 | .suspend = omap_dss_suspend, | 268 | .suspend = omap_dss_suspend, |
@@ -326,7 +337,6 @@ static int dss_driver_probe(struct device *dev) | |||
326 | int r; | 337 | int r; |
327 | struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver); | 338 | struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver); |
328 | struct omap_dss_device *dssdev = to_dss_device(dev); | 339 | struct omap_dss_device *dssdev = to_dss_device(dev); |
329 | struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; | ||
330 | bool force; | 340 | bool force; |
331 | 341 | ||
332 | DSSDBG("driver_probe: dev %s/%s, drv %s\n", | 342 | DSSDBG("driver_probe: dev %s/%s, drv %s\n", |
@@ -335,7 +345,8 @@ static int dss_driver_probe(struct device *dev) | |||
335 | 345 | ||
336 | dss_init_device(core.pdev, dssdev); | 346 | dss_init_device(core.pdev, dssdev); |
337 | 347 | ||
338 | force = pdata->default_device == dssdev; | 348 | force = core.default_display_name && |
349 | strcmp(core.default_display_name, dssdev->name) == 0; | ||
339 | dss_recheck_connections(dssdev, force); | 350 | dss_recheck_connections(dssdev, force); |
340 | 351 | ||
341 | r = dssdrv->probe(dssdev); | 352 | r = dssdrv->probe(dssdev); |
@@ -381,6 +392,8 @@ int omap_dss_register_driver(struct omap_dss_driver *dssdriver) | |||
381 | if (dssdriver->get_recommended_bpp == NULL) | 392 | if (dssdriver->get_recommended_bpp == NULL) |
382 | dssdriver->get_recommended_bpp = | 393 | dssdriver->get_recommended_bpp = |
383 | omapdss_default_get_recommended_bpp; | 394 | omapdss_default_get_recommended_bpp; |
395 | if (dssdriver->get_timings == NULL) | ||
396 | dssdriver->get_timings = omapdss_default_get_timings; | ||
384 | 397 | ||
385 | return driver_register(&dssdriver->driver); | 398 | return driver_register(&dssdriver->driver); |
386 | } | 399 | } |
@@ -427,27 +440,38 @@ static void omap_dss_dev_release(struct device *dev) | |||
427 | reset_device(dev, 0); | 440 | reset_device(dev, 0); |
428 | } | 441 | } |
429 | 442 | ||
430 | static int omap_dss_register_device(struct omap_dss_device *dssdev) | 443 | int omap_dss_register_device(struct omap_dss_device *dssdev, |
444 | struct device *parent, int disp_num) | ||
431 | { | 445 | { |
432 | static int dev_num; | ||
433 | |||
434 | WARN_ON(!dssdev->driver_name); | 446 | WARN_ON(!dssdev->driver_name); |
435 | 447 | ||
436 | reset_device(&dssdev->dev, 1); | 448 | reset_device(&dssdev->dev, 1); |
437 | dssdev->dev.bus = &dss_bus_type; | 449 | dssdev->dev.bus = &dss_bus_type; |
438 | dssdev->dev.parent = &dss_bus; | 450 | dssdev->dev.parent = parent; |
439 | dssdev->dev.release = omap_dss_dev_release; | 451 | dssdev->dev.release = omap_dss_dev_release; |
440 | dev_set_name(&dssdev->dev, "display%d", dev_num++); | 452 | dev_set_name(&dssdev->dev, "display%d", disp_num); |
441 | return device_register(&dssdev->dev); | 453 | return device_register(&dssdev->dev); |
442 | } | 454 | } |
443 | 455 | ||
444 | static void omap_dss_unregister_device(struct omap_dss_device *dssdev) | 456 | void omap_dss_unregister_device(struct omap_dss_device *dssdev) |
445 | { | 457 | { |
446 | device_unregister(&dssdev->dev); | 458 | device_unregister(&dssdev->dev); |
447 | } | 459 | } |
448 | 460 | ||
461 | static int dss_unregister_dss_dev(struct device *dev, void *data) | ||
462 | { | ||
463 | struct omap_dss_device *dssdev = to_dss_device(dev); | ||
464 | omap_dss_unregister_device(dssdev); | ||
465 | return 0; | ||
466 | } | ||
467 | |||
468 | void omap_dss_unregister_child_devices(struct device *parent) | ||
469 | { | ||
470 | device_for_each_child(parent, NULL, dss_unregister_dss_dev); | ||
471 | } | ||
472 | |||
449 | /* BUS */ | 473 | /* BUS */ |
450 | static int omap_dss_bus_register(void) | 474 | static int __init omap_dss_bus_register(void) |
451 | { | 475 | { |
452 | int r; | 476 | int r; |
453 | 477 | ||
@@ -469,12 +493,56 @@ static int omap_dss_bus_register(void) | |||
469 | } | 493 | } |
470 | 494 | ||
471 | /* INIT */ | 495 | /* INIT */ |
496 | static int (*dss_output_drv_reg_funcs[])(void) __initdata = { | ||
497 | #ifdef CONFIG_OMAP2_DSS_DPI | ||
498 | dpi_init_platform_driver, | ||
499 | #endif | ||
500 | #ifdef CONFIG_OMAP2_DSS_SDI | ||
501 | sdi_init_platform_driver, | ||
502 | #endif | ||
503 | #ifdef CONFIG_OMAP2_DSS_RFBI | ||
504 | rfbi_init_platform_driver, | ||
505 | #endif | ||
506 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
507 | venc_init_platform_driver, | ||
508 | #endif | ||
509 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
510 | dsi_init_platform_driver, | ||
511 | #endif | ||
512 | #ifdef CONFIG_OMAP4_DSS_HDMI | ||
513 | hdmi_init_platform_driver, | ||
514 | #endif | ||
515 | }; | ||
516 | |||
517 | static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = { | ||
518 | #ifdef CONFIG_OMAP2_DSS_DPI | ||
519 | dpi_uninit_platform_driver, | ||
520 | #endif | ||
521 | #ifdef CONFIG_OMAP2_DSS_SDI | ||
522 | sdi_uninit_platform_driver, | ||
523 | #endif | ||
524 | #ifdef CONFIG_OMAP2_DSS_RFBI | ||
525 | rfbi_uninit_platform_driver, | ||
526 | #endif | ||
527 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
528 | venc_uninit_platform_driver, | ||
529 | #endif | ||
530 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
531 | dsi_uninit_platform_driver, | ||
532 | #endif | ||
533 | #ifdef CONFIG_OMAP4_DSS_HDMI | ||
534 | hdmi_uninit_platform_driver, | ||
535 | #endif | ||
536 | }; | ||
537 | |||
538 | static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)]; | ||
472 | 539 | ||
473 | static int __init omap_dss_register_drivers(void) | 540 | static int __init omap_dss_register_drivers(void) |
474 | { | 541 | { |
475 | int r; | 542 | int r; |
543 | int i; | ||
476 | 544 | ||
477 | r = platform_driver_register(&omap_dss_driver); | 545 | r = platform_driver_probe(&omap_dss_driver, omap_dss_probe); |
478 | if (r) | 546 | if (r) |
479 | return r; | 547 | return r; |
480 | 548 | ||
@@ -490,40 +558,18 @@ static int __init omap_dss_register_drivers(void) | |||
490 | goto err_dispc; | 558 | goto err_dispc; |
491 | } | 559 | } |
492 | 560 | ||
493 | r = rfbi_init_platform_driver(); | 561 | /* |
494 | if (r) { | 562 | * It's ok if the output-driver register fails. It happens, for example, |
495 | DSSERR("Failed to initialize rfbi platform driver\n"); | 563 | * when there is no output-device (e.g. SDI for OMAP4). |
496 | goto err_rfbi; | 564 | */ |
497 | } | 565 | for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) { |
498 | 566 | r = dss_output_drv_reg_funcs[i](); | |
499 | r = venc_init_platform_driver(); | 567 | if (r == 0) |
500 | if (r) { | 568 | dss_output_drv_loaded[i] = true; |
501 | DSSERR("Failed to initialize venc platform driver\n"); | ||
502 | goto err_venc; | ||
503 | } | ||
504 | |||
505 | r = dsi_init_platform_driver(); | ||
506 | if (r) { | ||
507 | DSSERR("Failed to initialize DSI platform driver\n"); | ||
508 | goto err_dsi; | ||
509 | } | ||
510 | |||
511 | r = hdmi_init_platform_driver(); | ||
512 | if (r) { | ||
513 | DSSERR("Failed to initialize hdmi\n"); | ||
514 | goto err_hdmi; | ||
515 | } | 569 | } |
516 | 570 | ||
517 | return 0; | 571 | return 0; |
518 | 572 | ||
519 | err_hdmi: | ||
520 | dsi_uninit_platform_driver(); | ||
521 | err_dsi: | ||
522 | venc_uninit_platform_driver(); | ||
523 | err_venc: | ||
524 | rfbi_uninit_platform_driver(); | ||
525 | err_rfbi: | ||
526 | dispc_uninit_platform_driver(); | ||
527 | err_dispc: | 573 | err_dispc: |
528 | dss_uninit_platform_driver(); | 574 | dss_uninit_platform_driver(); |
529 | err_dss: | 575 | err_dss: |
@@ -534,10 +580,13 @@ err_dss: | |||
534 | 580 | ||
535 | static void __exit omap_dss_unregister_drivers(void) | 581 | static void __exit omap_dss_unregister_drivers(void) |
536 | { | 582 | { |
537 | hdmi_uninit_platform_driver(); | 583 | int i; |
538 | dsi_uninit_platform_driver(); | 584 | |
539 | venc_uninit_platform_driver(); | 585 | for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) { |
540 | rfbi_uninit_platform_driver(); | 586 | if (dss_output_drv_loaded[i]) |
587 | dss_output_drv_unreg_funcs[i](); | ||
588 | } | ||
589 | |||
541 | dispc_uninit_platform_driver(); | 590 | dispc_uninit_platform_driver(); |
542 | dss_uninit_platform_driver(); | 591 | dss_uninit_platform_driver(); |
543 | 592 | ||
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index ee30937482e1..4749ac356469 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -131,23 +131,6 @@ static inline u32 dispc_read_reg(const u16 idx) | |||
131 | return __raw_readl(dispc.base + idx); | 131 | return __raw_readl(dispc.base + idx); |
132 | } | 132 | } |
133 | 133 | ||
134 | static int dispc_get_ctx_loss_count(void) | ||
135 | { | ||
136 | struct device *dev = &dispc.pdev->dev; | ||
137 | struct omap_display_platform_data *pdata = dev->platform_data; | ||
138 | struct omap_dss_board_info *board_data = pdata->board_data; | ||
139 | int cnt; | ||
140 | |||
141 | if (!board_data->get_context_loss_count) | ||
142 | return -ENOENT; | ||
143 | |||
144 | cnt = board_data->get_context_loss_count(dev); | ||
145 | |||
146 | WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); | ||
147 | |||
148 | return cnt; | ||
149 | } | ||
150 | |||
151 | #define SR(reg) \ | 134 | #define SR(reg) \ |
152 | dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg) | 135 | dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg) |
153 | #define RR(reg) \ | 136 | #define RR(reg) \ |
@@ -251,7 +234,7 @@ static void dispc_save_context(void) | |||
251 | if (dss_has_feature(FEAT_CORE_CLK_DIV)) | 234 | if (dss_has_feature(FEAT_CORE_CLK_DIV)) |
252 | SR(DIVISOR); | 235 | SR(DIVISOR); |
253 | 236 | ||
254 | dispc.ctx_loss_cnt = dispc_get_ctx_loss_count(); | 237 | dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev); |
255 | dispc.ctx_valid = true; | 238 | dispc.ctx_valid = true; |
256 | 239 | ||
257 | DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); | 240 | DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); |
@@ -266,7 +249,7 @@ static void dispc_restore_context(void) | |||
266 | if (!dispc.ctx_valid) | 249 | if (!dispc.ctx_valid) |
267 | return; | 250 | return; |
268 | 251 | ||
269 | ctx = dispc_get_ctx_loss_count(); | 252 | ctx = dss_get_ctx_loss_count(&dispc.pdev->dev); |
270 | 253 | ||
271 | if (ctx >= 0 && ctx == dispc.ctx_loss_cnt) | 254 | if (ctx >= 0 && ctx == dispc.ctx_loss_cnt) |
272 | return; | 255 | return; |
@@ -413,14 +396,6 @@ static inline bool dispc_mgr_is_lcd(enum omap_channel channel) | |||
413 | return false; | 396 | return false; |
414 | } | 397 | } |
415 | 398 | ||
416 | static struct omap_dss_device *dispc_mgr_get_device(enum omap_channel channel) | ||
417 | { | ||
418 | struct omap_overlay_manager *mgr = | ||
419 | omap_dss_get_overlay_manager(channel); | ||
420 | |||
421 | return mgr ? mgr->device : NULL; | ||
422 | } | ||
423 | |||
424 | u32 dispc_mgr_get_vsync_irq(enum omap_channel channel) | 399 | u32 dispc_mgr_get_vsync_irq(enum omap_channel channel) |
425 | { | 400 | { |
426 | switch (channel) { | 401 | switch (channel) { |
@@ -432,6 +407,7 @@ u32 dispc_mgr_get_vsync_irq(enum omap_channel channel) | |||
432 | return DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN; | 407 | return DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN; |
433 | default: | 408 | default: |
434 | BUG(); | 409 | BUG(); |
410 | return 0; | ||
435 | } | 411 | } |
436 | } | 412 | } |
437 | 413 | ||
@@ -446,6 +422,7 @@ u32 dispc_mgr_get_framedone_irq(enum omap_channel channel) | |||
446 | return 0; | 422 | return 0; |
447 | default: | 423 | default: |
448 | BUG(); | 424 | BUG(); |
425 | return 0; | ||
449 | } | 426 | } |
450 | } | 427 | } |
451 | 428 | ||
@@ -764,7 +741,7 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane, | |||
764 | case OMAP_DSS_COLOR_XRGB16_1555: | 741 | case OMAP_DSS_COLOR_XRGB16_1555: |
765 | m = 0xf; break; | 742 | m = 0xf; break; |
766 | default: | 743 | default: |
767 | BUG(); break; | 744 | BUG(); return; |
768 | } | 745 | } |
769 | } else { | 746 | } else { |
770 | switch (color_mode) { | 747 | switch (color_mode) { |
@@ -801,13 +778,25 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane, | |||
801 | case OMAP_DSS_COLOR_XRGB16_1555: | 778 | case OMAP_DSS_COLOR_XRGB16_1555: |
802 | m = 0xf; break; | 779 | m = 0xf; break; |
803 | default: | 780 | default: |
804 | BUG(); break; | 781 | BUG(); return; |
805 | } | 782 | } |
806 | } | 783 | } |
807 | 784 | ||
808 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), m, 4, 1); | 785 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), m, 4, 1); |
809 | } | 786 | } |
810 | 787 | ||
788 | static void dispc_ovl_configure_burst_type(enum omap_plane plane, | ||
789 | enum omap_dss_rotation_type rotation_type) | ||
790 | { | ||
791 | if (dss_has_feature(FEAT_BURST_2D) == 0) | ||
792 | return; | ||
793 | |||
794 | if (rotation_type == OMAP_DSS_ROT_TILER) | ||
795 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), 1, 29, 29); | ||
796 | else | ||
797 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), 0, 29, 29); | ||
798 | } | ||
799 | |||
811 | void dispc_ovl_set_channel_out(enum omap_plane plane, enum omap_channel channel) | 800 | void dispc_ovl_set_channel_out(enum omap_plane plane, enum omap_channel channel) |
812 | { | 801 | { |
813 | int shift; | 802 | int shift; |
@@ -845,6 +834,7 @@ void dispc_ovl_set_channel_out(enum omap_plane plane, enum omap_channel channel) | |||
845 | break; | 834 | break; |
846 | default: | 835 | default: |
847 | BUG(); | 836 | BUG(); |
837 | return; | ||
848 | } | 838 | } |
849 | 839 | ||
850 | val = FLD_MOD(val, chan, shift, shift); | 840 | val = FLD_MOD(val, chan, shift, shift); |
@@ -872,6 +862,7 @@ static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane plane) | |||
872 | break; | 862 | break; |
873 | default: | 863 | default: |
874 | BUG(); | 864 | BUG(); |
865 | return 0; | ||
875 | } | 866 | } |
876 | 867 | ||
877 | val = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane)); | 868 | val = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane)); |
@@ -983,20 +974,13 @@ static void dispc_ovl_enable_replication(enum omap_plane plane, bool enable) | |||
983 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), enable, shift, shift); | 974 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), enable, shift, shift); |
984 | } | 975 | } |
985 | 976 | ||
986 | void dispc_mgr_set_lcd_size(enum omap_channel channel, u16 width, u16 height) | 977 | static void dispc_mgr_set_size(enum omap_channel channel, u16 width, |
978 | u16 height) | ||
987 | { | 979 | { |
988 | u32 val; | 980 | u32 val; |
989 | BUG_ON((width > (1 << 11)) || (height > (1 << 11))); | ||
990 | val = FLD_VAL(height - 1, 26, 16) | FLD_VAL(width - 1, 10, 0); | ||
991 | dispc_write_reg(DISPC_SIZE_MGR(channel), val); | ||
992 | } | ||
993 | 981 | ||
994 | void dispc_set_digit_size(u16 width, u16 height) | ||
995 | { | ||
996 | u32 val; | ||
997 | BUG_ON((width > (1 << 11)) || (height > (1 << 11))); | ||
998 | val = FLD_VAL(height - 1, 26, 16) | FLD_VAL(width - 1, 10, 0); | 982 | val = FLD_VAL(height - 1, 26, 16) | FLD_VAL(width - 1, 10, 0); |
999 | dispc_write_reg(DISPC_SIZE_MGR(OMAP_DSS_CHANNEL_DIGIT), val); | 983 | dispc_write_reg(DISPC_SIZE_MGR(channel), val); |
1000 | } | 984 | } |
1001 | 985 | ||
1002 | static void dispc_read_plane_fifo_sizes(void) | 986 | static void dispc_read_plane_fifo_sizes(void) |
@@ -1063,7 +1047,8 @@ void dispc_enable_fifomerge(bool enable) | |||
1063 | } | 1047 | } |
1064 | 1048 | ||
1065 | void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane, | 1049 | void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane, |
1066 | u32 *fifo_low, u32 *fifo_high, bool use_fifomerge) | 1050 | u32 *fifo_low, u32 *fifo_high, bool use_fifomerge, |
1051 | bool manual_update) | ||
1067 | { | 1052 | { |
1068 | /* | 1053 | /* |
1069 | * All sizes are in bytes. Both the buffer and burst are made of | 1054 | * All sizes are in bytes. Both the buffer and burst are made of |
@@ -1091,7 +1076,7 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane, | |||
1091 | * combined fifo size | 1076 | * combined fifo size |
1092 | */ | 1077 | */ |
1093 | 1078 | ||
1094 | if (dss_has_feature(FEAT_OMAP3_DSI_FIFO_BUG)) { | 1079 | if (manual_update && dss_has_feature(FEAT_OMAP3_DSI_FIFO_BUG)) { |
1095 | *fifo_low = ovl_fifo_size - burst_size * 2; | 1080 | *fifo_low = ovl_fifo_size - burst_size * 2; |
1096 | *fifo_high = total_fifo_size - burst_size; | 1081 | *fifo_high = total_fifo_size - burst_size; |
1097 | } else { | 1082 | } else { |
@@ -1185,6 +1170,94 @@ static void dispc_ovl_set_scale_param(enum omap_plane plane, | |||
1185 | dispc_ovl_set_fir(plane, fir_hinc, fir_vinc, color_comp); | 1170 | dispc_ovl_set_fir(plane, fir_hinc, fir_vinc, color_comp); |
1186 | } | 1171 | } |
1187 | 1172 | ||
1173 | static void dispc_ovl_set_accu_uv(enum omap_plane plane, | ||
1174 | u16 orig_width, u16 orig_height, u16 out_width, u16 out_height, | ||
1175 | bool ilace, enum omap_color_mode color_mode, u8 rotation) | ||
1176 | { | ||
1177 | int h_accu2_0, h_accu2_1; | ||
1178 | int v_accu2_0, v_accu2_1; | ||
1179 | int chroma_hinc, chroma_vinc; | ||
1180 | int idx; | ||
1181 | |||
1182 | struct accu { | ||
1183 | s8 h0_m, h0_n; | ||
1184 | s8 h1_m, h1_n; | ||
1185 | s8 v0_m, v0_n; | ||
1186 | s8 v1_m, v1_n; | ||
1187 | }; | ||
1188 | |||
1189 | const struct accu *accu_table; | ||
1190 | const struct accu *accu_val; | ||
1191 | |||
1192 | static const struct accu accu_nv12[4] = { | ||
1193 | { 0, 1, 0, 1 , -1, 2, 0, 1 }, | ||
1194 | { 1, 2, -3, 4 , 0, 1, 0, 1 }, | ||
1195 | { -1, 1, 0, 1 , -1, 2, 0, 1 }, | ||
1196 | { -1, 2, -1, 2 , -1, 1, 0, 1 }, | ||
1197 | }; | ||
1198 | |||
1199 | static const struct accu accu_nv12_ilace[4] = { | ||
1200 | { 0, 1, 0, 1 , -3, 4, -1, 4 }, | ||
1201 | { -1, 4, -3, 4 , 0, 1, 0, 1 }, | ||
1202 | { -1, 1, 0, 1 , -1, 4, -3, 4 }, | ||
1203 | { -3, 4, -3, 4 , -1, 1, 0, 1 }, | ||
1204 | }; | ||
1205 | |||
1206 | static const struct accu accu_yuv[4] = { | ||
1207 | { 0, 1, 0, 1, 0, 1, 0, 1 }, | ||
1208 | { 0, 1, 0, 1, 0, 1, 0, 1 }, | ||
1209 | { -1, 1, 0, 1, 0, 1, 0, 1 }, | ||
1210 | { 0, 1, 0, 1, -1, 1, 0, 1 }, | ||
1211 | }; | ||
1212 | |||
1213 | switch (rotation) { | ||
1214 | case OMAP_DSS_ROT_0: | ||
1215 | idx = 0; | ||
1216 | break; | ||
1217 | case OMAP_DSS_ROT_90: | ||
1218 | idx = 1; | ||
1219 | break; | ||
1220 | case OMAP_DSS_ROT_180: | ||
1221 | idx = 2; | ||
1222 | break; | ||
1223 | case OMAP_DSS_ROT_270: | ||
1224 | idx = 3; | ||
1225 | break; | ||
1226 | default: | ||
1227 | BUG(); | ||
1228 | return; | ||
1229 | } | ||
1230 | |||
1231 | switch (color_mode) { | ||
1232 | case OMAP_DSS_COLOR_NV12: | ||
1233 | if (ilace) | ||
1234 | accu_table = accu_nv12_ilace; | ||
1235 | else | ||
1236 | accu_table = accu_nv12; | ||
1237 | break; | ||
1238 | case OMAP_DSS_COLOR_YUV2: | ||
1239 | case OMAP_DSS_COLOR_UYVY: | ||
1240 | accu_table = accu_yuv; | ||
1241 | break; | ||
1242 | default: | ||
1243 | BUG(); | ||
1244 | return; | ||
1245 | } | ||
1246 | |||
1247 | accu_val = &accu_table[idx]; | ||
1248 | |||
1249 | chroma_hinc = 1024 * orig_width / out_width; | ||
1250 | chroma_vinc = 1024 * orig_height / out_height; | ||
1251 | |||
1252 | h_accu2_0 = (accu_val->h0_m * chroma_hinc / accu_val->h0_n) % 1024; | ||
1253 | h_accu2_1 = (accu_val->h1_m * chroma_hinc / accu_val->h1_n) % 1024; | ||
1254 | v_accu2_0 = (accu_val->v0_m * chroma_vinc / accu_val->v0_n) % 1024; | ||
1255 | v_accu2_1 = (accu_val->v1_m * chroma_vinc / accu_val->v1_n) % 1024; | ||
1256 | |||
1257 | dispc_ovl_set_vid_accu2_0(plane, h_accu2_0, v_accu2_0); | ||
1258 | dispc_ovl_set_vid_accu2_1(plane, h_accu2_1, v_accu2_1); | ||
1259 | } | ||
1260 | |||
1188 | static void dispc_ovl_set_scaling_common(enum omap_plane plane, | 1261 | static void dispc_ovl_set_scaling_common(enum omap_plane plane, |
1189 | u16 orig_width, u16 orig_height, | 1262 | u16 orig_width, u16 orig_height, |
1190 | u16 out_width, u16 out_height, | 1263 | u16 out_width, u16 out_height, |
@@ -1258,6 +1331,10 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane plane, | |||
1258 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), 0, 8, 8); | 1331 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), 0, 8, 8); |
1259 | return; | 1332 | return; |
1260 | } | 1333 | } |
1334 | |||
1335 | dispc_ovl_set_accu_uv(plane, orig_width, orig_height, out_width, | ||
1336 | out_height, ilace, color_mode, rotation); | ||
1337 | |||
1261 | switch (color_mode) { | 1338 | switch (color_mode) { |
1262 | case OMAP_DSS_COLOR_NV12: | 1339 | case OMAP_DSS_COLOR_NV12: |
1263 | /* UV is subsampled by 2 vertically*/ | 1340 | /* UV is subsampled by 2 vertically*/ |
@@ -1280,6 +1357,7 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane plane, | |||
1280 | break; | 1357 | break; |
1281 | default: | 1358 | default: |
1282 | BUG(); | 1359 | BUG(); |
1360 | return; | ||
1283 | } | 1361 | } |
1284 | 1362 | ||
1285 | if (out_width != orig_width) | 1363 | if (out_width != orig_width) |
@@ -1297,9 +1375,6 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane plane, | |||
1297 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), scale_x ? 1 : 0, 5, 5); | 1375 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), scale_x ? 1 : 0, 5, 5); |
1298 | /* set V scaling */ | 1376 | /* set V scaling */ |
1299 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), scale_y ? 1 : 0, 6, 6); | 1377 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), scale_y ? 1 : 0, 6, 6); |
1300 | |||
1301 | dispc_ovl_set_vid_accu2_0(plane, 0x80, 0); | ||
1302 | dispc_ovl_set_vid_accu2_1(plane, 0x80, 0); | ||
1303 | } | 1378 | } |
1304 | 1379 | ||
1305 | static void dispc_ovl_set_scaling(enum omap_plane plane, | 1380 | static void dispc_ovl_set_scaling(enum omap_plane plane, |
@@ -1410,6 +1485,7 @@ static int color_mode_to_bpp(enum omap_color_mode color_mode) | |||
1410 | return 32; | 1485 | return 32; |
1411 | default: | 1486 | default: |
1412 | BUG(); | 1487 | BUG(); |
1488 | return 0; | ||
1413 | } | 1489 | } |
1414 | } | 1490 | } |
1415 | 1491 | ||
@@ -1423,6 +1499,7 @@ static s32 pixinc(int pixels, u8 ps) | |||
1423 | return 1 - (-pixels + 1) * ps; | 1499 | return 1 - (-pixels + 1) * ps; |
1424 | else | 1500 | else |
1425 | BUG(); | 1501 | BUG(); |
1502 | return 0; | ||
1426 | } | 1503 | } |
1427 | 1504 | ||
1428 | static void calc_vrfb_rotation_offset(u8 rotation, bool mirror, | 1505 | static void calc_vrfb_rotation_offset(u8 rotation, bool mirror, |
@@ -1431,7 +1508,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror, | |||
1431 | enum omap_color_mode color_mode, bool fieldmode, | 1508 | enum omap_color_mode color_mode, bool fieldmode, |
1432 | unsigned int field_offset, | 1509 | unsigned int field_offset, |
1433 | unsigned *offset0, unsigned *offset1, | 1510 | unsigned *offset0, unsigned *offset1, |
1434 | s32 *row_inc, s32 *pix_inc) | 1511 | s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim) |
1435 | { | 1512 | { |
1436 | u8 ps; | 1513 | u8 ps; |
1437 | 1514 | ||
@@ -1477,10 +1554,10 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror, | |||
1477 | else | 1554 | else |
1478 | *offset0 = 0; | 1555 | *offset0 = 0; |
1479 | 1556 | ||
1480 | *row_inc = pixinc(1 + (screen_width - width) + | 1557 | *row_inc = pixinc(1 + |
1481 | (fieldmode ? screen_width : 0), | 1558 | (y_predecim * screen_width - x_predecim * width) + |
1482 | ps); | 1559 | (fieldmode ? screen_width : 0), ps); |
1483 | *pix_inc = pixinc(1, ps); | 1560 | *pix_inc = pixinc(x_predecim, ps); |
1484 | break; | 1561 | break; |
1485 | 1562 | ||
1486 | case OMAP_DSS_ROT_0 + 4: | 1563 | case OMAP_DSS_ROT_0 + 4: |
@@ -1498,14 +1575,15 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror, | |||
1498 | *offset0 = field_offset * screen_width * ps; | 1575 | *offset0 = field_offset * screen_width * ps; |
1499 | else | 1576 | else |
1500 | *offset0 = 0; | 1577 | *offset0 = 0; |
1501 | *row_inc = pixinc(1 - (screen_width + width) - | 1578 | *row_inc = pixinc(1 - |
1502 | (fieldmode ? screen_width : 0), | 1579 | (y_predecim * screen_width + x_predecim * width) - |
1503 | ps); | 1580 | (fieldmode ? screen_width : 0), ps); |
1504 | *pix_inc = pixinc(1, ps); | 1581 | *pix_inc = pixinc(x_predecim, ps); |
1505 | break; | 1582 | break; |
1506 | 1583 | ||
1507 | default: | 1584 | default: |
1508 | BUG(); | 1585 | BUG(); |
1586 | return; | ||
1509 | } | 1587 | } |
1510 | } | 1588 | } |
1511 | 1589 | ||
@@ -1515,7 +1593,7 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, | |||
1515 | enum omap_color_mode color_mode, bool fieldmode, | 1593 | enum omap_color_mode color_mode, bool fieldmode, |
1516 | unsigned int field_offset, | 1594 | unsigned int field_offset, |
1517 | unsigned *offset0, unsigned *offset1, | 1595 | unsigned *offset0, unsigned *offset1, |
1518 | s32 *row_inc, s32 *pix_inc) | 1596 | s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim) |
1519 | { | 1597 | { |
1520 | u8 ps; | 1598 | u8 ps; |
1521 | u16 fbw, fbh; | 1599 | u16 fbw, fbh; |
@@ -1557,10 +1635,14 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, | |||
1557 | *offset0 = *offset1 + field_offset * screen_width * ps; | 1635 | *offset0 = *offset1 + field_offset * screen_width * ps; |
1558 | else | 1636 | else |
1559 | *offset0 = *offset1; | 1637 | *offset0 = *offset1; |
1560 | *row_inc = pixinc(1 + (screen_width - fbw) + | 1638 | *row_inc = pixinc(1 + |
1561 | (fieldmode ? screen_width : 0), | 1639 | (y_predecim * screen_width - fbw * x_predecim) + |
1562 | ps); | 1640 | (fieldmode ? screen_width : 0), ps); |
1563 | *pix_inc = pixinc(1, ps); | 1641 | if (color_mode == OMAP_DSS_COLOR_YUV2 || |
1642 | color_mode == OMAP_DSS_COLOR_UYVY) | ||
1643 | *pix_inc = pixinc(x_predecim, 2 * ps); | ||
1644 | else | ||
1645 | *pix_inc = pixinc(x_predecim, ps); | ||
1564 | break; | 1646 | break; |
1565 | case OMAP_DSS_ROT_90: | 1647 | case OMAP_DSS_ROT_90: |
1566 | *offset1 = screen_width * (fbh - 1) * ps; | 1648 | *offset1 = screen_width * (fbh - 1) * ps; |
@@ -1568,9 +1650,9 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, | |||
1568 | *offset0 = *offset1 + field_offset * ps; | 1650 | *offset0 = *offset1 + field_offset * ps; |
1569 | else | 1651 | else |
1570 | *offset0 = *offset1; | 1652 | *offset0 = *offset1; |
1571 | *row_inc = pixinc(screen_width * (fbh - 1) + 1 + | 1653 | *row_inc = pixinc(screen_width * (fbh * x_predecim - 1) + |
1572 | (fieldmode ? 1 : 0), ps); | 1654 | y_predecim + (fieldmode ? 1 : 0), ps); |
1573 | *pix_inc = pixinc(-screen_width, ps); | 1655 | *pix_inc = pixinc(-x_predecim * screen_width, ps); |
1574 | break; | 1656 | break; |
1575 | case OMAP_DSS_ROT_180: | 1657 | case OMAP_DSS_ROT_180: |
1576 | *offset1 = (screen_width * (fbh - 1) + fbw - 1) * ps; | 1658 | *offset1 = (screen_width * (fbh - 1) + fbw - 1) * ps; |
@@ -1579,10 +1661,13 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, | |||
1579 | else | 1661 | else |
1580 | *offset0 = *offset1; | 1662 | *offset0 = *offset1; |
1581 | *row_inc = pixinc(-1 - | 1663 | *row_inc = pixinc(-1 - |
1582 | (screen_width - fbw) - | 1664 | (y_predecim * screen_width - fbw * x_predecim) - |
1583 | (fieldmode ? screen_width : 0), | 1665 | (fieldmode ? screen_width : 0), ps); |
1584 | ps); | 1666 | if (color_mode == OMAP_DSS_COLOR_YUV2 || |
1585 | *pix_inc = pixinc(-1, ps); | 1667 | color_mode == OMAP_DSS_COLOR_UYVY) |
1668 | *pix_inc = pixinc(-x_predecim, 2 * ps); | ||
1669 | else | ||
1670 | *pix_inc = pixinc(-x_predecim, ps); | ||
1586 | break; | 1671 | break; |
1587 | case OMAP_DSS_ROT_270: | 1672 | case OMAP_DSS_ROT_270: |
1588 | *offset1 = (fbw - 1) * ps; | 1673 | *offset1 = (fbw - 1) * ps; |
@@ -1590,9 +1675,9 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, | |||
1590 | *offset0 = *offset1 - field_offset * ps; | 1675 | *offset0 = *offset1 - field_offset * ps; |
1591 | else | 1676 | else |
1592 | *offset0 = *offset1; | 1677 | *offset0 = *offset1; |
1593 | *row_inc = pixinc(-screen_width * (fbh - 1) - 1 - | 1678 | *row_inc = pixinc(-screen_width * (fbh * x_predecim - 1) - |
1594 | (fieldmode ? 1 : 0), ps); | 1679 | y_predecim - (fieldmode ? 1 : 0), ps); |
1595 | *pix_inc = pixinc(screen_width, ps); | 1680 | *pix_inc = pixinc(x_predecim * screen_width, ps); |
1596 | break; | 1681 | break; |
1597 | 1682 | ||
1598 | /* mirroring */ | 1683 | /* mirroring */ |
@@ -1602,10 +1687,14 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, | |||
1602 | *offset0 = *offset1 + field_offset * screen_width * ps; | 1687 | *offset0 = *offset1 + field_offset * screen_width * ps; |
1603 | else | 1688 | else |
1604 | *offset0 = *offset1; | 1689 | *offset0 = *offset1; |
1605 | *row_inc = pixinc(screen_width * 2 - 1 + | 1690 | *row_inc = pixinc(y_predecim * screen_width * 2 - 1 + |
1606 | (fieldmode ? screen_width : 0), | 1691 | (fieldmode ? screen_width : 0), |
1607 | ps); | 1692 | ps); |
1608 | *pix_inc = pixinc(-1, ps); | 1693 | if (color_mode == OMAP_DSS_COLOR_YUV2 || |
1694 | color_mode == OMAP_DSS_COLOR_UYVY) | ||
1695 | *pix_inc = pixinc(-x_predecim, 2 * ps); | ||
1696 | else | ||
1697 | *pix_inc = pixinc(-x_predecim, ps); | ||
1609 | break; | 1698 | break; |
1610 | 1699 | ||
1611 | case OMAP_DSS_ROT_90 + 4: | 1700 | case OMAP_DSS_ROT_90 + 4: |
@@ -1614,10 +1703,10 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, | |||
1614 | *offset0 = *offset1 + field_offset * ps; | 1703 | *offset0 = *offset1 + field_offset * ps; |
1615 | else | 1704 | else |
1616 | *offset0 = *offset1; | 1705 | *offset0 = *offset1; |
1617 | *row_inc = pixinc(-screen_width * (fbh - 1) + 1 + | 1706 | *row_inc = pixinc(-screen_width * (fbh * x_predecim - 1) + |
1618 | (fieldmode ? 1 : 0), | 1707 | y_predecim + (fieldmode ? 1 : 0), |
1619 | ps); | 1708 | ps); |
1620 | *pix_inc = pixinc(screen_width, ps); | 1709 | *pix_inc = pixinc(x_predecim * screen_width, ps); |
1621 | break; | 1710 | break; |
1622 | 1711 | ||
1623 | case OMAP_DSS_ROT_180 + 4: | 1712 | case OMAP_DSS_ROT_180 + 4: |
@@ -1626,10 +1715,14 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, | |||
1626 | *offset0 = *offset1 - field_offset * screen_width * ps; | 1715 | *offset0 = *offset1 - field_offset * screen_width * ps; |
1627 | else | 1716 | else |
1628 | *offset0 = *offset1; | 1717 | *offset0 = *offset1; |
1629 | *row_inc = pixinc(1 - screen_width * 2 - | 1718 | *row_inc = pixinc(1 - y_predecim * screen_width * 2 - |
1630 | (fieldmode ? screen_width : 0), | 1719 | (fieldmode ? screen_width : 0), |
1631 | ps); | 1720 | ps); |
1632 | *pix_inc = pixinc(1, ps); | 1721 | if (color_mode == OMAP_DSS_COLOR_YUV2 || |
1722 | color_mode == OMAP_DSS_COLOR_UYVY) | ||
1723 | *pix_inc = pixinc(x_predecim, 2 * ps); | ||
1724 | else | ||
1725 | *pix_inc = pixinc(x_predecim, ps); | ||
1633 | break; | 1726 | break; |
1634 | 1727 | ||
1635 | case OMAP_DSS_ROT_270 + 4: | 1728 | case OMAP_DSS_ROT_270 + 4: |
@@ -1638,34 +1731,130 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, | |||
1638 | *offset0 = *offset1 - field_offset * ps; | 1731 | *offset0 = *offset1 - field_offset * ps; |
1639 | else | 1732 | else |
1640 | *offset0 = *offset1; | 1733 | *offset0 = *offset1; |
1641 | *row_inc = pixinc(screen_width * (fbh - 1) - 1 - | 1734 | *row_inc = pixinc(screen_width * (fbh * x_predecim - 1) - |
1642 | (fieldmode ? 1 : 0), | 1735 | y_predecim - (fieldmode ? 1 : 0), |
1643 | ps); | 1736 | ps); |
1644 | *pix_inc = pixinc(-screen_width, ps); | 1737 | *pix_inc = pixinc(-x_predecim * screen_width, ps); |
1645 | break; | 1738 | break; |
1646 | 1739 | ||
1647 | default: | 1740 | default: |
1648 | BUG(); | 1741 | BUG(); |
1742 | return; | ||
1743 | } | ||
1744 | } | ||
1745 | |||
1746 | static void calc_tiler_rotation_offset(u16 screen_width, u16 width, | ||
1747 | enum omap_color_mode color_mode, bool fieldmode, | ||
1748 | unsigned int field_offset, unsigned *offset0, unsigned *offset1, | ||
1749 | s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim) | ||
1750 | { | ||
1751 | u8 ps; | ||
1752 | |||
1753 | switch (color_mode) { | ||
1754 | case OMAP_DSS_COLOR_CLUT1: | ||
1755 | case OMAP_DSS_COLOR_CLUT2: | ||
1756 | case OMAP_DSS_COLOR_CLUT4: | ||
1757 | case OMAP_DSS_COLOR_CLUT8: | ||
1758 | BUG(); | ||
1759 | return; | ||
1760 | default: | ||
1761 | ps = color_mode_to_bpp(color_mode) / 8; | ||
1762 | break; | ||
1649 | } | 1763 | } |
1764 | |||
1765 | DSSDBG("scrw %d, width %d\n", screen_width, width); | ||
1766 | |||
1767 | /* | ||
1768 | * field 0 = even field = bottom field | ||
1769 | * field 1 = odd field = top field | ||
1770 | */ | ||
1771 | *offset1 = 0; | ||
1772 | if (field_offset) | ||
1773 | *offset0 = *offset1 + field_offset * screen_width * ps; | ||
1774 | else | ||
1775 | *offset0 = *offset1; | ||
1776 | *row_inc = pixinc(1 + (y_predecim * screen_width - width * x_predecim) + | ||
1777 | (fieldmode ? screen_width : 0), ps); | ||
1778 | if (color_mode == OMAP_DSS_COLOR_YUV2 || | ||
1779 | color_mode == OMAP_DSS_COLOR_UYVY) | ||
1780 | *pix_inc = pixinc(x_predecim, 2 * ps); | ||
1781 | else | ||
1782 | *pix_inc = pixinc(x_predecim, ps); | ||
1650 | } | 1783 | } |
1651 | 1784 | ||
1652 | static unsigned long calc_fclk_five_taps(enum omap_channel channel, u16 width, | 1785 | /* |
1786 | * This function is used to avoid synclosts in OMAP3, because of some | ||
1787 | * undocumented horizontal position and timing related limitations. | ||
1788 | */ | ||
1789 | static int check_horiz_timing_omap3(enum omap_channel channel, | ||
1790 | const struct omap_video_timings *t, u16 pos_x, | ||
1791 | u16 width, u16 height, u16 out_width, u16 out_height) | ||
1792 | { | ||
1793 | int DS = DIV_ROUND_UP(height, out_height); | ||
1794 | unsigned long nonactive, lclk, pclk; | ||
1795 | static const u8 limits[3] = { 8, 10, 20 }; | ||
1796 | u64 val, blank; | ||
1797 | int i; | ||
1798 | |||
1799 | nonactive = t->x_res + t->hfp + t->hsw + t->hbp - out_width; | ||
1800 | pclk = dispc_mgr_pclk_rate(channel); | ||
1801 | if (dispc_mgr_is_lcd(channel)) | ||
1802 | lclk = dispc_mgr_lclk_rate(channel); | ||
1803 | else | ||
1804 | lclk = dispc_fclk_rate(); | ||
1805 | |||
1806 | i = 0; | ||
1807 | if (out_height < height) | ||
1808 | i++; | ||
1809 | if (out_width < width) | ||
1810 | i++; | ||
1811 | blank = div_u64((u64)(t->hbp + t->hsw + t->hfp) * lclk, pclk); | ||
1812 | DSSDBG("blanking period + ppl = %llu (limit = %u)\n", blank, limits[i]); | ||
1813 | if (blank <= limits[i]) | ||
1814 | return -EINVAL; | ||
1815 | |||
1816 | /* | ||
1817 | * Pixel data should be prepared before visible display point starts. | ||
1818 | * So, atleast DS-2 lines must have already been fetched by DISPC | ||
1819 | * during nonactive - pos_x period. | ||
1820 | */ | ||
1821 | val = div_u64((u64)(nonactive - pos_x) * lclk, pclk); | ||
1822 | DSSDBG("(nonactive - pos_x) * pcd = %llu max(0, DS - 2) * width = %d\n", | ||
1823 | val, max(0, DS - 2) * width); | ||
1824 | if (val < max(0, DS - 2) * width) | ||
1825 | return -EINVAL; | ||
1826 | |||
1827 | /* | ||
1828 | * All lines need to be refilled during the nonactive period of which | ||
1829 | * only one line can be loaded during the active period. So, atleast | ||
1830 | * DS - 1 lines should be loaded during nonactive period. | ||
1831 | */ | ||
1832 | val = div_u64((u64)nonactive * lclk, pclk); | ||
1833 | DSSDBG("nonactive * pcd = %llu, max(0, DS - 1) * width = %d\n", | ||
1834 | val, max(0, DS - 1) * width); | ||
1835 | if (val < max(0, DS - 1) * width) | ||
1836 | return -EINVAL; | ||
1837 | |||
1838 | return 0; | ||
1839 | } | ||
1840 | |||
1841 | static unsigned long calc_core_clk_five_taps(enum omap_channel channel, | ||
1842 | const struct omap_video_timings *mgr_timings, u16 width, | ||
1653 | u16 height, u16 out_width, u16 out_height, | 1843 | u16 height, u16 out_width, u16 out_height, |
1654 | enum omap_color_mode color_mode) | 1844 | enum omap_color_mode color_mode) |
1655 | { | 1845 | { |
1656 | u32 fclk = 0; | 1846 | u32 core_clk = 0; |
1657 | u64 tmp, pclk = dispc_mgr_pclk_rate(channel); | 1847 | u64 tmp, pclk = dispc_mgr_pclk_rate(channel); |
1658 | 1848 | ||
1659 | if (height <= out_height && width <= out_width) | 1849 | if (height <= out_height && width <= out_width) |
1660 | return (unsigned long) pclk; | 1850 | return (unsigned long) pclk; |
1661 | 1851 | ||
1662 | if (height > out_height) { | 1852 | if (height > out_height) { |
1663 | struct omap_dss_device *dssdev = dispc_mgr_get_device(channel); | 1853 | unsigned int ppl = mgr_timings->x_res; |
1664 | unsigned int ppl = dssdev->panel.timings.x_res; | ||
1665 | 1854 | ||
1666 | tmp = pclk * height * out_width; | 1855 | tmp = pclk * height * out_width; |
1667 | do_div(tmp, 2 * out_height * ppl); | 1856 | do_div(tmp, 2 * out_height * ppl); |
1668 | fclk = tmp; | 1857 | core_clk = tmp; |
1669 | 1858 | ||
1670 | if (height > 2 * out_height) { | 1859 | if (height > 2 * out_height) { |
1671 | if (ppl == out_width) | 1860 | if (ppl == out_width) |
@@ -1673,23 +1862,23 @@ static unsigned long calc_fclk_five_taps(enum omap_channel channel, u16 width, | |||
1673 | 1862 | ||
1674 | tmp = pclk * (height - 2 * out_height) * out_width; | 1863 | tmp = pclk * (height - 2 * out_height) * out_width; |
1675 | do_div(tmp, 2 * out_height * (ppl - out_width)); | 1864 | do_div(tmp, 2 * out_height * (ppl - out_width)); |
1676 | fclk = max(fclk, (u32) tmp); | 1865 | core_clk = max_t(u32, core_clk, tmp); |
1677 | } | 1866 | } |
1678 | } | 1867 | } |
1679 | 1868 | ||
1680 | if (width > out_width) { | 1869 | if (width > out_width) { |
1681 | tmp = pclk * width; | 1870 | tmp = pclk * width; |
1682 | do_div(tmp, out_width); | 1871 | do_div(tmp, out_width); |
1683 | fclk = max(fclk, (u32) tmp); | 1872 | core_clk = max_t(u32, core_clk, tmp); |
1684 | 1873 | ||
1685 | if (color_mode == OMAP_DSS_COLOR_RGB24U) | 1874 | if (color_mode == OMAP_DSS_COLOR_RGB24U) |
1686 | fclk <<= 1; | 1875 | core_clk <<= 1; |
1687 | } | 1876 | } |
1688 | 1877 | ||
1689 | return fclk; | 1878 | return core_clk; |
1690 | } | 1879 | } |
1691 | 1880 | ||
1692 | static unsigned long calc_fclk(enum omap_channel channel, u16 width, | 1881 | static unsigned long calc_core_clk(enum omap_channel channel, u16 width, |
1693 | u16 height, u16 out_width, u16 out_height) | 1882 | u16 height, u16 out_width, u16 out_height) |
1694 | { | 1883 | { |
1695 | unsigned int hf, vf; | 1884 | unsigned int hf, vf; |
@@ -1730,15 +1919,20 @@ static unsigned long calc_fclk(enum omap_channel channel, u16 width, | |||
1730 | } | 1919 | } |
1731 | 1920 | ||
1732 | static int dispc_ovl_calc_scaling(enum omap_plane plane, | 1921 | static int dispc_ovl_calc_scaling(enum omap_plane plane, |
1733 | enum omap_channel channel, u16 width, u16 height, | 1922 | enum omap_channel channel, |
1734 | u16 out_width, u16 out_height, | 1923 | const struct omap_video_timings *mgr_timings, |
1735 | enum omap_color_mode color_mode, bool *five_taps) | 1924 | u16 width, u16 height, u16 out_width, u16 out_height, |
1925 | enum omap_color_mode color_mode, bool *five_taps, | ||
1926 | int *x_predecim, int *y_predecim, u16 pos_x) | ||
1736 | { | 1927 | { |
1737 | struct omap_overlay *ovl = omap_dss_get_overlay(plane); | 1928 | struct omap_overlay *ovl = omap_dss_get_overlay(plane); |
1738 | const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); | 1929 | const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); |
1739 | const int maxsinglelinewidth = | 1930 | const int maxsinglelinewidth = |
1740 | dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH); | 1931 | dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH); |
1741 | unsigned long fclk = 0; | 1932 | const int max_decim_limit = 16; |
1933 | unsigned long core_clk = 0; | ||
1934 | int decim_x, decim_y, error, min_factor; | ||
1935 | u16 in_width, in_height, in_width_max = 0; | ||
1742 | 1936 | ||
1743 | if (width == out_width && height == out_height) | 1937 | if (width == out_width && height == out_height) |
1744 | return 0; | 1938 | return 0; |
@@ -1746,64 +1940,154 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane, | |||
1746 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) | 1940 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) |
1747 | return -EINVAL; | 1941 | return -EINVAL; |
1748 | 1942 | ||
1749 | if (out_width < width / maxdownscale || | 1943 | *x_predecim = max_decim_limit; |
1750 | out_width > width * 8) | 1944 | *y_predecim = max_decim_limit; |
1945 | |||
1946 | if (color_mode == OMAP_DSS_COLOR_CLUT1 || | ||
1947 | color_mode == OMAP_DSS_COLOR_CLUT2 || | ||
1948 | color_mode == OMAP_DSS_COLOR_CLUT4 || | ||
1949 | color_mode == OMAP_DSS_COLOR_CLUT8) { | ||
1950 | *x_predecim = 1; | ||
1951 | *y_predecim = 1; | ||
1952 | *five_taps = false; | ||
1953 | return 0; | ||
1954 | } | ||
1955 | |||
1956 | decim_x = DIV_ROUND_UP(DIV_ROUND_UP(width, out_width), maxdownscale); | ||
1957 | decim_y = DIV_ROUND_UP(DIV_ROUND_UP(height, out_height), maxdownscale); | ||
1958 | |||
1959 | min_factor = min(decim_x, decim_y); | ||
1960 | |||
1961 | if (decim_x > *x_predecim || out_width > width * 8) | ||
1751 | return -EINVAL; | 1962 | return -EINVAL; |
1752 | 1963 | ||
1753 | if (out_height < height / maxdownscale || | 1964 | if (decim_y > *y_predecim || out_height > height * 8) |
1754 | out_height > height * 8) | ||
1755 | return -EINVAL; | 1965 | return -EINVAL; |
1756 | 1966 | ||
1757 | if (cpu_is_omap24xx()) { | 1967 | if (cpu_is_omap24xx()) { |
1758 | if (width > maxsinglelinewidth) | ||
1759 | DSSERR("Cannot scale max input width exceeded"); | ||
1760 | *five_taps = false; | 1968 | *five_taps = false; |
1761 | fclk = calc_fclk(channel, width, height, out_width, | 1969 | |
1762 | out_height); | 1970 | do { |
1971 | in_height = DIV_ROUND_UP(height, decim_y); | ||
1972 | in_width = DIV_ROUND_UP(width, decim_x); | ||
1973 | core_clk = calc_core_clk(channel, in_width, in_height, | ||
1974 | out_width, out_height); | ||
1975 | error = (in_width > maxsinglelinewidth || !core_clk || | ||
1976 | core_clk > dispc_core_clk_rate()); | ||
1977 | if (error) { | ||
1978 | if (decim_x == decim_y) { | ||
1979 | decim_x = min_factor; | ||
1980 | decim_y++; | ||
1981 | } else { | ||
1982 | swap(decim_x, decim_y); | ||
1983 | if (decim_x < decim_y) | ||
1984 | decim_x++; | ||
1985 | } | ||
1986 | } | ||
1987 | } while (decim_x <= *x_predecim && decim_y <= *y_predecim && | ||
1988 | error); | ||
1989 | |||
1990 | if (in_width > maxsinglelinewidth) { | ||
1991 | DSSERR("Cannot scale max input width exceeded"); | ||
1992 | return -EINVAL; | ||
1993 | } | ||
1763 | } else if (cpu_is_omap34xx()) { | 1994 | } else if (cpu_is_omap34xx()) { |
1764 | if (width > (maxsinglelinewidth * 2)) { | 1995 | |
1996 | do { | ||
1997 | in_height = DIV_ROUND_UP(height, decim_y); | ||
1998 | in_width = DIV_ROUND_UP(width, decim_x); | ||
1999 | core_clk = calc_core_clk_five_taps(channel, mgr_timings, | ||
2000 | in_width, in_height, out_width, out_height, | ||
2001 | color_mode); | ||
2002 | |||
2003 | error = check_horiz_timing_omap3(channel, mgr_timings, | ||
2004 | pos_x, in_width, in_height, out_width, | ||
2005 | out_height); | ||
2006 | |||
2007 | if (in_width > maxsinglelinewidth) | ||
2008 | if (in_height > out_height && | ||
2009 | in_height < out_height * 2) | ||
2010 | *five_taps = false; | ||
2011 | if (!*five_taps) | ||
2012 | core_clk = calc_core_clk(channel, in_width, | ||
2013 | in_height, out_width, out_height); | ||
2014 | error = (error || in_width > maxsinglelinewidth * 2 || | ||
2015 | (in_width > maxsinglelinewidth && *five_taps) || | ||
2016 | !core_clk || core_clk > dispc_core_clk_rate()); | ||
2017 | if (error) { | ||
2018 | if (decim_x == decim_y) { | ||
2019 | decim_x = min_factor; | ||
2020 | decim_y++; | ||
2021 | } else { | ||
2022 | swap(decim_x, decim_y); | ||
2023 | if (decim_x < decim_y) | ||
2024 | decim_x++; | ||
2025 | } | ||
2026 | } | ||
2027 | } while (decim_x <= *x_predecim && decim_y <= *y_predecim | ||
2028 | && error); | ||
2029 | |||
2030 | if (check_horiz_timing_omap3(channel, mgr_timings, pos_x, width, | ||
2031 | height, out_width, out_height)){ | ||
2032 | DSSERR("horizontal timing too tight\n"); | ||
2033 | return -EINVAL; | ||
2034 | } | ||
2035 | |||
2036 | if (in_width > (maxsinglelinewidth * 2)) { | ||
1765 | DSSERR("Cannot setup scaling"); | 2037 | DSSERR("Cannot setup scaling"); |
1766 | DSSERR("width exceeds maximum width possible"); | 2038 | DSSERR("width exceeds maximum width possible"); |
1767 | return -EINVAL; | 2039 | return -EINVAL; |
1768 | } | 2040 | } |
1769 | fclk = calc_fclk_five_taps(channel, width, height, out_width, | 2041 | |
1770 | out_height, color_mode); | 2042 | if (in_width > maxsinglelinewidth && *five_taps) { |
1771 | if (width > maxsinglelinewidth) { | 2043 | DSSERR("cannot setup scaling with five taps"); |
1772 | if (height > out_height && height < out_height * 2) | 2044 | return -EINVAL; |
1773 | *five_taps = false; | ||
1774 | else { | ||
1775 | DSSERR("cannot setup scaling with five taps"); | ||
1776 | return -EINVAL; | ||
1777 | } | ||
1778 | } | 2045 | } |
1779 | if (!*five_taps) | ||
1780 | fclk = calc_fclk(channel, width, height, out_width, | ||
1781 | out_height); | ||
1782 | } else { | 2046 | } else { |
1783 | if (width > maxsinglelinewidth) { | 2047 | int decim_x_min = decim_x; |
2048 | in_height = DIV_ROUND_UP(height, decim_y); | ||
2049 | in_width_max = dispc_core_clk_rate() / | ||
2050 | DIV_ROUND_UP(dispc_mgr_pclk_rate(channel), | ||
2051 | out_width); | ||
2052 | decim_x = DIV_ROUND_UP(width, in_width_max); | ||
2053 | |||
2054 | decim_x = decim_x > decim_x_min ? decim_x : decim_x_min; | ||
2055 | if (decim_x > *x_predecim) | ||
2056 | return -EINVAL; | ||
2057 | |||
2058 | do { | ||
2059 | in_width = DIV_ROUND_UP(width, decim_x); | ||
2060 | } while (decim_x <= *x_predecim && | ||
2061 | in_width > maxsinglelinewidth && decim_x++); | ||
2062 | |||
2063 | if (in_width > maxsinglelinewidth) { | ||
1784 | DSSERR("Cannot scale width exceeds max line width"); | 2064 | DSSERR("Cannot scale width exceeds max line width"); |
1785 | return -EINVAL; | 2065 | return -EINVAL; |
1786 | } | 2066 | } |
1787 | fclk = calc_fclk(channel, width, height, out_width, | 2067 | |
1788 | out_height); | 2068 | core_clk = calc_core_clk(channel, in_width, in_height, |
2069 | out_width, out_height); | ||
1789 | } | 2070 | } |
1790 | 2071 | ||
1791 | DSSDBG("required fclk rate = %lu Hz\n", fclk); | 2072 | DSSDBG("required core clk rate = %lu Hz\n", core_clk); |
1792 | DSSDBG("current fclk rate = %lu Hz\n", dispc_fclk_rate()); | 2073 | DSSDBG("current core clk rate = %lu Hz\n", dispc_core_clk_rate()); |
1793 | 2074 | ||
1794 | if (!fclk || fclk > dispc_fclk_rate()) { | 2075 | if (!core_clk || core_clk > dispc_core_clk_rate()) { |
1795 | DSSERR("failed to set up scaling, " | 2076 | DSSERR("failed to set up scaling, " |
1796 | "required fclk rate = %lu Hz, " | 2077 | "required core clk rate = %lu Hz, " |
1797 | "current fclk rate = %lu Hz\n", | 2078 | "current core clk rate = %lu Hz\n", |
1798 | fclk, dispc_fclk_rate()); | 2079 | core_clk, dispc_core_clk_rate()); |
1799 | return -EINVAL; | 2080 | return -EINVAL; |
1800 | } | 2081 | } |
1801 | 2082 | ||
2083 | *x_predecim = decim_x; | ||
2084 | *y_predecim = decim_y; | ||
1802 | return 0; | 2085 | return 0; |
1803 | } | 2086 | } |
1804 | 2087 | ||
1805 | int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, | 2088 | int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, |
1806 | bool ilace, bool replication) | 2089 | bool ilace, bool replication, |
2090 | const struct omap_video_timings *mgr_timings) | ||
1807 | { | 2091 | { |
1808 | struct omap_overlay *ovl = omap_dss_get_overlay(plane); | 2092 | struct omap_overlay *ovl = omap_dss_get_overlay(plane); |
1809 | bool five_taps = true; | 2093 | bool five_taps = true; |
@@ -1814,8 +2098,11 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, | |||
1814 | s32 pix_inc; | 2098 | s32 pix_inc; |
1815 | u16 frame_height = oi->height; | 2099 | u16 frame_height = oi->height; |
1816 | unsigned int field_offset = 0; | 2100 | unsigned int field_offset = 0; |
1817 | u16 outw, outh; | 2101 | u16 in_height = oi->height; |
2102 | u16 in_width = oi->width; | ||
2103 | u16 out_width, out_height; | ||
1818 | enum omap_channel channel; | 2104 | enum omap_channel channel; |
2105 | int x_predecim = 1, y_predecim = 1; | ||
1819 | 2106 | ||
1820 | channel = dispc_ovl_get_channel_out(plane); | 2107 | channel = dispc_ovl_get_channel_out(plane); |
1821 | 2108 | ||
@@ -1829,32 +2116,35 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, | |||
1829 | if (oi->paddr == 0) | 2116 | if (oi->paddr == 0) |
1830 | return -EINVAL; | 2117 | return -EINVAL; |
1831 | 2118 | ||
1832 | outw = oi->out_width == 0 ? oi->width : oi->out_width; | 2119 | out_width = oi->out_width == 0 ? oi->width : oi->out_width; |
1833 | outh = oi->out_height == 0 ? oi->height : oi->out_height; | 2120 | out_height = oi->out_height == 0 ? oi->height : oi->out_height; |
1834 | 2121 | ||
1835 | if (ilace && oi->height == outh) | 2122 | if (ilace && oi->height == out_height) |
1836 | fieldmode = 1; | 2123 | fieldmode = 1; |
1837 | 2124 | ||
1838 | if (ilace) { | 2125 | if (ilace) { |
1839 | if (fieldmode) | 2126 | if (fieldmode) |
1840 | oi->height /= 2; | 2127 | in_height /= 2; |
1841 | oi->pos_y /= 2; | 2128 | oi->pos_y /= 2; |
1842 | outh /= 2; | 2129 | out_height /= 2; |
1843 | 2130 | ||
1844 | DSSDBG("adjusting for ilace: height %d, pos_y %d, " | 2131 | DSSDBG("adjusting for ilace: height %d, pos_y %d, " |
1845 | "out_height %d\n", | 2132 | "out_height %d\n", |
1846 | oi->height, oi->pos_y, outh); | 2133 | in_height, oi->pos_y, out_height); |
1847 | } | 2134 | } |
1848 | 2135 | ||
1849 | if (!dss_feat_color_mode_supported(plane, oi->color_mode)) | 2136 | if (!dss_feat_color_mode_supported(plane, oi->color_mode)) |
1850 | return -EINVAL; | 2137 | return -EINVAL; |
1851 | 2138 | ||
1852 | r = dispc_ovl_calc_scaling(plane, channel, oi->width, oi->height, | 2139 | r = dispc_ovl_calc_scaling(plane, channel, mgr_timings, in_width, |
1853 | outw, outh, oi->color_mode, | 2140 | in_height, out_width, out_height, oi->color_mode, |
1854 | &five_taps); | 2141 | &five_taps, &x_predecim, &y_predecim, oi->pos_x); |
1855 | if (r) | 2142 | if (r) |
1856 | return r; | 2143 | return r; |
1857 | 2144 | ||
2145 | in_width = DIV_ROUND_UP(in_width, x_predecim); | ||
2146 | in_height = DIV_ROUND_UP(in_height, y_predecim); | ||
2147 | |||
1858 | if (oi->color_mode == OMAP_DSS_COLOR_YUV2 || | 2148 | if (oi->color_mode == OMAP_DSS_COLOR_YUV2 || |
1859 | oi->color_mode == OMAP_DSS_COLOR_UYVY || | 2149 | oi->color_mode == OMAP_DSS_COLOR_UYVY || |
1860 | oi->color_mode == OMAP_DSS_COLOR_NV12) | 2150 | oi->color_mode == OMAP_DSS_COLOR_NV12) |
@@ -1868,32 +2158,46 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, | |||
1868 | * so the integer part must be added to the base address of the | 2158 | * so the integer part must be added to the base address of the |
1869 | * bottom field. | 2159 | * bottom field. |
1870 | */ | 2160 | */ |
1871 | if (!oi->height || oi->height == outh) | 2161 | if (!in_height || in_height == out_height) |
1872 | field_offset = 0; | 2162 | field_offset = 0; |
1873 | else | 2163 | else |
1874 | field_offset = oi->height / outh / 2; | 2164 | field_offset = in_height / out_height / 2; |
1875 | } | 2165 | } |
1876 | 2166 | ||
1877 | /* Fields are independent but interleaved in memory. */ | 2167 | /* Fields are independent but interleaved in memory. */ |
1878 | if (fieldmode) | 2168 | if (fieldmode) |
1879 | field_offset = 1; | 2169 | field_offset = 1; |
1880 | 2170 | ||
1881 | if (oi->rotation_type == OMAP_DSS_ROT_DMA) | 2171 | offset0 = 0; |
2172 | offset1 = 0; | ||
2173 | row_inc = 0; | ||
2174 | pix_inc = 0; | ||
2175 | |||
2176 | if (oi->rotation_type == OMAP_DSS_ROT_TILER) | ||
2177 | calc_tiler_rotation_offset(oi->screen_width, in_width, | ||
2178 | oi->color_mode, fieldmode, field_offset, | ||
2179 | &offset0, &offset1, &row_inc, &pix_inc, | ||
2180 | x_predecim, y_predecim); | ||
2181 | else if (oi->rotation_type == OMAP_DSS_ROT_DMA) | ||
1882 | calc_dma_rotation_offset(oi->rotation, oi->mirror, | 2182 | calc_dma_rotation_offset(oi->rotation, oi->mirror, |
1883 | oi->screen_width, oi->width, frame_height, | 2183 | oi->screen_width, in_width, frame_height, |
1884 | oi->color_mode, fieldmode, field_offset, | 2184 | oi->color_mode, fieldmode, field_offset, |
1885 | &offset0, &offset1, &row_inc, &pix_inc); | 2185 | &offset0, &offset1, &row_inc, &pix_inc, |
2186 | x_predecim, y_predecim); | ||
1886 | else | 2187 | else |
1887 | calc_vrfb_rotation_offset(oi->rotation, oi->mirror, | 2188 | calc_vrfb_rotation_offset(oi->rotation, oi->mirror, |
1888 | oi->screen_width, oi->width, frame_height, | 2189 | oi->screen_width, in_width, frame_height, |
1889 | oi->color_mode, fieldmode, field_offset, | 2190 | oi->color_mode, fieldmode, field_offset, |
1890 | &offset0, &offset1, &row_inc, &pix_inc); | 2191 | &offset0, &offset1, &row_inc, &pix_inc, |
2192 | x_predecim, y_predecim); | ||
1891 | 2193 | ||
1892 | DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n", | 2194 | DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n", |
1893 | offset0, offset1, row_inc, pix_inc); | 2195 | offset0, offset1, row_inc, pix_inc); |
1894 | 2196 | ||
1895 | dispc_ovl_set_color_mode(plane, oi->color_mode); | 2197 | dispc_ovl_set_color_mode(plane, oi->color_mode); |
1896 | 2198 | ||
2199 | dispc_ovl_configure_burst_type(plane, oi->rotation_type); | ||
2200 | |||
1897 | dispc_ovl_set_ba0(plane, oi->paddr + offset0); | 2201 | dispc_ovl_set_ba0(plane, oi->paddr + offset0); |
1898 | dispc_ovl_set_ba1(plane, oi->paddr + offset1); | 2202 | dispc_ovl_set_ba1(plane, oi->paddr + offset1); |
1899 | 2203 | ||
@@ -1906,19 +2210,18 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, | |||
1906 | dispc_ovl_set_row_inc(plane, row_inc); | 2210 | dispc_ovl_set_row_inc(plane, row_inc); |
1907 | dispc_ovl_set_pix_inc(plane, pix_inc); | 2211 | dispc_ovl_set_pix_inc(plane, pix_inc); |
1908 | 2212 | ||
1909 | DSSDBG("%d,%d %dx%d -> %dx%d\n", oi->pos_x, oi->pos_y, oi->width, | 2213 | DSSDBG("%d,%d %dx%d -> %dx%d\n", oi->pos_x, oi->pos_y, in_width, |
1910 | oi->height, outw, outh); | 2214 | in_height, out_width, out_height); |
1911 | 2215 | ||
1912 | dispc_ovl_set_pos(plane, oi->pos_x, oi->pos_y); | 2216 | dispc_ovl_set_pos(plane, oi->pos_x, oi->pos_y); |
1913 | 2217 | ||
1914 | dispc_ovl_set_pic_size(plane, oi->width, oi->height); | 2218 | dispc_ovl_set_pic_size(plane, in_width, in_height); |
1915 | 2219 | ||
1916 | if (ovl->caps & OMAP_DSS_OVL_CAP_SCALE) { | 2220 | if (ovl->caps & OMAP_DSS_OVL_CAP_SCALE) { |
1917 | dispc_ovl_set_scaling(plane, oi->width, oi->height, | 2221 | dispc_ovl_set_scaling(plane, in_width, in_height, out_width, |
1918 | outw, outh, | 2222 | out_height, ilace, five_taps, fieldmode, |
1919 | ilace, five_taps, fieldmode, | ||
1920 | oi->color_mode, oi->rotation); | 2223 | oi->color_mode, oi->rotation); |
1921 | dispc_ovl_set_vid_size(plane, outw, outh); | 2224 | dispc_ovl_set_vid_size(plane, out_width, out_height); |
1922 | dispc_ovl_set_vid_color_conv(plane, cconv); | 2225 | dispc_ovl_set_vid_color_conv(plane, cconv); |
1923 | } | 2226 | } |
1924 | 2227 | ||
@@ -2087,8 +2390,10 @@ bool dispc_mgr_is_enabled(enum omap_channel channel) | |||
2087 | return !!REG_GET(DISPC_CONTROL, 1, 1); | 2390 | return !!REG_GET(DISPC_CONTROL, 1, 1); |
2088 | else if (channel == OMAP_DSS_CHANNEL_LCD2) | 2391 | else if (channel == OMAP_DSS_CHANNEL_LCD2) |
2089 | return !!REG_GET(DISPC_CONTROL2, 0, 0); | 2392 | return !!REG_GET(DISPC_CONTROL2, 0, 0); |
2090 | else | 2393 | else { |
2091 | BUG(); | 2394 | BUG(); |
2395 | return false; | ||
2396 | } | ||
2092 | } | 2397 | } |
2093 | 2398 | ||
2094 | void dispc_mgr_enable(enum omap_channel channel, bool enable) | 2399 | void dispc_mgr_enable(enum omap_channel channel, bool enable) |
@@ -2285,6 +2590,12 @@ void dispc_mgr_enable_stallmode(enum omap_channel channel, bool enable) | |||
2285 | REG_FLD_MOD(DISPC_CONTROL, enable, 11, 11); | 2590 | REG_FLD_MOD(DISPC_CONTROL, enable, 11, 11); |
2286 | } | 2591 | } |
2287 | 2592 | ||
2593 | static bool _dispc_mgr_size_ok(u16 width, u16 height) | ||
2594 | { | ||
2595 | return width <= dss_feat_get_param_max(FEAT_PARAM_MGR_WIDTH) && | ||
2596 | height <= dss_feat_get_param_max(FEAT_PARAM_MGR_HEIGHT); | ||
2597 | } | ||
2598 | |||
2288 | static bool _dispc_lcd_timings_ok(int hsw, int hfp, int hbp, | 2599 | static bool _dispc_lcd_timings_ok(int hsw, int hfp, int hbp, |
2289 | int vsw, int vfp, int vbp) | 2600 | int vsw, int vfp, int vbp) |
2290 | { | 2601 | { |
@@ -2309,11 +2620,20 @@ static bool _dispc_lcd_timings_ok(int hsw, int hfp, int hbp, | |||
2309 | return true; | 2620 | return true; |
2310 | } | 2621 | } |
2311 | 2622 | ||
2312 | bool dispc_lcd_timings_ok(struct omap_video_timings *timings) | 2623 | bool dispc_mgr_timings_ok(enum omap_channel channel, |
2624 | const struct omap_video_timings *timings) | ||
2313 | { | 2625 | { |
2314 | return _dispc_lcd_timings_ok(timings->hsw, timings->hfp, | 2626 | bool timings_ok; |
2315 | timings->hbp, timings->vsw, | 2627 | |
2316 | timings->vfp, timings->vbp); | 2628 | timings_ok = _dispc_mgr_size_ok(timings->x_res, timings->y_res); |
2629 | |||
2630 | if (dispc_mgr_is_lcd(channel)) | ||
2631 | timings_ok = timings_ok && _dispc_lcd_timings_ok(timings->hsw, | ||
2632 | timings->hfp, timings->hbp, | ||
2633 | timings->vsw, timings->vfp, | ||
2634 | timings->vbp); | ||
2635 | |||
2636 | return timings_ok; | ||
2317 | } | 2637 | } |
2318 | 2638 | ||
2319 | static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw, | 2639 | static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw, |
@@ -2340,37 +2660,45 @@ static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw, | |||
2340 | } | 2660 | } |
2341 | 2661 | ||
2342 | /* change name to mode? */ | 2662 | /* change name to mode? */ |
2343 | void dispc_mgr_set_lcd_timings(enum omap_channel channel, | 2663 | void dispc_mgr_set_timings(enum omap_channel channel, |
2344 | struct omap_video_timings *timings) | 2664 | struct omap_video_timings *timings) |
2345 | { | 2665 | { |
2346 | unsigned xtot, ytot; | 2666 | unsigned xtot, ytot; |
2347 | unsigned long ht, vt; | 2667 | unsigned long ht, vt; |
2668 | struct omap_video_timings t = *timings; | ||
2669 | |||
2670 | DSSDBG("channel %d xres %u yres %u\n", channel, t.x_res, t.y_res); | ||
2348 | 2671 | ||
2349 | if (!_dispc_lcd_timings_ok(timings->hsw, timings->hfp, | 2672 | if (!dispc_mgr_timings_ok(channel, &t)) { |
2350 | timings->hbp, timings->vsw, | ||
2351 | timings->vfp, timings->vbp)) | ||
2352 | BUG(); | 2673 | BUG(); |
2674 | return; | ||
2675 | } | ||
2676 | |||
2677 | if (dispc_mgr_is_lcd(channel)) { | ||
2678 | _dispc_mgr_set_lcd_timings(channel, t.hsw, t.hfp, t.hbp, t.vsw, | ||
2679 | t.vfp, t.vbp); | ||
2680 | |||
2681 | xtot = t.x_res + t.hfp + t.hsw + t.hbp; | ||
2682 | ytot = t.y_res + t.vfp + t.vsw + t.vbp; | ||
2353 | 2683 | ||
2354 | _dispc_mgr_set_lcd_timings(channel, timings->hsw, timings->hfp, | 2684 | ht = (timings->pixel_clock * 1000) / xtot; |
2355 | timings->hbp, timings->vsw, timings->vfp, | 2685 | vt = (timings->pixel_clock * 1000) / xtot / ytot; |
2356 | timings->vbp); | ||
2357 | 2686 | ||
2358 | dispc_mgr_set_lcd_size(channel, timings->x_res, timings->y_res); | 2687 | DSSDBG("pck %u\n", timings->pixel_clock); |
2688 | DSSDBG("hsw %d hfp %d hbp %d vsw %d vfp %d vbp %d\n", | ||
2689 | t.hsw, t.hfp, t.hbp, t.vsw, t.vfp, t.vbp); | ||
2359 | 2690 | ||
2360 | xtot = timings->x_res + timings->hfp + timings->hsw + timings->hbp; | 2691 | DSSDBG("hsync %luHz, vsync %luHz\n", ht, vt); |
2361 | ytot = timings->y_res + timings->vfp + timings->vsw + timings->vbp; | 2692 | } else { |
2693 | enum dss_hdmi_venc_clk_source_select source; | ||
2362 | 2694 | ||
2363 | ht = (timings->pixel_clock * 1000) / xtot; | 2695 | source = dss_get_hdmi_venc_clk_source(); |
2364 | vt = (timings->pixel_clock * 1000) / xtot / ytot; | ||
2365 | 2696 | ||
2366 | DSSDBG("channel %d xres %u yres %u\n", channel, timings->x_res, | 2697 | if (source == DSS_VENC_TV_CLK) |
2367 | timings->y_res); | 2698 | t.y_res /= 2; |
2368 | DSSDBG("pck %u\n", timings->pixel_clock); | 2699 | } |
2369 | DSSDBG("hsw %d hfp %d hbp %d vsw %d vfp %d vbp %d\n", | ||
2370 | timings->hsw, timings->hfp, timings->hbp, | ||
2371 | timings->vsw, timings->vfp, timings->vbp); | ||
2372 | 2700 | ||
2373 | DSSDBG("hsync %luHz, vsync %luHz\n", ht, vt); | 2701 | dispc_mgr_set_size(channel, t.x_res, t.y_res); |
2374 | } | 2702 | } |
2375 | 2703 | ||
2376 | static void dispc_mgr_set_lcd_divisor(enum omap_channel channel, u16 lck_div, | 2704 | static void dispc_mgr_set_lcd_divisor(enum omap_channel channel, u16 lck_div, |
@@ -2411,6 +2739,7 @@ unsigned long dispc_fclk_rate(void) | |||
2411 | break; | 2739 | break; |
2412 | default: | 2740 | default: |
2413 | BUG(); | 2741 | BUG(); |
2742 | return 0; | ||
2414 | } | 2743 | } |
2415 | 2744 | ||
2416 | return r; | 2745 | return r; |
@@ -2441,6 +2770,7 @@ unsigned long dispc_mgr_lclk_rate(enum omap_channel channel) | |||
2441 | break; | 2770 | break; |
2442 | default: | 2771 | default: |
2443 | BUG(); | 2772 | BUG(); |
2773 | return 0; | ||
2444 | } | 2774 | } |
2445 | 2775 | ||
2446 | return r / lcd; | 2776 | return r / lcd; |
@@ -2462,20 +2792,35 @@ unsigned long dispc_mgr_pclk_rate(enum omap_channel channel) | |||
2462 | 2792 | ||
2463 | return r / pcd; | 2793 | return r / pcd; |
2464 | } else { | 2794 | } else { |
2465 | struct omap_dss_device *dssdev = | 2795 | enum dss_hdmi_venc_clk_source_select source; |
2466 | dispc_mgr_get_device(channel); | ||
2467 | 2796 | ||
2468 | switch (dssdev->type) { | 2797 | source = dss_get_hdmi_venc_clk_source(); |
2469 | case OMAP_DISPLAY_TYPE_VENC: | 2798 | |
2799 | switch (source) { | ||
2800 | case DSS_VENC_TV_CLK: | ||
2470 | return venc_get_pixel_clock(); | 2801 | return venc_get_pixel_clock(); |
2471 | case OMAP_DISPLAY_TYPE_HDMI: | 2802 | case DSS_HDMI_M_PCLK: |
2472 | return hdmi_get_pixel_clock(); | 2803 | return hdmi_get_pixel_clock(); |
2473 | default: | 2804 | default: |
2474 | BUG(); | 2805 | BUG(); |
2806 | return 0; | ||
2475 | } | 2807 | } |
2476 | } | 2808 | } |
2477 | } | 2809 | } |
2478 | 2810 | ||
2811 | unsigned long dispc_core_clk_rate(void) | ||
2812 | { | ||
2813 | int lcd; | ||
2814 | unsigned long fclk = dispc_fclk_rate(); | ||
2815 | |||
2816 | if (dss_has_feature(FEAT_CORE_CLK_DIV)) | ||
2817 | lcd = REG_GET(DISPC_DIVISOR, 23, 16); | ||
2818 | else | ||
2819 | lcd = REG_GET(DISPC_DIVISORo(OMAP_DSS_CHANNEL_LCD), 23, 16); | ||
2820 | |||
2821 | return fclk / lcd; | ||
2822 | } | ||
2823 | |||
2479 | void dispc_dump_clocks(struct seq_file *s) | 2824 | void dispc_dump_clocks(struct seq_file *s) |
2480 | { | 2825 | { |
2481 | int lcd, pcd; | 2826 | int lcd, pcd; |
@@ -2588,7 +2933,7 @@ void dispc_dump_irqs(struct seq_file *s) | |||
2588 | } | 2933 | } |
2589 | #endif | 2934 | #endif |
2590 | 2935 | ||
2591 | void dispc_dump_regs(struct seq_file *s) | 2936 | static void dispc_dump_regs(struct seq_file *s) |
2592 | { | 2937 | { |
2593 | int i, j; | 2938 | int i, j; |
2594 | const char *mgr_names[] = { | 2939 | const char *mgr_names[] = { |
@@ -3247,27 +3592,6 @@ int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask, | |||
3247 | return 0; | 3592 | return 0; |
3248 | } | 3593 | } |
3249 | 3594 | ||
3250 | #ifdef CONFIG_OMAP2_DSS_FAKE_VSYNC | ||
3251 | void dispc_fake_vsync_irq(void) | ||
3252 | { | ||
3253 | u32 irqstatus = DISPC_IRQ_VSYNC; | ||
3254 | int i; | ||
3255 | |||
3256 | WARN_ON(!in_interrupt()); | ||
3257 | |||
3258 | for (i = 0; i < DISPC_MAX_NR_ISRS; i++) { | ||
3259 | struct omap_dispc_isr_data *isr_data; | ||
3260 | isr_data = &dispc.registered_isr[i]; | ||
3261 | |||
3262 | if (!isr_data->isr) | ||
3263 | continue; | ||
3264 | |||
3265 | if (isr_data->mask & irqstatus) | ||
3266 | isr_data->isr(isr_data->arg, irqstatus); | ||
3267 | } | ||
3268 | } | ||
3269 | #endif | ||
3270 | |||
3271 | static void _omap_dispc_initialize_irq(void) | 3595 | static void _omap_dispc_initialize_irq(void) |
3272 | { | 3596 | { |
3273 | unsigned long flags; | 3597 | unsigned long flags; |
@@ -3330,7 +3654,7 @@ static void _omap_dispc_initial_config(void) | |||
3330 | } | 3654 | } |
3331 | 3655 | ||
3332 | /* DISPC HW IP initialisation */ | 3656 | /* DISPC HW IP initialisation */ |
3333 | static int omap_dispchw_probe(struct platform_device *pdev) | 3657 | static int __init omap_dispchw_probe(struct platform_device *pdev) |
3334 | { | 3658 | { |
3335 | u32 rev; | 3659 | u32 rev; |
3336 | int r = 0; | 3660 | int r = 0; |
@@ -3399,6 +3723,11 @@ static int omap_dispchw_probe(struct platform_device *pdev) | |||
3399 | 3723 | ||
3400 | dispc_runtime_put(); | 3724 | dispc_runtime_put(); |
3401 | 3725 | ||
3726 | dss_debugfs_create_file("dispc", dispc_dump_regs); | ||
3727 | |||
3728 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | ||
3729 | dss_debugfs_create_file("dispc_irq", dispc_dump_irqs); | ||
3730 | #endif | ||
3402 | return 0; | 3731 | return 0; |
3403 | 3732 | ||
3404 | err_runtime_get: | 3733 | err_runtime_get: |
@@ -3407,7 +3736,7 @@ err_runtime_get: | |||
3407 | return r; | 3736 | return r; |
3408 | } | 3737 | } |
3409 | 3738 | ||
3410 | static int omap_dispchw_remove(struct platform_device *pdev) | 3739 | static int __exit omap_dispchw_remove(struct platform_device *pdev) |
3411 | { | 3740 | { |
3412 | pm_runtime_disable(&pdev->dev); | 3741 | pm_runtime_disable(&pdev->dev); |
3413 | 3742 | ||
@@ -3419,19 +3748,12 @@ static int omap_dispchw_remove(struct platform_device *pdev) | |||
3419 | static int dispc_runtime_suspend(struct device *dev) | 3748 | static int dispc_runtime_suspend(struct device *dev) |
3420 | { | 3749 | { |
3421 | dispc_save_context(); | 3750 | dispc_save_context(); |
3422 | dss_runtime_put(); | ||
3423 | 3751 | ||
3424 | return 0; | 3752 | return 0; |
3425 | } | 3753 | } |
3426 | 3754 | ||
3427 | static int dispc_runtime_resume(struct device *dev) | 3755 | static int dispc_runtime_resume(struct device *dev) |
3428 | { | 3756 | { |
3429 | int r; | ||
3430 | |||
3431 | r = dss_runtime_get(); | ||
3432 | if (r < 0) | ||
3433 | return r; | ||
3434 | |||
3435 | dispc_restore_context(); | 3757 | dispc_restore_context(); |
3436 | 3758 | ||
3437 | return 0; | 3759 | return 0; |
@@ -3443,8 +3765,7 @@ static const struct dev_pm_ops dispc_pm_ops = { | |||
3443 | }; | 3765 | }; |
3444 | 3766 | ||
3445 | static struct platform_driver omap_dispchw_driver = { | 3767 | static struct platform_driver omap_dispchw_driver = { |
3446 | .probe = omap_dispchw_probe, | 3768 | .remove = __exit_p(omap_dispchw_remove), |
3447 | .remove = omap_dispchw_remove, | ||
3448 | .driver = { | 3769 | .driver = { |
3449 | .name = "omapdss_dispc", | 3770 | .name = "omapdss_dispc", |
3450 | .owner = THIS_MODULE, | 3771 | .owner = THIS_MODULE, |
@@ -3452,12 +3773,12 @@ static struct platform_driver omap_dispchw_driver = { | |||
3452 | }, | 3773 | }, |
3453 | }; | 3774 | }; |
3454 | 3775 | ||
3455 | int dispc_init_platform_driver(void) | 3776 | int __init dispc_init_platform_driver(void) |
3456 | { | 3777 | { |
3457 | return platform_driver_register(&omap_dispchw_driver); | 3778 | return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe); |
3458 | } | 3779 | } |
3459 | 3780 | ||
3460 | void dispc_uninit_platform_driver(void) | 3781 | void __exit dispc_uninit_platform_driver(void) |
3461 | { | 3782 | { |
3462 | return platform_driver_unregister(&omap_dispchw_driver); | 3783 | platform_driver_unregister(&omap_dispchw_driver); |
3463 | } | 3784 | } |
diff --git a/drivers/video/omap2/dss/dispc.h b/drivers/video/omap2/dss/dispc.h index 5836bd1650f9..f278080e1063 100644 --- a/drivers/video/omap2/dss/dispc.h +++ b/drivers/video/omap2/dss/dispc.h | |||
@@ -120,6 +120,7 @@ static inline u16 DISPC_DEFAULT_COLOR(enum omap_channel channel) | |||
120 | return 0x03AC; | 120 | return 0x03AC; |
121 | default: | 121 | default: |
122 | BUG(); | 122 | BUG(); |
123 | return 0; | ||
123 | } | 124 | } |
124 | } | 125 | } |
125 | 126 | ||
@@ -134,6 +135,7 @@ static inline u16 DISPC_TRANS_COLOR(enum omap_channel channel) | |||
134 | return 0x03B0; | 135 | return 0x03B0; |
135 | default: | 136 | default: |
136 | BUG(); | 137 | BUG(); |
138 | return 0; | ||
137 | } | 139 | } |
138 | } | 140 | } |
139 | 141 | ||
@@ -144,10 +146,12 @@ static inline u16 DISPC_TIMING_H(enum omap_channel channel) | |||
144 | return 0x0064; | 146 | return 0x0064; |
145 | case OMAP_DSS_CHANNEL_DIGIT: | 147 | case OMAP_DSS_CHANNEL_DIGIT: |
146 | BUG(); | 148 | BUG(); |
149 | return 0; | ||
147 | case OMAP_DSS_CHANNEL_LCD2: | 150 | case OMAP_DSS_CHANNEL_LCD2: |
148 | return 0x0400; | 151 | return 0x0400; |
149 | default: | 152 | default: |
150 | BUG(); | 153 | BUG(); |
154 | return 0; | ||
151 | } | 155 | } |
152 | } | 156 | } |
153 | 157 | ||
@@ -158,10 +162,12 @@ static inline u16 DISPC_TIMING_V(enum omap_channel channel) | |||
158 | return 0x0068; | 162 | return 0x0068; |
159 | case OMAP_DSS_CHANNEL_DIGIT: | 163 | case OMAP_DSS_CHANNEL_DIGIT: |
160 | BUG(); | 164 | BUG(); |
165 | return 0; | ||
161 | case OMAP_DSS_CHANNEL_LCD2: | 166 | case OMAP_DSS_CHANNEL_LCD2: |
162 | return 0x0404; | 167 | return 0x0404; |
163 | default: | 168 | default: |
164 | BUG(); | 169 | BUG(); |
170 | return 0; | ||
165 | } | 171 | } |
166 | } | 172 | } |
167 | 173 | ||
@@ -172,10 +178,12 @@ static inline u16 DISPC_POL_FREQ(enum omap_channel channel) | |||
172 | return 0x006C; | 178 | return 0x006C; |
173 | case OMAP_DSS_CHANNEL_DIGIT: | 179 | case OMAP_DSS_CHANNEL_DIGIT: |
174 | BUG(); | 180 | BUG(); |
181 | return 0; | ||
175 | case OMAP_DSS_CHANNEL_LCD2: | 182 | case OMAP_DSS_CHANNEL_LCD2: |
176 | return 0x0408; | 183 | return 0x0408; |
177 | default: | 184 | default: |
178 | BUG(); | 185 | BUG(); |
186 | return 0; | ||
179 | } | 187 | } |
180 | } | 188 | } |
181 | 189 | ||
@@ -186,10 +194,12 @@ static inline u16 DISPC_DIVISORo(enum omap_channel channel) | |||
186 | return 0x0070; | 194 | return 0x0070; |
187 | case OMAP_DSS_CHANNEL_DIGIT: | 195 | case OMAP_DSS_CHANNEL_DIGIT: |
188 | BUG(); | 196 | BUG(); |
197 | return 0; | ||
189 | case OMAP_DSS_CHANNEL_LCD2: | 198 | case OMAP_DSS_CHANNEL_LCD2: |
190 | return 0x040C; | 199 | return 0x040C; |
191 | default: | 200 | default: |
192 | BUG(); | 201 | BUG(); |
202 | return 0; | ||
193 | } | 203 | } |
194 | } | 204 | } |
195 | 205 | ||
@@ -205,6 +215,7 @@ static inline u16 DISPC_SIZE_MGR(enum omap_channel channel) | |||
205 | return 0x03CC; | 215 | return 0x03CC; |
206 | default: | 216 | default: |
207 | BUG(); | 217 | BUG(); |
218 | return 0; | ||
208 | } | 219 | } |
209 | } | 220 | } |
210 | 221 | ||
@@ -215,10 +226,12 @@ static inline u16 DISPC_DATA_CYCLE1(enum omap_channel channel) | |||
215 | return 0x01D4; | 226 | return 0x01D4; |
216 | case OMAP_DSS_CHANNEL_DIGIT: | 227 | case OMAP_DSS_CHANNEL_DIGIT: |
217 | BUG(); | 228 | BUG(); |
229 | return 0; | ||
218 | case OMAP_DSS_CHANNEL_LCD2: | 230 | case OMAP_DSS_CHANNEL_LCD2: |
219 | return 0x03C0; | 231 | return 0x03C0; |
220 | default: | 232 | default: |
221 | BUG(); | 233 | BUG(); |
234 | return 0; | ||
222 | } | 235 | } |
223 | } | 236 | } |
224 | 237 | ||
@@ -229,10 +242,12 @@ static inline u16 DISPC_DATA_CYCLE2(enum omap_channel channel) | |||
229 | return 0x01D8; | 242 | return 0x01D8; |
230 | case OMAP_DSS_CHANNEL_DIGIT: | 243 | case OMAP_DSS_CHANNEL_DIGIT: |
231 | BUG(); | 244 | BUG(); |
245 | return 0; | ||
232 | case OMAP_DSS_CHANNEL_LCD2: | 246 | case OMAP_DSS_CHANNEL_LCD2: |
233 | return 0x03C4; | 247 | return 0x03C4; |
234 | default: | 248 | default: |
235 | BUG(); | 249 | BUG(); |
250 | return 0; | ||
236 | } | 251 | } |
237 | } | 252 | } |
238 | 253 | ||
@@ -243,10 +258,12 @@ static inline u16 DISPC_DATA_CYCLE3(enum omap_channel channel) | |||
243 | return 0x01DC; | 258 | return 0x01DC; |
244 | case OMAP_DSS_CHANNEL_DIGIT: | 259 | case OMAP_DSS_CHANNEL_DIGIT: |
245 | BUG(); | 260 | BUG(); |
261 | return 0; | ||
246 | case OMAP_DSS_CHANNEL_LCD2: | 262 | case OMAP_DSS_CHANNEL_LCD2: |
247 | return 0x03C8; | 263 | return 0x03C8; |
248 | default: | 264 | default: |
249 | BUG(); | 265 | BUG(); |
266 | return 0; | ||
250 | } | 267 | } |
251 | } | 268 | } |
252 | 269 | ||
@@ -257,10 +274,12 @@ static inline u16 DISPC_CPR_COEF_R(enum omap_channel channel) | |||
257 | return 0x0220; | 274 | return 0x0220; |
258 | case OMAP_DSS_CHANNEL_DIGIT: | 275 | case OMAP_DSS_CHANNEL_DIGIT: |
259 | BUG(); | 276 | BUG(); |
277 | return 0; | ||
260 | case OMAP_DSS_CHANNEL_LCD2: | 278 | case OMAP_DSS_CHANNEL_LCD2: |
261 | return 0x03BC; | 279 | return 0x03BC; |
262 | default: | 280 | default: |
263 | BUG(); | 281 | BUG(); |
282 | return 0; | ||
264 | } | 283 | } |
265 | } | 284 | } |
266 | 285 | ||
@@ -271,10 +290,12 @@ static inline u16 DISPC_CPR_COEF_G(enum omap_channel channel) | |||
271 | return 0x0224; | 290 | return 0x0224; |
272 | case OMAP_DSS_CHANNEL_DIGIT: | 291 | case OMAP_DSS_CHANNEL_DIGIT: |
273 | BUG(); | 292 | BUG(); |
293 | return 0; | ||
274 | case OMAP_DSS_CHANNEL_LCD2: | 294 | case OMAP_DSS_CHANNEL_LCD2: |
275 | return 0x03B8; | 295 | return 0x03B8; |
276 | default: | 296 | default: |
277 | BUG(); | 297 | BUG(); |
298 | return 0; | ||
278 | } | 299 | } |
279 | } | 300 | } |
280 | 301 | ||
@@ -285,10 +306,12 @@ static inline u16 DISPC_CPR_COEF_B(enum omap_channel channel) | |||
285 | return 0x0228; | 306 | return 0x0228; |
286 | case OMAP_DSS_CHANNEL_DIGIT: | 307 | case OMAP_DSS_CHANNEL_DIGIT: |
287 | BUG(); | 308 | BUG(); |
309 | return 0; | ||
288 | case OMAP_DSS_CHANNEL_LCD2: | 310 | case OMAP_DSS_CHANNEL_LCD2: |
289 | return 0x03B4; | 311 | return 0x03B4; |
290 | default: | 312 | default: |
291 | BUG(); | 313 | BUG(); |
314 | return 0; | ||
292 | } | 315 | } |
293 | } | 316 | } |
294 | 317 | ||
@@ -306,6 +329,7 @@ static inline u16 DISPC_OVL_BASE(enum omap_plane plane) | |||
306 | return 0x0300; | 329 | return 0x0300; |
307 | default: | 330 | default: |
308 | BUG(); | 331 | BUG(); |
332 | return 0; | ||
309 | } | 333 | } |
310 | } | 334 | } |
311 | 335 | ||
@@ -321,6 +345,7 @@ static inline u16 DISPC_BA0_OFFSET(enum omap_plane plane) | |||
321 | return 0x0008; | 345 | return 0x0008; |
322 | default: | 346 | default: |
323 | BUG(); | 347 | BUG(); |
348 | return 0; | ||
324 | } | 349 | } |
325 | } | 350 | } |
326 | 351 | ||
@@ -335,6 +360,7 @@ static inline u16 DISPC_BA1_OFFSET(enum omap_plane plane) | |||
335 | return 0x000C; | 360 | return 0x000C; |
336 | default: | 361 | default: |
337 | BUG(); | 362 | BUG(); |
363 | return 0; | ||
338 | } | 364 | } |
339 | } | 365 | } |
340 | 366 | ||
@@ -343,6 +369,7 @@ static inline u16 DISPC_BA0_UV_OFFSET(enum omap_plane plane) | |||
343 | switch (plane) { | 369 | switch (plane) { |
344 | case OMAP_DSS_GFX: | 370 | case OMAP_DSS_GFX: |
345 | BUG(); | 371 | BUG(); |
372 | return 0; | ||
346 | case OMAP_DSS_VIDEO1: | 373 | case OMAP_DSS_VIDEO1: |
347 | return 0x0544; | 374 | return 0x0544; |
348 | case OMAP_DSS_VIDEO2: | 375 | case OMAP_DSS_VIDEO2: |
@@ -351,6 +378,7 @@ static inline u16 DISPC_BA0_UV_OFFSET(enum omap_plane plane) | |||
351 | return 0x0310; | 378 | return 0x0310; |
352 | default: | 379 | default: |
353 | BUG(); | 380 | BUG(); |
381 | return 0; | ||
354 | } | 382 | } |
355 | } | 383 | } |
356 | 384 | ||
@@ -359,6 +387,7 @@ static inline u16 DISPC_BA1_UV_OFFSET(enum omap_plane plane) | |||
359 | switch (plane) { | 387 | switch (plane) { |
360 | case OMAP_DSS_GFX: | 388 | case OMAP_DSS_GFX: |
361 | BUG(); | 389 | BUG(); |
390 | return 0; | ||
362 | case OMAP_DSS_VIDEO1: | 391 | case OMAP_DSS_VIDEO1: |
363 | return 0x0548; | 392 | return 0x0548; |
364 | case OMAP_DSS_VIDEO2: | 393 | case OMAP_DSS_VIDEO2: |
@@ -367,6 +396,7 @@ static inline u16 DISPC_BA1_UV_OFFSET(enum omap_plane plane) | |||
367 | return 0x0314; | 396 | return 0x0314; |
368 | default: | 397 | default: |
369 | BUG(); | 398 | BUG(); |
399 | return 0; | ||
370 | } | 400 | } |
371 | } | 401 | } |
372 | 402 | ||
@@ -381,6 +411,7 @@ static inline u16 DISPC_POS_OFFSET(enum omap_plane plane) | |||
381 | return 0x009C; | 411 | return 0x009C; |
382 | default: | 412 | default: |
383 | BUG(); | 413 | BUG(); |
414 | return 0; | ||
384 | } | 415 | } |
385 | } | 416 | } |
386 | 417 | ||
@@ -395,6 +426,7 @@ static inline u16 DISPC_SIZE_OFFSET(enum omap_plane plane) | |||
395 | return 0x00A8; | 426 | return 0x00A8; |
396 | default: | 427 | default: |
397 | BUG(); | 428 | BUG(); |
429 | return 0; | ||
398 | } | 430 | } |
399 | } | 431 | } |
400 | 432 | ||
@@ -410,6 +442,7 @@ static inline u16 DISPC_ATTR_OFFSET(enum omap_plane plane) | |||
410 | return 0x0070; | 442 | return 0x0070; |
411 | default: | 443 | default: |
412 | BUG(); | 444 | BUG(); |
445 | return 0; | ||
413 | } | 446 | } |
414 | } | 447 | } |
415 | 448 | ||
@@ -418,6 +451,7 @@ static inline u16 DISPC_ATTR2_OFFSET(enum omap_plane plane) | |||
418 | switch (plane) { | 451 | switch (plane) { |
419 | case OMAP_DSS_GFX: | 452 | case OMAP_DSS_GFX: |
420 | BUG(); | 453 | BUG(); |
454 | return 0; | ||
421 | case OMAP_DSS_VIDEO1: | 455 | case OMAP_DSS_VIDEO1: |
422 | return 0x0568; | 456 | return 0x0568; |
423 | case OMAP_DSS_VIDEO2: | 457 | case OMAP_DSS_VIDEO2: |
@@ -426,6 +460,7 @@ static inline u16 DISPC_ATTR2_OFFSET(enum omap_plane plane) | |||
426 | return 0x032C; | 460 | return 0x032C; |
427 | default: | 461 | default: |
428 | BUG(); | 462 | BUG(); |
463 | return 0; | ||
429 | } | 464 | } |
430 | } | 465 | } |
431 | 466 | ||
@@ -441,6 +476,7 @@ static inline u16 DISPC_FIFO_THRESH_OFFSET(enum omap_plane plane) | |||
441 | return 0x008C; | 476 | return 0x008C; |
442 | default: | 477 | default: |
443 | BUG(); | 478 | BUG(); |
479 | return 0; | ||
444 | } | 480 | } |
445 | } | 481 | } |
446 | 482 | ||
@@ -456,6 +492,7 @@ static inline u16 DISPC_FIFO_SIZE_STATUS_OFFSET(enum omap_plane plane) | |||
456 | return 0x0088; | 492 | return 0x0088; |
457 | default: | 493 | default: |
458 | BUG(); | 494 | BUG(); |
495 | return 0; | ||
459 | } | 496 | } |
460 | } | 497 | } |
461 | 498 | ||
@@ -471,6 +508,7 @@ static inline u16 DISPC_ROW_INC_OFFSET(enum omap_plane plane) | |||
471 | return 0x00A4; | 508 | return 0x00A4; |
472 | default: | 509 | default: |
473 | BUG(); | 510 | BUG(); |
511 | return 0; | ||
474 | } | 512 | } |
475 | } | 513 | } |
476 | 514 | ||
@@ -486,6 +524,7 @@ static inline u16 DISPC_PIX_INC_OFFSET(enum omap_plane plane) | |||
486 | return 0x0098; | 524 | return 0x0098; |
487 | default: | 525 | default: |
488 | BUG(); | 526 | BUG(); |
527 | return 0; | ||
489 | } | 528 | } |
490 | } | 529 | } |
491 | 530 | ||
@@ -498,8 +537,10 @@ static inline u16 DISPC_WINDOW_SKIP_OFFSET(enum omap_plane plane) | |||
498 | case OMAP_DSS_VIDEO2: | 537 | case OMAP_DSS_VIDEO2: |
499 | case OMAP_DSS_VIDEO3: | 538 | case OMAP_DSS_VIDEO3: |
500 | BUG(); | 539 | BUG(); |
540 | return 0; | ||
501 | default: | 541 | default: |
502 | BUG(); | 542 | BUG(); |
543 | return 0; | ||
503 | } | 544 | } |
504 | } | 545 | } |
505 | 546 | ||
@@ -512,8 +553,10 @@ static inline u16 DISPC_TABLE_BA_OFFSET(enum omap_plane plane) | |||
512 | case OMAP_DSS_VIDEO2: | 553 | case OMAP_DSS_VIDEO2: |
513 | case OMAP_DSS_VIDEO3: | 554 | case OMAP_DSS_VIDEO3: |
514 | BUG(); | 555 | BUG(); |
556 | return 0; | ||
515 | default: | 557 | default: |
516 | BUG(); | 558 | BUG(); |
559 | return 0; | ||
517 | } | 560 | } |
518 | } | 561 | } |
519 | 562 | ||
@@ -522,6 +565,7 @@ static inline u16 DISPC_FIR_OFFSET(enum omap_plane plane) | |||
522 | switch (plane) { | 565 | switch (plane) { |
523 | case OMAP_DSS_GFX: | 566 | case OMAP_DSS_GFX: |
524 | BUG(); | 567 | BUG(); |
568 | return 0; | ||
525 | case OMAP_DSS_VIDEO1: | 569 | case OMAP_DSS_VIDEO1: |
526 | case OMAP_DSS_VIDEO2: | 570 | case OMAP_DSS_VIDEO2: |
527 | return 0x0024; | 571 | return 0x0024; |
@@ -529,6 +573,7 @@ static inline u16 DISPC_FIR_OFFSET(enum omap_plane plane) | |||
529 | return 0x0090; | 573 | return 0x0090; |
530 | default: | 574 | default: |
531 | BUG(); | 575 | BUG(); |
576 | return 0; | ||
532 | } | 577 | } |
533 | } | 578 | } |
534 | 579 | ||
@@ -537,6 +582,7 @@ static inline u16 DISPC_FIR2_OFFSET(enum omap_plane plane) | |||
537 | switch (plane) { | 582 | switch (plane) { |
538 | case OMAP_DSS_GFX: | 583 | case OMAP_DSS_GFX: |
539 | BUG(); | 584 | BUG(); |
585 | return 0; | ||
540 | case OMAP_DSS_VIDEO1: | 586 | case OMAP_DSS_VIDEO1: |
541 | return 0x0580; | 587 | return 0x0580; |
542 | case OMAP_DSS_VIDEO2: | 588 | case OMAP_DSS_VIDEO2: |
@@ -545,6 +591,7 @@ static inline u16 DISPC_FIR2_OFFSET(enum omap_plane plane) | |||
545 | return 0x0424; | 591 | return 0x0424; |
546 | default: | 592 | default: |
547 | BUG(); | 593 | BUG(); |
594 | return 0; | ||
548 | } | 595 | } |
549 | } | 596 | } |
550 | 597 | ||
@@ -553,6 +600,7 @@ static inline u16 DISPC_PIC_SIZE_OFFSET(enum omap_plane plane) | |||
553 | switch (plane) { | 600 | switch (plane) { |
554 | case OMAP_DSS_GFX: | 601 | case OMAP_DSS_GFX: |
555 | BUG(); | 602 | BUG(); |
603 | return 0; | ||
556 | case OMAP_DSS_VIDEO1: | 604 | case OMAP_DSS_VIDEO1: |
557 | case OMAP_DSS_VIDEO2: | 605 | case OMAP_DSS_VIDEO2: |
558 | return 0x0028; | 606 | return 0x0028; |
@@ -560,6 +608,7 @@ static inline u16 DISPC_PIC_SIZE_OFFSET(enum omap_plane plane) | |||
560 | return 0x0094; | 608 | return 0x0094; |
561 | default: | 609 | default: |
562 | BUG(); | 610 | BUG(); |
611 | return 0; | ||
563 | } | 612 | } |
564 | } | 613 | } |
565 | 614 | ||
@@ -569,6 +618,7 @@ static inline u16 DISPC_ACCU0_OFFSET(enum omap_plane plane) | |||
569 | switch (plane) { | 618 | switch (plane) { |
570 | case OMAP_DSS_GFX: | 619 | case OMAP_DSS_GFX: |
571 | BUG(); | 620 | BUG(); |
621 | return 0; | ||
572 | case OMAP_DSS_VIDEO1: | 622 | case OMAP_DSS_VIDEO1: |
573 | case OMAP_DSS_VIDEO2: | 623 | case OMAP_DSS_VIDEO2: |
574 | return 0x002C; | 624 | return 0x002C; |
@@ -576,6 +626,7 @@ static inline u16 DISPC_ACCU0_OFFSET(enum omap_plane plane) | |||
576 | return 0x0000; | 626 | return 0x0000; |
577 | default: | 627 | default: |
578 | BUG(); | 628 | BUG(); |
629 | return 0; | ||
579 | } | 630 | } |
580 | } | 631 | } |
581 | 632 | ||
@@ -584,6 +635,7 @@ static inline u16 DISPC_ACCU2_0_OFFSET(enum omap_plane plane) | |||
584 | switch (plane) { | 635 | switch (plane) { |
585 | case OMAP_DSS_GFX: | 636 | case OMAP_DSS_GFX: |
586 | BUG(); | 637 | BUG(); |
638 | return 0; | ||
587 | case OMAP_DSS_VIDEO1: | 639 | case OMAP_DSS_VIDEO1: |
588 | return 0x0584; | 640 | return 0x0584; |
589 | case OMAP_DSS_VIDEO2: | 641 | case OMAP_DSS_VIDEO2: |
@@ -592,6 +644,7 @@ static inline u16 DISPC_ACCU2_0_OFFSET(enum omap_plane plane) | |||
592 | return 0x0428; | 644 | return 0x0428; |
593 | default: | 645 | default: |
594 | BUG(); | 646 | BUG(); |
647 | return 0; | ||
595 | } | 648 | } |
596 | } | 649 | } |
597 | 650 | ||
@@ -600,6 +653,7 @@ static inline u16 DISPC_ACCU1_OFFSET(enum omap_plane plane) | |||
600 | switch (plane) { | 653 | switch (plane) { |
601 | case OMAP_DSS_GFX: | 654 | case OMAP_DSS_GFX: |
602 | BUG(); | 655 | BUG(); |
656 | return 0; | ||
603 | case OMAP_DSS_VIDEO1: | 657 | case OMAP_DSS_VIDEO1: |
604 | case OMAP_DSS_VIDEO2: | 658 | case OMAP_DSS_VIDEO2: |
605 | return 0x0030; | 659 | return 0x0030; |
@@ -607,6 +661,7 @@ static inline u16 DISPC_ACCU1_OFFSET(enum omap_plane plane) | |||
607 | return 0x0004; | 661 | return 0x0004; |
608 | default: | 662 | default: |
609 | BUG(); | 663 | BUG(); |
664 | return 0; | ||
610 | } | 665 | } |
611 | } | 666 | } |
612 | 667 | ||
@@ -615,6 +670,7 @@ static inline u16 DISPC_ACCU2_1_OFFSET(enum omap_plane plane) | |||
615 | switch (plane) { | 670 | switch (plane) { |
616 | case OMAP_DSS_GFX: | 671 | case OMAP_DSS_GFX: |
617 | BUG(); | 672 | BUG(); |
673 | return 0; | ||
618 | case OMAP_DSS_VIDEO1: | 674 | case OMAP_DSS_VIDEO1: |
619 | return 0x0588; | 675 | return 0x0588; |
620 | case OMAP_DSS_VIDEO2: | 676 | case OMAP_DSS_VIDEO2: |
@@ -623,6 +679,7 @@ static inline u16 DISPC_ACCU2_1_OFFSET(enum omap_plane plane) | |||
623 | return 0x042C; | 679 | return 0x042C; |
624 | default: | 680 | default: |
625 | BUG(); | 681 | BUG(); |
682 | return 0; | ||
626 | } | 683 | } |
627 | } | 684 | } |
628 | 685 | ||
@@ -632,6 +689,7 @@ static inline u16 DISPC_FIR_COEF_H_OFFSET(enum omap_plane plane, u16 i) | |||
632 | switch (plane) { | 689 | switch (plane) { |
633 | case OMAP_DSS_GFX: | 690 | case OMAP_DSS_GFX: |
634 | BUG(); | 691 | BUG(); |
692 | return 0; | ||
635 | case OMAP_DSS_VIDEO1: | 693 | case OMAP_DSS_VIDEO1: |
636 | case OMAP_DSS_VIDEO2: | 694 | case OMAP_DSS_VIDEO2: |
637 | return 0x0034 + i * 0x8; | 695 | return 0x0034 + i * 0x8; |
@@ -639,6 +697,7 @@ static inline u16 DISPC_FIR_COEF_H_OFFSET(enum omap_plane plane, u16 i) | |||
639 | return 0x0010 + i * 0x8; | 697 | return 0x0010 + i * 0x8; |
640 | default: | 698 | default: |
641 | BUG(); | 699 | BUG(); |
700 | return 0; | ||
642 | } | 701 | } |
643 | } | 702 | } |
644 | 703 | ||
@@ -648,6 +707,7 @@ static inline u16 DISPC_FIR_COEF_H2_OFFSET(enum omap_plane plane, u16 i) | |||
648 | switch (plane) { | 707 | switch (plane) { |
649 | case OMAP_DSS_GFX: | 708 | case OMAP_DSS_GFX: |
650 | BUG(); | 709 | BUG(); |
710 | return 0; | ||
651 | case OMAP_DSS_VIDEO1: | 711 | case OMAP_DSS_VIDEO1: |
652 | return 0x058C + i * 0x8; | 712 | return 0x058C + i * 0x8; |
653 | case OMAP_DSS_VIDEO2: | 713 | case OMAP_DSS_VIDEO2: |
@@ -656,6 +716,7 @@ static inline u16 DISPC_FIR_COEF_H2_OFFSET(enum omap_plane plane, u16 i) | |||
656 | return 0x0430 + i * 0x8; | 716 | return 0x0430 + i * 0x8; |
657 | default: | 717 | default: |
658 | BUG(); | 718 | BUG(); |
719 | return 0; | ||
659 | } | 720 | } |
660 | } | 721 | } |
661 | 722 | ||
@@ -665,6 +726,7 @@ static inline u16 DISPC_FIR_COEF_HV_OFFSET(enum omap_plane plane, u16 i) | |||
665 | switch (plane) { | 726 | switch (plane) { |
666 | case OMAP_DSS_GFX: | 727 | case OMAP_DSS_GFX: |
667 | BUG(); | 728 | BUG(); |
729 | return 0; | ||
668 | case OMAP_DSS_VIDEO1: | 730 | case OMAP_DSS_VIDEO1: |
669 | case OMAP_DSS_VIDEO2: | 731 | case OMAP_DSS_VIDEO2: |
670 | return 0x0038 + i * 0x8; | 732 | return 0x0038 + i * 0x8; |
@@ -672,6 +734,7 @@ static inline u16 DISPC_FIR_COEF_HV_OFFSET(enum omap_plane plane, u16 i) | |||
672 | return 0x0014 + i * 0x8; | 734 | return 0x0014 + i * 0x8; |
673 | default: | 735 | default: |
674 | BUG(); | 736 | BUG(); |
737 | return 0; | ||
675 | } | 738 | } |
676 | } | 739 | } |
677 | 740 | ||
@@ -681,6 +744,7 @@ static inline u16 DISPC_FIR_COEF_HV2_OFFSET(enum omap_plane plane, u16 i) | |||
681 | switch (plane) { | 744 | switch (plane) { |
682 | case OMAP_DSS_GFX: | 745 | case OMAP_DSS_GFX: |
683 | BUG(); | 746 | BUG(); |
747 | return 0; | ||
684 | case OMAP_DSS_VIDEO1: | 748 | case OMAP_DSS_VIDEO1: |
685 | return 0x0590 + i * 8; | 749 | return 0x0590 + i * 8; |
686 | case OMAP_DSS_VIDEO2: | 750 | case OMAP_DSS_VIDEO2: |
@@ -689,6 +753,7 @@ static inline u16 DISPC_FIR_COEF_HV2_OFFSET(enum omap_plane plane, u16 i) | |||
689 | return 0x0434 + i * 0x8; | 753 | return 0x0434 + i * 0x8; |
690 | default: | 754 | default: |
691 | BUG(); | 755 | BUG(); |
756 | return 0; | ||
692 | } | 757 | } |
693 | } | 758 | } |
694 | 759 | ||
@@ -698,12 +763,14 @@ static inline u16 DISPC_CONV_COEF_OFFSET(enum omap_plane plane, u16 i) | |||
698 | switch (plane) { | 763 | switch (plane) { |
699 | case OMAP_DSS_GFX: | 764 | case OMAP_DSS_GFX: |
700 | BUG(); | 765 | BUG(); |
766 | return 0; | ||
701 | case OMAP_DSS_VIDEO1: | 767 | case OMAP_DSS_VIDEO1: |
702 | case OMAP_DSS_VIDEO2: | 768 | case OMAP_DSS_VIDEO2: |
703 | case OMAP_DSS_VIDEO3: | 769 | case OMAP_DSS_VIDEO3: |
704 | return 0x0074 + i * 0x4; | 770 | return 0x0074 + i * 0x4; |
705 | default: | 771 | default: |
706 | BUG(); | 772 | BUG(); |
773 | return 0; | ||
707 | } | 774 | } |
708 | } | 775 | } |
709 | 776 | ||
@@ -713,6 +780,7 @@ static inline u16 DISPC_FIR_COEF_V_OFFSET(enum omap_plane plane, u16 i) | |||
713 | switch (plane) { | 780 | switch (plane) { |
714 | case OMAP_DSS_GFX: | 781 | case OMAP_DSS_GFX: |
715 | BUG(); | 782 | BUG(); |
783 | return 0; | ||
716 | case OMAP_DSS_VIDEO1: | 784 | case OMAP_DSS_VIDEO1: |
717 | return 0x0124 + i * 0x4; | 785 | return 0x0124 + i * 0x4; |
718 | case OMAP_DSS_VIDEO2: | 786 | case OMAP_DSS_VIDEO2: |
@@ -721,6 +789,7 @@ static inline u16 DISPC_FIR_COEF_V_OFFSET(enum omap_plane plane, u16 i) | |||
721 | return 0x0050 + i * 0x4; | 789 | return 0x0050 + i * 0x4; |
722 | default: | 790 | default: |
723 | BUG(); | 791 | BUG(); |
792 | return 0; | ||
724 | } | 793 | } |
725 | } | 794 | } |
726 | 795 | ||
@@ -730,6 +799,7 @@ static inline u16 DISPC_FIR_COEF_V2_OFFSET(enum omap_plane plane, u16 i) | |||
730 | switch (plane) { | 799 | switch (plane) { |
731 | case OMAP_DSS_GFX: | 800 | case OMAP_DSS_GFX: |
732 | BUG(); | 801 | BUG(); |
802 | return 0; | ||
733 | case OMAP_DSS_VIDEO1: | 803 | case OMAP_DSS_VIDEO1: |
734 | return 0x05CC + i * 0x4; | 804 | return 0x05CC + i * 0x4; |
735 | case OMAP_DSS_VIDEO2: | 805 | case OMAP_DSS_VIDEO2: |
@@ -738,6 +808,7 @@ static inline u16 DISPC_FIR_COEF_V2_OFFSET(enum omap_plane plane, u16 i) | |||
738 | return 0x0470 + i * 0x4; | 808 | return 0x0470 + i * 0x4; |
739 | default: | 809 | default: |
740 | BUG(); | 810 | BUG(); |
811 | return 0; | ||
741 | } | 812 | } |
742 | } | 813 | } |
743 | 814 | ||
@@ -754,6 +825,7 @@ static inline u16 DISPC_PRELOAD_OFFSET(enum omap_plane plane) | |||
754 | return 0x00A0; | 825 | return 0x00A0; |
755 | default: | 826 | default: |
756 | BUG(); | 827 | BUG(); |
828 | return 0; | ||
757 | } | 829 | } |
758 | } | 830 | } |
759 | #endif | 831 | #endif |
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 4424c198dbcd..249010630370 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c | |||
@@ -304,10 +304,18 @@ int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev) | |||
304 | return 24; | 304 | return 24; |
305 | default: | 305 | default: |
306 | BUG(); | 306 | BUG(); |
307 | return 0; | ||
307 | } | 308 | } |
308 | } | 309 | } |
309 | EXPORT_SYMBOL(omapdss_default_get_recommended_bpp); | 310 | EXPORT_SYMBOL(omapdss_default_get_recommended_bpp); |
310 | 311 | ||
312 | void omapdss_default_get_timings(struct omap_dss_device *dssdev, | ||
313 | struct omap_video_timings *timings) | ||
314 | { | ||
315 | *timings = dssdev->panel.timings; | ||
316 | } | ||
317 | EXPORT_SYMBOL(omapdss_default_get_timings); | ||
318 | |||
311 | /* Checks if replication logic should be used. Only use for active matrix, | 319 | /* Checks if replication logic should be used. Only use for active matrix, |
312 | * when overlay is in RGB12U or RGB16 mode, and LCD interface is | 320 | * when overlay is in RGB12U or RGB16 mode, and LCD interface is |
313 | * 18bpp or 24bpp */ | 321 | * 18bpp or 24bpp */ |
@@ -340,6 +348,7 @@ bool dss_use_replication(struct omap_dss_device *dssdev, | |||
340 | break; | 348 | break; |
341 | default: | 349 | default: |
342 | BUG(); | 350 | BUG(); |
351 | return false; | ||
343 | } | 352 | } |
344 | 353 | ||
345 | return bpp > 16; | 354 | return bpp > 16; |
@@ -352,46 +361,6 @@ void dss_init_device(struct platform_device *pdev, | |||
352 | int i; | 361 | int i; |
353 | int r; | 362 | int r; |
354 | 363 | ||
355 | switch (dssdev->type) { | ||
356 | #ifdef CONFIG_OMAP2_DSS_DPI | ||
357 | case OMAP_DISPLAY_TYPE_DPI: | ||
358 | r = dpi_init_display(dssdev); | ||
359 | break; | ||
360 | #endif | ||
361 | #ifdef CONFIG_OMAP2_DSS_RFBI | ||
362 | case OMAP_DISPLAY_TYPE_DBI: | ||
363 | r = rfbi_init_display(dssdev); | ||
364 | break; | ||
365 | #endif | ||
366 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
367 | case OMAP_DISPLAY_TYPE_VENC: | ||
368 | r = venc_init_display(dssdev); | ||
369 | break; | ||
370 | #endif | ||
371 | #ifdef CONFIG_OMAP2_DSS_SDI | ||
372 | case OMAP_DISPLAY_TYPE_SDI: | ||
373 | r = sdi_init_display(dssdev); | ||
374 | break; | ||
375 | #endif | ||
376 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
377 | case OMAP_DISPLAY_TYPE_DSI: | ||
378 | r = dsi_init_display(dssdev); | ||
379 | break; | ||
380 | #endif | ||
381 | case OMAP_DISPLAY_TYPE_HDMI: | ||
382 | r = hdmi_init_display(dssdev); | ||
383 | break; | ||
384 | default: | ||
385 | DSSERR("Support for display '%s' not compiled in.\n", | ||
386 | dssdev->name); | ||
387 | return; | ||
388 | } | ||
389 | |||
390 | if (r) { | ||
391 | DSSERR("failed to init display %s\n", dssdev->name); | ||
392 | return; | ||
393 | } | ||
394 | |||
395 | /* create device sysfs files */ | 364 | /* create device sysfs files */ |
396 | i = 0; | 365 | i = 0; |
397 | while ((attr = display_sysfs_attrs[i++]) != NULL) { | 366 | while ((attr = display_sysfs_attrs[i++]) != NULL) { |
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index faaf305fda27..8c2056c9537b 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c | |||
@@ -156,7 +156,7 @@ static int dpi_set_mode(struct omap_dss_device *dssdev) | |||
156 | t->pixel_clock = pck; | 156 | t->pixel_clock = pck; |
157 | } | 157 | } |
158 | 158 | ||
159 | dispc_mgr_set_lcd_timings(dssdev->manager->id, t); | 159 | dss_mgr_set_timings(dssdev->manager, t); |
160 | 160 | ||
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
@@ -202,10 +202,6 @@ int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) | |||
202 | goto err_reg_enable; | 202 | goto err_reg_enable; |
203 | } | 203 | } |
204 | 204 | ||
205 | r = dss_runtime_get(); | ||
206 | if (r) | ||
207 | goto err_get_dss; | ||
208 | |||
209 | r = dispc_runtime_get(); | 205 | r = dispc_runtime_get(); |
210 | if (r) | 206 | if (r) |
211 | goto err_get_dispc; | 207 | goto err_get_dispc; |
@@ -244,8 +240,6 @@ err_dsi_pll_init: | |||
244 | err_get_dsi: | 240 | err_get_dsi: |
245 | dispc_runtime_put(); | 241 | dispc_runtime_put(); |
246 | err_get_dispc: | 242 | err_get_dispc: |
247 | dss_runtime_put(); | ||
248 | err_get_dss: | ||
249 | if (cpu_is_omap34xx()) | 243 | if (cpu_is_omap34xx()) |
250 | regulator_disable(dpi.vdds_dsi_reg); | 244 | regulator_disable(dpi.vdds_dsi_reg); |
251 | err_reg_enable: | 245 | err_reg_enable: |
@@ -266,7 +260,6 @@ void omapdss_dpi_display_disable(struct omap_dss_device *dssdev) | |||
266 | } | 260 | } |
267 | 261 | ||
268 | dispc_runtime_put(); | 262 | dispc_runtime_put(); |
269 | dss_runtime_put(); | ||
270 | 263 | ||
271 | if (cpu_is_omap34xx()) | 264 | if (cpu_is_omap34xx()) |
272 | regulator_disable(dpi.vdds_dsi_reg); | 265 | regulator_disable(dpi.vdds_dsi_reg); |
@@ -283,21 +276,15 @@ void dpi_set_timings(struct omap_dss_device *dssdev, | |||
283 | DSSDBG("dpi_set_timings\n"); | 276 | DSSDBG("dpi_set_timings\n"); |
284 | dssdev->panel.timings = *timings; | 277 | dssdev->panel.timings = *timings; |
285 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { | 278 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { |
286 | r = dss_runtime_get(); | ||
287 | if (r) | ||
288 | return; | ||
289 | |||
290 | r = dispc_runtime_get(); | 279 | r = dispc_runtime_get(); |
291 | if (r) { | 280 | if (r) |
292 | dss_runtime_put(); | ||
293 | return; | 281 | return; |
294 | } | ||
295 | 282 | ||
296 | dpi_set_mode(dssdev); | 283 | dpi_set_mode(dssdev); |
297 | dispc_mgr_go(dssdev->manager->id); | ||
298 | 284 | ||
299 | dispc_runtime_put(); | 285 | dispc_runtime_put(); |
300 | dss_runtime_put(); | 286 | } else { |
287 | dss_mgr_set_timings(dssdev->manager, timings); | ||
301 | } | 288 | } |
302 | } | 289 | } |
303 | EXPORT_SYMBOL(dpi_set_timings); | 290 | EXPORT_SYMBOL(dpi_set_timings); |
@@ -312,7 +299,7 @@ int dpi_check_timings(struct omap_dss_device *dssdev, | |||
312 | unsigned long pck; | 299 | unsigned long pck; |
313 | struct dispc_clock_info dispc_cinfo; | 300 | struct dispc_clock_info dispc_cinfo; |
314 | 301 | ||
315 | if (!dispc_lcd_timings_ok(timings)) | 302 | if (dss_mgr_check_timings(dssdev->manager, timings)) |
316 | return -EINVAL; | 303 | return -EINVAL; |
317 | 304 | ||
318 | if (timings->pixel_clock == 0) | 305 | if (timings->pixel_clock == 0) |
@@ -352,7 +339,7 @@ int dpi_check_timings(struct omap_dss_device *dssdev, | |||
352 | } | 339 | } |
353 | EXPORT_SYMBOL(dpi_check_timings); | 340 | EXPORT_SYMBOL(dpi_check_timings); |
354 | 341 | ||
355 | int dpi_init_display(struct omap_dss_device *dssdev) | 342 | static int __init dpi_init_display(struct omap_dss_device *dssdev) |
356 | { | 343 | { |
357 | DSSDBG("init_display\n"); | 344 | DSSDBG("init_display\n"); |
358 | 345 | ||
@@ -378,12 +365,58 @@ int dpi_init_display(struct omap_dss_device *dssdev) | |||
378 | return 0; | 365 | return 0; |
379 | } | 366 | } |
380 | 367 | ||
381 | int dpi_init(void) | 368 | static void __init dpi_probe_pdata(struct platform_device *pdev) |
382 | { | 369 | { |
370 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
371 | int i, r; | ||
372 | |||
373 | for (i = 0; i < pdata->num_devices; ++i) { | ||
374 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
375 | |||
376 | if (dssdev->type != OMAP_DISPLAY_TYPE_DPI) | ||
377 | continue; | ||
378 | |||
379 | r = dpi_init_display(dssdev); | ||
380 | if (r) { | ||
381 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
382 | continue; | ||
383 | } | ||
384 | |||
385 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
386 | if (r) | ||
387 | DSSERR("device %s register failed: %d\n", | ||
388 | dssdev->name, r); | ||
389 | } | ||
390 | } | ||
391 | |||
392 | static int __init omap_dpi_probe(struct platform_device *pdev) | ||
393 | { | ||
394 | dpi_probe_pdata(pdev); | ||
395 | |||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | static int __exit omap_dpi_remove(struct platform_device *pdev) | ||
400 | { | ||
401 | omap_dss_unregister_child_devices(&pdev->dev); | ||
402 | |||
383 | return 0; | 403 | return 0; |
384 | } | 404 | } |
385 | 405 | ||
386 | void dpi_exit(void) | 406 | static struct platform_driver omap_dpi_driver = { |
407 | .remove = __exit_p(omap_dpi_remove), | ||
408 | .driver = { | ||
409 | .name = "omapdss_dpi", | ||
410 | .owner = THIS_MODULE, | ||
411 | }, | ||
412 | }; | ||
413 | |||
414 | int __init dpi_init_platform_driver(void) | ||
387 | { | 415 | { |
416 | return platform_driver_probe(&omap_dpi_driver, omap_dpi_probe); | ||
388 | } | 417 | } |
389 | 418 | ||
419 | void __exit dpi_uninit_platform_driver(void) | ||
420 | { | ||
421 | platform_driver_unregister(&omap_dpi_driver); | ||
422 | } | ||
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 662d14f8c2c3..ec363d8390ed 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -256,14 +256,13 @@ struct dsi_data { | |||
256 | struct platform_device *pdev; | 256 | struct platform_device *pdev; |
257 | void __iomem *base; | 257 | void __iomem *base; |
258 | 258 | ||
259 | int module_id; | ||
260 | |||
259 | int irq; | 261 | int irq; |
260 | 262 | ||
261 | struct clk *dss_clk; | 263 | struct clk *dss_clk; |
262 | struct clk *sys_clk; | 264 | struct clk *sys_clk; |
263 | 265 | ||
264 | int (*enable_pads)(int dsi_id, unsigned lane_mask); | ||
265 | void (*disable_pads)(int dsi_id, unsigned lane_mask); | ||
266 | |||
267 | struct dsi_clock_info current_cinfo; | 266 | struct dsi_clock_info current_cinfo; |
268 | 267 | ||
269 | bool vdds_dsi_enabled; | 268 | bool vdds_dsi_enabled; |
@@ -361,11 +360,6 @@ struct platform_device *dsi_get_dsidev_from_id(int module) | |||
361 | return dsi_pdev_map[module]; | 360 | return dsi_pdev_map[module]; |
362 | } | 361 | } |
363 | 362 | ||
364 | static inline int dsi_get_dsidev_id(struct platform_device *dsidev) | ||
365 | { | ||
366 | return dsidev->id; | ||
367 | } | ||
368 | |||
369 | static inline void dsi_write_reg(struct platform_device *dsidev, | 363 | static inline void dsi_write_reg(struct platform_device *dsidev, |
370 | const struct dsi_reg idx, u32 val) | 364 | const struct dsi_reg idx, u32 val) |
371 | { | 365 | { |
@@ -452,6 +446,7 @@ u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt) | |||
452 | return 16; | 446 | return 16; |
453 | default: | 447 | default: |
454 | BUG(); | 448 | BUG(); |
449 | return 0; | ||
455 | } | 450 | } |
456 | } | 451 | } |
457 | 452 | ||
@@ -1184,10 +1179,9 @@ static unsigned long dsi_get_txbyteclkhs(struct platform_device *dsidev) | |||
1184 | static unsigned long dsi_fclk_rate(struct platform_device *dsidev) | 1179 | static unsigned long dsi_fclk_rate(struct platform_device *dsidev) |
1185 | { | 1180 | { |
1186 | unsigned long r; | 1181 | unsigned long r; |
1187 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
1188 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1182 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1189 | 1183 | ||
1190 | if (dss_get_dsi_clk_source(dsi_module) == OMAP_DSS_CLK_SRC_FCK) { | 1184 | if (dss_get_dsi_clk_source(dsi->module_id) == OMAP_DSS_CLK_SRC_FCK) { |
1191 | /* DSI FCLK source is DSS_CLK_FCK */ | 1185 | /* DSI FCLK source is DSS_CLK_FCK */ |
1192 | r = clk_get_rate(dsi->dss_clk); | 1186 | r = clk_get_rate(dsi->dss_clk); |
1193 | } else { | 1187 | } else { |
@@ -1279,10 +1273,9 @@ static int dsi_pll_power(struct platform_device *dsidev, | |||
1279 | } | 1273 | } |
1280 | 1274 | ||
1281 | /* calculate clock rates using dividers in cinfo */ | 1275 | /* calculate clock rates using dividers in cinfo */ |
1282 | static int dsi_calc_clock_rates(struct omap_dss_device *dssdev, | 1276 | static int dsi_calc_clock_rates(struct platform_device *dsidev, |
1283 | struct dsi_clock_info *cinfo) | 1277 | struct dsi_clock_info *cinfo) |
1284 | { | 1278 | { |
1285 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | ||
1286 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1279 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1287 | 1280 | ||
1288 | if (cinfo->regn == 0 || cinfo->regn > dsi->regn_max) | 1281 | if (cinfo->regn == 0 || cinfo->regn > dsi->regn_max) |
@@ -1297,21 +1290,8 @@ static int dsi_calc_clock_rates(struct omap_dss_device *dssdev, | |||
1297 | if (cinfo->regm_dsi > dsi->regm_dsi_max) | 1290 | if (cinfo->regm_dsi > dsi->regm_dsi_max) |
1298 | return -EINVAL; | 1291 | return -EINVAL; |
1299 | 1292 | ||
1300 | if (cinfo->use_sys_clk) { | 1293 | cinfo->clkin = clk_get_rate(dsi->sys_clk); |
1301 | cinfo->clkin = clk_get_rate(dsi->sys_clk); | 1294 | cinfo->fint = cinfo->clkin / cinfo->regn; |
1302 | /* XXX it is unclear if highfreq should be used | ||
1303 | * with DSS_SYS_CLK source also */ | ||
1304 | cinfo->highfreq = 0; | ||
1305 | } else { | ||
1306 | cinfo->clkin = dispc_mgr_pclk_rate(dssdev->manager->id); | ||
1307 | |||
1308 | if (cinfo->clkin < 32000000) | ||
1309 | cinfo->highfreq = 0; | ||
1310 | else | ||
1311 | cinfo->highfreq = 1; | ||
1312 | } | ||
1313 | |||
1314 | cinfo->fint = cinfo->clkin / (cinfo->regn * (cinfo->highfreq ? 2 : 1)); | ||
1315 | 1295 | ||
1316 | if (cinfo->fint > dsi->fint_max || cinfo->fint < dsi->fint_min) | 1296 | if (cinfo->fint > dsi->fint_max || cinfo->fint < dsi->fint_min) |
1317 | return -EINVAL; | 1297 | return -EINVAL; |
@@ -1378,27 +1358,21 @@ retry: | |||
1378 | 1358 | ||
1379 | memset(&cur, 0, sizeof(cur)); | 1359 | memset(&cur, 0, sizeof(cur)); |
1380 | cur.clkin = dss_sys_clk; | 1360 | cur.clkin = dss_sys_clk; |
1381 | cur.use_sys_clk = 1; | ||
1382 | cur.highfreq = 0; | ||
1383 | 1361 | ||
1384 | /* no highfreq: 0.75MHz < Fint = clkin / regn < 2.1MHz */ | 1362 | /* 0.75MHz < Fint = clkin / regn < 2.1MHz */ |
1385 | /* highfreq: 0.75MHz < Fint = clkin / (2*regn) < 2.1MHz */ | ||
1386 | /* To reduce PLL lock time, keep Fint high (around 2 MHz) */ | 1363 | /* To reduce PLL lock time, keep Fint high (around 2 MHz) */ |
1387 | for (cur.regn = 1; cur.regn < dsi->regn_max; ++cur.regn) { | 1364 | for (cur.regn = 1; cur.regn < dsi->regn_max; ++cur.regn) { |
1388 | if (cur.highfreq == 0) | 1365 | cur.fint = cur.clkin / cur.regn; |
1389 | cur.fint = cur.clkin / cur.regn; | ||
1390 | else | ||
1391 | cur.fint = cur.clkin / (2 * cur.regn); | ||
1392 | 1366 | ||
1393 | if (cur.fint > dsi->fint_max || cur.fint < dsi->fint_min) | 1367 | if (cur.fint > dsi->fint_max || cur.fint < dsi->fint_min) |
1394 | continue; | 1368 | continue; |
1395 | 1369 | ||
1396 | /* DSIPHY(MHz) = (2 * regm / regn) * (clkin / (highfreq + 1)) */ | 1370 | /* DSIPHY(MHz) = (2 * regm / regn) * clkin */ |
1397 | for (cur.regm = 1; cur.regm < dsi->regm_max; ++cur.regm) { | 1371 | for (cur.regm = 1; cur.regm < dsi->regm_max; ++cur.regm) { |
1398 | unsigned long a, b; | 1372 | unsigned long a, b; |
1399 | 1373 | ||
1400 | a = 2 * cur.regm * (cur.clkin/1000); | 1374 | a = 2 * cur.regm * (cur.clkin/1000); |
1401 | b = cur.regn * (cur.highfreq + 1); | 1375 | b = cur.regn; |
1402 | cur.clkin4ddr = a / b * 1000; | 1376 | cur.clkin4ddr = a / b * 1000; |
1403 | 1377 | ||
1404 | if (cur.clkin4ddr > 1800 * 1000 * 1000) | 1378 | if (cur.clkin4ddr > 1800 * 1000 * 1000) |
@@ -1486,9 +1460,7 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev, | |||
1486 | 1460 | ||
1487 | DSSDBGF(); | 1461 | DSSDBGF(); |
1488 | 1462 | ||
1489 | dsi->current_cinfo.use_sys_clk = cinfo->use_sys_clk; | 1463 | dsi->current_cinfo.clkin = cinfo->clkin; |
1490 | dsi->current_cinfo.highfreq = cinfo->highfreq; | ||
1491 | |||
1492 | dsi->current_cinfo.fint = cinfo->fint; | 1464 | dsi->current_cinfo.fint = cinfo->fint; |
1493 | dsi->current_cinfo.clkin4ddr = cinfo->clkin4ddr; | 1465 | dsi->current_cinfo.clkin4ddr = cinfo->clkin4ddr; |
1494 | dsi->current_cinfo.dsi_pll_hsdiv_dispc_clk = | 1466 | dsi->current_cinfo.dsi_pll_hsdiv_dispc_clk = |
@@ -1503,17 +1475,13 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev, | |||
1503 | 1475 | ||
1504 | DSSDBG("DSI Fint %ld\n", cinfo->fint); | 1476 | DSSDBG("DSI Fint %ld\n", cinfo->fint); |
1505 | 1477 | ||
1506 | DSSDBG("clkin (%s) rate %ld, highfreq %d\n", | 1478 | DSSDBG("clkin rate %ld\n", cinfo->clkin); |
1507 | cinfo->use_sys_clk ? "dss_sys_clk" : "pclkfree", | ||
1508 | cinfo->clkin, | ||
1509 | cinfo->highfreq); | ||
1510 | 1479 | ||
1511 | /* DSIPHY == CLKIN4DDR */ | 1480 | /* DSIPHY == CLKIN4DDR */ |
1512 | DSSDBG("CLKIN4DDR = 2 * %d / %d * %lu / %d = %lu\n", | 1481 | DSSDBG("CLKIN4DDR = 2 * %d / %d * %lu = %lu\n", |
1513 | cinfo->regm, | 1482 | cinfo->regm, |
1514 | cinfo->regn, | 1483 | cinfo->regn, |
1515 | cinfo->clkin, | 1484 | cinfo->clkin, |
1516 | cinfo->highfreq + 1, | ||
1517 | cinfo->clkin4ddr); | 1485 | cinfo->clkin4ddr); |
1518 | 1486 | ||
1519 | DSSDBG("Data rate on 1 DSI lane %ld Mbps\n", | 1487 | DSSDBG("Data rate on 1 DSI lane %ld Mbps\n", |
@@ -1568,10 +1536,6 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev, | |||
1568 | 1536 | ||
1569 | if (dss_has_feature(FEAT_DSI_PLL_FREQSEL)) | 1537 | if (dss_has_feature(FEAT_DSI_PLL_FREQSEL)) |
1570 | l = FLD_MOD(l, f, 4, 1); /* DSI_PLL_FREQSEL */ | 1538 | l = FLD_MOD(l, f, 4, 1); /* DSI_PLL_FREQSEL */ |
1571 | l = FLD_MOD(l, cinfo->use_sys_clk ? 0 : 1, | ||
1572 | 11, 11); /* DSI_PLL_CLKSEL */ | ||
1573 | l = FLD_MOD(l, cinfo->highfreq, | ||
1574 | 12, 12); /* DSI_PLL_HIGHFREQ */ | ||
1575 | l = FLD_MOD(l, 1, 13, 13); /* DSI_PLL_REFEN */ | 1539 | l = FLD_MOD(l, 1, 13, 13); /* DSI_PLL_REFEN */ |
1576 | l = FLD_MOD(l, 0, 14, 14); /* DSIPHY_CLKINEN */ | 1540 | l = FLD_MOD(l, 0, 14, 14); /* DSIPHY_CLKINEN */ |
1577 | l = FLD_MOD(l, 1, 20, 20); /* DSI_HSDIVBYPASS */ | 1541 | l = FLD_MOD(l, 1, 20, 20); /* DSI_HSDIVBYPASS */ |
@@ -1716,7 +1680,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device *dsidev, | |||
1716 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1680 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1717 | struct dsi_clock_info *cinfo = &dsi->current_cinfo; | 1681 | struct dsi_clock_info *cinfo = &dsi->current_cinfo; |
1718 | enum omap_dss_clk_source dispc_clk_src, dsi_clk_src; | 1682 | enum omap_dss_clk_source dispc_clk_src, dsi_clk_src; |
1719 | int dsi_module = dsi_get_dsidev_id(dsidev); | 1683 | int dsi_module = dsi->module_id; |
1720 | 1684 | ||
1721 | dispc_clk_src = dss_get_dispc_clk_source(); | 1685 | dispc_clk_src = dss_get_dispc_clk_source(); |
1722 | dsi_clk_src = dss_get_dsi_clk_source(dsi_module); | 1686 | dsi_clk_src = dss_get_dsi_clk_source(dsi_module); |
@@ -1726,8 +1690,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device *dsidev, | |||
1726 | 1690 | ||
1727 | seq_printf(s, "- DSI%d PLL -\n", dsi_module + 1); | 1691 | seq_printf(s, "- DSI%d PLL -\n", dsi_module + 1); |
1728 | 1692 | ||
1729 | seq_printf(s, "dsi pll source = %s\n", | 1693 | seq_printf(s, "dsi pll clkin\t%lu\n", cinfo->clkin); |
1730 | cinfo->use_sys_clk ? "dss_sys_clk" : "pclkfree"); | ||
1731 | 1694 | ||
1732 | seq_printf(s, "Fint\t\t%-16luregn %u\n", cinfo->fint, cinfo->regn); | 1695 | seq_printf(s, "Fint\t\t%-16luregn %u\n", cinfo->fint, cinfo->regn); |
1733 | 1696 | ||
@@ -1789,7 +1752,6 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, | |||
1789 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1752 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1790 | unsigned long flags; | 1753 | unsigned long flags; |
1791 | struct dsi_irq_stats stats; | 1754 | struct dsi_irq_stats stats; |
1792 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
1793 | 1755 | ||
1794 | spin_lock_irqsave(&dsi->irq_stats_lock, flags); | 1756 | spin_lock_irqsave(&dsi->irq_stats_lock, flags); |
1795 | 1757 | ||
@@ -1806,7 +1768,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, | |||
1806 | #define PIS(x) \ | 1768 | #define PIS(x) \ |
1807 | seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]); | 1769 | seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]); |
1808 | 1770 | ||
1809 | seq_printf(s, "-- DSI%d interrupts --\n", dsi_module + 1); | 1771 | seq_printf(s, "-- DSI%d interrupts --\n", dsi->module_id + 1); |
1810 | PIS(VC0); | 1772 | PIS(VC0); |
1811 | PIS(VC1); | 1773 | PIS(VC1); |
1812 | PIS(VC2); | 1774 | PIS(VC2); |
@@ -1886,22 +1848,6 @@ static void dsi2_dump_irqs(struct seq_file *s) | |||
1886 | 1848 | ||
1887 | dsi_dump_dsidev_irqs(dsidev, s); | 1849 | dsi_dump_dsidev_irqs(dsidev, s); |
1888 | } | 1850 | } |
1889 | |||
1890 | void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir, | ||
1891 | const struct file_operations *debug_fops) | ||
1892 | { | ||
1893 | struct platform_device *dsidev; | ||
1894 | |||
1895 | dsidev = dsi_get_dsidev_from_id(0); | ||
1896 | if (dsidev) | ||
1897 | debugfs_create_file("dsi1_irqs", S_IRUGO, debugfs_dir, | ||
1898 | &dsi1_dump_irqs, debug_fops); | ||
1899 | |||
1900 | dsidev = dsi_get_dsidev_from_id(1); | ||
1901 | if (dsidev) | ||
1902 | debugfs_create_file("dsi2_irqs", S_IRUGO, debugfs_dir, | ||
1903 | &dsi2_dump_irqs, debug_fops); | ||
1904 | } | ||
1905 | #endif | 1851 | #endif |
1906 | 1852 | ||
1907 | static void dsi_dump_dsidev_regs(struct platform_device *dsidev, | 1853 | static void dsi_dump_dsidev_regs(struct platform_device *dsidev, |
@@ -2002,21 +1948,6 @@ static void dsi2_dump_regs(struct seq_file *s) | |||
2002 | dsi_dump_dsidev_regs(dsidev, s); | 1948 | dsi_dump_dsidev_regs(dsidev, s); |
2003 | } | 1949 | } |
2004 | 1950 | ||
2005 | void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir, | ||
2006 | const struct file_operations *debug_fops) | ||
2007 | { | ||
2008 | struct platform_device *dsidev; | ||
2009 | |||
2010 | dsidev = dsi_get_dsidev_from_id(0); | ||
2011 | if (dsidev) | ||
2012 | debugfs_create_file("dsi1_regs", S_IRUGO, debugfs_dir, | ||
2013 | &dsi1_dump_regs, debug_fops); | ||
2014 | |||
2015 | dsidev = dsi_get_dsidev_from_id(1); | ||
2016 | if (dsidev) | ||
2017 | debugfs_create_file("dsi2_regs", S_IRUGO, debugfs_dir, | ||
2018 | &dsi2_dump_regs, debug_fops); | ||
2019 | } | ||
2020 | enum dsi_cio_power_state { | 1951 | enum dsi_cio_power_state { |
2021 | DSI_COMPLEXIO_POWER_OFF = 0x0, | 1952 | DSI_COMPLEXIO_POWER_OFF = 0x0, |
2022 | DSI_COMPLEXIO_POWER_ON = 0x1, | 1953 | DSI_COMPLEXIO_POWER_ON = 0x1, |
@@ -2073,68 +2004,10 @@ static unsigned dsi_get_line_buf_size(struct platform_device *dsidev) | |||
2073 | return 1365 * 3; /* 1365x24 bits */ | 2004 | return 1365 * 3; /* 1365x24 bits */ |
2074 | default: | 2005 | default: |
2075 | BUG(); | 2006 | BUG(); |
2007 | return 0; | ||
2076 | } | 2008 | } |
2077 | } | 2009 | } |
2078 | 2010 | ||
2079 | static int dsi_parse_lane_config(struct omap_dss_device *dssdev) | ||
2080 | { | ||
2081 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | ||
2082 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | ||
2083 | u8 lanes[DSI_MAX_NR_LANES]; | ||
2084 | u8 polarities[DSI_MAX_NR_LANES]; | ||
2085 | int num_lanes, i; | ||
2086 | |||
2087 | static const enum dsi_lane_function functions[] = { | ||
2088 | DSI_LANE_CLK, | ||
2089 | DSI_LANE_DATA1, | ||
2090 | DSI_LANE_DATA2, | ||
2091 | DSI_LANE_DATA3, | ||
2092 | DSI_LANE_DATA4, | ||
2093 | }; | ||
2094 | |||
2095 | lanes[0] = dssdev->phy.dsi.clk_lane; | ||
2096 | lanes[1] = dssdev->phy.dsi.data1_lane; | ||
2097 | lanes[2] = dssdev->phy.dsi.data2_lane; | ||
2098 | lanes[3] = dssdev->phy.dsi.data3_lane; | ||
2099 | lanes[4] = dssdev->phy.dsi.data4_lane; | ||
2100 | polarities[0] = dssdev->phy.dsi.clk_pol; | ||
2101 | polarities[1] = dssdev->phy.dsi.data1_pol; | ||
2102 | polarities[2] = dssdev->phy.dsi.data2_pol; | ||
2103 | polarities[3] = dssdev->phy.dsi.data3_pol; | ||
2104 | polarities[4] = dssdev->phy.dsi.data4_pol; | ||
2105 | |||
2106 | num_lanes = 0; | ||
2107 | |||
2108 | for (i = 0; i < dsi->num_lanes_supported; ++i) | ||
2109 | dsi->lanes[i].function = DSI_LANE_UNUSED; | ||
2110 | |||
2111 | for (i = 0; i < dsi->num_lanes_supported; ++i) { | ||
2112 | int num; | ||
2113 | |||
2114 | if (lanes[i] == DSI_LANE_UNUSED) | ||
2115 | break; | ||
2116 | |||
2117 | num = lanes[i] - 1; | ||
2118 | |||
2119 | if (num >= dsi->num_lanes_supported) | ||
2120 | return -EINVAL; | ||
2121 | |||
2122 | if (dsi->lanes[num].function != DSI_LANE_UNUSED) | ||
2123 | return -EINVAL; | ||
2124 | |||
2125 | dsi->lanes[num].function = functions[i]; | ||
2126 | dsi->lanes[num].polarity = polarities[i]; | ||
2127 | num_lanes++; | ||
2128 | } | ||
2129 | |||
2130 | if (num_lanes < 2 || num_lanes > dsi->num_lanes_supported) | ||
2131 | return -EINVAL; | ||
2132 | |||
2133 | dsi->num_lanes_used = num_lanes; | ||
2134 | |||
2135 | return 0; | ||
2136 | } | ||
2137 | |||
2138 | static int dsi_set_lane_config(struct omap_dss_device *dssdev) | 2011 | static int dsi_set_lane_config(struct omap_dss_device *dssdev) |
2139 | { | 2012 | { |
2140 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 2013 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
@@ -2396,7 +2269,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev) | |||
2396 | 2269 | ||
2397 | DSSDBGF(); | 2270 | DSSDBGF(); |
2398 | 2271 | ||
2399 | r = dsi->enable_pads(dsidev->id, dsi_get_lane_mask(dssdev)); | 2272 | r = dss_dsi_enable_pads(dsi->module_id, dsi_get_lane_mask(dssdev)); |
2400 | if (r) | 2273 | if (r) |
2401 | return r; | 2274 | return r; |
2402 | 2275 | ||
@@ -2506,7 +2379,7 @@ err_cio_pwr: | |||
2506 | dsi_cio_disable_lane_override(dsidev); | 2379 | dsi_cio_disable_lane_override(dsidev); |
2507 | err_scp_clk_dom: | 2380 | err_scp_clk_dom: |
2508 | dsi_disable_scp_clk(dsidev); | 2381 | dsi_disable_scp_clk(dsidev); |
2509 | dsi->disable_pads(dsidev->id, dsi_get_lane_mask(dssdev)); | 2382 | dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dssdev)); |
2510 | return r; | 2383 | return r; |
2511 | } | 2384 | } |
2512 | 2385 | ||
@@ -2520,7 +2393,7 @@ static void dsi_cio_uninit(struct omap_dss_device *dssdev) | |||
2520 | 2393 | ||
2521 | dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); | 2394 | dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); |
2522 | dsi_disable_scp_clk(dsidev); | 2395 | dsi_disable_scp_clk(dsidev); |
2523 | dsi->disable_pads(dsidev->id, dsi_get_lane_mask(dssdev)); | 2396 | dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dssdev)); |
2524 | } | 2397 | } |
2525 | 2398 | ||
2526 | static void dsi_config_tx_fifo(struct platform_device *dsidev, | 2399 | static void dsi_config_tx_fifo(struct platform_device *dsidev, |
@@ -2544,6 +2417,7 @@ static void dsi_config_tx_fifo(struct platform_device *dsidev, | |||
2544 | if (add + size > 4) { | 2417 | if (add + size > 4) { |
2545 | DSSERR("Illegal FIFO configuration\n"); | 2418 | DSSERR("Illegal FIFO configuration\n"); |
2546 | BUG(); | 2419 | BUG(); |
2420 | return; | ||
2547 | } | 2421 | } |
2548 | 2422 | ||
2549 | v = FLD_VAL(add, 2, 0) | FLD_VAL(size, 7, 4); | 2423 | v = FLD_VAL(add, 2, 0) | FLD_VAL(size, 7, 4); |
@@ -2576,6 +2450,7 @@ static void dsi_config_rx_fifo(struct platform_device *dsidev, | |||
2576 | if (add + size > 4) { | 2450 | if (add + size > 4) { |
2577 | DSSERR("Illegal FIFO configuration\n"); | 2451 | DSSERR("Illegal FIFO configuration\n"); |
2578 | BUG(); | 2452 | BUG(); |
2453 | return; | ||
2579 | } | 2454 | } |
2580 | 2455 | ||
2581 | v = FLD_VAL(add, 2, 0) | FLD_VAL(size, 7, 4); | 2456 | v = FLD_VAL(add, 2, 0) | FLD_VAL(size, 7, 4); |
@@ -2717,6 +2592,7 @@ static int dsi_sync_vc(struct platform_device *dsidev, int channel) | |||
2717 | return dsi_sync_vc_l4(dsidev, channel); | 2592 | return dsi_sync_vc_l4(dsidev, channel); |
2718 | default: | 2593 | default: |
2719 | BUG(); | 2594 | BUG(); |
2595 | return -EINVAL; | ||
2720 | } | 2596 | } |
2721 | } | 2597 | } |
2722 | 2598 | ||
@@ -3285,6 +3161,7 @@ static int dsi_vc_generic_send_read_request(struct omap_dss_device *dssdev, | |||
3285 | data = reqdata[0] | (reqdata[1] << 8); | 3161 | data = reqdata[0] | (reqdata[1] << 8); |
3286 | } else { | 3162 | } else { |
3287 | BUG(); | 3163 | BUG(); |
3164 | return -EINVAL; | ||
3288 | } | 3165 | } |
3289 | 3166 | ||
3290 | r = dsi_vc_send_short(dsidev, channel, data_type, data, 0); | 3167 | r = dsi_vc_send_short(dsidev, channel, data_type, data, 0); |
@@ -3399,7 +3276,6 @@ static int dsi_vc_read_rx_fifo(struct platform_device *dsidev, int channel, | |||
3399 | goto err; | 3276 | goto err; |
3400 | } | 3277 | } |
3401 | 3278 | ||
3402 | BUG(); | ||
3403 | err: | 3279 | err: |
3404 | DSSERR("dsi_vc_read_rx_fifo(ch %d type %s) failed\n", channel, | 3280 | DSSERR("dsi_vc_read_rx_fifo(ch %d type %s) failed\n", channel, |
3405 | type == DSS_DSI_CONTENT_GENERIC ? "GENERIC" : "DCS"); | 3281 | type == DSS_DSI_CONTENT_GENERIC ? "GENERIC" : "DCS"); |
@@ -3794,6 +3670,186 @@ static void dsi_config_blanking_modes(struct omap_dss_device *dssdev) | |||
3794 | dsi_write_reg(dsidev, DSI_CTRL, r); | 3670 | dsi_write_reg(dsidev, DSI_CTRL, r); |
3795 | } | 3671 | } |
3796 | 3672 | ||
3673 | /* | ||
3674 | * According to section 'HS Command Mode Interleaving' in OMAP TRM, Scenario 3 | ||
3675 | * results in maximum transition time for data and clock lanes to enter and | ||
3676 | * exit HS mode. Hence, this is the scenario where the least amount of command | ||
3677 | * mode data can be interleaved. We program the minimum amount of TXBYTECLKHS | ||
3678 | * clock cycles that can be used to interleave command mode data in HS so that | ||
3679 | * all scenarios are satisfied. | ||
3680 | */ | ||
3681 | static int dsi_compute_interleave_hs(int blank, bool ddr_alwon, int enter_hs, | ||
3682 | int exit_hs, int exiths_clk, int ddr_pre, int ddr_post) | ||
3683 | { | ||
3684 | int transition; | ||
3685 | |||
3686 | /* | ||
3687 | * If DDR_CLK_ALWAYS_ON is set, we need to consider HS mode transition | ||
3688 | * time of data lanes only, if it isn't set, we need to consider HS | ||
3689 | * transition time of both data and clock lanes. HS transition time | ||
3690 | * of Scenario 3 is considered. | ||
3691 | */ | ||
3692 | if (ddr_alwon) { | ||
3693 | transition = enter_hs + exit_hs + max(enter_hs, 2) + 1; | ||
3694 | } else { | ||
3695 | int trans1, trans2; | ||
3696 | trans1 = ddr_pre + enter_hs + exit_hs + max(enter_hs, 2) + 1; | ||
3697 | trans2 = ddr_pre + enter_hs + exiths_clk + ddr_post + ddr_pre + | ||
3698 | enter_hs + 1; | ||
3699 | transition = max(trans1, trans2); | ||
3700 | } | ||
3701 | |||
3702 | return blank > transition ? blank - transition : 0; | ||
3703 | } | ||
3704 | |||
3705 | /* | ||
3706 | * According to section 'LP Command Mode Interleaving' in OMAP TRM, Scenario 1 | ||
3707 | * results in maximum transition time for data lanes to enter and exit LP mode. | ||
3708 | * Hence, this is the scenario where the least amount of command mode data can | ||
3709 | * be interleaved. We program the minimum amount of bytes that can be | ||
3710 | * interleaved in LP so that all scenarios are satisfied. | ||
3711 | */ | ||
3712 | static int dsi_compute_interleave_lp(int blank, int enter_hs, int exit_hs, | ||
3713 | int lp_clk_div, int tdsi_fclk) | ||
3714 | { | ||
3715 | int trans_lp; /* time required for a LP transition, in TXBYTECLKHS */ | ||
3716 | int tlp_avail; /* time left for interleaving commands, in CLKIN4DDR */ | ||
3717 | int ttxclkesc; /* period of LP transmit escape clock, in CLKIN4DDR */ | ||
3718 | int thsbyte_clk = 16; /* Period of TXBYTECLKHS clock, in CLKIN4DDR */ | ||
3719 | int lp_inter; /* cmd mode data that can be interleaved, in bytes */ | ||
3720 | |||
3721 | /* maximum LP transition time according to Scenario 1 */ | ||
3722 | trans_lp = exit_hs + max(enter_hs, 2) + 1; | ||
3723 | |||
3724 | /* CLKIN4DDR = 16 * TXBYTECLKHS */ | ||
3725 | tlp_avail = thsbyte_clk * (blank - trans_lp); | ||
3726 | |||
3727 | ttxclkesc = tdsi_fclk / lp_clk_div; | ||
3728 | |||
3729 | lp_inter = ((tlp_avail - 8 * thsbyte_clk - 5 * tdsi_fclk) / ttxclkesc - | ||
3730 | 26) / 16; | ||
3731 | |||
3732 | return max(lp_inter, 0); | ||
3733 | } | ||
3734 | |||
3735 | static void dsi_config_cmd_mode_interleaving(struct omap_dss_device *dssdev) | ||
3736 | { | ||
3737 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | ||
3738 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | ||
3739 | int blanking_mode; | ||
3740 | int hfp_blanking_mode, hbp_blanking_mode, hsa_blanking_mode; | ||
3741 | int hsa, hfp, hbp, width_bytes, bllp, lp_clk_div; | ||
3742 | int ddr_clk_pre, ddr_clk_post, enter_hs_mode_lat, exit_hs_mode_lat; | ||
3743 | int tclk_trail, ths_exit, exiths_clk; | ||
3744 | bool ddr_alwon; | ||
3745 | struct omap_video_timings *timings = &dssdev->panel.timings; | ||
3746 | int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); | ||
3747 | int ndl = dsi->num_lanes_used - 1; | ||
3748 | int dsi_fclk_hsdiv = dssdev->clocks.dsi.regm_dsi + 1; | ||
3749 | int hsa_interleave_hs = 0, hsa_interleave_lp = 0; | ||
3750 | int hfp_interleave_hs = 0, hfp_interleave_lp = 0; | ||
3751 | int hbp_interleave_hs = 0, hbp_interleave_lp = 0; | ||
3752 | int bl_interleave_hs = 0, bl_interleave_lp = 0; | ||
3753 | u32 r; | ||
3754 | |||
3755 | r = dsi_read_reg(dsidev, DSI_CTRL); | ||
3756 | blanking_mode = FLD_GET(r, 20, 20); | ||
3757 | hfp_blanking_mode = FLD_GET(r, 21, 21); | ||
3758 | hbp_blanking_mode = FLD_GET(r, 22, 22); | ||
3759 | hsa_blanking_mode = FLD_GET(r, 23, 23); | ||
3760 | |||
3761 | r = dsi_read_reg(dsidev, DSI_VM_TIMING1); | ||
3762 | hbp = FLD_GET(r, 11, 0); | ||
3763 | hfp = FLD_GET(r, 23, 12); | ||
3764 | hsa = FLD_GET(r, 31, 24); | ||
3765 | |||
3766 | r = dsi_read_reg(dsidev, DSI_CLK_TIMING); | ||
3767 | ddr_clk_post = FLD_GET(r, 7, 0); | ||
3768 | ddr_clk_pre = FLD_GET(r, 15, 8); | ||
3769 | |||
3770 | r = dsi_read_reg(dsidev, DSI_VM_TIMING7); | ||
3771 | exit_hs_mode_lat = FLD_GET(r, 15, 0); | ||
3772 | enter_hs_mode_lat = FLD_GET(r, 31, 16); | ||
3773 | |||
3774 | r = dsi_read_reg(dsidev, DSI_CLK_CTRL); | ||
3775 | lp_clk_div = FLD_GET(r, 12, 0); | ||
3776 | ddr_alwon = FLD_GET(r, 13, 13); | ||
3777 | |||
3778 | r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG0); | ||
3779 | ths_exit = FLD_GET(r, 7, 0); | ||
3780 | |||
3781 | r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG1); | ||
3782 | tclk_trail = FLD_GET(r, 15, 8); | ||
3783 | |||
3784 | exiths_clk = ths_exit + tclk_trail; | ||
3785 | |||
3786 | width_bytes = DIV_ROUND_UP(timings->x_res * bpp, 8); | ||
3787 | bllp = hbp + hfp + hsa + DIV_ROUND_UP(width_bytes + 6, ndl); | ||
3788 | |||
3789 | if (!hsa_blanking_mode) { | ||
3790 | hsa_interleave_hs = dsi_compute_interleave_hs(hsa, ddr_alwon, | ||
3791 | enter_hs_mode_lat, exit_hs_mode_lat, | ||
3792 | exiths_clk, ddr_clk_pre, ddr_clk_post); | ||
3793 | hsa_interleave_lp = dsi_compute_interleave_lp(hsa, | ||
3794 | enter_hs_mode_lat, exit_hs_mode_lat, | ||
3795 | lp_clk_div, dsi_fclk_hsdiv); | ||
3796 | } | ||
3797 | |||
3798 | if (!hfp_blanking_mode) { | ||
3799 | hfp_interleave_hs = dsi_compute_interleave_hs(hfp, ddr_alwon, | ||
3800 | enter_hs_mode_lat, exit_hs_mode_lat, | ||
3801 | exiths_clk, ddr_clk_pre, ddr_clk_post); | ||
3802 | hfp_interleave_lp = dsi_compute_interleave_lp(hfp, | ||
3803 | enter_hs_mode_lat, exit_hs_mode_lat, | ||
3804 | lp_clk_div, dsi_fclk_hsdiv); | ||
3805 | } | ||
3806 | |||
3807 | if (!hbp_blanking_mode) { | ||
3808 | hbp_interleave_hs = dsi_compute_interleave_hs(hbp, ddr_alwon, | ||
3809 | enter_hs_mode_lat, exit_hs_mode_lat, | ||
3810 | exiths_clk, ddr_clk_pre, ddr_clk_post); | ||
3811 | |||
3812 | hbp_interleave_lp = dsi_compute_interleave_lp(hbp, | ||
3813 | enter_hs_mode_lat, exit_hs_mode_lat, | ||
3814 | lp_clk_div, dsi_fclk_hsdiv); | ||
3815 | } | ||
3816 | |||
3817 | if (!blanking_mode) { | ||
3818 | bl_interleave_hs = dsi_compute_interleave_hs(bllp, ddr_alwon, | ||
3819 | enter_hs_mode_lat, exit_hs_mode_lat, | ||
3820 | exiths_clk, ddr_clk_pre, ddr_clk_post); | ||
3821 | |||
3822 | bl_interleave_lp = dsi_compute_interleave_lp(bllp, | ||
3823 | enter_hs_mode_lat, exit_hs_mode_lat, | ||
3824 | lp_clk_div, dsi_fclk_hsdiv); | ||
3825 | } | ||
3826 | |||
3827 | DSSDBG("DSI HS interleaving(TXBYTECLKHS) HSA %d, HFP %d, HBP %d, BLLP %d\n", | ||
3828 | hsa_interleave_hs, hfp_interleave_hs, hbp_interleave_hs, | ||
3829 | bl_interleave_hs); | ||
3830 | |||
3831 | DSSDBG("DSI LP interleaving(bytes) HSA %d, HFP %d, HBP %d, BLLP %d\n", | ||
3832 | hsa_interleave_lp, hfp_interleave_lp, hbp_interleave_lp, | ||
3833 | bl_interleave_lp); | ||
3834 | |||
3835 | r = dsi_read_reg(dsidev, DSI_VM_TIMING4); | ||
3836 | r = FLD_MOD(r, hsa_interleave_hs, 23, 16); | ||
3837 | r = FLD_MOD(r, hfp_interleave_hs, 15, 8); | ||
3838 | r = FLD_MOD(r, hbp_interleave_hs, 7, 0); | ||
3839 | dsi_write_reg(dsidev, DSI_VM_TIMING4, r); | ||
3840 | |||
3841 | r = dsi_read_reg(dsidev, DSI_VM_TIMING5); | ||
3842 | r = FLD_MOD(r, hsa_interleave_lp, 23, 16); | ||
3843 | r = FLD_MOD(r, hfp_interleave_lp, 15, 8); | ||
3844 | r = FLD_MOD(r, hbp_interleave_lp, 7, 0); | ||
3845 | dsi_write_reg(dsidev, DSI_VM_TIMING5, r); | ||
3846 | |||
3847 | r = dsi_read_reg(dsidev, DSI_VM_TIMING6); | ||
3848 | r = FLD_MOD(r, bl_interleave_hs, 31, 15); | ||
3849 | r = FLD_MOD(r, bl_interleave_lp, 16, 0); | ||
3850 | dsi_write_reg(dsidev, DSI_VM_TIMING6, r); | ||
3851 | } | ||
3852 | |||
3797 | static int dsi_proto_config(struct omap_dss_device *dssdev) | 3853 | static int dsi_proto_config(struct omap_dss_device *dssdev) |
3798 | { | 3854 | { |
3799 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 3855 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
@@ -3828,6 +3884,7 @@ static int dsi_proto_config(struct omap_dss_device *dssdev) | |||
3828 | break; | 3884 | break; |
3829 | default: | 3885 | default: |
3830 | BUG(); | 3886 | BUG(); |
3887 | return -EINVAL; | ||
3831 | } | 3888 | } |
3832 | 3889 | ||
3833 | r = dsi_read_reg(dsidev, DSI_CTRL); | 3890 | r = dsi_read_reg(dsidev, DSI_CTRL); |
@@ -3852,6 +3909,7 @@ static int dsi_proto_config(struct omap_dss_device *dssdev) | |||
3852 | if (dssdev->panel.dsi_mode == OMAP_DSS_DSI_VIDEO_MODE) { | 3909 | if (dssdev->panel.dsi_mode == OMAP_DSS_DSI_VIDEO_MODE) { |
3853 | dsi_config_vp_sync_events(dssdev); | 3910 | dsi_config_vp_sync_events(dssdev); |
3854 | dsi_config_blanking_modes(dssdev); | 3911 | dsi_config_blanking_modes(dssdev); |
3912 | dsi_config_cmd_mode_interleaving(dssdev); | ||
3855 | } | 3913 | } |
3856 | 3914 | ||
3857 | dsi_vc_initial_config(dsidev, 0); | 3915 | dsi_vc_initial_config(dsidev, 0); |
@@ -3975,6 +4033,74 @@ static void dsi_proto_timings(struct omap_dss_device *dssdev) | |||
3975 | } | 4033 | } |
3976 | } | 4034 | } |
3977 | 4035 | ||
4036 | int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev, | ||
4037 | const struct omap_dsi_pin_config *pin_cfg) | ||
4038 | { | ||
4039 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | ||
4040 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | ||
4041 | int num_pins; | ||
4042 | const int *pins; | ||
4043 | struct dsi_lane_config lanes[DSI_MAX_NR_LANES]; | ||
4044 | int num_lanes; | ||
4045 | int i; | ||
4046 | |||
4047 | static const enum dsi_lane_function functions[] = { | ||
4048 | DSI_LANE_CLK, | ||
4049 | DSI_LANE_DATA1, | ||
4050 | DSI_LANE_DATA2, | ||
4051 | DSI_LANE_DATA3, | ||
4052 | DSI_LANE_DATA4, | ||
4053 | }; | ||
4054 | |||
4055 | num_pins = pin_cfg->num_pins; | ||
4056 | pins = pin_cfg->pins; | ||
4057 | |||
4058 | if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2 | ||
4059 | || num_pins % 2 != 0) | ||
4060 | return -EINVAL; | ||
4061 | |||
4062 | for (i = 0; i < DSI_MAX_NR_LANES; ++i) | ||
4063 | lanes[i].function = DSI_LANE_UNUSED; | ||
4064 | |||
4065 | num_lanes = 0; | ||
4066 | |||
4067 | for (i = 0; i < num_pins; i += 2) { | ||
4068 | u8 lane, pol; | ||
4069 | int dx, dy; | ||
4070 | |||
4071 | dx = pins[i]; | ||
4072 | dy = pins[i + 1]; | ||
4073 | |||
4074 | if (dx < 0 || dx >= dsi->num_lanes_supported * 2) | ||
4075 | return -EINVAL; | ||
4076 | |||
4077 | if (dy < 0 || dy >= dsi->num_lanes_supported * 2) | ||
4078 | return -EINVAL; | ||
4079 | |||
4080 | if (dx & 1) { | ||
4081 | if (dy != dx - 1) | ||
4082 | return -EINVAL; | ||
4083 | pol = 1; | ||
4084 | } else { | ||
4085 | if (dy != dx + 1) | ||
4086 | return -EINVAL; | ||
4087 | pol = 0; | ||
4088 | } | ||
4089 | |||
4090 | lane = dx / 2; | ||
4091 | |||
4092 | lanes[lane].function = functions[i / 2]; | ||
4093 | lanes[lane].polarity = pol; | ||
4094 | num_lanes++; | ||
4095 | } | ||
4096 | |||
4097 | memcpy(dsi->lanes, lanes, sizeof(dsi->lanes)); | ||
4098 | dsi->num_lanes_used = num_lanes; | ||
4099 | |||
4100 | return 0; | ||
4101 | } | ||
4102 | EXPORT_SYMBOL(omapdss_dsi_configure_pins); | ||
4103 | |||
3978 | int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) | 4104 | int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) |
3979 | { | 4105 | { |
3980 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4106 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
@@ -3999,6 +4125,7 @@ int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) | |||
3999 | break; | 4125 | break; |
4000 | default: | 4126 | default: |
4001 | BUG(); | 4127 | BUG(); |
4128 | return -EINVAL; | ||
4002 | }; | 4129 | }; |
4003 | 4130 | ||
4004 | dsi_if_enable(dsidev, false); | 4131 | dsi_if_enable(dsidev, false); |
@@ -4183,10 +4310,6 @@ static void dsi_framedone_irq_callback(void *data, u32 mask) | |||
4183 | __cancel_delayed_work(&dsi->framedone_timeout_work); | 4310 | __cancel_delayed_work(&dsi->framedone_timeout_work); |
4184 | 4311 | ||
4185 | dsi_handle_framedone(dsidev, 0); | 4312 | dsi_handle_framedone(dsidev, 0); |
4186 | |||
4187 | #ifdef CONFIG_OMAP2_DSS_FAKE_VSYNC | ||
4188 | dispc_fake_vsync_irq(); | ||
4189 | #endif | ||
4190 | } | 4313 | } |
4191 | 4314 | ||
4192 | int omap_dsi_update(struct omap_dss_device *dssdev, int channel, | 4315 | int omap_dsi_update(struct omap_dss_device *dssdev, int channel, |
@@ -4250,13 +4373,12 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev) | |||
4250 | dispc_mgr_enable_stallmode(dssdev->manager->id, true); | 4373 | dispc_mgr_enable_stallmode(dssdev->manager->id, true); |
4251 | dispc_mgr_enable_fifohandcheck(dssdev->manager->id, 1); | 4374 | dispc_mgr_enable_fifohandcheck(dssdev->manager->id, 1); |
4252 | 4375 | ||
4253 | dispc_mgr_set_lcd_timings(dssdev->manager->id, &timings); | 4376 | dss_mgr_set_timings(dssdev->manager, &timings); |
4254 | } else { | 4377 | } else { |
4255 | dispc_mgr_enable_stallmode(dssdev->manager->id, false); | 4378 | dispc_mgr_enable_stallmode(dssdev->manager->id, false); |
4256 | dispc_mgr_enable_fifohandcheck(dssdev->manager->id, 0); | 4379 | dispc_mgr_enable_fifohandcheck(dssdev->manager->id, 0); |
4257 | 4380 | ||
4258 | dispc_mgr_set_lcd_timings(dssdev->manager->id, | 4381 | dss_mgr_set_timings(dssdev->manager, &dssdev->panel.timings); |
4259 | &dssdev->panel.timings); | ||
4260 | } | 4382 | } |
4261 | 4383 | ||
4262 | dispc_mgr_set_lcd_display_type(dssdev->manager->id, | 4384 | dispc_mgr_set_lcd_display_type(dssdev->manager->id, |
@@ -4285,13 +4407,11 @@ static int dsi_configure_dsi_clocks(struct omap_dss_device *dssdev) | |||
4285 | struct dsi_clock_info cinfo; | 4407 | struct dsi_clock_info cinfo; |
4286 | int r; | 4408 | int r; |
4287 | 4409 | ||
4288 | /* we always use DSS_CLK_SYSCK as input clock */ | ||
4289 | cinfo.use_sys_clk = true; | ||
4290 | cinfo.regn = dssdev->clocks.dsi.regn; | 4410 | cinfo.regn = dssdev->clocks.dsi.regn; |
4291 | cinfo.regm = dssdev->clocks.dsi.regm; | 4411 | cinfo.regm = dssdev->clocks.dsi.regm; |
4292 | cinfo.regm_dispc = dssdev->clocks.dsi.regm_dispc; | 4412 | cinfo.regm_dispc = dssdev->clocks.dsi.regm_dispc; |
4293 | cinfo.regm_dsi = dssdev->clocks.dsi.regm_dsi; | 4413 | cinfo.regm_dsi = dssdev->clocks.dsi.regm_dsi; |
4294 | r = dsi_calc_clock_rates(dssdev, &cinfo); | 4414 | r = dsi_calc_clock_rates(dsidev, &cinfo); |
4295 | if (r) { | 4415 | if (r) { |
4296 | DSSERR("Failed to calc dsi clocks\n"); | 4416 | DSSERR("Failed to calc dsi clocks\n"); |
4297 | return r; | 4417 | return r; |
@@ -4336,15 +4456,9 @@ static int dsi_configure_dispc_clocks(struct omap_dss_device *dssdev) | |||
4336 | static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | 4456 | static int dsi_display_init_dsi(struct omap_dss_device *dssdev) |
4337 | { | 4457 | { |
4338 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4458 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4339 | int dsi_module = dsi_get_dsidev_id(dsidev); | 4459 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
4340 | int r; | 4460 | int r; |
4341 | 4461 | ||
4342 | r = dsi_parse_lane_config(dssdev); | ||
4343 | if (r) { | ||
4344 | DSSERR("illegal lane config"); | ||
4345 | goto err0; | ||
4346 | } | ||
4347 | |||
4348 | r = dsi_pll_init(dsidev, true, true); | 4462 | r = dsi_pll_init(dsidev, true, true); |
4349 | if (r) | 4463 | if (r) |
4350 | goto err0; | 4464 | goto err0; |
@@ -4354,7 +4468,7 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | |||
4354 | goto err1; | 4468 | goto err1; |
4355 | 4469 | ||
4356 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); | 4470 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); |
4357 | dss_select_dsi_clk_source(dsi_module, dssdev->clocks.dsi.dsi_fclk_src); | 4471 | dss_select_dsi_clk_source(dsi->module_id, dssdev->clocks.dsi.dsi_fclk_src); |
4358 | dss_select_lcd_clk_source(dssdev->manager->id, | 4472 | dss_select_lcd_clk_source(dssdev->manager->id, |
4359 | dssdev->clocks.dispc.channel.lcd_clk_src); | 4473 | dssdev->clocks.dispc.channel.lcd_clk_src); |
4360 | 4474 | ||
@@ -4393,7 +4507,7 @@ err3: | |||
4393 | dsi_cio_uninit(dssdev); | 4507 | dsi_cio_uninit(dssdev); |
4394 | err2: | 4508 | err2: |
4395 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4509 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); |
4396 | dss_select_dsi_clk_source(dsi_module, OMAP_DSS_CLK_SRC_FCK); | 4510 | dss_select_dsi_clk_source(dsi->module_id, OMAP_DSS_CLK_SRC_FCK); |
4397 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); | 4511 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); |
4398 | 4512 | ||
4399 | err1: | 4513 | err1: |
@@ -4407,7 +4521,6 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev, | |||
4407 | { | 4521 | { |
4408 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4522 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4409 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 4523 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
4410 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
4411 | 4524 | ||
4412 | if (enter_ulps && !dsi->ulps_enabled) | 4525 | if (enter_ulps && !dsi->ulps_enabled) |
4413 | dsi_enter_ulps(dsidev); | 4526 | dsi_enter_ulps(dsidev); |
@@ -4420,7 +4533,7 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev, | |||
4420 | dsi_vc_enable(dsidev, 3, 0); | 4533 | dsi_vc_enable(dsidev, 3, 0); |
4421 | 4534 | ||
4422 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4535 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); |
4423 | dss_select_dsi_clk_source(dsi_module, OMAP_DSS_CLK_SRC_FCK); | 4536 | dss_select_dsi_clk_source(dsi->module_id, OMAP_DSS_CLK_SRC_FCK); |
4424 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); | 4537 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); |
4425 | dsi_cio_uninit(dssdev); | 4538 | dsi_cio_uninit(dssdev); |
4426 | dsi_pll_uninit(dsidev, disconnect_lanes); | 4539 | dsi_pll_uninit(dsidev, disconnect_lanes); |
@@ -4524,7 +4637,7 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) | |||
4524 | } | 4637 | } |
4525 | EXPORT_SYMBOL(omapdss_dsi_enable_te); | 4638 | EXPORT_SYMBOL(omapdss_dsi_enable_te); |
4526 | 4639 | ||
4527 | int dsi_init_display(struct omap_dss_device *dssdev) | 4640 | static int __init dsi_init_display(struct omap_dss_device *dssdev) |
4528 | { | 4641 | { |
4529 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4642 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4530 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 4643 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
@@ -4677,13 +4790,39 @@ static void dsi_put_clocks(struct platform_device *dsidev) | |||
4677 | clk_put(dsi->sys_clk); | 4790 | clk_put(dsi->sys_clk); |
4678 | } | 4791 | } |
4679 | 4792 | ||
4793 | static void __init dsi_probe_pdata(struct platform_device *dsidev) | ||
4794 | { | ||
4795 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | ||
4796 | struct omap_dss_board_info *pdata = dsidev->dev.platform_data; | ||
4797 | int i, r; | ||
4798 | |||
4799 | for (i = 0; i < pdata->num_devices; ++i) { | ||
4800 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
4801 | |||
4802 | if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) | ||
4803 | continue; | ||
4804 | |||
4805 | if (dssdev->phy.dsi.module != dsi->module_id) | ||
4806 | continue; | ||
4807 | |||
4808 | r = dsi_init_display(dssdev); | ||
4809 | if (r) { | ||
4810 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
4811 | continue; | ||
4812 | } | ||
4813 | |||
4814 | r = omap_dss_register_device(dssdev, &dsidev->dev, i); | ||
4815 | if (r) | ||
4816 | DSSERR("device %s register failed: %d\n", | ||
4817 | dssdev->name, r); | ||
4818 | } | ||
4819 | } | ||
4820 | |||
4680 | /* DSI1 HW IP initialisation */ | 4821 | /* DSI1 HW IP initialisation */ |
4681 | static int omap_dsihw_probe(struct platform_device *dsidev) | 4822 | static int __init omap_dsihw_probe(struct platform_device *dsidev) |
4682 | { | 4823 | { |
4683 | struct omap_display_platform_data *dss_plat_data; | ||
4684 | struct omap_dss_board_info *board_info; | ||
4685 | u32 rev; | 4824 | u32 rev; |
4686 | int r, i, dsi_module = dsi_get_dsidev_id(dsidev); | 4825 | int r, i; |
4687 | struct resource *dsi_mem; | 4826 | struct resource *dsi_mem; |
4688 | struct dsi_data *dsi; | 4827 | struct dsi_data *dsi; |
4689 | 4828 | ||
@@ -4691,15 +4830,11 @@ static int omap_dsihw_probe(struct platform_device *dsidev) | |||
4691 | if (!dsi) | 4830 | if (!dsi) |
4692 | return -ENOMEM; | 4831 | return -ENOMEM; |
4693 | 4832 | ||
4833 | dsi->module_id = dsidev->id; | ||
4694 | dsi->pdev = dsidev; | 4834 | dsi->pdev = dsidev; |
4695 | dsi_pdev_map[dsi_module] = dsidev; | 4835 | dsi_pdev_map[dsi->module_id] = dsidev; |
4696 | dev_set_drvdata(&dsidev->dev, dsi); | 4836 | dev_set_drvdata(&dsidev->dev, dsi); |
4697 | 4837 | ||
4698 | dss_plat_data = dsidev->dev.platform_data; | ||
4699 | board_info = dss_plat_data->board_data; | ||
4700 | dsi->enable_pads = board_info->dsi_enable_pads; | ||
4701 | dsi->disable_pads = board_info->dsi_disable_pads; | ||
4702 | |||
4703 | spin_lock_init(&dsi->irq_lock); | 4838 | spin_lock_init(&dsi->irq_lock); |
4704 | spin_lock_init(&dsi->errors_lock); | 4839 | spin_lock_init(&dsi->errors_lock); |
4705 | dsi->errors = 0; | 4840 | dsi->errors = 0; |
@@ -4777,8 +4912,21 @@ static int omap_dsihw_probe(struct platform_device *dsidev) | |||
4777 | else | 4912 | else |
4778 | dsi->num_lanes_supported = 3; | 4913 | dsi->num_lanes_supported = 3; |
4779 | 4914 | ||
4915 | dsi_probe_pdata(dsidev); | ||
4916 | |||
4780 | dsi_runtime_put(dsidev); | 4917 | dsi_runtime_put(dsidev); |
4781 | 4918 | ||
4919 | if (dsi->module_id == 0) | ||
4920 | dss_debugfs_create_file("dsi1_regs", dsi1_dump_regs); | ||
4921 | else if (dsi->module_id == 1) | ||
4922 | dss_debugfs_create_file("dsi2_regs", dsi2_dump_regs); | ||
4923 | |||
4924 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | ||
4925 | if (dsi->module_id == 0) | ||
4926 | dss_debugfs_create_file("dsi1_irqs", dsi1_dump_irqs); | ||
4927 | else if (dsi->module_id == 1) | ||
4928 | dss_debugfs_create_file("dsi2_irqs", dsi2_dump_irqs); | ||
4929 | #endif | ||
4782 | return 0; | 4930 | return 0; |
4783 | 4931 | ||
4784 | err_runtime_get: | 4932 | err_runtime_get: |
@@ -4787,12 +4935,14 @@ err_runtime_get: | |||
4787 | return r; | 4935 | return r; |
4788 | } | 4936 | } |
4789 | 4937 | ||
4790 | static int omap_dsihw_remove(struct platform_device *dsidev) | 4938 | static int __exit omap_dsihw_remove(struct platform_device *dsidev) |
4791 | { | 4939 | { |
4792 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 4940 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
4793 | 4941 | ||
4794 | WARN_ON(dsi->scp_clk_refcount > 0); | 4942 | WARN_ON(dsi->scp_clk_refcount > 0); |
4795 | 4943 | ||
4944 | omap_dss_unregister_child_devices(&dsidev->dev); | ||
4945 | |||
4796 | pm_runtime_disable(&dsidev->dev); | 4946 | pm_runtime_disable(&dsidev->dev); |
4797 | 4947 | ||
4798 | dsi_put_clocks(dsidev); | 4948 | dsi_put_clocks(dsidev); |
@@ -4813,7 +4963,6 @@ static int omap_dsihw_remove(struct platform_device *dsidev) | |||
4813 | static int dsi_runtime_suspend(struct device *dev) | 4963 | static int dsi_runtime_suspend(struct device *dev) |
4814 | { | 4964 | { |
4815 | dispc_runtime_put(); | 4965 | dispc_runtime_put(); |
4816 | dss_runtime_put(); | ||
4817 | 4966 | ||
4818 | return 0; | 4967 | return 0; |
4819 | } | 4968 | } |
@@ -4822,20 +4971,11 @@ static int dsi_runtime_resume(struct device *dev) | |||
4822 | { | 4971 | { |
4823 | int r; | 4972 | int r; |
4824 | 4973 | ||
4825 | r = dss_runtime_get(); | ||
4826 | if (r) | ||
4827 | goto err_get_dss; | ||
4828 | |||
4829 | r = dispc_runtime_get(); | 4974 | r = dispc_runtime_get(); |
4830 | if (r) | 4975 | if (r) |
4831 | goto err_get_dispc; | 4976 | return r; |
4832 | 4977 | ||
4833 | return 0; | 4978 | return 0; |
4834 | |||
4835 | err_get_dispc: | ||
4836 | dss_runtime_put(); | ||
4837 | err_get_dss: | ||
4838 | return r; | ||
4839 | } | 4979 | } |
4840 | 4980 | ||
4841 | static const struct dev_pm_ops dsi_pm_ops = { | 4981 | static const struct dev_pm_ops dsi_pm_ops = { |
@@ -4844,8 +4984,7 @@ static const struct dev_pm_ops dsi_pm_ops = { | |||
4844 | }; | 4984 | }; |
4845 | 4985 | ||
4846 | static struct platform_driver omap_dsihw_driver = { | 4986 | static struct platform_driver omap_dsihw_driver = { |
4847 | .probe = omap_dsihw_probe, | 4987 | .remove = __exit_p(omap_dsihw_remove), |
4848 | .remove = omap_dsihw_remove, | ||
4849 | .driver = { | 4988 | .driver = { |
4850 | .name = "omapdss_dsi", | 4989 | .name = "omapdss_dsi", |
4851 | .owner = THIS_MODULE, | 4990 | .owner = THIS_MODULE, |
@@ -4853,12 +4992,12 @@ static struct platform_driver omap_dsihw_driver = { | |||
4853 | }, | 4992 | }, |
4854 | }; | 4993 | }; |
4855 | 4994 | ||
4856 | int dsi_init_platform_driver(void) | 4995 | int __init dsi_init_platform_driver(void) |
4857 | { | 4996 | { |
4858 | return platform_driver_register(&omap_dsihw_driver); | 4997 | return platform_driver_probe(&omap_dsihw_driver, omap_dsihw_probe); |
4859 | } | 4998 | } |
4860 | 4999 | ||
4861 | void dsi_uninit_platform_driver(void) | 5000 | void __exit dsi_uninit_platform_driver(void) |
4862 | { | 5001 | { |
4863 | return platform_driver_unregister(&omap_dsihw_driver); | 5002 | platform_driver_unregister(&omap_dsihw_driver); |
4864 | } | 5003 | } |
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index bd2d5e159463..6ea1ff149f6f 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -62,6 +62,9 @@ struct dss_reg { | |||
62 | #define REG_FLD_MOD(idx, val, start, end) \ | 62 | #define REG_FLD_MOD(idx, val, start, end) \ |
63 | dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end)) | 63 | dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end)) |
64 | 64 | ||
65 | static int dss_runtime_get(void); | ||
66 | static void dss_runtime_put(void); | ||
67 | |||
65 | static struct { | 68 | static struct { |
66 | struct platform_device *pdev; | 69 | struct platform_device *pdev; |
67 | void __iomem *base; | 70 | void __iomem *base; |
@@ -277,7 +280,7 @@ void dss_dump_clocks(struct seq_file *s) | |||
277 | dss_runtime_put(); | 280 | dss_runtime_put(); |
278 | } | 281 | } |
279 | 282 | ||
280 | void dss_dump_regs(struct seq_file *s) | 283 | static void dss_dump_regs(struct seq_file *s) |
281 | { | 284 | { |
282 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r)) | 285 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r)) |
283 | 286 | ||
@@ -322,6 +325,7 @@ void dss_select_dispc_clk_source(enum omap_dss_clk_source clk_src) | |||
322 | break; | 325 | break; |
323 | default: | 326 | default: |
324 | BUG(); | 327 | BUG(); |
328 | return; | ||
325 | } | 329 | } |
326 | 330 | ||
327 | dss_feat_get_reg_field(FEAT_REG_DISPC_CLK_SWITCH, &start, &end); | 331 | dss_feat_get_reg_field(FEAT_REG_DISPC_CLK_SWITCH, &start, &end); |
@@ -335,7 +339,7 @@ void dss_select_dsi_clk_source(int dsi_module, | |||
335 | enum omap_dss_clk_source clk_src) | 339 | enum omap_dss_clk_source clk_src) |
336 | { | 340 | { |
337 | struct platform_device *dsidev; | 341 | struct platform_device *dsidev; |
338 | int b; | 342 | int b, pos; |
339 | 343 | ||
340 | switch (clk_src) { | 344 | switch (clk_src) { |
341 | case OMAP_DSS_CLK_SRC_FCK: | 345 | case OMAP_DSS_CLK_SRC_FCK: |
@@ -355,9 +359,11 @@ void dss_select_dsi_clk_source(int dsi_module, | |||
355 | break; | 359 | break; |
356 | default: | 360 | default: |
357 | BUG(); | 361 | BUG(); |
362 | return; | ||
358 | } | 363 | } |
359 | 364 | ||
360 | REG_FLD_MOD(DSS_CONTROL, b, 1, 1); /* DSI_CLK_SWITCH */ | 365 | pos = dsi_module == 0 ? 1 : 10; |
366 | REG_FLD_MOD(DSS_CONTROL, b, pos, pos); /* DSIx_CLK_SWITCH */ | ||
361 | 367 | ||
362 | dss.dsi_clk_source[dsi_module] = clk_src; | 368 | dss.dsi_clk_source[dsi_module] = clk_src; |
363 | } | 369 | } |
@@ -389,6 +395,7 @@ void dss_select_lcd_clk_source(enum omap_channel channel, | |||
389 | break; | 395 | break; |
390 | default: | 396 | default: |
391 | BUG(); | 397 | BUG(); |
398 | return; | ||
392 | } | 399 | } |
393 | 400 | ||
394 | pos = channel == OMAP_DSS_CHANNEL_LCD ? 0 : 12; | 401 | pos = channel == OMAP_DSS_CHANNEL_LCD ? 0 : 12; |
@@ -706,7 +713,7 @@ static void dss_put_clocks(void) | |||
706 | clk_put(dss.dss_clk); | 713 | clk_put(dss.dss_clk); |
707 | } | 714 | } |
708 | 715 | ||
709 | int dss_runtime_get(void) | 716 | static int dss_runtime_get(void) |
710 | { | 717 | { |
711 | int r; | 718 | int r; |
712 | 719 | ||
@@ -717,7 +724,7 @@ int dss_runtime_get(void) | |||
717 | return r < 0 ? r : 0; | 724 | return r < 0 ? r : 0; |
718 | } | 725 | } |
719 | 726 | ||
720 | void dss_runtime_put(void) | 727 | static void dss_runtime_put(void) |
721 | { | 728 | { |
722 | int r; | 729 | int r; |
723 | 730 | ||
@@ -740,7 +747,7 @@ void dss_debug_dump_clocks(struct seq_file *s) | |||
740 | #endif | 747 | #endif |
741 | 748 | ||
742 | /* DSS HW IP initialisation */ | 749 | /* DSS HW IP initialisation */ |
743 | static int omap_dsshw_probe(struct platform_device *pdev) | 750 | static int __init omap_dsshw_probe(struct platform_device *pdev) |
744 | { | 751 | { |
745 | struct resource *dss_mem; | 752 | struct resource *dss_mem; |
746 | u32 rev; | 753 | u32 rev; |
@@ -785,40 +792,24 @@ static int omap_dsshw_probe(struct platform_device *pdev) | |||
785 | dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK; | 792 | dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK; |
786 | dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK; | 793 | dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK; |
787 | 794 | ||
788 | r = dpi_init(); | ||
789 | if (r) { | ||
790 | DSSERR("Failed to initialize DPI\n"); | ||
791 | goto err_dpi; | ||
792 | } | ||
793 | |||
794 | r = sdi_init(); | ||
795 | if (r) { | ||
796 | DSSERR("Failed to initialize SDI\n"); | ||
797 | goto err_sdi; | ||
798 | } | ||
799 | |||
800 | rev = dss_read_reg(DSS_REVISION); | 795 | rev = dss_read_reg(DSS_REVISION); |
801 | printk(KERN_INFO "OMAP DSS rev %d.%d\n", | 796 | printk(KERN_INFO "OMAP DSS rev %d.%d\n", |
802 | FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); | 797 | FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); |
803 | 798 | ||
804 | dss_runtime_put(); | 799 | dss_runtime_put(); |
805 | 800 | ||
801 | dss_debugfs_create_file("dss", dss_dump_regs); | ||
802 | |||
806 | return 0; | 803 | return 0; |
807 | err_sdi: | 804 | |
808 | dpi_exit(); | ||
809 | err_dpi: | ||
810 | dss_runtime_put(); | ||
811 | err_runtime_get: | 805 | err_runtime_get: |
812 | pm_runtime_disable(&pdev->dev); | 806 | pm_runtime_disable(&pdev->dev); |
813 | dss_put_clocks(); | 807 | dss_put_clocks(); |
814 | return r; | 808 | return r; |
815 | } | 809 | } |
816 | 810 | ||
817 | static int omap_dsshw_remove(struct platform_device *pdev) | 811 | static int __exit omap_dsshw_remove(struct platform_device *pdev) |
818 | { | 812 | { |
819 | dpi_exit(); | ||
820 | sdi_exit(); | ||
821 | |||
822 | pm_runtime_disable(&pdev->dev); | 813 | pm_runtime_disable(&pdev->dev); |
823 | 814 | ||
824 | dss_put_clocks(); | 815 | dss_put_clocks(); |
@@ -829,11 +820,24 @@ static int omap_dsshw_remove(struct platform_device *pdev) | |||
829 | static int dss_runtime_suspend(struct device *dev) | 820 | static int dss_runtime_suspend(struct device *dev) |
830 | { | 821 | { |
831 | dss_save_context(); | 822 | dss_save_context(); |
823 | dss_set_min_bus_tput(dev, 0); | ||
832 | return 0; | 824 | return 0; |
833 | } | 825 | } |
834 | 826 | ||
835 | static int dss_runtime_resume(struct device *dev) | 827 | static int dss_runtime_resume(struct device *dev) |
836 | { | 828 | { |
829 | int r; | ||
830 | /* | ||
831 | * Set an arbitrarily high tput request to ensure OPP100. | ||
832 | * What we should really do is to make a request to stay in OPP100, | ||
833 | * without any tput requirements, but that is not currently possible | ||
834 | * via the PM layer. | ||
835 | */ | ||
836 | |||
837 | r = dss_set_min_bus_tput(dev, 1000000000); | ||
838 | if (r) | ||
839 | return r; | ||
840 | |||
837 | dss_restore_context(); | 841 | dss_restore_context(); |
838 | return 0; | 842 | return 0; |
839 | } | 843 | } |
@@ -844,8 +848,7 @@ static const struct dev_pm_ops dss_pm_ops = { | |||
844 | }; | 848 | }; |
845 | 849 | ||
846 | static struct platform_driver omap_dsshw_driver = { | 850 | static struct platform_driver omap_dsshw_driver = { |
847 | .probe = omap_dsshw_probe, | 851 | .remove = __exit_p(omap_dsshw_remove), |
848 | .remove = omap_dsshw_remove, | ||
849 | .driver = { | 852 | .driver = { |
850 | .name = "omapdss_dss", | 853 | .name = "omapdss_dss", |
851 | .owner = THIS_MODULE, | 854 | .owner = THIS_MODULE, |
@@ -853,12 +856,12 @@ static struct platform_driver omap_dsshw_driver = { | |||
853 | }, | 856 | }, |
854 | }; | 857 | }; |
855 | 858 | ||
856 | int dss_init_platform_driver(void) | 859 | int __init dss_init_platform_driver(void) |
857 | { | 860 | { |
858 | return platform_driver_register(&omap_dsshw_driver); | 861 | return platform_driver_probe(&omap_dsshw_driver, omap_dsshw_probe); |
859 | } | 862 | } |
860 | 863 | ||
861 | void dss_uninit_platform_driver(void) | 864 | void dss_uninit_platform_driver(void) |
862 | { | 865 | { |
863 | return platform_driver_unregister(&omap_dsshw_driver); | 866 | platform_driver_unregister(&omap_dsshw_driver); |
864 | } | 867 | } |
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index d4b3dff2ead3..dd1092ceaeef 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -150,9 +150,6 @@ struct dsi_clock_info { | |||
150 | u16 regm_dsi; /* OMAP3: REGM4 | 150 | u16 regm_dsi; /* OMAP3: REGM4 |
151 | * OMAP4: REGM5 */ | 151 | * OMAP4: REGM5 */ |
152 | u16 lp_clk_div; | 152 | u16 lp_clk_div; |
153 | |||
154 | u8 highfreq; | ||
155 | bool use_sys_clk; | ||
156 | }; | 153 | }; |
157 | 154 | ||
158 | struct seq_file; | 155 | struct seq_file; |
@@ -162,6 +159,16 @@ struct platform_device; | |||
162 | struct bus_type *dss_get_bus(void); | 159 | struct bus_type *dss_get_bus(void); |
163 | struct regulator *dss_get_vdds_dsi(void); | 160 | struct regulator *dss_get_vdds_dsi(void); |
164 | struct regulator *dss_get_vdds_sdi(void); | 161 | struct regulator *dss_get_vdds_sdi(void); |
162 | int dss_get_ctx_loss_count(struct device *dev); | ||
163 | int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask); | ||
164 | void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask); | ||
165 | int dss_set_min_bus_tput(struct device *dev, unsigned long tput); | ||
166 | int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)); | ||
167 | |||
168 | int omap_dss_register_device(struct omap_dss_device *dssdev, | ||
169 | struct device *parent, int disp_num); | ||
170 | void omap_dss_unregister_device(struct omap_dss_device *dssdev); | ||
171 | void omap_dss_unregister_child_devices(struct device *parent); | ||
165 | 172 | ||
166 | /* apply */ | 173 | /* apply */ |
167 | void dss_apply_init(void); | 174 | void dss_apply_init(void); |
@@ -179,6 +186,9 @@ void dss_mgr_get_info(struct omap_overlay_manager *mgr, | |||
179 | int dss_mgr_set_device(struct omap_overlay_manager *mgr, | 186 | int dss_mgr_set_device(struct omap_overlay_manager *mgr, |
180 | struct omap_dss_device *dssdev); | 187 | struct omap_dss_device *dssdev); |
181 | int dss_mgr_unset_device(struct omap_overlay_manager *mgr); | 188 | int dss_mgr_unset_device(struct omap_overlay_manager *mgr); |
189 | void dss_mgr_set_timings(struct omap_overlay_manager *mgr, | ||
190 | struct omap_video_timings *timings); | ||
191 | const struct omap_video_timings *dss_mgr_get_timings(struct omap_overlay_manager *mgr); | ||
182 | 192 | ||
183 | bool dss_ovl_is_enabled(struct omap_overlay *ovl); | 193 | bool dss_ovl_is_enabled(struct omap_overlay *ovl); |
184 | int dss_ovl_enable(struct omap_overlay *ovl); | 194 | int dss_ovl_enable(struct omap_overlay *ovl); |
@@ -208,9 +218,11 @@ int dss_init_overlay_managers(struct platform_device *pdev); | |||
208 | void dss_uninit_overlay_managers(struct platform_device *pdev); | 218 | void dss_uninit_overlay_managers(struct platform_device *pdev); |
209 | int dss_mgr_simple_check(struct omap_overlay_manager *mgr, | 219 | int dss_mgr_simple_check(struct omap_overlay_manager *mgr, |
210 | const struct omap_overlay_manager_info *info); | 220 | const struct omap_overlay_manager_info *info); |
221 | int dss_mgr_check_timings(struct omap_overlay_manager *mgr, | ||
222 | const struct omap_video_timings *timings); | ||
211 | int dss_mgr_check(struct omap_overlay_manager *mgr, | 223 | int dss_mgr_check(struct omap_overlay_manager *mgr, |
212 | struct omap_dss_device *dssdev, | ||
213 | struct omap_overlay_manager_info *info, | 224 | struct omap_overlay_manager_info *info, |
225 | const struct omap_video_timings *mgr_timings, | ||
214 | struct omap_overlay_info **overlay_infos); | 226 | struct omap_overlay_info **overlay_infos); |
215 | 227 | ||
216 | /* overlay */ | 228 | /* overlay */ |
@@ -220,22 +232,18 @@ void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr); | |||
220 | void dss_recheck_connections(struct omap_dss_device *dssdev, bool force); | 232 | void dss_recheck_connections(struct omap_dss_device *dssdev, bool force); |
221 | int dss_ovl_simple_check(struct omap_overlay *ovl, | 233 | int dss_ovl_simple_check(struct omap_overlay *ovl, |
222 | const struct omap_overlay_info *info); | 234 | const struct omap_overlay_info *info); |
223 | int dss_ovl_check(struct omap_overlay *ovl, | 235 | int dss_ovl_check(struct omap_overlay *ovl, struct omap_overlay_info *info, |
224 | struct omap_overlay_info *info, struct omap_dss_device *dssdev); | 236 | const struct omap_video_timings *mgr_timings); |
225 | 237 | ||
226 | /* DSS */ | 238 | /* DSS */ |
227 | int dss_init_platform_driver(void); | 239 | int dss_init_platform_driver(void) __init; |
228 | void dss_uninit_platform_driver(void); | 240 | void dss_uninit_platform_driver(void); |
229 | 241 | ||
230 | int dss_runtime_get(void); | ||
231 | void dss_runtime_put(void); | ||
232 | |||
233 | void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); | 242 | void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); |
234 | enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); | 243 | enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); |
235 | const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); | 244 | const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); |
236 | void dss_dump_clocks(struct seq_file *s); | 245 | void dss_dump_clocks(struct seq_file *s); |
237 | 246 | ||
238 | void dss_dump_regs(struct seq_file *s); | ||
239 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) | 247 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) |
240 | void dss_debug_dump_clocks(struct seq_file *s); | 248 | void dss_debug_dump_clocks(struct seq_file *s); |
241 | #endif | 249 | #endif |
@@ -265,19 +273,8 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck, | |||
265 | struct dispc_clock_info *dispc_cinfo); | 273 | struct dispc_clock_info *dispc_cinfo); |
266 | 274 | ||
267 | /* SDI */ | 275 | /* SDI */ |
268 | #ifdef CONFIG_OMAP2_DSS_SDI | 276 | int sdi_init_platform_driver(void) __init; |
269 | int sdi_init(void); | 277 | void sdi_uninit_platform_driver(void) __exit; |
270 | void sdi_exit(void); | ||
271 | int sdi_init_display(struct omap_dss_device *display); | ||
272 | #else | ||
273 | static inline int sdi_init(void) | ||
274 | { | ||
275 | return 0; | ||
276 | } | ||
277 | static inline void sdi_exit(void) | ||
278 | { | ||
279 | } | ||
280 | #endif | ||
281 | 278 | ||
282 | /* DSI */ | 279 | /* DSI */ |
283 | #ifdef CONFIG_OMAP2_DSS_DSI | 280 | #ifdef CONFIG_OMAP2_DSS_DSI |
@@ -285,19 +282,14 @@ static inline void sdi_exit(void) | |||
285 | struct dentry; | 282 | struct dentry; |
286 | struct file_operations; | 283 | struct file_operations; |
287 | 284 | ||
288 | int dsi_init_platform_driver(void); | 285 | int dsi_init_platform_driver(void) __init; |
289 | void dsi_uninit_platform_driver(void); | 286 | void dsi_uninit_platform_driver(void) __exit; |
290 | 287 | ||
291 | int dsi_runtime_get(struct platform_device *dsidev); | 288 | int dsi_runtime_get(struct platform_device *dsidev); |
292 | void dsi_runtime_put(struct platform_device *dsidev); | 289 | void dsi_runtime_put(struct platform_device *dsidev); |
293 | 290 | ||
294 | void dsi_dump_clocks(struct seq_file *s); | 291 | void dsi_dump_clocks(struct seq_file *s); |
295 | void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir, | ||
296 | const struct file_operations *debug_fops); | ||
297 | void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir, | ||
298 | const struct file_operations *debug_fops); | ||
299 | 292 | ||
300 | int dsi_init_display(struct omap_dss_device *display); | ||
301 | void dsi_irq_handler(void); | 293 | void dsi_irq_handler(void); |
302 | u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt); | 294 | u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt); |
303 | 295 | ||
@@ -314,13 +306,6 @@ void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev); | |||
314 | void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev); | 306 | void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev); |
315 | struct platform_device *dsi_get_dsidev_from_id(int module); | 307 | struct platform_device *dsi_get_dsidev_from_id(int module); |
316 | #else | 308 | #else |
317 | static inline int dsi_init_platform_driver(void) | ||
318 | { | ||
319 | return 0; | ||
320 | } | ||
321 | static inline void dsi_uninit_platform_driver(void) | ||
322 | { | ||
323 | } | ||
324 | static inline int dsi_runtime_get(struct platform_device *dsidev) | 309 | static inline int dsi_runtime_get(struct platform_device *dsidev) |
325 | { | 310 | { |
326 | return 0; | 311 | return 0; |
@@ -377,28 +362,14 @@ static inline struct platform_device *dsi_get_dsidev_from_id(int module) | |||
377 | #endif | 362 | #endif |
378 | 363 | ||
379 | /* DPI */ | 364 | /* DPI */ |
380 | #ifdef CONFIG_OMAP2_DSS_DPI | 365 | int dpi_init_platform_driver(void) __init; |
381 | int dpi_init(void); | 366 | void dpi_uninit_platform_driver(void) __exit; |
382 | void dpi_exit(void); | ||
383 | int dpi_init_display(struct omap_dss_device *dssdev); | ||
384 | #else | ||
385 | static inline int dpi_init(void) | ||
386 | { | ||
387 | return 0; | ||
388 | } | ||
389 | static inline void dpi_exit(void) | ||
390 | { | ||
391 | } | ||
392 | #endif | ||
393 | 367 | ||
394 | /* DISPC */ | 368 | /* DISPC */ |
395 | int dispc_init_platform_driver(void); | 369 | int dispc_init_platform_driver(void) __init; |
396 | void dispc_uninit_platform_driver(void); | 370 | void dispc_uninit_platform_driver(void) __exit; |
397 | void dispc_dump_clocks(struct seq_file *s); | 371 | void dispc_dump_clocks(struct seq_file *s); |
398 | void dispc_dump_irqs(struct seq_file *s); | ||
399 | void dispc_dump_regs(struct seq_file *s); | ||
400 | void dispc_irq_handler(void); | 372 | void dispc_irq_handler(void); |
401 | void dispc_fake_vsync_irq(void); | ||
402 | 373 | ||
403 | int dispc_runtime_get(void); | 374 | int dispc_runtime_get(void); |
404 | void dispc_runtime_put(void); | 375 | void dispc_runtime_put(void); |
@@ -409,12 +380,12 @@ void dispc_disable_sidle(void); | |||
409 | void dispc_lcd_enable_signal_polarity(bool act_high); | 380 | void dispc_lcd_enable_signal_polarity(bool act_high); |
410 | void dispc_lcd_enable_signal(bool enable); | 381 | void dispc_lcd_enable_signal(bool enable); |
411 | void dispc_pck_free_enable(bool enable); | 382 | void dispc_pck_free_enable(bool enable); |
412 | void dispc_set_digit_size(u16 width, u16 height); | ||
413 | void dispc_enable_fifomerge(bool enable); | 383 | void dispc_enable_fifomerge(bool enable); |
414 | void dispc_enable_gamma_table(bool enable); | 384 | void dispc_enable_gamma_table(bool enable); |
415 | void dispc_set_loadmode(enum omap_dss_load_mode mode); | 385 | void dispc_set_loadmode(enum omap_dss_load_mode mode); |
416 | 386 | ||
417 | bool dispc_lcd_timings_ok(struct omap_video_timings *timings); | 387 | bool dispc_mgr_timings_ok(enum omap_channel channel, |
388 | const struct omap_video_timings *timings); | ||
418 | unsigned long dispc_fclk_rate(void); | 389 | unsigned long dispc_fclk_rate(void); |
419 | void dispc_find_clk_divs(bool is_tft, unsigned long req_pck, unsigned long fck, | 390 | void dispc_find_clk_divs(bool is_tft, unsigned long req_pck, unsigned long fck, |
420 | struct dispc_clock_info *cinfo); | 391 | struct dispc_clock_info *cinfo); |
@@ -424,15 +395,16 @@ int dispc_calc_clock_rates(unsigned long dispc_fclk_rate, | |||
424 | 395 | ||
425 | void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high); | 396 | void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high); |
426 | void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane, | 397 | void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane, |
427 | u32 *fifo_low, u32 *fifo_high, bool use_fifomerge); | 398 | u32 *fifo_low, u32 *fifo_high, bool use_fifomerge, |
399 | bool manual_update); | ||
428 | int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, | 400 | int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, |
429 | bool ilace, bool replication); | 401 | bool ilace, bool replication, |
402 | const struct omap_video_timings *mgr_timings); | ||
430 | int dispc_ovl_enable(enum omap_plane plane, bool enable); | 403 | int dispc_ovl_enable(enum omap_plane plane, bool enable); |
431 | void dispc_ovl_set_channel_out(enum omap_plane plane, | 404 | void dispc_ovl_set_channel_out(enum omap_plane plane, |
432 | enum omap_channel channel); | 405 | enum omap_channel channel); |
433 | 406 | ||
434 | void dispc_mgr_enable_fifohandcheck(enum omap_channel channel, bool enable); | 407 | void dispc_mgr_enable_fifohandcheck(enum omap_channel channel, bool enable); |
435 | void dispc_mgr_set_lcd_size(enum omap_channel channel, u16 width, u16 height); | ||
436 | u32 dispc_mgr_get_vsync_irq(enum omap_channel channel); | 408 | u32 dispc_mgr_get_vsync_irq(enum omap_channel channel); |
437 | u32 dispc_mgr_get_framedone_irq(enum omap_channel channel); | 409 | u32 dispc_mgr_get_framedone_irq(enum omap_channel channel); |
438 | bool dispc_mgr_go_busy(enum omap_channel channel); | 410 | bool dispc_mgr_go_busy(enum omap_channel channel); |
@@ -445,12 +417,13 @@ void dispc_mgr_enable_stallmode(enum omap_channel channel, bool enable); | |||
445 | void dispc_mgr_set_tft_data_lines(enum omap_channel channel, u8 data_lines); | 417 | void dispc_mgr_set_tft_data_lines(enum omap_channel channel, u8 data_lines); |
446 | void dispc_mgr_set_lcd_display_type(enum omap_channel channel, | 418 | void dispc_mgr_set_lcd_display_type(enum omap_channel channel, |
447 | enum omap_lcd_display_type type); | 419 | enum omap_lcd_display_type type); |
448 | void dispc_mgr_set_lcd_timings(enum omap_channel channel, | 420 | void dispc_mgr_set_timings(enum omap_channel channel, |
449 | struct omap_video_timings *timings); | 421 | struct omap_video_timings *timings); |
450 | void dispc_mgr_set_pol_freq(enum omap_channel channel, | 422 | void dispc_mgr_set_pol_freq(enum omap_channel channel, |
451 | enum omap_panel_config config, u8 acbi, u8 acb); | 423 | enum omap_panel_config config, u8 acbi, u8 acb); |
452 | unsigned long dispc_mgr_lclk_rate(enum omap_channel channel); | 424 | unsigned long dispc_mgr_lclk_rate(enum omap_channel channel); |
453 | unsigned long dispc_mgr_pclk_rate(enum omap_channel channel); | 425 | unsigned long dispc_mgr_pclk_rate(enum omap_channel channel); |
426 | unsigned long dispc_core_clk_rate(void); | ||
454 | int dispc_mgr_set_clock_div(enum omap_channel channel, | 427 | int dispc_mgr_set_clock_div(enum omap_channel channel, |
455 | struct dispc_clock_info *cinfo); | 428 | struct dispc_clock_info *cinfo); |
456 | int dispc_mgr_get_clock_div(enum omap_channel channel, | 429 | int dispc_mgr_get_clock_div(enum omap_channel channel, |
@@ -460,19 +433,10 @@ void dispc_mgr_setup(enum omap_channel channel, | |||
460 | 433 | ||
461 | /* VENC */ | 434 | /* VENC */ |
462 | #ifdef CONFIG_OMAP2_DSS_VENC | 435 | #ifdef CONFIG_OMAP2_DSS_VENC |
463 | int venc_init_platform_driver(void); | 436 | int venc_init_platform_driver(void) __init; |
464 | void venc_uninit_platform_driver(void); | 437 | void venc_uninit_platform_driver(void) __exit; |
465 | void venc_dump_regs(struct seq_file *s); | ||
466 | int venc_init_display(struct omap_dss_device *display); | ||
467 | unsigned long venc_get_pixel_clock(void); | 438 | unsigned long venc_get_pixel_clock(void); |
468 | #else | 439 | #else |
469 | static inline int venc_init_platform_driver(void) | ||
470 | { | ||
471 | return 0; | ||
472 | } | ||
473 | static inline void venc_uninit_platform_driver(void) | ||
474 | { | ||
475 | } | ||
476 | static inline unsigned long venc_get_pixel_clock(void) | 440 | static inline unsigned long venc_get_pixel_clock(void) |
477 | { | 441 | { |
478 | WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__); | 442 | WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__); |
@@ -482,23 +446,10 @@ static inline unsigned long venc_get_pixel_clock(void) | |||
482 | 446 | ||
483 | /* HDMI */ | 447 | /* HDMI */ |
484 | #ifdef CONFIG_OMAP4_DSS_HDMI | 448 | #ifdef CONFIG_OMAP4_DSS_HDMI |
485 | int hdmi_init_platform_driver(void); | 449 | int hdmi_init_platform_driver(void) __init; |
486 | void hdmi_uninit_platform_driver(void); | 450 | void hdmi_uninit_platform_driver(void) __exit; |
487 | int hdmi_init_display(struct omap_dss_device *dssdev); | ||
488 | unsigned long hdmi_get_pixel_clock(void); | 451 | unsigned long hdmi_get_pixel_clock(void); |
489 | void hdmi_dump_regs(struct seq_file *s); | ||
490 | #else | 452 | #else |
491 | static inline int hdmi_init_display(struct omap_dss_device *dssdev) | ||
492 | { | ||
493 | return 0; | ||
494 | } | ||
495 | static inline int hdmi_init_platform_driver(void) | ||
496 | { | ||
497 | return 0; | ||
498 | } | ||
499 | static inline void hdmi_uninit_platform_driver(void) | ||
500 | { | ||
501 | } | ||
502 | static inline unsigned long hdmi_get_pixel_clock(void) | 453 | static inline unsigned long hdmi_get_pixel_clock(void) |
503 | { | 454 | { |
504 | WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__); | 455 | WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__); |
@@ -514,22 +465,18 @@ int omapdss_hdmi_read_edid(u8 *buf, int len); | |||
514 | bool omapdss_hdmi_detect(void); | 465 | bool omapdss_hdmi_detect(void); |
515 | int hdmi_panel_init(void); | 466 | int hdmi_panel_init(void); |
516 | void hdmi_panel_exit(void); | 467 | void hdmi_panel_exit(void); |
468 | #ifdef CONFIG_OMAP4_DSS_HDMI_AUDIO | ||
469 | int hdmi_audio_enable(void); | ||
470 | void hdmi_audio_disable(void); | ||
471 | int hdmi_audio_start(void); | ||
472 | void hdmi_audio_stop(void); | ||
473 | bool hdmi_mode_has_audio(void); | ||
474 | int hdmi_audio_config(struct omap_dss_audio *audio); | ||
475 | #endif | ||
517 | 476 | ||
518 | /* RFBI */ | 477 | /* RFBI */ |
519 | #ifdef CONFIG_OMAP2_DSS_RFBI | 478 | int rfbi_init_platform_driver(void) __init; |
520 | int rfbi_init_platform_driver(void); | 479 | void rfbi_uninit_platform_driver(void) __exit; |
521 | void rfbi_uninit_platform_driver(void); | ||
522 | void rfbi_dump_regs(struct seq_file *s); | ||
523 | int rfbi_init_display(struct omap_dss_device *display); | ||
524 | #else | ||
525 | static inline int rfbi_init_platform_driver(void) | ||
526 | { | ||
527 | return 0; | ||
528 | } | ||
529 | static inline void rfbi_uninit_platform_driver(void) | ||
530 | { | ||
531 | } | ||
532 | #endif | ||
533 | 480 | ||
534 | 481 | ||
535 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | 482 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c index ce14aa6dd672..938709724f0c 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c | |||
@@ -52,6 +52,8 @@ struct omap_dss_features { | |||
52 | const char * const *clksrc_names; | 52 | const char * const *clksrc_names; |
53 | const struct dss_param_range *dss_params; | 53 | const struct dss_param_range *dss_params; |
54 | 54 | ||
55 | const enum omap_dss_rotation_type supported_rotation_types; | ||
56 | |||
55 | const u32 buffer_size_unit; | 57 | const u32 buffer_size_unit; |
56 | const u32 burst_size_unit; | 58 | const u32 burst_size_unit; |
57 | }; | 59 | }; |
@@ -311,6 +313,8 @@ static const struct dss_param_range omap2_dss_param_range[] = { | |||
311 | * scaler cannot scale a image with width more than 768. | 313 | * scaler cannot scale a image with width more than 768. |
312 | */ | 314 | */ |
313 | [FEAT_PARAM_LINEWIDTH] = { 1, 768 }, | 315 | [FEAT_PARAM_LINEWIDTH] = { 1, 768 }, |
316 | [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 }, | ||
317 | [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 }, | ||
314 | }; | 318 | }; |
315 | 319 | ||
316 | static const struct dss_param_range omap3_dss_param_range[] = { | 320 | static const struct dss_param_range omap3_dss_param_range[] = { |
@@ -324,6 +328,8 @@ static const struct dss_param_range omap3_dss_param_range[] = { | |||
324 | [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1}, | 328 | [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1}, |
325 | [FEAT_PARAM_DOWNSCALE] = { 1, 4 }, | 329 | [FEAT_PARAM_DOWNSCALE] = { 1, 4 }, |
326 | [FEAT_PARAM_LINEWIDTH] = { 1, 1024 }, | 330 | [FEAT_PARAM_LINEWIDTH] = { 1, 1024 }, |
331 | [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 }, | ||
332 | [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 }, | ||
327 | }; | 333 | }; |
328 | 334 | ||
329 | static const struct dss_param_range omap4_dss_param_range[] = { | 335 | static const struct dss_param_range omap4_dss_param_range[] = { |
@@ -337,6 +343,8 @@ static const struct dss_param_range omap4_dss_param_range[] = { | |||
337 | [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 }, | 343 | [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 }, |
338 | [FEAT_PARAM_DOWNSCALE] = { 1, 4 }, | 344 | [FEAT_PARAM_DOWNSCALE] = { 1, 4 }, |
339 | [FEAT_PARAM_LINEWIDTH] = { 1, 2048 }, | 345 | [FEAT_PARAM_LINEWIDTH] = { 1, 2048 }, |
346 | [FEAT_PARAM_MGR_WIDTH] = { 1, 2048 }, | ||
347 | [FEAT_PARAM_MGR_HEIGHT] = { 1, 2048 }, | ||
340 | }; | 348 | }; |
341 | 349 | ||
342 | static const enum dss_feat_id omap2_dss_feat_list[] = { | 350 | static const enum dss_feat_id omap2_dss_feat_list[] = { |
@@ -399,6 +407,7 @@ static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = { | |||
399 | FEAT_FIR_COEF_V, | 407 | FEAT_FIR_COEF_V, |
400 | FEAT_ALPHA_FREE_ZORDER, | 408 | FEAT_ALPHA_FREE_ZORDER, |
401 | FEAT_FIFO_MERGE, | 409 | FEAT_FIFO_MERGE, |
410 | FEAT_BURST_2D, | ||
402 | }; | 411 | }; |
403 | 412 | ||
404 | static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = { | 413 | static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = { |
@@ -416,6 +425,7 @@ static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = { | |||
416 | FEAT_FIR_COEF_V, | 425 | FEAT_FIR_COEF_V, |
417 | FEAT_ALPHA_FREE_ZORDER, | 426 | FEAT_ALPHA_FREE_ZORDER, |
418 | FEAT_FIFO_MERGE, | 427 | FEAT_FIFO_MERGE, |
428 | FEAT_BURST_2D, | ||
419 | }; | 429 | }; |
420 | 430 | ||
421 | static const enum dss_feat_id omap4_dss_feat_list[] = { | 431 | static const enum dss_feat_id omap4_dss_feat_list[] = { |
@@ -434,6 +444,7 @@ static const enum dss_feat_id omap4_dss_feat_list[] = { | |||
434 | FEAT_FIR_COEF_V, | 444 | FEAT_FIR_COEF_V, |
435 | FEAT_ALPHA_FREE_ZORDER, | 445 | FEAT_ALPHA_FREE_ZORDER, |
436 | FEAT_FIFO_MERGE, | 446 | FEAT_FIFO_MERGE, |
447 | FEAT_BURST_2D, | ||
437 | }; | 448 | }; |
438 | 449 | ||
439 | /* OMAP2 DSS Features */ | 450 | /* OMAP2 DSS Features */ |
@@ -451,6 +462,7 @@ static const struct omap_dss_features omap2_dss_features = { | |||
451 | .overlay_caps = omap2_dss_overlay_caps, | 462 | .overlay_caps = omap2_dss_overlay_caps, |
452 | .clksrc_names = omap2_dss_clk_source_names, | 463 | .clksrc_names = omap2_dss_clk_source_names, |
453 | .dss_params = omap2_dss_param_range, | 464 | .dss_params = omap2_dss_param_range, |
465 | .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB, | ||
454 | .buffer_size_unit = 1, | 466 | .buffer_size_unit = 1, |
455 | .burst_size_unit = 8, | 467 | .burst_size_unit = 8, |
456 | }; | 468 | }; |
@@ -470,6 +482,7 @@ static const struct omap_dss_features omap3430_dss_features = { | |||
470 | .overlay_caps = omap3430_dss_overlay_caps, | 482 | .overlay_caps = omap3430_dss_overlay_caps, |
471 | .clksrc_names = omap3_dss_clk_source_names, | 483 | .clksrc_names = omap3_dss_clk_source_names, |
472 | .dss_params = omap3_dss_param_range, | 484 | .dss_params = omap3_dss_param_range, |
485 | .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB, | ||
473 | .buffer_size_unit = 1, | 486 | .buffer_size_unit = 1, |
474 | .burst_size_unit = 8, | 487 | .burst_size_unit = 8, |
475 | }; | 488 | }; |
@@ -488,6 +501,7 @@ static const struct omap_dss_features omap3630_dss_features = { | |||
488 | .overlay_caps = omap3630_dss_overlay_caps, | 501 | .overlay_caps = omap3630_dss_overlay_caps, |
489 | .clksrc_names = omap3_dss_clk_source_names, | 502 | .clksrc_names = omap3_dss_clk_source_names, |
490 | .dss_params = omap3_dss_param_range, | 503 | .dss_params = omap3_dss_param_range, |
504 | .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB, | ||
491 | .buffer_size_unit = 1, | 505 | .buffer_size_unit = 1, |
492 | .burst_size_unit = 8, | 506 | .burst_size_unit = 8, |
493 | }; | 507 | }; |
@@ -508,6 +522,7 @@ static const struct omap_dss_features omap4430_es1_0_dss_features = { | |||
508 | .overlay_caps = omap4_dss_overlay_caps, | 522 | .overlay_caps = omap4_dss_overlay_caps, |
509 | .clksrc_names = omap4_dss_clk_source_names, | 523 | .clksrc_names = omap4_dss_clk_source_names, |
510 | .dss_params = omap4_dss_param_range, | 524 | .dss_params = omap4_dss_param_range, |
525 | .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER, | ||
511 | .buffer_size_unit = 16, | 526 | .buffer_size_unit = 16, |
512 | .burst_size_unit = 16, | 527 | .burst_size_unit = 16, |
513 | }; | 528 | }; |
@@ -527,6 +542,7 @@ static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = { | |||
527 | .overlay_caps = omap4_dss_overlay_caps, | 542 | .overlay_caps = omap4_dss_overlay_caps, |
528 | .clksrc_names = omap4_dss_clk_source_names, | 543 | .clksrc_names = omap4_dss_clk_source_names, |
529 | .dss_params = omap4_dss_param_range, | 544 | .dss_params = omap4_dss_param_range, |
545 | .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER, | ||
530 | .buffer_size_unit = 16, | 546 | .buffer_size_unit = 16, |
531 | .burst_size_unit = 16, | 547 | .burst_size_unit = 16, |
532 | }; | 548 | }; |
@@ -546,6 +562,7 @@ static const struct omap_dss_features omap4_dss_features = { | |||
546 | .overlay_caps = omap4_dss_overlay_caps, | 562 | .overlay_caps = omap4_dss_overlay_caps, |
547 | .clksrc_names = omap4_dss_clk_source_names, | 563 | .clksrc_names = omap4_dss_clk_source_names, |
548 | .dss_params = omap4_dss_param_range, | 564 | .dss_params = omap4_dss_param_range, |
565 | .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER, | ||
549 | .buffer_size_unit = 16, | 566 | .buffer_size_unit = 16, |
550 | .burst_size_unit = 16, | 567 | .burst_size_unit = 16, |
551 | }; | 568 | }; |
@@ -562,13 +579,17 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = { | |||
562 | .pll_enable = ti_hdmi_4xxx_pll_enable, | 579 | .pll_enable = ti_hdmi_4xxx_pll_enable, |
563 | .pll_disable = ti_hdmi_4xxx_pll_disable, | 580 | .pll_disable = ti_hdmi_4xxx_pll_disable, |
564 | .video_enable = ti_hdmi_4xxx_wp_video_start, | 581 | .video_enable = ti_hdmi_4xxx_wp_video_start, |
582 | .video_disable = ti_hdmi_4xxx_wp_video_stop, | ||
565 | .dump_wrapper = ti_hdmi_4xxx_wp_dump, | 583 | .dump_wrapper = ti_hdmi_4xxx_wp_dump, |
566 | .dump_core = ti_hdmi_4xxx_core_dump, | 584 | .dump_core = ti_hdmi_4xxx_core_dump, |
567 | .dump_pll = ti_hdmi_4xxx_pll_dump, | 585 | .dump_pll = ti_hdmi_4xxx_pll_dump, |
568 | .dump_phy = ti_hdmi_4xxx_phy_dump, | 586 | .dump_phy = ti_hdmi_4xxx_phy_dump, |
569 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 587 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) |
570 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | ||
571 | .audio_enable = ti_hdmi_4xxx_wp_audio_enable, | 588 | .audio_enable = ti_hdmi_4xxx_wp_audio_enable, |
589 | .audio_disable = ti_hdmi_4xxx_wp_audio_disable, | ||
590 | .audio_start = ti_hdmi_4xxx_audio_start, | ||
591 | .audio_stop = ti_hdmi_4xxx_audio_stop, | ||
592 | .audio_config = ti_hdmi_4xxx_audio_config, | ||
572 | #endif | 593 | #endif |
573 | 594 | ||
574 | }; | 595 | }; |
@@ -662,6 +683,11 @@ void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end) | |||
662 | *end = omap_current_dss_features->reg_fields[id].end; | 683 | *end = omap_current_dss_features->reg_fields[id].end; |
663 | } | 684 | } |
664 | 685 | ||
686 | bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type) | ||
687 | { | ||
688 | return omap_current_dss_features->supported_rotation_types & rot_type; | ||
689 | } | ||
690 | |||
665 | void dss_features_init(void) | 691 | void dss_features_init(void) |
666 | { | 692 | { |
667 | if (cpu_is_omap24xx()) | 693 | if (cpu_is_omap24xx()) |
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h index c332e7ddfce1..bdf469f080e7 100644 --- a/drivers/video/omap2/dss/dss_features.h +++ b/drivers/video/omap2/dss/dss_features.h | |||
@@ -62,6 +62,7 @@ enum dss_feat_id { | |||
62 | FEAT_FIFO_MERGE, | 62 | FEAT_FIFO_MERGE, |
63 | /* An unknown HW bug causing the normal FIFO thresholds not to work */ | 63 | /* An unknown HW bug causing the normal FIFO thresholds not to work */ |
64 | FEAT_OMAP3_DSI_FIFO_BUG, | 64 | FEAT_OMAP3_DSI_FIFO_BUG, |
65 | FEAT_BURST_2D, | ||
65 | }; | 66 | }; |
66 | 67 | ||
67 | /* DSS register field id */ | 68 | /* DSS register field id */ |
@@ -91,6 +92,8 @@ enum dss_range_param { | |||
91 | FEAT_PARAM_DSIPLL_LPDIV, | 92 | FEAT_PARAM_DSIPLL_LPDIV, |
92 | FEAT_PARAM_DOWNSCALE, | 93 | FEAT_PARAM_DOWNSCALE, |
93 | FEAT_PARAM_LINEWIDTH, | 94 | FEAT_PARAM_LINEWIDTH, |
95 | FEAT_PARAM_MGR_WIDTH, | ||
96 | FEAT_PARAM_MGR_HEIGHT, | ||
94 | }; | 97 | }; |
95 | 98 | ||
96 | /* DSS Feature Functions */ | 99 | /* DSS Feature Functions */ |
@@ -108,6 +111,8 @@ const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id); | |||
108 | u32 dss_feat_get_buffer_size_unit(void); /* in bytes */ | 111 | u32 dss_feat_get_buffer_size_unit(void); /* in bytes */ |
109 | u32 dss_feat_get_burst_size_unit(void); /* in bytes */ | 112 | u32 dss_feat_get_burst_size_unit(void); /* in bytes */ |
110 | 113 | ||
114 | bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type); | ||
115 | |||
111 | bool dss_has_feature(enum dss_feat_id id); | 116 | bool dss_has_feature(enum dss_feat_id id); |
112 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); | 117 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); |
113 | void dss_features_init(void); | 118 | void dss_features_init(void); |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index c4b4f6950a92..8195c7166d20 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -33,12 +33,6 @@ | |||
33 | #include <linux/pm_runtime.h> | 33 | #include <linux/pm_runtime.h> |
34 | #include <linux/clk.h> | 34 | #include <linux/clk.h> |
35 | #include <video/omapdss.h> | 35 | #include <video/omapdss.h> |
36 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | ||
37 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | ||
38 | #include <sound/soc.h> | ||
39 | #include <sound/pcm_params.h> | ||
40 | #include "ti_hdmi_4xxx_ip.h" | ||
41 | #endif | ||
42 | 36 | ||
43 | #include "ti_hdmi.h" | 37 | #include "ti_hdmi.h" |
44 | #include "dss.h" | 38 | #include "dss.h" |
@@ -63,7 +57,6 @@ | |||
63 | 57 | ||
64 | static struct { | 58 | static struct { |
65 | struct mutex lock; | 59 | struct mutex lock; |
66 | struct omap_display_platform_data *pdata; | ||
67 | struct platform_device *pdev; | 60 | struct platform_device *pdev; |
68 | struct hdmi_ip_data ip_data; | 61 | struct hdmi_ip_data ip_data; |
69 | 62 | ||
@@ -130,25 +123,12 @@ static int hdmi_runtime_get(void) | |||
130 | 123 | ||
131 | DSSDBG("hdmi_runtime_get\n"); | 124 | DSSDBG("hdmi_runtime_get\n"); |
132 | 125 | ||
133 | /* | ||
134 | * HACK: Add dss_runtime_get() to ensure DSS clock domain is enabled. | ||
135 | * This should be removed later. | ||
136 | */ | ||
137 | r = dss_runtime_get(); | ||
138 | if (r < 0) | ||
139 | goto err_get_dss; | ||
140 | |||
141 | r = pm_runtime_get_sync(&hdmi.pdev->dev); | 126 | r = pm_runtime_get_sync(&hdmi.pdev->dev); |
142 | WARN_ON(r < 0); | 127 | WARN_ON(r < 0); |
143 | if (r < 0) | 128 | if (r < 0) |
144 | goto err_get_hdmi; | 129 | return r; |
145 | 130 | ||
146 | return 0; | 131 | return 0; |
147 | |||
148 | err_get_hdmi: | ||
149 | dss_runtime_put(); | ||
150 | err_get_dss: | ||
151 | return r; | ||
152 | } | 132 | } |
153 | 133 | ||
154 | static void hdmi_runtime_put(void) | 134 | static void hdmi_runtime_put(void) |
@@ -159,15 +139,9 @@ static void hdmi_runtime_put(void) | |||
159 | 139 | ||
160 | r = pm_runtime_put_sync(&hdmi.pdev->dev); | 140 | r = pm_runtime_put_sync(&hdmi.pdev->dev); |
161 | WARN_ON(r < 0); | 141 | WARN_ON(r < 0); |
162 | |||
163 | /* | ||
164 | * HACK: This is added to complement the dss_runtime_get() call in | ||
165 | * hdmi_runtime_get(). This should be removed later. | ||
166 | */ | ||
167 | dss_runtime_put(); | ||
168 | } | 142 | } |
169 | 143 | ||
170 | int hdmi_init_display(struct omap_dss_device *dssdev) | 144 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) |
171 | { | 145 | { |
172 | DSSDBG("init_display\n"); | 146 | DSSDBG("init_display\n"); |
173 | 147 | ||
@@ -344,7 +318,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev) | |||
344 | 318 | ||
345 | hdmi_compute_pll(dssdev, phy, &hdmi.ip_data.pll_data); | 319 | hdmi_compute_pll(dssdev, phy, &hdmi.ip_data.pll_data); |
346 | 320 | ||
347 | hdmi.ip_data.ops->video_enable(&hdmi.ip_data, 0); | 321 | hdmi.ip_data.ops->video_disable(&hdmi.ip_data); |
348 | 322 | ||
349 | /* config the PLL and PHY hdmi_set_pll_pwrfirst */ | 323 | /* config the PLL and PHY hdmi_set_pll_pwrfirst */ |
350 | r = hdmi.ip_data.ops->pll_enable(&hdmi.ip_data); | 324 | r = hdmi.ip_data.ops->pll_enable(&hdmi.ip_data); |
@@ -376,10 +350,11 @@ static int hdmi_power_on(struct omap_dss_device *dssdev) | |||
376 | dispc_enable_gamma_table(0); | 350 | dispc_enable_gamma_table(0); |
377 | 351 | ||
378 | /* tv size */ | 352 | /* tv size */ |
379 | dispc_set_digit_size(dssdev->panel.timings.x_res, | 353 | dss_mgr_set_timings(dssdev->manager, &dssdev->panel.timings); |
380 | dssdev->panel.timings.y_res); | ||
381 | 354 | ||
382 | hdmi.ip_data.ops->video_enable(&hdmi.ip_data, 1); | 355 | r = hdmi.ip_data.ops->video_enable(&hdmi.ip_data); |
356 | if (r) | ||
357 | goto err_vid_enable; | ||
383 | 358 | ||
384 | r = dss_mgr_enable(dssdev->manager); | 359 | r = dss_mgr_enable(dssdev->manager); |
385 | if (r) | 360 | if (r) |
@@ -388,7 +363,8 @@ static int hdmi_power_on(struct omap_dss_device *dssdev) | |||
388 | return 0; | 363 | return 0; |
389 | 364 | ||
390 | err_mgr_enable: | 365 | err_mgr_enable: |
391 | hdmi.ip_data.ops->video_enable(&hdmi.ip_data, 0); | 366 | hdmi.ip_data.ops->video_disable(&hdmi.ip_data); |
367 | err_vid_enable: | ||
392 | hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); | 368 | hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); |
393 | hdmi.ip_data.ops->pll_disable(&hdmi.ip_data); | 369 | hdmi.ip_data.ops->pll_disable(&hdmi.ip_data); |
394 | err: | 370 | err: |
@@ -400,7 +376,7 @@ static void hdmi_power_off(struct omap_dss_device *dssdev) | |||
400 | { | 376 | { |
401 | dss_mgr_disable(dssdev->manager); | 377 | dss_mgr_disable(dssdev->manager); |
402 | 378 | ||
403 | hdmi.ip_data.ops->video_enable(&hdmi.ip_data, 0); | 379 | hdmi.ip_data.ops->video_disable(&hdmi.ip_data); |
404 | hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); | 380 | hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); |
405 | hdmi.ip_data.ops->pll_disable(&hdmi.ip_data); | 381 | hdmi.ip_data.ops->pll_disable(&hdmi.ip_data); |
406 | hdmi_runtime_put(); | 382 | hdmi_runtime_put(); |
@@ -436,10 +412,12 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev) | |||
436 | r = hdmi_power_on(dssdev); | 412 | r = hdmi_power_on(dssdev); |
437 | if (r) | 413 | if (r) |
438 | DSSERR("failed to power on device\n"); | 414 | DSSERR("failed to power on device\n"); |
415 | } else { | ||
416 | dss_mgr_set_timings(dssdev->manager, &dssdev->panel.timings); | ||
439 | } | 417 | } |
440 | } | 418 | } |
441 | 419 | ||
442 | void hdmi_dump_regs(struct seq_file *s) | 420 | static void hdmi_dump_regs(struct seq_file *s) |
443 | { | 421 | { |
444 | mutex_lock(&hdmi.lock); | 422 | mutex_lock(&hdmi.lock); |
445 | 423 | ||
@@ -555,248 +533,201 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev) | |||
555 | mutex_unlock(&hdmi.lock); | 533 | mutex_unlock(&hdmi.lock); |
556 | } | 534 | } |
557 | 535 | ||
558 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 536 | static int hdmi_get_clocks(struct platform_device *pdev) |
559 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | ||
560 | |||
561 | static int hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, | ||
562 | struct snd_soc_dai *dai) | ||
563 | { | 537 | { |
564 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 538 | struct clk *clk; |
565 | struct snd_soc_codec *codec = rtd->codec; | ||
566 | struct platform_device *pdev = to_platform_device(codec->dev); | ||
567 | struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec); | ||
568 | int err = 0; | ||
569 | 539 | ||
570 | if (!(ip_data->ops) && !(ip_data->ops->audio_enable)) { | 540 | clk = clk_get(&pdev->dev, "sys_clk"); |
571 | dev_err(&pdev->dev, "Cannot enable/disable audio\n"); | 541 | if (IS_ERR(clk)) { |
572 | return -ENODEV; | 542 | DSSERR("can't get sys_clk\n"); |
543 | return PTR_ERR(clk); | ||
573 | } | 544 | } |
574 | 545 | ||
575 | switch (cmd) { | 546 | hdmi.sys_clk = clk; |
576 | case SNDRV_PCM_TRIGGER_START: | 547 | |
577 | case SNDRV_PCM_TRIGGER_RESUME: | 548 | return 0; |
578 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 549 | } |
579 | ip_data->ops->audio_enable(ip_data, true); | 550 | |
580 | break; | 551 | static void hdmi_put_clocks(void) |
581 | case SNDRV_PCM_TRIGGER_STOP: | 552 | { |
582 | case SNDRV_PCM_TRIGGER_SUSPEND: | 553 | if (hdmi.sys_clk) |
583 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 554 | clk_put(hdmi.sys_clk); |
584 | ip_data->ops->audio_enable(ip_data, false); | 555 | } |
585 | break; | 556 | |
586 | default: | 557 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) |
587 | err = -EINVAL; | 558 | int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) |
588 | } | 559 | { |
589 | return err; | 560 | u32 deep_color; |
590 | } | 561 | bool deep_color_correct = false; |
591 | 562 | u32 pclk = hdmi.ip_data.cfg.timings.pixel_clock; | |
592 | static int hdmi_audio_hw_params(struct snd_pcm_substream *substream, | 563 | |
593 | struct snd_pcm_hw_params *params, | 564 | if (n == NULL || cts == NULL) |
594 | struct snd_soc_dai *dai) | ||
595 | { | ||
596 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
597 | struct snd_soc_codec *codec = rtd->codec; | ||
598 | struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec); | ||
599 | struct hdmi_audio_format audio_format; | ||
600 | struct hdmi_audio_dma audio_dma; | ||
601 | struct hdmi_core_audio_config core_cfg; | ||
602 | struct hdmi_core_infoframe_audio aud_if_cfg; | ||
603 | int err, n, cts; | ||
604 | enum hdmi_core_audio_sample_freq sample_freq; | ||
605 | |||
606 | switch (params_format(params)) { | ||
607 | case SNDRV_PCM_FORMAT_S16_LE: | ||
608 | core_cfg.i2s_cfg.word_max_length = | ||
609 | HDMI_AUDIO_I2S_MAX_WORD_20BITS; | ||
610 | core_cfg.i2s_cfg.word_length = HDMI_AUDIO_I2S_CHST_WORD_16_BITS; | ||
611 | core_cfg.i2s_cfg.in_length_bits = | ||
612 | HDMI_AUDIO_I2S_INPUT_LENGTH_16; | ||
613 | core_cfg.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_LEFT; | ||
614 | audio_format.samples_per_word = HDMI_AUDIO_ONEWORD_TWOSAMPLES; | ||
615 | audio_format.sample_size = HDMI_AUDIO_SAMPLE_16BITS; | ||
616 | audio_format.justification = HDMI_AUDIO_JUSTIFY_LEFT; | ||
617 | audio_dma.transfer_size = 0x10; | ||
618 | break; | ||
619 | case SNDRV_PCM_FORMAT_S24_LE: | ||
620 | core_cfg.i2s_cfg.word_max_length = | ||
621 | HDMI_AUDIO_I2S_MAX_WORD_24BITS; | ||
622 | core_cfg.i2s_cfg.word_length = HDMI_AUDIO_I2S_CHST_WORD_24_BITS; | ||
623 | core_cfg.i2s_cfg.in_length_bits = | ||
624 | HDMI_AUDIO_I2S_INPUT_LENGTH_24; | ||
625 | audio_format.samples_per_word = HDMI_AUDIO_ONEWORD_ONESAMPLE; | ||
626 | audio_format.sample_size = HDMI_AUDIO_SAMPLE_24BITS; | ||
627 | audio_format.justification = HDMI_AUDIO_JUSTIFY_RIGHT; | ||
628 | core_cfg.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_RIGHT; | ||
629 | audio_dma.transfer_size = 0x20; | ||
630 | break; | ||
631 | default: | ||
632 | return -EINVAL; | 565 | return -EINVAL; |
633 | } | ||
634 | 566 | ||
635 | switch (params_rate(params)) { | 567 | /* TODO: When implemented, query deep color mode here. */ |
568 | deep_color = 100; | ||
569 | |||
570 | /* | ||
571 | * When using deep color, the default N value (as in the HDMI | ||
572 | * specification) yields to an non-integer CTS. Hence, we | ||
573 | * modify it while keeping the restrictions described in | ||
574 | * section 7.2.1 of the HDMI 1.4a specification. | ||
575 | */ | ||
576 | switch (sample_freq) { | ||
636 | case 32000: | 577 | case 32000: |
637 | sample_freq = HDMI_AUDIO_FS_32000; | 578 | case 48000: |
579 | case 96000: | ||
580 | case 192000: | ||
581 | if (deep_color == 125) | ||
582 | if (pclk == 27027 || pclk == 74250) | ||
583 | deep_color_correct = true; | ||
584 | if (deep_color == 150) | ||
585 | if (pclk == 27027) | ||
586 | deep_color_correct = true; | ||
638 | break; | 587 | break; |
639 | case 44100: | 588 | case 44100: |
640 | sample_freq = HDMI_AUDIO_FS_44100; | 589 | case 88200: |
641 | break; | 590 | case 176400: |
642 | case 48000: | 591 | if (deep_color == 125) |
643 | sample_freq = HDMI_AUDIO_FS_48000; | 592 | if (pclk == 27027) |
593 | deep_color_correct = true; | ||
644 | break; | 594 | break; |
645 | default: | 595 | default: |
646 | return -EINVAL; | 596 | return -EINVAL; |
647 | } | 597 | } |
648 | 598 | ||
649 | err = hdmi_config_audio_acr(ip_data, params_rate(params), &n, &cts); | 599 | if (deep_color_correct) { |
650 | if (err < 0) | 600 | switch (sample_freq) { |
651 | return err; | 601 | case 32000: |
652 | 602 | *n = 8192; | |
653 | /* Audio wrapper config */ | 603 | break; |
654 | audio_format.stereo_channels = HDMI_AUDIO_STEREO_ONECHANNEL; | 604 | case 44100: |
655 | audio_format.active_chnnls_msk = 0x03; | 605 | *n = 12544; |
656 | audio_format.type = HDMI_AUDIO_TYPE_LPCM; | 606 | break; |
657 | audio_format.sample_order = HDMI_AUDIO_SAMPLE_LEFT_FIRST; | 607 | case 48000: |
658 | /* Disable start/stop signals of IEC 60958 blocks */ | 608 | *n = 8192; |
659 | audio_format.en_sig_blk_strt_end = HDMI_AUDIO_BLOCK_SIG_STARTEND_OFF; | 609 | break; |
610 | case 88200: | ||
611 | *n = 25088; | ||
612 | break; | ||
613 | case 96000: | ||
614 | *n = 16384; | ||
615 | break; | ||
616 | case 176400: | ||
617 | *n = 50176; | ||
618 | break; | ||
619 | case 192000: | ||
620 | *n = 32768; | ||
621 | break; | ||
622 | default: | ||
623 | return -EINVAL; | ||
624 | } | ||
625 | } else { | ||
626 | switch (sample_freq) { | ||
627 | case 32000: | ||
628 | *n = 4096; | ||
629 | break; | ||
630 | case 44100: | ||
631 | *n = 6272; | ||
632 | break; | ||
633 | case 48000: | ||
634 | *n = 6144; | ||
635 | break; | ||
636 | case 88200: | ||
637 | *n = 12544; | ||
638 | break; | ||
639 | case 96000: | ||
640 | *n = 12288; | ||
641 | break; | ||
642 | case 176400: | ||
643 | *n = 25088; | ||
644 | break; | ||
645 | case 192000: | ||
646 | *n = 24576; | ||
647 | break; | ||
648 | default: | ||
649 | return -EINVAL; | ||
650 | } | ||
651 | } | ||
652 | /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */ | ||
653 | *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10); | ||
660 | 654 | ||
661 | audio_dma.block_size = 0xC0; | 655 | return 0; |
662 | audio_dma.mode = HDMI_AUDIO_TRANSF_DMA; | 656 | } |
663 | audio_dma.fifo_threshold = 0x20; /* in number of samples */ | ||
664 | 657 | ||
665 | hdmi_wp_audio_config_dma(ip_data, &audio_dma); | 658 | int hdmi_audio_enable(void) |
666 | hdmi_wp_audio_config_format(ip_data, &audio_format); | 659 | { |
660 | DSSDBG("audio_enable\n"); | ||
667 | 661 | ||
668 | /* | 662 | return hdmi.ip_data.ops->audio_enable(&hdmi.ip_data); |
669 | * I2S config | 663 | } |
670 | */ | ||
671 | core_cfg.i2s_cfg.en_high_bitrate_aud = false; | ||
672 | /* Only used with high bitrate audio */ | ||
673 | core_cfg.i2s_cfg.cbit_order = false; | ||
674 | /* Serial data and word select should change on sck rising edge */ | ||
675 | core_cfg.i2s_cfg.sck_edge_mode = HDMI_AUDIO_I2S_SCK_EDGE_RISING; | ||
676 | core_cfg.i2s_cfg.vbit = HDMI_AUDIO_I2S_VBIT_FOR_PCM; | ||
677 | /* Set I2S word select polarity */ | ||
678 | core_cfg.i2s_cfg.ws_polarity = HDMI_AUDIO_I2S_WS_POLARITY_LOW_IS_LEFT; | ||
679 | core_cfg.i2s_cfg.direction = HDMI_AUDIO_I2S_MSB_SHIFTED_FIRST; | ||
680 | /* Set serial data to word select shift. See Phillips spec. */ | ||
681 | core_cfg.i2s_cfg.shift = HDMI_AUDIO_I2S_FIRST_BIT_SHIFT; | ||
682 | /* Enable one of the four available serial data channels */ | ||
683 | core_cfg.i2s_cfg.active_sds = HDMI_AUDIO_I2S_SD0_EN; | ||
684 | |||
685 | /* Core audio config */ | ||
686 | core_cfg.freq_sample = sample_freq; | ||
687 | core_cfg.n = n; | ||
688 | core_cfg.cts = cts; | ||
689 | if (dss_has_feature(FEAT_HDMI_CTS_SWMODE)) { | ||
690 | core_cfg.aud_par_busclk = 0; | ||
691 | core_cfg.cts_mode = HDMI_AUDIO_CTS_MODE_SW; | ||
692 | core_cfg.use_mclk = dss_has_feature(FEAT_HDMI_AUDIO_USE_MCLK); | ||
693 | } else { | ||
694 | core_cfg.aud_par_busclk = (((128 * 31) - 1) << 8); | ||
695 | core_cfg.cts_mode = HDMI_AUDIO_CTS_MODE_HW; | ||
696 | core_cfg.use_mclk = true; | ||
697 | } | ||
698 | 664 | ||
699 | if (core_cfg.use_mclk) | 665 | void hdmi_audio_disable(void) |
700 | core_cfg.mclk_mode = HDMI_AUDIO_MCLK_128FS; | 666 | { |
701 | core_cfg.layout = HDMI_AUDIO_LAYOUT_2CH; | 667 | DSSDBG("audio_disable\n"); |
702 | core_cfg.en_spdif = false; | ||
703 | /* Use sample frequency from channel status word */ | ||
704 | core_cfg.fs_override = true; | ||
705 | /* Enable ACR packets */ | ||
706 | core_cfg.en_acr_pkt = true; | ||
707 | /* Disable direct streaming digital audio */ | ||
708 | core_cfg.en_dsd_audio = false; | ||
709 | /* Use parallel audio interface */ | ||
710 | core_cfg.en_parallel_aud_input = true; | ||
711 | |||
712 | hdmi_core_audio_config(ip_data, &core_cfg); | ||
713 | 668 | ||
714 | /* | 669 | hdmi.ip_data.ops->audio_disable(&hdmi.ip_data); |
715 | * Configure packet | ||
716 | * info frame audio see doc CEA861-D page 74 | ||
717 | */ | ||
718 | aud_if_cfg.db1_coding_type = HDMI_INFOFRAME_AUDIO_DB1CT_FROM_STREAM; | ||
719 | aud_if_cfg.db1_channel_count = 2; | ||
720 | aud_if_cfg.db2_sample_freq = HDMI_INFOFRAME_AUDIO_DB2SF_FROM_STREAM; | ||
721 | aud_if_cfg.db2_sample_size = HDMI_INFOFRAME_AUDIO_DB2SS_FROM_STREAM; | ||
722 | aud_if_cfg.db4_channel_alloc = 0x00; | ||
723 | aud_if_cfg.db5_downmix_inh = false; | ||
724 | aud_if_cfg.db5_lsv = 0; | ||
725 | |||
726 | hdmi_core_audio_infoframe_config(ip_data, &aud_if_cfg); | ||
727 | return 0; | ||
728 | } | 670 | } |
729 | 671 | ||
730 | static int hdmi_audio_startup(struct snd_pcm_substream *substream, | 672 | int hdmi_audio_start(void) |
731 | struct snd_soc_dai *dai) | ||
732 | { | 673 | { |
733 | if (!hdmi.ip_data.cfg.cm.mode) { | 674 | DSSDBG("audio_start\n"); |
734 | pr_err("Current video settings do not support audio.\n"); | 675 | |
735 | return -EIO; | 676 | return hdmi.ip_data.ops->audio_start(&hdmi.ip_data); |
736 | } | ||
737 | return 0; | ||
738 | } | 677 | } |
739 | 678 | ||
740 | static int hdmi_audio_codec_probe(struct snd_soc_codec *codec) | 679 | void hdmi_audio_stop(void) |
741 | { | 680 | { |
742 | struct hdmi_ip_data *priv = &hdmi.ip_data; | 681 | DSSDBG("audio_stop\n"); |
743 | 682 | ||
744 | snd_soc_codec_set_drvdata(codec, priv); | 683 | hdmi.ip_data.ops->audio_stop(&hdmi.ip_data); |
745 | return 0; | ||
746 | } | 684 | } |
747 | 685 | ||
748 | static struct snd_soc_codec_driver hdmi_audio_codec_drv = { | 686 | bool hdmi_mode_has_audio(void) |
749 | .probe = hdmi_audio_codec_probe, | 687 | { |
750 | }; | 688 | if (hdmi.ip_data.cfg.cm.mode == HDMI_HDMI) |
689 | return true; | ||
690 | else | ||
691 | return false; | ||
692 | } | ||
751 | 693 | ||
752 | static struct snd_soc_dai_ops hdmi_audio_codec_ops = { | 694 | int hdmi_audio_config(struct omap_dss_audio *audio) |
753 | .hw_params = hdmi_audio_hw_params, | 695 | { |
754 | .trigger = hdmi_audio_trigger, | 696 | return hdmi.ip_data.ops->audio_config(&hdmi.ip_data, audio); |
755 | .startup = hdmi_audio_startup, | 697 | } |
756 | }; | ||
757 | 698 | ||
758 | static struct snd_soc_dai_driver hdmi_codec_dai_drv = { | ||
759 | .name = "hdmi-audio-codec", | ||
760 | .playback = { | ||
761 | .channels_min = 2, | ||
762 | .channels_max = 2, | ||
763 | .rates = SNDRV_PCM_RATE_32000 | | ||
764 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, | ||
765 | .formats = SNDRV_PCM_FMTBIT_S16_LE | | ||
766 | SNDRV_PCM_FMTBIT_S24_LE, | ||
767 | }, | ||
768 | .ops = &hdmi_audio_codec_ops, | ||
769 | }; | ||
770 | #endif | 699 | #endif |
771 | 700 | ||
772 | static int hdmi_get_clocks(struct platform_device *pdev) | 701 | static void __init hdmi_probe_pdata(struct platform_device *pdev) |
773 | { | 702 | { |
774 | struct clk *clk; | 703 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; |
704 | int r, i; | ||
775 | 705 | ||
776 | clk = clk_get(&pdev->dev, "sys_clk"); | 706 | for (i = 0; i < pdata->num_devices; ++i) { |
777 | if (IS_ERR(clk)) { | 707 | struct omap_dss_device *dssdev = pdata->devices[i]; |
778 | DSSERR("can't get sys_clk\n"); | ||
779 | return PTR_ERR(clk); | ||
780 | } | ||
781 | 708 | ||
782 | hdmi.sys_clk = clk; | 709 | if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI) |
710 | continue; | ||
783 | 711 | ||
784 | return 0; | 712 | r = hdmi_init_display(dssdev); |
785 | } | 713 | if (r) { |
714 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
715 | continue; | ||
716 | } | ||
786 | 717 | ||
787 | static void hdmi_put_clocks(void) | 718 | r = omap_dss_register_device(dssdev, &pdev->dev, i); |
788 | { | 719 | if (r) |
789 | if (hdmi.sys_clk) | 720 | DSSERR("device %s register failed: %d\n", |
790 | clk_put(hdmi.sys_clk); | 721 | dssdev->name, r); |
722 | } | ||
791 | } | 723 | } |
792 | 724 | ||
793 | /* HDMI HW IP initialisation */ | 725 | /* HDMI HW IP initialisation */ |
794 | static int omapdss_hdmihw_probe(struct platform_device *pdev) | 726 | static int __init omapdss_hdmihw_probe(struct platform_device *pdev) |
795 | { | 727 | { |
796 | struct resource *hdmi_mem; | 728 | struct resource *hdmi_mem; |
797 | int r; | 729 | int r; |
798 | 730 | ||
799 | hdmi.pdata = pdev->dev.platform_data; | ||
800 | hdmi.pdev = pdev; | 731 | hdmi.pdev = pdev; |
801 | 732 | ||
802 | mutex_init(&hdmi.lock); | 733 | mutex_init(&hdmi.lock); |
@@ -830,28 +761,18 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) | |||
830 | 761 | ||
831 | hdmi_panel_init(); | 762 | hdmi_panel_init(); |
832 | 763 | ||
833 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 764 | dss_debugfs_create_file("hdmi", hdmi_dump_regs); |
834 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | 765 | |
766 | hdmi_probe_pdata(pdev); | ||
835 | 767 | ||
836 | /* Register ASoC codec DAI */ | ||
837 | r = snd_soc_register_codec(&pdev->dev, &hdmi_audio_codec_drv, | ||
838 | &hdmi_codec_dai_drv, 1); | ||
839 | if (r) { | ||
840 | DSSERR("can't register ASoC HDMI audio codec\n"); | ||
841 | return r; | ||
842 | } | ||
843 | #endif | ||
844 | return 0; | 768 | return 0; |
845 | } | 769 | } |
846 | 770 | ||
847 | static int omapdss_hdmihw_remove(struct platform_device *pdev) | 771 | static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) |
848 | { | 772 | { |
849 | hdmi_panel_exit(); | 773 | omap_dss_unregister_child_devices(&pdev->dev); |
850 | 774 | ||
851 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 775 | hdmi_panel_exit(); |
852 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | ||
853 | snd_soc_unregister_codec(&pdev->dev); | ||
854 | #endif | ||
855 | 776 | ||
856 | pm_runtime_disable(&pdev->dev); | 777 | pm_runtime_disable(&pdev->dev); |
857 | 778 | ||
@@ -867,7 +788,6 @@ static int hdmi_runtime_suspend(struct device *dev) | |||
867 | clk_disable(hdmi.sys_clk); | 788 | clk_disable(hdmi.sys_clk); |
868 | 789 | ||
869 | dispc_runtime_put(); | 790 | dispc_runtime_put(); |
870 | dss_runtime_put(); | ||
871 | 791 | ||
872 | return 0; | 792 | return 0; |
873 | } | 793 | } |
@@ -876,23 +796,13 @@ static int hdmi_runtime_resume(struct device *dev) | |||
876 | { | 796 | { |
877 | int r; | 797 | int r; |
878 | 798 | ||
879 | r = dss_runtime_get(); | ||
880 | if (r < 0) | ||
881 | goto err_get_dss; | ||
882 | |||
883 | r = dispc_runtime_get(); | 799 | r = dispc_runtime_get(); |
884 | if (r < 0) | 800 | if (r < 0) |
885 | goto err_get_dispc; | 801 | return r; |
886 | |||
887 | 802 | ||
888 | clk_enable(hdmi.sys_clk); | 803 | clk_enable(hdmi.sys_clk); |
889 | 804 | ||
890 | return 0; | 805 | return 0; |
891 | |||
892 | err_get_dispc: | ||
893 | dss_runtime_put(); | ||
894 | err_get_dss: | ||
895 | return r; | ||
896 | } | 806 | } |
897 | 807 | ||
898 | static const struct dev_pm_ops hdmi_pm_ops = { | 808 | static const struct dev_pm_ops hdmi_pm_ops = { |
@@ -901,8 +811,7 @@ static const struct dev_pm_ops hdmi_pm_ops = { | |||
901 | }; | 811 | }; |
902 | 812 | ||
903 | static struct platform_driver omapdss_hdmihw_driver = { | 813 | static struct platform_driver omapdss_hdmihw_driver = { |
904 | .probe = omapdss_hdmihw_probe, | 814 | .remove = __exit_p(omapdss_hdmihw_remove), |
905 | .remove = omapdss_hdmihw_remove, | ||
906 | .driver = { | 815 | .driver = { |
907 | .name = "omapdss_hdmi", | 816 | .name = "omapdss_hdmi", |
908 | .owner = THIS_MODULE, | 817 | .owner = THIS_MODULE, |
@@ -910,12 +819,12 @@ static struct platform_driver omapdss_hdmihw_driver = { | |||
910 | }, | 819 | }, |
911 | }; | 820 | }; |
912 | 821 | ||
913 | int hdmi_init_platform_driver(void) | 822 | int __init hdmi_init_platform_driver(void) |
914 | { | 823 | { |
915 | return platform_driver_register(&omapdss_hdmihw_driver); | 824 | return platform_driver_probe(&omapdss_hdmihw_driver, omapdss_hdmihw_probe); |
916 | } | 825 | } |
917 | 826 | ||
918 | void hdmi_uninit_platform_driver(void) | 827 | void __exit hdmi_uninit_platform_driver(void) |
919 | { | 828 | { |
920 | return platform_driver_unregister(&omapdss_hdmihw_driver); | 829 | platform_driver_unregister(&omapdss_hdmihw_driver); |
921 | } | 830 | } |
diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c index 533d5dc634d2..1179e3c4b1c7 100644 --- a/drivers/video/omap2/dss/hdmi_panel.c +++ b/drivers/video/omap2/dss/hdmi_panel.c | |||
@@ -30,7 +30,12 @@ | |||
30 | #include "dss.h" | 30 | #include "dss.h" |
31 | 31 | ||
32 | static struct { | 32 | static struct { |
33 | struct mutex hdmi_lock; | 33 | /* This protects the panel ops, mainly when accessing the HDMI IP. */ |
34 | struct mutex lock; | ||
35 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) | ||
36 | /* This protects the audio ops, specifically. */ | ||
37 | spinlock_t audio_lock; | ||
38 | #endif | ||
34 | } hdmi; | 39 | } hdmi; |
35 | 40 | ||
36 | 41 | ||
@@ -54,12 +59,168 @@ static void hdmi_panel_remove(struct omap_dss_device *dssdev) | |||
54 | 59 | ||
55 | } | 60 | } |
56 | 61 | ||
62 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) | ||
63 | static int hdmi_panel_audio_enable(struct omap_dss_device *dssdev) | ||
64 | { | ||
65 | unsigned long flags; | ||
66 | int r; | ||
67 | |||
68 | mutex_lock(&hdmi.lock); | ||
69 | spin_lock_irqsave(&hdmi.audio_lock, flags); | ||
70 | |||
71 | /* enable audio only if the display is active and supports audio */ | ||
72 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || | ||
73 | !hdmi_mode_has_audio()) { | ||
74 | DSSERR("audio not supported or display is off\n"); | ||
75 | r = -EPERM; | ||
76 | goto err; | ||
77 | } | ||
78 | |||
79 | r = hdmi_audio_enable(); | ||
80 | |||
81 | if (!r) | ||
82 | dssdev->audio_state = OMAP_DSS_AUDIO_ENABLED; | ||
83 | |||
84 | err: | ||
85 | spin_unlock_irqrestore(&hdmi.audio_lock, flags); | ||
86 | mutex_unlock(&hdmi.lock); | ||
87 | return r; | ||
88 | } | ||
89 | |||
90 | static void hdmi_panel_audio_disable(struct omap_dss_device *dssdev) | ||
91 | { | ||
92 | unsigned long flags; | ||
93 | |||
94 | spin_lock_irqsave(&hdmi.audio_lock, flags); | ||
95 | |||
96 | hdmi_audio_disable(); | ||
97 | |||
98 | dssdev->audio_state = OMAP_DSS_AUDIO_DISABLED; | ||
99 | |||
100 | spin_unlock_irqrestore(&hdmi.audio_lock, flags); | ||
101 | } | ||
102 | |||
103 | static int hdmi_panel_audio_start(struct omap_dss_device *dssdev) | ||
104 | { | ||
105 | unsigned long flags; | ||
106 | int r; | ||
107 | |||
108 | spin_lock_irqsave(&hdmi.audio_lock, flags); | ||
109 | /* | ||
110 | * No need to check the panel state. It was checked when trasitioning | ||
111 | * to AUDIO_ENABLED. | ||
112 | */ | ||
113 | if (dssdev->audio_state != OMAP_DSS_AUDIO_ENABLED) { | ||
114 | DSSERR("audio start from invalid state\n"); | ||
115 | r = -EPERM; | ||
116 | goto err; | ||
117 | } | ||
118 | |||
119 | r = hdmi_audio_start(); | ||
120 | |||
121 | if (!r) | ||
122 | dssdev->audio_state = OMAP_DSS_AUDIO_PLAYING; | ||
123 | |||
124 | err: | ||
125 | spin_unlock_irqrestore(&hdmi.audio_lock, flags); | ||
126 | return r; | ||
127 | } | ||
128 | |||
129 | static void hdmi_panel_audio_stop(struct omap_dss_device *dssdev) | ||
130 | { | ||
131 | unsigned long flags; | ||
132 | |||
133 | spin_lock_irqsave(&hdmi.audio_lock, flags); | ||
134 | |||
135 | hdmi_audio_stop(); | ||
136 | dssdev->audio_state = OMAP_DSS_AUDIO_ENABLED; | ||
137 | |||
138 | spin_unlock_irqrestore(&hdmi.audio_lock, flags); | ||
139 | } | ||
140 | |||
141 | static bool hdmi_panel_audio_supported(struct omap_dss_device *dssdev) | ||
142 | { | ||
143 | bool r = false; | ||
144 | |||
145 | mutex_lock(&hdmi.lock); | ||
146 | |||
147 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
148 | goto err; | ||
149 | |||
150 | if (!hdmi_mode_has_audio()) | ||
151 | goto err; | ||
152 | |||
153 | r = true; | ||
154 | err: | ||
155 | mutex_unlock(&hdmi.lock); | ||
156 | return r; | ||
157 | } | ||
158 | |||
159 | static int hdmi_panel_audio_config(struct omap_dss_device *dssdev, | ||
160 | struct omap_dss_audio *audio) | ||
161 | { | ||
162 | unsigned long flags; | ||
163 | int r; | ||
164 | |||
165 | mutex_lock(&hdmi.lock); | ||
166 | spin_lock_irqsave(&hdmi.audio_lock, flags); | ||
167 | |||
168 | /* config audio only if the display is active and supports audio */ | ||
169 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || | ||
170 | !hdmi_mode_has_audio()) { | ||
171 | DSSERR("audio not supported or display is off\n"); | ||
172 | r = -EPERM; | ||
173 | goto err; | ||
174 | } | ||
175 | |||
176 | r = hdmi_audio_config(audio); | ||
177 | |||
178 | if (!r) | ||
179 | dssdev->audio_state = OMAP_DSS_AUDIO_CONFIGURED; | ||
180 | |||
181 | err: | ||
182 | spin_unlock_irqrestore(&hdmi.audio_lock, flags); | ||
183 | mutex_unlock(&hdmi.lock); | ||
184 | return r; | ||
185 | } | ||
186 | |||
187 | #else | ||
188 | static int hdmi_panel_audio_enable(struct omap_dss_device *dssdev) | ||
189 | { | ||
190 | return -EPERM; | ||
191 | } | ||
192 | |||
193 | static void hdmi_panel_audio_disable(struct omap_dss_device *dssdev) | ||
194 | { | ||
195 | } | ||
196 | |||
197 | static int hdmi_panel_audio_start(struct omap_dss_device *dssdev) | ||
198 | { | ||
199 | return -EPERM; | ||
200 | } | ||
201 | |||
202 | static void hdmi_panel_audio_stop(struct omap_dss_device *dssdev) | ||
203 | { | ||
204 | } | ||
205 | |||
206 | static bool hdmi_panel_audio_supported(struct omap_dss_device *dssdev) | ||
207 | { | ||
208 | return false; | ||
209 | } | ||
210 | |||
211 | static int hdmi_panel_audio_config(struct omap_dss_device *dssdev, | ||
212 | struct omap_dss_audio *audio) | ||
213 | { | ||
214 | return -EPERM; | ||
215 | } | ||
216 | #endif | ||
217 | |||
57 | static int hdmi_panel_enable(struct omap_dss_device *dssdev) | 218 | static int hdmi_panel_enable(struct omap_dss_device *dssdev) |
58 | { | 219 | { |
59 | int r = 0; | 220 | int r = 0; |
60 | DSSDBG("ENTER hdmi_panel_enable\n"); | 221 | DSSDBG("ENTER hdmi_panel_enable\n"); |
61 | 222 | ||
62 | mutex_lock(&hdmi.hdmi_lock); | 223 | mutex_lock(&hdmi.lock); |
63 | 224 | ||
64 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | 225 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { |
65 | r = -EINVAL; | 226 | r = -EINVAL; |
@@ -75,40 +236,52 @@ static int hdmi_panel_enable(struct omap_dss_device *dssdev) | |||
75 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 236 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
76 | 237 | ||
77 | err: | 238 | err: |
78 | mutex_unlock(&hdmi.hdmi_lock); | 239 | mutex_unlock(&hdmi.lock); |
79 | 240 | ||
80 | return r; | 241 | return r; |
81 | } | 242 | } |
82 | 243 | ||
83 | static void hdmi_panel_disable(struct omap_dss_device *dssdev) | 244 | static void hdmi_panel_disable(struct omap_dss_device *dssdev) |
84 | { | 245 | { |
85 | mutex_lock(&hdmi.hdmi_lock); | 246 | mutex_lock(&hdmi.lock); |
86 | 247 | ||
87 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) | 248 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { |
249 | /* | ||
250 | * TODO: notify audio users that the display was disabled. For | ||
251 | * now, disable audio locally to not break our audio state | ||
252 | * machine. | ||
253 | */ | ||
254 | hdmi_panel_audio_disable(dssdev); | ||
88 | omapdss_hdmi_display_disable(dssdev); | 255 | omapdss_hdmi_display_disable(dssdev); |
256 | } | ||
89 | 257 | ||
90 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | 258 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; |
91 | 259 | ||
92 | mutex_unlock(&hdmi.hdmi_lock); | 260 | mutex_unlock(&hdmi.lock); |
93 | } | 261 | } |
94 | 262 | ||
95 | static int hdmi_panel_suspend(struct omap_dss_device *dssdev) | 263 | static int hdmi_panel_suspend(struct omap_dss_device *dssdev) |
96 | { | 264 | { |
97 | int r = 0; | 265 | int r = 0; |
98 | 266 | ||
99 | mutex_lock(&hdmi.hdmi_lock); | 267 | mutex_lock(&hdmi.lock); |
100 | 268 | ||
101 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | 269 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { |
102 | r = -EINVAL; | 270 | r = -EINVAL; |
103 | goto err; | 271 | goto err; |
104 | } | 272 | } |
105 | 273 | ||
106 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | 274 | /* |
275 | * TODO: notify audio users that the display was suspended. For now, | ||
276 | * disable audio locally to not break our audio state machine. | ||
277 | */ | ||
278 | hdmi_panel_audio_disable(dssdev); | ||
107 | 279 | ||
280 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
108 | omapdss_hdmi_display_disable(dssdev); | 281 | omapdss_hdmi_display_disable(dssdev); |
109 | 282 | ||
110 | err: | 283 | err: |
111 | mutex_unlock(&hdmi.hdmi_lock); | 284 | mutex_unlock(&hdmi.lock); |
112 | 285 | ||
113 | return r; | 286 | return r; |
114 | } | 287 | } |
@@ -117,7 +290,7 @@ static int hdmi_panel_resume(struct omap_dss_device *dssdev) | |||
117 | { | 290 | { |
118 | int r = 0; | 291 | int r = 0; |
119 | 292 | ||
120 | mutex_lock(&hdmi.hdmi_lock); | 293 | mutex_lock(&hdmi.lock); |
121 | 294 | ||
122 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { | 295 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { |
123 | r = -EINVAL; | 296 | r = -EINVAL; |
@@ -129,11 +302,12 @@ static int hdmi_panel_resume(struct omap_dss_device *dssdev) | |||
129 | DSSERR("failed to power on\n"); | 302 | DSSERR("failed to power on\n"); |
130 | goto err; | 303 | goto err; |
131 | } | 304 | } |
305 | /* TODO: notify audio users that the panel resumed. */ | ||
132 | 306 | ||
133 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 307 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
134 | 308 | ||
135 | err: | 309 | err: |
136 | mutex_unlock(&hdmi.hdmi_lock); | 310 | mutex_unlock(&hdmi.lock); |
137 | 311 | ||
138 | return r; | 312 | return r; |
139 | } | 313 | } |
@@ -141,11 +315,11 @@ err: | |||
141 | static void hdmi_get_timings(struct omap_dss_device *dssdev, | 315 | static void hdmi_get_timings(struct omap_dss_device *dssdev, |
142 | struct omap_video_timings *timings) | 316 | struct omap_video_timings *timings) |
143 | { | 317 | { |
144 | mutex_lock(&hdmi.hdmi_lock); | 318 | mutex_lock(&hdmi.lock); |
145 | 319 | ||
146 | *timings = dssdev->panel.timings; | 320 | *timings = dssdev->panel.timings; |
147 | 321 | ||
148 | mutex_unlock(&hdmi.hdmi_lock); | 322 | mutex_unlock(&hdmi.lock); |
149 | } | 323 | } |
150 | 324 | ||
151 | static void hdmi_set_timings(struct omap_dss_device *dssdev, | 325 | static void hdmi_set_timings(struct omap_dss_device *dssdev, |
@@ -153,12 +327,18 @@ static void hdmi_set_timings(struct omap_dss_device *dssdev, | |||
153 | { | 327 | { |
154 | DSSDBG("hdmi_set_timings\n"); | 328 | DSSDBG("hdmi_set_timings\n"); |
155 | 329 | ||
156 | mutex_lock(&hdmi.hdmi_lock); | 330 | mutex_lock(&hdmi.lock); |
331 | |||
332 | /* | ||
333 | * TODO: notify audio users that there was a timings change. For | ||
334 | * now, disable audio locally to not break our audio state machine. | ||
335 | */ | ||
336 | hdmi_panel_audio_disable(dssdev); | ||
157 | 337 | ||
158 | dssdev->panel.timings = *timings; | 338 | dssdev->panel.timings = *timings; |
159 | omapdss_hdmi_display_set_timing(dssdev); | 339 | omapdss_hdmi_display_set_timing(dssdev); |
160 | 340 | ||
161 | mutex_unlock(&hdmi.hdmi_lock); | 341 | mutex_unlock(&hdmi.lock); |
162 | } | 342 | } |
163 | 343 | ||
164 | static int hdmi_check_timings(struct omap_dss_device *dssdev, | 344 | static int hdmi_check_timings(struct omap_dss_device *dssdev, |
@@ -168,11 +348,11 @@ static int hdmi_check_timings(struct omap_dss_device *dssdev, | |||
168 | 348 | ||
169 | DSSDBG("hdmi_check_timings\n"); | 349 | DSSDBG("hdmi_check_timings\n"); |
170 | 350 | ||
171 | mutex_lock(&hdmi.hdmi_lock); | 351 | mutex_lock(&hdmi.lock); |
172 | 352 | ||
173 | r = omapdss_hdmi_display_check_timing(dssdev, timings); | 353 | r = omapdss_hdmi_display_check_timing(dssdev, timings); |
174 | 354 | ||
175 | mutex_unlock(&hdmi.hdmi_lock); | 355 | mutex_unlock(&hdmi.lock); |
176 | return r; | 356 | return r; |
177 | } | 357 | } |
178 | 358 | ||
@@ -180,7 +360,7 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len) | |||
180 | { | 360 | { |
181 | int r; | 361 | int r; |
182 | 362 | ||
183 | mutex_lock(&hdmi.hdmi_lock); | 363 | mutex_lock(&hdmi.lock); |
184 | 364 | ||
185 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | 365 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { |
186 | r = omapdss_hdmi_display_enable(dssdev); | 366 | r = omapdss_hdmi_display_enable(dssdev); |
@@ -194,7 +374,7 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len) | |||
194 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | 374 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) |
195 | omapdss_hdmi_display_disable(dssdev); | 375 | omapdss_hdmi_display_disable(dssdev); |
196 | err: | 376 | err: |
197 | mutex_unlock(&hdmi.hdmi_lock); | 377 | mutex_unlock(&hdmi.lock); |
198 | 378 | ||
199 | return r; | 379 | return r; |
200 | } | 380 | } |
@@ -203,7 +383,7 @@ static bool hdmi_detect(struct omap_dss_device *dssdev) | |||
203 | { | 383 | { |
204 | int r; | 384 | int r; |
205 | 385 | ||
206 | mutex_lock(&hdmi.hdmi_lock); | 386 | mutex_lock(&hdmi.lock); |
207 | 387 | ||
208 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | 388 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { |
209 | r = omapdss_hdmi_display_enable(dssdev); | 389 | r = omapdss_hdmi_display_enable(dssdev); |
@@ -217,7 +397,7 @@ static bool hdmi_detect(struct omap_dss_device *dssdev) | |||
217 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | 397 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) |
218 | omapdss_hdmi_display_disable(dssdev); | 398 | omapdss_hdmi_display_disable(dssdev); |
219 | err: | 399 | err: |
220 | mutex_unlock(&hdmi.hdmi_lock); | 400 | mutex_unlock(&hdmi.lock); |
221 | 401 | ||
222 | return r; | 402 | return r; |
223 | } | 403 | } |
@@ -234,6 +414,12 @@ static struct omap_dss_driver hdmi_driver = { | |||
234 | .check_timings = hdmi_check_timings, | 414 | .check_timings = hdmi_check_timings, |
235 | .read_edid = hdmi_read_edid, | 415 | .read_edid = hdmi_read_edid, |
236 | .detect = hdmi_detect, | 416 | .detect = hdmi_detect, |
417 | .audio_enable = hdmi_panel_audio_enable, | ||
418 | .audio_disable = hdmi_panel_audio_disable, | ||
419 | .audio_start = hdmi_panel_audio_start, | ||
420 | .audio_stop = hdmi_panel_audio_stop, | ||
421 | .audio_supported = hdmi_panel_audio_supported, | ||
422 | .audio_config = hdmi_panel_audio_config, | ||
237 | .driver = { | 423 | .driver = { |
238 | .name = "hdmi_panel", | 424 | .name = "hdmi_panel", |
239 | .owner = THIS_MODULE, | 425 | .owner = THIS_MODULE, |
@@ -242,7 +428,11 @@ static struct omap_dss_driver hdmi_driver = { | |||
242 | 428 | ||
243 | int hdmi_panel_init(void) | 429 | int hdmi_panel_init(void) |
244 | { | 430 | { |
245 | mutex_init(&hdmi.hdmi_lock); | 431 | mutex_init(&hdmi.lock); |
432 | |||
433 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) | ||
434 | spin_lock_init(&hdmi.audio_lock); | ||
435 | #endif | ||
246 | 436 | ||
247 | omap_dss_register_driver(&hdmi_driver); | 437 | omap_dss_register_driver(&hdmi_driver); |
248 | 438 | ||
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index e7364603f6a1..0cbcde4c688a 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c | |||
@@ -654,9 +654,20 @@ static int dss_mgr_check_zorder(struct omap_overlay_manager *mgr, | |||
654 | return 0; | 654 | return 0; |
655 | } | 655 | } |
656 | 656 | ||
657 | int dss_mgr_check_timings(struct omap_overlay_manager *mgr, | ||
658 | const struct omap_video_timings *timings) | ||
659 | { | ||
660 | if (!dispc_mgr_timings_ok(mgr->id, timings)) { | ||
661 | DSSERR("check_manager: invalid timings\n"); | ||
662 | return -EINVAL; | ||
663 | } | ||
664 | |||
665 | return 0; | ||
666 | } | ||
667 | |||
657 | int dss_mgr_check(struct omap_overlay_manager *mgr, | 668 | int dss_mgr_check(struct omap_overlay_manager *mgr, |
658 | struct omap_dss_device *dssdev, | ||
659 | struct omap_overlay_manager_info *info, | 669 | struct omap_overlay_manager_info *info, |
670 | const struct omap_video_timings *mgr_timings, | ||
660 | struct omap_overlay_info **overlay_infos) | 671 | struct omap_overlay_info **overlay_infos) |
661 | { | 672 | { |
662 | struct omap_overlay *ovl; | 673 | struct omap_overlay *ovl; |
@@ -668,6 +679,10 @@ int dss_mgr_check(struct omap_overlay_manager *mgr, | |||
668 | return r; | 679 | return r; |
669 | } | 680 | } |
670 | 681 | ||
682 | r = dss_mgr_check_timings(mgr, mgr_timings); | ||
683 | if (r) | ||
684 | return r; | ||
685 | |||
671 | list_for_each_entry(ovl, &mgr->overlays, list) { | 686 | list_for_each_entry(ovl, &mgr->overlays, list) { |
672 | struct omap_overlay_info *oi; | 687 | struct omap_overlay_info *oi; |
673 | int r; | 688 | int r; |
@@ -677,7 +692,7 @@ int dss_mgr_check(struct omap_overlay_manager *mgr, | |||
677 | if (oi == NULL) | 692 | if (oi == NULL) |
678 | continue; | 693 | continue; |
679 | 694 | ||
680 | r = dss_ovl_check(ovl, oi, dssdev); | 695 | r = dss_ovl_check(ovl, oi, mgr_timings); |
681 | if (r) | 696 | if (r) |
682 | return r; | 697 | return r; |
683 | } | 698 | } |
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c index 6e821810deec..b0ba60f88dd2 100644 --- a/drivers/video/omap2/dss/overlay.c +++ b/drivers/video/omap2/dss/overlay.c | |||
@@ -628,19 +628,23 @@ int dss_ovl_simple_check(struct omap_overlay *ovl, | |||
628 | return -EINVAL; | 628 | return -EINVAL; |
629 | } | 629 | } |
630 | 630 | ||
631 | if (dss_feat_rotation_type_supported(info->rotation_type) == 0) { | ||
632 | DSSERR("check_overlay: rotation type %d not supported\n", | ||
633 | info->rotation_type); | ||
634 | return -EINVAL; | ||
635 | } | ||
636 | |||
631 | return 0; | 637 | return 0; |
632 | } | 638 | } |
633 | 639 | ||
634 | int dss_ovl_check(struct omap_overlay *ovl, | 640 | int dss_ovl_check(struct omap_overlay *ovl, struct omap_overlay_info *info, |
635 | struct omap_overlay_info *info, struct omap_dss_device *dssdev) | 641 | const struct omap_video_timings *mgr_timings) |
636 | { | 642 | { |
637 | u16 outw, outh; | 643 | u16 outw, outh; |
638 | u16 dw, dh; | 644 | u16 dw, dh; |
639 | 645 | ||
640 | if (dssdev == NULL) | 646 | dw = mgr_timings->x_res; |
641 | return 0; | 647 | dh = mgr_timings->y_res; |
642 | |||
643 | dssdev->driver->get_resolution(dssdev, &dw, &dh); | ||
644 | 648 | ||
645 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) { | 649 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) { |
646 | outw = info->width; | 650 | outw = info->width; |
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index 788a0ef6323a..3d8c206e90e5 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c | |||
@@ -304,13 +304,23 @@ static void rfbi_transfer_area(struct omap_dss_device *dssdev, u16 width, | |||
304 | u16 height, void (*callback)(void *data), void *data) | 304 | u16 height, void (*callback)(void *data), void *data) |
305 | { | 305 | { |
306 | u32 l; | 306 | u32 l; |
307 | struct omap_video_timings timings = { | ||
308 | .hsw = 1, | ||
309 | .hfp = 1, | ||
310 | .hbp = 1, | ||
311 | .vsw = 1, | ||
312 | .vfp = 0, | ||
313 | .vbp = 0, | ||
314 | .x_res = width, | ||
315 | .y_res = height, | ||
316 | }; | ||
307 | 317 | ||
308 | /*BUG_ON(callback == 0);*/ | 318 | /*BUG_ON(callback == 0);*/ |
309 | BUG_ON(rfbi.framedone_callback != NULL); | 319 | BUG_ON(rfbi.framedone_callback != NULL); |
310 | 320 | ||
311 | DSSDBG("rfbi_transfer_area %dx%d\n", width, height); | 321 | DSSDBG("rfbi_transfer_area %dx%d\n", width, height); |
312 | 322 | ||
313 | dispc_mgr_set_lcd_size(dssdev->manager->id, width, height); | 323 | dss_mgr_set_timings(dssdev->manager, &timings); |
314 | 324 | ||
315 | dispc_mgr_enable(dssdev->manager->id, true); | 325 | dispc_mgr_enable(dssdev->manager->id, true); |
316 | 326 | ||
@@ -766,6 +776,16 @@ int omap_rfbi_prepare_update(struct omap_dss_device *dssdev, | |||
766 | u16 *x, u16 *y, u16 *w, u16 *h) | 776 | u16 *x, u16 *y, u16 *w, u16 *h) |
767 | { | 777 | { |
768 | u16 dw, dh; | 778 | u16 dw, dh; |
779 | struct omap_video_timings timings = { | ||
780 | .hsw = 1, | ||
781 | .hfp = 1, | ||
782 | .hbp = 1, | ||
783 | .vsw = 1, | ||
784 | .vfp = 0, | ||
785 | .vbp = 0, | ||
786 | .x_res = *w, | ||
787 | .y_res = *h, | ||
788 | }; | ||
769 | 789 | ||
770 | dssdev->driver->get_resolution(dssdev, &dw, &dh); | 790 | dssdev->driver->get_resolution(dssdev, &dw, &dh); |
771 | 791 | ||
@@ -784,7 +804,7 @@ int omap_rfbi_prepare_update(struct omap_dss_device *dssdev, | |||
784 | if (*w == 0 || *h == 0) | 804 | if (*w == 0 || *h == 0) |
785 | return -EINVAL; | 805 | return -EINVAL; |
786 | 806 | ||
787 | dispc_mgr_set_lcd_size(dssdev->manager->id, *w, *h); | 807 | dss_mgr_set_timings(dssdev->manager, &timings); |
788 | 808 | ||
789 | return 0; | 809 | return 0; |
790 | } | 810 | } |
@@ -799,7 +819,7 @@ int omap_rfbi_update(struct omap_dss_device *dssdev, | |||
799 | } | 819 | } |
800 | EXPORT_SYMBOL(omap_rfbi_update); | 820 | EXPORT_SYMBOL(omap_rfbi_update); |
801 | 821 | ||
802 | void rfbi_dump_regs(struct seq_file *s) | 822 | static void rfbi_dump_regs(struct seq_file *s) |
803 | { | 823 | { |
804 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r)) | 824 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r)) |
805 | 825 | ||
@@ -900,15 +920,39 @@ void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) | |||
900 | } | 920 | } |
901 | EXPORT_SYMBOL(omapdss_rfbi_display_disable); | 921 | EXPORT_SYMBOL(omapdss_rfbi_display_disable); |
902 | 922 | ||
903 | int rfbi_init_display(struct omap_dss_device *dssdev) | 923 | static int __init rfbi_init_display(struct omap_dss_device *dssdev) |
904 | { | 924 | { |
905 | rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; | 925 | rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; |
906 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; | 926 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; |
907 | return 0; | 927 | return 0; |
908 | } | 928 | } |
909 | 929 | ||
930 | static void __init rfbi_probe_pdata(struct platform_device *pdev) | ||
931 | { | ||
932 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
933 | int i, r; | ||
934 | |||
935 | for (i = 0; i < pdata->num_devices; ++i) { | ||
936 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
937 | |||
938 | if (dssdev->type != OMAP_DISPLAY_TYPE_DBI) | ||
939 | continue; | ||
940 | |||
941 | r = rfbi_init_display(dssdev); | ||
942 | if (r) { | ||
943 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
944 | continue; | ||
945 | } | ||
946 | |||
947 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
948 | if (r) | ||
949 | DSSERR("device %s register failed: %d\n", | ||
950 | dssdev->name, r); | ||
951 | } | ||
952 | } | ||
953 | |||
910 | /* RFBI HW IP initialisation */ | 954 | /* RFBI HW IP initialisation */ |
911 | static int omap_rfbihw_probe(struct platform_device *pdev) | 955 | static int __init omap_rfbihw_probe(struct platform_device *pdev) |
912 | { | 956 | { |
913 | u32 rev; | 957 | u32 rev; |
914 | struct resource *rfbi_mem; | 958 | struct resource *rfbi_mem; |
@@ -956,6 +1000,10 @@ static int omap_rfbihw_probe(struct platform_device *pdev) | |||
956 | 1000 | ||
957 | rfbi_runtime_put(); | 1001 | rfbi_runtime_put(); |
958 | 1002 | ||
1003 | dss_debugfs_create_file("rfbi", rfbi_dump_regs); | ||
1004 | |||
1005 | rfbi_probe_pdata(pdev); | ||
1006 | |||
959 | return 0; | 1007 | return 0; |
960 | 1008 | ||
961 | err_runtime_get: | 1009 | err_runtime_get: |
@@ -963,8 +1011,9 @@ err_runtime_get: | |||
963 | return r; | 1011 | return r; |
964 | } | 1012 | } |
965 | 1013 | ||
966 | static int omap_rfbihw_remove(struct platform_device *pdev) | 1014 | static int __exit omap_rfbihw_remove(struct platform_device *pdev) |
967 | { | 1015 | { |
1016 | omap_dss_unregister_child_devices(&pdev->dev); | ||
968 | pm_runtime_disable(&pdev->dev); | 1017 | pm_runtime_disable(&pdev->dev); |
969 | return 0; | 1018 | return 0; |
970 | } | 1019 | } |
@@ -972,7 +1021,6 @@ static int omap_rfbihw_remove(struct platform_device *pdev) | |||
972 | static int rfbi_runtime_suspend(struct device *dev) | 1021 | static int rfbi_runtime_suspend(struct device *dev) |
973 | { | 1022 | { |
974 | dispc_runtime_put(); | 1023 | dispc_runtime_put(); |
975 | dss_runtime_put(); | ||
976 | 1024 | ||
977 | return 0; | 1025 | return 0; |
978 | } | 1026 | } |
@@ -981,20 +1029,11 @@ static int rfbi_runtime_resume(struct device *dev) | |||
981 | { | 1029 | { |
982 | int r; | 1030 | int r; |
983 | 1031 | ||
984 | r = dss_runtime_get(); | ||
985 | if (r < 0) | ||
986 | goto err_get_dss; | ||
987 | |||
988 | r = dispc_runtime_get(); | 1032 | r = dispc_runtime_get(); |
989 | if (r < 0) | 1033 | if (r < 0) |
990 | goto err_get_dispc; | 1034 | return r; |
991 | 1035 | ||
992 | return 0; | 1036 | return 0; |
993 | |||
994 | err_get_dispc: | ||
995 | dss_runtime_put(); | ||
996 | err_get_dss: | ||
997 | return r; | ||
998 | } | 1037 | } |
999 | 1038 | ||
1000 | static const struct dev_pm_ops rfbi_pm_ops = { | 1039 | static const struct dev_pm_ops rfbi_pm_ops = { |
@@ -1003,8 +1042,7 @@ static const struct dev_pm_ops rfbi_pm_ops = { | |||
1003 | }; | 1042 | }; |
1004 | 1043 | ||
1005 | static struct platform_driver omap_rfbihw_driver = { | 1044 | static struct platform_driver omap_rfbihw_driver = { |
1006 | .probe = omap_rfbihw_probe, | 1045 | .remove = __exit_p(omap_rfbihw_remove), |
1007 | .remove = omap_rfbihw_remove, | ||
1008 | .driver = { | 1046 | .driver = { |
1009 | .name = "omapdss_rfbi", | 1047 | .name = "omapdss_rfbi", |
1010 | .owner = THIS_MODULE, | 1048 | .owner = THIS_MODULE, |
@@ -1012,12 +1050,12 @@ static struct platform_driver omap_rfbihw_driver = { | |||
1012 | }, | 1050 | }, |
1013 | }; | 1051 | }; |
1014 | 1052 | ||
1015 | int rfbi_init_platform_driver(void) | 1053 | int __init rfbi_init_platform_driver(void) |
1016 | { | 1054 | { |
1017 | return platform_driver_register(&omap_rfbihw_driver); | 1055 | return platform_driver_probe(&omap_rfbihw_driver, omap_rfbihw_probe); |
1018 | } | 1056 | } |
1019 | 1057 | ||
1020 | void rfbi_uninit_platform_driver(void) | 1058 | void __exit rfbi_uninit_platform_driver(void) |
1021 | { | 1059 | { |
1022 | return platform_driver_unregister(&omap_rfbihw_driver); | 1060 | platform_driver_unregister(&omap_rfbihw_driver); |
1023 | } | 1061 | } |
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 8266ca0d666b..3a43dc2a9b46 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/regulator/consumer.h> | 25 | #include <linux/regulator/consumer.h> |
26 | #include <linux/export.h> | 26 | #include <linux/export.h> |
27 | #include <linux/platform_device.h> | ||
27 | 28 | ||
28 | #include <video/omapdss.h> | 29 | #include <video/omapdss.h> |
29 | #include "dss.h" | 30 | #include "dss.h" |
@@ -71,10 +72,6 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) | |||
71 | if (r) | 72 | if (r) |
72 | goto err_reg_enable; | 73 | goto err_reg_enable; |
73 | 74 | ||
74 | r = dss_runtime_get(); | ||
75 | if (r) | ||
76 | goto err_get_dss; | ||
77 | |||
78 | r = dispc_runtime_get(); | 75 | r = dispc_runtime_get(); |
79 | if (r) | 76 | if (r) |
80 | goto err_get_dispc; | 77 | goto err_get_dispc; |
@@ -107,7 +104,7 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) | |||
107 | } | 104 | } |
108 | 105 | ||
109 | 106 | ||
110 | dispc_mgr_set_lcd_timings(dssdev->manager->id, t); | 107 | dss_mgr_set_timings(dssdev->manager, t); |
111 | 108 | ||
112 | r = dss_set_clock_div(&dss_cinfo); | 109 | r = dss_set_clock_div(&dss_cinfo); |
113 | if (r) | 110 | if (r) |
@@ -137,8 +134,6 @@ err_set_dss_clock_div: | |||
137 | err_calc_clock_div: | 134 | err_calc_clock_div: |
138 | dispc_runtime_put(); | 135 | dispc_runtime_put(); |
139 | err_get_dispc: | 136 | err_get_dispc: |
140 | dss_runtime_put(); | ||
141 | err_get_dss: | ||
142 | regulator_disable(sdi.vdds_sdi_reg); | 137 | regulator_disable(sdi.vdds_sdi_reg); |
143 | err_reg_enable: | 138 | err_reg_enable: |
144 | omap_dss_stop_device(dssdev); | 139 | omap_dss_stop_device(dssdev); |
@@ -154,7 +149,6 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) | |||
154 | dss_sdi_disable(); | 149 | dss_sdi_disable(); |
155 | 150 | ||
156 | dispc_runtime_put(); | 151 | dispc_runtime_put(); |
157 | dss_runtime_put(); | ||
158 | 152 | ||
159 | regulator_disable(sdi.vdds_sdi_reg); | 153 | regulator_disable(sdi.vdds_sdi_reg); |
160 | 154 | ||
@@ -162,7 +156,7 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) | |||
162 | } | 156 | } |
163 | EXPORT_SYMBOL(omapdss_sdi_display_disable); | 157 | EXPORT_SYMBOL(omapdss_sdi_display_disable); |
164 | 158 | ||
165 | int sdi_init_display(struct omap_dss_device *dssdev) | 159 | static int __init sdi_init_display(struct omap_dss_device *dssdev) |
166 | { | 160 | { |
167 | DSSDBG("SDI init\n"); | 161 | DSSDBG("SDI init\n"); |
168 | 162 | ||
@@ -182,11 +176,58 @@ int sdi_init_display(struct omap_dss_device *dssdev) | |||
182 | return 0; | 176 | return 0; |
183 | } | 177 | } |
184 | 178 | ||
185 | int sdi_init(void) | 179 | static void __init sdi_probe_pdata(struct platform_device *pdev) |
180 | { | ||
181 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
182 | int i, r; | ||
183 | |||
184 | for (i = 0; i < pdata->num_devices; ++i) { | ||
185 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
186 | |||
187 | if (dssdev->type != OMAP_DISPLAY_TYPE_SDI) | ||
188 | continue; | ||
189 | |||
190 | r = sdi_init_display(dssdev); | ||
191 | if (r) { | ||
192 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
193 | continue; | ||
194 | } | ||
195 | |||
196 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
197 | if (r) | ||
198 | DSSERR("device %s register failed: %d\n", | ||
199 | dssdev->name, r); | ||
200 | } | ||
201 | } | ||
202 | |||
203 | static int __init omap_sdi_probe(struct platform_device *pdev) | ||
186 | { | 204 | { |
205 | sdi_probe_pdata(pdev); | ||
206 | |||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static int __exit omap_sdi_remove(struct platform_device *pdev) | ||
211 | { | ||
212 | omap_dss_unregister_child_devices(&pdev->dev); | ||
213 | |||
187 | return 0; | 214 | return 0; |
188 | } | 215 | } |
189 | 216 | ||
190 | void sdi_exit(void) | 217 | static struct platform_driver omap_sdi_driver = { |
218 | .remove = __exit_p(omap_sdi_remove), | ||
219 | .driver = { | ||
220 | .name = "omapdss_sdi", | ||
221 | .owner = THIS_MODULE, | ||
222 | }, | ||
223 | }; | ||
224 | |||
225 | int __init sdi_init_platform_driver(void) | ||
226 | { | ||
227 | return platform_driver_probe(&omap_sdi_driver, omap_sdi_probe); | ||
228 | } | ||
229 | |||
230 | void __exit sdi_uninit_platform_driver(void) | ||
191 | { | 231 | { |
232 | platform_driver_unregister(&omap_sdi_driver); | ||
192 | } | 233 | } |
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h index 1f58b84d6901..e734cb444bc7 100644 --- a/drivers/video/omap2/dss/ti_hdmi.h +++ b/drivers/video/omap2/dss/ti_hdmi.h | |||
@@ -96,7 +96,9 @@ struct ti_hdmi_ip_ops { | |||
96 | 96 | ||
97 | void (*pll_disable)(struct hdmi_ip_data *ip_data); | 97 | void (*pll_disable)(struct hdmi_ip_data *ip_data); |
98 | 98 | ||
99 | void (*video_enable)(struct hdmi_ip_data *ip_data, bool start); | 99 | int (*video_enable)(struct hdmi_ip_data *ip_data); |
100 | |||
101 | void (*video_disable)(struct hdmi_ip_data *ip_data); | ||
100 | 102 | ||
101 | void (*dump_wrapper)(struct hdmi_ip_data *ip_data, struct seq_file *s); | 103 | void (*dump_wrapper)(struct hdmi_ip_data *ip_data, struct seq_file *s); |
102 | 104 | ||
@@ -106,9 +108,17 @@ struct ti_hdmi_ip_ops { | |||
106 | 108 | ||
107 | void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s); | 109 | void (*dump_phy)(struct hdmi_ip_data *ip_data, struct seq_file *s); |
108 | 110 | ||
109 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 111 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) |
110 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | 112 | int (*audio_enable)(struct hdmi_ip_data *ip_data); |
111 | void (*audio_enable)(struct hdmi_ip_data *ip_data, bool start); | 113 | |
114 | void (*audio_disable)(struct hdmi_ip_data *ip_data); | ||
115 | |||
116 | int (*audio_start)(struct hdmi_ip_data *ip_data); | ||
117 | |||
118 | void (*audio_stop)(struct hdmi_ip_data *ip_data); | ||
119 | |||
120 | int (*audio_config)(struct hdmi_ip_data *ip_data, | ||
121 | struct omap_dss_audio *audio); | ||
112 | #endif | 122 | #endif |
113 | 123 | ||
114 | }; | 124 | }; |
@@ -173,7 +183,8 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data); | |||
173 | void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data); | 183 | void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data); |
174 | int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, u8 *edid, int len); | 184 | int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, u8 *edid, int len); |
175 | bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data); | 185 | bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data); |
176 | void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start); | 186 | int ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data); |
187 | void ti_hdmi_4xxx_wp_video_stop(struct hdmi_ip_data *ip_data); | ||
177 | int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data); | 188 | int ti_hdmi_4xxx_pll_enable(struct hdmi_ip_data *ip_data); |
178 | void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data); | 189 | void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data); |
179 | void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data); | 190 | void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data); |
@@ -181,8 +192,13 @@ void ti_hdmi_4xxx_wp_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); | |||
181 | void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); | 192 | void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); |
182 | void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); | 193 | void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); |
183 | void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); | 194 | void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); |
184 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 195 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) |
185 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | 196 | int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts); |
186 | void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable); | 197 | int ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data); |
198 | void ti_hdmi_4xxx_wp_audio_disable(struct hdmi_ip_data *ip_data); | ||
199 | int ti_hdmi_4xxx_audio_start(struct hdmi_ip_data *ip_data); | ||
200 | void ti_hdmi_4xxx_audio_stop(struct hdmi_ip_data *ip_data); | ||
201 | int ti_hdmi_4xxx_audio_config(struct hdmi_ip_data *ip_data, | ||
202 | struct omap_dss_audio *audio); | ||
187 | #endif | 203 | #endif |
188 | #endif | 204 | #endif |
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c index bfe6fe65c8be..4dae1b291079 100644 --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | |||
@@ -29,9 +29,14 @@ | |||
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/seq_file.h> | 30 | #include <linux/seq_file.h> |
31 | #include <linux/gpio.h> | 31 | #include <linux/gpio.h> |
32 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) | ||
33 | #include <sound/asound.h> | ||
34 | #include <sound/asoundef.h> | ||
35 | #endif | ||
32 | 36 | ||
33 | #include "ti_hdmi_4xxx_ip.h" | 37 | #include "ti_hdmi_4xxx_ip.h" |
34 | #include "dss.h" | 38 | #include "dss.h" |
39 | #include "dss_features.h" | ||
35 | 40 | ||
36 | static inline void hdmi_write_reg(void __iomem *base_addr, | 41 | static inline void hdmi_write_reg(void __iomem *base_addr, |
37 | const u16 idx, u32 val) | 42 | const u16 idx, u32 val) |
@@ -298,9 +303,9 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data) | |||
298 | REG_FLD_MOD(phy_base, HDMI_TXPHY_PAD_CFG_CTRL, 0x1, 27, 27); | 303 | REG_FLD_MOD(phy_base, HDMI_TXPHY_PAD_CFG_CTRL, 0x1, 27, 27); |
299 | 304 | ||
300 | r = request_threaded_irq(gpio_to_irq(ip_data->hpd_gpio), | 305 | r = request_threaded_irq(gpio_to_irq(ip_data->hpd_gpio), |
301 | NULL, hpd_irq_handler, | 306 | NULL, hpd_irq_handler, |
302 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | 307 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | |
303 | IRQF_TRIGGER_FALLING, "hpd", ip_data); | 308 | IRQF_ONESHOT, "hpd", ip_data); |
304 | if (r) { | 309 | if (r) { |
305 | DSSERR("HPD IRQ request failed\n"); | 310 | DSSERR("HPD IRQ request failed\n"); |
306 | hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF); | 311 | hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF); |
@@ -699,9 +704,15 @@ static void hdmi_wp_init(struct omap_video_timings *timings, | |||
699 | 704 | ||
700 | } | 705 | } |
701 | 706 | ||
702 | void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start) | 707 | int ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data) |
708 | { | ||
709 | REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, true, 31, 31); | ||
710 | return 0; | ||
711 | } | ||
712 | |||
713 | void ti_hdmi_4xxx_wp_video_stop(struct hdmi_ip_data *ip_data) | ||
703 | { | 714 | { |
704 | REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, start, 31, 31); | 715 | REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, false, 31, 31); |
705 | } | 716 | } |
706 | 717 | ||
707 | static void hdmi_wp_video_init_format(struct hdmi_video_format *video_fmt, | 718 | static void hdmi_wp_video_init_format(struct hdmi_video_format *video_fmt, |
@@ -886,10 +897,12 @@ void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s) | |||
886 | 897 | ||
887 | #define CORE_REG(i, name) name(i) | 898 | #define CORE_REG(i, name) name(i) |
888 | #define DUMPCORE(r) seq_printf(s, "%-35s %08x\n", #r,\ | 899 | #define DUMPCORE(r) seq_printf(s, "%-35s %08x\n", #r,\ |
889 | hdmi_read_reg(hdmi_pll_base(ip_data), r)) | 900 | hdmi_read_reg(hdmi_core_sys_base(ip_data), r)) |
890 | #define DUMPCOREAV(i, r) seq_printf(s, "%s[%d]%*s %08x\n", #r, i, \ | 901 | #define DUMPCOREAV(r) seq_printf(s, "%-35s %08x\n", #r,\ |
902 | hdmi_read_reg(hdmi_av_base(ip_data), r)) | ||
903 | #define DUMPCOREAV2(i, r) seq_printf(s, "%s[%d]%*s %08x\n", #r, i, \ | ||
891 | (i < 10) ? 32 - strlen(#r) : 31 - strlen(#r), " ", \ | 904 | (i < 10) ? 32 - strlen(#r) : 31 - strlen(#r), " ", \ |
892 | hdmi_read_reg(hdmi_pll_base(ip_data), CORE_REG(i, r))) | 905 | hdmi_read_reg(hdmi_av_base(ip_data), CORE_REG(i, r))) |
893 | 906 | ||
894 | DUMPCORE(HDMI_CORE_SYS_VND_IDL); | 907 | DUMPCORE(HDMI_CORE_SYS_VND_IDL); |
895 | DUMPCORE(HDMI_CORE_SYS_DEV_IDL); | 908 | DUMPCORE(HDMI_CORE_SYS_DEV_IDL); |
@@ -898,6 +911,13 @@ void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s) | |||
898 | DUMPCORE(HDMI_CORE_SYS_SRST); | 911 | DUMPCORE(HDMI_CORE_SYS_SRST); |
899 | DUMPCORE(HDMI_CORE_CTRL1); | 912 | DUMPCORE(HDMI_CORE_CTRL1); |
900 | DUMPCORE(HDMI_CORE_SYS_SYS_STAT); | 913 | DUMPCORE(HDMI_CORE_SYS_SYS_STAT); |
914 | DUMPCORE(HDMI_CORE_SYS_DE_DLY); | ||
915 | DUMPCORE(HDMI_CORE_SYS_DE_CTRL); | ||
916 | DUMPCORE(HDMI_CORE_SYS_DE_TOP); | ||
917 | DUMPCORE(HDMI_CORE_SYS_DE_CNTL); | ||
918 | DUMPCORE(HDMI_CORE_SYS_DE_CNTH); | ||
919 | DUMPCORE(HDMI_CORE_SYS_DE_LINL); | ||
920 | DUMPCORE(HDMI_CORE_SYS_DE_LINH_1); | ||
901 | DUMPCORE(HDMI_CORE_SYS_VID_ACEN); | 921 | DUMPCORE(HDMI_CORE_SYS_VID_ACEN); |
902 | DUMPCORE(HDMI_CORE_SYS_VID_MODE); | 922 | DUMPCORE(HDMI_CORE_SYS_VID_MODE); |
903 | DUMPCORE(HDMI_CORE_SYS_INTR_STATE); | 923 | DUMPCORE(HDMI_CORE_SYS_INTR_STATE); |
@@ -907,102 +927,91 @@ void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s) | |||
907 | DUMPCORE(HDMI_CORE_SYS_INTR4); | 927 | DUMPCORE(HDMI_CORE_SYS_INTR4); |
908 | DUMPCORE(HDMI_CORE_SYS_UMASK1); | 928 | DUMPCORE(HDMI_CORE_SYS_UMASK1); |
909 | DUMPCORE(HDMI_CORE_SYS_TMDS_CTRL); | 929 | DUMPCORE(HDMI_CORE_SYS_TMDS_CTRL); |
910 | DUMPCORE(HDMI_CORE_SYS_DE_DLY); | ||
911 | DUMPCORE(HDMI_CORE_SYS_DE_CTRL); | ||
912 | DUMPCORE(HDMI_CORE_SYS_DE_TOP); | ||
913 | DUMPCORE(HDMI_CORE_SYS_DE_CNTL); | ||
914 | DUMPCORE(HDMI_CORE_SYS_DE_CNTH); | ||
915 | DUMPCORE(HDMI_CORE_SYS_DE_LINL); | ||
916 | DUMPCORE(HDMI_CORE_SYS_DE_LINH_1); | ||
917 | 930 | ||
918 | DUMPCORE(HDMI_CORE_DDC_CMD); | ||
919 | DUMPCORE(HDMI_CORE_DDC_STATUS); | ||
920 | DUMPCORE(HDMI_CORE_DDC_ADDR); | 931 | DUMPCORE(HDMI_CORE_DDC_ADDR); |
932 | DUMPCORE(HDMI_CORE_DDC_SEGM); | ||
921 | DUMPCORE(HDMI_CORE_DDC_OFFSET); | 933 | DUMPCORE(HDMI_CORE_DDC_OFFSET); |
922 | DUMPCORE(HDMI_CORE_DDC_COUNT1); | 934 | DUMPCORE(HDMI_CORE_DDC_COUNT1); |
923 | DUMPCORE(HDMI_CORE_DDC_COUNT2); | 935 | DUMPCORE(HDMI_CORE_DDC_COUNT2); |
936 | DUMPCORE(HDMI_CORE_DDC_STATUS); | ||
937 | DUMPCORE(HDMI_CORE_DDC_CMD); | ||
924 | DUMPCORE(HDMI_CORE_DDC_DATA); | 938 | DUMPCORE(HDMI_CORE_DDC_DATA); |
925 | DUMPCORE(HDMI_CORE_DDC_SEGM); | ||
926 | 939 | ||
927 | DUMPCORE(HDMI_CORE_AV_HDMI_CTRL); | 940 | DUMPCOREAV(HDMI_CORE_AV_ACR_CTRL); |
928 | DUMPCORE(HDMI_CORE_AV_DPD); | 941 | DUMPCOREAV(HDMI_CORE_AV_FREQ_SVAL); |
929 | DUMPCORE(HDMI_CORE_AV_PB_CTRL1); | 942 | DUMPCOREAV(HDMI_CORE_AV_N_SVAL1); |
930 | DUMPCORE(HDMI_CORE_AV_PB_CTRL2); | 943 | DUMPCOREAV(HDMI_CORE_AV_N_SVAL2); |
931 | DUMPCORE(HDMI_CORE_AV_AVI_TYPE); | 944 | DUMPCOREAV(HDMI_CORE_AV_N_SVAL3); |
932 | DUMPCORE(HDMI_CORE_AV_AVI_VERS); | 945 | DUMPCOREAV(HDMI_CORE_AV_CTS_SVAL1); |
933 | DUMPCORE(HDMI_CORE_AV_AVI_LEN); | 946 | DUMPCOREAV(HDMI_CORE_AV_CTS_SVAL2); |
934 | DUMPCORE(HDMI_CORE_AV_AVI_CHSUM); | 947 | DUMPCOREAV(HDMI_CORE_AV_CTS_SVAL3); |
948 | DUMPCOREAV(HDMI_CORE_AV_CTS_HVAL1); | ||
949 | DUMPCOREAV(HDMI_CORE_AV_CTS_HVAL2); | ||
950 | DUMPCOREAV(HDMI_CORE_AV_CTS_HVAL3); | ||
951 | DUMPCOREAV(HDMI_CORE_AV_AUD_MODE); | ||
952 | DUMPCOREAV(HDMI_CORE_AV_SPDIF_CTRL); | ||
953 | DUMPCOREAV(HDMI_CORE_AV_HW_SPDIF_FS); | ||
954 | DUMPCOREAV(HDMI_CORE_AV_SWAP_I2S); | ||
955 | DUMPCOREAV(HDMI_CORE_AV_SPDIF_ERTH); | ||
956 | DUMPCOREAV(HDMI_CORE_AV_I2S_IN_MAP); | ||
957 | DUMPCOREAV(HDMI_CORE_AV_I2S_IN_CTRL); | ||
958 | DUMPCOREAV(HDMI_CORE_AV_I2S_CHST0); | ||
959 | DUMPCOREAV(HDMI_CORE_AV_I2S_CHST1); | ||
960 | DUMPCOREAV(HDMI_CORE_AV_I2S_CHST2); | ||
961 | DUMPCOREAV(HDMI_CORE_AV_I2S_CHST4); | ||
962 | DUMPCOREAV(HDMI_CORE_AV_I2S_CHST5); | ||
963 | DUMPCOREAV(HDMI_CORE_AV_ASRC); | ||
964 | DUMPCOREAV(HDMI_CORE_AV_I2S_IN_LEN); | ||
965 | DUMPCOREAV(HDMI_CORE_AV_HDMI_CTRL); | ||
966 | DUMPCOREAV(HDMI_CORE_AV_AUDO_TXSTAT); | ||
967 | DUMPCOREAV(HDMI_CORE_AV_AUD_PAR_BUSCLK_1); | ||
968 | DUMPCOREAV(HDMI_CORE_AV_AUD_PAR_BUSCLK_2); | ||
969 | DUMPCOREAV(HDMI_CORE_AV_AUD_PAR_BUSCLK_3); | ||
970 | DUMPCOREAV(HDMI_CORE_AV_TEST_TXCTRL); | ||
971 | DUMPCOREAV(HDMI_CORE_AV_DPD); | ||
972 | DUMPCOREAV(HDMI_CORE_AV_PB_CTRL1); | ||
973 | DUMPCOREAV(HDMI_CORE_AV_PB_CTRL2); | ||
974 | DUMPCOREAV(HDMI_CORE_AV_AVI_TYPE); | ||
975 | DUMPCOREAV(HDMI_CORE_AV_AVI_VERS); | ||
976 | DUMPCOREAV(HDMI_CORE_AV_AVI_LEN); | ||
977 | DUMPCOREAV(HDMI_CORE_AV_AVI_CHSUM); | ||
935 | 978 | ||
936 | for (i = 0; i < HDMI_CORE_AV_AVI_DBYTE_NELEMS; i++) | 979 | for (i = 0; i < HDMI_CORE_AV_AVI_DBYTE_NELEMS; i++) |
937 | DUMPCOREAV(i, HDMI_CORE_AV_AVI_DBYTE); | 980 | DUMPCOREAV2(i, HDMI_CORE_AV_AVI_DBYTE); |
981 | |||
982 | DUMPCOREAV(HDMI_CORE_AV_SPD_TYPE); | ||
983 | DUMPCOREAV(HDMI_CORE_AV_SPD_VERS); | ||
984 | DUMPCOREAV(HDMI_CORE_AV_SPD_LEN); | ||
985 | DUMPCOREAV(HDMI_CORE_AV_SPD_CHSUM); | ||
938 | 986 | ||
939 | for (i = 0; i < HDMI_CORE_AV_SPD_DBYTE_NELEMS; i++) | 987 | for (i = 0; i < HDMI_CORE_AV_SPD_DBYTE_NELEMS; i++) |
940 | DUMPCOREAV(i, HDMI_CORE_AV_SPD_DBYTE); | 988 | DUMPCOREAV2(i, HDMI_CORE_AV_SPD_DBYTE); |
989 | |||
990 | DUMPCOREAV(HDMI_CORE_AV_AUDIO_TYPE); | ||
991 | DUMPCOREAV(HDMI_CORE_AV_AUDIO_VERS); | ||
992 | DUMPCOREAV(HDMI_CORE_AV_AUDIO_LEN); | ||
993 | DUMPCOREAV(HDMI_CORE_AV_AUDIO_CHSUM); | ||
941 | 994 | ||
942 | for (i = 0; i < HDMI_CORE_AV_AUD_DBYTE_NELEMS; i++) | 995 | for (i = 0; i < HDMI_CORE_AV_AUD_DBYTE_NELEMS; i++) |
943 | DUMPCOREAV(i, HDMI_CORE_AV_AUD_DBYTE); | 996 | DUMPCOREAV2(i, HDMI_CORE_AV_AUD_DBYTE); |
997 | |||
998 | DUMPCOREAV(HDMI_CORE_AV_MPEG_TYPE); | ||
999 | DUMPCOREAV(HDMI_CORE_AV_MPEG_VERS); | ||
1000 | DUMPCOREAV(HDMI_CORE_AV_MPEG_LEN); | ||
1001 | DUMPCOREAV(HDMI_CORE_AV_MPEG_CHSUM); | ||
944 | 1002 | ||
945 | for (i = 0; i < HDMI_CORE_AV_MPEG_DBYTE_NELEMS; i++) | 1003 | for (i = 0; i < HDMI_CORE_AV_MPEG_DBYTE_NELEMS; i++) |
946 | DUMPCOREAV(i, HDMI_CORE_AV_MPEG_DBYTE); | 1004 | DUMPCOREAV2(i, HDMI_CORE_AV_MPEG_DBYTE); |
947 | 1005 | ||
948 | for (i = 0; i < HDMI_CORE_AV_GEN_DBYTE_NELEMS; i++) | 1006 | for (i = 0; i < HDMI_CORE_AV_GEN_DBYTE_NELEMS; i++) |
949 | DUMPCOREAV(i, HDMI_CORE_AV_GEN_DBYTE); | 1007 | DUMPCOREAV2(i, HDMI_CORE_AV_GEN_DBYTE); |
1008 | |||
1009 | DUMPCOREAV(HDMI_CORE_AV_CP_BYTE1); | ||
950 | 1010 | ||
951 | for (i = 0; i < HDMI_CORE_AV_GEN2_DBYTE_NELEMS; i++) | 1011 | for (i = 0; i < HDMI_CORE_AV_GEN2_DBYTE_NELEMS; i++) |
952 | DUMPCOREAV(i, HDMI_CORE_AV_GEN2_DBYTE); | 1012 | DUMPCOREAV2(i, HDMI_CORE_AV_GEN2_DBYTE); |
953 | 1013 | ||
954 | DUMPCORE(HDMI_CORE_AV_ACR_CTRL); | 1014 | DUMPCOREAV(HDMI_CORE_AV_CEC_ADDR_ID); |
955 | DUMPCORE(HDMI_CORE_AV_FREQ_SVAL); | ||
956 | DUMPCORE(HDMI_CORE_AV_N_SVAL1); | ||
957 | DUMPCORE(HDMI_CORE_AV_N_SVAL2); | ||
958 | DUMPCORE(HDMI_CORE_AV_N_SVAL3); | ||
959 | DUMPCORE(HDMI_CORE_AV_CTS_SVAL1); | ||
960 | DUMPCORE(HDMI_CORE_AV_CTS_SVAL2); | ||
961 | DUMPCORE(HDMI_CORE_AV_CTS_SVAL3); | ||
962 | DUMPCORE(HDMI_CORE_AV_CTS_HVAL1); | ||
963 | DUMPCORE(HDMI_CORE_AV_CTS_HVAL2); | ||
964 | DUMPCORE(HDMI_CORE_AV_CTS_HVAL3); | ||
965 | DUMPCORE(HDMI_CORE_AV_AUD_MODE); | ||
966 | DUMPCORE(HDMI_CORE_AV_SPDIF_CTRL); | ||
967 | DUMPCORE(HDMI_CORE_AV_HW_SPDIF_FS); | ||
968 | DUMPCORE(HDMI_CORE_AV_SWAP_I2S); | ||
969 | DUMPCORE(HDMI_CORE_AV_SPDIF_ERTH); | ||
970 | DUMPCORE(HDMI_CORE_AV_I2S_IN_MAP); | ||
971 | DUMPCORE(HDMI_CORE_AV_I2S_IN_CTRL); | ||
972 | DUMPCORE(HDMI_CORE_AV_I2S_CHST0); | ||
973 | DUMPCORE(HDMI_CORE_AV_I2S_CHST1); | ||
974 | DUMPCORE(HDMI_CORE_AV_I2S_CHST2); | ||
975 | DUMPCORE(HDMI_CORE_AV_I2S_CHST4); | ||
976 | DUMPCORE(HDMI_CORE_AV_I2S_CHST5); | ||
977 | DUMPCORE(HDMI_CORE_AV_ASRC); | ||
978 | DUMPCORE(HDMI_CORE_AV_I2S_IN_LEN); | ||
979 | DUMPCORE(HDMI_CORE_AV_HDMI_CTRL); | ||
980 | DUMPCORE(HDMI_CORE_AV_AUDO_TXSTAT); | ||
981 | DUMPCORE(HDMI_CORE_AV_AUD_PAR_BUSCLK_1); | ||
982 | DUMPCORE(HDMI_CORE_AV_AUD_PAR_BUSCLK_2); | ||
983 | DUMPCORE(HDMI_CORE_AV_AUD_PAR_BUSCLK_3); | ||
984 | DUMPCORE(HDMI_CORE_AV_TEST_TXCTRL); | ||
985 | DUMPCORE(HDMI_CORE_AV_DPD); | ||
986 | DUMPCORE(HDMI_CORE_AV_PB_CTRL1); | ||
987 | DUMPCORE(HDMI_CORE_AV_PB_CTRL2); | ||
988 | DUMPCORE(HDMI_CORE_AV_AVI_TYPE); | ||
989 | DUMPCORE(HDMI_CORE_AV_AVI_VERS); | ||
990 | DUMPCORE(HDMI_CORE_AV_AVI_LEN); | ||
991 | DUMPCORE(HDMI_CORE_AV_AVI_CHSUM); | ||
992 | DUMPCORE(HDMI_CORE_AV_SPD_TYPE); | ||
993 | DUMPCORE(HDMI_CORE_AV_SPD_VERS); | ||
994 | DUMPCORE(HDMI_CORE_AV_SPD_LEN); | ||
995 | DUMPCORE(HDMI_CORE_AV_SPD_CHSUM); | ||
996 | DUMPCORE(HDMI_CORE_AV_AUDIO_TYPE); | ||
997 | DUMPCORE(HDMI_CORE_AV_AUDIO_VERS); | ||
998 | DUMPCORE(HDMI_CORE_AV_AUDIO_LEN); | ||
999 | DUMPCORE(HDMI_CORE_AV_AUDIO_CHSUM); | ||
1000 | DUMPCORE(HDMI_CORE_AV_MPEG_TYPE); | ||
1001 | DUMPCORE(HDMI_CORE_AV_MPEG_VERS); | ||
1002 | DUMPCORE(HDMI_CORE_AV_MPEG_LEN); | ||
1003 | DUMPCORE(HDMI_CORE_AV_MPEG_CHSUM); | ||
1004 | DUMPCORE(HDMI_CORE_AV_CP_BYTE1); | ||
1005 | DUMPCORE(HDMI_CORE_AV_CEC_ADDR_ID); | ||
1006 | } | 1015 | } |
1007 | 1016 | ||
1008 | void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s) | 1017 | void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s) |
@@ -1016,9 +1025,8 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s) | |||
1016 | DUMPPHY(HDMI_TXPHY_PAD_CFG_CTRL); | 1025 | DUMPPHY(HDMI_TXPHY_PAD_CFG_CTRL); |
1017 | } | 1026 | } |
1018 | 1027 | ||
1019 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 1028 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) |
1020 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | 1029 | static void ti_hdmi_4xxx_wp_audio_config_format(struct hdmi_ip_data *ip_data, |
1021 | void hdmi_wp_audio_config_format(struct hdmi_ip_data *ip_data, | ||
1022 | struct hdmi_audio_format *aud_fmt) | 1030 | struct hdmi_audio_format *aud_fmt) |
1023 | { | 1031 | { |
1024 | u32 r; | 1032 | u32 r; |
@@ -1037,7 +1045,7 @@ void hdmi_wp_audio_config_format(struct hdmi_ip_data *ip_data, | |||
1037 | hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CFG, r); | 1045 | hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CFG, r); |
1038 | } | 1046 | } |
1039 | 1047 | ||
1040 | void hdmi_wp_audio_config_dma(struct hdmi_ip_data *ip_data, | 1048 | static void ti_hdmi_4xxx_wp_audio_config_dma(struct hdmi_ip_data *ip_data, |
1041 | struct hdmi_audio_dma *aud_dma) | 1049 | struct hdmi_audio_dma *aud_dma) |
1042 | { | 1050 | { |
1043 | u32 r; | 1051 | u32 r; |
@@ -1055,7 +1063,7 @@ void hdmi_wp_audio_config_dma(struct hdmi_ip_data *ip_data, | |||
1055 | hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CTRL, r); | 1063 | hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CTRL, r); |
1056 | } | 1064 | } |
1057 | 1065 | ||
1058 | void hdmi_core_audio_config(struct hdmi_ip_data *ip_data, | 1066 | static void ti_hdmi_4xxx_core_audio_config(struct hdmi_ip_data *ip_data, |
1059 | struct hdmi_core_audio_config *cfg) | 1067 | struct hdmi_core_audio_config *cfg) |
1060 | { | 1068 | { |
1061 | u32 r; | 1069 | u32 r; |
@@ -1106,27 +1114,33 @@ void hdmi_core_audio_config(struct hdmi_ip_data *ip_data, | |||
1106 | REG_FLD_MOD(av_base, HDMI_CORE_AV_SPDIF_CTRL, | 1114 | REG_FLD_MOD(av_base, HDMI_CORE_AV_SPDIF_CTRL, |
1107 | cfg->fs_override, 1, 1); | 1115 | cfg->fs_override, 1, 1); |
1108 | 1116 | ||
1109 | /* I2S parameters */ | 1117 | /* |
1110 | REG_FLD_MOD(av_base, HDMI_CORE_AV_I2S_CHST4, | 1118 | * Set IEC-60958-3 channel status word. It is passed to the IP |
1111 | cfg->freq_sample, 3, 0); | 1119 | * just as it is received. The user of the driver is responsible |
1112 | 1120 | * for its contents. | |
1121 | */ | ||
1122 | hdmi_write_reg(av_base, HDMI_CORE_AV_I2S_CHST0, | ||
1123 | cfg->iec60958_cfg->status[0]); | ||
1124 | hdmi_write_reg(av_base, HDMI_CORE_AV_I2S_CHST1, | ||
1125 | cfg->iec60958_cfg->status[1]); | ||
1126 | hdmi_write_reg(av_base, HDMI_CORE_AV_I2S_CHST2, | ||
1127 | cfg->iec60958_cfg->status[2]); | ||
1128 | /* yes, this is correct: status[3] goes to CHST4 register */ | ||
1129 | hdmi_write_reg(av_base, HDMI_CORE_AV_I2S_CHST4, | ||
1130 | cfg->iec60958_cfg->status[3]); | ||
1131 | /* yes, this is correct: status[4] goes to CHST5 register */ | ||
1132 | hdmi_write_reg(av_base, HDMI_CORE_AV_I2S_CHST5, | ||
1133 | cfg->iec60958_cfg->status[4]); | ||
1134 | |||
1135 | /* set I2S parameters */ | ||
1113 | r = hdmi_read_reg(av_base, HDMI_CORE_AV_I2S_IN_CTRL); | 1136 | r = hdmi_read_reg(av_base, HDMI_CORE_AV_I2S_IN_CTRL); |
1114 | r = FLD_MOD(r, cfg->i2s_cfg.en_high_bitrate_aud, 7, 7); | ||
1115 | r = FLD_MOD(r, cfg->i2s_cfg.sck_edge_mode, 6, 6); | 1137 | r = FLD_MOD(r, cfg->i2s_cfg.sck_edge_mode, 6, 6); |
1116 | r = FLD_MOD(r, cfg->i2s_cfg.cbit_order, 5, 5); | ||
1117 | r = FLD_MOD(r, cfg->i2s_cfg.vbit, 4, 4); | 1138 | r = FLD_MOD(r, cfg->i2s_cfg.vbit, 4, 4); |
1118 | r = FLD_MOD(r, cfg->i2s_cfg.ws_polarity, 3, 3); | ||
1119 | r = FLD_MOD(r, cfg->i2s_cfg.justification, 2, 2); | 1139 | r = FLD_MOD(r, cfg->i2s_cfg.justification, 2, 2); |
1120 | r = FLD_MOD(r, cfg->i2s_cfg.direction, 1, 1); | 1140 | r = FLD_MOD(r, cfg->i2s_cfg.direction, 1, 1); |
1121 | r = FLD_MOD(r, cfg->i2s_cfg.shift, 0, 0); | 1141 | r = FLD_MOD(r, cfg->i2s_cfg.shift, 0, 0); |
1122 | hdmi_write_reg(av_base, HDMI_CORE_AV_I2S_IN_CTRL, r); | 1142 | hdmi_write_reg(av_base, HDMI_CORE_AV_I2S_IN_CTRL, r); |
1123 | 1143 | ||
1124 | r = hdmi_read_reg(av_base, HDMI_CORE_AV_I2S_CHST5); | ||
1125 | r = FLD_MOD(r, cfg->freq_sample, 7, 4); | ||
1126 | r = FLD_MOD(r, cfg->i2s_cfg.word_length, 3, 1); | ||
1127 | r = FLD_MOD(r, cfg->i2s_cfg.word_max_length, 0, 0); | ||
1128 | hdmi_write_reg(av_base, HDMI_CORE_AV_I2S_CHST5, r); | ||
1129 | |||
1130 | REG_FLD_MOD(av_base, HDMI_CORE_AV_I2S_IN_LEN, | 1144 | REG_FLD_MOD(av_base, HDMI_CORE_AV_I2S_IN_LEN, |
1131 | cfg->i2s_cfg.in_length_bits, 3, 0); | 1145 | cfg->i2s_cfg.in_length_bits, 3, 0); |
1132 | 1146 | ||
@@ -1138,12 +1152,19 @@ void hdmi_core_audio_config(struct hdmi_ip_data *ip_data, | |||
1138 | r = FLD_MOD(r, cfg->en_parallel_aud_input, 2, 2); | 1152 | r = FLD_MOD(r, cfg->en_parallel_aud_input, 2, 2); |
1139 | r = FLD_MOD(r, cfg->en_spdif, 1, 1); | 1153 | r = FLD_MOD(r, cfg->en_spdif, 1, 1); |
1140 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_MODE, r); | 1154 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_MODE, r); |
1155 | |||
1156 | /* Audio channel mappings */ | ||
1157 | /* TODO: Make channel mapping dynamic. For now, map channels | ||
1158 | * in the ALSA order: FL/FR/RL/RR/C/LFE/SL/SR. Remapping is needed as | ||
1159 | * HDMI speaker order is different. See CEA-861 Section 6.6.2. | ||
1160 | */ | ||
1161 | hdmi_write_reg(av_base, HDMI_CORE_AV_I2S_IN_MAP, 0x78); | ||
1162 | REG_FLD_MOD(av_base, HDMI_CORE_AV_SWAP_I2S, 1, 5, 5); | ||
1141 | } | 1163 | } |
1142 | 1164 | ||
1143 | void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data, | 1165 | static void ti_hdmi_4xxx_core_audio_infoframe_cfg(struct hdmi_ip_data *ip_data, |
1144 | struct hdmi_core_infoframe_audio *info_aud) | 1166 | struct snd_cea_861_aud_if *info_aud) |
1145 | { | 1167 | { |
1146 | u8 val; | ||
1147 | u8 sum = 0, checksum = 0; | 1168 | u8 sum = 0, checksum = 0; |
1148 | void __iomem *av_base = hdmi_av_base(ip_data); | 1169 | void __iomem *av_base = hdmi_av_base(ip_data); |
1149 | 1170 | ||
@@ -1157,24 +1178,23 @@ void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data, | |||
1157 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUDIO_LEN, 0x0a); | 1178 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUDIO_LEN, 0x0a); |
1158 | sum += 0x84 + 0x001 + 0x00a; | 1179 | sum += 0x84 + 0x001 + 0x00a; |
1159 | 1180 | ||
1160 | val = (info_aud->db1_coding_type << 4) | 1181 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(0), |
1161 | | (info_aud->db1_channel_count - 1); | 1182 | info_aud->db1_ct_cc); |
1162 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(0), val); | 1183 | sum += info_aud->db1_ct_cc; |
1163 | sum += val; | ||
1164 | 1184 | ||
1165 | val = (info_aud->db2_sample_freq << 2) | info_aud->db2_sample_size; | 1185 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(1), |
1166 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(1), val); | 1186 | info_aud->db2_sf_ss); |
1167 | sum += val; | 1187 | sum += info_aud->db2_sf_ss; |
1168 | 1188 | ||
1169 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(2), 0x00); | 1189 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(2), info_aud->db3); |
1190 | sum += info_aud->db3; | ||
1170 | 1191 | ||
1171 | val = info_aud->db4_channel_alloc; | 1192 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(3), info_aud->db4_ca); |
1172 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(3), val); | 1193 | sum += info_aud->db4_ca; |
1173 | sum += val; | ||
1174 | 1194 | ||
1175 | val = (info_aud->db5_downmix_inh << 7) | (info_aud->db5_lsv << 3); | 1195 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(4), |
1176 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(4), val); | 1196 | info_aud->db5_dminh_lsv); |
1177 | sum += val; | 1197 | sum += info_aud->db5_dminh_lsv; |
1178 | 1198 | ||
1179 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(5), 0x00); | 1199 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(5), 0x00); |
1180 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(6), 0x00); | 1200 | hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(6), 0x00); |
@@ -1192,70 +1212,212 @@ void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data, | |||
1192 | */ | 1212 | */ |
1193 | } | 1213 | } |
1194 | 1214 | ||
1195 | int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data, | 1215 | int ti_hdmi_4xxx_audio_config(struct hdmi_ip_data *ip_data, |
1196 | u32 sample_freq, u32 *n, u32 *cts) | 1216 | struct omap_dss_audio *audio) |
1197 | { | 1217 | { |
1198 | u32 r; | 1218 | struct hdmi_audio_format audio_format; |
1199 | u32 deep_color = 0; | 1219 | struct hdmi_audio_dma audio_dma; |
1200 | u32 pclk = ip_data->cfg.timings.pixel_clock; | 1220 | struct hdmi_core_audio_config core; |
1201 | 1221 | int err, n, cts, channel_count; | |
1202 | if (n == NULL || cts == NULL) | 1222 | unsigned int fs_nr; |
1223 | bool word_length_16b = false; | ||
1224 | |||
1225 | if (!audio || !audio->iec || !audio->cea || !ip_data) | ||
1203 | return -EINVAL; | 1226 | return -EINVAL; |
1227 | |||
1228 | core.iec60958_cfg = audio->iec; | ||
1204 | /* | 1229 | /* |
1205 | * Obtain current deep color configuration. This needed | 1230 | * In the IEC-60958 status word, check if the audio sample word length |
1206 | * to calculate the TMDS clock based on the pixel clock. | 1231 | * is 16-bit as several optimizations can be performed in such case. |
1207 | */ | 1232 | */ |
1208 | r = REG_GET(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, 1, 0); | 1233 | if (!(audio->iec->status[4] & IEC958_AES4_CON_MAX_WORDLEN_24)) |
1209 | switch (r) { | 1234 | if (audio->iec->status[4] & IEC958_AES4_CON_WORDLEN_20_16) |
1210 | case 1: /* No deep color selected */ | 1235 | word_length_16b = true; |
1211 | deep_color = 100; | 1236 | |
1237 | /* I2S configuration. See Phillips' specification */ | ||
1238 | if (word_length_16b) | ||
1239 | core.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_LEFT; | ||
1240 | else | ||
1241 | core.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_RIGHT; | ||
1242 | /* | ||
1243 | * The I2S input word length is twice the lenght given in the IEC-60958 | ||
1244 | * status word. If the word size is greater than | ||
1245 | * 20 bits, increment by one. | ||
1246 | */ | ||
1247 | core.i2s_cfg.in_length_bits = audio->iec->status[4] | ||
1248 | & IEC958_AES4_CON_WORDLEN; | ||
1249 | if (audio->iec->status[4] & IEC958_AES4_CON_MAX_WORDLEN_24) | ||
1250 | core.i2s_cfg.in_length_bits++; | ||
1251 | core.i2s_cfg.sck_edge_mode = HDMI_AUDIO_I2S_SCK_EDGE_RISING; | ||
1252 | core.i2s_cfg.vbit = HDMI_AUDIO_I2S_VBIT_FOR_PCM; | ||
1253 | core.i2s_cfg.direction = HDMI_AUDIO_I2S_MSB_SHIFTED_FIRST; | ||
1254 | core.i2s_cfg.shift = HDMI_AUDIO_I2S_FIRST_BIT_SHIFT; | ||
1255 | |||
1256 | /* convert sample frequency to a number */ | ||
1257 | switch (audio->iec->status[3] & IEC958_AES3_CON_FS) { | ||
1258 | case IEC958_AES3_CON_FS_32000: | ||
1259 | fs_nr = 32000; | ||
1260 | break; | ||
1261 | case IEC958_AES3_CON_FS_44100: | ||
1262 | fs_nr = 44100; | ||
1263 | break; | ||
1264 | case IEC958_AES3_CON_FS_48000: | ||
1265 | fs_nr = 48000; | ||
1212 | break; | 1266 | break; |
1213 | case 2: /* 10-bit deep color selected */ | 1267 | case IEC958_AES3_CON_FS_88200: |
1214 | deep_color = 125; | 1268 | fs_nr = 88200; |
1215 | break; | 1269 | break; |
1216 | case 3: /* 12-bit deep color selected */ | 1270 | case IEC958_AES3_CON_FS_96000: |
1217 | deep_color = 150; | 1271 | fs_nr = 96000; |
1272 | break; | ||
1273 | case IEC958_AES3_CON_FS_176400: | ||
1274 | fs_nr = 176400; | ||
1275 | break; | ||
1276 | case IEC958_AES3_CON_FS_192000: | ||
1277 | fs_nr = 192000; | ||
1218 | break; | 1278 | break; |
1219 | default: | 1279 | default: |
1220 | return -EINVAL; | 1280 | return -EINVAL; |
1221 | } | 1281 | } |
1222 | 1282 | ||
1223 | switch (sample_freq) { | 1283 | err = hdmi_compute_acr(fs_nr, &n, &cts); |
1224 | case 32000: | 1284 | |
1225 | if ((deep_color == 125) && ((pclk == 54054) | 1285 | /* Audio clock regeneration settings */ |
1226 | || (pclk == 74250))) | 1286 | core.n = n; |
1227 | *n = 8192; | 1287 | core.cts = cts; |
1228 | else | 1288 | if (dss_has_feature(FEAT_HDMI_CTS_SWMODE)) { |
1229 | *n = 4096; | 1289 | core.aud_par_busclk = 0; |
1290 | core.cts_mode = HDMI_AUDIO_CTS_MODE_SW; | ||
1291 | core.use_mclk = dss_has_feature(FEAT_HDMI_AUDIO_USE_MCLK); | ||
1292 | } else { | ||
1293 | core.aud_par_busclk = (((128 * 31) - 1) << 8); | ||
1294 | core.cts_mode = HDMI_AUDIO_CTS_MODE_HW; | ||
1295 | core.use_mclk = true; | ||
1296 | } | ||
1297 | |||
1298 | if (core.use_mclk) | ||
1299 | core.mclk_mode = HDMI_AUDIO_MCLK_128FS; | ||
1300 | |||
1301 | /* Audio channels settings */ | ||
1302 | channel_count = (audio->cea->db1_ct_cc & | ||
1303 | CEA861_AUDIO_INFOFRAME_DB1CC) + 1; | ||
1304 | |||
1305 | switch (channel_count) { | ||
1306 | case 2: | ||
1307 | audio_format.active_chnnls_msk = 0x03; | ||
1308 | break; | ||
1309 | case 3: | ||
1310 | audio_format.active_chnnls_msk = 0x07; | ||
1311 | break; | ||
1312 | case 4: | ||
1313 | audio_format.active_chnnls_msk = 0x0f; | ||
1314 | break; | ||
1315 | case 5: | ||
1316 | audio_format.active_chnnls_msk = 0x1f; | ||
1230 | break; | 1317 | break; |
1231 | case 44100: | 1318 | case 6: |
1232 | *n = 6272; | 1319 | audio_format.active_chnnls_msk = 0x3f; |
1233 | break; | 1320 | break; |
1234 | case 48000: | 1321 | case 7: |
1235 | if ((deep_color == 125) && ((pclk == 54054) | 1322 | audio_format.active_chnnls_msk = 0x7f; |
1236 | || (pclk == 74250))) | 1323 | break; |
1237 | *n = 8192; | 1324 | case 8: |
1238 | else | 1325 | audio_format.active_chnnls_msk = 0xff; |
1239 | *n = 6144; | ||
1240 | break; | 1326 | break; |
1241 | default: | 1327 | default: |
1242 | *n = 0; | ||
1243 | return -EINVAL; | 1328 | return -EINVAL; |
1244 | } | 1329 | } |
1245 | 1330 | ||
1246 | /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */ | 1331 | /* |
1247 | *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10); | 1332 | * the HDMI IP needs to enable four stereo channels when transmitting |
1333 | * more than 2 audio channels | ||
1334 | */ | ||
1335 | if (channel_count == 2) { | ||
1336 | audio_format.stereo_channels = HDMI_AUDIO_STEREO_ONECHANNEL; | ||
1337 | core.i2s_cfg.active_sds = HDMI_AUDIO_I2S_SD0_EN; | ||
1338 | core.layout = HDMI_AUDIO_LAYOUT_2CH; | ||
1339 | } else { | ||
1340 | audio_format.stereo_channels = HDMI_AUDIO_STEREO_FOURCHANNELS; | ||
1341 | core.i2s_cfg.active_sds = HDMI_AUDIO_I2S_SD0_EN | | ||
1342 | HDMI_AUDIO_I2S_SD1_EN | HDMI_AUDIO_I2S_SD2_EN | | ||
1343 | HDMI_AUDIO_I2S_SD3_EN; | ||
1344 | core.layout = HDMI_AUDIO_LAYOUT_8CH; | ||
1345 | } | ||
1346 | |||
1347 | core.en_spdif = false; | ||
1348 | /* use sample frequency from channel status word */ | ||
1349 | core.fs_override = true; | ||
1350 | /* enable ACR packets */ | ||
1351 | core.en_acr_pkt = true; | ||
1352 | /* disable direct streaming digital audio */ | ||
1353 | core.en_dsd_audio = false; | ||
1354 | /* use parallel audio interface */ | ||
1355 | core.en_parallel_aud_input = true; | ||
1356 | |||
1357 | /* DMA settings */ | ||
1358 | if (word_length_16b) | ||
1359 | audio_dma.transfer_size = 0x10; | ||
1360 | else | ||
1361 | audio_dma.transfer_size = 0x20; | ||
1362 | audio_dma.block_size = 0xC0; | ||
1363 | audio_dma.mode = HDMI_AUDIO_TRANSF_DMA; | ||
1364 | audio_dma.fifo_threshold = 0x20; /* in number of samples */ | ||
1365 | |||
1366 | /* audio FIFO format settings */ | ||
1367 | if (word_length_16b) { | ||
1368 | audio_format.samples_per_word = HDMI_AUDIO_ONEWORD_TWOSAMPLES; | ||
1369 | audio_format.sample_size = HDMI_AUDIO_SAMPLE_16BITS; | ||
1370 | audio_format.justification = HDMI_AUDIO_JUSTIFY_LEFT; | ||
1371 | } else { | ||
1372 | audio_format.samples_per_word = HDMI_AUDIO_ONEWORD_ONESAMPLE; | ||
1373 | audio_format.sample_size = HDMI_AUDIO_SAMPLE_24BITS; | ||
1374 | audio_format.justification = HDMI_AUDIO_JUSTIFY_RIGHT; | ||
1375 | } | ||
1376 | audio_format.type = HDMI_AUDIO_TYPE_LPCM; | ||
1377 | audio_format.sample_order = HDMI_AUDIO_SAMPLE_LEFT_FIRST; | ||
1378 | /* disable start/stop signals of IEC 60958 blocks */ | ||
1379 | audio_format.en_sig_blk_strt_end = HDMI_AUDIO_BLOCK_SIG_STARTEND_ON; | ||
1380 | |||
1381 | /* configure DMA and audio FIFO format*/ | ||
1382 | ti_hdmi_4xxx_wp_audio_config_dma(ip_data, &audio_dma); | ||
1383 | ti_hdmi_4xxx_wp_audio_config_format(ip_data, &audio_format); | ||
1384 | |||
1385 | /* configure the core*/ | ||
1386 | ti_hdmi_4xxx_core_audio_config(ip_data, &core); | ||
1387 | |||
1388 | /* configure CEA 861 audio infoframe*/ | ||
1389 | ti_hdmi_4xxx_core_audio_infoframe_cfg(ip_data, audio->cea); | ||
1248 | 1390 | ||
1249 | return 0; | 1391 | return 0; |
1250 | } | 1392 | } |
1251 | 1393 | ||
1252 | void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable) | 1394 | int ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data) |
1395 | { | ||
1396 | REG_FLD_MOD(hdmi_wp_base(ip_data), | ||
1397 | HDMI_WP_AUDIO_CTRL, true, 31, 31); | ||
1398 | return 0; | ||
1399 | } | ||
1400 | |||
1401 | void ti_hdmi_4xxx_wp_audio_disable(struct hdmi_ip_data *ip_data) | ||
1402 | { | ||
1403 | REG_FLD_MOD(hdmi_wp_base(ip_data), | ||
1404 | HDMI_WP_AUDIO_CTRL, false, 31, 31); | ||
1405 | } | ||
1406 | |||
1407 | int ti_hdmi_4xxx_audio_start(struct hdmi_ip_data *ip_data) | ||
1253 | { | 1408 | { |
1254 | REG_FLD_MOD(hdmi_av_base(ip_data), | 1409 | REG_FLD_MOD(hdmi_av_base(ip_data), |
1255 | HDMI_CORE_AV_AUD_MODE, enable, 0, 0); | 1410 | HDMI_CORE_AV_AUD_MODE, true, 0, 0); |
1256 | REG_FLD_MOD(hdmi_wp_base(ip_data), | 1411 | REG_FLD_MOD(hdmi_wp_base(ip_data), |
1257 | HDMI_WP_AUDIO_CTRL, enable, 31, 31); | 1412 | HDMI_WP_AUDIO_CTRL, true, 30, 30); |
1413 | return 0; | ||
1414 | } | ||
1415 | |||
1416 | void ti_hdmi_4xxx_audio_stop(struct hdmi_ip_data *ip_data) | ||
1417 | { | ||
1418 | REG_FLD_MOD(hdmi_av_base(ip_data), | ||
1419 | HDMI_CORE_AV_AUD_MODE, false, 0, 0); | ||
1258 | REG_FLD_MOD(hdmi_wp_base(ip_data), | 1420 | REG_FLD_MOD(hdmi_wp_base(ip_data), |
1259 | HDMI_WP_AUDIO_CTRL, enable, 30, 30); | 1421 | HDMI_WP_AUDIO_CTRL, false, 30, 30); |
1260 | } | 1422 | } |
1261 | #endif | 1423 | #endif |
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h index a14d1a0e6e41..8366ae19e82e 100644 --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h | |||
@@ -24,11 +24,6 @@ | |||
24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
25 | #include <video/omapdss.h> | 25 | #include <video/omapdss.h> |
26 | #include "ti_hdmi.h" | 26 | #include "ti_hdmi.h" |
27 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | ||
28 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | ||
29 | #include <sound/soc.h> | ||
30 | #include <sound/pcm_params.h> | ||
31 | #endif | ||
32 | 27 | ||
33 | /* HDMI Wrapper */ | 28 | /* HDMI Wrapper */ |
34 | 29 | ||
@@ -57,6 +52,13 @@ | |||
57 | #define HDMI_CORE_SYS_SRST 0x14 | 52 | #define HDMI_CORE_SYS_SRST 0x14 |
58 | #define HDMI_CORE_CTRL1 0x20 | 53 | #define HDMI_CORE_CTRL1 0x20 |
59 | #define HDMI_CORE_SYS_SYS_STAT 0x24 | 54 | #define HDMI_CORE_SYS_SYS_STAT 0x24 |
55 | #define HDMI_CORE_SYS_DE_DLY 0xC8 | ||
56 | #define HDMI_CORE_SYS_DE_CTRL 0xCC | ||
57 | #define HDMI_CORE_SYS_DE_TOP 0xD0 | ||
58 | #define HDMI_CORE_SYS_DE_CNTL 0xD8 | ||
59 | #define HDMI_CORE_SYS_DE_CNTH 0xDC | ||
60 | #define HDMI_CORE_SYS_DE_LINL 0xE0 | ||
61 | #define HDMI_CORE_SYS_DE_LINH_1 0xE4 | ||
60 | #define HDMI_CORE_SYS_VID_ACEN 0x124 | 62 | #define HDMI_CORE_SYS_VID_ACEN 0x124 |
61 | #define HDMI_CORE_SYS_VID_MODE 0x128 | 63 | #define HDMI_CORE_SYS_VID_MODE 0x128 |
62 | #define HDMI_CORE_SYS_INTR_STATE 0x1C0 | 64 | #define HDMI_CORE_SYS_INTR_STATE 0x1C0 |
@@ -66,50 +68,24 @@ | |||
66 | #define HDMI_CORE_SYS_INTR4 0x1D0 | 68 | #define HDMI_CORE_SYS_INTR4 0x1D0 |
67 | #define HDMI_CORE_SYS_UMASK1 0x1D4 | 69 | #define HDMI_CORE_SYS_UMASK1 0x1D4 |
68 | #define HDMI_CORE_SYS_TMDS_CTRL 0x208 | 70 | #define HDMI_CORE_SYS_TMDS_CTRL 0x208 |
69 | #define HDMI_CORE_SYS_DE_DLY 0xC8 | 71 | |
70 | #define HDMI_CORE_SYS_DE_CTRL 0xCC | ||
71 | #define HDMI_CORE_SYS_DE_TOP 0xD0 | ||
72 | #define HDMI_CORE_SYS_DE_CNTL 0xD8 | ||
73 | #define HDMI_CORE_SYS_DE_CNTH 0xDC | ||
74 | #define HDMI_CORE_SYS_DE_LINL 0xE0 | ||
75 | #define HDMI_CORE_SYS_DE_LINH_1 0xE4 | ||
76 | #define HDMI_CORE_CTRL1_VEN_FOLLOWVSYNC 0x1 | 72 | #define HDMI_CORE_CTRL1_VEN_FOLLOWVSYNC 0x1 |
77 | #define HDMI_CORE_CTRL1_HEN_FOLLOWHSYNC 0x1 | 73 | #define HDMI_CORE_CTRL1_HEN_FOLLOWHSYNC 0x1 |
78 | #define HDMI_CORE_CTRL1_BSEL_24BITBUS 0x1 | 74 | #define HDMI_CORE_CTRL1_BSEL_24BITBUS 0x1 |
79 | #define HDMI_CORE_CTRL1_EDGE_RISINGEDGE 0x1 | 75 | #define HDMI_CORE_CTRL1_EDGE_RISINGEDGE 0x1 |
80 | 76 | ||
81 | /* HDMI DDC E-DID */ | 77 | /* HDMI DDC E-DID */ |
82 | #define HDMI_CORE_DDC_CMD 0x3CC | ||
83 | #define HDMI_CORE_DDC_STATUS 0x3C8 | ||
84 | #define HDMI_CORE_DDC_ADDR 0x3B4 | 78 | #define HDMI_CORE_DDC_ADDR 0x3B4 |
79 | #define HDMI_CORE_DDC_SEGM 0x3B8 | ||
85 | #define HDMI_CORE_DDC_OFFSET 0x3BC | 80 | #define HDMI_CORE_DDC_OFFSET 0x3BC |
86 | #define HDMI_CORE_DDC_COUNT1 0x3C0 | 81 | #define HDMI_CORE_DDC_COUNT1 0x3C0 |
87 | #define HDMI_CORE_DDC_COUNT2 0x3C4 | 82 | #define HDMI_CORE_DDC_COUNT2 0x3C4 |
83 | #define HDMI_CORE_DDC_STATUS 0x3C8 | ||
84 | #define HDMI_CORE_DDC_CMD 0x3CC | ||
88 | #define HDMI_CORE_DDC_DATA 0x3D0 | 85 | #define HDMI_CORE_DDC_DATA 0x3D0 |
89 | #define HDMI_CORE_DDC_SEGM 0x3B8 | ||
90 | 86 | ||
91 | /* HDMI IP Core Audio Video */ | 87 | /* HDMI IP Core Audio Video */ |
92 | 88 | ||
93 | #define HDMI_CORE_AV_HDMI_CTRL 0xBC | ||
94 | #define HDMI_CORE_AV_DPD 0xF4 | ||
95 | #define HDMI_CORE_AV_PB_CTRL1 0xF8 | ||
96 | #define HDMI_CORE_AV_PB_CTRL2 0xFC | ||
97 | #define HDMI_CORE_AV_AVI_TYPE 0x100 | ||
98 | #define HDMI_CORE_AV_AVI_VERS 0x104 | ||
99 | #define HDMI_CORE_AV_AVI_LEN 0x108 | ||
100 | #define HDMI_CORE_AV_AVI_CHSUM 0x10C | ||
101 | #define HDMI_CORE_AV_AVI_DBYTE(n) (n * 4 + 0x110) | ||
102 | #define HDMI_CORE_AV_AVI_DBYTE_NELEMS 15 | ||
103 | #define HDMI_CORE_AV_SPD_DBYTE(n) (n * 4 + 0x190) | ||
104 | #define HDMI_CORE_AV_SPD_DBYTE_NELEMS 27 | ||
105 | #define HDMI_CORE_AV_AUD_DBYTE(n) (n * 4 + 0x210) | ||
106 | #define HDMI_CORE_AV_AUD_DBYTE_NELEMS 10 | ||
107 | #define HDMI_CORE_AV_MPEG_DBYTE(n) (n * 4 + 0x290) | ||
108 | #define HDMI_CORE_AV_MPEG_DBYTE_NELEMS 27 | ||
109 | #define HDMI_CORE_AV_GEN_DBYTE(n) (n * 4 + 0x300) | ||
110 | #define HDMI_CORE_AV_GEN_DBYTE_NELEMS 31 | ||
111 | #define HDMI_CORE_AV_GEN2_DBYTE(n) (n * 4 + 0x380) | ||
112 | #define HDMI_CORE_AV_GEN2_DBYTE_NELEMS 31 | ||
113 | #define HDMI_CORE_AV_ACR_CTRL 0x4 | 89 | #define HDMI_CORE_AV_ACR_CTRL 0x4 |
114 | #define HDMI_CORE_AV_FREQ_SVAL 0x8 | 90 | #define HDMI_CORE_AV_FREQ_SVAL 0x8 |
115 | #define HDMI_CORE_AV_N_SVAL1 0xC | 91 | #define HDMI_CORE_AV_N_SVAL1 0xC |
@@ -148,25 +124,39 @@ | |||
148 | #define HDMI_CORE_AV_AVI_VERS 0x104 | 124 | #define HDMI_CORE_AV_AVI_VERS 0x104 |
149 | #define HDMI_CORE_AV_AVI_LEN 0x108 | 125 | #define HDMI_CORE_AV_AVI_LEN 0x108 |
150 | #define HDMI_CORE_AV_AVI_CHSUM 0x10C | 126 | #define HDMI_CORE_AV_AVI_CHSUM 0x10C |
127 | #define HDMI_CORE_AV_AVI_DBYTE(n) (n * 4 + 0x110) | ||
151 | #define HDMI_CORE_AV_SPD_TYPE 0x180 | 128 | #define HDMI_CORE_AV_SPD_TYPE 0x180 |
152 | #define HDMI_CORE_AV_SPD_VERS 0x184 | 129 | #define HDMI_CORE_AV_SPD_VERS 0x184 |
153 | #define HDMI_CORE_AV_SPD_LEN 0x188 | 130 | #define HDMI_CORE_AV_SPD_LEN 0x188 |
154 | #define HDMI_CORE_AV_SPD_CHSUM 0x18C | 131 | #define HDMI_CORE_AV_SPD_CHSUM 0x18C |
132 | #define HDMI_CORE_AV_SPD_DBYTE(n) (n * 4 + 0x190) | ||
155 | #define HDMI_CORE_AV_AUDIO_TYPE 0x200 | 133 | #define HDMI_CORE_AV_AUDIO_TYPE 0x200 |
156 | #define HDMI_CORE_AV_AUDIO_VERS 0x204 | 134 | #define HDMI_CORE_AV_AUDIO_VERS 0x204 |
157 | #define HDMI_CORE_AV_AUDIO_LEN 0x208 | 135 | #define HDMI_CORE_AV_AUDIO_LEN 0x208 |
158 | #define HDMI_CORE_AV_AUDIO_CHSUM 0x20C | 136 | #define HDMI_CORE_AV_AUDIO_CHSUM 0x20C |
137 | #define HDMI_CORE_AV_AUD_DBYTE(n) (n * 4 + 0x210) | ||
159 | #define HDMI_CORE_AV_MPEG_TYPE 0x280 | 138 | #define HDMI_CORE_AV_MPEG_TYPE 0x280 |
160 | #define HDMI_CORE_AV_MPEG_VERS 0x284 | 139 | #define HDMI_CORE_AV_MPEG_VERS 0x284 |
161 | #define HDMI_CORE_AV_MPEG_LEN 0x288 | 140 | #define HDMI_CORE_AV_MPEG_LEN 0x288 |
162 | #define HDMI_CORE_AV_MPEG_CHSUM 0x28C | 141 | #define HDMI_CORE_AV_MPEG_CHSUM 0x28C |
142 | #define HDMI_CORE_AV_MPEG_DBYTE(n) (n * 4 + 0x290) | ||
143 | #define HDMI_CORE_AV_GEN_DBYTE(n) (n * 4 + 0x300) | ||
163 | #define HDMI_CORE_AV_CP_BYTE1 0x37C | 144 | #define HDMI_CORE_AV_CP_BYTE1 0x37C |
145 | #define HDMI_CORE_AV_GEN2_DBYTE(n) (n * 4 + 0x380) | ||
164 | #define HDMI_CORE_AV_CEC_ADDR_ID 0x3FC | 146 | #define HDMI_CORE_AV_CEC_ADDR_ID 0x3FC |
147 | |||
165 | #define HDMI_CORE_AV_SPD_DBYTE_ELSIZE 0x4 | 148 | #define HDMI_CORE_AV_SPD_DBYTE_ELSIZE 0x4 |
166 | #define HDMI_CORE_AV_GEN2_DBYTE_ELSIZE 0x4 | 149 | #define HDMI_CORE_AV_GEN2_DBYTE_ELSIZE 0x4 |
167 | #define HDMI_CORE_AV_MPEG_DBYTE_ELSIZE 0x4 | 150 | #define HDMI_CORE_AV_MPEG_DBYTE_ELSIZE 0x4 |
168 | #define HDMI_CORE_AV_GEN_DBYTE_ELSIZE 0x4 | 151 | #define HDMI_CORE_AV_GEN_DBYTE_ELSIZE 0x4 |
169 | 152 | ||
153 | #define HDMI_CORE_AV_AVI_DBYTE_NELEMS 15 | ||
154 | #define HDMI_CORE_AV_SPD_DBYTE_NELEMS 27 | ||
155 | #define HDMI_CORE_AV_AUD_DBYTE_NELEMS 10 | ||
156 | #define HDMI_CORE_AV_MPEG_DBYTE_NELEMS 27 | ||
157 | #define HDMI_CORE_AV_GEN_DBYTE_NELEMS 31 | ||
158 | #define HDMI_CORE_AV_GEN2_DBYTE_NELEMS 31 | ||
159 | |||
170 | /* PLL */ | 160 | /* PLL */ |
171 | 161 | ||
172 | #define PLLCTRL_PLL_CONTROL 0x0 | 162 | #define PLLCTRL_PLL_CONTROL 0x0 |
@@ -284,35 +274,6 @@ enum hdmi_core_infoframe { | |||
284 | HDMI_INFOFRAME_AVI_DB5PR_8 = 7, | 274 | HDMI_INFOFRAME_AVI_DB5PR_8 = 7, |
285 | HDMI_INFOFRAME_AVI_DB5PR_9 = 8, | 275 | HDMI_INFOFRAME_AVI_DB5PR_9 = 8, |
286 | HDMI_INFOFRAME_AVI_DB5PR_10 = 9, | 276 | HDMI_INFOFRAME_AVI_DB5PR_10 = 9, |
287 | HDMI_INFOFRAME_AUDIO_DB1CT_FROM_STREAM = 0, | ||
288 | HDMI_INFOFRAME_AUDIO_DB1CT_IEC60958 = 1, | ||
289 | HDMI_INFOFRAME_AUDIO_DB1CT_AC3 = 2, | ||
290 | HDMI_INFOFRAME_AUDIO_DB1CT_MPEG1 = 3, | ||
291 | HDMI_INFOFRAME_AUDIO_DB1CT_MP3 = 4, | ||
292 | HDMI_INFOFRAME_AUDIO_DB1CT_MPEG2_MULTICH = 5, | ||
293 | HDMI_INFOFRAME_AUDIO_DB1CT_AAC = 6, | ||
294 | HDMI_INFOFRAME_AUDIO_DB1CT_DTS = 7, | ||
295 | HDMI_INFOFRAME_AUDIO_DB1CT_ATRAC = 8, | ||
296 | HDMI_INFOFRAME_AUDIO_DB1CT_ONEBIT = 9, | ||
297 | HDMI_INFOFRAME_AUDIO_DB1CT_DOLBY_DIGITAL_PLUS = 10, | ||
298 | HDMI_INFOFRAME_AUDIO_DB1CT_DTS_HD = 11, | ||
299 | HDMI_INFOFRAME_AUDIO_DB1CT_MAT = 12, | ||
300 | HDMI_INFOFRAME_AUDIO_DB1CT_DST = 13, | ||
301 | HDMI_INFOFRAME_AUDIO_DB1CT_WMA_PRO = 14, | ||
302 | HDMI_INFOFRAME_AUDIO_DB2SF_FROM_STREAM = 0, | ||
303 | HDMI_INFOFRAME_AUDIO_DB2SF_32000 = 1, | ||
304 | HDMI_INFOFRAME_AUDIO_DB2SF_44100 = 2, | ||
305 | HDMI_INFOFRAME_AUDIO_DB2SF_48000 = 3, | ||
306 | HDMI_INFOFRAME_AUDIO_DB2SF_88200 = 4, | ||
307 | HDMI_INFOFRAME_AUDIO_DB2SF_96000 = 5, | ||
308 | HDMI_INFOFRAME_AUDIO_DB2SF_176400 = 6, | ||
309 | HDMI_INFOFRAME_AUDIO_DB2SF_192000 = 7, | ||
310 | HDMI_INFOFRAME_AUDIO_DB2SS_FROM_STREAM = 0, | ||
311 | HDMI_INFOFRAME_AUDIO_DB2SS_16BIT = 1, | ||
312 | HDMI_INFOFRAME_AUDIO_DB2SS_20BIT = 2, | ||
313 | HDMI_INFOFRAME_AUDIO_DB2SS_24BIT = 3, | ||
314 | HDMI_INFOFRAME_AUDIO_DB5_DM_INH_PERMITTED = 0, | ||
315 | HDMI_INFOFRAME_AUDIO_DB5_DM_INH_PROHIBITED = 1 | ||
316 | }; | 277 | }; |
317 | 278 | ||
318 | enum hdmi_packing_mode { | 279 | enum hdmi_packing_mode { |
@@ -322,17 +283,6 @@ enum hdmi_packing_mode { | |||
322 | HDMI_PACK_ALREADYPACKED = 7 | 283 | HDMI_PACK_ALREADYPACKED = 7 |
323 | }; | 284 | }; |
324 | 285 | ||
325 | enum hdmi_core_audio_sample_freq { | ||
326 | HDMI_AUDIO_FS_32000 = 0x3, | ||
327 | HDMI_AUDIO_FS_44100 = 0x0, | ||
328 | HDMI_AUDIO_FS_48000 = 0x2, | ||
329 | HDMI_AUDIO_FS_88200 = 0x8, | ||
330 | HDMI_AUDIO_FS_96000 = 0xA, | ||
331 | HDMI_AUDIO_FS_176400 = 0xC, | ||
332 | HDMI_AUDIO_FS_192000 = 0xE, | ||
333 | HDMI_AUDIO_FS_NOT_INDICATED = 0x1 | ||
334 | }; | ||
335 | |||
336 | enum hdmi_core_audio_layout { | 286 | enum hdmi_core_audio_layout { |
337 | HDMI_AUDIO_LAYOUT_2CH = 0, | 287 | HDMI_AUDIO_LAYOUT_2CH = 0, |
338 | HDMI_AUDIO_LAYOUT_8CH = 1 | 288 | HDMI_AUDIO_LAYOUT_8CH = 1 |
@@ -387,37 +337,12 @@ enum hdmi_audio_blk_strt_end_sig { | |||
387 | }; | 337 | }; |
388 | 338 | ||
389 | enum hdmi_audio_i2s_config { | 339 | enum hdmi_audio_i2s_config { |
390 | HDMI_AUDIO_I2S_WS_POLARITY_LOW_IS_LEFT = 0, | ||
391 | HDMI_AUDIO_I2S_WS_POLARIT_YLOW_IS_RIGHT = 1, | ||
392 | HDMI_AUDIO_I2S_MSB_SHIFTED_FIRST = 0, | 340 | HDMI_AUDIO_I2S_MSB_SHIFTED_FIRST = 0, |
393 | HDMI_AUDIO_I2S_LSB_SHIFTED_FIRST = 1, | 341 | HDMI_AUDIO_I2S_LSB_SHIFTED_FIRST = 1, |
394 | HDMI_AUDIO_I2S_MAX_WORD_20BITS = 0, | ||
395 | HDMI_AUDIO_I2S_MAX_WORD_24BITS = 1, | ||
396 | HDMI_AUDIO_I2S_CHST_WORD_NOT_SPECIFIED = 0, | ||
397 | HDMI_AUDIO_I2S_CHST_WORD_16_BITS = 1, | ||
398 | HDMI_AUDIO_I2S_CHST_WORD_17_BITS = 6, | ||
399 | HDMI_AUDIO_I2S_CHST_WORD_18_BITS = 2, | ||
400 | HDMI_AUDIO_I2S_CHST_WORD_19_BITS = 4, | ||
401 | HDMI_AUDIO_I2S_CHST_WORD_20_BITS_20MAX = 5, | ||
402 | HDMI_AUDIO_I2S_CHST_WORD_20_BITS_24MAX = 1, | ||
403 | HDMI_AUDIO_I2S_CHST_WORD_21_BITS = 6, | ||
404 | HDMI_AUDIO_I2S_CHST_WORD_22_BITS = 2, | ||
405 | HDMI_AUDIO_I2S_CHST_WORD_23_BITS = 4, | ||
406 | HDMI_AUDIO_I2S_CHST_WORD_24_BITS = 5, | ||
407 | HDMI_AUDIO_I2S_SCK_EDGE_FALLING = 0, | 342 | HDMI_AUDIO_I2S_SCK_EDGE_FALLING = 0, |
408 | HDMI_AUDIO_I2S_SCK_EDGE_RISING = 1, | 343 | HDMI_AUDIO_I2S_SCK_EDGE_RISING = 1, |
409 | HDMI_AUDIO_I2S_VBIT_FOR_PCM = 0, | 344 | HDMI_AUDIO_I2S_VBIT_FOR_PCM = 0, |
410 | HDMI_AUDIO_I2S_VBIT_FOR_COMPRESSED = 1, | 345 | HDMI_AUDIO_I2S_VBIT_FOR_COMPRESSED = 1, |
411 | HDMI_AUDIO_I2S_INPUT_LENGTH_NA = 0, | ||
412 | HDMI_AUDIO_I2S_INPUT_LENGTH_16 = 2, | ||
413 | HDMI_AUDIO_I2S_INPUT_LENGTH_17 = 12, | ||
414 | HDMI_AUDIO_I2S_INPUT_LENGTH_18 = 4, | ||
415 | HDMI_AUDIO_I2S_INPUT_LENGTH_19 = 8, | ||
416 | HDMI_AUDIO_I2S_INPUT_LENGTH_20 = 10, | ||
417 | HDMI_AUDIO_I2S_INPUT_LENGTH_21 = 13, | ||
418 | HDMI_AUDIO_I2S_INPUT_LENGTH_22 = 5, | ||
419 | HDMI_AUDIO_I2S_INPUT_LENGTH_23 = 9, | ||
420 | HDMI_AUDIO_I2S_INPUT_LENGTH_24 = 11, | ||
421 | HDMI_AUDIO_I2S_FIRST_BIT_SHIFT = 0, | 346 | HDMI_AUDIO_I2S_FIRST_BIT_SHIFT = 0, |
422 | HDMI_AUDIO_I2S_FIRST_BIT_NO_SHIFT = 1, | 347 | HDMI_AUDIO_I2S_FIRST_BIT_NO_SHIFT = 1, |
423 | HDMI_AUDIO_I2S_SD0_EN = 1, | 348 | HDMI_AUDIO_I2S_SD0_EN = 1, |
@@ -446,20 +371,6 @@ struct hdmi_core_video_config { | |||
446 | enum hdmi_core_tclkselclkmult tclk_sel_clkmult; | 371 | enum hdmi_core_tclkselclkmult tclk_sel_clkmult; |
447 | }; | 372 | }; |
448 | 373 | ||
449 | /* | ||
450 | * Refer to section 8.2 in HDMI 1.3 specification for | ||
451 | * details about infoframe databytes | ||
452 | */ | ||
453 | struct hdmi_core_infoframe_audio { | ||
454 | u8 db1_coding_type; | ||
455 | u8 db1_channel_count; | ||
456 | u8 db2_sample_freq; | ||
457 | u8 db2_sample_size; | ||
458 | u8 db4_channel_alloc; | ||
459 | bool db5_downmix_inh; | ||
460 | u8 db5_lsv; /* Level shift values for downmix */ | ||
461 | }; | ||
462 | |||
463 | struct hdmi_core_packet_enable_repeat { | 374 | struct hdmi_core_packet_enable_repeat { |
464 | u32 audio_pkt; | 375 | u32 audio_pkt; |
465 | u32 audio_pkt_repeat; | 376 | u32 audio_pkt_repeat; |
@@ -496,15 +407,10 @@ struct hdmi_audio_dma { | |||
496 | }; | 407 | }; |
497 | 408 | ||
498 | struct hdmi_core_audio_i2s_config { | 409 | struct hdmi_core_audio_i2s_config { |
499 | u8 word_max_length; | ||
500 | u8 word_length; | ||
501 | u8 in_length_bits; | 410 | u8 in_length_bits; |
502 | u8 justification; | 411 | u8 justification; |
503 | u8 en_high_bitrate_aud; | ||
504 | u8 sck_edge_mode; | 412 | u8 sck_edge_mode; |
505 | u8 cbit_order; | ||
506 | u8 vbit; | 413 | u8 vbit; |
507 | u8 ws_polarity; | ||
508 | u8 direction; | 414 | u8 direction; |
509 | u8 shift; | 415 | u8 shift; |
510 | u8 active_sds; | 416 | u8 active_sds; |
@@ -512,7 +418,7 @@ struct hdmi_core_audio_i2s_config { | |||
512 | 418 | ||
513 | struct hdmi_core_audio_config { | 419 | struct hdmi_core_audio_config { |
514 | struct hdmi_core_audio_i2s_config i2s_cfg; | 420 | struct hdmi_core_audio_i2s_config i2s_cfg; |
515 | enum hdmi_core_audio_sample_freq freq_sample; | 421 | struct snd_aes_iec958 *iec60958_cfg; |
516 | bool fs_override; | 422 | bool fs_override; |
517 | u32 n; | 423 | u32 n; |
518 | u32 cts; | 424 | u32 cts; |
@@ -527,17 +433,4 @@ struct hdmi_core_audio_config { | |||
527 | bool en_spdif; | 433 | bool en_spdif; |
528 | }; | 434 | }; |
529 | 435 | ||
530 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | ||
531 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | ||
532 | int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data, | ||
533 | u32 sample_freq, u32 *n, u32 *cts); | ||
534 | void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data, | ||
535 | struct hdmi_core_infoframe_audio *info_aud); | ||
536 | void hdmi_core_audio_config(struct hdmi_ip_data *ip_data, | ||
537 | struct hdmi_core_audio_config *cfg); | ||
538 | void hdmi_wp_audio_config_dma(struct hdmi_ip_data *ip_data, | ||
539 | struct hdmi_audio_dma *aud_dma); | ||
540 | void hdmi_wp_audio_config_format(struct hdmi_ip_data *ip_data, | ||
541 | struct hdmi_audio_format *aud_fmt); | ||
542 | #endif | ||
543 | #endif | 436 | #endif |
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 9c3daf71750c..2b8973931ff4 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -415,6 +415,7 @@ static const struct venc_config *venc_timings_to_config( | |||
415 | return &venc_config_ntsc_trm; | 415 | return &venc_config_ntsc_trm; |
416 | 416 | ||
417 | BUG(); | 417 | BUG(); |
418 | return NULL; | ||
418 | } | 419 | } |
419 | 420 | ||
420 | static int venc_power_on(struct omap_dss_device *dssdev) | 421 | static int venc_power_on(struct omap_dss_device *dssdev) |
@@ -440,10 +441,11 @@ static int venc_power_on(struct omap_dss_device *dssdev) | |||
440 | 441 | ||
441 | venc_write_reg(VENC_OUTPUT_CONTROL, l); | 442 | venc_write_reg(VENC_OUTPUT_CONTROL, l); |
442 | 443 | ||
443 | dispc_set_digit_size(dssdev->panel.timings.x_res, | 444 | dss_mgr_set_timings(dssdev->manager, &dssdev->panel.timings); |
444 | dssdev->panel.timings.y_res/2); | ||
445 | 445 | ||
446 | regulator_enable(venc.vdda_dac_reg); | 446 | r = regulator_enable(venc.vdda_dac_reg); |
447 | if (r) | ||
448 | goto err; | ||
447 | 449 | ||
448 | if (dssdev->platform_enable) | 450 | if (dssdev->platform_enable) |
449 | dssdev->platform_enable(dssdev); | 451 | dssdev->platform_enable(dssdev); |
@@ -485,16 +487,68 @@ unsigned long venc_get_pixel_clock(void) | |||
485 | return 13500000; | 487 | return 13500000; |
486 | } | 488 | } |
487 | 489 | ||
490 | static ssize_t display_output_type_show(struct device *dev, | ||
491 | struct device_attribute *attr, char *buf) | ||
492 | { | ||
493 | struct omap_dss_device *dssdev = to_dss_device(dev); | ||
494 | const char *ret; | ||
495 | |||
496 | switch (dssdev->phy.venc.type) { | ||
497 | case OMAP_DSS_VENC_TYPE_COMPOSITE: | ||
498 | ret = "composite"; | ||
499 | break; | ||
500 | case OMAP_DSS_VENC_TYPE_SVIDEO: | ||
501 | ret = "svideo"; | ||
502 | break; | ||
503 | default: | ||
504 | return -EINVAL; | ||
505 | } | ||
506 | |||
507 | return snprintf(buf, PAGE_SIZE, "%s\n", ret); | ||
508 | } | ||
509 | |||
510 | static ssize_t display_output_type_store(struct device *dev, | ||
511 | struct device_attribute *attr, const char *buf, size_t size) | ||
512 | { | ||
513 | struct omap_dss_device *dssdev = to_dss_device(dev); | ||
514 | enum omap_dss_venc_type new_type; | ||
515 | |||
516 | if (sysfs_streq("composite", buf)) | ||
517 | new_type = OMAP_DSS_VENC_TYPE_COMPOSITE; | ||
518 | else if (sysfs_streq("svideo", buf)) | ||
519 | new_type = OMAP_DSS_VENC_TYPE_SVIDEO; | ||
520 | else | ||
521 | return -EINVAL; | ||
522 | |||
523 | mutex_lock(&venc.venc_lock); | ||
524 | |||
525 | if (dssdev->phy.venc.type != new_type) { | ||
526 | dssdev->phy.venc.type = new_type; | ||
527 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { | ||
528 | venc_power_off(dssdev); | ||
529 | venc_power_on(dssdev); | ||
530 | } | ||
531 | } | ||
532 | |||
533 | mutex_unlock(&venc.venc_lock); | ||
534 | |||
535 | return size; | ||
536 | } | ||
537 | |||
538 | static DEVICE_ATTR(output_type, S_IRUGO | S_IWUSR, | ||
539 | display_output_type_show, display_output_type_store); | ||
540 | |||
488 | /* driver */ | 541 | /* driver */ |
489 | static int venc_panel_probe(struct omap_dss_device *dssdev) | 542 | static int venc_panel_probe(struct omap_dss_device *dssdev) |
490 | { | 543 | { |
491 | dssdev->panel.timings = omap_dss_pal_timings; | 544 | dssdev->panel.timings = omap_dss_pal_timings; |
492 | 545 | ||
493 | return 0; | 546 | return device_create_file(&dssdev->dev, &dev_attr_output_type); |
494 | } | 547 | } |
495 | 548 | ||
496 | static void venc_panel_remove(struct omap_dss_device *dssdev) | 549 | static void venc_panel_remove(struct omap_dss_device *dssdev) |
497 | { | 550 | { |
551 | device_remove_file(&dssdev->dev, &dev_attr_output_type); | ||
498 | } | 552 | } |
499 | 553 | ||
500 | static int venc_panel_enable(struct omap_dss_device *dssdev) | 554 | static int venc_panel_enable(struct omap_dss_device *dssdev) |
@@ -577,12 +631,6 @@ static int venc_panel_resume(struct omap_dss_device *dssdev) | |||
577 | return venc_panel_enable(dssdev); | 631 | return venc_panel_enable(dssdev); |
578 | } | 632 | } |
579 | 633 | ||
580 | static void venc_get_timings(struct omap_dss_device *dssdev, | ||
581 | struct omap_video_timings *timings) | ||
582 | { | ||
583 | *timings = dssdev->panel.timings; | ||
584 | } | ||
585 | |||
586 | static void venc_set_timings(struct omap_dss_device *dssdev, | 634 | static void venc_set_timings(struct omap_dss_device *dssdev, |
587 | struct omap_video_timings *timings) | 635 | struct omap_video_timings *timings) |
588 | { | 636 | { |
@@ -597,6 +645,8 @@ static void venc_set_timings(struct omap_dss_device *dssdev, | |||
597 | /* turn the venc off and on to get new timings to use */ | 645 | /* turn the venc off and on to get new timings to use */ |
598 | venc_panel_disable(dssdev); | 646 | venc_panel_disable(dssdev); |
599 | venc_panel_enable(dssdev); | 647 | venc_panel_enable(dssdev); |
648 | } else { | ||
649 | dss_mgr_set_timings(dssdev->manager, timings); | ||
600 | } | 650 | } |
601 | } | 651 | } |
602 | 652 | ||
@@ -661,7 +711,6 @@ static struct omap_dss_driver venc_driver = { | |||
661 | .get_resolution = omapdss_default_get_resolution, | 711 | .get_resolution = omapdss_default_get_resolution, |
662 | .get_recommended_bpp = omapdss_default_get_recommended_bpp, | 712 | .get_recommended_bpp = omapdss_default_get_recommended_bpp, |
663 | 713 | ||
664 | .get_timings = venc_get_timings, | ||
665 | .set_timings = venc_set_timings, | 714 | .set_timings = venc_set_timings, |
666 | .check_timings = venc_check_timings, | 715 | .check_timings = venc_check_timings, |
667 | 716 | ||
@@ -675,7 +724,7 @@ static struct omap_dss_driver venc_driver = { | |||
675 | }; | 724 | }; |
676 | /* driver end */ | 725 | /* driver end */ |
677 | 726 | ||
678 | int venc_init_display(struct omap_dss_device *dssdev) | 727 | static int __init venc_init_display(struct omap_dss_device *dssdev) |
679 | { | 728 | { |
680 | DSSDBG("init_display\n"); | 729 | DSSDBG("init_display\n"); |
681 | 730 | ||
@@ -695,7 +744,7 @@ int venc_init_display(struct omap_dss_device *dssdev) | |||
695 | return 0; | 744 | return 0; |
696 | } | 745 | } |
697 | 746 | ||
698 | void venc_dump_regs(struct seq_file *s) | 747 | static void venc_dump_regs(struct seq_file *s) |
699 | { | 748 | { |
700 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r)) | 749 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r)) |
701 | 750 | ||
@@ -779,8 +828,32 @@ static void venc_put_clocks(void) | |||
779 | clk_put(venc.tv_dac_clk); | 828 | clk_put(venc.tv_dac_clk); |
780 | } | 829 | } |
781 | 830 | ||
831 | static void __init venc_probe_pdata(struct platform_device *pdev) | ||
832 | { | ||
833 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
834 | int r, i; | ||
835 | |||
836 | for (i = 0; i < pdata->num_devices; ++i) { | ||
837 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
838 | |||
839 | if (dssdev->type != OMAP_DISPLAY_TYPE_VENC) | ||
840 | continue; | ||
841 | |||
842 | r = venc_init_display(dssdev); | ||
843 | if (r) { | ||
844 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
845 | continue; | ||
846 | } | ||
847 | |||
848 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
849 | if (r) | ||
850 | DSSERR("device %s register failed: %d\n", | ||
851 | dssdev->name, r); | ||
852 | } | ||
853 | } | ||
854 | |||
782 | /* VENC HW IP initialisation */ | 855 | /* VENC HW IP initialisation */ |
783 | static int omap_venchw_probe(struct platform_device *pdev) | 856 | static int __init omap_venchw_probe(struct platform_device *pdev) |
784 | { | 857 | { |
785 | u8 rev_id; | 858 | u8 rev_id; |
786 | struct resource *venc_mem; | 859 | struct resource *venc_mem; |
@@ -824,6 +897,10 @@ static int omap_venchw_probe(struct platform_device *pdev) | |||
824 | if (r) | 897 | if (r) |
825 | goto err_reg_panel_driver; | 898 | goto err_reg_panel_driver; |
826 | 899 | ||
900 | dss_debugfs_create_file("venc", venc_dump_regs); | ||
901 | |||
902 | venc_probe_pdata(pdev); | ||
903 | |||
827 | return 0; | 904 | return 0; |
828 | 905 | ||
829 | err_reg_panel_driver: | 906 | err_reg_panel_driver: |
@@ -833,12 +910,15 @@ err_runtime_get: | |||
833 | return r; | 910 | return r; |
834 | } | 911 | } |
835 | 912 | ||
836 | static int omap_venchw_remove(struct platform_device *pdev) | 913 | static int __exit omap_venchw_remove(struct platform_device *pdev) |
837 | { | 914 | { |
915 | omap_dss_unregister_child_devices(&pdev->dev); | ||
916 | |||
838 | if (venc.vdda_dac_reg != NULL) { | 917 | if (venc.vdda_dac_reg != NULL) { |
839 | regulator_put(venc.vdda_dac_reg); | 918 | regulator_put(venc.vdda_dac_reg); |
840 | venc.vdda_dac_reg = NULL; | 919 | venc.vdda_dac_reg = NULL; |
841 | } | 920 | } |
921 | |||
842 | omap_dss_unregister_driver(&venc_driver); | 922 | omap_dss_unregister_driver(&venc_driver); |
843 | 923 | ||
844 | pm_runtime_disable(&pdev->dev); | 924 | pm_runtime_disable(&pdev->dev); |
@@ -853,7 +933,6 @@ static int venc_runtime_suspend(struct device *dev) | |||
853 | clk_disable(venc.tv_dac_clk); | 933 | clk_disable(venc.tv_dac_clk); |
854 | 934 | ||
855 | dispc_runtime_put(); | 935 | dispc_runtime_put(); |
856 | dss_runtime_put(); | ||
857 | 936 | ||
858 | return 0; | 937 | return 0; |
859 | } | 938 | } |
@@ -862,23 +941,14 @@ static int venc_runtime_resume(struct device *dev) | |||
862 | { | 941 | { |
863 | int r; | 942 | int r; |
864 | 943 | ||
865 | r = dss_runtime_get(); | ||
866 | if (r < 0) | ||
867 | goto err_get_dss; | ||
868 | |||
869 | r = dispc_runtime_get(); | 944 | r = dispc_runtime_get(); |
870 | if (r < 0) | 945 | if (r < 0) |
871 | goto err_get_dispc; | 946 | return r; |
872 | 947 | ||
873 | if (venc.tv_dac_clk) | 948 | if (venc.tv_dac_clk) |
874 | clk_enable(venc.tv_dac_clk); | 949 | clk_enable(venc.tv_dac_clk); |
875 | 950 | ||
876 | return 0; | 951 | return 0; |
877 | |||
878 | err_get_dispc: | ||
879 | dss_runtime_put(); | ||
880 | err_get_dss: | ||
881 | return r; | ||
882 | } | 952 | } |
883 | 953 | ||
884 | static const struct dev_pm_ops venc_pm_ops = { | 954 | static const struct dev_pm_ops venc_pm_ops = { |
@@ -887,8 +957,7 @@ static const struct dev_pm_ops venc_pm_ops = { | |||
887 | }; | 957 | }; |
888 | 958 | ||
889 | static struct platform_driver omap_venchw_driver = { | 959 | static struct platform_driver omap_venchw_driver = { |
890 | .probe = omap_venchw_probe, | 960 | .remove = __exit_p(omap_venchw_remove), |
891 | .remove = omap_venchw_remove, | ||
892 | .driver = { | 961 | .driver = { |
893 | .name = "omapdss_venc", | 962 | .name = "omapdss_venc", |
894 | .owner = THIS_MODULE, | 963 | .owner = THIS_MODULE, |
@@ -896,18 +965,18 @@ static struct platform_driver omap_venchw_driver = { | |||
896 | }, | 965 | }, |
897 | }; | 966 | }; |
898 | 967 | ||
899 | int venc_init_platform_driver(void) | 968 | int __init venc_init_platform_driver(void) |
900 | { | 969 | { |
901 | if (cpu_is_omap44xx()) | 970 | if (cpu_is_omap44xx()) |
902 | return 0; | 971 | return 0; |
903 | 972 | ||
904 | return platform_driver_register(&omap_venchw_driver); | 973 | return platform_driver_probe(&omap_venchw_driver, omap_venchw_probe); |
905 | } | 974 | } |
906 | 975 | ||
907 | void venc_uninit_platform_driver(void) | 976 | void __exit venc_uninit_platform_driver(void) |
908 | { | 977 | { |
909 | if (cpu_is_omap44xx()) | 978 | if (cpu_is_omap44xx()) |
910 | return; | 979 | return; |
911 | 980 | ||
912 | return platform_driver_unregister(&omap_venchw_driver); | 981 | platform_driver_unregister(&omap_venchw_driver); |
913 | } | 982 | } |
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c index 6a09ef87e14f..c6cf372d22c5 100644 --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c | |||
@@ -70,7 +70,7 @@ static int omapfb_setup_plane(struct fb_info *fbi, struct omapfb_plane_info *pi) | |||
70 | 70 | ||
71 | DBG("omapfb_setup_plane\n"); | 71 | DBG("omapfb_setup_plane\n"); |
72 | 72 | ||
73 | if (ofbi->num_overlays != 1) { | 73 | if (ofbi->num_overlays == 0) { |
74 | r = -EINVAL; | 74 | r = -EINVAL; |
75 | goto out; | 75 | goto out; |
76 | } | 76 | } |
@@ -185,7 +185,7 @@ static int omapfb_query_plane(struct fb_info *fbi, struct omapfb_plane_info *pi) | |||
185 | { | 185 | { |
186 | struct omapfb_info *ofbi = FB2OFB(fbi); | 186 | struct omapfb_info *ofbi = FB2OFB(fbi); |
187 | 187 | ||
188 | if (ofbi->num_overlays != 1) { | 188 | if (ofbi->num_overlays == 0) { |
189 | memset(pi, 0, sizeof(*pi)); | 189 | memset(pi, 0, sizeof(*pi)); |
190 | } else { | 190 | } else { |
191 | struct omap_overlay *ovl; | 191 | struct omap_overlay *ovl; |
@@ -225,6 +225,9 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi) | |||
225 | down_write_nested(&rg->lock, rg->id); | 225 | down_write_nested(&rg->lock, rg->id); |
226 | atomic_inc(&rg->lock_count); | 226 | atomic_inc(&rg->lock_count); |
227 | 227 | ||
228 | if (rg->size == size && rg->type == mi->type) | ||
229 | goto out; | ||
230 | |||
228 | if (atomic_read(&rg->map_count)) { | 231 | if (atomic_read(&rg->map_count)) { |
229 | r = -EBUSY; | 232 | r = -EBUSY; |
230 | goto out; | 233 | goto out; |
@@ -247,12 +250,10 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi) | |||
247 | } | 250 | } |
248 | } | 251 | } |
249 | 252 | ||
250 | if (rg->size != size || rg->type != mi->type) { | 253 | r = omapfb_realloc_fbmem(fbi, size, mi->type); |
251 | r = omapfb_realloc_fbmem(fbi, size, mi->type); | 254 | if (r) { |
252 | if (r) { | 255 | dev_err(fbdev->dev, "realloc fbmem failed\n"); |
253 | dev_err(fbdev->dev, "realloc fbmem failed\n"); | 256 | goto out; |
254 | goto out; | ||
255 | } | ||
256 | } | 257 | } |
257 | 258 | ||
258 | out: | 259 | out: |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index b00db4068d21..3450ea0966c9 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -179,6 +179,7 @@ static unsigned omapfb_get_vrfb_offset(const struct omapfb_info *ofbi, int rot) | |||
179 | break; | 179 | break; |
180 | default: | 180 | default: |
181 | BUG(); | 181 | BUG(); |
182 | return 0; | ||
182 | } | 183 | } |
183 | 184 | ||
184 | offset *= vrfb->bytespp; | 185 | offset *= vrfb->bytespp; |
@@ -1502,7 +1503,7 @@ static int omapfb_parse_vram_param(const char *param, int max_entries, | |||
1502 | 1503 | ||
1503 | fbnum = simple_strtoul(p, &p, 10); | 1504 | fbnum = simple_strtoul(p, &p, 10); |
1504 | 1505 | ||
1505 | if (p == param) | 1506 | if (p == start) |
1506 | return -EINVAL; | 1507 | return -EINVAL; |
1507 | 1508 | ||
1508 | if (*p != ':') | 1509 | if (*p != ':') |
@@ -2307,7 +2308,7 @@ static int omapfb_init_display(struct omapfb2_device *fbdev, | |||
2307 | return 0; | 2308 | return 0; |
2308 | } | 2309 | } |
2309 | 2310 | ||
2310 | static int omapfb_probe(struct platform_device *pdev) | 2311 | static int __init omapfb_probe(struct platform_device *pdev) |
2311 | { | 2312 | { |
2312 | struct omapfb2_device *fbdev = NULL; | 2313 | struct omapfb2_device *fbdev = NULL; |
2313 | int r = 0; | 2314 | int r = 0; |
@@ -2448,7 +2449,7 @@ err0: | |||
2448 | return r; | 2449 | return r; |
2449 | } | 2450 | } |
2450 | 2451 | ||
2451 | static int omapfb_remove(struct platform_device *pdev) | 2452 | static int __exit omapfb_remove(struct platform_device *pdev) |
2452 | { | 2453 | { |
2453 | struct omapfb2_device *fbdev = platform_get_drvdata(pdev); | 2454 | struct omapfb2_device *fbdev = platform_get_drvdata(pdev); |
2454 | 2455 | ||
@@ -2462,8 +2463,7 @@ static int omapfb_remove(struct platform_device *pdev) | |||
2462 | } | 2463 | } |
2463 | 2464 | ||
2464 | static struct platform_driver omapfb_driver = { | 2465 | static struct platform_driver omapfb_driver = { |
2465 | .probe = omapfb_probe, | 2466 | .remove = __exit_p(omapfb_remove), |
2466 | .remove = omapfb_remove, | ||
2467 | .driver = { | 2467 | .driver = { |
2468 | .name = "omapfb", | 2468 | .name = "omapfb", |
2469 | .owner = THIS_MODULE, | 2469 | .owner = THIS_MODULE, |
@@ -2474,7 +2474,7 @@ static int __init omapfb_init(void) | |||
2474 | { | 2474 | { |
2475 | DBG("omapfb_init\n"); | 2475 | DBG("omapfb_init\n"); |
2476 | 2476 | ||
2477 | if (platform_driver_register(&omapfb_driver)) { | 2477 | if (platform_driver_probe(&omapfb_driver, omapfb_probe)) { |
2478 | printk(KERN_ERR "failed to register omapfb driver\n"); | 2478 | printk(KERN_ERR "failed to register omapfb driver\n"); |
2479 | return -ENODEV; | 2479 | return -ENODEV; |
2480 | } | 2480 | } |
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h index c0bdc9b54ecf..30361a09aecd 100644 --- a/drivers/video/omap2/omapfb/omapfb.h +++ b/drivers/video/omap2/omapfb/omapfb.h | |||
@@ -166,6 +166,7 @@ static inline struct omapfb_display_data *get_display_data( | |||
166 | 166 | ||
167 | /* This should never happen */ | 167 | /* This should never happen */ |
168 | BUG(); | 168 | BUG(); |
169 | return NULL; | ||
169 | } | 170 | } |
170 | 171 | ||
171 | static inline void omapfb_lock(struct omapfb2_device *fbdev) | 172 | static inline void omapfb_lock(struct omapfb2_device *fbdev) |
diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c index 4e5b960c32c8..7e990220ad2a 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/omap2/vrfb.c | |||
@@ -179,8 +179,10 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, | |||
179 | pixel_size_exp = 2; | 179 | pixel_size_exp = 2; |
180 | else if (bytespp == 2) | 180 | else if (bytespp == 2) |
181 | pixel_size_exp = 1; | 181 | pixel_size_exp = 1; |
182 | else | 182 | else { |
183 | BUG(); | 183 | BUG(); |
184 | return; | ||
185 | } | ||
184 | 186 | ||
185 | vrfb_width = ALIGN(width * bytespp, VRFB_PAGE_WIDTH) / bytespp; | 187 | vrfb_width = ALIGN(width * bytespp, VRFB_PAGE_WIDTH) / bytespp; |
186 | vrfb_height = ALIGN(height, VRFB_PAGE_HEIGHT); | 188 | vrfb_height = ALIGN(height, VRFB_PAGE_HEIGHT); |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 05f0a80818a2..c2d05a8279fd 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -28,6 +28,13 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | 30 | ||
31 | /* | ||
32 | * Balloon device works in 4K page units. So each page is pointed to by | ||
33 | * multiple balloon pages. All memory counters in this driver are in balloon | ||
34 | * page units. | ||
35 | */ | ||
36 | #define VIRTIO_BALLOON_PAGES_PER_PAGE (PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT) | ||
37 | |||
31 | struct virtio_balloon | 38 | struct virtio_balloon |
32 | { | 39 | { |
33 | struct virtio_device *vdev; | 40 | struct virtio_device *vdev; |
@@ -42,8 +49,13 @@ struct virtio_balloon | |||
42 | /* Waiting for host to ack the pages we released. */ | 49 | /* Waiting for host to ack the pages we released. */ |
43 | struct completion acked; | 50 | struct completion acked; |
44 | 51 | ||
45 | /* The pages we've told the Host we're not using. */ | 52 | /* Number of balloon pages we've told the Host we're not using. */ |
46 | unsigned int num_pages; | 53 | unsigned int num_pages; |
54 | /* | ||
55 | * The pages we've told the Host we're not using. | ||
56 | * Each page on this list adds VIRTIO_BALLOON_PAGES_PER_PAGE | ||
57 | * to num_pages above. | ||
58 | */ | ||
47 | struct list_head pages; | 59 | struct list_head pages; |
48 | 60 | ||
49 | /* The array of pfns we tell the Host about. */ | 61 | /* The array of pfns we tell the Host about. */ |
@@ -66,7 +78,13 @@ static u32 page_to_balloon_pfn(struct page *page) | |||
66 | 78 | ||
67 | BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT); | 79 | BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT); |
68 | /* Convert pfn from Linux page size to balloon page size. */ | 80 | /* Convert pfn from Linux page size to balloon page size. */ |
69 | return pfn >> (PAGE_SHIFT - VIRTIO_BALLOON_PFN_SHIFT); | 81 | return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE; |
82 | } | ||
83 | |||
84 | static struct page *balloon_pfn_to_page(u32 pfn) | ||
85 | { | ||
86 | BUG_ON(pfn % VIRTIO_BALLOON_PAGES_PER_PAGE); | ||
87 | return pfn_to_page(pfn / VIRTIO_BALLOON_PAGES_PER_PAGE); | ||
70 | } | 88 | } |
71 | 89 | ||
72 | static void balloon_ack(struct virtqueue *vq) | 90 | static void balloon_ack(struct virtqueue *vq) |
@@ -96,12 +114,23 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) | |||
96 | wait_for_completion(&vb->acked); | 114 | wait_for_completion(&vb->acked); |
97 | } | 115 | } |
98 | 116 | ||
117 | static void set_page_pfns(u32 pfns[], struct page *page) | ||
118 | { | ||
119 | unsigned int i; | ||
120 | |||
121 | /* Set balloon pfns pointing at this page. | ||
122 | * Note that the first pfn points at start of the page. */ | ||
123 | for (i = 0; i < VIRTIO_BALLOON_PAGES_PER_PAGE; i++) | ||
124 | pfns[i] = page_to_balloon_pfn(page) + i; | ||
125 | } | ||
126 | |||
99 | static void fill_balloon(struct virtio_balloon *vb, size_t num) | 127 | static void fill_balloon(struct virtio_balloon *vb, size_t num) |
100 | { | 128 | { |
101 | /* We can only do one array worth at a time. */ | 129 | /* We can only do one array worth at a time. */ |
102 | num = min(num, ARRAY_SIZE(vb->pfns)); | 130 | num = min(num, ARRAY_SIZE(vb->pfns)); |
103 | 131 | ||
104 | for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { | 132 | for (vb->num_pfns = 0; vb->num_pfns < num; |
133 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) { | ||
105 | struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY | | 134 | struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY | |
106 | __GFP_NOMEMALLOC | __GFP_NOWARN); | 135 | __GFP_NOMEMALLOC | __GFP_NOWARN); |
107 | if (!page) { | 136 | if (!page) { |
@@ -113,9 +142,9 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num) | |||
113 | msleep(200); | 142 | msleep(200); |
114 | break; | 143 | break; |
115 | } | 144 | } |
116 | vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); | 145 | set_page_pfns(vb->pfns + vb->num_pfns, page); |
146 | vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE; | ||
117 | totalram_pages--; | 147 | totalram_pages--; |
118 | vb->num_pages++; | ||
119 | list_add(&page->lru, &vb->pages); | 148 | list_add(&page->lru, &vb->pages); |
120 | } | 149 | } |
121 | 150 | ||
@@ -130,8 +159,9 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num) | |||
130 | { | 159 | { |
131 | unsigned int i; | 160 | unsigned int i; |
132 | 161 | ||
133 | for (i = 0; i < num; i++) { | 162 | /* Find pfns pointing at start of each page, get pages and free them. */ |
134 | __free_page(pfn_to_page(pfns[i])); | 163 | for (i = 0; i < num; i += VIRTIO_BALLOON_PAGES_PER_PAGE) { |
164 | __free_page(balloon_pfn_to_page(pfns[i])); | ||
135 | totalram_pages++; | 165 | totalram_pages++; |
136 | } | 166 | } |
137 | } | 167 | } |
@@ -143,11 +173,12 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num) | |||
143 | /* We can only do one array worth at a time. */ | 173 | /* We can only do one array worth at a time. */ |
144 | num = min(num, ARRAY_SIZE(vb->pfns)); | 174 | num = min(num, ARRAY_SIZE(vb->pfns)); |
145 | 175 | ||
146 | for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { | 176 | for (vb->num_pfns = 0; vb->num_pfns < num; |
177 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) { | ||
147 | page = list_first_entry(&vb->pages, struct page, lru); | 178 | page = list_first_entry(&vb->pages, struct page, lru); |
148 | list_del(&page->lru); | 179 | list_del(&page->lru); |
149 | vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); | 180 | set_page_pfns(vb->pfns + vb->num_pfns, page); |
150 | vb->num_pages--; | 181 | vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE; |
151 | } | 182 | } |
152 | 183 | ||
153 | /* | 184 | /* |
@@ -234,11 +265,14 @@ static void virtballoon_changed(struct virtio_device *vdev) | |||
234 | 265 | ||
235 | static inline s64 towards_target(struct virtio_balloon *vb) | 266 | static inline s64 towards_target(struct virtio_balloon *vb) |
236 | { | 267 | { |
237 | u32 v; | 268 | __le32 v; |
269 | s64 target; | ||
270 | |||
238 | vb->vdev->config->get(vb->vdev, | 271 | vb->vdev->config->get(vb->vdev, |
239 | offsetof(struct virtio_balloon_config, num_pages), | 272 | offsetof(struct virtio_balloon_config, num_pages), |
240 | &v, sizeof(v)); | 273 | &v, sizeof(v)); |
241 | return (s64)v - vb->num_pages; | 274 | target = le32_to_cpu(v); |
275 | return target - vb->num_pages; | ||
242 | } | 276 | } |
243 | 277 | ||
244 | static void update_balloon_size(struct virtio_balloon *vb) | 278 | static void update_balloon_size(struct virtio_balloon *vb) |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 99d8151c824a..1ffd03bf8e10 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -722,7 +722,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) | |||
722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; | 722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; |
723 | 723 | ||
724 | if (use_ptemod) | 724 | if (use_ptemod) |
725 | vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP; | 725 | vma->vm_flags |= VM_DONTCOPY; |
726 | 726 | ||
727 | vma->vm_private_data = map; | 727 | vma->vm_private_data = map; |
728 | 728 | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index b4d4eac761db..f100ce20b16b 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -1029,6 +1029,7 @@ int gnttab_init(void) | |||
1029 | int i; | 1029 | int i; |
1030 | unsigned int max_nr_glist_frames, nr_glist_frames; | 1030 | unsigned int max_nr_glist_frames, nr_glist_frames; |
1031 | unsigned int nr_init_grefs; | 1031 | unsigned int nr_init_grefs; |
1032 | int ret; | ||
1032 | 1033 | ||
1033 | nr_grant_frames = 1; | 1034 | nr_grant_frames = 1; |
1034 | boot_max_nr_grant_frames = __max_nr_grant_frames(); | 1035 | boot_max_nr_grant_frames = __max_nr_grant_frames(); |
@@ -1047,12 +1048,16 @@ int gnttab_init(void) | |||
1047 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; | 1048 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; |
1048 | for (i = 0; i < nr_glist_frames; i++) { | 1049 | for (i = 0; i < nr_glist_frames; i++) { |
1049 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); | 1050 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); |
1050 | if (gnttab_list[i] == NULL) | 1051 | if (gnttab_list[i] == NULL) { |
1052 | ret = -ENOMEM; | ||
1051 | goto ini_nomem; | 1053 | goto ini_nomem; |
1054 | } | ||
1052 | } | 1055 | } |
1053 | 1056 | ||
1054 | if (gnttab_resume() < 0) | 1057 | if (gnttab_resume() < 0) { |
1055 | return -ENODEV; | 1058 | ret = -ENODEV; |
1059 | goto ini_nomem; | ||
1060 | } | ||
1056 | 1061 | ||
1057 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; | 1062 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; |
1058 | 1063 | ||
@@ -1070,7 +1075,7 @@ int gnttab_init(void) | |||
1070 | for (i--; i >= 0; i--) | 1075 | for (i--; i >= 0; i--) |
1071 | free_page((unsigned long)gnttab_list[i]); | 1076 | free_page((unsigned long)gnttab_list[i]); |
1072 | kfree(gnttab_list); | 1077 | kfree(gnttab_list); |
1073 | return -ENOMEM; | 1078 | return ret; |
1074 | } | 1079 | } |
1075 | EXPORT_SYMBOL_GPL(gnttab_init); | 1080 | EXPORT_SYMBOL_GPL(gnttab_init); |
1076 | 1081 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 9e14ae6cd49c..412b96cc5305 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -132,6 +132,7 @@ static void do_suspend(void) | |||
132 | err = dpm_suspend_end(PMSG_FREEZE); | 132 | err = dpm_suspend_end(PMSG_FREEZE); |
133 | if (err) { | 133 | if (err) { |
134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); | 134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); |
135 | si.cancelled = 0; | ||
135 | goto out_resume; | 136 | goto out_resume; |
136 | } | 137 | } |
137 | 138 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index f20c5f178b40..a31b54d48839 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -135,7 +135,7 @@ static int read_backend_details(struct xenbus_device *xendev) | |||
135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); | 135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); |
136 | } | 136 | } |
137 | 137 | ||
138 | static int is_device_connecting(struct device *dev, void *data) | 138 | static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential) |
139 | { | 139 | { |
140 | struct xenbus_device *xendev = to_xenbus_device(dev); | 140 | struct xenbus_device *xendev = to_xenbus_device(dev); |
141 | struct device_driver *drv = data; | 141 | struct device_driver *drv = data; |
@@ -152,16 +152,41 @@ static int is_device_connecting(struct device *dev, void *data) | |||
152 | if (drv && (dev->driver != drv)) | 152 | if (drv && (dev->driver != drv)) |
153 | return 0; | 153 | return 0; |
154 | 154 | ||
155 | if (ignore_nonessential) { | ||
156 | /* With older QEMU, for PVonHVM guests the guest config files | ||
157 | * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0'] | ||
158 | * which is nonsensical as there is no PV FB (there can be | ||
159 | * a PVKB) running as HVM guest. */ | ||
160 | |||
161 | if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0)) | ||
162 | return 0; | ||
163 | |||
164 | if ((strncmp(xendev->nodename, "device/vfb", 10) == 0)) | ||
165 | return 0; | ||
166 | } | ||
155 | xendrv = to_xenbus_driver(dev->driver); | 167 | xendrv = to_xenbus_driver(dev->driver); |
156 | return (xendev->state < XenbusStateConnected || | 168 | return (xendev->state < XenbusStateConnected || |
157 | (xendev->state == XenbusStateConnected && | 169 | (xendev->state == XenbusStateConnected && |
158 | xendrv->is_ready && !xendrv->is_ready(xendev))); | 170 | xendrv->is_ready && !xendrv->is_ready(xendev))); |
159 | } | 171 | } |
172 | static int essential_device_connecting(struct device *dev, void *data) | ||
173 | { | ||
174 | return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */); | ||
175 | } | ||
176 | static int non_essential_device_connecting(struct device *dev, void *data) | ||
177 | { | ||
178 | return is_device_connecting(dev, data, false); | ||
179 | } | ||
160 | 180 | ||
161 | static int exists_connecting_device(struct device_driver *drv) | 181 | static int exists_essential_connecting_device(struct device_driver *drv) |
162 | { | 182 | { |
163 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | 183 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, |
164 | is_device_connecting); | 184 | essential_device_connecting); |
185 | } | ||
186 | static int exists_non_essential_connecting_device(struct device_driver *drv) | ||
187 | { | ||
188 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | ||
189 | non_essential_device_connecting); | ||
165 | } | 190 | } |
166 | 191 | ||
167 | static int print_device_status(struct device *dev, void *data) | 192 | static int print_device_status(struct device *dev, void *data) |
@@ -192,6 +217,23 @@ static int print_device_status(struct device *dev, void *data) | |||
192 | /* We only wait for device setup after most initcalls have run. */ | 217 | /* We only wait for device setup after most initcalls have run. */ |
193 | static int ready_to_wait_for_devices; | 218 | static int ready_to_wait_for_devices; |
194 | 219 | ||
220 | static bool wait_loop(unsigned long start, unsigned int max_delay, | ||
221 | unsigned int *seconds_waited) | ||
222 | { | ||
223 | if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) { | ||
224 | if (!*seconds_waited) | ||
225 | printk(KERN_WARNING "XENBUS: Waiting for " | ||
226 | "devices to initialise: "); | ||
227 | *seconds_waited += 5; | ||
228 | printk("%us...", max_delay - *seconds_waited); | ||
229 | if (*seconds_waited == max_delay) | ||
230 | return true; | ||
231 | } | ||
232 | |||
233 | schedule_timeout_interruptible(HZ/10); | ||
234 | |||
235 | return false; | ||
236 | } | ||
195 | /* | 237 | /* |
196 | * On a 5-minute timeout, wait for all devices currently configured. We need | 238 | * On a 5-minute timeout, wait for all devices currently configured. We need |
197 | * to do this to guarantee that the filesystems and / or network devices | 239 | * to do this to guarantee that the filesystems and / or network devices |
@@ -215,19 +257,14 @@ static void wait_for_devices(struct xenbus_driver *xendrv) | |||
215 | if (!ready_to_wait_for_devices || !xen_domain()) | 257 | if (!ready_to_wait_for_devices || !xen_domain()) |
216 | return; | 258 | return; |
217 | 259 | ||
218 | while (exists_connecting_device(drv)) { | 260 | while (exists_non_essential_connecting_device(drv)) |
219 | if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { | 261 | if (wait_loop(start, 30, &seconds_waited)) |
220 | if (!seconds_waited) | 262 | break; |
221 | printk(KERN_WARNING "XENBUS: Waiting for " | 263 | |
222 | "devices to initialise: "); | 264 | /* Skips PVKB and PVFB check.*/ |
223 | seconds_waited += 5; | 265 | while (exists_essential_connecting_device(drv)) |
224 | printk("%us...", 300 - seconds_waited); | 266 | if (wait_loop(start, 270, &seconds_waited)) |
225 | if (seconds_waited == 300) | 267 | break; |
226 | break; | ||
227 | } | ||
228 | |||
229 | schedule_timeout_interruptible(HZ/10); | ||
230 | } | ||
231 | 268 | ||
232 | if (seconds_waited) | 269 | if (seconds_waited) |
233 | printk("\n"); | 270 | printk("\n"); |
@@ -93,9 +93,8 @@ static void aio_free_ring(struct kioctx *ctx) | |||
93 | put_page(info->ring_pages[i]); | 93 | put_page(info->ring_pages[i]); |
94 | 94 | ||
95 | if (info->mmap_size) { | 95 | if (info->mmap_size) { |
96 | down_write(&ctx->mm->mmap_sem); | 96 | BUG_ON(ctx->mm != current->mm); |
97 | do_munmap(ctx->mm, info->mmap_base, info->mmap_size); | 97 | vm_munmap(info->mmap_base, info->mmap_size); |
98 | up_write(&ctx->mm->mmap_sem); | ||
99 | } | 98 | } |
100 | 99 | ||
101 | if (info->ring_pages && info->ring_pages != info->internal_pages) | 100 | if (info->ring_pages && info->ring_pages != info->internal_pages) |
@@ -389,6 +388,17 @@ void exit_aio(struct mm_struct *mm) | |||
389 | "exit_aio:ioctx still alive: %d %d %d\n", | 388 | "exit_aio:ioctx still alive: %d %d %d\n", |
390 | atomic_read(&ctx->users), ctx->dead, | 389 | atomic_read(&ctx->users), ctx->dead, |
391 | ctx->reqs_active); | 390 | ctx->reqs_active); |
391 | /* | ||
392 | * We don't need to bother with munmap() here - | ||
393 | * exit_mmap(mm) is coming and it'll unmap everything. | ||
394 | * Since aio_free_ring() uses non-zero ->mmap_size | ||
395 | * as indicator that it needs to unmap the area, | ||
396 | * just set it to 0; aio_free_ring() is the only | ||
397 | * place that uses ->mmap_size, so it's safe. | ||
398 | * That way we get all munmap done to current->mm - | ||
399 | * all other callers have ctx->mm == current->mm. | ||
400 | */ | ||
401 | ctx->ring_info.mmap_size = 0; | ||
392 | put_ioctx(ctx); | 402 | put_ioctx(ctx); |
393 | } | 403 | } |
394 | } | 404 | } |
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 2eb12f13593d..d146e181d10d 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -50,9 +50,7 @@ static int set_brk(unsigned long start, unsigned long end) | |||
50 | end = PAGE_ALIGN(end); | 50 | end = PAGE_ALIGN(end); |
51 | if (end > start) { | 51 | if (end > start) { |
52 | unsigned long addr; | 52 | unsigned long addr; |
53 | down_write(¤t->mm->mmap_sem); | 53 | addr = vm_brk(start, end - start); |
54 | addr = do_brk(start, end - start); | ||
55 | up_write(¤t->mm->mmap_sem); | ||
56 | if (BAD_ADDR(addr)) | 54 | if (BAD_ADDR(addr)) |
57 | return addr; | 55 | return addr; |
58 | } | 56 | } |
@@ -280,9 +278,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
280 | pos = 32; | 278 | pos = 32; |
281 | map_size = ex.a_text+ex.a_data; | 279 | map_size = ex.a_text+ex.a_data; |
282 | #endif | 280 | #endif |
283 | down_write(¤t->mm->mmap_sem); | 281 | error = vm_brk(text_addr & PAGE_MASK, map_size); |
284 | error = do_brk(text_addr & PAGE_MASK, map_size); | ||
285 | up_write(¤t->mm->mmap_sem); | ||
286 | if (error != (text_addr & PAGE_MASK)) { | 282 | if (error != (text_addr & PAGE_MASK)) { |
287 | send_sig(SIGKILL, current, 0); | 283 | send_sig(SIGKILL, current, 0); |
288 | return error; | 284 | return error; |
@@ -313,9 +309,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
313 | 309 | ||
314 | if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { | 310 | if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { |
315 | loff_t pos = fd_offset; | 311 | loff_t pos = fd_offset; |
316 | down_write(¤t->mm->mmap_sem); | 312 | vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); |
317 | do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); | ||
318 | up_write(¤t->mm->mmap_sem); | ||
319 | bprm->file->f_op->read(bprm->file, | 313 | bprm->file->f_op->read(bprm->file, |
320 | (char __user *)N_TXTADDR(ex), | 314 | (char __user *)N_TXTADDR(ex), |
321 | ex.a_text+ex.a_data, &pos); | 315 | ex.a_text+ex.a_data, &pos); |
@@ -325,24 +319,20 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
325 | goto beyond_if; | 319 | goto beyond_if; |
326 | } | 320 | } |
327 | 321 | ||
328 | down_write(¤t->mm->mmap_sem); | 322 | error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, |
329 | error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, | ||
330 | PROT_READ | PROT_EXEC, | 323 | PROT_READ | PROT_EXEC, |
331 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, | 324 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, |
332 | fd_offset); | 325 | fd_offset); |
333 | up_write(¤t->mm->mmap_sem); | ||
334 | 326 | ||
335 | if (error != N_TXTADDR(ex)) { | 327 | if (error != N_TXTADDR(ex)) { |
336 | send_sig(SIGKILL, current, 0); | 328 | send_sig(SIGKILL, current, 0); |
337 | return error; | 329 | return error; |
338 | } | 330 | } |
339 | 331 | ||
340 | down_write(¤t->mm->mmap_sem); | 332 | error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data, |
341 | error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data, | ||
342 | PROT_READ | PROT_WRITE | PROT_EXEC, | 333 | PROT_READ | PROT_WRITE | PROT_EXEC, |
343 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, | 334 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, |
344 | fd_offset + ex.a_text); | 335 | fd_offset + ex.a_text); |
345 | up_write(¤t->mm->mmap_sem); | ||
346 | if (error != N_DATADDR(ex)) { | 336 | if (error != N_DATADDR(ex)) { |
347 | send_sig(SIGKILL, current, 0); | 337 | send_sig(SIGKILL, current, 0); |
348 | return error; | 338 | return error; |
@@ -412,9 +402,7 @@ static int load_aout_library(struct file *file) | |||
412 | "N_TXTOFF is not page aligned. Please convert library: %s\n", | 402 | "N_TXTOFF is not page aligned. Please convert library: %s\n", |
413 | file->f_path.dentry->d_name.name); | 403 | file->f_path.dentry->d_name.name); |
414 | } | 404 | } |
415 | down_write(¤t->mm->mmap_sem); | 405 | vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); |
416 | do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); | ||
417 | up_write(¤t->mm->mmap_sem); | ||
418 | 406 | ||
419 | file->f_op->read(file, (char __user *)start_addr, | 407 | file->f_op->read(file, (char __user *)start_addr, |
420 | ex.a_text + ex.a_data, &pos); | 408 | ex.a_text + ex.a_data, &pos); |
@@ -425,12 +413,10 @@ static int load_aout_library(struct file *file) | |||
425 | goto out; | 413 | goto out; |
426 | } | 414 | } |
427 | /* Now use mmap to map the library into memory. */ | 415 | /* Now use mmap to map the library into memory. */ |
428 | down_write(¤t->mm->mmap_sem); | 416 | error = vm_mmap(file, start_addr, ex.a_text + ex.a_data, |
429 | error = do_mmap(file, start_addr, ex.a_text + ex.a_data, | ||
430 | PROT_READ | PROT_WRITE | PROT_EXEC, | 417 | PROT_READ | PROT_WRITE | PROT_EXEC, |
431 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, | 418 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, |
432 | N_TXTOFF(ex)); | 419 | N_TXTOFF(ex)); |
433 | up_write(¤t->mm->mmap_sem); | ||
434 | retval = error; | 420 | retval = error; |
435 | if (error != start_addr) | 421 | if (error != start_addr) |
436 | goto out; | 422 | goto out; |
@@ -438,9 +424,7 @@ static int load_aout_library(struct file *file) | |||
438 | len = PAGE_ALIGN(ex.a_text + ex.a_data); | 424 | len = PAGE_ALIGN(ex.a_text + ex.a_data); |
439 | bss = ex.a_text + ex.a_data + ex.a_bss; | 425 | bss = ex.a_text + ex.a_data + ex.a_bss; |
440 | if (bss > len) { | 426 | if (bss > len) { |
441 | down_write(¤t->mm->mmap_sem); | 427 | error = vm_brk(start_addr + len, bss - len); |
442 | error = do_brk(start_addr + len, bss - len); | ||
443 | up_write(¤t->mm->mmap_sem); | ||
444 | retval = error; | 428 | retval = error; |
445 | if (error != start_addr + len) | 429 | if (error != start_addr + len) |
446 | goto out; | 430 | goto out; |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 48ffb3dc610a..16f735417072 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -82,9 +82,7 @@ static int set_brk(unsigned long start, unsigned long end) | |||
82 | end = ELF_PAGEALIGN(end); | 82 | end = ELF_PAGEALIGN(end); |
83 | if (end > start) { | 83 | if (end > start) { |
84 | unsigned long addr; | 84 | unsigned long addr; |
85 | down_write(¤t->mm->mmap_sem); | 85 | addr = vm_brk(start, end - start); |
86 | addr = do_brk(start, end - start); | ||
87 | up_write(¤t->mm->mmap_sem); | ||
88 | if (BAD_ADDR(addr)) | 86 | if (BAD_ADDR(addr)) |
89 | return addr; | 87 | return addr; |
90 | } | 88 | } |
@@ -514,9 +512,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex, | |||
514 | elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); | 512 | elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); |
515 | 513 | ||
516 | /* Map the last of the bss segment */ | 514 | /* Map the last of the bss segment */ |
517 | down_write(¤t->mm->mmap_sem); | 515 | error = vm_brk(elf_bss, last_bss - elf_bss); |
518 | error = do_brk(elf_bss, last_bss - elf_bss); | ||
519 | up_write(¤t->mm->mmap_sem); | ||
520 | if (BAD_ADDR(error)) | 516 | if (BAD_ADDR(error)) |
521 | goto out_close; | 517 | goto out_close; |
522 | } | 518 | } |
@@ -962,10 +958,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
962 | and some applications "depend" upon this behavior. | 958 | and some applications "depend" upon this behavior. |
963 | Since we do not have the power to recompile these, we | 959 | Since we do not have the power to recompile these, we |
964 | emulate the SVr4 behavior. Sigh. */ | 960 | emulate the SVr4 behavior. Sigh. */ |
965 | down_write(¤t->mm->mmap_sem); | 961 | error = vm_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC, |
966 | error = do_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC, | ||
967 | MAP_FIXED | MAP_PRIVATE, 0); | 962 | MAP_FIXED | MAP_PRIVATE, 0); |
968 | up_write(¤t->mm->mmap_sem); | ||
969 | } | 963 | } |
970 | 964 | ||
971 | #ifdef ELF_PLAT_INIT | 965 | #ifdef ELF_PLAT_INIT |
@@ -1050,8 +1044,7 @@ static int load_elf_library(struct file *file) | |||
1050 | eppnt++; | 1044 | eppnt++; |
1051 | 1045 | ||
1052 | /* Now use mmap to map the library into memory. */ | 1046 | /* Now use mmap to map the library into memory. */ |
1053 | down_write(¤t->mm->mmap_sem); | 1047 | error = vm_mmap(file, |
1054 | error = do_mmap(file, | ||
1055 | ELF_PAGESTART(eppnt->p_vaddr), | 1048 | ELF_PAGESTART(eppnt->p_vaddr), |
1056 | (eppnt->p_filesz + | 1049 | (eppnt->p_filesz + |
1057 | ELF_PAGEOFFSET(eppnt->p_vaddr)), | 1050 | ELF_PAGEOFFSET(eppnt->p_vaddr)), |
@@ -1059,7 +1052,6 @@ static int load_elf_library(struct file *file) | |||
1059 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, | 1052 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, |
1060 | (eppnt->p_offset - | 1053 | (eppnt->p_offset - |
1061 | ELF_PAGEOFFSET(eppnt->p_vaddr))); | 1054 | ELF_PAGEOFFSET(eppnt->p_vaddr))); |
1062 | up_write(¤t->mm->mmap_sem); | ||
1063 | if (error != ELF_PAGESTART(eppnt->p_vaddr)) | 1055 | if (error != ELF_PAGESTART(eppnt->p_vaddr)) |
1064 | goto out_free_ph; | 1056 | goto out_free_ph; |
1065 | 1057 | ||
@@ -1072,11 +1064,8 @@ static int load_elf_library(struct file *file) | |||
1072 | len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + | 1064 | len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + |
1073 | ELF_MIN_ALIGN - 1); | 1065 | ELF_MIN_ALIGN - 1); |
1074 | bss = eppnt->p_memsz + eppnt->p_vaddr; | 1066 | bss = eppnt->p_memsz + eppnt->p_vaddr; |
1075 | if (bss > len) { | 1067 | if (bss > len) |
1076 | down_write(¤t->mm->mmap_sem); | 1068 | vm_brk(len, bss - len); |
1077 | do_brk(len, bss - len); | ||
1078 | up_write(¤t->mm->mmap_sem); | ||
1079 | } | ||
1080 | error = 0; | 1069 | error = 0; |
1081 | 1070 | ||
1082 | out_free_ph: | 1071 | out_free_ph: |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 9bd5612a8224..d390a0fffc65 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -390,21 +390,17 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, | |||
390 | (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC)) | 390 | (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC)) |
391 | stack_prot |= PROT_EXEC; | 391 | stack_prot |= PROT_EXEC; |
392 | 392 | ||
393 | down_write(¤t->mm->mmap_sem); | 393 | current->mm->start_brk = vm_mmap(NULL, 0, stack_size, stack_prot, |
394 | current->mm->start_brk = do_mmap(NULL, 0, stack_size, stack_prot, | ||
395 | MAP_PRIVATE | MAP_ANONYMOUS | | 394 | MAP_PRIVATE | MAP_ANONYMOUS | |
396 | MAP_UNINITIALIZED | MAP_GROWSDOWN, | 395 | MAP_UNINITIALIZED | MAP_GROWSDOWN, |
397 | 0); | 396 | 0); |
398 | 397 | ||
399 | if (IS_ERR_VALUE(current->mm->start_brk)) { | 398 | if (IS_ERR_VALUE(current->mm->start_brk)) { |
400 | up_write(¤t->mm->mmap_sem); | ||
401 | retval = current->mm->start_brk; | 399 | retval = current->mm->start_brk; |
402 | current->mm->start_brk = 0; | 400 | current->mm->start_brk = 0; |
403 | goto error_kill; | 401 | goto error_kill; |
404 | } | 402 | } |
405 | 403 | ||
406 | up_write(¤t->mm->mmap_sem); | ||
407 | |||
408 | current->mm->brk = current->mm->start_brk; | 404 | current->mm->brk = current->mm->start_brk; |
409 | current->mm->context.end_brk = current->mm->start_brk; | 405 | current->mm->context.end_brk = current->mm->start_brk; |
410 | current->mm->context.end_brk += | 406 | current->mm->context.end_brk += |
@@ -955,10 +951,8 @@ static int elf_fdpic_map_file_constdisp_on_uclinux( | |||
955 | if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE) | 951 | if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE) |
956 | mflags |= MAP_EXECUTABLE; | 952 | mflags |= MAP_EXECUTABLE; |
957 | 953 | ||
958 | down_write(&mm->mmap_sem); | 954 | maddr = vm_mmap(NULL, load_addr, top - base, |
959 | maddr = do_mmap(NULL, load_addr, top - base, | ||
960 | PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0); | 955 | PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0); |
961 | up_write(&mm->mmap_sem); | ||
962 | if (IS_ERR_VALUE(maddr)) | 956 | if (IS_ERR_VALUE(maddr)) |
963 | return (int) maddr; | 957 | return (int) maddr; |
964 | 958 | ||
@@ -1096,10 +1090,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, | |||
1096 | 1090 | ||
1097 | /* create the mapping */ | 1091 | /* create the mapping */ |
1098 | disp = phdr->p_vaddr & ~PAGE_MASK; | 1092 | disp = phdr->p_vaddr & ~PAGE_MASK; |
1099 | down_write(&mm->mmap_sem); | 1093 | maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, |
1100 | maddr = do_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, | ||
1101 | phdr->p_offset - disp); | 1094 | phdr->p_offset - disp); |
1102 | up_write(&mm->mmap_sem); | ||
1103 | 1095 | ||
1104 | kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx", | 1096 | kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx", |
1105 | loop, phdr->p_memsz + disp, prot, flags, | 1097 | loop, phdr->p_memsz + disp, prot, flags, |
@@ -1143,10 +1135,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, | |||
1143 | unsigned long xmaddr; | 1135 | unsigned long xmaddr; |
1144 | 1136 | ||
1145 | flags |= MAP_FIXED | MAP_ANONYMOUS; | 1137 | flags |= MAP_FIXED | MAP_ANONYMOUS; |
1146 | down_write(&mm->mmap_sem); | 1138 | xmaddr = vm_mmap(NULL, xaddr, excess - excess1, |
1147 | xmaddr = do_mmap(NULL, xaddr, excess - excess1, | ||
1148 | prot, flags, 0); | 1139 | prot, flags, 0); |
1149 | up_write(&mm->mmap_sem); | ||
1150 | 1140 | ||
1151 | kdebug("mmap[%d] <anon>" | 1141 | kdebug("mmap[%d] <anon>" |
1152 | " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx", | 1142 | " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx", |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 024d20ee3ca3..6b2daf99fab8 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -542,10 +542,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
542 | */ | 542 | */ |
543 | DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n"); | 543 | DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n"); |
544 | 544 | ||
545 | down_write(¤t->mm->mmap_sem); | 545 | textpos = vm_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, |
546 | textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, | ||
547 | MAP_PRIVATE|MAP_EXECUTABLE, 0); | 546 | MAP_PRIVATE|MAP_EXECUTABLE, 0); |
548 | up_write(¤t->mm->mmap_sem); | ||
549 | if (!textpos || IS_ERR_VALUE(textpos)) { | 547 | if (!textpos || IS_ERR_VALUE(textpos)) { |
550 | if (!textpos) | 548 | if (!textpos) |
551 | textpos = (unsigned long) -ENOMEM; | 549 | textpos = (unsigned long) -ENOMEM; |
@@ -556,10 +554,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
556 | 554 | ||
557 | len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); | 555 | len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); |
558 | len = PAGE_ALIGN(len); | 556 | len = PAGE_ALIGN(len); |
559 | down_write(¤t->mm->mmap_sem); | 557 | realdatastart = vm_mmap(0, 0, len, |
560 | realdatastart = do_mmap(0, 0, len, | ||
561 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); | 558 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); |
562 | up_write(¤t->mm->mmap_sem); | ||
563 | 559 | ||
564 | if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) { | 560 | if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) { |
565 | if (!realdatastart) | 561 | if (!realdatastart) |
@@ -603,10 +599,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
603 | 599 | ||
604 | len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); | 600 | len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); |
605 | len = PAGE_ALIGN(len); | 601 | len = PAGE_ALIGN(len); |
606 | down_write(¤t->mm->mmap_sem); | 602 | textpos = vm_mmap(0, 0, len, |
607 | textpos = do_mmap(0, 0, len, | ||
608 | PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); | 603 | PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); |
609 | up_write(¤t->mm->mmap_sem); | ||
610 | 604 | ||
611 | if (!textpos || IS_ERR_VALUE(textpos)) { | 605 | if (!textpos || IS_ERR_VALUE(textpos)) { |
612 | if (!textpos) | 606 | if (!textpos) |
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c index e4fc746629a7..4517aaff61b4 100644 --- a/fs/binfmt_som.c +++ b/fs/binfmt_som.c | |||
@@ -147,10 +147,8 @@ static int map_som_binary(struct file *file, | |||
147 | code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize); | 147 | code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize); |
148 | current->mm->start_code = code_start; | 148 | current->mm->start_code = code_start; |
149 | current->mm->end_code = code_start + code_size; | 149 | current->mm->end_code = code_start + code_size; |
150 | down_write(¤t->mm->mmap_sem); | 150 | retval = vm_mmap(file, code_start, code_size, prot, |
151 | retval = do_mmap(file, code_start, code_size, prot, | ||
152 | flags, SOM_PAGESTART(hpuxhdr->exec_tfile)); | 151 | flags, SOM_PAGESTART(hpuxhdr->exec_tfile)); |
153 | up_write(¤t->mm->mmap_sem); | ||
154 | if (retval < 0 && retval > -1024) | 152 | if (retval < 0 && retval > -1024) |
155 | goto out; | 153 | goto out; |
156 | 154 | ||
@@ -158,20 +156,16 @@ static int map_som_binary(struct file *file, | |||
158 | data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize); | 156 | data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize); |
159 | current->mm->start_data = data_start; | 157 | current->mm->start_data = data_start; |
160 | current->mm->end_data = bss_start = data_start + data_size; | 158 | current->mm->end_data = bss_start = data_start + data_size; |
161 | down_write(¤t->mm->mmap_sem); | 159 | retval = vm_mmap(file, data_start, data_size, |
162 | retval = do_mmap(file, data_start, data_size, | ||
163 | prot | PROT_WRITE, flags, | 160 | prot | PROT_WRITE, flags, |
164 | SOM_PAGESTART(hpuxhdr->exec_dfile)); | 161 | SOM_PAGESTART(hpuxhdr->exec_dfile)); |
165 | up_write(¤t->mm->mmap_sem); | ||
166 | if (retval < 0 && retval > -1024) | 162 | if (retval < 0 && retval > -1024) |
167 | goto out; | 163 | goto out; |
168 | 164 | ||
169 | som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize); | 165 | som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize); |
170 | current->mm->start_brk = current->mm->brk = som_brk; | 166 | current->mm->start_brk = current->mm->brk = som_brk; |
171 | down_write(¤t->mm->mmap_sem); | 167 | retval = vm_mmap(NULL, bss_start, som_brk - bss_start, |
172 | retval = do_mmap(NULL, bss_start, som_brk - bss_start, | ||
173 | prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0); | 168 | prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0); |
174 | up_write(¤t->mm->mmap_sem); | ||
175 | if (retval > 0 || retval < -1024) | 169 | if (retval > 0 || retval < -1024) |
176 | retval = 0; | 170 | retval = 0; |
177 | out: | 171 | out: |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index d286b40a5671..86eff48dab78 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -405,6 +405,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
405 | bio_put(bio); | 405 | bio_put(bio); |
406 | 406 | ||
407 | bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS); | 407 | bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS); |
408 | BUG_ON(!bio); | ||
408 | bio->bi_private = cb; | 409 | bio->bi_private = cb; |
409 | bio->bi_end_io = end_compressed_bio_write; | 410 | bio->bi_end_io = end_compressed_bio_write; |
410 | bio_add_page(bio, page, PAGE_CACHE_SIZE, 0); | 411 | bio_add_page(bio, page, PAGE_CACHE_SIZE, 0); |
@@ -687,6 +688,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
687 | 688 | ||
688 | comp_bio = compressed_bio_alloc(bdev, cur_disk_byte, | 689 | comp_bio = compressed_bio_alloc(bdev, cur_disk_byte, |
689 | GFP_NOFS); | 690 | GFP_NOFS); |
691 | BUG_ON(!comp_bio); | ||
690 | comp_bio->bi_private = cb; | 692 | comp_bio->bi_private = cb; |
691 | comp_bio->bi_end_io = end_compressed_bio_read; | 693 | comp_bio->bi_end_io = end_compressed_bio_read; |
692 | 694 | ||
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 5b8ef8eb3521..3f65a812e282 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2166,7 +2166,7 @@ BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item, | |||
2166 | 2166 | ||
2167 | static inline bool btrfs_root_readonly(struct btrfs_root *root) | 2167 | static inline bool btrfs_root_readonly(struct btrfs_root *root) |
2168 | { | 2168 | { |
2169 | return root->root_item.flags & BTRFS_ROOT_SUBVOL_RDONLY; | 2169 | return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0; |
2170 | } | 2170 | } |
2171 | 2171 | ||
2172 | /* struct btrfs_root_backup */ | 2172 | /* struct btrfs_root_backup */ |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a84420491c11..2b35f8d14bb9 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -529,9 +529,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, | |||
529 | * allocate blocks for the tree root we can't do the fast caching since | 529 | * allocate blocks for the tree root we can't do the fast caching since |
530 | * we likely hold important locks. | 530 | * we likely hold important locks. |
531 | */ | 531 | */ |
532 | if (trans && (!trans->transaction->in_commit) && | 532 | if (fs_info->mount_opt & BTRFS_MOUNT_SPACE_CACHE) { |
533 | (root && root != root->fs_info->tree_root) && | ||
534 | btrfs_test_opt(root, SPACE_CACHE)) { | ||
535 | ret = load_free_space_cache(fs_info, cache); | 533 | ret = load_free_space_cache(fs_info, cache); |
536 | 534 | ||
537 | spin_lock(&cache->lock); | 535 | spin_lock(&cache->lock); |
@@ -3152,15 +3150,14 @@ static void set_avail_alloc_bits(struct btrfs_fs_info *fs_info, u64 flags) | |||
3152 | /* | 3150 | /* |
3153 | * returns target flags in extended format or 0 if restripe for this | 3151 | * returns target flags in extended format or 0 if restripe for this |
3154 | * chunk_type is not in progress | 3152 | * chunk_type is not in progress |
3153 | * | ||
3154 | * should be called with either volume_mutex or balance_lock held | ||
3155 | */ | 3155 | */ |
3156 | static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags) | 3156 | static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags) |
3157 | { | 3157 | { |
3158 | struct btrfs_balance_control *bctl = fs_info->balance_ctl; | 3158 | struct btrfs_balance_control *bctl = fs_info->balance_ctl; |
3159 | u64 target = 0; | 3159 | u64 target = 0; |
3160 | 3160 | ||
3161 | BUG_ON(!mutex_is_locked(&fs_info->volume_mutex) && | ||
3162 | !spin_is_locked(&fs_info->balance_lock)); | ||
3163 | |||
3164 | if (!bctl) | 3161 | if (!bctl) |
3165 | return 0; | 3162 | return 0; |
3166 | 3163 | ||
@@ -4205,7 +4202,7 @@ static u64 calc_global_metadata_size(struct btrfs_fs_info *fs_info) | |||
4205 | num_bytes += div64_u64(data_used + meta_used, 50); | 4202 | num_bytes += div64_u64(data_used + meta_used, 50); |
4206 | 4203 | ||
4207 | if (num_bytes * 3 > meta_used) | 4204 | if (num_bytes * 3 > meta_used) |
4208 | num_bytes = div64_u64(meta_used, 3) * 2; | 4205 | num_bytes = div64_u64(meta_used, 3); |
4209 | 4206 | ||
4210 | return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10); | 4207 | return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10); |
4211 | } | 4208 | } |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8d904dd7ea9f..cd4b5e400221 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1937,7 +1937,7 @@ int repair_eb_io_failure(struct btrfs_root *root, struct extent_buffer *eb, | |||
1937 | struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree; | 1937 | struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree; |
1938 | u64 start = eb->start; | 1938 | u64 start = eb->start; |
1939 | unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); | 1939 | unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); |
1940 | int ret; | 1940 | int ret = 0; |
1941 | 1941 | ||
1942 | for (i = 0; i < num_pages; i++) { | 1942 | for (i = 0; i < num_pages; i++) { |
1943 | struct page *p = extent_buffer_page(eb, i); | 1943 | struct page *p = extent_buffer_page(eb, i); |
@@ -2180,6 +2180,10 @@ static int bio_readpage_error(struct bio *failed_bio, struct page *page, | |||
2180 | } | 2180 | } |
2181 | 2181 | ||
2182 | bio = bio_alloc(GFP_NOFS, 1); | 2182 | bio = bio_alloc(GFP_NOFS, 1); |
2183 | if (!bio) { | ||
2184 | free_io_failure(inode, failrec, 0); | ||
2185 | return -EIO; | ||
2186 | } | ||
2183 | bio->bi_private = state; | 2187 | bio->bi_private = state; |
2184 | bio->bi_end_io = failed_bio->bi_end_io; | 2188 | bio->bi_end_io = failed_bio->bi_end_io; |
2185 | bio->bi_sector = failrec->logical >> 9; | 2189 | bio->bi_sector = failrec->logical >> 9; |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index e88330d3df52..202008ec367d 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -748,13 +748,6 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, | |||
748 | u64 used = btrfs_block_group_used(&block_group->item); | 748 | u64 used = btrfs_block_group_used(&block_group->item); |
749 | 749 | ||
750 | /* | 750 | /* |
751 | * If we're unmounting then just return, since this does a search on the | ||
752 | * normal root and not the commit root and we could deadlock. | ||
753 | */ | ||
754 | if (btrfs_fs_closing(fs_info)) | ||
755 | return 0; | ||
756 | |||
757 | /* | ||
758 | * If this block group has been marked to be cleared for one reason or | 751 | * If this block group has been marked to be cleared for one reason or |
759 | * another then we can't trust the on disk cache, so just return. | 752 | * another then we can't trust the on disk cache, so just return. |
760 | */ | 753 | */ |
@@ -768,6 +761,8 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, | |||
768 | path = btrfs_alloc_path(); | 761 | path = btrfs_alloc_path(); |
769 | if (!path) | 762 | if (!path) |
770 | return 0; | 763 | return 0; |
764 | path->search_commit_root = 1; | ||
765 | path->skip_locking = 1; | ||
771 | 766 | ||
772 | inode = lookup_free_space_inode(root, block_group, path); | 767 | inode = lookup_free_space_inode(root, block_group, path); |
773 | if (IS_ERR(inode)) { | 768 | if (IS_ERR(inode)) { |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 90acc82046c3..bc015f77f3ea 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -1044,6 +1044,8 @@ static int scrub_recheck_block(struct btrfs_fs_info *fs_info, | |||
1044 | 1044 | ||
1045 | BUG_ON(!page->page); | 1045 | BUG_ON(!page->page); |
1046 | bio = bio_alloc(GFP_NOFS, 1); | 1046 | bio = bio_alloc(GFP_NOFS, 1); |
1047 | if (!bio) | ||
1048 | return -EIO; | ||
1047 | bio->bi_bdev = page->bdev; | 1049 | bio->bi_bdev = page->bdev; |
1048 | bio->bi_sector = page->physical >> 9; | 1050 | bio->bi_sector = page->physical >> 9; |
1049 | bio->bi_end_io = scrub_complete_bio_end_io; | 1051 | bio->bi_end_io = scrub_complete_bio_end_io; |
@@ -1171,6 +1173,8 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad, | |||
1171 | DECLARE_COMPLETION_ONSTACK(complete); | 1173 | DECLARE_COMPLETION_ONSTACK(complete); |
1172 | 1174 | ||
1173 | bio = bio_alloc(GFP_NOFS, 1); | 1175 | bio = bio_alloc(GFP_NOFS, 1); |
1176 | if (!bio) | ||
1177 | return -EIO; | ||
1174 | bio->bi_bdev = page_bad->bdev; | 1178 | bio->bi_bdev = page_bad->bdev; |
1175 | bio->bi_sector = page_bad->physical >> 9; | 1179 | bio->bi_sector = page_bad->physical >> 9; |
1176 | bio->bi_end_io = scrub_complete_bio_end_io; | 1180 | bio->bi_end_io = scrub_complete_bio_end_io; |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 8da29e8e4de1..11b77a59db62 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -480,6 +480,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
480 | struct btrfs_transaction *cur_trans = trans->transaction; | 480 | struct btrfs_transaction *cur_trans = trans->transaction; |
481 | struct btrfs_fs_info *info = root->fs_info; | 481 | struct btrfs_fs_info *info = root->fs_info; |
482 | int count = 0; | 482 | int count = 0; |
483 | int err = 0; | ||
483 | 484 | ||
484 | if (--trans->use_count) { | 485 | if (--trans->use_count) { |
485 | trans->block_rsv = trans->orig_rsv; | 486 | trans->block_rsv = trans->orig_rsv; |
@@ -532,18 +533,18 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
532 | 533 | ||
533 | if (current->journal_info == trans) | 534 | if (current->journal_info == trans) |
534 | current->journal_info = NULL; | 535 | current->journal_info = NULL; |
535 | memset(trans, 0, sizeof(*trans)); | ||
536 | kmem_cache_free(btrfs_trans_handle_cachep, trans); | ||
537 | 536 | ||
538 | if (throttle) | 537 | if (throttle) |
539 | btrfs_run_delayed_iputs(root); | 538 | btrfs_run_delayed_iputs(root); |
540 | 539 | ||
541 | if (trans->aborted || | 540 | if (trans->aborted || |
542 | root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { | 541 | root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { |
543 | return -EIO; | 542 | err = -EIO; |
544 | } | 543 | } |
545 | 544 | ||
546 | return 0; | 545 | memset(trans, 0, sizeof(*trans)); |
546 | kmem_cache_free(btrfs_trans_handle_cachep, trans); | ||
547 | return err; | ||
547 | } | 548 | } |
548 | 549 | ||
549 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, | 550 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a872b48be0ae..759d02486d7c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -3833,6 +3833,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, | |||
3833 | int sub_stripes = 0; | 3833 | int sub_stripes = 0; |
3834 | u64 stripes_per_dev = 0; | 3834 | u64 stripes_per_dev = 0; |
3835 | u32 remaining_stripes = 0; | 3835 | u32 remaining_stripes = 0; |
3836 | u32 last_stripe = 0; | ||
3836 | 3837 | ||
3837 | if (map->type & | 3838 | if (map->type & |
3838 | (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID10)) { | 3839 | (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID10)) { |
@@ -3846,6 +3847,8 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, | |||
3846 | stripe_nr_orig, | 3847 | stripe_nr_orig, |
3847 | factor, | 3848 | factor, |
3848 | &remaining_stripes); | 3849 | &remaining_stripes); |
3850 | div_u64_rem(stripe_nr_end - 1, factor, &last_stripe); | ||
3851 | last_stripe *= sub_stripes; | ||
3849 | } | 3852 | } |
3850 | 3853 | ||
3851 | for (i = 0; i < num_stripes; i++) { | 3854 | for (i = 0; i < num_stripes; i++) { |
@@ -3858,16 +3861,29 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, | |||
3858 | BTRFS_BLOCK_GROUP_RAID10)) { | 3861 | BTRFS_BLOCK_GROUP_RAID10)) { |
3859 | bbio->stripes[i].length = stripes_per_dev * | 3862 | bbio->stripes[i].length = stripes_per_dev * |
3860 | map->stripe_len; | 3863 | map->stripe_len; |
3864 | |||
3861 | if (i / sub_stripes < remaining_stripes) | 3865 | if (i / sub_stripes < remaining_stripes) |
3862 | bbio->stripes[i].length += | 3866 | bbio->stripes[i].length += |
3863 | map->stripe_len; | 3867 | map->stripe_len; |
3868 | |||
3869 | /* | ||
3870 | * Special for the first stripe and | ||
3871 | * the last stripe: | ||
3872 | * | ||
3873 | * |-------|...|-------| | ||
3874 | * |----------| | ||
3875 | * off end_off | ||
3876 | */ | ||
3864 | if (i < sub_stripes) | 3877 | if (i < sub_stripes) |
3865 | bbio->stripes[i].length -= | 3878 | bbio->stripes[i].length -= |
3866 | stripe_offset; | 3879 | stripe_offset; |
3867 | if ((i / sub_stripes + 1) % | 3880 | |
3868 | sub_stripes == remaining_stripes) | 3881 | if (stripe_index >= last_stripe && |
3882 | stripe_index <= (last_stripe + | ||
3883 | sub_stripes - 1)) | ||
3869 | bbio->stripes[i].length -= | 3884 | bbio->stripes[i].length -= |
3870 | stripe_end_offset; | 3885 | stripe_end_offset; |
3886 | |||
3871 | if (i == sub_stripes - 1) | 3887 | if (i == sub_stripes - 1) |
3872 | stripe_offset = 0; | 3888 | stripe_offset = 0; |
3873 | } else | 3889 | } else |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index d81e933a796b..f31dc9ac37b7 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -109,6 +109,8 @@ enum { | |||
109 | 109 | ||
110 | /* Options which could be blank */ | 110 | /* Options which could be blank */ |
111 | Opt_blank_pass, | 111 | Opt_blank_pass, |
112 | Opt_blank_user, | ||
113 | Opt_blank_ip, | ||
112 | 114 | ||
113 | Opt_err | 115 | Opt_err |
114 | }; | 116 | }; |
@@ -183,11 +185,15 @@ static const match_table_t cifs_mount_option_tokens = { | |||
183 | { Opt_wsize, "wsize=%s" }, | 185 | { Opt_wsize, "wsize=%s" }, |
184 | { Opt_actimeo, "actimeo=%s" }, | 186 | { Opt_actimeo, "actimeo=%s" }, |
185 | 187 | ||
188 | { Opt_blank_user, "user=" }, | ||
189 | { Opt_blank_user, "username=" }, | ||
186 | { Opt_user, "user=%s" }, | 190 | { Opt_user, "user=%s" }, |
187 | { Opt_user, "username=%s" }, | 191 | { Opt_user, "username=%s" }, |
188 | { Opt_blank_pass, "pass=" }, | 192 | { Opt_blank_pass, "pass=" }, |
189 | { Opt_pass, "pass=%s" }, | 193 | { Opt_pass, "pass=%s" }, |
190 | { Opt_pass, "password=%s" }, | 194 | { Opt_pass, "password=%s" }, |
195 | { Opt_blank_ip, "ip=" }, | ||
196 | { Opt_blank_ip, "addr=" }, | ||
191 | { Opt_ip, "ip=%s" }, | 197 | { Opt_ip, "ip=%s" }, |
192 | { Opt_ip, "addr=%s" }, | 198 | { Opt_ip, "addr=%s" }, |
193 | { Opt_unc, "unc=%s" }, | 199 | { Opt_unc, "unc=%s" }, |
@@ -1117,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option) | |||
1117 | string = match_strdup(args); | 1123 | string = match_strdup(args); |
1118 | if (string == NULL) | 1124 | if (string == NULL) |
1119 | return -ENOMEM; | 1125 | return -ENOMEM; |
1120 | rc = kstrtoul(string, 10, option); | 1126 | rc = kstrtoul(string, 0, option); |
1121 | kfree(string); | 1127 | kfree(string); |
1122 | 1128 | ||
1123 | return rc; | 1129 | return rc; |
@@ -1534,15 +1540,17 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1534 | 1540 | ||
1535 | /* String Arguments */ | 1541 | /* String Arguments */ |
1536 | 1542 | ||
1543 | case Opt_blank_user: | ||
1544 | /* null user, ie. anonymous authentication */ | ||
1545 | vol->nullauth = 1; | ||
1546 | vol->username = NULL; | ||
1547 | break; | ||
1537 | case Opt_user: | 1548 | case Opt_user: |
1538 | string = match_strdup(args); | 1549 | string = match_strdup(args); |
1539 | if (string == NULL) | 1550 | if (string == NULL) |
1540 | goto out_nomem; | 1551 | goto out_nomem; |
1541 | 1552 | ||
1542 | if (!*string) { | 1553 | if (strnlen(string, MAX_USERNAME_SIZE) > |
1543 | /* null user, ie. anonymous authentication */ | ||
1544 | vol->nullauth = 1; | ||
1545 | } else if (strnlen(string, MAX_USERNAME_SIZE) > | ||
1546 | MAX_USERNAME_SIZE) { | 1554 | MAX_USERNAME_SIZE) { |
1547 | printk(KERN_WARNING "CIFS: username too long\n"); | 1555 | printk(KERN_WARNING "CIFS: username too long\n"); |
1548 | goto cifs_parse_mount_err; | 1556 | goto cifs_parse_mount_err; |
@@ -1611,14 +1619,15 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1611 | } | 1619 | } |
1612 | vol->password[j] = '\0'; | 1620 | vol->password[j] = '\0'; |
1613 | break; | 1621 | break; |
1622 | case Opt_blank_ip: | ||
1623 | vol->UNCip = NULL; | ||
1624 | break; | ||
1614 | case Opt_ip: | 1625 | case Opt_ip: |
1615 | string = match_strdup(args); | 1626 | string = match_strdup(args); |
1616 | if (string == NULL) | 1627 | if (string == NULL) |
1617 | goto out_nomem; | 1628 | goto out_nomem; |
1618 | 1629 | ||
1619 | if (!*string) { | 1630 | if (strnlen(string, INET6_ADDRSTRLEN) > |
1620 | vol->UNCip = NULL; | ||
1621 | } else if (strnlen(string, INET6_ADDRSTRLEN) > | ||
1622 | INET6_ADDRSTRLEN) { | 1631 | INET6_ADDRSTRLEN) { |
1623 | printk(KERN_WARNING "CIFS: ip address " | 1632 | printk(KERN_WARNING "CIFS: ip address " |
1624 | "too long\n"); | 1633 | "too long\n"); |
@@ -1636,12 +1645,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1636 | if (string == NULL) | 1645 | if (string == NULL) |
1637 | goto out_nomem; | 1646 | goto out_nomem; |
1638 | 1647 | ||
1639 | if (!*string) { | ||
1640 | printk(KERN_WARNING "CIFS: invalid path to " | ||
1641 | "network resource\n"); | ||
1642 | goto cifs_parse_mount_err; | ||
1643 | } | ||
1644 | |||
1645 | temp_len = strnlen(string, 300); | 1648 | temp_len = strnlen(string, 300); |
1646 | if (temp_len == 300) { | 1649 | if (temp_len == 300) { |
1647 | printk(KERN_WARNING "CIFS: UNC name too long\n"); | 1650 | printk(KERN_WARNING "CIFS: UNC name too long\n"); |
@@ -1670,11 +1673,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1670 | if (string == NULL) | 1673 | if (string == NULL) |
1671 | goto out_nomem; | 1674 | goto out_nomem; |
1672 | 1675 | ||
1673 | if (!*string) { | 1676 | if (strnlen(string, 256) == 256) { |
1674 | printk(KERN_WARNING "CIFS: invalid domain" | ||
1675 | " name\n"); | ||
1676 | goto cifs_parse_mount_err; | ||
1677 | } else if (strnlen(string, 256) == 256) { | ||
1678 | printk(KERN_WARNING "CIFS: domain name too" | 1677 | printk(KERN_WARNING "CIFS: domain name too" |
1679 | " long\n"); | 1678 | " long\n"); |
1680 | goto cifs_parse_mount_err; | 1679 | goto cifs_parse_mount_err; |
@@ -1693,11 +1692,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1693 | if (string == NULL) | 1692 | if (string == NULL) |
1694 | goto out_nomem; | 1693 | goto out_nomem; |
1695 | 1694 | ||
1696 | if (!*string) { | 1695 | if (!cifs_convert_address( |
1697 | printk(KERN_WARNING "CIFS: srcaddr value not" | ||
1698 | " specified\n"); | ||
1699 | goto cifs_parse_mount_err; | ||
1700 | } else if (!cifs_convert_address( | ||
1701 | (struct sockaddr *)&vol->srcaddr, | 1696 | (struct sockaddr *)&vol->srcaddr, |
1702 | string, strlen(string))) { | 1697 | string, strlen(string))) { |
1703 | printk(KERN_WARNING "CIFS: Could not parse" | 1698 | printk(KERN_WARNING "CIFS: Could not parse" |
@@ -1710,11 +1705,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1710 | if (string == NULL) | 1705 | if (string == NULL) |
1711 | goto out_nomem; | 1706 | goto out_nomem; |
1712 | 1707 | ||
1713 | if (!*string) { | ||
1714 | printk(KERN_WARNING "CIFS: Invalid path" | ||
1715 | " prefix\n"); | ||
1716 | goto cifs_parse_mount_err; | ||
1717 | } | ||
1718 | temp_len = strnlen(string, 1024); | 1708 | temp_len = strnlen(string, 1024); |
1719 | if (string[0] != '/') | 1709 | if (string[0] != '/') |
1720 | temp_len++; /* missing leading slash */ | 1710 | temp_len++; /* missing leading slash */ |
@@ -1742,11 +1732,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1742 | if (string == NULL) | 1732 | if (string == NULL) |
1743 | goto out_nomem; | 1733 | goto out_nomem; |
1744 | 1734 | ||
1745 | if (!*string) { | 1735 | if (strnlen(string, 1024) >= 65) { |
1746 | printk(KERN_WARNING "CIFS: Invalid iocharset" | ||
1747 | " specified\n"); | ||
1748 | goto cifs_parse_mount_err; | ||
1749 | } else if (strnlen(string, 1024) >= 65) { | ||
1750 | printk(KERN_WARNING "CIFS: iocharset name " | 1736 | printk(KERN_WARNING "CIFS: iocharset name " |
1751 | "too long.\n"); | 1737 | "too long.\n"); |
1752 | goto cifs_parse_mount_err; | 1738 | goto cifs_parse_mount_err; |
@@ -1771,11 +1757,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1771 | if (string == NULL) | 1757 | if (string == NULL) |
1772 | goto out_nomem; | 1758 | goto out_nomem; |
1773 | 1759 | ||
1774 | if (!*string) { | ||
1775 | printk(KERN_WARNING "CIFS: No socket option" | ||
1776 | " specified\n"); | ||
1777 | goto cifs_parse_mount_err; | ||
1778 | } | ||
1779 | if (strnicmp(string, "TCP_NODELAY", 11) == 0) | 1760 | if (strnicmp(string, "TCP_NODELAY", 11) == 0) |
1780 | vol->sockopt_tcp_nodelay = 1; | 1761 | vol->sockopt_tcp_nodelay = 1; |
1781 | break; | 1762 | break; |
@@ -1784,12 +1765,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1784 | if (string == NULL) | 1765 | if (string == NULL) |
1785 | goto out_nomem; | 1766 | goto out_nomem; |
1786 | 1767 | ||
1787 | if (!*string) { | ||
1788 | printk(KERN_WARNING "CIFS: Invalid (empty)" | ||
1789 | " netbiosname\n"); | ||
1790 | break; | ||
1791 | } | ||
1792 | |||
1793 | memset(vol->source_rfc1001_name, 0x20, | 1768 | memset(vol->source_rfc1001_name, 0x20, |
1794 | RFC1001_NAME_LEN); | 1769 | RFC1001_NAME_LEN); |
1795 | /* | 1770 | /* |
@@ -1817,11 +1792,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1817 | if (string == NULL) | 1792 | if (string == NULL) |
1818 | goto out_nomem; | 1793 | goto out_nomem; |
1819 | 1794 | ||
1820 | if (!*string) { | ||
1821 | printk(KERN_WARNING "CIFS: Empty server" | ||
1822 | " netbiosname specified\n"); | ||
1823 | break; | ||
1824 | } | ||
1825 | /* last byte, type, is 0x20 for servr type */ | 1795 | /* last byte, type, is 0x20 for servr type */ |
1826 | memset(vol->target_rfc1001_name, 0x20, | 1796 | memset(vol->target_rfc1001_name, 0x20, |
1827 | RFC1001_NAME_LEN_WITH_NULL); | 1797 | RFC1001_NAME_LEN_WITH_NULL); |
@@ -1848,12 +1818,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1848 | if (string == NULL) | 1818 | if (string == NULL) |
1849 | goto out_nomem; | 1819 | goto out_nomem; |
1850 | 1820 | ||
1851 | if (!*string) { | ||
1852 | cERROR(1, "no protocol version specified" | ||
1853 | " after vers= mount option"); | ||
1854 | goto cifs_parse_mount_err; | ||
1855 | } | ||
1856 | |||
1857 | if (strnicmp(string, "cifs", 4) == 0 || | 1821 | if (strnicmp(string, "cifs", 4) == 0 || |
1858 | strnicmp(string, "1", 1) == 0) { | 1822 | strnicmp(string, "1", 1) == 0) { |
1859 | /* This is the default */ | 1823 | /* This is the default */ |
@@ -1868,12 +1832,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1868 | if (string == NULL) | 1832 | if (string == NULL) |
1869 | goto out_nomem; | 1833 | goto out_nomem; |
1870 | 1834 | ||
1871 | if (!*string) { | ||
1872 | printk(KERN_WARNING "CIFS: no security flavor" | ||
1873 | " specified\n"); | ||
1874 | break; | ||
1875 | } | ||
1876 | |||
1877 | if (cifs_parse_security_flavors(string, vol) != 0) | 1835 | if (cifs_parse_security_flavors(string, vol) != 0) |
1878 | goto cifs_parse_mount_err; | 1836 | goto cifs_parse_mount_err; |
1879 | break; | 1837 | break; |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index ab2594a30f86..0e01e90add8b 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1203,9 +1203,6 @@ struct ext4_sb_info { | |||
1203 | unsigned long s_ext_blocks; | 1203 | unsigned long s_ext_blocks; |
1204 | unsigned long s_ext_extents; | 1204 | unsigned long s_ext_extents; |
1205 | #endif | 1205 | #endif |
1206 | /* ext4 extent cache stats */ | ||
1207 | unsigned long extent_cache_hits; | ||
1208 | unsigned long extent_cache_misses; | ||
1209 | 1206 | ||
1210 | /* for buddy allocator */ | 1207 | /* for buddy allocator */ |
1211 | struct ext4_group_info ***s_group_info; | 1208 | struct ext4_group_info ***s_group_info; |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 1421938e6792..abcdeab67f52 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -2066,10 +2066,6 @@ static int ext4_ext_check_cache(struct inode *inode, ext4_lblk_t block, | |||
2066 | ret = 1; | 2066 | ret = 1; |
2067 | } | 2067 | } |
2068 | errout: | 2068 | errout: |
2069 | if (!ret) | ||
2070 | sbi->extent_cache_misses++; | ||
2071 | else | ||
2072 | sbi->extent_cache_hits++; | ||
2073 | trace_ext4_ext_in_cache(inode, block, ret); | 2069 | trace_ext4_ext_in_cache(inode, block, ret); |
2074 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 2070 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); |
2075 | return ret; | 2071 | return ret; |
@@ -2882,7 +2878,7 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2882 | if (err) | 2878 | if (err) |
2883 | goto fix_extent_len; | 2879 | goto fix_extent_len; |
2884 | /* update the extent length and mark as initialized */ | 2880 | /* update the extent length and mark as initialized */ |
2885 | ex->ee_len = cpu_to_le32(ee_len); | 2881 | ex->ee_len = cpu_to_le16(ee_len); |
2886 | ext4_ext_try_to_merge(inode, path, ex); | 2882 | ext4_ext_try_to_merge(inode, path, ex); |
2887 | err = ext4_ext_dirty(handle, inode, path + depth); | 2883 | err = ext4_ext_dirty(handle, inode, path + depth); |
2888 | goto out; | 2884 | goto out; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ceebaf853beb..6da193564e43 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1305,20 +1305,20 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) | |||
1305 | ext4_msg(sb, KERN_ERR, | 1305 | ext4_msg(sb, KERN_ERR, |
1306 | "Cannot change journaled " | 1306 | "Cannot change journaled " |
1307 | "quota options when quota turned on"); | 1307 | "quota options when quota turned on"); |
1308 | return 0; | 1308 | return -1; |
1309 | } | 1309 | } |
1310 | qname = match_strdup(args); | 1310 | qname = match_strdup(args); |
1311 | if (!qname) { | 1311 | if (!qname) { |
1312 | ext4_msg(sb, KERN_ERR, | 1312 | ext4_msg(sb, KERN_ERR, |
1313 | "Not enough memory for storing quotafile name"); | 1313 | "Not enough memory for storing quotafile name"); |
1314 | return 0; | 1314 | return -1; |
1315 | } | 1315 | } |
1316 | if (sbi->s_qf_names[qtype] && | 1316 | if (sbi->s_qf_names[qtype] && |
1317 | strcmp(sbi->s_qf_names[qtype], qname)) { | 1317 | strcmp(sbi->s_qf_names[qtype], qname)) { |
1318 | ext4_msg(sb, KERN_ERR, | 1318 | ext4_msg(sb, KERN_ERR, |
1319 | "%s quota file already specified", QTYPE2NAME(qtype)); | 1319 | "%s quota file already specified", QTYPE2NAME(qtype)); |
1320 | kfree(qname); | 1320 | kfree(qname); |
1321 | return 0; | 1321 | return -1; |
1322 | } | 1322 | } |
1323 | sbi->s_qf_names[qtype] = qname; | 1323 | sbi->s_qf_names[qtype] = qname; |
1324 | if (strchr(sbi->s_qf_names[qtype], '/')) { | 1324 | if (strchr(sbi->s_qf_names[qtype], '/')) { |
@@ -1326,7 +1326,7 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) | |||
1326 | "quotafile must be on filesystem root"); | 1326 | "quotafile must be on filesystem root"); |
1327 | kfree(sbi->s_qf_names[qtype]); | 1327 | kfree(sbi->s_qf_names[qtype]); |
1328 | sbi->s_qf_names[qtype] = NULL; | 1328 | sbi->s_qf_names[qtype] = NULL; |
1329 | return 0; | 1329 | return -1; |
1330 | } | 1330 | } |
1331 | set_opt(sb, QUOTA); | 1331 | set_opt(sb, QUOTA); |
1332 | return 1; | 1332 | return 1; |
@@ -1341,7 +1341,7 @@ static int clear_qf_name(struct super_block *sb, int qtype) | |||
1341 | sbi->s_qf_names[qtype]) { | 1341 | sbi->s_qf_names[qtype]) { |
1342 | ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options" | 1342 | ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options" |
1343 | " when quota turned on"); | 1343 | " when quota turned on"); |
1344 | return 0; | 1344 | return -1; |
1345 | } | 1345 | } |
1346 | /* | 1346 | /* |
1347 | * The space will be released later when all options are confirmed | 1347 | * The space will be released later when all options are confirmed |
@@ -1450,6 +1450,16 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, | |||
1450 | const struct mount_opts *m; | 1450 | const struct mount_opts *m; |
1451 | int arg = 0; | 1451 | int arg = 0; |
1452 | 1452 | ||
1453 | #ifdef CONFIG_QUOTA | ||
1454 | if (token == Opt_usrjquota) | ||
1455 | return set_qf_name(sb, USRQUOTA, &args[0]); | ||
1456 | else if (token == Opt_grpjquota) | ||
1457 | return set_qf_name(sb, GRPQUOTA, &args[0]); | ||
1458 | else if (token == Opt_offusrjquota) | ||
1459 | return clear_qf_name(sb, USRQUOTA); | ||
1460 | else if (token == Opt_offgrpjquota) | ||
1461 | return clear_qf_name(sb, GRPQUOTA); | ||
1462 | #endif | ||
1453 | if (args->from && match_int(args, &arg)) | 1463 | if (args->from && match_int(args, &arg)) |
1454 | return -1; | 1464 | return -1; |
1455 | switch (token) { | 1465 | switch (token) { |
@@ -1549,18 +1559,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, | |||
1549 | sbi->s_mount_opt |= m->mount_opt; | 1559 | sbi->s_mount_opt |= m->mount_opt; |
1550 | } | 1560 | } |
1551 | #ifdef CONFIG_QUOTA | 1561 | #ifdef CONFIG_QUOTA |
1552 | } else if (token == Opt_usrjquota) { | ||
1553 | if (!set_qf_name(sb, USRQUOTA, &args[0])) | ||
1554 | return -1; | ||
1555 | } else if (token == Opt_grpjquota) { | ||
1556 | if (!set_qf_name(sb, GRPQUOTA, &args[0])) | ||
1557 | return -1; | ||
1558 | } else if (token == Opt_offusrjquota) { | ||
1559 | if (!clear_qf_name(sb, USRQUOTA)) | ||
1560 | return -1; | ||
1561 | } else if (token == Opt_offgrpjquota) { | ||
1562 | if (!clear_qf_name(sb, GRPQUOTA)) | ||
1563 | return -1; | ||
1564 | } else if (m->flags & MOPT_QFMT) { | 1562 | } else if (m->flags & MOPT_QFMT) { |
1565 | if (sb_any_quota_loaded(sb) && | 1563 | if (sb_any_quota_loaded(sb) && |
1566 | sbi->s_jquota_fmt != m->mount_opt) { | 1564 | sbi->s_jquota_fmt != m->mount_opt) { |
@@ -2366,18 +2364,6 @@ static ssize_t lifetime_write_kbytes_show(struct ext4_attr *a, | |||
2366 | EXT4_SB(sb)->s_sectors_written_start) >> 1))); | 2364 | EXT4_SB(sb)->s_sectors_written_start) >> 1))); |
2367 | } | 2365 | } |
2368 | 2366 | ||
2369 | static ssize_t extent_cache_hits_show(struct ext4_attr *a, | ||
2370 | struct ext4_sb_info *sbi, char *buf) | ||
2371 | { | ||
2372 | return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_hits); | ||
2373 | } | ||
2374 | |||
2375 | static ssize_t extent_cache_misses_show(struct ext4_attr *a, | ||
2376 | struct ext4_sb_info *sbi, char *buf) | ||
2377 | { | ||
2378 | return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_misses); | ||
2379 | } | ||
2380 | |||
2381 | static ssize_t inode_readahead_blks_store(struct ext4_attr *a, | 2367 | static ssize_t inode_readahead_blks_store(struct ext4_attr *a, |
2382 | struct ext4_sb_info *sbi, | 2368 | struct ext4_sb_info *sbi, |
2383 | const char *buf, size_t count) | 2369 | const char *buf, size_t count) |
@@ -2435,8 +2421,6 @@ static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store) | |||
2435 | EXT4_RO_ATTR(delayed_allocation_blocks); | 2421 | EXT4_RO_ATTR(delayed_allocation_blocks); |
2436 | EXT4_RO_ATTR(session_write_kbytes); | 2422 | EXT4_RO_ATTR(session_write_kbytes); |
2437 | EXT4_RO_ATTR(lifetime_write_kbytes); | 2423 | EXT4_RO_ATTR(lifetime_write_kbytes); |
2438 | EXT4_RO_ATTR(extent_cache_hits); | ||
2439 | EXT4_RO_ATTR(extent_cache_misses); | ||
2440 | EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show, | 2424 | EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show, |
2441 | inode_readahead_blks_store, s_inode_readahead_blks); | 2425 | inode_readahead_blks_store, s_inode_readahead_blks); |
2442 | EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal); | 2426 | EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal); |
@@ -2452,8 +2436,6 @@ static struct attribute *ext4_attrs[] = { | |||
2452 | ATTR_LIST(delayed_allocation_blocks), | 2436 | ATTR_LIST(delayed_allocation_blocks), |
2453 | ATTR_LIST(session_write_kbytes), | 2437 | ATTR_LIST(session_write_kbytes), |
2454 | ATTR_LIST(lifetime_write_kbytes), | 2438 | ATTR_LIST(lifetime_write_kbytes), |
2455 | ATTR_LIST(extent_cache_hits), | ||
2456 | ATTR_LIST(extent_cache_misses), | ||
2457 | ATTR_LIST(inode_readahead_blks), | 2439 | ATTR_LIST(inode_readahead_blks), |
2458 | ATTR_LIST(inode_goal), | 2440 | ATTR_LIST(inode_goal), |
2459 | ATTR_LIST(mb_stats), | 2441 | ATTR_LIST(mb_stats), |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 206632887bb4..df5ac048dc74 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -387,9 +387,6 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, | |||
387 | if (fc->no_create) | 387 | if (fc->no_create) |
388 | return -ENOSYS; | 388 | return -ENOSYS; |
389 | 389 | ||
390 | if (flags & O_DIRECT) | ||
391 | return -EINVAL; | ||
392 | |||
393 | forget = fuse_alloc_forget(); | 390 | forget = fuse_alloc_forget(); |
394 | if (!forget) | 391 | if (!forget) |
395 | return -ENOMEM; | 392 | return -ENOMEM; |
@@ -644,13 +641,12 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) | |||
644 | fuse_put_request(fc, req); | 641 | fuse_put_request(fc, req); |
645 | if (!err) { | 642 | if (!err) { |
646 | struct inode *inode = entry->d_inode; | 643 | struct inode *inode = entry->d_inode; |
644 | struct fuse_inode *fi = get_fuse_inode(inode); | ||
647 | 645 | ||
648 | /* | 646 | spin_lock(&fc->lock); |
649 | * Set nlink to zero so the inode can be cleared, if the inode | 647 | fi->attr_version = ++fc->attr_version; |
650 | * does have more links this will be discovered at the next | 648 | drop_nlink(inode); |
651 | * lookup/getattr. | 649 | spin_unlock(&fc->lock); |
652 | */ | ||
653 | clear_nlink(inode); | ||
654 | fuse_invalidate_attr(inode); | 650 | fuse_invalidate_attr(inode); |
655 | fuse_invalidate_attr(dir); | 651 | fuse_invalidate_attr(dir); |
656 | fuse_invalidate_entry_cache(entry); | 652 | fuse_invalidate_entry_cache(entry); |
@@ -762,8 +758,17 @@ static int fuse_link(struct dentry *entry, struct inode *newdir, | |||
762 | will reflect changes in the backing inode (link count, | 758 | will reflect changes in the backing inode (link count, |
763 | etc.) | 759 | etc.) |
764 | */ | 760 | */ |
765 | if (!err || err == -EINTR) | 761 | if (!err) { |
762 | struct fuse_inode *fi = get_fuse_inode(inode); | ||
763 | |||
764 | spin_lock(&fc->lock); | ||
765 | fi->attr_version = ++fc->attr_version; | ||
766 | inc_nlink(inode); | ||
767 | spin_unlock(&fc->lock); | ||
768 | fuse_invalidate_attr(inode); | ||
769 | } else if (err == -EINTR) { | ||
766 | fuse_invalidate_attr(inode); | 770 | fuse_invalidate_attr(inode); |
771 | } | ||
767 | return err; | 772 | return err; |
768 | } | 773 | } |
769 | 774 | ||
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index a841868bf9ce..504e61b7fd75 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -194,10 +194,6 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) | |||
194 | struct fuse_conn *fc = get_fuse_conn(inode); | 194 | struct fuse_conn *fc = get_fuse_conn(inode); |
195 | int err; | 195 | int err; |
196 | 196 | ||
197 | /* VFS checks this, but only _after_ ->open() */ | ||
198 | if (file->f_flags & O_DIRECT) | ||
199 | return -EINVAL; | ||
200 | |||
201 | err = generic_file_open(inode, file); | 197 | err = generic_file_open(inode, file); |
202 | if (err) | 198 | if (err) |
203 | return err; | 199 | return err; |
@@ -932,17 +928,23 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
932 | struct file *file = iocb->ki_filp; | 928 | struct file *file = iocb->ki_filp; |
933 | struct address_space *mapping = file->f_mapping; | 929 | struct address_space *mapping = file->f_mapping; |
934 | size_t count = 0; | 930 | size_t count = 0; |
931 | size_t ocount = 0; | ||
935 | ssize_t written = 0; | 932 | ssize_t written = 0; |
933 | ssize_t written_buffered = 0; | ||
936 | struct inode *inode = mapping->host; | 934 | struct inode *inode = mapping->host; |
937 | ssize_t err; | 935 | ssize_t err; |
938 | struct iov_iter i; | 936 | struct iov_iter i; |
937 | loff_t endbyte = 0; | ||
939 | 938 | ||
940 | WARN_ON(iocb->ki_pos != pos); | 939 | WARN_ON(iocb->ki_pos != pos); |
941 | 940 | ||
942 | err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ); | 941 | ocount = 0; |
942 | err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ); | ||
943 | if (err) | 943 | if (err) |
944 | return err; | 944 | return err; |
945 | 945 | ||
946 | count = ocount; | ||
947 | |||
946 | mutex_lock(&inode->i_mutex); | 948 | mutex_lock(&inode->i_mutex); |
947 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); | 949 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); |
948 | 950 | ||
@@ -962,11 +964,41 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
962 | 964 | ||
963 | file_update_time(file); | 965 | file_update_time(file); |
964 | 966 | ||
965 | iov_iter_init(&i, iov, nr_segs, count, 0); | 967 | if (file->f_flags & O_DIRECT) { |
966 | written = fuse_perform_write(file, mapping, &i, pos); | 968 | written = generic_file_direct_write(iocb, iov, &nr_segs, |
967 | if (written >= 0) | 969 | pos, &iocb->ki_pos, |
968 | iocb->ki_pos = pos + written; | 970 | count, ocount); |
971 | if (written < 0 || written == count) | ||
972 | goto out; | ||
973 | |||
974 | pos += written; | ||
975 | count -= written; | ||
969 | 976 | ||
977 | iov_iter_init(&i, iov, nr_segs, count, written); | ||
978 | written_buffered = fuse_perform_write(file, mapping, &i, pos); | ||
979 | if (written_buffered < 0) { | ||
980 | err = written_buffered; | ||
981 | goto out; | ||
982 | } | ||
983 | endbyte = pos + written_buffered - 1; | ||
984 | |||
985 | err = filemap_write_and_wait_range(file->f_mapping, pos, | ||
986 | endbyte); | ||
987 | if (err) | ||
988 | goto out; | ||
989 | |||
990 | invalidate_mapping_pages(file->f_mapping, | ||
991 | pos >> PAGE_CACHE_SHIFT, | ||
992 | endbyte >> PAGE_CACHE_SHIFT); | ||
993 | |||
994 | written += written_buffered; | ||
995 | iocb->ki_pos = pos + written_buffered; | ||
996 | } else { | ||
997 | iov_iter_init(&i, iov, nr_segs, count, 0); | ||
998 | written = fuse_perform_write(file, mapping, &i, pos); | ||
999 | if (written >= 0) | ||
1000 | iocb->ki_pos = pos + written; | ||
1001 | } | ||
970 | out: | 1002 | out: |
971 | current->backing_dev_info = NULL; | 1003 | current->backing_dev_info = NULL; |
972 | mutex_unlock(&inode->i_mutex); | 1004 | mutex_unlock(&inode->i_mutex); |
@@ -1101,30 +1133,41 @@ static ssize_t fuse_direct_read(struct file *file, char __user *buf, | |||
1101 | return res; | 1133 | return res; |
1102 | } | 1134 | } |
1103 | 1135 | ||
1104 | static ssize_t fuse_direct_write(struct file *file, const char __user *buf, | 1136 | static ssize_t __fuse_direct_write(struct file *file, const char __user *buf, |
1105 | size_t count, loff_t *ppos) | 1137 | size_t count, loff_t *ppos) |
1106 | { | 1138 | { |
1107 | struct inode *inode = file->f_path.dentry->d_inode; | 1139 | struct inode *inode = file->f_path.dentry->d_inode; |
1108 | ssize_t res; | 1140 | ssize_t res; |
1109 | 1141 | ||
1110 | if (is_bad_inode(inode)) | ||
1111 | return -EIO; | ||
1112 | |||
1113 | /* Don't allow parallel writes to the same file */ | ||
1114 | mutex_lock(&inode->i_mutex); | ||
1115 | res = generic_write_checks(file, ppos, &count, 0); | 1142 | res = generic_write_checks(file, ppos, &count, 0); |
1116 | if (!res) { | 1143 | if (!res) { |
1117 | res = fuse_direct_io(file, buf, count, ppos, 1); | 1144 | res = fuse_direct_io(file, buf, count, ppos, 1); |
1118 | if (res > 0) | 1145 | if (res > 0) |
1119 | fuse_write_update_size(inode, *ppos); | 1146 | fuse_write_update_size(inode, *ppos); |
1120 | } | 1147 | } |
1121 | mutex_unlock(&inode->i_mutex); | ||
1122 | 1148 | ||
1123 | fuse_invalidate_attr(inode); | 1149 | fuse_invalidate_attr(inode); |
1124 | 1150 | ||
1125 | return res; | 1151 | return res; |
1126 | } | 1152 | } |
1127 | 1153 | ||
1154 | static ssize_t fuse_direct_write(struct file *file, const char __user *buf, | ||
1155 | size_t count, loff_t *ppos) | ||
1156 | { | ||
1157 | struct inode *inode = file->f_path.dentry->d_inode; | ||
1158 | ssize_t res; | ||
1159 | |||
1160 | if (is_bad_inode(inode)) | ||
1161 | return -EIO; | ||
1162 | |||
1163 | /* Don't allow parallel writes to the same file */ | ||
1164 | mutex_lock(&inode->i_mutex); | ||
1165 | res = __fuse_direct_write(file, buf, count, ppos); | ||
1166 | mutex_unlock(&inode->i_mutex); | ||
1167 | |||
1168 | return res; | ||
1169 | } | ||
1170 | |||
1128 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) | 1171 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) |
1129 | { | 1172 | { |
1130 | __free_page(req->pages[0]); | 1173 | __free_page(req->pages[0]); |
@@ -2077,6 +2120,57 @@ int fuse_notify_poll_wakeup(struct fuse_conn *fc, | |||
2077 | return 0; | 2120 | return 0; |
2078 | } | 2121 | } |
2079 | 2122 | ||
2123 | static ssize_t fuse_loop_dio(struct file *filp, const struct iovec *iov, | ||
2124 | unsigned long nr_segs, loff_t *ppos, int rw) | ||
2125 | { | ||
2126 | const struct iovec *vector = iov; | ||
2127 | ssize_t ret = 0; | ||
2128 | |||
2129 | while (nr_segs > 0) { | ||
2130 | void __user *base; | ||
2131 | size_t len; | ||
2132 | ssize_t nr; | ||
2133 | |||
2134 | base = vector->iov_base; | ||
2135 | len = vector->iov_len; | ||
2136 | vector++; | ||
2137 | nr_segs--; | ||
2138 | |||
2139 | if (rw == WRITE) | ||
2140 | nr = __fuse_direct_write(filp, base, len, ppos); | ||
2141 | else | ||
2142 | nr = fuse_direct_read(filp, base, len, ppos); | ||
2143 | |||
2144 | if (nr < 0) { | ||
2145 | if (!ret) | ||
2146 | ret = nr; | ||
2147 | break; | ||
2148 | } | ||
2149 | ret += nr; | ||
2150 | if (nr != len) | ||
2151 | break; | ||
2152 | } | ||
2153 | |||
2154 | return ret; | ||
2155 | } | ||
2156 | |||
2157 | |||
2158 | static ssize_t | ||
2159 | fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | ||
2160 | loff_t offset, unsigned long nr_segs) | ||
2161 | { | ||
2162 | ssize_t ret = 0; | ||
2163 | struct file *file = NULL; | ||
2164 | loff_t pos = 0; | ||
2165 | |||
2166 | file = iocb->ki_filp; | ||
2167 | pos = offset; | ||
2168 | |||
2169 | ret = fuse_loop_dio(file, iov, nr_segs, &pos, rw); | ||
2170 | |||
2171 | return ret; | ||
2172 | } | ||
2173 | |||
2080 | static const struct file_operations fuse_file_operations = { | 2174 | static const struct file_operations fuse_file_operations = { |
2081 | .llseek = fuse_file_llseek, | 2175 | .llseek = fuse_file_llseek, |
2082 | .read = do_sync_read, | 2176 | .read = do_sync_read, |
@@ -2120,6 +2214,7 @@ static const struct address_space_operations fuse_file_aops = { | |||
2120 | .readpages = fuse_readpages, | 2214 | .readpages = fuse_readpages, |
2121 | .set_page_dirty = __set_page_dirty_nobuffers, | 2215 | .set_page_dirty = __set_page_dirty_nobuffers, |
2122 | .bmap = fuse_bmap, | 2216 | .bmap = fuse_bmap, |
2217 | .direct_IO = fuse_direct_IO, | ||
2123 | }; | 2218 | }; |
2124 | 2219 | ||
2125 | void fuse_init_file_inode(struct inode *inode) | 2220 | void fuse_init_file_inode(struct inode *inode) |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 4aec5995867e..26783eb2b1fc 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -947,6 +947,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
947 | sb->s_magic = FUSE_SUPER_MAGIC; | 947 | sb->s_magic = FUSE_SUPER_MAGIC; |
948 | sb->s_op = &fuse_super_operations; | 948 | sb->s_op = &fuse_super_operations; |
949 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 949 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
950 | sb->s_time_gran = 1; | ||
950 | sb->s_export_op = &fuse_export_operations; | 951 | sb->s_export_op = &fuse_export_operations; |
951 | 952 | ||
952 | file = fget(d.fd); | 953 | file = fget(d.fd); |
diff --git a/fs/gfs2/Kconfig b/fs/gfs2/Kconfig index c465ae066c62..eb08c9e43c2a 100644 --- a/fs/gfs2/Kconfig +++ b/fs/gfs2/Kconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | config GFS2_FS | 1 | config GFS2_FS |
2 | tristate "GFS2 file system support" | 2 | tristate "GFS2 file system support" |
3 | depends on (64BIT || LBDAF) | 3 | depends on (64BIT || LBDAF) |
4 | select DLM if GFS2_FS_LOCKING_DLM | ||
5 | select CONFIGFS_FS if GFS2_FS_LOCKING_DLM | ||
6 | select SYSFS if GFS2_FS_LOCKING_DLM | ||
7 | select IP_SCTP if DLM_SCTP | ||
8 | select FS_POSIX_ACL | 4 | select FS_POSIX_ACL |
9 | select CRC32 | 5 | select CRC32 |
10 | select QUOTACTL | 6 | select QUOTACTL |
@@ -29,7 +25,8 @@ config GFS2_FS | |||
29 | 25 | ||
30 | config GFS2_FS_LOCKING_DLM | 26 | config GFS2_FS_LOCKING_DLM |
31 | bool "GFS2 DLM locking" | 27 | bool "GFS2 DLM locking" |
32 | depends on (GFS2_FS!=n) && NET && INET && (IPV6 || IPV6=n) && HOTPLUG | 28 | depends on (GFS2_FS!=n) && NET && INET && (IPV6 || IPV6=n) && \ |
29 | HOTPLUG && DLM && CONFIGFS_FS && SYSFS | ||
33 | help | 30 | help |
34 | Multiple node locking module for GFS2 | 31 | Multiple node locking module for GFS2 |
35 | 32 | ||
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 38b7a74a0f91..9b2ff0e851b1 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -807,7 +807,7 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh, | |||
807 | 807 | ||
808 | if (inode == sdp->sd_rindex) { | 808 | if (inode == sdp->sd_rindex) { |
809 | adjust_fs_space(inode); | 809 | adjust_fs_space(inode); |
810 | ip->i_gh.gh_flags |= GL_NOCACHE; | 810 | sdp->sd_rindex_uptodate = 0; |
811 | } | 811 | } |
812 | 812 | ||
813 | brelse(dibh); | 813 | brelse(dibh); |
@@ -873,7 +873,7 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
873 | 873 | ||
874 | if (inode == sdp->sd_rindex) { | 874 | if (inode == sdp->sd_rindex) { |
875 | adjust_fs_space(inode); | 875 | adjust_fs_space(inode); |
876 | ip->i_gh.gh_flags |= GL_NOCACHE; | 876 | sdp->sd_rindex_uptodate = 0; |
877 | } | 877 | } |
878 | 878 | ||
879 | brelse(dibh); | 879 | brelse(dibh); |
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 197c5c47e577..03c04febe26f 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -724,7 +724,11 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
724 | int metadata; | 724 | int metadata; |
725 | unsigned int revokes = 0; | 725 | unsigned int revokes = 0; |
726 | int x; | 726 | int x; |
727 | int error = 0; | 727 | int error; |
728 | |||
729 | error = gfs2_rindex_update(sdp); | ||
730 | if (error) | ||
731 | return error; | ||
728 | 732 | ||
729 | if (!*top) | 733 | if (!*top) |
730 | sm->sm_first = 0; | 734 | sm->sm_first = 0; |
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index c35573abd371..a836056343f0 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -1844,6 +1844,10 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, | |||
1844 | unsigned int x, size = len * sizeof(u64); | 1844 | unsigned int x, size = len * sizeof(u64); |
1845 | int error; | 1845 | int error; |
1846 | 1846 | ||
1847 | error = gfs2_rindex_update(sdp); | ||
1848 | if (error) | ||
1849 | return error; | ||
1850 | |||
1847 | memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); | 1851 | memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); |
1848 | 1852 | ||
1849 | ht = kzalloc(size, GFP_NOFS); | 1853 | ht = kzalloc(size, GFP_NOFS); |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index c98a60ee6dfd..a9ba2444e077 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -1031,7 +1031,13 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry) | |||
1031 | struct buffer_head *bh; | 1031 | struct buffer_head *bh; |
1032 | struct gfs2_holder ghs[3]; | 1032 | struct gfs2_holder ghs[3]; |
1033 | struct gfs2_rgrpd *rgd; | 1033 | struct gfs2_rgrpd *rgd; |
1034 | int error = -EROFS; | 1034 | int error; |
1035 | |||
1036 | error = gfs2_rindex_update(sdp); | ||
1037 | if (error) | ||
1038 | return error; | ||
1039 | |||
1040 | error = -EROFS; | ||
1035 | 1041 | ||
1036 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); | 1042 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); |
1037 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); | 1043 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); |
@@ -1224,6 +1230,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
1224 | return 0; | 1230 | return 0; |
1225 | } | 1231 | } |
1226 | 1232 | ||
1233 | error = gfs2_rindex_update(sdp); | ||
1234 | if (error) | ||
1235 | return error; | ||
1236 | |||
1227 | if (odip != ndip) { | 1237 | if (odip != ndip) { |
1228 | error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE, | 1238 | error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE, |
1229 | 0, &r_gh); | 1239 | 0, &r_gh); |
@@ -1345,7 +1355,6 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
1345 | error = alloc_required; | 1355 | error = alloc_required; |
1346 | if (error < 0) | 1356 | if (error < 0) |
1347 | goto out_gunlock; | 1357 | goto out_gunlock; |
1348 | error = 0; | ||
1349 | 1358 | ||
1350 | if (alloc_required) { | 1359 | if (alloc_required) { |
1351 | struct gfs2_qadata *qa = gfs2_qadata_get(ndip); | 1360 | struct gfs2_qadata *qa = gfs2_qadata_get(ndip); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 19bde40b4864..3df65c9ab73b 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -332,9 +332,6 @@ struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk, bool exact) | |||
332 | struct rb_node *n, *next; | 332 | struct rb_node *n, *next; |
333 | struct gfs2_rgrpd *cur; | 333 | struct gfs2_rgrpd *cur; |
334 | 334 | ||
335 | if (gfs2_rindex_update(sdp)) | ||
336 | return NULL; | ||
337 | |||
338 | spin_lock(&sdp->sd_rindex_spin); | 335 | spin_lock(&sdp->sd_rindex_spin); |
339 | n = sdp->sd_rindex_tree.rb_node; | 336 | n = sdp->sd_rindex_tree.rb_node; |
340 | while (n) { | 337 | while (n) { |
@@ -640,6 +637,7 @@ static int read_rindex_entry(struct gfs2_inode *ip, | |||
640 | return 0; | 637 | return 0; |
641 | 638 | ||
642 | error = 0; /* someone else read in the rgrp; free it and ignore it */ | 639 | error = 0; /* someone else read in the rgrp; free it and ignore it */ |
640 | gfs2_glock_put(rgd->rd_gl); | ||
643 | 641 | ||
644 | fail: | 642 | fail: |
645 | kfree(rgd->rd_bits); | 643 | kfree(rgd->rd_bits); |
@@ -927,6 +925,10 @@ int gfs2_fitrim(struct file *filp, void __user *argp) | |||
927 | } else if (copy_from_user(&r, argp, sizeof(r))) | 925 | } else if (copy_from_user(&r, argp, sizeof(r))) |
928 | return -EFAULT; | 926 | return -EFAULT; |
929 | 927 | ||
928 | ret = gfs2_rindex_update(sdp); | ||
929 | if (ret) | ||
930 | return ret; | ||
931 | |||
930 | rgd = gfs2_blk2rgrpd(sdp, r.start, 0); | 932 | rgd = gfs2_blk2rgrpd(sdp, r.start, 0); |
931 | rgd_end = gfs2_blk2rgrpd(sdp, r.start + r.len, 0); | 933 | rgd_end = gfs2_blk2rgrpd(sdp, r.start + r.len, 0); |
932 | 934 | ||
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index 2e5ba425cae7..927f4df874ae 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c | |||
@@ -238,6 +238,10 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, | |||
238 | unsigned int x; | 238 | unsigned int x; |
239 | int error; | 239 | int error; |
240 | 240 | ||
241 | error = gfs2_rindex_update(sdp); | ||
242 | if (error) | ||
243 | return error; | ||
244 | |||
241 | if (GFS2_EA_IS_STUFFED(ea)) | 245 | if (GFS2_EA_IS_STUFFED(ea)) |
242 | return 0; | 246 | return 0; |
243 | 247 | ||
@@ -1330,6 +1334,10 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) | |||
1330 | unsigned int x; | 1334 | unsigned int x; |
1331 | int error; | 1335 | int error; |
1332 | 1336 | ||
1337 | error = gfs2_rindex_update(sdp); | ||
1338 | if (error) | ||
1339 | return error; | ||
1340 | |||
1333 | memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); | 1341 | memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); |
1334 | 1342 | ||
1335 | error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT, &indbh); | 1343 | error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT, &indbh); |
@@ -1439,6 +1447,10 @@ static int ea_dealloc_block(struct gfs2_inode *ip) | |||
1439 | struct gfs2_holder gh; | 1447 | struct gfs2_holder gh; |
1440 | int error; | 1448 | int error; |
1441 | 1449 | ||
1450 | error = gfs2_rindex_update(sdp); | ||
1451 | if (error) | ||
1452 | return error; | ||
1453 | |||
1442 | rgd = gfs2_blk2rgrpd(sdp, ip->i_eattr, 1); | 1454 | rgd = gfs2_blk2rgrpd(sdp, ip->i_eattr, 1); |
1443 | if (!rgd) { | 1455 | if (!rgd) { |
1444 | gfs2_consist_inode(ip); | 1456 | gfs2_consist_inode(ip); |
diff --git a/fs/libfs.c b/fs/libfs.c index 358094f0433d..18d08f5db53a 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -529,6 +529,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic, | |||
529 | return 0; | 529 | return 0; |
530 | out: | 530 | out: |
531 | d_genocide(root); | 531 | d_genocide(root); |
532 | shrink_dcache_parent(root); | ||
532 | dput(root); | 533 | dput(root); |
533 | return -ENOMEM; | 534 | return -ENOMEM; |
534 | } | 535 | } |
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c index 3ddcbb1c0a43..13ad1539fbf2 100644 --- a/fs/lockd/clnt4xdr.c +++ b/fs/lockd/clnt4xdr.c | |||
@@ -241,7 +241,7 @@ static int decode_nlm4_stat(struct xdr_stream *xdr, __be32 *stat) | |||
241 | p = xdr_inline_decode(xdr, 4); | 241 | p = xdr_inline_decode(xdr, 4); |
242 | if (unlikely(p == NULL)) | 242 | if (unlikely(p == NULL)) |
243 | goto out_overflow; | 243 | goto out_overflow; |
244 | if (unlikely(*p > nlm4_failed)) | 244 | if (unlikely(ntohl(*p) > ntohl(nlm4_failed))) |
245 | goto out_bad_xdr; | 245 | goto out_bad_xdr; |
246 | *stat = *p; | 246 | *stat = *p; |
247 | return 0; | 247 | return 0; |
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c index 3d35e3e80c1c..d269ada7670e 100644 --- a/fs/lockd/clntxdr.c +++ b/fs/lockd/clntxdr.c | |||
@@ -236,7 +236,7 @@ static int decode_nlm_stat(struct xdr_stream *xdr, | |||
236 | p = xdr_inline_decode(xdr, 4); | 236 | p = xdr_inline_decode(xdr, 4); |
237 | if (unlikely(p == NULL)) | 237 | if (unlikely(p == NULL)) |
238 | goto out_overflow; | 238 | goto out_overflow; |
239 | if (unlikely(*p > nlm_lck_denied_grace_period)) | 239 | if (unlikely(ntohl(*p) > ntohl(nlm_lck_denied_grace_period))) |
240 | goto out_enum; | 240 | goto out_enum; |
241 | *stat = *p; | 241 | *stat = *p; |
242 | return 0; | 242 | return 0; |
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 08c6e36ab2eb..43f46cd9edea 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -803,13 +803,13 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, | |||
803 | return p; | 803 | return p; |
804 | } | 804 | } |
805 | 805 | ||
806 | static int | 806 | static __be32 |
807 | compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, | 807 | compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, |
808 | const char *name, int namlen) | 808 | const char *name, int namlen) |
809 | { | 809 | { |
810 | struct svc_export *exp; | 810 | struct svc_export *exp; |
811 | struct dentry *dparent, *dchild; | 811 | struct dentry *dparent, *dchild; |
812 | int rv = 0; | 812 | __be32 rv = nfserr_noent; |
813 | 813 | ||
814 | dparent = cd->fh.fh_dentry; | 814 | dparent = cd->fh.fh_dentry; |
815 | exp = cd->fh.fh_export; | 815 | exp = cd->fh.fh_export; |
@@ -817,26 +817,20 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, | |||
817 | if (isdotent(name, namlen)) { | 817 | if (isdotent(name, namlen)) { |
818 | if (namlen == 2) { | 818 | if (namlen == 2) { |
819 | dchild = dget_parent(dparent); | 819 | dchild = dget_parent(dparent); |
820 | if (dchild == dparent) { | 820 | /* filesystem root - cannot return filehandle for ".." */ |
821 | /* filesystem root - cannot return filehandle for ".." */ | 821 | if (dchild == dparent) |
822 | dput(dchild); | 822 | goto out; |
823 | return -ENOENT; | ||
824 | } | ||
825 | } else | 823 | } else |
826 | dchild = dget(dparent); | 824 | dchild = dget(dparent); |
827 | } else | 825 | } else |
828 | dchild = lookup_one_len(name, dparent, namlen); | 826 | dchild = lookup_one_len(name, dparent, namlen); |
829 | if (IS_ERR(dchild)) | 827 | if (IS_ERR(dchild)) |
830 | return -ENOENT; | 828 | return rv; |
831 | rv = -ENOENT; | ||
832 | if (d_mountpoint(dchild)) | 829 | if (d_mountpoint(dchild)) |
833 | goto out; | 830 | goto out; |
834 | rv = fh_compose(fhp, exp, dchild, &cd->fh); | ||
835 | if (rv) | ||
836 | goto out; | ||
837 | if (!dchild->d_inode) | 831 | if (!dchild->d_inode) |
838 | goto out; | 832 | goto out; |
839 | rv = 0; | 833 | rv = fh_compose(fhp, exp, dchild, &cd->fh); |
840 | out: | 834 | out: |
841 | dput(dchild); | 835 | dput(dchild); |
842 | return rv; | 836 | return rv; |
@@ -845,7 +839,7 @@ out: | |||
845 | static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) | 839 | static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) |
846 | { | 840 | { |
847 | struct svc_fh fh; | 841 | struct svc_fh fh; |
848 | int err; | 842 | __be32 err; |
849 | 843 | ||
850 | fh_init(&fh, NFS3_FHSIZE); | 844 | fh_init(&fh, NFS3_FHSIZE); |
851 | err = compose_entry_fh(cd, &fh, name, namlen); | 845 | err = compose_entry_fh(cd, &fh, name, namlen); |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 2ed14dfd00a2..987e719fbae8 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -235,17 +235,17 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | |||
235 | */ | 235 | */ |
236 | if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0) | 236 | if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0) |
237 | open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS | | 237 | open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS | |
238 | FATTR4_WORD1_TIME_MODIFY); | 238 | FATTR4_WORD1_TIME_MODIFY); |
239 | } else { | 239 | } else { |
240 | status = nfsd_lookup(rqstp, current_fh, | 240 | status = nfsd_lookup(rqstp, current_fh, |
241 | open->op_fname.data, open->op_fname.len, resfh); | 241 | open->op_fname.data, open->op_fname.len, resfh); |
242 | fh_unlock(current_fh); | 242 | fh_unlock(current_fh); |
243 | if (status) | ||
244 | goto out; | ||
245 | status = nfsd_check_obj_isreg(resfh); | ||
246 | } | 243 | } |
247 | if (status) | 244 | if (status) |
248 | goto out; | 245 | goto out; |
246 | status = nfsd_check_obj_isreg(resfh); | ||
247 | if (status) | ||
248 | goto out; | ||
249 | 249 | ||
250 | if (is_create_with_attrs(open) && open->op_acl != NULL) | 250 | if (is_create_with_attrs(open) && open->op_acl != NULL) |
251 | do_set_nfs4_acl(rqstp, resfh, open->op_acl, open->op_bmval); | 251 | do_set_nfs4_acl(rqstp, resfh, open->op_acl, open->op_bmval); |
@@ -841,6 +841,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
841 | struct nfsd4_setattr *setattr) | 841 | struct nfsd4_setattr *setattr) |
842 | { | 842 | { |
843 | __be32 status = nfs_ok; | 843 | __be32 status = nfs_ok; |
844 | int err; | ||
844 | 845 | ||
845 | if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { | 846 | if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { |
846 | nfs4_lock_state(); | 847 | nfs4_lock_state(); |
@@ -852,9 +853,9 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
852 | return status; | 853 | return status; |
853 | } | 854 | } |
854 | } | 855 | } |
855 | status = fh_want_write(&cstate->current_fh); | 856 | err = fh_want_write(&cstate->current_fh); |
856 | if (status) | 857 | if (err) |
857 | return status; | 858 | return nfserrno(err); |
858 | status = nfs_ok; | 859 | status = nfs_ok; |
859 | 860 | ||
860 | status = check_attr_support(rqstp, cstate, setattr->sa_bmval, | 861 | status = check_attr_support(rqstp, cstate, setattr->sa_bmval, |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1841f8bf845e..7f71c69cdcdf 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -4211,16 +4211,14 @@ out: | |||
4211 | * vfs_test_lock. (Arguably perhaps test_lock should be done with an | 4211 | * vfs_test_lock. (Arguably perhaps test_lock should be done with an |
4212 | * inode operation.) | 4212 | * inode operation.) |
4213 | */ | 4213 | */ |
4214 | static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) | 4214 | static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) |
4215 | { | 4215 | { |
4216 | struct file *file; | 4216 | struct file *file; |
4217 | int err; | 4217 | __be32 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); |
4218 | 4218 | if (!err) { | |
4219 | err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); | 4219 | err = nfserrno(vfs_test_lock(file, lock)); |
4220 | if (err) | 4220 | nfsd_close(file); |
4221 | return err; | 4221 | } |
4222 | err = vfs_test_lock(file, lock); | ||
4223 | nfsd_close(file); | ||
4224 | return err; | 4222 | return err; |
4225 | } | 4223 | } |
4226 | 4224 | ||
@@ -4234,7 +4232,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
4234 | struct inode *inode; | 4232 | struct inode *inode; |
4235 | struct file_lock file_lock; | 4233 | struct file_lock file_lock; |
4236 | struct nfs4_lockowner *lo; | 4234 | struct nfs4_lockowner *lo; |
4237 | int error; | ||
4238 | __be32 status; | 4235 | __be32 status; |
4239 | 4236 | ||
4240 | if (locks_in_grace()) | 4237 | if (locks_in_grace()) |
@@ -4280,12 +4277,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
4280 | 4277 | ||
4281 | nfs4_transform_lock_offset(&file_lock); | 4278 | nfs4_transform_lock_offset(&file_lock); |
4282 | 4279 | ||
4283 | status = nfs_ok; | 4280 | status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); |
4284 | error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); | 4281 | if (status) |
4285 | if (error) { | ||
4286 | status = nfserrno(error); | ||
4287 | goto out; | 4282 | goto out; |
4288 | } | 4283 | |
4289 | if (file_lock.fl_type != F_UNLCK) { | 4284 | if (file_lock.fl_type != F_UNLCK) { |
4290 | status = nfserr_denied; | 4285 | status = nfserr_denied; |
4291 | nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); | 4286 | nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index bcd8904ab1e3..74c00bc92b9a 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1392,7 +1392,7 @@ nfsd4_decode_test_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_test_sta | |||
1392 | for (i = 0; i < test_stateid->ts_num_ids; i++) { | 1392 | for (i = 0; i < test_stateid->ts_num_ids; i++) { |
1393 | stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL); | 1393 | stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL); |
1394 | if (!stateid) { | 1394 | if (!stateid) { |
1395 | status = PTR_ERR(stateid); | 1395 | status = nfserrno(-ENOMEM); |
1396 | goto out; | 1396 | goto out; |
1397 | } | 1397 | } |
1398 | 1398 | ||
@@ -3410,7 +3410,7 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, int nfserr, | |||
3410 | *p++ = htonl(test_stateid->ts_num_ids); | 3410 | *p++ = htonl(test_stateid->ts_num_ids); |
3411 | 3411 | ||
3412 | list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) { | 3412 | list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) { |
3413 | *p++ = htonl(stateid->ts_id_status); | 3413 | *p++ = stateid->ts_id_status; |
3414 | } | 3414 | } |
3415 | 3415 | ||
3416 | ADJUST_ARGS(); | 3416 | ADJUST_ARGS(); |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 296d671654d6..568666156ea4 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1458,7 +1458,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1458 | switch (createmode) { | 1458 | switch (createmode) { |
1459 | case NFS3_CREATE_UNCHECKED: | 1459 | case NFS3_CREATE_UNCHECKED: |
1460 | if (! S_ISREG(dchild->d_inode->i_mode)) | 1460 | if (! S_ISREG(dchild->d_inode->i_mode)) |
1461 | err = nfserr_exist; | 1461 | goto out; |
1462 | else if (truncp) { | 1462 | else if (truncp) { |
1463 | /* in nfsv4, we need to treat this case a little | 1463 | /* in nfsv4, we need to treat this case a little |
1464 | * differently. we don't want to truncate the | 1464 | * differently. we don't want to truncate the |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 3165aebb43c8..31b9463fba1f 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -1134,7 +1134,7 @@ static int ocfs2_adjust_rightmost_branch(handle_t *handle, | |||
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | el = path_leaf_el(path); | 1136 | el = path_leaf_el(path); |
1137 | rec = &el->l_recs[le32_to_cpu(el->l_next_free_rec) - 1]; | 1137 | rec = &el->l_recs[le16_to_cpu(el->l_next_free_rec) - 1]; |
1138 | 1138 | ||
1139 | ocfs2_adjust_rightmost_records(handle, et, path, rec); | 1139 | ocfs2_adjust_rightmost_records(handle, et, path, rec); |
1140 | 1140 | ||
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index cf7823382664..9f32d7cbb7a3 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -1036,14 +1036,14 @@ static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci, | |||
1036 | 1036 | ||
1037 | tmp_el = left_path->p_node[subtree_root].el; | 1037 | tmp_el = left_path->p_node[subtree_root].el; |
1038 | blkno = left_path->p_node[subtree_root+1].bh->b_blocknr; | 1038 | blkno = left_path->p_node[subtree_root+1].bh->b_blocknr; |
1039 | for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) { | 1039 | for (i = 0; i < le16_to_cpu(tmp_el->l_next_free_rec); i++) { |
1040 | if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) { | 1040 | if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) { |
1041 | *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos); | 1041 | *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos); |
1042 | break; | 1042 | break; |
1043 | } | 1043 | } |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec)); | 1046 | BUG_ON(i == le16_to_cpu(tmp_el->l_next_free_rec)); |
1047 | 1047 | ||
1048 | out: | 1048 | out: |
1049 | ocfs2_free_path(left_path); | 1049 | ocfs2_free_path(left_path); |
@@ -1468,7 +1468,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh, | |||
1468 | 1468 | ||
1469 | trace_ocfs2_divide_leaf_refcount_block( | 1469 | trace_ocfs2_divide_leaf_refcount_block( |
1470 | (unsigned long long)ref_leaf_bh->b_blocknr, | 1470 | (unsigned long long)ref_leaf_bh->b_blocknr, |
1471 | le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used)); | 1471 | le16_to_cpu(rl->rl_count), le16_to_cpu(rl->rl_used)); |
1472 | 1472 | ||
1473 | /* | 1473 | /* |
1474 | * XXX: Improvement later. | 1474 | * XXX: Improvement later. |
@@ -2411,7 +2411,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | |||
2411 | rb = (struct ocfs2_refcount_block *) | 2411 | rb = (struct ocfs2_refcount_block *) |
2412 | prev_bh->b_data; | 2412 | prev_bh->b_data; |
2413 | 2413 | ||
2414 | if (le64_to_cpu(rb->rf_records.rl_used) + | 2414 | if (le16_to_cpu(rb->rf_records.rl_used) + |
2415 | recs_add > | 2415 | recs_add > |
2416 | le16_to_cpu(rb->rf_records.rl_count)) | 2416 | le16_to_cpu(rb->rf_records.rl_count)) |
2417 | ref_blocks++; | 2417 | ref_blocks++; |
@@ -2476,7 +2476,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | |||
2476 | if (prev_bh) { | 2476 | if (prev_bh) { |
2477 | rb = (struct ocfs2_refcount_block *)prev_bh->b_data; | 2477 | rb = (struct ocfs2_refcount_block *)prev_bh->b_data; |
2478 | 2478 | ||
2479 | if (le64_to_cpu(rb->rf_records.rl_used) + recs_add > | 2479 | if (le16_to_cpu(rb->rf_records.rl_used) + recs_add > |
2480 | le16_to_cpu(rb->rf_records.rl_count)) | 2480 | le16_to_cpu(rb->rf_records.rl_count)) |
2481 | ref_blocks++; | 2481 | ref_blocks++; |
2482 | 2482 | ||
@@ -3629,7 +3629,7 @@ int ocfs2_refcounted_xattr_delete_need(struct inode *inode, | |||
3629 | * one will split a refcount rec, so totally we need | 3629 | * one will split a refcount rec, so totally we need |
3630 | * clusters * 2 new refcount rec. | 3630 | * clusters * 2 new refcount rec. |
3631 | */ | 3631 | */ |
3632 | if (le64_to_cpu(rb->rf_records.rl_used) + clusters * 2 > | 3632 | if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 > |
3633 | le16_to_cpu(rb->rf_records.rl_count)) | 3633 | le16_to_cpu(rb->rf_records.rl_count)) |
3634 | ref_blocks++; | 3634 | ref_blocks++; |
3635 | 3635 | ||
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index ba5d97e4a73e..f169da4624fd 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -600,7 +600,7 @@ static void ocfs2_bg_alloc_cleanup(handle_t *handle, | |||
600 | ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode, | 600 | ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode, |
601 | cluster_ac->ac_bh, | 601 | cluster_ac->ac_bh, |
602 | le64_to_cpu(rec->e_blkno), | 602 | le64_to_cpu(rec->e_blkno), |
603 | le32_to_cpu(rec->e_leaf_clusters)); | 603 | le16_to_cpu(rec->e_leaf_clusters)); |
604 | if (ret) | 604 | if (ret) |
605 | mlog_errno(ret); | 605 | mlog_errno(ret); |
606 | /* Try all the clusters to free */ | 606 | /* Try all the clusters to free */ |
@@ -1628,7 +1628,7 @@ static int ocfs2_bg_discontig_fix_by_rec(struct ocfs2_suballoc_result *res, | |||
1628 | { | 1628 | { |
1629 | unsigned int bpc = le16_to_cpu(cl->cl_bpc); | 1629 | unsigned int bpc = le16_to_cpu(cl->cl_bpc); |
1630 | unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc; | 1630 | unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc; |
1631 | unsigned int bitcount = le32_to_cpu(rec->e_leaf_clusters) * bpc; | 1631 | unsigned int bitcount = le16_to_cpu(rec->e_leaf_clusters) * bpc; |
1632 | 1632 | ||
1633 | if (res->sr_bit_offset < bitoff) | 1633 | if (res->sr_bit_offset < bitoff) |
1634 | return 0; | 1634 | return 0; |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 6a0c62d6e442..64c3b3172367 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -18,19 +18,39 @@ | |||
18 | #ifndef arch_irq_stat | 18 | #ifndef arch_irq_stat |
19 | #define arch_irq_stat() 0 | 19 | #define arch_irq_stat() 0 |
20 | #endif | 20 | #endif |
21 | #ifndef arch_idle_time | 21 | |
22 | #define arch_idle_time(cpu) 0 | 22 | #ifdef arch_idle_time |
23 | #endif | 23 | |
24 | static cputime64_t get_idle_time(int cpu) | ||
25 | { | ||
26 | cputime64_t idle; | ||
27 | |||
28 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; | ||
29 | if (cpu_online(cpu) && !nr_iowait_cpu(cpu)) | ||
30 | idle += arch_idle_time(cpu); | ||
31 | return idle; | ||
32 | } | ||
33 | |||
34 | static cputime64_t get_iowait_time(int cpu) | ||
35 | { | ||
36 | cputime64_t iowait; | ||
37 | |||
38 | iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; | ||
39 | if (cpu_online(cpu) && nr_iowait_cpu(cpu)) | ||
40 | iowait += arch_idle_time(cpu); | ||
41 | return iowait; | ||
42 | } | ||
43 | |||
44 | #else | ||
24 | 45 | ||
25 | static u64 get_idle_time(int cpu) | 46 | static u64 get_idle_time(int cpu) |
26 | { | 47 | { |
27 | u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL); | 48 | u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL); |
28 | 49 | ||
29 | if (idle_time == -1ULL) { | 50 | if (idle_time == -1ULL) |
30 | /* !NO_HZ so we can rely on cpustat.idle */ | 51 | /* !NO_HZ so we can rely on cpustat.idle */ |
31 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; | 52 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; |
32 | idle += arch_idle_time(cpu); | 53 | else |
33 | } else | ||
34 | idle = usecs_to_cputime64(idle_time); | 54 | idle = usecs_to_cputime64(idle_time); |
35 | 55 | ||
36 | return idle; | 56 | return idle; |
@@ -49,6 +69,8 @@ static u64 get_iowait_time(int cpu) | |||
49 | return iowait; | 69 | return iowait; |
50 | } | 70 | } |
51 | 71 | ||
72 | #endif | ||
73 | |||
52 | static int show_stat(struct seq_file *p, void *v) | 74 | static int show_stat(struct seq_file *p, void *v) |
53 | { | 75 | { |
54 | int i, j; | 76 | int i, j; |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 2a7a3f5d1ca6..35a36d39fa2c 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -729,6 +729,9 @@ int sysfs_create_dir(struct kobject * kobj) | |||
729 | else | 729 | else |
730 | parent_sd = &sysfs_root; | 730 | parent_sd = &sysfs_root; |
731 | 731 | ||
732 | if (!parent_sd) | ||
733 | return -ENOENT; | ||
734 | |||
732 | if (sysfs_ns_type(parent_sd)) | 735 | if (sysfs_ns_type(parent_sd)) |
733 | ns = kobj->ktype->namespace(kobj); | 736 | ns = kobj->ktype->namespace(kobj); |
734 | type = sysfs_read_ns_type(kobj); | 737 | type = sysfs_read_ns_type(kobj); |
@@ -878,7 +881,6 @@ int sysfs_rename(struct sysfs_dirent *sd, | |||
878 | 881 | ||
879 | dup_name = sd->s_name; | 882 | dup_name = sd->s_name; |
880 | sd->s_name = new_name; | 883 | sd->s_name = new_name; |
881 | sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name); | ||
882 | } | 884 | } |
883 | 885 | ||
884 | /* Move to the appropriate place in the appropriate directories rbtree. */ | 886 | /* Move to the appropriate place in the appropriate directories rbtree. */ |
@@ -886,6 +888,7 @@ int sysfs_rename(struct sysfs_dirent *sd, | |||
886 | sysfs_get(new_parent_sd); | 888 | sysfs_get(new_parent_sd); |
887 | sysfs_put(sd->s_parent); | 889 | sysfs_put(sd->s_parent); |
888 | sd->s_ns = new_ns; | 890 | sd->s_ns = new_ns; |
891 | sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name); | ||
889 | sd->s_parent = new_parent_sd; | 892 | sd->s_parent = new_parent_sd; |
890 | sysfs_link_sibling(sd); | 893 | sysfs_link_sibling(sd); |
891 | 894 | ||
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index dd1701caecc9..2df555c66d57 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c | |||
@@ -67,7 +67,11 @@ static int internal_create_group(struct kobject *kobj, int update, | |||
67 | /* Updates may happen before the object has been instantiated */ | 67 | /* Updates may happen before the object has been instantiated */ |
68 | if (unlikely(update && !kobj->sd)) | 68 | if (unlikely(update && !kobj->sd)) |
69 | return -EINVAL; | 69 | return -EINVAL; |
70 | 70 | if (!grp->attrs) { | |
71 | WARN(1, "sysfs: attrs not set by subsystem for group: %s/%s\n", | ||
72 | kobj->name, grp->name ? "" : grp->name); | ||
73 | return -EINVAL; | ||
74 | } | ||
71 | if (grp->name) { | 75 | if (grp->name) { |
72 | error = sysfs_create_subdir(kobj, grp->name, &sd); | 76 | error = sysfs_create_subdir(kobj, grp->name, &sd); |
73 | if (error) | 77 | if (error) |
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index 3963116083ae..e478de4e5d56 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h | |||
@@ -85,7 +85,7 @@ struct drm_exynos_gem_mmap { | |||
85 | struct drm_exynos_vidi_connection { | 85 | struct drm_exynos_vidi_connection { |
86 | unsigned int connection; | 86 | unsigned int connection; |
87 | unsigned int extensions; | 87 | unsigned int extensions; |
88 | uint64_t *edid; | 88 | uint64_t edid; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | struct drm_exynos_plane_set_zpos { | 91 | struct drm_exynos_plane_set_zpos { |
@@ -96,7 +96,8 @@ struct drm_exynos_plane_set_zpos { | |||
96 | /* memory type definitions. */ | 96 | /* memory type definitions. */ |
97 | enum e_drm_exynos_gem_mem_type { | 97 | enum e_drm_exynos_gem_mem_type { |
98 | /* Physically Non-Continuous memory. */ | 98 | /* Physically Non-Continuous memory. */ |
99 | EXYNOS_BO_NONCONTIG = 1 << 0 | 99 | EXYNOS_BO_NONCONTIG = 1 << 0, |
100 | EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | ||
100 | }; | 101 | }; |
101 | 102 | ||
102 | #define DRM_EXYNOS_GEM_CREATE 0x00 | 103 | #define DRM_EXYNOS_GEM_CREATE 0x00 |
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index 7847e197730a..8d54f79457ba 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h | |||
@@ -30,7 +30,6 @@ struct amba_device { | |||
30 | struct device dev; | 30 | struct device dev; |
31 | struct resource res; | 31 | struct resource res; |
32 | struct clk *pclk; | 32 | struct clk *pclk; |
33 | struct regulator *vcore; | ||
34 | u64 dma_mask; | 33 | u64 dma_mask; |
35 | unsigned int periphid; | 34 | unsigned int periphid; |
36 | unsigned int irq[AMBA_NR_IRQS]; | 35 | unsigned int irq[AMBA_NR_IRQS]; |
@@ -75,12 +74,6 @@ void amba_release_regions(struct amba_device *); | |||
75 | #define amba_pclk_disable(d) \ | 74 | #define amba_pclk_disable(d) \ |
76 | do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) | 75 | do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) |
77 | 76 | ||
78 | #define amba_vcore_enable(d) \ | ||
79 | (IS_ERR((d)->vcore) ? 0 : regulator_enable((d)->vcore)) | ||
80 | |||
81 | #define amba_vcore_disable(d) \ | ||
82 | do { if (!IS_ERR((d)->vcore)) regulator_disable((d)->vcore); } while (0) | ||
83 | |||
84 | /* Some drivers don't use the struct amba_device */ | 77 | /* Some drivers don't use the struct amba_device */ |
85 | #define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff) | 78 | #define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff) |
86 | #define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f) | 79 | #define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f) |
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h index b8c51124ed19..76dd1b199a1b 100644 --- a/include/linux/amba/pl022.h +++ b/include/linux/amba/pl022.h | |||
@@ -25,6 +25,8 @@ | |||
25 | #ifndef _SSP_PL022_H | 25 | #ifndef _SSP_PL022_H |
26 | #define _SSP_PL022_H | 26 | #define _SSP_PL022_H |
27 | 27 | ||
28 | #include <linux/types.h> | ||
29 | |||
28 | /** | 30 | /** |
29 | * whether SSP is in loopback mode or not | 31 | * whether SSP is in loopback mode or not |
30 | */ | 32 | */ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 606cf339bb56..2aa24664a5b5 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -426,14 +426,10 @@ struct request_queue { | |||
426 | (1 << QUEUE_FLAG_SAME_COMP) | \ | 426 | (1 << QUEUE_FLAG_SAME_COMP) | \ |
427 | (1 << QUEUE_FLAG_ADD_RANDOM)) | 427 | (1 << QUEUE_FLAG_ADD_RANDOM)) |
428 | 428 | ||
429 | static inline int queue_is_locked(struct request_queue *q) | 429 | static inline void queue_lockdep_assert_held(struct request_queue *q) |
430 | { | 430 | { |
431 | #ifdef CONFIG_SMP | 431 | if (q->queue_lock) |
432 | spinlock_t *lock = q->queue_lock; | 432 | lockdep_assert_held(q->queue_lock); |
433 | return lock && spin_is_locked(lock); | ||
434 | #else | ||
435 | return 1; | ||
436 | #endif | ||
437 | } | 433 | } |
438 | 434 | ||
439 | static inline void queue_flag_set_unlocked(unsigned int flag, | 435 | static inline void queue_flag_set_unlocked(unsigned int flag, |
@@ -445,7 +441,7 @@ static inline void queue_flag_set_unlocked(unsigned int flag, | |||
445 | static inline int queue_flag_test_and_clear(unsigned int flag, | 441 | static inline int queue_flag_test_and_clear(unsigned int flag, |
446 | struct request_queue *q) | 442 | struct request_queue *q) |
447 | { | 443 | { |
448 | WARN_ON_ONCE(!queue_is_locked(q)); | 444 | queue_lockdep_assert_held(q); |
449 | 445 | ||
450 | if (test_bit(flag, &q->queue_flags)) { | 446 | if (test_bit(flag, &q->queue_flags)) { |
451 | __clear_bit(flag, &q->queue_flags); | 447 | __clear_bit(flag, &q->queue_flags); |
@@ -458,7 +454,7 @@ static inline int queue_flag_test_and_clear(unsigned int flag, | |||
458 | static inline int queue_flag_test_and_set(unsigned int flag, | 454 | static inline int queue_flag_test_and_set(unsigned int flag, |
459 | struct request_queue *q) | 455 | struct request_queue *q) |
460 | { | 456 | { |
461 | WARN_ON_ONCE(!queue_is_locked(q)); | 457 | queue_lockdep_assert_held(q); |
462 | 458 | ||
463 | if (!test_bit(flag, &q->queue_flags)) { | 459 | if (!test_bit(flag, &q->queue_flags)) { |
464 | __set_bit(flag, &q->queue_flags); | 460 | __set_bit(flag, &q->queue_flags); |
@@ -470,7 +466,7 @@ static inline int queue_flag_test_and_set(unsigned int flag, | |||
470 | 466 | ||
471 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) | 467 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) |
472 | { | 468 | { |
473 | WARN_ON_ONCE(!queue_is_locked(q)); | 469 | queue_lockdep_assert_held(q); |
474 | __set_bit(flag, &q->queue_flags); | 470 | __set_bit(flag, &q->queue_flags); |
475 | } | 471 | } |
476 | 472 | ||
@@ -487,7 +483,7 @@ static inline int queue_in_flight(struct request_queue *q) | |||
487 | 483 | ||
488 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | 484 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) |
489 | { | 485 | { |
490 | WARN_ON_ONCE(!queue_is_locked(q)); | 486 | queue_lockdep_assert_held(q); |
491 | __clear_bit(flag, &q->queue_flags); | 487 | __clear_bit(flag, &q->queue_flags); |
492 | } | 488 | } |
493 | 489 | ||
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 676f967390ae..f9a2e5e67a54 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -974,6 +974,7 @@ int dma_async_device_register(struct dma_device *device); | |||
974 | void dma_async_device_unregister(struct dma_device *device); | 974 | void dma_async_device_unregister(struct dma_device *device); |
975 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); | 975 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); |
976 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); | 976 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); |
977 | struct dma_chan *net_dma_find_channel(void); | ||
977 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) | 978 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) |
978 | 979 | ||
979 | /* --- Helper iov-locking functions --- */ | 980 | /* --- Helper iov-locking functions --- */ |
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index 8ba2c9460b28..8f2ab8fef929 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
@@ -593,7 +593,7 @@ struct fuse_dirent { | |||
593 | __u64 off; | 593 | __u64 off; |
594 | __u32 namelen; | 594 | __u32 namelen; |
595 | __u32 type; | 595 | __u32 type; |
596 | char name[0]; | 596 | char name[]; |
597 | }; | 597 | }; |
598 | 598 | ||
599 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) | 599 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) |
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 2463b6100333..1f90de0cfdbe 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h | |||
@@ -666,23 +666,11 @@ struct twl4030_codec_data { | |||
666 | unsigned int check_defaults:1; | 666 | unsigned int check_defaults:1; |
667 | unsigned int reset_registers:1; | 667 | unsigned int reset_registers:1; |
668 | unsigned int hs_extmute:1; | 668 | unsigned int hs_extmute:1; |
669 | u16 hs_left_step; | ||
670 | u16 hs_right_step; | ||
671 | u16 hf_left_step; | ||
672 | u16 hf_right_step; | ||
673 | void (*set_hs_extmute)(int mute); | 669 | void (*set_hs_extmute)(int mute); |
674 | }; | 670 | }; |
675 | 671 | ||
676 | struct twl4030_vibra_data { | 672 | struct twl4030_vibra_data { |
677 | unsigned int coexist; | 673 | unsigned int coexist; |
678 | |||
679 | /* twl6040 */ | ||
680 | unsigned int vibldrv_res; /* left driver resistance */ | ||
681 | unsigned int vibrdrv_res; /* right driver resistance */ | ||
682 | unsigned int viblmotor_res; /* left motor resistance */ | ||
683 | unsigned int vibrmotor_res; /* right motor resistance */ | ||
684 | int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ | ||
685 | int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ | ||
686 | }; | 674 | }; |
687 | 675 | ||
688 | struct twl4030_audio_data { | 676 | struct twl4030_audio_data { |
diff --git a/include/linux/irq.h b/include/linux/irq.h index bff29c58da23..7810406f3d80 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -263,6 +263,11 @@ static inline void irqd_clr_chained_irq_inprogress(struct irq_data *d) | |||
263 | d->state_use_accessors &= ~IRQD_IRQ_INPROGRESS; | 263 | d->state_use_accessors &= ~IRQD_IRQ_INPROGRESS; |
264 | } | 264 | } |
265 | 265 | ||
266 | static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) | ||
267 | { | ||
268 | return d->hwirq; | ||
269 | } | ||
270 | |||
266 | /** | 271 | /** |
267 | * struct irq_chip - hardware interrupt chip descriptor | 272 | * struct irq_chip - hardware interrupt chip descriptor |
268 | * | 273 | * |
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index ead4a4215797..c65740d76e66 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h | |||
@@ -42,12 +42,6 @@ struct of_device_id; | |||
42 | /* Number of irqs reserved for a legacy isa controller */ | 42 | /* Number of irqs reserved for a legacy isa controller */ |
43 | #define NUM_ISA_INTERRUPTS 16 | 43 | #define NUM_ISA_INTERRUPTS 16 |
44 | 44 | ||
45 | /* This type is the placeholder for a hardware interrupt number. It has to | ||
46 | * be big enough to enclose whatever representation is used by a given | ||
47 | * platform. | ||
48 | */ | ||
49 | typedef unsigned long irq_hw_number_t; | ||
50 | |||
51 | /** | 45 | /** |
52 | * struct irq_domain_ops - Methods for irq_domain objects | 46 | * struct irq_domain_ops - Methods for irq_domain objects |
53 | * @match: Match an interrupt controller device node to a host, returns | 47 | * @match: Match an interrupt controller device node to a host, returns |
@@ -104,6 +98,9 @@ struct irq_domain { | |||
104 | unsigned int size; | 98 | unsigned int size; |
105 | unsigned int *revmap; | 99 | unsigned int *revmap; |
106 | } linear; | 100 | } linear; |
101 | struct { | ||
102 | unsigned int max_irq; | ||
103 | } nomap; | ||
107 | struct radix_tree_root tree; | 104 | struct radix_tree_root tree; |
108 | } revmap_data; | 105 | } revmap_data; |
109 | const struct irq_domain_ops *ops; | 106 | const struct irq_domain_ops *ops; |
@@ -126,6 +123,7 @@ struct irq_domain *irq_domain_add_linear(struct device_node *of_node, | |||
126 | const struct irq_domain_ops *ops, | 123 | const struct irq_domain_ops *ops, |
127 | void *host_data); | 124 | void *host_data); |
128 | struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, | 125 | struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, |
126 | unsigned int max_irq, | ||
129 | const struct irq_domain_ops *ops, | 127 | const struct irq_domain_ops *ops, |
130 | void *host_data); | 128 | void *host_data); |
131 | struct irq_domain *irq_domain_add_tree(struct device_node *of_node, | 129 | struct irq_domain *irq_domain_add_tree(struct device_node *of_node, |
@@ -134,7 +132,6 @@ struct irq_domain *irq_domain_add_tree(struct device_node *of_node, | |||
134 | 132 | ||
135 | extern struct irq_domain *irq_find_host(struct device_node *node); | 133 | extern struct irq_domain *irq_find_host(struct device_node *node); |
136 | extern void irq_set_default_host(struct irq_domain *host); | 134 | extern void irq_set_default_host(struct irq_domain *host); |
137 | extern void irq_set_virq_count(unsigned int count); | ||
138 | 135 | ||
139 | static inline struct irq_domain *irq_domain_add_legacy_isa( | 136 | static inline struct irq_domain *irq_domain_add_legacy_isa( |
140 | struct device_node *of_node, | 137 | struct device_node *of_node, |
@@ -146,7 +143,6 @@ static inline struct irq_domain *irq_domain_add_legacy_isa( | |||
146 | } | 143 | } |
147 | extern struct irq_domain *irq_find_host(struct device_node *node); | 144 | extern struct irq_domain *irq_find_host(struct device_node *node); |
148 | extern void irq_set_default_host(struct irq_domain *host); | 145 | extern void irq_set_default_host(struct irq_domain *host); |
149 | extern void irq_set_virq_count(unsigned int count); | ||
150 | 146 | ||
151 | 147 | ||
152 | extern unsigned int irq_create_mapping(struct irq_domain *host, | 148 | extern unsigned int irq_create_mapping(struct irq_domain *host, |
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 067eda0e4b32..be342b94c640 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h | |||
@@ -4,29 +4,43 @@ | |||
4 | #include <generated/autoconf.h> | 4 | #include <generated/autoconf.h> |
5 | 5 | ||
6 | /* | 6 | /* |
7 | * Helper macros to use CONFIG_ options in C expressions. Note that | 7 | * Helper macros to use CONFIG_ options in C/CPP expressions. Note that |
8 | * these only work with boolean and tristate options. | 8 | * these only work with boolean and tristate options. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * Getting something that works in C and CPP for an arg that may or may | ||
13 | * not be defined is tricky. Here, if we have "#define CONFIG_BOOGER 1" | ||
14 | * we match on the placeholder define, insert the "0," for arg1 and generate | ||
15 | * the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg (a one). | ||
16 | * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when | ||
17 | * the last step cherry picks the 2nd arg, we get a zero. | ||
18 | */ | ||
19 | #define __ARG_PLACEHOLDER_1 0, | ||
20 | #define config_enabled(cfg) _config_enabled(cfg) | ||
21 | #define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) | ||
22 | #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) | ||
23 | #define ___config_enabled(__ignored, val, ...) val | ||
24 | |||
25 | /* | ||
12 | * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', | 26 | * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', |
13 | * 0 otherwise. | 27 | * 0 otherwise. |
14 | * | 28 | * |
15 | */ | 29 | */ |
16 | #define IS_ENABLED(option) \ | 30 | #define IS_ENABLED(option) \ |
17 | (__enabled_ ## option || __enabled_ ## option ## _MODULE) | 31 | (config_enabled(option) || config_enabled(option##_MODULE)) |
18 | 32 | ||
19 | /* | 33 | /* |
20 | * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 | 34 | * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 |
21 | * otherwise. For boolean options, this is equivalent to | 35 | * otherwise. For boolean options, this is equivalent to |
22 | * IS_ENABLED(CONFIG_FOO). | 36 | * IS_ENABLED(CONFIG_FOO). |
23 | */ | 37 | */ |
24 | #define IS_BUILTIN(option) __enabled_ ## option | 38 | #define IS_BUILTIN(option) config_enabled(option) |
25 | 39 | ||
26 | /* | 40 | /* |
27 | * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 | 41 | * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 |
28 | * otherwise. | 42 | * otherwise. |
29 | */ | 43 | */ |
30 | #define IS_MODULE(option) __enabled_ ## option ## _MODULE | 44 | #define IS_MODULE(option) config_enabled(option##_MODULE) |
31 | 45 | ||
32 | #endif /* __LINUX_KCONFIG_H */ | 46 | #endif /* __LINUX_KCONFIG_H */ |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 665a260c7e09..72cbf08d45fb 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -596,6 +596,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | |||
596 | 596 | ||
597 | #ifdef CONFIG_IOMMU_API | 597 | #ifdef CONFIG_IOMMU_API |
598 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | 598 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); |
599 | void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | ||
599 | int kvm_iommu_map_guest(struct kvm *kvm); | 600 | int kvm_iommu_map_guest(struct kvm *kvm); |
600 | int kvm_iommu_unmap_guest(struct kvm *kvm); | 601 | int kvm_iommu_unmap_guest(struct kvm *kvm); |
601 | int kvm_assign_device(struct kvm *kvm, | 602 | int kvm_assign_device(struct kvm *kvm, |
@@ -609,6 +610,11 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm, | |||
609 | return 0; | 610 | return 0; |
610 | } | 611 | } |
611 | 612 | ||
613 | static inline void kvm_iommu_unmap_pages(struct kvm *kvm, | ||
614 | struct kvm_memory_slot *slot) | ||
615 | { | ||
616 | } | ||
617 | |||
612 | static inline int kvm_iommu_map_guest(struct kvm *kvm) | 618 | static inline int kvm_iommu_map_guest(struct kvm *kvm) |
613 | { | 619 | { |
614 | return -ENODEV; | 620 | return -ENODEV; |
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h index 9890687f582d..5a049dfaf153 100644 --- a/include/linux/mfd/db5500-prcmu.h +++ b/include/linux/mfd/db5500-prcmu.h | |||
@@ -8,41 +8,14 @@ | |||
8 | #ifndef __MFD_DB5500_PRCMU_H | 8 | #ifndef __MFD_DB5500_PRCMU_H |
9 | #define __MFD_DB5500_PRCMU_H | 9 | #define __MFD_DB5500_PRCMU_H |
10 | 10 | ||
11 | #ifdef CONFIG_MFD_DB5500_PRCMU | 11 | static inline int prcmu_resetout(u8 resoutn, u8 state) |
12 | |||
13 | void db5500_prcmu_early_init(void); | ||
14 | int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state); | ||
15 | int db5500_prcmu_set_display_clocks(void); | ||
16 | int db5500_prcmu_disable_dsipll(void); | ||
17 | int db5500_prcmu_enable_dsipll(void); | ||
18 | int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
19 | int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
20 | void db5500_prcmu_enable_wakeups(u32 wakeups); | ||
21 | int db5500_prcmu_request_clock(u8 clock, bool enable); | ||
22 | void db5500_prcmu_config_abb_event_readout(u32 abb_events); | ||
23 | void db5500_prcmu_get_abb_event_buffer(void __iomem **buf); | ||
24 | int prcmu_resetout(u8 resoutn, u8 state); | ||
25 | int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, | ||
26 | bool keep_ap_pll); | ||
27 | int db5500_prcmu_config_esram0_deep_sleep(u8 state); | ||
28 | void db5500_prcmu_system_reset(u16 reset_code); | ||
29 | u16 db5500_prcmu_get_reset_code(void); | ||
30 | bool db5500_prcmu_is_ac_wake_requested(void); | ||
31 | int db5500_prcmu_set_arm_opp(u8 opp); | ||
32 | int db5500_prcmu_get_arm_opp(void); | ||
33 | |||
34 | #else /* !CONFIG_UX500_SOC_DB5500 */ | ||
35 | |||
36 | static inline void db5500_prcmu_early_init(void) {} | ||
37 | |||
38 | static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
39 | { | 12 | { |
40 | return -ENOSYS; | 13 | return 0; |
41 | } | 14 | } |
42 | 15 | ||
43 | static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | 16 | static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state) |
44 | { | 17 | { |
45 | return -ENOSYS; | 18 | return 0; |
46 | } | 19 | } |
47 | 20 | ||
48 | static inline int db5500_prcmu_request_clock(u8 clock, bool enable) | 21 | static inline int db5500_prcmu_request_clock(u8 clock, bool enable) |
@@ -50,69 +23,82 @@ static inline int db5500_prcmu_request_clock(u8 clock, bool enable) | |||
50 | return 0; | 23 | return 0; |
51 | } | 24 | } |
52 | 25 | ||
53 | static inline int db5500_prcmu_set_display_clocks(void) | 26 | static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
27 | bool keep_ap_pll) | ||
54 | { | 28 | { |
55 | return 0; | 29 | return 0; |
56 | } | 30 | } |
57 | 31 | ||
58 | static inline int db5500_prcmu_disable_dsipll(void) | 32 | static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) |
59 | { | 33 | { |
60 | return 0; | 34 | return 0; |
61 | } | 35 | } |
62 | 36 | ||
63 | static inline int db5500_prcmu_enable_dsipll(void) | 37 | static inline u16 db5500_prcmu_get_reset_code(void) |
64 | { | 38 | { |
65 | return 0; | 39 | return 0; |
66 | } | 40 | } |
67 | 41 | ||
68 | static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) | 42 | static inline bool db5500_prcmu_is_ac_wake_requested(void) |
69 | { | 43 | { |
70 | return 0; | 44 | return 0; |
71 | } | 45 | } |
72 | 46 | ||
73 | static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} | 47 | static inline int db5500_prcmu_set_arm_opp(u8 opp) |
74 | |||
75 | static inline int prcmu_resetout(u8 resoutn, u8 state) | ||
76 | { | 48 | { |
77 | return 0; | 49 | return 0; |
78 | } | 50 | } |
79 | 51 | ||
80 | static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state) | 52 | static inline int db5500_prcmu_get_arm_opp(void) |
81 | { | 53 | { |
82 | return 0; | 54 | return 0; |
83 | } | 55 | } |
84 | 56 | ||
85 | static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {} | ||
86 | static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} | 57 | static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} |
87 | 58 | ||
88 | static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, | 59 | static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {} |
89 | bool keep_ap_pll) | ||
90 | { | ||
91 | return 0; | ||
92 | } | ||
93 | 60 | ||
94 | static inline void db5500_prcmu_system_reset(u16 reset_code) {} | 61 | static inline void db5500_prcmu_system_reset(u16 reset_code) {} |
95 | 62 | ||
96 | static inline u16 db5500_prcmu_get_reset_code(void) | 63 | static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} |
64 | |||
65 | #ifdef CONFIG_MFD_DB5500_PRCMU | ||
66 | |||
67 | void db5500_prcmu_early_init(void); | ||
68 | int db5500_prcmu_set_display_clocks(void); | ||
69 | int db5500_prcmu_disable_dsipll(void); | ||
70 | int db5500_prcmu_enable_dsipll(void); | ||
71 | int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
72 | int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
73 | |||
74 | #else /* !CONFIG_UX500_SOC_DB5500 */ | ||
75 | |||
76 | static inline void db5500_prcmu_early_init(void) {} | ||
77 | |||
78 | static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
97 | { | 79 | { |
98 | return 0; | 80 | return -ENOSYS; |
99 | } | 81 | } |
100 | 82 | ||
101 | static inline bool db5500_prcmu_is_ac_wake_requested(void) | 83 | static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) |
102 | { | 84 | { |
103 | return 0; | 85 | return -ENOSYS; |
104 | } | 86 | } |
105 | 87 | ||
106 | static inline int db5500_prcmu_set_arm_opp(u8 opp) | 88 | static inline int db5500_prcmu_set_display_clocks(void) |
107 | { | 89 | { |
108 | return 0; | 90 | return 0; |
109 | } | 91 | } |
110 | 92 | ||
111 | static inline int db5500_prcmu_get_arm_opp(void) | 93 | static inline int db5500_prcmu_disable_dsipll(void) |
112 | { | 94 | { |
113 | return 0; | 95 | return 0; |
114 | } | 96 | } |
115 | 97 | ||
98 | static inline int db5500_prcmu_enable_dsipll(void) | ||
99 | { | ||
100 | return 0; | ||
101 | } | ||
116 | 102 | ||
117 | #endif /* CONFIG_MFD_DB5500_PRCMU */ | 103 | #endif /* CONFIG_MFD_DB5500_PRCMU */ |
118 | 104 | ||
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h index a2c61609d21d..0b64b19d81ab 100644 --- a/include/linux/mfd/rc5t583.h +++ b/include/linux/mfd/rc5t583.h | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/regmap.h> | ||
29 | 30 | ||
30 | #define RC5T583_MAX_REGS 0xF8 | 31 | #define RC5T583_MAX_REGS 0xF8 |
31 | 32 | ||
@@ -279,14 +280,44 @@ struct rc5t583_platform_data { | |||
279 | bool enable_shutdown; | 280 | bool enable_shutdown; |
280 | }; | 281 | }; |
281 | 282 | ||
282 | int rc5t583_write(struct device *dev, u8 reg, uint8_t val); | 283 | static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) |
283 | int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val); | 284 | { |
284 | int rc5t583_set_bits(struct device *dev, unsigned int reg, | 285 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); |
285 | unsigned int bit_mask); | 286 | return regmap_write(rc5t583->regmap, reg, val); |
286 | int rc5t583_clear_bits(struct device *dev, unsigned int reg, | 287 | } |
287 | unsigned int bit_mask); | 288 | |
288 | int rc5t583_update(struct device *dev, unsigned int reg, | 289 | static inline int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val) |
289 | unsigned int val, unsigned int mask); | 290 | { |
291 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
292 | unsigned int ival; | ||
293 | int ret; | ||
294 | ret = regmap_read(rc5t583->regmap, reg, &ival); | ||
295 | if (!ret) | ||
296 | *val = (uint8_t)ival; | ||
297 | return ret; | ||
298 | } | ||
299 | |||
300 | static inline int rc5t583_set_bits(struct device *dev, unsigned int reg, | ||
301 | unsigned int bit_mask) | ||
302 | { | ||
303 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
304 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask); | ||
305 | } | ||
306 | |||
307 | static inline int rc5t583_clear_bits(struct device *dev, unsigned int reg, | ||
308 | unsigned int bit_mask) | ||
309 | { | ||
310 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
311 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0); | ||
312 | } | ||
313 | |||
314 | static inline int rc5t583_update(struct device *dev, unsigned int reg, | ||
315 | unsigned int val, unsigned int mask) | ||
316 | { | ||
317 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
318 | return regmap_update_bits(rc5t583->regmap, reg, mask, val); | ||
319 | } | ||
320 | |||
290 | int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id, | 321 | int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id, |
291 | int ext_pwr_req, int deepsleep_slot_nr); | 322 | int ext_pwr_req, int deepsleep_slot_nr); |
292 | int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base); | 323 | int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base); |
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h index 9bc9ac651dad..b15b5f03f5c4 100644 --- a/include/linux/mfd/twl6040.h +++ b/include/linux/mfd/twl6040.h | |||
@@ -174,8 +174,35 @@ | |||
174 | #define TWL6040_SYSCLK_SEL_LPPLL 0 | 174 | #define TWL6040_SYSCLK_SEL_LPPLL 0 |
175 | #define TWL6040_SYSCLK_SEL_HPPLL 1 | 175 | #define TWL6040_SYSCLK_SEL_HPPLL 1 |
176 | 176 | ||
177 | struct twl6040_codec_data { | ||
178 | u16 hs_left_step; | ||
179 | u16 hs_right_step; | ||
180 | u16 hf_left_step; | ||
181 | u16 hf_right_step; | ||
182 | }; | ||
183 | |||
184 | struct twl6040_vibra_data { | ||
185 | unsigned int vibldrv_res; /* left driver resistance */ | ||
186 | unsigned int vibrdrv_res; /* right driver resistance */ | ||
187 | unsigned int viblmotor_res; /* left motor resistance */ | ||
188 | unsigned int vibrmotor_res; /* right motor resistance */ | ||
189 | int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ | ||
190 | int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ | ||
191 | }; | ||
192 | |||
193 | struct twl6040_platform_data { | ||
194 | int audpwron_gpio; /* audio power-on gpio */ | ||
195 | unsigned int irq_base; | ||
196 | |||
197 | struct twl6040_codec_data *codec; | ||
198 | struct twl6040_vibra_data *vibra; | ||
199 | }; | ||
200 | |||
201 | struct regmap; | ||
202 | |||
177 | struct twl6040 { | 203 | struct twl6040 { |
178 | struct device *dev; | 204 | struct device *dev; |
205 | struct regmap *regmap; | ||
179 | struct mutex mutex; | 206 | struct mutex mutex; |
180 | struct mutex io_mutex; | 207 | struct mutex io_mutex; |
181 | struct mutex irq_mutex; | 208 | struct mutex irq_mutex; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index d8738a464b94..74aa71bea1e4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1393,29 +1393,20 @@ extern int install_special_mapping(struct mm_struct *mm, | |||
1393 | 1393 | ||
1394 | extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); | 1394 | extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); |
1395 | 1395 | ||
1396 | extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | ||
1397 | unsigned long len, unsigned long prot, | ||
1398 | unsigned long flag, unsigned long pgoff); | ||
1399 | extern unsigned long mmap_region(struct file *file, unsigned long addr, | 1396 | extern unsigned long mmap_region(struct file *file, unsigned long addr, |
1400 | unsigned long len, unsigned long flags, | 1397 | unsigned long len, unsigned long flags, |
1401 | vm_flags_t vm_flags, unsigned long pgoff); | 1398 | vm_flags_t vm_flags, unsigned long pgoff); |
1402 | 1399 | extern unsigned long do_mmap(struct file *, unsigned long, | |
1403 | static inline unsigned long do_mmap(struct file *file, unsigned long addr, | 1400 | unsigned long, unsigned long, |
1404 | unsigned long len, unsigned long prot, | 1401 | unsigned long, unsigned long); |
1405 | unsigned long flag, unsigned long offset) | ||
1406 | { | ||
1407 | unsigned long ret = -EINVAL; | ||
1408 | if ((offset + PAGE_ALIGN(len)) < offset) | ||
1409 | goto out; | ||
1410 | if (!(offset & ~PAGE_MASK)) | ||
1411 | ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); | ||
1412 | out: | ||
1413 | return ret; | ||
1414 | } | ||
1415 | |||
1416 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); | 1402 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); |
1417 | 1403 | ||
1418 | extern unsigned long do_brk(unsigned long, unsigned long); | 1404 | /* These take the mm semaphore themselves */ |
1405 | extern unsigned long vm_brk(unsigned long, unsigned long); | ||
1406 | extern int vm_munmap(unsigned long, size_t); | ||
1407 | extern unsigned long vm_mmap(struct file *, unsigned long, | ||
1408 | unsigned long, unsigned long, | ||
1409 | unsigned long, unsigned long); | ||
1419 | 1410 | ||
1420 | /* truncate.c */ | 1411 | /* truncate.c */ |
1421 | extern void truncate_inode_pages(struct address_space *, loff_t); | 1412 | extern void truncate_inode_pages(struct address_space *, loff_t); |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 01beae78f079..629b823f8836 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -481,7 +481,7 @@ struct mmc_driver { | |||
481 | struct device_driver drv; | 481 | struct device_driver drv; |
482 | int (*probe)(struct mmc_card *); | 482 | int (*probe)(struct mmc_card *); |
483 | void (*remove)(struct mmc_card *); | 483 | void (*remove)(struct mmc_card *); |
484 | int (*suspend)(struct mmc_card *, pm_message_t); | 484 | int (*suspend)(struct mmc_card *); |
485 | int (*resume)(struct mmc_card *); | 485 | int (*resume)(struct mmc_card *); |
486 | }; | 486 | }; |
487 | 487 | ||
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index f549adccc94c..1bc898b14a80 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h | |||
@@ -287,7 +287,17 @@ extern unsigned int ip6t_do_table(struct sk_buff *skb, | |||
287 | struct xt_table *table); | 287 | struct xt_table *table); |
288 | 288 | ||
289 | /* Check for an extension */ | 289 | /* Check for an extension */ |
290 | extern int ip6t_ext_hdr(u8 nexthdr); | 290 | static inline int |
291 | ip6t_ext_hdr(u8 nexthdr) | ||
292 | { return (nexthdr == IPPROTO_HOPOPTS) || | ||
293 | (nexthdr == IPPROTO_ROUTING) || | ||
294 | (nexthdr == IPPROTO_FRAGMENT) || | ||
295 | (nexthdr == IPPROTO_ESP) || | ||
296 | (nexthdr == IPPROTO_AH) || | ||
297 | (nexthdr == IPPROTO_NONE) || | ||
298 | (nexthdr == IPPROTO_DSTOPTS); | ||
299 | } | ||
300 | |||
291 | /* find specified header and get offset to it */ | 301 | /* find specified header and get offset to it */ |
292 | extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, | 302 | extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, |
293 | int target, unsigned short *fragoff); | 303 | int target, unsigned short *fragoff); |
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild index b8d4001212b3..5b7d84ac954a 100644 --- a/include/linux/nfsd/Kbuild +++ b/include/linux/nfsd/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | header-y += cld.h | ||
1 | header-y += debug.h | 2 | header-y += debug.h |
2 | header-y += export.h | 3 | header-y += export.h |
3 | header-y += nfsfh.h | 4 | header-y += nfsfh.h |
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h index fee4349364f7..e4d1de742502 100644 --- a/include/linux/pinctrl/machine.h +++ b/include/linux/pinctrl/machine.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #ifndef __LINUX_PINCTRL_MACHINE_H | 12 | #ifndef __LINUX_PINCTRL_MACHINE_H |
13 | #define __LINUX_PINCTRL_MACHINE_H | 13 | #define __LINUX_PINCTRL_MACHINE_H |
14 | 14 | ||
15 | #include <linux/bug.h> | ||
16 | |||
15 | #include "pinctrl-state.h" | 17 | #include "pinctrl-state.h" |
16 | 18 | ||
17 | enum pinctrl_map_type { | 19 | enum pinctrl_map_type { |
@@ -148,7 +150,7 @@ struct pinctrl_map { | |||
148 | #define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ | 150 | #define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ |
149 | PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) | 151 | PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) |
150 | 152 | ||
151 | #ifdef CONFIG_PINMUX | 153 | #ifdef CONFIG_PINCTRL |
152 | 154 | ||
153 | extern int pinctrl_register_mappings(struct pinctrl_map const *map, | 155 | extern int pinctrl_register_mappings(struct pinctrl_map const *map, |
154 | unsigned num_maps); | 156 | unsigned num_maps); |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index f51bf2e70c69..2db407a40051 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -357,7 +357,7 @@ struct uart_port { | |||
357 | #define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) | 357 | #define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) |
358 | #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) | 358 | #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) |
359 | #define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) | 359 | #define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) |
360 | #define UPF_IIR_ONCE ((__force upf_t) (1 << 26)) | 360 | #define UPF_BUG_THRE ((__force upf_t) (1 << 26)) |
361 | /* The exact UART type is known and should not be probed. */ | 361 | /* The exact UART type is known and should not be probed. */ |
362 | #define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) | 362 | #define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) |
363 | #define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) | 363 | #define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 33370271b8b2..70a3f8d49118 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -481,6 +481,7 @@ struct sk_buff { | |||
481 | union { | 481 | union { |
482 | __u32 mark; | 482 | __u32 mark; |
483 | __u32 dropcount; | 483 | __u32 dropcount; |
484 | __u32 avail_size; | ||
484 | }; | 485 | }; |
485 | 486 | ||
486 | sk_buff_data_t transport_header; | 487 | sk_buff_data_t transport_header; |
@@ -1366,6 +1367,18 @@ static inline int skb_tailroom(const struct sk_buff *skb) | |||
1366 | } | 1367 | } |
1367 | 1368 | ||
1368 | /** | 1369 | /** |
1370 | * skb_availroom - bytes at buffer end | ||
1371 | * @skb: buffer to check | ||
1372 | * | ||
1373 | * Return the number of bytes of free space at the tail of an sk_buff | ||
1374 | * allocated by sk_stream_alloc() | ||
1375 | */ | ||
1376 | static inline int skb_availroom(const struct sk_buff *skb) | ||
1377 | { | ||
1378 | return skb_is_nonlinear(skb) ? 0 : skb->avail_size - skb->len; | ||
1379 | } | ||
1380 | |||
1381 | /** | ||
1369 | * skb_reserve - adjust headroom | 1382 | * skb_reserve - adjust headroom |
1370 | * @skb: buffer to alter | 1383 | * @skb: buffer to alter |
1371 | * @len: bytes to move | 1384 | * @len: bytes to move |
diff --git a/include/linux/stddef.h b/include/linux/stddef.h index 6a40c76bdcf1..1747b6787b9e 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h | |||
@@ -3,14 +3,10 @@ | |||
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | 5 | ||
6 | #ifdef __KERNEL__ | ||
7 | |||
6 | #undef NULL | 8 | #undef NULL |
7 | #if defined(__cplusplus) | ||
8 | #define NULL 0 | ||
9 | #else | ||
10 | #define NULL ((void *)0) | 9 | #define NULL ((void *)0) |
11 | #endif | ||
12 | |||
13 | #ifdef __KERNEL__ | ||
14 | 10 | ||
15 | enum { | 11 | enum { |
16 | false = 0, | 12 | false = 0, |
diff --git a/include/linux/types.h b/include/linux/types.h index e5fa50345516..7f480db60231 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
@@ -210,6 +210,12 @@ typedef u32 phys_addr_t; | |||
210 | 210 | ||
211 | typedef phys_addr_t resource_size_t; | 211 | typedef phys_addr_t resource_size_t; |
212 | 212 | ||
213 | /* | ||
214 | * This type is the placeholder for a hardware interrupt number. It has to be | ||
215 | * big enough to enclose whatever representation is used by a given platform. | ||
216 | */ | ||
217 | typedef unsigned long irq_hw_number_t; | ||
218 | |||
213 | typedef struct { | 219 | typedef struct { |
214 | int counter; | 220 | int counter; |
215 | } atomic_t; | 221 | } atomic_t; |
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index f67810f8f21b..38ab3f46346f 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -94,6 +94,7 @@ struct usb_phy { | |||
94 | 94 | ||
95 | struct usb_otg *otg; | 95 | struct usb_otg *otg; |
96 | 96 | ||
97 | struct device *io_dev; | ||
97 | struct usb_phy_io_ops *io_ops; | 98 | struct usb_phy_io_ops *io_ops; |
98 | void __iomem *io_priv; | 99 | void __iomem *io_priv; |
99 | 100 | ||
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index fbb666b1b670..474283888233 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -28,13 +28,6 @@ | |||
28 | /* parity check flag */ | 28 | /* parity check flag */ |
29 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | 29 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) |
30 | 30 | ||
31 | enum port_dev_state { | ||
32 | PORT_UNREGISTERED, | ||
33 | PORT_REGISTERING, | ||
34 | PORT_REGISTERED, | ||
35 | PORT_UNREGISTERING, | ||
36 | }; | ||
37 | |||
38 | /* USB serial flags */ | 31 | /* USB serial flags */ |
39 | #define USB_SERIAL_WRITE_BUSY 0 | 32 | #define USB_SERIAL_WRITE_BUSY 0 |
40 | 33 | ||
@@ -124,7 +117,6 @@ struct usb_serial_port { | |||
124 | char throttle_req; | 117 | char throttle_req; |
125 | unsigned long sysrq; /* sysrq timeout */ | 118 | unsigned long sysrq; /* sysrq timeout */ |
126 | struct device dev; | 119 | struct device dev; |
127 | enum port_dev_state dev_state; | ||
128 | }; | 120 | }; |
129 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) | 121 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) |
130 | 122 | ||
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index 9c3120dca294..b572f80bdfd5 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h | |||
@@ -47,6 +47,8 @@ | |||
47 | */ | 47 | */ |
48 | #define VGA_DEFAULT_DEVICE (NULL) | 48 | #define VGA_DEFAULT_DEVICE (NULL) |
49 | 49 | ||
50 | struct pci_dev; | ||
51 | |||
50 | /* For use by clients */ | 52 | /* For use by clients */ |
51 | 53 | ||
52 | /** | 54 | /** |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 344b0f972828..d47e523c9d83 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -92,6 +92,7 @@ enum { | |||
92 | HCI_SERVICE_CACHE, | 92 | HCI_SERVICE_CACHE, |
93 | HCI_LINK_KEYS, | 93 | HCI_LINK_KEYS, |
94 | HCI_DEBUG_KEYS, | 94 | HCI_DEBUG_KEYS, |
95 | HCI_UNREGISTER, | ||
95 | 96 | ||
96 | HCI_LE_SCAN, | 97 | HCI_LE_SCAN, |
97 | HCI_SSP_ENABLED, | 98 | HCI_SSP_ENABLED, |
@@ -1327,8 +1328,8 @@ struct sockaddr_hci { | |||
1327 | #define HCI_DEV_NONE 0xffff | 1328 | #define HCI_DEV_NONE 0xffff |
1328 | 1329 | ||
1329 | #define HCI_CHANNEL_RAW 0 | 1330 | #define HCI_CHANNEL_RAW 0 |
1330 | #define HCI_CHANNEL_CONTROL 1 | ||
1331 | #define HCI_CHANNEL_MONITOR 2 | 1331 | #define HCI_CHANNEL_MONITOR 2 |
1332 | #define HCI_CHANNEL_CONTROL 3 | ||
1332 | 1333 | ||
1333 | struct hci_filter { | 1334 | struct hci_filter { |
1334 | unsigned long type_mask; | 1335 | unsigned long type_mask; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index daefaac51131..6822d2595aff 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -427,7 +427,7 @@ enum { | |||
427 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) | 427 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) |
428 | { | 428 | { |
429 | struct hci_dev *hdev = conn->hdev; | 429 | struct hci_dev *hdev = conn->hdev; |
430 | return (test_bit(HCI_SSP_ENABLED, &hdev->flags) && | 430 | return (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && |
431 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)); | 431 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)); |
432 | } | 432 | } |
433 | 433 | ||
@@ -907,11 +907,13 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, | |||
907 | 907 | ||
908 | static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) | 908 | static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) |
909 | { | 909 | { |
910 | u8 field_len; | 910 | size_t parsed = 0; |
911 | size_t parsed; | ||
912 | 911 | ||
913 | for (parsed = 0; parsed < data_len - 1; parsed += field_len) { | 912 | if (data_len < 2) |
914 | field_len = data[0]; | 913 | return false; |
914 | |||
915 | while (parsed < data_len - 1) { | ||
916 | u8 field_len = data[0]; | ||
915 | 917 | ||
916 | if (field_len == 0) | 918 | if (field_len == 0) |
917 | break; | 919 | break; |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index ffc1377e092e..ebfd91fc20f8 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -117,7 +117,7 @@ struct mgmt_mode { | |||
117 | #define MGMT_OP_SET_DISCOVERABLE 0x0006 | 117 | #define MGMT_OP_SET_DISCOVERABLE 0x0006 |
118 | struct mgmt_cp_set_discoverable { | 118 | struct mgmt_cp_set_discoverable { |
119 | __u8 val; | 119 | __u8 val; |
120 | __u16 timeout; | 120 | __le16 timeout; |
121 | } __packed; | 121 | } __packed; |
122 | #define MGMT_SET_DISCOVERABLE_SIZE 3 | 122 | #define MGMT_SET_DISCOVERABLE_SIZE 3 |
123 | 123 | ||
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 87d203ff7a8a..9210bdc7bd8d 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1327,7 +1327,7 @@ static inline struct ieee80211_rate * | |||
1327 | ieee80211_get_tx_rate(const struct ieee80211_hw *hw, | 1327 | ieee80211_get_tx_rate(const struct ieee80211_hw *hw, |
1328 | const struct ieee80211_tx_info *c) | 1328 | const struct ieee80211_tx_info *c) |
1329 | { | 1329 | { |
1330 | if (WARN_ON(c->control.rates[0].idx < 0)) | 1330 | if (WARN_ON_ONCE(c->control.rates[0].idx < 0)) |
1331 | return NULL; | 1331 | return NULL; |
1332 | return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx]; | 1332 | return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx]; |
1333 | } | 1333 | } |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 377df4a28512..1e1198546c72 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -134,6 +134,9 @@ struct scsi_cmnd { | |||
134 | 134 | ||
135 | static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) | 135 | static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) |
136 | { | 136 | { |
137 | if (!cmd->request->rq_disk) | ||
138 | return NULL; | ||
139 | |||
137 | return *(struct scsi_driver **)cmd->request->rq_disk->private_data; | 140 | return *(struct scsi_driver **)cmd->request->rq_disk->private_data; |
138 | } | 141 | } |
139 | 142 | ||
diff --git a/include/sound/core.h b/include/sound/core.h index b6e0f57d451d..bc056687f647 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -325,6 +325,13 @@ void release_and_free_resource(struct resource *res); | |||
325 | 325 | ||
326 | /* --- */ | 326 | /* --- */ |
327 | 327 | ||
328 | /* sound printk debug levels */ | ||
329 | enum { | ||
330 | SND_PR_ALWAYS, | ||
331 | SND_PR_DEBUG, | ||
332 | SND_PR_VERBOSE, | ||
333 | }; | ||
334 | |||
328 | #if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK) | 335 | #if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK) |
329 | __printf(4, 5) | 336 | __printf(4, 5) |
330 | void __snd_printk(unsigned int level, const char *file, int line, | 337 | void __snd_printk(unsigned int level, const char *file, int line, |
@@ -354,6 +361,8 @@ void __snd_printk(unsigned int level, const char *file, int line, | |||
354 | */ | 361 | */ |
355 | #define snd_printd(fmt, args...) \ | 362 | #define snd_printd(fmt, args...) \ |
356 | __snd_printk(1, __FILE__, __LINE__, fmt, ##args) | 363 | __snd_printk(1, __FILE__, __LINE__, fmt, ##args) |
364 | #define _snd_printd(level, fmt, args...) \ | ||
365 | __snd_printk(level, __FILE__, __LINE__, fmt, ##args) | ||
357 | 366 | ||
358 | /** | 367 | /** |
359 | * snd_BUG - give a BUG warning message and stack trace | 368 | * snd_BUG - give a BUG warning message and stack trace |
@@ -383,6 +392,7 @@ void __snd_printk(unsigned int level, const char *file, int line, | |||
383 | #else /* !CONFIG_SND_DEBUG */ | 392 | #else /* !CONFIG_SND_DEBUG */ |
384 | 393 | ||
385 | #define snd_printd(fmt, args...) do { } while (0) | 394 | #define snd_printd(fmt, args...) do { } while (0) |
395 | #define _snd_printd(level, fmt, args...) do { } while (0) | ||
386 | #define snd_BUG() do { } while (0) | 396 | #define snd_BUG() do { } while (0) |
387 | static inline int __snd_bug_on(int cond) | 397 | static inline int __snd_bug_on(int cond) |
388 | { | 398 | { |
diff --git a/include/video/omap-panel-nokia-dsi.h b/include/video/omap-panel-nokia-dsi.h index 7dc71f9c13e6..04219a295539 100644 --- a/include/video/omap-panel-nokia-dsi.h +++ b/include/video/omap-panel-nokia-dsi.h | |||
@@ -11,6 +11,7 @@ struct omap_dss_device; | |||
11 | * @esd_interval: interval of ESD checks, 0 = disabled (ms) | 11 | * @esd_interval: interval of ESD checks, 0 = disabled (ms) |
12 | * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms) | 12 | * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms) |
13 | * @use_dsi_backlight: true if panel uses DSI command to control backlight | 13 | * @use_dsi_backlight: true if panel uses DSI command to control backlight |
14 | * @pin_config: DSI pin configuration | ||
14 | */ | 15 | */ |
15 | struct nokia_dsi_panel_data { | 16 | struct nokia_dsi_panel_data { |
16 | const char *name; | 17 | const char *name; |
@@ -24,6 +25,8 @@ struct nokia_dsi_panel_data { | |||
24 | unsigned ulps_timeout; | 25 | unsigned ulps_timeout; |
25 | 26 | ||
26 | bool use_dsi_backlight; | 27 | bool use_dsi_backlight; |
28 | |||
29 | struct omap_dsi_pin_config pin_config; | ||
27 | }; | 30 | }; |
28 | 31 | ||
29 | #endif /* __OMAP_NOKIA_DSI_PANEL_H */ | 32 | #endif /* __OMAP_NOKIA_DSI_PANEL_H */ |
diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-tfp410.h index 87ad567b4229..68c31d79c571 100644 --- a/include/video/omap-panel-dvi.h +++ b/include/video/omap-panel-tfp410.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Header for DVI output driver | 2 | * Header for TFP410 chip driver |
3 | * | 3 | * |
4 | * Copyright (C) 2011 Texas Instruments Inc | 4 | * Copyright (C) 2011 Texas Instruments Inc |
5 | * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> | 5 | * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> |
@@ -17,21 +17,19 @@ | |||
17 | * this program. If not, see <http://www.gnu.org/licenses/>. | 17 | * this program. If not, see <http://www.gnu.org/licenses/>. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef __OMAP_PANEL_DVI_H | 20 | #ifndef __OMAP_PANEL_TFP410_H |
21 | #define __OMAP_PANEL_DVI_H | 21 | #define __OMAP_PANEL_TFP410_H |
22 | 22 | ||
23 | struct omap_dss_device; | 23 | struct omap_dss_device; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * struct panel_dvi_platform_data - panel driver configuration data | 26 | * struct tfp410_platform_data - panel driver configuration data |
27 | * @platform_enable: platform specific panel enable function | ||
28 | * @platform_disable: platform specific panel disable function | ||
29 | * @i2c_bus_num: i2c bus id for the panel | 27 | * @i2c_bus_num: i2c bus id for the panel |
28 | * @power_down_gpio: gpio number for PD pin (or -1 if not available) | ||
30 | */ | 29 | */ |
31 | struct panel_dvi_platform_data { | 30 | struct tfp410_platform_data { |
32 | int (*platform_enable)(struct omap_dss_device *dssdev); | ||
33 | void (*platform_disable)(struct omap_dss_device *dssdev); | ||
34 | u16 i2c_bus_num; | 31 | u16 i2c_bus_num; |
32 | int power_down_gpio; | ||
35 | }; | 33 | }; |
36 | 34 | ||
37 | #endif /* __OMAP_PANEL_DVI_H */ | 35 | #endif /* __OMAP_PANEL_TFP410_H */ |
diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 483f67caa7ad..c8e59b4a3364 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h | |||
@@ -51,6 +51,8 @@ | |||
51 | 51 | ||
52 | struct omap_dss_device; | 52 | struct omap_dss_device; |
53 | struct omap_overlay_manager; | 53 | struct omap_overlay_manager; |
54 | struct snd_aes_iec958; | ||
55 | struct snd_cea_861_aud_if; | ||
54 | 56 | ||
55 | enum omap_display_type { | 57 | enum omap_display_type { |
56 | OMAP_DISPLAY_TYPE_NONE = 0, | 58 | OMAP_DISPLAY_TYPE_NONE = 0, |
@@ -158,6 +160,13 @@ enum omap_dss_display_state { | |||
158 | OMAP_DSS_DISPLAY_SUSPENDED, | 160 | OMAP_DSS_DISPLAY_SUSPENDED, |
159 | }; | 161 | }; |
160 | 162 | ||
163 | enum omap_dss_audio_state { | ||
164 | OMAP_DSS_AUDIO_DISABLED = 0, | ||
165 | OMAP_DSS_AUDIO_ENABLED, | ||
166 | OMAP_DSS_AUDIO_CONFIGURED, | ||
167 | OMAP_DSS_AUDIO_PLAYING, | ||
168 | }; | ||
169 | |||
161 | /* XXX perhaps this should be removed */ | 170 | /* XXX perhaps this should be removed */ |
162 | enum omap_dss_overlay_managers { | 171 | enum omap_dss_overlay_managers { |
163 | OMAP_DSS_OVL_MGR_LCD, | 172 | OMAP_DSS_OVL_MGR_LCD, |
@@ -166,8 +175,9 @@ enum omap_dss_overlay_managers { | |||
166 | }; | 175 | }; |
167 | 176 | ||
168 | enum omap_dss_rotation_type { | 177 | enum omap_dss_rotation_type { |
169 | OMAP_DSS_ROT_DMA = 0, | 178 | OMAP_DSS_ROT_DMA = 1 << 0, |
170 | OMAP_DSS_ROT_VRFB = 1, | 179 | OMAP_DSS_ROT_VRFB = 1 << 1, |
180 | OMAP_DSS_ROT_TILER = 1 << 2, | ||
171 | }; | 181 | }; |
172 | 182 | ||
173 | /* clockwise rotation angle */ | 183 | /* clockwise rotation angle */ |
@@ -309,6 +319,7 @@ struct omap_dss_board_info { | |||
309 | struct omap_dss_device *default_device; | 319 | struct omap_dss_device *default_device; |
310 | int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); | 320 | int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); |
311 | void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); | 321 | void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); |
322 | int (*set_min_bus_tput)(struct device *dev, unsigned long r); | ||
312 | }; | 323 | }; |
313 | 324 | ||
314 | /* Init with the board info */ | 325 | /* Init with the board info */ |
@@ -316,11 +327,6 @@ extern int omap_display_init(struct omap_dss_board_info *board_data); | |||
316 | /* HDMI mux init*/ | 327 | /* HDMI mux init*/ |
317 | extern int omap_hdmi_init(enum omap_hdmi_flags flags); | 328 | extern int omap_hdmi_init(enum omap_hdmi_flags flags); |
318 | 329 | ||
319 | struct omap_display_platform_data { | ||
320 | struct omap_dss_board_info *board_data; | ||
321 | /* TODO: Additional members to be added when PM is considered */ | ||
322 | }; | ||
323 | |||
324 | struct omap_video_timings { | 330 | struct omap_video_timings { |
325 | /* Unit: pixels */ | 331 | /* Unit: pixels */ |
326 | u16 x_res; | 332 | u16 x_res; |
@@ -468,6 +474,21 @@ struct omap_overlay_manager { | |||
468 | int (*wait_for_vsync)(struct omap_overlay_manager *mgr); | 474 | int (*wait_for_vsync)(struct omap_overlay_manager *mgr); |
469 | }; | 475 | }; |
470 | 476 | ||
477 | /* 22 pins means 1 clk lane and 10 data lanes */ | ||
478 | #define OMAP_DSS_MAX_DSI_PINS 22 | ||
479 | |||
480 | struct omap_dsi_pin_config { | ||
481 | int num_pins; | ||
482 | /* | ||
483 | * pin numbers in the following order: | ||
484 | * clk+, clk- | ||
485 | * data1+, data1- | ||
486 | * data2+, data2- | ||
487 | * ... | ||
488 | */ | ||
489 | int pins[OMAP_DSS_MAX_DSI_PINS]; | ||
490 | }; | ||
491 | |||
471 | struct omap_dss_device { | 492 | struct omap_dss_device { |
472 | struct device dev; | 493 | struct device dev; |
473 | 494 | ||
@@ -490,17 +511,6 @@ struct omap_dss_device { | |||
490 | } sdi; | 511 | } sdi; |
491 | 512 | ||
492 | struct { | 513 | struct { |
493 | u8 clk_lane; | ||
494 | u8 clk_pol; | ||
495 | u8 data1_lane; | ||
496 | u8 data1_pol; | ||
497 | u8 data2_lane; | ||
498 | u8 data2_pol; | ||
499 | u8 data3_lane; | ||
500 | u8 data3_pol; | ||
501 | u8 data4_lane; | ||
502 | u8 data4_pol; | ||
503 | |||
504 | int module; | 514 | int module; |
505 | 515 | ||
506 | bool ext_te; | 516 | bool ext_te; |
@@ -583,6 +593,8 @@ struct omap_dss_device { | |||
583 | 593 | ||
584 | enum omap_dss_display_state state; | 594 | enum omap_dss_display_state state; |
585 | 595 | ||
596 | enum omap_dss_audio_state audio_state; | ||
597 | |||
586 | /* platform specific */ | 598 | /* platform specific */ |
587 | int (*platform_enable)(struct omap_dss_device *dssdev); | 599 | int (*platform_enable)(struct omap_dss_device *dssdev); |
588 | void (*platform_disable)(struct omap_dss_device *dssdev); | 600 | void (*platform_disable)(struct omap_dss_device *dssdev); |
@@ -595,6 +607,11 @@ struct omap_dss_hdmi_data | |||
595 | int hpd_gpio; | 607 | int hpd_gpio; |
596 | }; | 608 | }; |
597 | 609 | ||
610 | struct omap_dss_audio { | ||
611 | struct snd_aes_iec958 *iec; | ||
612 | struct snd_cea_861_aud_if *cea; | ||
613 | }; | ||
614 | |||
598 | struct omap_dss_driver { | 615 | struct omap_dss_driver { |
599 | struct device_driver driver; | 616 | struct device_driver driver; |
600 | 617 | ||
@@ -642,6 +659,24 @@ struct omap_dss_driver { | |||
642 | 659 | ||
643 | int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len); | 660 | int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len); |
644 | bool (*detect)(struct omap_dss_device *dssdev); | 661 | bool (*detect)(struct omap_dss_device *dssdev); |
662 | |||
663 | /* | ||
664 | * For display drivers that support audio. This encompasses | ||
665 | * HDMI and DisplayPort at the moment. | ||
666 | */ | ||
667 | /* | ||
668 | * Note: These functions might sleep. Do not call while | ||
669 | * holding a spinlock/readlock. | ||
670 | */ | ||
671 | int (*audio_enable)(struct omap_dss_device *dssdev); | ||
672 | void (*audio_disable)(struct omap_dss_device *dssdev); | ||
673 | bool (*audio_supported)(struct omap_dss_device *dssdev); | ||
674 | int (*audio_config)(struct omap_dss_device *dssdev, | ||
675 | struct omap_dss_audio *audio); | ||
676 | /* Note: These functions may not sleep */ | ||
677 | int (*audio_start)(struct omap_dss_device *dssdev); | ||
678 | void (*audio_stop)(struct omap_dss_device *dssdev); | ||
679 | |||
645 | }; | 680 | }; |
646 | 681 | ||
647 | int omap_dss_register_driver(struct omap_dss_driver *); | 682 | int omap_dss_register_driver(struct omap_dss_driver *); |
@@ -666,6 +701,8 @@ struct omap_overlay *omap_dss_get_overlay(int num); | |||
666 | void omapdss_default_get_resolution(struct omap_dss_device *dssdev, | 701 | void omapdss_default_get_resolution(struct omap_dss_device *dssdev, |
667 | u16 *xres, u16 *yres); | 702 | u16 *xres, u16 *yres); |
668 | int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev); | 703 | int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev); |
704 | void omapdss_default_get_timings(struct omap_dss_device *dssdev, | ||
705 | struct omap_video_timings *timings); | ||
669 | 706 | ||
670 | typedef void (*omap_dispc_isr_t) (void *arg, u32 mask); | 707 | typedef void (*omap_dispc_isr_t) (void *arg, u32 mask); |
671 | int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask); | 708 | int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask); |
@@ -687,6 +724,8 @@ int omap_dsi_update(struct omap_dss_device *dssdev, int channel, | |||
687 | int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel); | 724 | int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel); |
688 | int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id); | 725 | int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id); |
689 | void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); | 726 | void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); |
727 | int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev, | ||
728 | const struct omap_dsi_pin_config *pin_cfg); | ||
690 | 729 | ||
691 | int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); | 730 | int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); |
692 | void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, | 731 | void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, |
diff --git a/kernel/cred.c b/kernel/cred.c index 97b36eeca4c9..e70683d9ec32 100644 --- a/kernel/cred.c +++ b/kernel/cred.c | |||
@@ -386,6 +386,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags) | |||
386 | struct cred *new; | 386 | struct cred *new; |
387 | int ret; | 387 | int ret; |
388 | 388 | ||
389 | p->replacement_session_keyring = NULL; | ||
390 | |||
389 | if ( | 391 | if ( |
390 | #ifdef CONFIG_KEYS | 392 | #ifdef CONFIG_KEYS |
391 | !p->cred->thread_keyring && | 393 | !p->cred->thread_keyring && |
diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig index cf1a4a68ce44..d1a758bc972a 100644 --- a/kernel/irq/Kconfig +++ b/kernel/irq/Kconfig | |||
@@ -62,7 +62,7 @@ config IRQ_DOMAIN_DEBUG | |||
62 | help | 62 | help |
63 | This option will show the mapping relationship between hardware irq | 63 | This option will show the mapping relationship between hardware irq |
64 | numbers and Linux irq numbers. The mapping is exposed via debugfs | 64 | numbers and Linux irq numbers. The mapping is exposed via debugfs |
65 | in the file "virq_mapping". | 65 | in the file "irq_domain_mapping". |
66 | 66 | ||
67 | If you don't know what this means you don't need it. | 67 | If you don't know what this means you don't need it. |
68 | 68 | ||
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 3601f3fbf67c..0e0ba5f840b2 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
@@ -23,7 +23,6 @@ static LIST_HEAD(irq_domain_list); | |||
23 | static DEFINE_MUTEX(irq_domain_mutex); | 23 | static DEFINE_MUTEX(irq_domain_mutex); |
24 | 24 | ||
25 | static DEFINE_MUTEX(revmap_trees_mutex); | 25 | static DEFINE_MUTEX(revmap_trees_mutex); |
26 | static unsigned int irq_virq_count = NR_IRQS; | ||
27 | static struct irq_domain *irq_default_domain; | 26 | static struct irq_domain *irq_default_domain; |
28 | 27 | ||
29 | /** | 28 | /** |
@@ -184,13 +183,16 @@ struct irq_domain *irq_domain_add_linear(struct device_node *of_node, | |||
184 | } | 183 | } |
185 | 184 | ||
186 | struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, | 185 | struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, |
186 | unsigned int max_irq, | ||
187 | const struct irq_domain_ops *ops, | 187 | const struct irq_domain_ops *ops, |
188 | void *host_data) | 188 | void *host_data) |
189 | { | 189 | { |
190 | struct irq_domain *domain = irq_domain_alloc(of_node, | 190 | struct irq_domain *domain = irq_domain_alloc(of_node, |
191 | IRQ_DOMAIN_MAP_NOMAP, ops, host_data); | 191 | IRQ_DOMAIN_MAP_NOMAP, ops, host_data); |
192 | if (domain) | 192 | if (domain) { |
193 | domain->revmap_data.nomap.max_irq = max_irq ? max_irq : ~0; | ||
193 | irq_domain_add(domain); | 194 | irq_domain_add(domain); |
195 | } | ||
194 | return domain; | 196 | return domain; |
195 | } | 197 | } |
196 | 198 | ||
@@ -262,22 +264,6 @@ void irq_set_default_host(struct irq_domain *domain) | |||
262 | irq_default_domain = domain; | 264 | irq_default_domain = domain; |
263 | } | 265 | } |
264 | 266 | ||
265 | /** | ||
266 | * irq_set_virq_count() - Set the maximum number of linux irqs | ||
267 | * @count: number of linux irqs, capped with NR_IRQS | ||
268 | * | ||
269 | * This is mainly for use by platforms like iSeries who want to program | ||
270 | * the virtual irq number in the controller to avoid the reverse mapping | ||
271 | */ | ||
272 | void irq_set_virq_count(unsigned int count) | ||
273 | { | ||
274 | pr_debug("irq: Trying to set virq count to %d\n", count); | ||
275 | |||
276 | BUG_ON(count < NUM_ISA_INTERRUPTS); | ||
277 | if (count < NR_IRQS) | ||
278 | irq_virq_count = count; | ||
279 | } | ||
280 | |||
281 | static int irq_setup_virq(struct irq_domain *domain, unsigned int virq, | 267 | static int irq_setup_virq(struct irq_domain *domain, unsigned int virq, |
282 | irq_hw_number_t hwirq) | 268 | irq_hw_number_t hwirq) |
283 | { | 269 | { |
@@ -320,13 +306,12 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) | |||
320 | pr_debug("irq: create_direct virq allocation failed\n"); | 306 | pr_debug("irq: create_direct virq allocation failed\n"); |
321 | return 0; | 307 | return 0; |
322 | } | 308 | } |
323 | if (virq >= irq_virq_count) { | 309 | if (virq >= domain->revmap_data.nomap.max_irq) { |
324 | pr_err("ERROR: no free irqs available below %i maximum\n", | 310 | pr_err("ERROR: no free irqs available below %i maximum\n", |
325 | irq_virq_count); | 311 | domain->revmap_data.nomap.max_irq); |
326 | irq_free_desc(virq); | 312 | irq_free_desc(virq); |
327 | return 0; | 313 | return 0; |
328 | } | 314 | } |
329 | |||
330 | pr_debug("irq: create_direct obtained virq %d\n", virq); | 315 | pr_debug("irq: create_direct obtained virq %d\n", virq); |
331 | 316 | ||
332 | if (irq_setup_virq(domain, virq, virq)) { | 317 | if (irq_setup_virq(domain, virq, virq)) { |
@@ -350,7 +335,8 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) | |||
350 | unsigned int irq_create_mapping(struct irq_domain *domain, | 335 | unsigned int irq_create_mapping(struct irq_domain *domain, |
351 | irq_hw_number_t hwirq) | 336 | irq_hw_number_t hwirq) |
352 | { | 337 | { |
353 | unsigned int virq, hint; | 338 | unsigned int hint; |
339 | int virq; | ||
354 | 340 | ||
355 | pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq); | 341 | pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq); |
356 | 342 | ||
@@ -377,13 +363,13 @@ unsigned int irq_create_mapping(struct irq_domain *domain, | |||
377 | return irq_domain_legacy_revmap(domain, hwirq); | 363 | return irq_domain_legacy_revmap(domain, hwirq); |
378 | 364 | ||
379 | /* Allocate a virtual interrupt number */ | 365 | /* Allocate a virtual interrupt number */ |
380 | hint = hwirq % irq_virq_count; | 366 | hint = hwirq % nr_irqs; |
381 | if (hint == 0) | 367 | if (hint == 0) |
382 | hint++; | 368 | hint++; |
383 | virq = irq_alloc_desc_from(hint, 0); | 369 | virq = irq_alloc_desc_from(hint, 0); |
384 | if (!virq) | 370 | if (virq <= 0) |
385 | virq = irq_alloc_desc_from(1, 0); | 371 | virq = irq_alloc_desc_from(1, 0); |
386 | if (!virq) { | 372 | if (virq <= 0) { |
387 | pr_debug("irq: -> virq allocation failed\n"); | 373 | pr_debug("irq: -> virq allocation failed\n"); |
388 | return 0; | 374 | return 0; |
389 | } | 375 | } |
@@ -515,7 +501,7 @@ unsigned int irq_find_mapping(struct irq_domain *domain, | |||
515 | irq_hw_number_t hwirq) | 501 | irq_hw_number_t hwirq) |
516 | { | 502 | { |
517 | unsigned int i; | 503 | unsigned int i; |
518 | unsigned int hint = hwirq % irq_virq_count; | 504 | unsigned int hint = hwirq % nr_irqs; |
519 | 505 | ||
520 | /* Look for default domain if nececssary */ | 506 | /* Look for default domain if nececssary */ |
521 | if (domain == NULL) | 507 | if (domain == NULL) |
@@ -536,7 +522,7 @@ unsigned int irq_find_mapping(struct irq_domain *domain, | |||
536 | if (data && (data->domain == domain) && (data->hwirq == hwirq)) | 522 | if (data && (data->domain == domain) && (data->hwirq == hwirq)) |
537 | return i; | 523 | return i; |
538 | i++; | 524 | i++; |
539 | if (i >= irq_virq_count) | 525 | if (i >= nr_irqs) |
540 | i = 1; | 526 | i = 1; |
541 | } while(i != hint); | 527 | } while(i != hint); |
542 | return 0; | 528 | return 0; |
@@ -642,8 +628,9 @@ static int virq_debug_show(struct seq_file *m, void *private) | |||
642 | void *data; | 628 | void *data; |
643 | int i; | 629 | int i; |
644 | 630 | ||
645 | seq_printf(m, "%-5s %-7s %-15s %-18s %s\n", "virq", "hwirq", | 631 | seq_printf(m, "%-5s %-7s %-15s %-*s %s\n", "irq", "hwirq", |
646 | "chip name", "chip data", "domain name"); | 632 | "chip name", (int)(2 * sizeof(void *) + 2), "chip data", |
633 | "domain name"); | ||
647 | 634 | ||
648 | for (i = 1; i < nr_irqs; i++) { | 635 | for (i = 1; i < nr_irqs; i++) { |
649 | desc = irq_to_desc(i); | 636 | desc = irq_to_desc(i); |
@@ -666,7 +653,7 @@ static int virq_debug_show(struct seq_file *m, void *private) | |||
666 | seq_printf(m, "%-15s ", p); | 653 | seq_printf(m, "%-15s ", p); |
667 | 654 | ||
668 | data = irq_desc_get_chip_data(desc); | 655 | data = irq_desc_get_chip_data(desc); |
669 | seq_printf(m, "0x%16p ", data); | 656 | seq_printf(m, data ? "0x%p " : " %p ", data); |
670 | 657 | ||
671 | if (desc->irq_data.domain && desc->irq_data.domain->of_node) | 658 | if (desc->irq_data.domain && desc->irq_data.domain->of_node) |
672 | p = desc->irq_data.domain->of_node->full_name; | 659 | p = desc->irq_data.domain->of_node->full_name; |
diff --git a/kernel/irq_work.c b/kernel/irq_work.c index 0c56d44b9fd5..1588e3b2871b 100644 --- a/kernel/irq_work.c +++ b/kernel/irq_work.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/irq_work.h> | 11 | #include <linux/irq_work.h> |
12 | #include <linux/percpu.h> | 12 | #include <linux/percpu.h> |
13 | #include <linux/hardirq.h> | 13 | #include <linux/hardirq.h> |
14 | #include <linux/irqflags.h> | ||
14 | #include <asm/processor.h> | 15 | #include <asm/processor.h> |
15 | 16 | ||
16 | /* | 17 | /* |
diff --git a/kernel/itimer.c b/kernel/itimer.c index 22000c3db0dd..8d262b467573 100644 --- a/kernel/itimer.c +++ b/kernel/itimer.c | |||
@@ -284,8 +284,12 @@ SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value, | |||
284 | if (value) { | 284 | if (value) { |
285 | if(copy_from_user(&set_buffer, value, sizeof(set_buffer))) | 285 | if(copy_from_user(&set_buffer, value, sizeof(set_buffer))) |
286 | return -EFAULT; | 286 | return -EFAULT; |
287 | } else | 287 | } else { |
288 | memset((char *) &set_buffer, 0, sizeof(set_buffer)); | 288 | memset(&set_buffer, 0, sizeof(set_buffer)); |
289 | printk_once(KERN_WARNING "%s calls setitimer() with new_value NULL pointer." | ||
290 | " Misfeature support will be removed\n", | ||
291 | current->comm); | ||
292 | } | ||
289 | 293 | ||
290 | error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL); | 294 | error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL); |
291 | if (error || !ovalue) | 295 | if (error || !ovalue) |
diff --git a/kernel/panic.c b/kernel/panic.c index 80aed44e345a..8ed89a175d79 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -97,7 +97,7 @@ void panic(const char *fmt, ...) | |||
97 | /* | 97 | /* |
98 | * Avoid nested stack-dumping if a panic occurs during oops processing | 98 | * Avoid nested stack-dumping if a panic occurs during oops processing |
99 | */ | 99 | */ |
100 | if (!oops_in_progress) | 100 | if (!test_taint(TAINT_DIE) && oops_in_progress <= 1) |
101 | dump_stack(); | 101 | dump_stack(); |
102 | #endif | 102 | #endif |
103 | 103 | ||
diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig index 2cf9cc7aa103..a20dc8a3c949 100644 --- a/kernel/time/Kconfig +++ b/kernel/time/Kconfig | |||
@@ -1,6 +1,10 @@ | |||
1 | # | 1 | # |
2 | # Timer subsystem related configuration options | 2 | # Timer subsystem related configuration options |
3 | # | 3 | # |
4 | |||
5 | # Core internal switch. Selected by NO_HZ / HIGH_RES_TIMERS. This is | ||
6 | # only related to the tick functionality. Oneshot clockevent devices | ||
7 | # are supported independ of this. | ||
4 | config TICK_ONESHOT | 8 | config TICK_ONESHOT |
5 | bool | 9 | bool |
6 | 10 | ||
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index e883f57a3cd3..bf57abdc7bd0 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -575,10 +575,12 @@ void tick_broadcast_switch_to_oneshot(void) | |||
575 | unsigned long flags; | 575 | unsigned long flags; |
576 | 576 | ||
577 | raw_spin_lock_irqsave(&tick_broadcast_lock, flags); | 577 | raw_spin_lock_irqsave(&tick_broadcast_lock, flags); |
578 | |||
579 | tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT; | ||
580 | |||
578 | if (cpumask_empty(tick_get_broadcast_mask())) | 581 | if (cpumask_empty(tick_get_broadcast_mask())) |
579 | goto end; | 582 | goto end; |
580 | 583 | ||
581 | tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT; | ||
582 | bc = tick_broadcast_device.evtdev; | 584 | bc = tick_broadcast_device.evtdev; |
583 | if (bc) | 585 | if (bc) |
584 | tick_broadcast_setup_oneshot(bc); | 586 | tick_broadcast_setup_oneshot(bc); |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 3526038f2836..6a3a5b9ff561 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -534,9 +534,9 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now) | |||
534 | hrtimer_get_expires(&ts->sched_timer), 0)) | 534 | hrtimer_get_expires(&ts->sched_timer), 0)) |
535 | break; | 535 | break; |
536 | } | 536 | } |
537 | /* Update jiffies and reread time */ | 537 | /* Reread time and update jiffies */ |
538 | tick_do_update_jiffies64(now); | ||
539 | now = ktime_get(); | 538 | now = ktime_get(); |
539 | tick_do_update_jiffies64(now); | ||
540 | } | 540 | } |
541 | } | 541 | } |
542 | 542 | ||
diff --git a/lib/kobject.c b/lib/kobject.c index 21dee7c19afd..aeefa8bc8b1c 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -192,14 +192,14 @@ static int kobject_add_internal(struct kobject *kobj) | |||
192 | 192 | ||
193 | /* be noisy on error issues */ | 193 | /* be noisy on error issues */ |
194 | if (error == -EEXIST) | 194 | if (error == -EEXIST) |
195 | printk(KERN_ERR "%s failed for %s with " | 195 | WARN(1, "%s failed for %s with " |
196 | "-EEXIST, don't try to register things with " | 196 | "-EEXIST, don't try to register things with " |
197 | "the same name in the same directory.\n", | 197 | "the same name in the same directory.\n", |
198 | __func__, kobject_name(kobj)); | 198 | __func__, kobject_name(kobj)); |
199 | else | 199 | else |
200 | printk(KERN_ERR "%s failed for %s (%d)\n", | 200 | WARN(1, "%s failed for %s (error: %d parent: %s)\n", |
201 | __func__, kobject_name(kobj), error); | 201 | __func__, kobject_name(kobj), error, |
202 | dump_stack(); | 202 | parent ? kobject_name(parent) : "'none'"); |
203 | } else | 203 | } else |
204 | kobj->state_in_sysfs = 1; | 204 | kobj->state_in_sysfs = 1; |
205 | 205 | ||
diff --git a/lib/mpi/mpi-bit.c b/lib/mpi/mpi-bit.c index 2f526627e4f5..0c505361da19 100644 --- a/lib/mpi/mpi-bit.c +++ b/lib/mpi/mpi-bit.c | |||
@@ -177,8 +177,8 @@ int mpi_rshift(MPI x, MPI a, unsigned n) | |||
177 | */ | 177 | */ |
178 | int mpi_lshift_limbs(MPI a, unsigned int count) | 178 | int mpi_lshift_limbs(MPI a, unsigned int count) |
179 | { | 179 | { |
180 | mpi_ptr_t ap = a->d; | 180 | const int n = a->nlimbs; |
181 | int n = a->nlimbs; | 181 | mpi_ptr_t ap; |
182 | int i; | 182 | int i; |
183 | 183 | ||
184 | if (!count || !n) | 184 | if (!count || !n) |
@@ -187,6 +187,7 @@ int mpi_lshift_limbs(MPI a, unsigned int count) | |||
187 | if (RESIZE_IF_NEEDED(a, n + count) < 0) | 187 | if (RESIZE_IF_NEEDED(a, n + count) < 0) |
188 | return -ENOMEM; | 188 | return -ENOMEM; |
189 | 189 | ||
190 | ap = a->d; | ||
190 | for (i = n - 1; i >= 0; i--) | 191 | for (i = n - 1; i >= 0; i--) |
191 | ap[i + count] = ap[i]; | 192 | ap[i + count] = ap[i]; |
192 | for (i = 0; i < count; i++) | 193 | for (i = 0; i < count; i++) |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index b8ce6f450956..cd65cb19c941 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2791,6 +2791,7 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2791 | * so no worry about deadlock. | 2791 | * so no worry about deadlock. |
2792 | */ | 2792 | */ |
2793 | page = pte_page(entry); | 2793 | page = pte_page(entry); |
2794 | get_page(page); | ||
2794 | if (page != pagecache_page) | 2795 | if (page != pagecache_page) |
2795 | lock_page(page); | 2796 | lock_page(page); |
2796 | 2797 | ||
@@ -2822,6 +2823,7 @@ out_page_table_lock: | |||
2822 | } | 2823 | } |
2823 | if (page != pagecache_page) | 2824 | if (page != pagecache_page) |
2824 | unlock_page(page); | 2825 | unlock_page(page); |
2826 | put_page(page); | ||
2825 | 2827 | ||
2826 | out_mutex: | 2828 | out_mutex: |
2827 | mutex_unlock(&hugetlb_instantiation_mutex); | 2829 | mutex_unlock(&hugetlb_instantiation_mutex); |
diff --git a/mm/memblock.c b/mm/memblock.c index 99f285599501..a44eab3157f8 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -330,6 +330,9 @@ static int __init_memblock memblock_add_region(struct memblock_type *type, | |||
330 | phys_addr_t end = base + memblock_cap_size(base, &size); | 330 | phys_addr_t end = base + memblock_cap_size(base, &size); |
331 | int i, nr_new; | 331 | int i, nr_new; |
332 | 332 | ||
333 | if (!size) | ||
334 | return 0; | ||
335 | |||
333 | /* special case for empty array */ | 336 | /* special case for empty array */ |
334 | if (type->regions[0].size == 0) { | 337 | if (type->regions[0].size == 0) { |
335 | WARN_ON(type->cnt != 1 || type->total_size); | 338 | WARN_ON(type->cnt != 1 || type->total_size); |
@@ -430,6 +433,9 @@ static int __init_memblock memblock_isolate_range(struct memblock_type *type, | |||
430 | 433 | ||
431 | *start_rgn = *end_rgn = 0; | 434 | *start_rgn = *end_rgn = 0; |
432 | 435 | ||
436 | if (!size) | ||
437 | return 0; | ||
438 | |||
433 | /* we'll create at most two more regions */ | 439 | /* we'll create at most two more regions */ |
434 | while (type->cnt + 2 > type->max) | 440 | while (type->cnt + 2 > type->max) |
435 | if (memblock_double_array(type) < 0) | 441 | if (memblock_double_array(type) < 0) |
@@ -514,7 +520,6 @@ int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size) | |||
514 | (unsigned long long)base, | 520 | (unsigned long long)base, |
515 | (unsigned long long)base + size, | 521 | (unsigned long long)base + size, |
516 | (void *)_RET_IP_); | 522 | (void *)_RET_IP_); |
517 | BUG_ON(0 == size); | ||
518 | 523 | ||
519 | return memblock_add_region(_rgn, base, size, MAX_NUMNODES); | 524 | return memblock_add_region(_rgn, base, size, MAX_NUMNODES); |
520 | } | 525 | } |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 7d698df4a067..b868def9bcc1 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2165,7 +2165,7 @@ static int __cpuinit memcg_cpu_hotplug_callback(struct notifier_block *nb, | |||
2165 | if (action == CPU_ONLINE) | 2165 | if (action == CPU_ONLINE) |
2166 | return NOTIFY_OK; | 2166 | return NOTIFY_OK; |
2167 | 2167 | ||
2168 | if ((action != CPU_DEAD) || action != CPU_DEAD_FROZEN) | 2168 | if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) |
2169 | return NOTIFY_OK; | 2169 | return NOTIFY_OK; |
2170 | 2170 | ||
2171 | for_each_mem_cgroup(iter) | 2171 | for_each_mem_cgroup(iter) |
@@ -3392,6 +3392,7 @@ void mem_cgroup_replace_page_cache(struct page *oldpage, | |||
3392 | * the newpage may be on LRU(or pagevec for LRU) already. We lock | 3392 | * the newpage may be on LRU(or pagevec for LRU) already. We lock |
3393 | * LRU while we overwrite pc->mem_cgroup. | 3393 | * LRU while we overwrite pc->mem_cgroup. |
3394 | */ | 3394 | */ |
3395 | pc = lookup_page_cgroup(newpage); | ||
3395 | __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true); | 3396 | __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true); |
3396 | } | 3397 | } |
3397 | 3398 | ||
@@ -3763,7 +3764,7 @@ move_account: | |||
3763 | goto try_to_free; | 3764 | goto try_to_free; |
3764 | cond_resched(); | 3765 | cond_resched(); |
3765 | /* "ret" should also be checked to ensure all lists are empty. */ | 3766 | /* "ret" should also be checked to ensure all lists are empty. */ |
3766 | } while (memcg->res.usage > 0 || ret); | 3767 | } while (res_counter_read_u64(&memcg->res, RES_USAGE) > 0 || ret); |
3767 | out: | 3768 | out: |
3768 | css_put(&memcg->css); | 3769 | css_put(&memcg->css); |
3769 | return ret; | 3770 | return ret; |
@@ -3778,7 +3779,7 @@ try_to_free: | |||
3778 | lru_add_drain_all(); | 3779 | lru_add_drain_all(); |
3779 | /* try to free all pages in this cgroup */ | 3780 | /* try to free all pages in this cgroup */ |
3780 | shrink = 1; | 3781 | shrink = 1; |
3781 | while (nr_retries && memcg->res.usage > 0) { | 3782 | while (nr_retries && res_counter_read_u64(&memcg->res, RES_USAGE) > 0) { |
3782 | int progress; | 3783 | int progress; |
3783 | 3784 | ||
3784 | if (signal_pending(current)) { | 3785 | if (signal_pending(current)) { |
@@ -240,6 +240,8 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) | |||
240 | return next; | 240 | return next; |
241 | } | 241 | } |
242 | 242 | ||
243 | static unsigned long do_brk(unsigned long addr, unsigned long len); | ||
244 | |||
243 | SYSCALL_DEFINE1(brk, unsigned long, brk) | 245 | SYSCALL_DEFINE1(brk, unsigned long, brk) |
244 | { | 246 | { |
245 | unsigned long rlim, retval; | 247 | unsigned long rlim, retval; |
@@ -951,7 +953,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint) | |||
951 | * The caller must hold down_write(¤t->mm->mmap_sem). | 953 | * The caller must hold down_write(¤t->mm->mmap_sem). |
952 | */ | 954 | */ |
953 | 955 | ||
954 | unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | 956 | static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, |
955 | unsigned long len, unsigned long prot, | 957 | unsigned long len, unsigned long prot, |
956 | unsigned long flags, unsigned long pgoff) | 958 | unsigned long flags, unsigned long pgoff) |
957 | { | 959 | { |
@@ -1087,7 +1089,32 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
1087 | 1089 | ||
1088 | return mmap_region(file, addr, len, flags, vm_flags, pgoff); | 1090 | return mmap_region(file, addr, len, flags, vm_flags, pgoff); |
1089 | } | 1091 | } |
1090 | EXPORT_SYMBOL(do_mmap_pgoff); | 1092 | |
1093 | unsigned long do_mmap(struct file *file, unsigned long addr, | ||
1094 | unsigned long len, unsigned long prot, | ||
1095 | unsigned long flag, unsigned long offset) | ||
1096 | { | ||
1097 | if (unlikely(offset + PAGE_ALIGN(len) < offset)) | ||
1098 | return -EINVAL; | ||
1099 | if (unlikely(offset & ~PAGE_MASK)) | ||
1100 | return -EINVAL; | ||
1101 | return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); | ||
1102 | } | ||
1103 | EXPORT_SYMBOL(do_mmap); | ||
1104 | |||
1105 | unsigned long vm_mmap(struct file *file, unsigned long addr, | ||
1106 | unsigned long len, unsigned long prot, | ||
1107 | unsigned long flag, unsigned long offset) | ||
1108 | { | ||
1109 | unsigned long ret; | ||
1110 | struct mm_struct *mm = current->mm; | ||
1111 | |||
1112 | down_write(&mm->mmap_sem); | ||
1113 | ret = do_mmap(file, addr, len, prot, flag, offset); | ||
1114 | up_write(&mm->mmap_sem); | ||
1115 | return ret; | ||
1116 | } | ||
1117 | EXPORT_SYMBOL(vm_mmap); | ||
1091 | 1118 | ||
1092 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, | 1119 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, |
1093 | unsigned long, prot, unsigned long, flags, | 1120 | unsigned long, prot, unsigned long, flags, |
@@ -2105,21 +2132,25 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len) | |||
2105 | 2132 | ||
2106 | return 0; | 2133 | return 0; |
2107 | } | 2134 | } |
2108 | |||
2109 | EXPORT_SYMBOL(do_munmap); | 2135 | EXPORT_SYMBOL(do_munmap); |
2110 | 2136 | ||
2111 | SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) | 2137 | int vm_munmap(unsigned long start, size_t len) |
2112 | { | 2138 | { |
2113 | int ret; | 2139 | int ret; |
2114 | struct mm_struct *mm = current->mm; | 2140 | struct mm_struct *mm = current->mm; |
2115 | 2141 | ||
2116 | profile_munmap(addr); | ||
2117 | |||
2118 | down_write(&mm->mmap_sem); | 2142 | down_write(&mm->mmap_sem); |
2119 | ret = do_munmap(mm, addr, len); | 2143 | ret = do_munmap(mm, start, len); |
2120 | up_write(&mm->mmap_sem); | 2144 | up_write(&mm->mmap_sem); |
2121 | return ret; | 2145 | return ret; |
2122 | } | 2146 | } |
2147 | EXPORT_SYMBOL(vm_munmap); | ||
2148 | |||
2149 | SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) | ||
2150 | { | ||
2151 | profile_munmap(addr); | ||
2152 | return vm_munmap(addr, len); | ||
2153 | } | ||
2123 | 2154 | ||
2124 | static inline void verify_mm_writelocked(struct mm_struct *mm) | 2155 | static inline void verify_mm_writelocked(struct mm_struct *mm) |
2125 | { | 2156 | { |
@@ -2136,7 +2167,7 @@ static inline void verify_mm_writelocked(struct mm_struct *mm) | |||
2136 | * anonymous maps. eventually we may be able to do some | 2167 | * anonymous maps. eventually we may be able to do some |
2137 | * brk-specific accounting here. | 2168 | * brk-specific accounting here. |
2138 | */ | 2169 | */ |
2139 | unsigned long do_brk(unsigned long addr, unsigned long len) | 2170 | static unsigned long do_brk(unsigned long addr, unsigned long len) |
2140 | { | 2171 | { |
2141 | struct mm_struct * mm = current->mm; | 2172 | struct mm_struct * mm = current->mm; |
2142 | struct vm_area_struct * vma, * prev; | 2173 | struct vm_area_struct * vma, * prev; |
@@ -2232,7 +2263,17 @@ out: | |||
2232 | return addr; | 2263 | return addr; |
2233 | } | 2264 | } |
2234 | 2265 | ||
2235 | EXPORT_SYMBOL(do_brk); | 2266 | unsigned long vm_brk(unsigned long addr, unsigned long len) |
2267 | { | ||
2268 | struct mm_struct *mm = current->mm; | ||
2269 | unsigned long ret; | ||
2270 | |||
2271 | down_write(&mm->mmap_sem); | ||
2272 | ret = do_brk(addr, len); | ||
2273 | up_write(&mm->mmap_sem); | ||
2274 | return ret; | ||
2275 | } | ||
2276 | EXPORT_SYMBOL(vm_brk); | ||
2236 | 2277 | ||
2237 | /* Release all mmaps. */ | 2278 | /* Release all mmaps. */ |
2238 | void exit_mmap(struct mm_struct *mm) | 2279 | void exit_mmap(struct mm_struct *mm) |
diff --git a/mm/nommu.c b/mm/nommu.c index f59e170fceb4..bb8f4f004a82 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -1233,7 +1233,7 @@ enomem: | |||
1233 | /* | 1233 | /* |
1234 | * handle mapping creation for uClinux | 1234 | * handle mapping creation for uClinux |
1235 | */ | 1235 | */ |
1236 | unsigned long do_mmap_pgoff(struct file *file, | 1236 | static unsigned long do_mmap_pgoff(struct file *file, |
1237 | unsigned long addr, | 1237 | unsigned long addr, |
1238 | unsigned long len, | 1238 | unsigned long len, |
1239 | unsigned long prot, | 1239 | unsigned long prot, |
@@ -1470,7 +1470,32 @@ error_getting_region: | |||
1470 | show_free_areas(0); | 1470 | show_free_areas(0); |
1471 | return -ENOMEM; | 1471 | return -ENOMEM; |
1472 | } | 1472 | } |
1473 | EXPORT_SYMBOL(do_mmap_pgoff); | 1473 | |
1474 | unsigned long do_mmap(struct file *file, unsigned long addr, | ||
1475 | unsigned long len, unsigned long prot, | ||
1476 | unsigned long flag, unsigned long offset) | ||
1477 | { | ||
1478 | if (unlikely(offset + PAGE_ALIGN(len) < offset)) | ||
1479 | return -EINVAL; | ||
1480 | if (unlikely(offset & ~PAGE_MASK)) | ||
1481 | return -EINVAL; | ||
1482 | return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); | ||
1483 | } | ||
1484 | EXPORT_SYMBOL(do_mmap); | ||
1485 | |||
1486 | unsigned long vm_mmap(struct file *file, unsigned long addr, | ||
1487 | unsigned long len, unsigned long prot, | ||
1488 | unsigned long flag, unsigned long offset) | ||
1489 | { | ||
1490 | unsigned long ret; | ||
1491 | struct mm_struct *mm = current->mm; | ||
1492 | |||
1493 | down_write(&mm->mmap_sem); | ||
1494 | ret = do_mmap(file, addr, len, prot, flag, offset); | ||
1495 | up_write(&mm->mmap_sem); | ||
1496 | return ret; | ||
1497 | } | ||
1498 | EXPORT_SYMBOL(vm_mmap); | ||
1474 | 1499 | ||
1475 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, | 1500 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, |
1476 | unsigned long, prot, unsigned long, flags, | 1501 | unsigned long, prot, unsigned long, flags, |
@@ -1709,16 +1734,22 @@ erase_whole_vma: | |||
1709 | } | 1734 | } |
1710 | EXPORT_SYMBOL(do_munmap); | 1735 | EXPORT_SYMBOL(do_munmap); |
1711 | 1736 | ||
1712 | SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) | 1737 | int vm_munmap(unsigned long addr, size_t len) |
1713 | { | 1738 | { |
1714 | int ret; | ||
1715 | struct mm_struct *mm = current->mm; | 1739 | struct mm_struct *mm = current->mm; |
1740 | int ret; | ||
1716 | 1741 | ||
1717 | down_write(&mm->mmap_sem); | 1742 | down_write(&mm->mmap_sem); |
1718 | ret = do_munmap(mm, addr, len); | 1743 | ret = do_munmap(mm, addr, len); |
1719 | up_write(&mm->mmap_sem); | 1744 | up_write(&mm->mmap_sem); |
1720 | return ret; | 1745 | return ret; |
1721 | } | 1746 | } |
1747 | EXPORT_SYMBOL(vm_munmap); | ||
1748 | |||
1749 | SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) | ||
1750 | { | ||
1751 | return vm_munmap(addr, len); | ||
1752 | } | ||
1722 | 1753 | ||
1723 | /* | 1754 | /* |
1724 | * release all the mappings made in a process's VM space | 1755 | * release all the mappings made in a process's VM space |
@@ -1744,7 +1775,7 @@ void exit_mmap(struct mm_struct *mm) | |||
1744 | kleave(""); | 1775 | kleave(""); |
1745 | } | 1776 | } |
1746 | 1777 | ||
1747 | unsigned long do_brk(unsigned long addr, unsigned long len) | 1778 | unsigned long vm_brk(unsigned long addr, unsigned long len) |
1748 | { | 1779 | { |
1749 | return -ENOMEM; | 1780 | return -ENOMEM; |
1750 | } | 1781 | } |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 33c332bbab73..1a518684a32f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2107,12 +2107,7 @@ restart: | |||
2107 | * with multiple processes reclaiming pages, the total | 2107 | * with multiple processes reclaiming pages, the total |
2108 | * freeing target can get unreasonably large. | 2108 | * freeing target can get unreasonably large. |
2109 | */ | 2109 | */ |
2110 | if (nr_reclaimed >= nr_to_reclaim) | 2110 | if (nr_reclaimed >= nr_to_reclaim && priority < DEF_PRIORITY) |
2111 | nr_to_reclaim = 0; | ||
2112 | else | ||
2113 | nr_to_reclaim -= nr_reclaimed; | ||
2114 | |||
2115 | if (!nr_to_reclaim && priority < DEF_PRIORITY) | ||
2116 | break; | 2111 | break; |
2117 | } | 2112 | } |
2118 | blk_finish_plug(&plug); | 2113 | blk_finish_plug(&plug); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index e33af63a884a..92a857e3786d 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -665,6 +665,11 @@ int hci_dev_open(__u16 dev) | |||
665 | 665 | ||
666 | hci_req_lock(hdev); | 666 | hci_req_lock(hdev); |
667 | 667 | ||
668 | if (test_bit(HCI_UNREGISTER, &hdev->dev_flags)) { | ||
669 | ret = -ENODEV; | ||
670 | goto done; | ||
671 | } | ||
672 | |||
668 | if (hdev->rfkill && rfkill_blocked(hdev->rfkill)) { | 673 | if (hdev->rfkill && rfkill_blocked(hdev->rfkill)) { |
669 | ret = -ERFKILL; | 674 | ret = -ERFKILL; |
670 | goto done; | 675 | goto done; |
@@ -1849,6 +1854,8 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
1849 | 1854 | ||
1850 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); | 1855 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); |
1851 | 1856 | ||
1857 | set_bit(HCI_UNREGISTER, &hdev->dev_flags); | ||
1858 | |||
1852 | write_lock(&hci_dev_list_lock); | 1859 | write_lock(&hci_dev_list_lock); |
1853 | list_del(&hdev->list); | 1860 | list_del(&hdev->list); |
1854 | write_unlock(&hci_dev_list_lock); | 1861 | write_unlock(&hci_dev_list_lock); |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index b8e17e4dac8b..94552b33d528 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1308,6 +1308,7 @@ static void l2cap_monitor_timeout(struct work_struct *work) | |||
1308 | if (chan->retry_count >= chan->remote_max_tx) { | 1308 | if (chan->retry_count >= chan->remote_max_tx) { |
1309 | l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED); | 1309 | l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED); |
1310 | l2cap_chan_unlock(chan); | 1310 | l2cap_chan_unlock(chan); |
1311 | l2cap_chan_put(chan); | ||
1311 | return; | 1312 | return; |
1312 | } | 1313 | } |
1313 | 1314 | ||
@@ -1316,6 +1317,7 @@ static void l2cap_monitor_timeout(struct work_struct *work) | |||
1316 | 1317 | ||
1317 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); | 1318 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); |
1318 | l2cap_chan_unlock(chan); | 1319 | l2cap_chan_unlock(chan); |
1320 | l2cap_chan_put(chan); | ||
1319 | } | 1321 | } |
1320 | 1322 | ||
1321 | static void l2cap_retrans_timeout(struct work_struct *work) | 1323 | static void l2cap_retrans_timeout(struct work_struct *work) |
@@ -1335,6 +1337,7 @@ static void l2cap_retrans_timeout(struct work_struct *work) | |||
1335 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); | 1337 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); |
1336 | 1338 | ||
1337 | l2cap_chan_unlock(chan); | 1339 | l2cap_chan_unlock(chan); |
1340 | l2cap_chan_put(chan); | ||
1338 | } | 1341 | } |
1339 | 1342 | ||
1340 | static void l2cap_drop_acked_frames(struct l2cap_chan *chan) | 1343 | static void l2cap_drop_acked_frames(struct l2cap_chan *chan) |
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index c4fe583b0af6..29122ed28ea9 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -82,7 +82,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | if (la.l2_cid) | 84 | if (la.l2_cid) |
85 | err = l2cap_add_scid(chan, la.l2_cid); | 85 | err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid)); |
86 | else | 86 | else |
87 | err = l2cap_add_psm(chan, &la.l2_bdaddr, la.l2_psm); | 87 | err = l2cap_add_psm(chan, &la.l2_bdaddr, la.l2_psm); |
88 | 88 | ||
@@ -123,7 +123,8 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al | |||
123 | if (la.l2_cid && la.l2_psm) | 123 | if (la.l2_cid && la.l2_psm) |
124 | return -EINVAL; | 124 | return -EINVAL; |
125 | 125 | ||
126 | err = l2cap_chan_connect(chan, la.l2_psm, la.l2_cid, &la.l2_bdaddr); | 126 | err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid), |
127 | &la.l2_bdaddr); | ||
127 | if (err) | 128 | if (err) |
128 | return err; | 129 | return err; |
129 | 130 | ||
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 7fcff8887131..4ef275c69675 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2523,13 +2523,18 @@ static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev, | |||
2523 | 2523 | ||
2524 | if (cp->val) { | 2524 | if (cp->val) { |
2525 | type = PAGE_SCAN_TYPE_INTERLACED; | 2525 | type = PAGE_SCAN_TYPE_INTERLACED; |
2526 | acp.interval = 0x0024; /* 22.5 msec page scan interval */ | 2526 | |
2527 | /* 22.5 msec page scan interval */ | ||
2528 | acp.interval = __constant_cpu_to_le16(0x0024); | ||
2527 | } else { | 2529 | } else { |
2528 | type = PAGE_SCAN_TYPE_STANDARD; /* default */ | 2530 | type = PAGE_SCAN_TYPE_STANDARD; /* default */ |
2529 | acp.interval = 0x0800; /* default 1.28 sec page scan */ | 2531 | |
2532 | /* default 1.28 sec page scan */ | ||
2533 | acp.interval = __constant_cpu_to_le16(0x0800); | ||
2530 | } | 2534 | } |
2531 | 2535 | ||
2532 | acp.window = 0x0012; /* default 11.25 msec page scan window */ | 2536 | /* default 11.25 msec page scan window */ |
2537 | acp.window = __constant_cpu_to_le16(0x0012); | ||
2533 | 2538 | ||
2534 | err = hci_send_cmd(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY, sizeof(acp), | 2539 | err = hci_send_cmd(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY, sizeof(acp), |
2535 | &acp); | 2540 | &acp); |
@@ -2936,7 +2941,7 @@ int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | |||
2936 | name, name_len); | 2941 | name, name_len); |
2937 | 2942 | ||
2938 | if (dev_class && memcmp(dev_class, "\0\0\0", 3) != 0) | 2943 | if (dev_class && memcmp(dev_class, "\0\0\0", 3) != 0) |
2939 | eir_len = eir_append_data(&ev->eir[eir_len], eir_len, | 2944 | eir_len = eir_append_data(ev->eir, eir_len, |
2940 | EIR_CLASS_OF_DEV, dev_class, 3); | 2945 | EIR_CLASS_OF_DEV, dev_class, 3); |
2941 | 2946 | ||
2942 | put_unaligned_le16(eir_len, &ev->eir_len); | 2947 | put_unaligned_le16(eir_len, &ev->eir_len); |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 702a1ae9220b..27ca25ed7021 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -241,7 +241,6 @@ static void br_multicast_group_expired(unsigned long data) | |||
241 | hlist_del_rcu(&mp->hlist[mdb->ver]); | 241 | hlist_del_rcu(&mp->hlist[mdb->ver]); |
242 | mdb->size--; | 242 | mdb->size--; |
243 | 243 | ||
244 | del_timer(&mp->query_timer); | ||
245 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | 244 | call_rcu_bh(&mp->rcu, br_multicast_free_group); |
246 | 245 | ||
247 | out: | 246 | out: |
@@ -271,7 +270,6 @@ static void br_multicast_del_pg(struct net_bridge *br, | |||
271 | rcu_assign_pointer(*pp, p->next); | 270 | rcu_assign_pointer(*pp, p->next); |
272 | hlist_del_init(&p->mglist); | 271 | hlist_del_init(&p->mglist); |
273 | del_timer(&p->timer); | 272 | del_timer(&p->timer); |
274 | del_timer(&p->query_timer); | ||
275 | call_rcu_bh(&p->rcu, br_multicast_free_pg); | 273 | call_rcu_bh(&p->rcu, br_multicast_free_pg); |
276 | 274 | ||
277 | if (!mp->ports && !mp->mglist && | 275 | if (!mp->ports && !mp->mglist && |
@@ -507,74 +505,6 @@ static struct sk_buff *br_multicast_alloc_query(struct net_bridge *br, | |||
507 | return NULL; | 505 | return NULL; |
508 | } | 506 | } |
509 | 507 | ||
510 | static void br_multicast_send_group_query(struct net_bridge_mdb_entry *mp) | ||
511 | { | ||
512 | struct net_bridge *br = mp->br; | ||
513 | struct sk_buff *skb; | ||
514 | |||
515 | skb = br_multicast_alloc_query(br, &mp->addr); | ||
516 | if (!skb) | ||
517 | goto timer; | ||
518 | |||
519 | netif_rx(skb); | ||
520 | |||
521 | timer: | ||
522 | if (++mp->queries_sent < br->multicast_last_member_count) | ||
523 | mod_timer(&mp->query_timer, | ||
524 | jiffies + br->multicast_last_member_interval); | ||
525 | } | ||
526 | |||
527 | static void br_multicast_group_query_expired(unsigned long data) | ||
528 | { | ||
529 | struct net_bridge_mdb_entry *mp = (void *)data; | ||
530 | struct net_bridge *br = mp->br; | ||
531 | |||
532 | spin_lock(&br->multicast_lock); | ||
533 | if (!netif_running(br->dev) || !mp->mglist || | ||
534 | mp->queries_sent >= br->multicast_last_member_count) | ||
535 | goto out; | ||
536 | |||
537 | br_multicast_send_group_query(mp); | ||
538 | |||
539 | out: | ||
540 | spin_unlock(&br->multicast_lock); | ||
541 | } | ||
542 | |||
543 | static void br_multicast_send_port_group_query(struct net_bridge_port_group *pg) | ||
544 | { | ||
545 | struct net_bridge_port *port = pg->port; | ||
546 | struct net_bridge *br = port->br; | ||
547 | struct sk_buff *skb; | ||
548 | |||
549 | skb = br_multicast_alloc_query(br, &pg->addr); | ||
550 | if (!skb) | ||
551 | goto timer; | ||
552 | |||
553 | br_deliver(port, skb); | ||
554 | |||
555 | timer: | ||
556 | if (++pg->queries_sent < br->multicast_last_member_count) | ||
557 | mod_timer(&pg->query_timer, | ||
558 | jiffies + br->multicast_last_member_interval); | ||
559 | } | ||
560 | |||
561 | static void br_multicast_port_group_query_expired(unsigned long data) | ||
562 | { | ||
563 | struct net_bridge_port_group *pg = (void *)data; | ||
564 | struct net_bridge_port *port = pg->port; | ||
565 | struct net_bridge *br = port->br; | ||
566 | |||
567 | spin_lock(&br->multicast_lock); | ||
568 | if (!netif_running(br->dev) || hlist_unhashed(&pg->mglist) || | ||
569 | pg->queries_sent >= br->multicast_last_member_count) | ||
570 | goto out; | ||
571 | |||
572 | br_multicast_send_port_group_query(pg); | ||
573 | |||
574 | out: | ||
575 | spin_unlock(&br->multicast_lock); | ||
576 | } | ||
577 | |||
578 | static struct net_bridge_mdb_entry *br_multicast_get_group( | 508 | static struct net_bridge_mdb_entry *br_multicast_get_group( |
579 | struct net_bridge *br, struct net_bridge_port *port, | 509 | struct net_bridge *br, struct net_bridge_port *port, |
580 | struct br_ip *group, int hash) | 510 | struct br_ip *group, int hash) |
@@ -690,8 +620,6 @@ rehash: | |||
690 | mp->addr = *group; | 620 | mp->addr = *group; |
691 | setup_timer(&mp->timer, br_multicast_group_expired, | 621 | setup_timer(&mp->timer, br_multicast_group_expired, |
692 | (unsigned long)mp); | 622 | (unsigned long)mp); |
693 | setup_timer(&mp->query_timer, br_multicast_group_query_expired, | ||
694 | (unsigned long)mp); | ||
695 | 623 | ||
696 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); | 624 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); |
697 | mdb->size++; | 625 | mdb->size++; |
@@ -746,8 +674,6 @@ static int br_multicast_add_group(struct net_bridge *br, | |||
746 | hlist_add_head(&p->mglist, &port->mglist); | 674 | hlist_add_head(&p->mglist, &port->mglist); |
747 | setup_timer(&p->timer, br_multicast_port_group_expired, | 675 | setup_timer(&p->timer, br_multicast_port_group_expired, |
748 | (unsigned long)p); | 676 | (unsigned long)p); |
749 | setup_timer(&p->query_timer, br_multicast_port_group_query_expired, | ||
750 | (unsigned long)p); | ||
751 | 677 | ||
752 | rcu_assign_pointer(*pp, p); | 678 | rcu_assign_pointer(*pp, p); |
753 | 679 | ||
@@ -1291,9 +1217,6 @@ static void br_multicast_leave_group(struct net_bridge *br, | |||
1291 | time_after(mp->timer.expires, time) : | 1217 | time_after(mp->timer.expires, time) : |
1292 | try_to_del_timer_sync(&mp->timer) >= 0)) { | 1218 | try_to_del_timer_sync(&mp->timer) >= 0)) { |
1293 | mod_timer(&mp->timer, time); | 1219 | mod_timer(&mp->timer, time); |
1294 | |||
1295 | mp->queries_sent = 0; | ||
1296 | mod_timer(&mp->query_timer, now); | ||
1297 | } | 1220 | } |
1298 | 1221 | ||
1299 | goto out; | 1222 | goto out; |
@@ -1310,9 +1233,6 @@ static void br_multicast_leave_group(struct net_bridge *br, | |||
1310 | time_after(p->timer.expires, time) : | 1233 | time_after(p->timer.expires, time) : |
1311 | try_to_del_timer_sync(&p->timer) >= 0)) { | 1234 | try_to_del_timer_sync(&p->timer) >= 0)) { |
1312 | mod_timer(&p->timer, time); | 1235 | mod_timer(&p->timer, time); |
1313 | |||
1314 | p->queries_sent = 0; | ||
1315 | mod_timer(&p->query_timer, now); | ||
1316 | } | 1236 | } |
1317 | 1237 | ||
1318 | break; | 1238 | break; |
@@ -1681,7 +1601,6 @@ void br_multicast_stop(struct net_bridge *br) | |||
1681 | hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i], | 1601 | hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i], |
1682 | hlist[ver]) { | 1602 | hlist[ver]) { |
1683 | del_timer(&mp->timer); | 1603 | del_timer(&mp->timer); |
1684 | del_timer(&mp->query_timer); | ||
1685 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | 1604 | call_rcu_bh(&mp->rcu, br_multicast_free_group); |
1686 | } | 1605 | } |
1687 | } | 1606 | } |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 0b67a63ad7a8..e1d882257877 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -82,9 +82,7 @@ struct net_bridge_port_group { | |||
82 | struct hlist_node mglist; | 82 | struct hlist_node mglist; |
83 | struct rcu_head rcu; | 83 | struct rcu_head rcu; |
84 | struct timer_list timer; | 84 | struct timer_list timer; |
85 | struct timer_list query_timer; | ||
86 | struct br_ip addr; | 85 | struct br_ip addr; |
87 | u32 queries_sent; | ||
88 | }; | 86 | }; |
89 | 87 | ||
90 | struct net_bridge_mdb_entry | 88 | struct net_bridge_mdb_entry |
@@ -94,10 +92,8 @@ struct net_bridge_mdb_entry | |||
94 | struct net_bridge_port_group __rcu *ports; | 92 | struct net_bridge_port_group __rcu *ports; |
95 | struct rcu_head rcu; | 93 | struct rcu_head rcu; |
96 | struct timer_list timer; | 94 | struct timer_list timer; |
97 | struct timer_list query_timer; | ||
98 | struct br_ip addr; | 95 | struct br_ip addr; |
99 | bool mglist; | 96 | bool mglist; |
100 | u32 queries_sent; | ||
101 | }; | 97 | }; |
102 | 98 | ||
103 | struct net_bridge_mdb_htable | 99 | struct net_bridge_mdb_htable |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index baf8d281152c..e59840010d45 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -952,9 +952,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
952 | goto adjust_others; | 952 | goto adjust_others; |
953 | } | 953 | } |
954 | 954 | ||
955 | data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); | 955 | data = kmalloc(size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), |
956 | gfp_mask); | ||
956 | if (!data) | 957 | if (!data) |
957 | goto nodata; | 958 | goto nodata; |
959 | size = SKB_WITH_OVERHEAD(ksize(data)); | ||
958 | 960 | ||
959 | /* Copy only real data... and, alas, header. This should be | 961 | /* Copy only real data... and, alas, header. This should be |
960 | * optimized for the cases when header is void. | 962 | * optimized for the cases when header is void. |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index de9da21113a1..cf73cc70ed2d 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -74,16 +74,24 @@ static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | |||
74 | 74 | ||
75 | iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); | 75 | iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); |
76 | if (iph == NULL) | 76 | if (iph == NULL) |
77 | return -NF_DROP; | 77 | return -NF_ACCEPT; |
78 | 78 | ||
79 | /* Conntrack defragments packets, we might still see fragments | 79 | /* Conntrack defragments packets, we might still see fragments |
80 | * inside ICMP packets though. */ | 80 | * inside ICMP packets though. */ |
81 | if (iph->frag_off & htons(IP_OFFSET)) | 81 | if (iph->frag_off & htons(IP_OFFSET)) |
82 | return -NF_DROP; | 82 | return -NF_ACCEPT; |
83 | 83 | ||
84 | *dataoff = nhoff + (iph->ihl << 2); | 84 | *dataoff = nhoff + (iph->ihl << 2); |
85 | *protonum = iph->protocol; | 85 | *protonum = iph->protocol; |
86 | 86 | ||
87 | /* Check bogus IP headers */ | ||
88 | if (*dataoff > skb->len) { | ||
89 | pr_debug("nf_conntrack_ipv4: bogus IPv4 packet: " | ||
90 | "nhoff %u, ihl %u, skblen %u\n", | ||
91 | nhoff, iph->ihl << 2, skb->len); | ||
92 | return -NF_ACCEPT; | ||
93 | } | ||
94 | |||
87 | return NF_ACCEPT; | 95 | return NF_ACCEPT; |
88 | } | 96 | } |
89 | 97 | ||
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 5d54ed30e821..8bb6adeb62c0 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -701,11 +701,12 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp) | |||
701 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | 701 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); |
702 | if (skb) { | 702 | if (skb) { |
703 | if (sk_wmem_schedule(sk, skb->truesize)) { | 703 | if (sk_wmem_schedule(sk, skb->truesize)) { |
704 | skb_reserve(skb, sk->sk_prot->max_header); | ||
704 | /* | 705 | /* |
705 | * Make sure that we have exactly size bytes | 706 | * Make sure that we have exactly size bytes |
706 | * available to the caller, no more, no less. | 707 | * available to the caller, no more, no less. |
707 | */ | 708 | */ |
708 | skb_reserve(skb, skb_tailroom(skb) - size); | 709 | skb->avail_size = size; |
709 | return skb; | 710 | return skb; |
710 | } | 711 | } |
711 | __kfree_skb(skb); | 712 | __kfree_skb(skb); |
@@ -995,10 +996,9 @@ new_segment: | |||
995 | copy = seglen; | 996 | copy = seglen; |
996 | 997 | ||
997 | /* Where to copy to? */ | 998 | /* Where to copy to? */ |
998 | if (skb_tailroom(skb) > 0) { | 999 | if (skb_availroom(skb) > 0) { |
999 | /* We have some space in skb head. Superb! */ | 1000 | /* We have some space in skb head. Superb! */ |
1000 | if (copy > skb_tailroom(skb)) | 1001 | copy = min_t(int, copy, skb_availroom(skb)); |
1001 | copy = skb_tailroom(skb); | ||
1002 | err = skb_add_data_nocache(sk, skb, from, copy); | 1002 | err = skb_add_data_nocache(sk, skb, from, copy); |
1003 | if (err) | 1003 | if (err) |
1004 | goto do_fault; | 1004 | goto do_fault; |
@@ -1452,7 +1452,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1452 | if ((available < target) && | 1452 | if ((available < target) && |
1453 | (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && | 1453 | (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && |
1454 | !sysctl_tcp_low_latency && | 1454 | !sysctl_tcp_low_latency && |
1455 | dma_find_channel(DMA_MEMCPY)) { | 1455 | net_dma_find_channel()) { |
1456 | preempt_enable_no_resched(); | 1456 | preempt_enable_no_resched(); |
1457 | tp->ucopy.pinned_list = | 1457 | tp->ucopy.pinned_list = |
1458 | dma_pin_iovec_pages(msg->msg_iov, len); | 1458 | dma_pin_iovec_pages(msg->msg_iov, len); |
@@ -1667,7 +1667,7 @@ do_prequeue: | |||
1667 | if (!(flags & MSG_TRUNC)) { | 1667 | if (!(flags & MSG_TRUNC)) { |
1668 | #ifdef CONFIG_NET_DMA | 1668 | #ifdef CONFIG_NET_DMA |
1669 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1669 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1670 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1670 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1671 | 1671 | ||
1672 | if (tp->ucopy.dma_chan) { | 1672 | if (tp->ucopy.dma_chan) { |
1673 | tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( | 1673 | tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( |
@@ -3302,8 +3302,7 @@ void __init tcp_init(void) | |||
3302 | 3302 | ||
3303 | tcp_init_mem(&init_net); | 3303 | tcp_init_mem(&init_net); |
3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ | 3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ |
3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10); | 3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); |
3306 | limit = max(limit, 128UL); | ||
3307 | max_share = min(4UL*1024*1024, limit); | 3306 | max_share = min(4UL*1024*1024, limit); |
3308 | 3307 | ||
3309 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; | 3308 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e886e2f7fa8d..9944c1d9a218 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -474,8 +474,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep) | |||
474 | if (!win_dep) { | 474 | if (!win_dep) { |
475 | m -= (new_sample >> 3); | 475 | m -= (new_sample >> 3); |
476 | new_sample += m; | 476 | new_sample += m; |
477 | } else if (m < new_sample) | 477 | } else { |
478 | new_sample = m << 3; | 478 | m <<= 3; |
479 | if (m < new_sample) | ||
480 | new_sample = m; | ||
481 | } | ||
479 | } else { | 482 | } else { |
480 | /* No previous measure. */ | 483 | /* No previous measure. */ |
481 | new_sample = m << 3; | 484 | new_sample = m << 3; |
@@ -5225,7 +5228,7 @@ static int tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb, | |||
5225 | return 0; | 5228 | return 0; |
5226 | 5229 | ||
5227 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 5230 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
5228 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 5231 | tp->ucopy.dma_chan = net_dma_find_channel(); |
5229 | 5232 | ||
5230 | if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) { | 5233 | if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) { |
5231 | 5234 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 3a25cf743f8b..0cb86ceb652f 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1730,7 +1730,7 @@ process: | |||
1730 | #ifdef CONFIG_NET_DMA | 1730 | #ifdef CONFIG_NET_DMA |
1731 | struct tcp_sock *tp = tcp_sk(sk); | 1731 | struct tcp_sock *tp = tcp_sk(sk); |
1732 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1732 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1733 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1733 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1734 | if (tp->ucopy.dma_chan) | 1734 | if (tp->ucopy.dma_chan) |
1735 | ret = tcp_v4_do_rcv(sk, skb); | 1735 | ret = tcp_v4_do_rcv(sk, skb); |
1736 | else | 1736 | else |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 364784a91939..376b2cfbb685 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2060,7 +2060,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to, | |||
2060 | /* Punt if not enough space exists in the first SKB for | 2060 | /* Punt if not enough space exists in the first SKB for |
2061 | * the data in the second | 2061 | * the data in the second |
2062 | */ | 2062 | */ |
2063 | if (skb->len > skb_tailroom(to)) | 2063 | if (skb->len > skb_availroom(to)) |
2064 | break; | 2064 | break; |
2065 | 2065 | ||
2066 | if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp))) | 2066 | if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp))) |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 94874b0bdcdc..9d4e15559319 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -78,19 +78,6 @@ EXPORT_SYMBOL_GPL(ip6t_alloc_initial_table); | |||
78 | 78 | ||
79 | Hence the start of any table is given by get_table() below. */ | 79 | Hence the start of any table is given by get_table() below. */ |
80 | 80 | ||
81 | /* Check for an extension */ | ||
82 | int | ||
83 | ip6t_ext_hdr(u8 nexthdr) | ||
84 | { | ||
85 | return (nexthdr == IPPROTO_HOPOPTS) || | ||
86 | (nexthdr == IPPROTO_ROUTING) || | ||
87 | (nexthdr == IPPROTO_FRAGMENT) || | ||
88 | (nexthdr == IPPROTO_ESP) || | ||
89 | (nexthdr == IPPROTO_AH) || | ||
90 | (nexthdr == IPPROTO_NONE) || | ||
91 | (nexthdr == IPPROTO_DSTOPTS); | ||
92 | } | ||
93 | |||
94 | /* Returns whether matches rule or not. */ | 81 | /* Returns whether matches rule or not. */ |
95 | /* Performance critical - called for every packet */ | 82 | /* Performance critical - called for every packet */ |
96 | static inline bool | 83 | static inline bool |
@@ -2366,7 +2353,6 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, | |||
2366 | EXPORT_SYMBOL(ip6t_register_table); | 2353 | EXPORT_SYMBOL(ip6t_register_table); |
2367 | EXPORT_SYMBOL(ip6t_unregister_table); | 2354 | EXPORT_SYMBOL(ip6t_unregister_table); |
2368 | EXPORT_SYMBOL(ip6t_do_table); | 2355 | EXPORT_SYMBOL(ip6t_do_table); |
2369 | EXPORT_SYMBOL(ip6t_ext_hdr); | ||
2370 | EXPORT_SYMBOL(ipv6_find_hdr); | 2356 | EXPORT_SYMBOL(ipv6_find_hdr); |
2371 | 2357 | ||
2372 | module_init(ip6_tables_init); | 2358 | module_init(ip6_tables_init); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 12c6ece67f39..86cfe6005f40 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1645,7 +1645,7 @@ process: | |||
1645 | #ifdef CONFIG_NET_DMA | 1645 | #ifdef CONFIG_NET_DMA |
1646 | struct tcp_sock *tp = tcp_sk(sk); | 1646 | struct tcp_sock *tp = tcp_sk(sk); |
1647 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1647 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1648 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1648 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1649 | if (tp->ucopy.dma_chan) | 1649 | if (tp->ucopy.dma_chan) |
1650 | ret = tcp_v6_do_rcv(sk, skb); | 1650 | ret = tcp_v6_do_rcv(sk, skb); |
1651 | else | 1651 | else |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 576fb25456dd..f76da5b3f5c5 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -3387,8 +3387,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
3387 | */ | 3387 | */ |
3388 | printk(KERN_DEBUG "%s: waiting for beacon from %pM\n", | 3388 | printk(KERN_DEBUG "%s: waiting for beacon from %pM\n", |
3389 | sdata->name, ifmgd->bssid); | 3389 | sdata->name, ifmgd->bssid); |
3390 | assoc_data->timeout = jiffies + | 3390 | assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); |
3391 | TU_TO_EXP_TIME(req->bss->beacon_interval); | ||
3392 | } else { | 3391 | } else { |
3393 | assoc_data->have_beacon = true; | 3392 | assoc_data->have_beacon = true; |
3394 | assoc_data->sent_assoc = false; | 3393 | assoc_data->sent_assoc = false; |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 3cc4487ac349..729f157a0efa 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1592,7 +1592,7 @@ static int nf_conntrack_init_net(struct net *net) | |||
1592 | return 0; | 1592 | return 0; |
1593 | 1593 | ||
1594 | err_timeout: | 1594 | err_timeout: |
1595 | nf_conntrack_timeout_fini(net); | 1595 | nf_conntrack_ecache_fini(net); |
1596 | err_ecache: | 1596 | err_ecache: |
1597 | nf_conntrack_tstamp_fini(net); | 1597 | nf_conntrack_tstamp_fini(net); |
1598 | err_tstamp: | 1598 | err_tstamp: |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 361eade62a09..0d07a1dcf605 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct, | |||
584 | * Let's try to use the data from the packet. | 584 | * Let's try to use the data from the packet. |
585 | */ | 585 | */ |
586 | sender->td_end = end; | 586 | sender->td_end = end; |
587 | win <<= sender->td_scale; | 587 | swin = win << sender->td_scale; |
588 | sender->td_maxwin = (win == 0 ? 1 : win); | 588 | sender->td_maxwin = (swin == 0 ? 1 : swin); |
589 | sender->td_maxend = end + sender->td_maxwin; | 589 | sender->td_maxend = end + sender->td_maxwin; |
590 | /* | 590 | /* |
591 | * We haven't seen traffic in the other direction yet | 591 | * We haven't seen traffic in the other direction yet |
diff --git a/net/nfc/llcp/commands.c b/net/nfc/llcp/commands.c index 7b76eb7192f3..ef10ffcb4b6f 100644 --- a/net/nfc/llcp/commands.c +++ b/net/nfc/llcp/commands.c | |||
@@ -474,7 +474,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock, | |||
474 | 474 | ||
475 | while (remaining_len > 0) { | 475 | while (remaining_len > 0) { |
476 | 476 | ||
477 | frag_len = min_t(u16, local->remote_miu, remaining_len); | 477 | frag_len = min_t(size_t, local->remote_miu, remaining_len); |
478 | 478 | ||
479 | pr_debug("Fragment %zd bytes remaining %zd", | 479 | pr_debug("Fragment %zd bytes remaining %zd", |
480 | frag_len, remaining_len); | 480 | frag_len, remaining_len); |
@@ -497,7 +497,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock, | |||
497 | release_sock(sk); | 497 | release_sock(sk); |
498 | 498 | ||
499 | remaining_len -= frag_len; | 499 | remaining_len -= frag_len; |
500 | msg_ptr += len; | 500 | msg_ptr += frag_len; |
501 | } | 501 | } |
502 | 502 | ||
503 | kfree(msg_data); | 503 | kfree(msg_data); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index e49da2797022..f432c57af05d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1294,6 +1294,11 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1294 | goto bad_res; | 1294 | goto bad_res; |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | if (!netif_running(netdev)) { | ||
1298 | result = -ENETDOWN; | ||
1299 | goto bad_res; | ||
1300 | } | ||
1301 | |||
1297 | nla_for_each_nested(nl_txq_params, | 1302 | nla_for_each_nested(nl_txq_params, |
1298 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], | 1303 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], |
1299 | rem_txq_params) { | 1304 | rem_txq_params) { |
@@ -6384,7 +6389,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6384 | .doit = nl80211_get_key, | 6389 | .doit = nl80211_get_key, |
6385 | .policy = nl80211_policy, | 6390 | .policy = nl80211_policy, |
6386 | .flags = GENL_ADMIN_PERM, | 6391 | .flags = GENL_ADMIN_PERM, |
6387 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6392 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6388 | NL80211_FLAG_NEED_RTNL, | 6393 | NL80211_FLAG_NEED_RTNL, |
6389 | }, | 6394 | }, |
6390 | { | 6395 | { |
@@ -6416,7 +6421,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6416 | .policy = nl80211_policy, | 6421 | .policy = nl80211_policy, |
6417 | .flags = GENL_ADMIN_PERM, | 6422 | .flags = GENL_ADMIN_PERM, |
6418 | .doit = nl80211_set_beacon, | 6423 | .doit = nl80211_set_beacon, |
6419 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6424 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6420 | NL80211_FLAG_NEED_RTNL, | 6425 | NL80211_FLAG_NEED_RTNL, |
6421 | }, | 6426 | }, |
6422 | { | 6427 | { |
@@ -6424,7 +6429,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6424 | .policy = nl80211_policy, | 6429 | .policy = nl80211_policy, |
6425 | .flags = GENL_ADMIN_PERM, | 6430 | .flags = GENL_ADMIN_PERM, |
6426 | .doit = nl80211_start_ap, | 6431 | .doit = nl80211_start_ap, |
6427 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6432 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6428 | NL80211_FLAG_NEED_RTNL, | 6433 | NL80211_FLAG_NEED_RTNL, |
6429 | }, | 6434 | }, |
6430 | { | 6435 | { |
@@ -6432,7 +6437,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6432 | .policy = nl80211_policy, | 6437 | .policy = nl80211_policy, |
6433 | .flags = GENL_ADMIN_PERM, | 6438 | .flags = GENL_ADMIN_PERM, |
6434 | .doit = nl80211_stop_ap, | 6439 | .doit = nl80211_stop_ap, |
6435 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6440 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6436 | NL80211_FLAG_NEED_RTNL, | 6441 | NL80211_FLAG_NEED_RTNL, |
6437 | }, | 6442 | }, |
6438 | { | 6443 | { |
@@ -6448,7 +6453,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6448 | .doit = nl80211_set_station, | 6453 | .doit = nl80211_set_station, |
6449 | .policy = nl80211_policy, | 6454 | .policy = nl80211_policy, |
6450 | .flags = GENL_ADMIN_PERM, | 6455 | .flags = GENL_ADMIN_PERM, |
6451 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6456 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6452 | NL80211_FLAG_NEED_RTNL, | 6457 | NL80211_FLAG_NEED_RTNL, |
6453 | }, | 6458 | }, |
6454 | { | 6459 | { |
@@ -6464,7 +6469,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6464 | .doit = nl80211_del_station, | 6469 | .doit = nl80211_del_station, |
6465 | .policy = nl80211_policy, | 6470 | .policy = nl80211_policy, |
6466 | .flags = GENL_ADMIN_PERM, | 6471 | .flags = GENL_ADMIN_PERM, |
6467 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6472 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6468 | NL80211_FLAG_NEED_RTNL, | 6473 | NL80211_FLAG_NEED_RTNL, |
6469 | }, | 6474 | }, |
6470 | { | 6475 | { |
@@ -6497,7 +6502,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6497 | .doit = nl80211_del_mpath, | 6502 | .doit = nl80211_del_mpath, |
6498 | .policy = nl80211_policy, | 6503 | .policy = nl80211_policy, |
6499 | .flags = GENL_ADMIN_PERM, | 6504 | .flags = GENL_ADMIN_PERM, |
6500 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6505 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6501 | NL80211_FLAG_NEED_RTNL, | 6506 | NL80211_FLAG_NEED_RTNL, |
6502 | }, | 6507 | }, |
6503 | { | 6508 | { |
@@ -6505,7 +6510,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6505 | .doit = nl80211_set_bss, | 6510 | .doit = nl80211_set_bss, |
6506 | .policy = nl80211_policy, | 6511 | .policy = nl80211_policy, |
6507 | .flags = GENL_ADMIN_PERM, | 6512 | .flags = GENL_ADMIN_PERM, |
6508 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6513 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6509 | NL80211_FLAG_NEED_RTNL, | 6514 | NL80211_FLAG_NEED_RTNL, |
6510 | }, | 6515 | }, |
6511 | { | 6516 | { |
@@ -6531,7 +6536,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6531 | .doit = nl80211_get_mesh_config, | 6536 | .doit = nl80211_get_mesh_config, |
6532 | .policy = nl80211_policy, | 6537 | .policy = nl80211_policy, |
6533 | /* can be retrieved by unprivileged users */ | 6538 | /* can be retrieved by unprivileged users */ |
6534 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6539 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6535 | NL80211_FLAG_NEED_RTNL, | 6540 | NL80211_FLAG_NEED_RTNL, |
6536 | }, | 6541 | }, |
6537 | { | 6542 | { |
@@ -6664,7 +6669,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6664 | .doit = nl80211_setdel_pmksa, | 6669 | .doit = nl80211_setdel_pmksa, |
6665 | .policy = nl80211_policy, | 6670 | .policy = nl80211_policy, |
6666 | .flags = GENL_ADMIN_PERM, | 6671 | .flags = GENL_ADMIN_PERM, |
6667 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6672 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6668 | NL80211_FLAG_NEED_RTNL, | 6673 | NL80211_FLAG_NEED_RTNL, |
6669 | }, | 6674 | }, |
6670 | { | 6675 | { |
@@ -6672,7 +6677,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6672 | .doit = nl80211_setdel_pmksa, | 6677 | .doit = nl80211_setdel_pmksa, |
6673 | .policy = nl80211_policy, | 6678 | .policy = nl80211_policy, |
6674 | .flags = GENL_ADMIN_PERM, | 6679 | .flags = GENL_ADMIN_PERM, |
6675 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6680 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6676 | NL80211_FLAG_NEED_RTNL, | 6681 | NL80211_FLAG_NEED_RTNL, |
6677 | }, | 6682 | }, |
6678 | { | 6683 | { |
@@ -6680,7 +6685,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6680 | .doit = nl80211_flush_pmksa, | 6685 | .doit = nl80211_flush_pmksa, |
6681 | .policy = nl80211_policy, | 6686 | .policy = nl80211_policy, |
6682 | .flags = GENL_ADMIN_PERM, | 6687 | .flags = GENL_ADMIN_PERM, |
6683 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6688 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6684 | NL80211_FLAG_NEED_RTNL, | 6689 | NL80211_FLAG_NEED_RTNL, |
6685 | }, | 6690 | }, |
6686 | { | 6691 | { |
@@ -6840,7 +6845,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6840 | .doit = nl80211_probe_client, | 6845 | .doit = nl80211_probe_client, |
6841 | .policy = nl80211_policy, | 6846 | .policy = nl80211_policy, |
6842 | .flags = GENL_ADMIN_PERM, | 6847 | .flags = GENL_ADMIN_PERM, |
6843 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6848 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6844 | NL80211_FLAG_NEED_RTNL, | 6849 | NL80211_FLAG_NEED_RTNL, |
6845 | }, | 6850 | }, |
6846 | { | 6851 | { |
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c index 0af7f54e4f61..af648e08e61b 100644 --- a/net/wireless/wext-core.c +++ b/net/wireless/wext-core.c | |||
@@ -780,8 +780,10 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd, | |||
780 | if (cmd == SIOCSIWENCODEEXT) { | 780 | if (cmd == SIOCSIWENCODEEXT) { |
781 | struct iw_encode_ext *ee = (void *) extra; | 781 | struct iw_encode_ext *ee = (void *) extra; |
782 | 782 | ||
783 | if (iwp->length < sizeof(*ee) + ee->key_len) | 783 | if (iwp->length < sizeof(*ee) + ee->key_len) { |
784 | return -EFAULT; | 784 | err = -EFAULT; |
785 | goto out; | ||
786 | } | ||
785 | } | 787 | } |
786 | } | 788 | } |
787 | 789 | ||
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index de639eeeed50..faea0ec612bf 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -1869,12 +1869,6 @@ sub process { | |||
1869 | "No space is necessary after a cast\n" . $hereprev); | 1869 | "No space is necessary after a cast\n" . $hereprev); |
1870 | } | 1870 | } |
1871 | 1871 | ||
1872 | if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ && | ||
1873 | $prevrawline =~ /^\+[ \t]*$/) { | ||
1874 | CHK("BLOCK_COMMENT_STYLE", | ||
1875 | "Don't begin block comments with only a /* line, use /* comment...\n" . $hereprev); | ||
1876 | } | ||
1877 | |||
1878 | # check for spaces at the beginning of a line. | 1872 | # check for spaces at the beginning of a line. |
1879 | # Exceptions: | 1873 | # Exceptions: |
1880 | # 1) within comments | 1874 | # 1) within comments |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 0586085136d1..52577f052bc1 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -540,35 +540,6 @@ static struct conf_printer header_printer_cb = | |||
540 | }; | 540 | }; |
541 | 541 | ||
542 | /* | 542 | /* |
543 | * Generate the __enabled_CONFIG_* and __enabled_CONFIG_*_MODULE macros for | ||
544 | * use by the IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is | ||
545 | * generated even for booleans so that the IS_ENABLED() macro works. | ||
546 | */ | ||
547 | static void | ||
548 | header_print__enabled_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | ||
549 | { | ||
550 | |||
551 | switch (sym->type) { | ||
552 | case S_BOOLEAN: | ||
553 | case S_TRISTATE: { | ||
554 | fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", | ||
555 | sym->name, (*value == 'y')); | ||
556 | fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", | ||
557 | sym->name, (*value == 'm')); | ||
558 | break; | ||
559 | } | ||
560 | default: | ||
561 | break; | ||
562 | } | ||
563 | } | ||
564 | |||
565 | static struct conf_printer header__enabled_printer_cb = | ||
566 | { | ||
567 | .print_symbol = header_print__enabled_symbol, | ||
568 | .print_comment = header_print_comment, | ||
569 | }; | ||
570 | |||
571 | /* | ||
572 | * Tristate printer | 543 | * Tristate printer |
573 | * | 544 | * |
574 | * This printer is used when generating the `include/config/tristate.conf' file. | 545 | * This printer is used when generating the `include/config/tristate.conf' file. |
@@ -949,16 +920,11 @@ int conf_write_autoconf(void) | |||
949 | conf_write_heading(out_h, &header_printer_cb, NULL); | 920 | conf_write_heading(out_h, &header_printer_cb, NULL); |
950 | 921 | ||
951 | for_all_symbols(i, sym) { | 922 | for_all_symbols(i, sym) { |
952 | if (!sym->name) | ||
953 | continue; | ||
954 | |||
955 | sym_calc_value(sym); | 923 | sym_calc_value(sym); |
956 | 924 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) | |
957 | conf_write_symbol(out_h, sym, &header__enabled_printer_cb, NULL); | ||
958 | |||
959 | if (!(sym->flags & SYMBOL_WRITE)) | ||
960 | continue; | 925 | continue; |
961 | 926 | ||
927 | /* write symbol to auto.conf, tristate and header files */ | ||
962 | conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); | 928 | conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); |
963 | 929 | ||
964 | conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); | 930 | conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 3f01fd908730..c4e7d1510f9d 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -132,8 +132,10 @@ static struct module *new_module(char *modname) | |||
132 | /* strip trailing .o */ | 132 | /* strip trailing .o */ |
133 | s = strrchr(p, '.'); | 133 | s = strrchr(p, '.'); |
134 | if (s != NULL) | 134 | if (s != NULL) |
135 | if (strcmp(s, ".o") == 0) | 135 | if (strcmp(s, ".o") == 0) { |
136 | *s = '\0'; | 136 | *s = '\0'; |
137 | mod->is_dot_o = 1; | ||
138 | } | ||
137 | 139 | ||
138 | /* add to list */ | 140 | /* add to list */ |
139 | mod->name = p; | 141 | mod->name = p; |
@@ -587,7 +589,8 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
587 | unsigned int crc; | 589 | unsigned int crc; |
588 | enum export export; | 590 | enum export export; |
589 | 591 | ||
590 | if (!is_vmlinux(mod->name) && strncmp(symname, "__ksymtab", 9) == 0) | 592 | if ((!is_vmlinux(mod->name) || mod->is_dot_o) && |
593 | strncmp(symname, "__ksymtab", 9) == 0) | ||
591 | export = export_from_secname(info, get_secindex(info, sym)); | 594 | export = export_from_secname(info, get_secindex(info, sym)); |
592 | else | 595 | else |
593 | export = export_from_sec(info, get_secindex(info, sym)); | 596 | export = export_from_sec(info, get_secindex(info, sym)); |
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 2031119080dc..51207e4d5f8b 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h | |||
@@ -113,6 +113,7 @@ struct module { | |||
113 | int has_cleanup; | 113 | int has_cleanup; |
114 | struct buffer dev_table_buf; | 114 | struct buffer dev_table_buf; |
115 | char srcversion[25]; | 115 | char srcversion[25]; |
116 | int is_dot_o; | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | struct elf_info { | 119 | struct elf_info { |
diff --git a/scripts/xz_wrap.sh b/scripts/xz_wrap.sh index 17a5798c29da..7a2d372f4885 100644 --- a/scripts/xz_wrap.sh +++ b/scripts/xz_wrap.sh | |||
@@ -12,8 +12,8 @@ | |||
12 | BCJ= | 12 | BCJ= |
13 | LZMA2OPTS= | 13 | LZMA2OPTS= |
14 | 14 | ||
15 | case $ARCH in | 15 | case $SRCARCH in |
16 | x86|x86_64) BCJ=--x86 ;; | 16 | x86) BCJ=--x86 ;; |
17 | powerpc) BCJ=--powerpc ;; | 17 | powerpc) BCJ=--powerpc ;; |
18 | ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;; | 18 | ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;; |
19 | arm) BCJ=--arm ;; | 19 | arm) BCJ=--arm ;; |
diff --git a/security/commoncap.c b/security/commoncap.c index 0cf4b53480a7..71a166a05975 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/securebits.h> | 29 | #include <linux/securebits.h> |
30 | #include <linux/user_namespace.h> | 30 | #include <linux/user_namespace.h> |
31 | #include <linux/binfmts.h> | 31 | #include <linux/binfmts.h> |
32 | #include <linux/personality.h> | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * If a non-root user executes a setuid-root binary in | 35 | * If a non-root user executes a setuid-root binary in |
@@ -505,6 +506,11 @@ int cap_bprm_set_creds(struct linux_binprm *bprm) | |||
505 | } | 506 | } |
506 | skip: | 507 | skip: |
507 | 508 | ||
509 | /* if we have fs caps, clear dangerous personality flags */ | ||
510 | if (!cap_issubset(new->cap_permitted, old->cap_permitted)) | ||
511 | bprm->per_clear |= PER_CLEAR_ON_SETID; | ||
512 | |||
513 | |||
508 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised | 514 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised |
509 | * credentials unless they have the appropriate permit | 515 | * credentials unless they have the appropriate permit |
510 | */ | 516 | */ |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 81c03a597112..45c32f074166 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -1939,18 +1939,19 @@ static int smack_netlabel_send(struct sock *sk, struct sockaddr_in *sap) | |||
1939 | char *hostsp; | 1939 | char *hostsp; |
1940 | struct socket_smack *ssp = sk->sk_security; | 1940 | struct socket_smack *ssp = sk->sk_security; |
1941 | struct smk_audit_info ad; | 1941 | struct smk_audit_info ad; |
1942 | struct lsm_network_audit net; | ||
1943 | 1942 | ||
1944 | rcu_read_lock(); | 1943 | rcu_read_lock(); |
1945 | hostsp = smack_host_label(sap); | 1944 | hostsp = smack_host_label(sap); |
1946 | if (hostsp != NULL) { | 1945 | if (hostsp != NULL) { |
1947 | sk_lbl = SMACK_UNLABELED_SOCKET; | ||
1948 | #ifdef CONFIG_AUDIT | 1946 | #ifdef CONFIG_AUDIT |
1947 | struct lsm_network_audit net; | ||
1948 | |||
1949 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); | 1949 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
1950 | ad.a.u.net->family = sap->sin_family; | 1950 | ad.a.u.net->family = sap->sin_family; |
1951 | ad.a.u.net->dport = sap->sin_port; | 1951 | ad.a.u.net->dport = sap->sin_port; |
1952 | ad.a.u.net->v4info.daddr = sap->sin_addr.s_addr; | 1952 | ad.a.u.net->v4info.daddr = sap->sin_addr.s_addr; |
1953 | #endif | 1953 | #endif |
1954 | sk_lbl = SMACK_UNLABELED_SOCKET; | ||
1954 | rc = smk_access(ssp->smk_out, hostsp, MAY_WRITE, &ad); | 1955 | rc = smk_access(ssp->smk_out, hostsp, MAY_WRITE, &ad); |
1955 | } else { | 1956 | } else { |
1956 | sk_lbl = SMACK_CIPSO_SOCKET; | 1957 | sk_lbl = SMACK_CIPSO_SOCKET; |
@@ -2809,11 +2810,14 @@ static int smack_unix_stream_connect(struct sock *sock, | |||
2809 | struct socket_smack *osp = other->sk_security; | 2810 | struct socket_smack *osp = other->sk_security; |
2810 | struct socket_smack *nsp = newsk->sk_security; | 2811 | struct socket_smack *nsp = newsk->sk_security; |
2811 | struct smk_audit_info ad; | 2812 | struct smk_audit_info ad; |
2812 | struct lsm_network_audit net; | ||
2813 | int rc = 0; | 2813 | int rc = 0; |
2814 | 2814 | ||
2815 | #ifdef CONFIG_AUDIT | ||
2816 | struct lsm_network_audit net; | ||
2817 | |||
2815 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); | 2818 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
2816 | smk_ad_setfield_u_net_sk(&ad, other); | 2819 | smk_ad_setfield_u_net_sk(&ad, other); |
2820 | #endif | ||
2817 | 2821 | ||
2818 | if (!capable(CAP_MAC_OVERRIDE)) | 2822 | if (!capable(CAP_MAC_OVERRIDE)) |
2819 | rc = smk_access(ssp->smk_out, osp->smk_in, MAY_WRITE, &ad); | 2823 | rc = smk_access(ssp->smk_out, osp->smk_in, MAY_WRITE, &ad); |
@@ -2842,11 +2846,14 @@ static int smack_unix_may_send(struct socket *sock, struct socket *other) | |||
2842 | struct socket_smack *ssp = sock->sk->sk_security; | 2846 | struct socket_smack *ssp = sock->sk->sk_security; |
2843 | struct socket_smack *osp = other->sk->sk_security; | 2847 | struct socket_smack *osp = other->sk->sk_security; |
2844 | struct smk_audit_info ad; | 2848 | struct smk_audit_info ad; |
2845 | struct lsm_network_audit net; | ||
2846 | int rc = 0; | 2849 | int rc = 0; |
2847 | 2850 | ||
2851 | #ifdef CONFIG_AUDIT | ||
2852 | struct lsm_network_audit net; | ||
2853 | |||
2848 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); | 2854 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
2849 | smk_ad_setfield_u_net_sk(&ad, other->sk); | 2855 | smk_ad_setfield_u_net_sk(&ad, other->sk); |
2856 | #endif | ||
2850 | 2857 | ||
2851 | if (!capable(CAP_MAC_OVERRIDE)) | 2858 | if (!capable(CAP_MAC_OVERRIDE)) |
2852 | rc = smk_access(ssp->smk_out, osp->smk_in, MAY_WRITE, &ad); | 2859 | rc = smk_access(ssp->smk_out, osp->smk_in, MAY_WRITE, &ad); |
@@ -2993,7 +3000,9 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
2993 | char *csp; | 3000 | char *csp; |
2994 | int rc; | 3001 | int rc; |
2995 | struct smk_audit_info ad; | 3002 | struct smk_audit_info ad; |
3003 | #ifdef CONFIG_AUDIT | ||
2996 | struct lsm_network_audit net; | 3004 | struct lsm_network_audit net; |
3005 | #endif | ||
2997 | if (sk->sk_family != PF_INET && sk->sk_family != PF_INET6) | 3006 | if (sk->sk_family != PF_INET && sk->sk_family != PF_INET6) |
2998 | return 0; | 3007 | return 0; |
2999 | 3008 | ||
@@ -3156,7 +3165,9 @@ static int smack_inet_conn_request(struct sock *sk, struct sk_buff *skb, | |||
3156 | char *sp; | 3165 | char *sp; |
3157 | int rc; | 3166 | int rc; |
3158 | struct smk_audit_info ad; | 3167 | struct smk_audit_info ad; |
3168 | #ifdef CONFIG_AUDIT | ||
3159 | struct lsm_network_audit net; | 3169 | struct lsm_network_audit net; |
3170 | #endif | ||
3160 | 3171 | ||
3161 | /* handle mapped IPv4 packets arriving via IPv6 sockets */ | 3172 | /* handle mapped IPv4 packets arriving via IPv6 sockets */ |
3162 | if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP)) | 3173 | if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP)) |
@@ -3629,8 +3640,38 @@ struct security_operations smack_ops = { | |||
3629 | }; | 3640 | }; |
3630 | 3641 | ||
3631 | 3642 | ||
3632 | static __init void init_smack_know_list(void) | 3643 | static __init void init_smack_known_list(void) |
3633 | { | 3644 | { |
3645 | /* | ||
3646 | * Initialize CIPSO locks | ||
3647 | */ | ||
3648 | spin_lock_init(&smack_known_huh.smk_cipsolock); | ||
3649 | spin_lock_init(&smack_known_hat.smk_cipsolock); | ||
3650 | spin_lock_init(&smack_known_star.smk_cipsolock); | ||
3651 | spin_lock_init(&smack_known_floor.smk_cipsolock); | ||
3652 | spin_lock_init(&smack_known_invalid.smk_cipsolock); | ||
3653 | spin_lock_init(&smack_known_web.smk_cipsolock); | ||
3654 | /* | ||
3655 | * Initialize rule list locks | ||
3656 | */ | ||
3657 | mutex_init(&smack_known_huh.smk_rules_lock); | ||
3658 | mutex_init(&smack_known_hat.smk_rules_lock); | ||
3659 | mutex_init(&smack_known_floor.smk_rules_lock); | ||
3660 | mutex_init(&smack_known_star.smk_rules_lock); | ||
3661 | mutex_init(&smack_known_invalid.smk_rules_lock); | ||
3662 | mutex_init(&smack_known_web.smk_rules_lock); | ||
3663 | /* | ||
3664 | * Initialize rule lists | ||
3665 | */ | ||
3666 | INIT_LIST_HEAD(&smack_known_huh.smk_rules); | ||
3667 | INIT_LIST_HEAD(&smack_known_hat.smk_rules); | ||
3668 | INIT_LIST_HEAD(&smack_known_star.smk_rules); | ||
3669 | INIT_LIST_HEAD(&smack_known_floor.smk_rules); | ||
3670 | INIT_LIST_HEAD(&smack_known_invalid.smk_rules); | ||
3671 | INIT_LIST_HEAD(&smack_known_web.smk_rules); | ||
3672 | /* | ||
3673 | * Create the known labels list | ||
3674 | */ | ||
3634 | list_add(&smack_known_huh.list, &smack_known_list); | 3675 | list_add(&smack_known_huh.list, &smack_known_list); |
3635 | list_add(&smack_known_hat.list, &smack_known_list); | 3676 | list_add(&smack_known_hat.list, &smack_known_list); |
3636 | list_add(&smack_known_star.list, &smack_known_list); | 3677 | list_add(&smack_known_star.list, &smack_known_list); |
@@ -3665,16 +3706,8 @@ static __init int smack_init(void) | |||
3665 | cred = (struct cred *) current->cred; | 3706 | cred = (struct cred *) current->cred; |
3666 | cred->security = tsp; | 3707 | cred->security = tsp; |
3667 | 3708 | ||
3668 | /* initialize the smack_know_list */ | 3709 | /* initialize the smack_known_list */ |
3669 | init_smack_know_list(); | 3710 | init_smack_known_list(); |
3670 | /* | ||
3671 | * Initialize locks | ||
3672 | */ | ||
3673 | spin_lock_init(&smack_known_huh.smk_cipsolock); | ||
3674 | spin_lock_init(&smack_known_hat.smk_cipsolock); | ||
3675 | spin_lock_init(&smack_known_star.smk_cipsolock); | ||
3676 | spin_lock_init(&smack_known_floor.smk_cipsolock); | ||
3677 | spin_lock_init(&smack_known_invalid.smk_cipsolock); | ||
3678 | 3711 | ||
3679 | /* | 3712 | /* |
3680 | * Register with LSM | 3713 | * Register with LSM |
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 5c32f36ff706..038811cb7e62 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
@@ -1614,20 +1614,6 @@ static int __init init_smk_fs(void) | |||
1614 | smk_cipso_doi(); | 1614 | smk_cipso_doi(); |
1615 | smk_unlbl_ambient(NULL); | 1615 | smk_unlbl_ambient(NULL); |
1616 | 1616 | ||
1617 | mutex_init(&smack_known_floor.smk_rules_lock); | ||
1618 | mutex_init(&smack_known_hat.smk_rules_lock); | ||
1619 | mutex_init(&smack_known_huh.smk_rules_lock); | ||
1620 | mutex_init(&smack_known_invalid.smk_rules_lock); | ||
1621 | mutex_init(&smack_known_star.smk_rules_lock); | ||
1622 | mutex_init(&smack_known_web.smk_rules_lock); | ||
1623 | |||
1624 | INIT_LIST_HEAD(&smack_known_floor.smk_rules); | ||
1625 | INIT_LIST_HEAD(&smack_known_hat.smk_rules); | ||
1626 | INIT_LIST_HEAD(&smack_known_huh.smk_rules); | ||
1627 | INIT_LIST_HEAD(&smack_known_invalid.smk_rules); | ||
1628 | INIT_LIST_HEAD(&smack_known_star.smk_rules); | ||
1629 | INIT_LIST_HEAD(&smack_known_web.smk_rules); | ||
1630 | |||
1631 | return err; | 1617 | return err; |
1632 | } | 1618 | } |
1633 | 1619 | ||
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 14a286a7bf2b..857586135d18 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c | |||
@@ -419,6 +419,7 @@ EXPORT_SYMBOL(snd_ctl_make_virtual_master); | |||
419 | * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control | 419 | * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control |
420 | * @kcontrol: vmaster kctl element | 420 | * @kcontrol: vmaster kctl element |
421 | * @hook: the hook function | 421 | * @hook: the hook function |
422 | * @private_data: the private_data pointer to be saved | ||
422 | * | 423 | * |
423 | * Adds the given hook to the vmaster control element so that it's called | 424 | * Adds the given hook to the vmaster control element so that it's called |
424 | * at each time when the value is changed. | 425 | * at each time when the value is changed. |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index b4a6aa960f4b..8490f59709bb 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -1019,13 +1019,15 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1019 | irq_cfg = get_irq_config(sscape->type, irq[dev]); | 1019 | irq_cfg = get_irq_config(sscape->type, irq[dev]); |
1020 | if (irq_cfg == INVALID_IRQ) { | 1020 | if (irq_cfg == INVALID_IRQ) { |
1021 | snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", irq[dev]); | 1021 | snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", irq[dev]); |
1022 | return -ENXIO; | 1022 | err = -ENXIO; |
1023 | goto _release_dma; | ||
1023 | } | 1024 | } |
1024 | 1025 | ||
1025 | mpu_irq_cfg = get_irq_config(sscape->type, mpu_irq[dev]); | 1026 | mpu_irq_cfg = get_irq_config(sscape->type, mpu_irq[dev]); |
1026 | if (mpu_irq_cfg == INVALID_IRQ) { | 1027 | if (mpu_irq_cfg == INVALID_IRQ) { |
1027 | snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); | 1028 | snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); |
1028 | return -ENXIO; | 1029 | err = -ENXIO; |
1030 | goto _release_dma; | ||
1029 | } | 1031 | } |
1030 | 1032 | ||
1031 | /* | 1033 | /* |
diff --git a/sound/last.c b/sound/last.c index bdd0857b8871..7ffc182e0844 100644 --- a/sound/last.c +++ b/sound/last.c | |||
@@ -38,4 +38,4 @@ static int __init alsa_sound_last_init(void) | |||
38 | return 0; | 38 | return 0; |
39 | } | 39 | } |
40 | 40 | ||
41 | __initcall(alsa_sound_last_init); | 41 | late_initcall_sync(alsa_sound_last_init); |
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index 2c79d60a725f..536c4c0514d3 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c | |||
@@ -1294,6 +1294,8 @@ static int __init calibrate_adc(WORD srate) | |||
1294 | 1294 | ||
1295 | static int upload_dsp_code(void) | 1295 | static int upload_dsp_code(void) |
1296 | { | 1296 | { |
1297 | int ret = 0; | ||
1298 | |||
1297 | msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS); | 1299 | msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS); |
1298 | #ifndef HAVE_DSPCODEH | 1300 | #ifndef HAVE_DSPCODEH |
1299 | INITCODESIZE = mod_firmware_load(INITCODEFILE, &INITCODE); | 1301 | INITCODESIZE = mod_firmware_load(INITCODEFILE, &INITCODE); |
@@ -1312,7 +1314,8 @@ static int upload_dsp_code(void) | |||
1312 | memcpy_toio(dev.base, PERMCODE, PERMCODESIZE); | 1314 | memcpy_toio(dev.base, PERMCODE, PERMCODESIZE); |
1313 | if (msnd_upload_host(&dev, INITCODE, INITCODESIZE) < 0) { | 1315 | if (msnd_upload_host(&dev, INITCODE, INITCODESIZE) < 0) { |
1314 | printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n"); | 1316 | printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n"); |
1315 | return -ENODEV; | 1317 | ret = -ENODEV; |
1318 | goto out; | ||
1316 | } | 1319 | } |
1317 | #ifdef HAVE_DSPCODEH | 1320 | #ifdef HAVE_DSPCODEH |
1318 | printk(KERN_INFO LOGNAME ": DSP firmware uploaded (resident)\n"); | 1321 | printk(KERN_INFO LOGNAME ": DSP firmware uploaded (resident)\n"); |
@@ -1320,12 +1323,13 @@ static int upload_dsp_code(void) | |||
1320 | printk(KERN_INFO LOGNAME ": DSP firmware uploaded\n"); | 1323 | printk(KERN_INFO LOGNAME ": DSP firmware uploaded\n"); |
1321 | #endif | 1324 | #endif |
1322 | 1325 | ||
1326 | out: | ||
1323 | #ifndef HAVE_DSPCODEH | 1327 | #ifndef HAVE_DSPCODEH |
1324 | vfree(INITCODE); | 1328 | vfree(INITCODE); |
1325 | vfree(PERMCODE); | 1329 | vfree(PERMCODE); |
1326 | #endif | 1330 | #endif |
1327 | 1331 | ||
1328 | return 0; | 1332 | return ret; |
1329 | } | 1333 | } |
1330 | 1334 | ||
1331 | #ifdef MSND_CLASSIC | 1335 | #ifdef MSND_CLASSIC |
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 88168044375f..5ca0939e4223 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | config SND_TEA575X | 3 | config SND_TEA575X |
4 | tristate | 4 | tristate |
5 | depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 | 5 | depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 || RADIO_MAXIRADIO |
6 | default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 | 6 | default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO |
7 | 7 | ||
8 | menuconfig SND_PCI | 8 | menuconfig SND_PCI |
9 | bool "PCI sound devices" | 9 | bool "PCI sound devices" |
diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index 8c63200cf339..bc86cb726d79 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | AudioScience HPI driver | 3 | AudioScience HPI driver |
4 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> | 4 | Copyright (C) 1997-2012 AudioScience Inc. <support@audioscience.com> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of version 2 of the GNU General Public License as | 7 | it under the terms of version 2 of the GNU General Public License as |
@@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned. | |||
42 | If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and | 42 | If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and |
43 | HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle. | 43 | HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle. |
44 | */ | 44 | */ |
45 | int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle, | 45 | u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle, |
46 | /**< memory handle */ | 46 | /**< memory handle */ |
47 | u32 size, /**< Size in bytes to allocate */ | 47 | u32 size, /**< Size in bytes to allocate */ |
48 | struct pci_dev *p_os_reference | 48 | struct pci_dev *p_os_reference |
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c index 87f4385fe8c7..5ef4fe964366 100644 --- a/sound/pci/asihpi/hpios.c +++ b/sound/pci/asihpi/hpios.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | AudioScience HPI driver | 3 | AudioScience HPI driver |
4 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> | 4 | Copyright (C) 1997-2012 AudioScience Inc. <support@audioscience.com> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of version 2 of the GNU General Public License as | 7 | it under the terms of version 2 of the GNU General Public License as |
@@ -39,11 +39,11 @@ void hpios_delay_micro_seconds(u32 num_micro_sec) | |||
39 | 39 | ||
40 | } | 40 | } |
41 | 41 | ||
42 | /** Allocated an area of locked memory for bus master DMA operations. | 42 | /** Allocate an area of locked memory for bus master DMA operations. |
43 | 43 | ||
44 | On error, return -ENOMEM, and *pMemArea.size = 0 | 44 | If allocation fails, return 1, and *pMemArea.size = 0 |
45 | */ | 45 | */ |
46 | int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size, | 46 | u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size, |
47 | struct pci_dev *pdev) | 47 | struct pci_dev *pdev) |
48 | { | 48 | { |
49 | /*?? any benefit in using managed dmam_alloc_coherent? */ | 49 | /*?? any benefit in using managed dmam_alloc_coherent? */ |
@@ -62,7 +62,7 @@ int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size, | |||
62 | HPI_DEBUG_LOG(WARNING, | 62 | HPI_DEBUG_LOG(WARNING, |
63 | "failed to allocate %d bytes locked memory\n", size); | 63 | "failed to allocate %d bytes locked memory\n", size); |
64 | p_mem_area->size = 0; | 64 | p_mem_area->size = 0; |
65 | return -ENOMEM; | 65 | return 1; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 9a9f372e1be4..56b4f74c0b13 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -851,6 +851,9 @@ struct hda_codec { | |||
851 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index | 851 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index |
852 | * (e.g. Conexant codecs) | 852 | * (e.g. Conexant codecs) |
853 | */ | 853 | */ |
854 | unsigned int single_adc_amp:1; /* adc in-amp takes no index | ||
855 | * (e.g. CX20549 codec) | ||
856 | */ | ||
854 | unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ | 857 | unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ |
855 | unsigned int pins_shutup:1; /* pins are shut up */ | 858 | unsigned int pins_shutup:1; /* pins are shut up */ |
856 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ | 859 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ |
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index b58b4b1687fa..4c054f4486b9 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -418,7 +418,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a) | |||
418 | else | 418 | else |
419 | buf2[0] = '\0'; | 419 | buf2[0] = '\0'; |
420 | 420 | ||
421 | printk(KERN_INFO "HDMI: supports coding type %s:" | 421 | _snd_printd(SND_PR_VERBOSE, "HDMI: supports coding type %s:" |
422 | " channels = %d, rates =%s%s\n", | 422 | " channels = %d, rates =%s%s\n", |
423 | cea_audio_coding_type_names[a->format], | 423 | cea_audio_coding_type_names[a->format], |
424 | a->channels, | 424 | a->channels, |
@@ -442,14 +442,14 @@ void snd_hdmi_show_eld(struct hdmi_eld *e) | |||
442 | { | 442 | { |
443 | int i; | 443 | int i; |
444 | 444 | ||
445 | printk(KERN_INFO "HDMI: detected monitor %s at connection type %s\n", | 445 | _snd_printd(SND_PR_VERBOSE, "HDMI: detected monitor %s at connection type %s\n", |
446 | e->monitor_name, | 446 | e->monitor_name, |
447 | eld_connection_type_names[e->conn_type]); | 447 | eld_connection_type_names[e->conn_type]); |
448 | 448 | ||
449 | if (e->spk_alloc) { | 449 | if (e->spk_alloc) { |
450 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; | 450 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; |
451 | snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf)); | 451 | snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf)); |
452 | printk(KERN_INFO "HDMI: available speakers:%s\n", buf); | 452 | _snd_printd(SND_PR_VERBOSE, "HDMI: available speakers:%s\n", buf); |
453 | } | 453 | } |
454 | 454 | ||
455 | for (i = 0; i < e->sad_count; i++) | 455 | for (i = 0; i < e->sad_count; i++) |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 254ab5204603..e59e2f059b6e 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -651,9 +651,16 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
651 | snd_iprintf(buffer, " Amp-In caps: "); | 651 | snd_iprintf(buffer, " Amp-In caps: "); |
652 | print_amp_caps(buffer, codec, nid, HDA_INPUT); | 652 | print_amp_caps(buffer, codec, nid, HDA_INPUT); |
653 | snd_iprintf(buffer, " Amp-In vals: "); | 653 | snd_iprintf(buffer, " Amp-In vals: "); |
654 | print_amp_vals(buffer, codec, nid, HDA_INPUT, | 654 | if (wid_type == AC_WID_PIN || |
655 | wid_caps & AC_WCAP_STEREO, | 655 | (codec->single_adc_amp && |
656 | wid_type == AC_WID_PIN ? 1 : conn_len); | 656 | wid_type == AC_WID_AUD_IN)) |
657 | print_amp_vals(buffer, codec, nid, HDA_INPUT, | ||
658 | wid_caps & AC_WCAP_STEREO, | ||
659 | 1); | ||
660 | else | ||
661 | print_amp_vals(buffer, codec, nid, HDA_INPUT, | ||
662 | wid_caps & AC_WCAP_STEREO, | ||
663 | conn_len); | ||
657 | } | 664 | } |
658 | if (wid_caps & AC_WCAP_OUT_AMP) { | 665 | if (wid_caps & AC_WCAP_OUT_AMP) { |
659 | snd_iprintf(buffer, " Amp-Out caps: "); | 666 | snd_iprintf(buffer, " Amp-Out caps: "); |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 8c6523bbc797..d906c5b74cf0 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -141,7 +141,6 @@ struct conexant_spec { | |||
141 | unsigned int hp_laptop:1; | 141 | unsigned int hp_laptop:1; |
142 | unsigned int asus:1; | 142 | unsigned int asus:1; |
143 | unsigned int pin_eapd_ctrls:1; | 143 | unsigned int pin_eapd_ctrls:1; |
144 | unsigned int single_adc_amp:1; | ||
145 | 144 | ||
146 | unsigned int adc_switching:1; | 145 | unsigned int adc_switching:1; |
147 | 146 | ||
@@ -687,27 +686,26 @@ static const struct hda_channel_mode cxt5045_modes[1] = { | |||
687 | static const struct hda_input_mux cxt5045_capture_source = { | 686 | static const struct hda_input_mux cxt5045_capture_source = { |
688 | .num_items = 2, | 687 | .num_items = 2, |
689 | .items = { | 688 | .items = { |
690 | { "IntMic", 0x1 }, | 689 | { "Internal Mic", 0x1 }, |
691 | { "ExtMic", 0x2 }, | 690 | { "Mic", 0x2 }, |
692 | } | 691 | } |
693 | }; | 692 | }; |
694 | 693 | ||
695 | static const struct hda_input_mux cxt5045_capture_source_benq = { | 694 | static const struct hda_input_mux cxt5045_capture_source_benq = { |
696 | .num_items = 5, | 695 | .num_items = 4, |
697 | .items = { | 696 | .items = { |
698 | { "IntMic", 0x1 }, | 697 | { "Internal Mic", 0x1 }, |
699 | { "ExtMic", 0x2 }, | 698 | { "Mic", 0x2 }, |
700 | { "LineIn", 0x3 }, | 699 | { "Line", 0x3 }, |
701 | { "CD", 0x4 }, | 700 | { "Mixer", 0x0 }, |
702 | { "Mixer", 0x0 }, | ||
703 | } | 701 | } |
704 | }; | 702 | }; |
705 | 703 | ||
706 | static const struct hda_input_mux cxt5045_capture_source_hp530 = { | 704 | static const struct hda_input_mux cxt5045_capture_source_hp530 = { |
707 | .num_items = 2, | 705 | .num_items = 2, |
708 | .items = { | 706 | .items = { |
709 | { "ExtMic", 0x1 }, | 707 | { "Mic", 0x1 }, |
710 | { "IntMic", 0x2 }, | 708 | { "Internal Mic", 0x2 }, |
711 | } | 709 | } |
712 | }; | 710 | }; |
713 | 711 | ||
@@ -798,10 +796,8 @@ static void cxt5045_hp_unsol_event(struct hda_codec *codec, | |||
798 | } | 796 | } |
799 | 797 | ||
800 | static const struct snd_kcontrol_new cxt5045_mixers[] = { | 798 | static const struct snd_kcontrol_new cxt5045_mixers[] = { |
801 | HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), | 799 | HDA_CODEC_VOLUME("Capture Volume", 0x1a, 0x00, HDA_INPUT), |
802 | HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), | 800 | HDA_CODEC_MUTE("Capture Switch", 0x1a, 0x0, HDA_INPUT), |
803 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), | ||
804 | HDA_CODEC_MUTE("Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), | ||
805 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT), | 801 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT), |
806 | HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT), | 802 | HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT), |
807 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x1, HDA_INPUT), | 803 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x1, HDA_INPUT), |
@@ -822,27 +818,15 @@ static const struct snd_kcontrol_new cxt5045_mixers[] = { | |||
822 | }; | 818 | }; |
823 | 819 | ||
824 | static const struct snd_kcontrol_new cxt5045_benq_mixers[] = { | 820 | static const struct snd_kcontrol_new cxt5045_benq_mixers[] = { |
825 | HDA_CODEC_VOLUME("CD Capture Volume", 0x1a, 0x04, HDA_INPUT), | 821 | HDA_CODEC_VOLUME("Line Playback Volume", 0x17, 0x3, HDA_INPUT), |
826 | HDA_CODEC_MUTE("CD Capture Switch", 0x1a, 0x04, HDA_INPUT), | 822 | HDA_CODEC_MUTE("Line Playback Switch", 0x17, 0x3, HDA_INPUT), |
827 | HDA_CODEC_VOLUME("CD Playback Volume", 0x17, 0x4, HDA_INPUT), | ||
828 | HDA_CODEC_MUTE("CD Playback Switch", 0x17, 0x4, HDA_INPUT), | ||
829 | |||
830 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1a, 0x03, HDA_INPUT), | ||
831 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1a, 0x03, HDA_INPUT), | ||
832 | HDA_CODEC_VOLUME("Line In Playback Volume", 0x17, 0x3, HDA_INPUT), | ||
833 | HDA_CODEC_MUTE("Line In Playback Switch", 0x17, 0x3, HDA_INPUT), | ||
834 | |||
835 | HDA_CODEC_VOLUME("Mixer Capture Volume", 0x1a, 0x0, HDA_INPUT), | ||
836 | HDA_CODEC_MUTE("Mixer Capture Switch", 0x1a, 0x0, HDA_INPUT), | ||
837 | 823 | ||
838 | {} | 824 | {} |
839 | }; | 825 | }; |
840 | 826 | ||
841 | static const struct snd_kcontrol_new cxt5045_mixers_hp530[] = { | 827 | static const struct snd_kcontrol_new cxt5045_mixers_hp530[] = { |
842 | HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), | 828 | HDA_CODEC_VOLUME("Capture Volume", 0x1a, 0x00, HDA_INPUT), |
843 | HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), | 829 | HDA_CODEC_MUTE("Capture Switch", 0x1a, 0x0, HDA_INPUT), |
844 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), | ||
845 | HDA_CODEC_MUTE("Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), | ||
846 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT), | 830 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT), |
847 | HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT), | 831 | HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT), |
848 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x2, HDA_INPUT), | 832 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x2, HDA_INPUT), |
@@ -946,10 +930,10 @@ static const struct snd_kcontrol_new cxt5045_test_mixer[] = { | |||
946 | /* Output controls */ | 930 | /* Output controls */ |
947 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x10, 0x0, HDA_OUTPUT), | 931 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x10, 0x0, HDA_OUTPUT), |
948 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x10, 0x0, HDA_OUTPUT), | 932 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
949 | HDA_CODEC_VOLUME("Node 11 Playback Volume", 0x11, 0x0, HDA_OUTPUT), | 933 | HDA_CODEC_VOLUME("HP-OUT Playback Volume", 0x11, 0x0, HDA_OUTPUT), |
950 | HDA_CODEC_MUTE("Node 11 Playback Switch", 0x11, 0x0, HDA_OUTPUT), | 934 | HDA_CODEC_MUTE("HP-OUT Playback Switch", 0x11, 0x0, HDA_OUTPUT), |
951 | HDA_CODEC_VOLUME("Node 12 Playback Volume", 0x12, 0x0, HDA_OUTPUT), | 935 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x12, 0x0, HDA_OUTPUT), |
952 | HDA_CODEC_MUTE("Node 12 Playback Switch", 0x12, 0x0, HDA_OUTPUT), | 936 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x12, 0x0, HDA_OUTPUT), |
953 | 937 | ||
954 | /* Modes for retasking pin widgets */ | 938 | /* Modes for retasking pin widgets */ |
955 | CXT_PIN_MODE("HP-OUT pin mode", 0x11, CXT_PIN_DIR_INOUT), | 939 | CXT_PIN_MODE("HP-OUT pin mode", 0x11, CXT_PIN_DIR_INOUT), |
@@ -960,16 +944,16 @@ static const struct snd_kcontrol_new cxt5045_test_mixer[] = { | |||
960 | 944 | ||
961 | /* Loopback mixer controls */ | 945 | /* Loopback mixer controls */ |
962 | 946 | ||
963 | HDA_CODEC_VOLUME("Mixer-1 Volume", 0x17, 0x0, HDA_INPUT), | 947 | HDA_CODEC_VOLUME("PCM Volume", 0x17, 0x0, HDA_INPUT), |
964 | HDA_CODEC_MUTE("Mixer-1 Switch", 0x17, 0x0, HDA_INPUT), | 948 | HDA_CODEC_MUTE("PCM Switch", 0x17, 0x0, HDA_INPUT), |
965 | HDA_CODEC_VOLUME("Mixer-2 Volume", 0x17, 0x1, HDA_INPUT), | 949 | HDA_CODEC_VOLUME("MIC1 pin Volume", 0x17, 0x1, HDA_INPUT), |
966 | HDA_CODEC_MUTE("Mixer-2 Switch", 0x17, 0x1, HDA_INPUT), | 950 | HDA_CODEC_MUTE("MIC1 pin Switch", 0x17, 0x1, HDA_INPUT), |
967 | HDA_CODEC_VOLUME("Mixer-3 Volume", 0x17, 0x2, HDA_INPUT), | 951 | HDA_CODEC_VOLUME("LINE1 pin Volume", 0x17, 0x2, HDA_INPUT), |
968 | HDA_CODEC_MUTE("Mixer-3 Switch", 0x17, 0x2, HDA_INPUT), | 952 | HDA_CODEC_MUTE("LINE1 pin Switch", 0x17, 0x2, HDA_INPUT), |
969 | HDA_CODEC_VOLUME("Mixer-4 Volume", 0x17, 0x3, HDA_INPUT), | 953 | HDA_CODEC_VOLUME("HP-OUT pin Volume", 0x17, 0x3, HDA_INPUT), |
970 | HDA_CODEC_MUTE("Mixer-4 Switch", 0x17, 0x3, HDA_INPUT), | 954 | HDA_CODEC_MUTE("HP-OUT pin Switch", 0x17, 0x3, HDA_INPUT), |
971 | HDA_CODEC_VOLUME("Mixer-5 Volume", 0x17, 0x4, HDA_INPUT), | 955 | HDA_CODEC_VOLUME("CD pin Volume", 0x17, 0x4, HDA_INPUT), |
972 | HDA_CODEC_MUTE("Mixer-5 Switch", 0x17, 0x4, HDA_INPUT), | 956 | HDA_CODEC_MUTE("CD pin Switch", 0x17, 0x4, HDA_INPUT), |
973 | { | 957 | { |
974 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 958 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
975 | .name = "Input Source", | 959 | .name = "Input Source", |
@@ -978,16 +962,8 @@ static const struct snd_kcontrol_new cxt5045_test_mixer[] = { | |||
978 | .put = conexant_mux_enum_put, | 962 | .put = conexant_mux_enum_put, |
979 | }, | 963 | }, |
980 | /* Audio input controls */ | 964 | /* Audio input controls */ |
981 | HDA_CODEC_VOLUME("Input-1 Volume", 0x1a, 0x0, HDA_INPUT), | 965 | HDA_CODEC_VOLUME("Capture Volume", 0x1a, 0x0, HDA_INPUT), |
982 | HDA_CODEC_MUTE("Input-1 Switch", 0x1a, 0x0, HDA_INPUT), | 966 | HDA_CODEC_MUTE("Capture Switch", 0x1a, 0x0, HDA_INPUT), |
983 | HDA_CODEC_VOLUME("Input-2 Volume", 0x1a, 0x1, HDA_INPUT), | ||
984 | HDA_CODEC_MUTE("Input-2 Switch", 0x1a, 0x1, HDA_INPUT), | ||
985 | HDA_CODEC_VOLUME("Input-3 Volume", 0x1a, 0x2, HDA_INPUT), | ||
986 | HDA_CODEC_MUTE("Input-3 Switch", 0x1a, 0x2, HDA_INPUT), | ||
987 | HDA_CODEC_VOLUME("Input-4 Volume", 0x1a, 0x3, HDA_INPUT), | ||
988 | HDA_CODEC_MUTE("Input-4 Switch", 0x1a, 0x3, HDA_INPUT), | ||
989 | HDA_CODEC_VOLUME("Input-5 Volume", 0x1a, 0x4, HDA_INPUT), | ||
990 | HDA_CODEC_MUTE("Input-5 Switch", 0x1a, 0x4, HDA_INPUT), | ||
991 | { } /* end */ | 967 | { } /* end */ |
992 | }; | 968 | }; |
993 | 969 | ||
@@ -1009,10 +985,6 @@ static const struct hda_verb cxt5045_test_init_verbs[] = { | |||
1009 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 985 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1010 | {0x18, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 986 | {0x18, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
1011 | 987 | ||
1012 | /* Start with output sum widgets muted and their output gains at min */ | ||
1013 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
1014 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
1015 | |||
1016 | /* Unmute retasking pin widget output buffers since the default | 988 | /* Unmute retasking pin widget output buffers since the default |
1017 | * state appears to be output. As the pin mode is changed by the | 989 | * state appears to be output. As the pin mode is changed by the |
1018 | * user the pin mode control will take care of enabling the pin's | 990 | * user the pin mode control will take care of enabling the pin's |
@@ -1027,11 +999,11 @@ static const struct hda_verb cxt5045_test_init_verbs[] = { | |||
1027 | /* Set ADC connection select to match default mixer setting (mic1 | 999 | /* Set ADC connection select to match default mixer setting (mic1 |
1028 | * pin) | 1000 | * pin) |
1029 | */ | 1001 | */ |
1030 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | 1002 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
1031 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | 1003 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x01}, |
1032 | 1004 | ||
1033 | /* Mute all inputs to mixer widget (even unconnected ones) */ | 1005 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
1034 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* Mixer pin */ | 1006 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* Mixer */ |
1035 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* Mic1 pin */ | 1007 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* Mic1 pin */ |
1036 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* Line pin */ | 1008 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* Line pin */ |
1037 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* HP pin */ | 1009 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* HP pin */ |
@@ -1110,7 +1082,7 @@ static int patch_cxt5045(struct hda_codec *codec) | |||
1110 | if (!spec) | 1082 | if (!spec) |
1111 | return -ENOMEM; | 1083 | return -ENOMEM; |
1112 | codec->spec = spec; | 1084 | codec->spec = spec; |
1113 | codec->pin_amp_workaround = 1; | 1085 | codec->single_adc_amp = 1; |
1114 | 1086 | ||
1115 | spec->multiout.max_channels = 2; | 1087 | spec->multiout.max_channels = 2; |
1116 | spec->multiout.num_dacs = ARRAY_SIZE(cxt5045_dac_nids); | 1088 | spec->multiout.num_dacs = ARRAY_SIZE(cxt5045_dac_nids); |
@@ -3999,9 +3971,14 @@ static void cx_auto_init_output(struct hda_codec *codec) | |||
3999 | int i; | 3971 | int i; |
4000 | 3972 | ||
4001 | mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids); | 3973 | mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids); |
4002 | for (i = 0; i < cfg->hp_outs; i++) | 3974 | for (i = 0; i < cfg->hp_outs; i++) { |
3975 | unsigned int val = PIN_OUT; | ||
3976 | if (snd_hda_query_pin_caps(codec, cfg->hp_pins[i]) & | ||
3977 | AC_PINCAP_HP_DRV) | ||
3978 | val |= AC_PINCTL_HP_EN; | ||
4003 | snd_hda_codec_write(codec, cfg->hp_pins[i], 0, | 3979 | snd_hda_codec_write(codec, cfg->hp_pins[i], 0, |
4004 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); | 3980 | AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
3981 | } | ||
4005 | mute_outputs(codec, cfg->hp_outs, cfg->hp_pins); | 3982 | mute_outputs(codec, cfg->hp_outs, cfg->hp_pins); |
4006 | mute_outputs(codec, cfg->line_outs, cfg->line_out_pins); | 3983 | mute_outputs(codec, cfg->line_outs, cfg->line_out_pins); |
4007 | mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins); | 3984 | mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins); |
@@ -4220,7 +4197,7 @@ static int cx_auto_add_capture_volume(struct hda_codec *codec, hda_nid_t nid, | |||
4220 | int idx = get_input_connection(codec, adc_nid, nid); | 4197 | int idx = get_input_connection(codec, adc_nid, nid); |
4221 | if (idx < 0) | 4198 | if (idx < 0) |
4222 | continue; | 4199 | continue; |
4223 | if (spec->single_adc_amp) | 4200 | if (codec->single_adc_amp) |
4224 | idx = 0; | 4201 | idx = 0; |
4225 | return cx_auto_add_volume_idx(codec, label, pfx, | 4202 | return cx_auto_add_volume_idx(codec, label, pfx, |
4226 | cidx, adc_nid, HDA_INPUT, idx); | 4203 | cidx, adc_nid, HDA_INPUT, idx); |
@@ -4275,7 +4252,7 @@ static int cx_auto_build_input_controls(struct hda_codec *codec) | |||
4275 | if (cidx < 0) | 4252 | if (cidx < 0) |
4276 | continue; | 4253 | continue; |
4277 | input_conn[i] = spec->imux_info[i].adc; | 4254 | input_conn[i] = spec->imux_info[i].adc; |
4278 | if (!spec->single_adc_amp) | 4255 | if (!codec->single_adc_amp) |
4279 | input_conn[i] |= cidx << 8; | 4256 | input_conn[i] |= cidx << 8; |
4280 | if (i > 0 && input_conn[i] != input_conn[0]) | 4257 | if (i > 0 && input_conn[i] != input_conn[0]) |
4281 | multi_connection = 1; | 4258 | multi_connection = 1; |
@@ -4419,8 +4396,10 @@ static void apply_pin_fixup(struct hda_codec *codec, | |||
4419 | 4396 | ||
4420 | enum { | 4397 | enum { |
4421 | CXT_PINCFG_LENOVO_X200, | 4398 | CXT_PINCFG_LENOVO_X200, |
4399 | CXT_PINCFG_LENOVO_TP410, | ||
4422 | }; | 4400 | }; |
4423 | 4401 | ||
4402 | /* ThinkPad X200 & co with cxt5051 */ | ||
4424 | static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { | 4403 | static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { |
4425 | { 0x16, 0x042140ff }, /* HP (seq# overridden) */ | 4404 | { 0x16, 0x042140ff }, /* HP (seq# overridden) */ |
4426 | { 0x17, 0x21a11000 }, /* dock-mic */ | 4405 | { 0x17, 0x21a11000 }, /* dock-mic */ |
@@ -4429,15 +4408,33 @@ static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { | |||
4429 | {} | 4408 | {} |
4430 | }; | 4409 | }; |
4431 | 4410 | ||
4411 | /* ThinkPad 410/420/510/520, X201 & co with cxt5066 */ | ||
4412 | static const struct cxt_pincfg cxt_pincfg_lenovo_tp410[] = { | ||
4413 | { 0x19, 0x042110ff }, /* HP (seq# overridden) */ | ||
4414 | { 0x1a, 0x21a190f0 }, /* dock-mic */ | ||
4415 | { 0x1c, 0x212140ff }, /* dock-HP */ | ||
4416 | {} | ||
4417 | }; | ||
4418 | |||
4432 | static const struct cxt_pincfg *cxt_pincfg_tbl[] = { | 4419 | static const struct cxt_pincfg *cxt_pincfg_tbl[] = { |
4433 | [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200, | 4420 | [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200, |
4421 | [CXT_PINCFG_LENOVO_TP410] = cxt_pincfg_lenovo_tp410, | ||
4434 | }; | 4422 | }; |
4435 | 4423 | ||
4436 | static const struct snd_pci_quirk cxt_fixups[] = { | 4424 | static const struct snd_pci_quirk cxt5051_fixups[] = { |
4437 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), | 4425 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), |
4438 | {} | 4426 | {} |
4439 | }; | 4427 | }; |
4440 | 4428 | ||
4429 | static const struct snd_pci_quirk cxt5066_fixups[] = { | ||
4430 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), | ||
4431 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410), | ||
4432 | SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410), | ||
4433 | SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), | ||
4434 | SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), | ||
4435 | {} | ||
4436 | }; | ||
4437 | |||
4441 | /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches | 4438 | /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches |
4442 | * can be created (bko#42825) | 4439 | * can be created (bko#42825) |
4443 | */ | 4440 | */ |
@@ -4466,19 +4463,21 @@ static int patch_conexant_auto(struct hda_codec *codec) | |||
4466 | if (!spec) | 4463 | if (!spec) |
4467 | return -ENOMEM; | 4464 | return -ENOMEM; |
4468 | codec->spec = spec; | 4465 | codec->spec = spec; |
4469 | codec->pin_amp_workaround = 1; | ||
4470 | 4466 | ||
4471 | switch (codec->vendor_id) { | 4467 | switch (codec->vendor_id) { |
4472 | case 0x14f15045: | 4468 | case 0x14f15045: |
4473 | spec->single_adc_amp = 1; | 4469 | codec->single_adc_amp = 1; |
4474 | break; | 4470 | break; |
4475 | case 0x14f15051: | 4471 | case 0x14f15051: |
4476 | add_cx5051_fake_mutes(codec); | 4472 | add_cx5051_fake_mutes(codec); |
4473 | codec->pin_amp_workaround = 1; | ||
4474 | apply_pin_fixup(codec, cxt5051_fixups, cxt_pincfg_tbl); | ||
4477 | break; | 4475 | break; |
4476 | default: | ||
4477 | codec->pin_amp_workaround = 1; | ||
4478 | apply_pin_fixup(codec, cxt5066_fixups, cxt_pincfg_tbl); | ||
4478 | } | 4479 | } |
4479 | 4480 | ||
4480 | apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl); | ||
4481 | |||
4482 | /* Show mute-led control only on HP laptops | 4481 | /* Show mute-led control only on HP laptops |
4483 | * This is a sort of white-list: on HP laptops, EAPD corresponds | 4482 | * This is a sort of white-list: on HP laptops, EAPD corresponds |
4484 | * only to the mute-LED without actualy amp function. Meanwhile, | 4483 | * only to the mute-LED without actualy amp function. Meanwhile, |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 540cd13f7f15..83f345f3c961 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -757,8 +757,6 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
757 | struct hdmi_spec *spec = codec->spec; | 757 | struct hdmi_spec *spec = codec->spec; |
758 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | 758 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; |
759 | int pin_nid; | 759 | int pin_nid; |
760 | int pd = !!(res & AC_UNSOL_RES_PD); | ||
761 | int eldv = !!(res & AC_UNSOL_RES_ELDV); | ||
762 | int pin_idx; | 760 | int pin_idx; |
763 | struct hda_jack_tbl *jack; | 761 | struct hda_jack_tbl *jack; |
764 | 762 | ||
@@ -768,9 +766,10 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
768 | pin_nid = jack->nid; | 766 | pin_nid = jack->nid; |
769 | jack->jack_dirty = 1; | 767 | jack->jack_dirty = 1; |
770 | 768 | ||
771 | printk(KERN_INFO | 769 | _snd_printd(SND_PR_VERBOSE, |
772 | "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | 770 | "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", |
773 | codec->addr, pin_nid, pd, eldv); | 771 | codec->addr, pin_nid, |
772 | !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); | ||
774 | 773 | ||
775 | pin_idx = pin_nid_to_pin_index(spec, pin_nid); | 774 | pin_idx = pin_nid_to_pin_index(spec, pin_nid); |
776 | if (pin_idx < 0) | 775 | if (pin_idx < 0) |
@@ -992,7 +991,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) | |||
992 | if (eld->monitor_present) | 991 | if (eld->monitor_present) |
993 | eld_valid = !!(present & AC_PINSENSE_ELDV); | 992 | eld_valid = !!(present & AC_PINSENSE_ELDV); |
994 | 993 | ||
995 | printk(KERN_INFO | 994 | _snd_printd(SND_PR_VERBOSE, |
996 | "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | 995 | "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", |
997 | codec->addr, pin_nid, eld->monitor_present, eld_valid); | 996 | codec->addr, pin_nid, eld->monitor_present, eld_valid); |
998 | 997 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 9917e55d6f11..e65e35433055 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1445,6 +1445,13 @@ enum { | |||
1445 | ALC_FIXUP_ACT_BUILD, | 1445 | ALC_FIXUP_ACT_BUILD, |
1446 | }; | 1446 | }; |
1447 | 1447 | ||
1448 | static void alc_apply_pincfgs(struct hda_codec *codec, | ||
1449 | const struct alc_pincfg *cfg) | ||
1450 | { | ||
1451 | for (; cfg->nid; cfg++) | ||
1452 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | ||
1453 | } | ||
1454 | |||
1448 | static void alc_apply_fixup(struct hda_codec *codec, int action) | 1455 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
1449 | { | 1456 | { |
1450 | struct alc_spec *spec = codec->spec; | 1457 | struct alc_spec *spec = codec->spec; |
@@ -1478,9 +1485,7 @@ static void alc_apply_fixup(struct hda_codec *codec, int action) | |||
1478 | snd_printdd(KERN_INFO "hda_codec: %s: " | 1485 | snd_printdd(KERN_INFO "hda_codec: %s: " |
1479 | "Apply pincfg for %s\n", | 1486 | "Apply pincfg for %s\n", |
1480 | codec->chip_name, modelname); | 1487 | codec->chip_name, modelname); |
1481 | for (; cfg->nid; cfg++) | 1488 | alc_apply_pincfgs(codec, cfg); |
1482 | snd_hda_codec_set_pincfg(codec, cfg->nid, | ||
1483 | cfg->val); | ||
1484 | break; | 1489 | break; |
1485 | case ALC_FIXUP_VERBS: | 1490 | case ALC_FIXUP_VERBS: |
1486 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) | 1491 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
@@ -3398,8 +3403,10 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
3398 | for (;;) { | 3403 | for (;;) { |
3399 | badness = fill_and_eval_dacs(codec, fill_hardwired, | 3404 | badness = fill_and_eval_dacs(codec, fill_hardwired, |
3400 | fill_mio_first); | 3405 | fill_mio_first); |
3401 | if (badness < 0) | 3406 | if (badness < 0) { |
3407 | kfree(best_cfg); | ||
3402 | return badness; | 3408 | return badness; |
3409 | } | ||
3403 | debug_badness("==> lo_type=%d, wired=%d, mio=%d, badness=0x%x\n", | 3410 | debug_badness("==> lo_type=%d, wired=%d, mio=%d, badness=0x%x\n", |
3404 | cfg->line_out_type, fill_hardwired, fill_mio_first, | 3411 | cfg->line_out_type, fill_hardwired, fill_mio_first, |
3405 | badness); | 3412 | badness); |
@@ -3434,7 +3441,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
3434 | cfg->line_out_type = AUTO_PIN_SPEAKER_OUT; | 3441 | cfg->line_out_type = AUTO_PIN_SPEAKER_OUT; |
3435 | fill_hardwired = true; | 3442 | fill_hardwired = true; |
3436 | continue; | 3443 | continue; |
3437 | } | 3444 | } |
3438 | if (cfg->hp_outs > 0 && | 3445 | if (cfg->hp_outs > 0 && |
3439 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | 3446 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
3440 | cfg->speaker_outs = cfg->line_outs; | 3447 | cfg->speaker_outs = cfg->line_outs; |
@@ -3448,7 +3455,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
3448 | cfg->line_out_type = AUTO_PIN_HP_OUT; | 3455 | cfg->line_out_type = AUTO_PIN_HP_OUT; |
3449 | fill_hardwired = true; | 3456 | fill_hardwired = true; |
3450 | continue; | 3457 | continue; |
3451 | } | 3458 | } |
3452 | break; | 3459 | break; |
3453 | } | 3460 | } |
3454 | 3461 | ||
@@ -4423,7 +4430,7 @@ static int alc_parse_auto_config(struct hda_codec *codec, | |||
4423 | static int alc880_parse_auto_config(struct hda_codec *codec) | 4430 | static int alc880_parse_auto_config(struct hda_codec *codec) |
4424 | { | 4431 | { |
4425 | static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; | 4432 | static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
4426 | static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 }; | 4433 | static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
4427 | return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); | 4434 | return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); |
4428 | } | 4435 | } |
4429 | 4436 | ||
@@ -4859,6 +4866,7 @@ enum { | |||
4859 | ALC260_FIXUP_GPIO1_TOGGLE, | 4866 | ALC260_FIXUP_GPIO1_TOGGLE, |
4860 | ALC260_FIXUP_REPLACER, | 4867 | ALC260_FIXUP_REPLACER, |
4861 | ALC260_FIXUP_HP_B1900, | 4868 | ALC260_FIXUP_HP_B1900, |
4869 | ALC260_FIXUP_KN1, | ||
4862 | }; | 4870 | }; |
4863 | 4871 | ||
4864 | static void alc260_gpio1_automute(struct hda_codec *codec) | 4872 | static void alc260_gpio1_automute(struct hda_codec *codec) |
@@ -4886,6 +4894,36 @@ static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, | |||
4886 | } | 4894 | } |
4887 | } | 4895 | } |
4888 | 4896 | ||
4897 | static void alc260_fixup_kn1(struct hda_codec *codec, | ||
4898 | const struct alc_fixup *fix, int action) | ||
4899 | { | ||
4900 | struct alc_spec *spec = codec->spec; | ||
4901 | static const struct alc_pincfg pincfgs[] = { | ||
4902 | { 0x0f, 0x02214000 }, /* HP/speaker */ | ||
4903 | { 0x12, 0x90a60160 }, /* int mic */ | ||
4904 | { 0x13, 0x02a19000 }, /* ext mic */ | ||
4905 | { 0x18, 0x01446000 }, /* SPDIF out */ | ||
4906 | /* disable bogus I/O pins */ | ||
4907 | { 0x10, 0x411111f0 }, | ||
4908 | { 0x11, 0x411111f0 }, | ||
4909 | { 0x14, 0x411111f0 }, | ||
4910 | { 0x15, 0x411111f0 }, | ||
4911 | { 0x16, 0x411111f0 }, | ||
4912 | { 0x17, 0x411111f0 }, | ||
4913 | { 0x19, 0x411111f0 }, | ||
4914 | { } | ||
4915 | }; | ||
4916 | |||
4917 | switch (action) { | ||
4918 | case ALC_FIXUP_ACT_PRE_PROBE: | ||
4919 | alc_apply_pincfgs(codec, pincfgs); | ||
4920 | break; | ||
4921 | case ALC_FIXUP_ACT_PROBE: | ||
4922 | spec->init_amp = ALC_INIT_NONE; | ||
4923 | break; | ||
4924 | } | ||
4925 | } | ||
4926 | |||
4889 | static const struct alc_fixup alc260_fixups[] = { | 4927 | static const struct alc_fixup alc260_fixups[] = { |
4890 | [ALC260_FIXUP_HP_DC5750] = { | 4928 | [ALC260_FIXUP_HP_DC5750] = { |
4891 | .type = ALC_FIXUP_PINS, | 4929 | .type = ALC_FIXUP_PINS, |
@@ -4936,7 +4974,11 @@ static const struct alc_fixup alc260_fixups[] = { | |||
4936 | .v.func = alc260_fixup_gpio1_toggle, | 4974 | .v.func = alc260_fixup_gpio1_toggle, |
4937 | .chained = true, | 4975 | .chained = true, |
4938 | .chain_id = ALC260_FIXUP_COEF, | 4976 | .chain_id = ALC260_FIXUP_COEF, |
4939 | } | 4977 | }, |
4978 | [ALC260_FIXUP_KN1] = { | ||
4979 | .type = ALC_FIXUP_FUNC, | ||
4980 | .v.func = alc260_fixup_kn1, | ||
4981 | }, | ||
4940 | }; | 4982 | }; |
4941 | 4983 | ||
4942 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { | 4984 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { |
@@ -4946,6 +4988,7 @@ static const struct snd_pci_quirk alc260_fixup_tbl[] = { | |||
4946 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), | 4988 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), |
4947 | SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), | 4989 | SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), |
4948 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), | 4990 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), |
4991 | SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1), | ||
4949 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), | 4992 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), |
4950 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), | 4993 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), |
4951 | {} | 4994 | {} |
@@ -5269,7 +5312,9 @@ static const struct alc_fixup alc882_fixups[] = { | |||
5269 | { 0x16, 0x99130111 }, /* CLFE speaker */ | 5312 | { 0x16, 0x99130111 }, /* CLFE speaker */ |
5270 | { 0x17, 0x99130112 }, /* surround speaker */ | 5313 | { 0x17, 0x99130112 }, /* surround speaker */ |
5271 | { } | 5314 | { } |
5272 | } | 5315 | }, |
5316 | .chained = true, | ||
5317 | .chain_id = ALC882_FIXUP_GPIO1, | ||
5273 | }, | 5318 | }, |
5274 | [ALC882_FIXUP_ACER_ASPIRE_8930G] = { | 5319 | [ALC882_FIXUP_ACER_ASPIRE_8930G] = { |
5275 | .type = ALC_FIXUP_PINS, | 5320 | .type = ALC_FIXUP_PINS, |
@@ -5312,7 +5357,9 @@ static const struct alc_fixup alc882_fixups[] = { | |||
5312 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | 5357 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
5313 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | 5358 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, |
5314 | { } | 5359 | { } |
5315 | } | 5360 | }, |
5361 | .chained = true, | ||
5362 | .chain_id = ALC882_FIXUP_GPIO1, | ||
5316 | }, | 5363 | }, |
5317 | [ALC885_FIXUP_MACPRO_GPIO] = { | 5364 | [ALC885_FIXUP_MACPRO_GPIO] = { |
5318 | .type = ALC_FIXUP_FUNC, | 5365 | .type = ALC_FIXUP_FUNC, |
@@ -5359,6 +5406,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
5359 | ALC882_FIXUP_ACER_ASPIRE_4930G), | 5406 | ALC882_FIXUP_ACER_ASPIRE_4930G), |
5360 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), | 5407 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), |
5361 | SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE), | 5408 | SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE), |
5409 | SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G), | ||
5362 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), | 5410 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), |
5363 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), | 5411 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), |
5364 | SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), | 5412 | SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), |
@@ -5384,6 +5432,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
5384 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF), | 5432 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF), |
5385 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF), | 5433 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF), |
5386 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF), | 5434 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF), |
5435 | SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO), | ||
5387 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), | 5436 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), |
5388 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), | 5437 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), |
5389 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), | 5438 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), |
@@ -5399,6 +5448,13 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
5399 | {} | 5448 | {} |
5400 | }; | 5449 | }; |
5401 | 5450 | ||
5451 | static const struct alc_model_fixup alc882_fixup_models[] = { | ||
5452 | {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"}, | ||
5453 | {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"}, | ||
5454 | {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"}, | ||
5455 | {} | ||
5456 | }; | ||
5457 | |||
5402 | /* | 5458 | /* |
5403 | * BIOS auto configuration | 5459 | * BIOS auto configuration |
5404 | */ | 5460 | */ |
@@ -5439,7 +5495,8 @@ static int patch_alc882(struct hda_codec *codec) | |||
5439 | if (err < 0) | 5495 | if (err < 0) |
5440 | goto error; | 5496 | goto error; |
5441 | 5497 | ||
5442 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); | 5498 | alc_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, |
5499 | alc882_fixups); | ||
5443 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | 5500 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
5444 | 5501 | ||
5445 | alc_auto_parse_customize_define(codec); | 5502 | alc_auto_parse_customize_define(codec); |
@@ -6079,7 +6136,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
6079 | * Basically the device should work as is without the fixup table. | 6136 | * Basically the device should work as is without the fixup table. |
6080 | * If BIOS doesn't give a proper info, enable the corresponding | 6137 | * If BIOS doesn't give a proper info, enable the corresponding |
6081 | * fixup entry. | 6138 | * fixup entry. |
6082 | */ | 6139 | */ |
6083 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | 6140 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
6084 | ALC269_FIXUP_AMIC), | 6141 | ALC269_FIXUP_AMIC), |
6085 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC), | 6142 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC), |
@@ -6296,7 +6353,7 @@ static void alc_fixup_no_jack_detect(struct hda_codec *codec, | |||
6296 | { | 6353 | { |
6297 | if (action == ALC_FIXUP_ACT_PRE_PROBE) | 6354 | if (action == ALC_FIXUP_ACT_PRE_PROBE) |
6298 | codec->no_jack_detect = 1; | 6355 | codec->no_jack_detect = 1; |
6299 | } | 6356 | } |
6300 | 6357 | ||
6301 | static const struct alc_fixup alc861_fixups[] = { | 6358 | static const struct alc_fixup alc861_fixups[] = { |
6302 | [ALC861_FIXUP_FSC_AMILO_PI1505] = { | 6359 | [ALC861_FIXUP_FSC_AMILO_PI1505] = { |
@@ -6714,7 +6771,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | |||
6714 | * Basically the device should work as is without the fixup table. | 6771 | * Basically the device should work as is without the fixup table. |
6715 | * If BIOS doesn't give a proper info, enable the corresponding | 6772 | * If BIOS doesn't give a proper info, enable the corresponding |
6716 | * fixup entry. | 6773 | * fixup entry. |
6717 | */ | 6774 | */ |
6718 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1), | 6775 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1), |
6719 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3), | 6776 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3), |
6720 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1), | 6777 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 33a9946b492c..4742cac26aa9 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -5063,12 +5063,11 @@ static void stac92xx_update_led_status(struct hda_codec *codec, int enabled) | |||
5063 | if (spec->gpio_led_polarity) | 5063 | if (spec->gpio_led_polarity) |
5064 | muted = !muted; | 5064 | muted = !muted; |
5065 | 5065 | ||
5066 | /*polarity defines *not* muted state level*/ | ||
5067 | if (!spec->vref_mute_led_nid) { | 5066 | if (!spec->vref_mute_led_nid) { |
5068 | if (muted) | 5067 | if (muted) |
5069 | spec->gpio_data &= ~spec->gpio_led; /* orange */ | 5068 | spec->gpio_data |= spec->gpio_led; |
5070 | else | 5069 | else |
5071 | spec->gpio_data |= spec->gpio_led; /* white */ | 5070 | spec->gpio_data &= ~spec->gpio_led; |
5072 | stac_gpio_set(codec, spec->gpio_mask, | 5071 | stac_gpio_set(codec, spec->gpio_mask, |
5073 | spec->gpio_dir, spec->gpio_data); | 5072 | spec->gpio_dir, spec->gpio_data); |
5074 | } else { | 5073 | } else { |
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 6508e8b790bb..59d8efaa17e9 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -57,7 +57,7 @@ config SND_SOC_ALL_CODECS | |||
57 | select SND_SOC_TPA6130A2 if I2C | 57 | select SND_SOC_TPA6130A2 if I2C |
58 | select SND_SOC_TLV320DAC33 if I2C | 58 | select SND_SOC_TLV320DAC33 if I2C |
59 | select SND_SOC_TWL4030 if TWL4030_CORE | 59 | select SND_SOC_TWL4030 if TWL4030_CORE |
60 | select SND_SOC_TWL6040 if TWL4030_CORE | 60 | select SND_SOC_TWL6040 if TWL6040_CORE |
61 | select SND_SOC_UDA134X | 61 | select SND_SOC_UDA134X |
62 | select SND_SOC_UDA1380 if I2C | 62 | select SND_SOC_UDA1380 if I2C |
63 | select SND_SOC_WL1273 if MFD_WL1273_CORE | 63 | select SND_SOC_WL1273 if MFD_WL1273_CORE |
@@ -276,7 +276,6 @@ config SND_SOC_TWL4030 | |||
276 | tristate | 276 | tristate |
277 | 277 | ||
278 | config SND_SOC_TWL6040 | 278 | config SND_SOC_TWL6040 |
279 | select TWL6040_CORE | ||
280 | tristate | 279 | tristate |
281 | 280 | ||
282 | config SND_SOC_UDA134X | 281 | config SND_SOC_UDA134X |
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index f8e10ced244a..b3e24f289421 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c | |||
@@ -140,7 +140,7 @@ | |||
140 | * min : 0xFE : -115.0 dB | 140 | * min : 0xFE : -115.0 dB |
141 | * mute: 0xFF | 141 | * mute: 0xFF |
142 | */ | 142 | */ |
143 | static const DECLARE_TLV_DB_SCALE(out_tlv, -11500, 50, 1); | 143 | static const DECLARE_TLV_DB_SCALE(out_tlv, -11550, 50, 1); |
144 | 144 | ||
145 | static const struct snd_kcontrol_new ak4642_snd_controls[] = { | 145 | static const struct snd_kcontrol_new ak4642_snd_controls[] = { |
146 | 146 | ||
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index d1926266fe00..8e92fb88ed09 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -143,11 +143,11 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, | |||
143 | } | 143 | } |
144 | 144 | ||
145 | /* | 145 | /* |
146 | * using codec assist to small pop, hp_powerup or lineout_powerup | 146 | * As manual described, ADC/DAC only works when VAG powerup, |
147 | * should stay setting until vag_powerup is fully ramped down, | 147 | * So enabled VAG before ADC/DAC up. |
148 | * vag fully ramped down require 400ms. | 148 | * In power down case, we need wait 400ms when vag fully ramped down. |
149 | */ | 149 | */ |
150 | static int small_pop_event(struct snd_soc_dapm_widget *w, | 150 | static int power_vag_event(struct snd_soc_dapm_widget *w, |
151 | struct snd_kcontrol *kcontrol, int event) | 151 | struct snd_kcontrol *kcontrol, int event) |
152 | { | 152 | { |
153 | switch (event) { | 153 | switch (event) { |
@@ -156,7 +156,7 @@ static int small_pop_event(struct snd_soc_dapm_widget *w, | |||
156 | SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); | 156 | SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); |
157 | break; | 157 | break; |
158 | 158 | ||
159 | case SND_SOC_DAPM_PRE_PMD: | 159 | case SND_SOC_DAPM_POST_PMD: |
160 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, | 160 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, |
161 | SGTL5000_VAG_POWERUP, 0); | 161 | SGTL5000_VAG_POWERUP, 0); |
162 | msleep(400); | 162 | msleep(400); |
@@ -201,12 +201,8 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = { | |||
201 | mic_bias_event, | 201 | mic_bias_event, |
202 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | 202 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
203 | 203 | ||
204 | SND_SOC_DAPM_PGA_E("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0, | 204 | SND_SOC_DAPM_PGA("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0), |
205 | small_pop_event, | 205 | SND_SOC_DAPM_PGA("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0), |
206 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), | ||
207 | SND_SOC_DAPM_PGA_E("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0, | ||
208 | small_pop_event, | ||
209 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), | ||
210 | 206 | ||
211 | SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux), | 207 | SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux), |
212 | SND_SOC_DAPM_MUX("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux), | 208 | SND_SOC_DAPM_MUX("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux), |
@@ -221,8 +217,11 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = { | |||
221 | 0, SGTL5000_CHIP_DIG_POWER, | 217 | 0, SGTL5000_CHIP_DIG_POWER, |
222 | 1, 0), | 218 | 1, 0), |
223 | 219 | ||
224 | SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0), | 220 | SND_SOC_DAPM_SUPPLY("VAG_POWER", SGTL5000_CHIP_ANA_POWER, 7, 0, |
221 | power_vag_event, | ||
222 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
225 | 223 | ||
224 | SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0), | ||
226 | SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0), | 225 | SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0), |
227 | }; | 226 | }; |
228 | 227 | ||
@@ -231,9 +230,11 @@ static const struct snd_soc_dapm_route sgtl5000_dapm_routes[] = { | |||
231 | {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */ | 230 | {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */ |
232 | {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */ | 231 | {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */ |
233 | 232 | ||
233 | {"ADC", NULL, "VAG_POWER"}, | ||
234 | {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */ | 234 | {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */ |
235 | {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */ | 235 | {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */ |
236 | 236 | ||
237 | {"DAC", NULL, "VAG_POWER"}, | ||
237 | {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */ | 238 | {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */ |
238 | {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */ | 239 | {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */ |
239 | {"LO", NULL, "DAC"}, /* dac --> line_out */ | 240 | {"LO", NULL, "DAC"}, /* dac --> line_out */ |
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 2d8c6b825e57..dc7509b9d53a 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/pm.h> | 26 | #include <linux/pm.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/i2c/twl.h> | ||
30 | #include <linux/mfd/twl6040.h> | 29 | #include <linux/mfd/twl6040.h> |
31 | 30 | ||
32 | #include <sound/core.h> | 31 | #include <sound/core.h> |
@@ -1528,7 +1527,7 @@ static int twl6040_resume(struct snd_soc_codec *codec) | |||
1528 | static int twl6040_probe(struct snd_soc_codec *codec) | 1527 | static int twl6040_probe(struct snd_soc_codec *codec) |
1529 | { | 1528 | { |
1530 | struct twl6040_data *priv; | 1529 | struct twl6040_data *priv; |
1531 | struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); | 1530 | struct twl6040_codec_data *pdata = dev_get_platdata(codec->dev); |
1532 | struct platform_device *pdev = container_of(codec->dev, | 1531 | struct platform_device *pdev = container_of(codec->dev, |
1533 | struct platform_device, dev); | 1532 | struct platform_device, dev); |
1534 | int ret = 0; | 1533 | int ret = 0; |
diff --git a/sound/soc/imx/imx-audmux.c b/sound/soc/imx/imx-audmux.c index 1765a197acb0..f23700359c67 100644 --- a/sound/soc/imx/imx-audmux.c +++ b/sound/soc/imx/imx-audmux.c | |||
@@ -73,6 +73,9 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, | |||
73 | if (!buf) | 73 | if (!buf) |
74 | return -ENOMEM; | 74 | return -ENOMEM; |
75 | 75 | ||
76 | if (!audmux_base) | ||
77 | return -ENOSYS; | ||
78 | |||
76 | if (audmux_clk) | 79 | if (audmux_clk) |
77 | clk_prepare_enable(audmux_clk); | 80 | clk_prepare_enable(audmux_clk); |
78 | 81 | ||
@@ -152,7 +155,7 @@ static void __init audmux_debugfs_init(void) | |||
152 | return; | 155 | return; |
153 | } | 156 | } |
154 | 157 | ||
155 | for (i = 1; i < 8; i++) { | 158 | for (i = 0; i < MX31_AUDMUX_PORT6_SSI_PINS_6 + 1; i++) { |
156 | snprintf(buf, sizeof(buf), "ssi%d", i); | 159 | snprintf(buf, sizeof(buf), "ssi%d", i); |
157 | if (!debugfs_create_file(buf, 0444, audmux_debugfs_root, | 160 | if (!debugfs_create_file(buf, 0444, audmux_debugfs_root, |
158 | (void *)i, &audmux_debugfs_fops)) | 161 | (void *)i, &audmux_debugfs_fops)) |
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index e00dd0b1139c..deafbfaacdbf 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig | |||
@@ -97,7 +97,7 @@ config SND_OMAP_SOC_SDP3430 | |||
97 | 97 | ||
98 | config SND_OMAP_SOC_OMAP_ABE_TWL6040 | 98 | config SND_OMAP_SOC_OMAP_ABE_TWL6040 |
99 | tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" | 99 | tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" |
100 | depends on TWL4030_CORE && SND_OMAP_SOC && ARCH_OMAP4 | 100 | depends on TWL6040_CORE && SND_OMAP_SOC && ARCH_OMAP4 |
101 | select SND_OMAP_SOC_DMIC | 101 | select SND_OMAP_SOC_DMIC |
102 | select SND_OMAP_SOC_MCPDM | 102 | select SND_OMAP_SOC_MCPDM |
103 | select SND_SOC_TWL6040 | 103 | select SND_SOC_TWL6040 |
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 609abd51e55f..d08583790d23 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/io.h> | ||
20 | #include <sound/core.h> | 21 | #include <sound/core.h> |
21 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
22 | #include <sound/initval.h> | 23 | #include <sound/initval.h> |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e19c24ade414..accdcb7d4d9d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1081,6 +1081,8 @@ static int soc_probe_platform(struct snd_soc_card *card, | |||
1081 | snd_soc_dapm_new_controls(&platform->dapm, | 1081 | snd_soc_dapm_new_controls(&platform->dapm, |
1082 | driver->dapm_widgets, driver->num_dapm_widgets); | 1082 | driver->dapm_widgets, driver->num_dapm_widgets); |
1083 | 1083 | ||
1084 | platform->dapm.idle_bias_off = 1; | ||
1085 | |||
1084 | if (driver->probe) { | 1086 | if (driver->probe) { |
1085 | ret = driver->probe(platform); | 1087 | ret = driver->probe(platform); |
1086 | if (ret < 0) { | 1088 | if (ret < 0) { |
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index 33509de52540..e53349912b2e 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c | |||
@@ -79,11 +79,15 @@ static int tegra_i2s_show(struct seq_file *s, void *unused) | |||
79 | struct tegra_i2s *i2s = s->private; | 79 | struct tegra_i2s *i2s = s->private; |
80 | int i; | 80 | int i; |
81 | 81 | ||
82 | clk_enable(i2s->clk_i2s); | ||
83 | |||
82 | for (i = 0; i < ARRAY_SIZE(regs); i++) { | 84 | for (i = 0; i < ARRAY_SIZE(regs); i++) { |
83 | u32 val = tegra_i2s_read(i2s, regs[i].offset); | 85 | u32 val = tegra_i2s_read(i2s, regs[i].offset); |
84 | seq_printf(s, "%s = %08x\n", regs[i].name, val); | 86 | seq_printf(s, "%s = %08x\n", regs[i].name, val); |
85 | } | 87 | } |
86 | 88 | ||
89 | clk_disable(i2s->clk_i2s); | ||
90 | |||
87 | return 0; | 91 | return 0; |
88 | } | 92 | } |
89 | 93 | ||
@@ -112,7 +116,7 @@ static void tegra_i2s_debug_remove(struct tegra_i2s *i2s) | |||
112 | debugfs_remove(i2s->debug); | 116 | debugfs_remove(i2s->debug); |
113 | } | 117 | } |
114 | #else | 118 | #else |
115 | static inline void tegra_i2s_debug_add(struct tegra_i2s *i2s, int id) | 119 | static inline void tegra_i2s_debug_add(struct tegra_i2s *i2s) |
116 | { | 120 | { |
117 | } | 121 | } |
118 | 122 | ||
diff --git a/sound/soc/tegra/tegra_spdif.c b/sound/soc/tegra/tegra_spdif.c index 475428cf270e..9ff2c601445f 100644 --- a/sound/soc/tegra/tegra_spdif.c +++ b/sound/soc/tegra/tegra_spdif.c | |||
@@ -79,11 +79,15 @@ static int tegra_spdif_show(struct seq_file *s, void *unused) | |||
79 | struct tegra_spdif *spdif = s->private; | 79 | struct tegra_spdif *spdif = s->private; |
80 | int i; | 80 | int i; |
81 | 81 | ||
82 | clk_enable(spdif->clk_spdif_out); | ||
83 | |||
82 | for (i = 0; i < ARRAY_SIZE(regs); i++) { | 84 | for (i = 0; i < ARRAY_SIZE(regs); i++) { |
83 | u32 val = tegra_spdif_read(spdif, regs[i].offset); | 85 | u32 val = tegra_spdif_read(spdif, regs[i].offset); |
84 | seq_printf(s, "%s = %08x\n", regs[i].name, val); | 86 | seq_printf(s, "%s = %08x\n", regs[i].name, val); |
85 | } | 87 | } |
86 | 88 | ||
89 | clk_disable(spdif->clk_spdif_out); | ||
90 | |||
87 | return 0; | 91 | return 0; |
88 | } | 92 | } |
89 | 93 | ||
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore index 416684be0ad3..26b823b61aa1 100644 --- a/tools/perf/.gitignore +++ b/tools/perf/.gitignore | |||
@@ -19,3 +19,5 @@ TAGS | |||
19 | cscope* | 19 | cscope* |
20 | config.mak | 20 | config.mak |
21 | config.mak.autogen | 21 | config.mak.autogen |
22 | *-bison.* | ||
23 | *-flex.* | ||
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 820371f10d1b..03059e75665a 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -237,21 +237,20 @@ export PERL_PATH | |||
237 | FLEX = $(CROSS_COMPILE)flex | 237 | FLEX = $(CROSS_COMPILE)flex |
238 | BISON= $(CROSS_COMPILE)bison | 238 | BISON= $(CROSS_COMPILE)bison |
239 | 239 | ||
240 | event-parser: | 240 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l |
241 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c | ||
242 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c | 241 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c |
243 | 242 | ||
244 | $(OUTPUT)util/parse-events-flex.c: event-parser | 243 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y |
245 | $(OUTPUT)util/parse-events-bison.c: event-parser | 244 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c |
246 | 245 | ||
247 | pmu-parser: | 246 | $(OUTPUT)util/pmu-flex.c: util/pmu.l |
248 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c | ||
249 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c | 247 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c |
250 | 248 | ||
251 | $(OUTPUT)util/pmu-flex.c: pmu-parser | 249 | $(OUTPUT)util/pmu-bison.c: util/pmu.y |
252 | $(OUTPUT)util/pmu-bison.c: pmu-parser | 250 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c |
253 | 251 | ||
254 | $(OUTPUT)util/parse-events.o: event-parser pmu-parser | 252 | $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c |
253 | $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c | ||
255 | 254 | ||
256 | LIB_FILE=$(OUTPUT)libperf.a | 255 | LIB_FILE=$(OUTPUT)libperf.a |
257 | 256 | ||
@@ -527,7 +526,7 @@ else | |||
527 | endif | 526 | endif |
528 | 527 | ||
529 | ifdef NO_GTK2 | 528 | ifdef NO_GTK2 |
530 | BASIC_CFLAGS += -DNO_GTK2 | 529 | BASIC_CFLAGS += -DNO_GTK2_SUPPORT |
531 | else | 530 | else |
532 | FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) | 531 | FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) |
533 | ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) | 532 | ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) |
@@ -852,8 +851,6 @@ help: | |||
852 | @echo ' html - make html documentation' | 851 | @echo ' html - make html documentation' |
853 | @echo ' info - make GNU info documentation (access with info <foo>)' | 852 | @echo ' info - make GNU info documentation (access with info <foo>)' |
854 | @echo ' pdf - make pdf documentation' | 853 | @echo ' pdf - make pdf documentation' |
855 | @echo ' event-parser - make event parser code' | ||
856 | @echo ' pmu-parser - make pmu format parser code' | ||
857 | @echo ' TAGS - use etags to make tag information for source browsing' | 854 | @echo ' TAGS - use etags to make tag information for source browsing' |
858 | @echo ' tags - use ctags to make tag information for source browsing' | 855 | @echo ' tags - use ctags to make tag information for source browsing' |
859 | @echo ' cscope - use cscope to make interactive browsing database' | 856 | @echo ' cscope - use cscope to make interactive browsing database' |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index fb8b5f83b4a0..1cad3af4bf4c 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "util/debug.h" | 17 | #include "util/debug.h" |
18 | 18 | ||
19 | #include <sys/prctl.h> | 19 | #include <sys/prctl.h> |
20 | #include <sys/resource.h> | ||
20 | 21 | ||
21 | #include <semaphore.h> | 22 | #include <semaphore.h> |
22 | #include <pthread.h> | 23 | #include <pthread.h> |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index e3c63aef8efc..8ef59f8262bb 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "util/debug.h" | 42 | #include "util/debug.h" |
43 | 43 | ||
44 | #include <assert.h> | 44 | #include <assert.h> |
45 | #include <elf.h> | ||
45 | #include <fcntl.h> | 46 | #include <fcntl.h> |
46 | 47 | ||
47 | #include <stdio.h> | 48 | #include <stdio.h> |
@@ -59,6 +60,7 @@ | |||
59 | #include <sys/prctl.h> | 60 | #include <sys/prctl.h> |
60 | #include <sys/wait.h> | 61 | #include <sys/wait.h> |
61 | #include <sys/uio.h> | 62 | #include <sys/uio.h> |
63 | #include <sys/utsname.h> | ||
62 | #include <sys/mman.h> | 64 | #include <sys/mman.h> |
63 | 65 | ||
64 | #include <linux/unistd.h> | 66 | #include <linux/unistd.h> |
@@ -162,12 +164,40 @@ static void __zero_source_counters(struct hist_entry *he) | |||
162 | symbol__annotate_zero_histograms(sym); | 164 | symbol__annotate_zero_histograms(sym); |
163 | } | 165 | } |
164 | 166 | ||
167 | static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip) | ||
168 | { | ||
169 | struct utsname uts; | ||
170 | int err = uname(&uts); | ||
171 | |||
172 | ui__warning("Out of bounds address found:\n\n" | ||
173 | "Addr: %" PRIx64 "\n" | ||
174 | "DSO: %s %c\n" | ||
175 | "Map: %" PRIx64 "-%" PRIx64 "\n" | ||
176 | "Symbol: %" PRIx64 "-%" PRIx64 " %c %s\n" | ||
177 | "Arch: %s\n" | ||
178 | "Kernel: %s\n" | ||
179 | "Tools: %s\n\n" | ||
180 | "Not all samples will be on the annotation output.\n\n" | ||
181 | "Please report to linux-kernel@vger.kernel.org\n", | ||
182 | ip, map->dso->long_name, dso__symtab_origin(map->dso), | ||
183 | map->start, map->end, sym->start, sym->end, | ||
184 | sym->binding == STB_GLOBAL ? 'g' : | ||
185 | sym->binding == STB_LOCAL ? 'l' : 'w', sym->name, | ||
186 | err ? "[unknown]" : uts.machine, | ||
187 | err ? "[unknown]" : uts.release, perf_version_string); | ||
188 | if (use_browser <= 0) | ||
189 | sleep(5); | ||
190 | |||
191 | map->erange_warned = true; | ||
192 | } | ||
193 | |||
165 | static void perf_top__record_precise_ip(struct perf_top *top, | 194 | static void perf_top__record_precise_ip(struct perf_top *top, |
166 | struct hist_entry *he, | 195 | struct hist_entry *he, |
167 | int counter, u64 ip) | 196 | int counter, u64 ip) |
168 | { | 197 | { |
169 | struct annotation *notes; | 198 | struct annotation *notes; |
170 | struct symbol *sym; | 199 | struct symbol *sym; |
200 | int err; | ||
171 | 201 | ||
172 | if (he == NULL || he->ms.sym == NULL || | 202 | if (he == NULL || he->ms.sym == NULL || |
173 | ((top->sym_filter_entry == NULL || | 203 | ((top->sym_filter_entry == NULL || |
@@ -189,9 +219,12 @@ static void perf_top__record_precise_ip(struct perf_top *top, | |||
189 | } | 219 | } |
190 | 220 | ||
191 | ip = he->ms.map->map_ip(he->ms.map, ip); | 221 | ip = he->ms.map->map_ip(he->ms.map, ip); |
192 | symbol__inc_addr_samples(sym, he->ms.map, counter, ip); | 222 | err = symbol__inc_addr_samples(sym, he->ms.map, counter, ip); |
193 | 223 | ||
194 | pthread_mutex_unlock(¬es->lock); | 224 | pthread_mutex_unlock(¬es->lock); |
225 | |||
226 | if (err == -ERANGE && !he->ms.map->erange_warned) | ||
227 | ui__warn_map_erange(he->ms.map, sym, ip); | ||
195 | } | 228 | } |
196 | 229 | ||
197 | static void perf_top__show_details(struct perf_top *top) | 230 | static void perf_top__show_details(struct perf_top *top) |
@@ -615,6 +648,7 @@ process_hotkey: | |||
615 | 648 | ||
616 | /* Tag samples to be skipped. */ | 649 | /* Tag samples to be skipped. */ |
617 | static const char *skip_symbols[] = { | 650 | static const char *skip_symbols[] = { |
651 | "intel_idle", | ||
618 | "default_idle", | 652 | "default_idle", |
619 | "native_safe_halt", | 653 | "native_safe_halt", |
620 | "cpu_idle", | 654 | "cpu_idle", |
diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh index 677e59d62a8d..95b6f8b6177a 100644 --- a/tools/perf/perf-archive.sh +++ b/tools/perf/perf-archive.sh | |||
@@ -29,13 +29,14 @@ if [ ! -s $BUILDIDS ] ; then | |||
29 | fi | 29 | fi |
30 | 30 | ||
31 | MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX) | 31 | MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX) |
32 | PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/ | ||
32 | 33 | ||
33 | cut -d ' ' -f 1 $BUILDIDS | \ | 34 | cut -d ' ' -f 1 $BUILDIDS | \ |
34 | while read build_id ; do | 35 | while read build_id ; do |
35 | linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2} | 36 | linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2} |
36 | filename=$(readlink -f $linkname) | 37 | filename=$(readlink -f $linkname) |
37 | echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST | 38 | echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST |
38 | echo ${filename#$PERF_BUILDID_DIR} >> $MANIFEST | 39 | echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST |
39 | done | 40 | done |
40 | 41 | ||
41 | tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST | 42 | tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 199f69ec656f..08c6d138a655 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -64,8 +64,8 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | |||
64 | 64 | ||
65 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); | 65 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); |
66 | 66 | ||
67 | if (addr > sym->end) | 67 | if (addr < sym->start || addr > sym->end) |
68 | return 0; | 68 | return -ERANGE; |
69 | 69 | ||
70 | offset = addr - sym->start; | 70 | offset = addr - sym->start; |
71 | h = annotation__histogram(notes, evidx); | 71 | h = annotation__histogram(notes, evidx); |
@@ -561,16 +561,12 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx) | |||
561 | { | 561 | { |
562 | struct annotation *notes = symbol__annotation(sym); | 562 | struct annotation *notes = symbol__annotation(sym); |
563 | struct sym_hist *h = annotation__histogram(notes, evidx); | 563 | struct sym_hist *h = annotation__histogram(notes, evidx); |
564 | struct objdump_line *pos; | 564 | int len = sym->end - sym->start, offset; |
565 | int len = sym->end - sym->start; | ||
566 | 565 | ||
567 | h->sum = 0; | 566 | h->sum = 0; |
568 | 567 | for (offset = 0; offset < len; ++offset) { | |
569 | list_for_each_entry(pos, ¬es->src->source, node) { | 568 | h->addr[offset] = h->addr[offset] * 7 / 8; |
570 | if (pos->offset != -1 && pos->offset < len) { | 569 | h->sum += h->addr[offset]; |
571 | h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8; | ||
572 | h->sum += h->addr[pos->offset]; | ||
573 | } | ||
574 | } | 570 | } |
575 | } | 571 | } |
576 | 572 | ||
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 2ec4b60aff6c..9f6d630d5316 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -256,6 +256,18 @@ static struct hist_entry *add_hist_entry(struct hists *hists, | |||
256 | if (!cmp) { | 256 | if (!cmp) { |
257 | he->period += period; | 257 | he->period += period; |
258 | ++he->nr_events; | 258 | ++he->nr_events; |
259 | |||
260 | /* If the map of an existing hist_entry has | ||
261 | * become out-of-date due to an exec() or | ||
262 | * similar, update it. Otherwise we will | ||
263 | * mis-adjust symbol addresses when computing | ||
264 | * the history counter to increment. | ||
265 | */ | ||
266 | if (he->ms.map != entry->ms.map) { | ||
267 | he->ms.map = entry->ms.map; | ||
268 | if (he->ms.map) | ||
269 | he->ms.map->referenced = true; | ||
270 | } | ||
259 | goto out; | 271 | goto out; |
260 | } | 272 | } |
261 | 273 | ||
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index dea6d1c1a954..35ae56864e4f 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -38,6 +38,7 @@ void map__init(struct map *self, enum map_type type, | |||
38 | RB_CLEAR_NODE(&self->rb_node); | 38 | RB_CLEAR_NODE(&self->rb_node); |
39 | self->groups = NULL; | 39 | self->groups = NULL; |
40 | self->referenced = false; | 40 | self->referenced = false; |
41 | self->erange_warned = false; | ||
41 | } | 42 | } |
42 | 43 | ||
43 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | 44 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, |
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index b100c20b7f94..81371bad4ef0 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h | |||
@@ -33,6 +33,7 @@ struct map { | |||
33 | u64 end; | 33 | u64 end; |
34 | u8 /* enum map_type */ type; | 34 | u8 /* enum map_type */ type; |
35 | bool referenced; | 35 | bool referenced; |
36 | bool erange_warned; | ||
36 | u32 priv; | 37 | u32 priv; |
37 | u64 pgoff; | 38 | u64 pgoff; |
38 | 39 | ||
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 9412e3b05f68..1efd3bee6336 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -826,8 +826,16 @@ static struct machine * | |||
826 | { | 826 | { |
827 | const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | 827 | const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
828 | 828 | ||
829 | if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) | 829 | if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) { |
830 | return perf_session__find_machine(session, event->ip.pid); | 830 | u32 pid; |
831 | |||
832 | if (event->header.type == PERF_RECORD_MMAP) | ||
833 | pid = event->mmap.pid; | ||
834 | else | ||
835 | pid = event->ip.pid; | ||
836 | |||
837 | return perf_session__find_machine(session, pid); | ||
838 | } | ||
831 | 839 | ||
832 | return perf_session__find_host_machine(session); | 840 | return perf_session__find_host_machine(session); |
833 | } | 841 | } |
@@ -868,11 +876,11 @@ static int perf_session_deliver_event(struct perf_session *session, | |||
868 | dump_sample(session, event, sample); | 876 | dump_sample(session, event, sample); |
869 | if (evsel == NULL) { | 877 | if (evsel == NULL) { |
870 | ++session->hists.stats.nr_unknown_id; | 878 | ++session->hists.stats.nr_unknown_id; |
871 | return -1; | 879 | return 0; |
872 | } | 880 | } |
873 | if (machine == NULL) { | 881 | if (machine == NULL) { |
874 | ++session->hists.stats.nr_unprocessable_samples; | 882 | ++session->hists.stats.nr_unprocessable_samples; |
875 | return -1; | 883 | return 0; |
876 | } | 884 | } |
877 | return tool->sample(tool, event, sample, evsel, machine); | 885 | return tool->sample(tool, event, sample, evsel, machine); |
878 | case PERF_RECORD_MMAP: | 886 | case PERF_RECORD_MMAP: |
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index d7a1c4afe28b..2f83e5dc9967 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -125,6 +125,9 @@ static int callchain__count_rows(struct rb_root *chain) | |||
125 | 125 | ||
126 | static bool map_symbol__toggle_fold(struct map_symbol *self) | 126 | static bool map_symbol__toggle_fold(struct map_symbol *self) |
127 | { | 127 | { |
128 | if (!self) | ||
129 | return false; | ||
130 | |||
128 | if (!self->has_children) | 131 | if (!self->has_children) |
129 | return false; | 132 | return false; |
130 | 133 | ||
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index a457d2138f49..e9fff9830bf0 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
@@ -240,9 +240,13 @@ int kvm_iommu_map_guest(struct kvm *kvm) | |||
240 | return -ENODEV; | 240 | return -ENODEV; |
241 | } | 241 | } |
242 | 242 | ||
243 | mutex_lock(&kvm->slots_lock); | ||
244 | |||
243 | kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type); | 245 | kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type); |
244 | if (!kvm->arch.iommu_domain) | 246 | if (!kvm->arch.iommu_domain) { |
245 | return -ENOMEM; | 247 | r = -ENOMEM; |
248 | goto out_unlock; | ||
249 | } | ||
246 | 250 | ||
247 | if (!allow_unsafe_assigned_interrupts && | 251 | if (!allow_unsafe_assigned_interrupts && |
248 | !iommu_domain_has_cap(kvm->arch.iommu_domain, | 252 | !iommu_domain_has_cap(kvm->arch.iommu_domain, |
@@ -253,17 +257,16 @@ int kvm_iommu_map_guest(struct kvm *kvm) | |||
253 | " module option.\n", __func__); | 257 | " module option.\n", __func__); |
254 | iommu_domain_free(kvm->arch.iommu_domain); | 258 | iommu_domain_free(kvm->arch.iommu_domain); |
255 | kvm->arch.iommu_domain = NULL; | 259 | kvm->arch.iommu_domain = NULL; |
256 | return -EPERM; | 260 | r = -EPERM; |
261 | goto out_unlock; | ||
257 | } | 262 | } |
258 | 263 | ||
259 | r = kvm_iommu_map_memslots(kvm); | 264 | r = kvm_iommu_map_memslots(kvm); |
260 | if (r) | 265 | if (r) |
261 | goto out_unmap; | 266 | kvm_iommu_unmap_memslots(kvm); |
262 | |||
263 | return 0; | ||
264 | 267 | ||
265 | out_unmap: | 268 | out_unlock: |
266 | kvm_iommu_unmap_memslots(kvm); | 269 | mutex_unlock(&kvm->slots_lock); |
267 | return r; | 270 | return r; |
268 | } | 271 | } |
269 | 272 | ||
@@ -310,6 +313,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm, | |||
310 | } | 313 | } |
311 | } | 314 | } |
312 | 315 | ||
316 | void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | ||
317 | { | ||
318 | kvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages); | ||
319 | } | ||
320 | |||
313 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) | 321 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) |
314 | { | 322 | { |
315 | int idx; | 323 | int idx; |
@@ -320,7 +328,7 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm) | |||
320 | slots = kvm_memslots(kvm); | 328 | slots = kvm_memslots(kvm); |
321 | 329 | ||
322 | kvm_for_each_memslot(memslot, slots) | 330 | kvm_for_each_memslot(memslot, slots) |
323 | kvm_iommu_put_pages(kvm, memslot->base_gfn, memslot->npages); | 331 | kvm_iommu_unmap_pages(kvm, memslot); |
324 | 332 | ||
325 | srcu_read_unlock(&kvm->srcu, idx); | 333 | srcu_read_unlock(&kvm->srcu, idx); |
326 | 334 | ||
@@ -335,7 +343,11 @@ int kvm_iommu_unmap_guest(struct kvm *kvm) | |||
335 | if (!domain) | 343 | if (!domain) |
336 | return 0; | 344 | return 0; |
337 | 345 | ||
346 | mutex_lock(&kvm->slots_lock); | ||
338 | kvm_iommu_unmap_memslots(kvm); | 347 | kvm_iommu_unmap_memslots(kvm); |
348 | kvm->arch.iommu_domain = NULL; | ||
349 | mutex_unlock(&kvm->slots_lock); | ||
350 | |||
339 | iommu_domain_free(domain); | 351 | iommu_domain_free(domain); |
340 | return 0; | 352 | return 0; |
341 | } | 353 | } |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 42b73930a6de..9739b533ca2e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -808,12 +808,13 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
808 | if (r) | 808 | if (r) |
809 | goto out_free; | 809 | goto out_free; |
810 | 810 | ||
811 | /* map the pages in iommu page table */ | 811 | /* map/unmap the pages in iommu page table */ |
812 | if (npages) { | 812 | if (npages) { |
813 | r = kvm_iommu_map_pages(kvm, &new); | 813 | r = kvm_iommu_map_pages(kvm, &new); |
814 | if (r) | 814 | if (r) |
815 | goto out_free; | 815 | goto out_free; |
816 | } | 816 | } else |
817 | kvm_iommu_unmap_pages(kvm, &old); | ||
817 | 818 | ||
818 | r = -ENOMEM; | 819 | r = -ENOMEM; |
819 | slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), | 820 | slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), |