Commit graph

39 commits

Author SHA1 Message Date
Chien Kun Niu
d72768a1fe usb: hal: add all the i2c nodes for tcpc functions
This change is to add all the possible i2c nodes for tcpc functions with the correct permission, due to the path may change with different android version.

Bug: 273391794
Test: limit 1.3A work when connect to Head Unit
Change-Id: Iefb44f37c5b42ae5579e928477efc927d270b724
2023-03-21 05:14:41 +00:00
Xiang Wang
59332ea7e9 Move thermal utils to hardware/interfaces
Bug: b/269370789
Test: m
Change-Id: If7628b88a0b5a8d933dd0431eac2d3663649e834
Merged-In: If7628b88a0b5a8d933dd0431eac2d3663649e834
2023-02-23 04:29:33 +00:00
Badhri Jagan Sridharan
7c2d62aafc Usb: Set connected status when connected to non compliant port partners
Set mode, power role and data role when connected to non compliant
port partners.

Bug: 268584498
Change-Id: I6c3e7df09a61e26f3b976a86bd65cb646edd653d
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
2023-02-22 22:05:43 +00:00
RD Babiera
fb37a2a183 Usb non-compliant port partner gs201 implementation
Adds vendor code for non-compliant charger feature. Currently
updates service version.

Minor port of  commit 96ccf93453583642a15dd96b1e4d6bf0645fc10b

Test: atest VtsAidlUsbTargetTest
Bug: 236322506
Change-Id: Ie1a48b1acaaae9a53f3b9bfebcfee7a2f4814810
(cherry picked from commit 96ccf93453583642a15dd96b1e4d6bf0645fc10b)
2023-02-22 22:05:43 +00:00
Xiang Wang
5f6267c0b0 Update USB HAL clients to use Thermal stable AIDL
Bug: b/264594715
Test: boot test
Change-Id: I2ff6095e8ea6f0c5cc48b303585b65acc8a14f53
2023-02-14 22:24:23 +00:00
Roy Luo
4e38e3b8c3 Add shell command to send vendor command to GL852G
Bug: 261923350
Test: adb shell cmd android.hardware.usb.IUsb/default hub-vendor-cmd
<hex wValue> <hex wIndex>
Change-Id: I83b56d28cfd89dfaf51fce88f97020196402f972
Signed-off-by: Roy Luo <royluo@google.com>
2023-02-14 20:31:24 +00:00
Ricky Niu
f14cbd6370 Add resetCb
Add the resetCb to complete asynchronous

Bug: 267252826
Test: Boot to home and function work
Change-Id: I9d6624cbe15c86c63e28f8f176d7c560aed8446f
2023-02-09 02:02:50 +00:00
Ricky Niu
5c7e338667 Fix up open bugs from gs201 AIDL migration
1. Remove unused group "wakelock".
2. Correct the right return value on setCurrentUsbFunctions.

Bug: 266694076
Test: Boot to home and function work
Change-Id: If0925a61e481e4deca560dc8dfc1be80a76c148f
2023-02-07 08:55:20 +00:00
Avichal Rakesh
72dbe87c42 UsbGadget: Add support for UVC function
UVC is a new USB function supported in Android. This CL adds UVC as a
valid function and gives it a new pid of 0x4ee[de]. UVC function is
guarded by the property `ro.usb.uvc.enabled`. When this property is set
to false, UVC won't be considered as a valid gadget function.

Bug: 242344221
Test: Manually tested that the UVC function is successfully configured
Change-Id: I7ce1cc192c09b5f3cd7c73405fe54426a1311dfb
2023-02-06 21:20:59 +00:00
Avichal Rakesh
9ba92eed60 Migrate IUsbGadget implementation to AIDL
This change migrates IUsbGadget implementation to AIDL.
Port of commit <d6d0b7d2ca5066988ee90889dccd00c06d64b694>.

Bug: 218791946
Test: USB function switch success and AIDL service is running.
Change-Id: I9613178d3cd2f9abd5396e4af763a257a8ef62a7
2023-01-26 20:18:09 +00:00
Badhri Jagan Sridharan
694c890c33 Rename enable_usb dev node to move_data_to_usb
kernel dev attribute has now been renamed from enable_usb
to move_data_to_usb. Update the same.

Bug: 251381400
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: I8e4aa0b2e09bfef807f0169eabb79e2fa2e4d2c7
2022-10-31 14:07:51 +00:00
Kyle Tso
d0c6349927 usb: Modify the permission of additional i2c-max77759tcpc path
Bug: 251106770
Signed-off-by: Kyle Tso <kyletso@google.com>
Change-Id: I8b9dcc4b3de7b390f752ee410022dd0d86be9c40
2022-10-11 05:48:54 +00:00
Ray Chi
bfb57fd23f usb: remove redundant changes for USB nodes
Bug: 248982089
Test: build pass
Change-Id: Ic93017c26aada15cb04fc2d5cbeb9c9b07c999fa
2022-09-30 08:35:05 +00:00
Kyle Tso
a83716ff8d usb: Remove the permission change of unused nodes
Bug: 248982089
Signed-off-by: Kyle Tso <kyletso@google.com>
Change-Id: I4707e3bbd7fa1d42e08577edba8d9bb52cc7c061
2022-09-30 08:35:05 +00:00
badhri
7d34263bf9 Set powerBrickStatus to not connected when sourcing power
Bug: 239755044
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: I7720bfaa5876c058643c52525b488ba22b3e5121
2022-07-22 02:31:35 +00:00
Ricky Niu
6d0bb7f43d usb: Correct the i2c path
Correct the I2C path to match the new memory address setting.

Test: Connect to HU work
Bug: 233996502

Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I27cca56698568e8a3060d9e40bad3a29ec072588
2022-05-30 03:06:56 +00:00
Jimmy Hu
3b1583d7a5 Write the pullup value only if new value applied
Bug: 226018845
Test: build, boot
Signed-off-by: Jimmy Hu <hhhuuu@google.com>
Change-Id: I636dc18dca123f88dbf10c4a17caa9a75cbb12f7
2022-05-26 02:42:33 +00:00
Ricky Niu
0eefbf303b usb: limit the current to 1.3A when connect to accessory am: e6cacbcff2
Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs201/+/18527913

Change-Id: I33790e25c4d57d2af41492f2f263c8124ea2ebf3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-24 01:01:25 +00:00
Ricky Niu
e6cacbcff2 usb: limit the current to 1.3A when connect to accessory
For imporve USB stability, limit the current to 1.3A,
when connect to accessory.

Bug: 206635552
Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I2c1091aa7111e6242cc949923fbc86f27e54e976
2022-05-23 23:59:44 +00:00
Ray Chi
ee5795e850 usb: change function sequence if debug functions are enabled
On Windows platforms, wrong function sequnce will cause usb
driver installing not working. This patch will modify the
function sequence when debug functions are enabled.

Bug: 228800277
Test: tethering is working when debug functions are enabled.
Change-Id: I9f8b02354617b08a34fb4641ac710f32dabc643e
2022-04-14 03:59:15 +00:00
Kyle Tso
4dc3073629 usb: Correct the i2c path
Bug: 228780694
Signed-off-by: Kyle Tso <kyletso@google.com>
Change-Id: I59a4fa0870264e5f2ca275d5a228f11fcc6bf4be
2022-04-11 19:09:26 +00:00
Kyle Tso
e2c9e7a4b5 usb: Correct the i2c path
Bug: 228780694
Signed-off-by: Kyle Tso <kyletso@google.com>
Change-Id: I59a4fa0870264e5f2ca275d5a228f11fcc6bf4be
2022-04-11 14:26:48 +00:00
Ricky Niu
7d413565cd usb: Add dm condition in NCM
Add vid/pid 04e8/6862 for dm condition in NCM

Test: The usb gadget functions work normally
Bug: 226682477

Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I263f125d2ff961a6967b5b536c71fcbdcd87ed05
2022-03-25 10:34:56 +00:00
Ray Chi
f363704a92 tune usb irq (dwc3) in usb gadget hal
Since affinity permission is changed from root to system, original
permission change by script can't be used. Therefore, this patch
will move the functionality to usb gadget hal.

Bug: 220996010
Test: dwc3 irq could be located in medium/big cores after USB function switch
Change-Id: Id993db9fc303e85a9a6337a0e41b1dfd6fc9a86a
2022-03-07 07:45:50 +00:00
Ray Chi
b30924e359 usb: move the permission change to usb rc
Since permission change in hal rc may be late, gadget
hal would enable USB function failed. The solution will
change the permission before USB gadget hal starts.

Bug: 206902205
Test: build pass and verified pass
Change-Id: I45c1318f647220480fa03ba3b813a81b21393d71
2022-03-07 07:45:50 +00:00
Bob Badour
e3710a9f34 [LSC] Add LOCAL_LICENSE_KINDS
Added SPDX-license-identifier-Apache-2.0 to:
  usb/gadget/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Change-Id: Idea66093348d8c7e4a63b35e5f25a6d8bab9439a
2022-03-03 11:19:46 -08:00
Ray Chi
ef1c863453 Revert "usb: modify the permission of USB gadget hal"
This reverts commit bdd4728a17.

Reason for revert: original issue is fixed.

Bug: 206902205
Test: adb work without the error of gadget hal.
Change-Id: I3b7ab36f93e8bb7d6c23d53d4a12ed95d441fede
2022-03-01 18:33:17 +08:00
Badhri Jagan Sridharan
a1deb18dfb Migrate IUsb implementation to AIDL
Cherry-pick of <775523d1eb>

This change migrates IUsb implementation to AIDL.
Also, IUsb and IUsbGadget now run in its own processes
to improve stability and isolation.

Bug: 200993386
Change-Id: I02753af4a41916b77ce110f9531504bf8c6a4691
Merged-In: I02753af4a41916b77ce110f9531504bf8c6a4691
2022-03-01 03:32:23 +00:00
Ray Chi
a872edb528 tune usb irq (dwc3) based on usb function
This among other things greatly increases tethering performance.

Bug: 202103325
Test: tput improved
(synced from commit f9e02b98b8243d2db566df16d4e763250ac9efaf)

Change-Id: I19b22d748352eb04bc27d85c0f69fa2571b63d53
2022-01-25 03:28:35 +00:00
Ray Chi
8792d6d7a2 usb: create new functions for uwb
uwb needs ACM port, create this function combination.

Bug: 209568585
Test: ACM port can be enabled.
Change-Id: I06107cc6ee42fc6b622a1aff25cbdd54b479ea0f
2021-12-08 06:16:46 +00:00
Ray Chi
bdd4728a17 usb: modify the permission of USB gadget hal
Currently, USB gadgdet hal couldn't access configfs nodes during
device booting. The permission of configfs nodes are root as default,
and they are modified to system by init process. Therefore, USB
gadget HAL can't access them before permission changes completely.

The patch will modify permission of USB gadget hal so that it can
access configfs nodes without permission change.

Bug: 204378488
Test: check connection time
Change-Id: I97f5446a51183225227744043e4a6e0088fecf0b
2021-11-18 17:06:56 +08:00
Albert Wang
3773ce8687 usb: support both rndis and ncm, but not rndis + ncm
A cherry pick from 49a13bf for gs101

Bug: 199252036
Test: Boot to home and usb hal bring up normally
Change-Id: Ia4e344aa9cf7762b71cbfe35ff9cbcccb4474b11
2021-09-24 03:44:56 +00:00
Albert Wang
9b1babb956 Correct i2c path for contaminant protection detection and status
Bug: 189703449
Test: read contaminant status normally
Signed-off-by: Albert Wang <albertccwang@google.com>
Change-Id: Iff31b2846cec2e960e5c5db83371ca3e983a4a3b
2021-06-03 15:29:29 +08:00
Albert Wang
afefe3a71e Correct the new udc path
Bug: 189703449
Test: access attributes correctly
Signed-off-by: Albert Wang <albertccwang@google.com>
Change-Id: I2223666cf05ea69ea531991bedcf1de62686f2e7
2021-05-31 11:20:27 +08:00
Ray Chi
ef2cbbe6c3 Revert "gs201: usb: add state of usb extcon to monitorffs"
This reverts commit 72ef08cafa11ab10bc31105c70836cef92e1f7b4.

Reason for revert: using alternate method for original behavior change
Bug: 187261232
Test: build pass

Change-Id: I5643a4109f6e4a64d167ed9ee1ce0bc3492cea42
2021-05-24 20:29:07 +08:00
Hyunki Koo
f398577b5c change name 11110000.usb to 11210000.usb
Bug: 188672439
Signed-off-by: Pat Tjin <pattjin@google.com>
Signed-off-by: Hyunki Koo <hyunki00.koo@samsung.com>
Change-Id: I61c874ab37c7a1f9288843dbbba2781dee7ecf1e
2021-05-21 14:58:56 -07:00
Pat Tjin
89841bf57a s/gs101/gs201
do a global substitution

Bug: 186836335
Signed-off-by: Pat Tjin <pattjin@google.com>
Change-Id: Ic79e8983d04615be7da70ebb2b5092aae5178495
2021-05-20 17:54:35 +08:00
Aaron Ding
c4227335c9 init gs201 builds
Bug: 183183095
Change-Id: Ida78d0352dbd79acb8f2122b51fdb47a2e217bf0
2021-05-19 17:38:25 +08:00
Aaron Ding
bb4beafe47 Create gs201 device folder baseline
clone from gs101 sha 9d1c97c2

Bug: 183183095
Change-Id: Ie7112bdf0aceb33c9e1956aa52e961b670582733
2021-05-19 13:35:26 +08:00