diff options
author | Philippe Langlais <philippe.langlais@linaro.org> | 2011-05-11 14:35:30 +0200 |
---|---|---|
committer | Henrik Aberg <henrik.aberg@stericsson.com> | 2011-05-18 09:40:16 +0200 |
commit | 7a00b4bfab344fa53dc5330cc9b9cca2943829a7 (patch) | |
tree | 84175215f384555c294e05d2b6073ab5ec8a0c1e | |
parent | c8096b6c3ad7088a0a4452b1c6b81426fdf51cd2 (diff) |
U5500 : Update of ab5500 plaftorm data structure
Bring back AB5500 initial data setting structure in petra platform
data.Required by CG2900 chip driver
ST-Ericsson Linux next: NA
ST-Ericsson ID: 257121
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I7626d10611a32ea18619e47f21ed7a53016592be
Signed-off-by: Bibek Basu <bibek.basu@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/22763
Reviewed-by: Lukasz RYMANOWSKI <lukasz.rymanowski@stericsson.com>
Reviewed-by: QATOOLS
Reviewed-by: QATEST
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Conflicts:
drivers/mfd/ab5500-core.c
-rwxr-xr-x | drivers/mfd/ab5500-core.c | 41 | ||||
-rw-r--r-- | include/linux/mfd/abx500/ab5500.h | 4 |
2 files changed, 43 insertions, 2 deletions
diff --git a/drivers/mfd/ab5500-core.c b/drivers/mfd/ab5500-core.c index 2fc1cf1b101..6f850853ce7 100755 --- a/drivers/mfd/ab5500-core.c +++ b/drivers/mfd/ab5500-core.c @@ -2171,6 +2171,40 @@ static inline void ab5500_remove_debugfs(void) } #endif +/* + * ab5500_setup : Basic set-up, datastructure creation/destruction + * and I2C interface.This sets up a default config + * in the AB5500 chip so that it will work as expected. + * @ab : Pointer to ab5500 structure + * @settings : Pointer to struct abx500_init_settings + * @size : Size of init data + */ +static int __init ab5500_setup(struct ab5500 *ab, + struct abx500_init_settings *settings, unsigned int size) +{ + int err = 0; + int i; + + for (i = 0; i < size; i++) { + err = mask_and_set_register_interruptible(ab, + settings[i].bank, + settings[i].reg, + 0xFF, settings[i].setting); + if (err) + goto exit_no_setup; + + /* If event mask register update the event mask in ab5500 */ + if ((settings[i].bank == AB5500_BANK_IT) && + (AB5500_MASK_BASE <= settings[i].reg) && + (settings[i].reg <= AB5500_MASK_END)) { + ab->mask[settings[i].reg - AB5500_MASK_BASE] = + settings[i].setting; + } + } +exit_no_setup: + return err; +} + static void ab5500_irq_mask(struct irq_data *data) { struct ab5500 *ab = irq_data_get_irq_chip_data(data); @@ -2394,7 +2428,12 @@ static int __init ab5500_probe(struct platform_device *pdev) dev_err(&pdev->dev, "ab5500_mfd_add_device error\n"); goto exit_no_irq; } - + err = ab5500_setup(ab, ab5500_plf_data->init_settings, + ab5500_plf_data->init_settings_sz); + if (err) { + dev_err(&pdev->dev, "ab5500_setup error\n"); + goto exit_no_irq; + } ab5500_setup_debugfs(ab); return 0; diff --git a/include/linux/mfd/abx500/ab5500.h b/include/linux/mfd/abx500/ab5500.h index 1b2b150072a..58db5206fa9 100644 --- a/include/linux/mfd/abx500/ab5500.h +++ b/include/linux/mfd/abx500/ab5500.h @@ -134,9 +134,11 @@ struct ab5500 { struct ab5500_regulator_platform_data; struct ab5500_platform_data { struct {unsigned int base; unsigned int count; } irq; - bool pm_power_off; void *dev_data[AB5500_NUM_DEVICES]; size_t dev_data_sz[AB5500_NUM_DEVICES]; + struct abx500_init_settings *init_settings; + unsigned int init_settings_sz; + bool pm_power_off; struct ab5500_regulator_platform_data *regulator; }; |