Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp140884ybt; Tue, 7 Jul 2020 18:28:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw39yBc5Gg90ij00VVOrtDzcgtYIzgrVSmc74+5iQrkrjW5NYC37EdF6mR5jiBfSqEwu1Jy X-Received: by 2002:a17:906:1187:: with SMTP id n7mr43932920eja.161.1594171708924; Tue, 07 Jul 2020 18:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594171708; cv=none; d=google.com; s=arc-20160816; b=mf2ZR4bBgGTKSx4NWxjsIZ2achTPxasV0yXa6MZrC5/ZFEuYQykU8c+f8LTBPBZ9uL rJy6I76wkjChyhPf16Gv9f84bpITcW+QdwtTq0rjC/tt0aIw64xH7yPqQP1aizLg4qtu 10p6drxsEwbAwRY9QJUpawhXWNwwrMbgXNrZIGFLZ/HUoqLwXuChQTykQMLfMTY355ox w9/TwzFM6Z+1r0C6xzhiEXnAz7VJ4AqPqWEGm3ym0Du3FKGozsR8ZXecrmTKRcJdFGfj csEH/jkD8NGpn/cvxi0h8Br4lZrKYsICVz1xKpAe2njOypC9YiX9pVx7vm+L4xZEWKA8 GYzQ== 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=9jiS4KqONWOC5mf3zrCvAZ5bUNYEcdecmpFqJ7RDpoE=; b=ULbirry2ZZBLpbzdaLK6ENtd2gx9gdwyyhCtRHGmmXh4AO61wCQJ4r5CkVRPTtgTVR EYzLE+rX6SX4FKRTjsPIh5vBTgqjO8Ql5kDHcU8JemGB6Kg2fPrtmHUl2m+c/8gzQTfY KAY4PnmaS9l9pA2NTo6F1B/DWZBU9d+CzkFVe+ZJH+tDi6reQWCTXfRmeUT5/IOtd73N gsxIDsRc/jUWX1bUy3r6QmZQqAgRHiL7EWLfWLIhQFHG8sPbCRGEh/R/tWGpby1tokrQ H0HvzWFKjWdOqam4rJwdVOaLmyITIo8G6bglfUZQREDdwItHdnUUxRVZ3xLs3PDk1Vd6 u3Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=diGz9A07; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si15180523ejl.692.2020.07.07.18.28.06; Tue, 07 Jul 2020 18:28:28 -0700 (PDT) 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=@chromium.org header.s=google header.b=diGz9A07; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729168AbgGHBNs (ORCPT + 99 others); Tue, 7 Jul 2020 21:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728623AbgGHBNr (ORCPT ); Tue, 7 Jul 2020 21:13:47 -0400 Received: from mail-ua1-x944.google.com (mail-ua1-x944.google.com [IPv6:2607:f8b0:4864:20::944]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDC70C08C5DC for ; Tue, 7 Jul 2020 18:13:47 -0700 (PDT) Received: by mail-ua1-x944.google.com with SMTP id b13so13848187uav.3 for ; Tue, 07 Jul 2020 18:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9jiS4KqONWOC5mf3zrCvAZ5bUNYEcdecmpFqJ7RDpoE=; b=diGz9A072uzSke+K19POfossW4WSRglikhF9LycKc8CR4PNoz8WaQE5v0QwBE1aucz w0WCY4cw/7yXlMhPNh/i0S6Nv6pOlmRsclaHePlUS1T0/13xRIPZlbgdO41pHrw/ao5s 2WMqeccT14DiuCHrvJ9vql3jEt9lia2Y6lITE= 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=9jiS4KqONWOC5mf3zrCvAZ5bUNYEcdecmpFqJ7RDpoE=; b=okrJj044rEUzNxnngCviON+h+qM35miXW388PIqRx0NGz0BP91AIyXslfv+75aNIIw iApsK4SUz/R9pQWdfYKwMVZpZBZOtsjefbcnFeSCCuTcA/IEksTG8XQ0I3BI+x570k34 i+wQLSCihDeubTS0GDNbNp7npXDDcQCETGH70HQsiuZR0GRlNElFPZD2j1eQRQsqTiTB 50pODQ7y4Y1nWrUn6T9Au08mgzHJBAKqEitbO6W28r/lJK9LomUhCHDQQYSWIMZy+qrU DG0d5zTkcV7ZaT4rxP8dVh+azj8SsC+8Fqq7AtQ/zBc9AMIYFexJHvihcY/RaoE3jZWg OlWg== X-Gm-Message-State: AOAM531oHOjDdnKqcrwJSv7gJCKoYk0JmAZgjpi56BzHJMzbSLAV1guU QWt2S9qt4lrqYBjkPUO/74OhD3mdl58= X-Received: by 2002:a9f:22c4:: with SMTP id 62mr34349695uan.135.1594170826473; Tue, 07 Jul 2020 18:13:46 -0700 (PDT) Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com. [209.85.222.47]) by smtp.gmail.com with ESMTPSA id v205sm327915vke.25.2020.07.07.18.13.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jul 2020 18:13:45 -0700 (PDT) Received: by mail-ua1-f47.google.com with SMTP id b13so13848175uav.3 for ; Tue, 07 Jul 2020 18:13:45 -0700 (PDT) X-Received: by 2002:ab0:2408:: with SMTP id f8mr32068943uan.91.1594170824905; Tue, 07 Jul 2020 18:13:44 -0700 (PDT) MIME-Version: 1.0 References: <1593762506-32680-1-git-send-email-rnayak@codeaurora.org> <20200706203805.GS388985@builder.lan> In-Reply-To: From: Doug Anderson Date: Tue, 7 Jul 2020 18:13:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] pinctrl: qcom: sc7180: Make gpio28 non wakeup capable for google,lazor To: Rajendra Nayak Cc: Bjorn Andersson , LinusW , Andy Gross , linux-arm-msm , "open list:GPIO SUBSYSTEM" , LKML , Maulik Shah , Lina Iyer 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, On Tue, Jul 7, 2020 at 4:03 PM Doug Anderson wrote: > > Hi, > > On Mon, Jul 6, 2020 at 9:52 PM Rajendra Nayak wrote: > > > > > > [].. > > > > >>> @@ -1151,6 +1168,10 @@ static const struct msm_pinctrl_soc_data sc7180_pinctrl = { > > >>> > > >>> static int sc7180_pinctrl_probe(struct platform_device *pdev) > > >>> { > > >>> + if (of_machine_is_compatible("google,lazor")) { > > >>> + sc7180_pinctrl.wakeirq_map = sc7180_lazor_pdc_map; > > >>> + sc7180_pinctrl.nwakeirq_map = ARRAY_SIZE(sc7180_lazor_pdc_map); > > >>> + } > > >> > > >> As much as I want patches landed and things working, the above just > > >> doesn't feel like a viable solution. I guess it could work as a short > > >> term hack but it's going to become untenable pretty quickly. > > > > > > I second that. > > > > > >> As we > > >> have more variants of this we're going to have to just keep piling > > >> more machines in here, right? ...this is also already broken for us > > >> because not all boards will have the "google,lazor" compatible. From > > >> the current Chrome OS here are the compatibles for various revs/SKUs > > >> > > >> compatible = "google,lazor-rev0", "qcom,sc7180"; > > >> compatible = "google,lazor-rev0-sku0", "qcom,sc7180"; > > >> compatible = "google,lazor", "qcom,sc7180"; > > >> compatible = "google,lazor-sku0", "qcom,sc7180"; > > >> compatible = "google,lazor-rev2", "qcom,sc7180"; > > >> > > >> ...so of the 5 boards you'll only match one of them. > > >> > > >> > > >> Maybe I'm jumping into a situation again where I'm ignorant since I > > >> haven't followed all the prior conversation, but is it really that > > >> hard to just add dual edge support to the PDC irqchip driver? ...or > > > > FWIK, this is really a PDC hardware issue (with the specific IP rev that exists > > on sc7180) so working it around in SW could get ugly. > > Ugh. I guess it's ugly because the workaround would need to be in the > PDC driver but to properly do the workaround you need to be able to > read the state of the pin from the PDC driver? ...and I guess you > can't do that with the PDC register space so you'd either need to > violate a layer or 3 of abstraction and snarf into the GPIO register > space from the PDC driver or you'd have to provide some sort of API > access from the PDC back down to the GPIO driver? > > -- > > Actually, though, I'm still not sure why this would need to be in the > PDC driver. Sure, you can't just magically re-use the existing > dual-edge emulation in pinctrl-msm.c, but you can add some new > dual-edge emulation for when your parent handles your interrupts, > can't you? As per usually, I'm talking out of my rear end, but I > sorta imagine: > > 1. At the head of msm_gpio_irq_set_type() if you detect that > "skip_wake_irqs" is set and you're on an SoC with this hardware errata > then you do a loop much like the one in > msm_gpio_update_dual_edge_pos() except that instead of changing the > polarity with msm_writel_intr_cfg() you change the polarity with > "irq_chip_set_type_parent()". > > 2. At the head of msm_gpio_irq_ack() you make the same function call > if "skip_wake_irqs" is set and you're on an SoC with this hardware > errata. > > It doesn't feel all that ugly to me, assuming I'm understanding it > correctly. ...or maybe you can tell me why it'd be harder than that? So I REALLY don't know what I'm doing and this is very rough and probably all sorts of illegal (maybe?), but in the limited testing I was able to do it seemed to work: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2285815 WIP: proof of concept workaround for PDC wakeup problem If there's anything worthwhile to steal from that, please feel free and post your own patch based on it. :-) -Doug