2 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 * Qualcomm PMIC 8xxx driver header file
18 #ifndef __MFD_PM8XXX_CORE_H
19 #define __MFD_PM8XXX_CORE_H
21 #include <linux/mfd/core.h>
23 struct pm8xxx_drvdata {
24 int (*pmic_readb) (const struct device *dev, u16 addr, u8 *val);
25 int (*pmic_writeb) (const struct device *dev, u16 addr, u8 val);
26 int (*pmic_read_buf) (const struct device *dev, u16 addr, u8 *buf,
28 int (*pmic_write_buf) (const struct device *dev, u16 addr, u8 *buf,
33 static inline int pm8xxx_readb(const struct device *dev, u16 addr, u8 *val)
35 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
39 return dd->pmic_readb(dev, addr, val);
42 static inline int pm8xxx_writeb(const struct device *dev, u16 addr, u8 val)
44 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
48 return dd->pmic_writeb(dev, addr, val);
51 static inline int pm8xxx_read_buf(const struct device *dev, u16 addr, u8 *buf,
54 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
58 return dd->pmic_read_buf(dev, addr, buf, n);
61 static inline int pm8xxx_write_buf(const struct device *dev, u16 addr, u8 *buf,
64 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
68 return dd->pmic_write_buf(dev, addr, buf, n);