Commit Graph

8594 Commits

Author SHA1 Message Date
Nicolas Boichat
6d567bc45f config: Rename new key to assistant key
Make it clearer what the new key is about.

CONFIG_KEYBOARD_NEW_KEY to CONFIG_KEYBOARD_ASSISTANT_KEY.

BRANCH=none
BUG=none
TEST=make buildall -j

Change-Id: Ic2db425b40ff8bc612626b6f644463b1f8ec630e
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/950263
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-05 23:48:27 -08:00
Nicolas Boichat
00f86c0684 wand: Define CONFIG_KEYBOARD_NEW_KEY
BRANCH=none
BUG=b:74207950
TEST=evtest shows events when search or assistant keys are pressed

Change-Id: I1816769144b379ba6067b3b50b08b3d208d45b14
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/949904
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-05 23:48:26 -08:00
Allen Webb
6719bdf3ed Cr50: Add LLSR (long long shift right) support.
Cr50 lacks native instructions for 64-bit integers and an ABI
function can be used by the compiler to take the place of the
needed instructions. This CL adds support for a right bitwise
shift of 64-bit integers.

BRANCH=none
BUG=chromium:794010
TEST=Set CONFIG_LLSR_TEST, build, update cr50, and run llsrtest
on the console.

Change-Id: Iae66c86720c531454ba29f15b3cc6a07959f5ef2
Signed-off-by: Allen Webb <allenwebb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/931932
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-03-05 18:34:40 -08:00
Aseda Aboagye
38c86d9d1e meowth: Update board version reporting.
There's a new pin being added for board versions.  Additionally, the
endianness is different than what was implemented.

BUG=b:73260349
BRANCH=stabilize-meowth-10444.B
TEST=Flash meowth; verify board version is as expected.

Change-Id: I97fb66f6c6aaf20d0ea4ed5994301490234ab812
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/949054
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-03-05 18:34:33 -08:00
Nicolas Boichat
3d4db585fa charge_state_v2: Reduce OTG voltage to 12V for better efficiency
BRANCH=none
BUG=b:73528930
BUG=b:73660652
TEST=Flash lux, check that lux adc VBUS voltage when only no
     charger is connected is around 12V.

Change-Id: Iccc245c96ca3c83674446f96f78f1ce15ffa7de2
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/948322
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-05 18:34:29 -08:00
Philip Chen
9896e428f7 Introduce CONFIG_USB_PD_5V_CHARGER_CTRL
Add a new config for the boards using charger (e.g. rt946x)
to report if VBUS source is enabled instead of using GPIO.

BUG=b:65446459
BRANCH=none
TEST=Charge Scarlet rev3 with SDP and DCP.

Change-Id: Id0a07945f0f888b6a36c422c596b56c5aa5065c0
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/905400
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-03-05 00:21:22 -08:00
Vincent Palatin
29c2aa3294 stm32h7: enable the fast PLL on-demand
Add a new module ID 'MODULE_FAST_CPU'.
When it is enabled with clock_enable_module(MODULE_FAST_CPU, 1), switch
the system clocking to the fast 400-Mhz PLL.

For now, I consider that a single task/user is calling
clock_enable_module(MODULE_FAST_CPU, x), so we don't need to count users
(in a complicated atomic fashion). It's good enough for the current
use-case and we can add the complexity later if we have a real need.

BRANCH=none
BUG=b:67081508
TEST=on ZerbleBarn, with follow-up CL setting
clock_enable_module(MODULE_FAST_CPU,x) around the computation block,
see that computations are fast and the clock goes back to HSI after.

Change-Id: I2aef3ad673ddbffd6fc64c591c54297e94896fa6
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/945688
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-03-05 00:21:21 -08:00
Vincent Palatin
55855fd593 stm32: crank up CPU PLL frequency to 400Mhz on STM32H743
Set the PLL frequency to 400 Mhz (max value) and the AHB frequency to
200 Mhz.

Fix the PLL clocking code for STM32H7 :
- fix the frequency computation.
- adjust the timer divider depending on the system clock.
- the 64Mhz HSI is already setup properly at startup, takes it into
  account.
- set the SPI ports on the fixed 64-Mhz HSI, so clocking changes don't
  mess up their frequencies or stability.

