Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp131334imu; Tue, 27 Nov 2018 10:01:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/UTAGP1J4T5/ijPQ1sbvgZWBNiFv7JXRROfwcD7ZqhTnq5XlMV0T29CmgXlXRm814WmUTpO X-Received: by 2002:a63:2507:: with SMTP id l7mr28896210pgl.22.1543341665966; Tue, 27 Nov 2018 10:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543341665; cv=none; d=google.com; s=arc-20160816; b=lb30mMvpp0KuMIs4uTD2dCb0lxDVDxHZSbz/BAlpmF8XyfQ+QypFBeZoeKvK4gI2xN 8Bwq8OgLnJoWP7TUGBArVIyYC/GEzKMi1l1kpI1w4qTJpZBotwGooeDw0/cbeOxzfQdF NqfV1BFK5aPbX9MhjaG5GbHtUcA4o+B5DcV/zU3+Vm5PCj8W8FGcY+u4tNUnqe7NSXEa 9FeNw2+Ez3h61HRXUi9+q/lL2Az2wnp21b+MP5eo95imVJJO5MiUs+hYttispxEe7A5+ H4mFyDPrkIMEBjt+o6e6+BhW7b3sqZaNDh57WJv2ghvbVp26UPEvAGK6CL73GPvTgpUU TXtA== 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:from:date; bh=gylE9yn+SpMerBm0Q+NJjs2H6YEmjXHQyr6TR8U2wco=; b=tBD0Gb4nEYYlmmWcfCvkmihrQJrYPPfZQbggCrbNLBm2evU1aGanwfAT/MDyDjxciP APvy/fbkJc29gjX4lo5HJJCnUkEcLXliQbwkgbsbp/SWZVRn0p7D/+jnS1p6SL0vQvIH jE18tfiSACo1URzQNanCgQ36DDWSTzuTOEez4hL17qsOL3xPhBJWzem0i1LRKV7N4gvo jcNNNKPGqJL5Y9Su7qazCbeqOFRqq1uTFXtWpZCAdp41dr5b8J4SN9B8aE01XURYQ5qR 4ALDCSrLjGeOBa4ZoK+KQCT7tdqJJbCn0XLS58a28/WBG6hg4Ee9c8nKfjp0qBmNtUYE 2cRA== ARC-Authentication-Results: i=1; mx.google.com; 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 i6-v6si4507147plt.328.2018.11.27.10.00.20; Tue, 27 Nov 2018 10:01:05 -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; 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 S1732133AbeK1EyX (ORCPT + 99 others); Tue, 27 Nov 2018 23:54:23 -0500 Received: from muru.com ([72.249.23.125]:55348 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732019AbeK1EyW (ORCPT ); Tue, 27 Nov 2018 23:54:22 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id EDD398030; Tue, 27 Nov 2018 17:55:42 +0000 (UTC) Date: Tue, 27 Nov 2018 09:55:38 -0800 From: Tony Lindgren To: Jon Hunter Cc: Thierry Reding , Peter Ujfalusi , Belisko Marek , LKML , linux-omap@vger.kernel.org, "Dr. H. Nikolaus Schaller" , Laxman Dewangan Subject: Re: omap5 fixing palmas IRQ_TYPE_NONE warning leads to gpadc timeouts Message-ID: <20181127175538.GS53235@atomide.com> References: <46d271b2-35d3-6353-c530-3292cdac53ab@ti.com> <20181119161906.GP53235@atomide.com> <20181119171406.GQ53235@atomide.com> <725df8e7-4aff-3751-d0b0-809b89e882e5@nvidia.com> <20181123164827.GE53235@atomide.com> <20181126093625.GA10878@ulmo> <20181126102541.GC10878@ulmo> <20181126193212.GN53235@atomide.com> <149b3b6b-e52e-4942-151b-6df4358f5a7a@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <149b3b6b-e52e-4942-151b-6df4358f5a7a@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Jon Hunter [181126 20:17]: > > On 26/11/2018 19:32, Tony Lindgren wrote: > > * Thierry Reding [181126 10:25]: > >> On Mon, Nov 26, 2018 at 11:49:54AM +0200, Peter Ujfalusi wrote: > >>> The register map documentation I have states the following: > >>> bit7 INT_POLARITY Select the polarity of the INT output line > >>> 0: Interrupt line (INT) is low when interrupt is pending (default) RW > >>> 1: Interrupt line (INT) is high when interrupt is pending > >>> > >>> By default the Palmas irq is active low. > >> > >> That would confirm that the driver code is correct. My understanding is > >> that the PMC on Tegra expects a low-active IRQ from the PMIC, so we need > >> to invert the interrupt again in the PMC. > > > > But then why Tegra need to set PALMAS_POLARITY_CTRL_INT_POLARITY > > if dts has IRQ_TYPE_LEVEL_HIGH? Shouldn't the Palmas default low > > setting be correct for Tegra if PMC expects active-low interrupt > > and then inverts it for GIC? > > So I think what is going on here is ... > > 1. For Tegra, the interrupt parent the palmas interrupt in DT is the GIC > not the PMC. The PMC does not register an interrupt controller > (although to be correct probably should have. I think it had been > discussed in the past and Stephen W may know the history here). So > the interrupt polarity has to be HIGH otherwise setting the trigger > type in the GIC will fail (as it only supports rising edge or level > high IIRC). > 2. However, as Thierry mentioned the Tegra PMC wants an active low > interrupt and so the PMC inverts it on entering the PMC. However, > given that the GIC interrupts must be active high, the PMC must > invert again between the PMC and GIC. > > So looking back my description in the change 7e9d474954f4 was not quite > accurate because the interrupt from palmas is active high but the PMC > inverts it. I think that this is quite confusing because we don't have a > good way to describe this in the DT. If we made the PMC an interrupt > controller then it would probably be a lot clearer. However, for > historical reasons this was not done. OK if Tegra PMC inverts the PMIC interrupt coming in from palmas as active-high to active-low for PMC, and then PMC again inverts it from active-low to active-high for GIC then it makes sense. The only option that works for omap5 at palmas end is if PALMAS_POLARITY_CTRL_INT_POLARITY is cleared. Setting the SoC internal pulls does not make a difference, so I suspect there is either some unknown pull-up/pull-down configuration register in palmas, or there is an external pull resistor. But as dra7 is using a gpio interrupt, I'll just change omap5 to use gpio_wk16 instead of sys_nirq1 too. Will send out a patch shortly. Regards, Tony