From patchwork Tue Sep 25 09:42:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 10613817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 462F1112B for ; Tue, 25 Sep 2018 09:43:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CBF1285A1 for ; Tue, 25 Sep 2018 09:43:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3069B29B3B; Tue, 25 Sep 2018 09:43:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE38C285A1 for ; Tue, 25 Sep 2018 09:43:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729061AbeIYPu0 (ORCPT ); Tue, 25 Sep 2018 11:50:26 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:55485 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728815AbeIYPu0 (ORCPT ); Tue, 25 Sep 2018 11:50:26 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g4jsT-0001Xr-QE; Tue, 25 Sep 2018 11:43:33 +0200 Received: from mfe by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1g4jsS-0005fC-Qv; Tue, 25 Sep 2018 11:43:32 +0200 From: Marco Felsch To: dmitry.torokhov@gmail.com, broonie@kernel.org, mark.rutland@arm.com, robh+dt@kernel.org Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 1/3] spi: switch to SPDX license identifier Date: Tue, 25 Sep 2018 11:42:28 +0200 Message-Id: <20180925094230.32679-2-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180925094230.32679-1-m.felsch@pengutronix.de> References: <20180925094230.32679-1-m.felsch@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-spi@vger.kernel.org Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the appropriate SPDX license identifier and drop the previous license text. Signed-off-by: Marco Felsch --- drivers/spi/spi.c | 11 +---------- include/linux/spi/spi.h | 13 ++----------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index ec395a6baf9c..3a8f1224edfc 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1,18 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * SPI init/core code * * Copyright (C) 2005 David Brownell * Copyright (C) 2008 Secret Lab Technologies Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index a64235e05321..95c0243dc74a 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1,15 +1,6 @@ -/* - * Copyright (C) 2005 David Brownell +/* SPDX-License-Identifier: GPL-2.0-or-later * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Copyright (C) 2005 David Brownell */ #ifndef __LINUX_SPI_H From patchwork Tue Sep 25 09:42:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 10613811 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6F5E14BD for ; Tue, 25 Sep 2018 09:43:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8A82285A1 for ; Tue, 25 Sep 2018 09:43:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D11C29B48; Tue, 25 Sep 2018 09:43:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93617285A1 for ; Tue, 25 Sep 2018 09:43:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728397AbeIYPuW (ORCPT ); Tue, 25 Sep 2018 11:50:22 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:52761 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbeIYPuW (ORCPT ); Tue, 25 Sep 2018 11:50:22 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g4jsT-0001Xs-QB; Tue, 25 Sep 2018 11:43:33 +0200 Received: from mfe by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1g4jsS-0005fF-RP; Tue, 25 Sep 2018 11:43:32 +0200 From: Marco Felsch To: dmitry.torokhov@gmail.com, broonie@kernel.org, mark.rutland@arm.com, robh+dt@kernel.org Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 2/3] spi: make OF helper available for others Date: Tue, 25 Sep 2018 11:42:29 +0200 Message-Id: <20180925094230.32679-3-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180925094230.32679-1-m.felsch@pengutronix.de> References: <20180925094230.32679-1-m.felsch@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-spi@vger.kernel.org Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The of_find_spi_device_by_node() helper function is useful for other modules too. Export the funciton as GPL like all other spi helper functions and make it available if CONFIG_OF is enabled, because it isn't related to the CONFIG_OF_DYNAMIC context. Finally add a stub if CONFIG_OF isn't enabled, so others must not care about it. Signed-off-by: Marco Felsch --- drivers/spi/spi.c | 7 +++++-- include/linux/spi/spi.h | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 3a8f1224edfc..2983c3f69fb0 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3305,20 +3305,23 @@ EXPORT_SYMBOL_GPL(spi_write_then_read); /*-------------------------------------------------------------------------*/ -#if IS_ENABLED(CONFIG_OF_DYNAMIC) +#if IS_ENABLED(CONFIG_OF) static int __spi_of_device_match(struct device *dev, void *data) { return dev->of_node == data; } /* must call put_device() when done with returned spi_device device */ -static struct spi_device *of_find_spi_device_by_node(struct device_node *node) +struct spi_device *of_find_spi_device_by_node(struct device_node *node) { struct device *dev = bus_find_device(&spi_bus_type, NULL, node, __spi_of_device_match); return dev ? to_spi_device(dev) : NULL; } +EXPORT_SYMBOL_GPL(of_find_spi_device_by_node); +#endif /* IS_ENABLED(CONFIG_OF) */ +#if IS_ENABLED(CONFIG_OF_DYNAMIC) static int __spi_of_controller_match(struct device *dev, const void *data) { return dev->of_node == data; diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 95c0243dc74a..b53f4e348b24 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1268,7 +1268,6 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n) { return 0; } #endif - /* If you're hotplugging an adapter with devices (parport, usb, etc) * use spi_new_device() to describe each device. You can also call * spi_unregister_device() to start making that device vanish, but @@ -1300,6 +1299,22 @@ spi_transfer_is_last(struct spi_controller *ctlr, struct spi_transfer *xfer) return list_is_last(&xfer->transfer_list, &ctlr->cur_msg->transfers); } +/* OF support code */ +#if IS_ENABLED(CONFIG_OF) + +/* must call put_device() when done with returned spi_device device */ +extern struct spi_device * +of_find_spi_device_by_node(struct device_node *node); + +#else + +static inline struct spi_device * +of_find_spi_device_by_node(struct device_node *node) +{ + return NULL; +} + +#endif /* IS_ENABLED(CONFIG_OF) */ /* Compatibility layer */ #define spi_master spi_controller From patchwork Tue Sep 25 09:42:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 10613815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FA8E14DA for ; Tue, 25 Sep 2018 09:43:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 115C1285A1 for ; Tue, 25 Sep 2018 09:43:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0575829ADE; Tue, 25 Sep 2018 09:43:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD73629AE7 for ; Tue, 25 Sep 2018 09:43:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728355AbeIYPuW (ORCPT ); Tue, 25 Sep 2018 11:50:22 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:40457 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728337AbeIYPuW (ORCPT ); Tue, 25 Sep 2018 11:50:22 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g4jsT-0001Xt-QE; Tue, 25 Sep 2018 11:43:33 +0200 Received: from mfe by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1g4jsS-0005fI-Ru; Tue, 25 Sep 2018 11:43:32 +0200 From: Marco Felsch To: dmitry.torokhov@gmail.com, broonie@kernel.org, mark.rutland@arm.com, robh+dt@kernel.org Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 3/3] Input: add generic gpio brownout driver Date: Tue, 25 Sep 2018 11:42:30 +0200 Message-Id: <20180925094230.32679-4-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180925094230.32679-1-m.felsch@pengutronix.de> References: <20180925094230.32679-1-m.felsch@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-spi@vger.kernel.org Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A brownout can be detected in several ways e.g. a deticated pin on the soc, a external pmic or by another external hardware which informs the host via a gpio line. This patch adds the support for a generic gpio-based brownout detection. Upon a brownout the host system gets informed and the driver sends a keycode signal to the userspace. Per default this signal is mapped to KEY_POWER, so the system will shoutdown. Additional the driver supports releasing registered devices from their drivers, see Documentation/devicetree/bindings/input/gpio-brownout.txt for more details. Signed-off-by: Marco Felsch --- .../bindings/input/gpio-brownout.txt | 36 ++++ drivers/input/misc/Kconfig | 12 ++ drivers/input/misc/Makefile | 1 + drivers/input/misc/gpio-brownout.c | 166 ++++++++++++++++++ 4 files changed, 215 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/gpio-brownout.txt create mode 100644 drivers/input/misc/gpio-brownout.c diff --git a/Documentation/devicetree/bindings/input/gpio-brownout.txt b/Documentation/devicetree/bindings/input/gpio-brownout.txt new file mode 100644 index 000000000000..55fbe2aa52a9 --- /dev/null +++ b/Documentation/devicetree/bindings/input/gpio-brownout.txt @@ -0,0 +1,36 @@ +Device-Tree bindings for input/gpio_brownout.c driver + +Required properties: +- compatible: Must be "gpio-brownout" +- interrupt-parent: The phandle to the interrupt controller. For more details + see ../interrupt-controller/interrupts.txt. +- interrupts: The interrupt line for a brownout detection. For more details + see ../interrupt-controller/interrupts.txt. + +Optional properties: +- linux,code: Keycode to emit upon a brownout detection, default: KEY_POWER. +- release-devices: A list of i2c or spi device phandles. All listed devices + will be released from their drivers in the order they listed upon a brownout + detection. This can be helpful to avoid a interrupt flood, because some + system designs power off all external devices immediately and keep the host + on for a certain time. + +Example: + +i2c3 { + temp_core: lm75@48 { }; + temp_chassis: lm75@49 { }; +}; + +spi1 { + ts: ad7879@1 { }; +}; + +/ { + gpio_brownout_det { + compatible = "gpio-brownout"; + interrupts-parent = <&gpio3>; + interrupts = <3 IRQ_TYPE_EDGE_LOW>: + release-devices = <&temp_core &ts>; + }; +}; diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index ca59a2be9bc5..6b49e681cca7 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -268,6 +268,18 @@ config INPUT_GPIO_BEEPER To compile this driver as a module, choose M here: the module will be called gpio-beeper. +config INPUT_GPIO_BROWNOUT + tristate "Generic GPIO Brownout detection support" + depends on GPIOLIB || COMPILE_TEST + help + Say Y here if you have a brownout signal connected to a GPIO pin + and want to report a keycode signal on a brownout detection. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called gpio-brownout. + config INPUT_GPIO_DECODER tristate "Polled GPIO Decoder Input driver" depends on GPIOLIB || COMPILE_TEST diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 9d0f9d1ff68f..8b872b5fc84a 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_INPUT_DRV2665_HAPTICS) += drv2665.o obj-$(CONFIG_INPUT_DRV2667_HAPTICS) += drv2667.o obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o obj-$(CONFIG_INPUT_GPIO_BEEPER) += gpio-beeper.o +obj-$(CONFIG_INPUT_GPIO_BROWNOUT) += gpio-brownout.o obj-$(CONFIG_INPUT_GPIO_DECODER) += gpio_decoder.o obj-$(CONFIG_INPUT_HISI_POWERKEY) += hisi_powerkey.o obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o diff --git a/drivers/input/misc/gpio-brownout.c b/drivers/input/misc/gpio-brownout.c new file mode 100644 index 000000000000..23992b9e2814 --- /dev/null +++ b/drivers/input/misc/gpio-brownout.c @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * gpio-brownout.c - Generic power fail driver + * + * Copyright (C) 2018 Pengutronix, Marco Felsch + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GPIO_BROWNOUT_MOD_NAME "gpio-brownout" + +struct gpio_brownout_device { + struct list_head list; + struct device *dev; +}; + +struct gpio_brownout { + struct device *dev; + struct input_dev *idev; + unsigned short kcode; + struct list_head devices; +}; + +static irqreturn_t gpio_brownout_isr(int irq, void *dev_id) +{ + struct gpio_brownout *gb = dev_id; + struct input_dev *idev = gb->idev; + struct gpio_brownout_device *bout_dev, *tmp; + + /* first inform userspace */ + input_report_key(idev, gb->kcode, 1); + input_sync(idev); + + /* now unregister registered drivers */ + list_for_each_entry_safe(bout_dev, tmp, &gb->devices, list) { + device_release_driver(bout_dev->dev); + list_del(&bout_dev->list); + } + + return IRQ_HANDLED; +} + +#ifdef CONFIG_OF +static int gpio_brownout_probe_dt(struct gpio_brownout *gb) +{ + struct device_node *np = gb->dev->of_node; + struct of_phandle_iterator it; + unsigned int kcode; + int ret; + + /* all dt-properties are optional */ + of_property_read_u32(np, "linux,code", &kcode); + gb->kcode = kcode; + + /* + * Register all devices which should be unbinded upon a brownout + * detection. At the moment only i2c and spi devices are supported + */ + of_for_each_phandle(&it, ret, np, "release-devices", NULL, 0) { + struct gpio_brownout_device *elem; + struct i2c_client *i2c_c; + struct spi_device *spi_c; + + i2c_c = of_find_i2c_device_by_node(it.node); + spi_c = of_find_spi_device_by_node(it.node); + + if (!i2c_c && !spi_c) + return -EPROBE_DEFER; + else if (i2c_c && spi_c) + return -EINVAL; + + elem = devm_kzalloc(gb->dev, sizeof(*elem), GFP_KERNEL); + if (!elem) + return -ENOMEM; + + elem->dev = i2c_c ? &i2c_c->dev : &spi_c->dev; + + INIT_LIST_HEAD(&elem->list); + list_add_tail(&elem->list, &gb->devices); + } + + return 0; +} +#endif + +static int gpio_brownout_probe(struct platform_device *pdev) +{ + struct gpio_brownout *gb; + struct input_dev *idev; + int ret, irq; + + gb = devm_kzalloc(&pdev->dev, sizeof(*gb), GFP_KERNEL); + if (!gb) + return -ENOMEM; + + idev = devm_input_allocate_device(&pdev->dev); + if (!idev) + return -ENOMEM; + + gb->dev = &pdev->dev; + gb->idev = idev; + INIT_LIST_HEAD(&gb->devices); + + if (IS_ENABLED(CONFIG_OF)) { + ret = gpio_brownout_probe_dt(gb); + if (ret) { + dev_err(&pdev->dev, "probe_dt failed: %d\n", ret); + return ret; + } + } + + idev->name = pdev->name; + gb->kcode = gb->kcode == KEY_RESERVED ? KEY_POWER : gb->kcode; + + input_set_capability(idev, EV_KEY, gb->kcode); + + irq = platform_get_irq(pdev, 0); + ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, + gpio_brownout_isr, IRQF_ONESHOT, + GPIO_BROWNOUT_MOD_NAME, gb); + if (ret < 0) { + dev_err(&pdev->dev, "IRQ request failed: %d\n", ret); + return ret; + } + + ret = input_register_device(idev); + if (ret) { + dev_err(&pdev->dev, "Input register failed: %d\n", ret); + return ret; + } + + return 0; +} + +#ifdef CONFIG_OF +static const struct of_device_id gpio_brownout_of_match[] = { + { .compatible = GPIO_BROWNOUT_MOD_NAME, }, + { }, +}; +MODULE_DEVICE_TABLE(of, arm_gpio_brownout_of_match); +#endif + +static struct platform_driver gpio_brownout_driver = { + .driver = { + .name = GPIO_BROWNOUT_MOD_NAME, + .of_match_table = of_match_ptr(gpio_brownout_of_match) + }, + .probe = gpio_brownout_probe, +}; + +module_platform_driver(gpio_brownout_driver); + +MODULE_AUTHOR("Marco Felsch "); +MODULE_DESCRIPTION("GPIO Brownout Detection"); +MODULE_LICENSE("GPL v2");