ab8500-core.c 27.3 KB
Newer Older
R
Rabin Vincent 已提交
1 2 3 4 5 6
/*
 * Copyright (C) ST-Ericsson SA 2010
 *
 * License Terms: GNU General Public License v2
 * Author: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
7
 * Author: Mattias Wallin <mattias.wallin@stericsson.com>
R
Rabin Vincent 已提交
8 9 10 11 12 13 14 15 16 17 18
 */

#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/mfd/core.h>
19
#include <linux/mfd/abx500.h>
20
#include <linux/mfd/abx500/ab8500.h>
21
#include <linux/regulator/ab8500.h>
R
Rabin Vincent 已提交
22 23 24 25 26

/*
 * Interrupt register offsets
 * Bank : 0x0E
 */
27 28 29 30 31 32 33 34
#define AB8500_IT_SOURCE1_REG		0x00
#define AB8500_IT_SOURCE2_REG		0x01
#define AB8500_IT_SOURCE3_REG		0x02
#define AB8500_IT_SOURCE4_REG		0x03
#define AB8500_IT_SOURCE5_REG		0x04
#define AB8500_IT_SOURCE6_REG		0x05
#define AB8500_IT_SOURCE7_REG		0x06
#define AB8500_IT_SOURCE8_REG		0x07
35
#define AB9540_IT_SOURCE13_REG		0x0C
36 37 38 39 40 41
#define AB8500_IT_SOURCE19_REG		0x12
#define AB8500_IT_SOURCE20_REG		0x13
#define AB8500_IT_SOURCE21_REG		0x14
#define AB8500_IT_SOURCE22_REG		0x15
#define AB8500_IT_SOURCE23_REG		0x16
#define AB8500_IT_SOURCE24_REG		0x17
R
Rabin Vincent 已提交
42 43 44 45

/*
 * latch registers
 */
46 47 48 49 50 51 52 53 54 55
#define AB8500_IT_LATCH1_REG		0x20
#define AB8500_IT_LATCH2_REG		0x21
#define AB8500_IT_LATCH3_REG		0x22
#define AB8500_IT_LATCH4_REG		0x23
#define AB8500_IT_LATCH5_REG		0x24
#define AB8500_IT_LATCH6_REG		0x25
#define AB8500_IT_LATCH7_REG		0x26
#define AB8500_IT_LATCH8_REG		0x27
#define AB8500_IT_LATCH9_REG		0x28
#define AB8500_IT_LATCH10_REG		0x29
56
#define AB8500_IT_LATCH12_REG		0x2B
57
#define AB9540_IT_LATCH13_REG		0x2C
58 59 60 61 62 63
#define AB8500_IT_LATCH19_REG		0x32
#define AB8500_IT_LATCH20_REG		0x33
#define AB8500_IT_LATCH21_REG		0x34
#define AB8500_IT_LATCH22_REG		0x35
#define AB8500_IT_LATCH23_REG		0x36
#define AB8500_IT_LATCH24_REG		0x37
R
Rabin Vincent 已提交
64 65 66 67 68

/*
 * mask registers
 */

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
#define AB8500_IT_MASK1_REG		0x40
#define AB8500_IT_MASK2_REG		0x41
#define AB8500_IT_MASK3_REG		0x42
#define AB8500_IT_MASK4_REG		0x43
#define AB8500_IT_MASK5_REG		0x44
#define AB8500_IT_MASK6_REG		0x45
#define AB8500_IT_MASK7_REG		0x46
#define AB8500_IT_MASK8_REG		0x47
#define AB8500_IT_MASK9_REG		0x48
#define AB8500_IT_MASK10_REG		0x49
#define AB8500_IT_MASK11_REG		0x4A
#define AB8500_IT_MASK12_REG		0x4B
#define AB8500_IT_MASK13_REG		0x4C
#define AB8500_IT_MASK14_REG		0x4D
#define AB8500_IT_MASK15_REG		0x4E
#define AB8500_IT_MASK16_REG		0x4F
#define AB8500_IT_MASK17_REG		0x50
#define AB8500_IT_MASK18_REG		0x51
#define AB8500_IT_MASK19_REG		0x52
#define AB8500_IT_MASK20_REG		0x53
#define AB8500_IT_MASK21_REG		0x54
#define AB8500_IT_MASK22_REG		0x55
#define AB8500_IT_MASK23_REG		0x56
#define AB8500_IT_MASK24_REG		0x57

#define AB8500_REV_REG			0x80
95
#define AB8500_IC_NAME_REG		0x82
96
#define AB8500_SWITCH_OFF_STATUS	0x00
R
Rabin Vincent 已提交
97

98 99
#define AB8500_TURN_ON_STATUS		0x00

100 101 102
#define AB9540_MODEM_CTRL2_REG			0x23
#define AB9540_MODEM_CTRL2_SWDBBRSTN_BIT	BIT(2)

R
Rabin Vincent 已提交
103 104
/*
 * Map interrupt numbers to the LATCH and MASK register offsets, Interrupt
105 106
 * numbers are indexed into this array with (num / 8). The interupts are
 * defined in linux/mfd/ab8500.h
R
Rabin Vincent 已提交
107 108 109 110
 *
 * This is one off from the register names, i.e. AB8500_IT_MASK1_REG is at
 * offset 0.
 */
111
/* AB8500 support */
R
Rabin Vincent 已提交
112
static const int ab8500_irq_regoffset[AB8500_NUM_IRQ_REGS] = {
113
	0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 18, 19, 20, 21,
R
Rabin Vincent 已提交
114 115
};

116 117 118 119 120
/* AB9540 support */
static const int ab9540_irq_regoffset[AB9540_NUM_IRQ_REGS] = {
	0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 18, 19, 20, 21, 12, 13, 24,
};

