+ return read_int_from_file("/sys/class/power_supply/bq27500-0/capacity");
+}
+
+static int gamma_set(int val, int black_level)
+{
+ char buf[128];
+
+ snprintf(buf, sizeof(buf), "%s/op_gamma.sh -b %d %.2f",
+ pnd_script_base, black_level, (float)val / 100.0f);
+ return do_system(buf);
+}
+
+/* For now, this only switches tv-out to appropriate fb.
+ * Maybe this could control actual layers too? */
+static int switch_layer(int which, int enable)
+{
+ static int was_ovl_enabled = -1;
+ int tv_enabled = 0;
+ char buf[128];
+ int ret;
+
+ if (which != 1)
+ return -1;
+ if (enable == was_ovl_enabled)
+ return 0;
+
+ was_ovl_enabled = -1;
+
+ tv_enabled = read_int_from_file(
+ "/sys/devices/platform/omapdss/display1/enabled");
+ if (tv_enabled < 0)
+ return -1;
+
+ if (!tv_enabled) {
+ // tv-out not enabled
+ return 0;