Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/tegra support RB_POWERDOWN using the AMS AS3...



details:   https://anonhg.NetBSD.org/src/rev/61b3521e3279
branches:  trunk
changeset: 341556:61b3521e3279
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Nov 11 12:37:52 2015 +0000

description:
support RB_POWERDOWN using the AMS AS3722 PMIC when available

diffstat:

 sys/arch/evbarm/tegra/tegra_machdep.c |  26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diffs (72 lines):

diff -r 9200b8378bae -r 61b3521e3279 sys/arch/evbarm/tegra/tegra_machdep.c
--- a/sys/arch/evbarm/tegra/tegra_machdep.c     Wed Nov 11 12:37:13 2015 +0000
+++ b/sys/arch/evbarm/tegra/tegra_machdep.c     Wed Nov 11 12:37:52 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_machdep.c,v 1.25 2015/11/09 23:05:58 jmcneill Exp $ */
+/* $NetBSD: tegra_machdep.c,v 1.26 2015/11/11 12:37:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.25 2015/11/09 23:05:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.26 2015/11/11 12:37:52 jmcneill Exp $");
 
 #include "opt_tegra.h"
 #include "opt_machdep.h"
@@ -40,6 +40,7 @@
 #include "ukbd.h"
 #include "genfb.h"
 #include "ether.h"
+#include "as3722pmic.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -89,6 +90,10 @@
 #include <dev/usb/ukbdvar.h>
 #include <net/if_ether.h>
 
+#if NAS3722PMIC > 0
+#include <dev/i2c/as3722.h>
+#endif
+
 #ifndef TEGRA_MAX_BOOT_STRING
 #define TEGRA_MAX_BOOT_STRING 1024
 #endif
@@ -104,6 +109,7 @@
 #define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys)
 
 static void tegra_device_register(device_t, void *);
+static void tegra_powerdown(void);
 
 bs_protos(bs_notimpl);
 
@@ -253,6 +259,7 @@
 #endif
 
        cpu_reset_address = tegra_pmc_reset;
+       cpu_powerdown_address = tegra_powerdown;
 
        /* Talk to the user */
        DPRINTF("\nNetBSD/evbarm (tegra) booting ...\n");
@@ -527,3 +534,18 @@
        }
 #endif
 }
+
+static void
+tegra_powerdown(void)
+{
+#if NAS3722PMIC > 0
+       device_t pmic = device_find_by_driver_unit("as3722pmic", 0);
+       if (pmic != NULL) {
+               if (as3722_poweroff(pmic) != 0) {
+                       printf("WARNING: AS3722 poweroff failed\n");
+                       return;
+               }
+               delay(1000000);
+       }
+#endif
+}



Home | Main Index | Thread Index | Old Index