121 122 123 124 125 126 127
static const char ab8500_version_str[][7] = {
	[AB8500_VERSION_AB8500] = "AB8500",
	[AB8500_VERSION_AB8505] = "AB8505",
	[AB8500_VERSION_AB9540] = "AB9540",
	[AB8500_VERSION_AB8540] = "AB8540",
};

128 129
static int ab8500_get_chip_id(struct device *dev)
{
130 131 132 133 134 135
	struct ab8500 *ab8500;

	if (!dev)
		return -EINVAL;
	ab8500 = dev_get_drvdata(dev->parent);
	return ab8500 ? (int)ab8500->chip_id : -EINVAL;
136 137 138 139
}

static int set_register_interruptible(struct ab8500 *ab8500, u8 bank,
	u8 reg, u8 data)
R
Rabin Vincent 已提交
140 141
{
	int ret;
142 143 144 145 146
	/*
	 * Put the u8 bank and u8 register together into a an u16.
	 * The bank on higher 8 bits and register in lower 8 bits.
	 * */
	u16 addr = ((u16)bank) << 8 | reg;
R
Rabin Vincent 已提交
147 148 149

	dev_vdbg(ab8500->dev, "wr: addr %#x <= %#x\n", addr, data);

150 151 152 153
	ret = mutex_lock_interruptible(&ab8500->lock);
	if (ret)
		return ret;

R
Rabin Vincent 已提交
154 155 156 157
	ret = ab8500->write(ab8500, addr, data);
	if (ret < 0)
		dev_err(ab8500->dev, "failed to write reg %#x: %d\n",
			addr, ret);
158
	mutex_unlock(&ab8500->lock);
R
Rabin Vincent 已提交
159 160 161 162

	return ret;
}

163 164
static int ab8500_set_register(struct device *dev, u8 bank,
	u8 reg, u8 value)
R
Rabin Vincent 已提交
165
{
166
	struct ab8500 *ab8500 = dev_get_drvdata(dev->parent);
R
Rabin Vincent 已提交
167

168
	return set_register_interruptible(ab8500, bank, reg, value);
R
Rabin Vincent 已提交
169 170
}

171 172
static int get_register_interruptible(struct ab8500 *ab8500, u8 bank,
	u8 reg, u8 *value)
R
Rabin Vincent 已提交
173 174
{
	int ret;
175 176 177 178 179 180 181
	/* put the u8 bank and u8 reg together into a an u16.
	 * bank on higher 8 bits and reg in lower */
	u16 addr = ((u16)bank) << 8 | reg;

	ret = mutex_lock_interruptible(&ab8500->lock);
	if (ret)
		return ret;
R
Rabin Vincent 已提交
182 183 184 185 186

	ret = ab8500->read(ab8500, addr);
	if (ret < 0)
		dev_err(ab8500->dev, "failed to read reg %#x: %d\n",
			addr, ret);
187 188
	else
		*value = ret;
R
Rabin Vincent 已提交
189

190
	mutex_unlock(&ab8500->lock);
R
Rabin Vincent 已提交
191 192 193 194 195
	dev_vdbg(ab8500->dev, "rd: addr %#x => data %#x\n", addr, ret);

	return ret;
}

196 197
static int ab8500_get_register(struct device *dev, u8 bank,
	u8 reg, u8 *value)
R
Rabin Vincent 已提交
198
{
199
	struct ab8500 *ab8500 = dev_get_drvdata(dev->parent);
R
Rabin Vincent 已提交
200

201
	return get_register_interruptible(ab8500, bank, reg, value);
R
Rabin Vincent 已提交
202
}
203 204 205

static int mask_and_set_register_interruptible(struct ab8500 *ab8500, u8 bank,
	u8 reg, u8 bitmask, u8 bitvalues)
R
Rabin Vincent 已提交
206 207
{
	int ret;
208 209 210 211
	u8 data;
	/* put the u8 bank and u8 reg together into a an u16.
	 * bank on higher 8 bits and reg in lower */
	u16 addr = ((u16)bank) << 8 | reg;
R
Rabin Vincent 已提交
212

213 214 215
	ret = mutex_lock_interruptible(&ab8500->lock);
	if (ret)
		return ret;
R
Rabin Vincent 已提交
216

217 218 219 220
	ret = ab8500->read(ab8500, addr);
	if (ret < 0) {
		dev_err(ab8500->dev, "failed to read reg %#x: %d\n",
			addr, ret);
R
Rabin Vincent 已提交
221
		goto out;
222
	}
R
Rabin Vincent 已提交
223

224 225
	data = (u8)ret;
	data = (~bitmask & data) | (bitmask & bitvalues);
R
Rabin Vincent 已提交
226

227 228 229 230
	ret = ab8500->write(ab8500, addr, data);
	if (ret < 0)
		dev_err(ab8500->dev, "failed to write reg %#x: %d\n",
			addr, ret);
R
Rabin Vincent 已提交
231

232
	dev_vdbg(ab8500->dev, "mask: addr %#x => data %#x\n", addr, data);
R
Rabin Vincent 已提交
233 234 235 236
out:
	mutex_unlock(&ab8500->lock);
	return ret;
}
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257

static int ab8500_mask_and_set_register(struct device *dev,
	u8 bank, u8 reg, u8 bitmask, u8 bitvalues)
{
	struct ab8500 *ab8500 = dev_get_drvdata(dev->parent);

	return mask_and_set_register_interruptible(ab8500, bank, reg,
		bitmask, bitvalues);

}

static struct abx500_ops ab8500_ops = {
	.get_chip_id = ab8500_get_chip_id,
	.get_register = ab8500_get_register,
	.set_register = ab8500_set_register,
	.get_register_page = NULL,
	.set_register_page = NULL,
	.mask_and_set_register = ab8500_mask_and_set_register,
	.event_registers_startup_state_get = NULL,
	.startup_irq_enabled = NULL,
};
R
Rabin Vincent 已提交
258

259
static void ab8500_irq_lock(struct irq_data *data)
R
Rabin Vincent 已提交
260
{
261
	struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data);
