Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1868249ybv; Fri, 21 Feb 2020 04:53:37 -0800 (PST) X-Google-Smtp-Source: APXvYqyDyMNCAhshLb15dJAtlqZ6ehBdtynSNdQVZN9aqr20kZL6yaragjG0Zg9eHHZxSx750k/0 X-Received: by 2002:a05:6830:12d5:: with SMTP id a21mr28877320otq.296.1582289617068; Fri, 21 Feb 2020 04:53:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582289617; cv=none; d=google.com; s=arc-20160816; b=Gd0JSJfdiWRbxCstZI8soCG+i5iM3vAtR7eDkV2h74IdBxrd8r+M0vz1eDxX4XBFwq FCW0hH0vLf6Gyefx9E8AEOY93cKfzpmcjVcH9SjXvb81Rd4DaiJpxIeCIWbqNqs7nD55 gs1supPz99Trlnq2kx3hzFnpIPSLopYGsK7d9YS4EczqYxZPjVOgWwlNUiuJAaDBq3tt TmZ+OqZ+9Jep+AWUDI6TxbRevngOXA9fcHUzqfvmaqn3WYw/QQYPgspea4Xcp3Enzucp 8vn02xSmI0ghRnKuEqTs6lfdER/wLUwc8tE5rudPsyqPiJbUQx6B428aoXjdnQbbd+6T MmXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1Ecw0TwcU7uRxX0RbgoPbcukxSNyerj4Gg5H+/7jGU4=; b=YVL9UtFKMWz3gzJXAb4TnSKslHiLwES7GvIC/VIizexZrXdUR/1uE74htoPqp2RvHK o76W7EwzcDKdz/Lsvo4EovYBdtLYnhsjWeChTfn0pAhvfBiV+y24by6Djtf3fi5tzWSS As8p9NJjoBaDEYrOF+dCcSaCF4IzKkfS9N1qmmzP9OgroxZ2SwPHZGRzDKin7v0hN6ZQ yjah3Rd/PLvG/auKCQiqL6aEnqsn/PgCIJ9M5sahbqhiOTvLe8gEeXUj1UnkNlMkoXnm RY4UoG2Y8/Ru8leE4ZUWoTM6e1gygWwtmnnm2bJ1D9sw+XwDTZnBdxTvQaDklpJnLal7 Y89Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Is97m+zF; 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 l17si1325480otq.59.2020.02.21.04.53.24; Fri, 21 Feb 2020 04:53:37 -0800 (PST) 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=Is97m+zF; 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 S1727787AbgBUMxH (ORCPT + 99 others); Fri, 21 Feb 2020 07:53:07 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:45770 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbgBUMxH (ORCPT ); Fri, 21 Feb 2020 07:53:07 -0500 Received: by mail-wr1-f68.google.com with SMTP id g3so1919134wrs.12 for ; Fri, 21 Feb 2020 04:53:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=1Ecw0TwcU7uRxX0RbgoPbcukxSNyerj4Gg5H+/7jGU4=; b=Is97m+zF/OlL47unjgTyrlN2h5LOz7b+bCuBXaZ7I4NfCKXkYB+eEn9tr8HWToU5hS LcgaMH98pZ8E1XJVjarNN4j5rDbOg0TvWZqonAeorXDYmylpc5/p3a6zdZo0+OViPxVf vjaBs1HwK+d066WsYLlvTd/cfgCUGAocMJZCBxAbIYOmchE4hYYwfT2fgcgtO/lDa6n+ s46hilc6kKO54iNjcQIKiz/zMeNqSx8RMh2L/6aFfRv62MCyYyw9TIi26wXy7zkiHsnO 0qJx6mpEC9etxLhetlmYRb+0QZ7ItHTVG67ZgyBXOa2HCHtlIL/DA/fAs1ZuOWKYzTqv 60OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=1Ecw0TwcU7uRxX0RbgoPbcukxSNyerj4Gg5H+/7jGU4=; b=gYle4WPFJz1q9j6c617MSFCPxfO6xo4R50/wjtbbnoss4D+FWR6qTHCSQx8tsh/Hzr 70nfaqzRo/n+2tyb+uLhr5BKwoHQ9wAzw2LEDXD7oPeQ+3JyOfB3XdqtPDdZ1vnyrwng 7unpcjXj6ONSHb2pKD+6oAdegYyXkqG5FgH/0ta9FMExv+86AIebgLZl3WfSF3XqqIxf FQ34EIwLuOSUfDIvp+UZ7KwCrMbI7Ty2RbW8UfP5D7FYXB2xrXfEYAYeiVbUlPup1MpC TMt6MX/4iVeLPSDEkY+Zc5EUy5hcnlC/YpRV/LXomDZPbucfhMH2Zj2A8R9oHeF3STGw jBjA== X-Gm-Message-State: APjAAAUdgrwWGNyx0s0aOzs/G4HwashFczwwJ0ZQqSrc+9YKzrHFxfpj EsR09oK+L9LnXBJKgq4iaOOwjXantE4= X-Received: by 2002:a05:6000:124b:: with SMTP id j11mr45114087wrx.285.1582289584497; Fri, 21 Feb 2020 04:53:04 -0800 (PST) Received: from linaro.org ([2a01:e34:ed2f:f020:2dfb:b5ce:9043:4adb]) by smtp.gmail.com with ESMTPSA id k10sm3781715wrd.68.2020.02.21.04.53.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Feb 2020 04:53:03 -0800 (PST) Date: Fri, 21 Feb 2020 13:53:00 +0100 From: Daniel Lezcano To: Anson Huang Cc: robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, catalin.marinas@arm.com, will@kernel.org, rui.zhang@intel.com, amit.kucheria@verdurent.com, aisheng.dong@nxp.com, linux@roeck-us.net, srinivas.kandagatla@linaro.org, krzk@kernel.org, fugang.duan@nxp.com, peng.fan@nxp.com, daniel.baluta@nxp.com, bjorn.andersson@linaro.org, olof@lixom.net, dinguyen@kernel.org, leonard.crestez@nxp.com, marcin.juszkiewicz@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Linux-imx@nxp.com Subject: Re: [PATCH V15 RESEND 3/5] thermal: imx_sc: add i.MX system controller thermal support Message-ID: <20200221125300.GB10516@linaro.org> References: <1582161028-2844-1-git-send-email-Anson.Huang@nxp.com> <1582161028-2844-3-git-send-email-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1582161028-2844-3-git-send-email-Anson.Huang@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anson, sorry for the delay with this review, hopefully the upstreaming will be now a bit more smooth. Apart the comments below, the driver looks good to me. On Thu, Feb 20, 2020 at 09:10:26AM +0800, Anson Huang wrote: > i.MX8QXP is an ARMv8 SoC which has a Cortex-M4 system controller > inside, the system controller is in charge of controlling power, > clock and thermal sensors etc.. > > This patch adds i.MX system controller thermal driver support, > Linux kernel has to communicate with system controller via MU > (message unit) IPC to get each thermal sensor's temperature, > it supports multiple sensors which are passed from device tree, > please see the binding doc for details. > > Signed-off-by: Anson Huang > --- > No change. > --- > drivers/thermal/Kconfig | 11 +++ > drivers/thermal/Makefile | 1 + > drivers/thermal/imx_sc_thermal.c | 142 +++++++++++++++++++++++++++++++++++++++ > 3 files changed, 154 insertions(+) > create mode 100644 drivers/thermal/imx_sc_thermal.c > > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig > index 5a05db5..d1cb8dc 100644 > --- a/drivers/thermal/Kconfig > +++ b/drivers/thermal/Kconfig > @@ -251,6 +251,17 @@ config IMX_THERMAL > cpufreq is used as the cooling device to throttle CPUs when the > passive trip is crossed. > > +config IMX_SC_THERMAL > + tristate "Temperature sensor driver for NXP i.MX SoCs with System Controller" > + depends on ARCH_MXC && IMX_SCU IMX_SCU depends on IMX_MBOX which depends on ARCH_MXC. This dependency could be simplified. Also add the COMPILE_TEST option to improve compilation test coverage. > + depends on OF > + help > + Support for Temperature Monitor (TEMPMON) found on NXP i.MX SoCs with > + system controller inside, Linux kernel has to communicate with system > + controller via MU (message unit) IPC to get temperature from thermal > + sensor. It supports one critical trip point and one > + passive trip point for each thermal sensor. > + > config MAX77620_THERMAL > tristate "Temperature sensor driver for Maxim MAX77620 PMIC" > depends on MFD_MAX77620 > diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile > index 9fb88e2..a11a6d8 100644 > --- a/drivers/thermal/Makefile > +++ b/drivers/thermal/Makefile > @@ -43,6 +43,7 @@ obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.o > obj-$(CONFIG_ARMADA_THERMAL) += armada_thermal.o > obj-$(CONFIG_TANGO_THERMAL) += tango_thermal.o > obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o > +obj-$(CONFIG_IMX_SC_THERMAL) += imx_sc_thermal.o > obj-$(CONFIG_MAX77620_THERMAL) += max77620_thermal.o > obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o > obj-$(CONFIG_DA9062_THERMAL) += da9062-thermal.o > diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c > new file mode 100644 > index 0000000..d406ecb > --- /dev/null > +++ b/drivers/thermal/imx_sc_thermal.c > @@ -0,0 +1,142 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Copyright 2018-2019 NXP. *sigh* 2020 now ... [ ... ] > +static int imx_sc_thermal_get_temp(void *data, int *temp) > +{ > + struct imx_sc_msg_misc_get_temp msg; > + struct imx_sc_rpc_msg *hdr = &msg.hdr; > + struct imx_sc_sensor *sensor = data; > + int ret; > + > + msg.data.req.resource_id = sensor->resource_id; > + msg.data.req.type = IMX_SC_C_TEMP; > + > + hdr->ver = IMX_SC_RPC_VERSION; > + hdr->svc = IMX_SC_RPC_SVC_MISC; > + hdr->func = IMX_SC_MISC_FUNC_GET_TEMP; > + hdr->size = 2; Can you explain this 'size' value? [ ... ] > +MODULE_DEVICE_TABLE(of, imx_sc_thermal_table); > + > +static struct platform_driver imx_sc_thermal_driver = { > + .probe = imx_sc_thermal_probe, The driver can be compiled as module but there is no 'remove' callback > + .driver = { > + .name = "imx-sc-thermal", > + .of_match_table = imx_sc_thermal_table, > + }, > +}; > +module_platform_driver(imx_sc_thermal_driver); > + > +MODULE_AUTHOR("Anson Huang "); > +MODULE_DESCRIPTION("Thermal driver for NXP i.MX SoCs with system controller"); > +MODULE_LICENSE("GPL v2"); -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog