Commit Graph

448 Commits

Author SHA1 Message Date
Caveh Jalali
c74c078592 tcpm: add .release driver operation.
similar to the USB_PD_TCPC case, add release/init operations when the
pd_task enters/leaves the PD_STATE_SUSPENDED state.  one use case for
PD_SUSPEND is to get exlusive access to the TCPC for things like
firmware update, so the release/init operation is needed to get the
TCPC and driver into a good state.

updated all tcpm_drv style drivers.  for backward compatibility, "old"
drivers that may not handle init/release properly simply return
EC_ERROR_UNIMPLEMENTED for tcpm_release().  pd_task() uses this as a
signal that it should not try to re-init() the driver.

TEST=tested in combination with follow-on CLs to do TCPC firmware
	update on electro.  also built for kevin, eve, sand which are
	some of the other boards using these drivers.
	"make buildall -j" passes.

BRANCH=none

BUG=b:35586896

Change-Id: I3d2964a79e710428f7a6e7004d68ab424af85be8
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/544660
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-06-28 23:23:41 -07:00
Shawn Nematbakhsh
b0dd82b39c cleanup: Remove big and pit boards
Remove big and pit boards along with several now-obsolete CONFIGs /
source files.

BUG=chromium:735109
TEST=`make buildall -j`
BRANCH=None
CQ-DEPEND=CL:544681

Change-Id: Ieb784bd36157fd1f6240cd19de6e6d12191a8097
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/540667
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-06-22 17:03:52 -07:00
Shawn Nematbakhsh
89b8ff1cba cleanup: motion_sense: Remove driver data structure externs
Driver data structs are now accessed through the drv_data pointer.

BUG=chromium:733352
BRANCH=None
TEST=`make buildall -j`

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I8fedb425708a08ae6900ade6f17967fe2bc75ebf
Reviewed-on: https://chromium-review.googlesource.com/537217
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-06-15 23:54:00 -07:00
Vijay Hiremath
ce65199e5e BD9995X: Disable input current limiting for VBAT < VSYSREG_SET
The initial value for input current limit is set to
CONFIG_CHARGER_INPUT_CURRENT which is typically 512 mA. In deeply
discharged battery cases (Vbat < 5.8V), the 512 mA input current limit
can cause VSYS to collapse which in turn causes the EC to
reset. Depending on how discharged the battery is, the EC may remain
off until the external charger is disconnected and reconnected again,
or it may undergo a number of reset cycles, each time charging the
battery just a little, until Vbat becomes > ~5.8V and the charger is
able to stabilize. When the charger type is determined, either from
BCD detection, or Type C/USB PD, the input current limit is set to the
appropriate level.

In order to avoid the issue described above, this CL sets a bit in the
VIN_CTRL_SET register which will disable the input current limit in cases
Where the VBAT is less than the VSYSREG_SET value.

BUG=b:35648317
BRANCH=none
TEST=Manually tested on Electro.
     a. With Zinger attached DUT boots without the battery after
        plugging in AC
     b. DUT boots from cut-off battery
     c. With Zinger attached DUT boots from cold-reset without the
        battery
     d. With no battery & DCP charger, anti-collapse occurs,
        input current is limited to 512mA & the DUT is
        power-up inhibited.

Tested also on Eve with signal wires attached to both PPVAR_VSYS,
PP3300_DSW, and Vbat. Verified that on certain boards (some board to
board variation) that PPVAT_VSYS would collapse when the input current
limit was set to CONFIG_CHARGER_INPUT_CURRENT. Then after adding this
CL, verifed on the scope that the collapse of PPVAR_VSYS no longer
occurred.

Change-Id: Ief9960550f988e69ab4637db85450e91c70d3b51
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/456049
Commit-Ready: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
2017-06-03 20:31:40 -07:00
Scott Collyer
8bf7f38597 sensor: bmi160: Fix macro used to set double tap interstice
The line to convert the desired double tap window time to its
register value was using the incorrect macro. Have corrected this to
use the intended one.

BUG=b:62202895
BRANCH=none
TEST=On Eve verified that double tap events are properly detected.

Change-Id: I70d810c93a8e27a3f61f3175e1ea95d0e59554ac
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/518522
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2017-05-31 21:14:36 -07:00
Kevin K Wong
03a665939f pd: ensure tighter timings for IRQ_HPD pulse
In order to ensure we are always meeting the deadlines for the IRQ_HPD
pulse, increase the priority of the processing by moving the rising edge
from the low-priority HOOK task (in a deferred function) to the caller
task (which is the high-priority PD task).
The downside is we are now sleeping in the PD task blocking the
processing of the PD messages during this time.

Changed HPD_DSTREAM_DEBOUNCE_IRQ to 500us instead of 750us. According
to DP spec, the IRQ_HPD pulse width is between 500us and 1000us.

Ensure there is a minimum of 2ms delay in between each IRQ_HPD as specified
by the DP spec, by sleeping before sending the next pulse if needed.
(in practice, this should not wait if we are not too off processing the
messages)

BUG=chromium:711334
BRANCH=glados strago reef oak
TEST=manual, on SKL platform with kernel 3.18 and MST, verify display is
functional on USB-C dock.

