Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13292016pxu; Sun, 3 Jan 2021 09:08:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAqs7n9YJlTTrzVsyUE4bQstGroyfvcz8mQa29UGDUWXsztoZcUXhwS50IZsB/rYXQNKop X-Received: by 2002:a50:875b:: with SMTP id 27mr68703726edv.24.1609693712937; Sun, 03 Jan 2021 09:08:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609693712; cv=none; d=google.com; s=arc-20160816; b=D9+NYjfLta9GLNFIB1Pbb4DySHgrLMVg1lNSWT94i94BKirHWTzKSjlmB3F8FNhUrn TwpDteg0/HhxS+S9xVbGQf1hKfmKaHwskHEKNms9PVRAvPa+EBKO9SwH2rYigmIT0DnR fyxUJU5laTBcfc5iMyjSRs9pkcX89DQgtTMy0XTEq0yJ+AbXDHqE3TIpdeZeBUXYopje /j4r2AXzzhJndM78kBlVXPH1QsdfQ0sTNn3sdboGnwCUblHR+NXIMNIcwwUmE4rVK39p IKNIGPBHHLu9VnAM4Zm/h4wRGgnCt/9UMWuYmD/rEaxIjTam4iruaftTcBv6PVU+LbE9 1eFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5dqq/DsJwfVHsgRwxYYIC0zb6W8E9Tab6yx3XUhiPgk=; b=cwwqFpizYV1IxJHRW+iRZCFWCAod0MxID+2I4+sC7b4nNCL4obhmpFKvpcfCaIh86z tEtt4A2gZOVanuQeuFFB/a6NczCmHJjZnTyACvWVej/P7s9O2ZK6g4OCYGNio39lPREM hiOmJHXOri8i8abJLUzWXhTSwBLxqjz3/sYXKmDQl6M0FV6d/5CUxXfs1ni2ZW5NMLVF nb2ZVBkzqdnnLqdKF+ZhvhWr9xVClbwASlyDSgkqaFsn0G6elLGNsDjmiy1CSCoTjhQ8 9A3iexuW+o2ppCCQ6fS+X7AMqf6TxmvlZvksTULHq5j5JAJ/Fv8HP8rnwhcmGxs2lORE Ic0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=ZrhMgvCZ; 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=QUARANTINE 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 k4si30483697eds.355.2021.01.03.09.08.09; Sun, 03 Jan 2021 09:08:32 -0800 (PST) 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=ZrhMgvCZ; 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=QUARANTINE sp=NONE dis=NONE) header.from=pqgruber.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727338AbhACREy (ORCPT + 99 others); Sun, 3 Jan 2021 12:04:54 -0500 Received: from mail.pqgruber.com ([52.59.78.55]:57830 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726952AbhACREy (ORCPT ); Sun, 3 Jan 2021 12:04:54 -0500 Received: from workstation.tuxnet (213-47-165-233.cable.dynamic.surfer.at [213.47.165.233]) by mail.pqgruber.com (Postfix) with ESMTPSA id 1EE9DC68B88; Sun, 3 Jan 2021 18:04:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1609693452; bh=5dqq/DsJwfVHsgRwxYYIC0zb6W8E9Tab6yx3XUhiPgk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZrhMgvCZoiIvHxr4i0+l4IoL7AL5J4mPkOi9NXMdTEW92fVjRmNmhO8DMvVOmeNAa DE4GKX1Mzy8vPzwj3OKG6dHGCiKpsUdlkJGEhfzlf0iVrPcMuJsy4Wd06LMYUcQ1g6 HFFLguxQModKdMFhZXKgGPDRSo/EXQBObus0il/k= Date: Sun, 3 Jan 2021 18:04:10 +0100 From: Clemens Gruber To: Thierry Reding , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Sven Van Asbroeck Cc: Linux Kernel Mailing List , linux-pwm@vger.kernel.org Subject: Re: [PATCH v5 2/7] pwm: pca9685: Support hardware readout Message-ID: References: <20201216125320.5277-1-clemens.gruber@pqgruber.com> <20201216125320.5277-2-clemens.gruber@pqgruber.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi everyone, happy new year, hope you are all well! On Thu, Dec 17, 2020 at 12:52:42PM -0500, Sven Van Asbroeck wrote: > On Thu, Dec 17, 2020 at 12:43 PM Clemens Gruber > wrote: > > > > > > Conclusion: .get_state() will always return "pwm disabled", so why do we > > > bother reading out the h/w? > > > > If there are no plans for the PWM core to call .get_state more often in > > the future, we could just read out the period and return 0 duty and > > disabled. > > I'm not sure why we should even read out the period? > When a channel is disabled, the period is not externally visible, > therefore it's meaningless ? > > As far as I can tell, we can use this for .get_state(): > memset(&pwm->state, 0, sizeof(pwm_state)); > > > > > Thierry, Uwe, what's your take on this? I will continue working on this series in the upcoming weeks. Feedback on the .get_state issue would be greatly appreciated. To summarize: Is it OK for a driver to expect the chip->ops->get_state function to be only called from the place in pwm core it is currently called from? (Namely in pwm_device_request after chip->ops->request) If yes, we could always return a 0 duty cycle and disabled state, because this is the state we left it in after .probe (and .free). However, if in the future, the pwm core adds additional calls to chip->ops->get_state in other places, this could lead to problems. -- Another point is the period: Sven suggested we do not read out the period at all, as the PWM is disabled anyway (see above). Is this acceptable? And, if we never return anything but 0 in .get_state, should it be implemented at all? > > > > > Of course, if we choose to leave the pwm enabled after .free(), then > > > .get_state() can even be left out! Do we want that? Genuine question, I do > > > not know the answer. > > > > I do not think we should leave it enabled after free. It is less > > complicated if we know that unrequested channels are not in use. > > > > Good point, I agree with you. Thanks and best regards, Clemens