Esempio n. 1
0
int __init magus_pm_init(void)
{
	int error;
	u32 sram_size_to_allocate;
	printk("Power Management for MAGUS. %s\n", PM_VERSION);
	
	init_addr_external_device();
	if (magus_idle_loop_suspend_sz > magus_cpu_suspend_sz)
		sram_size_to_allocate = magus_idle_loop_suspend_sz;
	else
		sram_size_to_allocate = magus_cpu_suspend_sz;


	saved_sram = kmalloc(sram_size_to_allocate, GFP_ATOMIC);
	if (!saved_sram) {
		printk(KERN_ERR
	             "PM Suspend: cannot allocate memory to save portion of SRAM\n");
	    return -ENOMEM;
	}   

	suspend_set_ops(&magus_pm_ops);
	//pm_idle = magus_pm_idle;

	error = subsys_create_file(&power_subsys, &sleep_while_idle_attr);
	if (error)
		printk(KERN_ERR "PM: subsys_create_file failed: %d\n", error);

	return 0;
}
Esempio n. 2
0
static int __init pm_cpuidle_sysfs_init(void)
{
	int rc;

	rc = subsys_create_file(&power_subsys, &sleep_idle_state);
	if (rc)
		printk(KERN_ERR "ERROR creating sysfs entry for "
				"'sleep_idle_state': %d\n", rc);

#ifdef DEBUG_BAIL_STATS
	rc = subsys_create_file(&power_subsys, &clock_bail_stat);
	if (rc)
		printk(KERN_ERR "ERROR creating sysfs entry for "
				"'clock_bail_stat': %d\n", rc);
#endif

	return rc;
}
Esempio n. 3
0
/*
 * For now we register the stable subsystem with the firmware subsystem
 * and the paths subsystem with the stable subsystem
 */
static int __init
pdc_stable_init(void)
{
	struct subsys_attribute *attr;
	int i, rc = 0, error = 0;

	/* find the size of the stable storage */
	if (pdc_stable_get_size(&pdcs_size) != PDC_OK) 
		return -ENODEV;

	/* make sure we have enough data */
	if (pdcs_size < 96)
		return -ENODATA;

	printk(KERN_INFO PDCS_PREFIX " facility v%s\n", PDCS_VERSION);

	/* For now we'll register the stable subsys within this driver */
	if ((rc = firmware_register(&stable_subsys)))
		goto fail_firmreg;

	/* Don't forget the root entries */
	for (i = 0; (attr = pdcs_subsys_attrs[i]) && !error; i++)
		if (attr->show)
			error = subsys_create_file(&stable_subsys, attr);
	
	/* register the paths subsys as a subsystem of stable subsys */
	kset_set_kset_s(&paths_subsys, stable_subsys);
	if ((rc= subsystem_register(&paths_subsys)))
		goto fail_subsysreg;

	/* now we create all "files" for the paths subsys */
	if ((rc = pdcs_register_pathentries()))
		goto fail_pdcsreg;

	return rc;
	
fail_pdcsreg:
	pdcs_unregister_pathentries();
	subsystem_unregister(&paths_subsys);
	
fail_subsysreg:
	firmware_unregister(&stable_subsys);
	
fail_firmreg:
	printk(KERN_INFO PDCS_PREFIX " bailing out\n");
	return rc;
}
Esempio n. 4
0
static int __init apo_pm_init(void)
{
    return(subsys_create_file(&power_subsys, &auto_poweron_attr));
}