Note: this is just modifying the CPU frequency when the system is
clocked by the PLL, by default the system is still clocked by the 64-Mhz
HSI. Currently, one have to use the 'clock pll' console command to test
this PLL mode, some code will be added soon to switch on-demand for
heavy computations.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:67081508, b:72879097
TEST=On ZerbleBarn, do 'clock pll', check 'gettime' against wall clock,
run image capture and enrollment.
TEST=on ZerbleBarn, verify on the scope that the SPI master frequency is
4 Mhz in both configuration.

Change-Id: I92a2216999337cf9831fb5dfc2797ab1cce71a8f
Reviewed-on: https://chromium-review.googlesource.com/941226
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-03-05 00:21:20 -08:00
raymondchou
d87c684288 Nami: Enable fan feature
1. Enable fan feature and update fan setting.
2. Enable SW and chipset throttle feature.
3. Fix the issue that cannot set fan duty by "fanduty" in EC console.

BUG=b:72974136
BRANCH=none
TEST=Check fan command(fanduty/fanset/fanauto) in EC console can work and
check below condition.
1.AP throttling soft
--> Increased temperature to over trigger point, then to check
EC notify event in EC console.
2.AP throttling hard
--> Increased temperature to over trigger point, then to check
EC notify event and CPU_PROCHOT pin status in EC console.
3.Fan controlled in s3/s5 as expected (by EC)
--> Check Fan turn off in s3/s5.
4.Fan controlled in S0 as expected (by DPTF)
--> Check Fan keep 100% duty and no see DPTF to set fan duty.
But fan duty can be control by "fanduty" in EC console.
Change-Id: If9fd7f64c123ff54742052b6310023f0d4b0113a
Signed-off-by: raymondchou <raymond_chou@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/906086
Commit-Ready: Raymond Chou <raymond_chou@compal.corp-partner.google.com>
Tested-by: Raymond Chou <raymond_chou@compal.corp-partner.google.com>
Reviewed-by: Raymond Chou <raymond_chou@compal.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-03-03 02:50:48 -08:00
Elmo_Lan
6790a884a4 Nami: add keyboard backlight function
Base on LM3509 chip. Add file LM3509.C and LM3509.H
to control keyboard backlight when S0/LidOpen is turn on,
others is turn off.

BUG=b:73055990
BRANCH=none
TEST=Verify keyboard backlight function in resume and suspend.
S0/LidOpen is turn on; S4/S5/G3/LidClose is turn off.

Change-Id: Ief9e385f969c9dfc9e8f0d4e47ea7803cee747aa
Signed-off-by: Elmo_Lan <elmo_lan@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/881081
Commit-Ready: Raymond Chou <raymond_chou@compal.corp-partner.google.com>
Tested-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
2018-03-02 22:22:34 -08:00
Furquan Shaikh
f32d92b7f5 npcx: Preserve default values of HW_WIRE
NPCX7 requires that the HW_WIRE bits 2-0 of VWEVSM2 register are set
so that the hardwire signals for SCI, SMI and RCIN are connected to VW
input of eSPI_SIF module. NPCX5 did this by default, however NPCX7 has
made it configurable.

NPCX7 however sets the HW_WIRE bits 2-0 to 1 at reset. So, this change
ensures that they are preserved while initializing VWEVSM2 registers

BUG=b:74111394
BRANCH=None
TEST=Verified that SCI works on glkrvp and meowth with NPCX7.

Change-Id: I9da6f45b4aa0b72b68db6192cb7567f09b072f0c
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/943801
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: ML Chao <mlchao@nuvoton.corp-partner.google.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-03-02 19:52:06 -08:00
Philip Chen
6589e15e42 scarlet: Turn off ADC after board version is read
We can turn off ADC after the first successful read for board version.
A few milliwatts saved is important when Scarlet is in S3.

BUG=b:72160379
BRANCH=scarlet
TEST=Try 'version' command a few times on EC console and see
correct board version.

Change-Id: Id2bef415f161431ed895f49db30d50347479176d
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/942377
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Derek Basehore <dbasehore@chromium.org>
2018-03-02 15:47:00 -08:00
Philip Chen
69c18ad6a6 scarlet: Enable 4A charging for Simplo battery
Simplo update battery spec again -
the maximal charging current can be 4A now.

BUG=b:70820167
BRANCH=scarlet
TEST=build scarlet

