From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754463AbdDKJLf (ORCPT ); Tue, 11 Apr 2017 05:11:35 -0400 Received: from mga04.intel.com ([192.55.52.120]:13552 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754432AbdDKJLb (ORCPT ); Tue, 11 Apr 2017 05:11:31 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,184,1488873600"; d="scan'208";a="72471671" Date: Tue, 11 Apr 2017 12:11:26 +0300 From: Mika Westerberg To: Sven Van Asbroeck Cc: Thierry Reding , linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, clemens.gruber@pqgruber.com, andriy.shevchenko@linux.intel.com, Sven Van Asbroeck Subject: Re: [PATCH 1/1] pwm: pca9685: fix gpio-only operation. Message-ID: <20170411091126.GP2957@lahna.fi.intel.com> References: <1491754284-3870-1-git-send-email-svenv@arcx.com> <1491754284-3870-2-git-send-email-svenv@arcx.com> <20170410103320.GG2957@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 10, 2017 at 11:35:39PM -0400, Sven Van Asbroeck wrote: > > How about implementing a real runtime PM in the driver? Then when the > > device is idle regardless of whether it is GPIO or PWM, the SLEEP bit is > > set and cleared accordingly. > > You mean: increase the runtime_pm refcnt when a pwm/gpio is enabled, > and vice versa ? And don't touch the refcnt on pwm/gpio export/unexport? I mean whenever the thing is in use, it is in runtime PM active state. Then when the last user closes the device, it goest to runtime PM suspend state where you effectively set that SLEEP bit. The functions for refcounting are called pm_runtime_get* and pm_runtime_put*. You need to implement runtime PM callbacks for the driver as well. See Documentation/power/runtime_pm.txt for more information.