Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4837212ybg; Tue, 29 Oct 2019 13:10:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyw0thPndkJ6j5+wi+tyBvzKWRrMCa1CZkAMYLQtje4Ae6QdIfrsobLnTGoP/8kJxO1oyT1 X-Received: by 2002:a17:906:86d5:: with SMTP id j21mr5159946ejy.219.1572379810902; Tue, 29 Oct 2019 13:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572379810; cv=none; d=google.com; s=arc-20160816; b=WWj5XVhFgT+TtsKaxWQAfeFRz2w/T7QIe5/4IeKfDcAD1bRmQwdyMblO4GDMvUAEB6 FQB+X9wktXgKbc78fZwME/dP163FCwobmwMdUezr2pbHH+Cyvcj9sHtkXWB56YFchKeA M2m1I8Lm9f0IuF6Y3PBXRBB4DWSopm9Rg6+Jk0elFs9RkjzC9maRBtzQ9sujQf7vR1dU gatNzSaJaEGc8KSmeG7Edp8FqebtvrzjBNtGf9F3y5ukksbqwXx9gyW8KDc8hHJLQAH6 dOecNXMpXhyIb9mFYIDBuTKMRdeTrsRQlclIPxHp6IB/2YoMitMcRvbG8/XYXXQEntPm xX3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XCfvU04+5mQVULbx5SpGiwzKWm6mhLQ1u5wInSyKOEU=; b=a0u0Iu2mW0YldvKx5pJ5YI/BcQIwH44dCzfkOKWssqVPFh01VOjF0kejv5kslx2iVU +fTybdbCWIjE/cDSAxp2k9MkW5pPgWJuPZyLJNsyBDQA/RTcl916gkIUpL3d7jXG6f6C mdFKGjjAgkCfI6TuwBMITVOGEVMtjCzkfp9lUjdPt7bTpqJDXmP6D2pecxSb5ou6XFPZ XEqvGVH+IPRp8e06JUX+nNaAJobdVPO1cgz9NNbSdQqHzF/4pQHUgM/CuJXBJrM44sPv 0CqJcwpK4dtPfKynT1iFB7Qpx9CY14J58dq035qLDeXe8TnuAlkNvAvotDFQRmmYw4n2 aigg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NWcGI6t4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dt26si8442097ejb.38.2019.10.29.13.09.47; Tue, 29 Oct 2019 13:10:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NWcGI6t4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727046AbfJ2T6u (ORCPT + 99 others); Tue, 29 Oct 2019 15:58:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:56438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbfJ2T6u (ORCPT ); Tue, 29 Oct 2019 15:58:50 -0400 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 863B7217F9; Tue, 29 Oct 2019 19:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572379128; bh=WAdeg+B9VRaoa2GUGbY801lVq9HtWmhjZYVHysrysc4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NWcGI6t4d1C6w5YAcjerwQGwR40yf9qK1MLh8rjyF/petI083MZCWoDGvmAGjUNT+ osJVzDa0YEBwPO7Aa83PkbOI33Q1gE7pAw7jcVi8uWmcZglhBgxr0bcxGIyj55LVjE ZoNK5yzBU/vrK/+f+MwxjVdJElZhbsS1weXQZGvA= Received: by mail-qt1-f178.google.com with SMTP id t26so12065009qtr.5; Tue, 29 Oct 2019 12:58:48 -0700 (PDT) X-Gm-Message-State: APjAAAWZd5iDblHh3dzs6lYXpuUIOZWwl3viiUKOtN3jkcnqgOUkGYDM QcvxvTqRpFCYjkaw/KFP2b+mR7a6C02y2Gu2ZQ== X-Received: by 2002:ac8:48c5:: with SMTP id l5mr469360qtr.110.1572379127527; Tue, 29 Oct 2019 12:58:47 -0700 (PDT) MIME-Version: 1.0 References: <20191016010544.14561-1-slongerbeam@gmail.com> <20191016010544.14561-3-slongerbeam@gmail.com> <20191027212121.GA3049@bogus> <2daa37a6-83a7-ec08-b89c-a07268b3ea4a@gmail.com> In-Reply-To: <2daa37a6-83a7-ec08-b89c-a07268b3ea4a@gmail.com> From: Rob Herring Date: Tue, 29 Oct 2019 14:58:36 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] dt-bindings: timer: imx: gpt: Add pin group bindings for input capture To: Steve Longerbeam Cc: Daniel Lezcano , Thomas Gleixner , Mark Rutland , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , "open list:CLOCKSOURCE, CLOCKEVENT DRIVERS" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 28, 2019 at 6:59 PM Steve Longerbeam wrote: > > Hi Rob, > > Thanks for reviewing. > > On 10/27/19 2:21 PM, Rob Herring wrote: > > On Tue, Oct 15, 2019 at 06:05:44PM -0700, Steve Longerbeam wrote: > >> Add pin group bindings to support input capture function of the i.MX > >> GPT. > >> > >> Signed-off-by: Steve Longerbeam > >> --- > >> .../devicetree/bindings/timer/fsl,imxgpt.txt | 28 +++++++++++++++++++ > >> 1 file changed, 28 insertions(+) > >> > >> diff --git a/Documentation/devicetree/bindings/timer/fsl,imxgpt.txt b/Documentation/devicetree/bindings/timer/fsl,imxgpt.txt > >> index 5d8fd5b52598..32797b7b0d02 100644 > >> --- a/Documentation/devicetree/bindings/timer/fsl,imxgpt.txt > >> +++ b/Documentation/devicetree/bindings/timer/fsl,imxgpt.txt > >> @@ -33,6 +33,13 @@ Required properties: > >> an entry for each entry in clock-names. > >> - clock-names : must include "ipg" entry first, then "per" entry. > >> > >> +Optional properties: > >> + > >> +- pinctrl-0: For the i.MX GPT to support the Input Capture function, > >> + the input capture channel pin groups must be listed here. > >> +- pinctrl-names: must be "default". > >> + > >> + > >> Example: > >> > >> gpt1: timer@10003000 { > >> @@ -43,3 +50,24 @@ gpt1: timer@10003000 { > >> <&clks IMX27_CLK_PER1_GATE>; > >> clock-names = "ipg", "per"; > >> }; > >> + > >> + > >> +Example with input capture channel 0 support: > >> + > >> +pinctrl_gpt_input_capture0: gptinputcapture0grp { > >> + fsl,pins = < > >> + MX6QDL_PAD_SD1_DAT0__GPT_CAPTURE1 0x1b0b0 > >> + >; > >> +}; > >> + > >> +gpt: gpt@2098000 { > > timer@... > > Ok. > > > > > I don't really think this merits another example though. > > Ok. > > But for version 2 of this patch-set I'd like to run some ideas by you. > > Because in this version I did not make any attempt to create a generic > timer capture framework. I just exported a couple imx-specific functions > to request and free a timer input capture channel in the imx-gpt driver. > > So for version 2 I am thinking about a simple framework that other SoC > timers with timer input capture support can make use of. > > To begin with I don't see that timer input capture warrants the > definition of a new device. At least for imx, timer input capture is > just one function of the imx GPT, where the other is Output Compare > which is used for the system timer. I think that is likely the case for > most all SoC timers, that is, input capture and output compare are > tightly interwoven functions of general purpose timers. > > So I'm thinking there needs to be an additional #input-capture-cells > property that defines how many input capture channels the timer > contains, where a channel refers to a single input signal edge that can > capture the timer counter. The imx GPT has two input capture channels (2 > separate input signals). #foo-cells is not how many of something, but how many u32 parameters a 'foos' consumer property has. But seems like that's what you meant based on the example. > > For example, on imx: > > gpt: timer@2098000 { > compatible = "fsl,imx6q-gpt", "fsl,imx31-gpt"; > /* ... */ > #input-capture-cells = <1>; > pinctrl-names = "default", "icap1"; > pinctrl-0 = <&pinctrl_gpt_input_capture0>; > pinctrl-1 = <&pinctrl_gpt_input_capture1>; > }; > > > A device that is a listener/consumer of an timer capture event would then refer to a timer capture channel: > > some-device { > /* ... */ > timer-input-capture = <&gpt 0>; > }; We'd want to be more consistent in the naming, but seems reasonable. One of the challenges with timers is selecting which timer is used for what function. This helps as you can know if a timer is used for input capture or not. One issue will be is having '#input-capture-cells' enough to decide that, or does one have to walk the DT and find all the 'timer-input-capture' properties (shouldn't be a lot)? You could also want to use input capture, but not describe the connection in DT. Another thought is should it be just 'timers' to cover both input capture and output compare with those being selected with flags (like GPIO). My other question is just what are some real examples of devices needing to describe this connection. Timers have had input capture forever, but I've rarely seen it used. Output compare even less so. Rob