diff options
author | chrome-bot <chrome-bot@google.com> | 2012-02-07 16:15:16 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit-int.golo.chromium.org> | 2012-02-07 16:15:16 -0800 |
commit | 16df421edcbe9492555db13e57aa4b8a746dae3b (patch) | |
tree | 4e69b2af218536c7a246652551ae535606ca7252 /chip | |
parent | 7423b63ea3a60e1b2328f87e64aae85f9f329b9d (diff) | |
parent | 812b3f8cb692ae5f9c616f570e5973e9c66eddcb (diff) | |
download | chrome-ec-16df421edcbe9492555db13e57aa4b8a746dae3b.tar.gz |
Merge "Initial bq24725 charger driver import"
Diffstat (limited to 'chip')
-rw-r--r-- | chip/lm4/build.mk | 1 | ||||
-rw-r--r-- | chip/lm4/charger.c | 96 |
2 files changed, 0 insertions, 97 deletions
diff --git a/chip/lm4/build.mk b/chip/lm4/build.mk index 7a2053b2f9..028eeecc3f 100644 --- a/chip/lm4/build.mk +++ b/chip/lm4/build.mk @@ -16,4 +16,3 @@ chip-$(CONFIG_LPC)+=lpc.o chip-$(CONFIG_PWM)+=pwm.o chip-$(CONFIG_TEMP_SENSOR)+=chip_temp_sensor.o chip-$(CONFIG_TASK_KEYSCAN)+=keyboard_scan.o -chip-$(CONFIG_CHARGER)+=charger.o diff --git a/chip/lm4/charger.c b/chip/lm4/charger.c deleted file mode 100644 index e603e63453..0000000000 --- a/chip/lm4/charger.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) 2012 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. - */ - -/* Charger/battery debug command module for Chrome EC */ - -/* TODO: remove this or merge into charger/battery modules - * once charger and battery modules are ready. - */ - -#include "charger.h" -#include "board.h" -#include "i2c.h" -#include "console.h" -#include "uart.h" -#include "util.h" - -/* Address of battery charger */ -#define CHARGER_ADDR 0x12 - -/* Address of battery */ -#define BATTERY_ADDR 0x16 - -/*****************************************************************************/ -/* Console commands */ - -static int command_charger(int argc, char **argv) -{ - int rv; - int d; - - uart_puts("Reading battery charger...\n"); - - rv = i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, 0xfe, &d); - if (rv) - return rv; - uart_printf(" Manufacturer ID: 0x%04x\n", d); - - rv = i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, 0xff, &d); - uart_printf(" Device ID: 0x%04x\n", d); - - rv = i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, 0x12, &d); - uart_printf(" Option: 0x%04x\n", d); - - rv = i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, 0x14, &d); - uart_printf(" Charge current: 0x%04x\n", d); - - rv = i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, 0x15, &d); - uart_printf(" Charge voltage: 0x%04x\n", d); - - rv = i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, 0x3f, &d); - uart_printf(" Input current: 0x%04x\n", d); - - return EC_SUCCESS; -} -DECLARE_CONSOLE_COMMAND(charger, command_charger); - -static int command_battery(int argc, char **argv) -{ - int rv; - int d; - - uart_puts("Reading battery...\n"); - - rv = i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR, 0x08, &d); - if (rv) - return rv; - uart_printf(" Temperature: 0x%04x = %d C\n", - d, (d-2731)/10); - - rv = i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR, 0x09, &d); - uart_printf(" Voltage: 0x%04x = %d mV\n", d, d); - - rv = i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR, 0x0f, &d); - uart_printf(" Remaining capacity: 0x%04x = %d mAh\n", d, d); - rv = i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR, 0x10, &d); - uart_printf(" Full charge capacity: 0x%04x = %d mAh\n", d, d); - - rv = i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR, 0x14, &d); - uart_printf(" Desired charge current: 0x%04x = %d mA\n", d, d); - rv = i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR, 0x15, &d); - uart_printf(" Desired charge voltage: 0x%04x = %d mV\n", d, d); - - - return EC_SUCCESS; -} -DECLARE_CONSOLE_COMMAND(battery, command_battery); - -/*****************************************************************************/ -/* Initialization */ - -int charger_init(void) -{ - return EC_SUCCESS; -} |