Source
x
static int retu_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
/*
* Retu/Tahvo MFD driver
*
* Copyright (C) 2004, 2005 Nokia Corporation
*
* Based on code written by Juha Yrjölä, David Weinehall and Mikko Ylinen.
* Rewritten by Aaro Koskinen.
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file "COPYING" in the main directory of this
* archive for more details.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* Registers */
/* ASIC ID and revision */
/* Bit indicating Vilma */
/* Interrupt ID */
/* Interrupt mask (Retu) */
/* Interrupt mask (Tahvo) */
/* Interrupt sources */
/* Power button */
struct retu_dev {
struct regmap *regmap;
struct device *dev;
struct mutex mutex;
struct regmap_irq_chip_data *irq_data;
};
static struct resource retu_pwrbutton_res[] = {
{
.name = "retu-pwrbutton",
.start = RETU_INT_PWR,
.end = RETU_INT_PWR,
.flags = IORESOURCE_IRQ,
},
};
static const struct mfd_cell retu_devs[] = {
{
.name = "retu-wdt"
},
{
.name = "retu-pwrbutton",
.resources = retu_pwrbutton_res,
.num_resources = ARRAY_SIZE(retu_pwrbutton_res),
}
};
static struct regmap_irq retu_irqs[] = {
[RETU_INT_PWR] = {
.mask = 1 << RETU_INT_PWR,
}
};
static struct regmap_irq_chip retu_irq_chip = {
.name = "RETU",
.irqs = retu_irqs,
.num_irqs = ARRAY_SIZE(retu_irqs),
.num_regs = 1,
.status_base = RETU_REG_IDR,
.mask_base = RETU_REG_IMR,
.ack_base = RETU_REG_IDR,
};
/* Retu device registered for the power off. */
static struct retu_dev *retu_pm_power_off;
static struct resource tahvo_usb_res[] = {
{
.name = "tahvo-usb",
.start = TAHVO_INT_VBUS,
.end = TAHVO_INT_VBUS,
.flags = IORESOURCE_IRQ,