Badhri Jagan Sridharan
aecb1e452d
usb: typec: tcpci: Refactor tcpc_presenting_cc1_rd macro
...
Defining one macro instead of two for tcpc_presenting_*_rd.
This is a follow up of the comment left by Heikki Krogerus.
https://patchwork.kernel.org/project/linux-usb/patch/
20210304070931.1947316-1-badhri@google.com/
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210310223536.3471243-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-12 15:31:48 +01:00
Fabio Estevam
60a35ba914
usb: usb-mx2: Remove unused file
...
i.MX21 support has been dropped, so remove such unused file.
Signed-off-by: Fabio Estevam <festevam@gmail.com >
Link: https://lore.kernel.org/r/20210304023220.2362407-1-festevam@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:18 +01:00
Wei Yongjun
f2d90e07b5
usb: typec: stusb160x: fix return value check in stusb160x_probe()
...
In case of error, the function device_get_named_child_node() returns
NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.
Fixes: da0cb63100 ("usb: typec: add support for STUSB160x Type-C controller family")
Reported-by: Hulk Robot <hulkci@huawei.com >
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com >
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com >
Link: https://lore.kernel.org/r/20210308094839.3586773-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:18 +01:00
Wei Yongjun
604c75893a
usb: typec: tps6598x: Fix return value check in tps6598x_probe()
...
In case of error, the function device_get_named_child_node() returns
NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.
Fixes: 18a6c866bb ("usb: typec: tps6598x: Add USB role switching logic")
Reported-by: Hulk Robot <hulkci@huawei.com >
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com >
Link: https://lore.kernel.org/r/20210308094841.3587751-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:18 +01:00
Yang Li
493d0856de
usb: typec: tcpm: turn tcpm_ams_finish into void function
...
This function always return '0' and no callers use the return value.
So make it a void function.
This eliminates the following coccicheck warning:
./drivers/usb/typec/tcpm/tcpm.c:778:5-8: Unneeded variable: "ret".
Return "0" on line 794
Reported-by: Abaci Robot <abaci@linux.alibaba.com >
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com >
Link: https://lore.kernel.org/r/1615185330-118246-1-git-send-email-yang.lee@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:18 +01:00
Badhri Jagan Sridharan
19c234a14e
usb: typec: tcpci: Check ROLE_CONTROL while interpreting CC_STATUS
...
While interpreting CC_STATUS, ROLE_CONTROL has to be read to make
sure that CC1/CC2 is not forced presenting Rp/Rd.
>From the TCPCI spec:
4.4.5.2 ROLE_CONTROL (Normative):
The TCPM shall write B6 (DRP) = 0b and B3..0 (CC1/CC2) if it wishes
to control the Rp/Rd directly instead of having the TCPC perform
DRP toggling autonomously. When controlling Rp/Rd directly, the
TCPM writes to B3..0 (CC1/CC2) each time it wishes to change the
CC1/CC2 values. This control is used for TCPM-TCPC implementing
Source or Sink only as well as when a connection has been detected
via DRP toggling but the TCPM wishes to attempt Try.Src or Try.Snk.
Table 4-22. CC_STATUS Register Definition:
If (ROLE_CONTROL.CC1 = Rd) or ConnectResult=1)
00b: SNK.Open (Below maximum vRa)
01b: SNK.Default (Above minimum vRd-Connect)
10b: SNK.Power1.5 (Above minimum vRd-Connect) Detects Rp-1.5A
11b: SNK.Power3.0 (Above minimum vRd-Connect) Detects Rp-3.0A
If (ROLE_CONTROL.CC2=Rd) or (ConnectResult=1)
00b: SNK.Open (Below maximum vRa)
01b: SNK.Default (Above minimum vRd-Connect)
10b: SNK.Power1.5 (Above minimum vRd-Connect) Detects Rp 1.5A
11b: SNK.Power3.0 (Above minimum vRd-Connect) Detects Rp 3.0A
Fixes: 74e656d6b0 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com >
Link: https://lore.kernel.org/r/20210304070931.1947316-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:18 +01:00
Chunfeng Yun
365038f24b
usb: common: move function's kerneldoc next to its definition
...
Following a general rule, add the kerneldoc for a function next
to it's definition, but not next to its declaration in a header
file.
Suggested-by: Alan Stern <stern@rowland.harvard.edu >
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/c4d2e010ae2bf67cdfa0b55e6d1deb9339d9d3dc.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
f18b6edbce
usb: xhci-mtk: print debug info of endpoint interval
...
Print bInterval and convert it into the time expressed in
us or ms unit, this is the key info when allocate bandwidth
failed.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/f7a9fa7a812296fcd6c603bfa9853076144018d6.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
fb95c7cf56
usb: common: add function to get interval expressed in us unit
...
Add a new function to convert bInterval into the time expressed
in 1us unit.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/25c8a09b055f716c1e5bf11fea72c3418f844482.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
14295a1500
usb: xhci-mtk: support to build xhci-mtk-hcd.ko
...
Currently xhci-hcd.ko building depends on USB_XHCI_MTK, this
is not flexible for some cases. For example:
USB_XHCI_HCD is y, and USB_XHCI_MTK is m, then we can't
implement extended functions if only update xhci-mtk.ko
This patch is used to remove the dependence.
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com >
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/0b62e21ddfacc1c2874726dd27ccab80c993f303.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
dc9d3b2c4e
usb: xhci-mtk: remove declaration of xhci_mtk_setup()
...
Move xhci_driver_overrides struct variable after definition
of xhci_mtk_setup(), then we can remove it's declaration.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/cf627d611a5c59508371cc3360cb402b70825fd8.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
ccda8c224c
usb: xhci-mtk: add some schedule error number
...
This is used to provide more information about which case
causes bandwidth schedule failure.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/9771f44093053b581e9c4be4b7fb68d9fcecad08.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
bf7da03ae4
usb: xhci-mtk: rebuild the way to get bandwidth domain
...
Rebuild the function get_bw_index(), get the bandwidth domain
directly instead its index of domain array.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/de618970301702c57bd352bf87df48bc17c699dd.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
11fdcc3937
usb: xhci-mtk: use @tt_info to check the FS/LS device is under a HS hub
...
If the LS/FS device is connected to an external HS hub, the member
@tt_info in xhci_virt_device struct in not NULL, use it to check
whether a LS/FS device is under an exernal HS hub, then no need get
the slot context of this device.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/8117df52f16bd03087e486d7d740a183b6dd634a.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
6009bea08a
usb: xhci-mtk: add a member @speed in mu3h_sch_ep_info struct
...
This is used to drop parameter @udev for some functions,
meanwhile remove some unused @udev parameter.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/cda0833e44d6027cc8fdee1e29ce2b5b2a6ac03d.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
9132799d4a
usb: xhci-mtk: use clear type instead of void
...
Use struct usb_host_endpoint instead of void to declare
the member @ep of mu3h_sch_ep_info struct.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/e9790eb4b959f9f843433fa5048c76772cc59061.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
b707c13f98
usb: xhci-mtk: remove unnecessary members of mu3h_sch_tt struct
...
The members @usb_tt and @tt_port in mu3h_sch_tt struct
are not used after initialization, so can be removed
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/9afecc2411895a3c76658df26ebca1c961a39fbb.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:17 +01:00
Chunfeng Yun
44b948287a
usb: xhci-mtk: add a function to get bandwidth boundary
...
This is used to simplify unit test.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/805b3ba66c2f02a52de4440212519aaa58463039.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Chunfeng Yun
338af695ff
usb: xhci-mtk: add a function to (un)load bandwidth info
...
Extract a function to load/unload bandwidth info, and remove
a dummy check of TT offset.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/6fbc000756a4a4a7efbce651b785fee7561becb6.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Chunfeng Yun
4a56adf4fa
usb: xhci-mtk: use @sch_tt to check whether need do TT schedule
...
It's clearer to use @sch_tt to check whether need do TT schedule,
no function is changed.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/324a76782ccaf857a8f01f67aee435e8ec7d0e28.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Chunfeng Yun
1bf661daf6
usb: xhci-mtk: add only one extra CS for FS/LS INTR
...
In USB2 Spec:
"11.18.5 TT Response Generation
In general, there will be two (or more) complete-split
transactions scheduled for a periodic endpoint.
However, for interrupt endpoints, the maximum size of
the full-/low-speed transaction guarantees that it can
never require more than two complete-split transactions.
Two complete-split transactions are only required
when the transaction spans a microframe boundary."
Due to the maxp is 64, and less then 188 (at most in one
microframe), seems never span boundary, so use only one CS
for FS/LS interrupt transfer, this will save some bandwidth.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/5b9ff09f53d23cf9e5c5437db4ffc18b798bf60c.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Chunfeng Yun
7c986fbc16
usb: xhci-mtk: get the microframe boundary for ESIT
...
Tune the boundary for FS/LS ESIT due to CS:
For ISOC out-ep, the controller starts transfer data after
the first SS; for others, the data is already transferred
before the last CS.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/49e5a269a47984f3126a70c3fb471b0c2874b8c2.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Chunfeng Yun
e19ee44a3d
usb: xhci-mtk: improve bandwidth scheduling with TT
...
When the USB headset is plug into an external hub, sometimes
can't set config due to not enough bandwidth, so need improve
LS/FS INT/ISOC bandwidth scheduling with TT.
Fixes: 54f6a8af37 ("usb: xhci-mtk: skip dropping bandwidth of unchecked endpoints")
Cc: stable <stable@vger.kernel.org >
Signed-off-by: Yaqii Wu <yaqii.wu@mediatek.com >
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/2f30e81400a59afef5f8231c98149169c7520519.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Chunfeng Yun
5fa5827566
usb: xhci-mtk: remove or operator for setting schedule parameters
...
Side effect may happen if use or operator to set schedule parameters
when the parameters are already set before. Set them directly due to
other bits are reserved.
Fixes: 54f6a8af37 ("usb: xhci-mtk: skip dropping bandwidth of unchecked endpoints")
Cc: stable <stable@vger.kernel.org >
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/d287899e6beb2fc1bfb8900c75a872f628ecde55.1615170625.git.chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Ray Chi
0f3edf99c2
usb: dwc3: document usb_psy in struct dwc3
...
The new struct member was added to struct dwc3, but
a documentation was missing:
drivers/usb/dwc3/core.h:1273: warning: Function parameter or member 'usb_psy' not described in 'dwc3'
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au >
Signed-off-by: Ray Chi <raychi@google.com >
Link: https://lore.kernel.org/r/20210303095802.2801733-1-raychi@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Colin Ian King
b0bf77cd38
usb: dwc3: Fix dereferencing of null dwc->usb_psy
...
Currently the null check logic on dwc->usb_psy is inverted as it allows
calls to power_supply_put with a null dwc->usb_psy causing a null
pointer dereference. Fix this by removing the ! operator.
Addresses-Coverity: ("Dereference after null check")
Fixes: 59fa3def35de ("usb: dwc3: add a power supply for current control")
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Link: https://lore.kernel.org/r/20210303095826.6143-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Greg Kroah-Hartman
92d1e87e62
USB: remove usb_bus_type from usb.h
...
We have 2 forward declarations of usb_bus_type, one in the system-wide
usb.h and the other in the "USB core only header file". This variable
is not exported from the USB core, so remove the declaration from usb.h
as it does not need to be there.
Cc: Thomas Zimmermann <tzimmermann@suse.de >
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20210226102356.716746-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Greg Kroah-Hartman
153e140d1e
USB: typec: tcpm: create debugfs subdir for the driver
...
The single debugfs file for this driver really is a log file, so make a
subdir and call it "log" to make it obvious this is what it is for.
This makes cleanup simpler as we just remove the whole directory, no
need to handle individual files anymore.
Cc: Guenter Roeck <linux@roeck-us.net >
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Cc: linux-usb@vger.kernel.org
Reviewed-by: Guenter Roeck <linux@roeck-us.net >
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Link: https://lore.kernel.org/r/20210216144645.3813043-6-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:16 +01:00
Greg Kroah-Hartman
24a16199d9
USB: typec: fusb302: create debugfs subdir for the driver
...
The single debugfs file for this driver really is a log file, so make a
subdir and call it "log" to make it obvious this is what it is for.
This makes cleanup simpler as we just remove the whole directory, no
need to handle individual files anymore.
Cc: Guenter Roeck <linux@roeck-us.net >
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Cc: linux-usb@vger.kernel.org
Reviewed-by: Guenter Roeck <linux@roeck-us.net >
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Link: https://lore.kernel.org/r/20210216144645.3813043-5-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Greg Kroah-Hartman
5649d86f53
USB: host: uhci: remove dentry pointer for debugfs
...
There is no need to keep the dentry pointer around for the created
debugfs file, as it is only needed when removing it from the system.
When it is to be removed, ask debugfs itself for the pointer, to save on
storage and make things a bit simpler.
And, no one noticed that a __maybe_unused dentry * in uhci_start()
really was unused, so remove that as it's obviously not needed, and
hasn't been for quite some time.
Cc: Alan Stern <stern@rowland.harvard.edu >
Cc: linux-usb@vger.kernel.org
Link: https://lore.kernel.org/r/20210216144645.3813043-4-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Greg Kroah-Hartman
82d4afcfa9
USB: host: sl811: remove dentry pointer for debugfs
...
There is no need to keep the dentry pointer around for the created
debugfs file, as it is only needed when removing it from the system.
When it is to be removed, ask debugfs itself for the pointer, to save on
storage and make things a bit simpler.
Cc: linux-usb@vger.kernel.org
Link: https://lore.kernel.org/r/20210216144645.3813043-3-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Greg Kroah-Hartman
7347f4b95f
USB: host: isp1362: remove dentry pointer for debugfs
...
There is no need to keep the dentry pointer around for the created
debugfs file, as it is only needed when removing it from the system.
When it is to be removed, ask debugfs itself for the pointer, to save on
storage and make things a bit simpler.
Cc: linux-usb@vger.kernel.org
Link: https://lore.kernel.org/r/20210216144645.3813043-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Greg Kroah-Hartman
7c7b971d71
USB: host: isp116x: remove dentry pointer for debugfs
...
There is no need to keep the dentry pointer around for the created
debugfs file, as it is only needed when removing it from the system.
When it is to be removed, ask debugfs itself for the pointer, to save on
storage and make things a bit simpler.
Cc: Olav Kongas <ok@artecdesign.ee >
Cc: linux-usb@vger.kernel.org
Link: https://lore.kernel.org/r/20210216144645.3813043-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Martin Devera
b9d9137d29
usb: dwc2: Add STM32 related debugfs entries
...
These are entries related to STM32MP1 PHY control.
Acked-by: Minas Harutyunyan <hminas@synopsys.com >
Signed-off-by: Martin Devera <devik@eaxlabs.cz >
Link: https://lore.kernel.org/r/20210227215528.12752-1-devik@eaxlabs.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
kernel test robot
4294a8c2b8
usb: chipidea: tegra: fix flexible_array.cocci warnings
...
Zero-length and one-element arrays are deprecated, see
Documentation/process/deprecated.rst
Flexible-array members should be used instead.
Generated by: scripts/coccinelle/misc/flexible_array.cocci
Fixes: fc53d52790 ("usb: chipidea: tegra: Support host mode")
CC: Peter Geis <pgwipeout@gmail.com >
Reported-by: kernel test robot <lkp@intel.com >
Reviewed-by: Dmitry Osipenko <digetx@gmail.com >
Signed-off-by: kernel test robot <lkp@intel.com >
Signed-off-by: Julia Lawall <julia.lawall@inria.fr >
Link: https://lore.kernel.org/r/alpine.DEB.2.22.394.2102132108040.2720@hadrien
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Colin Ian King
292f750f43
USB: gadget: dummy-hcd: remove redundant initialization of variable 'value'
...
The variable 'value' is being initialized with 1 that is never read
and it is being updated later with a new value. The initialization is
redundant and can be removed.
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Addresses-Coverity: ("Unused value")
Link: https://lore.kernel.org/r/20210217210124.197780-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Greg Kroah-Hartman
9c174b57c9
USB: core: no need to save usb_devices_root
...
There is no need to save the usb_devices debugfs file as we only need it
when removing it, so have the debugfs code look it up when it is needed
instead, saving the storage.
Link: https://lore.kernel.org/r/YCubCA/trHAF7PtF@kroah.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Chen Lin
70be046404
usb: gadget: storage: Remove unused function pointer typedef fsg_routine_t
...
Remove the 'fsg_routine_t' typedef as it is not used.
Signed-off-by: Chen Lin <chen.lin5@zte.com.cn >
Link: https://lore.kernel.org/r/1613384130-3028-1-git-send-email-chen45464546@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Wei Ming Chen
e21a2e0a0f
usb: gadget: function: fix typo in f_printer.c
...
In line 824, it is trying to enable `out_ep`, so I
believe that in line 826, it should print `out_ep`
instead of `in_ep`.
Signed-off-by: Wei Ming Chen <jj251510319013@gmail.com >
Link: https://lore.kernel.org/r/20210214121929.9750-1-jj251510319013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Badhri Jagan Sridharan
3287f58bcb
usb: typec: tcpm: Wait for vbus discharge to VSAFE0V before toggling
...
When vbus auto discharge is enabled, TCPM can sometimes be faster than
the TCPC i.e. TCPM can go ahead and move the port to unattached state
(involves disabling vbus auto discharge) before TCPC could effectively
discharge vbus to VSAFE0V. This leaves vbus with residual charge and
increases the decay time which prevents tsafe0v from being met.
This change makes TCPM waits for a maximum of tSafe0V(max) for vbus
to discharge to VSAFE0V before transitioning to unattached state
and re-enable toggling. If vbus discharges to vsafe0v sooner, then,
transition to unattached state
happens right away.
Also, while in SNK_READY, when auto discharge is enabled, drive
disconnect based on vbus turning off instead of Rp disappearing on
CC pins. Rp disappearing on CC pins is almost instanteous compared
to vbus decay.
Sink detach:
[ 541.703058] CC1: 3 -> 0, CC2: 0 -> 0 [state SNK_READY, polarity 0, disconnected]
[ 541.703331] Setting voltage/current limit 5000 mV 0 mA
[ 541.727235] VBUS on
[ 541.749650] VBUS off
[ 541.749653] pending state change SNK_READY -> SNK_UNATTACHED @ 650 ms [rev3 NONE_AMS]
[ 541.749944] VBUS VSAFE0V
[ 541.749945] state change SNK_READY -> SNK_UNATTACHED [rev3 NONE_AMS]
[ 541.750806] Disable vbus discharge ret:0
[ 541.907345] Start toggling
[ 541.922799] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
Source detach:
[ 2555.310414] state change SRC_SEND_CAPABILITIES -> SRC_READY [rev3 POWER_NEGOTIATION]
[ 2555.310675] AMS POWER_NEGOTIATION finished
[ 2555.310679] cc:=3
[ 2593.645886] CC1: 0 -> 0, CC2: 2 -> 0 [state SRC_READY, polarity 1, disconnected]
[ 2593.645919] pending state change SRC_READY -> SNK_UNATTACHED @ 650 ms [rev3 NONE_AMS]
[ 2593.648419] VBUS off
[ 2593.648960] VBUS VSAFE0V
[ 2593.648965] state change SRC_READY -> SNK_UNATTACHED [rev3 NONE_AMS]
[ 2593.649962] Disable vbus discharge ret:0
[ 2593.890322] Start toggling
[ 2593.925663] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0,
Fixes: f321a02cae ("usb: typec: tcpm: Implement enabling Auto Discharge disconnect support")
Reviewed-by: Guenter Roeck <linux@roeck-us.net >
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com >
Link: https://lore.kernel.org/r/20210225101104.1680697-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:15 +01:00
Guido Günther
ced0e777e6
usb: typec: tps6598x: Add trace event for data status
...
This is useful to debug DP negotiation and pin assignment even
when the firmware does all the work.
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Signed-off-by: Guido Günther <agx@sigxcpu.org >
Link: https://lore.kernel.org/r/1125497fb83eac13fa1ee532759b91ce03770572.1613389531.git.agx@sigxcpu.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:14 +01:00
Guido Günther
9c9c1ddbf6
usb: typec: tps6598x: Add trace event for power status register
...
Together with the PD status register this is vital for debugging power
negotiations at runtime.
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Signed-off-by: Guido Günther <agx@sigxcpu.org >
Link: https://lore.kernel.org/r/3c92da489fa03d6fe67ac18443c48dccb1bf048a.1613389531.git.agx@sigxcpu.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:14 +01:00
Guido Günther
02a9ada7eb
usb: typec: tps6598x: Add trace event for status register
...
This allows to trace status information which helps to debug problems
with role switching, etc.
We don't use the generic FIELD_GET() to reduce the macro size since we
otherwise trip up sparse.
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Signed-off-by: Guido Günther <agx@sigxcpu.org >
Link: https://lore.kernel.org/r/d24742be3c98382cbef17047f3eecf0f7d807f31.1613389531.git.agx@sigxcpu.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:14 +01:00
Guido Günther
95cd85a9d4
usb: typec: tps6598x: Add trace event for IRQ events
...
Allow to get irq event information via the tracing framework. This
allows to inspect USB-C negotiation at runtime.
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Signed-off-by: Guido Günther <agx@sigxcpu.org >
Link: https://lore.kernel.org/r/11444ae487d69da98ec20a18f2e49259e68319e3.1613389531.git.agx@sigxcpu.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:14 +01:00
Ray Chi
99288de360
usb: dwc3: add an alternate path in vbus_draw callback
...
This patch adds an alternate path in vbus_draw callback through
power supply property POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT.
Signed-off-by: Ray Chi <raychi@google.com >
Link: https://lore.kernel.org/r/20210222115149.3606776-3-raychi@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:14 +01:00
Ray Chi
6f0764b5ad
usb: dwc3: add a power supply for current control
...
Currently, VBUS draw callback does no action when the
generic PHYs are used. This patch adds an additional
path to control charging current through power supply
interface.
Signed-off-by: Ray Chi <raychi@google.com >
Link: https://lore.kernel.org/r/20210222115149.3606776-2-raychi@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:37:14 +01:00
Linus Torvalds
a38fd87484
Linux 5.12-rc2
2021-03-05 17:33:41 -08:00
Linus Torvalds
f3ed4de6cc
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
...
Pull rdma fixes from Jason Gunthorpe:
"Nothing special here, though Bob's regression fixes for rxe would have
made it before the rc cycle had there not been such strong winter
weather!
- Fix corner cases in the rxe reference counting cleanup that are
causing regressions in blktests for SRP
- Two kdoc fixes so W=1 is clean
- Missing error return in error unwind for mlx5
- Wrong lock type nesting in IB CM"
* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
RDMA/rxe: Fix errant WARN_ONCE in rxe_completer()
RDMA/rxe: Fix extra deref in rxe_rcv_mcast_pkt()
RDMA/rxe: Fix missed IB reference counting in loopback
RDMA/uverbs: Fix kernel-doc warning of _uverbs_alloc
RDMA/mlx5: Set correct kernel-doc identifier
IB/mlx5: Add missing error code
RDMA/rxe: Fix missing kconfig dependency on CRYPTO
RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep
2021-03-05 17:27:59 -08:00
Linus Torvalds
de5bd6c54b
Merge tag 'gcc-plugins-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
...
Pull gcc-plugins fixes from Kees Cook:
"Tiny gcc-plugin fixes for v5.12-rc2. These issues are small but have
been reported a couple times now by static analyzers, so best to get
them fixed to reduce the noise. :)
- Fix coding style issues (Jason Yan)"
* tag 'gcc-plugins-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
gcc-plugins: latent_entropy: remove unneeded semicolon
gcc-plugins: structleak: remove unneeded variable 'ret'
2021-03-05 17:23:03 -08:00
Linus Torvalds
8b24ef4478
Merge tag 'pstore-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
...
Pull pstore fixes from Kees Cook:
- Rate-limit ECC warnings (Dmitry Osipenko)
- Fix error path check for NULL (Tetsuo Handa)
* tag 'pstore-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
pstore/ram: Rate-limit "uncorrectable error in header" message
pstore: Fix warning in pstore_kill_sb()
2021-03-05 17:21:25 -08:00