From patchwork Mon Jul 9 11:27:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 141381 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2548604ljj; Mon, 9 Jul 2018 04:28:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc0ZyXCuxfgV5P1ufEOgKg+UcK6HQg6xv7xFz89Eyt/988VEIMlcKv55rlnf9brMKlu1Lod X-Received: by 2002:a63:4203:: with SMTP id p3-v6mr18533363pga.184.1531135725524; Mon, 09 Jul 2018 04:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531135725; cv=none; d=google.com; s=arc-20160816; b=wjIi9dnD6L5BG3wteTZIq8b419iu4mACRs3OdHgwa5KJx1pi1bRVQdvlnjmtbqTG9e k4xdC0vvPPHPV8OHGGaG+TY2XYyZM2ivvUqnsohWyaGBXwPo4ryWqe5Yw69iIjos9Ixt MGOx6xIoZHWafeSbLoUh5456IJe01Qws96NBIyQYVJci4d1QB3cOpkvoku/RO9hbHp6a CTtmJ76pZ3W+2xEMAKLwuTfV4Nqko3g/I7tkjPhd2JKqjU+h5jq/b/tXAg8aXBUcoBA0 oJ+ogZE+ff+TE9YGb/fV7A/iH1XNfu13rChYwumJzsHqU0qaKV0IGoB/fvhIWP+yIrYC 3X2w== 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=2kQdfwaob3qy9LVH8RWOXrQk/39YsJ9FerONY2LPNaY=; b=kITtDp5x28ANtmxB0l8UaEglBmuQwZfXB9VUSjtQg84OrZG4trd4b/etI29OO0Pykf ASBrWrYaz/CW7S4ZjvSYVvR8Z1BvjOKUMpzNGU38AJ5cjc1Y8of4PFsM4duOHMxuTDv5 4emxoF34UqzY0Z94uqunkACC8OpYv7E+akep5Xm+rXGXojrxprtDJrm+lAkKqOV9u7xr RpwiLv1fCrE6iYGcVK0881p8cgYHLgnKglMe/s3Io5smrSTc6uDbBB9Ef4WegVLucFYD Av5PNPF9efB1PPwtPHK3wIarBmFJyfIzgH76ZL4pSABOom1jcEBDH7hCXXvH3Unz/frT GRKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fesnksgh; 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 h25-v6si9711323pgh.119.2018.07.09.04.28.45; Mon, 09 Jul 2018 04:28:45 -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=fesnksgh; 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 S932961AbeGIL2n (ORCPT + 31 others); Mon, 9 Jul 2018 07:28:43 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33199 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932743AbeGIL2k (ORCPT ); Mon, 9 Jul 2018 07:28:40 -0400 Received: by mail-wr1-f66.google.com with SMTP id g6-v6so1687424wrp.0 for ; Mon, 09 Jul 2018 04:28:40 -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=2kQdfwaob3qy9LVH8RWOXrQk/39YsJ9FerONY2LPNaY=; b=fesnksgh9Wby/1TIewrpFCuj4BsrRm3XPYMKQLrDJNpgDBYJxhTN9pFcQufX9yQ2Jf d/bldwSdJQTypHgF4BhDW/e2CO2Xw+RYCSNagUSS696/PNqLqKUEL3ORZZIiiogwN6o+ jHOAqq+0zNYlL+Z2jwfuNYccvmOfJ5iRdAuG4= 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=2kQdfwaob3qy9LVH8RWOXrQk/39YsJ9FerONY2LPNaY=; b=gRurexUAq7jwF7KqQkJMEJwX7f1ixjqaHch8RrmY9qd3rUdYVm4j8lr+LgWpWzB1Sq mbgYz+E7ktKRtlbJ20YcQJMTIU4JAzz71WfJpKrW3cQ0fSY2TlN/q6LXKcCxNOW+GO+I qgz9fmUyF8tzfkcXbHS7qhjGiV1U2TekTq3FWcnOAFYe3b5Vgi0qu5JUb+JOwGuSLoPn 6nUinO6g50HqBclWCE18aGII8f+ZMFG3oznuFV026iZVDbdKC2DRn0dotyGBSCuXXRtt yucnsz/VKclvdJWfWgp67Ptf+4q11AwUcnheRczEVI4Stdw4IH/SjBFlMzHVIEkfO8iT 8kag== X-Gm-Message-State: APt69E3ZxXflThsNf2ELFEG3URsMIU+jckEP+bUe3aGCjldJDvORgiyr 3H+FcxAoPE3ZTp+AaiBZzMTVo0TYzsU= X-Received: by 2002:adf:adae:: with SMTP id w43-v6mr15368407wrc.251.1531135719301; Mon, 09 Jul 2018 04:28:39 -0700 (PDT) Received: from localhost ([49.248.189.240]) by smtp.gmail.com with ESMTPSA id y203-v6sm14585462wme.42.2018.07.09.04.28.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 04:28:38 -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 Subject: [PATCH v5 4/7] thermal: tsens: Rename tsens-8996 to tsens-v2 for reuse Date: Mon, 9 Jul 2018 16:57:37 +0530 Message-Id: <910ed3e440a5612f4113318c66ae2395f53abaae.1531133612.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. We 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 60765b1..34ba6c7 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_generic_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_generic_v2, }; +