From patchwork Tue Sep 25 09:42:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 10613819 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 708C014DA 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 6553C285A1 for ; Tue, 25 Sep 2018 09:43:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5975229AE7; 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=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 0477029ADE for ; Tue, 25 Sep 2018 09:43:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728815AbeIYPu0 (ORCPT ); Tue, 25 Sep 2018 11:50:26 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:60465 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729033AbeIYPu0 (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-0001Xq-Q9; 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-0005f9-QS; 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 0/3] Add GPIO brownout detection support Date: Tue, 25 Sep 2018 11:42:27 +0200 Message-Id: <20180925094230.32679-1-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.19.0 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 Hi, this small series adds a generic gpio-based brownout detection driver to inform the userspace that something went wrong. Additional there is a optional support to release devices from their drivers, because there are board power designs which cut of external devices supply immediately and keep the host (SoC) alive for a few seconds to switch into a safe state. Due to the hard power cut some external devices throw interrupts and depending of the amount of external devices these interrupts will flood the host. The driver unloads all specified devices from their drivers so the interrupts are ignored. At the moment only spi and i2c devices are supported. I've tested the driver on a customer arm based board, but other testers are welcome. Maybe there are problems unloading device drivers which have a incorrect .remove() or devm_alloc() order. Then these drivers must be fixed. Regards, Marco Marco Felsch (3): spi: switch to SPDX license identifier spi: make OF helper available for others Input: add generic gpio brownout driver .../bindings/input/gpio-brownout.txt | 36 ++++ drivers/input/misc/Kconfig | 12 ++ drivers/input/misc/Makefile | 1 + drivers/input/misc/gpio-brownout.c | 166 ++++++++++++++++++ drivers/spi/spi.c | 18 +- include/linux/spi/spi.h | 30 ++-- 6 files changed, 239 insertions(+), 24 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/gpio-brownout.txt create mode 100644 drivers/input/misc/gpio-brownout.c