From patchwork Wed Nov 23 15:20:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 25049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2855625wrr; Wed, 23 Nov 2022 07:25:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf5DoOO15Z1PG3K7bdnfnoVyReOb6tHdpBn0l4v7Zmg8UxGsi6XOyM/FzKC2NplQyAHtdXGj X-Received: by 2002:a17:90a:4745:b0:213:1442:24be with SMTP id y5-20020a17090a474500b00213144224bemr36067964pjg.15.1669217155418; Wed, 23 Nov 2022 07:25:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669217155; cv=none; d=google.com; s=arc-20160816; b=RP7M/DtHYh+cZTsxwtzAY+ReUYxAU8ZhR1ZjLvgFU2JszKJ5MNh7DU8EGRGODn+VgB OYZHXs8Qs75jYyjazHxv7tBiEPwNZY221Zg4+JPnBYQ43dC27EhtaewQHw18JBplLua3 BoTZxAmGI+yc5bV6dZz/rNpxV5r4XDQSUWukTyT08xayXAOrqBZfxT7l+2I1Ya3wu11o 16NnpWGadSbOOoaIIwJ6NLqcPMFBaT9h7BYRN+NgeyyrnGQ6LWIAMUbFTNu7cv9r4sF4 +iR6rk3/t41V92ei9lX9Uhull/+BmG5cMSTlOtRfDuZ58yz3lV89Eg3vxDxZq57/69z8 FcPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KN2/QtlLjs6UFWl8nj+yt8+0EJtSW1V4HYBBliOcWZU=; b=yi/m3p4IjOoePosYRZLmUxZZpsMoHXdyawzpG1QFqoguvqGA5e0GgJNrc8NBOEvqnY UMQmGDpxofiEgAXOz4FGUr6+hv4GLYv76TTA6zh2/osE+X8zw7XSUDAfReKkiYMkXU5O Y17BODHxsNrhR+jbJ3Gkm9YfUvH8c2zUmxYGhwe5XpSqmcYNGkPBdYPDvIPKklRoYuOW T+ZGXz+WjfbP9zwOh77tYtL9DTS0F6bw0NAllar+5V+qhXQHFvgXjJbDS2J162FicLa/ nX97kjlOKQQf6TDBzkpD9X2pY3ySm+kPe+LfFiZ4ICbeFX4ej5XKDLD7AkNkLN98ujXC +Q0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vASi9wIA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q19-20020a056a00089300b0056bbdb48fcdsi18639324pfj.118.2022.11.23.07.25.41; Wed, 23 Nov 2022 07:25:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vASi9wIA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238742AbiKWPUb (ORCPT + 99 others); Wed, 23 Nov 2022 10:20:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238751AbiKWPUL (ORCPT ); Wed, 23 Nov 2022 10:20:11 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BB589209C for ; Wed, 23 Nov 2022 07:20:10 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id x17so16418627wrn.6 for ; Wed, 23 Nov 2022 07:20:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KN2/QtlLjs6UFWl8nj+yt8+0EJtSW1V4HYBBliOcWZU=; b=vASi9wIAwi7NyOC+JAIYezcqoYjpHTurwdRxp58vNKtT/4omMKwrmGjE4iTV4anhri OJ3CM7aGpLB27L5O5GqxOED2u/yexkYN4wsEXNzjZuzMkTFQu59j9vq/w736GI7M5chL 8y/1Wa0MNkKXH5jGV/k/4bfpeya3yHS2n2kzJTV8UY6znWO40gXSj8DkTQ+QzvbTWKJ+ R/YQToWISv9XZzJjG4lBeIAdS03dghBBllawSeVm4JvqFp9iFvh7jg8/OjotIGeMNHzJ OLnH40F1wkeq0asTs4sNHdU+cXlN25BQcNHxdb3ASAmiGVw7FZBmO0zwp4sx5CCT3Fp6 d49g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KN2/QtlLjs6UFWl8nj+yt8+0EJtSW1V4HYBBliOcWZU=; b=NQuugKMQJTJMqO19s+Qd0b5muLw7rwYs2fi492IWftIqjMRVm8m0UJPzqaMw6wRGF1 eHWN8ufCfQA0W0qPiQy/AUSPb98azD4T6drgwYFuWKNQn59SYKZebkWRybxlfFYIsnXP UPxJb7SeK0UV81rEtD65B2bxhSy37Tnqidfm8+M8Glf7D9Wej4H1dG2GlJOE3djOahy4 oAMfxd7B0tTZCEEQjWbKKCrvTyFlPfZ9isOc9Lm11HA/JjL05I4jBIzXG+rulFvLj5VO x7SXW0ghF6qO7tc3MgMOpd898CKFNeanVqUnYJDhw8g+Jh62hwDflGWRf9rGgLlUboss KejQ== X-Gm-Message-State: ANoB5plMa1lh9RSs5ieBPaMBU/m8iTxLQnl51O4q/Kyn5yk8MLiaJec2 JOB4y1OPmNkP15rtiRi28PIFAw== X-Received: by 2002:a5d:52d0:0:b0:241:c340:d1ea with SMTP id r16-20020a5d52d0000000b00241c340d1eamr10748919wrv.434.1669216809572; Wed, 23 Nov 2022 07:20:09 -0800 (PST) Received: from localhost.localdomain ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id l10-20020adff48a000000b002366ded5864sm16764914wro.116.2022.11.23.07.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 07:20:09 -0800 (PST) From: Abel Vesa To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Linus Walleij , Rob Herring , Krzysztof Kozlowski Cc: Linux Kernel Mailing List , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, "linux-gpio@vger.kernel.org" , Neil Armstrong Subject: [PATCH v2 3/4] pinctrl: qcom: add support for i2c specific pull feature Date: Wed, 23 Nov 2022 17:20:00 +0200 Message-Id: <20221123152001.694546-4-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221123152001.694546-1-abel.vesa@linaro.org> References: <20221123152001.694546-1-abel.vesa@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750301048022223215?= X-GMAIL-MSGID: =?utf-8?q?1750301048022223215?= From: Neil Armstrong Add support for the new i2c_pull property introduced for SM8550 setting a I2C specific pull mode on I2C able pins. Signed-off-by: Neil Armstrong Signed-off-by: Abel Vesa --- Changes since v1: * Added my missing Signed-off-by tag drivers/pinctrl/qcom/pinctrl-msm.c | 20 ++++++++++++++++++++ drivers/pinctrl/qcom/pinctrl-msm.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index 8fbb953c4bbe..f92082c1c805 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -83,6 +83,12 @@ struct msm_pinctrl { u32 phys_base[MAX_NR_TILES]; }; +#define PIN_CONFIG_QCOM_I2C_PULL (PIN_CONFIG_END + 1) + +static const struct pinconf_generic_params msm_pinconf_custom_bindings[] = { + {"qcom,i2c-pull", PIN_CONFIG_END + 1, 0}, +}; + #define MSM_ACCESSOR(name) \ static u32 msm_readl_##name(struct msm_pinctrl *pctrl, \ const struct msm_pingroup *g) \ @@ -324,6 +330,12 @@ static int msm_config_reg(struct msm_pinctrl *pctrl, *bit = g->oe_bit; *mask = 1; break; + case PIN_CONFIG_QCOM_I2C_PULL: + if (g->i2c_pull_bit == 0) + return -EOPNOTSUPP; + *bit = g->i2c_pull_bit; + *mask = 1; + break; default: return -ENOTSUPP; } @@ -415,6 +427,9 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev, return -EINVAL; arg = 1; break; + case PIN_CONFIG_QCOM_I2C_PULL: + arg = 1; + break; default: return -ENOTSUPP; } @@ -498,6 +513,9 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev, /* disable output */ arg = 0; break; + case PIN_CONFIG_QCOM_I2C_PULL: + arg = 1; + break; default: dev_err(pctrl->dev, "Unsupported config parameter: %x\n", param); @@ -1495,6 +1513,8 @@ int msm_pinctrl_probe(struct platform_device *pdev, pctrl->desc.name = dev_name(&pdev->dev); pctrl->desc.pins = pctrl->soc->pins; pctrl->desc.npins = pctrl->soc->npins; + pctrl->desc.custom_params = msm_pinconf_custom_bindings; + pctrl->desc.num_custom_params = ARRAY_SIZE(msm_pinconf_custom_bindings); pctrl->pctrl = devm_pinctrl_register(&pdev->dev, &pctrl->desc, pctrl); if (IS_ERR(pctrl->pctrl)) { diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h index 05a1209bf9ae..985eceda2517 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.h +++ b/drivers/pinctrl/qcom/pinctrl-msm.h @@ -80,6 +80,7 @@ struct msm_pingroup { unsigned pull_bit:5; unsigned drv_bit:5; + unsigned i2c_pull_bit:5; unsigned od_bit:5; unsigned egpio_enable:5;