Commit graph

42 commits

Author SHA1 Message Date
Kyle Tso
f178319b4a usb: Temporarily disable compliance warning
Revert me once the issue is fixed.

Bug: 278018111
Change-Id: I198c4a42aa8b64fef90817474710295d68497dda
Signed-off-by: Kyle Tso <kyletso@google.com>
2023-04-22 10:04:39 +00:00
Chien Kun Niu
6ef77dd8f0 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:33 +00:00
Xiang Wang
bc295aae91 Move thermal utils to hardware/interfaces
Bug: b/269370789
Test: m
Change-Id: I49b3b4ebabf124093851ad768ff106e9bdf30873
Merged-In: I49b3b4ebabf124093851ad768ff106e9bdf30873
2023-02-23 04:29:33 +00:00
Xiang Wang
db54aa1217 Update USB HAL clients to use Thermal stable AIDL
Bug: b/264594715
Test: boot test
Change-Id: I0d633a83224d928c888e53e54b375fcd5c3d4010
2023-02-14 22:24:23 +00:00
Badhri Jagan Sridharan
38a132ae24 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-13 23:12:04 +00:00
Ricky Niu
744f214f40 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
b77191c0fa Fix up open bugs from gs101 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 07:30:48 +00:00
Avichal Rakesh
eafdae6687 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: I5ba45ebb11d265b843dfde21407bc5bab1d070c9
2023-02-06 21:20:59 +00:00
Ricky Niu
5b86b2fb5f Use AIDL utils in GadgetHAL
Test: Built locally, and logcat confirms the new implementation is used
Bug: 218791946
Change-Id: I4122450326864de268f3908d920a1ffa472f3d7d
2023-01-19 17:40:18 -08:00
Ricky Niu
6b863d5b74 Migrate IUsbGadget implementation to AIDL am: d6d0b7d2ca am: a912032b9d am: 7d8c7aa768
Original change: https://android-review.googlesource.com/c/device/google/gs101/+/2361897

Change-Id: I5a35d64da039e377cb77d984fc752ffca9d6464e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-12 08:30:04 +00:00
Ricky Niu
d6d0b7d2ca Migrate IUsbGadget implementation to AIDL
This change migrates IUsbGadget implementation to AIDL.

Bug: 261027750
Test: USB function switch success and AIDL service is running.
Change-Id: I7cc7070d875c26bc42f99aef84d5e5a41606223f
Signed-off-by: Ricky Niu <rickyniu@google.com>
2023-01-07 15:39:44 +08:00
Chien Kun Niu
3507989979 Revert "Migrate IUsbGadget implementation to AIDL"
This reverts commit bbcd013c41.

Reason for revert: Increase the boot time to cause the below bug.
b/261027750 | P0 | Broken test: v2/android-perfetto-dev-team/apct/perfetto/perfetto_integrationtests on git_master on oriole_hwasan-userdebug at 9355690

Change-Id: Idba7322ca86e70cf5d8e170936696586caa8c1c2
2022-12-07 03:56:16 +00:00
Ricky Niu
bbcd013c41 Migrate IUsbGadget implementation to AIDL
This change migrates IUsbGadget implementation to AIDL.

Bug: 218791946
Test: USB function switch success and AIDL service is running.
Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: Ib2cff64e75608572a005933bc94ecaf128b85559
2022-12-01 04:30:22 +00:00
RD Babiera
96ccf93453 Usb non-compliant port partner gs101 implementation
Adds vendor code for non-compliant charger feature. Currently
updates service version.

Test: atest VtsAidlUsbTargetTest
Bug: 236322506
Change-Id: Ie1a48b1acaaae9a53f3b9bfebcfee7a2f4814810
2022-11-30 01:39:11 +00:00
badhri
803bb5c4f4 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
Jimmy Hu
11f2c88795 Write the pullup value only if new value applied
Bug: 226018845
Test: build, boot
Signed-off-by: Jimmy Hu <hhhuuu@google.com>
Change-Id: I64a964753fc89a29d278f1c426b2746abc2a2b12
2022-05-26 02:42:33 +00:00
Ricky Niu
ebd7fca53a 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-21 15:35:34 +00:00
Ray Chi
ba3dc9b3da 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: 224699556
Test: dwc3 irq could be located in medium/big cores after USB function switch
Change-Id: Id993db9fc303e85a9a6337a0e41b1dfd6fc9a86a
Merged-In: Id993db9fc303e85a9a6337a0e41b1dfd6fc9a86a
(cherry picked from commit f363704a92fd7611cf01c8b3bcaf6e8913255207)
2022-05-05 07:08:19 +00:00
Ray Chi
7da5d4f43f 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: 224699556
Test: build pass and verified pass
Change-Id: I45c1318f647220480fa03ba3b813a81b21393d71
Merged-In: I45c1318f647220480fa03ba3b813a81b21393d71
(cherry picked from commit b30924e3599f2e92aeae498a6ae15d3b9a397930)
2022-05-05 07:08:19 +00:00
chungkai
deca07793f init: modify path of i2c peripherals
add potential paths when enable parpllel module loading

