static int __init via_pmu_led_init(void)
{
	struct device_node *dt;
	const char *model;

	
	if (pmu_get_model() != PMU_KEYLARGO_BASED)
		return -ENODEV;

	dt = of_find_node_by_path("/");
	if (dt == NULL)
		return -ENODEV;
	model = of_get_property(dt, "model", NULL);
	if (model == NULL) {
		of_node_put(dt);
		return -ENODEV;
	}
	if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 &&
	    strncmp(model, "iBook", strlen("iBook")) != 0 &&
	    strcmp(model, "PowerMac7,2") != 0 &&
	    strcmp(model, "PowerMac7,3") != 0) {
		of_node_put(dt);
		
		return -ENODEV;
	}
	of_node_put(dt);

	spin_lock_init(&pmu_blink_lock);
	
	pmu_blink_req.complete = 1;
	pmu_blink_req.done = pmu_req_done;

	return led_classdev_register(NULL, &pmu_led);
}
static int __init via_pmu_event_init(void)
{
	int err;

	
	if (pmu_get_model() != PMU_KEYLARGO_BASED)
		return -ENODEV;

	pmu_input_dev = input_allocate_device();
	if (!pmu_input_dev)
		return -ENOMEM;

	pmu_input_dev->name = "PMU";
	pmu_input_dev->id.bustype = BUS_HOST;
	pmu_input_dev->id.vendor = 0x0001;
	pmu_input_dev->id.product = 0x0001;
	pmu_input_dev->id.version = 0x0100;

	set_bit(EV_KEY, pmu_input_dev->evbit);
	set_bit(EV_SW, pmu_input_dev->evbit);
	set_bit(KEY_POWER, pmu_input_dev->keybit);
	set_bit(SW_LID, pmu_input_dev->swbit);

	err = input_register_device(pmu_input_dev);
	if (err)
		input_free_device(pmu_input_dev);
	return err;
}
示例#3
0
static int __init via_pmu_led_init(void)
{
	struct device_node *dt;
	const char *model;

	/* only do this on keylargo based models */
	if (pmu_get_model() != PMU_KEYLARGO_BASED)
		return -ENODEV;

	dt = of_find_node_by_path("/");
	if (dt == NULL)
		return -ENODEV;
	model = (const char *)get_property(dt, "model", NULL);
	if (model == NULL)
		return -ENODEV;
	if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 &&
	    strncmp(model, "iBook", strlen("iBook")) != 0) {
		of_node_put(dt);
		/* ignore */
		return -ENODEV;
	}
	of_node_put(dt);

	spin_lock_init(&pmu_blink_lock);
	/* no outstanding req */
	pmu_blink_req.complete = 1;
	pmu_blink_req.done = pmu_req_done;
#ifdef CONFIG_PM
	pmu_register_sleep_notifier(&via_pmu_led_sleep_notif);
#endif
	return led_classdev_register(NULL, &pmu_led);
}
static int __init via_pmu_led_init(void)
{
	struct device_node *dt;
	const char *model;

	/* only do this on keylargo based models */
	if (pmu_get_model() != PMU_KEYLARGO_BASED)
		return -ENODEV;

	dt = of_find_node_by_path("/");
	if (dt == NULL)
		return -ENODEV;
	model = of_get_property(dt, "model", NULL);
<<<<<<< HEAD