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: 9193571 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 AE8C56075A for ; Wed, 22 Jun 2016 19:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A3152840A for ; Wed, 22 Jun 2016 19:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F12F28415; Wed, 22 Jun 2016 19:24:59 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 522212840A for ; Wed, 22 Jun 2016 19:24:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFnkA-0000jL-NB; Wed, 22 Jun 2016 19:23:22 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFnk6-0000hs-KC for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2016 19:23:20 +0000 Received: by mail-wm0-x242.google.com with SMTP id a66so4212778wme.2 for ; Wed, 22 Jun 2016 12:23:00 -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=QM07e93/I1RNENV87CyLF3bp1WJXPUIiMMEGllNbV+GpJRdwN+MAPYffRZnviDsL+x y5x+PrdpOhmagCWC9OFUrBeS47EaO3pp1PS+czBF8cj7IXctcAMbeOJIAkVnVA9WCFey X/Jy2o1zIQy2mNEPjul6p9yZexMYaQncPMWtC+4meAflN9WUq8FMpUQkXnCn4FmYc9w5 qGmyEALGbJ9D9hXGTbKRJotan5UZjgndliTJkPWmAjFN49HK8cWwdq2Yvn8bZjr/x3HI Gny8q2k2XQOxqNfU/2fi25u3AUdW8oLnurdGqRhH6bAW3jB92tFZsq70XVbcZ/09mt6N sV/Q== X-Gm-Message-State: ALyK8tIkvLaboRsovvhZW00ThR3k65nfhQMqBsWhpzySe4YDyyF0s2i+38eva/aZMM5YYw== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160622_122318_866815_5991A510 X-CRM114-Status: GOOD ( 11.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Ivaylo Dimitrov , linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, sre@kernel.org, pavel@ucw.cz, pali.rohar@gmail.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;