From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DF90C433DF for ; Wed, 29 Jul 2020 08:12:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD8CF2070B for ; Wed, 29 Jul 2020 08:12:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD8CF2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D6F16E479; Wed, 29 Jul 2020 08:12:24 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id E8B216E478; Wed, 29 Jul 2020 08:12:22 +0000 (UTC) IronPort-SDR: rnlUjDEurStlrRnX6MT6eh+ErT4M28pSbEcBKBlEq+8Lt6sQT1bX2InjwyLUDWeUs2Gw1jVidv 8t3uusWLcq5w== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="150544019" X-IronPort-AV: E=Sophos;i="5.75,409,1589266800"; d="scan'208";a="150544019" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 01:12:22 -0700 IronPort-SDR: s2JNo0zhIjiaCpq1u81jmQCbPSEu3ALLV3y99My7JkY6HkvzEaDoGe40MzeL9eJW6L0vQy+RZd 6tyjyOke+mag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,409,1589266800"; d="scan'208";a="272561398" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga007.fm.intel.com with ESMTP; 29 Jul 2020 01:12:19 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1k0hCE-004eKo-T4; Wed, 29 Jul 2020 11:12:18 +0300 Date: Wed, 29 Jul 2020 11:12:18 +0300 From: Andy Shevchenko To: Hans de Goede Message-ID: <20200729081218.GH3703480@smile.fi.intel.com> References: <20200717133753.127282-1-hdegoede@redhat.com> <20200717133753.127282-7-hdegoede@redhat.com> <20200728185703.GA3703480@smile.fi.intel.com> <1e19e31f-cf68-5607-3027-3b963ce53c39@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1e19e31f-cf68-5607-3027-3b963ce53c39@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: Re: [Intel-gfx] [PATCH v5 06/16] pwm: lpss: Use pwm_lpss_apply() when restoring state on resume X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, intel-gfx , "Rafael J . Wysocki" , linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Mika Westerberg , Len Brown Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Tue, Jul 28, 2020 at 09:55:22PM +0200, Hans de Goede wrote: > On 7/28/20 8:57 PM, Andy Shevchenko wrote: > > On Fri, Jul 17, 2020 at 03:37:43PM +0200, Hans de Goede wrote: ... > > Maybe I'm too picky, but I would go even further and split apply to two versions > > > > static int pwm_lpss_apply_on_resume(struct pwm_chip *chip, struct pwm_device *pwm, > > const struct pwm_state *state) > > > { > > > struct pwm_lpss_chip *lpwm = to_lpwm(chip); > > > if (state->enabled) > > > return pwm_lpss_prepare_enable(lpwm, pwm, state, !pwm_is_enabled(pwm)); > > > if (pwm_is_enabled(pwm)) { > > > pwm_lpss_write(pwm, pwm_lpss_read(pwm) & ~PWM_ENABLE); > > > return 0; > > > } > > > > and another one for !from_resume. > > It is a bit picky :) But that is actually not a bad idea, although I would write > it like this for more symmetry with the normal (not on_resume) apply version, > while at it I also renamed the function: > > /* > * This is a mirror of pwm_lpss_apply() without pm_runtime reference handling > * for restoring the PWM state on resume. > */ > static int pwm_lpss_restore_state(struct pwm_chip *chip, struct pwm_device *pwm, > const struct pwm_state *state) > { > struct pwm_lpss_chip *lpwm = to_lpwm(chip); > int ret = 0; > > if (state->enabled) > ret = pwm_lpss_prepare_enable(lpwm, pwm, state, !pwm_is_enabled(pwm)); > else if (pwm_is_enabled(pwm)) > pwm_lpss_write(pwm, pwm_lpss_read(pwm) & ~PWM_ENABLE); > > return ret; > } > > Would that work for you? Yes. ... > > > + ret = __pwm_lpss_apply(&lpwm->chip, pwm, &saved_state, true); > > > + if (ret) > > > + dev_err(dev, "Error restoring state on resume\n"); > > > > I'm wondering if it's a real error why we do not bail out? > > Otherwise dev_warn() ? > > It is a real error, but a single PWM chip might have multiple controllers > and bailing out early would mean not even trying to restore the state on > the other controllers. As for propagating the error, AFAIK the pm framework > does not do anything with resume errors other then log an extra error. OK. -- With Best Regards, Andy Shevchenko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx