From 93cb494a7e44864912843e63c04ae72912a1a2e4 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Tue, 20 Aug 2013 16:36:38 +0800 Subject: Add BQ27541 battery driver BQ27541 is not a smart battery IC, and thus we cannot use existing smart battery driver. Let's add a driver that implements a smart-battery-like interface. The 'battery' console command is also moved to battery.c so that it can be reused by different battery driver. BUG=chrome-os-partner:22048 TEST=Type 'battery' and check the reported values are sane. TEST=Check 'battery' command works fine on Spring. BRANCH=None Change-Id: I5d1eaeb3f801478f3b9473fd43c1f2a2eda75859 Signed-off-by: Vic Yang Reviewed-on: https://chromium-review.googlesource.com/66340 --- chip/host/build.mk | 2 +- chip/host/i2c.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 chip/host/i2c.c (limited to 'chip') diff --git a/chip/host/build.mk b/chip/host/build.mk index 694734cd57..177246a925 100644 --- a/chip/host/build.mk +++ b/chip/host/build.mk @@ -8,5 +8,5 @@ CORE:=host -chip-y=system.o gpio.o uart.o persistence.o flash.o lpc.o reboot.o +chip-y=system.o gpio.o uart.o persistence.o flash.o lpc.o reboot.o i2c.o chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o diff --git a/chip/host/i2c.c b/chip/host/i2c.c new file mode 100644 index 0000000000..b9d685a656 --- /dev/null +++ b/chip/host/i2c.c @@ -0,0 +1,34 @@ +/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + * Dummy I2C driver for unit test. + */ + +#include "i2c.h" + +int i2c_read16(int port, int slave_addr, int offset, int *data) +{ + return EC_ERROR_UNKNOWN; +} + +int i2c_write16(int port, int slave_addr, int offset, int data) +{ + return EC_ERROR_UNKNOWN; +} + +int i2c_read8(int port, int slave_addr, int offset, int *data) +{ + return EC_ERROR_UNKNOWN; +} + +int i2c_write8(int port, int slave_addr, int offset, int data) +{ + return EC_ERROR_UNKNOWN; +} + +int i2c_read_string(int port, int slave_addr, int offset, uint8_t *data, + int len) +{ + return EC_ERROR_UNKNOWN; +} -- cgit v1.2.1