Received: by 10.213.65.68 with SMTP id h4csp35244imn; Thu, 15 Mar 2018 08:48:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELs2ih3RdmEjwTb9AE5ZGBhn6+4+JNPUQXgsxwPUT6CgpWeIjutolRB3JpqKPdoJcim9nWuU X-Received: by 10.99.45.194 with SMTP id t185mr7010669pgt.267.1521128884742; Thu, 15 Mar 2018 08:48:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521128884; cv=none; d=google.com; s=arc-20160816; b=GlgwwYVNRsCqUCJg9ITiF6LIO8BTo2obh2wK/zp7Utdw5Z5HyZvl50tnB2LFPjtwrm B4rfTQBpayu+8pMH0Etubix0oiyCYYZTCD8JRvWPTZs/8D/9MdRo0H8DqSFT+Q/MgZSb Sa5O/OMHRC/UX5Gf+y6nBCTaxK112KZer5tqwP8qqAtokv6DTtlgLTd+vi7H3Ami/qHH Ng/OL+nKG/NcnRD+h4kzyG+UPWHz/tQBR8hFK5ADCS1VbDcGNBnY1vdZiclT8hEMBlnL ca4YuDbPfmNXtVvuKQ3b6dIS9bQYSk+Cz8EIBROnWHJHXqV+4Ido83K/ZVdl0wcqeDWF PQIA== 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=QTPznRkJt6S79PvH3Z1Th9z6D34QmmP5ZHLEw9d8xDivhSIHMLe4NtPh1JvZeoFhyg mrwhb/EcRClwU7Znz+t9KgQMQh9l9paPYoiF1lz2N9G/ADrxR/AEtEXVfsekhzldqysE MEqOMZmjEEI9+wdGzShlOJuTDT2drqaP2/ryYaTjHdU++ZhVKHyXmQATpx09FwRUOC38 0x/yU1LtIYiIqrwTubttQXed5oGojE4RvUeQYWapfxVtHgHs2GgmH5U9pF7x4SXMhylN LY+FssFHPr5feEduk3v3b5DbwuYMW290g/51UVT1fwZMHRy91LHpSjY6yxCSU7eNZyed 68lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CnxkFjgZ; 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 v23-v6si4193840plo.276.2018.03.15.08.47.50; Thu, 15 Mar 2018 08:48:04 -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=CnxkFjgZ; 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 S932768AbeCOPrD (ORCPT + 99 others); Thu, 15 Mar 2018 11:47:03 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:41196 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932427AbeCOPrB (ORCPT ); Thu, 15 Mar 2018 11:47:01 -0400 Received: by mail-yw0-f196.google.com with SMTP id w12so4898522ywa.8; Thu, 15 Mar 2018 08:47:00 -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=CnxkFjgZaHXIEfsqapDWQ8rOAoLNIb25JHbTqRCojiLT9YatSjR5zQaDu4vNWzmtQb iIpTrNVEo61qx2o5IX21aPGz+AMWQkh6eSrBYxP1cLmKjBtNmmbSHIfbPp78AuRKeJMc PWVcmuP7niMYRG46FKG80EutZOuVjWkAgSoV0jrzsyXX6rbjZ/2Zr0E+ChDTA8FY2MRV IZ2k/GP90EAzaFhc3hp7ELVhGeAJWQ+2dD4F5s2hB5n941YbbaGIZhO+4R5HL3SqPJQB LLovIS3IUxsoctvd3ODFj+OUh0OzaWhmkZfu7Hjt4TBhgevbNjMp2QNxBXi8ljJ3fJ/x lxIA== 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=GnCBovAreUHYNvMn5Hx7sxoMn8Uxc/63SQBGON/io15L46Y0jRzDU9BQn/eqLglZeU Tg212zcXZOQg6vMMICgK8nXd0Q9I812IHZl+l1lctFgdpaLh69rd4/QOlLZKTD2LhAtn YI6CrjE244H6GqgtPN0fypQe2YpmaU6yBs3c0MFWVewaODNNmGdbo7XltpzuihhViGL2 N5tnke4bCOZyCJDpl6IaCHzdF2TMjNWTGF+8fM36SsjCQeQuXe2u7BQI1nvpif80GeWd TOSokbXRMvQBNt+xceT4Ceh3BLmE1jFGZUpaZqu5Req26BdLyVWug6ELjYxE/VYwPKXy lHKA== X-Gm-Message-State: AElRT7GhOR58YuiTdY1fILpalDOTmlhxBR0SyumzXl07HU8JiZ+rKY68 KH0kE1eUntP35heNMQNfUj79wg== X-Received: by 2002:a25:6843:: with SMTP id d64-v6mr991636ybc.268.1521128820386; Thu, 15 Mar 2018 08:47:00 -0700 (PDT) Received: from localhost ([72.188.97.40]) by smtp.gmail.com with ESMTPSA id i123sm124624ywd.73.2018.03.15.08.46.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 08:46:59 -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 v2 2/8] gpio: 104-idio-16: Implement get_multiple callback Date: Thu, 15 Mar 2018 11:46:54 -0400 Message-Id: <486eb9bad0440ed305a78d9fc990728cbeb7d43e.1521128287.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