From patchwork Fri Jun 29 06:35:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 140515 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp465342ljj; Thu, 28 Jun 2018 23:36:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLyjxHb2szDOwcLEZVOdBru7tD8QN239bG7aDADmk1p0V3G+v84CVzZhv7rNhDT6vDrUKgG X-Received: by 2002:a17:902:780e:: with SMTP id p14-v6mr13475619pll.239.1530254169245; Thu, 28 Jun 2018 23:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530254169; cv=none; d=google.com; s=arc-20160816; b=EdntG7p5XdZrBcE8PxdScJ+pkl9ee4e1/Lzfq0vCR/jX9rJ02KbY2s/NuDAzCk6pv6 OlN1uzKoJbyudmnnTlShdMNgFgusR+Drd+uc73kv5Kxzij7v/rA4f5l/tu78ciVKL52Z y2r1N8mV9qRLbt1D4iBiJC0+UvtB0hD++BOgv5XFGZFFspTxfc3QIn+dvB4TL4g1Z7SP /B/Kdixw+gBXxJgFAuMDHAHi+t0Ya7rHfNCAo7BcOAyI89TiaXMoE/whTSNmw4U3bZrE sJ+AnadNWl+QZyzCoe4TwfQfOva9I2Gk+LfKfoH++vBra2xTkFSUu5mEIScbTzCX2GVh 6/UA== 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=ab1hYfwSO3vUAtTXvIkgBAz9W/xa3sqxirpkILZAmn4=; b=wTW9K0ViyI8bM3r+/UumQ6/Xk1W7XbvCabVtJVgfC7QK+NyJvFvgXI2heMrSI3o9r1 ApDZx5WWJNzEsd+z5mSZNdRa5BXZEulhWygCjQYLs89GM6VE3ESG21OkN9J1V2WiE87j E1AiE1B3dnYA2tyFZLW7FMtJIV1djwSGHrEHv/WQJKKW1qiPfyivUOBR2tSojr8PuZHv JGyU+yqaE7GvyBZ4pFRz82I3g9QgftKNzG5CdLMk+7/k46ITfhJCtyoYgd+csbF1248X 8NbZvmzv8JOrzo6zCcrwXQFCs1CmMCFcHZP6PLYI5LHXmtD/lWxHm7uhkn/dEVacoA3p yQuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BnAuaZZA; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2-v6si398613pge.585.2018.06.28.23.36.09; Thu, 28 Jun 2018 23:36:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BnAuaZZA; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753194AbeF2GgI (ORCPT + 5 others); Fri, 29 Jun 2018 02:36:08 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38114 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752967AbeF2GgI (ORCPT ); Fri, 29 Jun 2018 02:36:08 -0400 Received: by mail-lj1-f196.google.com with SMTP id v15-v6so6418299ljk.5 for ; Thu, 28 Jun 2018 23:36:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NHiT73881VoCIe0spKZcaEs+BUKhaLoQE9m3CtckF+U=; b=BnAuaZZAC/tr6q4wGe27OWk2wXwXgZuwGDVDlSm86hjMunL5/QaEDHVF/t7kqTd/qL v0gb/V0fAtczzgsPC5aCHSCVM1x5P6aL+dA6hrWFyLM3XuXazhPHl1Po/stDPw0mqwAJ RIqenpdHe6u9kLesR91aTUi+wDR3WlNU3bHe8= 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=NHiT73881VoCIe0spKZcaEs+BUKhaLoQE9m3CtckF+U=; b=pzK1Yy11WbgAFrwaJFO+vaU2bJqG3OIc5HvpEc84pFc3UcOBhzxHn647sQnO59+ZqL Wh5PWW5wuWlpmScUEb+a8lh8XFCYndTFZQVTSGHL4Sgu5qp8irFYcsZYpHvppQt5VFKC 05ufKtkRLnN7O3vjLMpXWauUanO9h87P5GTU3KdryPHKhYP7uCitVcDaeSYaYHcNe0NN LCgakDPK6V87/7Z71PV/0LE44g+cATOh3eSu/Jy3jw6pYQ/Hzjfuis18J4h6LaDh6zd1 hw+iqtk8f73tzUEA+l7SZ8Fbsl/NAyUMPjA7GTq7HS0BDdbHX6RFhbeGtcRZQb3Fkart mjQA== X-Gm-Message-State: APt69E3BugYQo7PSmjZz51oIpUc14hMIelmiCNJPThpEZ4M3lZKpdSsj g4QPymWCXXYGKAnFk9INRW/tQ6TT3Po= X-Received: by 2002:a2e:1207:: with SMTP id t7-v6mr9502055lje.129.1530254166410; Thu, 28 Jun 2018 23:36:06 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v2-v6sm1382162ljj.71.2018.06.28.23.36.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Jun 2018 23:36:05 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , Bruno Randolf Subject: [PATCH 08/18] gpio: sch311x: Implement .get_direction() Date: Fri, 29 Jun 2018 08:35:34 +0200 Message-Id: <20180629063544.3826-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180629063544.3826-1-linus.walleij@linaro.org> References: <20180629063544.3826-1-linus.walleij@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org It's pretty simple to implement the .get_direction() for this chip, so let's just do it. Cc: Bruno Randolf Signed-off-by: Linus Walleij --- drivers/gpio/gpio-sch311x.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpio-sch311x.c b/drivers/gpio/gpio-sch311x.c index 8bc2bf45e5da..ed64f7fa23b1 100644 --- a/drivers/gpio/gpio-sch311x.c +++ b/drivers/gpio/gpio-sch311x.c @@ -221,6 +221,18 @@ static int sch311x_gpio_direction_out(struct gpio_chip *chip, unsigned offset, return 0; } +static int sch311x_gpio_get_direction(struct gpio_chip *chip, unsigned offset) +{ + struct sch311x_gpio_block *block = gpiochip_get_data(chip); + unsigned char data; + + spin_lock(&block->lock); + data = inb(block->runtime_reg + block->config_regs[offset]); + spin_unlock(&block->lock); + + return !!(data & SCH311X_GPIO_CONF_IN); +} + static int sch311x_gpio_probe(struct platform_device *pdev) { struct sch311x_pdev_data *pdata = dev_get_platdata(&pdev->dev); @@ -253,6 +265,7 @@ static int sch311x_gpio_probe(struct platform_device *pdev) block->chip.free = sch311x_gpio_free; block->chip.direction_input = sch311x_gpio_direction_in; block->chip.direction_output = sch311x_gpio_direction_out; + block->chip.get_direction = sch311x_gpio_get_direction; block->chip.get = sch311x_gpio_get; block->chip.set = sch311x_gpio_set; block->chip.ngpio = 8;