Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame^] | 1 | /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | #ifndef __PMIC8901_H__ |
| 14 | #define __PMIC8901_H__ |
| 15 | /* |
| 16 | * Qualcomm PMIC8901 driver header file |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | #include <linux/irq.h> |
| 21 | #include <linux/mfd/core.h> |
| 22 | |
| 23 | /* PM8901 interrupt numbers */ |
| 24 | |
| 25 | #define PM8901_MPPS 4 |
| 26 | |
| 27 | #define PM8901_IRQ_BLOCK_BIT(block, bit) ((block) * 8 + (bit)) |
| 28 | |
| 29 | /* MPPs [0,N) */ |
| 30 | #define PM8901_MPP_IRQ(base, mpp) ((base) + \ |
| 31 | PM8901_IRQ_BLOCK_BIT(6, (mpp))) |
| 32 | |
| 33 | #define PM8901_TEMP_ALARM_IRQ(base) ((base) + PM8901_IRQ_BLOCK_BIT(6, 4)) |
| 34 | #define PM8901_TEMP_HI_ALARM_IRQ(base) ((base) + PM8901_IRQ_BLOCK_BIT(6, 5)) |
| 35 | |
| 36 | struct pm8901_chip; |
| 37 | |
| 38 | struct pm8901_platform_data { |
| 39 | /* This table is only needed for misc interrupts. */ |
| 40 | int irq_base; |
| 41 | |
| 42 | int num_subdevs; |
| 43 | struct mfd_cell *sub_devices; |
| 44 | int irq_trigger_flags; |
| 45 | }; |
| 46 | |
| 47 | struct pm8901_gpio_platform_data { |
| 48 | int gpio_base; |
| 49 | int irq_base; |
| 50 | }; |
| 51 | |
| 52 | /* chip revision */ |
| 53 | #define PM_8901_REV_1p0 0xF1 |
| 54 | #define PM_8901_REV_1p1 0xF2 |
| 55 | #define PM_8901_REV_2p0 0xF3 |
| 56 | |
| 57 | int pm8901_read(struct pm8901_chip *pm_chip, u16 addr, u8 *values, |
| 58 | unsigned int len); |
| 59 | int pm8901_write(struct pm8901_chip *pm_chip, u16 addr, u8 *values, |
| 60 | unsigned int len); |
| 61 | |
| 62 | int pm8901_rev(struct pm8901_chip *pm_chip); |
| 63 | |
| 64 | int pm8901_irq_get_rt_status(struct pm8901_chip *pm_chip, int irq); |
| 65 | |
| 66 | #ifdef CONFIG_PMIC8901 |
| 67 | int pm8901_reset_pwr_off(int reset); |
| 68 | #else |
| 69 | static inline int pm8901_reset_pwr_off(int reset) { return 0; } |
| 70 | #endif |
| 71 | |
| 72 | #endif /* __PMIC8901_H__ */ |