Change-Id: I52e295b83563240aed73944107b00649c9b422b1
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/942370
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
2018-03-02 15:47:00 -08:00
Vadim Bendebury
f6b72676a0 cr50: fix console command RMA authentication code check
When checking the RMA authentication code the code currently just
verifies the value, but does not act on it.

This patch directs the user input through the same vendor command path
which is used when the RMA operation is controlled using gsctool.

BRANCH=cr50, cr50-mp
BUG=b:74080723
TEST=verified that issuing 'rma_auth <code>' on the Cr50 console now
     trigger CCD open and reboot.

Change-Id: Ib3fab131b6a24b65618f0b1f2504638f8df11a4b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/945311
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-02 13:25:12 -08:00
Vincent Palatin
f23f45e74e cortex-m: enable I-cache on ARMv7-M
The ARMv7-M ISA defines standard (and optional) mechanism to manage the
CPU caches through the SCB (System Control Block) registers.
So far, only the Cortex-M7 core implements such as a mechanism (e.g. the
Cortex-M4 with caches we have are using a proprietary mechanism for the
management).

Define the functions to use the I-Cache,
and enable them on STM32H7 which is our only supported Cortex-M7 core.

The D-Cache mechanism is still To Be Done, as it involves a bit more
support in the firmware for the DMA memory areas.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:67081508
TEST=on ZerbleBarn, verify manually that the 'IC' bit is set in the CCR
(e.g. 'rw 0xe000ed14' returns 0x60218), and runs some CPU workload
without crash and with a speed-up.

Change-Id: I6af1021d65048b787630387f7d95797db15d069c
Reviewed-on: https://chromium-review.googlesource.com/943445
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-02 06:49:06 -08:00
Vincent Palatin
c55f094960 stm32: fix RTC configuration on STM32H7
The DBP bit needs to be set in the PWR_CR1 register before doing the RTC
configuration (in order to be able to right RTC registers).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:67081508
TEST=on ZerbleBarn, dump the RTC_TR register and it is incrementing
every second, e.g. 'rw 0x58004000'.

Change-Id: I02dc6c6f1852ced934bccf3e401f4fdc1aad57d9
Reviewed-on: https://chromium-review.googlesource.com/941224
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-03-02 06:49:05 -08:00
Daisuke Nojiri
074050c048 Nami: Enable interrupt for BMI160
BUG=b:72335612
BRANCH=none
TEST=make BOARD=nami

Change-Id: Ifcf401b881a40490ead8186be77cc7a097550291
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/941601
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
2018-03-01 16:13:43 -08:00
Mary Ruthven
097f5e6a0b cr50: include GscFullConsole in rma open
Set GscFullConsole to Always in RMA open. We need this to be accessible
after rma open, so that we can use RMA open as a ccd open testlab
replacement.

Commands like rddkeepalive and bitbang are needed for testlab use, so
they should be accessible after open.

BUG=b:74019846
BRANCH=cr50, cr50-mp
TEST=build, do rma open, verify commands are not locked out, and do rma
disable

Change-Id: Iaeb89cea94d478dc0eb25c92bb09d488d14cad41
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/942309
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-01 16:13:34 -08:00
Vincent Palatin
e0e2645b1e meowth_fp: update RW signature verification config
Move the RW signature verification in a dedicated task rather than on
the synchronous startup path, in order to be compatible with our flashrom
update mechanisms (but at the expense of additional latency in RO).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:36125319
TEST=flashrom -p ec:type=fp -w ec.bin

Change-Id: If9ae66bfde0c5922db86dc9acfd4ee766089fa1d
Reviewed-on: https://chromium-review.googlesource.com/936542
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-03-01 16:13:11 -08:00
Vincent Palatin
870fa901a3 ectool: add missing EC feature strings
Add the strings to display the recently added EC feature flags.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=none
TEST=on ZerbleBarn, run 'ectool inventory'

Change-Id: I213d34515800532fc3b2378b8619e2b90ce5fd28
Reviewed-on: https://chromium-review.googlesource.com/937263
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-03-01 16:13:10 -08:00
Vincent Palatin
045aef2cda make EC_FEATURE_RWSIG definition more useful
Also define the EC_FEATURE_RWSIG feature bit if the RO firmware contains
the RWSIG task but not the RW.
Given the RWSIG verification task is not terribly useful in RW
(where it is never executed), it can be skipped there but the host
program trying to detect RWSIG usage (e.g. flashrom) still wants to be
able to detect it.

