Lines Matching +full:led +full:- +full:speed +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0+
6 * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
8 * Copyright (C) 2003-2004 Intel Corporation
34 return -ENOMEM; in queue_interrupt_event()
36 info->event_type = event_type; in queue_interrupt_event()
37 info->p_slot = p_slot; in queue_interrupt_event()
38 INIT_WORK(&info->work, interrupt_event_handler); in queue_interrupt_event()
40 queue_work(p_slot->wq, &info->work); in queue_interrupt_event()
53 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_attention_button()
54 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_handle_attention_button()
57 * Button pressed - See if need to TAKE ACTION!!! in shpchp_handle_attention_button()
77 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_switch_change()
78 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_handle_switch_change()
81 p_slot->presence_save, p_slot->pwr_save); in shpchp_handle_switch_change()
89 if (p_slot->pwr_save && p_slot->presence_save) { in shpchp_handle_switch_change()
114 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_presence_change()
119 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_handle_presence_change()
120 if (p_slot->presence_save) { in shpchp_handle_presence_change()
149 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in shpchp_handle_power_fault()
157 p_slot->status = 0x00; in shpchp_handle_power_fault()
166 p_slot->status = 0xFF; in shpchp_handle_power_fault()
179 enum pci_bus_speed speed) in change_bus_speed() argument
183 ctrl_dbg(ctrl, "Change speed to %d\n", speed); in change_bus_speed()
184 rc = shpchp_set_bus_speed_mode(p_slot, speed); in change_bus_speed()
186 ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n", in change_bus_speed()
201 * change the bus speed. in fix_bus_speed()
205 ctrl_err(ctrl, "Speed of bus %x and adapter %x mismatch\n", in fix_bus_speed()
223 * board_added - Called after a board has been added to the system.
235 struct controller *ctrl = p_slot->ctrl; in board_added()
236 struct pci_bus *parent = ctrl->pci_dev->subordinate; in board_added()
238 hp_slot = p_slot->device - ctrl->slot_device_offset; in board_added()
240 ctrl_dbg(ctrl, "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", in board_added()
241 __func__, p_slot->device, ctrl->slot_device_offset, hp_slot); in board_added()
247 return -1; in board_added()
250 if ((ctrl->pci_dev->vendor == 0x8086) && (ctrl->pci_dev->device == 0x0332)) { in board_added()
253 ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n", in board_added()
258 /* turn on board, blink green LED, turn off Amber LED */ in board_added()
268 ctrl_err(ctrl, "Can't get adapter speed or bus mode mismatch\n"); in board_added()
272 bsp = ctrl->pci_dev->subordinate->cur_bus_speed; in board_added()
273 msp = ctrl->pci_dev->subordinate->max_bus_speed; in board_added()
276 if (!list_empty(&ctrl->pci_dev->subordinate->devices)) in board_added()
287 /* turn on board, blink green LED, turn off Amber LED */ in board_added()
297 ctrl_dbg(ctrl, "%s: slot status = %x\n", __func__, p_slot->status); in board_added()
299 if (p_slot->status == 0xFF) { in board_added()
302 p_slot->status = 0; in board_added()
308 pci_domain_nr(parent), p_slot->bus, p_slot->device); in board_added()
312 p_slot->status = 0; in board_added()
313 p_slot->is_a_board = 0x01; in board_added()
314 p_slot->pwr_save = 1; in board_added()
321 /* turn off slot, turn on Amber LED, turn off Green LED */ in board_added()
334 * remove_board - Turns off slot and LEDs
339 struct controller *ctrl = p_slot->ctrl; in remove_board()
345 hp_slot = p_slot->device - ctrl->slot_device_offset; in remove_board()
346 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); in remove_board()
351 if (p_slot->is_a_board) in remove_board()
352 p_slot->status = 0x01; in remove_board()
354 /* turn off slot, turn on Amber LED, turn off Green LED */ in remove_board()
368 p_slot->pwr_save = 0; in remove_board()
369 p_slot->is_a_board = 0; in remove_board()
381 * shpchp_pushbutton_thread - handle pushbutton events
391 struct slot *p_slot = info->p_slot; in shpchp_pushbutton_thread()
393 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
394 switch (p_slot->state) { in shpchp_pushbutton_thread()
396 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
398 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
399 p_slot->state = STATIC_STATE; in shpchp_pushbutton_thread()
402 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
405 mutex_lock(&p_slot->lock); in shpchp_pushbutton_thread()
406 p_slot->state = STATIC_STATE; in shpchp_pushbutton_thread()
411 mutex_unlock(&p_slot->lock); in shpchp_pushbutton_thread()
423 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", in shpchp_queue_pushbutton_work()
427 info->p_slot = p_slot; in shpchp_queue_pushbutton_work()
428 INIT_WORK(&info->work, shpchp_pushbutton_thread); in shpchp_queue_pushbutton_work()
430 mutex_lock(&p_slot->lock); in shpchp_queue_pushbutton_work()
431 switch (p_slot->state) { in shpchp_queue_pushbutton_work()
433 p_slot->state = POWEROFF_STATE; in shpchp_queue_pushbutton_work()
436 p_slot->state = POWERON_STATE; in shpchp_queue_pushbutton_work()
442 queue_work(p_slot->wq, &info->work); in shpchp_queue_pushbutton_work()
444 mutex_unlock(&p_slot->lock); in shpchp_queue_pushbutton_work()
449 shpchp_get_power_status(slot, &slot->pwr_save); in update_slot_info()
450 shpchp_get_attention_status(slot, &slot->attention_save); in update_slot_info()
451 shpchp_get_latch_status(slot, &slot->latch_save); in update_slot_info()
452 shpchp_get_adapter_status(slot, &slot->presence_save); in update_slot_info()
456 * Note: This function must be called with slot->lock held
461 struct controller *ctrl = p_slot->ctrl; in handle_button_press_event()
463 switch (p_slot->state) { in handle_button_press_event()
467 p_slot->state = BLINKINGOFF_STATE; in handle_button_press_event()
468 ctrl_info(ctrl, "PCI slot #%s - powering off due to button press\n", in handle_button_press_event()
471 p_slot->state = BLINKINGON_STATE; in handle_button_press_event()
472 ctrl_info(ctrl, "PCI slot #%s - powering on due to button press\n", in handle_button_press_event()
475 /* blink green LED and turn off amber */ in handle_button_press_event()
479 queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); in handle_button_press_event()
486 * expires to cancel hot-add or hot-remove in handle_button_press_event()
490 cancel_delayed_work(&p_slot->work); in handle_button_press_event()
491 if (p_slot->state == BLINKINGOFF_STATE) in handle_button_press_event()
496 ctrl_info(ctrl, "PCI slot #%s - action canceled due to button press\n", in handle_button_press_event()
498 p_slot->state = STATIC_STATE; in handle_button_press_event()
503 * Ignore if the slot is on power-on or power-off state; in handle_button_press_event()
505 * to hot-add or hot-remove is undergoing in handle_button_press_event()
520 struct slot *p_slot = info->p_slot; in interrupt_event_handler()
522 mutex_lock(&p_slot->lock); in interrupt_event_handler()
523 switch (info->event_type) { in interrupt_event_handler()
528 ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__); in interrupt_event_handler()
536 mutex_unlock(&p_slot->lock); in interrupt_event_handler()
545 int rc, retval = -ENODEV; in shpchp_enable_slot()
546 struct controller *ctrl = p_slot->ctrl; in shpchp_enable_slot()
549 mutex_lock(&p_slot->ctrl->crit_sect); in shpchp_enable_slot()
567 p_slot->is_a_board = 1; in shpchp_enable_slot()
570 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_enable_slot()
571 shpchp_get_power_status(p_slot, &p_slot->pwr_save); in shpchp_enable_slot()
572 ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); in shpchp_enable_slot()
575 if ((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD && in shpchp_enable_slot()
576 p_slot->ctrl->pci_dev->device == PCI_DEVICE_ID_AMD_POGO_7458) in shpchp_enable_slot()
577 && p_slot->ctrl->num_slots == 1) { in shpchp_enable_slot()
587 shpchp_get_adapter_status(p_slot, &p_slot->presence_save); in shpchp_enable_slot()
593 mutex_unlock(&p_slot->ctrl->crit_sect); in shpchp_enable_slot()
601 int rc, retval = -ENODEV; in shpchp_disable_slot()
602 struct controller *ctrl = p_slot->ctrl; in shpchp_disable_slot()
604 if (!p_slot->ctrl) in shpchp_disable_slot()
605 return -ENODEV; in shpchp_disable_slot()
608 mutex_lock(&p_slot->ctrl->crit_sect); in shpchp_disable_slot()
630 mutex_unlock(&p_slot->ctrl->crit_sect); in shpchp_disable_slot()
636 int retval = -ENODEV; in shpchp_sysfs_enable_slot()
637 struct controller *ctrl = p_slot->ctrl; in shpchp_sysfs_enable_slot()
639 mutex_lock(&p_slot->lock); in shpchp_sysfs_enable_slot()
640 switch (p_slot->state) { in shpchp_sysfs_enable_slot()
642 cancel_delayed_work(&p_slot->work); in shpchp_sysfs_enable_slot()
645 p_slot->state = POWERON_STATE; in shpchp_sysfs_enable_slot()
646 mutex_unlock(&p_slot->lock); in shpchp_sysfs_enable_slot()
648 mutex_lock(&p_slot->lock); in shpchp_sysfs_enable_slot()
649 p_slot->state = STATIC_STATE; in shpchp_sysfs_enable_slot()
665 mutex_unlock(&p_slot->lock); in shpchp_sysfs_enable_slot()
672 int retval = -ENODEV; in shpchp_sysfs_disable_slot()
673 struct controller *ctrl = p_slot->ctrl; in shpchp_sysfs_disable_slot()
675 mutex_lock(&p_slot->lock); in shpchp_sysfs_disable_slot()
676 switch (p_slot->state) { in shpchp_sysfs_disable_slot()
678 cancel_delayed_work(&p_slot->work); in shpchp_sysfs_disable_slot()
681 p_slot->state = POWEROFF_STATE; in shpchp_sysfs_disable_slot()
682 mutex_unlock(&p_slot->lock); in shpchp_sysfs_disable_slot()
684 mutex_lock(&p_slot->lock); in shpchp_sysfs_disable_slot()
685 p_slot->state = STATIC_STATE; in shpchp_sysfs_disable_slot()
701 mutex_unlock(&p_slot->lock); in shpchp_sysfs_disable_slot()