Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: twl4030-pwrbutton - add device tree support

Add device tree support for twl4030 power button driver.

Adding device tree support involved converting the
driver to module_platform_driver().

Signed-off-by: Sebastian Reichel <sre@debian.org>
Acked-by: Kumar Gala <galak@codeaurora.org>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Sebastian Reichel and committed by
Dmitry Torokhov
c81e5926 fd91a5f0

+33 -4
+21
Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
··· 1 + Texas Instruments TWL family (twl4030) pwrbutton module 2 + 3 + This module is part of the TWL4030. For more details about the whole 4 + chip see Documentation/devicetree/bindings/mfd/twl-familly.txt. 5 + 6 + This module provides a simple power button event via an Interrupt. 7 + 8 + Required properties: 9 + - compatible: should be one of the following 10 + - "ti,twl4030-pwrbutton": For controllers compatible with twl4030 11 + - interrupts: should be one of the following 12 + - <8>: For controllers compatible with twl4030 13 + 14 + Example: 15 + 16 + &twl { 17 + twl_pwrbutton: pwrbutton { 18 + compatible = "ti,twl4030-pwrbutton"; 19 + interrupts = <8>; 20 + }; 21 + };
+12 -4
drivers/input/misc/twl4030-pwrbutton.c
··· 52 52 return IRQ_HANDLED; 53 53 } 54 54 55 - static int __init twl4030_pwrbutton_probe(struct platform_device *pdev) 55 + static int twl4030_pwrbutton_probe(struct platform_device *pdev) 56 56 { 57 57 struct input_dev *pwr; 58 58 int irq = platform_get_irq(pdev, 0); ··· 106 106 return 0; 107 107 } 108 108 109 + #ifdef CONFIG_OF 110 + static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = { 111 + { .compatible = "ti,twl4030-pwrbutton" }, 112 + {}, 113 + }; 114 + MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table); 115 + #endif 116 + 109 117 static struct platform_driver twl4030_pwrbutton_driver = { 118 + .probe = twl4030_pwrbutton_probe, 110 119 .remove = __exit_p(twl4030_pwrbutton_remove), 111 120 .driver = { 112 121 .name = "twl4030_pwrbutton", 113 122 .owner = THIS_MODULE, 123 + .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table), 114 124 }, 115 125 }; 116 - 117 - module_platform_driver_probe(twl4030_pwrbutton_driver, 118 - twl4030_pwrbutton_probe); 126 + module_platform_driver(twl4030_pwrbutton_driver); 119 127 120 128 MODULE_ALIAS("platform:twl4030_pwrbutton"); 121 129 MODULE_DESCRIPTION("Triton2 Power Button");