include: extcon: Fix compilation error caused because of incomplete merge
Fix the following compilation error caused due to incomplete merge. This is
observed if CONFIG_EXTCON is not set.
In file included from ./include/linux/mfd/palmas.h:23:0,
from drivers/input/misc/palmas-pwrbutton.c:22:
./include/linux/extcon.h: In function ‘extcon_sync’:
./include/linux/extcon.h:361:1: error: expected declaration specifiers before ‘<<’ token
./include/linux/extcon.h:370:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./include/linux/extcon.h:376:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘>>’ token
./include/linux/extcon.h:381:1: error: expected declaration specifiers before ‘<<’ token
./include/linux/extcon.h:390:1: error: expected declaration specifiers or ‘...’ before ‘==’ token
./include/linux/extcon.h:476:11: warning: ‘struct extcon_specific_cable_nb’ declared inside parameter list [enabled by default]
./include/linux/extcon.h:476:11: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
./include/linux/extcon.h:474:19: error: storage class specified for parameter ‘extcon_register_interest’
./include/linux/extcon.h:474:19: warning: parameter ‘extcon_register_interest’ declared ‘inline’ [enabled by default]
./include/linux/extcon.h:477:1: warning: ‘always_inline’ attribute ignored [-Wattributes]
./include/linux/extcon.h:474:19: error: ‘no_instrument_function’ attribute applies only to functions
./include/linux/extcon.h:477:1: error: expected ‘;’, ‘,’ or ‘)’ before ‘{’ token
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge tag 'phy-for-4.9-updated_v1' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-testing
Kishon writes:
phy: for 4.9 (with extcon merge resolution)
updated tag for 4.9 based on usb-next along with extcon merge
resolution
phy updates includes:
*) phy driver for USB 3.0 PHY on Northstar
*) phy driver for Rockchip usb2phy
*) phy driver for the Rockchip SoC internal PCIe PHY
*) phy driver for USB Type-C PHY on rk3399
*) phy_reset() API
*) support for Allwinner A64 usb phy, usb2 phy in r8a7796
*) Fixes in twl4030-usb, tegra phy, sun4i-usb phy, da8xx-usb phy
and omap-usb2 phy
*) other misc cleanups
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Merge tag 'usb-for-v4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes:
usb: patches for v4.9 merge window
This time around we have 92 non-merge commits. Most
of the changes are in drivers/usb/gadget (40.3%)
with drivers/usb/gadget/function being the most
active directory (27.2%).
As for UDC drivers, only dwc3 (26.5%) and dwc2
(12.7%) have really been active.
The most important changes for dwc3 are better
support for scatterlist and, again, throughput
improvements. While on dwc2 got some minor stability
fixes related to soft reset and FIFO usage.
Felipe Tonello has done some good work fixing up our
f_midi gadget and Tal Shorer has implemented a nice
API change for our ULPI bus.
Apart from these, we have our usual set of
non-critical fixes, spelling fixes, build warning
fixes, etc.
Andreas Kemnade [Wed, 24 Aug 2016 22:27:59 +0000 (00:27 +0200)]
phy-twl4030-usb: initialize charging-related stuff via pm_runtime
twl4030_phy_power_on() initializes some bits which are required for
charging. As they are not set in twl4030_usb_runtime_resume()
a call to pm_runtime_get_sync() is not sufficient to enable charging.
This patch moves the initialization to twl4030_usb_runtime_resume()
so everything needed for charging is initialized upon
pm_runtime_get_sync().
That also gives improved possibilities to debug problems in that area
because the relevant parts can be checked separately. Charging can be
enabled without having the musb subsystem active.
As a side effect this hides some bugs in musb which causes
unbalanced calls to phy_power_off()/phy_power_on() so that
phy->power_count becomes -1.
The result is that e.g. the GTA04 phone (dm3730 + twl4030) works
finally as a usb gadget again and charging is working.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
setting twl->linkstat = MUSB_UNKNOWN upon error in musb_mailbox as
introduced in
commit 12b7db2bf8b8 ("usb: musb: Return error value from musb_mailbox")
causes twl4030_usb_irq() to not detect a state change form cable connected
to cable disconnected after such an error so that
pm_runtime_put_autosuspend() will not be called and the usage counter
gets unbalanced. Such errors happen e.g. if the omap2430 module is not
(yet) loaded during plug/unplug events.
This patch introduces a flag instead that indicates whether there is
information for the musb_mailbox pending and calls musb_mailbox() if
that flag is set.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Lucas Stach [Mon, 15 Aug 2016 14:09:07 +0000 (16:09 +0200)]
usb: chipidea: host: disable io watchdog
The Chipidea EHCI core seems to behave sanely and doesn't need
the IO watchdog. This kills off 10 non-deferrable wakeup events
per second when the controller is otherwise idle.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Peter Chen <peter.chen@nxp.com>
Li Jun [Wed, 20 Jul 2016 08:02:42 +0000 (16:02 +0800)]
usb: chipidea: imx: set over current polarity per dts setting
imx usb over current polarity is low active by default, with
over-current-active-high property added, user can config it to be high
active. Meanwhile keep this setting unchanged for existing platforms
so new platform must set the right value for active low by its usbmisc
init function if over current is enabled.
Signed-off-by: Li Jun <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
Roger Quadros [Tue, 13 Sep 2016 08:16:03 +0000 (11:16 +0300)]
usb: core: setup dma_pfn_offset for USB devices and, interfaces
If dma_pfn_offset is not inherited correctly from the host controller,
it might result in sub-optimal configuration as bounce
buffer limit might be set to less than optimal level.
Consider the mass storage device case.
USB storage driver creates a scsi host for the mass storage interface in
drivers/usb/storage/usb.c
The scsi host parent device is nothing but the the USB interface device.
Now, __scsi_init_queue() calls scsi_calculate_bounce_limit() to find out
and set the block layer bounce limit.
scsi_calculate_bounce_limit() uses dma_max_pfn(host_dev) to get the
bounce_limit. host_dev is nothing but the device representing the
mass storage interface.
If that device doesn't have the right dma_pfn_offset, then dma_max_pfn()
is messed up and the bounce buffer limit is wrong.
e.g. On Keystone 2 systems, dma_max_pfn() is 0x87FFFF and dma_mask_pfn
is 0xFFFFF. Consider a mass storage use case: Without this patch,
usb scsi host device (usb-storage) will get a dma_pfn_offset of 0 resulting
in a dma_max_pfn() of 0xFFFFF within the scsi layer
(scsi_calculate_bounce_limit()).
This will result in bounce buffers being unnecessarily used.
Hint: On 32-bit ARM platforms dma_max_pfn() = dma_mask_pfn + dma_pfn_offset
Signed-off-by: Roger Quadros <rogerq@ti.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Julia Lawall [Sun, 11 Sep 2016 13:05:58 +0000 (15:05 +0200)]
ezusb: constify local structures
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.
Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Colin Ian King [Mon, 12 Sep 2016 13:19:17 +0000 (14:19 +0100)]
USB: wusbcore: add in missing white space in error message text
A dev_err message spans two lines and the literal string is missing
a white space between words. Add the white space and reformat the
message to not span multiple lines.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
aDate is always the empty string, so entirely pointless. The aRevision
formatting might as well be done as part of the pr_debug() call - that
also avoids it altogether if pr_debug is compiled out.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Lechner [Tue, 13 Sep 2016 02:48:34 +0000 (21:48 -0500)]
usb: musb: da8xx: Remove mach code
Use the new phy-da8xx-usb driver to take the place of the mach code that
pokes CFGCHIP2 in the da8xx musb glue driver. This unbreaks the driver.
Signed-off-by: David Lechner <david@lechnology.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Hans de Goede [Tue, 13 Sep 2016 02:48:32 +0000 (21:48 -0500)]
musb: sunxi: Add support for platform_set_mode
This allows run-time dr_mode switching support via the "mode" musb
sysfs attribute.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tony Lindgren [Tue, 13 Sep 2016 02:48:31 +0000 (21:48 -0500)]
usb: musb: Add PM runtime support for MUSB DSPS glue layer
We can now just use PM runtime autoidle support as musb core
keeps things enabled when the devctl session bit is set. And
there's no need for dsps_musb_try_idle() so let's just remove
it.
Note that as cppi41 dma is clocked by musb, this only makes
PM work for dsps glue layer if CONFIG_MUSB_PIO_ONLY=y and
cppi41.ko is unloaded. This will get fixed when cppi41.c has
PM runtime implemented.
Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tony Lindgren [Tue, 13 Sep 2016 02:48:29 +0000 (21:48 -0500)]
usb: musb: Prepare dsps glue layer for PM runtime support
We want to be polling the state when nothing is connected.
Let's change the polling logic in preparation for PM runtime
support.
Signed-off-by: Tony Lindgren <tony@atomide.com>
[b-liu@ti.com: undo unnecessary line leading whitespace change] Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tony Lindgren [Tue, 13 Sep 2016 02:48:28 +0000 (21:48 -0500)]
usb: musb: Implement session bit based runtime PM for musb-core
We want to keep musb enabled always when the session bit is
set. This simplifies the PM runtime and allows making it more
generic across the various glue layers.
So far the only exception to just following the session bit is
host mode disconnect where the session bit stays set.
In that case, just allow PM and let the PM runtime autoidle
timeout deal with it.
Signed-off-by: Tony Lindgren <tony@atomide.com>
[b-liu@ti.com: changed using dev_dbg() to musb_dbg()] Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge tag 'extcon-next-for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into usb-testing
Chanwoo writes:
Update extcon for 4.9
Detailed description for this pull request:
1. Support the extcon property and add the synchronization APIs.
- This feature supports the extcon property for external connector
because each external connector might have the property according to
the H/W design.
- The property name should keep the following style.
: EXTCON_PROP_USB_[property_name]
: EXTCON_PROP_CHG_[property_name]
: EXTCON_PROP_JACK_[property_name]
: EXTCON_PROP_DISP_[property_name]
- Add the new extcon APIs to support the extcon property.
: extcon_set_property()
: extcon_get_property()
: extcon_set_property_capability()
: extcon_get_property_capability()
- Add the new synchronization extcon APIs.
: This feature adds the synchronization extcon APIs to support the noti
for both state and property. When extcon_*_sync() functions is called,
the extcon informs the information from extcon provider to extcon client.
The extcon driver may need to change the both state and multiple properties
at the same time. After setting the data of a external connector,
the extcon send the notification to client driver with the extcon_*_sync().
- Change the name of existing APIs.
: extcon_set_cable_state_() -> extcon_set_cable()
: extcon_get_cable_state_() -> extcon_get_cable()
2. Add the extcon type to group the connector into five category.
- EXTCON_TYPE_USB : USB connector
- EXTCON_TYPE_CHG : Charger connector
- EXTCON_TYPE_JACK : Jack connector
- EXTCON_TYPE_DISP : Display connector
- EXTCON_TYPE_MISC : Miscellaneous connector
3. Add the new property for external connector.
- EXTCON_PROP_USB_VBUS
- EXTCON_PROP_USB_TYPEC_POLARITY
- EXTCON_PROP_USB_SS (SuperSpeed)
- EXTCON_PROP_DISP_HPD (Hot Plug Detect)
4. Add the new type of external connector.
- EXTCON_DISP_DP : Display Port
- EXTCON_DISP_HMD : Head Mounted Device
- EXTCON_CHG_WPT : Wireless Power Transfer device
5. Add the new extcon driver.
- Qualcomm SPMI PMIC USB id detection driver detects whether
EXTCON_USB_HOST is attached or detached. (extcon-qcom-spmi-mis.c)
6. Remove the usage of extcon_update_state() and old extcon_set_state()
- Both extcon_update_state() and extcon_set_state() should change the state
of all external connectors with bit masking handling. It may occur the
problem. Instead, extcon provides the extcon_set/get_state() functions.
Building the UVC gadget into the kernel fails to build when
CONFIG_VIDEO_V4L2 is a loadable module:
drivers/usb/gadget/function/usb_f_uvc.o: In function `uvc_function_ep0_complete':
uvc_configfs.c:(.text.uvc_function_ep0_complete+0x84): undefined reference to `v4l2_event_queue'
drivers/usb/gadget/function/usb_f_uvc.o: In function `uvc_function_disable':
uvc_configfs.c:(.text.uvc_function_disable+0x34): undefined reference to `v4l2_event_queue'
Adding a dependency in USB_CONFIGFS_F_UVC (which is a bool symbol)
make the 'select USB_F_UVC' statement turn the USB_F_UVC into 'm'
whenever CONFIG_VIDEO_V4L2=m too, avoiding the link failure.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Oliver Neukum [Mon, 12 Sep 2016 13:19:41 +0000 (15:19 +0200)]
scsi: introduce a quirk for false cache reporting
Some SATA to USB bridges fail to cooperate with some
drives resulting in no cache being present being reported
to the host. That causes the host to skip sending
a command to synchronize caches. That causes data loss
when the drive is powered down.
Signed-off-by: Oliver Neukum <oneukum@suse.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stephen Boyd [Fri, 9 Sep 2016 21:48:47 +0000 (14:48 -0700)]
extcon: Add support for qcom SPMI PMIC USB id detection hardware
Some Qualcomm PMICs have a misc device that performs USB id pin
detection via an interrupt. When the interrupt triggers, we
should read the interrupt line to see if it has gone high or low.
If the interrupt is low then the ID pin is grounded, and if the
interrupt is high then the ID pin is being held high.
Cc: Roger Quadros <rogerq@ti.com> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
[cw00.choi: Edited the driver description and added the author information] Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 16 Aug 2016 06:55:34 +0000 (15:55 +0900)]
extcon: Use the extcon_set_state_sync() instead of deprecated functions
This patch alters the renamed extcon API to set the state of the external
connectors instead of deprecated extcon_set_cable_state_().
Because the patch[1] modifies the function name to maintain the function
naming pattern.
- extcon_set_cable_state_() -> extcon_set_state_sync()
- extcon_get_cable_state_() -> extcon_get_state()
[1] https://lkml.org/lkml/2016/8/4/729
- extcon: Rename the extcon_set/get_state() to maintain the function naming pattern
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Roger Quadros <rogerq@ti.com>
Colin Ian King [Wed, 17 Aug 2016 18:02:35 +0000 (19:02 +0100)]
extcon: axp288: Fix spelling mistake
This patch fixes the spelling mistake in dev_dbg messages.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
[cw00.choi: Modify the patch title/description] Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
extcon: max14577: Change Krzysztof Kozlowski's email to kernel.org
Change my email address to kernel.org instead of Samsung one for the
purpose of any future contact. The copyrights remain untouched and are
attributed to Samsung.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chris Zhong [Sat, 10 Sep 2016 02:15:44 +0000 (19:15 -0700)]
extcon: Introduce EXTCON_PROP_DISP_HPD property
EXTCON_PROP_DISP_HPD is need by display port, if the system has no hpd
interrupt, this property can be used.
- HPD (Hot Plug Detect) send the signal whether display device is on or off
to source device.
Signed-off-by: Chris Zhong <zyw@rock-chips.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
[cw00.choi: Add the description of HPD and full name of HPD] Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Peter Chen [Mon, 12 Sep 2016 08:38:46 +0000 (16:38 +0800)]
usb: Kconfig: let USB_ULPI_BUS depends on USB_COMMON
Since ulpi bus driver is located at usb/common/ulpi.c, whether it
is compiled or not depends on CONFIG_USB_COMMON which needs either
USB Host or USB Gadget is enabled, so even CONFIG_USB_ULPI_BUS is
chosen, its source may still not be compiled when both USB HOST
and USB gadget are disabled.
It fixed compile error with below configurations:
- # CONFIG_USB is not set
- # CONFIG_USB_GADGET is not set
- CONFIG_PHY_TUSB1210=m
- CONFIG_USB_ULPI_BUS=m
>> All errors (new ones prefixed by >>):
>>
>> ERROR: "ulpi_unregister_driver" [drivers/phy/phy-tusb1210.ko] undefined!
>> ERROR: "__ulpi_register_driver" [drivers/phy/phy-tusb1210.ko] undefined!
>> ERROR: "ulpi_write" [drivers/phy/phy-tusb1210.ko] undefined!
Fixes: ad764c49f65a ("usb: Kconfig: move ulpi bus support out of host") Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In dwc3_of_simple_remove() we are using clk_unprepare() before doing
any clk_disable(). If we enable Common CLK framework (CCF) and try to
unbind dwc3-of-simple driver, we see kernel WARN messages.
This patch fixes this kernel warning by using clk_disable_unprepare()
instead of clk_unprepare().
Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Lu Baolu [Fri, 9 Sep 2016 04:51:27 +0000 (12:51 +0800)]
usb: dwc3: fix Clear Stall EP command failure
Commit 50c763f8c1bac ("usb: dwc3: Set the ClearPendIN bit on Clear
Stall EP command") sets ClearPendIN bit for all IN endpoints of
v2.60a+ cores. This causes ClearStall command fails on 2.60+ cores
operating in HighSpeed mode.
In page 539 of 2.60a specification:
"When issuing Clear Stall command for IN endpoints in SuperSpeed
mode, the software must set the "ClearPendIN" bit to '1' to
clear any pending IN transcations, so that the device does not
expect any ACK TP from the host for the data sent earlier."
It's obvious that we only need to apply this rule to those IN
endpoints that currently operating in SuperSpeed mode.
Fixes: 50c763f8c1bac ("usb: dwc3: Set the ClearPendIN bit on Clear Stall EP command") Cc: <stable@vger.kernel.org> # v4.7+ Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Commit aa71987472a9 ("nvme: fabrics drivers don't need the nvme-pci
driver") removed the dependency on BLK_DEV_NVME, but the cdoe does
depend on the block layer (which used to be an implicit dependency
through BLK_DEV_NVME).
Otherwise you get various errors from the kbuild test robot random
config testing when that happens to hit a configuration with BLOCK
device support disabled.
Cc: Christoph Hellwig <hch@lst.de> Cc: Jay Freyensee <james_p_freyensee@linux.intel.com> Cc: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge tag 'staging-4.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull IIO fixes from Greg KH:
"Here are a few small IIO fixes for 4.8-rc6.
Nothing major, full details are in the shortlog, all of these have
been in linux-next with no reported issues"
* tag 'staging-4.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
iio:core: fix IIO_VAL_FRACTIONAL sign handling
iio: ensure ret is initialized to zero before entering do loop
iio: accel: kxsd9: Fix scaling bug
iio: accel: bmc150: reset chip at init time
iio: fix pressure data output unit in hid-sensor-attributes
tools:iio:iio_generic_buffer: fix trigger-less mode
Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fixes from Dan Williams:
"nvdimm fixes for v4.8, two of them are tagged for -stable:
- Fix devm_memremap_pages() to use track_pfn_insert(). Otherwise,
DAX pmd mappings end up with an uncached pgprot, and unusable
performance for the device-dax interface. The device-dax interface
appeared in 4.7 so this is tagged for -stable.
- Fix a couple VM_BUG_ON() checks in the show_smaps() path to
understand DAX pmd entries. This fix is tagged for -stable.
- Fix a mis-merge of the nfit machine-check handler to flip the
polarity of an if() to match the final version of the patch that
Vishal sent for 4.8-rc1. Without this the nfit machine check
handler never detects / inserts new 'badblocks' entries which
applications use to identify lost portions of files.
- For test purposes, fix the nvdimm_clear_poison() path to operate on
legacy / simulated nvdimm memory ranges. Without this fix a test
can set badblocks, but never clear them on these ranges.
- Fix the range checking done by dax_dev_pmd_fault(). This is not
tagged for -stable since this problem is mitigated by specifying
aligned resources at device-dax setup time.
These patches have appeared in a next release over the past week. The
recent rebase you can see in the timestamps was to drop an invalid fix
as identified by the updated device-dax unit tests [1]. The -mm
touches have an ack from Andrew"
[1]: "[ndctl PATCH 0/3] device-dax test for recent kernel bugs"
https://lists.01.org/pipermail/linux-nvdimm/2016-September/006855.html
* 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
libnvdimm: allow legacy (e820) pmem region to clear bad blocks
nfit, mce: Fix SPA matching logic in MCE handler
mm: fix cache mode of dax pmd mappings
mm: fix show_smap() for zone_device-pmd ranges
dax: fix mapping size check
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang:
"Mostly driver bugfixes, but also a few cleanups which are nice to have
out of the way"
* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: rk3x: Restore clock settings at resume time
i2c: Spelling s/acknowedge/acknowledge/
i2c: designware: save the preset value of DW_IC_SDA_HOLD
Documentation: i2c: slave-interface: add note for driver development
i2c: mux: demux-pinctrl: run properly with multiple instances
i2c: bcm-kona: fix inconsistent indenting
i2c: rcar: use proper device with dma_mapping_error
i2c: sh_mobile: use proper device with dma_mapping_error
i2c: mux: demux-pinctrl: invalidate properly when switching fails
Merge tag 'for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull fscrypto fixes fromTed Ts'o:
"Fix some brown-paper-bag bugs for fscrypto, including one one which
allows a malicious user to set an encryption policy on an empty
directory which they do not own"
* tag 'for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
fscrypto: require write access to mount to set encryption policy
fscrypto: only allow setting encryption policy on directories
fscrypto: add authorization check for setting encryption policy
phy: sun4i-usb: Use spinlock to guard phyctl register access
The musb driver calls into this phy driver to disable/enable squelch
detection. This function was introduced in 24fe86a617c5 ("phy: sun4i-usb:
Add a sunxi specific function for setting squelch-detect"). This
function in turn calls sun4i_usb_phy_write, which uses a mutex to
guard the common access register. Unfortunately musb does this
in atomic context, which results in the following warning with lock
debugging enabled:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:97
in_atomic(): 1, irqs_disabled(): 128, pid: 96, name: kworker/0:2
CPU: 0 PID: 96 Comm: kworker/0:2 Not tainted 4.8.0-rc4-00181-gd502f8ad1c3e #13
Hardware name: Allwinner sun8i Family
Workqueue: events musb_deassert_reset
[<c010bc01>] (unwind_backtrace) from [<c0109237>] (show_stack+0xb/0xc)
[<c0109237>] (show_stack) from [<c02a669b>] (dump_stack+0x67/0x74)
[<c02a669b>] (dump_stack) from [<c05d68c9>] (mutex_lock+0x15/0x2c)
[<c05d68c9>] (mutex_lock) from [<c02c3589>] (sun4i_usb_phy_write+0x39/0xec)
[<c02c3589>] (sun4i_usb_phy_write) from [<c03e6327>] (musb_port_reset+0xfb/0x184)
[<c03e6327>] (musb_port_reset) from [<c03e4917>] (musb_deassert_reset+0x1f/0x2c)
[<c03e4917>] (musb_deassert_reset) from [<c012ecb5>] (process_one_work+0x129/0x2b8)
[<c012ecb5>] (process_one_work) from [<c012f5e3>] (worker_thread+0xf3/0x424)
[<c012f5e3>] (worker_thread) from [<c0132dbd>] (kthread+0xa1/0xb8)
[<c0132dbd>] (kthread) from [<c0105f31>] (ret_from_fork+0x11/0x20)
Since the register access is mmio, we can use a spinlock to guard this
specific access, rather than the mutex that guards the entire phy.
Fixes: ba4bdc9e1dc0 ("PHY: sunxi: Add driver for sunxi usb phy") Cc: Hans de Goede <hdegoede@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Chen-Yu Tsai <wens@csie.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Hans de Goede [Wed, 7 Sep 2016 20:20:38 +0000 (22:20 +0200)]
phy-sun4i-usb: Refactor forced session ending
The phy-sun4i-usb code supports forced ending a session on systems
which lack Vbus detection, to allow switching between host and peripheral
mode on such systems.
Role switching via the musb driver "mode" sysfs attribute requires force
ending the session too. This commit refactors the code to allow other
parts of the phy-sun4i-usb code to request a forced session end.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Hans de Goede [Wed, 7 Sep 2016 20:20:37 +0000 (22:20 +0200)]
phy-sun4i-usb: Use bool where appropriate
We're using bool as true/false type in most places in phy-sun4i-usb.c
for consistency fixup the remaining uses of ints which are ever only
0 or 1 to be bools too.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
The driver now calls of_usb_get_dr_mode_by_phy, which is part of the
USB core layer, and it fails to build when that is not provided:
drivers/phy/phy-sun4i-usb.o: In function `sun4i_usb_phy_probe':
phy-sun4i-usb.c:(.text.sun4i_usb_phy_probe+0x140): undefined reference to `of_usb_get_dr_mode_by_phy'
We already have a couple of other PHY drivers with a dependency
on USB_SUPPORT, so that seems to be the easiest fix here.
An alternative would be to adjust the #ifdef in include/linux/usb/of.h
to also check for CONFIG_USB_SUPPORT.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Fixes: b33ecca87df9 ("phy-sun4i-usb: Add support for peripheral-only mode") Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Chris Zhong [Tue, 6 Sep 2016 17:00:20 +0000 (10:00 -0700)]
Documentation: bindings: add dt doc for Rockchip USB Type-C PHY
This patch adds a binding that describes the Rockchip USB Type-C PHY
for rk3399
Signed-off-by: Chris Zhong <zyw@rock-chips.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Chris Zhong [Wed, 24 Aug 2016 05:17:02 +0000 (22:17 -0700)]
phy: Add USB Type-C PHY driver for rk3399
Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB
Type-C PHY is designed to support the USB3 and DP applications.
The USB3 operates in SuperSpeed mode and the DP can operate at RBR,
HBR and HBR2 data rates. This driver create 2 PHY devices separately
for USB3 and DisplyPort, and registers them under the child node.
Signed-off-by: Chris Zhong <zyw@rock-chips.com> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Tested-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Chanwoo Choi [Fri, 5 Aug 2016 09:15:46 +0000 (18:15 +0900)]
extcon: Add new EXTCON_CHG_WPT for Wireless Power Transfer device
This patchs add the new EXTCON_CHG_WPT for Wireless Power Transfer[1].
The Wireless Power Transfer is the transmission of electronical energy
from a power source. The EXTCON_CHG_WPT has the EXTCON_TYPE_CHG.
Chanwoo Choi [Fri, 5 Aug 2016 08:49:23 +0000 (17:49 +0900)]
extcon: Add new EXTCON_DISP_HMD for Head-mounted Display device
This patch adds the new EXTCON_DISP_HMD id for Head-mounted Display[1] device.
The HMD device is usually for USB connector type So, the HMD connector
has the two extcon types of both EXTCON_TYPE_DISP and EXTCON_TYPE_USB.
Chris Zhong [Thu, 21 Jul 2016 16:13:02 +0000 (01:13 +0900)]
extcon: Add EXTCON_DISP_DP and the property for USB Type-C
Add EXTCON_DISP_DP for the Display external connector. For Type-C
connector the DisplayPort can work as an Alternate Mode(VESA DisplayPort
Alt Mode on USB Type-C Standard). The Type-C support both normal
and flipped orientation, so add a property to extcon.
Signed-off-by: Chris Zhong <zyw@rock-chips.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Tested-by: Chris Zhong <zyw@rock-chips.com> Tested-by: Guenter Roeck <groeck@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org>
extcon: Add the synchronization extcon APIs to support the notification
This patch adds the synchronization extcon APIs to support the notifications
for both state and property. When extcon_*_sync() functions is called,
the extcon informs the information from extcon provider to extcon client.
The extcon driver may need to change the both state and multiple properties
at the same time. After setting the data of a external connector,
the extcon send the notification to client driver with the extcon_*_sync().
The list of new extcon APIs as following:
- extcon_sync() : Send the notification for each external connector to
synchronize the information between extcon provider driver
and extcon client driver.
- extcon_set_state_sync() : Set the state of external connector with noti.
- extcon_set_property_sync() : Set the property of external connector with noti.
For example,
case 1, change the state of external connector and synchronized the data.
extcon_set_state_sync(edev, EXTCON_USB, 1);
case 2, change both the state and property of external connector
and synchronized the data.
extcon_set_state(edev, EXTCON_USB, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS 1);
extcon_sync(edev, EXTCON_USB);
case 3, change the property of external connector and synchronized the data.
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_sync(edev, EXTCON_USB);
case 4, change the property of external connector and synchronized the data.
extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon: Rename the extcon_set/get_state() to maintain the function naming pattern
This patch just renames the existing extcon_get/set_cable_state_()
as following because of maintaining the function naming pattern
like as extcon APIs for property.
- extcon_set_cable_state_() -> extcon_set_state()
- extcon_get_cable_state_() -> extcon_get_state()
But, this patch remains the old extcon_set/get_cable_state_() functions
to prevent the build break. After altering new APIs, remove the old APIs.
extcon: Add the support for the capability of each property
This patch adds the support of the property capability setting. This function
decides the supported properties of each external connector on extcon provider
driver.
Ths list of new extcon APIs to get/set the capability of property as following:
- int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
- int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
extcon: Add the support for extcon property according to extcon type
This patch support the extcon property for the external connector
because each external connector might have the property according to
the H/W design and the specific characteristics.
Add the new extcon APIs to get/set the property value as following:
- int extcon_get_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value *prop_val)
- int extcon_set_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value prop_val)
extcon: Add the extcon_type to gather each connector into five category
This patch adds the new extcon type to group the each connecotr
into following five category. This type would be used to handle
the connectors as a group unit instead of a connector unit.
- EXTCON_TYPE_USB : USB connector
- EXTCON_TYPE_CHG : Charger connector
- EXTCON_TYPE_JACK : Jack connector
- EXTCON_TYPE_DISP : Display connector
- EXTCON_TYPE_MISC : Miscellaneous connector
Also, each external connector is possible to belong to one more extcon type.
In caes of EXTCON_CHG_USB_SDP, it have the EXTCON_TYPE_CHG and EXTCON_TYPE_USB.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Tested-by: Chris Zhong <zyw@rock-chips.com> Tested-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
Maninder Singh [Mon, 1 Aug 2016 09:21:30 +0000 (14:51 +0530)]
extcon: Fix compile time warning
This patch fixes below compilation warning:-
drivers/extcon/extcon.c: In function extcon_register_notifier:
drivers/extcon/extcon.c:455:6: warning: idx may be used uninitialized in this function [-Wmaybe-uninitialized]
if (idx >= 0) {
Signed-off-by: Vaneet Narang <v.narang@samsung.com> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
[cw00.choi : Modify the patch title using the a captical letter for first char] Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 30 Jun 2016 17:41:18 +0000 (02:41 +0900)]
extcon: Block the bit masking operation for cable state except for extcon core
This patch restrict the usage of extcon_update_state() in the extcon
core because the extcon_update_state() use the bit masking to change
the state of external connector. When this function is used in device drivers,
it may occur the probelm with the handling mistake of bit masking.
Also, this patch removes the extcon_get/set_state() functions because these
functions use the bit masking which is reluctant way. Instead, extcon
provides the extcon_set/get_cable_state_() functions.
extcon: Remove the state_store() to prevent the wrong access
This patch removes the state_store() which change the state of external
connectors with bit masking on user-space. It is wrong access to modify
the change the state of external connectors.
extcon: gpio: Remove the usage of extcon_set_state()
This patch removes the usage of extcon_set_state() because it uses
the bit masking to change the state of external connectors. The extcon framework
should handle the state by extcon_set_cable_state_() with extcon id.
extcon: adc-jack: Remove the usage of extcon_set_state()
This patch removes the usage of extcon_set_state() because it uses the bit
masking to change the state of external connectors. The extcon framework
should handle the state by extcon_set/get_cable_state_() with extcon id.
Chanwoo Choi [Thu, 30 Jun 2016 17:36:49 +0000 (02:36 +0900)]
extcon: arizona: Remove the usage of extcon_update_state()
This patch remvoes the usage of extcon_update_state() because
the extcon_update_state() use directly the bit masking calculation
to change the state of external connector without the unique id of
external connector. It makes the code diffcult to read it.
So, this patch uses the extcon_set_cable_state_() instead.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Stephen Boyd [Tue, 5 Jul 2016 18:57:05 +0000 (11:57 -0700)]
extcon: Move extcon_get_edev_by_phandle() errors to dbg level
Sometimes drivers may call this API and expect it to fail because
the extcon they're looking for is optional. Let's move these
prints to debug level so it doesn't look like there's a problem
when there isn't one.
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
On kernel builds without COMMON_CLK, the newly added rockchip-inno-usb2
driver fails to build:
drivers/phy/phy-rockchip-inno-usb2.c:124:16: error: field 'clk480m_hw'
has incomplete type
struct clk_hw clk480m_hw;
In file included from include/linux/clk.h:16:0
from drivers/phy/phy-rockchip-inno-usb2.c:17:
include/linux/kernel.h:831:48: error: initialization from incompatible
pointer type [-Werror=incompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
... ...
Signed-off-by: Frank Wang <frank.wang@rock-chips.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Sekhar Nori [Tue, 23 Aug 2016 08:57:40 +0000 (11:57 +0300)]
dt-bindings: phy: ti: add documentation for ti,dra7x-usb2
Commit 7e472402ca30 ("phy: omap-usb2: Provide workaround for
USB2PHY false disconnect") added a new binding for USB2 PHYs
on DRA7x. But it has remained undocumented so far.
Add documentation for the binding.
Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Roger Quadros <rogerq@ti.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Sekhar Nori [Tue, 23 Aug 2016 08:57:39 +0000 (11:57 +0300)]
phy: omap-usb2: support suspend/resume
Relying on PM-ops for shutting down PHY clocks was a
bad idea since the users (e.g. USB DWC3) might not
have been suspended by then.
Get rid of all PM-ops. It is the sole responsibility
of the PHY user to properly turn OFF and de-initialize
the PHY as part of its suspend routine.
Enable/disable PHY clock as part of ->init()/->exit()
call respectively. With this phy_init() and phy_exit()
can be called by PHY user during suspend/resume.
This is similar to what is done for ti-pipe3 driver.
See 31c8954efb1b ("phy: ti-pipe3: fix suspend")
The pm_runtime_enable() call in omap_usb2_probe()
is still required because without it, phy_create()
will not enable runtime PM on the phy device it
creates and phy_init() will not call
pm_runtime_get_sync().
Without pm_runtime_get_sync(), ocp2scp hwmod will
_not_ enable the IP and, thus, we will have abort
exceptions.
Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Axel Lin [Tue, 30 Aug 2016 13:54:00 +0000 (21:54 +0800)]
phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops
Add missing .owner field in ns2_pci_phy_ops, which is used for refcounting.
While at it, also makes ns2_pci_phy_ops const as it's never get modified.
Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-and-tested-by: Jon Mason <jon.mason@broadcom.com> Reviewed-by: Pramod Kumar <pramodku@broadcom.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Axel Lin [Tue, 30 Aug 2016 13:53:59 +0000 (21:53 +0800)]
phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy
By setting phy_set_drvdata(phy, mdiodev), struct ns2_pci_phy can be
removed.
Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-and-tested-by: Jon Mason <jon.mason@broadcom.com> Reviewed-by: Pramod Kumar <pramodku@broadcom.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Baoyou Xie [Wed, 31 Aug 2016 09:05:19 +0000 (17:05 +0800)]
phy: tegra: mark tegra_xusb_lane_lookup_function() static
We get 1 warning when building kernel with W=1:
drivers/phy/tegra/xusb.c:104:5: warning: no previous prototype for 'tegra_xusb_lane_lookup_function' [-Wmissing-prototypes]
In fact, this function is only used in the file in which it is
declared and don't need a declaration, but can be made static.
So this patch marks it 'static'.
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Baoyou Xie [Wed, 31 Aug 2016 08:56:49 +0000 (16:56 +0800)]
phy: tegra: add missing header dependencies
We get 5 warnings when building kernel with W=1:
drivers/phy/tegra/xusb.c:948:27: warning: no previous prototype for 'tegra_xusb_padctl_get' [-Wmissing-prototypes]
drivers/phy/tegra/xusb.c:981:6: warning: no previous prototype for 'tegra_xusb_padctl_put' [-Wmissing-prototypes]
drivers/phy/tegra/xusb.c:988:5: warning: no previous prototype for 'tegra_xusb_padctl_usb3_save_context' [-Wmissing-prototypes]
drivers/phy/tegra/xusb.c:998:5: warning: no previous prototype for 'tegra_xusb_padctl_hsic_set_idle' [-Wmissing-prototypes]
drivers/phy/tegra/xusb.c:1008:5: warning: no previous prototype for 'tegra_xusb_padctl_usb3_set_lfps_detect' [-Wmissing-prototypes]
In fact, these functions are declared in linux/phy/tegra/xusb.h,
so this patch adds missing header dependencies.
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Frank Wang [Fri, 22 Jul 2016 07:00:44 +0000 (15:00 +0800)]
phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy
The newer SoCs (rk3366, rk3399) take a different usb-phy IP block
than rk3288 and before, and most of phy-related registers are also
different from the past, so a new phy driver is required necessarily.
Signed-off-by: Frank Wang <frank.wang@rock-chips.com> Suggested-by: Heiko Stuebner <heiko@sntech.de> Suggested-by: Guenter Roeck <linux@roeck-us.net> Suggested-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>