diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
| commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
| tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/mfd | |
| parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) | |
Diffstat (limited to 'drivers/mfd')
| -rw-r--r-- | drivers/mfd/ab3550-core.c | 1380 | ||||
| -rw-r--r-- | drivers/mfd/ab8500-i2c.c | 104 | ||||
| -rw-r--r-- | drivers/mfd/db5500-prcmu-regs.h | 115 | ||||
| -rw-r--r-- | drivers/mfd/db5500-prcmu.c | 448 | ||||
| -rw-r--r-- | drivers/mfd/db8500-prcmu-regs.h | 166 | ||||
| -rw-r--r-- | drivers/mfd/max77663-core.c | 1445 | ||||
| -rw-r--r-- | drivers/mfd/max8907c-irq.c | 425 | ||||
| -rw-r--r-- | drivers/mfd/max8907c.c | 376 | ||||
| -rw-r--r-- | drivers/mfd/ricoh583.c | 1213 | ||||
| -rw-r--r-- | drivers/mfd/tps65910-irq.c | 232 | ||||
| -rw-r--r-- | drivers/mfd/tps6591x.c | 930 | ||||
| -rw-r--r-- | drivers/mfd/tps8003x-gpadc.c | 650 | ||||
| -rw-r--r-- | drivers/mfd/twl6030-pwm.c | 165 | ||||
| -rw-r--r-- | drivers/mfd/twl6040-core.c | 620 | ||||
| -rw-r--r-- | drivers/mfd/twl6040-irq.c | 191 |
15 files changed, 8460 insertions, 0 deletions
diff --git a/drivers/mfd/ab3550-core.c b/drivers/mfd/ab3550-core.c new file mode 100644 index 00000000000..56ba1943c91 --- /dev/null +++ b/drivers/mfd/ab3550-core.c | |||
| @@ -0,0 +1,1380 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2007-2010 ST-Ericsson | ||
| 3 | * License terms: GNU General Public License (GPL) version 2 | ||
| 4 | * Low-level core for exclusive access to the AB3550 IC on the I2C bus | ||
| 5 | * and some basic chip-configuration. | ||
| 6 | * Author: Bengt Jonsson <bengt.g.jonsson@stericsson.com> | ||
| 7 | * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> | ||
| 8 | * Author: Mattias Wallin <mattias.wallin@stericsson.com> | ||
| 9 | * Author: Rickard Andersson <rickard.andersson@stericsson.com> | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/i2c.h> | ||
| 13 | #include <linux/mutex.h> | ||
| 14 | #include <linux/err.h> | ||
| 15 | #include <linux/platform_device.h> | ||
| 16 | #include <linux/slab.h> | ||
| 17 | #include <linux/device.h> | ||
| 18 | #include <linux/irq.h> | ||
| 19 | #include <linux/interrupt.h> | ||
| 20 | #include <linux/random.h> | ||
| 21 | #include <linux/workqueue.h> | ||
| 22 | #include <linux/debugfs.h> | ||
| 23 | #include <linux/seq_file.h> | ||
| 24 | #include <linux/uaccess.h> | ||
| 25 | #include <linux/mfd/abx500.h> | ||
| 26 | #include <linux/list.h> | ||
| 27 | #include <linux/bitops.h> | ||
| 28 | #include <linux/spinlock.h> | ||
| 29 | #include <linux/mfd/core.h> | ||
| 30 | |||
| 31 | #define AB3550_NAME_STRING "ab3550" | ||
| 32 | #define AB3550_ID_FORMAT_STRING "AB3550 %s" | ||
| 33 | #define AB3550_NUM_BANKS 2 | ||
| 34 | #define AB3550_NUM_EVENT_REG 5 | ||
| 35 | |||
| 36 | /* These are the only registers inside AB3550 used in this main file */ | ||
| 37 | |||
| 38 | /* Chip ID register */ | ||
| 39 | #define AB3550_CID_REG 0x20 | ||
| 40 | |||
| 41 | /* Interrupt event registers */ | ||
| 42 | #define AB3550_EVENT_BANK 0 | ||
| 43 | #define AB3550_EVENT_REG 0x22 | ||
| 44 | |||
| 45 | /* Read/write operation values. */ | ||
| 46 | #define AB3550_PERM_RD (0x01) | ||
| 47 | #define AB3550_PERM_WR (0x02) | ||
| 48 | |||
| 49 | /* Read/write permissions. */ | ||
| 50 | #define AB3550_PERM_RO (AB3550_PERM_RD) | ||
| 51 | #define AB3550_PERM_RW (AB3550_PERM_RD | AB3550_PERM_WR) | ||
| 52 | |||
| 53 | /** | ||
| 54 | * struct ab3550 | ||
| 55 | * @access_mutex: lock out concurrent accesses to the AB registers | ||
| 56 | * @i2c_client: I2C client for this chip | ||
| 57 | * @chip_name: name of this chip variant | ||
| 58 | * @chip_id: 8 bit chip ID for this chip variant | ||
| 59 | * @mask_work: a worker for writing to mask registers | ||
| 60 | * @event_lock: a lock to protect the event_mask | ||
| 61 | * @event_mask: a local copy of the mask event registers | ||
| 62 | * @startup_events: a copy of the first reading of the event registers | ||
| 63 | * @startup_events_read: whether the first events have been read | ||
| 64 | */ | ||
| 65 | struct ab3550 { | ||
| 66 | struct mutex access_mutex; | ||
| 67 | struct i2c_client *i2c_client[AB3550_NUM_BANKS]; | ||
| 68 | char chip_name[32]; | ||
| 69 | u8 chip_id; | ||
| 70 | struct work_struct mask_work; | ||
| 71 | spinlock_t event_lock; | ||
| 72 | u8 event_mask[AB3550_NUM_EVENT_REG]; | ||
| 73 | u8 startup_events[AB3550_NUM_EVENT_REG]; | ||
| 74 | bool startup_events_read; | ||
| 75 | #ifdef CONFIG_DEBUG_FS | ||
| 76 | unsigned int debug_bank; | ||
| 77 | unsigned int debug_address; | ||
| 78 | #endif | ||
| 79 | }; | ||
| 80 | |||
| 81 | /** | ||
| 82 | * struct ab3550_reg_range | ||
| 83 | * @first: the first address of the range | ||
| 84 | * @last: the last address of the range | ||
| 85 | * @perm: access permissions for the range | ||
| 86 | */ | ||
| 87 | struct ab3550_reg_range { | ||
| 88 | u8 first; | ||
| 89 | u8 last; | ||
| 90 | u8 perm; | ||
| 91 | }; | ||
| 92 | |||
| 93 | /** | ||
| 94 | * struct ab3550_reg_ranges | ||
| 95 | * @count: the number of ranges in the list | ||
| 96 | * @range: the list of register ranges | ||
| 97 | */ | ||
| 98 | struct ab3550_reg_ranges { | ||
| 99 | u8 count; | ||
| 100 | const struct ab3550_reg_range *range; | ||
| 101 | }; | ||
| 102 | |||
| 103 | /* | ||
| 104 | * Permissible register ranges for reading and writing per device and bank. | ||
| 105 | * | ||
| 106 | * The ranges must be listed in increasing address order, and no overlaps are | ||
| 107 | * allowed. It is assumed that write permission implies read permission | ||
| 108 | * (i.e. only RO and RW permissions should be used). Ranges with write | ||
| 109 | * permission must not be split up. | ||
| 110 | */ | ||
| 111 | |||
| 112 | #define NO_RANGE {.count = 0, .range = NULL,} | ||
| 113 | |||
| 114 | static struct | ||
| 115 | ab3550_reg_ranges ab3550_reg_ranges[AB3550_NUM_DEVICES][AB3550_NUM_BANKS] = { | ||
| 116 | [AB3550_DEVID_DAC] = { | ||
| 117 | NO_RANGE, | ||
| 118 | { | ||
| 119 | .count = 2, | ||
| 120 | .range = (struct ab3550_reg_range[]) { | ||
| 121 | { | ||
| 122 | .first = 0xb0, | ||
| 123 | .last = 0xba, | ||
| 124 | .perm = AB3550_PERM_RW, | ||
| 125 | }, | ||
| 126 | { | ||
| 127 | .first = 0xbc, | ||
| 128 | .last = 0xc3, | ||
| 129 | .perm = AB3550_PERM_RW, | ||
| 130 | }, | ||
| 131 | }, | ||
| 132 | }, | ||
| 133 | }, | ||
| 134 | [AB3550_DEVID_LEDS] = { | ||
| 135 | NO_RANGE, | ||
| 136 | { | ||
| 137 | .count = 2, | ||
| 138 | .range = (struct ab3550_reg_range[]) { | ||
| 139 | { | ||
| 140 | .first = 0x5a, | ||
| 141 | .last = 0x88, | ||
| 142 | .perm = AB3550_PERM_RW, | ||
| 143 | }, | ||
| 144 | { | ||
| 145 | .first = 0x8a, | ||
| 146 | .last = 0xad, | ||
| 147 | .perm = AB3550_PERM_RW, | ||
| 148 | }, | ||
| 149 | } | ||
| 150 | }, | ||
| 151 | }, | ||
| 152 | [AB3550_DEVID_POWER] = { | ||
| 153 | { | ||
| 154 | .count = 1, | ||
| 155 | .range = (struct ab3550_reg_range[]) { | ||
| 156 | { | ||
| 157 | .first = 0x21, | ||
| 158 | .last = 0x21, | ||
| 159 | .perm = AB3550_PERM_RO, | ||
| 160 | }, | ||
| 161 | } | ||
| 162 | }, | ||
| 163 | NO_RANGE, | ||
| 164 | }, | ||
| 165 | [AB3550_DEVID_REGULATORS] = { | ||
| 166 | { | ||
| 167 | .count = 1, | ||
| 168 | .range = (struct ab3550_reg_range[]) { | ||
| 169 | { | ||
| 170 | .first = 0x69, | ||
| 171 | .last = 0xa3, | ||
| 172 | .perm = AB3550_PERM_RW, | ||
| 173 | }, | ||
| 174 | } | ||
| 175 | }, | ||
| 176 | { | ||
| 177 | .count = 1, | ||
| 178 | .range = (struct ab3550_reg_range[]) { | ||
| 179 | { | ||
| 180 | .first = 0x14, | ||
| 181 | .last = 0x16, | ||
| 182 | .perm = AB3550_PERM_RW, | ||
| 183 | }, | ||
| 184 | } | ||
| 185 | }, | ||
| 186 | }, | ||
| 187 | [AB3550_DEVID_SIM] = { | ||
| 188 | { | ||
| 189 | .count = 1, | ||
| 190 | .range = (struct ab3550_reg_range[]) { | ||
| 191 | { | ||
| 192 | .first = 0x21, | ||
| 193 | .last = 0x21, | ||
| 194 | .perm = AB3550_PERM_RO, | ||
| 195 | }, | ||
| 196 | |||
