get rid of EOL spaces
[pandora-libraries.git] / include / pnd_device.h
1
2 #ifndef h_pnd_device_h
3 #define h_pnd_device_h
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 // do we have a 'minimal' lib yet anywhere formalized? if not, we could
10 // attempt to include it here.
11
12 // for reference material, see the Pandora wiki. Specifically, some good
13 // places to look:
14 // http://pandorawiki.org/Kernel_interface
15
16 /* for reference, here are some devices of use; most of these should already have
17  * functions below, to avoid you having to code your own.
18  */
19 #define PND_DEVICE_PROC_CLOCK "/proc/pandora/cpu_mhz_max"
20 #define PND_DEVICE_SYS_BACKLIGHT_BRIGHTNESS "/sys/class/backlight/gpio-backlight/brightness"
21 #define PND_DEVICE_FRAMEBUFFER "/dev/fb0"
22 #define PND_DEVICE_NUB1 "/dev/input/js1"
23 #define PND_DEVICE_NUB2 "/dev/input/js2"
24 #define PND_DEVICE_POWER_BASE "/sys/class/power_supply"
25 #define PND_DEVICE_BATTERY_GAUGE_PERC "/sys/class/power_supply/bq27500-0/capacity"
26 #define PND_DEVICE_CHARGE_CURRENT "/sys/class/power_supply/bq27500-0/current_now"
27
28 #define PND_DEVICE_LED_CHARGER "/sys/class/leds/pandora::charger"
29 #define PND_DEVICE_LED_POWER   "/sys/class/leds/pandora::power"
30 #define PND_DEVICE_LED_SD1     "/sys/class/leds/pandora::sd1"
31 #define PND_DEVICE_LED_SD2     "/sys/class/leds/pandora::sd2"
32 #define PND_DEVICE_LED_WIFI    "/sys/class/leds/pandora::wifi"
33 #define PND_DEVICE_LED_BT      "/sys/class/leds/pandora::bluetooth"
34 #define PND_DEVICE_LED_SUFFIX_BRIGHTNESS "/brightness"
35
36 // device names
37 #define PND_EVDEV_NUB1    "nub0" /*"vsense66"*/
38 #define PND_EVDEV_NUB2    "nub1" /*"vsense67"*/
39 #define PND_EVDEV_KEYPAD  "keypad" /*"omap_twl4030keypad"*/
40 #define PND_EVDEV_GPIO    "gpio-keys"
41 #define PND_EVDEV_TS      "touchscreen" /*"ADS784x Touchscreen"*/
42 #define PND_EVDEV_POWER   "power-button" /*"triton2-pwrbutton"*/
43
44 /* utility
45  */
46 unsigned char pnd_device_open_write_close ( char *name, char *v );
47 unsigned char pnd_device_open_read_close ( char *name, char *r_buffer, unsigned int buffer_len );
48
49 /* overall clock speed
50  * WARN: No boundaries are checked, so try to avoid setting clock to 2GHz :)
51  * NOTE: get-clock() is not implemented yet.
52  */
53 unsigned char pnd_device_set_clock ( unsigned int c ); // returns >0 on success
54 unsigned int pnd_device_get_clock ( void );
55
56 /* return the battery current %age level; 0-100%
57  * On error, returns -1
58  */
59 int pnd_device_get_battery_gauge_perc ( void );
60 unsigned char pnd_device_get_charge_current ( int *result ); // returns + - current; if charging, current is +ve.
61
62 /* return the battery charger enable state; 1 or 0
63  * On error, returns value < 0
64  */
65 int pnd_device_get_charger_enable ( const char *device );
66 unsigned char pnd_device_set_charger_enable ( const char *device, unsigned char v );
67
68 // LCD to set on/off
69
70 // Backlight control
71 unsigned char pnd_device_set_backlight ( unsigned int v ); // value to set; 0 is off
72 unsigned int pnd_device_get_backlight ( void );
73
74 // set one or more LEDs on
75 unsigned char pnd_device_set_led_power_brightness ( unsigned char v ); // 0-255
76 unsigned char pnd_device_set_led_charger_brightness ( unsigned char v ); // 0-255
77
78 // suspend/hibernate/etc
79
80 #ifdef __cplusplus
81 } /* "C" */
82 #endif
83
84 #endif