Lines Matching +full:slow +full:- +full:io +full:- +full:gpios

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Support for OLPC XO-1 System Control Interrupts (SCI)
21 #include <linux/olpc-ec.h>
23 #include <asm/io.h>
27 #define DRV_NAME "olpc-xo1-sci"
83 if (test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == !!state) in send_ebook_state()
88 pm_wakeup_event(&ebook_switch_idev->dev, 0); in send_ebook_state()
93 /* gpio is high; invert so we'll get l->h event interrupt */ in flip_lid_inverter()
110 * front-end inverter to ensure that that's the edge we're always in detect_lid_state()
127 if (!!test_bit(SW_LID, lid_switch_idev->sw) == !lid_open) in send_lid_state()
132 pm_wakeup_event(&lid_switch_idev->dev, 0); in send_lid_state()
154 return -EINVAL; in lid_wake_mode_set()
168 * This is handled in a workqueue because olpc_ec_cmd can be slow (and
225 dev_dbg(&pdev->dev, "sts %x gpe %x\n", sts, gpe); in xo1_sci_intr()
238 pm_wakeup_event(&power_button_idev->dev, 0); in xo1_sci_intr()
268 if (device_may_wakeup(&power_button_idev->dev)) in xo1_sci_suspend()
273 if (device_may_wakeup(&ebook_switch_idev->dev)) in xo1_sci_suspend()
278 if (!device_may_wakeup(&lid_switch_idev->dev)) { in xo1_sci_suspend()
323 dev_info(&pdev->dev, "SCI is mapped to IRQ %d\n", sci_irq); in setup_sci_interrupt()
326 dev_info(&pdev->dev, "SCI unmapped. Mapping to IRQ 3\n"); in setup_sci_interrupt()
339 lo |= 1 << (sci_irq - 8); in setup_sci_interrupt()
350 dev_err(&pdev->dev, "can't request interrupt\n"); in setup_sci_interrupt()
359 r = gpio_request(OLPC_GPIO_ECSCI, "OLPC-ECSCI"); in setup_ec_sci()
373 * Ordinarily, in addition to functioning as GPIOs, Geode GPIOs can in setup_ec_sci()
374 * be mapped to regular interrupts *or* Geode-specific Power in setup_ec_sci()
375 * Management Events (PMEs) - events that bring the system out of in setup_ec_sci()
376 * suspend. In this case, we want both of those things - the system in setup_ec_sci()
403 r = gpio_request(OLPC_GPIO_LID, "OLPC-LID"); in setup_lid_events()
442 return -ENOMEM; in setup_power_button()
444 power_button_idev->name = "Power Button"; in setup_power_button()
445 power_button_idev->phys = DRV_NAME "/input0"; in setup_power_button()
446 set_bit(EV_KEY, power_button_idev->evbit); in setup_power_button()
447 set_bit(KEY_POWER, power_button_idev->keybit); in setup_power_button()
449 power_button_idev->dev.parent = &pdev->dev; in setup_power_button()
450 device_init_wakeup(&power_button_idev->dev, 1); in setup_power_button()
454 dev_err(&pdev->dev, "failed to register power button: %d\n", r); in setup_power_button()
472 return -ENOMEM; in setup_ebook_switch()
474 ebook_switch_idev->name = "EBook Switch"; in setup_ebook_switch()
475 ebook_switch_idev->phys = DRV_NAME "/input1"; in setup_ebook_switch()
476 set_bit(EV_SW, ebook_switch_idev->evbit); in setup_ebook_switch()
477 set_bit(SW_TABLET_MODE, ebook_switch_idev->swbit); in setup_ebook_switch()
479 ebook_switch_idev->dev.parent = &pdev->dev; in setup_ebook_switch()
480 device_set_wakeup_capable(&ebook_switch_idev->dev, true); in setup_ebook_switch()
484 dev_err(&pdev->dev, "failed to register ebook switch: %d\n", r); in setup_ebook_switch()
502 return -ENOMEM; in setup_lid_switch()
504 lid_switch_idev->name = "Lid Switch"; in setup_lid_switch()
505 lid_switch_idev->phys = DRV_NAME "/input2"; in setup_lid_switch()
506 set_bit(EV_SW, lid_switch_idev->evbit); in setup_lid_switch()
507 set_bit(SW_LID, lid_switch_idev->swbit); in setup_lid_switch()
509 lid_switch_idev->dev.parent = &pdev->dev; in setup_lid_switch()
510 device_set_wakeup_capable(&lid_switch_idev->dev, true); in setup_lid_switch()
514 dev_err(&pdev->dev, "failed to register lid switch: %d\n", r); in setup_lid_switch()
535 /* don't run on non-XOs */ in xo1_sci_probe()
537 return -ENODEV; in xo1_sci_probe()
541 dev_err(&pdev->dev, "can't fetch device resource info\n"); in xo1_sci_probe()
542 return -EIO; in xo1_sci_probe()
544 acpi_base = res->start; in xo1_sci_probe()
566 /* Enable PME generation for EC-generated events */ in xo1_sci_probe()
615 .name = "olpc-xo1-sci-acpi",