From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753282AbdDJKdh (ORCPT ); Mon, 10 Apr 2017 06:33:37 -0400 Received: from mga02.intel.com ([134.134.136.20]:51132 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752941AbdDJKdf (ORCPT ); Mon, 10 Apr 2017 06:33:35 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,182,1488873600"; d="scan'208";a="1117708594" Date: Mon, 10 Apr 2017 13:33:20 +0300 From: Mika Westerberg To: Sven Van Asbroeck Cc: thierry.reding@gmail.com, 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: <20170410103320.GG2957@lahna.fi.intel.com> References: <1491754284-3870-1-git-send-email-svenv@arcx.com> <1491754284-3870-2-git-send-email-svenv@arcx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1491754284-3870-2-git-send-email-svenv@arcx.com> 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 Sun, Apr 09, 2017 at 12:11:24PM -0400, Sven Van Asbroeck wrote: > gpio-only driver operation never clears the SLEEP bit, which can > cause the gpios to become unusable. > > Example: > 1. user requests first pwm -> driver clears SLEEP bit > 2. user frees last pwm -> driver sets SLEEP bit > 3. user requests gpio > 4. user switches gpio on -> output does not turn on > because SLEEP bit is set > > Prevent this behaviour by keeping the SLEEP bit cleared > for the lifetime of the driver instance. > > Fixes: bccec89f0a35 ("Allow any of the 16 PWMs to be used as a GPIO") > Signed-off-by: Sven Van Asbroeck 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.