Message ID | 20201102174950.1148498-3-dmitry.baryshkov@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp3922536ilc; Mon, 2 Nov 2020 09:50:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzo6Ib4sAWkzC4CDKI0HogQw83KMoyiJJIEa8eC7GO0c4utYPelXG0XK0EXdrOg89nFbPo3 X-Received: by 2002:a05:6402:744:: with SMTP id p4mr17329009edy.190.1604339403929; Mon, 02 Nov 2020 09:50:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604339403; cv=none; d=google.com; s=arc-20160816; b=HFHRcqzqQTlJ2544nV/CMq7bpsw/bdHisUShxA4l+tMsY1hA1k6z9Rx4CPd8dI0sch dHUpu4/T6ehf1zvgwdD0dEgewFkb7N7IXDr/4nm2cmn2OB0AYsEz2LF1Cv0amOhlf8uu T26Dn0ngoCy1OpIVxWYOP0MXwQa/c4NDlYPclhI2On+agrSPz3nGBdZlMz80f3nYXUfP oFdRpGyQGSjgnqtCm7N7grX6jmf6vCWeIBxYzEsJXl0TtGqyu4eNQ2R8/60/Dd7Y/MDA cI8fA65nzvjkbYTv8gCB5rMGny6UpvYze8WhikGPcBBlzDRmlAl+BDtzhVdTD8OihpP8 eyPQ== 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=UzUXD768Y0HIp6upcK8c3jHYmzY+nMeV0gUUeig4dLOqDQurlj7wOYU3FUN0FKNRf/ d1rb011YGlbsr99G00bvt1yqeNaj2Z+b3EmxeLfeZ/u/iwEYWONOmngxXJ+5UCaOc0xn S9I8n1YaO9sj1IGNuqbmW/kDvR1XhD2woeVWpEvrzk3P/FmApEuFmXTn1bdpUfimAhKT ZQBpXSDmJTm5O7R0PhM6BJmQECU4gE/gPdyR36+u4TWdbecTwfcS2fqsI2663A2fZl84 Qpjcc2tj5BPFge76VMBn0G4m23Ng+1D/LEu+lxgj7ny8N12US9ffjrKSMfphPalnC/xe fWyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pF6nXloP; 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: <devicetree-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx12si12334700edb.507.2020.11.02.09.50.03; Mon, 02 Nov 2020 09:50:03 -0800 (PST) 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=pF6nXloP; 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 S1725921AbgKBRuC (ORCPT <rfc822;patch@linaro.org> + 6 others); Mon, 2 Nov 2020 12:50:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbgKBRuC (ORCPT <rfc822; devicetree@vger.kernel.org>); Mon, 2 Nov 2020 12:50:02 -0500 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3974CC0617A6 for <devicetree@vger.kernel.org>; Mon, 2 Nov 2020 09:50:02 -0800 (PST) Received: by mail-lf1-x144.google.com with SMTP id i6so18566792lfd.1 for <devicetree@vger.kernel.org>; Mon, 02 Nov 2020 09:50:02 -0800 (PST) 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=pF6nXloPlqM6obPwi75GDJ4k5kNTxmZBNAdxptXASLgJmKW8WWkBtqq1Wp1Ce1erYq cUIYfWu8TfzFoMmt32WTIcuwBtthMZOLo4y9bj4/a4v75KrpU1FEumUwjy0jYvxoKlGH etmg4jGm6GDjteZt6JgXGbEdlmEgBfjRmJh7G49/TxpyfoBS4pTnNnVBsBIl2vLK6nBm GbDF7Q8X5Yqnc/qx6sDhiGjG9tGrIcG3aa/M8fWVnpJv7Afk9M5FK8BjkpnN6ZK/Yr0T 6x5lBglGJ0VFL3uCu2+8tvYLDJMh9PY2/CszYvVXVOlxWltI3RXlnqB2TyxsLrF7xMgM IEiA== 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=nFd5xqVH3q6m9wbA0L1gjtHd9uu0jLkNi7kQpu3319ovViVUcscwz2RUQe8ONVNl/z d7EOndajvHaaIISDHDPkPNb68ZUZcAy7aYOIvWHHG7hfu6Bev94ukZvSYnZjfCMY39bH /iM9kgJzooGI4u4ekI1qw4N1gEq8+SEuSG6i5vhCFxeiIhOdzehLOxznzQkWSdNUITV4 d5Pep83G63YaS7v/1brQ9jGarBXM9U6RHhaJK0VFEU68KusuZVfiCoZ9Qza/9W2R6iXo v9xcwBqD+9tMJfvTq4pw/rTIgzY0TRtsFFP/anQ/Ic5voHGCMRGpfLbFLwK/1sm3lnq6 kIaw== X-Gm-Message-State: AOAM532gBcXZYLX8eKZ5WhC0vZUwNcwT1nzEbaIC6AVEozoMExSPqGyR AOibn+2nkOZqihOd/HChXkginPJh73xHsNbA X-Received: by 2002:a19:407:: with SMTP id 7mr5928439lfe.291.1604339400716; Mon, 02 Nov 2020 09:50:00 -0800 (PST) Received: from eriador.lan ([94.25.229.254]) by smtp.gmail.com with ESMTPSA id r7sm2516163lfc.206.2020.11.02.09.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 09:50:00 -0800 (PST) From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> To: Andy Gross <agross@kernel.org>, Bjorn Andersson <bjorn.andersson@linaro.org>, Rob Herring <robh+dt@kernel.org>, Zhang Rui <rui.zhang@intel.com>, Daniel Lezcano <daniel.lezcano@linaro.org>, Amit Kucheria <amitk@kernel.org>, Jonathan Cameron <jic23@kernel.org>, Hartmut Knaack <knaack.h@gmx.de>, Lars-Peter Clausen <lars@metafoo.de>, Peter Meerwald-Stadler <pmeerw@pmeerw.net> Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>, Jishnu Prakash <jprakash@qti.qualcomm.com>, Craig Tatlor <ctatlor97@gmail.com>, Jonathan Cameron <Jonathan.Cameron@huawei.com> Subject: [PATCH v9 02/15] fixp-arith: add a linear interpolation function Date: Mon, 2 Nov 2020 20:49:37 +0300 Message-Id: <20201102174950.1148498-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102174950.1148498-1-dmitry.baryshkov@linaro.org> References: <20201102174950.1148498-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <devicetree.vger.kernel.org> X-Mailing-List: devicetree@vger.kernel.org |
Series |
[v9,01/15] dt-bindings: thermal: qcom: add adc-thermal monitor bindings
|
expand
|
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