From patchwork Thu Aug 9 12:32:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 143836 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2038777ljj; Thu, 9 Aug 2018 05:33:26 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxQsHsaKTLqYaKyBhaMcGUG6917ko+Jn+vpJSFxadykGxtDBpgaE0MrgOI1tKt7grxq6TkV X-Received: by 2002:a65:6086:: with SMTP id t6-v6mr2042770pgu.424.1533818006682; Thu, 09 Aug 2018 05:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533818006; cv=none; d=google.com; s=arc-20160816; b=gn7IgpCrOcsdOeZKC8xSDhMiGZzI+4OZpQHyTuUfYSOe+J4tDx4etWK2whQXJ/k4hx Xx5n2Ag44A118hjzGy3Qvr8GmE6MFeti4vCrqxQmD0lbmG3F5mGmwy7NXd9AYyX2vJRG KlRAaiqpR+GzcMN3yq5tZi3pfYfBUv8GyO4RVuIxXV6+jf36Y/AIHtrAVuKicz5Xtnwc oCDVVHQGlGAByHwOY9amTWTWLIboCAOgzDL1U+TajogY3M3Xsl/39dTrkK7VBEo+3n6O fV+Zogv96ZfNQtY72YsEgVIS++pI6N0x21USby+8J1zsEcgIod+5bHkhDTdKVcYsplC/ 2C+g== 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=Gct4lOuxYFWJ5iMbse3TfLVgnZuyuNabzMoHh2gRRuQ=; b=wVyq1qdiaQxAsMgk2zdQ8WPed2Y4BPyFbWYYrzK404EcxI6G63t8cvRs/nxrK0a67G 78iRwoARtaQs/PyVnIV5urNIxYcvPK1qbAi3DRLO0dkKfk5XJpuBcsiJUoN9cIAcdnHa 5LIJ8mkFSsFTnvRLg08TeBTwKsY6PXuuugQXUgish6Dy6LSKtUyNMKTsfWpMVkp3qvbM PD+sQd7WFGCAcwkWpsMWcbMYZmdpI0LvisnahVV5lK1D7IQjfSMN57wTIIQ8xnmk/EGb TJkx1wBQ3rZL/eM6+oJWQ/e3QCiEYhwPr3+QBYM3gpr7qWvSvjCjtUzXD2pQtO/LWHHy Gf+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SngJGovQ; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 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: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si5902794pgn.556.2018.08.09.05.33.26; Thu, 09 Aug 2018 05:33:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=SngJGovQ; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 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 S1732270AbeHIO6G (ORCPT + 10 others); Thu, 9 Aug 2018 10:58:06 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34568 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731065AbeHIO6G (ORCPT ); Thu, 9 Aug 2018 10:58:06 -0400 Received: by mail-pg1-f195.google.com with SMTP id y5-v6so2703265pgv.1 for ; Thu, 09 Aug 2018 05:33:24 -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=Gct4lOuxYFWJ5iMbse3TfLVgnZuyuNabzMoHh2gRRuQ=; b=SngJGovQLy8KurtU6+ZIVcvxJ39PFS30jXQoqitXwU65m9c/yrARDeWfwwpnl7Z5HE VrcAh/dNNHLxiz2mdxOhTNKnpCLLEcaGcZDeBsF/IgizgMBqqKFf1ncFtwT3Sh1GDZmL 7knOvcTABQXmO1PSnC7s7LI8MbJWsFwaSG6Ps= 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=Gct4lOuxYFWJ5iMbse3TfLVgnZuyuNabzMoHh2gRRuQ=; b=q/nL89MY7c999RIhfyL8vNXv0xOd+Lm1FBn63J8ED33sqJp9qxdCNaIOf67Q+ejhkA aU2q1Hsc62laR3Iogwo2xcDHFdmWNebQLJd10uS9YEFXtc1MYVV+EZVlf0ANs6XmaoOv oOBuLMfvoRwCfyQ6azh435j9SEHmM4cjI3/RxQIEJQ4Q0F6DzOMF/14TnPjiWPPY1RBU gPuENKCY83AwlDkGl/OpGfUdzveRr4WXsTnv+VxElkRiTRr8OcpWPDcFTCoGcGrrVyO0 ApXdsK8rCQrAODx50wsFvfl6rtxe76/PMsLT5yMblTWCWh8BGH/rp7sceMX/TzijWQaU Z+lw== X-Gm-Message-State: AOUpUlHarx2Ii3XQ7KEhTOIpKGwP1g7jLwxOU1bnKhw+6phm1jCrjZnf cAjyGoMi7RlDTNp/qS4QI+Ijpg== X-Received: by 2002:a62:5e45:: with SMTP id s66-v6mr2216120pfb.129.1533818004405; Thu, 09 Aug 2018 05:33:24 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id n9-v6sm12201171pfg.21.2018.08.09.05.33.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:23 -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, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v1 08/10] thermal: tsens: Get rid of 'id' field Date: Thu, 9 Aug 2018 18:02:40 +0530 Message-Id: <3810cbe6b499d265d7e3fb97c408cb80a12d5850.1533815718.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The hw_id field in 'struct tsens_sensor' can do the job of tracking unique ids for each sensor connected to each tsens device instance. It also allows hw_ids to be overridden (e.g. 8916) in cases where some sensors in a sequence are disabled on a particular platform. Use the hw_id field instead of the id field consistently across the tsens code. While, we're at it, document the fields of struct tsens_sensor. Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens.c | 5 ++--- drivers/thermal/qcom/tsens.h | 10 +++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 9a8e8f7b4ae1..fb728ec5d77f 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -17,7 +17,7 @@ static int tsens_get_temp(void *data, int *temp) const struct tsens_sensor *s = data; struct tsens_device *tmdev = s->tmdev; - return tmdev->ops->get_temp(tmdev, s->id, temp); + return tmdev->ops->get_temp(tmdev, s->hw_id, temp); } static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend) @@ -26,7 +26,7 @@ static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend) struct tsens_device *tmdev = s->tmdev; if (tmdev->ops->get_trend) - return tmdev->ops->get_trend(tmdev, s->id, trend); + return tmdev->ops->get_trend(tmdev, s->hw_id, trend); return -ENOTSUPP; } @@ -83,7 +83,6 @@ static int tsens_register(struct tsens_device *tmdev) for (i = 0; i < tmdev->num_sensors; i++) { tmdev->sensor[i].tmdev = tmdev; - tmdev->sensor[i].id = i; tzd = devm_thermal_zone_of_sensor_register(tmdev->dev, i, &tmdev->sensor[i], &tsens_of_ops); diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index b9c4bcf255fa..2a3174dfc1a9 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -14,11 +14,19 @@ struct tsens_device; +/** + * struct tsens_sensor - sensor-specific data + * @tmdev: tsens device instance this sensor is connected to + * @tzd: thermal zone corresponding to this sensor + * @offset: offset from calibration data to convert ADC data to degrees + * @hw_id: unique sensor ID for each sensor connected to tsens device instance + * @slope: slope from calibration data to convert ADC data to degrees + * @status: 8960-specific status register addresses + */ struct tsens_sensor { struct tsens_device *tmdev; struct thermal_zone_device *tzd; int offset; - int id; int hw_id; int slope; u32 status;