Change-Id: Ib2e9dd608c5f1c671cc5a0fd979a5742101375ff
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/508629
Reviewed-by: Todd Broch <tbroch@chromium.org>
2017-05-29 03:28:25 -07:00
Dino Li
1c29603580 tcpm: it83xx: reload cc parameter setting during initialization
The trimmed value of CC parameter setting registers
(port0: ff3760h ~ ff3763h, port1: ff3860h ~ ff3863h)
will be reset to default after a soft reset (system_reset()).

BRANCH=none
BUG=none
TEST=Console command 'reboot' and checking if the value of
cc parameter setting registers are correct (trimmed).

Change-Id: Ibf9c72e8aeef36701d72bcb64529735295295cdf
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/513744
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-25 04:27:42 -07:00
Vincent Palatin
4ce20f3f79 fpc1140: add the finger capture init sequence
Allow to configure the sensor to detect autonomously finger touch event
similar to what is done in the suspend() routine of the kernel fpc1020
driver.

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

BRANCH=none
BUG=b:35648259
TEST=make BOARD=eve_fp

Change-Id: I8b78bd6bdeecd8658850383417c950d9025fdf40
Reviewed-on: https://chromium-review.googlesource.com/491072
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2017-05-23 05:57:14 -07:00
Vincent Palatin
563456c658 eve_fp: add more fingerprint host commands
Move the existing fingerprint host command in the driver and
add more of them to prepare the new fingerprint architecture.
The commands are mostly stubbed for now.

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

CQ-DEPEND=*364728
BRANCH=none
BUG=b:35648259
TEST=make BOARD=eve_fp (with and without a private repository)
do a fingerprint image capture with 'fptest'.

Change-Id: Ie17a5fde2d6470c6272e8059bddc845cea07aff2
Reviewed-on: https://chromium-review.googlesource.com/491071
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-23 05:57:13 -07:00
Nick Vaccaro
9a0d0aa70d common: sensors: add extra sensor attributes
Adds min_frequency and max_frequency to struct motion_sensor_t.

New attributes min_frequency and max_frequency are now returned in
ectool's MOTIONSENSE_CMD_INFO response.

Incremented ectool's MOTIONSENSE_CMD_INFO version to version 3.

Add constants for MIN_FREQUENCY and MAX_FREQUENCY to each sensor's
header file.

BRANCH=none
BUG=chromium:615059
TEST=build/boot and verify MOTIONSENSE_CMD_INFO response on kevin,
make buildall -j passes.

Change-Id: I66db9715c122ef6bb4665ad5d086a9ecc9c7c93a
Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/482703
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-05-18 21:05:23 -07:00
Nicolas Boichat
8151b3f7e6 touchpad_elan: Read resolution and validate against build-time values
At init time, read resolution/dpi from trackpad, and check that
logical/physical dimensions match the expected values, provided
at build-time.

BRANCH=none
BUG=b:38277869
TEST=Flash staff, no error message at boot time. Flash hammer image
     onto staff, a warning is shown at boot time.

Change-Id: I5ef7d25b6e6525c2bd6fc023f58f3a242134d962
Reviewed-on: https://chromium-review.googlesource.com/505857
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-18 02:26:08 -07:00
Dino Li
53b72194cd bd9995x: BD9995X_PMON_IOUT_ADC_READ_COUNT is a power of two
With the change, compiler won't use 64-bit division for
bd9995x_psys_charger_adc() function.

BRANCH=none
BUG=none
TEST=To replace "reg" variable and checking the return value
     if it is expected for both "bd9995x_psys_charger_adc()" and
     "bd9995x_amon_bmon_chg_adc()" functions.

Change-Id: Ifc461e5a54ce583ff59281ad13421c640ec9e21e
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/485083
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-09 23:20:10 -07:00
Scott Collyer
6e38b4d5a3 driver: bd9995x: Modify USB_CHG task so interrupts can be handled
The function bc12_detect was using a msleep(312) to allow for enough
time for the bd9995 to determine the charger type. Putting the USB_CHG
task to sleep for this period of time means that the USB_CHG task is
not able to process interrupts from the bd9995 during that time. This
is a particular problem when Try.SRC is enabled and a charger is
connected. VBUS will only remain present for ~40-50 msec, and
when it goes away, the discharge circuit should be engaged. However,
the USB_CHG task is still in the 312 mSec sleep from when VBUS was
detected. The result is that discharge circuit is not engaged. It was
observed that processing of charger interrupts could be delayed
upwards of 500 msec.

On Eve with the EVT charger, VBUS was not discharging without the
discharge circuit being enabled. This resulted in excessive connect
time as the Try.SRC cycle repeated many times until a case where the
discharge circuit was not disabled when VBUS detect occurred and this
finally allowed the charger to attach.

This CL modifies the USB_CHG task main loop so that a wait timer is
used when bc12_type needs to be read from the charger. There is a wait
timer mark per port. If the mark value is 0, then a wait timer is not
required and the task is put to sleep with -1. Each time the task is
woken, either from the interrupt or wait event timer, the current time
is checked against the timer mark for each port. The function that
reads the bc12_type will return a 1 if the type is still not available
and will return 0 if either VBUS is no longer present, or the
bc12_type was successfully determined.

With this change in place the discharge circuit is reliably
enabled/disabled within ~5-10 mSec of VBUS changes.

