summaryrefslogtreecommitdiff
path: root/driver
Commit message (Collapse)AuthorAgeFilesLines
* Update license boilerplate text in source code filesstabilize-quickfix-15278.72.B-ishstabilize-quickfix-15183.78.B-ishstabilize-15446.B-ishstabilize-15439.B-ishstabilize-15432.B-ishstabilize-15429.B-ishstabilize-15415.B-ishstabilize-15395.B-ishstabilize-15393.48.B-ishstabilize-15381.B-ishstabilize-15364.B-ishstabilize-15361.B-ishstabilize-15359.B-ishstabilize-15359.58.B-ishstabilize-15359.50.B-ishstabilize-15359.45.B-ishstabilize-15335.B-ishstabilize-15329.59.B-ishstabilize-15329.44.B-ishstabilize-15317.B-ishstabilize-15301.B-ishstabilize-15300.B-ishstabilize-15278.64.B-ishstabilize-15251.B-ishstabilize-15245.B-ishstabilize-15236.66.B-ishstabilize-15208.B-ishstabilize-15207.B-ishstabilize-15185.B-ishstabilize-15185.7.B-ishstabilize-15183.82.B-ishstabilize-15183.69.B-ishstabilize-15183.14.B-ishstabilize-15174.B-ishstabilize-15167.B-ishstabilize-15129.B-ishstabilize-15122.B-ishstabilize-15120.B-ishstabilize-15117.86.B-ishstabilize-15117.48.B-ishstabilize-15117.111.B-ishrelease-R114-15437.B-ishrelease-R113-15393.B-ishrelease-R112-15359.B-ishrelease-R111-15329.B-ishrelease-R110-15278.B-ishrelease-R109-15237.B-ishrelease-R109-15236.B-ishrelease-R108-15183.B-ishrelease-R107-15117.B-ishishfirmware-ti50-prepvt-15315.B-ishfirmware-skyrim-15390.B-ishfirmware-skyrim-15369.B-ishfirmware-nissa-15217.B-ishfirmware-nissa-15217.45.B-ishfirmware-nissa-15217.126.B-ishfirmware-duplo-15151.B-ishfirmware-corsola-15194.B-ishfactory-trogdor-15210.B-ishfactory-skyrim-15384.B-ishfactory-nissa-15199.B-ishfactory-corsola-15197.B-ishfactory-corsola-15196.B-ishfactory-brya-15231.B-ishMike Frysinger2022-09-1410-11/+10
| | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: I5b357b85ae9473a192b80983871bef4ae0d4b16f Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893394 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ishJack Rosenthal2021-11-05285-73910/+0
| | | | | | | | | | | | | | | | | | | | | | In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* driver: Remove unused functionTom Hughes2021-09-291-16/+0
| | | | | | | | | | | | | | | | | | When compiling with clang it warns that the function is unused: driver/accelgyro_lsm6dsm.c:45:29: error: unused function 'get_fifo_type' [-Werror,-Wunused-function] static inline enum dev_fifo get_fifo_type(const struct motion_sensor_t *s) BRANCH=none BUG=b:172020503 TEST=make CC=clang V=1 BOARD=arcada_ish Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ibc52e25a2f750e8da8335e7835475db7a5d42670 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3193275 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* SSFC: Framework to support two charger sourcesParth Malkan2021-09-241-14/+21
| | | | | | | | | | | | | | | | | | Many platforms have requirements to support more than one charge source (eg. pirika). It can't be supported by just enabling two different CONFIGS as that can lead to conflicts. Eg.USD_PD_VBUS_DETECT_TCPC vs USB_PD_VBUS_DETECT_DISCHARGE. This change provides a framework that supports two different charger sources in the same build. Please see the CL for relevant logs. BRANCH=None BUG=b:194375840 TEST=make -j buildall Signed-off-by: Parth Malkan <parthmalkan@google.com> Change-Id: I309cc5930233983e615d90a4290fc749abf7aa2d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3088232 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: drivers: thermistors are device tree nodesAaron Massey2021-09-241-3/+4
| | | | | | | | | | | | | | | | | | | Thermistor drivers now query the device tree for configuration. Thermistor tests have been updated to be parameterized on all thermistors enabled in the device tree. BRANCH=none BUG=b:184374937 TEST= 1) zmake testall 2) make runhosttests Cq-Depend: chromium:3161332 Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Change-Id: Ic5330cd5c33e79e192428ca857651de9a225856e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133812 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Aaron Massey <aaronmassey@google.com> Commit-Queue: Aaron Massey <aaronmassey@google.com>
* driver/tcpm/it83xx: turn both cc pins off when disable VconnRuibin Chang2021-09-241-9/+17
| | | | | | | | | | | | | | | | | | | | | If the pd port has previous connection and supplies Vconn, then RO jumping to RW reset the system, we never know which cc is the previous Vconn pin, so we always turn both cc pins off when disable Vconn power switch. BUG=b:199461325 BRANCH=none TEST=on board haboki, RO jump to RW, check Vconn low and pd can nego Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: I526af287d3f52ca27c38f342553aac9b3a241d84 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3178341 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Tested-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Commit-Queue: Diana Z <dzigterman@chromium.org>
* driver/tcpm/it8xxx2: turn both cc pins off when disable VconnRuibin Chang2021-09-241-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | If the pd port has previous connection and supplies Vconn, then RO jumping to RW reset the system, we never know which cc is the previous Vconn pin, so we always turn both cc pins off when disable Vconn power switch. This change is leveraged from it83xx (CL:3178341), although Vconn is controlled by ppc on asurada series and asurada series don't happen the bug, but we still need this change for the future that if there is a project control Vconn by GPIO. BUG=none BRANCH=none TEST=make board hayato Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: I66e7961d5ba412c18948a433103c17b79e7c5e08 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3180703 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* driver: lsm6dsm: remove load_fifo_sensor_state_tGwendal Grignou2021-09-232-38/+0
| | | | | | | | | | | | | | | | Remove load_fifo_sensor_state_t since timestamp spreading is done in common code. Fixes: 4e6d315948 ("common: motion_sense: Spread timestamps in motion sense fifo") BUG=b:172342141 BRANCH=none TEST=buildall Change-Id: If47fdd5dc800e6b75bdea4fcef80cf6874debdaa Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150052 Reviewed-by: Yuval Peress <peress@google.com>
* Revert "DP/TBT/USB4: Retimer WA resolved Brya TBT lane bonding issue in AP mode"madhusudanarao amara2021-09-231-20/+0
| | | | | | | | | | | | | | | | | | | | This reverts commit f0985f8a11585f6a704aa94a8354bd5b934619ac. Reason for revert: Issue is resolved after setting the Force BB Retimer GPIO (GPP_E4) to 0. It is a coreboot change. BUG=b:195375738 BRANCH=None TEST=TBT enumerated no lane bonding issue is observed with above coreboot code change with reverted EC WA. Signed-off-by: madhusudanarao amara <madhusudanarao.amara@intel.corp-partner.google.com> Change-Id: I09a8a53aec9ba3757189a091606922bc7a133ba7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3162936 Reviewed-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Commit-Queue: caveh jalali <caveh@chromium.org>
* driver: bmi3xx: simplify irq handlerGwendal Grignou2021-09-232-261/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove unnecessary structure: - bmi3_fifo_data, bmi3xx_drv_data - put static buffer in local bmi3_fifo_frame - Tighten interrupt routine - Use word to avoid intermediate copy - Trust fifo configuration from fifo_enable. - Process FIFO until interrupt indicates it is empty. - Simplify bmi3_parse_fifo_data - Use loop to avoid code duplication. - Remove intermediate variable. - Use word to process FIFO. - Remove blank lines, use inverted christmas tree convention. - Use constant when appropriate. - Set FIFO watermark to 3 words to catch single acceleromter event when gyroscope is disabled. BUG=b:195264765,b:178398789 BRANCH=none TEST=Run `tast run guybrushlocal hardware.SensorIioserviceHard' in loop. Change-Id: I55da91a557b8c51f707dc29b4867cc715dce2cca Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170618 Reviewed-by: Diana Z <dzigterman@chromium.org>
* Revert "driver: bmi3xx: Set FIFO watermark to 6 words"Gwendal Grignou2021-09-231-1/+1
| | | | | | | | | | | | | | | | | | This reverts commit 5786cdd32f9d8ba7da8b2d9764b06dfeb991f5ff. FIFO is not always 6 words: When the gyroscope is disabled, the FIFO will only contains 3 words. BUG=b:178398789,b:195264765 BRANCH=none TEST=Compile Cq-Depend: chromium:3170618 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I1cc0f6e31bb06a2ea11a815ea1f360766fb5d474 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172267 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Rob Barnes <robbarnes@google.com>
* ccgxxf: Add correct I2C address flagsstabilize-14235.B-mainVijay Hiremath2021-09-221-2/+1
| | | | | | | | | | | | | | | | CCGXXF exposes I2C addresses 0x0B for 1st port & 0x1B for second port hence corrected the I2C address flags in header file. BUG=none BRANCH=none TEST=Able to initialize second Type-C port Change-Id: I9dc955d1035b1f488e92a47cdac49bdd6154f4ae Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172253 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* driver: lis2dw12: fix init timeout loop conditionYuval Peress2021-09-211-3/+1
| | | | | | | | | | | | | | | | | | | | The loop condition for the soft reset was incorrect, on a failure to read the soft reset register, the loop would hit the `continue` command which would then test (status & LIS2DW12_SOFT_RESET_MASK) != 0 and leave us at the mercy of the status value left on the stack. BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/projects/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Iebeafe9c57c71713a1df5230e60ac067209ec5b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170538 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* driver: accel_lis2dw12: use ret in init as the return valueYuval Peress2021-09-211-4/+4
| | | | | | | | | | | | | | | | Use the value in ret during the lis2dw12_init function to differentiate between errors. BRANCH=none BUG=b:200046770 TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id31f01e09ff1305a4cd0ab14d56a05172a263760 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170536 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ps8xxx: Add support for ps8815 A2 with bad FWCaveh Jalali2021-09-211-0/+7
| | | | | | | | | | | | | | | | This adds the low level chip ID of the ps8815 A2 so we can recognize the chip when its main firmware is inoperative. BRANCH=none BUG=b:186189039 TEST=with next patch in series, verified the brya EC reports the correct device ID when the firmware is corrupted. Change-Id: I2696b9c20fdefd8afd02f7394a45f1c4c5636d71 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2857796 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Remove mux set from HPD updateDiana Z2021-09-161-7/+0
| | | | | | | | | | | | | | Now that the BB retimer has its own HPD update function, the extra mux set can be removed from the general USB mux code. BRANCH=None BUG=b:195773400 TEST=on voxel, pass tast typec.Mode*.manual Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ica83c2c568799d7686d8cfdbc5b0f446a6ebcb8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163931 Reviewed-by: Keith Short <keithshort@chromium.org>
* BB Retimer: Create HPD update functionDiana Z2021-09-161-0/+32
| | | | | | | | | | | | | | | | The BB retimer may use a simple read/modify/write on its configuration register to set HPD fields, rather than needing to rely on a call to a full mux set later to achieve this. Introduce an API so boards using the BB retimer may move to using this function. BRANCH=None BUG=b:195773400 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iae87c0860350fed32f69e0ea3b6530cd7e5ba111 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163929 Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Gate ACK event send on ACK waitingDiana Z2021-09-161-1/+11
| | | | | | | | | | | | | | | | | Currently, the EC doesn't always wait for an ACK from the virtual mux but it will still always send the AP ACK onto the PD task. This means we have some risk of a previous ACK being present in the task events already when we begin a new wait. Remove this risk by only sending the event to the task when there is a task waiting. BRANCH=None BUG=b:186777984 TEST=tast typec.Mode*.manual tests on voxel Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I1e4cf96af838c0cbe4ef549337b304679b59d641 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078414 Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Add access locksDiana Z2021-09-161-0/+22
| | | | | | | | | | | | | | | Currently, there are three separate tasks which can access the muxes at once (host command, PD, and chipset). As such, locking should help coordinate sets and gets to each port. BRANCH=None BUG=b:172222942 TEST=tast typec.Mode*.manual on voxel Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I003a2eee06e4b44241308d8b64da597bd17c8878 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078413 Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Update mux HPD update interface to use mux_state_tDiana Z2021-09-161-9/+7
| | | | | | | | | | | | | | | | | Since the drivers are now taking a mux_state_t set of flags to update, go ahead and unify the usb_mux API this way as well. It makes the parameters more apparent than the 1/0 inputs, and aligns the stack to use the same parameters. BRANCH=None BUG=b:172222942 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie943dbdf03818d8497c0e328adf2b9794585d96e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3095438 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* rt1718s: refactor: move gpio control to driver moduleTing Shen2021-09-142-6/+74
| | | | | | | | | | | | | | | | | | | | This CL moves RT1718S gpio control from board file to common driver codebase, and implements the set flag and get/set level functions. Note that this CL does not fully implement IOEX interface because TCPC has different init process than usual ioexpanders. BUG=none TEST=1) pass faft_pd 2) manually test pd source/sink/frs on port 1 BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: If2a0bca2b13ad4748eea54b4c8004da7dc6fc6a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3159643 Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* bmi3xx: Fix sensor_num in ec_response_motion_sensor_dataRob Barnes2021-09-141-2/+1
| | | | | | | | | | | | | | | | | | The sensor_num should match the sensor index of the sensor that produced the data. It was incorrectly set to sens_cnt, which is just the offset of the sensors on the bmi3xx. BUG=b:195264765, b:197186738 TEST=Passed the following tests on guybrush: iioservice_simpleclient --channels='accel_x' --frequency=12.5 --device_id=2 --samples=1 run cts -m CtsSensorTestCases -t android.hardware.cts.SensorBatchingTests#testAccelUncalibrated_50hz_batching BRANCH=None Change-Id: Id51ea52a0426fc50a5001437e720eedf41c333ad Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150058 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* driver: ln9310: check return codesYuval Peress2021-09-131-93/+82
| | | | | | | | | | | | | | | | | | | Allow better code coverage by checking return codes in various internal static functions. BRANCH=none BUG=b:184856083 TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I28afe0538ed9ac98d4ecb9c499d218cd11cbc1ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158736 Commit-Queue: Yuval Peress <peress@google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Yuval Peress <peress@google.com> Auto-Submit: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* IOEX: it8801: change the KSO mapping array to overridableTim Lin2021-09-132-3/+4
| | | | | | | | | | | | | | | KSO mapping array need to follow the different circuit design, so change this array to overridable. BUG=b:199337186 BRANCH=none TEST=make buildall -j4 Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: I3ee0ceffbdb50cf9282cda6039c4a44ebe445bd0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3151045 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* driver: bmi: Merge list_activities in common codeGwendal Grignou2021-09-103-24/+11
| | | | | | | | | | | | | | | | | Put list_activities in common code, as it is used by both BMI160 and BMI260 driver. Fixes cb3771973de ("Coachz: MotionSensor: Avoid redefine gesture function list_activites") Fixes fc298a0ada0 ("driver: bmi260: integrate body detection") BUG=b:195908820 BRANCH=trogdor TEST=buildall Change-Id: I05591954c825802502328c842b03e8934c497f08 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150056 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: lsm6dso: Fix FIFO processingGwendal Grignou2021-09-102-37/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a loop in irq_handler to match datasheet documentation: """ 1. Read the FIFO_STATUS1 and FIFO_STATUS2 registers to check how many words are stored in the FIFO. This information is contained in the DIFF_FIFO_[9:0] bits. 2. For each word in FIFO, read the FIFO word (tag and output data) and interpret it on the basis of the FIFO tag. 3. Go to step 1. """ We need to read the FIFO length at the end of the IRQ handler to be sure a new item has not been put while the FIFO was being read. Otherwise, we will not get interrupt and will stop processing FIFO when the FIFO status register still shows the FIFO as not empty. However, using linux kernel st_lsm6dsx_read_tagged_fifo() as model, read only one word at a time: When reading 2 7bytes word at time, the FIFO would still claim one entry remains: The 3rd entry would be a copy of the accelerometer data, but with a corrupted z axis.That why we fail the data test, the gravity vector is not measured at 9.81m/s^2. There was a bug in the interrupt handler that would read the FIFO twice, which was presenting the data: both gyro and accel at the same ODR: [7623.475256 Base Accel FIFO status: 8002] [7623.476548 Base Gyro sending vector num: 2 raw: 0x00000007 - 0xFFFFFFF6 - 0xFFFFFFF9] [7623.477526 Base Accel sending vector num: 1 raw: 0xFFFFFFCC - 0xFFFFE275 - 0xFFFFE818] [7623.479271 Base Accel FIFO status: 8001] [7623.480333 Base Accel sending vector num: 1 raw: 0xFFFFFFCC - 0xFFFFE275 - 0x00000C18] [7623.481699 Base Accel FIFO status: 0000] We must only run the irq_hanlder for the main/accelerometer sensor. Restructure irq_hanlder to match other driver, like accelgyro_bm160.c. BUG=b:195700255,b:192219470 BRANCH=dedede TEST=Running tast run <ip> hardware.SensorIioserviceHard Check we get the right amount of samples. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I5820dec4c7c5ccb1ebeda854398738d1af60290c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150679 Reviewed-by: Keith Short <keithshort@chromium.org>
* driver: lsm6dso: Minor macro changesGwendal Grignou2021-09-102-5/+4
| | | | | | | | | | | | | | | | | | Rename LSM6DSO_FIFO_ODR_TO_REG into LSM6DSO_FIFO_ODR_MASK as the macro return the mask to use to set the FIFO ODR. Remove CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ in code, as already used in LSM6DSO_ODR_MAX_VAL. Simplify LSM6DSO_ST_DATA by using . instead of ->. BUG=none BRANCH=deded TEST=buildall Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I4253368415635c858ce181f228591e8bf93eacb9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150678 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* driver: LSM6DSM: Limit FIFO transfer buffer sizeGwendal Grignou2021-09-101-1/+1
| | | | | | | | | | | | | | | | | The buffer is allocated on the stack. It is currently 32*6 bytes. This is unnecessarily large as we set the FIFO threshold at 1. Reduce it to 8*6 bytes, the gain of long I2C transactions is negligible and we save some space in the stack. BUG=none BRANCH=none TEST=buildall Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I8b6f9f2bdfe27206d049c1fe0b82df4caaadce09 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150677 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* IOEX: it8801: Enable GPIO based interruptsVijay Hiremath2021-09-102-26/+153
| | | | | | | | | | | | | | | | Added code to enable GPIO based interrupts on it8801 I/O Expander. BUG=b:197659347 BRANCH=none TEST=Tested on ADL-RVP able to get ISR triggered Change-Id: I7f5f460f48fc21e51bb93bede5a05da89b7dc807 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3076469 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Dino Li <Dino.Li@ite.com.tw> Commit-Queue: Keith Short <keithshort@chromium.org>
* it8801: Allow configurable option to use RAW KeyboardVijay Hiremath2021-09-101-1/+3
| | | | | | | | | | | | | | | | | | To avoid BOM stuffing options on RVP, it8801 discrete keyboard with I/O expander is added on RVP as an AIC in MECC1.1. This config allows MECC vendors to easily switch between RAW keyboard or discrete keyboard. BUG=b:197659347 BRANCH=none TEST=make buildall -j Change-Id: I3b55eff0f5a1582daf63fca955954b8a42c1b7b2 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115433 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Li Feng <li1.feng@intel.com>
* ioex: it8801: Support multiple I2C addressesVijay Hiremath2021-09-102-5/+6
| | | | | | | | | | | | | | | | | | | To avoid the I2C address contention between multiple I2C devices on same bus, added code to support multiple I2C addresses for it8801 I/O expander. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I6985973f9ae3ce91383d3b568a851169e6a308af Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115426 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Li Feng <li1.feng@intel.com>
* tcpm/rt1718s: fix race condition between tcpc_init and usb_chg taskTing Shen2021-09-091-3/+0
| | | | | | | | | | | | | | | | | | | | | Two different functions controls the BC12_SNK_FUNC register, one is bc12_init, another one is usb_charger_task. This causes a racing condition happens during EC soft reset: bc12_init resets the BC12_SNK_FUNC register to its initial value when usb_chg task starts bc1.2 detection. To solve this, let usb_chg task has full control of the register. BUG=b:199226158 TEST=bc1.2 detection works after ec soft reset. BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ie423e2d9ddad1e1fadb97e1b73b8b5e535121601 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3147512 Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* bq25710: add IADP_GAIN configurationScott Chao2021-09-071-0/+1
| | | | | | | | | | | | BUG=b:198689488 BRANCH=none TEST=make -j BOARD=gimble Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Change-Id: Ic9bd989bc8ff19d93e9b350a74ff9a0ddeb3cf60 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139516 Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* Coachz: MotionSensor: Avoid redefine gesture function list_activitespengjunhao52021-09-072-11/+11
| | | | | | | | | | | | | | | | | | | | | This commit is for motion sensor combine(BMI160 & BMI260),Avoid redefine gesture function `list_activites`. BUG=b:195908820 TEST=make -j BOARD=coachz Verify build on SIT board BRANCH=Trogdor Signed-off-by: pengjunhao5 <pengjunhao5@huaqin.corp-partner.google.com> Reviewed-by: tongjian <tongjian@huaqin.corp-partner.google.com> Reviewed-by: yudengwu <yudengwu@huaqin.corp-partner.google.com> Change-Id: If31442d0c00745d124b20188b4e5fad8a9a1d173 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133188 Reviewed-by: Jian Tong <tongjian@huaqin.corp-partner.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* tcpm: Mitigate EC RX circular buffer overflowNathan K2021-09-031-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | There are two FIFO buffers for USB-PD packet reception. One is located in TCPC, another was added in EC layer in crrev/c/1185727 . There are scenarios that may lead to overflow. In these scenarios, the EC RX circular buffer overflows without clearing the TCPC ALERT# signal. This in turn results in a tight-loop in the TCPC interrupt handler, leading to port "suspend". This CL is a reduced hotfix to mitigate this scenario. Further CL is needed to perform proper TCPCI spec-compliant overflow handling. BRANCH=none BUG=b:192382194 TEST=1. Connect CB282K via DP to G5 dock on old FW 2. Connect G5 dock to AKEMI on TCPMv1 3. Allow MST VDM:Attention communication to occur 4. Observe EC console prints via SuzyQ Change-Id: Ic579a3763fc595b8250d4ca78c3942675450295a Signed-off-by: Nathan K <nkolluru@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3135041 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: Add BB retimer emulatorTomasz Michalec2021-09-022-47/+1
| | | | | | | | | | | | | | | | | | Add BB retimer emulator on i2c bus. Emulator properties can be defined using device tree or runtime emulator API. Emulator checks if RO registers and reserved bits are accessed correctly. API allows to set custom read/write i2c messagess handlers to emulate complex behaviour. BUG=b:184856919 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I4b641a90e6fb55e89aaee388c0ac04ab7bf367ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110085 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* ps8xxx: Fix PD task hang if PS8xxx device is missingKeith Short2021-09-021-2/+3
| | | | | | | | | | | | | | | | | | | | CL:3084331 added logic to retry reading the PS8xxx FW version register to ensure the chip has woken up from low power mode. If the PS8xxx device is damaged/missing, there was an unbounded loop so the initialization never completed, hanging the corresponding PD task. BUG=b:198619831 BRANCH=none TEST=Verify herobrine boots AP when the battery and right I/O board are disconnected. Also observe "LPM recovery failed" reported on the console for the missing type-C port. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I578f20a9a63dd54fc777dcc0acc26a7540a1bb46 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139975 Reviewed-by: Michał Barnaś <mb@semihalf.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* driver: ln9310: include status in error codeYuval Peress2021-09-021-1/+1
| | | | | | | | | | | BRANCH=none BUG=none TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I7963baa87d6edbd208fb8bad5c80866f26527748 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3138385 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* rt1718s: don't update charge_manager on supplier = NONETing Shen2021-09-021-1/+3
| | | | | | | | | | | | | | | | | Same bug as CL:3113487. charge_manager accidentally overwrites other global variable when supplier = -1. BUG=b:198552518 TEST=Add debug log in charge_manager.c, make sure charge_manager does not receive invalid arguments. BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I12787ab66fba7d8328440835867262e3828ac723 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140013 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* driver/sy21612: Fix sy21612 task signatureRob Barnes2021-09-011-2/+1
| | | | | | | | | | | | | | Tasks should have a void pointer parameter. BUG=None TEST=Build all BRANCH=None Change-Id: I6d8e289929862b60cef4901b59c78448173090ea Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3136035 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* driver: ln9310: Update init function signature to return statusYuval Peress2021-09-011-7/+8
| | | | | | | | | | | | | | | Return the status of the init function. This will be used in testing to verify that initialization was correct. BRANCH=none BUG=b:184856083 TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I578b32b24b3ee59abf646307fb9670d2db74fe3b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133624 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* STT: Don't talk to the SoC outside S0Rob Barnes2021-08-312-0/+10
| | | | | | | | | | | | | | | | STT interface is not available outside of S0, so report that the interface is not powered and allow the STT hook to exit quickly in this condition. BRANCH=None BUG=b:197745639 TEST=No STT errors with board in G3 state Change-Id: Id0c926ce896cdb4d3096746b3e7cc99db83bdd2d Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3126700 Tested-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* driver: ln9310: fix typoYuval Peress2021-08-311-1/+1
| | | | | | | | | | | | | | | | | | There's a bug in the chip_revision calculation. Also, add a missing include which causes a warning during build. BUG=none BRANCH=none TEST=make buildall -j Change-Id: Id636f4abcfffc0158d879d4b9333c7cb3ac1ee21 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133800 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Tested-by: Yuval Peress <peress@chromium.org> Auto-Submit: Yuval Peress <peress@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPM: Rename enum tcpm_sop_type and its constantsAbe Levkoy2021-08-3110-51/+51
| | | | | | | | | | | | | | | As a followup to CL:3104290, give the TCPCI TRANSMIT and RX_BUF_FRAME_TYPE types more consistent names. Most of them can be used for receiving, not just transmitting. Fix lint errors thus revealed. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I399ec479eacc18622fc4d3f55f8bdabf4560fcff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3125995 Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Convert usb_mux HPD functions to use mux_state_tDiana Z2021-08-307-17/+15
| | | | | | | | | | | | | | Since we have definitions for HPD IRQ and level in the mux flags, extend this to the HPD update function in the usb_mux structure as well. BRANCH=None BUG=b:172222942 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I19c3a65fc821a341338d73fabd7876339b37fe7d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3095437 Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Pull HPD update into mux configurestabilize-14189.B-mainDiana Z2021-08-301-6/+17
| | | | | | | | | | | | | | | The mux HPD update is the only function not currently going through configure_mux(). Pull out its contents so it may be run with the rest of the mux changes. BRANCH=None BUG=b:186777984 TEST=tast typec.Mode*.manual on voxel Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I5d91ca89dcdab0dcb0ba844494f9009948ee5abc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078412 Reviewed-by: Keith Short <keithshort@chromium.org>
* ANX7451: Report failure to set mux in G3Diana Z2021-08-261-3/+6
| | | | | | | | | | | | | | | | | | | Since the ANX7451 is unpowered in Z1/G3, return an error for mux sets during this time. This will let the usb_mux.c code know that any set it attempted to perform was unsuccessful. Otherwise, it will be assumed that setting mux mode of None succeeded, when we'll actually power up to default USB mode. BRANCH=None BUG=b:195045790 TEST=on guybrush, power on board and ensure that C1 is put into None mode successfully after its powered Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ic98be3bc15e8f0affeda25d7d7170b89e3aecf10 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3093087 Reviewed-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* tmp112: Support reading TMP112 in millikelvinRob Barnes2021-08-252-13/+35
| | | | | | | | | | | | | | | TMP112 supports .0625 degrees of resolution. Retain this resolution and support reading the temp in degrees millikelvin. BUG=b:176994331 TEST=Build and run on guybrush BRANCH=None Change-Id: I2802016b1edb08678953238e7f01acdd320c37cf Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3001391 Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* rt1718s: enable FRSTing Shen2021-08-253-10/+75
| | | | | | | | | | | | | BUG=b:190348051 TEST=Combined with other CLs in the chain, verify FRS workable on Tomato BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I52a020b1288928eb9a0f3ada1364776cd8e78337 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3109709 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* Homestar: Distinguish PS8755 with hidden registerxuxinxiong2021-08-252-0/+26
| | | | | | | | | | | | | | | | | | When TCPC PS8755 is upgraded to PS8805 firmware, the product id cannot distinguish whether the chip is PS8755 or PS8805. Only the hidden register value of PS8755 is 0x80, so use this hidden register to distinguish whether it is PS8755. BRANCH=trogdor BUG=b:196889096 TEST=emerge-strongbad chromeos-ec Change-Id: I99b50dfb2f5ae47c3d4dbb3334dcdae20c281478 Signed-off-by: xuxinxiong <xuxinxiong@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3113261 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>