R
Rabin Vincent 已提交
262 263 264 265

	mutex_lock(&ab8500->irq_lock);
}

266
static void ab8500_irq_sync_unlock(struct irq_data *data)
R
Rabin Vincent 已提交
267
{
268
	struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data);
R
Rabin Vincent 已提交
269 270
	int i;

271
	for (i = 0; i < ab8500->mask_size; i++) {
R
Rabin Vincent 已提交
272 273 274 275 276 277 278
		u8 old = ab8500->oldmask[i];
		u8 new = ab8500->mask[i];
		int reg;

		if (new == old)
			continue;

279 280 281 282 283 284
		/*
		 * Interrupt register 12 doesn't exist prior to AB8500 version
		 * 2.0
		 */
		if (ab8500->irq_reg_offset[i] == 11 &&
			is_ab8500_1p1_or_earlier(ab8500))
285 286
			continue;

R
Rabin Vincent 已提交
287 288
		ab8500->oldmask[i] = new;

289
		reg = AB8500_IT_MASK1_REG + ab8500->irq_reg_offset[i];
290
		set_register_interruptible(ab8500, AB8500_INTERRUPT, reg, new);
R
Rabin Vincent 已提交
291 292 293 294 295
	}

	mutex_unlock(&ab8500->irq_lock);
}

296
static void ab8500_irq_mask(struct irq_data *data)
R
Rabin Vincent 已提交
297
{
298 299
	struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data);
	int offset = data->irq - ab8500->irq_base;
R
Rabin Vincent 已提交
300 301 302 303 304 305
	int index = offset / 8;
	int mask = 1 << (offset % 8);

	ab8500->mask[index] |= mask;
}

306
static void ab8500_irq_unmask(struct irq_data *data)
R
Rabin Vincent 已提交
307
{
308 309
	struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data);
	int offset = data->irq - ab8500->irq_base;
R
Rabin Vincent 已提交
310 311 312 313 314 315 316 317
	int index = offset / 8;
	int mask = 1 << (offset % 8);

	ab8500->mask[index] &= ~mask;
}

static struct irq_chip ab8500_irq_chip = {
	.name			= "ab8500",
318 319 320
	.irq_bus_lock		= ab8500_irq_lock,
	.irq_bus_sync_unlock	= ab8500_irq_sync_unlock,
	.irq_mask		= ab8500_irq_mask,
321
	.irq_disable		= ab8500_irq_mask,
322
	.irq_unmask		= ab8500_irq_unmask,
R
Rabin Vincent 已提交
323 324 325 326 327 328 329 330 331
};

static irqreturn_t ab8500_irq(int irq, void *dev)
{
	struct ab8500 *ab8500 = dev;
	int i;

	dev_vdbg(ab8500->dev, "interrupt\n");

332 333
	for (i = 0; i < ab8500->mask_size; i++) {
		int regoffset = ab8500->irq_reg_offset[i];
R
Rabin Vincent 已提交
334
		int status;
335
		u8 value;
R
Rabin Vincent 已提交
336

337 338 339 340 341
		/*
		 * Interrupt register 12 doesn't exist prior to AB8500 version
		 * 2.0
		 */
		if (regoffset == 11 && is_ab8500_1p1_or_earlier(ab8500))
342 343
			continue;

344 345 346
		status = get_register_interruptible(ab8500, AB8500_INTERRUPT,
			AB8500_IT_LATCH1_REG + regoffset, &value);
		if (status < 0 || value == 0)
R
Rabin Vincent 已提交
347 348 349
			continue;

		do {
350
			int bit = __ffs(value);
R
Rabin Vincent 已提交
351 352 353
			int line = i * 8 + bit;

			handle_nested_irq(ab8500->irq_base + line);
354 355
			value &= ~(1 << bit);
		} while (value);
R
Rabin Vincent 已提交
356 357 358 359 360 361 362 363 364
	}

	return IRQ_HANDLED;
}

static int ab8500_irq_init(struct ab8500 *ab8500)
{
	int base = ab8500->irq_base;
	int irq;
365
	int num_irqs;
R
Rabin Vincent 已提交
366

367 368 369 370
	if (is_ab9540(ab8500))
		num_irqs = AB9540_NR_IRQS;
	else
		num_irqs = AB8500_NR_IRQS;
371 372

	for (irq = base; irq < base + num_irqs; irq++) {
T
Thomas Gleixner 已提交
373 374
		irq_set_chip_data(irq, ab8500);
		irq_set_chip_and_handler(irq, &ab8500_irq_chip,
R
Rabin Vincent 已提交
375
					 handle_simple_irq);
T
Thomas Gleixner 已提交
376
		irq_set_nested_thread(irq, 1);
R
Rabin Vincent 已提交
377 378 379
#ifdef CONFIG_ARM
		set_irq_flags(irq, IRQF_VALID);
#else
T
Thomas Gleixner 已提交
380
		irq_set_noprobe(irq);
R
Rabin Vincent 已提交
381 382 383 384 385 386 387 388 389 390
#endif
	}

	return 0;
}

static void ab8500_irq_remove(struct ab8500 *ab8500)
{
	int base = ab8500->irq_base;
	int irq;
391 392
	int num_irqs;

393 394 395 396
	if (is_ab9540(ab8500))
		num_irqs = AB9540_NR_IRQS;
	else
		num_irqs = AB8500_NR_IRQS;
R
Rabin Vincent 已提交
397

398
	for (irq = base; irq < base + num_irqs; irq++) {
R
Rabin Vincent 已提交
399 400 401
#ifdef CONFIG_ARM
		set_irq_flags(irq, 0);
#endif
T
Thomas Gleixner 已提交
402 403
		irq_set_chip_and_handler(irq, NULL, NULL);
		irq_set_chip_data(irq, NULL);
R
Rabin Vincent 已提交
404 405 406
	}
}

