blob: c7a91f1d906cf1c643ad2f13ce76155e655b13d1 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* include/asm/mach-msm/htc_pwrsink.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (C) 2008 HTC Corporation.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16#ifndef _ARCH_ARM_MACH_MSM_HTC_PWRSINK_H_
17#define _ARCH_ARM_MACH_MSM_HTC_PWRSINK_H_
18
19#include <linux/platform_device.h>
20#include <linux/earlysuspend.h>
21
22typedef enum {
23 PWRSINK_AUDIO_PCM = 0,
24 PWRSINK_AUDIO_MP3,
25 PWRSINK_AUDIO_AAC,
26
27 PWRSINK_AUDIO_LAST = PWRSINK_AUDIO_AAC,
28 PWRSINK_AUDIO_INVALID
29} pwrsink_audio_id_type;
30
31struct pwr_sink_audio {
32 unsigned volume;
33 unsigned percent;
34};
35
36typedef enum {
37 PWRSINK_SYSTEM_LOAD = 0,
38 PWRSINK_AUDIO,
39 PWRSINK_BACKLIGHT,
40 PWRSINK_LED_BUTTON,
41 PWRSINK_LED_KEYBOARD,
42 PWRSINK_GP_CLK,
43 PWRSINK_BLUETOOTH,
44 PWRSINK_CAMERA,
45 PWRSINK_SDCARD,
46 PWRSINK_VIDEO,
47 PWRSINK_WIFI,
48
49 PWRSINK_LAST = PWRSINK_WIFI,
50 PWRSINK_INVALID
51} pwrsink_id_type;
52
53struct pwr_sink {
54 pwrsink_id_type id;
55 unsigned ua_max;
56 unsigned percent_util;
57};
58
59struct pwr_sink_platform_data {
60 unsigned num_sinks;
61 struct pwr_sink *sinks;
62 int (*suspend_late)(struct platform_device *, pm_message_t state);
63 int (*resume_early)(struct platform_device *);
64 void (*suspend_early)(struct early_suspend *);
65 void (*resume_late)(struct early_suspend *);
66};
67
68#ifndef CONFIG_HTC_PWRSINK
69static inline int htc_pwrsink_set(pwrsink_id_type id, unsigned percent)
70{
71 return 0;
72}
73static inline int htc_pwrsink_audio_set(pwrsink_audio_id_type id,
74 unsigned percent_utilized) { return 0; }
75static inline int htc_pwrsink_audio_volume_set(
76 pwrsink_audio_id_type id, unsigned volume) { return 0; }
77static inline int htc_pwrsink_audio_path_set(unsigned path) { return 0; }
78#else
79extern int htc_pwrsink_set(pwrsink_id_type id, unsigned percent);
80extern int htc_pwrsink_audio_set(pwrsink_audio_id_type id,
81 unsigned percent_utilized);
82extern int htc_pwrsink_audio_volume_set(pwrsink_audio_id_type id,
83 unsigned volume);
84extern int htc_pwrsink_audio_path_set(unsigned path);
85#endif
86
87#endif