In order to be able to do so, add the HAS_TASK_xXx_RO and
HAS_TASK_xXx_RW flags which define the tasks defined in the other
partition (at compilation-time you might still run a frankeinstein combo).

Fix ectool 'inventory' to avoid segfaulting on missing feature string
definition.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:36125319
TEST=on ZerbleBarn, run 'ectool inventory', also uses flashrom to
re-flash the RW partition.

Change-Id: I224a6cc4aef956204792a2cc04ad12aaed5abf47
Reviewed-on: https://chromium-review.googlesource.com/937262
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-01 16:13:10 -08:00
Vincent Palatin
2e9ea7bf85 stm32mon: add option to replace the spinner
Using only a Carriage Return as done to have a nice spinner is not
terribly compatible with logging the output of the tool to a file or
piping it to anything.
Add another option to have a simple progress-bar instead.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=none
TEST=on Meowth, run flash_fp_mcu from the factory UI.

Change-Id: I0c37689d2ed1e45dff54b7f1eb2be515ea37e004
Reviewed-on: https://chromium-review.googlesource.com/936766
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
2018-03-01 16:13:09 -08:00
Vincent Palatin
f917f447d7 fix shmem console command
The shmem console command was looping with the wrong iterators,
doing an infinite loop when there was more than one allocated or
free block.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=none
TEST=build software with CONFIG_MALLOC and CONFIG_CMD_SHMEM, then run
'shmem' on the console at different time without hitting watchdog reset.

Change-Id: I93a9cff3811669ab895fa8753d1571e90aeb4f33
Reviewed-on: https://chromium-review.googlesource.com/943070
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-03-01 12:39:05 -08:00
Haridhar Kalvala
73ed5a5a78 Revert "poppy/soraka: Enable VR decay for runtime and suspend S0ix"
Because of instability(corner case) occured in couple of boards,
its better to enable VR_decay at SLP_S0 and disable it in S0
system state.

BUG=b:70881268
BRANCH=None

This reverts commit fac65e668c.

Change-Id: I7dff9983befc68c33052fffcb058ac01579c5a47
Reviewed-on: https://chromium-review.googlesource.com/939225
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-03-01 12:39:04 -08:00
Daisuke Nojiri
84208c27ae npcx/fan: Make all fans in RPM mode work
Currently, if there is a fan which isn't in RPM mode, the rest of the
fans are not controlled even if they're in RPM mode. This patch gives
a chance to all the fans.

BUG=b:35543471
BRANCH=none
TEST=none

Change-Id: I6f930bad313bc2a31497f46647ab2b08e328dfff
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/940813
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-02-28 21:30:03 -08:00
Divya Sasidharan
06b1140d3d glkrvp: Discharge on AC when battery almost full
In the case of almost full battery, without this
change the battery will keep charging even
if charging is not allowed when external power
is kept attached.

BUG=b:71364739
BRANCH=master
TEST=On glkrvp, let battery charge to 100% and verify after that
     it starts discharging to 95% and then starts charging back.

Change-Id: I71935f795909d11ad93fd56caaa3683b54104c65
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/927798
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-02-28 21:30:02 -08:00
CHLin
5e614b1c98 npcx7: WoV: Add support for Wake-on-Voice (WoV) module
This CL adds the driver support for the WoV module which inludes the
following files:
  - wov.c
  - wov_chip.h
  - apm.c
  - apm_chip.h
It also supports the console commad "wov" which can test different
configuration and audio quality by entering different parameters.

