Received: by 10.213.65.68 with SMTP id h4csp421478imn; Sat, 17 Mar 2018 08:51:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELvtxvKqAI9NC/o8Cf4lIe6OPAhebVqXjFbh/6MNYm9KWKTezcCDNfQFE9p+rQedsG6gGLST X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr6096676pla.328.1521301909329; Sat, 17 Mar 2018 08:51:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521301909; cv=none; d=google.com; s=arc-20160816; b=bNkuGewOeBZ6QpoL37gh2hBfmO2N7n5Pjrq1RDz+1kwxWwEmjl1Wiyeh8OYVdfEp6N yatIRm3yOvfXf8Ys5gG2wHTfc96eWDLfmCRCV8Gj3c1IGhPe/nKALaMB1pMA5BeA18/e TrGYtyVM4aw6HkdfStnTefufklm8rifh3cS+JiZYUbs9H1g561jCKlRX+VYUeUoT0P6P WsfJOywfkTm4njm05cOwzeLqthZUlfXL/UORFM7LBtqj69zB0lMgz6D3JjsIMb84a5Rn m/Mda5XzXfboEW4w/XfOA7iniLC8Grs7ZckKA49CXnlBQvpsHwFtig80w7+YCVyAmr4r FH6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=5S57FZrDn18lTmUv3cK/UjtCHjKej2R0jpXyStLW50c=; b=D+9ruQaDwv4pQs8TRT/vixe/inMKQZemwG+BQbBh3x+cBfOPFYmcyHSB1p451/Wzmo vALXuNo4gULV/uKmMR+c+9beJ/MrPdU2pqBPxOka2bCavznj+JhEt15AJta3krAX/g50 ep3YrJP507iMkAqPXDSYNQdTEaW9IOyiml+PwH7AEbhyuCF2Mocr1tNMhJDoFp+E8yrm Qhw+tH15/Ml7g9xJ7OW1lRZ2htmLKj/Mfb/4AhY/lK69wMvJFzDFgoaBhrTvdgSBIZzn mh25pH0ZbgWjFK3aqIfaCqpm4hOdOUzL5hT3G6FCcEq3PoVeVuAML5SybbxANP9Sy5iH Dk6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y9NdzJzf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o11si6595562pgn.554.2018.03.17.08.51.35; Sat, 17 Mar 2018 08:51:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y9NdzJzf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753674AbeCQPu3 (ORCPT + 99 others); Sat, 17 Mar 2018 11:50:29 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:37605 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753642AbeCQPu1 (ORCPT ); Sat, 17 Mar 2018 11:50:27 -0400 Received: by mail-yw0-f193.google.com with SMTP id y23so8919858ywy.4; Sat, 17 Mar 2018 08:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5S57FZrDn18lTmUv3cK/UjtCHjKej2R0jpXyStLW50c=; b=Y9NdzJzfQrLYtZBA27fWdeIVjZUnlanb6/7cniFQHAbNymQiTxuJ76fNeJVczZoWH0 YQbdZGuyHFRql0xTbmAjk9A2eJOo8NBRMAm61yxp6yasYEI3sDhUR4jLLIMURvtgWTHn SL6xFlUpdXBpK39ELI4a3pfKa+HvjRz1ioz4UhHmvgKusylToUv8z6b+Z1Rav/R/SbHR m0r+FIsuqwm2dO4FDCWztCsOiprO2GQiMqM1qodjzYgZ3IjG+qAieM0q1dogmApb3MHC hFiCd30bAViie/vFAwA1TKxUExv6FGmOBmdv+CKaJgnjIhF+k1gF64P+KLIYOFJcsOVE 0XRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5S57FZrDn18lTmUv3cK/UjtCHjKej2R0jpXyStLW50c=; b=g8PxkCYvCedByauL4i2k09J1wXGAvj03Ijt1RmMQtwGtidmBueooeZDVk3u2RTFqln /GAGb9/yj7WsvGEZUxtTz4qJi3lx+o2MGswpgqIn9Hs/cnXBnxpTcd03Z8+FwKUvA5SD mWUetd+NkoPoDjWunJB4fs6kLauoYVt/d1ijtF2l24H9kJZByRFphoj3X7VPoC1Z2Ly+ ayk9X1KF8cCKxdMPxVINuO8uubajtCT0YqOMFws8BuJAOKfq0zeIK61HkguLWYN4q399 F0DZ1C7dS8hS7p4NBtnbzW9JFB5KacurFbRm1qcHNJZUo4rRVtAdNPF+7d1A3qTz9c64 WM0A== X-Gm-Message-State: AElRT7HSwPz22tg8q+ekcdd275Q44xiwE8lAG/p5Hapu64RctrsyzRu5 QLLi7oVkIWNXYYwTcFWcKIE= X-Received: by 10.13.218.194 with SMTP id c185mr3502901ywe.393.1521301826853; Sat, 17 Mar 2018 08:50:26 -0700 (PDT) Received: from localhost ([72.188.97.40]) by smtp.gmail.com with ESMTPSA id r12sm225005ywl.108.2018.03.17.08.50.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Mar 2018 08:50:26 -0700 (PDT) From: William Breathitt Gray To: linus.walleij@linaro.org Cc: andy.shevchenko@gmail.com, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, William Breathitt Gray Subject: [PATCH v3 2/8] gpio: 104-idio-16: Implement get_multiple callback Date: Sat, 17 Mar 2018 11:50:15 -0400 Message-Id: <486eb9bad0440ed305a78d9fc990728cbeb7d43e.1521301345.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ACCES I/O 104-IDIO-16 series of devices provides 16 optically-isolated digital inputs accessed via two 8-bit ports. Since eight input lines are acquired on a single port input read, the 104-IDIO-16 GPIO driver may improve multiple input reads by utilizing a get_multiple callback. This patch implements the idio_16_gpio_get_multiple function which serves as the respective get_multiple callback. Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-104-idio-16.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpio/gpio-104-idio-16.c b/drivers/gpio/gpio-104-idio-16.c index 2f16638a0589..5de5819e5156 100644 --- a/drivers/gpio/gpio-104-idio-16.c +++ b/drivers/gpio/gpio-104-idio-16.c @@ -90,6 +90,20 @@ static int idio_16_gpio_get(struct gpio_chip *chip, unsigned offset) return !!(inb(idio16gpio->base + 5) & (mask>>8)); } +static int idio_16_gpio_get_multiple(struct gpio_chip *chip, + unsigned long *mask, unsigned long *bits) +{ + struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); + + *bits = 0; + if (*mask & 0xFF0000) + *bits |= (unsigned long)inb(idio16gpio->base + 1) << 16; + if (*mask & 0xFF000000) + *bits |= (unsigned long)inb(idio16gpio->base + 5) << 24; + + return 0; +} + static void idio_16_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); @@ -244,6 +258,7 @@ static int idio_16_probe(struct device *dev, unsigned int id) idio16gpio->chip.direction_input = idio_16_gpio_direction_input; idio16gpio->chip.direction_output = idio_16_gpio_direction_output; idio16gpio->chip.get = idio_16_gpio_get; + idio16gpio->chip.get_multiple = idio_16_gpio_get_multiple; idio16gpio->chip.set = idio_16_gpio_set; idio16gpio->chip.set_multiple = idio_16_gpio_set_multiple; idio16gpio->base = base[id]; -- 2.16.2