407
/* AB8500 GPIO Resources */
408
static struct resource __devinitdata ab8500_gpio_resources[] = {
409 410 411 412 413 414 415 416
	{
		.name	= "GPIO_INT6",
		.start	= AB8500_INT_GPIO6R,
		.end	= AB8500_INT_GPIO41F,
		.flags	= IORESOURCE_IRQ,
	}
};

417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
/* AB9540 GPIO Resources */
static struct resource __devinitdata ab9540_gpio_resources[] = {
	{
		.name	= "GPIO_INT6",
		.start	= AB8500_INT_GPIO6R,
		.end	= AB8500_INT_GPIO41F,
		.flags	= IORESOURCE_IRQ,
	},
	{
		.name	= "GPIO_INT14",
		.start	= AB9540_INT_GPIO50R,
		.end	= AB9540_INT_GPIO54R,
		.flags	= IORESOURCE_IRQ,
	},
	{
		.name	= "GPIO_INT15",
		.start	= AB9540_INT_GPIO50F,
		.end	= AB9540_INT_GPIO54F,
		.flags	= IORESOURCE_IRQ,
	}
};

439
static struct resource __devinitdata ab8500_gpadc_resources[] = {
R
Rabin Vincent 已提交
440 441 442 443 444 445 446 447 448 449 450 451 452 453
	{
		.name	= "HW_CONV_END",
		.start	= AB8500_INT_GP_HW_ADC_CONV_END,
		.end	= AB8500_INT_GP_HW_ADC_CONV_END,
		.flags	= IORESOURCE_IRQ,
	},
	{
		.name	= "SW_CONV_END",
		.start	= AB8500_INT_GP_SW_ADC_CONV_END,
		.end	= AB8500_INT_GP_SW_ADC_CONV_END,
		.flags	= IORESOURCE_IRQ,
	},
};

454
static struct resource __devinitdata ab8500_rtc_resources[] = {
R
Rabin Vincent 已提交
455 456 457 458 459 460 461 462 463 464 465 466 467 468
	{
		.name	= "60S",
		.start	= AB8500_INT_RTC_60S,
		.end	= AB8500_INT_RTC_60S,
		.flags	= IORESOURCE_IRQ,
	},
	{
		.name	= "ALARM",
		.start	= AB8500_INT_RTC_ALARM,
		.end	= AB8500_INT_RTC_ALARM,
		.flags	= IORESOURCE_IRQ,
	},
};

469
static struct resource __devinitdata ab8500_poweronkey_db_resources[] = {
470 471 472 473 474 475 476 477 478 479 480 481 482 483
	{
		.name	= "ONKEY_DBF",
		.start	= AB8500_INT_PON_KEY1DB_F,
		.end	= AB8500_INT_PON_KEY1DB_F,
		.flags	= IORESOURCE_IRQ,
	},
	{
		.name	= "ONKEY_DBR",
		.start	= AB8500_INT_PON_KEY1DB_R,
		.end	= AB8500_INT_PON_KEY1DB_R,
		.flags	= IORESOURCE_IRQ,
	},
};

484
static struct resource __devinitdata ab8500_av_acc_detect_resources[] = {
485
	{
486 487 488 489
	       .name = "ACC_DETECT_1DB_F",
	       .start = AB8500_INT_ACC_DETECT_1DB_F,
	       .end = AB8500_INT_ACC_DETECT_1DB_F,
	       .flags = IORESOURCE_IRQ,
490 491
	},
	{
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
	       .name = "ACC_DETECT_1DB_R",
	       .start = AB8500_INT_ACC_DETECT_1DB_R,
	       .end = AB8500_INT_ACC_DETECT_1DB_R,
	       .flags = IORESOURCE_IRQ,
	},
	{
	       .name = "ACC_DETECT_21DB_F",
	       .start = AB8500_INT_ACC_DETECT_21DB_F,
	       .end = AB8500_INT_ACC_DETECT_21DB_F,
	       .flags = IORESOURCE_IRQ,
	},
	{
	       .name = "ACC_DETECT_21DB_R",
	       .start = AB8500_INT_ACC_DETECT_21DB_R,
	       .end = AB8500_INT_ACC_DETECT_21DB_R,
	       .flags = IORESOURCE_IRQ,
	},
	{
	       .name = "ACC_DETECT_22DB_F",
	       .start = AB8500_INT_ACC_DETECT_22DB_F,
	       .end = AB8500_INT_ACC_DETECT_22DB_F,
	       .flags = IORESOURCE_IRQ,
514
	},
515 516 517 518 519 520 521 522 523
	{
	       .name = "ACC_DETECT_22DB_R",
	       .start = AB8500_INT_ACC_DETECT_22DB_R,
	       .end = AB8500_INT_ACC_DETECT_22DB_R,
	       .flags = IORESOURCE_IRQ,
	},
};

