Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2917786imu; Wed, 7 Nov 2018 01:37:52 -0800 (PST) X-Google-Smtp-Source: AJdET5cxrqeZORnzgrsaB6bAG1zKWRcHPxfgWhz/gruKIvYg/dO6ZjLXjKrNj5udtuuP1k9iQp9y X-Received: by 2002:a17:902:15c5:: with SMTP id a5-v6mr1210764plh.136.1541583472897; Wed, 07 Nov 2018 01:37:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541583472; cv=none; d=google.com; s=arc-20160816; b=dSGCl2xggoSTTmK+Pn5Dakwf6WMSGwnq9TfGGANO69Nor929jZqWHl0zTlM68hVvho +nsiHi/0Ijo+Ud6I7gkCXVWqWLyolzTnX8IMgyLt4rU506TlnJ2GBol13QfBtsiVqv2q QpWSgrumoWUfAE1Cs9zDy5+mtL8stIa3xHkswMUw6mnp72LoQs73Ir7rYgliBLqIUSWF Bz3pcEptsgbgmFDAtqgfvpExBT+usLyOO6x5i6wDrNRB42Vdn+7sxbxe4u0b6H2TElAD f6kEtI8DjcT9unKGMp0+pD/nJIkBaVvkK+4EzGkngJABM5j6nZfE8Ex/q1W72tag0QjU sLWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KQGegao9zNeFUWhEcMMURli/nhZvxVqW1koxmyGrXEs=; b=J702/CX7kIq2PiKB2MyZtOGDI7QsSp12Zv2tRO8wAgL0YT7o4/h4wOj7Kx6F/91/Hx jLENJei34K2Q/4MOHSnVVX8CucO3x3WQTOKXH/O9e31N5ixToL5/+9Z0DFckKH4MCAzi Bu6Aoth8JGYDshHC/8sDS2RVuMANSwMay0d+9TrzMMUBDa0X+t28ecKA9HSMXfWgcBld 7SmY9hHxfc7DpVZWx9c3SGHKGY6YF659D53HomSytYX1WSlTjGwDweD0gNzZXOEtKBfT tVehjmnystNDsMMVL85tCTuEraPN31aOSBCKcpX3b5BE1BYobdJ8YAhVAjP1kjqvdMTQ +CHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u9pdVTgB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si69144pgg.162.2018.11.07.01.37.38; Wed, 07 Nov 2018 01:37:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u9pdVTgB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730461AbeKGTGP (ORCPT + 99 others); Wed, 7 Nov 2018 14:06:15 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33033 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726097AbeKGTGP (ORCPT ); Wed, 7 Nov 2018 14:06:15 -0500 Received: by mail-wr1-f68.google.com with SMTP id u9-v6so6269920wrr.0; Wed, 07 Nov 2018 01:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KQGegao9zNeFUWhEcMMURli/nhZvxVqW1koxmyGrXEs=; b=u9pdVTgB1+KoAklw347BeovvNFFyRpuBjjvL54JdBIpbpWjq560Tzz2Atr0HQlc3uP KOfiPW77/VCl7O/vnVqyCjLxmwwIoBLZmbgN106cvjm2C1SilVAofnmUlKynAxk2hDoU 0mEVDNlfxs+9WrRI88GPZiviIyVGhUII6jRTlvy7SLi2DOAkXBMxW91ZNsvlwiHqGVKK BFHa2QYbuU7537x4j7Gqxq129bzewEBRGgEjYW3CrIPMnbxACEwwtfauhtnsbd9RnNfk Z590jFzGSESYpj6DUDcAl1gehWMncmllfsWv3uX49oM/ij2ZgdsOF9a+dXzcKtwR0UXv v0Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KQGegao9zNeFUWhEcMMURli/nhZvxVqW1koxmyGrXEs=; b=oBT1cENtly9TkUypin5bdetfQCKqaWDWNYBCpemZH8Tj74I9hw51gaW85CHUOcUvkT JnhDO0MYMwZDiIJw2RzMUQINS5EPKFNFsjg+4OeFPunFuCRIqPcrLSJRNPfXmNoUjJl8 vexBPkwDCs67yvZgYBjnpjaXrA1ZhlkqGSZCv82KRIO1vazfy7+U2DF1RneMbjwH01Fd 3ELhDitVMlInTr1/2ySDmbmv1TLoNxuSoakd9as3TvWXs8F6e2xAESQDfsOFbO9Jjc+q 43rPoEKhGAbGICsubqlegHinjVpsAeZgCYuK89NWkGo809AD9omGK0p0vhNEXOZtmS6v Xe/Q== X-Gm-Message-State: AGRZ1gIB1RfivZf84G8qX/sNIEzoPgo0j+lPN1lO1/KJda1uvVIPxrIw fxv3gF1OEpDNGR8x+J+Ks9XypulLjsZ+hQ== X-Received: by 2002:adf:8919:: with SMTP id s25-v6mr1099830wrs.44.1541583400877; Wed, 07 Nov 2018 01:36:40 -0800 (PST) Received: from cperon-Latitude-7490.devialet.com (static-css-csd-151233.business.bouyguestelecom.com. [176.162.151.233]) by smtp.gmail.com with ESMTPSA id c14-v6sm350206wmh.44.2018.11.07.01.36.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 01:36:40 -0800 (PST) From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= To: Thierry Reding , Florian Fainelli , Ray Jui , Scott Branden Cc: bcm-kernel-feedback-list@broadcom.com, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Suji Velupillai , =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= Subject: [PATCH 2/2] pwm: bcm-kona: apply pwm settings on enable Date: Wed, 7 Nov 2018 10:36:13 +0100 Message-Id: <20181107093613.26734-2-peron.clem@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181107093613.26734-1-peron.clem@gmail.com> References: <20181107093613.26734-1-peron.clem@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suji Velupillai When pwm_bl framework calls enable, a call to pwm_is_enabled(pwm) still return false, this prevents the backlight being turn on at boot time. Signed-off-by: Suji Velupillai Signed-off-by: Clément Péron --- drivers/pwm/pwm-bcm-kona.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c index 09a95aeb3a70..d991d53c4b38 100644 --- a/drivers/pwm/pwm-bcm-kona.c +++ b/drivers/pwm/pwm-bcm-kona.c @@ -108,8 +108,8 @@ static void kona_pwmc_apply_settings(struct kona_pwmc *kp, unsigned int chan) ndelay(400); } -static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm, - int duty_ns, int period_ns) +static int __pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm, + int duty_ns, int period_ns, bool pwmc_enabled) { struct kona_pwmc *kp = to_kona_pwmc(chip); u64 val, div, rate; @@ -155,7 +155,7 @@ static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm, * always calculated above to ensure the new values are * validated immediately instead of on enable. */ - if (pwm_is_enabled(pwm)) { + if (pwm_is_enabled(pwm) || pwmc_enabled) { kona_pwmc_prepare_for_settings(kp, chan); value = readl(kp->base + PRESCALE_OFFSET); @@ -173,6 +173,12 @@ static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm, return 0; } +static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm, + int duty_ns, int period_ns) +{ + return __pwmc_config(chip, pwm, duty_ns, period_ns, false); +} + static int kona_pwmc_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, enum pwm_polarity polarity) { @@ -216,8 +222,8 @@ static int kona_pwmc_enable(struct pwm_chip *chip, struct pwm_device *pwm) return ret; } - ret = kona_pwmc_config(chip, pwm, pwm_get_duty_cycle(pwm), - pwm_get_period(pwm)); + ret = __pwmc_config(chip, pwm, pwm_get_duty_cycle(pwm), + pwm_get_period(pwm), true); if (ret < 0) { clk_disable_unprepare(kp->clk); return ret; -- 2.19.1