From 5d4e9bd79a5ab5bd4695d3becaa71da447a76a94 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 16 Jan 2013 14:53:50 +0100 Subject: mfd: twl-core: Clean up module id lookup and definitions Use enums for all module definitions: twl_module_ids for common functionality among twl4030/twl6030 twl4030_module_ids for twl4030 specific ids twl6030_module_ids for twl6030 specific ids In this way the list can be managed easier when new functionality going to be implemented. Signed-off-by: Peter Ujfalusi Signed-off-by: Samuel Ortiz --- include/linux/i2c/twl.h | 66 ++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 31 deletions(-) (limited to 'include/linux/i2c') diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 1ff54b114efc..72adc8807912 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -39,51 +39,55 @@ * address each module uses within a given i2c slave. */ +/* Module IDs for similar functionalities found in twl4030/twl6030 */ +enum twl_module_ids { + TWL_MODULE_USB, + TWL_MODULE_PIH, + TWL_MODULE_MAIN_CHARGE, + TWL_MODULE_PM_MASTER, + TWL_MODULE_PM_RECEIVER, + + TWL_MODULE_RTC, + TWL_MODULE_PWM, + TWL_MODULE_LED, + TWL_MODULE_SECURED_REG, + + TWL_MODULE_LAST, +}; + +/* Modules only available in twl4030 series */ enum twl4030_module_ids { - TWL4030_MODULE_USB = 0, /* Slave 0 (i2c address 0x48) */ - TWL4030_MODULE_AUDIO_VOICE, /* Slave 1 (i2c address 0x49) */ + TWL4030_MODULE_AUDIO_VOICE = TWL_MODULE_LAST, TWL4030_MODULE_GPIO, TWL4030_MODULE_INTBR, - TWL4030_MODULE_PIH, - TWL4030_MODULE_TEST, - TWL4030_MODULE_KEYPAD, /* Slave 2 (i2c address 0x4a) */ + TWL4030_MODULE_KEYPAD, + TWL4030_MODULE_MADC, TWL4030_MODULE_INTERRUPTS, - TWL4030_MODULE_LED, - - TWL4030_MODULE_MAIN_CHARGE, TWL4030_MODULE_PRECHARGE, - TWL4030_MODULE_PWM0, - TWL4030_MODULE_PWM1, - TWL4030_MODULE_PWMA, + TWL4030_MODULE_BACKUP, + TWL4030_MODULE_INT, - TWL4030_MODULE_PWMB, TWL5031_MODULE_ACCESSORY, TWL5031_MODULE_INTERRUPTS, - TWL4030_MODULE_BACKUP, /* Slave 3 (i2c address 0x4b) */ - TWL4030_MODULE_INT, - TWL4030_MODULE_PM_MASTER, - TWL4030_MODULE_PM_RECEIVER, - TWL4030_MODULE_RTC, - TWL4030_MODULE_SECURED_REG, TWL4030_MODULE_LAST, }; -/* Similar functionalities implemented in TWL4030/6030 */ -#define TWL_MODULE_USB TWL4030_MODULE_USB -#define TWL_MODULE_PIH TWL4030_MODULE_PIH -#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE -#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER -#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER -#define TWL_MODULE_RTC TWL4030_MODULE_RTC -#define TWL_MODULE_PWM TWL4030_MODULE_PWM0 -#define TWL_MODULE_LED TWL4030_MODULE_LED - -#define TWL6030_MODULE_ID0 13 -#define TWL6030_MODULE_ID1 14 -#define TWL6030_MODULE_ID2 15 +/* Modules only available in twl6030 series */ +enum twl6030_module_ids { + TWL6030_MODULE_ID0 = TWL_MODULE_LAST, + TWL6030_MODULE_ID1, + TWL6030_MODULE_ID2, + TWL6030_MODULE_GPADC, + TWL6030_MODULE_GASGAUGE, + + TWL6030_MODULE_LAST, +}; + +/* Until the clients has been converted to use TWL_MODULE_LED */ +#define TWL4030_MODULE_LED TWL_MODULE_LED #define GPIO_INTR_OFFSET 0 #define KEYPAD_INTR_OFFSET 1 -- cgit v1.2.3