static struct resource __devinitdata ab8500_charger_resources[] = {
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
	{
		.name = "MAIN_CH_UNPLUG_DET",
		.start = AB8500_INT_MAIN_CH_UNPLUG_DET,
		.end = AB8500_INT_MAIN_CH_UNPLUG_DET,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "MAIN_CHARGE_PLUG_DET",
		.start = AB8500_INT_MAIN_CH_PLUG_DET,
		.end = AB8500_INT_MAIN_CH_PLUG_DET,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "VBUS_DET_R",
		.start = AB8500_INT_VBUS_DET_R,
		.end = AB8500_INT_VBUS_DET_R,
		.flags = IORESOURCE_IRQ,
	},
	{
543 544 545
		.name = "VBUS_DET_F",
		.start = AB8500_INT_VBUS_DET_F,
		.end = AB8500_INT_VBUS_DET_F,
546 547 548
		.flags = IORESOURCE_IRQ,
	},
	{
549 550 551 552 553 554 555 556 557
		.name = "USB_LINK_STATUS",
		.start = AB8500_INT_USB_LINK_STATUS,
		.end = AB8500_INT_USB_LINK_STATUS,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "USB_CHARGE_DET_DONE",
		.start = AB8500_INT_USB_CHG_DET_DONE,
		.end = AB8500_INT_USB_CHG_DET_DONE,
558 559 560 561 562 563 564 565 566
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "VBUS_OVV",
		.start = AB8500_INT_VBUS_OVV,
		.end = AB8500_INT_VBUS_OVV,
		.flags = IORESOURCE_IRQ,
	},
	{
567 568 569
		.name = "USB_CH_TH_PROT_R",
		.start = AB8500_INT_USB_CH_TH_PROT_R,
		.end = AB8500_INT_USB_CH_TH_PROT_R,
570 571 572
		.flags = IORESOURCE_IRQ,
	},
	{
573 574 575
		.name = "USB_CH_TH_PROT_F",
		.start = AB8500_INT_USB_CH_TH_PROT_F,
		.end = AB8500_INT_USB_CH_TH_PROT_F,
576 577 578
		.flags = IORESOURCE_IRQ,
	},
	{
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
		.name = "MAIN_EXT_CH_NOT_OK",
		.start = AB8500_INT_MAIN_EXT_CH_NOT_OK,
		.end = AB8500_INT_MAIN_EXT_CH_NOT_OK,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "MAIN_CH_TH_PROT_R",
		.start = AB8500_INT_MAIN_CH_TH_PROT_R,
		.end = AB8500_INT_MAIN_CH_TH_PROT_R,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "MAIN_CH_TH_PROT_F",
		.start = AB8500_INT_MAIN_CH_TH_PROT_F,
		.end = AB8500_INT_MAIN_CH_TH_PROT_F,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "USB_CHARGER_NOT_OKR",
		.start = AB8500_INT_USB_CHARGER_NOT_OK,
		.end = AB8500_INT_USB_CHARGER_NOT_OK,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "USB_CHARGER_NOT_OKF",
		.start = AB8500_INT_USB_CHARGER_NOT_OKF,
		.end = AB8500_INT_USB_CHARGER_NOT_OKF,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "CH_WD_EXP",
		.start = AB8500_INT_CH_WD_EXP,
		.end = AB8500_INT_CH_WD_EXP,
		.flags = IORESOURCE_IRQ,
	},
};

static struct resource __devinitdata ab8500_btemp_resources[] = {
	{
		.name = "BAT_CTRL_INDB",
		.start = AB8500_INT_BAT_CTRL_INDB,
		.end = AB8500_INT_BAT_CTRL_INDB,
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "BTEMP_LOW",
		.start = AB8500_INT_BTEMP_LOW,
		.end = AB8500_INT_BTEMP_LOW,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "BTEMP_HIGH",
		.start = AB8500_INT_BTEMP_HIGH,
		.end = AB8500_INT_BTEMP_HIGH,
		.flags = IORESOURCE_IRQ,
	},
	{
636 637 638
		.name = "BTEMP_LOW_MEDIUM",
		.start = AB8500_INT_BTEMP_LOW_MEDIUM,
		.end = AB8500_INT_BTEMP_LOW_MEDIUM,
639 640 641
		.flags = IORESOURCE_IRQ,
	},
	{
642 643 644
		.name = "BTEMP_MEDIUM_HIGH",
		.start = AB8500_INT_BTEMP_MEDIUM_HIGH,
		.end = AB8500_INT_BTEMP_MEDIUM_HIGH,
645 646
		.flags = IORESOURCE_IRQ,
	},
647 648 649
};

static struct resource __devinitdata ab8500_fg_resources[] = {
650
	{
651 652 653
		.name = "NCONV_ACCU",
		.start = AB8500_INT_CCN_CONV_ACC,
		.end = AB8500_INT_CCN_CONV_ACC,
654 655 656
		.flags = IORESOURCE_IRQ,
	},
	{
657 658 659
		.name = "BATT_OVV",
		.start = AB8500_INT_BATT_OVV,
		.end = AB8500_INT_BATT_OVV,
660 661 662
		.flags = IORESOURCE_IRQ,
	},
	{
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
		.name = "LOW_BAT_F",
		.start = AB8500_INT_LOW_BAT_F,
		.end = AB8500_INT_LOW_BAT_F,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "LOW_BAT_R",
		.start = AB8500_INT_LOW_BAT_R,
		.end = AB8500_INT_LOW_BAT_R,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "CC_INT_CALIB",
		.start = AB8500_INT_CC_INT_CALIB,
		.end = AB8500_INT_CC_INT_CALIB,
678 679 680 681
		.flags = IORESOURCE_IRQ,
	},
};

682 683
static struct resource __devinitdata ab8500_chargalg_resources[] = {};

684
#ifdef CONFIG_DEBUG_FS
685
static struct resource __devinitdata ab8500_debug_resources[] = {
686 687 688 689 690 691 692 693 694 695 696 697 698
	{
		.name	= "IRQ_FIRST",
		.start	= AB8500_INT_MAIN_EXT_CH_NOT_OK,
		.end	= AB8500_INT_MAIN_EXT_CH_NOT_OK,
		.flags	= IORESOURCE_IRQ,
	},
	{
		.name	= "IRQ_LAST",
		.start	= AB8500_INT_USB_CHARGER_NOT_OKF,
		.end	= AB8500_INT_USB_CHARGER_NOT_OKF,
		.flags	= IORESOURCE_IRQ,
	},
};
699
#endif
700

