Add PSU callback to nyan platforms

This change adds PSU callback to nyan platforms to return correct
psu types.
 - big: battery
 - blaze: battery
 - kitty: AC_only

BUG=chrome-os-partner:33067
BRANCH=none
TEST=tested on big, blaze and kitty. got the correct psu type by
"mosys psu type".

Change-Id: I057a08b7517fa2c00fd2886fe5eb9453b5962c9e
Reviewed-on: https://chromium-review.googlesource.com/224872
Tested-by: Ken Chang <kenc@nvidia.com>
Tested-by: Titan Lee <titanlee@nvidia.com>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Ken Chang <kenc@nvidia.com>
diff --git a/platform/experimental/nyan/Makefile b/platform/experimental/nyan/Makefile
index faa5a0e..7fe28b0 100644
--- a/platform/experimental/nyan/Makefile
+++ b/platform/experimental/nyan/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_EXPERIMENTAL_NYAN)	+= ec.o
 obj-$(CONFIG_EXPERIMENTAL_NYAN)	+= eeprom.o
 obj-$(CONFIG_EXPERIMENTAL_NYAN)	+= memory.o
+obj-$(CONFIG_EXPERIMENTAL_NYAN)	+= psu.o
 obj-$(CONFIG_EXPERIMENTAL_NYAN)	+= sys.o
 obj-$(CONFIG_EXPERIMENTAL_NYAN)	+= nyan.o
diff --git a/platform/experimental/nyan/nyan.c b/platform/experimental/nyan/nyan.c
index bb6dbe9..eee1e44 100644
--- a/platform/experimental/nyan/nyan.c
+++ b/platform/experimental/nyan/nyan.c
@@ -84,6 +84,7 @@
 	&cmd_memory,
 	&cmd_nvram,
 	&cmd_platform,
+	&cmd_psu,
 	&cmd_eventlog,
 	NULL
 };
@@ -203,6 +204,7 @@
 	.eeprom 	= &nyan_eeprom_cb,
 	.memory		= &nyan_memory_cb,
 	.nvram		= &cros_ec_nvram_cb,
+	.psu		= &nyan_psu_cb,
 	.sys 		= &nyan_sys_cb,
 	.eventlog	= &nyan_eventlog_cb,
 };
diff --git a/platform/experimental/nyan/nyan.h b/platform/experimental/nyan/nyan.h
index 32628a8..555b182 100644
--- a/platform/experimental/nyan/nyan.h
+++ b/platform/experimental/nyan/nyan.h
@@ -50,5 +50,6 @@
 extern struct sys_cb nyan_sys_cb;		/* sys.c */
 extern struct memory_cb nyan_memory_cb;	        /* memory.c */
 extern struct nvram_cb cros_ec_nvram_cb;	/* drivers/google/cros_ec.c */
+extern struct psu_cb nyan_psu_cb;            /* psu.c */
 
 #endif /* PLATFORM_NYAN_H_ */
diff --git a/platform/experimental/nyan/psu.c b/platform/experimental/nyan/psu.c
new file mode 100644
index 0000000..9c7bc8d
--- /dev/null
+++ b/platform/experimental/nyan/psu.c
@@ -0,0 +1,44 @@
+/*
+ * 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)
+{
+	if (!strncmp(intf->name, "Kitty", strlen(intf->name)))
+		return PSU_TYPE_AC_ONLY;
+	else
+		return PSU_TYPE_BATTERY;
+}
+
+struct psu_cb nyan_psu_cb = {
+	.type		= &psu_type,
+};