Received: by 10.213.65.68 with SMTP id h4csp3850919imn; Tue, 10 Apr 2018 05:46:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/w/h32CANhufFxNcOh+vh+Nk6fV8OGWhRYxKwoIkddPAxPOrxmPGNvacbYBxAg2eBmizKv X-Received: by 2002:a17:902:206:: with SMTP id 6-v6mr287706plc.376.1523364372815; Tue, 10 Apr 2018 05:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523364372; cv=none; d=google.com; s=arc-20160816; b=gzKpHrs+OnI5ePHD1zYdV3Gqh705RopXX1Z7K8cnrJvoMu69AHbGkee9omTx+mSDI/ pIOLcw/fqQxPvaBwz6rnbHH8nU+0i6ohNy4kxLTcBKAqPbnoPqDJ+fMF42FW0EblaLCF h7VazTXPu2iT4kTnzmzes0VKWK7fvF6gWXr30n5L061asm634dhrd2Ry43QNWnu6rbI3 dVfeOF/dAFpSL2JSS3D56lwtHoponZ8eAlbQ8Sdk8WS/IvIBgZu69bpA1jndjaqpO7Bz EVOus3xGijVj6y+iV0oTX9xO5XbEGamlet6Qet7+0xIOzBceBjt2+R+L8ecU2SzrXHm8 xUKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=C/yTmY0vlqcPp0W2dc66KMs4Br+DnQKqfRw8ERKoAgc=; b=BCx2BaYKSpN/Gx0HaPA9SKa5UliTQX3v0o2CqUWl1WJNK9Wwyrus5Vh+7sY5jgjhVK g/QvQpeC/zuA4iG+K9flyMbDH34bxLXEWG7cNdpEliXEt3KhV1pYlnILnaYxUw8bVxXU o2iL+4Zy8QAcpCUma9AO/i2AtgeAKQw0Pi9nT3kfz6CeGA7aCN2eeB5YkXpL8PN9DtcQ dem4ri7BaCvaMTaS4VaAGBRprcKYrR2vjEy0wgAEfhPsUKbZ5d3UZPBpD2v2CLvFn7vs NDnKUKA8y/8AXHMGMvENw4uO7lN0gGi5828DNSm8d0T0lg2mn8/biRqm3t0d/5AfqJn2 NRXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=LxVjJMpW; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n17-v6si2640232plp.7.2018.04.10.05.45.35; Tue, 10 Apr 2018 05:46:12 -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=@samsung.com header.s=mail20170921 header.b=LxVjJMpW; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752803AbeDJMmp (ORCPT + 99 others); Tue, 10 Apr 2018 08:42:45 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:57282 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751178AbeDJMmn (ORCPT ); Tue, 10 Apr 2018 08:42:43 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20180410124241epoutp034b181d0652d7669442f607944479d436~kE6JAMMh-0547905479epoutp03f; Tue, 10 Apr 2018 12:42:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180410124241epoutp034b181d0652d7669442f607944479d436~kE6JAMMh-0547905479epoutp03f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523364161; bh=C/yTmY0vlqcPp0W2dc66KMs4Br+DnQKqfRw8ERKoAgc=; h=From:To:Cc:Subject:Date:References:From; b=LxVjJMpWfDy/wXc/mqRQ7QWubzBzHY40LYDlYjYOddcvK7TE9ZC4dYhpkUvldZWRG Wdy/jjzAOE11OFmTHP340CpQYOE834whWjE0IbBqvZy6xkQqyDkALOeWDGNa6Nj7ik bJK4G3qfyl5ygCzJfE6YKwdc9Uf9+xULj7DFGB5Q= Received: from epsmges2p3.samsung.com (unknown [182.195.42.71]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20180410124241epcas2p1e638a508ccd9097693f15b0687f8fcd6~kE6I0q_rE1748417484epcas2p1H; Tue, 10 Apr 2018 12:42:41 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id B2.80.04072.141BCCA5; Tue, 10 Apr 2018 21:42:41 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20180410124240epcas2p25c8979583c41f147ac34c49faf30aa14~kE6HrXPfr2951329513epcas2p2T; Tue, 10 Apr 2018 12:42:40 +0000 (GMT) X-AuditID: b6c32a47-0fbff70000000fe8-24-5accb14101b9 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 99.1E.03827.F31BCCA5; Tue, 10 Apr 2018 21:42:40 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P6Y00EUVZATQUB0@mmp1.samsung.com>; Tue, 10 Apr 2018 21:42:39 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH 00/17] thermal: enable/check sensor after its setup is finished Date: Tue, 10 Apr 2018 14:41:54 +0200 Message-id: <1523364131-31059-1-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRjHfbdzzo7D6eko+epIY6WS5Oyi8lYSClaHyqjoQwysRh7UdCo7 all9sClmgpdQsMRbXiJmIo45zaaZus3mUkQTSUss0zSawkSxkmoe/fZ7+P+ey4eHFNJ/MF8y KTWDVacqU2SEGDP0H4gIiW6zKQ61j3igtietOJp3WABqKTJhqHZ8Ake9D8YA+vvlB46sHRoB yqusx1Dj3KwIjXVVEchRNABQlX1KhOZmiwn0Xe+NdC8mCbTRVYOh7s8OELWL0SybCaZy5j3B vKr8JGLaP4YzDcZFAaPTPiKY6QkjwRTl2gmmWK8FTMdEjZAZrFjHGMtkh4Bx6PwuShTiyHg2 JSmLVYeevCFOnDL2EumW4DvWsk8gByz5FwJXElJhsMdaLCwEYpKmOgEsGZoR8cU6gLnDJuGO 1WhuFvDBawAXm+q3rV8A/jTatiyCOg4fP9SCQkCSXtQ5qH9JOh0h9RSDK9POSSTpSV2Cpjza iRgVAB1LtLNTQjHQbjfg/C4/+M5chjtbIfWbgN9Wx3GnD6kYOKjdyzuecMmiF/EshfPaNsD7 uQCudRq3jy4F0NhK83wC9ltGtxYIKXdY0L8p4mdKYEE+zSMDi+tSeTsabsw5CCfTVBx8NvAB LwU+dcBFC3az6ZwqgeWOpB+Vc0oVl5maIL+ZptKBrZ8IPtMJDMPn+wBFApmbpPTtkILGlVlc tqoPQFIo85KktNgUtCRemX2XVaddV2emsFwfkJKYzFuSE/s/ohKUGWwyy6az6p1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8979583c41f147ac34c49faf30aa14 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20180410124240epcas2p25c8979583c41f147ac34c49faf30aa14 X-RootMTR: 20180410124240epcas2p25c8979583c41f147ac34c49faf30aa14 References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, [devm]_thermal_zone_of_sensor_register() is used to register thermal sensor by thermal drivers using DeviceTree. Besides registering sensor this function also immediately enables it (using ->set_mode method) and then checks it with a update call to the thermal core (which ends up using ->get_temp method). For many DT thermal drivers this causes a problem because [devm]_thermal_zone_of_sensor_register() need to be called in order to obtain data about thermal trips which are then used to finish hardware sensor setup (only after which ->get_temp can be used). The issue has been observed when using Samsung Exynos thermal driver and fixed internally in the driver in commit d8efad71e5b6 ("thermal: exynos: Reading temperature makes sense only when TMU is turned on"). However after this commit there are now following warnings from the thermal core visible: [ 3.453602] thermal thermal_zone0: failed to read out thermal zone (-22) [ 3.483468] thermal thermal_zone1: failed to read out thermal zone (-22) [ 3.505965] thermal thermal_zone2: failed to read out thermal zone (-22) [ 3.528455] thermal thermal_zone3: failed to read out thermal zone (-22) [ 3.550939] thermal thermal_zone4: failed to read out thermal zone (-22) This patchset attempts to directly address the thermal core problem with [devm]_thermal_zone_of_sensor_register() and affected DT thermal drivers. In order to achieve this sensor registration, enable and check operations are separated and corresponding drivers are modified to use the new helpers to enable and check sensor explicitly. Tested on Exynos5422 based Odroid-XU3 Lite board (aforementioned warnings from the thermal core are now gone). Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics Bartlomiej Zolnierkiewicz (17): thermal: add thermal_zone_device_toggle() helper thermal: separate sensor registration and enable thermal: add thermal_zone_device_check() helper thermal: do sensor checking explicitly in drivers thermal: bcm2835: enable/check sensor after its setup is finished thermal: brcmstb: enable/check sensor after its setup is finished thermal: hisi_thermal: enable/check sensor after its setup is finished thermal: qcom: tsens: enable/check sensor after its setup is finished thermal: qoriq: enable/check sensor after its setup is finished thermal: rcar_gen3_thermal: enable/check sensor after its setup is finished thermal: rockchip_thermal: enable/check sensor after its setup is finished thermal: exynos: enable/check sensor after its setup is finished thermal: tegra: enable/check sensor after its setup is finished thermal: ti-soc-thermal: enable/check sensor after its setup is finished thermal: uniphier: enable/check sensor after its setup is finished thermal: zx2967: enable/check sensor after its setup is finished thermal: warn on attempts to read temperature on disabled sensors drivers/acpi/thermal.c | 5 ++-- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 1 - drivers/platform/x86/acerhdf.c | 6 +++- drivers/regulator/max8973-regulator.c | 3 +- drivers/thermal/broadcom/bcm2835_thermal.c | 3 ++ drivers/thermal/broadcom/brcmstb_thermal.c | 3 ++ drivers/thermal/broadcom/ns-thermal.c | 3 ++ drivers/thermal/da9062-thermal.c | 7 ++--- drivers/thermal/db8500_thermal.c | 5 +++- drivers/thermal/hisi_thermal.c | 22 ++++---------- drivers/thermal/imx_thermal.c | 3 +- drivers/thermal/int340x_thermal/int3400_thermal.c | 1 + drivers/thermal/intel_bxt_pmic_thermal.c | 3 +- drivers/thermal/intel_soc_dts_iosf.c | 3 +- drivers/thermal/max77620_thermal.c | 6 ++-- drivers/thermal/mtk_thermal.c | 3 ++ drivers/thermal/of-thermal.c | 6 ++-- drivers/thermal/qcom-spmi-temp-alarm.c | 5 +++- drivers/thermal/qcom/tsens.c | 6 ++++ drivers/thermal/qoriq_thermal.c | 3 ++ drivers/thermal/rcar_gen3_thermal.c | 7 +++-- drivers/thermal/rcar_thermal.c | 8 +++-- drivers/thermal/rockchip_thermal.c | 34 ++++++++++------------ drivers/thermal/samsung/exynos_tmu.c | 7 ++++- drivers/thermal/st/st_thermal_memmap.c | 3 +- drivers/thermal/tango_thermal.c | 5 ++++ drivers/thermal/tegra/soctherm.c | 3 ++ drivers/thermal/tegra/tegra-bpmp-thermal.c | 3 ++ drivers/thermal/thermal-generic-adc.c | 3 ++ drivers/thermal/thermal_core.c | 14 ++++----- drivers/thermal/thermal_helpers.c | 33 +++++++++++++++++++++ drivers/thermal/thermal_sysfs.c | 17 +++++++---- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 7 ++++- drivers/thermal/uniphier_thermal.c | 6 +++- drivers/thermal/x86_pkg_temp_thermal.c | 2 +- drivers/thermal/zx2967_thermal.c | 3 ++ include/linux/thermal.h | 5 ++++ 37 files changed, 173 insertions(+), 84 deletions(-) -- 1.9.1