From patchwork Tue Mar 22 06:24:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12788105 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 0A9E2C433EF for ; Tue, 22 Mar 2022 06:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237150AbiCVG0w (ORCPT ); Tue, 22 Mar 2022 02:26:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237119AbiCVG0o (ORCPT ); Tue, 22 Mar 2022 02:26:44 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F45233349 for ; Mon, 21 Mar 2022 23:25:10 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id x2so1105335plm.7 for ; Mon, 21 Mar 2022 23:25:10 -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=Dvp5PLFFHZuIsQgWetyrsf4XNvoqvv0/5sQ2pDSkzC4=; b=b6lMgKv5Sw24Rt4XR5Ivbbja4czyGfu0gP7CcpgVxE4+T3WzKMKZn8pKGO5rASuILO LjZbEW2yLovrzHvDbc056juhC0Fr7PZURaX0QGZmhK/c24EIGm3/8Q/yRSEmNHn33uoM T+4j1Mo3g35YmQfbxFyNeJCZRfAT4NgPQYDzo= 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=Dvp5PLFFHZuIsQgWetyrsf4XNvoqvv0/5sQ2pDSkzC4=; b=DLgO5YOGQ41XIfMx9eGfh5us+f3C5no5nVHSEI5HDFNBQJzoASVKY6CXySuM3bEOaM KF1roFgIALN1ES6bI82T4DobhCxAB+QG9L66XGDJLwE34Lo6oWbqG1gyQBxl+tOzi/du ZiplrRelANRgsm873BEQ0brJvN2GhrM61XXOJitcY+1DfODrXJiexR9OiBbSC6+Pusqh cIuMXUP3JL4wJl9YcfTnZJg6I6tUjXec797+/Z4naevsU8h2f0GDiGbXEwMK1e74Kko7 cN5XN+2dWBTjMi4CzQaz4pdDhSAYKFKsP13KKw6Zre7nJitkaW8FAm3bS8yu61O7zMY3 sR+w== X-Gm-Message-State: AOAM533ukhKbFRHL3nTsxC46ErokJFVNMwDXEVchFYP7DG2IFFVezZTr K5nd+/WalCsOcZMdwunru5EgcQ== X-Google-Smtp-Source: ABdhPJy9Q3kS0c782m03W2yRWveI5jwvz72UxXedRRzodo+D+nfPTeo9Ax0/jonDXCofcMmXQUl8TQ== X-Received: by 2002:a17:90b:4a4b:b0:1c6:4398:523c with SMTP id lb11-20020a17090b4a4b00b001c64398523cmr3164773pjb.50.1647930309968; Mon, 21 Mar 2022 23:25:09 -0700 (PDT) Received: from localhost ([2620:15c:202:201:c016:a147:e7e:6836]) by smtp.gmail.com with UTF8SMTPSA id c34-20020a630d22000000b0034cb89e4695sm16329296pgl.28.2022.03.21.23.25.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Mar 2022 23:25:09 -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 v2 1/8] iio: sx9324: Fix default precharge internal resistance register Date: Mon, 21 Mar 2022 23:24:57 -0700 Message-Id: <20220322062504.1019504-2-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220322062504.1019504-1-gwendal@chromium.org> References: <20220322062504.1019504-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 --- 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 Tue Mar 22 06:24:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12788107 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 34036C4321E for ; Tue, 22 Mar 2022 06:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237097AbiCVG0y (ORCPT ); Tue, 22 Mar 2022 02:26:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237172AbiCVG0p (ORCPT ); Tue, 22 Mar 2022 02:26:45 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8125437A37 for ; Mon, 21 Mar 2022 23:25:11 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id o6-20020a17090a9f8600b001c6562049d9so1283485pjp.3 for ; Mon, 21 Mar 2022 23:25:11 -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=IjgJJVcsve1n7Z5mXv4kDR9lNutzLAA9Ze2+yi6SXPQ=; b=m5fHtMApZNLn0Pq+xH7xFGnEq+6CJyOvh10vbCdYNEpjBtFDEh+AIfekMynjdVJifb nuYQevh8sZklmcuK/kL7QSBgFvmnVBJehy8mvHqLnYUHTeUSZHPNmxfExUkjsdnP0mdj 9w2disc9YMwOyZthrXwMZyWnorfLFvsJipb8Q= 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=IjgJJVcsve1n7Z5mXv4kDR9lNutzLAA9Ze2+yi6SXPQ=; b=1pB1rEbLGlHMnwVAzXmAOeq5VARE7mPZuiewbcoyduefImyfhRsquxsCEVuFGnxB3E lDlkg2NRPBQ3UPpPBdtAOw1pnBODp1DyljgoS7vNaH7diCOMooqEcrQgnzay5Ib3rryd luVXSGShHPFcFK0Lf9uQVVu8rJAys7PaJf/pryDaA1JigIikRGvOhRoa2hJcwjGbbFze sVxT2zzXYA7mJ8TwcouvecRo9yhB/e+VKzFFXCDMBD9Lgvd39xWpWlWIV8/JkPjArNul Lz+h1t7eCCTCgL8uQlHojqVVwo4NTcW3VqxmSxrRZVITrmF6kCk4yZlY2k+3L7hkK+KS 0PXQ== X-Gm-Message-State: AOAM530yCI7MdH/UDT//xJaeo+H2M39TwOra4KvN9saW9cbcU6Bljkhs 0lPKOue4MS8tz+YdhdV7p1AQxw== X-Google-Smtp-Source: ABdhPJwI9AeZASfiGcfQx10S97lEhWB4gh5C7xVA2RSBYEH6fVb50qcvHIDWPaiPahuV4eDKCMFgFg== X-Received: by 2002:a17:902:8306:b0:14f:a386:6a44 with SMTP id bd6-20020a170902830600b0014fa3866a44mr16149333plb.140.1647930311019; Mon, 21 Mar 2022 23:25:11 -0700 (PDT) Received: from localhost ([2620:15c:202:201:c016:a147:e7e:6836]) by smtp.gmail.com with UTF8SMTPSA id s20-20020a056a00179400b004f709998d13sm22672619pfg.10.2022.03.21.23.25.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Mar 2022 23:25:10 -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 v2 2/8] iio: sx9324: Fix register field spelling Date: Mon, 21 Mar 2022 23:24:58 -0700 Message-Id: <20220322062504.1019504-3-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220322062504.1019504-1-gwendal@chromium.org> References: <20220322062504.1019504-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 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 Tue Mar 22 06:24:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12788108 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 036FFC433EF for ; Tue, 22 Mar 2022 06:25:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237081AbiCVG0y (ORCPT ); Tue, 22 Mar 2022 02:26:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237031AbiCVG0p (ORCPT ); Tue, 22 Mar 2022 02:26:45 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A109D37AB6 for ; Mon, 21 Mar 2022 23:25:12 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id n7-20020a17090aab8700b001c6aa871860so1285472pjq.2 for ; Mon, 21 Mar 2022 23:25:12 -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=YCQuJ6XtkWARCT/SeBBl76pl1bofCmdHbO/6yKxBBCo=; b=Ef9IMR5PloZldV944IOtnJP7DY0QGiNygulYQxKRA7KJ2s/f7AM9i1YHestywoOrKC naUthvieNsv5XmbQ7M6XuzjnIyAvnuNpNoJ6pGqRa8+CEi1MnbI/NT4EI8GP7e3ycqyQ /4lPfRoMc98ybFknXjOtfGnD2jH086iDbcp8Y= 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=YCQuJ6XtkWARCT/SeBBl76pl1bofCmdHbO/6yKxBBCo=; b=cJXFKTaCmVE1l1azIdrCVpuE6hHiFzvx0pdKmot/EMqPBrPkb+34qRP95y67UqQUeO mjRBcJRkk8MGyXYb+NJpa6520k1NQsCttJH0vNASFOXANDp832dnM/GD3gyF2ZkW0f5b FAJtu07tGgqAFUN14AnocQ6GQCxswA7Q4Qd3Qti3SBmabPd5psZ6bjeaI/Orrc4gOGOd 9ZDstwwu6I0ed9rldIBBFdJGFvjqxPEfcXO94mVtl5+Hm8ibudsds7uMUxqrge4B+mf7 uWtfMQGV+38zVcxvc2nWtmdgGe4FEPvR4G/Tgu7ffjs4cAAv/I5D0pYwZMX376PfCkz+ Sq0g== X-Gm-Message-State: AOAM531N1Ifc5cF+BTMiqljgEM1nAJ/u6X7o+Qv3PsR+btkj0QAtEnaX 7ET+MtsnrdSzBbwJ49GgaA6fpQ== X-Google-Smtp-Source: ABdhPJxdE48xQ9kOe4WzGs68fXv4gq+U0bmSw+O/9Qzj2sXXtHdhMkXWrttyzW1Ew7LYj08BBxR0Lw== X-Received: by 2002:a17:902:9345:b0:153:4d7a:53d9 with SMTP id g5-20020a170902934500b001534d7a53d9mr17003306plp.116.1647930312172; Mon, 21 Mar 2022 23:25:12 -0700 (PDT) Received: from localhost ([2620:15c:202:201:c016:a147:e7e:6836]) by smtp.gmail.com with UTF8SMTPSA id x23-20020a63fe57000000b0036490068f12sm15853883pgj.90.2022.03.21.23.25.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Mar 2022 23:25:11 -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 v2 3/8] dt-bindings: iio: sx9324: Add precharge resistor setting Date: Mon, 21 Mar 2022 23:24:59 -0700 Message-Id: <20220322062504.1019504-4-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220322062504.1019504-1-gwendal@chromium.org> References: <20220322062504.1019504-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 --- 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..8fbea71823e76 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-kohms: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 4 + description: + Pre-charge input resistance in kOhm. + minimum: 0 + maximum: 30 + 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-kohms = <2>; }; }; From patchwork Tue Mar 22 06:25:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12788109 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 69247C35274 for ; Tue, 22 Mar 2022 06:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237089AbiCVG0z (ORCPT ); Tue, 22 Mar 2022 02:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237093AbiCVG0p (ORCPT ); Tue, 22 Mar 2022 02:26:45 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079E338BC8 for ; Mon, 21 Mar 2022 23:25:13 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id m22so14900112pja.0 for ; Mon, 21 Mar 2022 23:25:13 -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=h9k3rCozgrGymSdhye62YH957jC7tnolJq0Oa32pVRw=; b=kF4jU2CtaNf2Vz2zGLuVCxOlP4oIX5/J/zv2QANMM9Y/h+4pZ13lLTnlxyYumVmgJq AlIeaV5nffpxPVruYJRISsPMQW2zfX0M8vjfobgldCx1YUiGWfmPmF2rsjBb0BdT0/TU ZrCdspmkU4tL3iK0+ltYuYpep5X3hVbWGjntE= 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=h9k3rCozgrGymSdhye62YH957jC7tnolJq0Oa32pVRw=; b=XDzI+91kA0FuizwTDbGD+lXn/gaZS/qwYcVcDtpCulhRCbKSiCpvJRxv/24hUPmWwD e+UsBZ8jzPPgTxi+7GFAHlhCcr0Cn2XM9L61eJYo1Kre6+UNHCupx4rNdrt1/aoW/EqA meSUG2nqtHqBAXxsdowTfHjcNnX4r2cHBiF46wsm8uMyFuALnjvAtskEdVt2y+ZRgUqE /qRhde0KIpE6L0kTONykjyujSwrJhcYBnDod/R4e00uOUAthkW4zo7MB8jXmSm6FleNk PLh2//V9Qy/qBXExgaWWepkPc6MWhvljAAgWsXu8g5g85W9tDijm4P0a5MrWZ+UBYkjb C25w== X-Gm-Message-State: AOAM532zUcl2Suf+nYmV0R052xQonb+aiiwdJ2O0YI32sM+myLIhdWRv /XEpssy9XE4/0gHfbuAWqIVWJzziyw01LA== X-Google-Smtp-Source: ABdhPJx/Ug572bWM2cO5FlxvdLKfpEzF9UbVfJDiFdb8txm+0RSrtZ7WYAc/fCZFLj/Qhf/fHpktag== X-Received: by 2002:a17:90b:1e04:b0:1c6:fb36:9d93 with SMTP id pg4-20020a17090b1e0400b001c6fb369d93mr3127978pjb.57.1647930313431; Mon, 21 Mar 2022 23:25:13 -0700 (PDT) Received: from localhost ([2620:15c:202:201:c016:a147:e7e:6836]) by smtp.gmail.com with UTF8SMTPSA id z130-20020a633388000000b003817671cb29sm1468201pgz.41.2022.03.21.23.25.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Mar 2022 23:25:12 -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 v2 4/8] iio: sx9324: Add precharge internal resistance setting Date: Mon, 21 Mar 2022 23:25:00 -0700 Message-Id: <20220322062504.1019504-5-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220322062504.1019504-1-gwendal@chromium.org> References: <20220322062504.1019504-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. Fix the default value for the register that set the resistance: it has to be 0x10. Signed-off-by: Gwendal Grignou --- Changes since v1: - Suffix field with kOhms unit. 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..95de5d9f8eacb 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-kohms", + &raw); + reg_def->def &= ~SX9324_REG_AFE_CTRL8_RESFILTIN_MASK; + reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL8_RESFILTIN_MASK, + raw / 2); + break; + case SX9324_REG_ADV_CTRL5: ret = device_property_read_u32(dev, "semtech,startup-sensor", &start); From patchwork Tue Mar 22 06:25:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12788110 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 371FCC433FE for ; Tue, 22 Mar 2022 06:25:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237047AbiCVG04 (ORCPT ); Tue, 22 Mar 2022 02:26:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237184AbiCVG0r (ORCPT ); Tue, 22 Mar 2022 02:26:47 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 403313AA7C for ; Mon, 21 Mar 2022 23:25:15 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id mp6-20020a17090b190600b001c6841b8a52so1563528pjb.5 for ; Mon, 21 Mar 2022 23:25:15 -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=8H64PmBRnHx7HLvB9XS+QfSLLMLBzRrCI6hoIn6XP3o=; b=MbQ6bBh4t5fdIq3qRYHFOcqgL1Hm1v5FEe3MWsPZCABh0DMC8vPphvQNOZUbURnR6J ew0qmjdnQbKMsVHCatDdxdd8epVwGupewdoRCJxURYg+ykFrUMqeVS6Y3b1S1+BSamAG BAIocFlM1CNaE3SE3iPFOhlpxV7gyOUqHw2qc= 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=8H64PmBRnHx7HLvB9XS+QfSLLMLBzRrCI6hoIn6XP3o=; b=KhpIn1ZZOp4cemYPwIkHbodTfU4SrDXwlsyxL9a8kR/VJGNVicGV7UiaMpM98ZI571 qGVXcg2shbalXWVyy+S3XR4DRqkTE++QmY/f5bRiDWjjvaYmeJCNBdA7V+8lRb+pdsMN Bhvaqyq9rsyyL841J1ZlBYjdywC16sPYJQsDaeTCspVYOsqU1L3tEPGdPyzMAR6DwFwZ HAKJUhfuAW7y55g9WMlyO9FWkEh/TluOPf8bFak6y4fprv67nQh4NtWW9I/msjb0+EAU gEQdtE/7aREe8T87P2kWi4MTq71qHJcj/nWmTKFWyZ2mw6rL98yAhBD1k5TI98BNcM8W hfow== X-Gm-Message-State: AOAM532ukYyWxVdx8/eqkfZPgGSNhlODB8EfJMQIWFOLw9LYtiJOSLVi hKGcm81iSMo6TmsZI4YJlvRAcg== X-Google-Smtp-Source: ABdhPJxqzCVP2ehVp3HGjvMfTUvuBhZn3b2o5B+ARRnP9/Gw/WkywbmYrisBwjjaQtegd0JdsM9+RQ== X-Received: by 2002:a17:902:6a89:b0:153:7213:3841 with SMTP id n9-20020a1709026a8900b0015372133841mr16615072plk.74.1647930314583; Mon, 21 Mar 2022 23:25:14 -0700 (PDT) Received: from localhost ([2620:15c:202:201:c016:a147:e7e:6836]) by smtp.gmail.com with UTF8SMTPSA id y16-20020a637d10000000b00381268f2c6fsm16582428pgc.4.2022.03.21.23.25.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Mar 2022 23:25:14 -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 v2 5/8] dt-bindings: iio: sx9324: Add internal compensation resistor setting Date: Mon, 21 Mar 2022 23:25:01 -0700 Message-Id: <20220322062504.1019504-6-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220322062504.1019504-1-gwendal@chromium.org> References: <20220322062504.1019504-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 --- Changes since v1: - Suffix field with kOhms unit. .../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 8fbea71823e76..b5f59038f9dd7 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-kohms: $ref: /schemas/types.yaml#/definitions/uint32 default: 4 @@ -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-kohms = <2>; }; }; From patchwork Tue Mar 22 06:25:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12788111 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 2BC23C4332F for ; Tue, 22 Mar 2022 06:25:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237180AbiCVG1P (ORCPT ); Tue, 22 Mar 2022 02:27:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237221AbiCVG0t (ORCPT ); Tue, 22 Mar 2022 02:26:49 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58BCA3B29C for ; Mon, 21 Mar 2022 23:25:16 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id w8so14615639pll.10 for ; Mon, 21 Mar 2022 23:25:16 -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=DoxMhq+bC/cTSPLUvKT6PG4EeSJOwiuaNwjOtxm2JDw=; b=h4m/5pCBipNoMzaqO+2K6vD+wlf35d28atsfAgGm1b1DSBrGBDsIL7ZcJlFcB76fVr 8+JY0JJGBIVGsPhb6UYHFwPZE0Yium1BmYuPRfC0CgOu1ACMHSVgXbbd5L6bM7q0KVnP detw4g3d6FNwj96rv2rhycQjxhCC9cl6pHx3U= 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=DoxMhq+bC/cTSPLUvKT6PG4EeSJOwiuaNwjOtxm2JDw=; b=8Q2vaoF93cpOMVTRIKjnWQ1FKkFT6PsSIhIhtoMIPcC1eC9TWEUgnOIGgH92fXOsIW rnoCg90wjxYPpApe2S9M5Tr1aWhN/yWGHO8WpNN7G5N0vWW7etX5oXa8OkiEMBSFAsOM sVM9XSgr7Jr3U4Z6vDmSKEaXW0V44wN3luR62aCSSPKsqjsTA7ekHZTbANyBUb+BxIpU UlTCNy4a3iPl4l+RSI70spP3kG1StBkJIM/n5+HtlU6uYmEzTFzq3GajObm7w0zy/tr5 oYvCJ90/9PH1TEX5iy0hRg1PT0FFNTjZkIYiu49ohbB1jczD9HCNYBVi+4VmIlTiJRHF TYYg== X-Gm-Message-State: AOAM533SajsOjqqTG0kuF95fQ7oGWEML0PWGhCx+FE6T5TLOn4Gj0cZN 3Lkj5IdweSvi3Kki94wR+YadOQ== X-Google-Smtp-Source: ABdhPJyv4KqbGWWuHAIJWsw3DOAKs2f64SL8EMpeP1dI4mYX9Bv/6VEof5aAX0Dfwhf6NQkyQoUQcQ== X-Received: by 2002:a17:90b:4c8e:b0:1c6:d1ed:f6b2 with SMTP id my14-20020a17090b4c8e00b001c6d1edf6b2mr3154838pjb.166.1647930315838; Mon, 21 Mar 2022 23:25:15 -0700 (PDT) Received: from localhost ([2620:15c:202:201:c016:a147:e7e:6836]) by smtp.gmail.com with UTF8SMTPSA id h6-20020a636c06000000b00363a2533b17sm16292929pgc.8.2022.03.21.23.25.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Mar 2022 23:25:15 -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 v2 6/8] iio: sx9324: Add Setting for internal compensation resistor Date: Mon, 21 Mar 2022 23:25:02 -0700 Message-Id: <20220322062504.1019504-7-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220322062504.1019504-1-gwendal@chromium.org> References: <20220322062504.1019504-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 Reviewed-by: Stephen Boyd --- 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 95de5d9f8eacb..31179e1925624 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 Tue Mar 22 06:25:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12788113 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 2B5B8C4321E for ; Tue, 22 Mar 2022 06:25:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237073AbiCVG1R (ORCPT ); Tue, 22 Mar 2022 02:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237253AbiCVG0t (ORCPT ); Tue, 22 Mar 2022 02:26:49 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7569E33E11 for ; Mon, 21 Mar 2022 23:25:17 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id jx9so996736pjb.5 for ; Mon, 21 Mar 2022 23:25:17 -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=30RcZys3m+mnl1wP4Li2+2cSCnquqYOBajAz0JIjDJs=; b=V3aUEaQA32XUGTV33Mandcv3Lgfa4gFsNJTEvaf+bqRWidZOP6Jnjaa/oTUkMfgTAE BwaQtd8esfQvUJhfr1lds+siUo+tD/Pr5yFGLfrjteMEhxVhj+5cfiK4Ee/V1V/UGvZ7 iUL4kyaidVBtyeB+3tvRbdyQ4wKge6UR5jalE= 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=30RcZys3m+mnl1wP4Li2+2cSCnquqYOBajAz0JIjDJs=; b=OpbXDPE4qQNRfzDRufgsC7ubTIQxLWrjG0YpYyfOu3RDk1vMsujHs8jvy1AVHyHYK2 cjz2R8NUfnjiLLnfR8+mdNhOaUNY3LCZy784Ly0Mz27oMBJCzgmFpSij4VPy8ao3+2aF nlCC7KnFgJ4x/fcrowfOlhsVW6+OL21dn1NuzamNX3FJeNPZ5UOG0apTs7lYWClGv715 iYLsRVSQb47/IwZVtzD/slSALaN85orzUg4F+4EtN1k8bdCBn6nipKAs/7amMkppje3T J+/gZSrsSjt42lQMaDlUTZuaqzylYsJyS0Iw7HfWnbYDofFE0z0DJYzGFenWhGCO2k81 /EkQ== X-Gm-Message-State: AOAM531t5fm7nXHvCEAgOEoaYspvqsSluWNfYJoSg6TfSqF2O6FNlLN5 ubQaTJzob5PsZcJR/rJspEmCLQ== X-Google-Smtp-Source: ABdhPJyLtfBqUQpoVZNoqWX48X/ynHku0Q/mpdlADxhZE9maHPd7pzNzlEz8Vp+sXtbfa1/CJYhJYA== X-Received: by 2002:a17:902:b113:b0:153:2251:c1b0 with SMTP id q19-20020a170902b11300b001532251c1b0mr16128580plr.44.1647930316996; Mon, 21 Mar 2022 23:25:16 -0700 (PDT) Received: from localhost ([2620:15c:202:201:c016:a147:e7e:6836]) by smtp.gmail.com with UTF8SMTPSA id y2-20020a056a00190200b004fa865d1fd3sm9903049pfi.86.2022.03.21.23.25.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Mar 2022 23:25:16 -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 v2 7/8] dt-bindings: iio: sx9360: Add precharge resistor setting Date: Mon, 21 Mar 2022 23:25:03 -0700 Message-Id: <20220322062504.1019504-8-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220322062504.1019504-1-gwendal@chromium.org> References: <20220322062504.1019504-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 --- Changes since v1: - no changes. .../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..1225f64f14174 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-kohms: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 0 + description: + Pre-charge input resistance in kOhm. + 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-kohms = <4>; }; }; From patchwork Tue Mar 22 06:25:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 12788112 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 CC4DFC43217 for ; Tue, 22 Mar 2022 06:25:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237186AbiCVG1Q (ORCPT ); Tue, 22 Mar 2022 02:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237251AbiCVG0t (ORCPT ); Tue, 22 Mar 2022 02:26:49 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A685A2A273 for ; Mon, 21 Mar 2022 23:25:18 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id n15so14652759plh.2 for ; Mon, 21 Mar 2022 23:25:18 -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=hikheyI0Nl+ipWdnweJSWsnrclofhtF+n/fKkrLyMFM=; b=TiV4uSre9LReQAaZ+o4zK4NCDqoZW5AC2CT8gkv5kcowRPQEHh7aKIgcH4ieFGaGq/ gom/Q6cZtLtMsReWwqW50lLGTQ6OMfNVyeiQLsvqcI4H0VfarxNnxYAr3n6iSaDm2Dxt pEB9Mxm/CM+cqPDdJwuy3X71ULNP/N+K6izJg= 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=hikheyI0Nl+ipWdnweJSWsnrclofhtF+n/fKkrLyMFM=; b=qptjoiTTpoXJM9pzxPP6bl5ae2gmWlzz7COsIdLKO63Y0CuddabS9aEVVcB5VPUH9n ZSOdXQ7NkuItcjCP1HQfkkQgs7HZcAw14jK58xP1IofWrNmAvWfzdYC/FOnD16lMtF2W vTG8mMt4mnIWH40Q5cfcrIGa8ITpTSGNfD3Uz8HL8wBTM0yKQCwUNqmwFlP91G7qOXT/ k4pvin/219C+2m2BmoFcctJyswAql+VrkYApFRwX4YNf9xodg2OlDuWsWbV+LnTXm4EO vS8TOuPUf/dlyaVP6GN077Bw7aOmpiA0Gd3NWJETiDGx3tIUQowzyK4J60ILhgY8esCG gpqw== X-Gm-Message-State: AOAM532MxtHLM8UjjFelmUIThx0lJbLDH5VMozt404t9fxC+o2tROnpD APQ/eW79EEchKjK6mzljWwIppw== X-Google-Smtp-Source: ABdhPJyK8P6TrbFnJDLZ0h/km0s1P+Qjz2PJ6CEy3m8HmmLxwFjE5QXjHV8mETAYZD1l9Zk/FDLHqQ== X-Received: by 2002:a17:903:41cf:b0:154:25bf:7d0f with SMTP id u15-20020a17090341cf00b0015425bf7d0fmr16150921ple.41.1647930318211; Mon, 21 Mar 2022 23:25:18 -0700 (PDT) Received: from localhost ([2620:15c:202:201:c016:a147:e7e:6836]) by smtp.gmail.com with UTF8SMTPSA id g5-20020a056a001a0500b004def10341e5sm22139411pfv.22.2022.03.21.23.25.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Mar 2022 23:25:17 -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 v2 8/8] iio: sx9360: Add pre-charge resistor setting Date: Mon, 21 Mar 2022 23:25:04 -0700 Message-Id: <20220322062504.1019504-9-gwendal@chromium.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220322062504.1019504-1-gwendal@chromium.org> References: <20220322062504.1019504-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 --- 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..a70d2ad808f1a 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-kohms", + &raw); + reg_def->def &= ~SX9360_REG_AFE_CTRL1_RESFILTIN_MASK; + reg_def->def |= FIELD_PREP(SX9360_REG_AFE_CTRL1_RESFILTIN_MASK, + raw / 2); + break; case SX9360_REG_AFE_PARAM0_PHR: case SX9360_REG_AFE_PARAM0_PHM: ret = device_property_read_u32(dev, "semtech,resolution", &raw);