summaryrefslogtreecommitdiff
path: root/arch/arm/mach-mx3/mx35_3ds_pmic_mc9s08dz60.c
blob: 8428befdf0b32a5766c4549fb184b5e24cfd5e96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
95
96
97
98
99
100
101
102
103
104
105
/*
 * mx35-3stack-pmic-mc9s08dz60.c -- i.MX35 3STACK Driver for MCU PMIC
 */
 /*
  * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
  */

 /*
  * The code contained herein is licensed under the GNU General Public
  * License. You may obtain a copy of the GNU General Public License
  * Version 2 or later at the following locations:
  *
  * http://www.opensource.org/licenses/gpl-license.html
  * http://www.gnu.org/copyleft/gpl.html
  */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/pmic_external.h>
#include <linux/regulator/machine.h>
#include <linux/mfd/mc9s08dz60/core.h>

#include <mach/board-mx35_3ds.h>
#include <mach/hardware.h>

static struct regulator_init_data lcd_init = {
	.constraints = {
		.name = "LCD",
	}
};

static struct regulator_init_data wifi_init = {
	.constraints = {
		.name = "WIFI",
	}
};

static struct regulator_init_data hdd_init = {
	.constraints = {
		.name = "HDD",
	}
};

static struct regulator_init_data gps_init = {
	.constraints = {
		.name = "GPS",
	}
};

static struct regulator_init_data spkr_init = {
	.constraints = {
		.name = "SPKR",
	}
};

static int mc9s08dz60_regulator_init(struct mc9s08dz60 *mc9s08dz60)
{
	if (!board_is_rev(BOARD_REV_2))
		return 0;

	mc9s08dz60_register_regulator(
			mc9s08dz60, MC9S08DZ60_LCD, &lcd_init);
	mc9s08dz60_register_regulator(mc9s08dz60,
			MC9S08DZ60_WIFI, &wifi_init);
	mc9s08dz60_register_regulator(
			mc9s08dz60, MC9S08DZ60_HDD, &hdd_init);
	mc9s08dz60_register_regulator(
			mc9s08dz60, MC9S08DZ60_GPS, &gps_init);
	mc9s08dz60_register_regulator(mc9s08dz60,
				MC9S08DZ60_SPKR, &spkr_init);
	return 0;
}

static struct mc9s08dz60_platform_data mc9s08dz60_plat = {
	.init = mc9s08dz60_regulator_init,
};

static struct i2c_board_info __initdata mc9s08dz60_i2c_device = {
	I2C_BOARD_INFO("mc9s08dz60", 0x69),
	.platform_data = &mc9s08dz60_plat,
};

static struct resource mc9s08dz60_keypad_resource = {
	.start = MXC_PSEUDO_IRQ_KEYPAD,
	.end = MXC_PSEUDO_IRQ_KEYPAD,
	.flags = IORESOURCE_IRQ,
};

static struct platform_device mc9s08dz60_keypad_dev = {
	.name = "mc9s08dz60keypad",
	.num_resources = 1,
	.resource = &mc9s08dz60_keypad_resource,
};

int __init mx35_3stack_init_mc9s08dz60(void)
{
	int retval = 0;
	retval = i2c_register_board_info(0, &mc9s08dz60_i2c_device, 1);
	if (retval == 0)
		platform_device_register(&mc9s08dz60_keypad_dev);
	return retval;
}