mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-28 07:04:00 +08:00
4b78147468
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJPw2QKAAoJEIqAPN1PVmxKfv8P/2L5d38tc3+9wYuGI1l+k7Mz xQt2PdAx/kHQGTjLE1DSoeOD6dn4aodFbPaTcsLsU9Eo4IiJnT68b8adr/bqYHKU Cod6NSPJMaBxLBJZxXsA7nY69Z6O5SMjXxEQsiDc24gaP0jjwaeY35KJSfMug8nF DA6rvEpchkF8QXzBmkO2t2/uPYr1YWqDZQkauLDnLRG01JnGXFz5ajv9N5pYhiFt QyYtheg8yEnfwnQ6AlmRtGK75jZRVmrj0kOzRjE9UL7ZwtzswWJes+RE3tlgk89m JQ7KASRmmqLpvcVJ9fG9SlGX//yBO6OEp5Km06RTxgmt0XftBDVqBTjk1EG2tfMR SR0NIz6gJ0twKAe6U0d+5HMYalOU45H5ha9e3vCqZ8vl9JfmM95RS+TmWbGcRIqj 04Y5x3I4zq6e9D0u+211BeuRfzkQiefwWJmdPpn0oac3u5LeYbRj/aQ85fqwJWzG f99D9VU5xgfFHPAtL3SLFiwgd9yOiMBar6eeIva+okDyOW3KaEUzs8Y4dgDyvYcg IU//JGK51vLVmI5kXtGCwYkgRLF/Y7WKZ8TwypT+SY6iv6tPQVvApOZljq7RC9GI mXx2z2slA90jlg3TlEFZfxr1WqbZ3TCbonU1riLeMEtkiXUpLtmKC8gbhOqfGvvn Nzgt+YqRJXafZdELb/S+ =Rh0r -----END PGP SIGNATURE----- Merge tag 'mfd-3.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6 Pull MFD changes from Samuel Ortiz: "Besides the usual cleanups, this one brings: * Support for 5 new chipsets: Intel's ICH LPC and SCH Centerton, ST-E's STAX211, Samsung's MAX77693 and TI's LM3533. * Device tree support for the twl6040, tps65910, da9502 and ab8500 drivers. * Fairly big tps56910, ab8500 and db8500 updates. * i2c support for mc13xxx. * Our regular update for the wm8xxx driver from Mark." Fix up various conflicts with other trees, largely due to ab5500 removal etc. * tag 'mfd-3.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (106 commits) mfd: Fix build break of max77693 by adding REGMAP_I2C option mfd: Fix twl6040 build failure mfd: Fix max77693 build failure mfd: ab8500-core should depend on MFD_DB8500_PRCMU gpio: tps65910: dt: process gpio specific device node info mfd: Remove the parsing of dt info for tps65910 gpio mfd: Save device node parsed platform data for tps65910 sub devices mfd: Add r_select to lm3533 platform data gpio: Add Intel Centerton support to gpio-sch mfd: Emulate active low IRQs as well as active high IRQs for wm831x mfd: Mark two lm3533 zone registers as volatile mfd: Fix return type of lm533 attribute is_visible mfd: Enable Device Tree support in the ab8500-pwm driver mfd: Enable Device Tree support in the ab8500-sysctrl driver mfd: Add support for Device Tree to twl6040 mfd: Register the twl6040 child for the ASoC codec unconditionally mfd: Allocate twl6040 IRQ numbers dynamically mfd: twl6040 code cleanup in interrupt initialization part mfd: Enable ab8500-gpadc driver for Device Tree mfd: Prevent unassigned pointer from being used in ab8500-gpadc driver ...
150 lines
3.8 KiB
C
150 lines
3.8 KiB
C
/*
|
|
* da9052 declarations for DA9052 PMICs.
|
|
*
|
|
* Copyright(c) 2011 Dialog Semiconductor Ltd.
|
|
*
|
|
* Author: David Dajun Chen <dchen@diasemi.com>
|
|
*
|
|
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*
|
|
*/
|
|
|
|
#ifndef __MFD_DA9052_DA9052_H
|
|
#define __MFD_DA9052_DA9052_H
|
|
|
|
#include <linux/interrupt.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/completion.h>
|
|
#include <linux/list.h>
|
|
#include <linux/mfd/core.h>
|
|
|
|
#include <linux/mfd/da9052/reg.h>
|
|
|
|
/* Common - HWMON Channel Definations */
|
|
#define DA9052_ADC_VDDOUT 0
|
|
#define DA9052_ADC_ICH 1
|
|
#define DA9052_ADC_TBAT 2
|
|
#define DA9052_ADC_VBAT 3
|
|
#define DA9052_ADC_IN4 4
|
|
#define DA9052_ADC_IN5 5
|
|
#define DA9052_ADC_IN6 6
|
|
#define DA9052_ADC_TSI 7
|
|
#define DA9052_ADC_TJUNC 8
|
|
#define DA9052_ADC_VBBAT 9
|
|
|
|
#define DA9052_IRQ_DCIN 0
|
|
#define DA9052_IRQ_VBUS 1
|
|
#define DA9052_IRQ_DCINREM 2
|
|
#define DA9052_IRQ_VBUSREM 3
|
|
#define DA9052_IRQ_VDDLOW 4
|
|
#define DA9052_IRQ_ALARM 5
|
|
#define DA9052_IRQ_SEQRDY 6
|
|
#define DA9052_IRQ_COMP1V2 7
|
|
#define DA9052_IRQ_NONKEY 8
|
|
#define DA9052_IRQ_IDFLOAT 9
|
|
#define DA9052_IRQ_IDGND 10
|
|
#define DA9052_IRQ_CHGEND 11
|
|
#define DA9052_IRQ_TBAT 12
|
|
#define DA9052_IRQ_ADC_EOM 13
|
|
#define DA9052_IRQ_PENDOWN 14
|
|
#define DA9052_IRQ_TSIREADY 15
|
|
#define DA9052_IRQ_GPI0 16
|
|
#define DA9052_IRQ_GPI1 17
|
|
#define DA9052_IRQ_GPI2 18
|
|
#define DA9052_IRQ_GPI3 19
|
|
#define DA9052_IRQ_GPI4 20
|
|
#define DA9052_IRQ_GPI5 21
|
|
#define DA9052_IRQ_GPI6 22
|
|
#define DA9052_IRQ_GPI7 23
|
|
#define DA9052_IRQ_GPI8 24
|
|
#define DA9052_IRQ_GPI9 25
|
|
#define DA9052_IRQ_GPI10 26
|
|
#define DA9052_IRQ_GPI11 27
|
|
#define DA9052_IRQ_GPI12 28
|
|
#define DA9052_IRQ_GPI13 29
|
|
#define DA9052_IRQ_GPI14 30
|
|
#define DA9052_IRQ_GPI15 31
|
|
|
|
enum da9052_chip_id {
|
|
DA9052,
|
|
DA9053_AA,
|
|
DA9053_BA,
|
|
DA9053_BB,
|
|
};
|
|
|
|
struct da9052_pdata;
|
|
|
|
struct da9052 {
|
|
struct device *dev;
|
|
struct regmap *regmap;
|
|
|
|
struct mutex auxadc_lock;
|
|
struct completion done;
|
|
|
|
int irq_base;
|
|
struct regmap_irq_chip_data *irq_data;
|
|
u8 chip_id;
|
|
|
|
int chip_irq;
|
|
};
|
|
|
|
/* ADC API */
|
|
int da9052_adc_manual_read(struct da9052 *da9052, unsigned char channel);
|
|
int da9052_adc_read_temp(struct da9052 *da9052);
|
|
|
|
/* Device I/O API */
|
|
static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg)
|
|
{
|
|
int val, ret;
|
|
|
|
ret = regmap_read(da9052->regmap, reg, &val);
|
|
if (ret < 0)
|
|
return ret;
|
|
return val;
|
|
}
|
|
|
|
static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
|
|
unsigned char val)
|
|
{
|
|
return regmap_write(da9052->regmap, reg, val);
|
|
}
|
|
|
|
static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
|
|
unsigned reg_cnt, unsigned char *val)
|
|
{
|
|
return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
|
|
}
|
|
|
|
static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
|
|
unsigned reg_cnt, unsigned char *val)
|
|
{
|
|
return regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
|
|
}
|
|
|
|
static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
|
|
unsigned char bit_mask,
|
|
unsigned char reg_val)
|
|
{
|
|
return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
|
|
}
|
|
|
|
int da9052_device_init(struct da9052 *da9052, u8 chip_id);
|
|
void da9052_device_exit(struct da9052 *da9052);
|
|
|
|
extern struct regmap_config da9052_regmap_config;
|
|
|
|
#endif /* __MFD_DA9052_DA9052_H */
|