From patchwork Tue Apr 14 18:05:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 6217321 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EB8ADBF4A6 for ; Tue, 14 Apr 2015 18:05:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCC0A201F4 for ; Tue, 14 Apr 2015 18:05:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E7809201B9 for ; Tue, 14 Apr 2015 18:05:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753481AbbDNSF0 (ORCPT ); Tue, 14 Apr 2015 14:05:26 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:33693 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752859AbbDNSFZ (ORCPT ); Tue, 14 Apr 2015 14:05:25 -0400 Received: by pdbnk13 with SMTP id nk13so20589469pdb.0; Tue, 14 Apr 2015 11:05:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=zbCS78hPg9zhgiOMhMVHU2LqHJQyRbxI8STczhSD8Og=; b=DGUk5E9fqK25wc5BGEXrCqeG945aDNOmQM4uDwlG2Y2CuidxCwftfOMBlxxrgKW1nG bUzM8H57MynyB+LTPPwzCXMO8cbk/ng6Ac1lzXUeJSwNw5GjLDKiE1oXhYml4Q5sZfqa J+N6LtvDrkq/ThtIYP+iHpr+pvvcH1/5OAqHbWTAgC4Y32fXdZAJGUnj6Qno9S68NTDP gakywhBTFJ+H/wKBfmBSukEVIgGsJM3ShqiwrU5EbAOeatWgIrfY++DWi5bi5pNXTTzh vPytJHCqzmrJ/JhhGr3L5rCbhgY9Bv4UkmXCMTLAV8B59s5VfaNKaz79cURBjJUPqt0l MWng== X-Received: by 10.68.203.66 with SMTP id ko2mr38074139pbc.156.1429034724551; Tue, 14 Apr 2015 11:05:24 -0700 (PDT) Received: from localhost.localdomain ([115.117.45.106]) by mx.google.com with ESMTPSA id nj7sm1732608pbc.36.2015.04.14.11.05.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Apr 2015 11:05:23 -0700 (PDT) From: Anand Moon To: Thierry Reding , Sjoerd Simons Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Anand Moon Subject: [PATCH] pwm: Add clk enable/disable for pwm_samsung_enable/pwm_samsung_disable Date: Wed, 15 Apr 2015 03:35:08 +0930 Message-Id: <1429034708-4537-1-git-send-email-linux.amoon@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's safe to disable the clk when we following. pwm_config(pwm, 0, period); pwm_disable(pwm); And enable clk when we do following. pwm_config(pwm, duty, period); pwm_enable(pwm); Tested on OdroidXU3 Board. Signed-off-by: Anand Moon --- drivers/pwm/pwm-samsung.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c index 3e9b583..b579753 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -247,6 +247,7 @@ static int pwm_samsung_enable(struct pwm_chip *chip, struct pwm_device *pwm) tcon &= ~TCON_MANUALUPDATE(tcon_chan); tcon |= TCON_START(tcon_chan) | TCON_AUTORELOAD(tcon_chan); writel(tcon, our_chip->base + REG_TCON); + clk_prepare_enable(our_chip->base_clk); spin_unlock_irqrestore(&samsung_pwm_lock, flags); @@ -265,6 +266,7 @@ static void pwm_samsung_disable(struct pwm_chip *chip, struct pwm_device *pwm) tcon = readl(our_chip->base + REG_TCON); tcon &= ~TCON_AUTORELOAD(tcon_chan); writel(tcon, our_chip->base + REG_TCON); + clk_disable_unprepare(our_chip->base_clk); spin_unlock_irqrestore(&samsung_pwm_lock, flags); }