701
static struct resource __devinitdata ab8500_usb_resources[] = {
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725
	{
		.name = "ID_WAKEUP_R",
		.start = AB8500_INT_ID_WAKEUP_R,
		.end = AB8500_INT_ID_WAKEUP_R,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "ID_WAKEUP_F",
		.start = AB8500_INT_ID_WAKEUP_F,
		.end = AB8500_INT_ID_WAKEUP_F,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "VBUS_DET_F",
		.start = AB8500_INT_VBUS_DET_F,
		.end = AB8500_INT_VBUS_DET_F,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "VBUS_DET_R",
		.start = AB8500_INT_VBUS_DET_R,
		.end = AB8500_INT_VBUS_DET_R,
		.flags = IORESOURCE_IRQ,
	},
726 727 728 729 730 731
	{
		.name = "USB_LINK_STATUS",
		.start = AB8500_INT_USB_LINK_STATUS,
		.end = AB8500_INT_USB_LINK_STATUS,
		.flags = IORESOURCE_IRQ,
	},
732 733 734 735 736 737 738 739 740 741 742 743
	{
		.name = "USB_ADP_PROBE_PLUG",
		.start = AB8500_INT_ADP_PROBE_PLUG,
		.end = AB8500_INT_ADP_PROBE_PLUG,
		.flags = IORESOURCE_IRQ,
	},
	{
		.name = "USB_ADP_PROBE_UNPLUG",
		.start = AB8500_INT_ADP_PROBE_UNPLUG,
		.end = AB8500_INT_ADP_PROBE_UNPLUG,
		.flags = IORESOURCE_IRQ,
	},
744 745
};

746
static struct resource __devinitdata ab8500_temp_resources[] = {
747 748 749 750 751 752 753 754
	{
		.name  = "AB8500_TEMP_WARM",
		.start = AB8500_INT_TEMP_WARM,
		.end   = AB8500_INT_TEMP_WARM,
		.flags = IORESOURCE_IRQ,
	},
};

755
static struct mfd_cell __devinitdata abx500_common_devs[] = {
M
Mattias Wallin 已提交
756 757 758
#ifdef CONFIG_DEBUG_FS
	{
		.name = "ab8500-debug",
759 760
		.num_resources = ARRAY_SIZE(ab8500_debug_resources),
		.resources = ab8500_debug_resources,
M
Mattias Wallin 已提交
761 762
	},
#endif
763 764 765 766 767 768
	{
		.name = "ab8500-sysctrl",
	},
	{
		.name = "ab8500-regulator",
	},
R
Rabin Vincent 已提交
769 770 771 772 773 774 775 776 777 778
	{
		.name = "ab8500-gpadc",
		.num_resources = ARRAY_SIZE(ab8500_gpadc_resources),
		.resources = ab8500_gpadc_resources,
	},
	{
		.name = "ab8500-rtc",
		.num_resources = ARRAY_SIZE(ab8500_rtc_resources),
		.resources = ab8500_rtc_resources,
	},
779
	{
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805
		.name = "ab8500-charger",
		.num_resources = ARRAY_SIZE(ab8500_charger_resources),
		.resources = ab8500_charger_resources,
	},
	{
		.name = "ab8500-btemp",
		.num_resources = ARRAY_SIZE(ab8500_btemp_resources),
		.resources = ab8500_btemp_resources,
	},
	{
		.name = "ab8500-fg",
		.num_resources = ARRAY_SIZE(ab8500_fg_resources),
		.resources = ab8500_fg_resources,
	},
	{
		.name = "ab8500-chargalg",
		.num_resources = ARRAY_SIZE(ab8500_chargalg_resources),
		.resources = ab8500_chargalg_resources,
	},
	{
		.name = "ab8500-acc-det",
		.num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources),
		.resources = ab8500_av_acc_detect_resources,
	},
	{
		.name = "ab8500-codec",
806
	},
807

808 809 810 811 812
	{
		.name = "ab8500-poweron-key",
		.num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources),
		.resources = ab8500_poweronkey_db_resources,
	},
A
Arun Murthy 已提交
813 814 815 816 817 818 819 820 821 822 823 824
	{
		.name = "ab8500-pwm",
		.id = 1,
	},
	{
		.name = "ab8500-pwm",
		.id = 2,
	},
	{
		.name = "ab8500-pwm",
		.id = 3,
	},
825
	{ .name = "ab8500-leds", },
826
	{
827 828 829 830 831 832
		.name = "ab8500-denc",
	},
	{
		.name = "ab8500-temp",
		.num_resources = ARRAY_SIZE(ab8500_temp_resources),
		.resources = ab8500_temp_resources,
833
	},
R
Rabin Vincent 已提交
834 835
};

836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861
static struct mfd_cell __devinitdata ab8500_devs[] = {
	{
		.name = "ab8500-gpio",
		.num_resources = ARRAY_SIZE(ab8500_gpio_resources),
		.resources = ab8500_gpio_resources,
	},
	{
		.name = "ab8500-usb",
		.num_resources = ARRAY_SIZE(ab8500_usb_resources),
		.resources = ab8500_usb_resources,
	},
};

static struct mfd_cell __devinitdata ab9540_devs[] = {
	{
		.name = "ab8500-gpio",
		.num_resources = ARRAY_SIZE(ab9540_gpio_resources),
		.resources = ab9540_gpio_resources,
	},
	{
		.name = "ab9540-usb",
		.num_resources = ARRAY_SIZE(ab8500_usb_resources),
		.resources = ab8500_usb_resources,
	},
};

862 863 864 865 866 867 868 869 870
static ssize_t show_chip_id(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	struct ab8500 *ab8500;

	ab8500 = dev_get_drvdata(dev);
	return sprintf(buf, "%#x\n", ab8500 ? ab8500->chip_id : -EINVAL);
}

871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896
/*
 * ab8500 has switched off due to (SWITCH_OFF_STATUS):
 * 0x01 Swoff bit programming
 * 0x02 Thermal protection activation
 * 0x04 Vbat lower then BattOk falling threshold
 * 0x08 Watchdog expired
 * 0x10 Non presence of 32kHz clock
 * 0x20 Battery level lower than power on reset threshold
 * 0x40 Power on key 1 pressed longer than 10 seconds
 * 0x80 DB8500 thermal shutdown
 */
