Received: by 10.213.65.68 with SMTP id h4csp666439imn; Thu, 22 Mar 2018 06:06:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELvkLegUkNr3XD30Z+26TzpRTMvVfE6dogVH0v8surWugrWQQ1gPxoNVbPyaHKN6N5rSEwKn X-Received: by 10.99.160.25 with SMTP id r25mr14411499pge.95.1521723993513; Thu, 22 Mar 2018 06:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521723993; cv=none; d=google.com; s=arc-20160816; b=K9WOLZgCszTBmRAyBlIcbbip7hhsOWu2CfRhYiKtPpWTrfGc2fKA8/m8TFJiIPR8T/ zngxZEhr9a7hB5OvVVC50I9zvaxeggdQrEE/EsDRsgePQNtL9qn7vLCmf+xHAtGtpSam fuNOfOW7j6l4eYO7McVzmoN+03nUyoofrZNZmqk8DL606JSnppU4fyie/9gT1pr9X35y kqjfQWuA5ITi9QSeWdtkVqdHzPIGkNE045rBxRi3Z5s3rB5r3DRr4E+XMqXUlePpU2st U0yQ2gf7MiBhqScqiLldTmhJ1LyN/nWsOA2SFAH+ZSLNh4R+qm84koRitwjFGqVRn/Hm uVcQ== 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=0PGIwpjptKrmxrHuWkj1CXzN2iorTnCkvuqkLiPOBL8=; b=KLN3yWiOqc7KrirqioC/HlxayiGoZnSFBbMsVH5YWwgaGS7ps5IIyJVJ4PJrBTV6aB ijE29aR5TGWhkC0LdnWNIH8XHtIL5ot6Oal+7rDlwP53D1FRZT40moNwsKavGYZEQQrf B6dcp5gOxXsWCNs4zfD0VEZbAMwhSDlD6buFLqkTHkZg5nE4/iTGWeM/XzUEdikKbDKr PvwaFwdCbEPszU+UDcN65ygUcLzK6xo2Cb3GLQ2knPgb6Lh3KhqXT67h0f6e9ECmB9op FqETKCMexAzwYOsQbnfejyud03P1Ru+SHDoHMb0LZAliRAigMSeDhoG86kE8Zq3SSwAB rDlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U0U+GhDt; 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 z190si4336522pgb.461.2018.03.22.06.06.13; Thu, 22 Mar 2018 06:06:33 -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=U0U+GhDt; 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 S1755341AbeCVNDe (ORCPT + 99 others); Thu, 22 Mar 2018 09:03:34 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:46885 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754920AbeCVM7o (ORCPT ); Thu, 22 Mar 2018 08:59:44 -0400 Received: by mail-yw0-f193.google.com with SMTP id v68so2760435ywg.13; Thu, 22 Mar 2018 05:59:44 -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=0PGIwpjptKrmxrHuWkj1CXzN2iorTnCkvuqkLiPOBL8=; b=U0U+GhDtalUeDyQOs8TVANSFdgh2rWLozVthU6kOeiDTcm19D1E8ap3UJ+eLUjuIkP Q1wY9D5YhHiK0VpIjmXFHd8xuQ2gl1alS6Z+f4LgBjrXxZBj6t7y8YK8zjY+m7odEh9m d7sak60oN4v7nppBb/3bF1Q/aCOXUmYXeUZxtXHLy0GWmgNSzj/eaCgJQkMKyq5CHT54 kDa4HgONsCw/9rU+oHQS2S3vmOsfAJ9m9mFpNwfUX30oFzomilAZjwNEGsACxfh8MoU1 H/PeBEP2CgxKUaMKd/ippxy9YDFvUwq5hnlIOS1tRi1gd+RRWbMymJe11EJRP7CuYyeC MXOQ== 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=0PGIwpjptKrmxrHuWkj1CXzN2iorTnCkvuqkLiPOBL8=; b=NQQyxcRy0S2KpoWsM4+8s+pWxOQXHcIkEns2kyKtA+pUalF7+xOPLB+qX/g3JWrZcr pXNP49/nhvSZXtrggo5zRtdoPviM8AGyIbvKJrqUfgbbcUT7am9QWmXJGeoUqrcTL/RH Zg8r+VOSf19kptHvAwVHsgIjT0BTvQ8hlfQp/bUZk592KYyOl35Gvx4uu6j+WEyUrBVu 4gDvQssj/+8B8fMpHvInRAqszhuYBKg6EYNQdHXTCLYqEKSJlOb+NhLh1KpiyEgsNeJT 4r+XvPcln8TaGPkLVpbk5LpKazjKICz0V9nYSl6rD2CP5JASBVjHD/ZVToIo5NQNRPEH Ac/g== X-Gm-Message-State: AElRT7GWPnHF1nVVlA9VCCrMJxSZo2vgFBPT0HQ2l8kYZgqIOfHg9X4M UQKoy/CLtn73wsAZ+1hzJ3g= X-Received: by 10.129.113.139 with SMTP id m133mr14463973ywc.164.1521723584029; Thu, 22 Mar 2018 05:59:44 -0700 (PDT) Received: from localhost ([72.188.97.40]) by smtp.gmail.com with ESMTPSA id t131sm2543927ywe.77.2018.03.22.05.59.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 05:59:43 -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, William Breathitt Gray Subject: [PATCH v4 1/7] gpio: 104-idio-16: Implement get_multiple callback Date: Thu, 22 Mar 2018 08:59:37 -0400 Message-Id: <1699105253cb33680bb27ca61e6fc9fb0bd2aaf8.1521723192.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..96700308c1e3 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 & GENMASK(23, 16)) + *bits |= (unsigned long)inb(idio16gpio->base + 1) << 16; + if (*mask & GENMASK(31, 24)) + *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