Venu Byravarasu | 3c33be06 | 2012-03-16 11:10:19 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Core driver interface for TI TPS65090 PMIC family |
| 3 | * |
| 4 | * Copyright (C) 2012 NVIDIA Corporation |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 14 | * more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along |
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef __LINUX_MFD_TPS65090_H |
| 23 | #define __LINUX_MFD_TPS65090_H |
| 24 | |
Axel Lin | 06c4998 | 2012-04-17 17:08:56 +0800 | [diff] [blame] | 25 | #include <linux/irq.h> |
| 26 | |
Laxman Dewangan | 24282a1 | 2012-10-09 15:18:59 +0530 | [diff] [blame] | 27 | /* TPS65090 Regulator ID */ |
| 28 | enum { |
Laxman Dewangan | 8620ca9 | 2012-10-09 15:19:00 +0530 | [diff] [blame] | 29 | TPS65090_REGULATOR_DCDC1, |
| 30 | TPS65090_REGULATOR_DCDC2, |
| 31 | TPS65090_REGULATOR_DCDC3, |
| 32 | TPS65090_REGULATOR_FET1, |
| 33 | TPS65090_REGULATOR_FET2, |
| 34 | TPS65090_REGULATOR_FET3, |
| 35 | TPS65090_REGULATOR_FET4, |
| 36 | TPS65090_REGULATOR_FET5, |
| 37 | TPS65090_REGULATOR_FET6, |
| 38 | TPS65090_REGULATOR_FET7, |
Laxman Dewangan | 3a81ef8 | 2012-10-09 15:19:01 +0530 | [diff] [blame] | 39 | TPS65090_REGULATOR_LDO1, |
| 40 | TPS65090_REGULATOR_LDO2, |
Laxman Dewangan | 24282a1 | 2012-10-09 15:18:59 +0530 | [diff] [blame] | 41 | |
| 42 | /* Last entry for maximum ID */ |
Laxman Dewangan | 8620ca9 | 2012-10-09 15:19:00 +0530 | [diff] [blame] | 43 | TPS65090_REGULATOR_MAX, |
Laxman Dewangan | 24282a1 | 2012-10-09 15:18:59 +0530 | [diff] [blame] | 44 | }; |
| 45 | |
Axel Lin | 06c4998 | 2012-04-17 17:08:56 +0800 | [diff] [blame] | 46 | struct tps65090 { |
| 47 | struct mutex lock; |
| 48 | struct device *dev; |
| 49 | struct i2c_client *client; |
| 50 | struct regmap *rmap; |
| 51 | struct irq_chip irq_chip; |
| 52 | struct mutex irq_lock; |
| 53 | int irq_base; |
| 54 | unsigned int id; |
| 55 | }; |
| 56 | |
Venu Byravarasu | 3c33be06 | 2012-03-16 11:10:19 +0530 | [diff] [blame] | 57 | struct tps65090_subdev_info { |
| 58 | int id; |
| 59 | const char *name; |
| 60 | void *platform_data; |
| 61 | }; |
| 62 | |
Laxman Dewangan | 24282a1 | 2012-10-09 15:18:59 +0530 | [diff] [blame] | 63 | /* |
| 64 | * struct tps65090_regulator_plat_data |
| 65 | * |
| 66 | * @reg_init_data: The regulator init data. |
Laxman Dewangan | f329b17 | 2012-10-09 15:19:02 +0530 | [diff] [blame^] | 67 | * @enable_ext_control: Enable extrenal control or not. Only available for |
| 68 | * DCDC1, DCDC2 and DCDC3. |
| 69 | * @gpio: Gpio number if external control is enabled and controlled through |
| 70 | * gpio. |
Laxman Dewangan | 24282a1 | 2012-10-09 15:18:59 +0530 | [diff] [blame] | 71 | */ |
Laxman Dewangan | 24282a1 | 2012-10-09 15:18:59 +0530 | [diff] [blame] | 72 | struct tps65090_regulator_plat_data { |
| 73 | struct regulator_init_data *reg_init_data; |
Laxman Dewangan | f329b17 | 2012-10-09 15:19:02 +0530 | [diff] [blame^] | 74 | bool enable_ext_control; |
| 75 | int gpio; |
Laxman Dewangan | 24282a1 | 2012-10-09 15:18:59 +0530 | [diff] [blame] | 76 | }; |
| 77 | |
Venu Byravarasu | 3c33be06 | 2012-03-16 11:10:19 +0530 | [diff] [blame] | 78 | struct tps65090_platform_data { |
| 79 | int irq_base; |
| 80 | int num_subdevs; |
| 81 | struct tps65090_subdev_info *subdevs; |
Laxman Dewangan | 8620ca9 | 2012-10-09 15:19:00 +0530 | [diff] [blame] | 82 | struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX]; |
Venu Byravarasu | 3c33be06 | 2012-03-16 11:10:19 +0530 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | /* |
| 86 | * NOTE: the functions below are not intended for use outside |
| 87 | * of the TPS65090 sub-device drivers |
| 88 | */ |
| 89 | extern int tps65090_write(struct device *dev, int reg, uint8_t val); |
| 90 | extern int tps65090_read(struct device *dev, int reg, uint8_t *val); |
| 91 | extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num); |
| 92 | extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num); |
| 93 | |
| 94 | #endif /*__LINUX_MFD_TPS65090_H */ |