--- zzzz-none-000/linux-3.10.107/drivers/media/rc/winbond-cir.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/rc/winbond-cir.c 2021-02-04 17:41:59.000000000 +0000 @@ -213,13 +213,11 @@ /* RX state */ enum wbcir_rxstate rxstate; - struct led_trigger *rxtrigger; int carrier_report_enabled; u32 pulse_duration; /* TX state */ enum wbcir_txstate txstate; - struct led_trigger *txtrigger; u32 txlen; u32 txoff; u32 *txbuf; @@ -366,14 +364,11 @@ { struct wbcir_data *data = dev->priv; - if (!idle && data->rxstate == WBCIR_RXSTATE_INACTIVE) { + if (!idle && data->rxstate == WBCIR_RXSTATE_INACTIVE) data->rxstate = WBCIR_RXSTATE_ACTIVE; - led_trigger_event(data->rxtrigger, LED_FULL); - } if (idle && data->rxstate != WBCIR_RXSTATE_INACTIVE) { data->rxstate = WBCIR_RXSTATE_INACTIVE; - led_trigger_event(data->rxtrigger, LED_OFF); if (data->carrier_report_enabled) wbcir_carrier_report(data); @@ -425,7 +420,6 @@ case WBCIR_TXSTATE_INACTIVE: /* TX FIFO empty */ space = 16; - led_trigger_event(data->txtrigger, LED_FULL); break; case WBCIR_TXSTATE_ACTIVE: /* TX FIFO low (3 bytes or less) */ @@ -464,7 +458,6 @@ /* Clear TX underrun bit */ outb(WBCIR_TX_UNDERRUN, data->sbase + WBCIR_REG_SP3_ASCR); wbcir_set_irqmask(data, WBCIR_IRQ_RX | WBCIR_IRQ_ERR); - led_trigger_event(data->txtrigger, LED_OFF); kfree(data->txbuf); data->txbuf = NULL; data->txstate = WBCIR_TXSTATE_INACTIVE; @@ -878,15 +871,13 @@ */ wbcir_set_irqmask(data, WBCIR_IRQ_NONE); disable_irq(data->irq); - - /* Disable LED */ - led_trigger_event(data->rxtrigger, LED_OFF); - led_trigger_event(data->txtrigger, LED_OFF); } static int wbcir_suspend(struct pnp_dev *device, pm_message_t state) { + struct wbcir_data *data = pnp_get_drvdata(device); + led_classdev_suspend(&data->led); wbcir_shutdown(device); return 0; } @@ -1015,6 +1006,7 @@ wbcir_init_hw(data); enable_irq(data->irq); + led_classdev_resume(&data->led); return 0; } @@ -1058,25 +1050,13 @@ "(w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n", data->wbase, data->ebase, data->sbase, data->irq); - led_trigger_register_simple("cir-tx", &data->txtrigger); - if (!data->txtrigger) { - err = -ENOMEM; - goto exit_free_data; - } - - led_trigger_register_simple("cir-rx", &data->rxtrigger); - if (!data->rxtrigger) { - err = -ENOMEM; - goto exit_unregister_txtrigger; - } - data->led.name = "cir::activity"; - data->led.default_trigger = "cir-rx"; + data->led.default_trigger = "rc-feedback"; data->led.brightness_set = wbcir_led_brightness_set; data->led.brightness_get = wbcir_led_brightness_get; err = led_classdev_register(&device->dev, &data->led); if (err) - goto exit_unregister_rxtrigger; + goto exit_free_data; data->dev = rc_allocate_device(); if (!data->dev) { @@ -1102,7 +1082,7 @@ data->dev->dev.parent = &device->dev; data->dev->timeout = MS_TO_NS(100); data->dev->rx_resolution = US_TO_NS(2); - data->dev->allowed_protos = RC_BIT_ALL; + data->dev->allowed_protocols = RC_BIT_ALL; err = rc_register_device(data->dev); if (err) @@ -1130,7 +1110,7 @@ } err = request_irq(data->irq, wbcir_irq_handler, - IRQF_DISABLED, DRVNAME, device); + 0, DRVNAME, device); if (err) { dev_err(dev, "Failed to claim IRQ %u\n", data->irq); err = -EBUSY; @@ -1156,10 +1136,6 @@ rc_free_device(data->dev); exit_unregister_led: led_classdev_unregister(&data->led); -exit_unregister_rxtrigger: - led_trigger_unregister_simple(data->rxtrigger); -exit_unregister_txtrigger: - led_trigger_unregister_simple(data->txtrigger); exit_free_data: kfree(data); pnp_set_drvdata(device, NULL); @@ -1187,8 +1163,6 @@ rc_unregister_device(data->dev); - led_trigger_unregister_simple(data->rxtrigger); - led_trigger_unregister_simple(data->txtrigger); led_classdev_unregister(&data->led); /* This is ok since &data->led isn't actually used */