Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2886438pxb; Tue, 24 Aug 2021 09:52:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGtV/oAEpv1rSNrWsoLdl2hypJrtcIosBuQKpqdo3j0OLZPdVQaW0X5s5oc8xzVO+PYYEl X-Received: by 2002:a6b:b2d4:: with SMTP id b203mr32569088iof.179.1629823965988; Tue, 24 Aug 2021 09:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629823965; cv=none; d=google.com; s=arc-20160816; b=lqjVBlOUylnZxQV7Ot06euymcRVBF0uZt0l0QD/ojw0AufjJYAHdGBnC97yu+/FYzh rQlzIriFeWEH6JvTjb4knqt5oZr6H1SROJVOQFVIOFzBoz6XxrsIbMfn4QEOsQhq2Uda vwmk670+EEUy8djCzRqPjWZJNGX1qNJ66bIGI0cOrea1SvcB4Wlglnz9KaqWYsfliBNI F1IDCIZOBIPNs8phlVT93zr0TdtnQrKoHh0lIO8iaZmh/jrzY35dN2bLMAaTyC0FSL4V QwLhPigJDW+AWPZ73nxXLdAvH8bCoo1jaivInQmSBT/nMjPTeRO2RQdPFFALWFX7DtHC noRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=9wZsF8XJu97qVYGl5l+KPsPQpMZp7KxW4yvtw+RhBjs=; b=aFD+NUzIhHGC4RGq6BZAfi+P5VT86BCJhkQh8RuLtOUFIybTMSy4Z4WutSALoHI5Ko 3P6F19d3unK50q1U6EyJ7fHdi+yMPpfKBFmyDxqz/r/fAInVcjifGm/zJnllJV/SO1QW sX+9KGYSFslufwhDzj1uSfwqYsJhEUaeZjIIRFr5s20mAj+6CEt4BTGNLq/Y1jh0MWgz 0qs1EQn/Vo06xT2V9KzKBMr+wMqAYoJ5E1VFTVoOJhKac5Qy+3E9ILP7gcuVyEAUtYe3 uh2GtD+0NArZ6EHCFJOVnDpS23NzoQoYjioT8u16eiRFtPUZUzQ5Ixt7Hjtrk5dwQRvB w5Jw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 6si18753431ilx.104.2021.08.24.09.52.34; Tue, 24 Aug 2021 09:52:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234015AbhHXQui (ORCPT + 99 others); Tue, 24 Aug 2021 12:50:38 -0400 Received: from mga02.intel.com ([134.134.136.20]:10298 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbhHXQtw (ORCPT ); Tue, 24 Aug 2021 12:49:52 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10086"; a="204550799" X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="204550799" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2021 09:48:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="684036936" Received: from inlubt0177.iind.intel.com ([10.223.67.91]) by fmsmga006.fm.intel.com with ESMTP; 24 Aug 2021 09:48:48 -0700 From: lakshmi.sowjanya.d@intel.com To: linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com, linux-kernel@vger.kernel.org, mgross@linux.intel.com, andriy.shevchenko@linux.intel.com, tamal.saha@intel.com, bala.senthil@intel.com, lakshmi.sowjanya.d@intel.com Subject: [RFC PATCH v1 15/20] pwm: Add capability for PWM Driver managed state Date: Tue, 24 Aug 2021 22:17:56 +0530 Message-Id: <20210824164801.28896-16-lakshmi.sowjanya.d@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210824164801.28896-1-lakshmi.sowjanya.d@intel.com> References: <20210824164801.28896-1-lakshmi.sowjanya.d@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christopher Hall Add additional flag that can be set by drivers to indicate that the driver will manage its own PWM state. When calling pwm_ops.apply the driver applies the requested state change to the pwm_device reconciling, if possible, any conflicting requests. Intel(R) Timed I/O devices support very limited PWM capabilities. The duty cycle must always be 50% of the period. When changing one parameter at a time through the sysfs interface, it isn't possible for the user or the PWM subsystem to maintain this relation. Signed-off-by: Christopher Hall Signed-off-by: Tamal Saha Signed-off-by: Lakshmi Sowjanya D Reviewed-by: Mark Gross --- drivers/pwm/core.c | 3 ++- include/linux/pwm.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 35e894f4a379..c658585ac3bc 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -554,7 +554,8 @@ int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state) trace_pwm_apply(pwm, state); - pwm->state = *state; + if (!test_bit(PWMF_DRIVERMANAGEDSTATE, &pwm->flags)) + pwm->state = *state; /* * only do this after pwm->state was applied as some diff --git a/include/linux/pwm.h b/include/linux/pwm.h index a0b7e43049d5..d805fee81e2c 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -46,6 +46,7 @@ struct pwm_args { enum { PWMF_REQUESTED = 1 << 0, PWMF_EXPORTED = 1 << 1, + PWMF_DRIVERMANAGEDSTATE = 1 << 2, }; /* -- 2.17.1