--- zzzz-none-000/linux-3.10.107/drivers/platform/x86/intel_mid_powerbtn.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/platform/x86/intel_mid_powerbtn.c 2021-02-04 17:41:59.000000000 +0000 @@ -24,6 +24,7 @@ #include #include #include +#include #define DRIVER_NAME "msic_power_btn" @@ -66,10 +67,8 @@ return -EINVAL; input = input_allocate_device(); - if (!input) { - dev_err(&pdev->dev, "Input device allocation error\n"); + if (!input) return -ENOMEM; - } input->name = pdev->name; input->phys = "power-button/input0"; @@ -78,14 +77,17 @@ input_set_capability(input, EV_KEY, KEY_POWER); - error = request_threaded_irq(irq, NULL, mfld_pb_isr, IRQF_NO_SUSPEND | - IRQF_ONESHOT, DRIVER_NAME, input); + error = request_threaded_irq(irq, NULL, mfld_pb_isr, IRQF_ONESHOT, + DRIVER_NAME, input); if (error) { dev_err(&pdev->dev, "Unable to request irq %d for mfld power" "button\n", irq); goto err_free_input; } + device_init_wakeup(&pdev->dev, true); + dev_pm_set_wake_irq(&pdev->dev, irq); + error = input_register_device(input); if (error) { dev_err(&pdev->dev, "Unable to register input dev, error " @@ -126,9 +128,10 @@ struct input_dev *input = platform_get_drvdata(pdev); int irq = platform_get_irq(pdev, 0); + dev_pm_clear_wake_irq(&pdev->dev); + device_init_wakeup(&pdev->dev, false); free_irq(irq, input); input_unregister_device(input); - platform_set_drvdata(pdev, NULL); return 0; } @@ -136,7 +139,6 @@ static struct platform_driver mfld_pb_driver = { .driver = { .name = DRIVER_NAME, - .owner = THIS_MODULE, }, .probe = mfld_pb_probe, .remove = mfld_pb_remove,