From patchwork Mon May 16 19:34:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 34325 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2OJK-0006G1-GF; Mon, 16 May 2016 19:36:14 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-5) with esmtp id 1b2OJI-0000Ua-84; Mon, 16 May 2016 21:36:14 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754408AbcEPTeb (ORCPT + 1 other); Mon, 16 May 2016 15:34:31 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36646 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754615AbcEPTe2 (ORCPT ); Mon, 16 May 2016 15:34:28 -0400 Received: by mail-wm0-f67.google.com with SMTP id w143so20282075wmw.3; Mon, 16 May 2016 12:34:27 -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=YZssG2IO2YVjub+LIj98K3LjOA4kXYZIkQ385VzA4OA=; b=uZKc9pBLfIzJ7ECap/QgUPKAfSgGNo41eXq5HdLTKkiqz4WsHD30ZxvYseSMOK1VfL joOzN8Od8vWrvpC/o04pIR+6pNA/kvmalr5q8A4euO+Dvwl1uZ+teb/By5eFPQZpGuG9 7OPYlgn3R0jFhIcUtI3tK5eoYY8Hk2WxyKE4JvkUrtr2HsrjSAmHIfePQzx/VEKoZ688 37iEgnjCxaX6a94PIejeS3EvB+rGQIWpzitnChRMKv3pxhc3EGsRQZDKJ+msmcF+9vxG LmzXlSfiqcRZ+p+bYAn9KBJ43LuqbWa4u5d0VfMz6mDsf8G8NuGTd4wfYRxiErpY3QST Jaow== 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=YZssG2IO2YVjub+LIj98K3LjOA4kXYZIkQ385VzA4OA=; b=NyXM8Jwx2TL8KhXTEEcRgSpOZhsRyBlJFZYWb/yILrsDbYdSuLYRils7z1ka9FRJVm gsVYSHYPbBjMqwmio0z8v4S4Lw71qUTL/pJVAsBx6c1F9jvQ9cfyIlHwOJkN7ywvVGon 2mHxv0JPMEWo+7FQAgSzHxThcMQejNvthTSRvlMKXTlikwU/HPM1dSAlJT5yGgybLxfX Acb4NBagbhvC/TMxRfR8Cjat9znAS2YNH9Oz5kQ3TEQPn0is9S5ZxnKJfWAAiEsvw8l4 ZAjLzikCDEPDMhSru2PshmVezcvGhd3iXN65+xYQUshpVeR78YYBkETqesRMNk1CFnKJ P1Bg== X-Gm-Message-State: AOPr4FXU3ctg4bW6Z9qBICh4b5ylIyEYSIfBgAWftQ5mkQIIY1+eaedE0njWyP5lMDD2yQ== X-Received: by 10.28.153.213 with SMTP id b204mr20611110wme.102.1463427266810; Mon, 16 May 2016 12:34:26 -0700 (PDT) Received: from localhost.localdomain ([46.249.74.23]) by smtp.gmail.com with ESMTPSA id g132sm20069306wme.0.2016.05.16.12.34.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 May 2016 12:34:26 -0700 (PDT) From: Ivaylo Dimitrov To: robh+dt@kernel.org, mark.rutland@arm.com, pawel.moll@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, Ivaylo Dimitrov Subject: [PATCH v2 2/6] pwm: omap-dmtimer: Allow for setting dmtimer clock source Date: Mon, 16 May 2016 22:34:10 +0300 Message-Id: <1463427254-7728-3-git-send-email-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1463427254-7728-1-git-send-email-ivo.g.dimitrov.75@gmail.com> References: <1463427254-7728-1-git-send-email-ivo.g.dimitrov.75@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.5.16.192415 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, NO_URI_HTTPS 0, REFERENCES 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __DATE_TZ_RU 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __MULTIPLE_RCPTS_TO_X5 0, __PHISH_SPEAR_STRUCTURE_1 0, __REFERENCES 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0, __YOUTUBE_RCVD 0' 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;