From patchwork Wed Jun 22 19:22:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 9193541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 321FA6075C for ; Wed, 22 Jun 2016 19:23:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EBF828416 for ; Wed, 22 Jun 2016 19:23:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1185128417; Wed, 22 Jun 2016 19:23:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EAFD2840B for ; Wed, 22 Jun 2016 19:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752839AbcFVTXE (ORCPT ); Wed, 22 Jun 2016 15:23:04 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33456 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752667AbcFVTXB (ORCPT ); Wed, 22 Jun 2016 15:23:01 -0400 Received: by mail-wm0-f66.google.com with SMTP id r201so4204587wme.0; Wed, 22 Jun 2016 12:22:59 -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:in-reply-to:references; bh=XPZWyGYgLw4raiuCTMYuQpBOtiCmntuqzlKXYu3z68Q=; b=C/6l4lwzQarc8t1v89j0+ge17/bVclMT/44AZDsBGmZKZ7rgvgC21A/ZF78TBsmbc/ L3ZRTbQwxz1ycQOJzYtOrLzOyAZeYNfBRYOPEMrRkHoMutrG93pFdTveGQGH4Tjk+6in Ei1WbJeH/fDoLzGx6BjHxbtrd0X/3GVIVU9+nuyPxFnz7xqStZAeRqBYpOnxk9affD05 Xo3AlsvKjaxHkPz6s0UWU8k0iZl6tQfpMaooMdOiIS4vx5jSYWzmaj91wBWqu6wa2bYv 9iV+epxBmVh1+bfKSFX5bD33a4x2zTZGpUDNfAtE6acSNFVmOSMfutcp3MAxdeqSLH1y 5UYw== 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=XPZWyGYgLw4raiuCTMYuQpBOtiCmntuqzlKXYu3z68Q=; b=Yc4WugsJ7mg76FCRwgSE8BId2+hsYEexPnblwPGkB3iquwJvCmMT6nxWQpHl2ayUYa s1ibv1k1Rj2PzcBBwR6qsW/Yu3WBpHbfqp1oDBv9HTYvNguIJGnfgfhQF9Mh+q1S/sgt 2uNNyKKQy3+wFsdWPpDU3FHPeMgS4nXdUaWUlqj/Dmw7FoTETLFmt33GdghsyxUQlqzW E9N3h3nygbhoPrdE9kEq5VqXsfHlHPywMC0Ch84GYsi+dDpGxMBFEDEPG5TIqNw1VvYl e+t0C4MOed+pvN4Td90ImgkQ+Su/zHOMHHC6d2qCxX1ppCcVmmxq5JFGv3XKcPGyb6Y6 APMQ== X-Gm-Message-State: ALyK8tIRJU7ag65trU+dKSkwFBeni7xqe7+lUEWWkRmFJrjyXZks5an4O13Pd4IlRXcGkA== X-Received: by 10.28.63.136 with SMTP id m130mr10124978wma.33.1466623379057; Wed, 22 Jun 2016 12:22:59 -0700 (PDT) Received: from localhost.localdomain ([46.249.74.23]) by smtp.gmail.com with ESMTPSA id b200sm265952wmb.9.2016.06.22.12.22.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Jun 2016 12:22:58 -0700 (PDT) From: Ivaylo Dimitrov To: robh+dt@kernel.org, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, thierry.reding@gmail.com, bcousson@baylibre.com, tony@atomide.com, linux@arm.linux.org.uk, mchehab@osg.samsung.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, sre@kernel.org, pali.rohar@gmail.com, pavel@ucw.cz, Ivaylo Dimitrov Subject: [RESEND PATCH v2 2/5] pwm: omap-dmtimer: Allow for setting dmtimer clock source Date: Wed, 22 Jun 2016 22:22:18 +0300 Message-Id: <1466623341-30130-3-git-send-email-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466623341-30130-1-git-send-email-ivo.g.dimitrov.75@gmail.com> References: <1466623341-30130-1-git-send-email-ivo.g.dimitrov.75@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP OMAP GP timers can have different input clocks that allow different PWM frequencies. However, there is no other way of setting the clock source but through clocks or clock-names properties of the timer itself. This limits PWM functionality to only the frequencies allowed by the particular clock source. Allowing setting the clock source by PWM rather than by timer allows different PWMs to have different ranges by not hard-wiring the clock source to the timer. Signed-off-by: Ivaylo Dimitrov Acked-by: Rob Herring Acked-by: Thierry Reding --- Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt | 4 ++++ drivers/pwm/pwm-omap-dmtimer.c | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt b/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt index 5befb53..2e53324 100644 --- a/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt +++ b/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt @@ -9,6 +9,10 @@ Required properties: Optional properties: - ti,prescaler: Should be a value between 0 and 7, see the timers datasheet +- ti,clock-source: Set dmtimer parent clock, values between 0 and 2: + - 0x00 - high-frequency system clock (timer_sys_ck) + - 0x01 - 32-kHz always-on clock (timer_32k_ck) + - 0x02 - external clock (timer_ext_ck, OMAP2 only) Example: pwm9: dmtimer-pwm@9 { diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c index 3e95090..5ad42f3 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -245,7 +245,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) struct pwm_omap_dmtimer_chip *omap; struct pwm_omap_dmtimer_pdata *pdata; pwm_omap_dmtimer *dm_timer; - u32 prescaler; + u32 v; int status; pdata = dev_get_platdata(&pdev->dev); @@ -306,10 +306,12 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) if (pm_runtime_active(&omap->dm_timer_pdev->dev)) omap->pdata->stop(omap->dm_timer); - /* setup dmtimer prescaler */ - if (!of_property_read_u32(pdev->dev.of_node, "ti,prescaler", - &prescaler)) - omap->pdata->set_prescaler(omap->dm_timer, prescaler); + if (!of_property_read_u32(pdev->dev.of_node, "ti,prescaler", &v)) + omap->pdata->set_prescaler(omap->dm_timer, v); + + /* setup dmtimer clock source */ + if (!of_property_read_u32(pdev->dev.of_node, "ti,clock-source", &v)) + omap->pdata->set_source(omap->dm_timer, v); omap->chip.dev = &pdev->dev; omap->chip.ops = &pwm_omap_dmtimer_ops;