hsmmc.o \
usb-musb.o \
usb-ehci.o \
- board-3430sdp-flash.o \
- bci.o
+ board-3430sdp-flash.o
obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o \
hsmmc.o \
usb-musb.o usb-ehci.o \
hsmmc.o
obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o \
hsmmc.o \
- bci.o \
usb-musb.o
obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o \
board-apollon-mmc.o \
+++ /dev/null
-/*
- * linux/arch/arm/mach-omap2/bci.c
- *
- * TWL4030 BCI platform device setup/initialization
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <mach/bci.h>
-
-#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
- defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
-/*
- * Thermistor Calibration for Current Source and MADC
- * Tolerance (for THS05-3H103F)
- */
-static int sdp3430_batt_table[] = {
-/* 0 C*/
-30800, 29500, 28300, 27100,
-26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
-17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
-11600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
-8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
-5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
-4040, 3910, 3790, 3670, 3550
-};
-
-static struct twl4030_bci_platform_data sdp3430_bci_data = {
- .battery_tmp_tbl = sdp3430_batt_table,
- .tblsize = ARRAY_SIZE(sdp3430_batt_table),
-};
-
-static struct platform_device twl4030_bci_battery_device = {
- .name = "twl4030-bci-battery",
- .id = -1,
- .dev = {
- .platform_data = &sdp3430_bci_data,
- },
- .num_resources = 0,
-};
-
-void __init twl4030_bci_battery_init(void)
-{
- (void) platform_device_register(&twl4030_bci_battery_device);
-}
-#else
-void __init twl4030_bci_battery_init(void)
-{
-}
-#endif
{ OMAP_TAG_LCD, &sdp3430_lcd_config },
};
+static int sdp3430_batt_table[] = {
+/* 0 C*/
+30800, 29500, 28300, 27100,
+26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
+17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
+11600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
+8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
+5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
+4040, 3910, 3790, 3670, 3550
+};
+
+static struct twl4030_bci_platform_data sdp3430_bci_data = {
+ .battery_tmp_tbl = sdp3430_batt_table,
+ .tblsize = ARRAY_SIZE(sdp3430_batt_table),
+};
+
static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
.gpio_base = OMAP_MAX_GPIO_LINES,
.irq_base = TWL4030_GPIO_IRQ_BASE,
.irq_end = TWL4030_IRQ_END,
/* platform_data for children goes here */
+ .bci = &sdp3430_bci_data,
.gpio = &sdp3430_gpio_data,
.madc = &sdp3430_madc_data,
.keypad = &sdp3430_kp_data,
ads7846_dev_init();
sdp3430_flash_init();
msecure_init();
- twl4030_bci_battery_init();
omap_serial_init();
usb_musb_init();
usb_ehci_init();
{ OMAP_TAG_UART, &ldp_uart_config },
};
+static int ldp_batt_table[] = {
+/* 0 C*/
+30800, 29500, 28300, 27100,
+26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
+17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
+11600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
+8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
+5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
+4040, 3910, 3790, 3670, 3550
+};
+
+static struct twl4030_bci_platform_data ldp_bci_data = {
+ .battery_tmp_tbl = ldp_batt_table,
+ .tblsize = ARRAY_SIZE(ldp_batt_table),
+};
+
static struct twl4030_usb_data ldp_usb_data = {
.usb_mode = T2_USB_MODE_ULPI,
};
.irq_end = TWL4030_IRQ_END,
/* platform_data for children goes here */
+ .bci = &ldp_bci_data,
.madc = &ldp_madc_data,
.usb = &ldp_usb_data,
.gpio = &ldp_gpio_data,
ARRAY_SIZE(ldp_spi_board_info));
msecure_init();
ads7846_dev_init();
- twl4030_bci_battery_init();
omap_serial_init();
usb_musb_init();
hsmmc_init();
+++ /dev/null
-/*
- * arch/arm/plat-omap/include/mach/bci.h
- *
- * Copyright (C) 2008 Texas Instruments, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef ASMARM_ARCH_BCI_H
-#define ASMARM_ARCH_BCI_H
-struct twl4030_bci_platform_data {
- int *battery_tmp_tbl;
- unsigned int tblsize;
-};
-#endif
-
#define DRIVER_NAME "twl4030"
+#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
+ defined(CONFIG_TWL4030_BCI_BATTERY_MODUEL)
+#define twl_has_bci() true
+#else
+#define twl_has_bci() false
+#endif
+
#if defined(CONFIG_KEYBOARD_TWL4030) || defined(CONFIG_KEYBOARD_TWL4030_MODULE)
#define twl_has_keypad() true
#else
struct twl4030_client *twl = NULL;
int status = 0;
+ if (twl_has_bci() && pdata->bci) {
+ twl = &twl4030_modules[TWL4030_SLAVENUM_NUM3];
+
+ pdev = platform_device_alloc("twl4030_bci", -1);
+ if (!pdev) {
+ pr_debug("%s: can't alloc bci dev\n", DRIVER_NAME);
+ status = -ENOMEM;
+ goto err;
+ }
+
+ if (status == 0) {
+ pdev->dev.parent = &twl->client->dev;
+ status = platform_device_add_data(pdev, pdata->bci,
+ sizeof(*pdata->bci));
+ if (status < 0) {
+ dev_dbg(&twl->client->dev,
+ "can't add bci data, %d\n",
+ status);
+ goto err;
+ }
+ }
+
+ if (status == 0) {
+ struct resource r = {
+ .start = TWL4030_PWRIRQ_CHG_PRES,
+ .flags = IORESOURCE_IRQ,
+ };
+
+ status = platform_device_add_resources(pdev, &r, 1);
+ }
+
+ if (status == 0)
+ status = platform_device_add(pdev);
+
+ if (status < 0) {
+ platform_device_put(pdev);
+ dev_dbg(&twl->client->dev,
+ "can't create bci dev, %d\n",
+ status);
+ goto err;
+ }
+ }
+
if (twl_has_gpio() && pdata->gpio) {
twl = &twl4030_modules[TWL4030_SLAVENUM_NUM1];
#include <linux/platform_device.h>
#include <linux/i2c/twl4030.h>
#include <linux/power_supply.h>
-#include <mach/bci.h>
#include <linux/i2c/twl4030-madc.h>
#define T2_BATTERY_VOLT 0x04
*/
static int twl4030backupbatt_voltage(void)
{
- int ret, temp;
- u8 volt;
struct twl4030_madc_request req;
+ int temp;
req.channels = (1 << 9);
req.do_avg = 0;
enum power_supply_property psp,
union power_supply_propval *val)
{
- struct twl4030_bci_device_info *di = to_twl4030_bci_device_info(psy);
+ struct twl4030_bci_device_info *di;
int status = 0;
+ di = to_twl4030_bci_device_info(psy);
+
switch (psp) {
case POWER_SUPPLY_PROP_STATUS:
val->intval = di->charge_status;
{
struct twl4030_bci_platform_data *pdata = pdev->dev.platform_data;
struct twl4030_bci_device_info *di;
+ int irq;
int ret;
therm_tbl = pdata->battery_tmp_tbl;
if (ret)
goto voltage_setup_fail;
+ /* REVISIT do we need to request both IRQs ?? */
+
/* request BCI interruption */
ret = request_irq(TWL4030_MODIRQ_BCI, twl4030battery_interrupt,
IRQF_DISABLED, pdev->name, NULL);
goto batt_irq_fail;
}
+ irq = platform_get_irq(pdev, 0);
+
/* request Power interruption */
- ret = request_irq(TWL4030_PWRIRQ_CHG_PRES, twl4030charger_interrupt,
+ ret = request_irq(irq, twl4030charger_interrupt,
0, pdev->name, di);
if (ret) {
dev_dbg(&pdev->dev, "could not request irq %d, status %d\n",
- TWL4030_PWRIRQ_CHG_PRES, ret);
+ irq, ret);
goto chg_irq_fail;
}
- ret = power_supply_register(&dev->dev, &di->bat);
+ ret = power_supply_register(&pdev->dev, &di->bat);
if (ret) {
dev_dbg(&pdev->dev, "failed to register main battery\n");
goto batt_failed;
bk_batt_failed:
power_supply_unregister(&di->bat);
batt_failed:
- free_irq(TWL4030_MODIRQ_PWR, di);
+ free_irq(irq, di);
chg_irq_fail:
-prev_setup_err:
free_irq(TWL4030_MODIRQ_BCI, NULL);
batt_irq_fail:
voltage_setup_fail:
static int __exit twl4030_bci_battery_remove(struct platform_device *pdev)
{
struct twl4030_bci_device_info *di = platform_get_drvdata(pdev);
+ int irq = platform_get_irq(pdev, 0);
twl4030charger_ac_en(DISABLE);
twl4030charger_usb_en(DISABLE);
twl4030battery_hw_presence_en(DISABLE);
free_irq(TWL4030_MODIRQ_BCI, NULL);
- free_irq(TWL4030_MODIRQ_PWR, di);
+ free_irq(irq, di);
flush_scheduled_work();
power_supply_unregister(&di->bat);
#define TWL4030_MODULE_RTC 0x14
#define TWL4030_MODULE_SECURED_REG 0x15
+struct twl4030_bci_platform_data {
+ int *battery_tmp_tbl;
+ unsigned int tblsize;
+};
/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
struct twl4030_gpio_platform_data {
struct twl4030_platform_data {
unsigned irq_base, irq_end;
+ struct twl4030_bci_platform_data *bci;
struct twl4030_gpio_platform_data *gpio;
struct twl4030_madc_platform_data *madc;
struct twl4030_keypad_data *keypad;