aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/phy
AgeCommit message (Collapse)AuthorFilesLines
2017-08-15usb: phy: Add USB charger supportBaolin Wang1-0/+272
This patch introduces the usb charger support based on usb phy that makes an enhancement to a power driver. The basic conception of the usb charger is that, when one usb charger is added or removed by reporting from the extcon device state change, the usb charger will report to power user to set the current limitation. Power user can register a notifiee on the usb phy by issuing usb_register_notifier() to get notified by charger status changes or charger current changes. we can notify what current to be drawn to power user according to different charger type, and now we have 2 methods to get charger type. One is get charger type from extcon subsystem, which also means the charger state changes. Another is we can get the charger type from USB controller detecting or PMIC detecting, and the charger state changes should be told by issuing usb_phy_set_charger_state(). Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-08-15usb: phy-tahvo: constify attribute_group structures.Arvind Yadav1-1/+1
attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-08-15usb: phy-mv-usb: constify attribute_group structures.Arvind Yadav1-1/+1
attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-08-15usb: phy: qcom: Use devm_ioremap_resource()Fabio Estevam1-6/+3
Using devm_ioremap_resource() can make the code simpler, as it already does the resource NULL check. Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-08-15mfd: tps65010: Move header file out of I2C realmWolfram Sang1-1/+1
include/linux/i2c is not for client devices. Move the header file to a more appropriate location. Signed-off-by: Wolfram Sang <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Acked-by: Tony Lindgren <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2017-08-14Merge 4.13-rc5 into usb-nextGreg Kroah-Hartman1-8/+9
This gets the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-08-10usb: phy-mv-usb: constify attribute_group structures.Arvind Yadav1-1/+1
attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-08-10usb: phy-tahvo: constify attribute_group structures.Arvind Yadav1-1/+1
attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-08-03usb: phy: phy-msm-usb: Fix usage of devm_regulator_bulk_get()Rajendra Nayak1-8/+9
The regulator_bulk_data pointer passed to devm_regulator_bulk_get() is used to store the client handles for the regulators, which is later used by devm_regulator_bulk_release() to free the regulators. Passing a local array as is done here means the memory used to store the handles is freed causing the handles to be corrupted, resulting in a crash when devm_regulator_bulk_release() tries to free them. Fix this my moving the array inside of the msm_otg structure. Signed-off-by: Rajendra Nayak <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-07-22usb: Convert to using %pOF instead of full_nameRob Herring1-2/+2
Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-07-22USB: phy: remove unneeded MODULE_VERSION() usageGreg Kroah-Hartman1-2/+0
MODULE_VERSION is useless for in-kernel drivers, so remove the use of it in the marvel phy driver, along with the DRIVER_VERSION define. Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-17usb: phy: phy-msm-usb: Remove redundant extcon register/unregisterBaolin Wang1-67/+18
Since usb phy core has added common code to register or unregister extcon device, then phy-msm-usb driver does not need its own code to register/unregister extcon device, then remove them. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-05-17usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregisterBaolin Wang1-15/+5
Since usb phy core has added common code to register or unregister extcon device, then phy-qcom-8x16-usb driver does not need its own code to register/unregister extcon device, then remove them. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-05-17usb: phy: Introduce one extcon device into usb phyBaolin Wang2-3/+60
Usually usb phy need register one extcon device to get the connection notifications. It will remove some duplicate code if the extcon device is registered using common code instead of each phy driver having its own related extcon APIs. So we add one pointer of extcon device into usb phy structure, and some other helper functions to register extcon. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-04-11Merge tag 'usb-for-v4.12' of ↵Greg Kroah-Hartman1-0/+7
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: changes for v4.12 With 51 non-merge commits, this is one of the smallest USB Gadget pull requests. Apart from your expected set of non-critical fixes, and other miscellaneous items, we have most of the changes in dwc3 (52.5%) with all other UDCs following with 34.8%. As for the actual changes, the most important of them are all the recent changes to reduce memory footprint of dwc3, bare minimum dual-role support on dwc3 and reworked endpoint count and initialization routines.
2017-04-11usb: otg-fsm: Prevent build warning "VDBG" redefinedRoger Quadros1-0/+7
If usb/otg-fsm.h and usb/composite.h are included together then it results in the build warning [1]. Prevent that by defining VDBG locally. Also get rid of MPC_LOC which doesn't seem to be used by anyone. [1] - warning fixed by this patch: In file included from drivers/usb/dwc3/core.h:33, from drivers/usb/dwc3/ep0.c:33: include/linux/usb/otg-fsm.h:30:1: warning: "VDBG" redefined In file included from drivers/usb/dwc3/ep0.c:31: include/linux/usb/composite.h:615:1: warning: this is the location of the previous definition Signed-off-by: Roger Quadros <[email protected]> Reviewed-by: Jun Li <[email protected]> Acked-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-04-11usb: phy: Remove unused configBaolin Wang2-8/+0
Since the old common Samsung USB PHY code has been removed by commit ea2fdf8423 ("usb: phy: samsung: remove old common USB PHY code"), thus remove the unused config. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-04-03Merge 4.11-rc5 into usb-nextGreg Kroah-Hartman1-1/+1
We want the usb fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-03-29usb: phy: isp1301: Fix build warning when CONFIG_OF is disabledJavier Martinez Canillas1-1/+1
Commit fd567653bdb9 ("usb: phy: isp1301: Add OF device ID table") added an OF device ID table, but used the of_match_ptr() macro that will lead to a build warning if CONFIG_OF symbol is disabled: drivers/usb/phy//phy-isp1301.c:36:34: warning: ‘isp1301_of_match’ defined but not used [-Wunused-const-variable=] static const struct of_device_id isp1301_of_match[] = { ^~~~~~~~~~~~~~~~ Fixes: fd567653bdb9 ("usb: phy: isp1301: Add OF device ID table") Reported-by: Arnd Bergmann <[email protected]> Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-03-23usb: phy: Remove unused configBaolin Wang2-8/+0
Since the old common Samsung USB PHY code has been removed by commit ea2fdf8423 ("usb: phy: samsung: remove old common USB PHY code"), thus remove the unused config. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-03-09usb: phy: isp1301: Add OF device ID tableJavier Martinez Canillas1-0/+7
The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-01-26usb: phy: ab8500: remove unused ab8500_eyediagram_workaroud()Arnd Bergmann1-13/+0
The only caller of this function is gone, so now we get a warning: drivers/usb/phy/phy-ab8500-usb.c:1026:17: error: 'ab8500_eyediagram_workaroud' defined but not used [-Werror=unused-function] It is possible that we should in fact still call the function from somewhere else, but I don't see from where. Fixes: 635f997a499b ("usb: phy: ab8500: Remove the set_power callback") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: phy: fsl: Remove the set_power callbackBaolin Wang1-12/+0
Since the set_power callback did not do anything for power setting, then remove it. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: phy: msm: Remove the set_power callbackBaolin Wang1-18/+0
Since it will not set the PMIC current drawn from USB configuration by set_power callback, then remove it. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: phy: ab8500: Remove the set_power callbackBaolin Wang1-20/+0
There are no users will use the vbus_draw variable set by set_power() callback to set the vbus current. Thus we can remove it. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: phy: tahvo: Replace the deprecated extcon APIChanwoo Choi1-5/+5
This patch replaces the deprecated extcon API as following: - extcon_set_cable_state_() -> extcon_set_state_sync() Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: phy: qcom-8x16-usb: Replace the extcon APIChanwoo Choi1-9/+4
This patch uses the resource-managed extcon API for extcon_register_notifier() and replaces the deprecated extcon API as following: - extcon_get_cable_state_() -> extcon_get_state() Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: phy: msm: Replace the extcon APIChanwoo Choi1-22/+11
This patch uses the resource-managed extcon API for extcon_register_notifier() and replaces the deprecated extcon API as following: - extcon_get_cable_state_() -> extcon_get_state() Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: phy: omap-otg: Replace the extcon APIChanwoo Choi1-18/+6
This patch uses the resource-managed extcon API for extcon_register_notifier() and replaces the deprecated extcon API as following: - extcon_get_cable_state_() -> extcon_get_state() Cc: [email protected] Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: twl6030-usb: make driver DT onlyNicolae Rosia2-17/+7
All users are DT-only and it makes no sense to keep unused code Acked-by: Tony Lindgren <[email protected]> Signed-off-by: Nicolae Rosia <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: phy: phy-generic: add the implementation of .set_suspendPeter Chen1-0/+9
Add clock operation at .set_suspend if the PHY has suspend requirement, it can be benefit of power saving for phy and the whole system (parent clock may also be disabled). Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: isp1301-omap: don't opencode IS_REACHABLE()Fabian Frederick1-1/+1
We have a macro which does the same trick. Let's use it. Signed-off-by: Fabian Frederick <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18USB: phy: am335x-control: fix device and of_node leaksJohan Hovold1-0/+2
Make sure to drop the references taken by of_parse_phandle() and bus_find_device() before returning from am335x_get_phy_control(). Note that there is no guarantee that the devres-managed struct phy_control will be valid for the lifetime of the sibling phy device regardless of this change. Fixes: 3bb869c8b3f1 ("usb: phy: Add AM335x PHY driver") Acked-by: Bin Liu <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-09-14Merge tag 'usb-for-v4.9' of ↵Greg Kroah-Hartman3-9/+69
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.
2016-09-05usb: phy: phy-generic: Check clk_prepare_enable() errorFabio Estevam1-2/+6
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of failure. Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-08-29usb: phy: ab8500-usb: fix spelling mistake "regester" -> "register"Colin Ian King1-4/+4
Trivial fix to spelling mistakes in dev_err messages. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-08-25usb: phy: mxs: Add DT bindings to configure TX settingsJaret Cantu1-0/+61
The TX settings can be calibrated for particular hardware. The phy is reset by Linux, so this cannot be handled by the bootloader. The TRM mentions that the maximum resistance should be used for the DN/DP calibration in order to pass USB certification. The values for the TX registers are poorly described in the TRM. The meanings of the register values were taken from another NXP-provided document: https://community.nxp.com/message/566147#comment-566912 Acked-by: Peter Chen <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Jaret Cantu <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-08-25usb: phy: generic: remove the vbus dependencyRobert Jarzmik1-5/+2
As the last known user, ie. pxa27x_udc relying on calls to usb_gadget_xxx() was amended to use the phy notifier, remove a bit the USB stack adherence. Actually the driver still uses the gadget API for structures definition, but the implementation of USB gadget specific function usb_gadget_*() is not necessary anymore. Signed-off-by: Robert Jarzmik <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-08-25usb: phy: generic: cope with initial stateRobert Jarzmik1-0/+2
In the gpio based case, the status of the phy is known at start by reading the VBus gpio. Actually, this is a fix, as this initial state, when not set up, prevents a gadget to answer to the enumeration phase, as there is no notification in this case (the VBus is already high when kernel boots) so no interrupt is triggered, and the flow is : - gadget initializes - gadget gets its phy-generic with a xxx_get_phy_xxx() call type - gadget does a "set_peripheral()" call type => here if the otg->state is correctly filled, the proper vbus handling will be called, and the gadget will be aware it should answer enumeration and go forth Without this fix, the USB cable must be removed and replugged for any gadget relying on phy-generic and its gpio vbus handling to work. The problem was seen on a pxa27x architecture based board on a devicetree build. Signed-off-by: Robert Jarzmik <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-08-11usb: phy: omap-otg: Fix missing platform_set_drvdata() in omap_otg_probe()Wei Yongjun1-0/+2
Add missing platform_set_drvdata() in omap_otg_probe(), otherwise calling platform_get_drvdata() in remove returns NULL. This is detected by Coccinelle semantic patch. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-06-21usb: phy: move msm_hsusb.h into driverArnd Bergmann1-1/+177
As a preparation for another cleanup, this moves the header file for the phy-msm-usb driver into the driver itself. No other file includes it any more, and we don't really want it in the global namespace anyway. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-06-21usb: phy: omap-otg: Space required after that ','.Sandhya Bankar1-1/+1
Space required after that ','. Reviewed-by: Aaro Koskinen <[email protected]> Signed-off-by: Sandhya Bankar <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-06-21USB: Fix of_usb_get_dr_mode_by_phy with a shared phy blockHans de Goede1-1/+1
Some SoCs have a single phy-hw-block with multiple phys, this is modelled by a single phy dts node, so we end up with multiple controller nodes with a phys property pointing to the phy-node of the otg-phy. Only one of these controllers typically is an otg controller, yet we were checking the first controller who uses a phy from the block and then end up looking for a dr_mode property in e.g. the ehci controller. This commit fixes this by adding an arg0 parameter to of_usb_get_dr_mode_by_phy and make of_usb_get_dr_mode_by_phy check that this matches the phandle args[0] value when looking for the otg controller. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-06-21usb: gadget: move gadget API functions to udc-coreFelipe Balbi1-2/+9
instead of defining all functions as static inlines, let's move them to udc-core and export them with EXPORT_SYMBOL_GPL, that way we can make sure that only GPL drivers will use them. As a side effect, it'll be nicer to add tracepoints to the gadget API. While at that, also fix Kconfig dependencies to avoid randconfig build failures. Acked-By: Sebastian Reichel <[email protected]> Acked-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-06-01usb: phy: Check initial state for twl6030Tony Lindgren1-2/+15
We need to check the state for the PHY with delayed_work as otherwise MUSB will get confused and idles immediately. Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Bin Liu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-06-01usb: musb: Return error value from musb_mailboxTony Lindgren1-3/+9
At least on n900 we have phy-twl4030-usb only generating cable interrupts, and then have a separate USB PHY. In order for musb to know the real cable status, we need to clear any cached state until musb is ready. Otherwise the cable status interrupts will get just ignored if the status does not change from the initial state. To do this, let's add a return value to musb_mailbox(), and reset cached linkstat to MUSB_UNKNOWN on error. Sorry to cause a bit of churn here, I should have added that already last time patching musb_mailbox(). Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Bin Liu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-05-09usb: Remove unnecessary space before operator ','.Sandhya Bankar1-5/+5
Remove unnecessary space before operator ','. Signed-off-by: Sandhya Bankar <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-04-14usb: phy: qcom: use PTR_ERR_OR_ZERO()Felipe Balbi1-4/+1
coccicheck found this pattern which could be converted to PTR_ERR_OR_ZERO(). No functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2016-03-30usb: phy: qcom-8x16: fix regulator API abuseArnd Bergmann1-61/+11
gcc warns about the use of regulators in phy_8x16_probe: drivers/usb/phy/phy-qcom-8x16-usb.c: In function 'phy_8x16_probe': drivers/usb/phy/phy-qcom-8x16-usb.c:284:13: error: 'regs[0].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/usb/phy/phy-qcom-8x16-usb.c:285:13: error: 'regs[1].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/usb/phy/phy-qcom-8x16-usb.c:286:12: error: 'regs[2].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized] According to Mark Brown, this is the result of various abuses of the PHY interfaces [1], so let's fix the driver instead. This puts the regulator bulk data into the device structure so it gets properly initialized and lets us call regulator_bulk_enable() and regulator_bulk_disable() rather than open-coding them. Setting the voltages the way the driver does is rather pointless because for each regulator there is only one valid voltage range, so that can just get set up in the DT. As there doesn't seem to be any user of the newly added driver yet, we can simply make sure the DTs are setting this up right when they get added. I'm also fixing the handling of regulator_bulk_enable() failure. Right now, the driver just ignores any failure, which doesn't make sense, so I'm changing it to loudly complain (in case we actually had a bug here) and error out. Doing a fly-by review of the driver, I notice a couple of other problems that I'm not addressing here: - It really should not have been written as a USB PHY driver, but instead should use the PHY subsystem. - The DT compatible string does not follow the usual conventions, and it should have a proper identifier in it rather than a wildcard. - The example in the devicetree binding lists a register address that is the same as the actual EHCI host controller in the SoC as well as the otg-snps and the ci-hdrc device, which indicates that these are probably not even distinct devices (or all but one of them are wrong), and if more than one of them tries to request the resources correctly, they fail. [1] https://lkml.org/lkml/2016/1/26/267 Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-03-04usb: phy: generic: Handle late registration of gadgetMaarten ter Huurne1-3/+8
It is possible for the VBUS detect GPIO interrupt to occur before nop_set_peripheral() is called, in which case otg->gadget is NULL. Signed-off-by: Maarten ter Huurne <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>