The detail description of WoV console command is listed below:
------------------------------------------------------------------------
 [Note]: Before changing any of settings, please make sure the operation
 mode is on the "OFF" state. (ie. run the command wov cfgmod off
 first) .

 > wov init
 Initialize WoV interface, including pin mux and interrupt
 registration etc.

 > wov mute <enable / disable >
 mute enable / disable.

 > wov cfgsrc  <mono | stereo | left | right>
 set audio source, ex: wov cfgsrc left, means audio source from left
 MIC.

 > wov cfgbis  <16|18|20|24>
 set audio resolution, ex: wov cfgbit 16 means audio resolution are
 16bits.

 > wov cfgsfs  <8000|12000|16000|24000|32000|48000>
 set audio sampling frequency rate, ex: wov cfgsfs 48000 means audio
 sampling rate are 48Khz.

 > wov cfgbck  <32fs|48fs|64fs|128fs|256fs>
 set I2S bit clock rate, ex: wov cfgsfs 48000 and wov cfgbck 32fs
 means audio sampling rate are 1536Khz (32*48000).

 > wov cfgfmt  <i2s|right|left|pcma|pcmb|tdm>
 set I2S but format, ex: wov cfgfmt right means audio I2S format are
 Right-Justify.

 > wov cfgmod  <off|vad|ram|i2s|rami2s>
 set audio operation mode ,ex: wov cfgmod i2s means audio output via
 I2S bus.

 > wov cfgtdm  <0~496 0~496 0~3>
 set TDM time slot, the first values is left channel delay counter,
 the second is right channel, and the 3rd is startup counting condition.
 (chosen LRCK raising or falling edge) .
 [Note: this command is just working on cfgmod equal to tdm]

 > wov cfgget
  retrieve above settings.

 > wov vadsens
 (currently not support, reserve for next version)

 > wov gain (0~31)
 set audio data gain value, ex: wov gain 10 means setting audio digital
 gain are 10dB.

 > wov cfgdck <1.0 | 2.4 | 3.0 >
 set digital MIC PDM clock rate. ex: wov cfgdck 2.4 means PDM clock
 are 2.4Mhz.

-----------------------------------------------------------------------

This CL also adds the chip ID (0x24) for npcx7m7w. So the console
command "version" can show the chip is npcx7m7w.

BRANCH=none
BUG=none
TEST=No build errors for make buildall.
TEST="BOARD=npcx7_evb make"; Flash the image on EVB; Test WoV function
with console commands described above.

Change-Id: Ief2b3e89edbd3e6d2a9d82d317a93c9f0b7a20cd
Signed-off-by: Dror Goldstein <dror.goldstein@nuvoton.com>
Signed-off-by: Simon Liang <CMLiang@nuvoton.com>
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/897314
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2018-02-28 15:21:13 -08:00
Philip Chen
2f1e99bcef charger/rt946x: Support BC 1.2
BUG=b:65446459
BRANCH=none
TEST=Charge Scarlet rev3 with SDP and DCP.

Change-Id: I84fb64953c380b96ec852dca2c981331801e4416
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/905399
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-02-28 15:21:08 -08:00
Jett Rink
7a0a4d6393 yorp: initial add of octopus BOM-A board
BRANCH=none
BUG=b:73811887
TEST=build yorp and all other boards

Change-Id: I2c29ba86f29a3d25128c00c1b55e90f6843bcdd5
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/935367
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-02-28 15:21:06 -08:00
Jett Rink
75acf08118 cleanup: Sorting list alphabetically
BRANCH=none
BUG=none
TEST=make buildall

Change-Id: I3c07a87e0a41ad3ec51f78e30e14ac7d45d3e531
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/935366
2018-02-28 15:21:05 -08:00
Alexandru M Stan
000f5301b8 scarlet: gyro should be off by default
Things that need it will request it to turn on.
The only reason accel is on by default is because we need to be able to
poll it from time to time.

TEST=Motion related things still work
BUG=While looking at b/67743747
BRANCH=master

Change-Id: I08ea487058fb93ce6ff5fcc9054243d83e189e21
Suggested-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/887947
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2018-02-27 20:17:36 -08:00
Philip Chen
0f80ec9474 scarlet: Keep VBAT on for the fuel gauge
The fuel gauge (max17055) on Scarlet is powered by VBAT.
To use max17055 to detect batttery presence, we want to keep
it alive even if battery is disconnected.

BUG=b:72697658
BRANCH=scarlet
TEST=boot scarlet rev3 w/o battery on AC and don't see VBAT drops

Change-Id: Ice27384ded257be75ee29a28c0ada9f73b173f6c
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/930572
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
2018-02-27 20:17:35 -08:00
Jett Rink
284c0c3589 usb-pd: Tell TCPC and PPC to both source Vconn
BRANCH=none
BUG=b:72961003,b:72956593
TEST=verified with grunt that parade TCPC will no longer shut down when
PPC sources Vconn

