summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-01-17pat9126: add PM suspend / resume supportandroid-wear-11.0.0_r0.9android-wear-11.0.0_r0.8android-wear-11.0.0_r0.7android-wear-11.0.0_r0.13android-wear-11.0.0_r0.11android-wear-11.0.0_r0.10android-exynos-r11-4.19-rvc-wear-jr3-qpr2-drandroid-exynos-r11-4.19-android11-wear-jr3-qpr2-drandroid-exynos-r11-4.19-android11-wear-jr3-qpr2android-exynos-r11-4.19-android11-wear-jr3Amit Bhanagay
Lock / unlock mutex on SoC suspend / resume. This method is adopted to avoid potential race condition where the IRQ handler schedules a delayed workload and processes it post suspend. This delayed workload now remains blocked on the mutex. Bug: 263634942 Change-Id: Ia14df8b9425419e00535d8603f9957c807f1a924 Signed-off-by: Amit Bhanagay <amitbhanagay@google.com>
2023-01-13misc: cs40l25: Use strscpy to write the bufferChase Wu
Use strscpy to write to the buffer in cs40l2x_cp_trigger_queue_show to avoid writing incorrect addresses using snprintf. Also, checking to see if the input trigger queue string is too large. Bug: 224000736 Test: push a poc file and check the log Change-Id: Id46d8a0dbe8eea188362e4f2ca54ccbd720d2bc8 Signed-off-by: Paul Handrigan <Paul.Handrigan@cirrus.com> Signed-off-by: Chase Wu <chasewu@google.com> (cherry picked from commit 31ef461089e795b4347499e792a6a5c88425aeae) Signed-off-by: Necip Fazil Yildiran <necip@google.com>
2023-01-04Only reset soc_spoof_full for WLC on first connectAlice Sheng
It should not be reset again when WLC re-applies authentication. Bug: 264426477 Change-Id: I74711eed8abfdc4ba037d979745c9f23795d0f93
2022-12-21bcmdhd: Fixed Memory Overwrite in function dhd_prot_ioctcmplt_processSungjoon Park
In dhd_prot_ioctcmplt_process of dhd_msgbuf.c, there is a possible out of bounds write due to improper input validation Fix: 1. Added bounds check 2. Limited the copy length to dest length. Bug: 254028518 Test: BRCM Internal test is finished without regression. Change-Id: I7d000282c6732ff0963751284ac6331c7cc48d8b Signed-off-by: Sungjoon Park <sungjoon.park@broadcom.corp-partner.google.com> (cherry picked from commit 56beb29852101f342c12f355bf89639a107336cc) Signed-off-by: Necip Fazil Yildiran <necip@google.com>
2022-12-21bcmdhd: Fixed Memory Overwrite in function add_roam_cache_listSungjoon Park
In add_roam_cache_list of wl_roam.c, there is a possible out of bounds write due to a missing bounds check. Fix: 1. Added bounds check 2. If SSID_len is bigger than 32, do not update that list in the roam cache list. Bug: 254028776 Test: BRCM Internal test is finished without regression. Change-Id: Ifaf4a5c963e89dde3fed39888c4fa83d093f5e25 Signed-off-by: Sungjoon Park <sungjoon.park@broadcom.corp-partner.google.com> (cherry picked from commit aa4626311e2926e28ab4c7ce0599be7c5df769ab) Signed-off-by: Necip Fazil Yildiran <necip@google.com>
2022-12-21bcmdhd: Fixed Memory OOB Read/Write in function wl_update_hidden_ap_ieSungjoon Park
In wl_update_hidden_ap_ie of wl_cfgscan.c, there is a possible out of bounds write due to a missing bounds check. Fix: 1. Added bounds check. 2. If the ie_offset + ie_length is not matched with length then bi might be corrupted. Ignoring that AP bi update. Bug: 254029309 Test: BRCM Internal test is finished without regression. Change-Id: Ibd638e27a09f657f903c46e8c4712732af47cfc9 Signed-off-by: Sungjoon Park <sungjoon.park@broadcom.corp-partner.google.com> (cherry picked from commit 31b7bb4d289272bdcde29b8e37cc2a5c2d5e2760) Signed-off-by: Necip Fazil Yildiran <necip@google.com>
2022-12-21bcmdhd: Fixed Memory overwrite when handling RTT eventSungjoon Park
[Issues] The kernel panic occurs by memory overwrite if the test code is added with incorrect length and id. When checking the argument of ctx, it was defined in various structures. We couldn't know the correct size of ctx in rtt_unpack_xtlv_cbfn function, so require to fix. [Fix] Make a structure(rtt_event_data_info_t) to include bcm_xtlv_t, rtt_result_t and wl_proxd_ftm_session_status_t. Using the structure change to copy memory explicitly. Bug: 257290781, 257289560, 257290396, 254839721, 254840211 Test: Over 3 day RTT aging test has passed. Change-Id: I5140cc4639ac5e9f90aa51818c3b85c9fe874640 Signed-off-by: Sungjoon Park <sungjoon.park@broadcom.corp-partner.google.com> (cherry picked from commit f0fdc816d07b07be00026f3f59a85eaa649d9c52) Signed-off-by: Necip Fazil Yildiran <necip@google.com>
2022-12-15DHD: DUT disconnected by replaying broadcast deauthStephen Chu
When an attacker records the broadcast deauth packet and resent. DUT would disconnect. Supplicant replies IGTK and IPN to DHD. DHD calls iovar wsec_key to FW but miss IPN to cause this. Bug: 235324895 Test: Verified positive result by T6 Signed-off-by: Stephen Chu <stephen.chu@synaptics.corp-partner.google.com> Change-Id: I6d08a96233db5d44c1ce2919fb1c5f788d0c1767 (cherry picked from commit f84f3d9580d2b16a43c0fb7618c6ff8602818672) Signed-off-by: Necip Fazil Yildiran <necip@google.com>
2022-12-13Properly handle errors in nvt_ts_wakeup_gesture_reportBen Fennema
In case of unexpected inputs to nvt_ts_wakeup_gesture_report, the driver could internally switch from ts->idle_mode == true to ts->idle_mod == false, even though no wakeup event was sent to android (so android would never wake up) This would cause the driver to discard future wake events, as it thinks events should be points instead of wake events. Additionally, only interrupts were being tracked (but treated as if each interrupt generated an event). This is not necessarily true, so add tracking of events and errors, in addition to interrupts. Bug: 262416625 Change-Id: Ib244116860f56bbb236821fff57e4e63d2290726 Signed-off-by: Ben Fennema <fennema@google.com>
2022-12-12Do not reset charge delay state when throttling.Radu Solea
Bug: 259451666 Test: Manual. Verified that the delay fires on charger attach, not on every throttle. Change-Id: I415f721f962e4d699c6caffec5d5f2733aa54714 Signed-off-by: Radu Solea <radusolea@google.com>
2022-12-09battery: Add battery OCV to get_battery_info traceRich Shanks
Test: Review log entries from adb bugreport Bug: 261901952 Change-Id: I0db8ef3ae39e1fe9eb504c75b77ed03991d86444 Signed-off-by: Rich Shanks <rshanks@google.com>
2022-12-08cs40l2x: log vibration stateZabi Khadri
Bug: 255074134 Test: Manual and idlcli vibrator compose 0 x y Signed-off-by: Zabi Khadri <zkhadri@google.com> Change-Id: I6333bb9dc90b26eba54f8a8125e901963b97a544
2022-12-01Add RSB-to-wake functionalityAmit Bhanagay
Add support to wake AP with RSB scroll when display off. Sensitivity is set to a very low value when display is off and restored back to normal when on. This ensures a deliberate long scroll to wake AP. Bug: 196046174 Signed-off-by: Amit Bhanagay <amitbhanagay@google.com> Change-Id: Iacd9ed909974c32b73c895d40afab215cd2c6dcd
2022-11-17wlc: Delay charging reporting.Alice Sheng
Wait for authentication to finish before reporting charging present. Bug: 255784023 Change-Id: Ie276df3324df452eda52c6c017c2132b7e95c419
2022-11-08Remove redundant intermediate reason string copy.ajay
Bug:188488064 Bug:258271661 Test: Verified on hikey960 platform. Signed-off-by: ajay <ajay.davanageri@broadcom.corp-partner.google.com> Change-Id: I12477f60f802f2280a5b01ac8b04dfa842924345 (cherry picked from commit d47e19c5f1ebc2a972690bce32065aaf020f5622) Signed-off-by: Necip Fazil Yildiran <necip@google.com>
2022-10-05ntc-thermal: fix NTC reading comparisonandroid-wear-11.0.0_r0.6android-wear-11.0.0_r0.5android-wear-11.0.0_r0.4android-exynos-r11-4.19-android11-wear-jr2Alice Sheng
Compare it to the previous check, not just the last reading. This will prevent false positives for errors in cases where the temperature actually jumped a lot. Bug: 250564489 Change-Id: I19844854ad64d3d2f90701670731c9ef0d8e7caf
2022-10-04Increase NTC driver stabilityAlice Sheng
Increase the autosuspend delay so the GPIO doesn't have to change as often. Store the previous temperature state and retry if it has changed too much, helping to catch transient errors. Bug: 250564489 Change-Id: Iad7396836be93ec8ac7e6d8e551c0c75fba57a93
2022-10-03bcmdhd: Do not wakeup host for IPv6 multicast packetsFlorian Muller
The WiFi chip supports IPv6 Neighbor Discovery offload. When the screen is off, it will send NA packets to reply to NS packets without waking up the host. So the WiFi connection will not be disconnected. Test: Manual. CtsLibcoreTestCases needs screen on to pass. Bug: 243078730 Bug: 247142829 Signed-off-by: Florian Muller <mullerf@google.com> Change-Id: I38b780f37137dbecb6e9d139863f3b2e3cd5ce6c
2022-09-29Set client->irq prior to registering touch input deviceMatthew Bouyack
Previously we were registering the touch panel as an input device before initialization was actually complete. In particular, we had not yet initialized the touch interrupt handler. This was causing issues in the case where nvt_ts_input_open is called immediately after the panel is registered but while client->irq is still zero. Signed-off-by: Matthew Bouyack <mbouyack@google.com> Bug: 249214710 Change-Id: I00073646be44527cd974efa80538c0b222a609d4
2022-09-13Don't skip first pno scan on wifi enableJason Tan
Remove skipping the first pno scan when wifi is first brought up to reduce delay of first scan when wifi is turned on during screen off Bug: 245362458 Test: Verified through logs first pno scan after wifi bringup is not skipped and device connected successfully. Verified subsequent pno scans first scan is skipped by using cli to disconnect device from AP, and triggering screen on+screen off Change-Id: Ie74821365ab4ce67e74731820684ae53b080c51c
2022-09-09Add time delay between charger connect and charging startRadu Solea
Bug: 228131904 Test: Tested normal operation by verifying an increase in measured vbatt after timer expires. Signed-off-by: Radu Solea <radusolea@google.com> Change-Id: I8007275c3a80b182d83fc55d244f066fc17282aa Signed-off-by: Radu Solea <radusolea@google.com>
2022-09-07bcmdhd: Support of Custom Mapping of DSCP to User PriorityFlorian Muller
This is needed in order to support Voice over WiFi on R11. Test: Manual Bug: 158509532 Bug: 156812084 Signed-off-by: Florian Muller <mullerf@google.com> Change-Id: Ie4862b7f224f14d6f536be50ad9e1eb10e3fa274
2022-08-30Reset soc_spoof_full 100% when charger inserted.Brandon Edens
We want to reset our capacity scaling each time user inserts device onto charger to reflect the true capacity of the battery and what 100% truly means. Bug: 241447004 Test: Monitor adb logcat for soc_spoof_full state and expect a reset to 100000 after charger insert. Signed-off-by: Brandon Edens <brandonedens@google.com> Change-Id: Id19e0d7a729bd035620a3bad2157d27d2f72d549
2022-08-17Abort fw_reset_state() at 300 msecs.Brandon Edens
Rather than waiting 1 second for fw_reset_state() to abort we wait only 300 msecs aka make 30 attempts. This is the value advised by the vendor as being optimal. bug: 242878185 test: logcat should report entries [NVT-ts] nvt_check_fw_reset_state 381: error, retry=31, buf[1]=0xA0, 0x01, 0x00, 0x00, 0x00 with retry=31 rather than retry=101 Change-Id: Iab4dbaeddfc261709ca6f6f18b846fcde355f176
2022-07-22Disable wake irq on touchscreen closeandroid-wear-11.0.0_r0.2Matthew Bouyack
This avoids waking the AP unnecessarily. Signed-off-by: Matthew Bouyack <mbouyack@google.com> Bug: 238461762 Change-Id: I68a729cfd39b6fdaac24534a6521d6f2d78c1ab8
2022-07-15Fix unintended sign extension in RSB driverMatthew Bouyack
The magnitude of RSB rotation is a 12-bit value which is read from the hardware as 8 low bit and 4 high bits. Because the 8 low bits were being stored in an int8_t, casting that value to int16_t was producing unintended sign extension. This caused very large values to become negative. Also, there is no reason to cast the rotation magnitude to 's8' before calling input_report_rel. That API accepts a 32-bit integer. This was also causing issues with overflow. Signed-off-by: Matthew Bouyack <mbouyack@google.com> Bug: 234361169 Change-Id: I3ea53ffd392a11ecc6c8bb6ac8cca49d54fc0df7
2022-06-01Don't reset the MCU on nanohub errorsandroid-wear-11.0.0_r0.1Mark Rawling
We have observed in b/231130162 that nanohub can reset the MCU shortly after a firmware download. Whilst we rely on the MCU watchdog to catch and handle any and all cases like this, this is not supposed to happen and it can interfere with the MCU watchdog, restarts and crash reporting. It can also lead to errors in telemetry. Although resets were being logged in the past, they weren't actually being performed, so here we also change the log to be more accurate. Bug: 231130162 Test: manually induced errors and verified behaviour Change-Id: I232dc218f3131cac3140a5ee63b8a84c86fd2a42
2022-05-23Ensure the SPI bus idle state is correct after suspend/resumeMark Rawling
The SPI driver does not always preserve or restore the bus idle state after suspend/resume. Eg, when using CPHA, the clock should idle high, but it often goes low in suspend and does not return high. I looked for DT-based ways to fix this, but the driver is hardcoded and the only soluion is the one here, or to cede control of chip-select back to the SPI driver. Bug: 233382308 Test: extensive manual verification and testing Change-Id: I7a871deca9c65694223d535dfec538856deb3a8f
2022-05-05CS40L25: Add retry to on-chip memory writes.Charles MacDonald
This retries failed I2C writes to the internal RAM of the haptic chip as a workaround until b/230392743 is resolved. Test: Reboot system until error occurs, observe retry attempt. Bug: 220482904 Change-Id: I0fbb2f7d27a3ccbc81f152ef84b4906ec73a8296
2022-04-25Indicate read or write on MCU bootloader time outMark Rawling
Bug: 229907038 Test: Manual Change-Id: I92a2245828edfee9c60a86165531bcb4cbc8a55a
2022-04-20battery: replace mdelay with usleep_rangehoax
This commit replaces mdelay with usleep_range to reduce busy wait. Bug: 228514775 Change-Id: Id953755ab230c6e23202ef014e1601e88d83d105
2022-04-20Use a double pulse when resetting the MCU to avoid boot failureandroid-wear-11.0.0_r0.3Mark Rawling
This is a workaroud for: b/227924872 R11 MCU boot failure (due to SPI1, JTAG and RESET interaction) After multiple resets, there is a chance the MCU can enter a TAP test mode that it cannot escape from due to interaction b/w the SPI1 bus and the JTAG control pins. The ultimate cause is a lack of pull-down on the TRST_N pin. A double reset pulse works around this problem as follows: 1. The first reset ensures the TRST_N pin is deterministically pulled low by the bootrom. 2. The second reset occurs while TRST_N is still low, which will in turn reset the TAP state machine. This ensures that the TAP state machine cannot cumulatively move to a dangerous state across multiple MCU boots. Bug: 227924872 Test: Extensive soak testing with 1000s of reboot cycles with no failures Change-Id: I8a79e4e90e7df02657d9a40f50bbf5b3d4fc2799
2022-04-19cs53l41: Scale down gain when reaching low battery and/or on chargerFlorian Muller
Test: Manual Bug: 228179921 Signed-off-by: Florian Muller <mullerf@google.com> Change-Id: Ib667d017ec3d373219a4bc320157bb6998ce8d5f
2022-04-19cs53l41: Register smart amp to s2mpw02-fuelgauge and wireless psyFlorian Muller
This is needed so we can later add support to scale the smart amp volume according to the battery level and battery state (on vs off charger) Test: Manual Bug: 228179922 Signed-off-by: Florian Muller <mullerf@google.com> Change-Id: I1786806246d5f2838134658eacec4c39166a625a
2022-04-16Remove compiler warningMark Rawling
__nanohub_interrupt_cfg isn't used, but we're keeping it for later use, and making sure it compiles. Bug: 228919054 Test: builds without warning Change-Id: Ic798abce01d38e38d0c04bca406b1d66d4c68872
2022-04-12Reduce empty packet log spamMark Rawling
If the MCU becomes stuck, or is slow to respond, with the data interrupt line low, the AP will attempt many retries trying to read the data, which creates a lot of log spam since we are running with debug logs enabled for nanohub. Here we reduce the log of empty ack packets to a single tally of the total number of empty acks. Even with this there can be 10 outer retries, so this message can itself be repeated 10 times if the MCU is stuck. Bug: 228919054 Test: Manually induced retries and observed logs Change-Id: I5d6e295f612b6f367726ae41844c1d8d3f48081f
2022-04-09Use version of boottime compatible b/w 4.19 and 5.4Mark Rawling
This version will build for both Rohan and Eos. Test: verified time produced is the same either way Change-Id: I415d4438925d5395ee8c3703e9d666e0994775f9 Bug: 228668796
2022-04-07cs35l41: Fix computation of the boost voltage from the device treeFlorian Muller
This is an erorr from the cirrus vendor. Needs to be fixed. Details are in b/223626740#comment13 to #15 Test: Manual Bug: 223626740 Signed-off-by: Florian Muller <mullerf@google.com> Change-Id: I7427b378b6e2a2a10deb036440ae652cb3bfb70a
2022-04-07nitrous: Add a wakelock to manage the UART Tx transactionsFlorian Muller
We are seeing issues where it seems that the userspace BT wakelocks from the stack and from the HAL are failing to get acquired when Tx UART data are sent. It leads a different type of issues but so far, the issues identified are either crashes or UART BT irq stuck in a loop. As a workaround to this issue, we acquire a lock in the kernel at the start of a UART Tx request and release it at then end with a 100 ms timer to match what the BT stack and HAL usually do. This is with the hope that kernel locks acquired in the kernel will not fail to abort a suspend even if already advanced in that stage, which seems to be where the usersapce locks are failing. Test: Manual Bug: 226972758 Bug: 195363858 Signed-off-by: Florian Muller <mullerf@google.com> Change-Id: Ib2d2434ef0557d7f707b973cb88bf30ca4b9cc24
2022-03-31Ensure boot0 is low for ISP modeMark Rawling
boot0 is normally driven correctly in and out of suspend, but we need to set it low after a reboot, prior to resetting the MCU Bug: 206044802 Change-Id: I1bb8d327e879d86decb09fc5c66492190cc457a5
2022-03-31MCU fast boot via NXP bootloader over SPIMark Rawling
The Rohan MCU currently takes 30s to boot over UART. This is unacceptable because: - it adds 30s to the visible boot, ie, until the watch face is visible - MCU restarts are so slow that sensor behaviour is impacted We cannot use blhost over SPI because it requires either SPIDEV, or a custom interface, precise timing control, and workarounds for bootloader bugs. None of these things are viable in Rohan. This CL adds support for a subset of the NXP bootloader commands, enough to enable booting the MCU over SPI. Other commands can be easily added on top of the basic interface. - MCU boot time is improved from 30s to 2s - bootloader sync and timing bugs are handled - bootloader data aborts are detected and retried - downloads run at elevated priority for speed and stability - signed firmware is supported See go/rh-mcu-boot-improvements Bug: 206044802 Change-Id: I79b9d9d7ab670e1e758824dfaf212b46e41120c2
2022-03-30Remove mask/unmask interrupt callsAlice Sheng
The MCU doesn't support it and causes it to go into a retry loop when the irq2 isn't defined. Bug: 222158397 Change-Id: I9dab60b8f1e6b3f090ba828afc11c733e6169741
2022-03-23Disable wake-on-RSBMatthew Bouyack
This feature was found to cause a power regression Signed-off-by: Matthew Bouyack <mbouyack@google.com> Bug: 225919923 Change-Id: If7bc3369c68ea3c8df773285eca772941b99f008
2022-03-17Reverse direction of virtual buttons for swipesTim Kryger
In Wear, a swipe to the left is meant to drag in a card from the right so flip the direction accordingly of virtual keys generated for swipes. Bug: 178204254 Change-Id: If8db125eafcf267867ecc913c057fabe85e724ea
2022-03-16Revert^2 "Wake on RSB rotation"Matthew Bouyack
This reverts commit a4f37fdbaf0f8a43108777579147cadab9a6dd6b. Note that the original revert-revert doesn't apply cleanly. We also need to disable display-based power management. The change also defines "PAT9126_WAKE_IRQ" to make it easy to switch back and forth. Signed-off-by: Matthew Bouyack <mbouyack@google.com> Bug: 181563147 Change-Id: I2543b09519e43fda45c61e392d862c14fcfd60f4
2022-03-14Avoid accessing i2c from touch in suspendMatthew Bouyack
It is suspected that a touch interrupt which occurs late in suspend may cause us to access i2c after it has suspended. This change disables the interrupt prior to suspend to avoid this case. Note that even with the interrupt disabled we can still call enable_irq_wake to allow touch events to wake the device. Test: tap-to-wake (check 'dmesg' to confirm device was suspended) Signed-off-by: Matthew Bouyack <mbouyack@google.com> Bug: 217742260 Change-Id: I6d726a0c584bf82a03560d95303b8b5ad6fe6179
2022-03-08Add a 40ms debounce to the NFC gpioMatthew Bouyack
This prevents ghost touches from being reported just after NFC is disabled. Signed-off-by: Matthew Bouyack <mbouyack@google.com> Bug: 201462475 Change-Id: Ie9f93db867bcbdcf6732e23faf5bddd515eca87f
2022-03-04Support invalid charger notificationAlice Sheng
Change usb charging to also report the charge current (which we will use to detect invalid wireless chargers if it is 0) and remove spoofing of disconnected charger for inauthentic chargers Bug: 177663771 Change-Id: I054804c0f0d0fee5cc3cdbd37fb300929d4e619e
2022-02-16Revert^2 "nitrous: Remove bt_host_wake wakelock release 1s delay"Florian Muller
This reverts commit 52df49e5f526d2a76787992fbdd6f44a8a935e0a. Reason for revert: After running for three weeks with this reverted on my own watch and have the test team in TW running BCST, it is clear that this change does not affect in any way the crash rate we currently observe on BT overall. It might have a positive impact on power though, so it makes sense to revert this. Change-Id: I64831429ee0b776b1a86410a874c35f5bbd99d82
2022-02-16bcmdhd: Do not do an immediate scan when entering PNOFlorian Muller
Test: Manual Bug: 215656628 Signed-off-by: Florian Muller <mullerf@google.com> Change-Id: I6fba8bc3adb458cd4b25c7b921f444ce2eeb1047