From patchwork Fri Mar 25 22:08:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12792104 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F79DC433EF for ; Fri, 25 Mar 2022 22:08:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233766AbiCYWKI (ORCPT ); Fri, 25 Mar 2022 18:10:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233777AbiCYWKH (ORCPT ); Fri, 25 Mar 2022 18:10:07 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24076166660 for ; Fri, 25 Mar 2022 15:08:33 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id c23so9635489plo.0 for ; Fri, 25 Mar 2022 15:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xOpY+DRdxabYq4KSBS213CEML9vt3FeER5a0RKzlMFw=; b=MyU7CSOScAxvn4y5ih8kVLnLZpwiai3vdS4oQBGkVQ8S1ZVu9nJ/eMrF+kSvk3e8Bw ufGIGB9wcYmeR0JZSL7dr8FmEUE8LaDvl/2Y/GN9W6HfZ4cu62pZUQsKahTqDrbNmaoO E2tbgJCqkciNqUbrwguQLEVNHVUGxH6+WDMkw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xOpY+DRdxabYq4KSBS213CEML9vt3FeER5a0RKzlMFw=; b=veEBXuR0WQE4o4jl99A5xO4cnzCl1jLyWoAu90kRf5IF4Jrpb9SEA2X4xwICwQ41o0 TWOt9O5AlBf3ktyEgIiaOt9RFqykNOO2lWcAxu4/OEYEEXmviZz7HGwLOn+9AxidQwVb P2PXQmgq8UFViYbTgs1uYuNwqnlu69MoTfnSAxY6hVh932upNc6dqMs8G/IDbl4zQ8u1 RqNfhvCEQyrX7nivncvrKvPk2rmhSBxixJTyN3vFq8a5C5DeHAGSaTvUyIkuDfW2VoBI skpl/gLW+Iz+PLxtMXMuc9Go4JaNpZdDDoy56D/IPBteakoEEOhtiieLE7wHAtkotg+J ZjtQ== X-Gm-Message-State: AOAM533pRro9MZJZSd6uIGWaM3tJRrBnYpPaPj/kS/TfOrKitAOvUX9T FNEYSL6crWnUt3xcHp7++00j3np8dVvYSA== X-Google-Smtp-Source: ABdhPJwRy+sx4YMZ0u4xcqx1mVelcnOuRT8sBr0pcXctkoSL8l0tYKp6GIHQ83BMhH92o37IttNGlQ== X-Received: by 2002:a17:90a:b38b:b0:1c7:9f03:9b4d with SMTP id e11-20020a17090ab38b00b001c79f039b4dmr15206702pjr.170.1648246112370; Fri, 25 Mar 2022 15:08:32 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f21c:980b:7d64:94f9]) by smtp.gmail.com with UTF8SMTPSA id y15-20020a17090a1f4f00b001c7ecaf9e13sm2909175pjy.35.2022.03.25.15.08.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Mar 2022 15:08:32 -0700 (PDT) From: Gwendal Grignou To: jic23@kernel.org, robh+dt@kernel.org, swboyd@chromium.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Gwendal Grignou , stable@vger.kernel.org Subject: [PATCH v3 1/8] iio: sx9324: Fix default precharge internal resistance register Date: Fri, 25 Mar 2022 15:08:20 -0700 Message-Id: <20220325220827.3719273-2-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog In-Reply-To: <20220325220827.3719273-1-gwendal@chromium.org> References: <20220325220827.3719273-1-gwendal@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Fix the default value for the register that set the resistance: it has to be 0x10. Fixes: 4c18a890dff8d ("iio:proximity:sx9324: Add SX9324 support") Cc: stable@vger.kernel.org Signed-off-by: Gwendal Grignou Reviewed-by: Stephen Boyd --- Changes since v2: - no changes Changes since v1: - new patch. drivers/iio/proximity/sx9324.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c index 0d9bbbb50cb45..d50ce67aafdf2 100644 --- a/drivers/iio/proximity/sx9324.c +++ b/drivers/iio/proximity/sx9324.c @@ -70,7 +70,8 @@ #define SX9324_REG_AFE_PH2 0x2a #define SX9324_REG_AFE_PH3 0x2b #define SX9324_REG_AFE_CTRL8 0x2c -#define SX9324_REG_AFE_CTRL8_RESFILTN_4KOHM 0x02 +#define SX9324_REG_AFE_CTRL8_RSVD 0x10 +#define SX9324_REG_AFE_CTRL8_RESFILTIN_4KOHM 0x02 #define SX9324_REG_AFE_CTRL9 0x2d #define SX9324_REG_AFE_CTRL9_AGAIN_1 0x08 @@ -781,7 +782,8 @@ static const struct sx_common_reg_default sx9324_default_regs[] = { { SX9324_REG_AFE_PH2, 0x1a }, { SX9324_REG_AFE_PH3, 0x16 }, - { SX9324_REG_AFE_CTRL8, SX9324_REG_AFE_CTRL8_RESFILTN_4KOHM }, + { SX9324_REG_AFE_CTRL8, SX9324_REG_AFE_CTRL8_RSVD | + SX9324_REG_AFE_CTRL8_RESFILTIN_4KOHM }, { SX9324_REG_AFE_CTRL9, SX9324_REG_AFE_CTRL9_AGAIN_1 }, { SX9324_REG_PROX_CTRL0, SX9324_REG_PROX_CTRL0_GAIN_1 | From patchwork Fri Mar 25 22:08:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12792105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 921B3C433F5 for ; Fri, 25 Mar 2022 22:08:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233777AbiCYWKK (ORCPT ); Fri, 25 Mar 2022 18:10:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233772AbiCYWKJ (ORCPT ); Fri, 25 Mar 2022 18:10:09 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21FA3166677 for ; Fri, 25 Mar 2022 15:08:34 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id a16-20020a17090a6d9000b001c7d6c1bb13so4628747pjk.4 for ; Fri, 25 Mar 2022 15:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6KZS4Fn3XZXMPORcEe2Fn8Tp1Rquo/5MePufC7Tb21w=; b=P0ON+rFkhVycyCo2fWtouqSLlKkPk4AtWHcCqPAyKcB4HSGk/igEbzhZVmBiAJw7IS 2tGCmLftClZcVxZUJF5EURfeLhWkNbwmZ2rZDV9sjT8PjrZo2nQfBIom8bAl78rv0iv1 rQlkIqBz1LhemYX5Oysov7If8tZ6KcFzwggVc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6KZS4Fn3XZXMPORcEe2Fn8Tp1Rquo/5MePufC7Tb21w=; b=KQwJKUrAxjGJZyPwf6vbsPNtHlBjAYUZ4MuVpNllmhdRs7rlTt0KZEjlmCJdm2slnd hZ3D0CIK15yg0g2lqvIoW7Z6i4BUC8YGWrMEUKJOgMd+Z6lUIEQj7lGH7ul/FCqjfGit 6a1MJxIS/euDGuL2c97odM7Qa0O1sm0ScaSPEHG2gur/6Fko9XPpQMGE6NNEqCbZsTTX WD3xVjTzxBr2ShEnjAwB6Rbs2DYl3znIWmtR9tYMSeJSSPOd2Ml9HCiX27+nwT2z+lY5 TBguhJzfaqqpx0O0DW0+CZw01Mw2XBSQtRLT10qzxb3ExFozM4QnLbYR0JB4koExjoKU GKFA== X-Gm-Message-State: AOAM530/RYB4O+FCsnDylimkjYCGQlgwrNJHegUMLsMSqAh2Q0lsc5Lw yynlqUBZDazsmMBJWyApvP0H2A== X-Google-Smtp-Source: ABdhPJwoPZvqd8Dhy9q4yZvmyIiK6L/uWN2FM7OxWjgdDorYCAtXuvCgv/fQSFS/CgTenKpBtqaOIg== X-Received: by 2002:a17:902:f54d:b0:154:6794:ab38 with SMTP id h13-20020a170902f54d00b001546794ab38mr13740569plf.114.1648246113681; Fri, 25 Mar 2022 15:08:33 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f21c:980b:7d64:94f9]) by smtp.gmail.com with UTF8SMTPSA id d5-20020a17090acd0500b001b9c05b075dsm13329404pju.44.2022.03.25.15.08.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Mar 2022 15:08:33 -0700 (PDT) From: Gwendal Grignou To: jic23@kernel.org, robh+dt@kernel.org, swboyd@chromium.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Gwendal Grignou Subject: [PATCH v3 2/8] iio: sx9324: Fix register field spelling Date: Fri, 25 Mar 2022 15:08:21 -0700 Message-Id: <20220325220827.3719273-3-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog In-Reply-To: <20220325220827.3719273-1-gwendal@chromium.org> References: <20220325220827.3719273-1-gwendal@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Field for PROX_CTRL4 should contain PROX_CTRL4. Fixes: 4c18a890dff8d ("iio:proximity:sx9324: Add SX9324 support") Signed-off-by: Gwendal Grignou Reviewed-by: Stephen Boyd --- Changes since v2: - no changes Changes since v1: - Add Fixes keyword in commit message. drivers/iio/proximity/sx9324.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c index d50ce67aafdf2..1dfa19426c210 100644 --- a/drivers/iio/proximity/sx9324.c +++ b/drivers/iio/proximity/sx9324.c @@ -90,7 +90,7 @@ #define SX9324_REG_PROX_CTRL4_AVGNEGFILT_MASK GENMASK(5, 3) #define SX9324_REG_PROX_CTRL4_AVGNEG_FILT_2 0x08 #define SX9324_REG_PROX_CTRL4_AVGPOSFILT_MASK GENMASK(2, 0) -#define SX9324_REG_PROX_CTRL3_AVGPOS_FILT_256 0x04 +#define SX9324_REG_PROX_CTRL4_AVGPOS_FILT_256 0x04 #define SX9324_REG_PROX_CTRL5 0x35 #define SX9324_REG_PROX_CTRL5_HYST_MASK GENMASK(5, 4) #define SX9324_REG_PROX_CTRL5_CLOSE_DEBOUNCE_MASK GENMASK(3, 2) @@ -794,7 +794,7 @@ static const struct sx_common_reg_default sx9324_default_regs[] = { { SX9324_REG_PROX_CTRL3, SX9324_REG_PROX_CTRL3_AVGDEB_2SAMPLES | SX9324_REG_PROX_CTRL3_AVGPOS_THRESH_16K }, { SX9324_REG_PROX_CTRL4, SX9324_REG_PROX_CTRL4_AVGNEG_FILT_2 | - SX9324_REG_PROX_CTRL3_AVGPOS_FILT_256 }, + SX9324_REG_PROX_CTRL4_AVGPOS_FILT_256 }, { SX9324_REG_PROX_CTRL5, 0x00 }, { SX9324_REG_PROX_CTRL6, SX9324_REG_PROX_CTRL6_PROXTHRESH_32 }, { SX9324_REG_PROX_CTRL7, SX9324_REG_PROX_CTRL6_PROXTHRESH_32 }, From patchwork Fri Mar 25 22:08:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12792106 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24609C4332F for ; Fri, 25 Mar 2022 22:08:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233776AbiCYWKL (ORCPT ); Fri, 25 Mar 2022 18:10:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233782AbiCYWKK (ORCPT ); Fri, 25 Mar 2022 18:10:10 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80EC2166678 for ; Fri, 25 Mar 2022 15:08:35 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id bc27so7498263pgb.4 for ; Fri, 25 Mar 2022 15:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7X00LqhqpHZwyipr6lc2MdAmx6U5RnTCI92rZftagtM=; b=gXJHx4dLHRJikCj225JFWBmmSWee37txjmAmNWdkAzDDlvXeKtymxRcA00Wd+e1XVE qwox4q1txrq8DlN41edYX/LcHQ4JiJfWL398SbPHA2fTX4QeJbjFDM8kaYXDq2Irqto0 /HD+VjfSw8GotSM1iEKao+3yiLw9M0ZLWS+10= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7X00LqhqpHZwyipr6lc2MdAmx6U5RnTCI92rZftagtM=; b=DBaDTqDql8H17xX6to3flFd6ZOZ7ke8jvNT2HkwU5K3p1WKR9l6Zxc4iSnMWXsDGfZ i+gFWxe/zOAVUtoPuAL3X8ApLmj8aldPu3jnM80Q5lh2HuV1g20p0oAMc46GcQdV+NFH oOuTM3/p+ViRNEh02thQgou6B1laqba0Wtfq3oCJR50J3DAiZ4IE6d2oCyXZJckD2qyf wvWS9beOcMr/kQaoYbBT+i8Fsk7PgdhEQKvQhoENO6AgqP7XVzEY6K7HxbRxYpHQqSJw BPYGoi2+vqbfdkd2PgkivsSuLUvAkS+rhW9kh0uwigZFdCITvwq/G4dviG1Vpdil5ic5 Okew== X-Gm-Message-State: AOAM532hT7Tm+adK1US+LtADOfmMsHPo4RRjpN1ogOvoke9EMOjHjsoS re58KczswiLl6I5zasM0r0BfnQ== X-Google-Smtp-Source: ABdhPJxPDIqqXOV9F3il3MjQ7S/3nUpNfNPxzUMM6Rf6wfFQMXHkG39ihCVSBfhWCXHzwx8n6z9Xog== X-Received: by 2002:a05:6a00:2402:b0:4e1:46ca:68bd with SMTP id z2-20020a056a00240200b004e146ca68bdmr12135342pfh.70.1648246114996; Fri, 25 Mar 2022 15:08:34 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f21c:980b:7d64:94f9]) by smtp.gmail.com with UTF8SMTPSA id w9-20020a056a0014c900b004fb2ca5f6d7sm174253pfu.136.2022.03.25.15.08.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Mar 2022 15:08:34 -0700 (PDT) From: Gwendal Grignou To: jic23@kernel.org, robh+dt@kernel.org, swboyd@chromium.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Gwendal Grignou Subject: [PATCH v3 3/8] dt-bindings: iio: sx9324: Add precharge resistor setting Date: Fri, 25 Mar 2022 15:08:22 -0700 Message-Id: <20220325220827.3719273-4-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog In-Reply-To: <20220325220827.3719273-1-gwendal@chromium.org> References: <20220325220827.3719273-1-gwendal@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Allow configure the resistance used during precharge. Signed-off-by: Gwendal Grignou Reviewed-by: Stephen Boyd Acked-by: Rob Herring --- Changes since v2: - Change kOhms into ohms. Changes since v1: - Suffix field with kOhms unit. .../bindings/iio/proximity/semtech,sx9324.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml index b8a6ee16854ff..a22cad1507b6b 100644 --- a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml +++ b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml @@ -126,6 +126,14 @@ properties: UINT_MAX (4294967295) represents infinite. Other values represent 1-1/N. + semtech,input-precharge-resistor-ohms: + default: 4000 + description: + Pre-charge input resistance in Ohm. + Rounded down to a 2000 Ohm multiple. + minimum: 0 + maximum: 30000 + required: - compatible - reg @@ -157,5 +165,6 @@ examples: semtech,ph01-proxraw-strength = <2>; semtech,ph23-proxraw-strength = <2>; semtech,avg-pos-strength = <64>; + semtech,input-precharge-resistor-ohms = <2000>; }; }; From patchwork Fri Mar 25 22:08:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12792107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60178C433F5 for ; Fri, 25 Mar 2022 22:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233787AbiCYWKM (ORCPT ); Fri, 25 Mar 2022 18:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbiCYWKL (ORCPT ); Fri, 25 Mar 2022 18:10:11 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC940166675 for ; Fri, 25 Mar 2022 15:08:36 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id t13so6254483pgn.8 for ; Fri, 25 Mar 2022 15:08:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZNLkn36+WdikLcYtD8d4p99FZ3awOSvlGNb/3GiGF18=; b=h4Aff1GaUCddfZcUl+gGSlaaN4Juokcg5IzDSfCXXne6IHahZJQ16dJ9OAB3Q43oX5 JXHy7xIdTJe6T9h3TlGv8LN6Qzj0KuLW4qFiey7kv/ozVcke+tXWSrZbPAqpyALS6FwW C4BtkuF88cdftQFbi/XAbPZAqzJdoH9DYD7sE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZNLkn36+WdikLcYtD8d4p99FZ3awOSvlGNb/3GiGF18=; b=10Yg+WXol+RibUEhZKkSSKYzy0wcS0e91li2pIfXD5u5yZRrXnBgZXJYS9a2ZrO+If TC0gL+4ThTu+EQdJCjvQViFXJmPm+d75gsBA1n1UuqPEwMxvin8HZOYXvz4YrwLux4v0 3o9ogEdET2ooRb934DGmlvjYc4rRTC3nG2UxSsdnR7fzXoc6FtosE2ASGGuE/gZ8l1Xx S62o2Q6Dsl6tAgSLzvsg1p1MIA5/q1M1RMCSS8SWFxm58Qu+FhHbYVdHpsd/OpghX0uW ed6mXCRMCls1tsoFh6yCUUjXgA5et0bTUKuaGww2/KBWj1yyXe7f2sCQunt7DMP7+h/A GyUQ== X-Gm-Message-State: AOAM5330KrdCBOMUCZFIN6kDwUiCLZtDfb1N2LM4Be4mwGZ2IT8lOROd BljJklzgRiGIc0DiB2+FcpZgO8ti7FP+6g== X-Google-Smtp-Source: ABdhPJyOfT4uoSEG1gduAQ0uWIYmGtj6pr0QlIHm1QjyU/eHHJ4A43lDGSLJ6i5suiOMP/jZ0qF7VQ== X-Received: by 2002:a05:6a00:18a4:b0:4fa:ee98:87bb with SMTP id x36-20020a056a0018a400b004faee9887bbmr10104532pfh.2.1648246116369; Fri, 25 Mar 2022 15:08:36 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f21c:980b:7d64:94f9]) by smtp.gmail.com with UTF8SMTPSA id 75-20020a62144e000000b004fae56c42a0sm7335243pfu.211.2022.03.25.15.08.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Mar 2022 15:08:36 -0700 (PDT) From: Gwendal Grignou To: jic23@kernel.org, robh+dt@kernel.org, swboyd@chromium.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Gwendal Grignou Subject: [PATCH v3 4/8] iio: sx9324: Add precharge internal resistance setting Date: Fri, 25 Mar 2022 15:08:23 -0700 Message-Id: <20220325220827.3719273-5-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog In-Reply-To: <20220325220827.3719273-1-gwendal@chromium.org> References: <20220325220827.3719273-1-gwendal@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Add ability to set the precharge internal resistance from the device tree. Signed-off-by: Gwendal Grignou Reviewed-by: Stephen Boyd --- Changes since v2: - Change kOhms into ohms. Changes since v1: - Suffix field with kOhms unit. - Split patch in 2. drivers/iio/proximity/sx9324.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c index 1dfa19426c210..3f229dffd5380 100644 --- a/drivers/iio/proximity/sx9324.c +++ b/drivers/iio/proximity/sx9324.c @@ -72,6 +72,7 @@ #define SX9324_REG_AFE_CTRL8 0x2c #define SX9324_REG_AFE_CTRL8_RSVD 0x10 #define SX9324_REG_AFE_CTRL8_RESFILTIN_4KOHM 0x02 +#define SX9324_REG_AFE_CTRL8_RESFILTIN_MASK GENMASK(3, 0) #define SX9324_REG_AFE_CTRL9 0x2d #define SX9324_REG_AFE_CTRL9_AGAIN_1 0x08 @@ -893,6 +894,15 @@ sx9324_get_default_reg(struct device *dev, int idx, reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL4_RESOLUTION_MASK, raw); break; + case SX9324_REG_AFE_CTRL8: + ret = device_property_read_u32(dev, + "semtech,input-precharge-resistor-ohms", + &raw); + reg_def->def &= ~SX9324_REG_AFE_CTRL8_RESFILTIN_MASK; + reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL8_RESFILTIN_MASK, + raw / 2000); + break; + case SX9324_REG_ADV_CTRL5: ret = device_property_read_u32(dev, "semtech,startup-sensor", &start); From patchwork Fri Mar 25 22:08:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12792108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A629C433FE for ; Fri, 25 Mar 2022 22:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233784AbiCYWKN (ORCPT ); Fri, 25 Mar 2022 18:10:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbiCYWKM (ORCPT ); Fri, 25 Mar 2022 18:10:12 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 639EB166675 for ; Fri, 25 Mar 2022 15:08:38 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id s8so7568963pfk.12 for ; Fri, 25 Mar 2022 15:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J75R2mMWF+az1P2ih4+x2IsyXN2geBWtCz9aNcOKaxw=; b=ghnQ+axF4TfKN/r4BClayoJ7umXeJR8NdKsDPb8+HwFX26PE59UJcLsCvNRgaOgCS1 PW57qG6c1CklfBb4XRfvvz8rXDB1obEkyOzvkRG5mD8URLoJxK/SdukTbAyZ1rIu2W5a 590i2AQzAJJrUmj9bW4K/Lla51o5reYmKADPg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J75R2mMWF+az1P2ih4+x2IsyXN2geBWtCz9aNcOKaxw=; b=tviMi4cKYlDEtAJqiD1ZxtFfUMn3jzomXdZTAn2cKJpECC8yhYwft/cjyebOoy8U71 d1P5XRqVtKOw7vLvddtygV1oMwcQDovEoz3ImBs81uQLjZYb35ueQ9e5ChkcwZr7jxsW ZMaKPsqIWCxv8NN6v9vxKmndmKdRr+g7lewfBL891LADOOMDikbLleonMXxOQVcuMwfG mZVDdKTdcIHXufAouO5x4F9JUGZQfdLtPDQ+7dX7AYmH2x8I2sGWe/cS729CP4NuNpXg ILxTw0l8WMFIqmHjCkZPx9gUbT5NObADKaSDfN2Sa3Imn1Ea/yElBDiZ+iuLYDkoElR2 MzEw== X-Gm-Message-State: AOAM532t/GAkpAMlCP5ZYuiTIQI9PndHF0Jo7UlqlfugPbDwtXiXwTt5 G7CQQ+krKh+/MfpKBYkb4VQQrA== X-Google-Smtp-Source: ABdhPJwZSnZde78UWv/gJ1OrMqQ2vOL0kb970ASV7h4I0DGIonxpOZG6gAjD1zCWi9IouGycrb2Q8g== X-Received: by 2002:a63:d13:0:b0:381:f043:c627 with SMTP id c19-20020a630d13000000b00381f043c627mr1301911pgl.168.1648246117890; Fri, 25 Mar 2022 15:08:37 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f21c:980b:7d64:94f9]) by smtp.gmail.com with UTF8SMTPSA id cd20-20020a056a00421400b004fa7d1b35b6sm7575899pfb.80.2022.03.25.15.08.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Mar 2022 15:08:37 -0700 (PDT) From: Gwendal Grignou To: jic23@kernel.org, robh+dt@kernel.org, swboyd@chromium.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Gwendal Grignou Subject: [PATCH v3 5/8] dt-bindings: iio: sx9324: Add internal compensation resistor setting Date: Fri, 25 Mar 2022 15:08:24 -0700 Message-Id: <20220325220827.3719273-6-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog In-Reply-To: <20220325220827.3719273-1-gwendal@chromium.org> References: <20220325220827.3719273-1-gwendal@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Allow setting the internal resistor used for compensation. Signed-off-by: Gwendal Grignou Reviewed-by: Stephen Boyd Acked-by: Rob Herring --- Changes since v2: - no changes Changes since v1: - no changes .../bindings/iio/proximity/semtech,sx9324.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml index a22cad1507b6b..f99b2c1cd3ac2 100644 --- a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml +++ b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml @@ -126,6 +126,15 @@ properties: UINT_MAX (4294967295) represents infinite. Other values represent 1-1/N. + semtech,int-comp-resistor: + description: + Internal resistor setting for compensation. + enum: + - lowest + - low + - high + - highest + semtech,input-precharge-resistor-ohms: default: 4000 description: @@ -165,6 +174,7 @@ examples: semtech,ph01-proxraw-strength = <2>; semtech,ph23-proxraw-strength = <2>; semtech,avg-pos-strength = <64>; + semtech,int-comp-resistor = "lowest"; semtech,input-precharge-resistor-ohms = <2000>; }; }; From patchwork Fri Mar 25 22:08:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12792109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE9F0C433FE for ; Fri, 25 Mar 2022 22:08:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233789AbiCYWKP (ORCPT ); Fri, 25 Mar 2022 18:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233782AbiCYWKO (ORCPT ); Fri, 25 Mar 2022 18:10:14 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3B10166671 for ; Fri, 25 Mar 2022 15:08:39 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id u22so7591884pfg.6 for ; Fri, 25 Mar 2022 15:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l98A4PNT9yRJjDO0lTIQbjMRwoPNVoAjqrcGwahNQ0U=; b=m0aqV6+DxvfENOsDf/vAN7uTs2V26xAaCIqes8qJ3+fyPF+/pw469P5ueBSSiBgX7n uXWkqXbSPZUDxSj83/F8nPRCMBNorjfRwN+2502PSgNj1WSz1IdnUusNiAgzCOq8QXGr L1zuwO8j8nY+a7OOpwPIup949JNFdvsxrDtCU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l98A4PNT9yRJjDO0lTIQbjMRwoPNVoAjqrcGwahNQ0U=; b=yNG7dy4Zit1T4JXr8Pd//b89QTVJ4DFWGrC7VzrOT6tWn9CBQj0vXUlBHnbVjvXhyb POstZZD19jI1ilPiBbSULfcjRUPGmFzpm07XqdcGQb4spEhe6Cgp5F20LDdlDl4MTiqf 3zevrGqUuwYq41w+sZHoIZdjObJmUjFdP/39l6NmoM/VP8MLUOaAzXiPVbo4IQcPv9Tq EIJJS4Gk2pavCKt7401UBCszVLuHz6a+RS16Ocw1PeSBdZnhgTcpkfUE9rU82Xdg5P4h 84MgQwnuDkBqx2Yn3qiWhBquFLztRS+TPfKbMsuiqFZxdMRsuRXjK7rQCivmiI1Lv0j2 nAZA== X-Gm-Message-State: AOAM530490p+NCmRODuwrNGntoTzbAmTiNJbLcXJYRBHmnLtu6Rw9weY yB3Z8StyJOurNMccZQiO7YQbdA== X-Google-Smtp-Source: ABdhPJxKy1JgbsWnuseG13j2sQc5BR7i0UafZcVClms+W9xzwnhjmKakpMxa3fUFfmjPxguX6E/QTA== X-Received: by 2002:aa7:81c1:0:b0:4f7:6ba1:553b with SMTP id c1-20020aa781c1000000b004f76ba1553bmr12357364pfn.45.1648246119245; Fri, 25 Mar 2022 15:08:39 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f21c:980b:7d64:94f9]) by smtp.gmail.com with UTF8SMTPSA id k17-20020a056a00135100b004fa9df39517sm8342482pfu.198.2022.03.25.15.08.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Mar 2022 15:08:38 -0700 (PDT) From: Gwendal Grignou To: jic23@kernel.org, robh+dt@kernel.org, swboyd@chromium.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Gwendal Grignou Subject: [PATCH v3 6/8] iio: sx9324: Add Setting for internal compensation resistor Date: Fri, 25 Mar 2022 15:08:25 -0700 Message-Id: <20220325220827.3719273-7-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog In-Reply-To: <20220325220827.3719273-1-gwendal@chromium.org> References: <20220325220827.3719273-1-gwendal@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Based on device tree setting, set the internal compensation resistor. Signed-off-by: Gwendal Grignou --- Changes since v2: - No changes. Changes since v1: - No changes. drivers/iio/proximity/sx9324.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c index 3f229dffd5380..38dfdc6dc86ad 100644 --- a/drivers/iio/proximity/sx9324.c +++ b/drivers/iio/proximity/sx9324.c @@ -52,6 +52,11 @@ #define SX9324_REG_CLK_SPRD 0x15 #define SX9324_REG_AFE_CTRL0 0x20 +#define SX9324_REG_AFE_CTRL0_RINT_MASK GENMASK(7, 6) +#define SX9324_REG_AFE_CTRL0_RINT_LOWEST 0x00 +#define SX9324_REG_AFE_CTRL0_RINT_LOW 0x40 +#define SX9324_REG_AFE_CTRL0_RINT_HIGH 0x80 +#define SX9324_REG_AFE_CTRL0_RINT_HIGHEST 0xc0 #define SX9324_REG_AFE_CTRL1 0x21 #define SX9324_REG_AFE_CTRL2 0x22 #define SX9324_REG_AFE_CTRL3 0x23 @@ -769,7 +774,7 @@ static const struct sx_common_reg_default sx9324_default_regs[] = { */ { SX9324_REG_GNRL_CTRL1, SX9324_REG_GNRL_CTRL1_PAUSECTRL }, - { SX9324_REG_AFE_CTRL0, 0x00 }, + { SX9324_REG_AFE_CTRL0, SX9324_REG_AFE_CTRL0_RINT_LOWEST }, { SX9324_REG_AFE_CTRL3, 0x00 }, { SX9324_REG_AFE_CTRL4, SX9324_REG_AFE_CTRL4_FREQ_83_33HZ | SX9324_REG_AFE_CTRL4_RES_100 }, @@ -855,6 +860,7 @@ sx9324_get_default_reg(struct device *dev, int idx, char prop[] = SX9324_PROXRAW_DEF; u32 start = 0, raw = 0, pos = 0; int ret, count, ph, pin; + const char *res; memcpy(reg_def, &sx9324_default_regs[idx], sizeof(*reg_def)); switch (reg_def->reg) { @@ -875,6 +881,22 @@ sx9324_get_default_reg(struct device *dev, int idx, SX9324_REG_AFE_PH0_PIN_MASK(pin); reg_def->def = raw; break; + case SX9324_REG_AFE_CTRL0: + ret = device_property_read_string(dev, + "semtech,int-comp-resistor", &res); + if (ret) + break; + reg_def->def &= ~SX9324_REG_AFE_CTRL0_RINT_MASK; + if (!strcmp(res, "lowest")) + reg_def->def |= SX9324_REG_AFE_CTRL0_RINT_LOWEST; + else if (!strcmp(res, "low")) + reg_def->def |= SX9324_REG_AFE_CTRL0_RINT_LOW; + else if (!strcmp(res, "high")) + reg_def->def |= SX9324_REG_AFE_CTRL0_RINT_HIGH; + else if (!strcmp(res, "highest")) + reg_def->def |= SX9324_REG_AFE_CTRL0_RINT_HIGHEST; + + break; case SX9324_REG_AFE_CTRL4: case SX9324_REG_AFE_CTRL7: if (reg_def->reg == SX9324_REG_AFE_CTRL4) From patchwork Fri Mar 25 22:08:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12792110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E955C433EF for ; Fri, 25 Mar 2022 22:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233793AbiCYWKQ (ORCPT ); Fri, 25 Mar 2022 18:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbiCYWKP (ORCPT ); Fri, 25 Mar 2022 18:10:15 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 237DB166677 for ; Fri, 25 Mar 2022 15:08:41 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id k6so9576222plg.12 for ; Fri, 25 Mar 2022 15:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4W66j1PiqzTVmN0Xwgko1VGmUJcMjfB92Rvx7H+XM00=; b=NJpCWVTPmpXSnZsqyE5HBpC5Saug4XwYsOBr5Wt2/qr31IQ3YRpj4gG/XploROplpX jDRhbTSqt4FedFQ6N/tVJjPGMCBNAlSMZ/WkaW+1s4DPSqpcpKlgeQgycuVLnA+EaahV 6i+7tDE9NCbOubQLZ2Owqub2B9q2ah7Xqej/M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4W66j1PiqzTVmN0Xwgko1VGmUJcMjfB92Rvx7H+XM00=; b=zfLRQNpDjR9gp1adbiLXO7R8V1DyWRKrq7V/Sdb4dplaqofQJIgApesvFQSgFmMvgD wPy+TeemBKZYYIGxgWuxf1LCEpovXcpbzAAysMxTkAAz8ucpEB311H79Aub5Bxeo78i9 8lZ11aknfLuggAJPHjRP9iSC9Q/Uvhn9t/Wzz9mtWgqBrAjaOO+m9QD8ycrgpr0SpYXu F0g8UN/yjM6+NKg/2SDQA9/d7YMrDAfg9MQSErhL5U8qpakwJ4BpjuTFiqMzcImacyKK NMB/WqotBlOeOm6nlcO5WgpJhlgmgHDiw5jZL+Rd4zFIYRssS8tVIPjbwltRl/G6z2y3 GQ3Q== X-Gm-Message-State: AOAM531xLWlpMRtHDOtfNVeoz+k0gpOcn8ExGGGNDziKu1+Iv/lTG+eB 1ebKZwjkJw21/dqXeDo9TN/0ef8/8crKCw== X-Google-Smtp-Source: ABdhPJwJrTPzTKPCMjt8N60Aw/UfckmMriFxRF1FlGAhBsJSAiJzj3T/hcAZVn2V+eOJRpWBG0nfuQ== X-Received: by 2002:a17:902:ab43:b0:153:29c8:38da with SMTP id ij3-20020a170902ab4300b0015329c838damr13620718plb.11.1648246120674; Fri, 25 Mar 2022 15:08:40 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f21c:980b:7d64:94f9]) by smtp.gmail.com with UTF8SMTPSA id b25-20020a637159000000b00381fda49d15sm6893142pgn.39.2022.03.25.15.08.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Mar 2022 15:08:40 -0700 (PDT) From: Gwendal Grignou To: jic23@kernel.org, robh+dt@kernel.org, swboyd@chromium.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Gwendal Grignou Subject: [PATCH v3 7/8] dt-bindings: iio: sx9360: Add precharge resistor setting Date: Fri, 25 Mar 2022 15:08:26 -0700 Message-Id: <20220325220827.3719273-8-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog In-Reply-To: <20220325220827.3719273-1-gwendal@chromium.org> References: <20220325220827.3719273-1-gwendal@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Allow configure the resistance used during precharge. Signed-off-by: Gwendal Grignou Reviewed-by: Stephen Boyd --- Changes since v2: - Change kOhms into ohms. Changes since v1: - Suffix property with kOhms. .../bindings/iio/proximity/semtech,sx9360.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9360.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9360.yaml index 63e1a1fd00d4c..453d2f02abbb1 100644 --- a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9360.yaml +++ b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9360.yaml @@ -61,6 +61,14 @@ properties: UINT_MAX (4294967295) represents infinite. Other values represent 1-1/N. + semtech,input-precharge-resistor-ohms: + default: 0 + description: + Pre-charge input resistance in Ohm. + Rounded down to a 2000 Ohm multiple. + minimum: 0 + maximum: 30 + required: - compatible - reg @@ -85,5 +93,6 @@ examples: semtech,resolution = <256>; semtech,proxraw-strength = <2>; semtech,avg-pos-strength = <64>; + semtech,input-precharge-resistor-ohms = <4000>; }; }; From patchwork Fri Mar 25 22:08:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12792111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 608BEC433EF for ; Fri, 25 Mar 2022 22:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233797AbiCYWKS (ORCPT ); Fri, 25 Mar 2022 18:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233791AbiCYWKR (ORCPT ); Fri, 25 Mar 2022 18:10:17 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A0AF1667D3 for ; Fri, 25 Mar 2022 15:08:43 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id j13so9598384plj.8 for ; Fri, 25 Mar 2022 15:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PMMjrrJY3lBiXSG25cQt8v0fu/OT/ANdwXDyrDx8fr4=; b=J2QpRsMq8BWZ2dqZ7wcB/KblotkDhATrfTEQRjLNfDwAliioj9PyqIFKQYMr1Rrns6 isQmnYrDPErBygpB4ecF15Muavr0n+XpiB59LHpflMiQcniA+hH+v7GNvAi60mONB9VK +OLhMlHrBzhuK0/JPM4GUV5FK1XAqaABveQsI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PMMjrrJY3lBiXSG25cQt8v0fu/OT/ANdwXDyrDx8fr4=; b=qdu0/DTKecs3fV/bKLB+6q7Jh8aqD7HT8acpqqeofWeH3UqWwzLeMF0mZMqC1kRkt7 n9hSLlDQ07vd3bDwxQLHwkiDv0jO7xKpfx5Xmt4cAVTSzyeigft6PIMc1qqPITxWuW64 +xfSVFSWbPTC7svyVFIcg/BAIAjL/NTCupnWEf00J2+3VH2XFiRDgQq9lAD+M/kedXKg v2sCbKwl9X6GIsZnJImi76V68E/1sG5blVFMhbeNDPLtJ1AX85RhvqKhxFFiM8dZiZef dD1gJQfK5rTjq4BFn5jUjXU/8LP1U9SSaCW9mmxQjEJfVaFnZ4ar84VM7wrY1ljfjnPi K3kw== X-Gm-Message-State: AOAM531Ay5wHwtXENpLLgg6GNPsSo5bBHJoZYuowNQ5hID6LV4Q9VxXC P/UQjENV7BnrcdK7EOx/Ajw5Lw== X-Google-Smtp-Source: ABdhPJxLJ8TbGaKuzSq7jJVieEUNAN6Mx0cv1g6SIFedyQ6xre8QZTqPHOoK5/CP69tHqvh+zut+Bw== X-Received: by 2002:a17:90a:306:b0:1c6:ff30:70da with SMTP id 6-20020a17090a030600b001c6ff3070damr26812768pje.117.1648246122043; Fri, 25 Mar 2022 15:08:42 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f21c:980b:7d64:94f9]) by smtp.gmail.com with UTF8SMTPSA id 135-20020a62198d000000b004fa9a8f73casm7751457pfz.99.2022.03.25.15.08.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Mar 2022 15:08:41 -0700 (PDT) From: Gwendal Grignou To: jic23@kernel.org, robh+dt@kernel.org, swboyd@chromium.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Gwendal Grignou Subject: [PATCH v3 8/8] iio: sx9360: Add pre-charge resistor setting Date: Fri, 25 Mar 2022 15:08:27 -0700 Message-Id: <20220325220827.3719273-9-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog In-Reply-To: <20220325220827.3719273-1-gwendal@chromium.org> References: <20220325220827.3719273-1-gwendal@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Add ability to set the precharge internal resistance from the device tree. Signed-off-by: Gwendal Grignou Reviewed-by: Stephen Boyd --- Changes since v2: - Change kOhms into ohms. Changes since v1: - Suffix field with kOhms unit. drivers/iio/proximity/sx9360.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/iio/proximity/sx9360.c b/drivers/iio/proximity/sx9360.c index 3ebb30c8a4f61..21cade4358aeb 100644 --- a/drivers/iio/proximity/sx9360.c +++ b/drivers/iio/proximity/sx9360.c @@ -51,6 +51,8 @@ #define SX9360_REG_GNRL_REG_2_FREQ(_r) (SX9360_FOSC_HZ / ((_r) * 8192)) #define SX9360_REG_AFE_CTRL1 0x21 +#define SX9360_REG_AFE_CTRL1_RESFILTIN_MASK GENMASK(3, 0) +#define SX9360_REG_AFE_CTRL1_RESFILTIN_0OHMS 0 #define SX9360_REG_AFE_PARAM0_PHR 0x22 #define SX9360_REG_AFE_PARAM1_PHR 0x23 #define SX9360_REG_AFE_PARAM0_PHM 0x24 @@ -671,7 +673,7 @@ static const struct sx_common_reg_default sx9360_default_regs[] = { { SX9360_REG_GNRL_CTRL1, 0x00 }, { SX9360_REG_GNRL_CTRL2, SX9360_REG_GNRL_CTRL2_PERIOD_102MS }, - { SX9360_REG_AFE_CTRL1, 0x00 }, + { SX9360_REG_AFE_CTRL1, SX9360_REG_AFE_CTRL1_RESFILTIN_0OHMS }, { SX9360_REG_AFE_PARAM0_PHR, SX9360_REG_AFE_PARAM0_RSVD | SX9360_REG_AFE_PARAM0_RESOLUTION_128 }, { SX9360_REG_AFE_PARAM1_PHR, SX9360_REG_AFE_PARAM1_AGAIN_PHM_6PF | @@ -722,6 +724,14 @@ sx9360_get_default_reg(struct device *dev, int idx, memcpy(reg_def, &sx9360_default_regs[idx], sizeof(*reg_def)); switch (reg_def->reg) { + case SX9360_REG_AFE_CTRL1: + ret = device_property_read_u32(dev, + "semtech,input-precharge-resistor-ohms", + &raw); + reg_def->def &= ~SX9360_REG_AFE_CTRL1_RESFILTIN_MASK; + reg_def->def |= FIELD_PREP(SX9360_REG_AFE_CTRL1_RESFILTIN_MASK, + raw / 2000); + break; case SX9360_REG_AFE_PARAM0_PHR: case SX9360_REG_AFE_PARAM0_PHM: ret = device_property_read_u32(dev, "semtech,resolution", &raw);