Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp849302imm; Fri, 1 Jun 2018 10:33:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKc8Nkos96vM4nuBCqcfUtXa6QDYeFxplckbRFKK3I9TFhu1ykPiYY5S1wqr9Yya97W78SK X-Received: by 2002:a62:8910:: with SMTP id v16-v6mr11581743pfd.13.1527874400643; Fri, 01 Jun 2018 10:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527874400; cv=none; d=google.com; s=arc-20160816; b=nCOMfDUxCl1BUVyvd3Eo8zTt9sJMY39gpcHcEOppKDmxK2fqNuisFfZMSvFOima/+M PHhULKrPj4oBozwqW4bVhW8vllXurzAPc7sjY9/Qk9NloMq4GSLfMy0lWKUAbDz760VN D38xKA1yKDWVdxRG37G7szuOfLLS25HdAtuFf/0tkUuoIpCbWEmjESdkQr9R9xRheMn2 Q8sLTX4hBBj2Hl+k1lrXMrOXF8K4wgHhM3zRIV21tmiQoNqfVogpTR7AYYlDvRtSMxvg 0z30vWVlLBoILOqVVSroX9Scg1wBLrYXs9qZLq3VoPcEdNRbmI4tyi0wq95Fu0qf2uQk X7ZQ== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=9QzwxOd/WcOOS6X28G0Bm2EM5mPzs5uvtjMmm2gzvPg=; b=JHQRyjc5uCYPSx3lWgeegAywF9e5mntVTlM1DLfNysO5l9v5J4SjMNOHas0O0CeoQa 6tHKkxsuDQJ45xv7WoVo2Y0RIR56FwDJ1h6JDpglaZgi/ksNOVlJ+OZItAdN99Q9JBzL Frcmr4eCwFPwMzoO1ojgk+46V+gIVqW6SuNST2lhr5DOqSVy7zBomggJ1QIY47ktvKVT M0WULPL6Iaot6/vCZy2hrk8GNARRrxrJCuWALhHPigBlFMv0hl7NH6h66FWqqo+4A7bF mYGnm2FCLmw0ZXl2fQ6qrpITO3O7WpxANNdFkYKleabdzOxSSoLhRjYmD/bBR0CvzpwM NG6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dWBoe3q2; 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 38-v6si40896142plc.446.2018.06.01.10.33.06; Fri, 01 Jun 2018 10:33:20 -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=dWBoe3q2; 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 S1752548AbeFARcm (ORCPT + 99 others); Fri, 1 Jun 2018 13:32:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:46014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751502AbeFARci (ORCPT ); Fri, 1 Jun 2018 13:32:38 -0400 Received: from mail-qk0-f178.google.com (mail-qk0-f178.google.com [209.85.220.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 0D752208A1; Fri, 1 Jun 2018 17:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527874358; bh=Qx/GX5Dh6g8KfQ7GZXGLP+Shlk0zaAQcs6klT58Qv4A=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=dWBoe3q2yzKjVEnxMul3o90aOQUbvST9TFVbKJWJdG6G95MBMh9cmfVC5V/oxENIq aHcW/n0wg8M6g82ci1e6J+UIuQceikHHLIrjicYw+Tfld79StbgWSkGm+FpUzQUNXl AWes6z2airG2muldbBGQ52wHP9ZEV9WEV2c/AwPo= Received: by mail-qk0-f178.google.com with SMTP id y4-v6so2292940qka.5; Fri, 01 Jun 2018 10:32:38 -0700 (PDT) X-Gm-Message-State: APt69E2b3EZCRAsGSFYm81pbnH75vxaLjSyiE8lfrzcGfzxncL2igoBq Xpe5QRlEL2I2AhILHcWtdH7EOBHupmb7FlJyew== X-Received: by 2002:a37:ef0d:: with SMTP id j13-v6mr6692749qkk.120.1527874357178; Fri, 01 Jun 2018 10:32:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9b02:0:0:0:0:0 with HTTP; Fri, 1 Jun 2018 10:32:16 -0700 (PDT) In-Reply-To: <20180601062540.GB5150@localhost.localdomain> References: <3b05ca98a671a762013c312f8b70543402ee7556.1527669443.git.matti.vaittinen@fi.rohmeurope.com> <20180531030129.GA16122@rob-hp-laptop> <20180531071717.GG13528@localhost.localdomain> <20180531102315.GA5150@localhost.localdomain> <20180601062540.GB5150@localhost.localdomain> From: Rob Herring Date: Fri, 1 Jun 2018 12:32:16 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 2/6] mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC To: Matti Vaittinen Cc: Matti Vaittinen , Michael Turquette , Stephen Boyd , Mark Rutland , Lee Jones , Liam Girdwood , Mark Brown , linux-clk , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , mikko.mutanen@fi.rohmeurope.com, heikki.haikola@fi.rohmeurope.com 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 Fri, Jun 1, 2018 at 1:25 AM, Matti Vaittinen wrote: > On Thu, May 31, 2018 at 09:07:24AM -0500, Rob Herring wrote: >> On Thu, May 31, 2018 at 5:23 AM, Matti Vaittinen >> wrote: >> > On Thu, May 31, 2018 at 10:17:17AM +0300, Matti Vaittinen wrote: >> >> On Wed, May 30, 2018 at 10:01:29PM -0500, Rob Herring wrote: >> >> > On Wed, May 30, 2018 at 11:42:03AM +0300, Matti Vaittinen wrote: >> >> > > Document devicetree bindings for ROHM BD71837 PMIC MFD. >> >> > > + - interrupts : The interrupt line the device is connected to. >> >> > > + - interrupt-controller : Marks the device node as an interrupt controller. >> >> > >> >> > What sub blocks have interrupts? >> >> >> >> The PMIC can generate interrupts from events which cause it to reset. >> >> Eg, irq from watchdog line change, power button pushes, reset request >> >> via register interface etc. I don't know any generic handling for these >> >> interrupts. In "normal" use-case this PMIC is powering the processor >> >> where driver is running and I do not see reasonable handling because >> >> power-reset is going to follow the irq. >> >> >> > >> > Oh, but when reading this I understand that the interrupt-controller >> > property should at least be optional. >> >> I don't think it should. The h/w either has an interrupt controller or >> it doesn't. > > I hope this explains why I did this interrupt controller - please tell > me if this is legitimate use-case and what you think of following: > > +Optional properties: > + - interrupt-controller : Marks the device node as an interrupt controller. > + BD71837MWV can report different power state change > + events to other devices. Different events can be seen > + as separate BD71837 domain interrupts. To what other devices? > + - #interrupt-cells : The number of cells to describe an IRQ should be 1. > + The first cell is the IRQ number. > + masks from ../interrupt-controller/interrupts.txt. I'm still not clear. Generally in a PMIC, you'd define an interrupt controller when there's a common set of registers to manage sub-block interrupts (typical mask/unmask, ack regs) and the subblocks themselves have control of masking/unmasking interrupts. If there's not a need to have these 2 levels of interrupt handling, then you don't really need to define an interrupt controller. > >> My concern is you added it but nothing uses it which tells >> me your binding is incomplete. I'd rather see complete bindings even >> if you don't have drivers. > > So this makes me wonder if my use-case for interrupt controller is > valid. I thought making this PMIC as interrupt controller is a nice way > of hiding the irq register and i2c access from other potential drivers > using these interrupts. But as I don't know what could be the potential > user for these irqs, I don't know how to complete binding. This is why I > also thought of making this optional, so that the potential for using > the interrupts would be there but it was not required when interrupts > are not needed. The only drivers getting these interrupts would be drivers for this PMIC. Interrupts are handled by the driver owning the h/w that generated the interrupt. I think that is the disconnect here. Take a power button. We don't create a generic power button interrupt and then have some generic power button interrupt handler. We have a handler for specifically for that device and then it generates a power button press event. >> For example, as-is, there's not really any >> need for the clocks child node. You can just make the parent a clock >> provider. > > This sounds correct. I just lack of knowledge on how to handle clocks > in "standard way" using the clock framework and this was a result of > my first attempt. (Funny, I have written clk / synchronization drivers > for work in the past but still I have no idea on how to do this in > "standard way"). > >> But we need a complete picture of the h/w to make that >> determination. > > My attempt is to create generic driver for this PMIC. I would rather not > limit it's use to any particular board/soc. The example binding is based > on my test environment where I simply connected this PMIC break out > board to beagle bone black. (I do also have a test board where i.MX8 and > peripherials are powered by this PMIC but I rather not limit this driver > to such single setup. Besides the linux running on that board is not > 'standard') That's how we design all the PMIC drivers. All the PMIC functions should be exposed thru standard class APIs. Though many PMICs are pretty tightly coupled to particular SoCs either by design or just there's not a lot of boards to create any sort of matrix of combinations. > The PMIC itself just has this 32.768 KHz clock output. Clock can be > enabled/disabled via register interface. I think this is intended to be > used for RTC but I thought this driver does not need to care about that. > I thought it is just a good idea to provide control via clk subsystem > and to not make assumptions on use-cases in this driver. Sure that is fine. No one is saying you shouldn't do that. Rob