diff options
Diffstat (limited to 'include/linux/mfd/pcf50633')
-rw-r--r-- | include/linux/mfd/pcf50633/adc.h | 94 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/core.h | 52 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/gpio.h | 23 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/input.h | 29 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/led.h | 24 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/mbc.h | 18 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/pmic.h | 30 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/rtc.h | 43 |
8 files changed, 102 insertions, 211 deletions
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 - |