Test: build pass
Bug: 228181404
Signed-off-by: chungkai <chungkai@google.com>
Change-Id: I929669a2ddc9155ad4dac1f40f808ffcb4c914f2
2022-04-07 09:33:25 +00:00
Badhri Jagan Sridharan
31fb891398 Implement callbacks for limitPowerTransfer
Implements limiting the source current when limitPowerTransfer
is invoked.

Bug: 200993386
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: Ia34dc127c1eb20254caa932db882e26e6092b945
2022-02-25 21:31:46 +00:00
Badhri Jagan Sridharan
06870a01fa 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: 211677613
Bug: 213312081
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: I8e4aa0b2e09bfef807f0169eabb79e2fa2e4d2c7
2022-02-07 07:13:12 +00:00
Bob Badour
6d6da10554 [LSC] Add LOCAL_LICENSE_KINDS to device/google/gs101
Added SPDX-license-identifier-Apache-2.0 to:
  fingerprint/extension/Android.bp
  usb/usb/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: I28953341fc1fdb81a1a8898543fde5477dba0f0f
2022-01-27 22:06:54 +00:00
Ricky Niu
df693e00a8 Implement resetUsbPort in USB HAL
Bug: 197300598
Test: Check it works

Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: Ibd6fd14faf47e1ad5d7817b006f9ba64e2ab5fb9
2022-01-26 08:13:06 +00:00
Badhri Jagan Sridharan
4db6811934 Implement interfaces for enabling usb data while being docked
Monitor google,pogo device attributes to report usb data status.
enableUsbDataWhileDocked now writes to enable_usb to enable USB-C
data while being docked.

Bug: 211677613
Bug: 213312081
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: Ie5c5d50c966ad9261cbf980c10909f04c4a757a0
2022-01-23 00:46:25 -08:00
Badhri Jagan Sridharan
9a5124a117 Implement callbacks for limitPowerTransfer
Implements limiting the sink current current when limitPowerTransfer
is invoked.

Bug: 199357330
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: I751a3912ebd159a536808897f878502418c6efdb
2022-01-22 01:20:15 +00:00
Badhri Jagan Sridharan
3c97a6bb68 Migrate IUsb implementation to AIDL
This change migrates IUsb implementation to AIDL.
Also, IUsb and IUsbGadget now run in its own processes
to improve stability and isolation.

Bug: 200993386
Bug: 199357330
Change-Id: I02753af4a41916b77ce110f9531504bf8c6a4691
2022-01-22 01:20:15 +00:00
Ricky Niu
ac257ea3eb usb: Add dm condition in NCM am: 48b3e5de64
Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs101/+/16334651

Change-Id: I3f2feae311bc65ed245eb00be7761b12d1f52b2a
2021-11-26 08:35:10 +00:00
Ricky Niu
48b3e5de64 usb: Add dm condition in NCM
Add vid/pid 04e8/6862 for dm condition in NCM

Test: The usb gadget functions work normally
Bug: 206565428
Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I04fba9fc137848d7f1c97a288bb12d76a613badc
2021-11-26 08:22:03 +00:00
Jiyong Park
a259a1db18 Remove ndk_platform backend. Use the ndk backend. am: 3428793114
Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs101/+/16119649

Change-Id: I2657a0f2342879a8897af8677b3ec665e3a723e4
2021-10-27 01:05:57 +00:00
Jiyong Park
96a77be5a3 Remove ndk_platform backend. Use the ndk backend.
The ndk_platform backend will soon be deprecated because the ndk backend
can serve the same purpose. This is to eliminate the confusion about
having two variants (ndk and ndk_platform) for the same ndk backend.

