Add PSU callbacks to platforms that use AC power only

This adds PSU callbacks to platforms which run on AC power only.

BUG=chrome-os-partner:23944
BRANCH=none
TEST=tested on beltino, stumpy

Change-Id: I950bae0cb627b62fab08623e47a9bc4b589d8bd3
Reviewed-on: https://chromium-review.googlesource.com/183754
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
diff --git a/platform/experimental/beltino/Makefile b/platform/experimental/beltino/Makefile
index 5e479df..f881bd9 100644
--- a/platform/experimental/beltino/Makefile
+++ b/platform/experimental/beltino/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_EXPERIMENTAL_BELTINO)	+= gpio.o
 obj-$(CONFIG_EXPERIMENTAL_BELTINO)	+= memory.o
 obj-$(CONFIG_EXPERIMENTAL_BELTINO)	+= nvram.o
+obj-$(CONFIG_EXPERIMENTAL_BELTINO)	+= psu.o
 obj-$(CONFIG_EXPERIMENTAL_BELTINO)	+= sensors.o
 obj-$(CONFIG_EXPERIMENTAL_BELTINO)	+= sys.o
 obj-$(CONFIG_EXPERIMENTAL_BELTINO)	+= beltino.o
diff --git a/platform/experimental/beltino/beltino.c b/platform/experimental/beltino/beltino.c
index 66687f8..62d3047 100644
--- a/platform/experimental/beltino/beltino.c
+++ b/platform/experimental/beltino/beltino.c
@@ -76,6 +76,7 @@
 	&cmd_memory,
 	&cmd_nvram,
 	&cmd_platform,
+	&cmd_psu,
 	&cmd_sensor,
 	&cmd_smbios,
 	&cmd_eventlog,
@@ -137,6 +138,7 @@
 	.gpio		= &beltino_gpio_cb,
 	.memory		= &beltino_memory_cb,
 	.nvram		= &beltino_nvram_cb,
+	.psu		= &beltino_psu_cb,
 	.sensor		= &beltino_sensor_cb,
 	.smbios		= &smbios_sysinfo_cb,
 	.sys 		= &beltino_sys_cb,
diff --git a/platform/experimental/beltino/beltino.h b/platform/experimental/beltino/beltino.h
index 5f404c3..ab2d97d 100644
--- a/platform/experimental/beltino/beltino.h
+++ b/platform/experimental/beltino/beltino.h
@@ -43,6 +43,7 @@
 extern struct gpio_cb beltino_gpio_cb;		/* gpio.c */
 extern struct memory_cb beltino_memory_cb;	/* memory.c */
 extern struct nvram_cb beltino_nvram_cb;	/* nvram.c */
+extern struct psu_cb beltino_psu_cb;		/* psu.c */
 extern struct sensor_cb beltino_sensor_cb;	/* sensors.c */
 extern struct sys_cb beltino_sys_cb;		/* sys.c */
 
diff --git a/platform/experimental/beltino/psu.c b/platform/experimental/beltino/psu.c
new file mode 100644
index 0000000..a6c1f56
--- /dev/null
+++ b/platform/experimental/beltino/psu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials provided
+ *      with the distribution.
+ *    * Neither the name of Google Inc. nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mosys/platform.h"
+
+static enum psu_types psu_type(struct platform_intf *intf)
+{
+	return PSU_TYPE_AC_ONLY;
+}
+
+struct psu_cb beltino_psu_cb = {
+	.type		= &psu_type,
+};
diff --git a/platform/experimental/kiev/Makefile b/platform/experimental/kiev/Makefile
index b5dfef7..c74dff9 100644
--- a/platform/experimental/kiev/Makefile
+++ b/platform/experimental/kiev/Makefile
@@ -3,6 +3,7 @@
 #obj-$(CONFIG_EXPERIMENTAL_KIEV)	+= gpio.o
 obj-$(CONFIG_EXPERIMENTAL_KIEV)	+= memory.o
 obj-$(CONFIG_EXPERIMENTAL_KIEV)	+= nvram.o
+obj-$(CONFIG_EXPERIMENTAL_KIEV)	+= psu.o
 obj-$(CONFIG_EXPERIMENTAL_KIEV)	+= sensors.o
 obj-$(CONFIG_EXPERIMENTAL_KIEV)	+= kiev.o
 obj-$(CONFIG_EXPERIMENTAL_KIEV)	+= sys.o
diff --git a/platform/experimental/kiev/kiev.c b/platform/experimental/kiev/kiev.c
index 37e282b..de00b76 100644
--- a/platform/experimental/kiev/kiev.c
+++ b/platform/experimental/kiev/kiev.c
@@ -58,6 +58,7 @@
 	&cmd_memory,
 	&cmd_nvram,
 	&cmd_platform,
+	&cmd_psu,
 	&cmd_sensor,
 	&cmd_smbios,
 	&cmd_vpd,
@@ -133,6 +134,7 @@
 //	.gpio		= &kiev_gpio_cb,
 	.memory		= &kiev_memory_cb,
 	.nvram		= &kiev_nvram_cb,
