Message ID | 20201204025509.1075506-3-dmitry.baryshkov@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp817967ilb; Thu, 3 Dec 2020 18:56:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeg3CEAcF/g5SnCjxMkwD1bPn1wmSQRq3PyIMNihm5GIS0tkCK8xoGL2WskmShHtbqfhJB X-Received: by 2002:a05:6402:559:: with SMTP id i25mr5660399edx.128.1607050605091; Thu, 03 Dec 2020 18:56:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607050605; cv=none; d=google.com; s=arc-20160816; b=dbA5wDAdhT4+1pb+QnNoDJktE3NTnOWjlt6Gg3spRNWdsxwp7RZpMbusWxyU8hWNkH TuSFhRwidnnC+MXnARK7LpB8iMGGliaxAdzBsDf5RE0x1dkDbTmu+Ev/u0ZTKgsuWu56 ULzrD1/3/Eoj7SIGYc/2AiOIkxizcKAHPITtqO+3JqO/5R56nd/77Q+W1Ayb/xmfEQHP RRjg5eDat+GEt7AHzZITqABfS3VfN4pP5UjA5Dzc8VnKcjmnKTcJEXZoKL2XOZriyOtC dllm3j4qNH+/OIfLZ4I/Y/q5MM+4Qhs7g3iphPgNxuWRPEjWuU7ssipdsTl/DCKHTrQi NbDg== 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=4MAQUsN9uWY5ajUEroZxi+OKqjFgmfYZZ4/Px2YZkiI=; b=AC4wajrtQM75NmERxacr3y0BfaS8q8wzWl/xIUoBxGO5nbXRJgbCgjHDRXqUrYcnHp TGNx8ctBxn0UEvF4sobIXcYvOQsSyELBx8wefY1xGWwNGgZVt721Krk3Ujjg62t5esF2 SVFeuqQuNERczAmRELglxuy5SI1HhlPHh4G00VgLu/aGU00jxoToMWXr/MfrTwWMcmQ9 SWgfIJjhK+p5cusOdxigOa585Lg3bApamkX5taeokyGxYFjv1T8acXmMvoCF10ctIuuN gQ0yRXegCszmB3rfjEkGCxegoBbXDvqm0hR0HzCwopzJ1BXTdyuEZY6d9ujPH+UXO3a0 BQ2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qQ92WvbL; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <linux-pm-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si2202619edq.317.2020.12.03.18.56.44; Thu, 03 Dec 2020 18:56:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-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=qQ92WvbL; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 S1726920AbgLDC4j (ORCPT <rfc822;jun.nie@linaro.org> + 8 others); Thu, 3 Dec 2020 21:56:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbgLDC4j (ORCPT <rfc822;linux-pm@vger.kernel.org>); Thu, 3 Dec 2020 21:56:39 -0500 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 630F6C08E85E for <linux-pm@vger.kernel.org>; Thu, 3 Dec 2020 18:55:21 -0800 (PST) Received: by mail-lj1-x241.google.com with SMTP id y7so4910331lji.8 for <linux-pm@vger.kernel.org>; Thu, 03 Dec 2020 18:55:21 -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=4MAQUsN9uWY5ajUEroZxi+OKqjFgmfYZZ4/Px2YZkiI=; b=qQ92WvbLHygA9tYFlW/qVMiJlnWK1Okf7PjhTjzbbiNH8IuTFRwQkmHVZNHzoBywFz SbqTzuqyPUkNO5jGVBicTIQ+VJ0+PYpVbQtPeQRwm6vLgJCH66/gg/lwr+GUOogiGL7G bhKNRn1+/hq2u4CntZ7xKj+Y9/jC3W0x0VLbMrFgiwBIFimYsJKLdXXaAG8swhyAADOt 0ruXuZRs5uGuJOZlN8t6PHIe2P5OQh8iZ9QTRhTNQQAx3JhsNJWO762LHND9Zd3z/k/I 6SdZFaVZHuHG4Yq6SL1FpypMyIFW+zDiq7tf5HClBe7lqWHO65/1CbvEEW3TX+azVzGS HL6A== 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=4MAQUsN9uWY5ajUEroZxi+OKqjFgmfYZZ4/Px2YZkiI=; b=dTO1K9wrBs4igDycM+wuRBB8tU89nivJPYj73jwwYDBqQleZrQ1EIo7o5g8WTYomwZ RHkQtPaOVYVHBoG8iYZ6wn+BBqlrU78s6O8M/Un1HWNwssFLnCb6hofm8X2SNYOZhU5c LospXwSHAXGb1s8DA1FZCRYvucHSxN8YyXgYBpfRYMbPcq7841GgRcwLLKSQBUHuyiDz y7qXjo0Txt5FeIzJ2B0b+YNu3a84Otjxr95/VYX90lr7DMPkAhpnTWRQM46ipiNMjUPl D/rxHRvf24Y8OpT1QqIAiw7ldgvk/PUiYzYgen+8JSAk28P/x/7xzwzGwubUUxwJbnHs idUA== X-Gm-Message-State: AOAM530lcWWWiZafpN5/b2Did+jkTErFw25SFM6Zz01RRg5Lo3IwHfgu 0PANRin9PT35UavvmR7Hs/JZfw== X-Received: by 2002:a2e:2286:: with SMTP id i128mr2446984lji.396.1607050519844; Thu, 03 Dec 2020 18:55:19 -0800 (PST) Received: from eriador.lumag.spb.ru ([188.162.64.117]) by smtp.gmail.com with ESMTPSA id b8sm1131667ljo.68.2020.12.03.18.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 18:55:19 -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 v10 02/15] fixp-arith: add a linear interpolation function Date: Fri, 4 Dec 2020 05:54:56 +0300 Message-Id: <20201204025509.1075506-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204025509.1075506-1-dmitry.baryshkov@linaro.org> References: <20201204025509.1075506-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-pm.vger.kernel.org> X-Mailing-List: linux-pm@vger.kernel.org |
Series |
qcom: pm8150: add support for thermal monitoring
|
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