Re: [PATCH v2 2/4] mfd: introduce retu-mfd driver

From: Felipe Balbi
Date: Wed Oct 31 2012 - 14:43:25 EST


On Wed, Oct 31, 2012 at 08:03:44PM +0200, Aaro Koskinen wrote:
> Retu is a multi-function device found on Nokia Internet Tablets
> implementing at least watchdog, RTC, headset detection and power button
> functionality.
>
> This patch implements minimum functionality providing register access,
> IRQ handling and power off functions.
>
> Cc: sameo@xxxxxxxxxxxxxxx
> Acked-by: Felipe Balbi <balbi@xxxxxx>
> Acked-by: Tony Lindgren <tony@xxxxxxxxxxx>
> Signed-off-by: Aaro Koskinen <aaro.koskinen@xxxxxx>
> ---
> drivers/mfd/Kconfig | 9 ++
> drivers/mfd/Makefile | 1 +
> drivers/mfd/retu-mfd.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/mfd/retu.h | 22 ++++
> 4 files changed, 296 insertions(+), 0 deletions(-)
> create mode 100644 drivers/mfd/retu-mfd.c
> create mode 100644 include/linux/mfd/retu.h
>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index acab3ef..7528c5e 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1044,6 +1044,15 @@ config MFD_PALMAS
> If you say yes here you get support for the Palmas
> series of PMIC chips from Texas Instruments.
>
> +config MFD_RETU
> + tristate "Support for Retu multi-function device"
> + select MFD_CORE
> + depends on I2C
> + select REGMAP_IRQ
> + help
> + Retu is a multi-function device found on Nokia Internet Tablets
> + (770, N800 and N810).
> +
> endmenu
> endif
>
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index d8ccb63..ad7879f 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -138,3 +138,4 @@ obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
> obj-$(CONFIG_MFD_SEC_CORE) += sec-core.o sec-irq.o
> obj-$(CONFIG_MFD_SYSCON) += syscon.o
> obj-$(CONFIG_MFD_LM3533) += lm3533-core.o lm3533-ctrlbank.o
> +obj-$(CONFIG_MFD_RETU) += retu-mfd.o
> diff --git a/drivers/mfd/retu-mfd.c b/drivers/mfd/retu-mfd.c
> new file mode 100644
> index 0000000..8f81566
> --- /dev/null
> +++ b/drivers/mfd/retu-mfd.c
> @@ -0,0 +1,264 @@
> +/*
> + * Retu 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.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/i2c.h>
> +#include <linux/irq.h>
> +#include <linux/init.h>
> +#include <linux/slab.h>
> +#include <linux/mutex.h>
> +#include <linux/module.h>
> +#include <linux/regmap.h>
> +#include <linux/mfd/core.h>
> +#include <linux/mfd/retu.h>
> +#include <linux/interrupt.h>
> +#include <linux/moduleparam.h>
> +
> +/* Registers */
> +#define RETU_REG_ASICR 0x00 /* ASIC ID and revision */
> +#define RETU_REG_ASICR_VILMA (1 << 7) /* Bit indicating Vilma */
> +#define RETU_REG_IDR 0x01 /* Interrupt ID */
> +#define RETU_REG_IMR 0x02 /* Interrupt mask */
> +
> +/* Interrupt sources */
> +#define RETU_INT_PWR 0 /* 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 struct mfd_cell retu_devs[] = {
> + {
> + .name = "retu-wdt"
> + },
> + {
> + .name = "retu-pwrbutton",
> + .resources = &retu_pwrbutton_res[0],

.resources = retu_powerbutton_res, ??

--
balbi

Attachment: signature.asc
Description: Digital signature