Bug: 161456198
Test: m
Merged-In: Iebc1c5d4c277e96cf7564d882aeecb084adc53ee
Change-Id: Iebc1c5d4c277e96cf7564d882aeecb084adc53ee
(cherry picked from commit 25368375b1759a13cacbfa1a9a183d4eee7381b2)
2021-10-26 15:36:47 +09:00
Puma Hsu
fbcb7ad5dc usb: create new functions for uwb
uwb needs ACM port, create this function combination.

Bug: 187877902
Test: ACM port can be enabled.
Signed-off-by: Puma Hsu <pumahsu@google.com>
Change-Id: I14c6af95bbd5e9e0b2c4a17a1fffb6e04def2c9b
2021-08-26 06:37:39 +00:00
Badhri Jagan Sridharan
09719be64b gs101: usb: Report USB port overheat event
Read duration stats expoted by google,usbc_port_cooling_dev and
push suez atom when the uevent is received. The plugged temperature
is queried every time when the USB port is connected. Maximum
temperature during overheat is queried when the uevent is received.

Bug: 193615568
Change-Id: Ib02e14dbdbe1390476e864d351158c1523a5c311
2021-07-22 20:31:12 +00:00
Maciej Żenczykowski
a24469c9d0 tune usb irq (dwc3) based on usb function
This among other things greatly increases tethering performance.

Bug: 185092876
Test: TreeHugger, built and booted on an oriole, enabled tethering
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic9f0b4bef05250bb38c91dc1e046366098d98dc0
2021-07-07 16:23:12 +00:00
Maciej Żenczykowski
e0ccd8fe6d support both rndis and ncm, but not rndis + ncm
Bug: 172793258
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6ac656d5eec27fadf76391fc3318b9d29d253a89
2021-06-22 02:53:55 +00:00
Albert Wang
a902992f64 Correct the file permission for usb data on/off
Bug: 180711938
Test: access nodes normally
Signed-off-by: Albert Wang <albertccwang@google.com>
Change-Id: I12e3357e675a77f3beb5f9fd6d3ada4378e10693
2021-06-04 08:36:17 +00:00
Albert Wang
891818811e Modify attributes path for USB data on/off
Bug: 180711938
Test: HAL loaded and accessed attributes normally
Signed-off-by: Albert Wang <albertccwang@google.com>
Change-Id: Ic0399cfe7022cc1971fc99870d955b9308512ca8
2021-05-27 03:32:39 +00:00
Ray Chi
387995b245 Revert "gs101: usb: add state of usb extcon to monitorffs"
This reverts commit 72ef08cafa.

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

Change-Id: I5643a4109f6e4a64d167ed9ee1ce0bc3492cea42
2021-05-24 16:02:50 +00:00
Manish Varma
3fd056fb40 Modify file path for i2c devices
Bug: 188078957
Test: Verified using temporary log messages to confirm
file paths are formed correctly as otherwise to test queryMoistureDetectionStatus()
requires some mock circuits.

Signed-off-by: Manish Varma <varmam@google.com>
Change-Id: If5402d5999c77bf5a3431c70d800e50570b87c88
2021-05-14 05:05:26 +00:00
Ray Chi
72ef08cafa gs101: usb: add state of usb extcon to monitorffs
Monitorffs needs to check the state of usb extcon to pull up
USB gadget. Therefore, this patch add state of usb extcon and
send this information to monitorffs.

Bug: 173086594
Test: verified pass
Change-Id: Ib2a1bb01813490185e1901fafdeba02458332e63
2021-04-26 10:00:12 +00:00
Ricky Niu
88313cf20b gs101: usb: remove flag "OLDER_GADGET"
The flag "OLDER_GADGET" is no need.
Using "11110000.dwc3" be the udc name.

Test: Build Pass and boot to home
Bug: 177879761
Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I43c9e2815a6384c4dffdc47312fa0f372b34d9e9
2021-04-02 04:42:53 +00:00
Robin Peng
c2b5ca99e3 Move slider into gs101 and <device>
from: 026342771c6642980cb4653b1ec4d857a5d8be54

Bug: 167996145
Change-Id: I2ebf7f019afed1cbe9b60dcd82581bd3a52fe109
2021-03-06 16:31:12 +08:00