static ssize_t show_switch_off_status(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	int ret;
	u8 value;
	struct ab8500 *ab8500;

	ab8500 = dev_get_drvdata(dev);
	ret = get_register_interruptible(ab8500, AB8500_RTC,
		AB8500_SWITCH_OFF_STATUS, &value);
	if (ret < 0)
		return ret;
	return sprintf(buf, "%#x\n", value);
}

897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922
/*
 * ab8500 has turned on due to (TURN_ON_STATUS):
 * 0x01 PORnVbat
 * 0x02 PonKey1dbF
 * 0x04 PonKey2dbF
 * 0x08 RTCAlarm
 * 0x10 MainChDet
 * 0x20 VbusDet
 * 0x40 UsbIDDetect
 * 0x80 Reserved
 */
static ssize_t show_turn_on_status(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	int ret;
	u8 value;
	struct ab8500 *ab8500;

	ab8500 = dev_get_drvdata(dev);
	ret = get_register_interruptible(ab8500, AB8500_SYS_CTRL1_BLOCK,
		AB8500_TURN_ON_STATUS, &value);
	if (ret < 0)
		return ret;
	return sprintf(buf, "%#x\n", value);
}

923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975
static ssize_t show_ab9540_dbbrstn(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	struct ab8500 *ab8500;
	int ret;
	u8 value;

	ab8500 = dev_get_drvdata(dev);

	ret = get_register_interruptible(ab8500, AB8500_REGU_CTRL2,
		AB9540_MODEM_CTRL2_REG, &value);
	if (ret < 0)
		return ret;

	return sprintf(buf, "%d\n",
			(value & AB9540_MODEM_CTRL2_SWDBBRSTN_BIT) ? 1 : 0);
}

static ssize_t store_ab9540_dbbrstn(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t count)
{
	struct ab8500 *ab8500;
	int ret = count;
	int err;
	u8 bitvalues;

	ab8500 = dev_get_drvdata(dev);

	if (count > 0) {
		switch (buf[0]) {
		case '0':
			bitvalues = 0;
			break;
		case '1':
			bitvalues = AB9540_MODEM_CTRL2_SWDBBRSTN_BIT;
			break;
		default:
			goto exit;
		}

		err = mask_and_set_register_interruptible(ab8500,
			AB8500_REGU_CTRL2, AB9540_MODEM_CTRL2_REG,
			AB9540_MODEM_CTRL2_SWDBBRSTN_BIT, bitvalues);
		if (err)
			dev_info(ab8500->dev,
				"Failed to set DBBRSTN %c, err %#x\n",
				buf[0], err);
	}

exit:
	return ret;
}

976
static DEVICE_ATTR(chip_id, S_IRUGO, show_chip_id, NULL);
977
static DEVICE_ATTR(switch_off_status, S_IRUGO, show_switch_off_status, NULL);
978
static DEVICE_ATTR(turn_on_status, S_IRUGO, show_turn_on_status, NULL);
979 980
static DEVICE_ATTR(dbbrstn, S_IRUGO | S_IWUSR,
			show_ab9540_dbbrstn, store_ab9540_dbbrstn);
981 982 983

static struct attribute *ab8500_sysfs_entries[] = {
	&dev_attr_chip_id.attr,
984
	&dev_attr_switch_off_status.attr,
985
	&dev_attr_turn_on_status.attr,
986 987 988
	NULL,
};

989 990 991 992 993 994 995 996
static struct attribute *ab9540_sysfs_entries[] = {
	&dev_attr_chip_id.attr,
	&dev_attr_switch_off_status.attr,
	&dev_attr_turn_on_status.attr,
	&dev_attr_dbbrstn.attr,
	NULL,
};

997 998 999 1000
static struct attribute_group ab8500_attr_group = {
	.attrs	= ab8500_sysfs_entries,
};

1001 1002 1003 1004
static struct attribute_group ab9540_attr_group = {
	.attrs	= ab9540_sysfs_entries,
};

