From patchwork Sat Jan 30 04:26:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David Rivshin (Allworx)" X-Patchwork-Id: 8169511 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 329D29F818 for ; Sat, 30 Jan 2016 04:30:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FDB720396 for ; Sat, 30 Jan 2016 04:30:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A938E20397 for ; Sat, 30 Jan 2016 04:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755916AbcA3Eaj (ORCPT ); Fri, 29 Jan 2016 23:30:39 -0500 Received: from mail-qg0-f68.google.com ([209.85.192.68]:35464 "EHLO mail-qg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754355AbcA3Eag (ORCPT ); Fri, 29 Jan 2016 23:30:36 -0500 Received: by mail-qg0-f68.google.com with SMTP id b35so6626830qge.2; Fri, 29 Jan 2016 20:30:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mSybQWTFC6vq2Mt9E0XkWsnbtP2Clq+auC1y91XGoes=; b=Uf99eOLrXksObH6/xBZnadhlBBORiK2L2pXt87F4YZ05TfQbQ6S30Di1RXDFeVHsCv bDwXN0MN8ScfEV0vBIAaXf12YC5eSj1MACe9wzWkzibpPOF8u8oh96gm0OWkcmyEFp4b np5jMnwNNsQj5GgVXjVCy80ZLcrq5x3coTuPfMRknRuE27uT+a2oiu89jy4NS7lBzr0E jsiIWN02oBFGWzVQOMgpJhkyN7bATRjvImVXt0MrW2POpf2JtOU4j26Z8YA7tZCwQNZP M1ijok7aAL67wUAJJCTjopG40sspK82wZ8olgCjDs34mlsxvVsS48NrJMzL7tpviWu0T wQvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mSybQWTFC6vq2Mt9E0XkWsnbtP2Clq+auC1y91XGoes=; b=VYxkwKol/gMGbqwVxsk3xzos6BOGrpDpR9NVdAhs3wZhdZXJmGFXcPuQErmbSEFhhA xokvoiki/LR8/DfT0x9hOGYurGMavvtBGQ+d/OHuxADpiBLa84yISPHmZhypbSEzouan i5zlLKU6ZhFDC9S03PplTigNUI4Gm0hCAWeNXWqQzrB0ESoj0eKe0RlGACCGUmuf3+Et Tm7pmvpWdx7VGLHWFd7ETnZs7EFBi1wx/kYA8mN7fNT+SN0Zn3GjiLBScEvndRkDBMRi A+am6DwBa7NmQ6I6PmkgXDNBNU1xPiHw1vRjFkYe2jFotBN9Z81SmEUpB5+ex/gheuLU /ppw== X-Gm-Message-State: AG10YOR0Qp6xo+7iQVyXVXWOu7gUhpJgrPQYdk0DW/S9zgsjr/o8cjk35xhHaM3Ry6p5uA== X-Received: by 10.140.223.148 with SMTP id t142mr16074419qhb.65.1454128236068; Fri, 29 Jan 2016 20:30:36 -0800 (PST) Received: from drivshin-linux.crosskeys.inscitek.com ([24.213.148.66]) by smtp.gmail.com with ESMTPSA id y104sm8404563qgd.33.2016.01.29.20.30.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jan 2016 20:30:35 -0800 (PST) From: "David Rivshin (Allworx)" To: linux-pwm@vger.kernel.org, Thierry Reding , Neil Armstrong Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tony Lindgren , Grant Erickson , NeilBrown , Joachim Eastwood Subject: [PATCH 4/4] pwm: omap-dmtimer: add dev_dbg() message for effective period and duty cycle Date: Fri, 29 Jan 2016 23:26:54 -0500 Message-Id: <1454128014-22866-5-git-send-email-drivshin.allworx@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454128014-22866-1-git-send-email-drivshin.allworx@gmail.com> References: <1454128014-22866-1-git-send-email-drivshin.allworx@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: David Rivshin After going through the math and constraints checking to compute load and match values, it is helpful to know what the resultant period and duty cycle are. Signed-off-by: David Rivshin Acked-by: Neil Armstrong --- I found this helpful while testing the other changes, so I included it in case it may be of use to someone in the future. I would have no issues with dropping this if it's not considered worthwhile. drivers/pwm/pwm-omap-dmtimer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c index 8c9953c..44e3dca 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -102,7 +102,8 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip, unsigned long clk_rate; bool timer_active; - dev_dbg(chip->dev, "duty cycle: %d, period %d\n", duty_ns, period_ns); + dev_dbg(chip->dev, "requested duty cycle: %dns, period: %dns\n", + duty_ns, period_ns); mutex_lock(&omap->mutex); if (duty_ns == pwm_get_duty_cycle(pwm) && @@ -163,6 +164,12 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip, duty_cycles = period_cycles - 1; } + dev_dbg(chip->dev, "effective duty cycle: %lldns, period: %lldns\n", + DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * duty_cycles, + clk_rate), + DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * period_cycles, + clk_rate)); + load_value = (DM_TIMER_MAX - period_cycles) + 1; match_value = load_value + duty_cycles - 1;