Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp726508pxb; Thu, 15 Apr 2021 05:16:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIg5M4BmTK4cLXI453XHozKK41IsOkidcP7fPIPY5/Nvy5lrwGKUgoBtNQQKdGZRkL1aPq X-Received: by 2002:a65:4382:: with SMTP id m2mr3202856pgp.354.1618489000291; Thu, 15 Apr 2021 05:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618489000; cv=none; d=google.com; s=arc-20160816; b=WV5QcCQNmIuKLnWdwN9tZsl+7nwQcAJGx4y/Cek10SYlRgZM4ZoAEBiS0NMsvx89bc yQInA0N0axpU5ZG8CrTiv4Bz17teRjkycBaytAT4LoEWfzC5YqjgewsWCV27pRwMnzQI 4fzf2tDDudPC7R0x3O0b39Tp6u7anoSMyVeKaQhv5bLqGERAFJC4UQRPAnI7tAeX3uI6 DzbWePdLgVhSt/19TT+mQo/JeASrqTNqqqk8UQxY5xw+v7jPubB5EEviCL1uwm8hF/MZ MGCpw/LxklN7pZ0N5jIgGHCytDa5vBArarcvOkq6Blu49ldWBAiEdZ8kFiyhnSTDX6WE sGxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SxiB/wQTlRoG8/dxG1/RTDvR1hDyB+kFAQl39HISeJU=; b=c7Y1uQ3AefyD+H90bWXxIVhu2XgEyym9s5rpP4e8fEtFM7GLPBr7rWHzJ7cigQzU2S E+gYcPnkm1fcFk5GjKNr1QVX3dp30BWho8+OilJ4WYa8o0fdl20TXkwd0b6lSnBdSi2H 6/ehmQjD3yOqlpIYPz9zANqn14/LotlFBylOt9klqKnTT/xRJHhgqP3iGF5h1cjuwQF2 OVj5IEtfV0noh9FME8zeEwiabNlSU2AG27lo82URxLoUI45T0zSzLsEACKNUlmbQuS2t J6ofvrLQTAHp2YVnHGq/AyNqOi2tfHYmrpWWLxd1XnajW90WMz4u3Irj+GZkej4w7ICN iK8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=xcOan3DD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=pqgruber.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v4si3059995ple.156.2021.04.15.05.16.28; Thu, 15 Apr 2021 05:16:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=xcOan3DD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=pqgruber.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232842AbhDOMP6 (ORCPT + 99 others); Thu, 15 Apr 2021 08:15:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232789AbhDOMPy (ORCPT ); Thu, 15 Apr 2021 08:15:54 -0400 Received: from mail.pqgruber.com (mail.pqgruber.com [IPv6:2a05:d014:575:f70b:4f2c:8f1d:40c4:b13e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE8D7C061756; Thu, 15 Apr 2021 05:15:31 -0700 (PDT) Received: from workstation.tuxnet (213-47-165-233.cable.dynamic.surfer.at [213.47.165.233]) by mail.pqgruber.com (Postfix) with ESMTPSA id 61DC3C725D8; Thu, 15 Apr 2021 14:15:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1618488930; bh=SxiB/wQTlRoG8/dxG1/RTDvR1hDyB+kFAQl39HISeJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xcOan3DDCz5Rq3XfIWpufXfrToPMMrhC90mGBQGWaL1xy1QiUmR092zwCzAPHbi6S Pk8zVPT06sMnqQ7H80pLkUCyrqMHYqj3dZEVneGgTC+yOszyFws2jebS44RZbt7TwG dQ5CFJGGkmT5ITLa+gYZXfaLyzONeIE8EoZKh3fE= From: Clemens Gruber To: linux-pwm@vger.kernel.org Cc: Thierry Reding , Sven Van Asbroeck , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Clemens Gruber Subject: [PATCH v9 5/8] pwm: core: Support new PWM_USAGE_POWER flag Date: Thu, 15 Apr 2021 14:14:52 +0200 Message-Id: <20210415121455.39536-5-clemens.gruber@pqgruber.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210415121455.39536-1-clemens.gruber@pqgruber.com> References: <20210415121455.39536-1-clemens.gruber@pqgruber.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the flag PWM_USAGE_POWER is set on a channel, the PWM driver may optimize the signal as long as the power output is not changed. Depending on the specific driver, the optimization could for example improve EMI (if supported) by phase-shifting the individual channels. Signed-off-by: Clemens Gruber --- drivers/pwm/core.c | 9 +++++++-- include/linux/pwm.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index a8eff4b3ee36..56a9c739e1b2 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -153,9 +153,14 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args) pwm->args.period = args->args[1]; pwm->args.polarity = PWM_POLARITY_NORMAL; + pwm->args.usage_power = false; - if (args->args_count > 2 && args->args[2] & PWM_POLARITY_INVERTED) - pwm->args.polarity = PWM_POLARITY_INVERSED; + if (args->args_count > 2) { + if (args->args[2] & PWM_POLARITY_INVERTED) + pwm->args.polarity = PWM_POLARITY_INVERSED; + if (args->args[2] & PWM_USAGE_POWER) + pwm->args.usage_power = true; + } return pwm; } diff --git a/include/linux/pwm.h b/include/linux/pwm.h index e4d84d4db293..555e050e8bec 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -41,6 +41,7 @@ enum pwm_polarity { struct pwm_args { u64 period; enum pwm_polarity polarity; + bool usage_power; }; enum { -- 2.31.1