BUG=b:37292010
BRANCH=reef,gru
TEST=Manual
Added signal probe wires to VBUS, discharge control, and charger
interrupt signals. Connected eve EVT charger and verified that the
discharge circuit is consitently enabled when VBUS is removed
following the initial attach in Try.SRC. Verifed that the EVT charger
always connects on the first attempt.

Also tested with various different chargers on both Eve and Reef
platforms. In addition, temporarily changed the initial deferred time
to 100 mSec and validated the path where vbus_provided is not true and
that additional deferred calls were initiated until bc12_type is valid.

Change-Id: Idd066b5461ec4cbb77bb023519fed90c9e9f71db
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/487028
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-03 16:54:09 -07:00
Dino Li
a97dae4738 tcpm: it83xx: added chip info
We can get the correct chip info after the change was made.

BRANCH=none
BUG=none
TEST=console message:
[0.013915 TCPC p1 VID:0x48d PID:0x8320 DID:0x1 FWV:0xec]
[0.018054 TCPC p0 VID:0x48d PID:0x8320 DID:0x1 FWV:0xec]

Change-Id: I4eb94967acb351559e745ed1c4e34a4c58f41e14
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/487767
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-05-01 21:54:05 -07:00
James Chao
92d3c8f6c8 BD9995X: Enable/Disable charger depending on charging current
If charging current is set to 0mA during charging, reference of
charge current feedback amp (VREF_CHG) is set to 0V. Hence the DCDC
stops switching (because of the EA offset). To eliminate this issue,
disable/enable charger depending on the charging current is zero
or non-zero respectively.

BUG=b:37413065
BRANCH=reef
TEST=test 'ectool chargecontrol normal/idle/discharge' are working

Change-Id: Id31876afe365a476fb906e059ab519b7a0c9a7c6
Signed-off-by: james_chao <james_chao@asus.com>
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/486101
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
(cherry picked from commit 6da9ed8786e90ee91b39934180fe84e01ac30260)
Reviewed-on: https://chromium-review.googlesource.com/489812
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
2017-04-30 22:50:54 -07:00
Nicolas Boichat
be294d4efb hammer: Only define required options for RO and RW
RO does not need touchpad/keyboard driver or I2C passthru, RW does
not need RW verification, let's shrink both images by only including
required config options.

BRANCH=none
BUG=b:35582031
TEST=Build and flash hammer: still functional.
   build/hammer/RO/ec.RO.flat shrank by 10144 bytes: (45868 to 35724)
   build/hammer/RW/ec.RW.flat shrank by 2764 bytes: (45332 to 42568)

Change-Id: Iff0feb4e8446cc9f2e32103cd383fddae3234fec
Reviewed-on: https://chromium-review.googlesource.com/479492
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-04-25 05:52:34 -07:00
Dino Li
b95463cf3c tcpm: it83xx: fill out structure members
These are options for features can be implemented if they are required.

BRANCH=none
BUG=none
TEST=build 'it83xx_evb' board with pd modules.

Change-Id: I1afb7d9c2d764728a375563a6739544032394c54
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/483319
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-04-25 01:45:44 -07:00
Scott
dda9541448 tcpm: anx74xx: Improvements to low power mode for S3/G3 chipset state
Before entering standby mode, bit 7 (cable_det) or analog_ctrl_0 is
cleared. This allows a new cable detect event to trigger the EC to
put the ANX4329 into normal mode. However, in some cases such as when
in S3/S5/G3 chipset power states a port will be in sink only mode and
therefore won't attach when a sink only adapter is connected to the
port. This results in the an indefinite toggle of standby<->normal
mode transitions. This constant toggle floods the EC console and more
importantly prevents the ANX4329 from remaining in standby mode and
the power consumption remains at ~9.5 mW instead of ~1.2 mW when no
adapter is connected.

This CL adds logic around clearing the cable_det bit so that it's only
cleared if both CC lines are open or if an Emark cable is
attached. Emark cable is determined from the presence of Ra on one CC
line and no Rd on the other CC line. The special consideration for an
Emark cable is reqiured because when an Emark cable is connected, the
USB PD auto toggle state may require some number of iterations until
the attach event is recognized.

In order to support handle cases where the drp mode is changed via
either the EC console command or host command, added a call to
tcpm_set_drp_toggle whenever the drp state is updated. Since the drp
mode is updated upon chipset resume events, the chipset resume hook in
board.c for anx74xx_cable_det_handler() became redundant and hence it
was removed.

BUG=b:35775019,b:35586188
BRANCH=reef
TEST=Tested the following cases:
- Sink, source adapters in chipset S0. Verified that adapters
connected as expected. Also, used Emark cable to connect to both USB
PD chargers (source)  and Pixel phone (sink).

- Run 'lidclose' on EC console then connect Type C -> A adatper
[3490.370125 TCPC p0 reset!]
[3490.389588 TCPC p0 Low Power Mode]
It no longer toggles indefintely and after running 'lidopen' verified
that port 0 is now in SRC_DISCOVERY.

- In S3/G3 connected USB PD charger with regular and Emark typeC
  cable. Verified that port 0 is in SNK_READY state.

- use 'pd dualrole sink' and test with Type C -> A adatper. Verified
  that tcpc wakes up, but goes into standby mode until entering 'pd
  dualrole on'.

- When sink only adapter is connected in S3/G3, measure power level
  ~1.2 mW as opposed to ~10 mW in S0.

- Repeated similar tests on port 1 (parade tcpc) to verify that
  adapters connected as expected.

Change-Id: Ib8de666f72723934186fee7869f9dda01381c7a8
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/463991
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: S Wang <swang@analogix.corp-partner.google.com>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-04-11 20:22:34 -07:00
Scott
154c16ac18 tcpm: anx74xx: Take ANX3429 out of suspend state before I2C access
The cable_det signal is used to signal to the EC that the tcpc has
detected a cable being connected when low power mode is
configured. The driver then needs to take the tcpc out of suspend
state by setting PWR_EN and RESET_N high. Then bit 7 of analog_ctrl_0
needs to be set properly.

The code that is handling this transition was attempting to access the
tcpc via I2C before putting the chip in normal mode when
transitioning from suspend to normal. In addition there are issues
with calling the driver function directly from the hook task (in the
delayed ISR handler) and from the USB PD task.

This CL changes the delay ISR handler to only set the TCPC_RESET
indication so that the call to put the ANX3429 into normal from
standby to normal mode only happens in the USB PD task. The TCPC_RESET
event is only set if cable_det is high, but reset_n (to the ANX3429)
is low which indicates that the ANX3429 is currently in standby mode.

BUG=b:35775019
BRANCH=reef
TEST=Manual
Tested with various adapters in both S0 and S3/G3 chipset
states. Verified that adapters connected as expected. When in S3/G3
connecting a sink only adapter still causes an indefinite toggle, but
all calls into the driver are executed from within the USB PD 0 task
and all ANX3429 I2C accesses work as expected.

Change-Id: I6e4843e43f59afbf5ca3251feb68981b815c1c78
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/457103
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-04-11 20:22:33 -07:00
Daisuke Nojiri
32d670a054 bd9995x: Disable IADP
This patch disables IADP immediately after the EC boots. We
observed noise on IADP/RESET pin causing SEL_ILIM_VAL to
randomly change. This seems the cause of b:35648317.

We enabled IADP to fix b:35647661 initially and also followed
the vendor's recommendation. However, the issue is only
reproducible on the particular board which was used for power
measurement and we did not see the issue on other boards with
IADP disabled.

Also the vendor assumed our EC doesn't control IBUS_LIM_SET
and ICC_LIM_SET. (I think they assumed like other thier customers
our EC controls ILIM by DAC connected to IADP/RESET pin.) If ILIM
is not set by EC and IADP is disabled, the system would brownout
because ILIM stays at 128mA. Therefore, it was (mistakenly)
recommended that our EC should keep IADP enabled.

Cros EC configures IBUS_LIM_SET and ICC_LIM_SET dynamically thus
the above concern does not apply.

We also found that we have too much noise on IADP/RESET pin. The
noise is not big enough to cause the chip to reset but it's big
enough to cause ILIM to fall in 128mA zone. We think this is why
the boards fail to boot from battery cutoff or no battery.
(Contrary to the vendor's explanation, it seems IADP/RESET pin
continusouly affects ILIM not only in the early chip power-up
period.)

BUG=b:35648317
BRANCH=none
TEST=Booted two Electro and two Snappy from 1) dead battery 2) no
battery 3) battery cutoff.

Change-Id: Ic675f1354b9ef222ceec8ce112b19713812d2752
Reviewed-on: https://chromium-review.googlesource.com/458676
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-03-23 19:03:57 -07:00
Daisuke Nojiri
1851495eb2 tcpm: Call usb_mux board_init on exit from low power mode
PS8751 does not restore all register contents when resuming
from low power mode. This change makes tcpm call board_init
when it stops auto-toggling so that register contents can be
restored.

BUG=b:35585399
BRACH=none
TEST=On Snappy, the board_init funciton is called every time a device
is plugged in and register contents are restored.

Change-Id: I50c51334f43c02e3c4d8453e1e966bf6eb3ce769
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/454139
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-03-16 18:06:59 -07:00
Vincent Palatin
39b605e9f2 Add minimal fpc1140 driver
Add a basic driver for FPC1140 sensor similar to the kernel fpc1020
driver.

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

BRANCH=none
BUG=b:35648259
TEST=on Eve, run the FP sensor 'int_test' with the FP MCU pass-through.

Change-Id: Ib042b890b5848f66cf6ab9284fd26e7b641f68c1
Reviewed-on: https://chromium-review.googlesource.com/454700
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2017-03-16 04:17:32 -07:00
Vijay Hiremath
c5c5a57f90 BD9995X: Do not overwrite the charging current in idle mode
If the charging current is less than the BD9995X's minimum charging current
it is overwritten to BD9995X's minimum charging current. However in idle
mode we write the charging current which is known to the charger during
that time, which can be less than the BD9995X's charging current. Hence,
do not overwrite the charging current in idle mode.

BUG=b:35984679
BRANCH=none
TEST=Manually tested on Electro. In idle mode charge current is 0mA.

