From patchwork Sat May 7 15:21:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 9038181 Return-Path: X-Original-To: patchwork-linux-arm@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 09A08BF29F for ; Sat, 7 May 2016 15:25:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 067382010E for ; Sat, 7 May 2016 15:24:59 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 20976200ED for ; Sat, 7 May 2016 15:24:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1az44G-00047A-9R; Sat, 07 May 2016 15:22:56 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1az442-00042k-4q for linux-arm-kernel@lists.infradead.org; Sat, 07 May 2016 15:22:44 +0000 Received: by mail-wm0-x243.google.com with SMTP id e201so13349218wme.2 for ; Sat, 07 May 2016 08:22:20 -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=x7HlV8xrfO/5xFy19nEjgie2OM2YgYCKyd0og973s3M=; b=fZq0VOkMrme+Xw+rn8jD4yehNGUK9Oh9sxeLMYHBR2G6EgngX0v7cY880X1lMb/RWI w7mojzNPYiTqDmKvUHbO+30nxuzfUPRsN4mt1p4+xYVWmUO6aEKhG0WcSs9G+g4Q84OG nNrkfutXcqlSrH2Ckxq0Ca/tidszoMfKt+IhCmteoxkhwt3WVnwBlcuegevnunioGN19 nue5ooUrSJWoFCIA+K9COgmB89QlG9mewwjAQs4LW4+qAvrylFSU3vmQKAq2/r4I7czv eI1/FYiQuuNvezneJyrHztmAe92tX0tUIQoJoVPPKV6Pp/HWWoAfxXtI68wQpxZcPVHs HqIQ== 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=x7HlV8xrfO/5xFy19nEjgie2OM2YgYCKyd0og973s3M=; b=LJlEnn+TXL56KWKIT8GLPc43FWMiWu27uV+Ig/QYijsm9pV1l5p5h4QXNkd8/ggSEh z1h531b0jNK9AnrAp3+3OVzitJg6xUTIHbatWEHNKbcLkq8pucgoktzBIAoIokJwIN3i mPCrMOLYOJ3ZPcb21Ygy3TC8WAYfSs7CTj+WqgcURK5yABfrZxVH5100563YdvnnlenZ lHzuwjGxxNRyBEF38UwDwF6G+gH9ge9/bdSQQCWV9URu2Xi933HZsnJl4fNUEmx0MdY4 N9HzZamQhNnXvdEpMbrjoxGOlhVauqTGaSr6evlaGg0pdOFIlS7f3N78Ax909cKbKm28 MRVg== X-Gm-Message-State: AOPr4FX4eIGSnzMNTHtfmpCcibLgEGYhCjR7aIIlcL+Px+c1uEu+vOSC24cf+XipKqGVYg== X-Received: by 10.194.51.8 with SMTP id g8mr25003183wjo.15.1462634539731; Sat, 07 May 2016 08:22:19 -0700 (PDT) Received: from localhost.localdomain ([46.249.74.23]) by smtp.gmail.com with ESMTPSA id jq1sm20737835wjc.28.2016.05.07.08.22.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 07 May 2016 08:22:19 -0700 (PDT) From: Ivaylo Dimitrov To: robh+dt@kernel.org, pawel.moll@arm.com, 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: [PATCH 2/7] pwm: omap-dmtimer: Allow for setting dmtimer clock source Date: Sat, 7 May 2016 18:21:43 +0300 Message-Id: <1462634508-24961-3-git-send-email-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462634508-24961-1-git-send-email-ivo.g.dimitrov.75@gmail.com> References: <1462634508-24961-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-20160507_082242_442159_3CA58BE4 X-CRM114-Status: GOOD ( 11.80 ) X-Spam-Score: -2.5 (--) 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, 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-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, 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 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 --- 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 b7e6ecb..95964c6 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;