Received: by 10.213.65.68 with SMTP id h4csp286022imn; Mon, 12 Mar 2018 13:50:39 -0700 (PDT) X-Google-Smtp-Source: AG47ELvvTYT8JUgKhXk4vtKisLX8cjHRIUCN4B+xLZ8GEx4DHuN3nandcYVmRCAstHkjzYNluX7g X-Received: by 10.98.210.70 with SMTP id c67mr9226301pfg.164.1520887839040; Mon, 12 Mar 2018 13:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520887839; cv=none; d=google.com; s=arc-20160816; b=gOoa+Yq5FHTinD5pkejKQhEXSty7phtSzxiomMQLZPexpxR4eYiDsx7M4v5IS8jq4z 01d/Ngqir5ABBDVXEWCk6QdQGTJz15prbFP1rpEHkxV8N7AHe/6bIRdo8o7NIJ02VSb9 Gam5awaChVpc5NEBMdNx3liQvpCq1aEX51sjKUSkWk29JJheO+CwIFpW54xBbNsPFIs+ VgYxtTVS9VgZ4HdpbC9oXnR18kNg7Pc0ta40OGKRYvOOnhqLlEFlZZiYKO/9yU0xe7k7 X/RIWzZmmjs/Q9OsfzM4RJzsqRQh6KpPcFVagSQGG1W0IM8mA4SUFTY5gn/kpqMaX3DH 4JaA== 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=wFnMK6D+bblhMDPQuvsSIftWix+j8lnFE4c41AdwXEtoAzqBJShv9v+VmcfIIQq+Ss rpZWDPhSzMF58KCwl9wXa6aKK0n6g2o0hGXBRvCPjklEZXFA+Sz7s/0foHVgyVs9hKdF GTBIAfpj7qTMDiQ5pdR2BXuYjAIgaXKfXGdzJiQWl9okA06dInTSL1KGDrOKTnw3rReH zpA5cHYyywT29ZESwpvoPd4JH8VTk3NaBcAfwRJ+2T0Ip6PfzayfOLD/WLjlQ7wNj2sh UPz4nn7M5WbYe0EzJG8/8i0Zjlk1SHh9eKQH5fir7Rmf8SLhqTegwKISeQHjdivcTkGd ESrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AWMZdDJW; 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 q195si5520913pgq.309.2018.03.12.13.50.24; Mon, 12 Mar 2018 13:50:38 -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=AWMZdDJW; 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 S932468AbeCLUtE (ORCPT + 99 others); Mon, 12 Mar 2018 16:49:04 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:37029 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932274AbeCLUtD (ORCPT ); Mon, 12 Mar 2018 16:49:03 -0400 Received: by mail-yw0-f193.google.com with SMTP id j143so6391792ywb.4; Mon, 12 Mar 2018 13:49:02 -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=AWMZdDJW2zxiUpccHlrG6FUHoju3CZK4i2ZptjXAbEzMVFr5v2T+lHr4efGq3HaNEP p6aq5YJx2UREJ8B7VY+vBfRq/paSlPn7CxG5sVA3x5M/Awmoz3jLqcyh8/13IaQpneo3 oKr4HM4AwCdeFefLWI3TsEpsdDKIiuaHfQLs/BRj3wL3ZuMyfvcY8g4v7XsfTPTr6KRh cg5WwKiOCRAlno5JJngOUcWdexFZwhICds1dS++ey6n3wUiNIhConCcLCccslfBf68Ch alMjWDdQNIAYuPNv+MF98aoICnRlaFX1qZulKalu6ZBWN6vfGsjd35G7u6ExgJevQiti OBqw== 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=O5BrsE93+uBPH5Rg34E2GXt6pi21MlpiJuzq4UtbQEFjCxe1Fk/Cv285fCCJe8zjKD myDRAYfz39ogQduEFRE1bnjq1Dx/4pbbuS8yVQWcSbYOOJUpey4MbaEnpJO9cYCHa+HO 0pM+HhxAQ/muZwnXr8RuXm1z6gZZxYmp1n3D3fhWGpt0bPjpkbzDheKD4UjinLFZ5+rp wAXjfE7LvlliJcYD9Hfa2+qb5TlHLz1OxV0DwVv2pOMkqB3txiRH0dsM0pZIFQb0ArTf 4MdySk3j+MrLWoe5nUbloxy0UGbEUFgkZm2xP7wD2q8fpdtM5Co5yLgXAKhtkpbsCbKn fnYQ== X-Gm-Message-State: AElRT7FxY2UwEQJD7aXG0reaAGTIaRvYmFbosy7EsZc/XvFkRyIgDgRb VnCSgHSPwICt29SsalbNMmY= X-Received: by 10.129.69.10 with SMTP id s10mr5639124ywa.145.1520887742479; Mon, 12 Mar 2018 13:49:02 -0700 (PDT) Received: from localhost ([72.188.97.40]) by smtp.gmail.com with ESMTPSA id h7sm3112890ywf.2.2018.03.12.13.49.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 13:49:01 -0700 (PDT) From: William Breathitt Gray To: linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, William Breathitt Gray Subject: [PATCH 2/8] gpio: 104-idio-16: Implement get_multiple callback Date: Mon, 12 Mar 2018 16:48:51 -0400 Message-Id: <486eb9bad0440ed305a78d9fc990728cbeb7d43e.1520886945.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