aboutsummaryrefslogtreecommitdiff
path: root/include/linux/mfd
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/da903x.h44
-rw-r--r--include/linux/mfd/pcf50606/adc.h87
-rw-r--r--include/linux/mfd/pcf50606/core.h163
-rw-r--r--include/linux/mfd/pcf50606/gpo.h43
-rw-r--r--include/linux/mfd/pcf50606/led.h22
-rw-r--r--include/linux/mfd/pcf50606/mbc.h53
-rw-r--r--include/linux/mfd/pcf50606/pmic.h82
-rw-r--r--include/linux/mfd/pcf50606/rtc.h43
-rw-r--r--include/linux/mfd/pcf50606/wdt.h32
-rw-r--r--include/linux/mfd/pcf50633/adc.h94
-rw-r--r--include/linux/mfd/pcf50633/core.h52
-rw-r--r--include/linux/mfd/pcf50633/gpio.h23
-rw-r--r--include/linux/mfd/pcf50633/input.h29
-rw-r--r--include/linux/mfd/pcf50633/led.h24
-rw-r--r--include/linux/mfd/pcf50633/mbc.h18
-rw-r--r--include/linux/mfd/pcf50633/pmic.h30
-rw-r--r--include/linux/mfd/pcf50633/rtc.h43
-rw-r--r--include/linux/mfd/wm8350/audio.h38
-rw-r--r--include/linux/mfd/wm8350/comparator.h8
-rw-r--r--include/linux/mfd/wm8350/core.h52
-rw-r--r--include/linux/mfd/wm8350/pmic.h40
-rw-r--r--include/linux/mfd/wm8350/rtc.h2
-rw-r--r--include/linux/mfd/wm8350/supply.h25
23 files changed, 302 insertions, 745 deletions
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h
index cad314c1243..115dbe96508 100644
--- a/include/linux/mfd/da903x.h
+++ b/include/linux/mfd/da903x.h
@@ -32,6 +32,7 @@ enum {
DA9030_ID_LDO18,
DA9030_ID_LDO19,
DA9030_ID_LDO_INT, /* LDO Internal */
+ DA9030_ID_BAT, /* battery charger */
DA9034_ID_LED_1,
DA9034_ID_LED_2,
@@ -93,6 +94,43 @@ struct da9034_touch_pdata {
int y_inverted;
};
+/* DA9030 battery charger data */
+struct power_supply_info;
+
+struct da9030_battery_info {
+ /* battery parameters */
+ struct power_supply_info *battery_info;
+
+ /* current and voltage to use for battery charging */
+ unsigned int charge_milliamp;
+ unsigned int charge_millivolt;
+
+ /* voltage thresholds (in millivolts) */
+ int vbat_low;
+ int vbat_crit;
+ int vbat_charge_start;
+ int vbat_charge_stop;
+ int vbat_charge_restart;
+
+ /* battery nominal minimal and maximal voltages in millivolts */
+ int vcharge_min;
+ int vcharge_max;
+
+ /* Temperature thresholds. These are DA9030 register values
+ "as is" and should be measured for each battery type */
+ int tbat_low;
+ int tbat_high;
+ int tbat_restart;
+
+
+ /* battery monitor interval (seconds) */
+ unsigned int batmon_interval;
+
+ /* platform callbacks for battery low and critical events */
+ void (*battery_low)(void);
+ void (*battery_critical)(void);
+};
+
struct da903x_subdev_info {
int id;
const char *name;
@@ -190,11 +228,13 @@ extern int da903x_unregister_notifier(struct device *dev,
extern int da903x_query_status(struct device *dev, unsigned int status);
-/* NOTE: the two functions below are not intended for use outside
- * of the DA9034 sub-device drivers
+/* NOTE: the functions below are not intended for use outside
+ * of the DA903x sub-device drivers
*/
extern int da903x_write(struct device *dev, int reg, uint8_t val);
+extern int da903x_writes(struct device *dev, int reg, int len, uint8_t *val);
extern int da903x_read(struct device *dev, int reg, uint8_t *val);
+extern int da903x_reads(struct device *dev, int reg, int len, uint8_t *val);
extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask);
extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
diff --git a/include/linux/mfd/pcf50606/adc.h b/include/linux/mfd/pcf50606/adc.h
deleted file mode 100644
index 1cb8cab70ce..00000000000
--- a/include/linux/mfd/pcf50606/adc.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * adc.h -- Driver for NXP PCF50606 ADC
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50606_ADC_H
-#define __LINUX_MFD_PCF50606_ADC_H
-
-#include <linux/platform_device.h>
-
-/* ADC Registers */
-#define PCF50606_REG_ADCC1 0x2e
-#define PCF50606_REG_ADCC2 0x2f
-#define PCF50606_REG_ADCS1 0x30
-#define PCF50606_REG_ADCS2 0x31
-#define PCF50606_REG_ADCS3 0x32
-
-#define PCF50606_ADCC1_TSCMODACT 0x01
-#define PCF50606_ADCC1_TSCMODSTB 0x02
-#define PCF50606_ADCC1_TRATSET 0x04
-#define PCF50606_ADCC1_NTCSWAPE 0x08
-#define PCF50606_ADCC1_NTCSWAOFF 0x10
-#define PCF50606_ADCC1_EXTSYNCBREAK 0x20
- /* reserved */
-#define PCF50606_ADCC1_TSCINT 0x80
-
-#define PCF50606_ADCC2_ADCSTART 0x01
- /* see enum pcf50606_adcc2_adcmux */
-#define PCF50606_ADCC2_SYNC_NONE 0x00
-#define PCF50606_ADCC2_SYNC_TXON 0x20
-#define PCF50606_ADCC2_SYNC_PWREN1 0x40
-#define PCF50606_ADCC2_SYNC_PWREN2 0x60
-#define PCF50606_ADCC2_RES_10BIT 0x00
-#define PCF50606_ADCC2_RES_8BIT 0x80
-
-#define PCF50606_ADCC2_ADCMUX_MASK (0xf << 1)
-
-#define ADCMUX_SHIFT 1
-#define PCF50606_ADCMUX_BATVOLT_RES (0x0 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_BATVOLT_SUBTR (0x1 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_ADCIN1_RES (0x2 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_ADCIN1_SUBTR (0x3 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_BATTEMP (0x4 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_ADCIN2 (0x5 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_ADCIN3 (0x6 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_ADCIN3_RATIO (0x7 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_XPOS (0x8 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_YPOS (0x9 << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_P1 (0xa << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_P2 (0xb << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_BATVOLT_ADCIN1 (0xc << ADCMUX_SHIFT)
-#define PCF50606_ADCMUX_XY_SEQUENCE (0xe << ADCMUX_SHIFT)
-#define PCF50606_P1_P2_RESISTANCE (0xf << ADCMUX_SHIFT)
-
-#define PCF50606_ADCS2_ADCRDY 0x80
-
-struct pcf50606;
-
-#define PCF50606_MAX_ADC_FIFO_DEPTH 8
-
-struct pcf50606_adc_request;
-
-struct pcf50606_adc {
- struct platform_device *pdev;
-
- /* Private stuff */
- struct pcf50606_adc_request *queue[PCF50606_MAX_ADC_FIFO_DEPTH];
- int queue_head;
- int queue_tail;
- struct mutex queue_mutex;
-};
-
-extern int
-pcf50606_adc_async_read(struct pcf50606 *pcf, int mux, int avg,
- void (*callback)(struct pcf50606 *, void *, int),
- void *callback_param);
-extern int
-pcf50606_adc_sync_read(struct pcf50606 *pcf, int mux, int avg);
-
-#endif /* __LINUX_PCF50606_ADC_H */
diff --git a/include/linux/mfd/pcf50606/core.h b/include/linux/mfd/pcf50606/core.h
deleted file mode 100644
index b45d7ebc137..00000000000
--- a/include/linux/mfd/pcf50606/core.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * core.h -- Core driver for NXP PCF50606
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50606_CORE_H
-#define __LINUX_MFD_PCF50606_CORE_H
-
-#include <linux/i2c.h>
-#include <linux/workqueue.h>
-#include <linux/regulator/driver.h>
-#include <linux/regulator/machine.h>
-#include <linux/power_supply.h>
-
-#include <linux/mfd/pcf50606/pmic.h>
-#include <linux/mfd/pcf50606/input.h>
-#include <linux/mfd/pcf50606/mbc.h>
-#include <linux/mfd/pcf50606/rtc.h>
-#include <linux/mfd/pcf50606/adc.h>
-#include <linux/mfd/pcf50606/wdt.h>
-
-struct pcf50606;
-
-struct pcf50606_platform_data {
- struct regulator_init_data reg_init_data[PCF50606_NUM_REGULATORS];
-
- char **batteries;
- int num_batteries;
-
- /* Callbacks */
- void (*probe_done)(struct pcf50606 *);
- void (*mbc_event_callback)(struct pcf50606 *, int);
- void (*regulator_registered)(struct pcf50606 *, int);
- void (*force_shutdown)(struct pcf50606 *);
-
- u8 resumers[3];
-
- /* Runtime data - filled by driver afer probe */
- struct pcf50606 *pcf;
-};
-
-struct pcf50606_irq {
- void (*handler)(struct pcf50606 *, int, void *);
- void *data;
-};
-
-int pcf50606_irq_mask(struct pcf50606 *pcf, int irq);
-int pcf50606_irq_unmask(struct pcf50606 *pcf, int irq);
-int pcf50606_irq_mask_get(struct pcf50606 *pcf, int irq);
-
-int pcf50606_read_block(struct pcf50606 *, u8 reg,
- int nr_regs, u8 *data);
-int pcf50606_write_block(struct pcf50606 *pcf, u8 reg,
- int nr_regs, u8 *data);
-u8 pcf50606_reg_read(struct pcf50606 *, u8 reg);
-int pcf50606_reg_write(struct pcf50606 *pcf, u8 reg, u8 val);
-
-int pcf50606_reg_set_bit_mask(struct pcf50606 *pcf, u8 reg, u8 mask, u8 val);
-int pcf50606_reg_clear_bits(struct pcf50606 *pcf, u8 reg, u8 bits);
-
-/* Interrupt registers */
-
-#define PCF50606_REG_INT1 0x02
-#define PCF50606_REG_INT2 0x03
-#define PCF50606_REG_INT3 0x04
-
-#define PCF50606_REG_INT1M 0x05
-#define PCF50606_REG_INT2M 0x06
-#define PCF50606_REG_INT3M 0x07
-
-enum {
- /* Chip IRQs */
- PCF50606_IRQ_ONKEYR,
- PCF50606_IRQ_ONKEYF,
- PCF50606_IRQ_ONKEY1S,
- PCF50606_IRQ_EXTONR,
- PCF50606_IRQ_EXTONF,
- PCF50606_IRQ_SECOND,
- PCF50606_IRQ_ALARM,
- PCF50606_IRQ_CHGINS,
- PCF50606_IRQ_CHGRM,
- PCF50606_IRQ_CHGFOK,
- PCF50606_IRQ_CHGERR,
- PCF50606_IRQ_CHGFRDY,
- PCF50606_IRQ_CHGPROT,
- PCF50606_IRQ_CHGWD10S,
- PCF50606_IRQ_CHGWDEXP,
- PCF50606_IRQ_ADCRDY,
- PCF50606_IRQ_ACDINS,
- PCF50606_IRQ_ACDREM,
- PCF50606_IRQ_TSCPRES,
- PCF50606_IRQ_LOWBAT,
- PCF50606_IRQ_HIGHTMP,
-
- /* Always last */
- PCF50606_NUM_IRQ,
-};
-
-struct pcf50606 {
- struct device *dev;
- struct i2c_client *i2c_client;
-
- struct pcf50606_platform_data *pdata;
- int irq;
- struct pcf50606_irq irq_handler[PCF50606_NUM_IRQ];
- struct work_struct irq_work;
- struct mutex lock;
-
- u8 mask_regs[3];
-
- u8 suspend_irq_masks[3];
- u8 resume_reason[3];
- int is_suspended;
-
- int onkey1s_held;
-
- struct pcf50606_pmic pmic;
- struct pcf50606_input input;
- struct pcf50606_mbc mbc;
- struct pcf50606_rtc rtc;
- struct pcf50606_adc adc;
- struct pcf50606_wdt wdt;
-};
-
-enum pcf50606_reg_int1 {
- PCF50606_INT1_ONKEYR = 0x01, /* ONKEY rising edge */
- PCF50606_INT1_ONKEYF = 0x02, /* ONKEY falling edge */
- PCF50606_INT1_ONKEY1S = 0x04, /* OMKEY at least 1sec low */
- PCF50606_INT1_EXTONR = 0x08, /* EXTON rising edge */
- PCF50606_INT1_EXTONF = 0x10, /* EXTON falling edge */
- PCF50606_INT1_SECOND = 0x40, /* RTC periodic second interrupt */
- PCF50606_INT1_ALARM = 0x80, /* RTC alarm time is reached */
-};
-
-enum pcf50606_reg_int2 {
- PCF50606_INT2_CHGINS = 0x01, /* Charger inserted */
- PCF50606_INT2_CHGRM = 0x02, /* Charger removed */
- PCF50606_INT2_CHGFOK = 0x04, /* Fast charging OK */
- PCF50606_INT2_CHGERR = 0x08, /* Error in charging mode */
- PCF50606_INT2_CHGFRDY = 0x10, /* Fast charge completed */
- PCF50606_INT2_CHGPROT = 0x20, /* Charging protection interrupt */
- PCF50606_INT2_CHGWD10S = 0x40, /* Charger watchdig expires in 10s */
- PCF50606_INT2_CHGWDEXP = 0x80, /* Charger watchdog expires */
-};
-
-enum pcf50606_reg_int3 {
- PCF50606_INT3_ADCRDY = 0x01, /* ADC conversion finished */
- PCF50606_INT3_ACDINS = 0x02, /* Accessory inserted */
- PCF50606_INT3_ACDREM = 0x04, /* Accessory removed */
- PCF50606_INT3_TSCPRES = 0x08, /* Touch screen pressed */
- PCF50606_INT3_LOWBAT = 0x40, /* Low battery voltage */
- PCF50606_INT3_HIGHTMP = 0x80, /* High temperature */
-};
-
-#endif
-
diff --git a/include/linux/mfd/pcf50606/gpo.h b/include/linux/mfd/pcf50606/gpo.h
deleted file mode 100644
index fc512288635..00000000000
--- a/include/linux/mfd/pcf50606/gpo.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * gpo.h -- GPO driver for NXP PCF50606
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50606_GPO_H
-#define __LINUX_MFD_PCF50606_GPO_H
-
-#define PCF50606_REG_GPOC1 0x38
-#define PCF50606_REG_GPOC2 0x39
-#define PCF50606_REG_GPOC3 0x3a
-#define PCF50606_REG_GPOC4 0x3b
-#define PCF50606_REG_GPOC5 0x3c
-
-#define PCF50606_GPO1 PCF50606_REG_GPOC1
-#define PCF50606_GPO2 PCF50606_REG_GPOC1
-#define PCF50606_GPOOD1 PCF50606_REG_GPOC2
-#define PCF50606_GPOOD2 PCF50606_REG_GPOC3
-#define PCF50606_GPOOD3 PCF50606_REG_GPOC4
-#define PCF50606_GPOOD4 PCF50606_REG_GPOC5
-
-#define PCF50606_GPOCFG_GPOSEL_MASK 0x07
-
-struct pcf50606;
-
-void pcf50606_gpo_set_active(struct pcf50606 *pcf, int gpo, int value);
-int pcf50606_gpo_get_active(struct pcf50606 *pcf, int gpo);
-void pcf50606_gpo_set_standby(struct pcf50606 *pcf, int gpo, int value);
-int pcf50606_gpo_get_standby(struct pcf50606 *pcf, int gpo);
-
-void pcf50606_gpo_invert_set(struct pcf50606 *, int gpo, int invert);
-int pcf50606_gpo_invert_get(struct pcf50606 *pcf, int gpo);
-
-#endif /* __LINUX_MFD_PCF50606_GPIO_H */
-
-
diff --git a/include/linux/mfd/pcf50606/led.h b/include/linux/mfd/pcf50606/led.h
deleted file mode 100644
index acc428bbaaa..00000000000
--- a/include/linux/mfd/pcf50606/led.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * led.h -- LED driver for NXP PCF50606
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50606_LED_H
-#define __LINUX_MFD_PCF50606_LED_H
-
-#define PCF50606_REG_LEDC1 0x36
-#define PCF50606_REG_LEDC2 0x37
-
-#include <linux/platform_device.h>
-
-#endif
-
diff --git a/include/linux/mfd/pcf50606/mbc.h b/include/linux/mfd/pcf50606/mbc.h
deleted file mode 100644
index d4a6b0f6b27..00000000000
--- a/include/linux/mfd/pcf50606/mbc.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * mbc.h -- Driver for NXP PCF50606 Main Battery Charger
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50606_MBC_H
-#define __LINUX_MFD_PCF50606_MBC_H
-
-#include <linux/platform_device.h>
-
-#define PCF50606_REG_MBCC1 0x29
-#define PCF50606_REG_MBCC2 0x2a
-#define PCF50606_REG_MBCC3 0x2b
-#define PCF50606_REG_MBCS1 0x2c
-
-enum pcf50606_reg_mbcc1 {
- PCF50606_MBCC1_CHGAPE = 0x01,
- PCF50606_MBCC1_AUTOFST = 0x02,
-#define PCF50606_MBCC1_CHGMOD_MASK 0x1c
-#define PCF50606_MBCC1_CHGMOD_SHIFT 2
- PCF50606_MBCC1_CHGMOD_QUAL = 0x00,
- PCF50606_MBCC1_CHGMOD_PRE = 0x04,
- PCF50606_MBCC1_CHGMOD_TRICKLE = 0x08,
- PCF50606_MBCC1_CHGMOD_FAST_CCCV = 0x0c,
- PCF50606_MBCC1_CHGMOD_FAST_NOCC = 0x10,
- PCF50606_MBCC1_CHGMOD_FAST_NOCV = 0x14,
- PCF50606_MBCC1_CHGMOD_FAST_SW = 0x18,
- PCF50606_MBCC1_CHGMOD_IDLE = 0x1c,
- PCF50606_MBCC1_DETMOD_LOWCHG = 0x20,
- PCF50606_MBCC1_DETMOD_WDRST = 0x40,
-};
-
-struct pcf50606;
-
-void pcf50606_mbc_usb_curlim_set(struct pcf50606 *pcf, int ma);
-
-struct pcf50606_mbc {
- int charger_online;
- int charger_active;
-
- struct power_supply charger;
-
- struct platform_device *pdev;
-};
-#endif
-
diff --git a/include/linux/mfd/pcf50606/pmic.h b/include/linux/mfd/pcf50606/pmic.h
deleted file mode 100644
index 3b17e738b8a..00000000000
--- a/include/linux/mfd/pcf50606/pmic.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef __LINUX_MFD_PCF50606_PMIC_H
-#define __LINUX_MFD_PCF50606_PMIC_H
-
-#include <linux/platform_device.h>
-
-#define PCF50606_REG_DCDC1 0x1b
-#define PCF50606_REG_DCDC2 0x1c
-#define PCF50606_REG_DCDC3 0x1d
-#define PCF50606_REG_DCDC4 0x1e
-#define PCF50606_REG_DCDEC1 0x1f
-#define PCF50606_REG_DCDEC2 0x20
-#define PCF50606_REG_DCUDC1 0x21
-#define PCF50606_REG_DCUDC2 0x22
-#define PCF50606_REG_IOREGC 0x23
-#define PCF50606_REG_D1REGC1 0x24
-#define PCF50606_REG_D2REGC1 0x25
-#define PCF50606_REG_D3REGC1 0x26
-#define PCF50606_REG_LPREGC1 0x27
-#define PCF50606_REG_LPREGC2 0x28
-
-/* used by PSSC, PWROKM, PWROKS, */
-enum pcf50606_regu {
- PCF50606_REGU_DCD = 0x01, /* DCD in phase 2 */
- PCF50606_REGU_DCDE = 0x02, /* DCDE in phase 2 */
- PCF50606_REGU_DCUD = 0x04, /* DCDU in phase 2 */
- PCF50606_REGU_IO = 0x08, /* IO in phase 2 */
- PCF50606_REGU_D1 = 0x10, /* D1 in phase 2 */
- PCF50606_REGU_D2 = 0x20, /* D2 in phase 2 */
- PCF50606_REGU_D3 = 0x40, /* D3 in phase 2 */
- PCF50606_REGU_LP = 0x80, /* LP in phase 2 */
-};
-
-enum pcf50606_reg_dcdc4 {
- PCF50606_DCDC4_MODE_AUTO = 0x00,
- PCF50606_DCDC4_MODE_PWM = 0x01,
- PCF50606_DCDC4_MODE_PCF = 0x02,
- PCF50606_DCDC4_OFF_FLOAT = 0x00,
- PCF50606_DCDC4_OFF_BYPASS = 0x04,
- PCF50606_DCDC4_OFF_PULLDOWN = 0x08,
- PCF50606_DCDC4_CURLIM_500mA = 0x00,
- PCF50606_DCDC4_CURLIM_750mA = 0x10,
- PCF50606_DCDC4_CURLIM_1000mA = 0x20,
- PCF50606_DCDC4_CURLIM_1250mA = 0x30,
- PCF50606_DCDC4_TOGGLE = 0x40,
- PCF50606_DCDC4_REGSEL_DCDC2 = 0x80,
-};
-
-enum pcf50606_reg_dcdec2 {
- PCF50606_DCDEC2_MODE_AUTO = 0x00,
- PCF50606_DCDEC2_MODE_PWM = 0x01,
- PCF50606_DCDEC2_MODE_PCF = 0x02,
- PCF50606_DCDEC2_OFF_FLOAT = 0x00,
- PCF50606_DCDEC2_OFF_BYPASS = 0x04,
-};
-
-enum pcf50606_reg_dcudc2 {
- PCF50606_DCUDC2_MODE_AUTO = 0x00,
- PCF50606_DCUDC2_MODE_PWM = 0x01,
- PCF50606_DCUDC2_MODE_PCF = 0x02,
- PCF50606_DCUDC2_OFF_FLOAT = 0x00,
- PCF50606_DCUDC2_OFF_BYPASS = 0x04,
-};
-
-enum pcf50606_regulator_id {
- PCF50606_REGULATOR_DCD,
- PCF50606_REGULATOR_DCDE,
- PCF50606_REGULATOR_DCUD,
- PCF50606_REGULATOR_D1REG,
- PCF50606_REGULATOR_D2REG,
- PCF50606_REGULATOR_D3REG,
- PCF50606_REGULATOR_LPREG,
- PCF50606_REGULATOR_IOREG,
-
- /* Always last */
- PCF50606_NUM_REGULATORS
-};
-
-struct pcf50606_pmic {
- struct platform_device *pdev[PCF50606_NUM_REGULATORS];
-};
-#endif
-
diff --git a/include/linux/mfd/pcf50606/rtc.h b/include/linux/mfd/pcf50606/rtc.h
deleted file mode 100644
index d025710ca0f..00000000000
--- a/include/linux/mfd/pcf50606/rtc.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * rtc.h -- RTC driver for NXP PCF50606
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50606_RTC_H
-#define __LINUX_MFD_PCF50606_RTC_H
-
-#include <linux/rtc.h>
-#include <linux/platform_device.h>
-
-#define PCF50606_REG_RTCSC 0x0a /* Second */
-#define PCF50606_REG_RTCMN 0x0b /* Minute */
-#define PCF50606_REG_RTCHR 0x0c /* Hour */
-#define PCF50606_REG_RTCWD 0x0d /* Weekday */
-#define PCF50606_REG_RTCDT 0x0e /* Day */
-#define PCF50606_REG_RTCMT 0x0f /* Month */
-#define PCF50606_REG_RTCYR 0x10 /* Year */
-#define PCF50606_REG_RTCSCA 0x11 /* Alarm Second */
-#define PCF50606_REG_RTCMNA 0x12 /* Alarm Minute */
-#define PCF50606_REG_RTCHRA 0x13 /* Alarm Hour */
-#define PCF50606_REG_RTCWDA 0x14 /* Alarm Weekday */
-#define PCF50606_REG_RTCDTA 0x15 /* Alarm Day */
-#define PCF50606_REG_RTCMTA 0x16 /* Alarm Month */
-#define PCF50606_REG_RTCYRA 0x17 /* Alarm Year */
-
-struct pcf50606_rtc {
- int alarm_enabled;
- int second_enabled;
-
- struct rtc_device *rtc_dev;
- struct platform_device *pdev;
-};
-
-#endif
-
diff --git a/include/linux/mfd/pcf50606/wdt.h b/include/linux/mfd/pcf50606/wdt.h
deleted file mode 100644
index d91de905529..00000000000
--- a/include/linux/mfd/pcf50606/wdt.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * wdt.h -- WDT driver for NXP PCF50606
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50606_WDT_H
-#define __LINUX_MFD_PCF50606_WDT_H
-
-#define PCF50606_REG_OOCC1 0x08
-#define PCF50606_REG_OOCS 0x01
-
-#define PCF50606_OOCS_WDTEXP 0x80
-#define PCF50606_OOCC1_WDTRST 0x08
-
-#define CLOSE_STATE_NOT 0x0000
-#define CLOSE_STATE_ALLOW 0x2342
-
-struct pcf50606;
-
-struct pcf50606_wdt {
- struct platform_device *pdev;
-};
-#endif /* __LINUX_MFD_PCF50606_WDT_H */
-
-
diff --git a/include/linux/mfd/pcf50633/adc.h b/include/linux/mfd/pcf50633/adc.h
index 27eabb21683..56669b4183a 100644
--- a/include/linux/mfd/pcf50633/adc.h
+++ b/include/linux/mfd/pcf50633/adc.h
@@ -13,71 +13,55 @@
#ifndef __LINUX_MFD_PCF50633_ADC_H
#define __LINUX_MFD_PCF50633_ADC_H
+#include <linux/mfd/pcf50633/core.h>
#include <linux/platform_device.h>
/* ADC Registers */
-#define PCF50633_REG_ADCC3 0x52
-#define PCF50633_REG_ADCC2 0x53
-#define PCF50633_REG_ADCC1 0x54
-#define PCF50633_REG_ADCS1 0x55
-#define PCF50633_REG_ADCS2 0x56
-#define PCF50633_REG_ADCS3 0x57
-
-#define PCF50633_ADCC1_ADCSTART 0x01
-#define PCF50633_ADCC1_RES_10BIT 0x02
-#define PCF50633_ADCC1_AVERAGE_NO 0x00
-#define PCF50633_ADCC1_AVERAGE_4 0x04
-#define PCF50633_ADCC1_AVERAGE_8 0x08
-#define PCF50633_ADCC1_AVERAGE_16 0x0c
-#define PCF50633_ADCC1_MUX_BATSNS_RES 0x00
-#define PCF50633_ADCC1_MUX_BATSNS_SUBTR 0x10
-#define PCF50633_ADCC1_MUX_ADCIN2_RES 0x20
-#define PCF50633_ADCC1_MUX_ADCIN2_SUBTR 0x30
-#define PCF50633_ADCC1_MUX_BATTEMP 0x60
-#define PCF50633_ADCC1_MUX_ADCIN1 0x70
+#define PCF50633_REG_ADCC3 0x52
+#define PCF50633_REG_ADCC2 0x53
+#define PCF50633_REG_ADCC1 0x54
+#define PCF50633_REG_ADCS1 0x55
+#define PCF50633_REG_ADCS2 0x56
+#define PCF50633_REG_ADCS3 0x57
+
+#define PCF50633_ADCC1_ADCSTART 0x01
+#define PCF50633_ADCC1_RES_10BIT 0x02
+#define PCF50633_ADCC1_AVERAGE_NO 0x00
+#define PCF50633_ADCC1_AVERAGE_4 0x04
+#define PCF50633_ADCC1_AVERAGE_8 0x08
+#define PCF50633_ADCC1_AVERAGE_16 0x0c
+#define PCF50633_ADCC1_MUX_BATSNS_RES 0x00
+#define PCF50633_ADCC1_MUX_BATSNS_SUBTR 0x10
+#define PCF50633_ADCC1_MUX_ADCIN2_RES 0x20
+#define PCF50633_ADCC1_MUX_ADCIN2_SUBTR 0x30
+#define PCF50633_ADCC1_MUX_BATTEMP 0x60
+#define PCF50633_ADCC1_MUX_ADCIN1 0x70
#define PCF50633_ADCC1_AVERAGE_MASK 0x0c
-#define PCF50633_ADCC1_ADCMUX_MASK 0xf0
-
-#define PCF50633_ADCC2_RATIO_NONE 0x00
-#define PCF50633_ADCC2_RATIO_BATTEMP 0x01
-#define PCF50633_ADCC2_RATIO_ADCIN1 0x02
-#define PCF50633_ADCC2_RATIO_BOTH 0x03
-#define PCF50633_ADCC2_RATIOSETTL_100US 0x04
-
-#define PCF50633_ADCC3_ACCSW_EN 0x01
-#define PCF50633_ADCC3_NTCSW_EN 0x04
-#define PCF50633_ADCC3_RES_DIV_TWO 0x10
-#define PCF50633_ADCC3_RES_DIV_THREE 0x00
-
-#define PCF50633_ADCS3_REF_NTCSW 0x00
-#define PCF50633_ADCS3_REF_ACCSW 0x10
-#define PCF50633_ADCS3_REF_2V0 0x20
-#define PCF50633_ADCS3_REF_VISA 0x30
-#define PCF50633_ADCS3_REF_2V0_2 0x70
-#define PCF50633_ADCS3_ADCRDY 0x80
+#define PCF50633_ADCC1_ADCMUX_MASK 0xf0
+
+#define PCF50633_ADCC2_RATIO_NONE 0x00
+#define PCF50633_ADCC2_RATIO_BATTEMP 0x01
+#define PCF50633_ADCC2_RATIO_ADCIN1 0x02
+#define PCF50633_ADCC2_RATIO_BOTH 0x03
+#define PCF50633_ADCC2_RATIOSETTL_100US 0x04
+
+#define PCF50633_ADCC3_ACCSW_EN 0x01
+#define PCF50633_ADCC3_NTCSW_EN 0x04
+#define PCF50633_ADCC3_RES_DIV_TWO 0x10
+#define PCF50633_ADCC3_RES_DIV_THREE 0x00
+
+#define PCF50633_ADCS3_REF_NTCSW 0x00
+#define PCF50633_ADCS3_REF_ACCSW 0x10
+#define PCF50633_ADCS3_REF_2V0 0x20
+#define PCF50633_ADCS3_REF_VISA 0x30
+#define PCF50633_ADCS3_REF_2V0_2 0x70
+#define PCF50633_ADCS3_ADCRDY 0x80
#define PCF50633_ADCS3_ADCDAT1L_MASK 0x03
#define PCF50633_ADCS3_ADCDAT2L_MASK 0x0c
#define PCF50633_ADCS3_ADCDAT2L_SHIFT 2
#define PCF50633_ASCS3_REF_MASK 0x70
-
-struct pcf50633;
-
-#define PCF50633_MAX_ADC_FIFO_DEPTH 8
-
-struct pcf50633_adc_request;
-
-struct pcf50633_adc {
- struct platform_device *pdev;
-
- /* Private stuff */
- struct pcf50633_adc_request *queue[PCF50633_MAX_ADC_FIFO_DEPTH];
- int queue_head;
- int queue_tail;
- struct mutex queue_mutex;
-};
-
extern int
pcf50633_adc_async_read(struct pcf50633 *pcf, int mux, int avg,
void (*callback)(struct pcf50633 *, void *, int),
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index d08be0da7b3..2269f3ba7a4 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -19,15 +19,10 @@
#include <linux/regulator/machine.h>
#include <linux/power_supply.h>
-#include <linux/mfd/pcf50633/pmic.h>
-#include <linux/mfd/pcf50633/input.h>
-#include <linux/mfd/pcf50633/mbc.h>
-#include <linux/mfd/pcf50633/rtc.h>
-#include <linux/mfd/pcf50633/adc.h>
-#include <linux/mfd/pcf50633/gpio.h>
-
struct pcf50633;
+#define PCF50633_NUM_REGULATORS 11
+
struct pcf50633_platform_data {
struct regulator_init_data reg_init_data[PCF50633_NUM_REGULATORS];
@@ -41,16 +36,21 @@ struct pcf50633_platform_data {
void (*force_shutdown)(struct pcf50633 *);
u8 resumers[5];
+};
- /* Runtime data - filled by driver afer probe */
+struct pcf50633_subdev_pdata {
struct pcf50633 *pcf;
};
struct pcf50633_irq {
- void (*handler)(struct pcf50633 *, int, void *);
+ void (*handler) (int, void *);
void *data;
};
+int pcf50633_register_irq(struct pcf50633 *pcf, int irq,
+ void (*handler) (int, void *), void *data);
+int pcf50633_free_irq(struct pcf50633 *pcf, int irq);
+
int pcf50633_irq_mask(struct pcf50633 *pcf, int irq);
int pcf50633_irq_unmask(struct pcf50633 *pcf, int irq);
int pcf50633_irq_mask_get(struct pcf50633 *pcf, int irq);
@@ -68,20 +68,20 @@ int pcf50633_reg_clear_bits(struct pcf50633 *pcf, u8 reg, u8 bits);
/* Interrupt registers */
#define PCF50633_REG_INT1 0x02
-#define PCF50633_REG_INT2 0x03
-#define PCF50633_REG_INT3 0x04
-#define PCF50633_REG_INT4 0x05
-#define PCF50633_REG_INT5 0x06
+#define PCF50633_REG_INT2 0x03
+#define PCF50633_REG_INT3 0x04
+#define PCF50633_REG_INT4 0x05
+#define PCF50633_REG_INT5 0x06
#define PCF50633_REG_INT1M 0x07
-#define PCF50633_REG_INT2M 0x08
-#define PCF50633_REG_INT3M 0x09
-#define PCF50633_REG_INT4M 0x0a
-#define PCF50633_REG_INT5M 0x0b
+#define PCF50633_REG_INT2M 0x08
+#define PCF50633_REG_INT3M 0x09
+#define PCF50633_REG_INT4M 0x0a
+#define PCF50633_REG_INT5M 0x0b
enum {
/* Chip IRQs */
- PCF50633_IRQ_ADPINS = 0,
+ PCF50633_IRQ_ADPINS,
PCF50633_IRQ_ADPREM,
PCF50633_IRQ_USBINS,
PCF50633_IRQ_USBREM,
@@ -144,11 +144,11 @@ struct pcf50633 {
int onkey1s_held;
- struct pcf50633_pmic pmic;
- struct pcf50633_input input;
- struct pcf50633_mbc mbc;
- struct pcf50633_rtc rtc;
- struct pcf50633_adc adc;
+ struct platform_device *rtc_pdev;
+ struct platform_device *mbc_pdev;
+ struct platform_device *adc_pdev;
+ struct platform_device *input_pdev;
+ struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS];
};
enum pcf50633_reg_int1 {
@@ -209,5 +209,11 @@ enum pcf50633_reg_int5 {
#define PCF50633_REG_OOCSHDWN 0x0c
#define PCF50633_OOCSHDWN_GOSTDBY 0x01
+/* LED registers */
+#define PCF50633_REG_LEDOUT 0x28
+#define PCF50633_REG_LEDENA 0x29
+#define PCF50633_REG_LEDCTL 0x2a
+#define PCF50633_REG_LEDDIM 0x2b
+
#endif
diff --git a/include/linux/mfd/pcf50633/gpio.h b/include/linux/mfd/pcf50633/gpio.h
index 6ba3951c54d..a42b845efc5 100644
--- a/include/linux/mfd/pcf50633/gpio.h
+++ b/include/linux/mfd/pcf50633/gpio.h
@@ -13,16 +13,20 @@
#ifndef __LINUX_MFD_PCF50633_GPIO_H
#define __LINUX_MFD_PCF50633_GPIO_H
-#define PCF50633_GPIO1 1
-#define PCF50633_GPIO2 2
-#define PCF50633_GPIO3 3
-#define PCF50633_GPO 4
+#include <linux/mfd/pcf50633/core.h>
+
+#define PCF50633_GPIO1 1
+#define PCF50633_GPIO2 2
+#define PCF50633_GPIO3 3
+#define PCF50633_GPO 4
#define PCF50633_REG_GPIO1CFG 0x14
#define PCF50633_REG_GPIO2CFG 0x15
#define PCF50633_REG_GPIO3CFG 0x16
#define PCF50633_REG_GPOCFG 0x17
+#define PCF50633_GPOCFG_GPOSEL_MASK 0x07
+
enum pcf50633_reg_gpocfg {
PCF50633_GPOCFG_GPOSEL_0 = 0x00,
PCF50633_GPOCFG_GPOSEL_LED_NFET = 0x01,
@@ -34,17 +38,14 @@ enum pcf50633_reg_gpocfg {
PCF50633_GPOCFG_GPOSEL_1 = 0x07,
PCF50633_GPOCFG_GPOSEL_INVERSE = 0x08,
};
-#define PCF50633_GPOCFG_GPOSEL_MASK 0x07
-
-struct pcf50633;
-void pcf50633_gpio_set(struct pcf50633 *pcf, int gpio, int on);
-int pcf50633_gpio_get(struct pcf50633 *pcf, int gpio);
+int pcf50633_gpio_set(struct pcf50633 *pcf, int gpio, u8 val);
+u8 pcf50633_gpio_get(struct pcf50633 *pcf, int gpio);
-void pcf50633_gpio_invert_set(struct pcf50633 *, int gpio, int invert);
+int pcf50633_gpio_invert_set(struct pcf50633 *, int gpio, int invert);
int pcf50633_gpio_invert_get(struct pcf50633 *pcf, int gpio);
-void pcf50633_gpio_power_supply_set(struct pcf50633 *,
+int pcf50633_gpio_power_supply_set(struct pcf50633 *,
int gpio, int regulator, int on);
#endif /* __LINUX_MFD_PCF50633_GPIO_H */
diff --git a/include/linux/mfd/pcf50633/input.h b/include/linux/mfd/pcf50633/input.h
deleted file mode 100644
index fd1030269e2..00000000000
--- a/include/linux/mfd/pcf50633/input.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * input.h -- Input driver for NXP PCF50633
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50633_INPUT_H
-#define __LINUX_MFD_PCF50633_INPUT_H
-
-#include <linux/platform_device.h>
-#include <linux/input.h>
-
-#define PCF50633_OOCSTAT_ONKEY 0x01
-#define PCF50633_REG_OOCSTAT 0x12
-#define PCF50633_REG_OOCMODE 0x10
-
-struct pcf50633_input {
- struct input_dev *input_dev;
- struct platform_device *pdev;
-};
-
-#endif
-
diff --git a/include/linux/mfd/pcf50633/led.h b/include/linux/mfd/pcf50633/led.h
deleted file mode 100644
index c84a97e0a58..00000000000
--- a/include/linux/mfd/pcf50633/led.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * led.h -- LED driver for NXP PCF50633
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50633_LED_H
-#define __LINUX_MFD_PCF50633_LED_H
-
-#include <linux/platform_device.h>
-
-#define PCF50633_REG_LEDOUT 0x28
-#define PCF50633_REG_LEDENA 0x29
-#define PCF50633_REG_LEDCTL 0x2a
-#define PCF50633_REG_LEDDIM 0x2b
-
-#endif
-
diff --git a/include/linux/mfd/pcf50633/mbc.h b/include/linux/mfd/pcf50633/mbc.h
index 5ba4aeedc28..fb1c3d7750d 100644
--- a/include/linux/mfd/pcf50633/mbc.h
+++ b/include/linux/mfd/pcf50633/mbc.h
@@ -13,6 +13,7 @@
#ifndef __LINUX_MFD_PCF50633_MBC_H
#define __LINUX_MFD_PCF50633_MBC_H
+#include <linux/mfd/pcf50633/core.h>
#include <linux/platform_device.h>
#define PCF50633_REG_MBCC1 0x43
@@ -115,18 +116,19 @@ enum pcf50633_reg_mbcs3 {
PCF50633_MBCS3_VRES = 0x80, /* 1: Vbat > Vth(RES) */
};
-#define PCF50633_MBCC2_VBATCOND_MASK 0x03
+#define PCF50633_MBCC2_VBATCOND_MASK 0x03
#define PCF50633_MBCC2_VMAX_MASK 0x3c
-struct pcf50633;
+/* Charger status */
+#define PCF50633_MBC_USB_ONLINE 0x01
+#define PCF50633_MBC_USB_ACTIVE 0x02
+#define PCF50633_MBC_ADAPTER_ONLINE 0x04
+#define PCF50633_MBC_ADAPTER_ACTIVE 0x08
-void pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma);
+int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma);
-struct pcf50633_mbc {
- int adapter_active;
- int adapter_online;
- int usb_active;
- int usb_online;
+int pcf50633_mbc_get_status(struct pcf50633 *);
+void pcf50633_mbc_set_status(struct pcf50633 *, int what, int status);
struct power_supply ac;
struct power_supply usb;
diff --git a/include/linux/mfd/pcf50633/pmic.h b/include/linux/mfd/pcf50633/pmic.h
index b33deece2a7..2d3dbe53b23 100644
--- a/include/linux/mfd/pcf50633/pmic.h
+++ b/include/linux/mfd/pcf50633/pmic.h
@@ -1,6 +1,7 @@
#ifndef __LINUX_MFD_PCF50633_PMIC_H
#define __LINUX_MFD_PCF50633_PMIC_H
+#include <linux/mfd/pcf50633/core.h>
#include <linux/platform_device.h>
#define PCF50633_REG_AUTOOUT 0x1a
@@ -11,7 +12,7 @@
#define PCF50633_REG_DOWN1ENA 0x1f
#define PCF50633_REG_DOWN1CTL 0x20
#define PCF50633_REG_DOWN1MXC 0x21
-#define PCF50633_REG_DOWN2OUT 0x22
+#define PCF50633_REG_DOWN2OUT 0x22
#define PCF50633_REG_DOWN2ENA 0x23
#define PCF50633_REG_DOWN2CTL 0x24
#define PCF50633_REG_DOWN2MXC 0x25
@@ -21,16 +22,16 @@
#define PCF50633_REG_LDO1ENA 0x2e
#define PCF50633_REG_LDO2OUT 0x2f
#define PCF50633_REG_LDO2ENA 0x30
-#define PCF50633_REG_LDO3OUT 0x31
-#define PCF50633_REG_LDO3ENA 0x32
-#define PCF50633_REG_LDO4OUT 0x33
-#define PCF50633_REG_LDO4ENA 0x34
-#define PCF50633_REG_LDO5OUT 0x35
-#define PCF50633_REG_LDO5ENA 0x36
-#define PCF50633_REG_LDO6OUT 0x37
-#define PCF50633_REG_LDO6ENA 0x38
-#define PCF50633_REG_HCLDOOUT 0x39
-#define PCF50633_REG_HCLDOENA 0x3a
+#define PCF50633_REG_LDO3OUT 0x31
+#define PCF50633_REG_LDO3ENA 0x32
+#define PCF50633_REG_LDO4OUT 0x33
+#define PCF50633_REG_LDO4ENA 0x34
+#define PCF50633_REG_LDO5OUT 0x35
+#define PCF50633_REG_LDO5ENA 0x36
+#define PCF50633_REG_LDO6OUT 0x37
+#define PCF50633_REG_LDO6ENA 0x38
+#define PCF50633_REG_HCLDOOUT 0x39
+#define PCF50633_REG_HCLDOENA 0x3a
#define PCF50633_REG_HCLDOOVL 0x40
enum pcf50633_regulator_enable {
@@ -49,7 +50,6 @@ enum pcf50633_regulator_phase {
};
#define PCF50633_REGULATOR_ACTPH_MASK 0x30
-
enum pcf50633_regulator_id {
PCF50633_REGULATOR_AUTO,
PCF50633_REGULATOR_DOWN1,
@@ -62,12 +62,6 @@ enum pcf50633_regulator_id {
PCF50633_REGULATOR_LDO6,
PCF50633_REGULATOR_HCLDO,
PCF50633_REGULATOR_MEMLDO,
-
- PCF50633_NUM_REGULATORS
-};
-
-struct pcf50633_pmic {
- struct platform_device *pdev[PCF50633_NUM_REGULATORS];
};
#endif
diff --git a/include/linux/mfd/pcf50633/rtc.h b/include/linux/mfd/pcf50633/rtc.h
deleted file mode 100644
index ce8ad8f5928..00000000000
--- a/include/linux/mfd/pcf50633/rtc.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * rtc.h -- RTC driver for NXP PCF50633
- *
- * (C) 2006-2008 by Openmoko, Inc.
- * All rights reserved.
- *
- * 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.
- */
-
-#ifndef __LINUX_MFD_PCF50633_RTC_H
-#define __LINUX_MFD_PCF50633_RTC_H
-
-#include <linux/rtc.h>
-#include <linux/platform_device.h>
-
-#define PCF50633_REG_RTCSC 0x59 /* Second */
-#define PCF50633_REG_RTCMN 0x5a /* Minute */
-#define PCF50633_REG_RTCHR 0x5b /* Hour */
-#define PCF50633_REG_RTCWD 0x5c /* Weekday */
-#define PCF50633_REG_RTCDT 0x5d /* Day */
-#define PCF50633_REG_RTCMT 0x5e /* Month */
-#define PCF50633_REG_RTCYR 0x5f /* Year */
-#define PCF50633_REG_RTCSCA 0x60 /* Alarm Second */
-#define PCF50633_REG_RTCMNA 0x61 /* Alarm Minute */
-#define PCF50633_REG_RTCHRA 0x62 /* Alarm Hour */
-#define PCF50633_REG_RTCWDA 0x63 /* Alarm Weekday */
-#define PCF50633_REG_RTCDTA 0x64 /* Alarm Day */
-#define PCF50633_REG_RTCMTA 0x65 /* Alarm Month */
-#define PCF50633_REG_RTCYRA 0x66 /* Alarm Year */
-
-struct pcf50633_rtc {
- int alarm_enabled;
- int second_enabled;
-
- struct rtc_device *rtc_dev;
- struct platform_device *pdev;
-};
-
-#endif
-
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index 217bb22ebb8..af95a1d2f3a 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -1,7 +1,7 @@
/*
* audio.h -- Audio Driver for Wolfson WM8350 PMIC
*
- * Copyright 2007 Wolfson Microelectronics PLC
+ * Copyright 2007, 2008 Wolfson Microelectronics PLC
*
* 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
@@ -70,9 +70,9 @@
#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */
#define WM8350_VMID_OFF 0
-#define WM8350_VMID_500K 1
-#define WM8350_VMID_100K 2
-#define WM8350_VMID_10K 3
+#define WM8350_VMID_300K 1
+#define WM8350_VMID_50K 2
+#define WM8350_VMID_5K 3
/*
* R40 (0x28) - Clock Control 1
@@ -591,8 +591,38 @@
#define WM8350_IRQ_CODEC_MICSCD 41
#define WM8350_IRQ_CODEC_MICD 42
+/*
+ * WM8350 Platform data.
+ *
+ * This must be initialised per platform for best audio performance.
+ * Please see WM8350 datasheet for information.
+ */
+struct wm8350_audio_platform_data {
+ int vmid_discharge_msecs; /* VMID --> OFF discharge time */
+ int drain_msecs; /* OFF drain time */
+ int cap_discharge_msecs; /* Cap ON (from OFF) discharge time */
+ int vmid_charge_msecs; /* vmid power up time */
+ u32 vmid_s_curve:2; /* vmid enable s curve speed */
+ u32 dis_out4:2; /* out4 discharge speed */
+ u32 dis_out3:2; /* out3 discharge speed */
+ u32 dis_out2:2; /* out2 discharge speed */
+ u32 dis_out1:2; /* out1 discharge speed */
+ u32 vroi_out4:1; /* out4 tie off */
+ u32 vroi_out3:1; /* out3 tie off */
+ u32 vroi_out2:1; /* out2 tie off */
+ u32 vroi_out1:1; /* out1 tie off */
+ u32 vroi_enable:1; /* enable tie off */
+ u32 codec_current_on:2; /* current level ON */
+ u32 codec_current_standby:2; /* current level STANDBY */
+ u32 codec_current_charge:2; /* codec current @ vmid charge */
+};
+
+struct snd_soc_codec;
+
struct wm8350_codec {
struct platform_device *pdev;
+ struct snd_soc_codec *codec;
+ struct wm8350_audio_platform_data *platform_data;
};
#endif
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h
index 05378864945..54bc5d0fd50 100644
--- a/include/linux/mfd/wm8350/comparator.h
+++ b/include/linux/mfd/wm8350/comparator.h
@@ -164,4 +164,12 @@
#define WM8350_AUXADC_BATT 6
#define WM8350_AUXADC_TEMP 7
+struct wm8350;
+
+/*
+ * AUX ADC Readback
+ */
+int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale,
+ int vref);
+
#endif
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 6ebf97f2a47..980669d50dc 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -29,6 +29,7 @@
*/
#define WM8350_RESET_ID 0x00
#define WM8350_ID 0x01
+#define WM8350_REVISION 0x02
#define WM8350_SYSTEM_CONTROL_1 0x03
#define WM8350_SYSTEM_CONTROL_2 0x04
#define WM8350_SYSTEM_HIBERNATE 0x05
@@ -57,6 +58,10 @@
#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
#define WM8350_GPIO_INT_STATUS_MASK 0x26
#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
+#define WM8350_CHARGER_OVERRIDES 0xE2
+#define WM8350_MISC_OVERRIDES 0xE3
+#define WM8350_COMPARATOR_OVERRIDES 0xE7
+#define WM8350_STATE_MACHINE_STATUS 0xE9
#define WM8350_MAX_REGISTER 0xFF
@@ -77,6 +82,11 @@
#define WM8350_CUST_ID_MASK 0x00FF
/*
+ * R2 (0x02) - Revision
+ */
+#define WM8350_MASK_REV_MASK 0x00FF
+
+/*
* R3 (0x03) - System Control 1
*/
#define WM8350_CHIP_ON 0x8000
@@ -523,6 +533,35 @@
#define WM8350_DC2_STS 0x0002
#define WM8350_DC1_STS 0x0001
+/*
+ * R226 (0xE2) - Charger status
+ */
+#define WM8350_CHG_BATT_HOT_OVRDE 0x8000
+#define WM8350_CHG_BATT_COLD_OVRDE 0x4000
+
+/*
+ * R227 (0xE3) - Misc Overrides
+ */
+#define WM8350_USB_LIMIT_OVRDE 0x0400
+
+/*
+ * R227 (0xE7) - Comparator Overrides
+ */
+#define WM8350_USB_FB_OVRDE 0x8000
+#define WM8350_WALL_FB_OVRDE 0x4000
+#define WM8350_BATT_FB_OVRDE 0x2000
+
+
+/*
+ * R233 (0xE9) - State Machinine Status
+ */
+#define WM8350_USB_SM_MASK 0x0700
+#define WM8350_USB_SM_SHIFT 8
+
+#define WM8350_USB_SM_100_SLV 1
+#define WM8350_USB_SM_500_SLV 5
+#define WM8350_USB_SM_STDBY_SLV 7
+
/* WM8350 wake up conditions */
#define WM8350_IRQ_WKUP_OFF_STATE 43
#define WM8350_IRQ_WKUP_HIB_STATE 44
@@ -536,6 +575,7 @@
#define WM8350_REV_E 0x4
#define WM8350_REV_F 0x5
#define WM8350_REV_G 0x6
+#define WM8350_REV_H 0x7
#define WM8350_NUM_IRQ 63
@@ -549,6 +589,14 @@ extern const u16 wm8350_mode0_defaults[];
extern const u16 wm8350_mode1_defaults[];
extern const u16 wm8350_mode2_defaults[];
extern const u16 wm8350_mode3_defaults[];
+extern const u16 wm8351_mode0_defaults[];
+extern const u16 wm8351_mode1_defaults[];
+extern const u16 wm8351_mode2_defaults[];
+extern const u16 wm8351_mode3_defaults[];
+extern const u16 wm8352_mode0_defaults[];
+extern const u16 wm8352_mode1_defaults[];
+extern const u16 wm8352_mode2_defaults[];
+extern const u16 wm8352_mode3_defaults[];
struct wm8350;
@@ -558,8 +606,6 @@ struct wm8350_irq {
};
struct wm8350 {
- int rev; /* chip revision */
-
struct device *dev;
/* device IO */
@@ -572,6 +618,8 @@ struct wm8350 {
void *src);
u16 *reg_cache;
+ struct mutex auxadc_mutex;
+
/* Interrupt handling */
struct work_struct irq_work;
struct mutex irq_mutex; /* IRQ table mutex */
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h
index 69b69e07f62..be3264e286e 100644
--- a/include/linux/mfd/wm8350/pmic.h
+++ b/include/linux/mfd/wm8350/pmic.h
@@ -13,6 +13,10 @@
#ifndef __LINUX_MFD_WM8350_PMIC_H
#define __LINUX_MFD_WM8350_PMIC_H
+#include <linux/platform_device.h>
+#include <linux/leds.h>
+#include <linux/regulator/machine.h>
+
/*
* Register values.
*/
@@ -700,7 +704,38 @@ struct wm8350;
struct platform_device;
struct regulator_init_data;
+/*
+ * WM8350 LED platform data
+ */
+struct wm8350_led_platform_data {
+ const char *name;
+ const char *default_trigger;
+ int max_uA;
+};
+
+struct wm8350_led {
+ struct platform_device *pdev;
+ struct mutex mutex;
+ struct work_struct work;
+ spinlock_t value_lock;
+ enum led_brightness value;
+ struct led_classdev cdev;
+ int max_uA_index;
+ int enabled;
+
+ struct regulator *isink;
+ struct regulator_consumer_supply isink_consumer;
+ struct regulator_init_data isink_init;
+ struct regulator *dcdc;
+ struct regulator_consumer_supply dcdc_consumer;
+ struct regulator_init_data dcdc_init;
+};
+
struct wm8350_pmic {
+ /* Number of regulators of each type on this device */
+ int max_dcdc;
+ int max_isink;
+
/* ISINK to DCDC mapping */
int isink_A_dcdc;
int isink_B_dcdc;
@@ -713,10 +748,15 @@ struct wm8350_pmic {
/* regulator devices */
struct platform_device *pdev[NUM_WM8350_REGULATORS];
+
+ /* LED devices */
+ struct wm8350_led led[2];
};
int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
struct regulator_init_data *initdata);
+int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
+ struct wm8350_led_platform_data *pdata);
/*
* Additional DCDC control not supported via regulator API
diff --git a/include/linux/mfd/wm8350/rtc.h b/include/linux/mfd/wm8350/rtc.h
index dfda69e9f44..24add2bef6c 100644
--- a/include/linux/mfd/wm8350/rtc.h
+++ b/include/linux/mfd/wm8350/rtc.h
@@ -261,6 +261,8 @@
struct wm8350_rtc {
struct platform_device *pdev;
+ struct rtc_device *rtc;
+ int alarm_enabled; /* used over suspend/resume */
};
#endif
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index 1c8f3cde79b..2b9479310bb 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -13,7 +13,8 @@
#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
#define __LINUX_MFD_WM8350_SUPPLY_H_
-#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/power_supply.h>
/*
* Charger registers
@@ -104,8 +105,30 @@
#define WM8350_IRQ_EXT_WALL_FB 37
#define WM8350_IRQ_EXT_BAT_FB 38
+/*
+ * Policy to control charger state machine.
+ */
+struct wm8350_charger_policy {
+
+ /* charger state machine policy - set in machine driver */
+ int eoc_mA; /* end of charge current (mA) */
+ int charge_mV; /* charge voltage */
+ int fast_limit_mA; /* fast charge current limit */
+ int fast_limit_USB_mA; /* USB fast charge current limit */
+ int charge_timeout; /* charge timeout (mins) */
+ int trickle_start_mV; /* trickle charge starts at mV */
+ int trickle_charge_mA; /* trickle charge current */
+ int trickle_charge_USB_mA; /* USB trickle charge current */
+};
+
struct wm8350_power {
struct platform_device *pdev;
+ struct power_supply battery;
+ struct power_supply usb;
+ struct power_supply ac;
+ struct wm8350_charger_policy *policy;
+
+ int rev_g_coeff;
};
#endif