Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1816175pxb; Thu, 4 Mar 2021 23:46:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMwtER6wieAqwvptKchXo+780XSS1BVztmV6V+841AwJAhdL7iBHflGROVfmFPd1SFoypD X-Received: by 2002:a92:c102:: with SMTP id p2mr7406380ile.227.1614930379051; Thu, 04 Mar 2021 23:46:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614930379; cv=none; d=google.com; s=arc-20160816; b=ON0ThYZ3U3WzWhwdlCk7SG6EUWfEB/jlHbW9MTCCnh7zB0jNdL0hCMts5KdHYd03vT z1bx2x3odLtpe9MSKQy9wY0I3Wu68ENI9FHE6yvSTU1cputiGyQQSacXAHwW/STdhf7U 4WVUE9tAUqwHSo6eTiLcZtWY6mQ+nrCLGvOj1uSnAHUEvrEgRp7RNWsWMVnxOftPEzX/ wEa/zAGpsddtGdJ96Zswnmpjj9LiXaQfwgoBXF+T9eY+FZ+/Fy2Aq/apbPAf4p3IGqZZ mPTvrJl1xP8ELKAqwqpUf34VTT4dRKloaVuFyZNX6yL3/L0gORuHdG1BR/8X9scrpoFY 1Z2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=exdJjoCJ2rSvuP4ybnCq/QxIWwOykgPsfHghdEPauo8=; b=WZvMT+VUhiMwOYGWlfsKNJV0ql6bxpQD0n7rCvzFtn9xSI0MOtupaLYXobZfk6wjZH eAsO2m/qa7c4HJnG4HzyMHmA3IUioghRNtDdwpIjyVmuoULGw7B5CR13Pp8fJEHQDwbb 920Lp6FaMLYojTI+2cdO4vNJUQMQTWNvEclyKYXvNcV+C6lE6fgIc4WHmAdotsoXP65r i0dTEnX91wIkAyB7Z5Y3UYFnTq8cWM1DgvVLBqbgm1ue2Y+WTpAxN3INTYrvpRESWlLl ac9MHitkoB7q8lOUc1uqNkBonRON9nYeBDQVT1xVJAJ0ffmVoZXOiz+eQpg/VgMpbCLu AoTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gj2EDqBi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id w15si1594278iot.97.2021.03.04.23.46.05; Thu, 04 Mar 2021 23:46:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gj2EDqBi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229573AbhCEHpo (ORCPT + 99 others); Fri, 5 Mar 2021 02:45:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbhCEHpo (ORCPT ); Fri, 5 Mar 2021 02:45:44 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6313C061574; Thu, 4 Mar 2021 23:45:43 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id u16so1012309wrt.1; Thu, 04 Mar 2021 23:45:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=exdJjoCJ2rSvuP4ybnCq/QxIWwOykgPsfHghdEPauo8=; b=gj2EDqBiRmbuYy+mBkYa+Pyi7eKQwqyJ5Jwvb5gf8N++YPW2r+lcxiJmnmFIzVfLHa NYgEt/+CGLJag1DZjiXwanVfQxTnS8Y3xwzJjC/rQorFGMFLG4za2M//UIhL3GTf3DZE +eFI+StU6Ao/xGBpBKO9Ig84L/EHztMT5WBf/h4AkDsfcPXAXhUxE//Lo2DqMdoK1Qet DVxAW1PoShRjXsQJGED2WvfSjOF0rKNREFxAeRRvgMSBkB2cKudJwVZJAy6IFMVs4Xwk CKFkDCT5pbRPeZ584HIf4uA3scewoI+PzGmPDzjNumonl7J/IyNaZS3jm2YrGg/eWS6C pHLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=exdJjoCJ2rSvuP4ybnCq/QxIWwOykgPsfHghdEPauo8=; b=mRrHJ05kRhNtBVWKe4mmAN7ypZ5nhIjB2a3FVcvNqrO9X+sY2b7eFvLGvO2QFJ3ZSN HQLqTbDR/MFErC0lV1EYdVhOgs0X7+Q7pM74yUhsitLmB6yKs9AhOvCMyYr3dBkDG1kC 9OGlIbchzvtVm4LRe1AqXOgay2vtvwuCNXe4uthFGEAMZY+jcyx+gJHfhflgtINIBAM0 12RW3kkDcFw7yiCjIUcTBqwZfE8EUZPUnxz2tMfc+7o+WpquQijb1OmWK1EHhmx360QC 15H6F1tu6FHngoqYawCPIrXnpUeJHNBv1JQYmY28GUpVxNFWllCmCMTOKarcHZPTKzSN Eg0A== X-Gm-Message-State: AOAM533V9BX0fbA/gMaDJVvd+wEI9Y7uMs1DLKbQgGnsjOHU1qBBxqN7 wYSCTAr9yskCP2p6Nl2jvS8= X-Received: by 2002:a5d:430a:: with SMTP id h10mr8219155wrq.162.1614930342625; Thu, 04 Mar 2021 23:45:42 -0800 (PST) Received: from macbook-pro-alvaro.lan (170.red-88-1-105.dynamicip.rima-tde.net. [88.1.105.170]) by smtp.gmail.com with ESMTPSA id e8sm3320516wme.14.2021.03.04.23.45.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Mar 2021 23:45:42 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node From: =?utf-8?Q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= In-Reply-To: Date: Fri, 5 Mar 2021 08:45:40 +0100 Cc: Linus Walleij , Rob Herring , Michael Walle , Bartosz Golaszewski , Florian Fainelli , bcm-kernel-feedback-list , Jonas Gorski , Necip Fazil Yildiran , "open list:GPIO SUBSYSTEM" , devicetree , Linux Kernel Mailing List , linux-arm Mailing List Content-Transfer-Encoding: quoted-printable Message-Id: <891B849E-32A0-4115-BCE9-2F0495274404@gmail.com> References: <20210304085710.7128-1-noltari@gmail.com> <20210304085710.7128-3-noltari@gmail.com> <9A8A595D-2556-4493-AA96-41A3C3E39292@gmail.com> <0504ADC2-0DD5-4E9E-B7DF-353B4EBAB6B4@gmail.com> <68F60F3F-33DD-4183-84F9-8D62BFA8A8F1@gmail.com> To: Andy Shevchenko X-Mailer: Apple Mail (2.3654.60.0.2.21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, > El 4 mar 2021, a las 17:33, Andy Shevchenko = escribi=C3=B3: >=20 > On Thu, Mar 4, 2021 at 5:44 PM =C3=81lvaro Fern=C3=A1ndez Rojas = wrote: >>> El 4 mar 2021, a las 16:28, Andy Shevchenko = escribi=C3=B3: >>> On Thu, Mar 4, 2021 at 5:24 PM =C3=81lvaro Fern=C3=A1ndez Rojas = wrote: >>>>> El 4 mar 2021, a las 16:17, Andy Shevchenko = escribi=C3=B3: >>>>> On Thu, Mar 4, 2021 at 5:06 PM =C3=81lvaro Fern=C3=A1ndez Rojas = wrote: >>>>>>> El 4 mar 2021, a las 11:35, Andy Shevchenko = escribi=C3=B3: >>>>>>> On Thu, Mar 4, 2021 at 10:57 AM =C3=81lvaro Fern=C3=A1ndez Rojas >>>>>>> wrote: >>>>>=20 >>>>>>>> + * @of_node: (Optional) The device node >>>>>>>=20 >>>>>>>> + struct device_node *of_node; >>>>>>>=20 >>>>>>> Can we use fwnode from day 1, please? >>>>>>=20 >>>>>> Could you explain this? I haven=E2=80=99t dealt with fwnode never = :$ >>>>>> BTW, this is done to fix this check when parsing gpio ranges: >>>>>> = https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba37= 0f797/drivers/gpio/gpiolib-of.c#L933-L934 >>>>>=20 >>>>> Use struct fwnode_handle pointer instead of OF-specific one. >>>>=20 >>>> But is that compatible with the current gpiolib-of code? :$ >>>=20 >>> Yes (after a bit of amendment I have sent today as v2: >>> = https://lore.kernel.org/linux-gpio/20210304150215.80652-1-andriy.shevchenk= o@linux.intel.com/T/#u). >>=20 >> Well that doesn=E2=80=99t fulfill my definition of =E2=80=9Ccurrent = gpiolib-of code=E2=80=9D=E2=80=A6 >> @Linus what should I do about this? >=20 > Well, fwnode is a generic, and I strongly against spreading > OF-specific code when we have fwnode working. But let's hear Linus > out, of course! >=20 > But it seems you are right and the library needs a few more = amendments. Yes, but I=E2=80=99m trying to do as few amendments as possible since I = already have quite a large amount of patches :) >=20 >>>>> Also here is the question, why do you need to have that field in = the >>>>> regmap config structure and can't simply use the parent's fwnode? >>>>> Also I'm puzzled why it's not working w/o this patch: GPIO library >>>>> effectively assigns parent's fwnode (okay, of_node right now). >>>>=20 >>>> Because gpio regmap a child node of the pin controller, which is = the one probed (gpio regmap is probed from the pin controller). >>>> Therefore the parent=E2=80=99s fwnode is useless, since the correct = gpio_chip node is the child's one (we have pin-ranges declared in the = child node, referencing the parent pinctrl node). >>>=20 >>> I see. Can you point me out to the code where we get the node and >>> where it's being retrieved / filled? >>=20 >> Sure, this is where the child node is searched: = https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb4= 8c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L100-L109 >> Then the gpio child node is probed and assigned here: = https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb4= 8c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L51 >=20 > So, this is not (*yet) in upstream, correct? No it=E2=80=99s not, but I've already changed the approach several times = and I=E2=80=99m starting to get tired about it... >=20 > So, why not to switch to fwnode API in that driver as well? >=20 > When you do that and supply fwnode thru the regmap configuration, in > the gpio-regmap we may assign it to of_node (via to_of_node() API). >=20 >> Basically, I based that part of the code on the ingenic pin = controller: = https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba37= 0f797/drivers/pinctrl/pinctrl-ingenic.c#L2485-L2491 >> = https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba37= 0f797/Documentation/devicetree/bindings/pinctrl/ingenic%2Cpinctrl.yaml#L15= 5-L176 >=20 > This doesn't use remgap GPIO. Yes, I know, but there aren=E2=80=99t any pinctrl drivers using regmap = GPIO right now, so I couldn=E2=80=99t base my code on anything else :) >=20 > --=20 > With Best Regards, > Andy Shevchenko Best regards, =C3=81lvaro.=