Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2260108pxb; Mon, 12 Apr 2021 19:54:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0uCagifT6hWn17adUl10SavCnET8PvD7ZVfk/GF6N9k6XN18ZTNrzpw9YLJ3QnXzDmk4L X-Received: by 2002:a05:6402:74b:: with SMTP id p11mr32927379edy.40.1618282473980; Mon, 12 Apr 2021 19:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618282473; cv=none; d=google.com; s=arc-20160816; b=zpAaqSU+4Lqaq7JSl3ZOiFN19PWiNFYqYZvxjwzMO7sv/syJAtZrSkR68KHUgSCPCx KD40QJYzKYCLYUtsTSuUYik/o4ThpqJ8kdTAkpVyVz7eC4XHe/DJM0pgcmygYIzxgUag BA/dOI6tRrzTVDxbGa60tPpwtrA//bgx19v4/M2rHL79q2uMzrXY2Cw0YI9+2IeK7h9d oNrnyhnNW4cqPF5zjsO/OAfEQ7HHciGI7XwYX7TbSscMGzetTybyPJ60fg2vX75LXhTa 6ttBA0fUb/MkVKePIhX+vq0My1cfQ1QXKDo8Wv6pqVuYX7msmMK5ViglwJiFgtstoQ2t O2sQ== 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=eihO2IHLyYSAsVYkiQiUns9gdzQbNkVaFf310a7AEiQ+HUxIlBbuUJDuRksqIhW7Xl F5D69qJQCDRzg8z3akYK0zT44OjHy6e+DNpp3Fkl67bXLIPZgAqX4K+qgwr0rT+Lrwed eKK8gEmpp3jvPeNHuT4scOt+rsQz/k2jlUddddWsQ0IyZ82Qj7UgZk/oO2ImrFq/OrZy Gl692wakC6tiyUIFcAR+WNeKak37eAbmsmuH6qKPw7r7ymS+E4gQvpopFpRySfvqFm4u bnf9rvjE0/++ybn2/KH5TySyXo3/788MSZ/B6uqutrLxVKRomHQ0DbOmexO6W3NneCNc Z0kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=bHWDhbPt; 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 mp1si8672792ejc.457.2021.04.12.19.54.10; Mon, 12 Apr 2021 19:54:33 -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=bHWDhbPt; 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 S241893AbhDLN3t (ORCPT + 99 others); Mon, 12 Apr 2021 09:29:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241820AbhDLN3o (ORCPT ); Mon, 12 Apr 2021 09:29:44 -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 60C88C06138C; Mon, 12 Apr 2021 06:29:22 -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 AE1F3C725CF; Mon, 12 Apr 2021 15:29:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1618234161; bh=SxiB/wQTlRoG8/dxG1/RTDvR1hDyB+kFAQl39HISeJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHWDhbPtqiUMa6Te6Xl59XLDbFz8txMpjGNr0YkdnVWVRO/1ALoBmUmIQvltK7RQW y1NO+GCZ5gMEKHFOTvJ0Ubd04nOpb/pYpi413xKBnx+LFANvco3Qk95zQsrZGrn5fZ whWZJeWCz42nPfFlduLSWibAAZq0UlBCewbpQgms= 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 v8 5/8] pwm: core: Support new PWM_USAGE_POWER flag Date: Mon, 12 Apr 2021 15:27:42 +0200 Message-Id: <20210412132745.76609-5-clemens.gruber@pqgruber.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412132745.76609-1-clemens.gruber@pqgruber.com> References: <20210412132745.76609-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