Change-Id: I2e605b63c8519383c6a62d76718bc52660e7270e
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/453999
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-03-16 00:11:48 -07:00
Scott
d3cc4835bb tcpm: anx74xx: Only connect aux to sbu when DP mode is selected
The anx74xx tcpm driver for the usb_mux_set() function is always
connecting the DP aux lines to the SBU signals regardless of whether
the bit flag MUX_DP_ENABLED was set or not. For CCD opertation the sbu
lines are used to establish a USB connection to H1. This means that if
a PD port ever attaches to a sink debug accessory, usb_mux_set would
result in interrupting the USB connection being used for CCD.

In addition, the anx74xx_tcpm_mux_exit() function had a bug where the
value read from ANALOG_CTRL_5 was being masked by 0x09 and then
written to ANALOG_CTRL_2.

Added functions anx74xx_tcpm_mux_enter_safe_mode() and
anx74xx_tcpm_mux_exit_safe_mode() so that writes to the 3 CTRL
registers that are used to configure ALT_DP mode can be easily
bookended.

BUG=b:36007652
BRANCH=reef
TEST=Connected servo_v4 to port 0 of electro, verified that H1 console
access worked. Then initiated a data role swap so that port 0 on
electro was in DFP mode and the H1 console stayed connected.

- Tested with dingdong that could connect to a 4k monitor.
- Tested with USB3 flash drive.
- Tested Anker USBC -> USBA hub

Change-Id: I2d045134fbdd21b6b492bbeabc85ab23aef73b9a
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/451837
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: S Wang <swang@analogix.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-03-16 00:11:43 -07:00
Yidi Lin
1d8fcd4fab driver: kionix: Add checking whoami value at initialization.
spi_transaction() always returns success even without the sensor.
Check whoami value to make sure that the sensor is existed.

BUG=none
BRANCH=none
TEST=remove LID accel sensor from elm and see init failed log.
[1.258973 Lid Accel: 1: init failed: 4]

Change-Id: I55aa35bc9790e5dec61e22aa2f51243e29368a86
Signed-off-by: Yidi Lin <yidi.lin@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/453579
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2017-03-13 22:40:00 -07:00
Daisuke Nojiri
584cd06c9c bd9995x: Do not set IADP monitoring enable bit
IADP monitoring bit was set to the default value for the devices
with an RO image which clears the bit (and causes the issue).

This patch removes the code so that we do not touch the IADP
monitoring bit since transitioning from 0->1 may cause other issues.

BUG=b:35647661
BRANCH=reef
TEST=none

Change-Id: I4413e0bd2de3f4e3912cbe6e73b8cad641ee9245
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/453400
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/453798
2017-03-13 17:54:00 -07:00
Ryan Zhang
00d7f4ab9d Electro: DP CTS testing failed in HBR2 deterministic Jitter
Uploading CL according EE's requirement.
Need to overwrite PS8751 Address: 0x16, offset: 0xD3, Data: 0x98

BUG=b:36044164
BRANCH=firmware-reef-9042.B
TEST=`make -j BOARD=reef`

Change-Id: I60d5c6724fd047770ddd0af1d204571d59c6e25e
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/451047
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
(cherry picked from commit 1c39223ff9f970be69a62cbf4302fa3aa8f57647)
Reviewed-on: https://chromium-review.googlesource.com/452647
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-03-10 13:05:16 -08:00
Nicolas Boichat
2b22a4b25f driver/touchpad_elan: Use slightly more precise pressure adjustment
Matches the pressure multiplier used with elan trackpad on Chrome OS
(3.1416). We do fixed point arithmetic to avoid the need for
floating point or non-power of 2 division.

BRANCH=none
BUG=chrome-os-partner:59083
TEST=make BOARD=hammer -j && util/flash_ec --board=hammer

Change-Id: Ic3daad2645839955734eb7cbd9a60bbdf2520ce8
Reviewed-on: https://chromium-review.googlesource.com/450994
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-03-08 11:27:43 -08:00
Vincent Palatin
c21ad5898e anx74xx: fix role bits for GOOD_CRC
There were 2 mistakes when setting the data/power roles for automatic
GOOD_CRC:
- the bit numbers for data role and power role were swapped.
- the function can only set and not reset the bits.

Try to simplify this code by:
- removing the duplicated name for register 0x9C (aka AUTO_GOODCRC_1)
- avoiding the multiple read/modify/write by using AUTO_GOODCRC_1 for
  the actual settings (and letting the enable bit always on)
  and GOOD_CRC_2 for enabling/disabling it, so we can do simple writes.
