From patchwork Tue Sep 25 09:03:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 147407 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp472139lji; Tue, 25 Sep 2018 02:03:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV61O6sKyQqwQzwJAdII9s5Gv3b2JjcSxRBivIhxWRgG949D/GXHe3zxs8bO5SME6VPtpd/QX X-Received: by 2002:a62:db46:: with SMTP id f67-v6mr37159pfg.1.1537866229651; Tue, 25 Sep 2018 02:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537866229; cv=none; d=google.com; s=arc-20160816; b=pr/1lNxmDg3g8DHmCrc7nrG/ALvjz0SZ53HjlP7FRnC9lUMhBy7D8yOCMyUneky/je pK6jfTz3AmKvt9ePk/EzE1kNijGz7Ro4BpTuFc0jK20nk9fAOtZw3E3VFBfywFMmN6HO im0V1ub5E7ieGOxPxjKsBgTFd0xr0NpOR/cqpfEtA+kFamGzNSbqY/jRYN8LlyjFt2WQ TpOk0/EkDLyYKA31lMLLiV3NVrBBGGXYMnPkkDLcTBwbgALjNmcpHa6El19f49h399vt 7yxGXwg6qr4l9h5CIYnMMh03btk/F+AdWXP4thh5xQ2LtGNLloiudPh96hmEvgrHvhT9 51pA== 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:message-id:date :subject:cc:to:from:dkim-signature; bh=JKtye1UkuEcXKPFhNVW7GNxXrGnc1c47iAdiNPq2Uxg=; b=Qa+1qbnPmW22y6FuUn+Y6smI7nEyiam5gl+sTOimWNssqIRvOvSZU8IcAITzHT73Ov lEWA0D512KpblcdOvCLKjG0uurQr+iIyLuTvT50MNu/knd51kDUKm9z735YxZopuiQpy aZu5WQQie4L2ZUZQWcVBtY68uHlLKFpTTsEuVS/jVddTn/C4HhVl/gQ+g3Jm9cQtxWzC kgbZNPwlaAMKyIh37RFYbr26cKGwpttdwCE4KVKv7CwfgpcuI0A8Heq49xjSogXasIpw Qk3wfzx9EFp13iyF+GL1P+7nncCSOIoN4GM8a2E8lYjoYoAG0N+u8oPOJRO6f/2MsaCV a7xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cbdFeuBr; 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 3-v6si1873633plx.173.2018.09.25.02.03.49; Tue, 25 Sep 2018 02:03:49 -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=cbdFeuBr; 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 S1728543AbeIYPKU (ORCPT + 32 others); Tue, 25 Sep 2018 11:10:20 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:35470 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727678AbeIYPKT (ORCPT ); Tue, 25 Sep 2018 11:10:19 -0400 Received: by mail-wr1-f67.google.com with SMTP id o16so9157172wrx.2 for ; Tue, 25 Sep 2018 02:03:46 -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; bh=JKtye1UkuEcXKPFhNVW7GNxXrGnc1c47iAdiNPq2Uxg=; b=cbdFeuBrE/DKJJz1QSZJFGPjEAFse41UeHzPKMZERRGt78pGqap+46Di+4OVPQcwzE l6jZrWxI0t16pbiLxIBXRHXKQZh+1cJgRSvKvA4223WBrOP7jJw9txR+eBP5fzsDoxC1 wDgRHAuoHLqv4a0XOIhNGzjKfsHOWV2R9cHJI= 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; bh=JKtye1UkuEcXKPFhNVW7GNxXrGnc1c47iAdiNPq2Uxg=; b=fce6h2nGMn7fPFswUlS5y35E2XhAMe4EB7UZWvWhOdpKqBQWNZhQ6oEggFzBio5Z8S NgyEa2suR8UpF1mWfxMEnjiIQP75nsSJ56S1qRk8Es0jTc4TUO4DdWdPkwalHG7GcIoI fyfKpenIvCg1RQ5pvULzFNHqpvmBrvosFgWvnLAQeC7Ch2Chu8Qpa/TCZVpqkm5ThDzm 5tOsqY4jyCuCD1QrNeVHGr675ORD0s/mhBmWopFfzOVgy0XaNNmQ3oPb4Xesda3DmmoF 69TZ6Ga5QPaItLYG1Jkwcv7b2AJvJNMBIPYhv3NvhuAgFTQsTr8hBNY+KYMFmAidfSKC rOpw== X-Gm-Message-State: ABuFfojLWZR/VG9YQMoRG7avzmhd1nxivwQEFqF7/lsjyvj02bJnWjJq U6l7RFvSRc6XLMRk7W3A0X2K+w== X-Received: by 2002:adf:80a3:: with SMTP id 32-v6mr1131wrl.231.1537866225446; Tue, 25 Sep 2018 02:03:45 -0700 (PDT) Received: from localhost.localdomain (251.150.136.77.rev.sfr.net. [77.136.150.251]) by smtp.gmail.com with ESMTPSA id y206-v6sm1523828wmg.14.2018.09.25.02.03.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Sep 2018 02:03:42 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, leo.yan@linaro.org, Zhang Rui Subject: [PATCH 02/14] thermal/drivers/hisi: Change the driver to be sensor oriented Date: Tue, 25 Sep 2018 11:03:00 +0200 Message-Id: <1537866192-12320-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> References: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to support multiple sensors, we have to change the code to deal with sensors and not the hisi thermal structure. Add a back pointer to the hisi thermal structure (containerof is not a good option because later we convert the sensor field to a pointer). Change the functions parameters to take a sensor instead of this hisi thermal 'data' structure. Signed-off-by: Daniel Lezcano --- drivers/thermal/hisi_thermal.c | 72 ++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 30 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 9794cfe..1fdda55 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -58,27 +58,28 @@ #define HI6220_DEFAULT_SENSOR 2 #define HI3660_DEFAULT_SENSOR 1 +struct hisi_thermal_data; + struct hisi_thermal_sensor { + struct hisi_thermal_data *data; struct thermal_zone_device *tzd; uint32_t id; uint32_t thres_temp; }; -struct hisi_thermal_data; - struct hisi_thermal_ops { - int (*get_temp)(struct hisi_thermal_data *data); - int (*enable_sensor)(struct hisi_thermal_data *data); - int (*disable_sensor)(struct hisi_thermal_data *data); - int (*irq_handler)(struct hisi_thermal_data *data); + int (*get_temp)(struct hisi_thermal_sensor *sensor); + int (*enable_sensor)(struct hisi_thermal_sensor *sensor); + int (*disable_sensor)(struct hisi_thermal_sensor *sensor); + int (*irq_handler)(struct hisi_thermal_sensor *sensor); int (*probe)(struct hisi_thermal_data *data); }; struct hisi_thermal_data { const struct hisi_thermal_ops *ops; + struct hisi_thermal_sensor sensor; struct platform_device *pdev; struct clk *clk; - struct hisi_thermal_sensor sensor; void __iomem *regs; int irq; }; @@ -273,30 +274,40 @@ static inline void hi6220_thermal_hdak_set(void __iomem *addr, int value) (value << 4), addr + HI6220_TEMP0_CFG); } -static int hi6220_thermal_irq_handler(struct hisi_thermal_data *data) +static int hi6220_thermal_irq_handler(struct hisi_thermal_sensor *sensor) { + struct hisi_thermal_data *data = sensor->data; + hi6220_thermal_alarm_clear(data->regs, 1); return 0; } -static int hi3660_thermal_irq_handler(struct hisi_thermal_data *data) +static int hi3660_thermal_irq_handler(struct hisi_thermal_sensor *sensor) { - hi3660_thermal_alarm_clear(data->regs, data->sensor.id, 1); + struct hisi_thermal_data *data = sensor->data; + + hi3660_thermal_alarm_clear(data->regs, sensor->id, 1); return 0; } -static int hi6220_thermal_get_temp(struct hisi_thermal_data *data) +static int hi6220_thermal_get_temp(struct hisi_thermal_sensor *sensor) { + struct hisi_thermal_data *data = sensor->data; + return hi6220_thermal_get_temperature(data->regs); } -static int hi3660_thermal_get_temp(struct hisi_thermal_data *data) +static int hi3660_thermal_get_temp(struct hisi_thermal_sensor *sensor) { - return hi3660_thermal_get_temperature(data->regs, data->sensor.id); + struct hisi_thermal_data *data = sensor->data; + + return hi3660_thermal_get_temperature(data->regs, sensor->id); } -static int hi6220_thermal_disable_sensor(struct hisi_thermal_data *data) +static int hi6220_thermal_disable_sensor(struct hisi_thermal_sensor *sensor) { + struct hisi_thermal_data *data = sensor->data; + /* disable sensor module */ hi6220_thermal_enable(data->regs, 0); hi6220_thermal_alarm_enable(data->regs, 0); @@ -307,16 +318,18 @@ static int hi6220_thermal_disable_sensor(struct hisi_thermal_data *data) return 0; } -static int hi3660_thermal_disable_sensor(struct hisi_thermal_data *data) +static int hi3660_thermal_disable_sensor(struct hisi_thermal_sensor *sensor) { + struct hisi_thermal_data *data = sensor->data; + /* disable sensor module */ - hi3660_thermal_alarm_enable(data->regs, data->sensor.id, 0); + hi3660_thermal_alarm_enable(data->regs, sensor->id, 0); return 0; } -static int hi6220_thermal_enable_sensor(struct hisi_thermal_data *data) +static int hi6220_thermal_enable_sensor(struct hisi_thermal_sensor *sensor) { - struct hisi_thermal_sensor *sensor = &data->sensor; + struct hisi_thermal_data *data = sensor->data; int ret; /* enable clock for tsensor */ @@ -352,10 +365,10 @@ static int hi6220_thermal_enable_sensor(struct hisi_thermal_data *data) return 0; } -static int hi3660_thermal_enable_sensor(struct hisi_thermal_data *data) +static int hi3660_thermal_enable_sensor(struct hisi_thermal_sensor *sensor) { unsigned int value; - struct hisi_thermal_sensor *sensor = &data->sensor; + struct hisi_thermal_data *data = sensor->data; /* disable interrupt */ hi3660_thermal_alarm_enable(data->regs, sensor->id, 0); @@ -432,7 +445,7 @@ static int hisi_thermal_get_temp(void *__data, int *temp) struct hisi_thermal_data *data = __data; struct hisi_thermal_sensor *sensor = &data->sensor; - *temp = data->ops->get_temp(data); + *temp = data->ops->get_temp(sensor); dev_dbg(&data->pdev->dev, "id=%d, temp=%d, thres=%d\n", sensor->id, *temp, sensor->thres_temp); @@ -450,7 +463,7 @@ static irqreturn_t hisi_thermal_alarm_irq_thread(int irq, void *dev) struct hisi_thermal_sensor *sensor = &data->sensor; int temp = 0; - data->ops->irq_handler(data); + data->ops->irq_handler(sensor); hisi_thermal_get_temp(data, &temp); @@ -470,10 +483,10 @@ static irqreturn_t hisi_thermal_alarm_irq_thread(int irq, void *dev) } static int hisi_thermal_register_sensor(struct platform_device *pdev, - struct hisi_thermal_data *data, struct hisi_thermal_sensor *sensor) { int ret, i; + struct hisi_thermal_data *data = sensor->data; const struct thermal_trip *trip; sensor->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, @@ -549,21 +562,20 @@ static int hisi_thermal_probe(struct platform_device *pdev) data->pdev = pdev; platform_set_drvdata(pdev, data); - + data->sensor.data = data; data->ops = of_device_get_match_data(dev); ret = data->ops->probe(data); if (ret) return ret; - ret = hisi_thermal_register_sensor(pdev, data, - &data->sensor); + ret = hisi_thermal_register_sensor(pdev, &data->sensor); if (ret) { dev_err(dev, "failed to register thermal sensor: %d\n", ret); return ret; } - ret = data->ops->enable_sensor(data); + ret = data->ops->enable_sensor(&data->sensor); if (ret) { dev_err(dev, "Failed to setup the sensor: %d\n", ret); return ret; @@ -591,7 +603,7 @@ static int hisi_thermal_remove(struct platform_device *pdev) hisi_thermal_toggle_sensor(sensor, false); - data->ops->disable_sensor(data); + data->ops->disable_sensor(&data->sensor); return 0; } @@ -601,7 +613,7 @@ static int hisi_thermal_suspend(struct device *dev) { struct hisi_thermal_data *data = dev_get_drvdata(dev); - data->ops->disable_sensor(data); + data->ops->disable_sensor(&data->sensor); return 0; } @@ -610,7 +622,7 @@ static int hisi_thermal_resume(struct device *dev) { struct hisi_thermal_data *data = dev_get_drvdata(dev); - return data->ops->enable_sensor(data); + return data->ops->enable_sensor(&data->sensor); } #endif From patchwork Tue Sep 25 09:03:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 147408 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp472230lji; Tue, 25 Sep 2018 02:03:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV62tewwbjdTiWv3u98QOrqos4jvERga7tK1LD77HVLpryrOZocZrAF08zPL5BPHgn3KEYklW X-Received: by 2002:a63:4950:: with SMTP id y16-v6mr111308pgk.32.1537866234756; Tue, 25 Sep 2018 02:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537866234; cv=none; d=google.com; s=arc-20160816; b=xg8vm0pEfuhPCNnfSnrammvy2hWODr/qwE/m24r7t2wqKB6la8XGFmLPP1d/pJccbE ARLst1cgoMNmrWyaN358wGeAZoLSXrc5RBG7yW0MjfpfnzYOnM8OLeqr48pla8CJSkjl P6v7meKpRNgeLSxTCbexFA6zzUUE7jj8BotFLS7iu13ZUN4eJCPwS8h93E6XnskRIufB DGFXNNCJHYR/xo81sOaSO1HprF8XJDHOfkBc6Fg9AIzZNdaFfqp2X61mODoSIJSmWedz KtkZaH6qlCJosPDyQwzQiy2YbFlHqDx3yzsw39fVo0rStwUL4hAwVQ60j6XlOkY/++2i RhKA== 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:message-id:date :subject:cc:to:from:dkim-signature; bh=HwYZFcnFZ79mwFslZ96x0gM5YC++omWUey3iWIx22vk=; b=PjO9Nc1cEVHOvlcSG7QymDFkPhTzcHoVulxPlia35lVopnlmr09VjSb/xRMBQTVFMG XlBsNQehqxj6oe9vOxD39crnbrrIeRY+Oi57s2/tz89BpDGSWg+0IEZW5aC65No84tVG kfBUh9mCsMRsqUFITcGbiOM3bO2W95telh/J1loTSZicoJ6P5r4dw97p3VZBxuqTT9B8 eZxsqGbJxspZPs7m2knM1ah3K3s42Ehlho9nRQ4DWsV0rt0bvsoaycykWzTylnkoeQgQ jQ3qtjY9Tu5AAAzkJEZ+uZpzPH3oTUBvzCc03QXO5pHaA89oVTWL+PXEad+E9Pjc8672 FsLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZC9Ti9Kh; 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 cb8-v6si1602909plb.178.2018.09.25.02.03.53; Tue, 25 Sep 2018 02:03:54 -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=ZC9Ti9Kh; 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 S1728652AbeIYPKY (ORCPT + 32 others); Tue, 25 Sep 2018 11:10:24 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54174 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728580AbeIYPKX (ORCPT ); Tue, 25 Sep 2018 11:10:23 -0400 Received: by mail-wm1-f67.google.com with SMTP id b19-v6so12515693wme.3 for ; Tue, 25 Sep 2018 02:03:50 -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; bh=HwYZFcnFZ79mwFslZ96x0gM5YC++omWUey3iWIx22vk=; b=ZC9Ti9KhOgRCMuao2UPV1SrhW3WxdLEqc3hqIXa9RS5QGznBokFYD8lvQLEELTz0gs GjJ3B2Z8QwPivFTCfPGj2YY0Ep1gT1MW+JftbeFy9zVidQbPIvUkKZX0kkJx0n45gTnJ 4I4UIcTGjhDE8IO12oWJ5XjdJeiTWbGp7TXcE= 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; bh=HwYZFcnFZ79mwFslZ96x0gM5YC++omWUey3iWIx22vk=; b=j6T4328sG0EM02LKUb1geVlCfuaVugxIFlaBGY7f7bNLgW5u4GaCGrKBBhh53pvuZz HabPr2EeVyZy7nEAZQuOFzT9u5r6ZOIop+WvtgIhhNt//X9dqo7+PwkQVrifUUnaJy1E fltDLXlEDDI7wmWsTu0dotTaC/ao8kFJ3V5F4LqkE25v/Aa0PHteQxEbuzo7TH9C4Rdf nckY5wi7EgEEOQQ8JDQ964FDTVQ5NtGfQAz3WBD1cn0+TBtD5Euud8OB/lZL+ggmHQyX T3FsiesEkzHbfUH3KywSwuW9w0XW/UWxK/mAto1tnBCQmZ3HcHnQOEFMkv4zBs/YgXmv PXEQ== X-Gm-Message-State: ABuFfojLLek55CB+eWkhKbflJzp4eHrleAjlg8pC8TIz7WoevZ2Hqfip eVvduVwmn1wOCyC19Yf9tqILM+b20+w= X-Received: by 2002:a1c:9355:: with SMTP id v82-v6mr60555wmd.128.1537866229953; Tue, 25 Sep 2018 02:03:49 -0700 (PDT) Received: from localhost.localdomain (251.150.136.77.rev.sfr.net. [77.136.150.251]) by smtp.gmail.com with ESMTPSA id y206-v6sm1523828wmg.14.2018.09.25.02.03.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Sep 2018 02:03:47 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, leo.yan@linaro.org, Zhang Rui Subject: [PATCH 03/14] thermal/drivers/hisi: Set the thermal zone private data to the sensor pointer Date: Tue, 25 Sep 2018 11:03:01 +0200 Message-Id: <1537866192-12320-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> References: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Store the sensor pointer in the thermal zone private data and use it in the callback functions. That allows to continue the conversion to sensor oriented code where the pointers are the sensors. Signed-off-by: Daniel Lezcano --- drivers/thermal/hisi_thermal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 1fdda55..567fde6 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -442,8 +442,8 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data) static int hisi_thermal_get_temp(void *__data, int *temp) { - struct hisi_thermal_data *data = __data; - struct hisi_thermal_sensor *sensor = &data->sensor; + struct hisi_thermal_sensor *sensor = __data; + struct hisi_thermal_data *data = sensor->data; *temp = data->ops->get_temp(sensor); @@ -465,7 +465,7 @@ static irqreturn_t hisi_thermal_alarm_irq_thread(int irq, void *dev) data->ops->irq_handler(sensor); - hisi_thermal_get_temp(data, &temp); + hisi_thermal_get_temp(sensor, &temp); if (temp >= sensor->thres_temp) { dev_crit(&data->pdev->dev, "THERMAL ALARM: %d > %d\n", @@ -486,11 +486,10 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev, struct hisi_thermal_sensor *sensor) { int ret, i; - struct hisi_thermal_data *data = sensor->data; const struct thermal_trip *trip; sensor->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, - sensor->id, data, + sensor->id, sensor, &hisi_of_thermal_ops); if (IS_ERR(sensor->tzd)) { ret = PTR_ERR(sensor->tzd); From patchwork Tue Sep 25 09:03:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 147413 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp472925lji; Tue, 25 Sep 2018 02:04:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV61gm/RZmNsS8SCoBodWc4FMVYsDhn0KtRU3irGg1CP5FQ3ZZnp9Tnk+hnNfBftTZOvZtjcc X-Received: by 2002:a63:8742:: with SMTP id i63-v6mr73525pge.27.1537866277204; Tue, 25 Sep 2018 02:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537866277; cv=none; d=google.com; s=arc-20160816; b=hLtWDmlYwCS/i3FV1l6kvNFhF3ftkiKP02wbzfD69I7a912ojlKPZVcRpIXzjx12ek PG3f40Hgp3Qhp7JpBVY1yLiWVrZF8VOU5taAvKmVqD/GLyf1871Xqxkhd/BP6FByHUtY C6ubIxct953imyvP1S8Jl0BKIzdEOR9Uhid75ZgMFut9f5uTHTjqv1gpPSQqFm7LiTpG crg4Al+mz3QDL/RxK4+X3M67+xoOcMSq8u6rhlZQjnMtjByMvSIu3qTuDLSIqTMjH/lF CIuAvajuMx+UrE0E9XSL7pEg8nR3bJ24RNHhAuJJrEoY4gORyYfAlt9NlG7OL3dKTrO2 Kv6w== 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:message-id:date :subject:cc:to:from:dkim-signature; bh=fOZ6rfysb+Hiuh5cPbqLhry8YsLUdhlmW/oJcrqQRxA=; b=hWM7nQfdGOkPScwcTLC+JgheFaozAwPMsnBWiOG42CszLun/JlzS8xSuqYZGq9tcP6 ED5T+1ntgETQ7+YX/SkRpZx8Dl82yXgkUmgMZGWAheakxDpRchVIxX3jNawRAhcDzjeC ZE+5H//kMO98RR71TNNWyazkE1P3L+CWtg44SXrsupXdvSYMwgiioD8SRMKYd52IVukK 0u3xqemhAGJd+7YxC6k9rqj1b6rZpNgJLx0urV7j/BXs+9AweC2ArblTnaAiL3DmYJWL rK+T7hLlHHEKu5vr3KlLKjkZ2A6Ap1ilW3UaMDzxqoGklx36G2FXUyzAhLKKv/8cj18o j40A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hcVBj09/"; 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 ay4-v6si52987plb.410.2018.09.25.02.04.36; Tue, 25 Sep 2018 02:04:37 -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="hcVBj09/"; 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 S1728753AbeIYPLG (ORCPT + 32 others); Tue, 25 Sep 2018 11:11:06 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:39998 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbeIYPLF (ORCPT ); Tue, 25 Sep 2018 11:11:05 -0400 Received: by mail-wr1-f66.google.com with SMTP id y8-v6so18833950wrh.7 for ; Tue, 25 Sep 2018 02:04:32 -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; bh=fOZ6rfysb+Hiuh5cPbqLhry8YsLUdhlmW/oJcrqQRxA=; b=hcVBj09/LPgzagzXbG9tfUX8oRAsiwmFID99WPVrdOQGmbC1/0KZ9FWpIpwqpIRwUp s0EdWA/zagjvvwkOeDckhfYfza+coZ2FjWx/hC0xW5q2qvV+REWF/BYRpH/agpwbHgjp swl2HELI+DPy1jSvRSc+6SD4QrEnNdJPpCZXE= 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; bh=fOZ6rfysb+Hiuh5cPbqLhry8YsLUdhlmW/oJcrqQRxA=; b=cmkI9+Lg8rv5X5f/eu84rAts5HlZ48j+eVaw5iwI3Y+q31Ycgkj5n+xEhXhSKTCmVy VN+jrOgyNku6X21UokEtD3wKvxvRMYI4gtux6RrJnG1LmydEa47QV+729CXYigiB8CDx 0UFQqzO3QvSidq371dgUHt2tv7haUTCWw+VvoPZOQzAop67uj4OzhZ/a0JHmmiUVSr8j v3ac1sEoPf7vLcPv1AFKk1f6cvT9HBbR6EuNFDUxdqtCvYYM0iOUBXDyiSsDUvZG9Fnr x2BPsKf6uUUMtwmqCsuaoNL/a2MSRNR2r3dLhVU/ZWlqjlTkPOiNAbYQLXtw0p677sBB 5qrA== X-Gm-Message-State: ABuFfojXch6S0UbhKyDkzU/vruXW9MfwSfQAlilKAf8cV0bzlYoLsH7X NFXHW/9M6tB+s6UvCL9c6rVXng== X-Received: by 2002:a5d:448d:: with SMTP id j13-v6mr40484wrq.236.1537866271365; Tue, 25 Sep 2018 02:04:31 -0700 (PDT) Received: from localhost.localdomain (251.150.136.77.rev.sfr.net. [77.136.150.251]) by smtp.gmail.com with ESMTPSA id y206-v6sm1523828wmg.14.2018.09.25.02.04.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Sep 2018 02:04:30 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, leo.yan@linaro.org, Zhang Rui , Rob Herring , Mark Rutland , Wei Xu , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/HISILICON SOC SUPPORT) Subject: [PATCH 08/14] ARM64: dts: hisilicon: Add tsensor interrupt name Date: Tue, 25 Sep 2018 11:03:06 +0200 Message-Id: <1537866192-12320-9-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> References: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the interrupt names for the sensors, so the code can rely on them instead of dealing with index which are prone to error. The name comes from the Hisilicon documentation found on internet. Signed-off-by: Daniel Lezcano --- .../bindings/thermal/hisilicon-thermal.txt | 3 ++ arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 63 +++++++++++----------- arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 1 + 3 files changed, 36 insertions(+), 31 deletions(-) -- 2.7.4 diff --git a/Documentation/devicetree/bindings/thermal/hisilicon-thermal.txt b/Documentation/devicetree/bindings/thermal/hisilicon-thermal.txt index cef716a..3edfae3 100644 --- a/Documentation/devicetree/bindings/thermal/hisilicon-thermal.txt +++ b/Documentation/devicetree/bindings/thermal/hisilicon-thermal.txt @@ -7,6 +7,7 @@ region. - interrupt: The interrupt number to the cpu. Defines the interrupt used by /SOCTHERM/tsensor. +- interrupt-names: The interrupt names for the different sensors - clock-names: Input clock name, should be 'thermal_clk'. - clocks: phandles for clock specified in "clock-names" property. - #thermal-sensor-cells: Should be 1. See ./thermal.txt for a description. @@ -18,6 +19,7 @@ for Hi6220: compatible = "hisilicon,tsensor"; reg = <0x0 0xf7030700 0x0 0x1000>; interrupts = <0 7 0x4>; + interrupt-names = "tsensor_intr"; clocks = <&sys_ctrl HI6220_TSENSOR_CLK>; clock-names = "thermal_clk"; #thermal-sensor-cells = <1>; @@ -28,5 +30,6 @@ for Hi3660: compatible = "hisilicon,hi3660-tsensor"; reg = <0x0 0xfff30000 0x0 0x1000>; interrupts = ; + interrupt-names = "tsensor_a73"; #thermal-sensor-cells = <1>; }; diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi index f432b0a..bf8a479 100644 --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi @@ -1081,46 +1081,47 @@ compatible = "hisilicon,hi3660-tsensor"; reg = <0x0 0xfff30000 0x0 0x1000>; interrupts = ; + interrupt-names = "tsensor_a73"; #thermal-sensor-cells = <1>; }; - thermal-zones { + thermal-zones { - cls0: cls0 { - polling-delay = <1000>; - polling-delay-passive = <100>; - sustainable-power = <4500>; + cls0: cls0 { + polling-delay = <1000>; + polling-delay-passive = <100>; + sustainable-power = <4500>; - /* sensor ID */ - thermal-sensors = <&tsensor 1>; + /* sensor ID */ + thermal-sensors = <&tsensor 1>; - trips { - threshold: trip-point@0 { - temperature = <65000>; - hysteresis = <1000>; - type = "passive"; - }; + trips { + threshold: trip-point@0 { + temperature = <65000>; + hysteresis = <1000>; + type = "passive"; + }; - target: trip-point@1 { - temperature = <75000>; - hysteresis = <1000>; - type = "passive"; - }; - }; + target: trip-point@1 { + temperature = <75000>; + hysteresis = <1000>; + type = "passive"; + }; + }; - cooling-maps { + cooling-maps { map0 { - trip = <&target>; - contribution = <1024>; - cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; - }; + trip = <&target>; + contribution = <1024>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; map1 { - trip = <&target>; - contribution = <512>; - cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; - }; - }; - }; - }; + trip = <&target>; + contribution = <512>; + cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; }; }; diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi index 247024d..9eae986 100644 --- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi +++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi @@ -841,6 +841,7 @@ compatible = "hisilicon,tsensor"; reg = <0x0 0xf7030700 0x0 0x1000>; interrupts = ; + interrupt-names = "tsensor_intr"; clocks = <&sys_ctrl 22>; clock-names = "thermal_clk"; #thermal-sensor-cells = <1>; From patchwork Tue Sep 25 09:03:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 147414 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp472950lji; Tue, 25 Sep 2018 02:04:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Ufq7a7zwT/HhgW+gEvmSqRMojOekID2dH3LdkceJ7pCwshVrvn20YLC8WHzb2vxuDqupE X-Received: by 2002:a63:6111:: with SMTP id v17-v6mr96154pgb.226.1537866279190; Tue, 25 Sep 2018 02:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537866279; cv=none; d=google.com; s=arc-20160816; b=pwwwUye7YC6SKL8VYmlrlh1X7q3k23QaMUw5Ua/42nABXgeKPEzQekH+KviRxlLG4e 9Rl6mX3VglTi2E8hdrLS7Yj+NAzDkB0MRM1FbOJklBpTlANgnE0tU7WtUqzsjZg2tv1l VLDsrMLRS9Tp+sFbvR1tKqn7HujxuHhimMHhqY0hStQRabAvccApKVVrFU+t83OygQRe wCKcjnzIpWBpf1RLQH3BSFGNuuLjOPpdPaa+j6M5e3OxCAMhuMUc/OW9V42hR0JgbSW9 ej29AuyU20BRhgrIHFV1qqOTyhqNon9tdsHAPlU/ipEg71U2C6pkmsQkNK4KNwnX4J2r BtKQ== 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:message-id:date :subject:cc:to:from:dkim-signature; bh=24xEIGND92Wry87aRP5S+r2CoVI/mGeClIEhmLV7kWE=; b=WUSRP8i86eZHX+93jPG80P2PnfT/LMx1k8UGELQPBkLZ/e2LsTZ7UKCi1OiI4h5x4x ApOG8rxGDgI8hVHPB7XkHHr1ddidViVr0PJLqnb6Eoocs2UIWw42OoIthWQw8AwHxLLo 3uLQNep9db6VtElSBLec8rb+dXMFwxr045KlTS5YySR3WaxzYcQvfRV+/r8iW3t9TlZO d0B+fJq+WFvFbuTTTKnsSFEiI9I+XCG6z9MK5P7v0hQMAXT5bPAWDem6Cl+GgOjWJluw 88tHtCLAcirQcAzh0TxzPs4Qb81HxaXI1Xl7bQcve1lgE6P1ueZc2qv/ChPS5kSOL32b ThHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QFkBO4n0; 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 y9-v6si1416516pgh.516.2018.09.25.02.04.38; Tue, 25 Sep 2018 02:04:39 -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=QFkBO4n0; 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 S1728851AbeIYPLI (ORCPT + 32 others); Tue, 25 Sep 2018 11:11:08 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33479 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbeIYPLH (ORCPT ); Tue, 25 Sep 2018 11:11:07 -0400 Received: by mail-wr1-f68.google.com with SMTP id f10-v6so1445358wrs.0 for ; Tue, 25 Sep 2018 02:04:34 -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; bh=24xEIGND92Wry87aRP5S+r2CoVI/mGeClIEhmLV7kWE=; b=QFkBO4n0OJHz1OCdkarXuxWrZ1/9HdldlP+H6dN4WG6Q84n0T4V3bXkg++3crFFLHc ifJLjRg+Q/WygElxH6nJ13OH/0ilBVh9yE+oUKMQez9cFKKHkcgSsC6GJy1XV/eS0M0F /5XeDdoNK08NyuYvFggL4yvQAh7txa6zDBqzc= 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; bh=24xEIGND92Wry87aRP5S+r2CoVI/mGeClIEhmLV7kWE=; b=clfkpulj57ejTg3BwT+2H4df5Injs+JLVRFrH51MHWsAFhgsYoGGXsVWOW1kcKdYVk 6GSXMDJOrmR84hHoBojMnoOT3Y2lmKlQwhq/G2MdA8f/zv4WLUBoeF0jDtEEPfMGIo8p fQRKAJpuykjJP2uDwD7RxRydhz19yXfPXhCbaEk5cavicLGREJbiPOd3wBcYoyLiJBEj 8icKxNu5O+3s5tuZg9snxKjkdtu2+tieSCYu0JXGvGrUgC6uqH0hNTSj6XQcL6gZgJV/ GbExHx+Ur6AEC20enHUET2RRrNwBip1SwW0k71sMw0c/cQqDnff2AOJKi/P47T4fN1nI ngaA== X-Gm-Message-State: ABuFfogL3uEvADuanWZlZp0ckl+GpWMZRsoUsDnBCnKYD5hLfqitLJcE A6NUDJfZ8PpFmWXkc4YLvATSVg== X-Received: by 2002:adf:a925:: with SMTP id u34-v6mr14366wrc.175.1537866273230; Tue, 25 Sep 2018 02:04:33 -0700 (PDT) Received: from localhost.localdomain (251.150.136.77.rev.sfr.net. [77.136.150.251]) by smtp.gmail.com with ESMTPSA id y206-v6sm1523828wmg.14.2018.09.25.02.04.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Sep 2018 02:04:32 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, leo.yan@linaro.org, Zhang Rui Subject: [PATCH 09/14] thermal/drivers/hisi: Use platform_get_irq_byname Date: Tue, 25 Sep 2018 11:03:07 +0200 Message-Id: <1537866192-12320-10-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> References: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we have the interrupt names defines, replace platform_get_irq() by platform_get_irq_byname(), so no confusion can be made when getting the interrupt with the sensor id. Signed-off-by: Daniel Lezcano --- drivers/thermal/hisi_thermal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index a542cb3..941c2c4 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -63,6 +63,7 @@ struct hisi_thermal_data; struct hisi_thermal_sensor { struct hisi_thermal_data *data; struct thermal_zone_device *tzd; + const char *irq_name; uint32_t id; uint32_t thres_temp; }; @@ -407,6 +408,7 @@ static int hi6220_thermal_probe(struct hisi_thermal_data *data) return -ENOMEM; data->sensor[0].id = HI6220_CLUSTER0_SENSOR; + data->sensor[0].irq_name = "tsensor_intr"; data->sensor[0].data = data; data->nr_sensors = 1; @@ -423,6 +425,7 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data) return -ENOMEM; data->sensor[0].id = HI3660_BIG_SENSOR; + data->sensor[0].irq_name = "tsensor_a73"; data->sensor[0].data = data; data->nr_sensors = 1; @@ -576,13 +579,13 @@ static int hisi_thermal_probe(struct platform_device *pdev) return ret; } - data->irq = platform_get_irq(pdev, 0); + data->irq = platform_get_irq_byname(pdev, sensor->irq_name); if (data->irq < 0) return data->irq; ret = devm_request_threaded_irq(dev, data->irq, NULL, hisi_thermal_alarm_irq_thread, - IRQF_ONESHOT, "hisi_thermal", + IRQF_ONESHOT, sensor->irq_name, sensor); if (ret < 0) { dev_err(dev, "failed to request alarm irq: %d\n", ret); From patchwork Tue Sep 25 09:03:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 147416 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp473243lji; Tue, 25 Sep 2018 02:04:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV60h9EBb+KUBJb9+mCvrbBvHb2CB9gLEGRMYcgTiFcuypWvL7+nkE4rTpdR8eTSD/tmnrM13 X-Received: by 2002:a17:902:b496:: with SMTP id y22-v6mr95141plr.314.1537866298651; Tue, 25 Sep 2018 02:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537866298; cv=none; d=google.com; s=arc-20160816; b=uKKPSX7LbWU52Pcj/lnCPAZiTPOpo987UtnU71papM+UgN3l6DJ7gP7wyzVp+hO4SQ 1mqBd4sdIzdcsWBR1o7lb3HYLnLIRt7ODng9o717mmJIEziQ+xESz6U/ySr0T8kGekQG zqUhHdtTunop+f6NlqeetD0QYbAovXYDky3WPYrgj5mzzz5FRXeUU1ls2uUsOvqAUChq NaM0H4wog6DbiJgtGu2aIwPfgMrWguvQqFh6M/6FhDB1i1O3NP9TdylIrvO4cWvwhzhu Q1D/XLF6Iiiqs4QeCEChc3OKDpuP8DCeKmDq5H8fAEGTE0h3GKJ+CuhfyruPJwpO2TiP PHOQ== 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:message-id:date :subject:cc:to:from:dkim-signature; bh=2GO8tdB0VqF/b2ulgCZCuFFs0ie3KdkmUxeTxxbYG3I=; b=JTx/nIpl2QAhZDyqH16sUIJwZ/ymwuC7pkoVAYaILDd0Zf1LEiWo0V0x3DPYVnobmT ffcWIiII7R54385w92E8iD283/MrWCOirfItUWc3qf1IdUJKKY6M/oJpdsdcLK5MQgdR C1PbTcGhtWJpQhOJ0OJR4dSzLOxk6MHeMmFNtWxF2SQvHDlzFIu/Z+COiYQauUvJmoQS kjxAnGx7F61gU3sN8JcYunAtKPGft1q7v86duFv7Vk1uwhILzcaCx5tln5rP+Q3URAgD ARC/g8J1TPXtRyDux7v6ctglRBvCgqHWcFuOsu1F3iI1IRz0PjsnSMnDiI5wF+E16Oad XQqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KOyh3egX; 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 75-v6si1753115pfy.169.2018.09.25.02.04.58; Tue, 25 Sep 2018 02:04:58 -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=KOyh3egX; 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 S1728889AbeIYPL2 (ORCPT + 32 others); Tue, 25 Sep 2018 11:11:28 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:53274 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727550AbeIYPL1 (ORCPT ); Tue, 25 Sep 2018 11:11:27 -0400 Received: by mail-wm1-f68.google.com with SMTP id b19-v6so12519817wme.3 for ; Tue, 25 Sep 2018 02:04:54 -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; bh=2GO8tdB0VqF/b2ulgCZCuFFs0ie3KdkmUxeTxxbYG3I=; b=KOyh3egXVnoup8Dg4CvBj/Aq3XnB2Z9Jn0rwy6SseExGuOW/eWS4yRRbJpX7hLf7f7 3pa0iMIQy0wrYn+04NfvD3SqceW9W1svCl3IywZ70NMtIkJy/JqRewnMHs/115//+MVh tMmjyJ3gAe78KtjmMXn3uIsWF7P5AZXlmGz/M= 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; bh=2GO8tdB0VqF/b2ulgCZCuFFs0ie3KdkmUxeTxxbYG3I=; b=BXyEligTMBqt3/9JocfxMp4CmAaaHdfJWQNAqEyZ1XXMobCEYocChy8iEGEu5irQjB BpHsL/hQoeSStMJPbBtzcBbNenu2L9lQBSQScCl3VJ0NJely49+srLHugWOave7XNfJx rCLKUyekdwDehk8jdNXayP4KVDmCP8gKA/dTHDQRpbwPeKzsJ1RzHz+M51GgPY+EFSMl U5GSJEfPwqCD/6osEjNlD0a8PhlL4yi1u7+EnYd7w1phtrMWMoRMJtl2J6tIlMS/DkZ2 mVX3urz/0NgFJspVAC46d63kPHeLu3gaHH+AmIzVRd9PnHycMtc4D1dljl5QwJVwMgHJ Nnuw== X-Gm-Message-State: ABuFfoiCaE72XcTd3FO4PaHHJRg9hVMFd2sLPTO3+etUNoreoaKsC7O6 Wg+b4ZvpEo/bY3gyv3717OZOeQ== X-Received: by 2002:a1c:7d51:: with SMTP id y78-v6mr55960wmc.37.1537866293946; Tue, 25 Sep 2018 02:04:53 -0700 (PDT) Received: from localhost.localdomain (251.150.136.77.rev.sfr.net. [77.136.150.251]) by smtp.gmail.com with ESMTPSA id y206-v6sm1523828wmg.14.2018.09.25.02.04.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Sep 2018 02:04:51 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, leo.yan@linaro.org, Zhang Rui Subject: [PATCH 11/14] thermal/drivers/hisi: Remove pointless irq field Date: Tue, 25 Sep 2018 11:03:09 +0200 Message-Id: <1537866192-12320-12-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> References: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The irq field in the data structure is pointless as the scope of its usage is just to request the interrupt. It can be replaced by a local variable. Use the 'ret' variable to get the interrupt number. Signed-off-by: Daniel Lezcano --- drivers/thermal/hisi_thermal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 941c2c4..87d8a13 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -83,7 +83,6 @@ struct hisi_thermal_data { struct clk *clk; void __iomem *regs; int nr_sensors; - int irq; }; /* @@ -579,16 +578,16 @@ static int hisi_thermal_probe(struct platform_device *pdev) return ret; } - data->irq = platform_get_irq_byname(pdev, sensor->irq_name); - if (data->irq < 0) - return data->irq; + ret = platform_get_irq_byname(pdev, sensor->irq_name); + if (ret < 0) + return ret; - ret = devm_request_threaded_irq(dev, data->irq, NULL, + ret = devm_request_threaded_irq(dev, ret, NULL, hisi_thermal_alarm_irq_thread, IRQF_ONESHOT, sensor->irq_name, sensor); if (ret < 0) { - dev_err(dev, "failed to request alarm irq: %d\n", ret); + dev_err(dev, "Failed to request alarm irq: %d\n", ret); return ret; } From patchwork Tue Sep 25 09:03:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 147417 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp473287lji; Tue, 25 Sep 2018 02:05:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV60KCdo7yeS3HGXPcbPvVtNEDpre06SMumskivHUSycMP90ztkpVQBv5YV03BKIT+LXmGZVn X-Received: by 2002:a62:c08b:: with SMTP id g11-v6mr117481pfk.72.1537866301290; Tue, 25 Sep 2018 02:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537866301; cv=none; d=google.com; s=arc-20160816; b=vqEMruxaPADlMLlkR348gvkJB/8KtBcmoBuRJShhOhipWnVBAdFzLHAFli50/dmhFQ HPqw1qTxINDVW3lQH9pGDvyNH35fqrewHr6HoIgaLApuRbOE/ChC+VQuFslicGVTjgVy 8GqvG58FHJpmz88dfDq/zyOGwLSboXcbYe0r5ZJbOWXe4wSRGD9tz8gkvQRqfkaaz5wU Yk7v6lhPUlXseBVGLO10n9G4gqfb7l79FHdOfszxKVbW0XoMX5isxx0COD5BAS1SlW3N 0zxMDNBF1/M6HIcURgsF6BhSsoubyx4mnxugSGffwUs/OyScDLEH5RSR7SsHyAtEO7Eo kURQ== 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:message-id:date :subject:cc:to:from:dkim-signature; bh=xaKoq2Z5i+AH80JWe8GKSoRR6ISgaXZtO2Gfftl5H7k=; b=vip/cu8SjALx4sLLZO+rP9s7HhptX+kRyNKe56922FwYIs6qyYNlRBO5GQ9TWI7dt8 u3rSN+j8+oOYUX7R5jkR0xSAV5nk0QFTbfMqm7s9IHvmDG4QRUoNk0N62gKcMcgy0g+P KmVq4cGpOeVEIz5tYd/A7zD5sfxzu8HY7NxVEwfoU+yPZlm/7UmEF0tZXx/HzzPQ5AX0 00ppzK4Gj68nbqVU3AwgEiJgPvft/5NcCFIOiIlPZc0rJSi2BjZQA7OiMM6rj8WqI6ZF 6qthmXEbeg/MkfiJYeMM5SYJA9IzDngcOn//ssZ93i4JQ487GnkWu23Et29yvXsB6Qhk 1aag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ewS1y75l; 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 75-v6si1753115pfy.169.2018.09.25.02.05.01; Tue, 25 Sep 2018 02:05:01 -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=ewS1y75l; 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 S1728927AbeIYPLa (ORCPT + 32 others); Tue, 25 Sep 2018 11:11:30 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39806 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727550AbeIYPL3 (ORCPT ); Tue, 25 Sep 2018 11:11:29 -0400 Received: by mail-wr1-f68.google.com with SMTP id s14-v6so22457168wrw.6 for ; Tue, 25 Sep 2018 02:04:56 -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; bh=xaKoq2Z5i+AH80JWe8GKSoRR6ISgaXZtO2Gfftl5H7k=; b=ewS1y75l1+/fHRqN/ts2a8WT3bknw2zaVcpHBeb2sONr4psMZ1KR2jC/1E204J2bpL S/QO/x51Ws1NGos9hHrjUx4/n0dJa3KuNN6u68uOALxcth+qHAPDFFfKN19QejfUDfn0 L6QMSU13bwzIrbYBsKJFjqM1OQ01k67v/XA8o= 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; bh=xaKoq2Z5i+AH80JWe8GKSoRR6ISgaXZtO2Gfftl5H7k=; b=OMm2WqwMQj+XipulWS2umt0uO5WAHzgcNb+p1IhgflLQgqpzQmQesXEBP2OtcvyIsG ZyfZVk77FenUHm4nGo+ifmvN4qaxKu6mn5j/+7ISgnWfUW0tXBz+cCGDBFHLaPWWMsmX 7WHV/EBCQUDNA1Sxs5SKbxGAlgOZiz3WYAWTvKN2kb+AfQrVgLRUUBTqavKIAB61Hnom W5FuBP8ctzCrcpPe5zjJISW1pCIn4IhW02hrgmMrLdtLPtAbx7JsNpUt1s/Q1EBkitQC Cc2BcrZTgfsde5ownN55/d8qrbEUrGeTrFUfaU7rFQqNzZpRrxpddRIJLFO9FaSdJBam lCzA== X-Gm-Message-State: ABuFfoiYt9kMJ27rAfmvDacIim2e/waMNHfxM2JyWfX5aaCR0MGEH22F /yvUjEHr+WCmW51VbtsGW/12ig== X-Received: by 2002:adf:a599:: with SMTP id g25-v6mr90065wrc.88.1537866295905; Tue, 25 Sep 2018 02:04:55 -0700 (PDT) Received: from localhost.localdomain (251.150.136.77.rev.sfr.net. [77.136.150.251]) by smtp.gmail.com with ESMTPSA id y206-v6sm1523828wmg.14.2018.09.25.02.04.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Sep 2018 02:04:55 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, leo.yan@linaro.org, Zhang Rui Subject: [PATCH 12/14] thermal/drivers/hisi: Add more sensors channel Date: Tue, 25 Sep 2018 11:03:10 +0200 Message-Id: <1537866192-12320-13-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> References: <1537866192-12320-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the sensor channels id for the little, g3d and modem. Signed-off-by: Daniel Lezcano --- drivers/thermal/hisi_thermal.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 87d8a13..ba89cb9 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -56,7 +56,12 @@ #define HI3660_TEMP_LAG (4000) #define HI6220_CLUSTER0_SENSOR 2 +#define HI6220_CLUSTER1_SENSOR 1 + +#define HI3660_LITTLE_SENSOR 0 #define HI3660_BIG_SENSOR 1 +#define HI3660_G3D_SENSOR 2 +#define HI3660_MODEM_SENSOR 3 struct hisi_thermal_data;