Commit Graph

356 Commits

Author SHA1 Message Date
Gwendal Grignou
09f90a3b8f kionix: Add reading whoami to be sure device has booted.
From the specs, "KX022-1020 Specifications Rev4.0", the power up time
can be as long as 10ms.
Add a loop to be sure the device is responsive before initalizing it.

BRANCH=reef,glados,oak,veyron,cyan
BUG=none
TEST=After putting a KX022 accel as first in the list, it would not
initialize properly. After adding the loop, it initializes properly.

Change-Id: I3194a5d1deb0c2eb2a04a459aab3b4269e479af3
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/394750
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-10-08 18:34:36 -07:00
Gwendal Grignou
f11271c8ee driver: bmi160: Fix logic issue when accelerometer is not first sensor
BMI160 driver assumes accel, gyro, compass are next to each other.
It was also assuming accel was sensor 0, which is wrong.

BUG=none
BRANCH=glados
TEST=On Cave, check sensors 1 (accel) and 2 (gyro) are working properly.

Change-Id: I37402e1d48070caaecbd7e32bbf53754616ee8cb
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/394067
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-10-07 21:51:24 -07:00
Gwendal Grignou
0ea4603143 driver: bmi160: Add config variable for INT2 setting
BMI INT2 can be input or output.
It is not used currently, but configure it properly nevertheless.

BUG=none
BRANCH=none
TEST=On cave, (int2 is output), ensure FIFO headers are free of
interrupt information.

Change-Id: I9c058689a8676593aad542e33601cc11da105838
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/394066
2016-10-07 21:51:22 -07:00
Sam Hurst
ece9996136 ec: Remove fusb302 rev.A support
We're using fusb302 rev. >= B now, so let's remove rev. A support.

BUG=chrome-os-partner:57492
BRANCH=none
TEST=Manuel
- plug USBC->DP cable into TV then into kevin
localhost ~ # ectool usbpdmuxinfo
Port 0: DP INV

- plug USBC->DP cable into kevin then into TV
localhost ~ # ectool usbpdmuxinfo
Port 0: DP INV

- unplug USBC->DP cable from TV
Port 0: OPEN INV

- plug USBC->ETHERNET into kevin and verified that network
displayed ethernet

Change-Id: Ia84dc2480c1a8b003ab8dfdcdaa9f82f6d429e4b
Reviewed-on: https://chromium-review.googlesource.com/388925
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-29 19:14:52 -07:00
Shawn Nematbakhsh
7f70ae4585 charger: bd9995x: Reset map command set on failed set operation
If BD9995X_CMD_MAP_SET fails, the charger's internal map command set
may be the old set (if the charger failed to process the command) or the
new set (if the EC failed to receive the response). Therefore, reset the
EC's known map command state on failure, so that it will always be
re-set on the next transaction.

BUG=None
TEST=Build + boot kevin.
BRANCH=Kevin

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Id16273ccf2e39b5aae7776d626aae8863e713df5
Reviewed-on: https://chromium-review.googlesource.com/390318
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-09-28 22:09:27 -07:00
philipchen
98541217df bd9995x: Disable fast/pre-charging watchdog timer
BUG=chrome-os-partner:55771
BRANCH=none
TEST=make -j buildall
TEST=bd9995x r 0x0f 1; verify 0x00.

