From patchwork Thu Dec 29 14:10:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 709510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tqBM926P4z9sQw for ; Fri, 30 Dec 2016 01:10:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=agner.ch header.i=@agner.ch header.b="P8MBpGue"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752668AbcL2OKM (ORCPT ); Thu, 29 Dec 2016 09:10:12 -0500 Received: from mail.kmu-office.ch ([178.209.48.109]:55315 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752311AbcL2OKL (ORCPT ); Thu, 29 Dec 2016 09:10:11 -0500 Received: from trochilidae.toradex.int (unknown [46.140.72.82]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 6166D5C383E; Thu, 29 Dec 2016 15:02:01 +0100 (CET) From: Stefan Agner To: l.majewski@majess.pl, thierry.reding@gmail.com Cc: s.hauer@pengutronix.de, linux-pwm@vger.kernel.org, bhuvanchandra.dv@toradex.com, linux-kernel@vger.kernel.org, fabio.estevam@nxp.com, boris.brezillon@free-electrons.com, LW@karo-electronics.de, kernel@pengutronix.de, shawnguo@kernel.org, Stefan Agner Subject: [PATCH] pwm: imx: keep peripheral clock enabled during register access Date: Thu, 29 Dec 2016 15:10:41 +0100 Message-Id: <20161229141041.16369-1-stefan@agner.ch> X-Mailer: git-send-email 2.11.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1483020121; bh=Ga4eBbBr3M7ohu9Ixc4LifhXQymhrDaFLNLr4i0vG+I=; h=From:To:Cc:Subject:Date:Message-Id; b=P8MBpGueObCmzaxqGEicPo1sdxW81Z88oQdgT/D0ML65+DSeHl7Bc7sZSGVHFySPrPRxxRnVccNqqw8w0QIt7L3FuPKff0Jm0rHvLS97BC/PNK1amLs5L5grrjSHcYA+8TBhNK6tHiDYKIkrzNx/BtwMy61at+13QUm1yIjnyrs= Sender: linux-pwm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org On some platforms (i.MX 7) the peripheral clock is required during register access. Make sure that the clock is kept enabled when accessing registers. Signed-off-by: Stefan Agner --- Hi Thierry, hi Lukasz, This patch applies ontop of Lukasz "pwm: imx: Provide atomic operation for IMX PWM driver" patchset. With that, my expressed concern to patch 2 is solved. -- Stefan drivers/pwm/pwm-imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c index a21463436aa4..fbd997514a87 100644 --- a/drivers/pwm/pwm-imx.c +++ b/drivers/pwm/pwm-imx.c @@ -192,7 +192,7 @@ static int imx_pwm_apply_v2(struct pwm_chip *chip, struct pwm_device *pwm, period_cycles = 0; /* Enable the clock if the PWM is being enabled. */ - if (state->enabled && !cstate.enabled) { + if (!cstate.enabled) { ret = clk_prepare_enable(imx->clk_per); if (ret) return ret; @@ -223,7 +223,7 @@ static int imx_pwm_apply_v2(struct pwm_chip *chip, struct pwm_device *pwm, writel(cr, imx->mmio_base + MX3_PWMCR); /* Disable the clock if the PWM is being disabled. */ - if (!state->enabled && cstate.enabled) + if (!state->enabled) clk_disable_unprepare(imx->clk_per); return 0;