+	.psu		= &kiev_psu_cb,
 	.smbios		= &smbios_sysinfo_cb,
 	.sensor		= &kiev_sensor_cb,
 	.sys 		= &kiev_sys_cb,
diff --git a/platform/experimental/kiev/kiev.h b/platform/experimental/kiev/kiev.h
index 3a45c8d..fe4495d 100644
--- a/platform/experimental/kiev/kiev.h
+++ b/platform/experimental/kiev/kiev.h
@@ -42,6 +42,7 @@
 //extern struct gpio_cb kiev_gpio_cb;		/* gpio.c */
 extern struct memory_cb kiev_memory_cb;	/* memory.c */
 extern struct nvram_cb kiev_nvram_cb;		/* nvram.c */
+extern struct psu_cb kiev_psu_cb;		/* psu.c */
 extern struct sensor_cb kiev_sensor_cb;	/* sensors.c */
 extern struct sys_cb kiev_sys_cb;		/* sys.c */
 extern struct vpd_cb kiev_vpd_cb;		/* vpd.c */
diff --git a/platform/experimental/kiev/psu.c b/platform/experimental/kiev/psu.c
new file mode 100644
index 0000000..6f0ce7c
--- /dev/null
+++ b/platform/experimental/kiev/psu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials provided
+ *      with the distribution.
+ *    * Neither the name of Google Inc. nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mosys/platform.h"
+
+static enum psu_types psu_type(struct platform_intf *intf)
+{
+	return PSU_TYPE_AC_ONLY;
+}
+
+struct psu_cb kiev_psu_cb = {
+	.type		= &psu_type,
+};
diff --git a/platform/samsung/stumpy/Makefile b/platform/samsung/stumpy/Makefile
index 57bf8a4..b03d386 100644
--- a/platform/samsung/stumpy/Makefile
+++ b/platform/samsung/stumpy/Makefile
@@ -3,6 +3,7 @@
 #obj-$(CONFIG_PLATFORM_STUMPY)	+= gpio.o
 obj-$(CONFIG_PLATFORM_STUMPY)	+= memory.o
 obj-$(CONFIG_PLATFORM_STUMPY)	+= nvram.o
+obj-$(CONFIG_PLATFORM_STUMPY)	+= psu.o
 obj-$(CONFIG_PLATFORM_STUMPY)	+= sensors.o
 obj-$(CONFIG_PLATFORM_STUMPY)	+= stumpy.o
 obj-$(CONFIG_PLATFORM_STUMPY)	+= sys.o
diff --git a/platform/samsung/stumpy/psu.c b/platform/samsung/stumpy/psu.c
new file mode 100644
index 0000000..949644d
--- /dev/null
+++ b/platform/samsung/stumpy/psu.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials provided
+ *      with the distribution.
+ *    * Neither the name of Google Inc. nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mosys/platform.h"
+
+static enum psu_types psu_type(struct platform_intf *intf)
+{
+	return PSU_TYPE_AC_ONLY;
+}
+
+struct psu_cb stumpy_psu_cb = {
+	.type		= &psu_type,
+};
diff --git a/platform/samsung/stumpy/stumpy.c b/platform/samsung/stumpy/stumpy.c
index 114dc91..5680efc 100644
--- a/platform/samsung/stumpy/stumpy.c
+++ b/platform/samsung/stumpy/stumpy.c
@@ -58,6 +58,7 @@
 	&cmd_memory,
 	&cmd_nvram,
 	&cmd_platform,
+	&cmd_psu,
 	&cmd_sensor,
 	&cmd_smbios,
 	&cmd_vpd,
@@ -132,6 +133,7 @@
 	.eeprom		= &stumpy_eeprom_cb,
 //	.gpio		= &stumpy_gpio_cb,
 	.memory		= &stumpy_memory_cb,
+	.psu		= &stumpy_psu_cb,
 	.nvram		= &stumpy_nvram_cb,
 	.smbios		= &smbios_sysinfo_cb,
 	.sensor		= &stumpy_sensor_cb,
diff --git a/platform/samsung/stumpy/stumpy.h b/platform/samsung/stumpy/stumpy.h
index efa4ce7..0ed28ee 100644
--- a/platform/samsung/stumpy/stumpy.h
+++ b/platform/samsung/stumpy/stumpy.h
@@ -42,6 +42,7 @@
 //extern struct gpio_cb stumpy_gpio_cb;		/* gpio.c */
 extern struct memory_cb stumpy_memory_cb;	/* memory.c */
 extern struct nvram_cb stumpy_nvram_cb;		/* nvram.c */
+extern struct psu_cb stumpy_psu_cb;		/* psu.c */
 extern struct sensor_cb stumpy_sensor_cb;	/* sensors.c */
 extern struct sys_cb stumpy_sys_cb;		/* sys.c */
 extern struct vpd_cb stumpy_vpd_cb;		/* vpd.c */