ARM: tizen_tm1_defconfig: Enable missing features related with CGROUPS
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / kernel / swap / energy / lcd / lcd_base.h
1 #ifndef _LCD_BASE_H
2 #define _LCD_BASE_H
3
4 /**
5  * @file energy/lcd/lcd_base.h
6  * @author Vyacheslav Cherkashin <v.cherkashin@samsung.com>
7  *
8  * @section LICENSE
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * @section COPYRIGHT
24  * Copyright (C) Samsung Electronics, 2013
25  *
26  * @section DESCRIPTION
27  * Description of the interface for interacting with LСD
28  */
29
30
31 #include <linux/errno.h>
32 #include <energy/rational_debugfs.h>
33
34
35 /** Description of actions */
36 enum lcd_action_type {
37         LAT_BRIGHTNESS,         /**< LCD brightness */
38         LAT_POWER               /**< LCD power */
39 };
40
41
42 /** Description of parameters */
43 enum lcd_parameter_type {
44         LPD_MIN_BRIGHTNESS,     /**< minimum brightness value */
45         LPD_MAX_BRIGHTNESS,     /**< maximum brightness value */
46         LPD_BRIGHTNESS,         /**< current brightness value */
47
48         LPD_POWER               /**< current power value */
49 };
50
51 struct lcd_ops;
52
53 /**
54  * @brief LCD callback type
55  *
56  * @param ops LCD operations
57  * @return Error code
58  */
59 typedef int (*call_lcd)(struct lcd_ops *ops);
60
61 /**
62  * @brief LCD notifier type
63  *
64  * @param ops LCD operations
65  * @param action Event type
66  * @param data Date
67  * @return Error code
68  */
69 typedef int (*notifier_lcd)(struct lcd_ops *ops, enum lcd_action_type action,
70                             void *data);
71
72 /**
73  * @brief LCD parameter type
74  *
75  * @param ops LCD operations
76  * @param type Requested parameter type
77  * @return Requested parameter value
78  *
79  */
80 typedef unsigned long (*get_parameter_lcd)(struct lcd_ops *ops,
81                                            enum lcd_parameter_type type);
82
83
84 /**
85  * @struct lcd_ops
86  * @breaf set of operations available for LСD
87  */
88 struct lcd_ops {
89         char *name;                     /**< LCD driver name */
90         notifier_lcd notifier;          /**< Notifier */
91         get_parameter_lcd get;          /**< Method to obtain the parameters */
92
93         call_lcd check;                 /**< LCD check on device */
94         call_lcd set;                   /**< LCD initialization */
95         call_lcd unset;                 /**< LCD deinitialization */
96
97         /* for debugfs */
98         struct dentry *dentry;          /**< Dentry of debugfs for this LCD */
99         struct rational min_coef;       /**< Minimum coefficient */
100         struct rational max_coef;       /**< Maximum coefficient */
101
102         void *priv;                     /**< Private data */
103 };
104
105 size_t get_lcd_size_array(struct lcd_ops *ops);
106 void get_lcd_array_time(struct lcd_ops *ops, u64 *array_time);
107
108 int read_val(const char *path);
109
110 int lcd_set_energy(void);
111 void lcd_unset_energy(void);
112
113 int lcd_init(void);
114 void lcd_exit(void);
115
116 #endif /* _LCD_BASE_H */