~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/platforms/pseries/power.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  *  Interface for power-management for ppc64 compliant platform
  4  *
  5  *  Manish Ahuja <mahuja@us.ibm.com>
  6  *
  7  *  Feb 2007
  8  *
  9  *  Copyright (C) 2007 IBM Corporation.
 10  */
 11 
 12 #include <linux/kobject.h>
 13 #include <linux/string.h>
 14 #include <linux/errno.h>
 15 #include <linux/init.h>
 16 #include <asm/machdep.h>
 17 
 18 #include "pseries.h"
 19 
 20 unsigned long rtas_poweron_auto; /* default and normal state is 0 */
 21 
 22 static ssize_t auto_poweron_show(struct kobject *kobj,
 23                                  struct kobj_attribute *attr, char *buf)
 24 {
 25         return sprintf(buf, "%lu\n", rtas_poweron_auto);
 26 }
 27 
 28 static ssize_t auto_poweron_store(struct kobject *kobj,
 29                                   struct kobj_attribute *attr,
 30                                   const char *buf, size_t n)
 31 {
 32         int ret;
 33         unsigned long ups_restart;
 34         ret = sscanf(buf, "%lu", &ups_restart);
 35 
 36         if ((ret == 1) && ((ups_restart == 1) || (ups_restart == 0))){
 37                 rtas_poweron_auto = ups_restart;
 38                 return n;
 39         }
 40         return -EINVAL;
 41 }
 42 
 43 static struct kobj_attribute auto_poweron_attr =
 44         __ATTR(auto_poweron, 0644, auto_poweron_show, auto_poweron_store);
 45 
 46 #ifndef CONFIG_PM
 47 struct kobject *power_kobj;
 48 
 49 static struct attribute *g[] = {
 50         &auto_poweron_attr.attr,
 51         NULL,
 52 };
 53 
 54 static const struct attribute_group attr_group = {
 55         .attrs = g,
 56 };
 57 
 58 static int __init pm_init(void)
 59 {
 60         power_kobj = kobject_create_and_add("power", NULL);
 61         if (!power_kobj)
 62                 return -ENOMEM;
 63         return sysfs_create_group(power_kobj, &attr_group);
 64 }
 65 machine_core_initcall(pseries, pm_init);
 66 #else
 67 static int __init apo_pm_init(void)
 68 {
 69         return (sysfs_create_file(power_kobj, &auto_poweron_attr.attr));
 70 }
 71 machine_device_initcall(pseries, apo_pm_init);
 72 #endif
 73 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php