From patchwork Fri Oct 9 15:44:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 317546 Delivered-To: patch@linaro.org Received: by 2002:a92:d603:0:0:0:0:0 with SMTP id w3csp2426593ilm; Fri, 9 Oct 2020 08:45:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbzlRVDdxhO/ASLJ2HwEE01JoAhUWX3yvFmcFvGdDzWwzOkMA+ssn2jbdSv7h6mu9eOoMO X-Received: by 2002:a50:c309:: with SMTP id a9mr15497998edb.199.1602258314741; Fri, 09 Oct 2020 08:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602258314; cv=none; d=google.com; s=arc-20160816; b=DEj1yHkNJZZrE4oRr+CFTiTxOMIU/3E1aYxfgri8u+VBFe2z/SRAc1mtjme2gClkmn +UhccGgUYcYGgdoFL7OMJrmAdd3pjNrq0zTF1wewq9zx8XFokMKdhQljNxEyN7dWZ8lg lC7Jn8OjN5R0y5YMoOVf6M8HETny6ag9XlSz8T527cpu88HNcmEchgYNaCuJqeGYxV12 qhrDpLQ5WHpYRg5/h5J+w4KKlRy4HsL3ycvnrTBkcsCoT4G6rC+VGskgmMUxzJ9wsPR/ Xc/kEviAdf/iyxpkdGyjgzyXRQOvTRTL4GA8qNqZPAI7SW1Td0YKBCxKiPCP6pmo1XMB ZBNg== 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=u+ec5e/iUjJ8qDBtGE9xKBCADcm1RI8srVHT5OLXlvU=; b=J97c65Eg8ih49x3dGNgfKXq3JOybimhxxwC9c0Ld+6to9s7/JFJVsl6XdiEcYVVa7Z F0cEy0jf75BZKfQt9Bw4a4LbEgyQh12H5o+ZCliXWlR3KefJ1WrEv0crmXZNyBli/y9e 0hT59cdOwZsxRRbAJQv7aFL9/v4aZOZouJrA9w56XoJbI0FKzMiuSJZ+9XoAXX02hjSP +zCPTrHXWosss70UgElX6Q26g8UYcDlxUHCFhepTBxeWul8w+fADvcDgUD8iykCGdYuw ArThGFIsGqEY/iYLyUSmP16KqY84LzibzbYspTpXH3NBZKzhxRWC4vI78oVW2KTCa3Rr JaAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bwohXV3Y; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si6328708ejy.232.2020.10.09.08.45.14; Fri, 09 Oct 2020 08:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bwohXV3Y; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S2389388AbgJIPpM (ORCPT + 6 others); Fri, 9 Oct 2020 11:45:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389355AbgJIPpL (ORCPT ); Fri, 9 Oct 2020 11:45:11 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77EF8C0613D7 for ; Fri, 9 Oct 2020 08:45:11 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id i2so10070854ljg.4 for ; Fri, 09 Oct 2020 08:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u+ec5e/iUjJ8qDBtGE9xKBCADcm1RI8srVHT5OLXlvU=; b=bwohXV3YZo5cTz0TyNBCL/bMBJIwuPprPvrhOn48oBFgGvgBiXBPol+T7jzXJBlYAA jUNORplCm8Wgt6R/yIDhzByfIanKQaRWKUsdeKHBlp9j7NJay5EhVgnn4OsBJuW8J5rT 4jY1ipSBsKUbbkCAHXDVjb+xgwIl+w8giDNkvPSQH/N1orSMRnrH/odd77upToDSb/tZ C9bDTxulmJAh7cAMvpxWd8JWMXHySlcOgA90BBBcPtxqwOC2vrjeGvdHFEiwn/cJ+x5H pLGtSKf/BZvDTvSJ6pjLxBWYBYY0TaULkbUVShYJDXk5SqlJa8+bv3Sdc2ab16TnE7Em 2sgw== 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=u+ec5e/iUjJ8qDBtGE9xKBCADcm1RI8srVHT5OLXlvU=; b=CkM9vjc3O58dEhOTVd3N9FB2Kj/fYh2Y+FeA/zzkemzxHfNCtImAaLePXmWPvDYhIr 0EckgvuFtMh0OZPu66B9wLI6z0W0aQ1nFHqkDe/06Iy5iWbgj1vsHjSHN5W8Xhb+yyLw QkElBZXRzq6sUB2H8LWi4/B5kh6vn3dG2Mgddz3JH0+SK0M6dWq98Gun+sc9n4JVHfRC 6iZ+8k1FT2S1ZKjwADy01gCdkPszyr/EsKIR6ZYf7Exe9FsWdCN1cs2oLMT5mutFS+er 27bSlwphJ+J/Bi+ZAbkKK8z1+SyRoqgIzEPNpmK/UPg4ozmInhng1xpxhVxqyEhXSbO+ p/vg== X-Gm-Message-State: AOAM531U5L8q3YjCyYN+SO8zkLVSwE3emBKDYGtN+b5sfuxtxrxOAjZl 7up8BV7FVANUoPXXb3Kei2OpGw== X-Received: by 2002:a2e:8042:: with SMTP id p2mr4336774ljg.90.1602258309858; Fri, 09 Oct 2020 08:45:09 -0700 (PDT) Received: from eriador.lan ([188.162.65.231]) by smtp.gmail.com with ESMTPSA id r4sm1505597lfc.162.2020.10.09.08.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 08:45:09 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Zhang Rui , Daniel Lezcano , Amit Kucheria , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, Manivannan Sadhasivam , Jishnu Prakash , Craig Tatlor , Jonathan Cameron Subject: [PATCH v8 02/11] fixp-arith: add a linear interpolation function Date: Fri, 9 Oct 2020 18:44:50 +0300 Message-Id: <20201009154459.106189-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009154459.106189-1-dmitry.baryshkov@linaro.org> References: <20201009154459.106189-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Craig Tatlor Adds a function to interpolate against two points, this is carried arount as a helper function by tons of drivers. Signed-off-by: Craig Tatlor Signed-off-by: Dmitry Baryshkov Acked-by: Jonathan Cameron --- include/linux/fixp-arith.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.28.0 diff --git a/include/linux/fixp-arith.h b/include/linux/fixp-arith.h index 8396013785ef..281cb4f83dbe 100644 --- a/include/linux/fixp-arith.h +++ b/include/linux/fixp-arith.h @@ -141,4 +141,23 @@ static inline s32 fixp_sin32_rad(u32 radians, u32 twopi) #define fixp_cos32_rad(rad, twopi) \ fixp_sin32_rad(rad + twopi / 4, twopi) +/** + * fixp_linear_interpolate() - interpolates a value from two known points + * + * @x0: x value of point 0 + * @y0: y value of point 0 + * @x1: x value of point 1 + * @y1: y value of point 1 + * @x: the linear interpolant + */ +static inline int fixp_linear_interpolate(int x0, int y0, int x1, int y1, int x) +{ + if (y0 == y1 || x == x0) + return y0; + if (x1 == x0 || x == x1) + return y1; + + return y0 + ((y1 - y0) * (x - x0) / (x1 - x0)); +} + #endif From patchwork Fri Oct 9 15:44:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 317550 Delivered-To: patch@linaro.org Received: by 2002:a92:d603:0:0:0:0:0 with SMTP id w3csp2426788ilm; Fri, 9 Oct 2020 08:45:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjnmPivoOYUQ5SadueBfdGCAz+3KE6VppgEw9rSV4LfxuiaF7q4/DztJlmJxQG+mXUd9Xl X-Received: by 2002:a17:906:4b19:: with SMTP id y25mr15787685eju.393.1602258324789; Fri, 09 Oct 2020 08:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602258324; cv=none; d=google.com; s=arc-20160816; b=SwDYtmcL+y5zAxs5qaSqrwGkuFSOBuUlQDklPi4/4TFqPnEoQ0mLHrzBdjM5NbFaPe bfdC8EFXra4xaEHG4Eo7nx+4Os3I8VhIWB97om5ukD9Xk+RtQtb14HZiGOCp4xCk0Mh4 2POXWdyueo6ijtuRvFFpwVl0/sHJh4W+Z63MQFDYpXt9sz0VzZKlYYD6DGKCPOWbJZys ONbVN5rRTUBIluF0NwqX3AMMtKjEN7TvpCL+Wy3bLvh0+JMsZQQbx5/H8vaZ3POpiuNw iMeu7QyIS1NTMrNtHdhMXldlnnW3SuO6LMHCuQOrWY0PM19SER+98gO6E0fcTdjTJOde BTqg== 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=Rs/lmUbls2+lr33cOkF5wTnejEIFAqou3Xfg7WIvltg=; b=Ie9sxTxdmbhZSX6oHWFfH4Ssz79wV4E2syuj14FtTzVoLphUIlHVQBHAzxHzIw2tIe rvpbYiKcPDm3YTUehYbRO83zeuV1XvHDeSpQlTGcgPHN58fKPk82xFmKz8TY+2hY1W5T /bFSb8FGyEyFKBZPyNnYDYNzh3MdY9OMckk1xJ61cXmkUXLB/TSO8ywOKGodRJxlPrCv o81EkijvVyzUxpV9QP/9J0GsrCxiTWYrRGy7T6TXxZtrBJs8bXoD5vnnwGsO4AZYv/uD kQVIgwoSyl52AGnXLu9KXFaJKYP2uzd+OikF38hXIJk8LOwf1IFQk7pw+wIlAm1EckXN /BEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yivuL4J5; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si6328708ejy.232.2020.10.09.08.45.24; Fri, 09 Oct 2020 08:45:24 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yivuL4J5; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S2389445AbgJIPpW (ORCPT + 6 others); Fri, 9 Oct 2020 11:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389454AbgJIPpW (ORCPT ); Fri, 9 Oct 2020 11:45:22 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C7BC0613D7 for ; Fri, 9 Oct 2020 08:45:21 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id a15so10074131ljk.2 for ; Fri, 09 Oct 2020 08:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rs/lmUbls2+lr33cOkF5wTnejEIFAqou3Xfg7WIvltg=; b=yivuL4J53m688pGDgg3WPhODsMl4KQrCp23+POmiBRLuXeQtDcUSlZ92XvU590BQT7 P+frwWWKTNat2ORIVRl6EzSIO4yV1kKedUzc/WQtJNNc4VjUJgdCqt0Z+lsflrAmoeaz 5GQ2j6Qrwh5npSETINzGpD3DBNUQZW3kodv/HgzECl5kCbkMlABTX6WdXIC1PQMYnu9A nEQcM45a98V0oH+iJl3XsdbesVmFeawRCJA4SKbfMyFsI6o6UsuzOc5TArbbVoWASB+j l1+iaFVmY2OS0FJ+zk7JqybA/GxV6e1O/oBh1zsbJsT2HFWYfuf5tRW15dV0RKlMpsoR tnNw== 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=Rs/lmUbls2+lr33cOkF5wTnejEIFAqou3Xfg7WIvltg=; b=H67NGbvhNXCFkvJ1vEoBpDu71vAXXfX+gZpnWmuPte641IWIN00gNiVDnhEokkXmcx iSrMfMlj3YfW5jtattXoW9u+9kLo5C+ENMSGlHcw4+RXD4kUY5WKmPIaRi7ATHTiB0VP 62emuX8PwMhcFV87RIjjNXUJdI4jW62EypPHjkckE0kanAC/+tFpBqXnluR0VjA/JeYC uECkktg0xLcVnuV8lOQ3HLtWPYWCqO33EJK1Je4A32JfKt7ydwzTcca+4qmX+PRTayaO wWVx/is+w8ZC5presqNcKnfvGKWLaQwuAKOSNFeBJB5lp/Ckz4bUlZlo0eKIM5NepefE UuHQ== X-Gm-Message-State: AOAM533CXwndbHapOixSxEwJqqPVlz5ogo7MfwIaCIwXxi/9+PUKkHPR 3/A3XDG4ddA+tF407/Em6BrTlw== X-Received: by 2002:a2e:3806:: with SMTP id f6mr5315337lja.93.1602258319918; Fri, 09 Oct 2020 08:45:19 -0700 (PDT) Received: from eriador.lan ([188.162.65.231]) by smtp.gmail.com with ESMTPSA id r4sm1505597lfc.162.2020.10.09.08.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 08:45:19 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Zhang Rui , Daniel Lezcano , Amit Kucheria , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, Manivannan Sadhasivam , Jishnu Prakash , Jonathan Cameron Subject: [PATCH v8 06/11] iio: adc: qcom-spmi-adc5: use of_device_get_match_data Date: Fri, 9 Oct 2020 18:44:54 +0300 Message-Id: <20201009154459.106189-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009154459.106189-1-dmitry.baryshkov@linaro.org> References: <20201009154459.106189-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Use of_device_get_match_data() instead of hand-coding it manually. Signed-off-by: Dmitry Baryshkov Acked-by: Jonathan Cameron Acked-by: Manivannan Sadhasivam --- drivers/iio/adc/qcom-spmi-adc5.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) -- 2.28.0 diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c index b10a0fcf09dc..87438d1e5c0b 100644 --- a/drivers/iio/adc/qcom-spmi-adc5.c +++ b/drivers/iio/adc/qcom-spmi-adc5.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -807,8 +808,6 @@ static int adc5_get_dt_data(struct adc5_chip *adc, struct device_node *node) struct adc5_channel_prop prop, *chan_props; struct device_node *child; unsigned int index = 0; - const struct of_device_id *id; - const struct adc5_data *data; int ret; adc->nchannels = of_get_available_child_count(node); @@ -827,24 +826,21 @@ static int adc5_get_dt_data(struct adc5_chip *adc, struct device_node *node) chan_props = adc->chan_props; iio_chan = adc->iio_chans; - id = of_match_node(adc5_match_table, node); - if (id) - data = id->data; - else - data = &adc5_data_pmic; - adc->data = data; + adc->data = of_device_get_match_data(adc->dev); + if (!adc->data) + adc->data = &adc5_data_pmic; for_each_available_child_of_node(node, child) { - ret = adc5_get_dt_channel_data(adc, &prop, child, data); + ret = adc5_get_dt_channel_data(adc, &prop, child, adc->data); if (ret) { of_node_put(child); return ret; } prop.scale_fn_type = - data->adc_chans[prop.channel].scale_fn_type; + adc->data->adc_chans[prop.channel].scale_fn_type; *chan_props = prop; - adc_chan = &data->adc_chans[prop.channel]; + adc_chan = &adc->data->adc_chans[prop.channel]; iio_chan->channel = prop.channel; iio_chan->datasheet_name = prop.datasheet_name; From patchwork Fri Oct 9 15:44:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 317554 Delivered-To: patch@linaro.org Received: by 2002:a92:d603:0:0:0:0:0 with SMTP id w3csp2426972ilm; Fri, 9 Oct 2020 08:45:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBtYFT0omwO4QbM/6K9gVjpwHg4t+On5Idkf/bRZXLmzbHJq77xAvYtYxfmVsqUt1i8wc7 X-Received: by 2002:a17:906:dc5:: with SMTP id p5mr15733042eji.116.1602258335868; Fri, 09 Oct 2020 08:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602258335; cv=none; d=google.com; s=arc-20160816; b=U6D4rYvfCMoAu6bPOug3alHe4H4X9yOMzKaygp96cIhP/B1jpwTbm0oUHT65IZX/dD R80xMcT/FfRgMqLxMRSSw0/OiwHv2KatRb0ZpS+alnuDH1GuXES8XkhuVC0Gu+UxMnoA w8IPfXkhoXMvnvT1RZzvo+K2K+5KOEsFwYAkG4jx5AepPTu/40STtznXyTfFtcmX22lY d/dZHduWiT3BAMrDgcELYyu8fiCZ7N747V7Ys3Oqmy9pXCnptXf18INSrSDZzPj7KNb+ uC6fkHXCq3gGnRYAYL+Zigqnt/0zz6xwPDdOtVacnTgO4s1JelYugnl84mNBZaE1uD++ Fw6A== 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=IX5J13tHQBhV3OyuAx16FFIRHXqfdlDIoHquJV7x6Go=; b=kZIxifOuO/LekKSbkAiJRg+o8xpy1kefV4wzFkTvwZfCNbxNSg6zv/QR5Cbyz0BF9R d1TLCoqDCQl2oLBL1eg75bKxT3x9q8kkUVd8dP5cPpfUEUSKVJSfYC4XXYIRoy6Bf/8l 1B/cg3U6SOMzzwnQhUwF2/3uinoSO6wcVri8nJ3SOT0fgf+9hNTypH04A89HsN+X36aB MNrnRtLOPoceCKbdu/15Mmp8mYR1vLkjKBcsPwwNNDpi8U5hqvSnXkZQXkWvkM/GbUt3 n1sj/rR3csPmzs4f7bt2wMtpeaiA5nRG7GtxVqlrDtMRN0HLRFWQyorX7HY6IvQnW+df jxVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OW/J3NuW"; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si6328708ejy.232.2020.10.09.08.45.35; Fri, 09 Oct 2020 08:45:35 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OW/J3NuW"; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S2389468AbgJIPpe (ORCPT + 6 others); Fri, 9 Oct 2020 11:45:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389466AbgJIPpd (ORCPT ); Fri, 9 Oct 2020 11:45:33 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20BDDC0613D5 for ; Fri, 9 Oct 2020 08:45:33 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id y16so8906832ljk.1 for ; Fri, 09 Oct 2020 08:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IX5J13tHQBhV3OyuAx16FFIRHXqfdlDIoHquJV7x6Go=; b=OW/J3NuWgPhMJqoOfdBVFraYf0bvh6VUfD9NDs0qFesTezLa3BEyOQPDm1pGtDqfhz DSEiT09DGZOIOPqEKK3b9MqufIMif0m9O2l5cMWpWL3ucBxEm6H94Z9Z55IlK54twjTG ctrihc7EcyCpOGY2yWph6/DH6Ej129C5woSLKuyqaz6lngtc2ySk+XsIWBujE/2VPElr t05o0iSxbYO50tvhq2vEyMIJm1Lt0kuZBd1hmc2TWuma4fMmeRifl48Jypjild4tSnO0 JGLcb6Inxn/bpTGUVSowy1gmD8/mOZAqea6rasV0dcad/sREbxOXIjQ/jNu+E1xxloZV o7aA== 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=IX5J13tHQBhV3OyuAx16FFIRHXqfdlDIoHquJV7x6Go=; b=EtceO/uMnb1kpqHCaMC2pF1SPiREg66ksG/xz4N3g7SvjtoZSKkFKaQVG6SwXdZP6U CyENFb8nAjJyLAnU2uxszvpGjn+tz6XYSzzMPLKSFfx9ADW5ctw+EEiUijGbjdMmsAul 7EUc9z/VhKULzKl0IGDkyw2lQlYqxsCXShfYdB8ZWYww5w76tiPOzSx3koLS6fAI/Ylm yXkBEs3tzOajpCWlz+B8Y8y0R7w/H+7f5fgM8pjYSyBCGh5OW6R+tT9mfBrULH2ejbmn ynOXn3aQ1s9+cs6VSQAgvXLYMqfoSNNNqkaxT930oTRoMF+eg8BLA3eVRjajUI+7QIG/ T50w== X-Gm-Message-State: AOAM532gGGkiJw6etbS/Dr/aFFpntgFLqwZmfdW2fI6CQofK4CHln7ME MWAQt+kQ+od2fnNlIS/v6f6OXfpiRyclx+DR X-Received: by 2002:a2e:b557:: with SMTP id a23mr5586986ljn.0.1602258331537; Fri, 09 Oct 2020 08:45:31 -0700 (PDT) Received: from eriador.lan ([188.162.65.231]) by smtp.gmail.com with ESMTPSA id r4sm1505597lfc.162.2020.10.09.08.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 08:45:30 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Zhang Rui , Daniel Lezcano , Amit Kucheria , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, Manivannan Sadhasivam , Jishnu Prakash Subject: [PATCH v8 10/11] arm64: dts: sm8250-mtp: add thermal zones using pmic's adc-tm5 Date: Fri, 9 Oct 2020 18:44:58 +0300 Message-Id: <20201009154459.106189-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009154459.106189-1-dmitry.baryshkov@linaro.org> References: <20201009154459.106189-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Port thermal zones definitions from msm-4.19 tree. Enable and add channel configuration to PMIC's ADC-TM definitions. Declare thermal zones and respective trip points. Signed-off-by: Dmitry Baryshkov --- arch/arm64/boot/dts/qcom/sm8250-mtp.dts | 207 ++++++++++++++++++++++++ 1 file changed, 207 insertions(+) -- 2.28.0 diff --git a/arch/arm64/boot/dts/qcom/sm8250-mtp.dts b/arch/arm64/boot/dts/qcom/sm8250-mtp.dts index 98675e1f8204..95050f7d11f2 100644 --- a/arch/arm64/boot/dts/qcom/sm8250-mtp.dts +++ b/arch/arm64/boot/dts/qcom/sm8250-mtp.dts @@ -24,6 +24,104 @@ chosen { stdout-path = "serial0:115200n8"; }; + thermal-zones { + xo-therm { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pm8150_adc_tm 0>; + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + skin-therm { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pm8150_adc_tm 1>; + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + mmw-pa1 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pm8150_adc_tm 2>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + conn-therm { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pm8150b_adc_tm 0>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + camera-therm { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pm8150l_adc_tm 0>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + skin-msm-therm { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pm8150l_adc_tm 1>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + mmw-pa2 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pm8150l_adc_tm 2>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + }; + vph_pwr: vph-pwr-regulator { compatible = "regulator-fixed"; regulator-name = "vph_pwr"; @@ -378,6 +476,115 @@ &i2c15 { /* rtc6226 @ 64 */ }; +&pm8150_adc { + xo-therm@4c { + reg = ; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + }; + + skin-therm@4d { + reg = ; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + }; + + pa-therm1@4e { + reg = ; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + }; +}; + +&pm8150b_adc { + conn-therm@4f { + reg = ; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + }; +}; + +&pm8150l_adc { + camera-flash-therm@4d { + reg = ; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + }; + + skin-msm-therm@4e { + reg = ; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + }; + + pa-therm2@4f { + reg = ; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + }; +}; + +&pm8150_adc_tm { + status = "okay"; + + xo-therm@0 { + reg = <0>; + io-channels = <&pm8150_adc ADC5_XO_THERM_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + skin-therm@1 { + reg = <1>; + io-channels = <&pm8150_adc ADC5_AMUX_THM1_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + pa-therm1@2 { + reg = <2>; + io-channels = <&pm8150_adc ADC5_AMUX_THM2_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; +}; + +&pm8150b_adc_tm { + status = "okay"; + + conn-therm@0 { + reg = <0>; + io-channels = <&pm8150b_adc ADC5_AMUX_THM3_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; +}; + +&pm8150l_adc_tm { + status = "okay"; + + camera-flash-therm@0 { + reg = <0>; + io-channels = <&pm8150l_adc ADC5_AMUX_THM1_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + skin-msm-therm@1 { + reg = <1>; + io-channels = <&pm8150l_adc ADC5_AMUX_THM2_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + pa-therm2@2 { + reg = <2>; + io-channels = <&pm8150l_adc ADC5_AMUX_THM3_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; +}; + &qupv3_id_0 { status = "okay"; };