From patchwork Thu Oct 12 10:40:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 824771 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yCS6k0dj8z9t2r for ; Thu, 12 Oct 2017 21:40:30 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090AbdJLKkO (ORCPT ); Thu, 12 Oct 2017 06:40:14 -0400 Received: from mailout1.hostsharing.net ([83.223.95.204]:53071 "EHLO mailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754530AbdJLKkN (ORCPT ); Thu, 12 Oct 2017 06:40:13 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Organization Validation Secure Server CA" (not verified)) by mailout1.hostsharing.net (Postfix) with ESMTPS id 68AF11037D386; Thu, 12 Oct 2017 12:40:11 +0200 (CEST) Received: from localhost (p4FC97DB7.dip0.t-ipconnect.de [79.201.125.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id F29A8603DF34; Thu, 12 Oct 2017 12:40:10 +0200 (CEST) X-Mailbox-Line: From 165c5061f7f309ecb7f1a3d32c8f7df5026f4a47 Mon Sep 17 00:00:00 2001 Message-Id: From: Lukas Wunner Date: Thu, 12 Oct 2017 12:40:10 +0200 Subject: [PATCH v2 0/5] GPIO driver for Maxim MAX3191x To: Linus Walleij Cc: Mathias Duckeck , Phil Elwell , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , Mark Rutland , Jonathan Cameron , Rojhalat Ibrahim , Bart Van Assche , Alasdair Kergon , Mike Snitzer , Andrew Morton , Neil Brown , Peter Zijlstra , Ingo Molnar , Theodore Ts'o , Borislav Petkov , "H. Peter Anvin" , Denys Vlasenko , linux-kernel@vger.kernel.org Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org GPIO driver for Maxim MAX31910, MAX31911, MAX31912, MAX31913, MAX31953 and MAX31963 industrial serializer, a daisy-chainable chip to make 8 digital 24V inputs available via SPI. Supports CRC checksums to guard against electromagnetic interference, as well as undervoltage and overtemperature detection. The chip is used by the "Revolution Pi" family of open source PLCs based on the Raspberry Pi (https://revolution.kunbus.com/). In a typical SCADA system, all input signals are read periodically, say, every 5 or 10 ms, and stored in a so-called "process image". To make this perform well with serializers, add a ->get_multiple callback to struct gpio_chip, add corresponding consumer functions and wire it up with linehandle_ioctl(). Changes v1 -> v2: - Patch [1/5]: Change the argument order of assign_bit() to reflect traditional "dst = src" in C. (Peter Zijlstra) - Patch [2/5]: Update documentation. (Linus Walleij) Drop const qualifier from struct gpio_desc ** in all function signatures to avoid a cast when passing a non-const array created with gpiod_get_array(), which is likely the most common use case. - Patch [3/5]: Newly inserted patch to introduce common property for number of daisy-chained devices. - Patch [4/5]: Add vendor prefix to GPIO identifiers, use boolean instead of integer to select mode, rename boolean to ignore undervoltage alarms, separate compatible strings with newlines. (Rob Herring) - Patch [5/5]: Optimize algorithm in max3191x_get_multiple() to iterate over the bits in the mask, instead of iterating over every chip, thus implicitly skipping chips which are not selected at all by the mask. Support configurations where all chips in a daisy-chain share the same modesel, fault or debounce pin. Verify that the number of db0 and db1 GPIOs specified in the DT is identical. Link to v1: https://www.spinics.net/lists/linux-gpio/msg25067.html Thanks, Lukas Lukas Wunner (5): bitops: Introduce assign_bit() gpio: Introduce ->get_multiple callback dt-bindings: Document common property for daisy-chained devices dt-bindings: gpio: max3191x: Document new driver gpio: Add driver for Maxim MAX3191x industrial serializer .../devicetree/bindings/common-properties.txt | 26 ++ .../devicetree/bindings/gpio/gpio-max3191x.txt | 59 +++ Documentation/gpio/consumer.txt | 41 +- drivers/gpio/Kconfig | 10 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-max3191x.c | 492 +++++++++++++++++++++ drivers/gpio/gpiolib.c | 179 +++++++- drivers/gpio/gpiolib.h | 4 + drivers/md/dm-mpath.c | 22 +- include/linux/bitops.h | 24 + include/linux/gpio/consumer.h | 43 ++ include/linux/gpio/driver.h | 5 + 12 files changed, 869 insertions(+), 37 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-max3191x.txt create mode 100644 drivers/gpio/gpio-max3191x.c