Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp10453imm; Thu, 28 Jun 2018 13:54:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLdMskZh7eiNEOiTN2UOpzRL/ii7UX3S0YsdR4UcckyrltxRJAVngDckwBHac7yCfb3bG8G X-Received: by 2002:a17:902:123:: with SMTP id 32-v6mr11705670plb.181.1530219245360; Thu, 28 Jun 2018 13:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530219245; cv=none; d=google.com; s=arc-20160816; b=A/W8dW2/gUvIyOG2KRAQQ6W2QxR2zTtlA1q2ce1wT2B3m+9Y/OwTUni8zGsk1klML5 J4Sa6lpq90Gp3p9ynblZqyum27F+lwj6ovzHMLxSxWaFe6THPxQPTX6lfqPQu0BzDHEf iEbqyFWssOfth1QEtLZyyiY6ugUq4AI0IqTIjwlLb0BtGbcRcC8ZXbvEo3zymD/LwezU 2IGg0tn8UmQyKYre39gs72/Y0n/Cq8UvgxuiEggpASDDxKkydB/O767l6xp6m+OMep5x te/X/9AUnac8+nuBecmthQ3YYXR21ntkib47cP5tbevY8XsH70r2QvA30bC9hkYsFowy 50QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=8xTgjlnzHzKXTR34WzoaNnu7pwiH36F9/CHlALit1Gk=; b=o8emio0c3ABIKtCpb9kZWmMhsIfMePJgx80rVMJ4ukFhle+U82CMdcpoXWE0BekpY9 8SJDl9TwD1Ncs9yvBNTHN9xRKgBsrtUppsLEKyX+GDolRmCa6lPAPfCqSySMna7jakAY WEZsIjubsWSy0quBQ8vkVITZ5aLcJIrNN26c/CUnSM8+ohRxDqB363ARUh+QQZWyjmwM Z2gCuYH77qdW66tTkzJD6A//ttjWouJUoyPTyEVIdf73umX8a+4nBtmcY2xOZN7hAaar YQSIMc5lR57hGooK4xDsCO6xcYh+2uKjSWmuvm59Y+ku2y4jZp6iDKW6ml7ZTJ585kUE gqAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kresin-me.20150623.gappssmtp.com header.s=20150623 header.b=rzZH7UZv; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4-v6si7319394plb.251.2018.06.28.13.53.50; Thu, 28 Jun 2018 13:54:05 -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=@kresin-me.20150623.gappssmtp.com header.s=20150623 header.b=rzZH7UZv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965703AbeF1UCM (ORCPT + 99 others); Thu, 28 Jun 2018 16:02:12 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:54102 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935080AbeF1UCK (ORCPT ); Thu, 28 Jun 2018 16:02:10 -0400 Received: by mail-wm0-f68.google.com with SMTP id b188-v6so4892457wme.3 for ; Thu, 28 Jun 2018 13:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kresin-me.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=8xTgjlnzHzKXTR34WzoaNnu7pwiH36F9/CHlALit1Gk=; b=rzZH7UZvXyBJttmQ/zLERC8Fn5QkW1ZgRp9EBRfCfL8d9Bot+vfTUwVBuWvk6CJgCv dzYgsxsUW2yanegdb24OE8CXkn7yh2GmpA3j8JJvQGTRIryGgVmb6Ov6vrqdJKd0i68+ /EB2iZQSAU5zcx2SFtHu+JmBPKG8f4u8vbkX8dq8fDExcCwiiZmLu/LhLUFVR1tPFz6r nBFQHgzxoie6YmsZsVmyN6ecg5qIz0NKKRfaYfnG0iuUJucUT8TIkoy8CFHjKspBx0uK EmcuHEnm16VTSvixqa2/6nGKoBXXder6/HaH6SNM9d4/3SEODUvrZcZ75wayXtFnZ4Wa 3/RA== 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; bh=8xTgjlnzHzKXTR34WzoaNnu7pwiH36F9/CHlALit1Gk=; b=gyJYp/DyXFjkz1q3M7lkb3ZdYY8c3la2HO6obCL2a48u+jVCbvT+zoZIt1APo1FnFn 7xIL365k1hoF/FSeC1+gw6Nqcycy3WgoVeWyDWZSP6Nu6rdvYQWDgLrJLU/vJ6rdumEd R47KGZCMe/RjMdKa/txPogWC6C1jbiZAX9G4DKDYm3pFY5z7WuqqqX7WZEp0DsWdi9sa x0PkIZboY4s/YASlaa2zKtHKql0ooJxgBpYLycWe+X3ajhWYzyI5UrWKNj9BkR3egUuM EgGcgHOJW4Hqh4aSYssYugitD6n/V1w7dPCbvTFcW35Dlpqvw0cbxc39209+3DAGQPq7 rQ7A== X-Gm-Message-State: APt69E2z2u1akuTyy2SQb6er1TQsACL5H0ZBKjRTF5znYu0lALL198WW Q4wbymyrQla01Q+1rgSChLbBOw== X-Received: by 2002:a1c:64d5:: with SMTP id y204-v6mr36998wmb.14.1530216129494; Thu, 28 Jun 2018 13:02:09 -0700 (PDT) Received: from desktop.wvd.kresin.me (p200300EC2BC6E30040B8FF52E7C5D1B8.dip0.t-ipconnect.de. [2003:ec:2bc6:e300:40b8:ff52:e7c5:d1b8]) by smtp.gmail.com with ESMTPSA id 16-v6sm12878387wmi.36.2018.06.28.13.02.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jun 2018 13:02:08 -0700 (PDT) From: Mathias Kresin To: linus.walleij@linaro.org, john@phrozen.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: martin.blumenstingl@googlemail.com Subject: [PATCH] gpio: stp-xway: Implement get callback Date: Thu, 28 Jun 2018 21:57:40 +0200 Message-Id: <1530215860-25549-1-git-send-email-dev@kresin.me> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an implementation to get the current GPIO state. The callback is used by the leds-gpio driver for example, in case the current LED/GPIO state should be kept during driver load. Signed-off-by: Mathias Kresin --- drivers/gpio/gpio-stp-xway.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c index c07385b..63c708c 100644 --- a/drivers/gpio/gpio-stp-xway.c +++ b/drivers/gpio/gpio-stp-xway.c @@ -91,6 +91,20 @@ struct xway_stp { }; /** + * xway_stp_get() - gpio_chip->get - get gpios. + * @gc: Pointer to gpio_chip device structure. + * @gpio: GPIO signal number. + * + * Gets the shadow value. + */ +static int xway_stp_get(struct gpio_chip *gc, unsigned int gpio) +{ + struct xway_stp *chip = gpiochip_get_data(gc); + + return (xway_stp_r32(chip->virt, XWAY_STP_CPU0) & BIT(gpio)); +} + +/** * xway_stp_set() - gpio_chip->set - set gpios. * @gc: Pointer to gpio_chip device structure. * @gpio: GPIO signal number. @@ -215,6 +229,7 @@ static int xway_stp_probe(struct platform_device *pdev) chip->gc.parent = &pdev->dev; chip->gc.label = "stp-xway"; chip->gc.direction_output = xway_stp_dir_out; + chip->gc.get = xway_stp_get; chip->gc.set = xway_stp_set; chip->gc.request = xway_stp_request; chip->gc.base = -1; -- 2.7.4