OMAP: New twl-common for common TWL configuration
[linux-2.6-block.git] / arch / arm / mach-omap2 / twl-common.c
CommitLineData
a53b8e3b
PU
1/*
2 * twl-common.c
3 *
4 * Copyright (C) 2011 Texas Instruments, Inc..
5 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */
22
23#include <linux/i2c.h>
24#include <linux/i2c/twl.h>
25#include <linux/gpio.h>
26
27#include <plat/i2c.h>
28
29#include "twl-common.h"
30
31static struct i2c_board_info __initdata pmic_i2c_board_info = {
32 .addr = 0x48,
33 .flags = I2C_CLIENT_WAKE,
34};
35
36void __init omap_pmic_init(int bus, u32 clkrate,
37 const char *pmic_type, int pmic_irq,
38 struct twl4030_platform_data *pmic_data)
39{
40 strncpy(pmic_i2c_board_info.type, pmic_type,
41 sizeof(pmic_i2c_board_info.type));
42 pmic_i2c_board_info.irq = pmic_irq;
43 pmic_i2c_board_info.platform_data = pmic_data;
44
45 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
46}