Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755042Ab3CFExb (ORCPT ); Tue, 5 Mar 2013 23:53:31 -0500 Received: from hqemgate04.nvidia.com ([216.228.121.35]:7481 "EHLO hqemgate04.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768Ab3CFExa (ORCPT ); Tue, 5 Mar 2013 23:53:30 -0500 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Tue, 05 Mar 2013 20:47:31 -0800 Message-ID: <5136CBC7.3030803@nvidia.com> Date: Wed, 6 Mar 2013 13:53:27 +0900 From: Alex Courbot Organization: NVIDIA User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: Andrew Chew CC: "thierry.reding@avionic-design.de" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/1 v3] pwm_bl: Add support for backlight enable regulator References: <1362527485-8611-1-git-send-email-achew@nvidia.com> <5136A781.2050303@nvidia.com> <643E69AA4436674C8F39DCC2C05F7638629BFE1DB7@HQMAIL03.nvidia.com> In-Reply-To: <643E69AA4436674C8F39DCC2C05F7638629BFE1DB7@HQMAIL03.nvidia.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1141 Lines: 27 On 03/06/2013 11:41 AM, Andrew Chew wrote: >>> struct pwm_bl_data { >>> struct pwm_device *pwm; >>> struct device *dev; >>> + struct regulator *en_supply; >>> + bool en_supply_enabled; >> >> Couldn't you use regulator_is_enabled() and get rid of en_supply_enabled? >> It would also ensure the driver performs correctly no matter what the initial >> state of the regulator is. > > Are you sure this works? I'm concerned about the (bizarre and unlikely) case > where this supply is shared with another driver, so I use en_supply_enabled > to track the state of the supply such that I can ignore that case. You're right, consumers can share regulators and the calls to enable/disable need to be balanced. Also there is no way to check the intensity of the backlight prior to the change to detect a transition, so I guess your approach is indeed the most appropriate here. Alex. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/