Change-Id: Ibfca44599b8a6d631215b2c9a50e810312559f3a
Reviewed-on: https://chromium-review.googlesource.com/388819
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-26 22:16:51 -07:00
Shaoliang Wang
e29005abe7 anx74xx: fix hard reset issue.
1.ANX3429 have CC Rx buffer, when the partner sent one message,ANX3429
received this message into Rx buffer and triggered an interrupt to
inform (TCPM), at this moment Reef sends a CC message before reading
CC Rx buffer. After Reef sends this CC message successfully, it receives
the message the partner sent. So (TCPM) sees an unexpected message was
received, that`s why sends out hard reset.

Root cause:
ANX3429 use a normal R/W register as a interrupt status register.
Between EC read interrupt status and clear interrupt status, if
ANX3429 change interrupt status, it causes interrupt status is
incorrect on EC side.
Solution:
ANX3429 FW use two normal R/W registers for interrupt status reg,
one is for FW interrupt status,other is for EC control register.
Note:
Since cc messages conflict between TCPM and the Partner,ANX3429
shall discard the TCPM message, (TCPM) sometimes send soft reset
depend on the discarded message type.

2. Sometimes TCPM (Reef) does not response GoodCRC for a received mesg.

Root Cause: Reef send message conflict with ANX3429 send auto GoodCRC.
Solution: This is fixed in the 1.5 ANX 3429 firmware.

BUG=chrome-os-partner:53936
BRANCH=none
TEST=On Reef tested with ANX3429 FW v1.5, did not see HARD RST on
ec log with Zinger.

Change-Id: I81da95433e7a0cc71e7ed121b925afccbcd84b06
Signed-off-by: Swang <swang@analogixsemi.com>
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/381014
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-24 13:53:28 -07:00
Shawn Nematbakhsh
a87663f6dc tcpm: anx74xx: Initialize regs for proper CC cye diagram
BUG=chrome-os-partner:56788
BRANCH=None
TEST=Verify CC eye diagram looks better.

Change-Id: I4880e81b0a4737a303027513e77c9a66845472e2
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/380352
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-23 21:09:29 -07:00
Vijay Hiremath
f9272713da i2c: Add i2ctest console command
Added i2ctest console command to test the reliability of the I2C.
By reading/writing to the known registers this tests provides the
number of successful read and writes.

BUG=chrome-os-partner:57487
TEST=Enabled the i2ctest config on Reef and tested the
     i2c read/writes.
BRANCH=none

Change-Id: I9e27ff96f2b85422933bc590d112a083990e2dfb
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/290427
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>
2016-09-23 15:10:08 -07:00
Victor Prupis
62bb88c730 pi2usb9281: Prevent race condition in RMW control register
Added unlocked versions of register access,
modified RMW functions to use unlocked versions
and made them locked themselves.

BRANCH=master
BUG=chrome-os-partner:49182
TEST=DUT boots successfully

Change-Id: Ifd16abc349cc731aeed78b12989595214e65cea2
Signed-off-by: Victor Prupis <vprupis@google.com>
Reviewed-on: https://chromium-review.googlesource.com/377151
Commit-Ready: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-23 12:22:13 -07:00
Kevin K Wong
19e35f3c3e anx74xx: remove pd role control from init code
BUG=chrome-os-partner:54332
BRANCH=none
TEST=verify only zinger is detected in sink mode (G3/S5), and both
zinger and hoho is detected in dual role mode (S0).

Change-Id: Ifce0009908acc4b1849723ce807ca1b4c8e26020
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/387260
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-23 12:22:05 -07:00
Vijay Hiremath
420b423096 BD9995X: Rename common code of BD99955 and BD99956 as BD9995X
Except the CHIP_ID and charger name code is common between BD99955
and BD99956. Hence renamed the code to BD9995X so that valid
output is printed from console commands.

BUG=chrome-os-partner:57519
BRANCH=none
TEST=Manually tested on Reef. 'charger' console command prints
     charger name as 'bd99956'

Change-Id: I3c995757941bcc5a6a8026dd807d76a7a47c9911
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/387119
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>
2016-09-21 19:38:13 -07:00
Vijay Hiremath
54187e7b9b ALS: OPT3001: Return appropriate error value
Return appropriate error value for I2C errors and data verification
errors.

BUG=chrome-os-partner:57512
BRANCH=none
TEST=Manually tested on Reef, ALS data changes when surrounding
     brightness is changed.

Change-Id: I17b5bd10da5fa5cc82fdff10337ae893146c70ee
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/386397
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-21 19:37:34 -07:00
Divya Sasidharan
70bea45fa7 reef: Print tcpc firmware version
BUG=chrome-os-partner:56866
BRANCH=master
TEST=prints firmware version at boot up;make buildall -j

Change-Id: Idb067186924e6706ccfc69a64f2febd61f396074
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/380317
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-21 19:37:32 -07:00
Tang Zhentian1
0fbbafc151 tcpm: anx74xx: fix wrong clear CABLE_DET bit in 0x50:43 register.
BUG=None
TEST=Verify cable detect is correct.
BRANCH=None

Change-Id: I6eb7c6cd979120835f89bbb68116ddbc03813f3b
Signed-off-by: Tang Zhentian1 <ztang@analogixsemi.com>
Reviewed-on: https://chromium-review.googlesource.com/382868
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-21 19:37:19 -07:00
Shawn Nematbakhsh
cca986c9b4 charger: bd99955: Adjust charger params at init
- Use 1200KHz DCDC clock.
- Set reverse current threshold to -50mV.
- Set internal gain to 2x.

BUG=chrome-os-partner:57118,chrome-os-partner:56255
TEST=Manual on kevin and reef, verify charging w/ zinger.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ib7188764206743543fb873f303acb7b62977dc3d
Reviewed-on: https://chromium-review.googlesource.com/382451
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-09-16 21:59:31 -07:00
Vijay Hiremath
258bc48bac BD99955: Support Pull-up port non-standard BC1.2 chargers
Some chargers with valid VBUS advertise as Pull-up ports. Hence,
added code to support these kind of chargers as non-standard
BC1.2 chargers.

BUG=chrome-os-partner:57163
BRANCH=none
TEST=Manually tested on reef. Used a Pull-up port non-standard
     BC1.2 charger and observed it can ramp to its maximum
     current ratings.

Change-Id: I33c4c3a64e9c7176c909a48f6fbc49e04d529541
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/385239
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Rachel Nancollas <rachelsn@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-16 19:56:53 -07:00
Gwendal Grignou
f48b781dea driver: bmp280: set_data_rate rate in mHz.
The argument is mHz not ms.

BUG=chrome-os-partner:57117,b:27849483
BRANCH=reef
TEST=Using frequency sysfs parameter check the returned value is close
to the requested value. It will be greater than the requested frequency.
It maxes out at 76Hz when frequency is greater than 13.5Hz.
Check Androsensor reports pressure.

Change-Id: Ie40ac0f0a83d1578b5b66097d85a9124ec8e4c54
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/385083
Reviewed-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-09-15 16:16:10 -07:00
Shaoliang Wang
5dd80cf583 anx74xx: fix Rp control
BUG=chrome-os-partner:56933
BRANCH=none
TEST=none

Change-Id: Ic5fae940a48467f3d46f2515eba7642cf5963239
Signed-off-by: Swang <swang@analogixsemi.com>
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/381773
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-09-15 05:24:05 -07:00
Vincent Palatin
820d36af3d bd99955: enable power-save mode only when we have no USB data
When we source VBUS, the BD99955 does not disable its power saving mode
and messes up our USB2.0 data connection (DP/DN).
Let's disable the BD99955 power-save mode whenever a USB data connection
is present on one of the ports.
For configurations without power saving enabled, let's still write the
power-save mode register to ensure it is in the proper (disabled) state
whatever happened before (bad RW ...)

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

BRANCH=gru
BUG=chrome-os-partner:57310
TEST=On Kevin, connect a USB-Ethernet dongle and see it enumerating
properly (while BD99955 power-save mode is enabled).

Change-Id: I379f94ecd294f045f353bd50eafd2035636837b1
Reviewed-on: https://chromium-review.googlesource.com/384851
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-15 02:50:06 -07:00
Kevin K Wong
ab967a1c77 tcpc: Enable vbus discharge using PD discharge registers
BUG=chrome-os-partner:56040
BRANCH=none
TEST=Manually tested on Reef.
     Used scope to monitor VBUS & it dropped to 0.8V within 650ms.

Change-Id: Icaea1dc11a7342a5cc1493d6d3c2ec3408d6d37b
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/367482
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>
2016-09-13 22:21:33 -07:00
Shawn Nematbakhsh
9229c795b0 charger: bd99955: Enable VBUS discharge when appropriate
Use a custom VBUS threshold of 3.9V for enable / disable of our VBUS
discharge circuit.

BUG=chrome-os-partner:55584
BRANCH=None
TEST=Plug Apple charge-thru accessory into kevin, plug zinger into
accessory, verify charging occurs at PD-negotiated current / voltage.

Change-Id: I25f6f68cfe55e8bae2071cda39618b2bfadcb355
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/379475
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-09-13 22:21:31 -07:00
Rocky Hsiao
d8166a8d65 driver: add support ambient light sensor AL3010
AL3010 is Dyna-Image ambient light sensor.
Here is add basic driver and functions.

BUG=chrome-os-partner:52915
BRANCH=elm
TEST=Flash on base board "glados" with ASUS
al3010_init is return success.
al3010_read_lux is return the lux success.

Change-Id: Ie3b97d0889b150c43d19bc84d84f04c13e415c31
Signed-off-by: Rocky Hsiao <rocky.hsiao@dyna-image.com>
Reviewed-on: https://chromium-review.googlesource.com/356874
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Thomas Lin <thomas.lin@dyna-image.com>
2016-09-13 01:10:47 -07:00
Tang Zhentian1
b275061eec anx74xx: get F/W version register and comments
reading F/W version by register 0x50:44

BUG=chrome-os-partner:56866
BRANCH=none
TEST=make buildall -j; > Tested on Reef->
i2cxfer r 0 0x50 0x44 shows correct fw version.

Change-Id: Ic4dce273e95a545d0b90162ee4851a06c277e680
Signed-off-by: Tang Zhentian1 <ztang@analogixsemi.com>
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/382858
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-12 22:11:49 -07:00
Aseda Aboagye
491627741a bd99955: Add support for power save mode.
The BD99956 charger has a power save mode that it can enter once VBUS or
VCC is removed.  This commit adds an optional config option that can be
used to select the power save mode:

  CONFIG_BD99955_POWER_SAVE_MODE

By default, no power save mode will be enabled.  However, a board can
device what level of power savings they wish to use.

The levels are the following:

BD99955_PWR_SAVE_LOW /* BGATE ON w/ PROCHOT# monitored only system
                      * voltage. */

BD99955_PWR_SAVE_MED /* BGATE ON w/ PROCHOT# monitored only system
                      * voltage every 1ms. */

BD99955_PWR_SAVE_HIGH /* BGATE ON w/o PROCHOT# monitoring. */

BD99955_PWR_SAVE_MAX  /* BGATE OFF */

BUG=chrome-os-partner:55631
BRANCH=kevin
TEST=make -j buildall

Change-Id: Ibab7ad30d5f1ae9917b46b40d6f2800ef19e52dd
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/382877
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-09 14:42:23 -07:00
Gwendal Grignou
60fc54854c driver: bmp280: Add range
Data from the sensor (in Pa) does not fit in 16 bits.
Add set_range/get_range to allow the AP to set the precision.
For pressure around ~1000 hPa, we need to right shift by 2 bits.

BUG=chrome-os-partner:57117
BRANCH=reef
TEST=Check data is not truncated anymore:
> accelrange 4
Range for sensor 4: 262144    (Pa ~= 2621 hPa)
> accelread 4
Current data 4: 24030 0     0
Last calib. data 4: 24030 0     0 (x4 = 961.2 hPa)

Change-Id: I3f7280336e5120d903116612c9c830f4150d2ed7
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/382323
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-09-09 00:04:28 -07:00
Gwendal Grignou
3798d8e8cc driver: kionix: Add set_value
Put the common code for set_[data_rate|range|resolution] in the same
function

BUG=b:27849483
TEST=tested on Cyan, save 128 bytes on minnie.
BRANCH=none

(cherry picked from commit 79c74a2a662cdc6d9ea0d8729ca4fb1d641400e5)
Reviewed-on: https://chromium-review.googlesource.com/379099
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Change-Id: Ie66f64a478ad73c2a46129a664f2a6c60c5157bc
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/379544
2016-09-07 21:32:37 -07:00
Vijay Hiremath
3392ad70d0 Driver: BD99955: Enable trickle charging
Enabled the trickle charging mode by setting the VPRECHG_TH_SET
register[0x18H] to board specific battery voltage minimum value.
When the battery voltage drops below the battery voltage minimum
value, trickle charging is enabled.

BUG=chrome-os-partner:56684
BRANCH=none
TEST=Manually verified on Reef. Drained the battery below battery
     voltage minimum value. On plugging in the charger, State
     Machine Status register CHGSTM_STATUS [0x00h] is 0x01 which
     indicates, current state of the charger state-machine is in
     Trickle-Charge condition.

Change-Id: Ic4b985c71ff68ea4f5ab22e18feab03d776ec134
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/376939
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-06 22:03:21 -07:00
Shawn Nematbakhsh
5f9e39ceaf bd99955: usb_charger: Don't do BC1.2 detection on source ports
If we're sourcing 5V to the port, consider the port as not providing
power, for the purpose of VBUS / BC1.2 detection.

BUG=chrome-os-partner:55432
BRANCH=None
TEST=Manual on kevin, attach legacy peripheral in one port, zinger in
the other, run "reboot" on EC console, and verify zinger port is
selected as charge port. Also attach Apple charge-thru accessory w/o
charger plugged, verify that charge manager is not informed of a BC1.2 /
VBUS supplier.

Change-Id: Ifbe587215f28756760e7106e1a00dd96319438e3
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/380324
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: Vincent Palatin <vpalatin@chromium.org>
2016-09-05 19:26:35 -07:00
Dino Li
7f87c6aeae TCPM: it83xx: fix build error
Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=The "IT83XX_PD_EVB" is non-zero and "make BOARD=it83xx_evb -j"

Change-Id: Ie555370754f325fdf61d65c01533f4ca3897b25f
Reviewed-on: https://chromium-review.googlesource.com/381135
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-09-05 07:07:13 -07:00
Gwendal Grignou
fd25b97b27 driver: kionix: No need to set static field to NULL
Redundant, already set by the compiler.

BRANCH=none
BUG=none
TEST=compile.

(cherry picked from commit 895476044812a63f0f611d96e11437c49d73443a)
Reviewed-on: https://chromium-review.googlesource.com/379098
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Change-Id: I4d1c7263034c0cef1a6484a516edb3893c11945f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/379543
2016-09-02 04:24:26 -07:00
Gwendal Grignou
5a01bd89ba driver: kionix: Remove variant field.
Field is not required: sensor->chip already has that information.

BRANCH=veyron
BUG=none
TEST=compile

(cherry picked from commit 90fcd6be2b5d2104301efef295113d7816e14042)
Reviewed-on: https://chromium-review.googlesource.com/379096
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Change-Id: I6c0bc2e71d7c848968caa78c749dd3fb916f6263
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/379541
2016-09-01 22:55:41 -07:00
Vijay Hiremath
d684e2a678 Amenia/Reef: Add software charge ramp for BC1.2 & nonstandard BC1.2
Setting the higher limit of input current for BC1.2 & nonstandard
BC1.2 devices than their maximum current rating results in an
anti-collapse. BD99955 does not have a way to do hardware charge
ramp or to detect the anti-collapse for these chargers. Hence added
code to support software charge ramp for BC1.2 & nonstandard BC1.2
so that the input current is set to maximum of the respective
charger.

BUG=chrome-os-partner:54990, chrome-os-partner:55517
BRANCH=none
TEST=Manually tested on Amenia & Reef. BC1.2 & nonstandard BC12
     devices can negotiate their respective maximum current rating.

Change-Id: I0033b3662362bd7822ad01cf4360d18caabd5249
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/358106
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>
2016-08-29 17:12:39 -07:00
Vincent Palatin
e880402f74 pd: select dynamically Rp value
Add API to switch the Rp pull-up value on CC dynamically at runtime.
This is a preparatory work for boards having a more complex maximum
source current policy (eg 2 ports sharing a common pool of power).

For fusb302, update the voltage thresholds for open/Rd/Ra as they depend
on the Rp (was missing from the previous change).

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

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

Change-Id: Id3c24a31a16217075a398ec21ef58ee07187a882
Reviewed-on: https://chromium-review.googlesource.com/373501
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-25 07:32:31 -07:00
David Hendricks
78acb197a0 usb_mux: Correct an error print.
BUG=none
BRANCH=none
TEST=none

Change-Id: Ica208bf8d6f34c856073b06633560de08792976c
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/368590
Reviewed-by: Martin Roth <martinroth@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-24 17:40:52 -07:00
Sam Hurst
c5bd6d98b9 charger: Send host event after charge info is updated.
When the charger is detached, the host event would sometimes be
sent before the charge info was updated, resulting in the host
thinking that the charger was still connected.

BUG=chrome-os-partner:55584
BRANCH=none
TEST=Connected charger to kevin 15 times and verified that the
icon was removed in 2-seconds or less.
Change-Id: I1a4e4e0f7cc23010210570fc261da8308d8e8070
Reviewed-on: https://chromium-review.googlesource.com/367809
Commit-Ready: Wonjoon Lee <woojoo.lee@samsung.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-24 17:40:38 -07:00
Divya Sasidharan
1bebf37965 barometer: Add barometer driver for BMP280 in EC
BMP280 driver API is designed to work with motion
sensor task. The sensor sampling parameters are
configured optimally for handheld device in accordance
with BMP280 spec recommendation.

BUG=None
BRANCH=master
TEST=Tested on amenia; with appropriate .odr in board file
     test command "accelread 4" returns raw pressure
     value in Pa; accelinfo on 4000 shows Pa value.

Change-Id: I3f4c0c33a77dd317aa1425624d3cc7f4ec6b45a1
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/351660
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2016-08-24 17:40:34 -07:00
Gwendal Grignou
71c9cc6f3f driver: l3gd20h: remove unnecessary test.
rotate by identity matrix is fast.

BRANCH=none
BUG=none
TEST=compile

Change-Id: Ia9fccb81ebc4c0be7c9d80823b3c2f76aa2275d0
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373723
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-24 17:40:29 -07:00
Bill Richardson
bb15561db5 cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args
Since pretty much always, we've declared console commands to take
a "longhelp" argument with detailed explanations of what the
command does. But since almost as long, we've never actually used
that argument for anything - we just silently throw it away in
the macro. There's only one command (usbchargemode) that even
thinks it defines that argument.

We're never going to use this, let's just get rid of it.

BUG=none
BRANCH=none
CQ-DEPEND=CL:*279060
CQ-DEPEND=CL:*279158
CQ-DEPEND=CL:*279037
TEST=make buildall; tested on Cr50 hardware

Everything builds. Since we never used this arg anyway, there had
better not be any difference in the result.

Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374163
Reviewed-by: Myles Watson <mylesgw@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-24 16:30:10 +00:00
Martin Roth
6e866962a0 charger/bd99955: only print data if read was successful
In console_command_bd99955(), because the return value wasn't being
checked before displaying the data variable, it could be printed without
being initialized.

TEST=Build
BUG=None
BRANCH=None

Change-Id: I03e0aae6fee33e32f648d952d6f2906e71f67ea2
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371398
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-08-23 15:36:52 -07:00
Vijay Hiremath
61c45fb33e BD99955: Map PD port number to charge port number
Charger port number may differ from PD port number hence added
a macro to select appropriate port numbers during compilation.

BUG=chrome-os-partner:54970
BRANCH=none
TEST=Reef can negotiate on both the ports.

Change-Id: Id3b4b639a5f8698c27341be037bb09370910cac5
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/357836
Commit-Ready: Martin Roth <martinroth@chromium.org>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-22 23:27:16 -07:00
Shawn Nematbakhsh
99e95dd3c3 charger: bd99955: Prevent truncated console command output
"bd99955_dump" output may be larger than our UART output buffer, so
flush our buffer in between prints.

BUG=None
TEST=Run 'bd99955_dump' on kevin, verify full output is seen.
BRANCH=None

Change-Id: I5816e0ce0c000bf63bc09502888e5acc9c4728ae
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/373660
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: Aseda Aboagye <aaboagye@chromium.org>
2016-08-22 14:52:41 -07:00
Dino Li
8d8f2401a2 TCPM: it83xx: support Rp 1.5/3.0A pullup configuration
Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=chrome-os-partner:54452
TEST=1. To check appropriate register setting.
     2. Measure the CC voltage by connecting USB-C to DP cable to EVB.
        Default                  : 433mV
        CONFIG_USB_PD_PULLUP_1_5A: 951mV
        CONFIG_USB_PD_PULLUP_3A  : 1.72V

Change-Id: Id5a36ded94121db4343c48ecea19a5a533244f43
Reviewed-on: https://chromium-review.googlesource.com/371020
Commit-Ready: Dino Li <Dino.Li@ite.com.tw>
Tested-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-22 00:11:59 -07:00
Nicolas Boichat
e3297d7255 anx7688: Add custom vbus function
On ANX7688, POWER_STATUS.VBusPresent is averaged 16 times, so its
value may not be set to 1 quickly enough during power role swap.
Therefore, we use a proprietary register to read the unfiltered VBus
value.

BRANCH=oak
BUG=chrome-os-partner:55221
TEST=LG monitor works over type-C, power role swap looks good

Change-Id: I68572c34440be65882f431bb892ed032da05bd0a
Reviewed-on: https://chromium-review.googlesource.com/364351
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-08-21 22:03:34 -07:00
Victor Prupis
a56aabfc65 Standard locations for board specific battery code
Moved battery code for samus and ryu from driver tree to board tree.

BUG=chrome-os-partner:42486
BRANCH=master
TEST=none

Change-Id: Iaad1456323f85e5852d8aa8e3e2d453b26e2d452
Signed-off-by: Victor Prupis <vprupis@google.com>
Reviewed-on: https://chromium-review.googlesource.com/371402
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2016-08-19 14:21:17 -07:00
Ravi Chandra Sadineni
2d5827682d Correct interpolation algorithm of thermal values.
Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>

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

Change-Id: I22ac65f33b27b8ce8ad0687971f47b82395aa781
Reviewed-on: https://chromium-review.googlesource.com/370402
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Commit-Ready: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Tested-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-08-17 22:15:35 -07:00
Vincent Palatin
81421ba013 fusb302: enable setting Rp value
Configure the FUSB302 current source used for Rp according to the
CONFIG_USB_PD_PULLUP_xxx value.

Set the default Rp for Kevin to 1.5A.

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

BRANCH=none
BUG=chrome-os-partner:54452 chrome-os-partner:56110
TEST=manual: plug to Samus, enable charging on the Samus side,
measure the CC voltage with Twinkie, get 950mV instead of 450mV.

Change-Id: I98faf18132a097e49e9c0fa8e1395d230608ee9e
Reviewed-on: https://chromium-review.googlesource.com/369190
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-16 00:58:14 -07:00
Martin Roth
7832ba6c4f tcpm/anx74xx: initialize reg variable before use
When disabling auto_good_crc, the reg variable was being used
without initialization.  Mirror the code for enabling auto_good_crc
to set the variable.

TEST=Booted reef with updated code.
BUG=None
BRANCH=None

Change-Id: Ie552f2ff74df05750bd65b6344d8a80cc285f8b0
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/368221
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-08-12 13:45:37 -07:00
Martin Roth
0b16cd761a charger/bd99955.c: Simplify flow in console_command_bd99955
It looks to static analyzers as if the variable val could be used
without being initialized.  That isn't actually the case because of
all the checks that are being done, but the flow can be simplified
to only get the value to write when we're on the write path.

BRANCH=None
TEST=Build and boot Reef
BUG=None

Change-Id: I9f6ce3c9dcbab74f3c6de18dbd1f2e07bc1c4a13
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/368302
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-08-12 13:45:19 -07:00
Tang Zhentian1
2e738c72fd Analogix: Present configured Rp pull-up.
ANX was using 36K Rp detection as default detect value.
ANX fix google issue google charger
BUG=chrome-os-partner:54452
BRANCH=master
TEST=On Reef: With twinkie tested CC voltage change for
      1.5A Rp pull up meets the spec values.

Change-Id: I3af20e5c437218b83befc899a7c62b019b2c9dee
Signed-off-by: Tang Zhentian1 <ztang@analogixsemi.com>
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/366461
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-08-11 16:52:02 -07:00