diff options
author | Gabriel M. Beddingfield <gabrbedd@ti.com> | 2012-03-01 15:18:49 -0600 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 12:58:09 +0200 |
commit | 0d71015befd1f4eab792b39dae0a8eba19b7d965 (patch) | |
tree | 0db1b8fef98e19fae37f3e17738c311ccf8d45fe | |
parent | 4a70ab3a931c263a510590cde74816066dddfbb7 (diff) | |
download | kernel_samsung_tuna-0d71015befd1f4eab792b39dae0a8eba19b7d965.zip kernel_samsung_tuna-0d71015befd1f4eab792b39dae0a8eba19b7d965.tar.gz kernel_samsung_tuna-0d71015befd1f4eab792b39dae0a8eba19b7d965.tar.bz2 |
MFD: twl6040-codec: Add register supply query APIs
Add a new set of APIs to TWL6040 MFD to query the supply of its
registers: twl6040_get_reg_supply(), twl6040_reg_is_vdd() and
twl6040_reg_is_vio().
Change-Id: Ic320ad7759c66d705f6025361cd6a296ac695dd9
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Chris Kelly <c-kelly@ti.com>
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
-rw-r--r-- | drivers/mfd/twl6040-codec.c | 43 | ||||
-rw-r--r-- | include/linux/mfd/twl6040-codec.h | 3 |
2 files changed, 46 insertions, 0 deletions
diff --git a/drivers/mfd/twl6040-codec.c b/drivers/mfd/twl6040-codec.c index 7b2e94d..31c484b 100644 --- a/drivers/mfd/twl6040-codec.c +++ b/drivers/mfd/twl6040-codec.c @@ -34,6 +34,49 @@ #include <linux/mfd/core.h> #include <linux/mfd/twl6040-codec.h> +int twl6040_get_reg_supply(unsigned int reg) +{ + if (reg > TWL6040_CACHEREGNUM) + return -EINVAL; + + switch (reg) { + case TWL6040_REG_ASICID: + case TWL6040_REG_ASICREV: + case TWL6040_REG_INTID: + case TWL6040_REG_INTMR: + case TWL6040_REG_NCPCTL: + case TWL6040_REG_LDOCTL: + case TWL6040_REG_AMICBCTL: + case TWL6040_REG_DMICBCTL: + case TWL6040_REG_HKCTL1: + case TWL6040_REG_HKCTL2: + case TWL6040_REG_GPOCTL: + case TWL6040_REG_TRIM1: + case TWL6040_REG_TRIM2: + case TWL6040_REG_TRIM3: + case TWL6040_REG_HSOTRIM: + case TWL6040_REG_HFOTRIM: + case TWL6040_REG_ACCCTL: + case TWL6040_REG_STATUS: + return TWL6040_VIO_SUPPLY; + default: + return TWL6040_VDD_SUPPLY; + } +} +EXPORT_SYMBOL(twl6040_get_reg_supply); + +int twl6040_reg_is_vdd(unsigned int reg) +{ + return twl6040_get_reg_supply(reg) == TWL6040_VDD_SUPPLY; +} +EXPORT_SYMBOL(twl6040_reg_is_vdd); + +int twl6040_reg_is_vio(unsigned int reg) +{ + return twl6040_get_reg_supply(reg) == TWL6040_VIO_SUPPLY; +} +EXPORT_SYMBOL(twl6040_reg_is_vio); + static inline int twl6040_cache_read(struct twl6040 *twl6040, unsigned int reg) { return twl6040->cache[reg]; diff --git a/include/linux/mfd/twl6040-codec.h b/include/linux/mfd/twl6040-codec.h index 1a70ffe..38ec8cd 100644 --- a/include/linux/mfd/twl6040-codec.h +++ b/include/linux/mfd/twl6040-codec.h @@ -284,6 +284,9 @@ enum twl6040_pll_id twl6040_get_pll(struct twl6040 *twl6040); unsigned int twl6040_get_sysclk(struct twl6040 *twl6040); int twl6040_get_icrev(struct twl6040 *twl6040); void twl6040_report_event(struct twl6040 *twl6040, int event); +int twl6040_get_reg_supply(unsigned int reg); +int twl6040_reg_is_vdd(unsigned int reg); +int twl6040_reg_is_vio(unsigned int reg); int twl6040_irq_init(struct twl6040 *twl6040); void twl6040_irq_exit(struct twl6040 *twl6040); |