From patchwork Thu Jun 14 10:43:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 138544 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1940763lji; Thu, 14 Jun 2018 03:44:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJzMneK1xeigbJ/egjj1Wa5jNIcMOgymbXBcqGGAM+Xz1U3OgNOZijm5FcrO1KV1V48SgXu X-Received: by 2002:a17:902:b40f:: with SMTP id x15-v6mr2470467plr.270.1528973045953; Thu, 14 Jun 2018 03:44:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528973045; cv=none; d=google.com; s=arc-20160816; b=CdFDvQXYst3O4pq29Z5eq5dsJh8OVhrVslVmjuvxRpwNZey/lnk5l3P0vKNqMJoUNl b76eEcVMSgHuIgWdMyccjK35AOjO3P1A215aincVys5nRyMK+uyFW/DhRkaxQinRuKD4 DPgDwxsb210aECa0FpJvuGJWGofYU+OZSXactKFcfE7vTakC3QmuL0qU1EdEUR6cEhrT gXHNgD8XLDjj2BMYKB2aiyy7P/L/JS9ArOX8z/J16+7adV2U6GOW/12pg21VhuqIJP+j gjRCaVhDMuF5JuD2IOlWjfMrr6MMj97urKumTI7A3B/pdVuSeKKG/erl5ERXuHmd4u19 hDKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=79IlTt7LMeUKFlfd230WbPE21fWiEzhh7e4WAJs4pwE=; b=0ik9bI3WE0Yf2872z7G/tC7xlT910K1P0iq2TSitg7ivPl/tecXsYHaNbWRifQACvU zRShwgC+ZgAATeun639RZEid0r46og4grRhDLiBh6QZGcK15DtiVU/Utf3+GHjvtormL KXPkhEBLWrvRMX3O1f+iiuuMLOhdyTksQd+tUOvQAcT4o+lsq+zK2qPb2RRjM96aFtwm pYGGSSrdFgyYo1FJ7uVz/kwIk5PSSXDmnHlX9qIXU1w/adFki/T8gN5Ku4M5sPNBioQp ZQPCa07Kc1UzNz/UDdwfzyPN+Gf/hLXWb//+T+MkIiXxZpE+41iMwNmq0HyxZeRNvBzI hphQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EhLcvwF5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id y21-v6si4843958pfm.1.2018.06.14.03.44.05; Thu, 14 Jun 2018 03:44:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EhLcvwF5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1755113AbeFNKoE (ORCPT + 30 others); Thu, 14 Jun 2018 06:44:04 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:45045 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755102AbeFNKoB (ORCPT ); Thu, 14 Jun 2018 06:44:01 -0400 Received: by mail-lf0-f65.google.com with SMTP id 36-v6so8636940lfr.11 for ; Thu, 14 Jun 2018 03:44:01 -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 :in-reply-to:references; bh=79IlTt7LMeUKFlfd230WbPE21fWiEzhh7e4WAJs4pwE=; b=EhLcvwF51e+ZPnpx00WQ9NvTdBWZRTYsULr16qZp96G278PsdBkIIFjJ88DGcF3cI2 tyd1kYbuPlOl9flhJmd4/DzZHnMjxTqvuo9gP0QcCdq1PmSfUKM2zB1ay3U5LVAXyiKq EmEOO67Ng1Q5/ZfiJG04yf6IhBdvZRC7qepPg= 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:in-reply-to:references; bh=79IlTt7LMeUKFlfd230WbPE21fWiEzhh7e4WAJs4pwE=; b=VQnkSYKtTEGtZQDuAEuUcZTxwFacyJkUlh6DJ2DrZPG4smHbmmN57alXTQytyNuclt w460N5N1aYx1whAUOo0DXZVrisCIfhEQUv8dV9GgEL5P5Vd9EHah20+E8jbX/wF3jRdT 0wdBlLBOkylDrarhJHfNhSKorNRs8hjVY37BFYL+DCl2CI/R8Efc3VIviaD1rurRDr5v 0KKAa/1K215Lpa9ff3yr0mZkf+cmR3X4acqenKINoTkoMaZrif47BrSDFtK7ipDcZy2V /E64w1U5R+YXT9Tl9cB0gE9jR12mb4e6GEGRicBdRzq4gLWZ4CEF5ICai3WGIHNvC9c6 lhDg== X-Gm-Message-State: APt69E1XWVRyFaclZJrklZIBUds4OYK87zjaFyfGYjbhuO3JeqccoWYr /J1aoXBEyRLramBdWhkEFE+9JiAHEhI= X-Received: by 2002:a2e:635b:: with SMTP id x88-v6mr1478142ljb.103.1528973040056; Thu, 14 Jun 2018 03:44:00 -0700 (PDT) Received: from localhost (85-76-96-172-nat.elisa-mobile.fi. [85.76.96.172]) by smtp.gmail.com with ESMTPSA id d6-v6sm893297ljd.52.2018.06.14.03.43.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 03:43:59 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, smohanad@codeaurora.org, vivek.gautam@codeaurora.org, andy.gross@linaro.org, Zhang Rui , linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH v3 3/6] thermal: tsens: Rename tsens-8996 to tsens-v2 for reuse Date: Thu, 14 Jun 2018 13:43:13 +0300 Message-Id: <44df951a0e13aa0b313e3dbcdf4e0b313c5893e2.1528972165.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The TSENS block inside the 8996 is internally classified as version 2 of the IP. Several other SoC families use this block and can share this code. Also, rename get_temp() to reflect that it can be used across the v2 family. Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/Makefile | 2 +- drivers/thermal/qcom/{tsens-8996.c => tsens-v2.c} | 26 ++++++++--------------- 2 files changed, 10 insertions(+), 18 deletions(-) rename drivers/thermal/qcom/{tsens-8996.c => tsens-v2.c} (66%) -- 2.7.4 diff --git a/drivers/thermal/qcom/Makefile b/drivers/thermal/qcom/Makefile index 2cc2193..a821929 100644 --- a/drivers/thermal/qcom/Makefile +++ b/drivers/thermal/qcom/Makefile @@ -1,2 +1,2 @@ obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o -qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o +qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-v2.o diff --git a/drivers/thermal/qcom/tsens-8996.c b/drivers/thermal/qcom/tsens-v2.c similarity index 66% rename from drivers/thermal/qcom/tsens-8996.c rename to drivers/thermal/qcom/tsens-v2.c index e1f7781..c981a40 100644 --- a/drivers/thermal/qcom/tsens-8996.c +++ b/drivers/thermal/qcom/tsens-v2.c @@ -1,27 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * + * Copyright (c) 2018, Linaro Limited */ -#include #include #include "tsens.h" -#define STATUS_OFFSET 0x10a0 -#define LAST_TEMP_MASK 0xfff +#define STATUS_OFFSET 0xa0 +#define LAST_TEMP_MASK 0xfff #define STATUS_VALID_BIT BIT(21) #define CODE_SIGN_BIT BIT(11) -static int get_temp_8996(struct tsens_device *tmdev, int id, int *temp) +static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) { struct tsens_sensor *s = &tmdev->sensor[id]; u32 code; @@ -73,12 +64,13 @@ static int get_temp_8996(struct tsens_device *tmdev, int id, int *temp) return 0; } -static const struct tsens_ops ops_8996 = { +static const struct tsens_ops ops_v2 = { .init = init_common, - .get_temp = get_temp_8996, + .get_temp = get_temp_tsens_v2, }; const struct tsens_data data_8996 = { .num_sensors = 13, - .ops = &ops_8996, + .ops = &ops_v2, }; +