Lines Matching +full:power +full:- +full:button

5  * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
7 * Copyright (C) 2003-2004 Intel Corporation
46 return -ENOMEM; in queue_interrupt_event()
48 info->event_type = event_type; in queue_interrupt_event()
49 info->p_slot = p_slot; in queue_interrupt_event()
50 INIT_WORK(&info->work, interrupt_event_handler); in queue_interrupt_event()
52 queue_work(pciehp_wq, &info->work); in queue_interrupt_event()
60 struct controller *ctrl = p_slot->ctrl; in pciehp_handle_attention_button()
62 /* Attention Button Change */ in pciehp_handle_attention_button()
63 ctrl_dbg(ctrl, "Attention button interrupt received\n"); in pciehp_handle_attention_button()
66 * Button pressed - See if need to TAKE ACTION!!! in pciehp_handle_attention_button()
68 ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot)); in pciehp_handle_attention_button()
80 struct controller *ctrl = p_slot->ctrl; in pciehp_handle_switch_change()
109 struct controller *ctrl = p_slot->ctrl; in pciehp_handle_presence_change()
141 struct controller *ctrl = p_slot->ctrl; in pciehp_handle_power_fault()
143 /* power fault */ in pciehp_handle_power_fault()
144 ctrl_dbg(ctrl, "Power fault interrupt received\n"); in pciehp_handle_power_fault()
145 ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot)); in pciehp_handle_power_fault()
147 ctrl_info(ctrl, "Power fault bit %x set\n", 0); in pciehp_handle_power_fault()
163 "Issue of Slot Power Off command failed\n"); in set_slot_off()
167 * After turning power off, we must wait for at least 1 second in set_slot_off()
168 * before taking any action that relies on power having been in set_slot_off()
187 * board_added - Called after a board has been added to the system.
190 * Turns power on for the board.
196 struct controller *ctrl = p_slot->ctrl; in board_added()
197 struct pci_bus *parent = ctrl->pcie->port->subordinate; in board_added()
200 /* Power on slot */ in board_added()
216 /* Check for a power fault */ in board_added()
217 if (ctrl->power_fault_detected || pciehp_query_power_fault(p_slot)) { in board_added()
218 ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot)); in board_added()
219 retval = -EIO; in board_added()
226 pci_domain_nr(parent), parent->number); in board_added()
241 * remove_board - Turns off slot and LEDs
247 struct controller *ctrl = p_slot->ctrl; in remove_board()
254 /* power off slot */ in remove_board()
262 * After turning power off, we must wait for at least 1 second in remove_board()
263 * before taking any action that relies on power having been in remove_board()
282 * pciehp_power_thread - handle pushbutton events
292 struct slot *p_slot = info->p_slot; in pciehp_power_thread()
294 mutex_lock(&p_slot->lock); in pciehp_power_thread()
295 switch (p_slot->state) { in pciehp_power_thread()
297 mutex_unlock(&p_slot->lock); in pciehp_power_thread()
298 ctrl_dbg(p_slot->ctrl, in pciehp_power_thread()
300 pci_domain_nr(p_slot->ctrl->pcie->port->subordinate), in pciehp_power_thread()
301 p_slot->ctrl->pcie->port->subordinate->number); in pciehp_power_thread()
303 mutex_lock(&p_slot->lock); in pciehp_power_thread()
304 p_slot->state = STATIC_STATE; in pciehp_power_thread()
307 mutex_unlock(&p_slot->lock); in pciehp_power_thread()
308 if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl)) in pciehp_power_thread()
310 mutex_lock(&p_slot->lock); in pciehp_power_thread()
311 p_slot->state = STATIC_STATE; in pciehp_power_thread()
316 mutex_unlock(&p_slot->lock); in pciehp_power_thread()
328 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", in pciehp_queue_pushbutton_work()
332 info->p_slot = p_slot; in pciehp_queue_pushbutton_work()
333 INIT_WORK(&info->work, pciehp_power_thread); in pciehp_queue_pushbutton_work()
335 mutex_lock(&p_slot->lock); in pciehp_queue_pushbutton_work()
336 switch (p_slot->state) { in pciehp_queue_pushbutton_work()
338 p_slot->state = POWEROFF_STATE; in pciehp_queue_pushbutton_work()
341 p_slot->state = POWERON_STATE; in pciehp_queue_pushbutton_work()
347 queue_work(pciehp_wq, &info->work); in pciehp_queue_pushbutton_work()
349 mutex_unlock(&p_slot->lock); in pciehp_queue_pushbutton_work()
353 * Note: This function must be called with slot->lock held
357 struct controller *ctrl = p_slot->ctrl; in handle_button_press_event()
360 switch (p_slot->state) { in handle_button_press_event()
364 p_slot->state = BLINKINGOFF_STATE; in handle_button_press_event()
366 "PCI slot #%s - powering off due to button " in handle_button_press_event()
369 p_slot->state = BLINKINGON_STATE; in handle_button_press_event()
371 "PCI slot #%s - powering on due to button " in handle_button_press_event()
380 queue_delayed_work(pciehp_wq, &p_slot->work, 5*HZ); in handle_button_press_event()
387 * expires to cancel hot-add or hot-remove in handle_button_press_event()
389 ctrl_info(ctrl, "Button cancel on Slot(%s)\n", slot_name(p_slot)); in handle_button_press_event()
390 cancel_delayed_work(&p_slot->work); in handle_button_press_event()
391 if (p_slot->state == BLINKINGOFF_STATE) { in handle_button_press_event()
400 ctrl_info(ctrl, "PCI slot #%s - action canceled " in handle_button_press_event()
401 "due to button press\n", slot_name(p_slot)); in handle_button_press_event()
402 p_slot->state = STATIC_STATE; in handle_button_press_event()
407 * Ignore if the slot is on power-on or power-off state; in handle_button_press_event()
408 * this means that the previous attention button action in handle_button_press_event()
409 * to hot-add or hot-remove is undergoing in handle_button_press_event()
411 ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot)); in handle_button_press_event()
420 * Note: This function must be called with slot->lock held
429 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", in handle_surprise_event()
433 info->p_slot = p_slot; in handle_surprise_event()
434 INIT_WORK(&info->work, pciehp_power_thread); in handle_surprise_event()
438 p_slot->state = POWEROFF_STATE; in handle_surprise_event()
440 p_slot->state = POWERON_STATE; in handle_surprise_event()
442 queue_work(pciehp_wq, &info->work); in handle_surprise_event()
448 struct slot *p_slot = info->p_slot; in interrupt_event_handler()
449 struct controller *ctrl = p_slot->ctrl; in interrupt_event_handler()
451 mutex_lock(&p_slot->lock); in interrupt_event_handler()
452 switch (info->event_type) { in interrupt_event_handler()
474 mutex_unlock(&p_slot->lock); in interrupt_event_handler()
483 struct controller *ctrl = p_slot->ctrl; in pciehp_enable_slot()
488 return -ENODEV; in pciehp_enable_slot()
490 if (MRL_SENS(p_slot->ctrl)) { in pciehp_enable_slot()
495 return -ENODEV; in pciehp_enable_slot()
499 if (POWER_CTRL(p_slot->ctrl)) { in pciehp_enable_slot()
504 return -EINVAL; in pciehp_enable_slot()
522 struct controller *ctrl = p_slot->ctrl; in pciehp_disable_slot()
524 if (!p_slot->ctrl) in pciehp_disable_slot()
527 if (!HP_SUPR_RM(p_slot->ctrl)) { in pciehp_disable_slot()
532 return -ENODEV; in pciehp_disable_slot()
536 if (MRL_SENS(p_slot->ctrl)) { in pciehp_disable_slot()
541 return -ENODEV; in pciehp_disable_slot()
545 if (POWER_CTRL(p_slot->ctrl)) { in pciehp_disable_slot()
550 return -EINVAL; in pciehp_disable_slot()
559 int retval = -ENODEV; in pciehp_sysfs_enable_slot()
560 struct controller *ctrl = p_slot->ctrl; in pciehp_sysfs_enable_slot()
562 mutex_lock(&p_slot->lock); in pciehp_sysfs_enable_slot()
563 switch (p_slot->state) { in pciehp_sysfs_enable_slot()
565 cancel_delayed_work(&p_slot->work); in pciehp_sysfs_enable_slot()
567 p_slot->state = POWERON_STATE; in pciehp_sysfs_enable_slot()
568 mutex_unlock(&p_slot->lock); in pciehp_sysfs_enable_slot()
570 mutex_lock(&p_slot->lock); in pciehp_sysfs_enable_slot()
571 p_slot->state = STATIC_STATE; in pciehp_sysfs_enable_slot()
587 mutex_unlock(&p_slot->lock); in pciehp_sysfs_enable_slot()
594 int retval = -ENODEV; in pciehp_sysfs_disable_slot()
595 struct controller *ctrl = p_slot->ctrl; in pciehp_sysfs_disable_slot()
597 mutex_lock(&p_slot->lock); in pciehp_sysfs_disable_slot()
598 switch (p_slot->state) { in pciehp_sysfs_disable_slot()
600 cancel_delayed_work(&p_slot->work); in pciehp_sysfs_disable_slot()
602 p_slot->state = POWEROFF_STATE; in pciehp_sysfs_disable_slot()
603 mutex_unlock(&p_slot->lock); in pciehp_sysfs_disable_slot()
605 mutex_lock(&p_slot->lock); in pciehp_sysfs_disable_slot()
606 p_slot->state = STATIC_STATE; in pciehp_sysfs_disable_slot()
622 mutex_unlock(&p_slot->lock); in pciehp_sysfs_disable_slot()