Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6284317imu; Mon, 21 Jan 2019 06:22:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN4zvDlZg0V52w37Uj5oJ9kuvUhxkqu5K86jUfyiEXu9sTre6p3hHbpsfYQfPCayW+pIdWFi X-Received: by 2002:a63:9749:: with SMTP id d9mr27833271pgo.415.1548080533187; Mon, 21 Jan 2019 06:22:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548080533; cv=none; d=google.com; s=arc-20160816; b=WAkCG0U2dFXdUC1eDcZkpXkvOBI+ER9zCWZf8psqvcGLbSUwFqAbRuCpF3ns3A64pY Ztck+nh8vhPSJ4IfNjfUs81eluIBnmNu20E8UFjwoWwBfwVFH5S8ggMA3CSkgExXuRa7 K+8prqbX/yU1ZPr8+fiDduWa+CID2JIrDHbHA+ZQGeb0FP0emlPlvR1cMOpfgi2qyZhe XQyD24193K2rjv1KKWs4IxMiBC2vA0v5nDsTg+9r5Oe/bb+19XJJpp04eVGYGmB0Beud wmmA4FjpBepC0JakNvVeeJUC7vHD1S2QtwHQIzEUl0U3iI54Q6hvszg/OyoFXovL2+Qq bzYQ== 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=blI7pVrta7bFFRIe7g2xgLRIywYAbEGyThO1GFaydko=; b=TAFhOzq5Eaiwj8kfdeA4J55fy6R1vMmjZ3YGbeKPoTjIvDlfRkoFHMC1MBNkmymqwM /5++ghirn1+AHntogGy+S/BpT7U0wSoxBidkPelEvcJ/zoI6SXHf6auxFKUs8i8Ehbzf PWA9OpnwbbB6xQQyZ6AlNY1t5kuHTSF0EzHqSRFrDguR5y0EkVVtrUTMv8ZKksi7MhWf +vgJv2D5PxL3fDtdYJIZmp1WBxH8/toW2zyRLQT4ODeXqhkmuhiYN7Wos3zKCJUwVD/k dNXaTXyvqNNT1b5RfZf/mCgpl7WML6aS1fxiD0z3ypUaY+aGxv3ivtLdHN/O9DFVgOeG zdxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FjxGsCqC; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a28si12601265pgl.530.2019.01.21.06.21.57; Mon, 21 Jan 2019 06:22:13 -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=@linaro.org header.s=google header.b=FjxGsCqC; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729907AbfAUOUa (ORCPT + 99 others); Mon, 21 Jan 2019 09:20:30 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:39880 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729693AbfAUOU2 (ORCPT ); Mon, 21 Jan 2019 09:20:28 -0500 Received: by mail-lj1-f196.google.com with SMTP id t9-v6so17673249ljh.6 for ; Mon, 21 Jan 2019 06:20:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=blI7pVrta7bFFRIe7g2xgLRIywYAbEGyThO1GFaydko=; b=FjxGsCqCHHvBaJz6FvVpHzw6NHQPVW+GaCV+nyQy9IG3DEYqqw7NYd2pw0YWhTs2qa U2EPsTBj4LYjUWUEHQfmAdfCUP8nPYcsrYZ8L9hNHYNgTR4B/yvDXJVmWFfP+ZqGcnFi J6O7/tkgc2eQBcgdsuZwAH+F9O6Vvx6rkTNwY= 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; bh=blI7pVrta7bFFRIe7g2xgLRIywYAbEGyThO1GFaydko=; b=ajtFMehqmKsdBBGN15NLX7MJivwS7aekJx3U6pkMmxBtZT2h8tk3WGw9FLuAgfSS71 vNc/IV2LbAUnU+i7lqBo7mgce0tmHsLj5/GKq5ReuOOXEobCIndPegKOHR3Eq2cVq0Ty dZHmkvqF902MCHJSSC3JMlq2Y9Y4SosaHFu719yutyggZQ2ZXHC6g6o10cwy65csF3Ul f9GOwrZa0/xwHtqLrnIZpHDFKpF2Ge8HBvq1k7CXW8DP7yncSY7yhXLIHo3zfIjcDBh7 JynaHwsJPojs6CJZTUg9LnuBS0AQugsaRQpoNEAlVdU0ktDsQjSuGiWj53IAdsMtQCcC rD4g== X-Gm-Message-State: AJcUukf3UyMagIFyfAOYaeJUdKeJCIa9yJ6q/KCLrGvVgZnPEruN7wHr KGgEGdXZafgg+a8RJHhUVLKin2/TfOE6GzybQ6vXJg== X-Received: by 2002:a2e:9107:: with SMTP id m7-v6mr17901121ljg.23.1548080426506; Mon, 21 Jan 2019 06:20:26 -0800 (PST) MIME-Version: 1.0 References: <20190118134244.22253-1-brgl@bgdev.pl> <20190118134244.22253-11-brgl@bgdev.pl> In-Reply-To: <20190118134244.22253-11-brgl@bgdev.pl> From: Linus Walleij Date: Mon, 21 Jan 2019 15:20:13 +0100 Message-ID: Subject: Re: [PATCH 10/13] gpio: max77650: add GPIO support To: Bartosz Golaszewski , Brian Masney Cc: 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 offset) > +{ > + struct max77650_gpio_chip *chip = gpiochip_get_data(gc); > + > + return regmap_irq_get_virq(chip->irq_chip_data, MAX77650_INT_GPI); > +} 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=ib-qcom-spmi And the overall description on what he's trying to achieve is here: https://marc.info/?l=linux-gpio&m=154793071511130&w=2 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. Yours, Linus Walleij