- answer only on SOP (not SOP' or SOP'').

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

BRANCH=reef
BUG=b:35648282
TEST=On Snappy, connect a given power supply, record the USB PD traces
and see that the GOOD_CRC messages are still correct after the DR_SWAP.

Change-Id: I848b1dcbc0e06806649e64a9664f3fba21bdd448
Reviewed-on: https://chromium-review.googlesource.com/448040
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: S Wang <swang@analogix.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-03-08 03:13:20 -08:00
Scott
a990e4e832 pd: Add tcpc_select_rp_value to stub tcpm driver
The function tcpm_select_rp_value() is used to set a given Rp
value. This function was not supported for boards that use the config
option CONFIG_USB_PD_TCPC. This CL adds a weak board_ function which
can be overloaded for boards that have the requirement to set Rp to
different values.

BUG=chrome-os-partner:61878
BRANCH=servo
TEST=run 'make buildall'. On plankton added a console command to trigger
a call to tcpm_select_rp_value(0, 0), verified that it returned
2 (EC_ERROR_NOT_IMPLEMENTED). Then added board_select_rp_value() to
plankton's board.c and verified that it returned 0.

Change-Id: I1cd6f0ed51717736d30575c58025bd9a1c5d6fc4
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/446685
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-03-02 11:29:06 -08:00
Gwendal Grignou
9af60bb795 driver: kionix: Forgive i2c read failures while the acc is resetting
Port changes cl/288874 to generic kionix driver.

From cl/288874:

After we write SRST in CTRL2, there seems to be a period of time where the
accelerometer doesn't respond to i2c commmands. Instead of failing the init
just consider it as part of the timeout period.

BUG=chrome-os-partner:39269,chrome-os-partner:63146
TEST=make -j buildall
BRANCH=veyron,cave

Reviewed-on: https://chromium-review.googlesource.com/445973
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 4a34b0d88f6b0075ee66a18f4aa22325dc766eb6)
Change-Id: I2197aa7741d1482b76c7c07b0cb0c171aab86a59
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/446417
2017-03-01 11:19:35 -08:00
Gwendal Grignou
eb85cc2101 driver: kionix: Increase init delay to 20ms
Port changes cl/289037 to generic kionix driver.

Form cl/289037

Sometimes the accelerometer doesn't initialize nicely.
Increase the timeout to 20ms.

BUG=chrome-os-partner:39269,chrome-os-partner:63146
TEST=buildall
BRANCH=veyron,cave

Change-Id: I4e4d8951fc821b8b33daa53e6c3b8da5ffa7acde
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/446132
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 11c00e1a4116bb0ac387c0264053e66e41a5ec92)
Reviewed-on: https://chromium-review.googlesource.com/446699
2017-03-01 11:19:35 -08:00
Scott
8cef7bab3b driver: Add polling mode support to Si114x ALS sensor
Eve P1 is missing the ALS_INT_L signal and so needs to poll the
Si114x. This CL adds a new config option CONFIG_ALS_SI114X_POLLING
that when defined uses a deferred callback to trigger the motion
sensor event that reads sensor registers. The deferred callback uses a
8 msec delay which is ~2x longer than the time required by the sensor
to complete the measurement.

BUG=chrome-os-partner:61470
BRANCH=none
TEST=On Eve verify that light sensor measurments are present with the
'accelinfo on 1000' command.

