Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6454142imu; Mon, 21 Jan 2019 09:09:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN7QgzkNRFRCWin5aVE1q2pArsVHOhb3H60aMaMWiRVsgG2ZiTe2uU4DWOvfVauzgt5XlYzv X-Received: by 2002:a62:32c4:: with SMTP id y187mr31403737pfy.195.1548090569880; Mon, 21 Jan 2019 09:09:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548090569; cv=none; d=google.com; s=arc-20160816; b=ppDa9PokZAKuD9ZowsBklS5+Ut2va8eRTR/R1rC8JhefZtJ8RS2WaRwo7MF8doRSJx 9fVjkpMTsNxRgvesiC1BeVcqP1C/3apu5WKkm9f/I6NOBBvNpx+xGzOUlWJqt0G97Y3Q 5uo5iE43pVa9v3WISNYYK8tMVep6UWb3XWGPDRatuNgpTaC7J7yM8BUlszRZH+WNDNbh WNsVI07kLXZHL9iSa14aYMa4q+ZSX4U3WrnMcZViRA9ObJtyqpECHdXPPNLogfESejmL ZlTTWyNMMumS8oGikvXCoOEls6wXqFBhQx1F9R2vgfMu+b9pchd7nVZa20hDwKqIWsdR q+sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+qKNF4SDqZ8Cmkl7t5eoGqwDzAnyKArVQHpPC0Jdyo0=; b=xz7RnWqB8QGAQo1d0ww+H50W01J5D6eTU0lmUMhxnsk+erakR1O417LBByuFZqpfdG u2SlpoEGbL4KZJ5JrFjtRJPs/0buQWZs226HCcr/qowMr8GBgW3pLGaABo4P1km3pul1 ZYB6dxVDGbe7Z4A0sl1FQXEgUMLWHTl0BlddAs7w5/HdmeO8XUx9McJJ+pJCeHW8siLE NzfjaA3bVamfJxgugxjC5PPNChVqhB+UbGxbES1cbx8tkQNAUPF7tWmWx6qCbPzMtLqB Mpazw6PkL/3IoMpyYnHhmUOOqSCAn3iUT/rbQsXFgp1q1ybPpu7D0KaboyVYxPnW2KYs j9+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=y7u2sbbh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si9270011pgs.417.2019.01.21.09.09.13; Mon, 21 Jan 2019 09:09:29 -0800 (PST) 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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=y7u2sbbh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727785AbfAURHg (ORCPT + 99 others); Mon, 21 Jan 2019 12:07:36 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:36155 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbfAURHg (ORCPT ); Mon, 21 Jan 2019 12:07:36 -0500 Received: by mail-io1-f68.google.com with SMTP id m19so16934594ioh.3 for ; Mon, 21 Jan 2019 09:07:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+qKNF4SDqZ8Cmkl7t5eoGqwDzAnyKArVQHpPC0Jdyo0=; b=y7u2sbbh627XtRHa4a95FZUweoxWDtAwUfzzvgTr8I4CsFawe1fpSh1XfLAMoCbYSN XAtxLE4XiZ0A+E8DHyUhtPHKNgt3lnTIb1huUeoe6id2oujRNrEM4KvCjvAV2BGRg7Sp tr6Tn3Q/jVo0/iFNRJAZ9a4DWfPPUBxrSgfOX6Cy7vfZILX+f4axuTXQ1yirIPBQkcfc 7UZRjTY/VsXATTEle3wLcNQlp9Bzq6znT8aBoiYgOf6KYOd98ARrfKwYDsPNMQUm/pEm PVqUmtSJUXL4sCYLyfIXP0AjhM57+6c7Cj/VfrgUD1Ji6qJRBlwwDQ+++o+D+5k41pSb 2M0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+qKNF4SDqZ8Cmkl7t5eoGqwDzAnyKArVQHpPC0Jdyo0=; b=X1cfB+i9jcprZtJP60giD9J0HqHoX3Yl9KGg4oIR9a6ny6MUQOdtzgIcNYy38idiaM VlyCFVZKMGGeMrxPt7C76bH0Ecms3nJaTecavM5p30ixDrbpRQycanc7i6oC87rY1DYd BkcfM9WwyXTy4HXDAQg/9aHyGWUqWMAQ4zQ4+xFrlcEq4CDPZpD5zCzeyk3Zltc1luf/ 6O/L+qeMTHYPzVpPkGRbNXStmTetFCaxq843EW2geYiKMwg36z/pUsRlpMPiV2GlwoFC t6iW0xdLNIdfY3XJqDu0cUqiR2he+jax9TycZNCHL/8mYC4rabqwEcaBfe8AdIUX4T/4 /iuw== X-Gm-Message-State: AJcUukdhUp1cfsb1VgIZDfYU5y3BEFROYt7UxWHlacMVr+OXcVTe8gzi B839Gqs7gwMsUeWuvx+NYCmciFgFrhGL9+jxFvssKQ== X-Received: by 2002:a5d:834e:: with SMTP id q14mr16186660ior.258.1548090455062; Mon, 21 Jan 2019 09:07:35 -0800 (PST) MIME-Version: 1.0 References: <20190118134244.22253-1-brgl@bgdev.pl> <20190118134244.22253-11-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Mon, 21 Jan 2019 18:07:24 +0100 Message-ID: Subject: Re: [PATCH 10/13] gpio: max77650: add GPIO support To: Linus Walleij Cc: Brian Masney , Rob Herring , Mark Rutland , Dmitry Torokhov , Jacek Anaszewski , Pavel Machek , Lee Jones , Sebastian Reichel , Liam Girdwood , Mark Brown , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , "open list:GPIO SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Input , Linux LED Subsystem , Linux PM list , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pon., 21 sty 2019 o 15:20 Linus Walleij napisa= =C5=82(a): > > Hi Bartosz, > > thanks for the patch! > > On Fri, Jan 18, 2019 at 2:43 PM Bartosz Golaszewski wrote= : > > > From: Bartosz Golaszewski > > > > Add GPIO support for max77650 mfd device. This PMIC exposes a single > > GPIO line. > > > > Signed-off-by: Bartosz Golaszewski > > Overall you know for sure what you're doing so not much to > say about the GPIO chip etc. The .set_config() is nice and > helpful (maybe you will be able to also add pull up/down > using Thomas Petazzoni's new config interfaces!) > > However enlighten me on this: > > > +static int max77650_gpio_to_irq(struct gpio_chip *gc, unsigned int off= set) > > +{ > > + struct max77650_gpio_chip *chip =3D gpiochip_get_data(gc); > > + > > + return regmap_irq_get_virq(chip->irq_chip_data, MAX77650_INT_GP= I); > > +} > > I know this may be opening the gates to a lot of coding, but > isn't this IRQ hierarchical? I.e. that irqchip is not in the > node of the GPIO chip but in the node of the MFD top > device, with a 1:1 mapping between some of the IRQs > and a certain GPIO line. > > Using regmap IRQ makes it confusing for me so I do not > know for sure if that is the case. > > I am worried that you are recreating a problem (present in many > drivers, including some written by me, mea culpa) that Brian Masney > has been trying to solve for the gpiochip inside the SPMI > GPIO (drivers/pinctrl/qcom/pinctrl-spmi-gpio.c). > > I have queued Brians refactoring and solution here: > https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log= /?h=3Dib-qcom-spmi > > And the overall description on what he's trying to achieve is > here: > https://marc.info/?l=3Dlinux-gpio&m=3D154793071511130&w=3D2 > > My problem description (which I fear will apply also to this > driver): > https://www.spinics.net/lists/linux-gpio/msg34655.html > > I plan to merge Brians patches soon-ish to devel and then from > there try to construct more helpers in the gpiolib core, > and if possible fix some of the old drivers who rely on > .to_irq(). > > We will certainly fix ssbi-gpio as well, and that is a good start > since the Qualdcomm platforms are so pervasive in the > market. > > But maybe this doesn't apply here? I am not the smartest... > Just want to make sure that it is possible to refer an > interrupt directly to this DT node, as it is indeed marked > as interrupt-controller. > Hi Linus, Thank you for your review. While I think you're right about the issue being present in this driver, I'm not sure it's really a problem. Do we actually require every gpio-controller to also be a stand-alone interrupt-controller? The binding document for the GPIO module doesn't mention this - it only requires the gpio-controller property. Without the "interrupt-controller" property dtc will bail-out if anyone uses this node as the interrupt parent. If I'm wrong and we do require it, then I think we need to update Documentation/devicetree/bindings/gpio/gpio.txt. Best regards, Bartosz Golaszewski PS: FYI since this submission I dropped the virtual irq number lookup in sub-drivers in favor of resources setup by the parent driver[1] as suggested by Dmitry in his review of the input module driver. [1] https://github.com/brgl/linux/blob/topic/max77650_mfd_driver/drivers/gp= io/gpio-max77650.c#L158