Change-Id: I6c1cee4dd8a40a992813841ec227a6af04de5313
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/935301
2018-02-27 14:51:13 -08:00
Elthan_Huang
87c549aebd Nami: Add remote temperture 2 reading function
1. Add reading function for remote2 temperature (Fintek, F75303)
2. Modify the temp_sensors to read sensor remote1 and remote2 for nami.

BUG=b:72974136
BRANCH=none
TEST=Verify Nami can get thermal remote 2 data by command "ectool temps
all"

Change-Id: I5e4a58f20089ed5690e2a084e93e7021e80afcdc
Signed-off-by: Elthan_Huang <elthan_huang@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/910270
Commit-Ready: Raymond Chou <raymond_chou@compal.corp-partner.google.com>
Tested-by: Raymond Chou <raymond_chou@compal.corp-partner.google.com>
Reviewed-by: Raymond Chou <raymond_chou@compal.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
2018-02-27 05:14:31 -08:00
Vadim Bendebury
5bab2ee13d cr50: move dev version to 0.2.3
This will make sure that Cr50 images built from dev branch can take
over images built from either MP or pre-MP branches.

BRANCH=none
BUG=none
TEST=verified that it is possible to overwrite pre-MP Cr50 version of
     0.2.2.

Change-Id: I929cb2be857ea90c544f83160d6820c73e23c69d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/938946
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-02-26 22:07:22 -08:00
Daisuke Nojiri
c6f5fe6d30 npcx/fan: Avoid turning on disabled fans
Fan enable state is controlled in common/fan.c. This patch prevents
npcx fan driver from enabling it.

BUG=b:73127788
BRANCH=none
TEST=Verify no 'Fan 0 stalled' is printed in S3 and S5. Verify the
fan spins in S0.

Change-Id: I549253a64c91d8a23bb793c3506b5daf1f7642be
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/937941
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-02-26 22:07:16 -08:00
Marius Schilder
ab706d65fd g: make fw upgrade less chatty
When running w/ blocking usb console output
(CONFIG_USB_CONSOLE_CRC) and the host is not polling the console,
upgrade will fail.

Signed-off-by: mschilder@google.com
TEST=buildall -j8; gsctool update succeeds on mn50
BRANCH=none
BUG=none

Change-Id: I5c09694c146ba0fbf7562b86ab0fad0d578bc5ff
Reviewed-on: https://chromium-review.googlesource.com/938392
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-02-26 19:28:55 -08:00
Jeff Andersen
3b2fec7700 Add rw_product_family field to signed_header.h.
This field allows multiple product families to be independently versioned
and released, without risk of having one product family's image flashed
to another product family's chip.

BUG=b:73728151
BRANCH=none
TEST=make buildall -J

Change-Id: I53f5e5b1e9ac7ea19997f8d1228a568e66c43d39
Reviewed-on: https://chromium-review.googlesource.com/935759
Commit-Ready: Jeff Andersen <jeffandersen@google.com>
Tested-by: Jeff Andersen <jeffandersen@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Nadim Taha <ntaha@google.com>
2018-02-26 19:28:39 -08:00
Philip Chen
7ee410c14d charger/rt946x: Initialize earlier
Thermal protection is by default enabled on rt946x, but we
disable it in rt946x_init() and only rely on the fuel gauge
to do thermal measurement.

Thus when we init rt946x too late, rt946x could trigger thermal
protection during boot and brown out the fuel gauge temporarily.

BUG=b:72697658
BRANCH=scarlet
TEST=boot scarlet rev3 w/o battery on AC and don't see VBAT drops

Change-Id: I54eadd80bd4fd8a6e47309b13c4d46ee01dec04a
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/933703
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-02-26 16:27:25 -08:00
Philip Chen
c3deceae6a battery/max17055: Report battery presence properly
For boards using max17055 and dumb battery, we can always
read battery parameters from max17055 regs, even if the
read values are out of whack.

So it doesn't make sense to determine battery is present
because we can read these parameters from max17055.

Meanwhile, we have to set CONFIG.TSEL on max17055 as early
as possible because this is required for max17055 to detect
battery presense.

BUG=b:72697658
BRANCH=scarlet
TEST=boot scarlet rev3 w/o battery on Type-C/PD chargers

