From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zg8tmtyylji0my4xnjqumte4.icoremail.net (zg8tmtyylji0my4xnjqumte4.icoremail.net [162.243.164.118]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00C143E168F; Tue, 30 Jun 2026 09:10:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.164.118 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782810653; cv=none; b=PbkEwxZ7WzIeONhV/7Jo0pnAGU7xqNGCNW8HfqjJKrB1Khxt6Ll3VNt9VqzhGWCY2kOO07SBhoKTUyITMZw3qXXRmw8532OSOK70hGCLhTuXy9YaI4G+3o5MyXOKaH20KQkFef2hsij2phnGcfAYXRdyRDJBLmYhIUj5Yh5iThI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782810653; c=relaxed/simple; bh=6GsS91VDm5XJTxBx9/v0Ih9NThZHJONJTviT5aFAdC0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=qxqzu/2jBKVwfqQb+m8cZk3d80NQWrIemKZZAWyiYtUL548pT6BHwPoI8PLCkIi4bfHenqJmsAZ5SgGlbSCQAlkGBHiyySnZLWchPd/AaLZVrGeouQnfJg7dDecNdnTGUe+gyNcZMrQRWnhhXILA28I+cw0UzdYgrO3Lbs1ytiE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com; spf=pass smtp.mailfrom=eswincomputing.com; arc=none smtp.client-ip=162.243.164.118 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=eswincomputing.com Received: from E0005152DT.eswin.cn (unknown [10.12.96.41]) by app2 (Coremail) with SMTP id TQJkCgAXLaAQiENqkyUwAA--.30595S2; Tue, 30 Jun 2026 17:10:41 +0800 (CST) From: dongxuyang@eswincomputing.com To: linux@roeck-us.net, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, p.zabel@pengutronix.de Cc: ningyu@eswincomputing.com, linmin@eswincomputing.com, pinkesh.vaghela@einfochips.com, luyulin@eswincomputing.com, dongxuyang@eswincomputing.com Subject: [PATCH v9 0/2] Add driver support for ESWIN EIC7700 PVT controller Date: Tue, 30 Jun 2026 17:10:40 +0800 Message-Id: <20260630091040.1407-1-dongxuyang@eswincomputing.com> X-Mailer: git-send-email 2.31.1.windows.1 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:TQJkCgAXLaAQiENqkyUwAA--.30595S2 X-Coremail-Antispam: 1UD129KBjvJXoW3Jw1DKF1rWrW3urWUKFWktFb_yoWfGF1rpF W8KryYkw4DXrWSq3yDt3W09F1ftan3JFWayr4xWw18Zw15t34j9FWfKF1Y9FyDArn3X3Zx ta4Yqr47Aa4qyrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBv14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1lw4CEc2x0rVAKj4xxMxkF7I0En4kS14v26r1q6r43MxkIecxEwVCm-wCF04 k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18 MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr4 1lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1l IxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4 A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUXJ5wUUUUU= X-CM-SenderInfo: pgrqw5xx1d0w46hv4xpqfrz1xxwl0woofrz/ From: Xuyang Dong Add support for the ESWIN EIC7700 PVT (Voltage, Temperature) sensor Features: The driver supports monitoring of voltage and temperature parameters through the hardware monitoring subsystem. It provides an access to the sampled Temperature and Voltage. Test: Tested this patch on the SiFive HiFive Premier P550 (which uses the ESWIN EIC7700 SoC). Updates: Changes in v9: - Taking over from Huan He , who has left the company and whose email is no longer reachable. Huan He's Signed-off-by tag is retained to acknowledge the original contribution. - Update eswin,eic7700-pvt.yaml - Add 'Reviewed-by: Conor Dooley ' tag. - Update eic7700-pvt.c and eic7700-pvt.h - Remove config HWMON. - Add eic7700_pvt_set_trim(pvt, PVT_TRIM_DEF) in eic7700_pvt_runtime_resume(). Re-apply the trim values to prevent incorrect sensor readings upon wake (Sashiko review of v8). - Link to v8: https://lore.kernel.org/all/20260625061049.1614-1-hehuan1@eswincomputing.com/ Changes in v8: - Update eswin,eic7700-pvt.yaml - Delete reviewed-by tag of Krzysztof Kozlowski due to functional changes. Add the APB clock because when the kernel is booted with CMDLINE option "clk_ignore_unused", the APB clock remains enabled by default; without this option, the APB clock may be gated and the PVT driver will not operate correctly - Update eic7700-pvt.c and eic7700-pvt.h - Add APB clock support and retrieve clocks using devm_clk_bulk_get() - Update eic7700_pvt_hard_isr() to verify PVT_INT_STAT before clearing the interrupt and completing a conversion, preventing spurious interrupts from returning stale data or completing a conversion early - Update eic7700_pvt_probe() to register the PM runtime cleanup action before requesting the IRQ, so the IRQ is torn down before clocks are disabled during driver removal, preventing a possible use-after-disable of the hardware clock in the ISR - Link to v7: https://lore.kernel.org/all/20260611090505.734-1-hehuan1@eswincomputing.com/ Changes in v7: - Remove the unused reset control pointer from struct pvt_hwmon and keep the reset control handle local to eic7700_pvt_probe() - Update eic7700_pvt_init_iface() to disable PVT_ENA_EN before clearing the interrupt status, preventing a possible level-triggered interrupt storm if the bootloader leaves the conversion engine running - Update eic7700_pvt_disable_pm_runtime() to explicitly disable runtime PM and avoid an unbalanced disable_depth - Link to v6: https://lore.kernel.org/all/20260604080430.126-1-hehuan1@eswincomputing.com/ Changes in v6: - Fix the !CONFIG_PM probe error path by disabling the clock if IRQ request fails before the PM cleanup action is registered - Replace pm_runtime_put_noidle() with pm_runtime_put() in the IRQ handler to avoid a runtime PM reference-count race with the read path - Remove the unused pvt_clear_data() devres action and its associated devm_add_action() registration - Link to v5: https://lore.kernel.org/all/20260515091942.449-1-hehuan1@eswincomputing.com/ Changes in v5: - Update eswin,eic7700-pvt.yaml - Drop the label enum constraint and remove label from the required list - Add '#thermal-sensor-cells' to the required list - Rename the example node to the generic sensor@... form - Update the binding description to describe one temperature sensor and one voltage sensor - Update eic7700-pvt.c - Register the hwmon device with the fixed name "pvt" - Remove label-based instance identification from the driver - Fix CONFIG_PM=n support by keeping the clock enabled when runtime PM is unavailable - Add pm_runtime_force_suspend() in the cleanup path to avoid leaving the device active during unbind - Switch system sleep callbacks to pm_runtime_force_suspend() and pm_runtime_force_resume() - Guard ISR register accesses with pm_runtime_get_if_active() - Add synchronize_irq() on the timeout path to avoid stale completion races - Remove temp_offset support because the raw trim register does not match the hwmon ABI - Align the commit message with the implementation (one temperature sensor, one voltage sensor) - Link to v4: https://lore.kernel.org/all/20260430064107.1598-1-hehuan1@eswincomputing.com/ Changes in v4: - Update eswin,eic7700-pvt.yaml - Delete reviewed-by tag of Conor Dooley, because the label enum constraint is introduced - Update eic7700-pvt.c and eic7700-pvt.h - Remove the unused LVT/ULVT/SVT process-monitoring channels - Remove the probe-time power check since the PVT block is always powered on EIC7700 and the extra verification is unnecessary - Stop requesting the interrupt as shared and use the dedicated PVT IRQ only - Reorder probe initialization so the interface is initialized before the clock is disabled, avoiding register accesses with the clock gated - Fix runtime PM reference handling on error paths by balancing pm_runtime_get_noresume() with pm_runtime_put_noidle() - Add pm_runtime_put_noidle() handling for failed pm_runtime_get_sync() calls in hwmon read/write paths - Switch the PM callback registration from pm_sleep_ptr() to pm_ptr() - Link to v3: https://lore.kernel.org/all/20260306094312.1043-1-hehuan1@eswincomputing.com/ Changes in v3: - Update eswin,eic7700-pvt.yaml - Remove redundant label property description and use 'label: true' to reference the definition in hwmon-common.yaml - Replace 'additionalProperties: false' with 'unevaluatedProperties: false' - Remove the description for '#thermal-sensor-cells' - Update eic7700-pvt.c and eic7700-pvt.h - Fix clock reference count imbalance with Runtime PM: Replace devm_clk_get_enabled() with devm_clk_get() and manually manage clock enable/disable to avoid double-disable in remove() when Runtime PM is active. Clock is now enabled only during probe for eic7700_pvt_check_pwr(), then disabled before enabling Runtime PM, which takes full control of the clock thereafter - Add detailed comment explaining the spurious interrupt risk in eic7700_pvt_check_pwr() - Replace wait_for_completion_interruptible() with wait_for_completion_timeout() to prevent infinite wait - Link to v2: https://lore.kernel.org/all/20260128101400.859-1-hehuan1@eswincomputing.com/ Changes in v2: - Update eswin,eic7700-pvt.yaml - Reference the hwmon-common.yaml file - Remove the clock-names and reset-names properties - Move additionalProperties: false after the required block - Remove one example node to avoid redundancy - Update eic7700-pvt.c and eic7700-pvt.h - Remove unused sensor macros (PVT_SENSOR_FIRST, PVT_SENSOR_LAST, PVT_SENSORS_NUM) - Drop the unnecessary hwmon-sysfs.h header - Replace dynamic sensor info allocation with a static array and unify sensor labels - Remove unused hwmon_temp_type attribute - Eliminate redundant validation checks - Remove mutex and related locking, relying on hwmon core serialization - Replace per-sensor caches and completions with a single data cache and completion object - Remove pvt->sensor tracking. ISR no longer depends on the currently selected sensor - Move devm_add_action() registration after init_completion() for safer cleanup, and update cleanup function (pvt_clear_data) - Replace devm_reset_control_get_optional_exclusive() with devm_reset_control_get_exclusive_deasserted() - Replace eic7700_pvt_remove() with eic7700_pvt_disable_pm_runtime() and move it after PM runtime enable to avoid resource leaks on probe failure and remove clock disable and reset assert from eic7700_pvt_disable_pm_runtime() as it is already handled by devm_* framework - Remove redundant clock presence check in runtime_resume - Link to v1: https://lore.kernel.org/all/20260109090718.442-1-hehuan1@eswincomputing.com/ Huan He (2): dt-bindings: hwmon: Add Eswin EIC7700 PVT sensor hwmon: Add Eswin EIC7700 PVT sensor driver .../bindings/hwmon/eswin,eic7700-pvt.yaml | 72 +++ drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/eic7700-pvt.c | 509 ++++++++++++++++++ drivers/hwmon/eic7700-pvt.h | 99 ++++ 5 files changed, 692 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/eswin,eic7700-pvt.yaml create mode 100644 drivers/hwmon/eic7700-pvt.c create mode 100644 drivers/hwmon/eic7700-pvt.h -- 2.34.1