Change-Id: I212bebf2ceacbac87ccb0734cc4990dbc349b028
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/440377
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2017-02-20 14:28:02 -08:00
Nicolas Boichat
887298ba50 anx74xx: Restore behaviour if CONFIG_USB_PD_TCPC_LOW_POWER is unset
Commit 18327455c1 ("ANX74xx: add TCPC low power mode for different
DRP state") introduced new code to put ANX74xx in low power mode.
However, this broke existing boards that do not enable
CONFIG_USB_PD_TCPC_LOW_POWER (and therefore do not implement cable
detection interrupt).

BUG=chrome-os-partner:59841, chrome-os-partner:61640
BUG=chrome-os-partner:62964
BRANCH=none
TEST=on poppy, connect USB-A keyboard to ANX port via A-C adapter:
     keyboard works

Change-Id: I4b66511b816afee402a7e769aa6d2c323724d071
Reviewed-on: https://chromium-review.googlesource.com/443865
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-02-17 04:09:37 -08:00
Gwendal Grignou
484ef12119 motion: Add opt3001 as a motion sensor
Use the motion sensor to manage ALS as well.
The current interface (via memmap) is preserved, but
we can also access the sensor via cros ec sensor stack and
send the ALS information to ARC++.

BUG=chrome-os-partner:59423
BRANCH=reef
CQ-DEPEND=CL:424217
TEST=Check the sensor is working via ACPI sensor and
cros ec sensor. Check ARC++ sees the sensors.

Change-Id: Iaf608370454ad582691b72b471ea87b511863a78
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424323
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-02-16 18:03:59 -08:00
Daisuke Nojiri
4d6eb1bc01 pdchipinfo: Add option to force renewal
This change adds an option to pdchipinfo command to force ec to get
the version from the chip instead of the cache (if it's available).

This option will be used after firmware update, which makes the cache
value stale.

BUG=chrome-os-partner:62383
BRANCH=none
TEST=Run ectool as follows:
localhost ~ # /tmp/ectool pdchipinfo 0 on
vendor_id: 0xaaaa
product_id: 0x3429
device_id: 0xad
fw_version: 0x15
localhost ~ # /tmp/ectool pdchipinfo 1 on
EC result 2 (ERROR)

Change-Id: Icefe96d7fc1208b991a4caa13aaf4f04052edba7
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/441271
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-02-14 17:28:16 -08:00
Daisuke Nojiri
c9ea4bddbc pdchipinfo: Increase compatibility of fw_version
The firmware version formats may vary chip to chip. fw_version field is
changed to a union of a 8 byte string and an 64-bit integer.

BUG=chrome-os-partner:62383
BRANCH=none
TEST=ectool pdchipinfo 0/1 on Electro

Change-Id: Id51e66c44338a09ed897ee61f54cd6a394400e63
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/441270
2017-02-14 17:28:15 -08:00
Gwendal Grignou
d910997f6a lis2dh: code cleanup
Make FIFO a stack variable to save static memory,
Remove auto_inc argument, always set
Remove constant for rate 0.
Force board to declare sensor private data.
Avoid name collision in stm_mems_common
Include stm_mems_common.h in accel_lis2dh.h, caller only need to
include accel_lis2dh.h.

BUG=none
BRANCH=none
TEST=Compile with discovery_stmems board.

Change-Id: Id52b54dd4ec3cf217247c5511ad5a506067ad293
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/441144
Tested-by: mario tesi <mario.tesi@st.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: mario tesi <mario.tesi@st.com>
2017-02-13 21:15:16 -08:00
Kevin K Wong
18327455c1 ANX74xx: add TCPC low power mode for different DRP state
Added code to put the ANX74xx in low power mode for different DRP state.
1. When nothing attached or system is in S3 or S5 disable the auto
   toggling and put ANX74xx system in Analog control mode.
2. Using the CABLE_DET interrupt pin (attach event) enable normal power
   mode.

BUG=chrome-os-partner:59841, chrome-os-partner:61640
BRANCH=None
TEST=Manually tested on Reef using below dut-control command
     dut-control pp3300_pd_a_mw -r <n>
     1. S0, S3, S5 - Nothing connected, ANX in low power mode.
     2. In S0 SNK (display/USB dongle, eMark cable) connected & put
	system to S3, ANX remains in normal mode.
     3. In S0 SNK connected & put system to S5, ANX in low power** mode.
     4. In S0 nothing connected, put system to S3 or S5, attach
        SNK, ANX in low power** mode.
     5. Attach SNK at S3/S5 & boot to S0, ANX in normal mode.
     6. SRC (AC adapter) with/without eMark cable are detected in
	S0, S3, S5, and continue to charge the system after S-state
	transition.

low power**: ANX74xx hardware limitation that Ra/Open (Ex: E-Mark cable
only) detection will trigger CABLE_DET continuously, therefore ANX74xx
will go to normal power mode momentarily and then low power mode in a
loop.

Change-Id: I30f7fd7a85e31987fb77e2cab2fe140d59dd3629
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/415580
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-02-11 13:06:39 -08:00
Shawn Nematbakhsh
eb2e38ec56 console: Add non-verbose print config option
Shorten certain long prints and reduce the precision of timestamp prints
when CONFIG_CONSOLE_VERBOSE is undef'd.

BUG=chromium:688743
BRANCH=gru
TEST=On kevin, cold reset the EC, boot to OS, and verify cros_ec.log
contains all data since sysjump and is < 2K bytes (~1500 bytes).

Change-Id: Ia9390867788d0ab3087f827b0296107b4e9d4bca
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/438932
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-02-11 13:06:38 -08:00
Daisuke Nojiri
4ff544a573 Add host command to get PD chip information
This patch adds a host command to get PD chip info.

For PS8751, tcpci_get_chip_info will fail if the chip is in
low power mode. It can be woken up by reading a random register
first then wait for 10ms.

This code doesn't have the wake-up read to avoid 10ms delay.
Instead, we call this function immediately after the chip is
initialized because it'll gurantee the chip is awake.

Once it's called, the chip info will be stored in cache, which
can be accessed by tcpc_get_chip_info without worrying about
chip states.

localhost ~ # ectool pdchipinfo 0
vendor_id: 0xaaaa
product_id: 0x3429
device_id: 0xad
fw_version: 0x15

localhost ~ # ectool pdchipinfo 1
vendor_id: 0x1da0
product_id: 0x8751
device_id: 0x1
fw_version: 0x37

BUG=chrome-os-partner:62383
BRANCH=none
TEST=ectool pdchipinfo 0/1. make buildall

Change-Id: I3f1667d00ce1826936d90882ada1df6ed6b0ea37
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/433166
2017-02-09 22:50:50 -08:00
Daisuke Nojiri
591eec2cd2 Snappy: Recondition USB3.0 RX
The loss between PS8751 and Type-C connector is large and requires
a larger EQ and low squelch threshold for compensation.

- USB Type-c connector facing receiver equalization setting:
	Compensate for channel loss up to 10.9dB
- High Speed Signal Detector threshold adjustment: -25%

BUG=chrome-os-partner:61101
BRANCH=none
TEST=Boot & charge

Change-Id: Ie74e2d0b8ad7206f5e60fb013613c382980c0eac
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/433846
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-02-09 12:47:41 -08:00
Mario Tesi
8db50ce410 driver: accel: Add acc driver basics and FIFO for LIS2DH/LIS2DH12
Add driver for acc sensor ST lis2dh/lis2dh12
    Support interrupt management for FIFO watermark
    Starting to share common code with other devices
    like lsm6dsm/lsm6dsl (acc/gyro) or new lis2mdl (mag)
    TODO: Add all embedded functions support (click,
    tap and so on)

    BUG=none
    BRANCH=master
    TEST=Tested on discovery BOARD with sensor connected on
    EC i2c master bus. Added motion sense task on discovery
    board task list, added gpio info in board configuration
    file and tested with motion sense console commands. Data
    for acc seems ok: can successfully change ODR and
    full scale range. Also FIFO and interrupt tested
    Device tested is lis2dh (lis2dh12 simply differs for low
    pin count but share the same registers)

Change-Id: I16abeac3f139a604094b38d8d8b857a62c93a242
Signed-off-by: Mario Tesi <mario.tesi@st.com>
Reviewed-on: https://chromium-review.googlesource.com/412700
Commit-Ready: mario tesi <mario.tesi@st.com>
Tested-by: mario tesi <mario.tesi@st.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2017-02-09 03:10:22 -08:00
Shawn Nematbakhsh
8e4bcd49c0 tcpm: it83xx: Add support for TYPEC_CC_OPEN
BUG=chrome-os-partner:62281
BRANCH=None
TEST=Verify compilation on it83xx w/ IT83XX_PD_EVB = 1.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Id82387e7d4782ed1a5e07f7968475988ff6da9d5
Reviewed-on: https://chromium-review.googlesource.com/434077
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-02-07 20:14:35 -08:00
Sam Hurst
edf46467b9 cleanup: Remove charge_state_v1
All boards have been transitioned to charge_state_v2.c
So charge_state_v1.c, HOOK_CHARGE_STATE_CHANGE, and
CONFIG_CHARGER_TIMEOUT_HOURS can be removed

BUG=chrome-os-partner:36272
TEST=make -j buildall
BRANCH=none

Change-Id: I3f20c5198ea75185f9894deb792575a1be31432a
Reviewed-on: https://chromium-review.googlesource.com/435467
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-02-06 14:50:32 -08:00
Shawn Nematbakhsh
f08109522d charge_ramp: Specify port number in board_is_vbus_too_low()
charge_ramp needs to make a decision based upon the VBUS level on one
specific port - the port that is ramping. The VBUS level on any other
charge ports (if present) is not relevant.

BUG=chrome-os-partner:54099
BRANCH=reef, gru
TEST=With subsequent patches, verify charge_ramp success with a variety
of BC1.2 chargers.

Change-Id: Ie0a51a577e2b7491222560cd08dd5321ff3b7975
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/435561
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-02-02 19:09:52 -08:00
Vijay Hiremath
2726191393 BD9995X: Set VSYSREG_SET register as per Charger State Machine
Setting the VSYSREG_SET register as per Charge State Machine of
the BD9995X datasheet.
1. Set VSYSREG_SET <= VBAT so that the charger is in Fast-Charge
   state when charging.
2. Set VSYSREG_SET > VBAT so that the charger is in Pre-Charge
   state when not charging or discharging.

BUG=chrome-os-partner:55220
BRANCH=none
TEST=Manually tested on Reef. Observed 'Charger State Machine Status'
     register value when charging it is in Fast-Charge state and
     when not charging/discharging it is in Pre-Charge state.

Change-Id: I5cd5afa92384acb4fd9d69128a2a03ae6992dc5b
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/430880
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-02-01 18:24:34 -08:00
Wonjoon Lee
ef976e6387 bd9995x: more delay time between chg_en and vsys_set
The nvdc voltage has a kind of deep, so that rarely observed
NVDC down at this point because of back-boosting.
Our sequence to enable charger bit and setting vsysreg
is correct but rohm introduce charger may need some more time
to be stable when between chg_en and vsys_set to start charge

BUG=chrome-os-partner:60380
BRANCH=gru
TEST=Manual on kevin, trigger battery disconnect, re-attach AC, verify
system boots cleanly. and see voltage probing on c54@60380

Change-Id: Ic05091379322ffaac16fe827a47345c76c85f3e5
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/434252
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-01-28 01:52:15 -08:00
Scott
58e18da39f servo_v4: pd: Added Device Test System support
- Modified src attach state to enable vbus when debug accessory is
detected.

- servo_v4 has two pd ports, but each port requires a different default
power role. Port 0 can only ever be a SNK, but port 1 which acts is
intended to be a DTS port should default to a SRC so it can be be a
source debug accessory. It may also act as a sink debug accessory, but
is not intended to toggle automatically but will swap roles if
necessary via pd role swap messaging.

- Add hook for ccd enable/disable for DTS mode

BUG=chrome-os-partner:61878
BRANCH=servo
TEST=Manual Verfied that can still build servo_v4 project. All changes
in this CL are contingent on config option CONFIG_USB_PD_DTS being enabled.

Change-Id: Iab968b6fbdfc8f2d155c4f8618921b32f313b9ec
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/428308
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-01-26 23:16:40 -08:00
Daisuke Nojiri
7a4eac1bed Reef: Reduce max battery charge voltage for 0.5% margin
(From CL 431233)

Limit battery charge voltage to prevent battery over-charge, due to
regulation inaccuracy. Since RO FW may charge > 8656 mV, ensure the
battery is not full before charging.

BUG=chrome-os-partner:61906
BRANCH=none
TEST=Manual on Electro, sysjump with battery @ 99%, verify battery
discharges, then re-charges to 100%, before discharging once again.

Change-Id: I28212c83057a442fd75e39f8ad51927a7a1f2817
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/432857
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-01-25 22:12:30 -08:00