Change-Id: Id190f0c2aa5bcd62dbe3edccca6460bf145cff01
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/933702
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-02-26 14:10:12 -08:00
Vincent Palatin
36679bb544 stm32mon: skip empty blocks
Skip the empty blocks when writing even if they are in the middle of the
firmware.
This greatly improves flashing speed when the firmware contains a
signature at the end of the RW.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:36125319
TEST=./util/flash_ec --board=meowth_fp

Change-Id: I3cd1c1bd2670be23d3d9daf9b87d9af0bdfc8963
Reviewed-on: https://chromium-review.googlesource.com/880956
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2018-02-26 14:10:02 -08:00
Vincent Palatin
fb8e3f922b stm32: trigger watchdog hard reset immediately
When using the watchdog (IWDG) to perform the cold reset, set the Key
register to 'RELOAD' (0xAAAA) rather than 'START' (0xCCCC) to ensure
that the reset is performed immediately rather than at the end of the
current watchdog period (which might be 1 to 5s away).

Replace the Key register special values by their symbolic constants.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:67081508
TEST=On ZerbleBarn using a STM32H7, run 'ectool reboot_ec cold' and see
the MCU rebooting immediately rather than after 5s.

Change-Id: Ib49c703e3ec973389e4d774eda53f3be7ec4dd2e
Reviewed-on: https://chromium-review.googlesource.com/936764
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-02-26 09:32:52 -08:00
Marius Schilder
e5e1b7ea5d g: add CONFIG_USB_CONSOLE_CRC
This option will cause usb console output to block and
also compute a crc32.

Signed-off-by: mschilder@google.com
TEST=make buildall -j
BRANCH=none
BUG=none

Change-Id: Icf66d5ddbea52008a9c97094e7c83194caa7db79
Reviewed-on: https://chromium-review.googlesource.com/936281
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-02-24 01:22:46 -08:00
Marius Schilder
3c4800e594 ec: add crc32_ctx..() to take context parameter.
Add crc32_ctx.. functions to take context parameter.

This allows for multiple instances to exist in parallel.

Signed-off-by: mschilder@google.com
TEST=make buildall -j8 succeeds
BRANCH=none
BUG=b:73832883

Change-Id: I66bbc56377eeebf01c790caad0bc4c7a51a1bc58
Reviewed-on: https://chromium-review.googlesource.com/935825
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-02-23 23:13:01 -08:00
Vadim Bendebury
d57e5eb312 gsctool: add open box RMA option
This patch enhances the gsctool utility to allow to verify RO sections
of the target AP and EC flash memory.

The only command line parameter required for the new option ('O') is
the file name of the target descriptors database, containing memory
description sections for one or more Chrome OS devices.

Memory description sections are of two types (both types could be
referring AP or EC memory):

 - hash descriptor, this section includes the address range of the
   memory and one or more hash values for the contents of that address
   range. Multiple hashes are needed in case when the same device has
   mnore than one RO firmware releases in circulation.

 - dump descriptor, this is a request for this utility to display on
   the console the contents of the certain area of flash memory on the
   target.

When this utility starts the process, the target might request that
the operator confirms physical presence, in this case the utility
keeps prompting the operator to press the physical presence button
until DUT is satisfied,

BRANCH=none
BUG=b:73668125
TEST=created a descriptor database for a Robo device feeding it with
     values retrieved on the device by locally running spihash command
     on the device.

     Then ran this utility to verify successful hash and dump
     retrievals, comparing dump values with values obtained through
     Cr50 console directly.

     Created additional dummy hash variants and verified that the
     utility succeeds only if all matches happen at the same variant
     index in different hash sections.

Change-Id: Ib43cf4eb642d141b7cd7f129ef412e14bd59f30b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/933545
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-02-23 23:12:58 -08:00
Vadim Bendebury
52b93ce19d gsctool: move common objects and definitions into a .h file
This is a lateral move allowing to share some data structures and
functions previously limited to the gsctool.c scope.

This will allow adding new functionality in a separate .c file, and
further refactor gsctool.c which little by little became quite
unwieldy.

BRANCH=none
BUG=b:73668125
TEST=gsctool utility still works for uploading Cr50 images.

