Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2400679pxu; Mon, 7 Dec 2020 05:48:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4qMyaZN2dCIUOpN1BqlR9031ifuntpGuN+MvpbR5SyjlG2XpFENRKXCe7nMBpziQhjOsq X-Received: by 2002:a05:6402:1c96:: with SMTP id cy22mr19717007edb.339.1607348932458; Mon, 07 Dec 2020 05:48:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607348932; cv=none; d=google.com; s=arc-20160816; b=hSAp554oXHezabSNQgnFjeLklWg2leqrl3oeh659arjAg8uwPb1NZuvuRMJg/SyYNR OoCdQIUl7qPHIUJFmWy6e0/tQw+nfL+JeewlA73njSYgv5ZKPCK+bk3WkBHia0YekDZZ donRJaddEEP2J7k0q5+LXr+4wJmSe5xuR7ZgAR2MM5MU2D6WJWatPDgBGQdy+D+yHD97 yyxPM7UjdcsrBBsvoxc/lYS5YxvBVpg6BWy+JPHtO9v2QUeSyIxLxtowaf7fhKtHUnjq SwYHDEzbmVVSNvoITGXds0Uwlase5ATN+cjdj9e/clpTuDbIFHrPC8Jt46jupMGaki7E V/Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gP0uJhQTgF/+63+6gB2l+pnsCV2YV5kIdg6VVuH/EPg=; b=LH02vjIvE771PnS2ZkQGahUZGQWrJNzsZQdopJ2PM276IJrSGYZRVwJeG/L7pWXLE0 63DsQPntOTPqRSFOQ63fP9j2f6pyas1jXcU8BjaFGlK9kLLMvU4dL/m4ztkRmbHcng25 JPmudwSMEGN69ONNRaRdujrs14wVSYhCllV/oiSE0umKbpecDH81ghS+sMXeGtYjL3BH uRtDV3EY3jJFbm9Td2w20vMVoOmT/BwY8dWFS/aowI+lc7GDocriwr+qnkbpKF9Hb4p3 6erRU49cNVHGjqC79N6tUbZbtdZpsm674GaB1WFqr3FMQAFFFyBDFxnIw/cbq7oyiaQn 7TFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wIwEnnsZ; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 88si8249269edr.151.2020.12.07.05.48.25; Mon, 07 Dec 2020 05:48:52 -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=@linaro.org header.s=google header.b=wIwEnnsZ; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726367AbgLGNo3 (ORCPT + 99 others); Mon, 7 Dec 2020 08:44:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbgLGNo3 (ORCPT ); Mon, 7 Dec 2020 08:44:29 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 637DAC0613D3 for ; Mon, 7 Dec 2020 05:43:48 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id l11so18177035lfg.0 for ; Mon, 07 Dec 2020 05:43:48 -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=gP0uJhQTgF/+63+6gB2l+pnsCV2YV5kIdg6VVuH/EPg=; b=wIwEnnsZNQshljsYBE4lem1wlantjPxjdyfhvVc5xSyfwo/p1r3xY4FFmPmRbkP3Ji TDPOtFp7oYMFl1jRnDGJRFvwN6eNJvWA9YMsEQUzwT+c26CRjCY03kenMQSZV5D7uKAy oOgEBb/0wcKQZWP2BoYXl4f5ifuyJLym4cMeY94MgOo9Pj3Rab7X/5dkEirUjfA1paHE 8tPdH4aToNawRR7X1A4J+0NWY86ZbfcwMW18bAi6WNUAT/3xGwfvLnCbbLQzGctEH+PE 0dOEnClsuG/3DQ585xyUwWTDbpFln1ceL4kyoMfP4Y3CtmjkaZsFJkW4U6rrSIJ+pG91 H9HA== 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=gP0uJhQTgF/+63+6gB2l+pnsCV2YV5kIdg6VVuH/EPg=; b=hVl+/6RLuiPWzM6ijF0LbHDF9a2LKTQkb6zsfTvC9xdIhC5xbwNuAoPLGWWj+JB8br EJoDQ2kxS2mfiac1f6uBSHe98bL3NV8iBZTjhCdpSwpJekkI/XsUrgCz02gCTiJGRruf AnZjIPbjTNHgfXTjA24/LA/S0UpHqSXfXBNzuOdoRPN7sUUs53skLolVZeVJPAb+VP0C KO/L/yroFiPJubemUjjywDHh4CFc2iPlSGi9b2MpGvFPfKskvMpKsN3h5x4Mip6EobAD Ojz2jV2uyAGv1GJJ4BusPj5qUg5KfL6tprAC2NjbTnrX+/kRl3zQDPxoWRnLTuOjJCLE TW1A== X-Gm-Message-State: AOAM530+6Z9jr0F3ebuvDDUZvy9mViDBykNg6lIb1+roT6XDZICCTAkq zODXeYo9qUW5cZ7+HaxWwoVzKP7ST2eWhwaOF6Ttyw== X-Received: by 2002:ac2:4308:: with SMTP id l8mr7872928lfh.260.1607348626724; Mon, 07 Dec 2020 05:43:46 -0800 (PST) MIME-Version: 1.0 References: <1jeek5ps3b.fsf@starbuckisacylon.baylibre.com> <1jtusxkh6v.fsf@starbuckisacylon.baylibre.com> <1jr1o1katc.fsf@starbuckisacylon.baylibre.com> In-Reply-To: <1jr1o1katc.fsf@starbuckisacylon.baylibre.com> From: Linus Walleij Date: Mon, 7 Dec 2020 14:43:36 +0100 Message-ID: Subject: Re: 0001-add-amlogic-gpio-to-irq To: Jerome Brunet Cc: Marc Zyngier , Andy Shevchenko , =?UTF-8?B?5p6X5Zyj5qyi?= , khilman , narmstrong , "martin.blumenstingl" , linux-gpio , linux-arm-kernel , linux-amlogic , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 7, 2020 at 2:25 PM Jerome Brunet wrote: > [Me] > > So maybe the problem is that you need to go back and think about > > updating the DT bindings for this thing to include interrupt-controller > > as well? > > We do > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/irqchip/irq-meson-gpio.c > > That's actually the only thing we provide, on purpose. Aha I see now. > >> * We only get to know a mapping is required when gpio_to_irq() is called > > > > No that callback should not be used for that. > > Agreed ... I was trying explain why we did *not* push a patch similar to what > was proposed here, or use gpiolib irqchip. The gpiolib irqchip kind of suppose there is a 1-to-1 mapping between a GPIO line and an IRQ, so I see the reasoning. That said, the callbacks are code so a deviant remapping irq line "pool" could possibly be used. > > I don't quite understand this. Do you mean you are bombarded by pointless > > requests for interrupts that will not work anyways? > > When we tried the approach suggested in this patch (again I agree it is > bad, which is why I'm against it), some drivers out there (I don't > remember which one TBH - that was 3 years ago) parsed the "gpio" > property and tried gpio_to_irq() and if it did not work then go > something else (like polling). > > However the allocation stayed behind. It does not take much > "bombardment" when you only have 8. I don't see any problem with gpio_to_irq() always returning -EINVAL in situations like this. > We control the ressources of the devices through DT, not the necessarily > drivers (which may be generic) > > Some device needs the gpio, even if we don't want the irq. > We can't always prevent the driver to try gpio_to_irq(). True. But you can say "no" to anything trying to do that, that way you will only hand out the irqs on a first-come-first serve basis to the clients that use the irqs directly and thus you get it under control. > This why I don't want gpio_to_irq() to be enabled on this HW, because it > would not be under our control anymore. I think you can enable it and use gpiolibs hierarchical irqchip but let gpio_to_irq() say no to everything. > Again agreed. I'm really sorry if I have been that unclear about my > motive here. We already had that discussion 3 years ago, I totally > understand your point and agree. I was trying (and failing) to tell the > author of the patch that this approach had already been discussed in > past and that, unless gpiolib dramatically changed since then, > gpio_to_irq() should be used in this way and he should use irqchip we > already provide. OK I get it. It's just that from my point of view using the hierarchical gpiolib irqchip has a value in itself even if gpio_to_irq() isn't used at all because it brings the criss-cross under control. If the author wants to get some driver to work, such as MMC card detect or ethernet phy or similar, what s/he should do is to go and fix the driver to ask for an irq directly from the platform device or similar if it can't get an IRQ from the GPIO line by using gpiod_to_irq(). Yours, Linus Walleij