From ceee35acb43eac80425873f44f18a963747015c4 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Thu, 7 Jul 2011 20:31:46 +0530 Subject: mfd: ricoh583: Add core driver Adding core driver for the Powermanagement system device RICOH 583. bug 822562 Change-Id: I8a21b42800bd9043f901689ed354618165c42534 Reviewed-on: http://git-master/r/40035 Reviewed-by: Varun Colbert Tested-by: Varun Colbert --- include/linux/mfd/ricoh583.h | 127 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 include/linux/mfd/ricoh583.h (limited to 'include') diff --git a/include/linux/mfd/ricoh583.h b/include/linux/mfd/ricoh583.h new file mode 100644 index 000000000000..e420bc9a57cd --- /dev/null +++ b/include/linux/mfd/ricoh583.h @@ -0,0 +1,127 @@ +/* include/linux/mfd/ricoh583.h + * + * Core driver interface to access RICOH583 power management chip. + * + * Copyright (C) 2011 NVIDIA Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef __LINUX_MFD_RICOH583_H +#define __LINUX_MFD_RICOH583_H + +/* RICOH583 IRQ definitions */ +enum { + RICOH583_IRQ_ONKEY, + RICOH583_IRQ_ACOK, + RICOH583_IRQ_LIDOPEN, + RICOH583_IRQ_PREOT, + RICOH583_IRQ_CLKSTP, + RICOH583_IRQ_ONKEY_OFF, + RICOH583_IRQ_WD, + RICOH583_IRQ_EN_PWRREQ1, + RICOH583_IRQ_EN_PWRREQ2, + RICOH583_IRQ_PRE_VINDET, + + RICOH583_IRQ_DC0LIM, + RICOH583_IRQ_DC1LIM, + RICOH583_IRQ_DC2LIM, + RICOH583_IRQ_DC3LIM, + + RICOH583_IRQ_CTC, + RICOH583_IRQ_YALE, + RICOH583_IRQ_DALE, + RICOH583_IRQ_WALE, + + RICOH583_IRQ_AIN1L, + RICOH583_IRQ_AIN2L, + RICOH583_IRQ_AIN3L, + RICOH583_IRQ_VBATL, + RICOH583_IRQ_VIN3L, + RICOH583_IRQ_VIN8L, + RICOH583_IRQ_AIN1H, + RICOH583_IRQ_AIN2H, + RICOH583_IRQ_AIN3H, + RICOH583_IRQ_VBATH, + RICOH583_IRQ_VIN3H, + RICOH583_IRQ_VIN8H, + RICOH583_IRQ_ADCEND, + + RICOH583_IRQ_GPIO0, + RICOH583_IRQ_GPIO1, + RICOH583_IRQ_GPIO2, + RICOH583_IRQ_GPIO3, + RICOH583_IRQ_GPIO4, + RICOH583_IRQ_GPIO5, + RICOH583_IRQ_GPIO6, + RICOH583_IRQ_GPIO7, + RICOH583_NR_IRQS, +}; + +/* Ricoh583 gpio definitions */ +enum { + RICOH583_GPIO0, + RICOH583_GPIO1, + RICOH583_GPIO2, + RICOH583_GPIO3, + RICOH583_GPIO4, + RICOH583_GPIO5, + RICOH583_GPIO6, + RICOH583_GPIO7, + + RICOH583_NR_GPIO, +}; + +struct ricoh583_subdev_info { + int id; + const char *name; + void *platform_data; +}; + +struct ricoh583_rtc_platform_data { + int irq; +}; + +struct ricoh583_gpio_init_data { + unsigned pulldn_en:1; /* Enable pull down */ + unsigned output_mode_en:1; /* Enable output mode during init */ + unsigned output_val:1; /* Output value if it is in output mode */ + unsigned init_apply:1; /* Apply init data on configuring gpios*/ +}; + +struct ricoh583_platform_data { + int num_subdevs; + struct ricoh583_subdev_info *subdevs; + int gpio_base; + int irq_base; + + struct ricoh583_gpio_init_data *gpio_init_data; + int num_gpioinit_data; +}; + +extern int ricoh583_read(struct device *dev, uint8_t reg, uint8_t *val); +extern int ricoh583_bulk_read(struct device *dev, u8 reg, u8 count, + uint8_t *val); +extern int ricoh583_write(struct device *dev, u8 reg, uint8_t val); +extern int ricoh583_bulk_write(struct device *dev, u8 reg, u8 count, + uint8_t *val); +extern int ricoh583_set_bits(struct device *dev, u8 reg, uint8_t bit_mask); +extern int ricoh583_clr_bits(struct device *dev, u8 reg, uint8_t bit_mask); +extern int ricoh583_update(struct device *dev, u8 reg, uint8_t val, + uint8_t mask); +extern int ricoh583_power_off(void); + +#endif -- cgit v1.2.3