Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson SA 2010 |
| 3 | * |
| 4 | * Author: Mattias Wallin <mattias.wallin@stericsson.com> for ST-Ericsson. |
| 5 | * License Terms: GNU General Public License v2 |
| 6 | */ |
| 7 | |
| 8 | #include <linux/seq_file.h> |
| 9 | #include <linux/uaccess.h> |
| 10 | #include <linux/fs.h> |
Paul Gortmaker | 4e36dd3 | 2011-07-03 15:13:27 -0400 | [diff] [blame] | 11 | #include <linux/module.h> |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 12 | #include <linux/debugfs.h> |
| 13 | #include <linux/platform_device.h> |
Lee Jones | 4b8ac08 | 2013-01-14 16:10:36 +0000 | [diff] [blame^] | 14 | #include <linux/interrupt.h> |
| 15 | #include <linux/kobject.h> |
| 16 | #include <linux/slab.h> |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 17 | |
| 18 | #include <linux/mfd/abx500.h> |
Linus Walleij | ee66e65 | 2011-12-02 14:16:33 +0100 | [diff] [blame] | 19 | #include <linux/mfd/abx500/ab8500.h> |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 20 | |
| 21 | static u32 debug_bank; |
| 22 | static u32 debug_address; |
| 23 | |
Lee Jones | 4b8ac08 | 2013-01-14 16:10:36 +0000 | [diff] [blame^] | 24 | static int irq_first; |
| 25 | static int irq_last; |
| 26 | |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 27 | /** |
| 28 | * struct ab8500_reg_range |
| 29 | * @first: the first address of the range |
| 30 | * @last: the last address of the range |
| 31 | * @perm: access permissions for the range |
| 32 | */ |
| 33 | struct ab8500_reg_range { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 34 | u8 first; |
| 35 | u8 last; |
| 36 | u8 perm; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | /** |
Lee Jones | 822672a | 2012-06-20 13:56:38 +0100 | [diff] [blame] | 40 | * struct ab8500_prcmu_ranges |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 41 | * @num_ranges: the number of ranges in the list |
| 42 | * @bankid: bank identifier |
| 43 | * @range: the list of register ranges |
| 44 | */ |
Lee Jones | 822672a | 2012-06-20 13:56:38 +0100 | [diff] [blame] | 45 | struct ab8500_prcmu_ranges { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 46 | u8 num_ranges; |
| 47 | u8 bankid; |
| 48 | const struct ab8500_reg_range *range; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | #define AB8500_NAME_STRING "ab8500" |
| 52 | #define AB8500_NUM_BANKS 22 |
| 53 | |
| 54 | #define AB8500_REV_REG 0x80 |
| 55 | |
Lee Jones | 822672a | 2012-06-20 13:56:38 +0100 | [diff] [blame] | 56 | static struct ab8500_prcmu_ranges debug_ranges[AB8500_NUM_BANKS] = { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 57 | [0x0] = { |
| 58 | .num_ranges = 0, |
| 59 | .range = 0, |
| 60 | }, |
| 61 | [AB8500_SYS_CTRL1_BLOCK] = { |
| 62 | .num_ranges = 3, |
| 63 | .range = (struct ab8500_reg_range[]) { |
| 64 | { |
| 65 | .first = 0x00, |
| 66 | .last = 0x02, |
| 67 | }, |
| 68 | { |
| 69 | .first = 0x42, |
| 70 | .last = 0x42, |
| 71 | }, |
| 72 | { |
| 73 | .first = 0x80, |
| 74 | .last = 0x81, |
| 75 | }, |
| 76 | }, |
| 77 | }, |
| 78 | [AB8500_SYS_CTRL2_BLOCK] = { |
| 79 | .num_ranges = 4, |
| 80 | .range = (struct ab8500_reg_range[]) { |
| 81 | { |
| 82 | .first = 0x00, |
| 83 | .last = 0x0D, |
| 84 | }, |
| 85 | { |
| 86 | .first = 0x0F, |
| 87 | .last = 0x17, |
| 88 | }, |
| 89 | { |
| 90 | .first = 0x30, |
| 91 | .last = 0x30, |
| 92 | }, |
| 93 | { |
| 94 | .first = 0x32, |
| 95 | .last = 0x33, |
| 96 | }, |
| 97 | }, |
| 98 | }, |
| 99 | [AB8500_REGU_CTRL1] = { |
| 100 | .num_ranges = 3, |
| 101 | .range = (struct ab8500_reg_range[]) { |
| 102 | { |
| 103 | .first = 0x00, |
| 104 | .last = 0x00, |
| 105 | }, |
| 106 | { |
| 107 | .first = 0x03, |
| 108 | .last = 0x10, |
| 109 | }, |
| 110 | { |
| 111 | .first = 0x80, |
| 112 | .last = 0x84, |
| 113 | }, |
| 114 | }, |
| 115 | }, |
| 116 | [AB8500_REGU_CTRL2] = { |
| 117 | .num_ranges = 5, |
| 118 | .range = (struct ab8500_reg_range[]) { |
| 119 | { |
| 120 | .first = 0x00, |
| 121 | .last = 0x15, |
| 122 | }, |
| 123 | { |
| 124 | .first = 0x17, |
| 125 | .last = 0x19, |
| 126 | }, |
| 127 | { |
| 128 | .first = 0x1B, |
| 129 | .last = 0x1D, |
| 130 | }, |
| 131 | { |
| 132 | .first = 0x1F, |
| 133 | .last = 0x22, |
| 134 | }, |
| 135 | { |
| 136 | .first = 0x40, |
| 137 | .last = 0x44, |
| 138 | }, |
| 139 | /* 0x80-0x8B is SIM registers and should |
| 140 | * not be accessed from here */ |
| 141 | }, |
| 142 | }, |
| 143 | [AB8500_USB] = { |
| 144 | .num_ranges = 2, |
| 145 | .range = (struct ab8500_reg_range[]) { |
| 146 | { |
| 147 | .first = 0x80, |
| 148 | .last = 0x83, |
| 149 | }, |
| 150 | { |
| 151 | .first = 0x87, |
| 152 | .last = 0x8A, |
| 153 | }, |
| 154 | }, |
| 155 | }, |
| 156 | [AB8500_TVOUT] = { |
| 157 | .num_ranges = 9, |
| 158 | .range = (struct ab8500_reg_range[]) { |
| 159 | { |
| 160 | .first = 0x00, |
| 161 | .last = 0x12, |
| 162 | }, |
| 163 | { |
| 164 | .first = 0x15, |
| 165 | .last = 0x17, |
| 166 | }, |
| 167 | { |
| 168 | .first = 0x19, |
| 169 | .last = 0x21, |
| 170 | }, |
| 171 | { |
| 172 | .first = 0x27, |
| 173 | .last = 0x2C, |
| 174 | }, |
| 175 | { |
| 176 | .first = 0x41, |
| 177 | .last = 0x41, |
| 178 | }, |
| 179 | { |
| 180 | .first = 0x45, |
| 181 | .last = 0x5B, |
| 182 | }, |
| 183 | { |
| 184 | .first = 0x5D, |
| 185 | .last = 0x5D, |
| 186 | }, |
| 187 | { |
| 188 | .first = 0x69, |
| 189 | .last = 0x69, |
| 190 | }, |
| 191 | { |
| 192 | .first = 0x80, |
| 193 | .last = 0x81, |
| 194 | }, |
| 195 | }, |
| 196 | }, |
| 197 | [AB8500_DBI] = { |
| 198 | .num_ranges = 0, |
Mark Brown | 87fff23 | 2010-12-13 14:06:47 +0000 | [diff] [blame] | 199 | .range = NULL, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 200 | }, |
| 201 | [AB8500_ECI_AV_ACC] = { |
| 202 | .num_ranges = 1, |
| 203 | .range = (struct ab8500_reg_range[]) { |
| 204 | { |
| 205 | .first = 0x80, |
| 206 | .last = 0x82, |
| 207 | }, |
| 208 | }, |
| 209 | }, |
| 210 | [0x9] = { |
| 211 | .num_ranges = 0, |
Mark Brown | 87fff23 | 2010-12-13 14:06:47 +0000 | [diff] [blame] | 212 | .range = NULL, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 213 | }, |
| 214 | [AB8500_GPADC] = { |
| 215 | .num_ranges = 1, |
| 216 | .range = (struct ab8500_reg_range[]) { |
| 217 | { |
| 218 | .first = 0x00, |
| 219 | .last = 0x08, |
| 220 | }, |
| 221 | }, |
| 222 | }, |
| 223 | [AB8500_CHARGER] = { |
| 224 | .num_ranges = 8, |
| 225 | .range = (struct ab8500_reg_range[]) { |
| 226 | { |
| 227 | .first = 0x00, |
| 228 | .last = 0x03, |
| 229 | }, |
| 230 | { |
| 231 | .first = 0x05, |
| 232 | .last = 0x05, |
| 233 | }, |
| 234 | { |
| 235 | .first = 0x40, |
| 236 | .last = 0x40, |
| 237 | }, |
| 238 | { |
| 239 | .first = 0x42, |
| 240 | .last = 0x42, |
| 241 | }, |
| 242 | { |
| 243 | .first = 0x44, |
| 244 | .last = 0x44, |
| 245 | }, |
| 246 | { |
| 247 | .first = 0x50, |
| 248 | .last = 0x55, |
| 249 | }, |
| 250 | { |
| 251 | .first = 0x80, |
| 252 | .last = 0x82, |
| 253 | }, |
| 254 | { |
| 255 | .first = 0xC0, |
| 256 | .last = 0xC2, |
| 257 | }, |
| 258 | }, |
| 259 | }, |
| 260 | [AB8500_GAS_GAUGE] = { |
| 261 | .num_ranges = 3, |
| 262 | .range = (struct ab8500_reg_range[]) { |
| 263 | { |
| 264 | .first = 0x00, |
| 265 | .last = 0x00, |
| 266 | }, |
| 267 | { |
| 268 | .first = 0x07, |
| 269 | .last = 0x0A, |
| 270 | }, |
| 271 | { |
| 272 | .first = 0x10, |
| 273 | .last = 0x14, |
| 274 | }, |
| 275 | }, |
| 276 | }, |
| 277 | [AB8500_AUDIO] = { |
| 278 | .num_ranges = 1, |
| 279 | .range = (struct ab8500_reg_range[]) { |
| 280 | { |
| 281 | .first = 0x00, |
| 282 | .last = 0x6F, |
| 283 | }, |
| 284 | }, |
| 285 | }, |
| 286 | [AB8500_INTERRUPT] = { |
| 287 | .num_ranges = 0, |
Mark Brown | 87fff23 | 2010-12-13 14:06:47 +0000 | [diff] [blame] | 288 | .range = NULL, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 289 | }, |
| 290 | [AB8500_RTC] = { |
| 291 | .num_ranges = 1, |
| 292 | .range = (struct ab8500_reg_range[]) { |
| 293 | { |
| 294 | .first = 0x00, |
| 295 | .last = 0x0F, |
| 296 | }, |
| 297 | }, |
| 298 | }, |
| 299 | [AB8500_MISC] = { |
| 300 | .num_ranges = 8, |
| 301 | .range = (struct ab8500_reg_range[]) { |
| 302 | { |
| 303 | .first = 0x00, |
| 304 | .last = 0x05, |
| 305 | }, |
| 306 | { |
| 307 | .first = 0x10, |
| 308 | .last = 0x15, |
| 309 | }, |
| 310 | { |
| 311 | .first = 0x20, |
| 312 | .last = 0x25, |
| 313 | }, |
| 314 | { |
| 315 | .first = 0x30, |
| 316 | .last = 0x35, |
| 317 | }, |
| 318 | { |
| 319 | .first = 0x40, |
| 320 | .last = 0x45, |
| 321 | }, |
| 322 | { |
| 323 | .first = 0x50, |
| 324 | .last = 0x50, |
| 325 | }, |
| 326 | { |
| 327 | .first = 0x60, |
| 328 | .last = 0x67, |
| 329 | }, |
| 330 | { |
| 331 | .first = 0x80, |
| 332 | .last = 0x80, |
| 333 | }, |
| 334 | }, |
| 335 | }, |
| 336 | [0x11] = { |
| 337 | .num_ranges = 0, |
Mark Brown | 87fff23 | 2010-12-13 14:06:47 +0000 | [diff] [blame] | 338 | .range = NULL, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 339 | }, |
| 340 | [0x12] = { |
| 341 | .num_ranges = 0, |
Mark Brown | 87fff23 | 2010-12-13 14:06:47 +0000 | [diff] [blame] | 342 | .range = NULL, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 343 | }, |
| 344 | [0x13] = { |
| 345 | .num_ranges = 0, |
Mark Brown | 87fff23 | 2010-12-13 14:06:47 +0000 | [diff] [blame] | 346 | .range = NULL, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 347 | }, |
| 348 | [0x14] = { |
| 349 | .num_ranges = 0, |
Mark Brown | 87fff23 | 2010-12-13 14:06:47 +0000 | [diff] [blame] | 350 | .range = NULL, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 351 | }, |
| 352 | [AB8500_OTP_EMUL] = { |
| 353 | .num_ranges = 1, |
| 354 | .range = (struct ab8500_reg_range[]) { |
| 355 | { |
| 356 | .first = 0x01, |
| 357 | .last = 0x0F, |
| 358 | }, |
| 359 | }, |
| 360 | }, |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 361 | }; |
| 362 | |
Lee Jones | 4b8ac08 | 2013-01-14 16:10:36 +0000 | [diff] [blame^] | 363 | static irqreturn_t ab8500_debug_handler(int irq, void *data) |
| 364 | { |
| 365 | char buf[16]; |
| 366 | struct kobject *kobj = (struct kobject *)data; |
| 367 | |
| 368 | /* |
| 369 | * This makes it possible to use poll for events (POLLPRI | POLLERR) |
| 370 | * from userspace on sysfs file named irq-<nr> |
| 371 | */ |
| 372 | sprintf(buf, "irq-%d", irq); |
| 373 | sysfs_notify(kobj, NULL, buf); |
| 374 | |
| 375 | return IRQ_HANDLED; |
| 376 | } |
| 377 | |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 378 | static int ab8500_registers_print(struct seq_file *s, void *p) |
| 379 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 380 | struct device *dev = s->private; |
| 381 | unsigned int i; |
| 382 | u32 bank = debug_bank; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 383 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 384 | seq_printf(s, AB8500_NAME_STRING " register values:\n"); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 385 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 386 | seq_printf(s, " bank %u:\n", bank); |
| 387 | for (i = 0; i < debug_ranges[bank].num_ranges; i++) { |
| 388 | u32 reg; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 389 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 390 | for (reg = debug_ranges[bank].range[i].first; |
| 391 | reg <= debug_ranges[bank].range[i].last; |
| 392 | reg++) { |
| 393 | u8 value; |
| 394 | int err; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 395 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 396 | err = abx500_get_register_interruptible(dev, |
| 397 | (u8)bank, (u8)reg, &value); |
| 398 | if (err < 0) { |
| 399 | dev_err(dev, "ab->read fail %d\n", err); |
| 400 | return err; |
| 401 | } |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 402 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 403 | err = seq_printf(s, " [%u/0x%02X]: 0x%02X\n", bank, |
| 404 | reg, value); |
| 405 | if (err < 0) { |
| 406 | dev_err(dev, "seq_printf overflow\n"); |
| 407 | /* Error is not returned here since |
| 408 | * the output is wanted in any case */ |
| 409 | return 0; |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | return 0; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 414 | } |
| 415 | |
| 416 | static int ab8500_registers_open(struct inode *inode, struct file *file) |
| 417 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 418 | return single_open(file, ab8500_registers_print, inode->i_private); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | static const struct file_operations ab8500_registers_fops = { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 422 | .open = ab8500_registers_open, |
| 423 | .read = seq_read, |
| 424 | .llseek = seq_lseek, |
| 425 | .release = single_release, |
| 426 | .owner = THIS_MODULE, |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 427 | }; |
| 428 | |
| 429 | static int ab8500_bank_print(struct seq_file *s, void *p) |
| 430 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 431 | return seq_printf(s, "%d\n", debug_bank); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 432 | } |
| 433 | |
| 434 | static int ab8500_bank_open(struct inode *inode, struct file *file) |
| 435 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 436 | return single_open(file, ab8500_bank_print, inode->i_private); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | static ssize_t ab8500_bank_write(struct file *file, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 440 | const char __user *user_buf, |
| 441 | size_t count, loff_t *ppos) |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 442 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 443 | struct device *dev = ((struct seq_file *)(file->private_data))->private; |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 444 | unsigned long user_bank; |
| 445 | int err; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 446 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 447 | /* Get userspace string and assure termination */ |
Peter Huewe | 8504d63 | 2011-06-06 22:43:32 +0200 | [diff] [blame] | 448 | err = kstrtoul_from_user(user_buf, count, 0, &user_bank); |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 449 | if (err) |
Peter Huewe | 8504d63 | 2011-06-06 22:43:32 +0200 | [diff] [blame] | 450 | return err; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 451 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 452 | if (user_bank >= AB8500_NUM_BANKS) { |
| 453 | dev_err(dev, "debugfs error input > number of banks\n"); |
| 454 | return -EINVAL; |
| 455 | } |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 456 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 457 | debug_bank = user_bank; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 458 | |
Peter Huewe | 8504d63 | 2011-06-06 22:43:32 +0200 | [diff] [blame] | 459 | return count; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 460 | } |
| 461 | |
| 462 | static int ab8500_address_print(struct seq_file *s, void *p) |
| 463 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 464 | return seq_printf(s, "0x%02X\n", debug_address); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 465 | } |
| 466 | |
| 467 | static int ab8500_address_open(struct inode *inode, struct file *file) |
| 468 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 469 | return single_open(file, ab8500_address_print, inode->i_private); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | static ssize_t ab8500_address_write(struct file *file, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 473 | const char __user *user_buf, |
| 474 | size_t count, loff_t *ppos) |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 475 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 476 | struct device *dev = ((struct seq_file *)(file->private_data))->private; |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 477 | unsigned long user_address; |
| 478 | int err; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 479 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 480 | /* Get userspace string and assure termination */ |
Peter Huewe | 8504d63 | 2011-06-06 22:43:32 +0200 | [diff] [blame] | 481 | err = kstrtoul_from_user(user_buf, count, 0, &user_address); |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 482 | if (err) |
Peter Huewe | 8504d63 | 2011-06-06 22:43:32 +0200 | [diff] [blame] | 483 | return err; |
| 484 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 485 | if (user_address > 0xff) { |
| 486 | dev_err(dev, "debugfs error input > 0xff\n"); |
| 487 | return -EINVAL; |
| 488 | } |
| 489 | debug_address = user_address; |
Peter Huewe | 8504d63 | 2011-06-06 22:43:32 +0200 | [diff] [blame] | 490 | return count; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 491 | } |
| 492 | |
| 493 | static int ab8500_val_print(struct seq_file *s, void *p) |
| 494 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 495 | struct device *dev = s->private; |
| 496 | int ret; |
| 497 | u8 regvalue; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 498 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 499 | ret = abx500_get_register_interruptible(dev, |
| 500 | (u8)debug_bank, (u8)debug_address, ®value); |
| 501 | if (ret < 0) { |
| 502 | dev_err(dev, "abx500_get_reg fail %d, %d\n", |
| 503 | ret, __LINE__); |
| 504 | return -EINVAL; |
| 505 | } |
| 506 | seq_printf(s, "0x%02X\n", regvalue); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 507 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 508 | return 0; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 509 | } |
| 510 | |
| 511 | static int ab8500_val_open(struct inode *inode, struct file *file) |
| 512 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 513 | return single_open(file, ab8500_val_print, inode->i_private); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 514 | } |
| 515 | |
| 516 | static ssize_t ab8500_val_write(struct file *file, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 517 | const char __user *user_buf, |
| 518 | size_t count, loff_t *ppos) |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 519 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 520 | struct device *dev = ((struct seq_file *)(file->private_data))->private; |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 521 | unsigned long user_val; |
| 522 | int err; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 523 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 524 | /* Get userspace string and assure termination */ |
Peter Huewe | 8504d63 | 2011-06-06 22:43:32 +0200 | [diff] [blame] | 525 | err = kstrtoul_from_user(user_buf, count, 0, &user_val); |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 526 | if (err) |
Peter Huewe | 8504d63 | 2011-06-06 22:43:32 +0200 | [diff] [blame] | 527 | return err; |
| 528 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 529 | if (user_val > 0xff) { |
| 530 | dev_err(dev, "debugfs error input > 0xff\n"); |
| 531 | return -EINVAL; |
| 532 | } |
| 533 | err = abx500_set_register_interruptible(dev, |
| 534 | (u8)debug_bank, debug_address, (u8)user_val); |
| 535 | if (err < 0) { |
| 536 | printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__); |
| 537 | return -EINVAL; |
| 538 | } |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 539 | |
Peter Huewe | 8504d63 | 2011-06-06 22:43:32 +0200 | [diff] [blame] | 540 | return count; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 541 | } |
| 542 | |
Lee Jones | 4b8ac08 | 2013-01-14 16:10:36 +0000 | [diff] [blame^] | 543 | static int ab8500_subscribe_unsubscribe_print(struct seq_file *s, void *p) |
| 544 | { |
| 545 | seq_printf(s, "%d\n", irq_first); |
| 546 | |
| 547 | return 0; |
| 548 | } |
| 549 | |
| 550 | static int ab8500_subscribe_unsubscribe_open(struct inode *inode, |
| 551 | struct file *file) |
| 552 | { |
| 553 | return single_open(file, ab8500_subscribe_unsubscribe_print, |
| 554 | inode->i_private); |
| 555 | } |
| 556 | |
| 557 | /* |
| 558 | * This function is used for all interrupts and will always print |
| 559 | * the same string. It is however this file sysfs_notify called on. |
| 560 | * Userspace should read this file and then poll. When an event occur |
| 561 | * the blocking poll will be released. |
| 562 | */ |
| 563 | static ssize_t show_irq(struct device *dev, |
| 564 | struct device_attribute *attr, char *buf) |
| 565 | { |
| 566 | return sprintf(buf, "irq\n"); |
| 567 | } |
| 568 | |
| 569 | static struct device_attribute *dev_attr[AB8500_NR_IRQS]; |
| 570 | static char *event_name[AB8500_NR_IRQS]; |
| 571 | |
| 572 | static ssize_t ab8500_subscribe_write(struct file *file, |
| 573 | const char __user *user_buf, |
| 574 | size_t count, loff_t *ppos) |
| 575 | { |
| 576 | struct device *dev = ((struct seq_file *)(file->private_data))->private; |
| 577 | char buf[32]; |
| 578 | int buf_size; |
| 579 | unsigned long user_val; |
| 580 | int err; |
| 581 | |
| 582 | /* Get userspace string and assure termination */ |
| 583 | buf_size = min(count, (sizeof(buf)-1)); |
| 584 | if (copy_from_user(buf, user_buf, buf_size)) |
| 585 | return -EFAULT; |
| 586 | buf[buf_size] = 0; |
| 587 | |
| 588 | err = strict_strtoul(buf, 0, &user_val); |
| 589 | if (err) |
| 590 | return -EINVAL; |
| 591 | if (user_val < irq_first) { |
| 592 | dev_err(dev, "debugfs error input < %d\n", irq_first); |
| 593 | return -EINVAL; |
| 594 | } |
| 595 | if (user_val > irq_last) { |
| 596 | dev_err(dev, "debugfs error input > %d\n", irq_last); |
| 597 | return -EINVAL; |
| 598 | } |
| 599 | |
| 600 | /* |
| 601 | * This will create a sysfs file named irq-<nr> which userspace can |
| 602 | * use to select or poll and get the AB8500 events |
| 603 | */ |
| 604 | dev_attr[user_val] = kmalloc(sizeof(struct device_attribute), |
| 605 | GFP_KERNEL); |
| 606 | event_name[user_val] = kmalloc(buf_size, GFP_KERNEL); |
| 607 | sprintf(event_name[user_val], "irq-%lu", user_val); |
| 608 | dev_attr[user_val]->show = show_irq; |
| 609 | dev_attr[user_val]->store = NULL; |
| 610 | dev_attr[user_val]->attr.name = event_name[user_val]; |
| 611 | dev_attr[user_val]->attr.mode = S_IRUGO; |
| 612 | err = sysfs_create_file(&dev->kobj, &dev_attr[user_val]->attr); |
| 613 | if (err < 0) { |
| 614 | printk(KERN_ERR "sysfs_create_file failed %d\n", err); |
| 615 | return err; |
| 616 | } |
| 617 | |
| 618 | err = request_threaded_irq(user_val, NULL, ab8500_debug_handler, |
| 619 | IRQF_SHARED | IRQF_NO_SUSPEND, |
| 620 | "ab8500-debug", &dev->kobj); |
| 621 | if (err < 0) { |
| 622 | printk(KERN_ERR "request_threaded_irq failed %d, %lu\n", |
| 623 | err, user_val); |
| 624 | return err; |
| 625 | } |
| 626 | |
| 627 | return buf_size; |
| 628 | } |
| 629 | |
| 630 | static ssize_t ab8500_unsubscribe_write(struct file *file, |
| 631 | const char __user *user_buf, |
| 632 | size_t count, loff_t *ppos) |
| 633 | { |
| 634 | struct device *dev = ((struct seq_file *)(file->private_data))->private; |
| 635 | char buf[32]; |
| 636 | int buf_size; |
| 637 | unsigned long user_val; |
| 638 | int err; |
| 639 | |
| 640 | /* Get userspace string and assure termination */ |
| 641 | buf_size = min(count, (sizeof(buf)-1)); |
| 642 | if (copy_from_user(buf, user_buf, buf_size)) |
| 643 | return -EFAULT; |
| 644 | buf[buf_size] = 0; |
| 645 | |
| 646 | err = strict_strtoul(buf, 0, &user_val); |
| 647 | if (err) |
| 648 | return -EINVAL; |
| 649 | if (user_val < irq_first) { |
| 650 | dev_err(dev, "debugfs error input < %d\n", irq_first); |
| 651 | return -EINVAL; |
| 652 | } |
| 653 | if (user_val > irq_last) { |
| 654 | dev_err(dev, "debugfs error input > %d\n", irq_last); |
| 655 | return -EINVAL; |
| 656 | } |
| 657 | |
| 658 | free_irq(user_val, &dev->kobj); |
| 659 | kfree(event_name[user_val]); |
| 660 | kfree(dev_attr[user_val]); |
| 661 | |
| 662 | if (dev_attr[user_val]) |
| 663 | sysfs_remove_file(&dev->kobj, &dev_attr[user_val]->attr); |
| 664 | |
| 665 | return buf_size; |
| 666 | } |
| 667 | |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 668 | static const struct file_operations ab8500_bank_fops = { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 669 | .open = ab8500_bank_open, |
| 670 | .write = ab8500_bank_write, |
| 671 | .read = seq_read, |
| 672 | .llseek = seq_lseek, |
| 673 | .release = single_release, |
| 674 | .owner = THIS_MODULE, |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 675 | }; |
| 676 | |
| 677 | static const struct file_operations ab8500_address_fops = { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 678 | .open = ab8500_address_open, |
| 679 | .write = ab8500_address_write, |
| 680 | .read = seq_read, |
| 681 | .llseek = seq_lseek, |
| 682 | .release = single_release, |
| 683 | .owner = THIS_MODULE, |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 684 | }; |
| 685 | |
| 686 | static const struct file_operations ab8500_val_fops = { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 687 | .open = ab8500_val_open, |
| 688 | .write = ab8500_val_write, |
| 689 | .read = seq_read, |
| 690 | .llseek = seq_lseek, |
| 691 | .release = single_release, |
| 692 | .owner = THIS_MODULE, |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 693 | }; |
| 694 | |
Lee Jones | 4b8ac08 | 2013-01-14 16:10:36 +0000 | [diff] [blame^] | 695 | static const struct file_operations ab8500_subscribe_fops = { |
| 696 | .open = ab8500_subscribe_unsubscribe_open, |
| 697 | .write = ab8500_subscribe_write, |
| 698 | .read = seq_read, |
| 699 | .llseek = seq_lseek, |
| 700 | .release = single_release, |
| 701 | .owner = THIS_MODULE, |
| 702 | }; |
| 703 | |
| 704 | static const struct file_operations ab8500_unsubscribe_fops = { |
| 705 | .open = ab8500_subscribe_unsubscribe_open, |
| 706 | .write = ab8500_unsubscribe_write, |
| 707 | .read = seq_read, |
| 708 | .llseek = seq_lseek, |
| 709 | .release = single_release, |
| 710 | .owner = THIS_MODULE, |
| 711 | }; |
| 712 | |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 713 | static struct dentry *ab8500_dir; |
| 714 | static struct dentry *ab8500_reg_file; |
| 715 | static struct dentry *ab8500_bank_file; |
| 716 | static struct dentry *ab8500_address_file; |
| 717 | static struct dentry *ab8500_val_file; |
Lee Jones | 4b8ac08 | 2013-01-14 16:10:36 +0000 | [diff] [blame^] | 718 | static struct dentry *ab8500_subscribe_file; |
| 719 | static struct dentry *ab8500_unsubscribe_file; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 720 | |
Bill Pemberton | f791be4 | 2012-11-19 13:23:04 -0500 | [diff] [blame] | 721 | static int ab8500_debug_probe(struct platform_device *plf) |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 722 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 723 | debug_bank = AB8500_MISC; |
| 724 | debug_address = AB8500_REV_REG & 0x00FF; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 725 | |
Lee Jones | 4b8ac08 | 2013-01-14 16:10:36 +0000 | [diff] [blame^] | 726 | irq_first = platform_get_irq_byname(plf, "IRQ_FIRST"); |
| 727 | if (irq_first < 0) { |
| 728 | dev_err(&plf->dev, "First irq not found, err %d\n", |
| 729 | irq_first); |
| 730 | return irq_first; |
| 731 | } |
| 732 | |
| 733 | irq_last = platform_get_irq_byname(plf, "IRQ_LAST"); |
| 734 | if (irq_last < 0) { |
| 735 | dev_err(&plf->dev, "Last irq not found, err %d\n", |
| 736 | irq_last); |
| 737 | return irq_last; |
| 738 | } |
| 739 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 740 | ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL); |
| 741 | if (!ab8500_dir) |
| 742 | goto exit_no_debugfs; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 743 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 744 | ab8500_reg_file = debugfs_create_file("all-bank-registers", |
| 745 | S_IRUGO, ab8500_dir, &plf->dev, &ab8500_registers_fops); |
| 746 | if (!ab8500_reg_file) |
| 747 | goto exit_destroy_dir; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 748 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 749 | ab8500_bank_file = debugfs_create_file("register-bank", |
Vasiliy Kulikov | 44bdcb5 | 2011-02-04 15:23:43 +0300 | [diff] [blame] | 750 | (S_IRUGO | S_IWUSR), ab8500_dir, &plf->dev, &ab8500_bank_fops); |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 751 | if (!ab8500_bank_file) |
| 752 | goto exit_destroy_reg; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 753 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 754 | ab8500_address_file = debugfs_create_file("register-address", |
Vasiliy Kulikov | 44bdcb5 | 2011-02-04 15:23:43 +0300 | [diff] [blame] | 755 | (S_IRUGO | S_IWUSR), ab8500_dir, &plf->dev, |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 756 | &ab8500_address_fops); |
| 757 | if (!ab8500_address_file) |
| 758 | goto exit_destroy_bank; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 759 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 760 | ab8500_val_file = debugfs_create_file("register-value", |
Vasiliy Kulikov | 44bdcb5 | 2011-02-04 15:23:43 +0300 | [diff] [blame] | 761 | (S_IRUGO | S_IWUSR), ab8500_dir, &plf->dev, &ab8500_val_fops); |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 762 | if (!ab8500_val_file) |
| 763 | goto exit_destroy_address; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 764 | |
Lee Jones | 4b8ac08 | 2013-01-14 16:10:36 +0000 | [diff] [blame^] | 765 | ab8500_subscribe_file = |
| 766 | debugfs_create_file("irq-subscribe", |
| 767 | (S_IRUGO | S_IWUGO), ab8500_dir, &plf->dev, |
| 768 | &ab8500_subscribe_fops); |
| 769 | if (!ab8500_subscribe_file) |
| 770 | goto exit_destroy_val; |
| 771 | |
| 772 | ab8500_unsubscribe_file = |
| 773 | debugfs_create_file("irq-unsubscribe", |
| 774 | (S_IRUGO | S_IWUGO), ab8500_dir, &plf->dev, |
| 775 | &ab8500_unsubscribe_fops); |
| 776 | if (!ab8500_unsubscribe_file) |
| 777 | goto exit_destroy_subscribe; |
| 778 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 779 | return 0; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 780 | |
Lee Jones | 4b8ac08 | 2013-01-14 16:10:36 +0000 | [diff] [blame^] | 781 | exit_destroy_subscribe: |
| 782 | debugfs_remove(ab8500_subscribe_file); |
| 783 | exit_destroy_val: |
| 784 | debugfs_remove(ab8500_val_file); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 785 | exit_destroy_address: |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 786 | debugfs_remove(ab8500_address_file); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 787 | exit_destroy_bank: |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 788 | debugfs_remove(ab8500_bank_file); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 789 | exit_destroy_reg: |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 790 | debugfs_remove(ab8500_reg_file); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 791 | exit_destroy_dir: |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 792 | debugfs_remove(ab8500_dir); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 793 | exit_no_debugfs: |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 794 | dev_err(&plf->dev, "failed to create debugfs entries.\n"); |
| 795 | return -ENOMEM; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 796 | } |
| 797 | |
Bill Pemberton | 4740f73 | 2012-11-19 13:26:01 -0500 | [diff] [blame] | 798 | static int ab8500_debug_remove(struct platform_device *plf) |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 799 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 800 | debugfs_remove(ab8500_val_file); |
| 801 | debugfs_remove(ab8500_address_file); |
| 802 | debugfs_remove(ab8500_bank_file); |
| 803 | debugfs_remove(ab8500_reg_file); |
| 804 | debugfs_remove(ab8500_dir); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 805 | |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 806 | return 0; |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 807 | } |
| 808 | |
| 809 | static struct platform_driver ab8500_debug_driver = { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 810 | .driver = { |
| 811 | .name = "ab8500-debug", |
| 812 | .owner = THIS_MODULE, |
| 813 | }, |
| 814 | .probe = ab8500_debug_probe, |
Bill Pemberton | 8444921 | 2012-11-19 13:20:24 -0500 | [diff] [blame] | 815 | .remove = ab8500_debug_remove |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 816 | }; |
| 817 | |
| 818 | static int __init ab8500_debug_init(void) |
| 819 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 820 | return platform_driver_register(&ab8500_debug_driver); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 821 | } |
| 822 | |
| 823 | static void __exit ab8500_debug_exit(void) |
| 824 | { |
Mattias Wallin | d7b9f32 | 2010-11-26 13:06:39 +0100 | [diff] [blame] | 825 | platform_driver_unregister(&ab8500_debug_driver); |
Mattias Wallin | 5814fc3 | 2010-09-13 16:05:04 +0200 | [diff] [blame] | 826 | } |
| 827 | subsys_initcall(ab8500_debug_init); |
| 828 | module_exit(ab8500_debug_exit); |
| 829 | |
| 830 | MODULE_AUTHOR("Mattias WALLIN <mattias.wallin@stericsson.com"); |
| 831 | MODULE_DESCRIPTION("AB8500 DEBUG"); |
| 832 | MODULE_LICENSE("GPL v2"); |