Change-Id: Ib56db3e0b983c53a228a658467a3059abcf2166e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/933543
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-02-23 23:12:57 -08:00
Vadim Bendebury
9a6de75ebf gsctool: add RO descriptor parser
This patch adds code which would parse the RO hash/dump descriptor
file including a database listing expected values of hashes for
various ranges of target SPI flash devices, or areas which need to be
printed out (hex dumped) for operator inspection.

Lines starting with '#' are completely ignored. The rest of the
logical lines could actually split into multiple text lines in the
file, so to separate one logical line from another at least one empty
line is required.

Hash descriptor database file consists of sections for various Chrome
OS boards. Each board description section starts with a logical line
of 4 characters which is the board ID (the same as the board's RLZ
code).

Each board description section includes variable number of range
descriptor entries, each entry being a logical line, potentially split
into multiple text lines.

Each entry consists of semicolon separated fields:

 {a|e|g}:{h|d}:base_addr:size[:value[:value[:value...]]]]

 Where

  - the first sindgle character field defines the way the range is
    accessed:
     a - AP flash
     e - EC flash
     g - EC flash requiring gang programming mode
  - the second single character field defines the range type
     h - Cr50 returns the hash of the range
     d - Cr50 returns actual contents of the range (hex dump)
   - the third and and forth fields are base address and size of the range
   - ranges of type 'h' include one or more values for the hash of the
     range, each hash is a 64 byte hex string. Ranges of type 'd' do
     not include any data.

All values are expressed in hex.

The parser API provides functions to open the passed in hash
descriptor file and find there the section for a particular board, a
function to advance to the next entry in the board's section, and a
function to close the file when board entries scanning is completed.

When scanning the entries, the parser verifies their sanity, i.e.
conformance with the above described format, that all hashes are of
the right size, that there are no hashes attached to 'dump' entries
and there is at least one hash attached to the 'hash' entries, and
that there are no invalid characters in the hashes and address range
definitions.

The parser is not yet used by the gsctool, but when the new module is
compiled stand alone with -DTEST_PARSER passed to the compiler, it
becomes an executable which can be given the test hash database (the
new file, sample_descriptor) to interpret and report success or
failure.

BRANCH=none
BUG=chromium:812880
TEST=ran the following commands:

  $ gcc -DTEST_PARSER desc_parser.c -o dp
  $ ./dp sample_descriptor
  Section 1, rv 0
  Section 2, rv 0
  Section 3, rv 0
  Unexpected data in section 4
  Section 4, rv -22
  Invalid hash 1 size 0 in section 5
  Section 5, rv -22
  Invalid hash 1 size 0 in section 6
  Section 6, rv -22
  Invalid hash 1 size 63 in section 7
  Section 7, rv -22
  Invalid hash 1 size 65 in section 8
  Section 8, rv -22
  Invalid hash 1 value in section 9
  Section 9, rv -22
  Unexpected number of variants in section 10
  Section 10, rv -22
  Invalid hex value 10x in section 11
  Section 11, rv -22
  Section 12, rv -61
  $

Change-Id: I14b2754a5f6ba26b3c56ddc26d45cb4574514b69
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/923419
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2018-02-23 23:12:56 -08:00
Philip Chen
ae952f06a8 scarlet: Update battery profile for Simplo battery
BUG=b:69634899
BRANCH=scarlet
TEST='battery' command shows the full cap is updated to 8734 mAh

Change-Id: I090d80e7c889c044ba2dfbdf02527a0791419320
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/933861
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-02-23 21:07:14 -08:00
Marius Schilder
25e8bc3efd g: optionally check board_id match at upgrade time
CONFIG_IGNORE_G_UPDATE_CHECKS currently drops all upgrade checks.
Now with CONFIG_BOARD_ID_SUPPORT only check for board_id match.

CR50_DEV still retains full no check behavior.

TEST=buildall -j8
BRANCH=none
BUG=none

Change-Id: I0d085a26c814cd0f35450f0a0db06fe8525ab896
Reviewed-on: https://chromium-review.googlesource.com/933589
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-02-23 07:23:45 -08:00
Furquan Shaikh
a5f63e0391 nautilus: Disable sensor in S5
BUG=b:73292704
BRANCH=None
TEST=None

Change-Id: I6f2f09232daed87fcd54a356ee13e69bfeda994c
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/918381
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Jerry Parson <jwp@chromium.org>
2018-02-23 07:23:41 -08:00