From patchwork Wed Sep 14 15:31:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 1677950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pwm-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=tq-group.com header.i=@tq-group.com header.a=rsa-sha256 header.s=key1 header.b=MZsqRlGw; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.a=rsa-sha256 header.s=key1 header.b=BohBRBJt; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4MSPT36VwYz1yhR for ; Thu, 15 Sep 2022 01:31:51 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbiINPbs (ORCPT ); Wed, 14 Sep 2022 11:31:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbiINPbr (ORCPT ); Wed, 14 Sep 2022 11:31:47 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B619C4455F; Wed, 14 Sep 2022 08:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1663169506; x=1694705506; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Tc8r3viZ1THhht9uyUek4ZAite/GHEyNkUji3BY65Oc=; b=MZsqRlGwRLAyfQDSewGd/wRmpZ/arQPDcUlu2LATUyopWDi0535TH3qC /A2LImcBR2TRx3QThpMl2gVEfAi1wDOOSECAdAM+RTzVrihbVYKcU0zvb cAT082AvgURQ+h+oDEjOc4XbkpaxLXFMKyPzibL+t97xICXzJp9yGs/kw +yTchCVOq5qNcjC1VAgZ/6lM0sBtgleQT111+RY5W0CqXa+uaDHSm+D5+ CFFhw1oKBxmPV8r2oSjTTR4VhzLe4JasCEaJDY83bfaSKuIhHH5BSOEPe v90CslkkhGvVT+Cv5Nosu6v3C/o9Oz8FrxoUe2+sSljPiOYEigUljV0N8 w==; X-IronPort-AV: E=Sophos;i="5.93,315,1654552800"; d="scan'208";a="26181296" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 14 Sep 2022 17:31:44 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 14 Sep 2022 17:31:44 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 14 Sep 2022 17:31:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1663169504; x=1694705504; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Tc8r3viZ1THhht9uyUek4ZAite/GHEyNkUji3BY65Oc=; b=BohBRBJtClMjPxH3V+5nDbNMBNlmCcAFnJroPUwUzL6lD+DVTyfpJzOy QlHjwQdIyqjuR9ptRhHJe/TU9Nsbt6I3e0Ph7BUQTOkKZGTW3mfWGRUMu n06SjHu1Ar9AZgm3yxNogpqi17tm8Hjzm+05JUzaOXZZihJAok/K7Vy/i 3iAefo/fkZluuT3GaysZr3d7+uIhH4ukTt7D+7q9YkNWwQaCDsJ0Kv3tk N1BgUFWmpXmz5bZmIrZSD8QpsguzYCqMv7+YDdONCwAppw+Dit7yN96lk ryfEGCOQV3oFTbAiVUl61B50eEq/8wLzssoIQJXiLgkNgpRvdyB98i0lu w==; X-IronPort-AV: E=Sophos;i="5.93,315,1654552800"; d="scan'208";a="26181295" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 14 Sep 2022 17:31:44 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id CA30C280056; Wed, 14 Sep 2022 17:31:43 +0200 (CEST) From: Alexander Stein To: Jean Delvare , Guenter Roeck , Jonathan Corbet , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Lee Jones Cc: Alexander Stein , linux-hwmon@vger.kernel.org, linux-pwm@vger.kernel.org, Markus Niebel Subject: [PATCH v5 0/5] hwmon: pwm-fan: switch regulator dynamically Date: Wed, 14 Sep 2022 17:31:32 +0200 Message-Id: <20220914153137.613982-1-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org Hello everyone, this is the next version for supporting switching off the pwm-fan regulator. Review points from Guenter are included. Changes in v5: * Added Guenter's R-b to Patch 1 & 4 * Removed useless goto (Patch 2) * Added error checking when switching off PWM (Patch 2) * Removed useless branches when switching power (Patch 3) * Removed useless (temporary) variable (Patch 3) * Updated Patch 5 to changes of previous patches * Dropped Patch 6 completly for lack of benefit Changes in v4: * Reordered commits so current behavior is the default all the time * Fixed pwm state bug in Patch 1, this affects the patch context in Patch 2 * Refactor even more code in Patch 3 & 4 for smaller further patches * Squashed the dynamic regulator switch patch and the sysfs attribute patch into one, keeping default behavior. Overhaul the patch to support different modes altogether * Fixed bugs in module removal in pwm1_enable=1 * Moved internal PWM state removal to the end to keep the patch smaller Best regards, Alexander Alexander Stein (5): hwmon: pwm-fan: Refactor fan power on/off hwmon: pwm-fan: Simplify enable/disable check hwmon: pwm-fan: Add dedicated power switch function hwmon: pwm-fan: split __set_pwm into locked/unlocked functions hwmon: pwm-fan: Switch regulator dynamically Documentation/hwmon/pwm-fan.rst | 12 ++ drivers/hwmon/pwm-fan.c | 312 +++++++++++++++++++++++--------- 2 files changed, 241 insertions(+), 83 deletions(-)