Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3089811imm; Thu, 24 May 2018 22:55:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoFZGt8xZhhHuxI+OsBfnTmhXM+xxIse1YaDZkMrRg7jDj5xdhvAGP122QybHjO42YuMk1F X-Received: by 2002:a65:63cf:: with SMTP id n15-v6mr850330pgv.371.1527227701846; Thu, 24 May 2018 22:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527227701; cv=none; d=google.com; s=arc-20160816; b=cobg3FHC8TbSMsmeBHimSFs3EtfEJ1au50XhZ1eDX7dzeoqIH6H3yV9GrHjQS2qdd/ xhthjsZd4crR9F35VU8c+eyXu6hxLypYK1q6qqAFa6Qg8oIuBac4RokkXxEWt8Ae/4z8 fgP/rc5lwV6IwkdzZYQv7OREldWqK3wQ7NSiiE2x7otJK1iVoRniBj3M1QuHtt6NR6sh cDgy7tVQQsifESbJA5HLBCgil7zhs3HuS2Phgsb3VfV/cMqc7Gw8Trs0D5GUr1vQ6uak LORszJzimwyTjdCwmVsLSQ5oi3J4B6g+eNs12lceaTI7WQs/TOGs6DnATbMknZRLyoJi wpTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature:arc-authentication-results; bh=BCNeli22h8DS01KstoOjVORRPTRFRj4Y33ACKj14ILA=; b=PjIjptj4cGz1kITVyNMiwuCu4jjE/vLUxX+S3dc73ytAG76/MuFDwy+j1VRHgiB4gN mnj7dRTDP06CV39fKCjMFE4w8CfyBbmjyDDUEGA4M0Y0W2VApKIY8pnShIAzj4t8PSC7 bBir7AWV6X5YodcQDC2kQwYMWazansUeZ/kM66XBwBPvl2WCp+eZ6LqQSxxzM5gtOe2L lFEHtVndhoUqx47FkZ6/lOdtBMBk0lzghY7g0IB1c8gN671F5KjTWQEqXV878wMbqf/O PZXrXoR/ScTg8ZemnJbsxTBOOrbl7m46EvBcXI5ROYZd7aTO2VKgUnQWynXdHl1KK+E2 Pz3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oVZBYgJt; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d65-v6si23485431pfj.243.2018.05.24.22.54.44; Thu, 24 May 2018 22:55:01 -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=@gmail.com header.s=20161025 header.b=oVZBYgJt; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271AbeEYFyh (ORCPT + 99 others); Fri, 25 May 2018 01:54:37 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37191 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752360AbeEYFyf (ORCPT ); Fri, 25 May 2018 01:54:35 -0400 Received: by mail-wm0-f66.google.com with SMTP id l1-v6so11273426wmb.2; Thu, 24 May 2018 22:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=BCNeli22h8DS01KstoOjVORRPTRFRj4Y33ACKj14ILA=; b=oVZBYgJt3TMmiwF/Q7TN88MEgZIWkezWEOdH57R8un8D5tpB+NUnrgMg/Ckp4gQW75 XvAVbIH0+VgOInRo21fh2HPS+UcockGIHw2hJmgewnI7GiK4jFDn/FfF7ml6/V1c9zZ1 WvBnuUjgFtZh1Wi3aAiDJrPCK44A/M7a+i3ZWV0vrDKKCWgeOCN4bGGKSF1vGTcS/Wz5 oi2ORT0w5OaUA1l86fisAJQQFhrAt0je2gYlUezi89bH+8UWNQhBkCdxMmTUWmtHNKNH gbjLZn3KErzqyy29MPGo5aNEATuvfktfiQ4WwGf4kbqNta/8nZNZXCt76wKoB5rxf8d/ vxmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BCNeli22h8DS01KstoOjVORRPTRFRj4Y33ACKj14ILA=; b=skctzLNAv8MW7c3Kh33ZZKOSUKZ1pPrCNxejA6Sih0IIImR2OGmEVf5dwZurROYYOb PmpCi5hhzRjt4SVUqcg5DachKjlURV0noILK9cKCLQ4tnZhoH8ruTAnVepuhenPvXVDU zqGAF6+Z8y+H/5+3wWFdc0im0/7LHuibJz2OrM5ka1Nvr22+Y3xdRY8aJfEXymh3+m8R 1gAdHZbxip92p7lXtqy2++5bgghg3loaLlGD8Deun1VAptqdqaCZV9DxRcz1PSPK+B1V dgpvj6rqDr3e8eZL1/WnqNI9Y01N7rOLy707wlaEAqlCAdYH4oJipFmlsBIYnw8zd1gp QpTg== X-Gm-Message-State: ALKqPwfur4rBiUgpQmimefVMrbm81PyMYBBSkx/4TPYB+kX9nPamgj0w Y2opThHzVla1cp9jehraDvM= X-Received: by 2002:a2e:3e0c:: with SMTP id l12-v6mr576144lja.23.1527227673472; Thu, 24 May 2018 22:54:33 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.34]) by smtp.gmail.com with ESMTPSA id o80-v6sm5331942lfb.41.2018.05.24.22.54.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 May 2018 22:54:32 -0700 (PDT) From: Matti Vaittinen X-Google-Original-From: Matti Vaittinen Date: Fri, 25 May 2018 08:54:30 +0300 To: Mark Brown Cc: "Vaittinen, Matti" , "mturquette@baylibre.com" , "sboyd@kernel.org" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "lee.jones@linaro.org" , "lgirdwood@gmail.com" , "mazziesaccount@gmail.com" , "linux-clk@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mutanen, Mikko" , "Haikola, Heikki" Subject: Re: [PATCH 4/9] regulator: bd71837: Devicetree bindings for BD71837 regulators Message-ID: <20180525055430.GB16888@localhost.localdomain> References: <20180524055752.GE4249@localhost.localdomain> <20180524140118.GS4828@sirena.org.uk> <042F8805D2046347BB8420BEAE397A4016C06B47@WILL-MAIL002.REu.RohmEu.com> <20180524175721.GB4828@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180524175721.GB4828@sirena.org.uk> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 24, 2018 at 06:57:21PM +0100, Mark Brown wrote: > On Thu, May 24, 2018 at 05:30:57PM +0000, Vaittinen, Matti wrote: > > > > On Thu, May 24, 2018 at 08:57:52AM +0300, Matti Vaittinen wrote: > > > > > > > +Required properties: > > > > + - compatible: should be "rohm,bd71837-pmic". > > > > + - regulator-name: should be "buck1", ..., "buck8" and "ldo1", ..., "ldo7" > > > > > > The MFD is for a single device, there should be no need for compatibles > > > on subfunctions. > > > > I will check this. I must admit I am not sure what is the de-facto mechanism > > for assigning the correct device-tree nodes to sub devices if compatibles > > are not used? I think I saw device-tree node name being used for regulators > > You can look at the regulators node within the parent device, you know > that in Linux the parent device will be the MFD. So I should parse the device-tree in MFD my driver in order to locate the regulators node? Isn't that somewhat like code dublication? If we rely on compatibles we can avoid device-tree parsing in MFD driver, right? An in-tree example of this is: Documentation/devicetree/bindings/regulator/sprd,sc2731-regulator.txt >Required properties: >- compatible: should be "sprd,sc27xx-regulator". //snip >Example: > regulators { > compatible = "sprd,sc27xx-regulator"; > > vddarm0: BUCK_CPU0 { > regulator-name = "vddarm0"; > regulator-min-microvolt = <400000>; drivers/mfd/sprd-sc27xx-spi.c > static const struct mfd_cell sprd_pmic_devs[] = { //snip > }, { > .name = "sc27xx-regulator", > .of_compatible = "sprd,sc27xx-regulator", > }, { //snip > }; and in probe just: > ret = devm_mfd_add_devices(&spi->dev, PLATFORM_DEVID_AUTO, > sprd_pmic_devs, ARRAY_SIZE(sprd_pmic_devs), > NULL, 0, > regmap_irq_get_domain(ddata->irq_data)); this looks clean to me and offloads the device-tree parsing completely to generic code. Wouldn't that be simpler approach that looking up the regulator node in MFD driver code? (I can do as you suggested but to me the approach used in sprd-sc27xx-spi.c makes sense) > > Also, another thing I was wondering is how supply regulators should be > > handled? In this case the LDO5 is supplied by BUCK6 and LDO6 by > > BUCK7. > > > From generic regulator bindings > > /Documentation/devicetree/bindings/regulator/regulator.txt > > I found statement: > > > > - -supply: phandle to the parent supply/regulator node > > None of that stuff uses compatible strings, just handle it as covered in > the bindings. Sorry. I have not been clear with my question. This part was unrelated to compatible properties - I should have stated it in my previous mail. What I meant is that I tried out adding xxx-supply = <&buck6>; in LDO5 device tree node and expected that the regulator core code would take care of parsing this from device-tree and adding the supply information to LDO5. This was not done and I did not fing parsing for *-supply from drivers/regulator/of_regulator.c. So I was wondering if I am missing something? I guess the *-supply properties in device-tree for BD71837 regulators are now ignored. Should the supply parsing be added in drivers/regulator/of_regulator.c - or have I simply misunderstood something? Anyways, I ended up hard coding: .supply_name = "buck6" in LDO5 regulator_desc before passing the desc to regulator_register(). This works but it means the buck6 name must be fixed to "buck6". Br, Matti Vaittinen