1005
int __devinit ab8500_init(struct ab8500 *ab8500, enum ab8500_version version)
R
Rabin Vincent 已提交
1006 1007 1008 1009
{
	struct ab8500_platform_data *plat = dev_get_platdata(ab8500->dev);
	int ret;
	int i;
1010
	u8 value;
R
Rabin Vincent 已提交
1011 1012 1013 1014 1015 1016 1017

	if (plat)
		ab8500->irq_base = plat->irq_base;

	mutex_init(&ab8500->lock);
	mutex_init(&ab8500->irq_lock);

1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028
	if (version != AB8500_VERSION_UNDEFINED)
		ab8500->version = version;
	else {
		ret = get_register_interruptible(ab8500, AB8500_MISC,
			AB8500_IC_NAME_REG, &value);
		if (ret < 0)
			return ret;

		ab8500->version = value;
	}

1029 1030
	ret = get_register_interruptible(ab8500, AB8500_MISC,
		AB8500_REV_REG, &value);
R
Rabin Vincent 已提交
1031 1032 1033
	if (ret < 0)
		return ret;

1034
	ab8500->chip_id = value;
R
Rabin Vincent 已提交
1035

1036 1037 1038 1039 1040
	dev_info(ab8500->dev, "detected chip, %s rev. %1x.%1x\n",
			ab8500_version_str[ab8500->version],
			ab8500->chip_id >> 4,
			ab8500->chip_id & 0x0F);

1041 1042 1043 1044 1045 1046 1047 1048
	/* Configure AB8500 or AB9540 IRQ */
	if (is_ab9540(ab8500)) {
		ab8500->mask_size = AB9540_NUM_IRQ_REGS;
		ab8500->irq_reg_offset = ab9540_irq_regoffset;
	} else {
		ab8500->mask_size = AB8500_NUM_IRQ_REGS;
		ab8500->irq_reg_offset = ab8500_irq_regoffset;
	}
1049 1050 1051 1052 1053 1054 1055 1056
	ab8500->mask = kzalloc(ab8500->mask_size, GFP_KERNEL);
	if (!ab8500->mask)
		return -ENOMEM;
	ab8500->oldmask = kzalloc(ab8500->mask_size, GFP_KERNEL);
	if (!ab8500->oldmask) {
		ret = -ENOMEM;
		goto out_freemask;
	}
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074
	/*
	 * ab8500 has switched off due to (SWITCH_OFF_STATUS):
	 * 0x01 Swoff bit programming
	 * 0x02 Thermal protection activation
	 * 0x04 Vbat lower then BattOk falling threshold
	 * 0x08 Watchdog expired
	 * 0x10 Non presence of 32kHz clock
	 * 0x20 Battery level lower than power on reset threshold
	 * 0x40 Power on key 1 pressed longer than 10 seconds
	 * 0x80 DB8500 thermal shutdown
	 */

	ret = get_register_interruptible(ab8500, AB8500_RTC,
		AB8500_SWITCH_OFF_STATUS, &value);
	if (ret < 0)
		return ret;
	dev_info(ab8500->dev, "switch off status: %#x", value);

R
Rabin Vincent 已提交
1075 1076 1077 1078
	if (plat && plat->init)
		plat->init(ab8500);

	/* Clear and mask all interrupts */
1079
	for (i = 0; i < ab8500->mask_size; i++) {
1080 1081 1082 1083 1084 1085
		/*
		 * Interrupt register 12 doesn't exist prior to AB8500 version
		 * 2.0
		 */
		if (ab8500->irq_reg_offset[i] == 11 &&
				is_ab8500_1p1_or_earlier(ab8500))
1086
			continue;
R
Rabin Vincent 已提交
1087

1088
		get_register_interruptible(ab8500, AB8500_INTERRUPT,
1089
			AB8500_IT_LATCH1_REG + ab8500->irq_reg_offset[i],
1090
			&value);
1091
		set_register_interruptible(ab8500, AB8500_INTERRUPT,
1092
			AB8500_IT_MASK1_REG + ab8500->irq_reg_offset[i], 0xff);
R
Rabin Vincent 已提交
1093 1094
	}

1095 1096
	ret = abx500_register_ops(ab8500->dev, &ab8500_ops);
	if (ret)
1097
		goto out_freeoldmask;
1098

1099
	for (i = 0; i < ab8500->mask_size; i++)
R
Rabin Vincent 已提交
1100 1101 1102 1103 1104
		ab8500->mask[i] = ab8500->oldmask[i] = 0xff;

	if (ab8500->irq_base) {
		ret = ab8500_irq_init(ab8500);
		if (ret)
1105
			goto out_freeoldmask;
R
Rabin Vincent 已提交
1106 1107

		ret = request_threaded_irq(ab8500->irq, NULL, ab8500_irq,
1108 1109
					   IRQF_ONESHOT | IRQF_NO_SUSPEND,
					   "ab8500", ab8500);
R
Rabin Vincent 已提交
1110 1111 1112 1113
		if (ret)
			goto out_removeirq;
	}

1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127
	ret = mfd_add_devices(ab8500->dev, 0, abx500_common_devs,
			      ARRAY_SIZE(abx500_common_devs), NULL,
			      ab8500->irq_base);

	if (ret)
		goto out_freeirq;

	if (is_ab9540(ab8500))
		ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs,
			      ARRAY_SIZE(ab9540_devs), NULL,
			      ab8500->irq_base);
	else
		ret = mfd_add_devices(ab8500->dev, 0, ab8500_devs,
			      ARRAY_SIZE(ab9540_devs), NULL,
R
Rabin Vincent 已提交
1128 1129 1130 1131
			      ab8500->irq_base);
	if (ret)
		goto out_freeirq;

1132 1133 1134 1135 1136 1137
	if (is_ab9540(ab8500))
		ret = sysfs_create_group(&ab8500->dev->kobj,
					&ab9540_attr_group);
	else
		ret = sysfs_create_group(&ab8500->dev->kobj,
					&ab8500_attr_group);
1138 1139
	if (ret)
		dev_err(ab8500->dev, "error creating sysfs entries\n");
1140 1141
	else
		return ret;
R
Rabin Vincent 已提交
1142 1143

out_freeirq:
L
Linus Walleij 已提交
1144
	if (ab8500->irq_base)
R
Rabin Vincent 已提交
1145 1146
		free_irq(ab8500->irq, ab8500);
out_removeirq:
L
Linus Walleij 已提交
1147
	if (ab8500->irq_base)
R
Rabin Vincent 已提交
1148
		ab8500_irq_remove(ab8500);
1149 1150 1151 1152
out_freeoldmask:
	kfree(ab8500->oldmask);
out_freemask:
	kfree(ab8500->mask);
L
Linus Walleij 已提交
1153

R
Rabin Vincent 已提交
1154 1155 1156 1157 1158
	return ret;
}

int __devexit ab8500_exit(struct ab8500 *ab8500)
{
1159 1160 1161 1162
	if (is_ab9540(ab8500))
		sysfs_remove_group(&ab8500->dev->kobj, &ab9540_attr_group);
	else
		sysfs_remove_group(&ab8500->dev->kobj, &ab8500_attr_group);
R
Rabin Vincent 已提交
1163 1164 1165 1166 1167
	mfd_remove_devices(ab8500->dev);
	if (ab8500->irq_base) {
		free_irq(ab8500->irq, ab8500);
		ab8500_irq_remove(ab8500);
	}
1168 1169
	kfree(ab8500->oldmask);
	kfree(ab8500->mask);
R
Rabin Vincent 已提交
1170 1171 1172 1173

	return 0;
}

1174
MODULE_AUTHOR("Mattias Wallin, Srinidhi Kasagar, Rabin Vincent");
R
Rabin Vincent 已提交
1175 1176
MODULE_DESCRIPTION("AB8500 MFD core");
MODULE_LICENSE("GPL v2");