From patchwork Wed Oct 9 04:52:45 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: 175587 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp265948ill; Tue, 8 Oct 2019 21:53:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxz6IFtu8ZFccZfvI04GdEVrh5ocG3jOMC3VyVyULTQ8MgEsvnKveC3SrVmzIsMRTC3SS+Q X-Received: by 2002:a50:f742:: with SMTP id j2mr1209952edn.253.1570596784768; Tue, 08 Oct 2019 21:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570596784; cv=none; d=google.com; s=arc-20160816; b=qkXBzL6c/mrMn0j8kGKTcXUWmf8IPtwwq8MhJoPJC1YsG7pnNXW8LsN4ox24YMfVvz LWnBQCGX6wlYJN5U/+BWxH+3gr39ObbrlYzlo0oybPAAMI8vJP34sSyB90ko131muqXI Li8nr0Y0S3Omdx5u91XVnDq3pvQNt59eAwzc9v3n5Dswom/ncKdhB1I2gnE4xyYxhawS rXI4j7bhwGyYdNGqSjdPQA7qvADMnEzmOhh47BTRs+A3suWG87Za2Piiyhp61YDfx0Uq WeEf0+/YT4ijG3PaLfHX5eCtsR582j3tX71+vKYsnLeI47bPvtGG273QaKiVTILsUhSg MoLA== 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=BVPDZ+UM30WirOqNPfNn7Zfe1sfZXxP2P+omCF1CkXM=; b=jDMrXBKI1q+0PVFQAy9hCLj8ZXMhOoufNvu3RQ79pJG0cDKC3h9zSf2oHuKmIcx6hD Eii/5vZuKNnUQ5YMWRcqP0rLOfAiPi/f/qn8/NnL44BtloLMenbMZLI2hkz5LAHNO/Iu RQHVxQnyfKvkZm4K0rKItbHe4YYazoyWUq7lL2P/9pTMr3AsrZtU7s0wrNTO9DzPcOW8 OreLk4dmcHgYfwSqsN/xP05he2l6YeFv+vuVWb0asPPiA/hRObYDhm3SDlxWC0lyKt/d uveLuNwndO5HI0JkGb6DtgH0J1SWTGG5VlMDm8YBXHiqJwL+cHlHEQoCRQjy8jSIywUw 5tWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ewr0dLfG; 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=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 x9si528987eju.147.2019.10.08.21.53.04; Tue, 08 Oct 2019 21:53: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=@linaro.org header.s=google header.b=Ewr0dLfG; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730342AbfJIExD (ORCPT + 26 others); Wed, 9 Oct 2019 00:53:03 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43410 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729040AbfJIExD (ORCPT ); Wed, 9 Oct 2019 00:53:03 -0400 Received: by mail-pg1-f193.google.com with SMTP id i32so577168pgl.10 for ; Tue, 08 Oct 2019 21:53:03 -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; bh=BVPDZ+UM30WirOqNPfNn7Zfe1sfZXxP2P+omCF1CkXM=; b=Ewr0dLfGV3C81iZtiq9ImVyUdComMA/4a9GbeiEGsQkyAMNZ8/e6pDLMSebzRSbIa+ ryYN1cXcBAnzJINPo1cfm1WuV6rWMqP8tX5H+40EwiMZe8GTU1U3Hwrh3nihEpdbDIAP Bgsp28d0W3GhraUzHJNS370erIjrDJ8nSZTVjnfpk5SvdvPChqTp1gUBK7IGqYaWzaj9 XRWxyVfPldyZUKYFKCBoDdV9sPI4L7UffXU7BQEhPIpVZEkeX5WjO/DC9FKuVIVACTdg O5n9B+S9dUT2OY/gP8muAzeueJy3nXOCQp8hXJ2QCumAvydNQWa2SQS+UJRKp+TxH+GF DPUw== 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=BVPDZ+UM30WirOqNPfNn7Zfe1sfZXxP2P+omCF1CkXM=; b=Ld1ulE14GOcd90cz3tL2Ttq1/o54+v0TkRYhd/YmVndbEGss6hijtQ976kVvyx24Vp K2AH87oCVxuj5CpKVV2LtP7Gyfe+R3O7UIButyE94Kv70y2dqIZOEMlyMmp9qihPP+Oy 8AWRBEKy1VEvQ5RBPUdmEg1RJedG/KjnPD6PvdDgvs/2KT9xKo2AksFtrOvzf6+1uhur eYepFhhug+U0VobjRVlSIWa8ILvjlnb/Cmwlk9gzuLDLvifZpMACoSPCgMy1F16eOmxU j0HFLfQOVVGJgnez/ztYBykNrPmmodp0opv8QiiVuE4B4AVXHS+um+uiVVCKIwGrw2zl WmXQ== X-Gm-Message-State: APjAAAVQ4/NqseJPkIwnOgNXI3wMMzGwkvxnozDVvy4lMR9OtAJ+e6M6 dfIgT/GTBaMIqZo8ZEqUrgK0jg== X-Received: by 2002:a65:520d:: with SMTP id o13mr2343089pgp.42.1570596782870; Tue, 08 Oct 2019 21:53:02 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id 7sm732678pgx.26.2019.10.08.21.53.00 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Oct 2019 21:53:02 -0700 (PDT) From: Baolin Wang To: linus.walleij@linaro.org Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, baolin.wang@linaro.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] pinctrl: sprd: Add PIN_CONFIG_BIAS_DISABLE configuration support Date: Wed, 9 Oct 2019 12:52:45 +0800 Message-Id: <66d373ddee61e8be2fcef49aac5e80bd58f14915.1570596606.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add PIN_CONFIG_BIAS_DISABLE configuration support for Spreadtrum pin controller. Signed-off-by: Baolin Wang --- drivers/pinctrl/sprd/pinctrl-sprd.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 1.7.9.5 diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c index 7b95bf5..8869843 100644 --- a/drivers/pinctrl/sprd/pinctrl-sprd.c +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c @@ -484,6 +484,13 @@ static int sprd_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin_id, SLEEP_PULL_UP_MASK) << 16; arg |= (reg >> PULL_UP_SHIFT) & PULL_UP_MASK; break; + case PIN_CONFIG_BIAS_DISABLE: + if ((reg & (SLEEP_PULL_DOWN | SLEEP_PULL_UP)) || + (reg & (PULL_DOWN | PULL_UP_4_7K | PULL_UP_20K))) + return -EINVAL; + + arg = 1; + break; case PIN_CONFIG_SLEEP_HARDWARE_STATE: arg = 0; break; @@ -674,6 +681,16 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id, shift = PULL_UP_SHIFT; } break; + case PIN_CONFIG_BIAS_DISABLE: + if (is_sleep_config == true) { + val = shift = 0; + mask = SLEEP_PULL_DOWN | SLEEP_PULL_UP; + } else { + val = shift = 0; + mask = PULL_DOWN | PULL_UP_20K | + PULL_UP_4_7K; + } + break; case PIN_CONFIG_SLEEP_HARDWARE_STATE: continue; default: