From patchwork Wed Jan 16 05:06:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 155686 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp230060jaa; Tue, 15 Jan 2019 21:06:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN6xC/cgXLozEvVpO4ba9APC1CulrokUypIxC+gtCNAOSQH1plE+t2wizoOHGTe2WU/RR9yj X-Received: by 2002:a63:1b1f:: with SMTP id b31mr7138385pgb.66.1547615215269; Tue, 15 Jan 2019 21:06:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547615215; cv=none; d=google.com; s=arc-20160816; b=aA3qz+OdhH2Z3Nj89XFn/t2sofeMtUU7Pr2hQQ/wiRY5Xamj2yY2t/L959hP5aL1mg 34LQlhaPtxicZ7LZMS4VA7cw3vjrrQ9TdcdC/OPPTUu5lmFxMcJKgSDR9+b9gflkZMbD ua9ZxIMHLMXIofPsrlg5xYKbDgGbD1tl7IvbtKVI9qotZhPfwXWDQHb8HHKK9EvlqK/5 +4T+RpDzXAl4NEVj5Pm+WJbc1Sn0JSqqPJibpaAhoAqDlZBYRUVOWhQOL0nB/EKvzAEX McxRoV0ykBs4+ttaZsKmteA9jeIZCpqk0AC3EKHFDnIXvJWiWWDJoir4b+rpPJEw6kYR DsTA== 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; bh=UjqyiLdS2ob09b2Z4ip9zepqiphUB4pWHb9KKE6913I=; b=0KUUGU89LLMPdITWpkcrfndyQ8VhSmSnagnUSPjA90cINSOYlmpQywHbTzV6zQsfjb zbEwh/LsxQc+mVLqpB84NSIiXoDSva77ReIDT7n+AaWb/XBtdTR955KQBV3rU+L86H8t AM53q5cMNJ7wrzr0rfxGsXPTFUlfVwbffRfrrlgO28UyGpYAGXlVc5HUAkqy4D/iBi0W 2qawNzET1w5SV0R1wy0U0SxD0Mbb9HO2yUFOA7tpgTHXC5c+xZvrKMLoIwjZ7crqpvWb Mk2a9CGxiJVB+AhtQz7yFvhm6OppcAlUhwnsDAOgfRszdBtFLom+8PjwZGEK5WpkGGI9 1SQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ThhjCLKb; 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=pass (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 h85si4036702pfd.27.2019.01.15.21.06.54; Tue, 15 Jan 2019 21:06:55 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=ThhjCLKb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725928AbfAPFGy (ORCPT + 5 others); Wed, 16 Jan 2019 00:06:54 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42684 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725874AbfAPFGy (ORCPT ); Wed, 16 Jan 2019 00:06:54 -0500 Received: by mail-pf1-f193.google.com with SMTP id 64so2433550pfr.9 for ; Tue, 15 Jan 2019 21:06:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=UjqyiLdS2ob09b2Z4ip9zepqiphUB4pWHb9KKE6913I=; b=ThhjCLKbGB0aSJW/dfx7GDmmMjs+HqUjfVC9s3V3R52RXV40o/ovlKQmtYLZ/y9IcU feWB6vn2ww4djoUEwWaCXSIroLwcN6aMlTqkMjTMuf7mTLAjUoH/JP4vwdzSRZI+em75 Hw2WJeB8ucObmZaNuqOxfn7+J9v/MyYVrVTQY= 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=UjqyiLdS2ob09b2Z4ip9zepqiphUB4pWHb9KKE6913I=; b=LFNf6NS7Pmn8PTGpcWWgQx1ePoogohETVSEDPEccJmWSX+ZOfsi7cFeP8//8OHMf+x nHEZhfJ6aCF8scS65eluiilLc7ovMS0ZmuKhwcnSo2m2UNJAczvk/dGHHCVIVPjdTWBR rwuFXjsYKU67j4EELSpSgzflt+l8ilcg14RPn9DyRQI90L058jFQrV09hZPOsB+2bGBt 32kutV9MpspSPmdnXU9htMNFh58MzMQ4iF2E64aIyxT8yVT0eEi4w6fur1e8Jv6NKliN KrOXzpzuzfbUuY3C3vbTTYsIvayO6u8DG8j1hp5QCuK2mHiym0iTMnMohcle35GGhwEm WiGg== X-Gm-Message-State: AJcUukdMNwSHHbmvBMSoHtT5qmdGpMNfTrTv2Pkz0ZQs+lHO1wymiQ0g AmmWpuSvO298Ya9/y861ybQmaw== X-Received: by 2002:a63:1f1c:: with SMTP id f28mr7139149pgf.193.1547615212701; Tue, 15 Jan 2019 21:06:52 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id m20sm4784888pgv.93.2019.01.15.21.06.49 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Jan 2019 21:06:51 -0800 (PST) From: Baolin Wang To: linus.walleij@linaro.org, bgolaszewski@baylibre.com Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, baolin.wang@linaro.org, neo.hou@unisoc.com, broonie@kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] gpio: sprd: Fix the incorrect data register Date: Wed, 16 Jan 2019 13:06:13 +0800 Message-Id: <24594f8799f6aabdeaad3935fe36d832fb465148.1547615070.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Neo Hou Since differnt type EICs have its own data register to read, thus fix the incorrect data register. Fixes: 25518e024e3a ("gpio: Add Spreadtrum EIC driver support") Cc: Signed-off-by: Neo Hou Signed-off-by: Baolin Wang --- Changes from v1: - Add fix tag and CC stable. --- drivers/gpio/gpio-eic-sprd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c index e0d6a0a..257df59 100644 --- a/drivers/gpio/gpio-eic-sprd.c +++ b/drivers/gpio/gpio-eic-sprd.c @@ -180,7 +180,18 @@ static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset) static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) { - return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); + struct sprd_eic *sprd_eic = gpiochip_get_data(chip); + + switch (sprd_eic->type) { + case SPRD_EIC_DEBOUNCE: + return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); + case SPRD_EIC_ASYNC: + return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA); + case SPRD_EIC_SYNC: + return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA); + default: + return -ENOTSUPP; + } } static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset)