~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to include/linux/mfd/pm8xxx/core.h

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
 
3
 *
 
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.
 
7
 *
 
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.
 
12
 */
 
13
/*
 
14
 * Qualcomm PMIC 8xxx driver header file
 
15
 *
 
16
 */
 
17
 
 
18
#ifndef __MFD_PM8XXX_CORE_H
 
19
#define __MFD_PM8XXX_CORE_H
 
20
 
 
21
#include <linux/mfd/core.h>
 
22
 
 
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,
 
27
                                                                        int n);
 
28
        int     (*pmic_write_buf) (const struct device *dev, u16 addr, u8 *buf,
 
29
                                                                        int n);
 
30
        int     (*pmic_read_irq_stat) (const struct device *dev, int irq);
 
31
        void    *pm_chip_data;
 
32
};
 
33
 
 
34
static inline int pm8xxx_readb(const struct device *dev, u16 addr, u8 *val)
 
35
{
 
36
        struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
 
37
 
 
38
        if (!dd)
 
39
                return -EINVAL;
 
40
        return dd->pmic_readb(dev, addr, val);
 
41
}
 
42
 
 
43
static inline int pm8xxx_writeb(const struct device *dev, u16 addr, u8 val)
 
44
{
 
45
        struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
 
46
 
 
47
        if (!dd)
 
48
                return -EINVAL;
 
49
        return dd->pmic_writeb(dev, addr, val);
 
50
}
 
51
 
 
52
static inline int pm8xxx_read_buf(const struct device *dev, u16 addr, u8 *buf,
 
53
                                                                        int n)
 
54
{
 
55
        struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
 
56
 
 
57
        if (!dd)
 
58
                return -EINVAL;
 
59
        return dd->pmic_read_buf(dev, addr, buf, n);
 
60
}
 
61
 
 
62
static inline int pm8xxx_write_buf(const struct device *dev, u16 addr, u8 *buf,
 
63
                                                                        int n)
 
64
{
 
65
        struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
 
66
 
 
67
        if (!dd)
 
68
                return -EINVAL;
 
69
        return dd->pmic_write_buf(dev, addr, buf, n);
 
70
}
 
71
 
 
72
static inline int pm8xxx_read_irq_stat(const struct device *dev, int irq)
 
73
{
 
74
        struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
 
75
 
 
76
        if (!dd)
 
77
                return -EINVAL;
 
78
        return dd->pmic_read_irq_stat(dev, irq);
 
79
}
 
80
 
 
81
#endif