From patchwork Sat Sep 26 17:18:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 11801599 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3F886CA for ; Sat, 26 Sep 2020 17:18:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7D682177B for ; Sat, 26 Sep 2020 17:18:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MaueTk1y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729955AbgIZRSn (ORCPT ); Sat, 26 Sep 2020 13:18:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726309AbgIZRSn (ORCPT ); Sat, 26 Sep 2020 13:18:43 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA13AC0613CE; Sat, 26 Sep 2020 10:18:42 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id s12so7260434wrw.11; Sat, 26 Sep 2020 10:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bl53+IHBE7yXiOLq6WRfnfhUTBMnGEZtbf1LqSaqfOk=; b=MaueTk1yEtJ7GzSgrXw9tmwckv/94rigKyb+hYnwA4mrGQVzJNB5sjMe6y2xd4IBeT 3zkQ9HbFbDy2HsnjEzWPRD0Y0WO7UoGKjIxD+WFa4PQoTYvzULDT06j5a3uoJ3DXDEuB kwBeb9FSSZOMVJb9QpJOm1IZ76qUyTUG04nCCPF74hjYkr7zD2KCdCnP9ID5ZmR8Nzmg C7MsQtBPYqbYzatYImp4itw+59MOMc+2ezR9fnuhOMJ3/LKjf0riQt/EiAWmQToz5Wcb rhdKstdxImdK1Ec5krm8r230l7kWzYOa0U20CsBBZOhjsabFERo9xzDUDPJXk0vj+k8p muuA== 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:mime-version :content-transfer-encoding; bh=bl53+IHBE7yXiOLq6WRfnfhUTBMnGEZtbf1LqSaqfOk=; b=GdxjOrt3qfc2NDShUkPm+FhikafObXAx2zB0+2hrT4kBCuBTuTvLLBHAbFkAKdB/Ku IZGOitadgmm6+WNFAVaT+RKwzM/lx0X4l4wegbDB4gyY/e7/KxRFXjLc1pvSR5JArkMb awTf/31Kr/WwJPfdxNzSryi/IjO+oxV1hLcmgAu6Ac/HkGCs0aJbbiqIO3jVcCCX1Dk0 S+4MnZn7fBM+V3YfbuZ3jFboztl6A2uv9QQDh4v5JDiragvx51WLWHRU9Kno2ol7L4WK KA9rTIo0IITNo4X6n+AE1+RPMnYmgfXEDreQ5gczkca3K28s/USwexOzCIZicBMpAg6U 66lg== X-Gm-Message-State: AOAM531pXjsQZY//J/ZpDbxh4kk4Bpy7g/eE/zgeUanDyNxfN+ZI6jYN 6O9r2WZZrPBI/C45AtSFAyA= X-Google-Smtp-Source: ABdhPJyzlxbTOBiEV6UjiHZ8TzGIgyhnXIRMmB49mXLck6hVgqRUzmKf7TuHcYyH3cOFuQuh7oKS5Q== X-Received: by 2002:adf:f903:: with SMTP id b3mr10611592wrr.142.1601140721323; Sat, 26 Sep 2020 10:18:41 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu ([2.237.20.237]) by smtp.gmail.com with ESMTPSA id l4sm7427125wrc.14.2020.09.26.10.18.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 10:18:40 -0700 (PDT) From: kholk11@gmail.com To: agross@kernel.org Cc: bjorn.andersson@linaro.org, jic23@kernel.org, robh+dt@kernel.org, kholk11@gmail.com, marijns95@gmail.com, konradybcio@gmail.com, martin.botka1@gmail.com, linux-arm-msm@vger.kernel.org, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845 Date: Sat, 26 Sep 2020 19:18:34 +0200 Message-Id: <20200926171835.27154-1-kholk11@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: AngeloGioacchino Del Regno The ratiometric range for MSM8998, SDM630/636/660 and SDM845 is 1875mV instead of the standard 1800mV: address this by adding a new compatible "qcom,spmi-vadc-8998" and assigning the different range to the machines declaring this one. Signed-off-by: AngeloGioacchino Del Regno --- drivers/iio/adc/qcom-spmi-vadc.c | 10 +++++++++- drivers/iio/adc/qcom-vadc-common.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c index b0388f8a69f4..59a94ea7bf78 100644 --- a/drivers/iio/adc/qcom-spmi-vadc.c +++ b/drivers/iio/adc/qcom-spmi-vadc.c @@ -101,6 +101,7 @@ struct vadc_channel_prop { * @dev: pointer to struct device. * @base: base address for the ADC peripheral. * @nchannels: number of VADC channels. + * @ratio_range: ratiometric range for ref points. * @chan_props: array of VADC channel properties. * @iio_chans: array of IIO channels specification. * @are_ref_measured: are reference points measured. @@ -114,6 +115,7 @@ struct vadc_priv { struct device *dev; u16 base; unsigned int nchannels; + unsigned int ratio_range; struct vadc_channel_prop *chan_props; struct iio_chan_spec *iio_chans; bool are_ref_measured; @@ -355,7 +357,7 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc) u16 read_1, read_2; int ret; - vadc->graph[VADC_CALIB_RATIOMETRIC].dx = VADC_RATIOMETRIC_RANGE; + vadc->graph[VADC_CALIB_RATIOMETRIC].dx = vadc->ratio_range; vadc->graph[VADC_CALIB_ABSOLUTE].dx = VADC_ABSOLUTE_RANGE_UV; prop = vadc_get_channel(vadc, VADC_REF_1250MV); @@ -885,6 +887,11 @@ static int vadc_probe(struct platform_device *pdev) if (ret) return ret; + if (of_device_is_compatible(node, "qcom,spmi-vadc-8998")) + vadc->ratio_range = VADC_RATIOMETRIC_RANGE_8998; + else + vadc->ratio_range = VADC_RATIOMETRIC_RANGE; + irq_eoc = platform_get_irq(pdev, 0); if (irq_eoc < 0) { if (irq_eoc == -EPROBE_DEFER || irq_eoc == -EINVAL) @@ -918,6 +925,7 @@ static int vadc_probe(struct platform_device *pdev) static const struct of_device_id vadc_match_table[] = { { .compatible = "qcom,spmi-vadc" }, + { .compatible = "qcom-spmi-vadc-8998" }, { } }; MODULE_DEVICE_TABLE(of, vadc_match_table); diff --git a/drivers/iio/adc/qcom-vadc-common.h b/drivers/iio/adc/qcom-vadc-common.h index 17b2fc4d8bf2..b10d5fd59034 100644 --- a/drivers/iio/adc/qcom-vadc-common.h +++ b/drivers/iio/adc/qcom-vadc-common.h @@ -16,6 +16,7 @@ #define VADC_ABSOLUTE_RANGE_UV 625000 #define VADC_RATIOMETRIC_RANGE 1800 +#define VADC_RATIOMETRIC_RANGE_8998 1875 #define VADC_DEF_PRESCALING 0 /* 1:1 */ #define VADC_DEF_DECIMATION 0 /* 512 */ From patchwork Sat Sep 26 17:18:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 11801603 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CC5D6CA for ; Sat, 26 Sep 2020 17:18:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51BE020882 for ; Sat, 26 Sep 2020 17:18:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dVhPJD/W" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729986AbgIZRSo (ORCPT ); Sat, 26 Sep 2020 13:18:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726309AbgIZRSo (ORCPT ); Sat, 26 Sep 2020 13:18:44 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C68A6C0613CE; Sat, 26 Sep 2020 10:18:43 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id g4so7297670wrs.5; Sat, 26 Sep 2020 10:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c8nPtqvHXCkUTvUezerS3EWetfGCD8LGrLlldVmFG+I=; b=dVhPJD/W+PLgXlmj9+7F9WqTsSSMJb48hu4R+kdlQujgkQ6XzU432IFkDwFdVVxuxJ gDV8OM6mwf8Mf4qnJTbX4HMwNATlkfCDCanHsuKsor20zHsG9hZ4PuSWHr2v09IKnO2i vbZ+ERCrqxrcghCLeECSx/ul9OoXmTmbQaiZaDIL2b+SjTr4AsdZpQvlxcZSov/sS3nj g+mvWf+W49DRmFqSerZEYmTIL+zH0PjQk1Lj7i1sB/DboD9xwhABBVeN0X6rnbA/asIb /IJ3Q7nZBhYlfH3dNiMW6qd2wLg0bXfn8Likzz/ilQiiriehEN4DyybKA3MFFU11tT9u C28g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=c8nPtqvHXCkUTvUezerS3EWetfGCD8LGrLlldVmFG+I=; b=QU1EH3BmX86/9jDUsRQOpsa7WuOFON0KNsIv0JN0GiheDlpfcCEnyrfjUIhOTv66p/ WE9sqIbruwusngmKEbAfiqOiESNxar3H/sGZtRY4M1BkTr8I65gGk/7lgMribCtCmtgf PwtZGpEdhYol9yMCGFenGXGhlJQHHxgRZYI7/1AYtm51Xw82DHi52FVT5oM6djHOhE2t uTEjbJEB4hQgA1dxcJ5NG1A3/gU96W23vpv1q0XOJLzWEQcdCeVe1Z7OpHuYVswak/tZ g9sUhFAZD+TYplTIZ1G5nFwhbu3Cg7zyncJYOH0P3Six8RTvI2ltaqq0C+eQQ2sL+/s2 Z/zw== X-Gm-Message-State: AOAM531buLG0DaBg+pKg8hh1Yu+Via3fi3mmn5XJYR5SOC4IQlzb2eI1 XQB9UdQT69+ABQUCGeSgtYA= X-Google-Smtp-Source: ABdhPJwQP2F6G4uixs1tEIh0Q5eW4AEu9eRwSzqVBJLGnMX+M/dFuiQjw/chmrOvkkurE4Two1VoSw== X-Received: by 2002:adf:83c3:: with SMTP id 61mr9987667wre.287.1601140722463; Sat, 26 Sep 2020 10:18:42 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu ([2.237.20.237]) by smtp.gmail.com with ESMTPSA id l4sm7427125wrc.14.2020.09.26.10.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 10:18:42 -0700 (PDT) From: kholk11@gmail.com To: agross@kernel.org Cc: bjorn.andersson@linaro.org, jic23@kernel.org, robh+dt@kernel.org, kholk11@gmail.com, marijns95@gmail.com, konradybcio@gmail.com, martin.botka1@gmail.com, linux-arm-msm@vger.kernel.org, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH 2/2] dt-bindings: qcom-spmi-vadc: Document qcom,spmi-vadc-8998 compatible Date: Sat, 26 Sep 2020 19:18:35 +0200 Message-Id: <20200926171835.27154-2-kholk11@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200926171835.27154-1-kholk11@gmail.com> References: <20200926171835.27154-1-kholk11@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: AngeloGioacchino Del Regno This compatible is used in the qcom-spmi-vadc driver to select a variation in the ratiometric range, valid for MSM8998-style VADCs, like MSM8998 itself, SDM630, SDM636, SDM660, SDM845 and others. Signed-off-by: AngeloGioacchino Del Regno --- Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml index 0ca992465a21..e9f0ebba5e2a 100644 --- a/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml +++ b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml @@ -26,6 +26,7 @@ properties: - items: - enum: - qcom,spmi-vadc + - qcom,spmi-vadc-8998 - qcom,spmi-adc5 - qcom,spmi-adc-rev2 - qcom,spmi-adc7