Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp516812ybe; Fri, 6 Sep 2019 03:07:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSZfKiYAyQGX5miNZVVKbLvDjcgezSUm9CD8rwhCJxfDNswoxqwxy+1VQPp8Be07jo5VaI X-Received: by 2002:a62:198b:: with SMTP id 133mr7211653pfz.257.1567764422850; Fri, 06 Sep 2019 03:07:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567764422; cv=none; d=google.com; s=arc-20160816; b=ox9fRAog/2i7eGn9utoe+KBItjOYkg+A3ZqQw4il7xtcsWPflv0H/Ptit5yKPkuF6O GleTvkFqLGLeoyKGKXEg7wt2XGq7211GfyhwMkHnCjbiKeRWksmbuaO/v4k1nq0Fet/X 3VXE+CA5A1KUgbglhcDgdgtcRsx2gNBu/iecxXNVQHnlpIi60czPV4Am5aFXgSjhgE+g 1pMLkVdvoUX5eD2V3qbjrJGXbmSy4Jrk6A78YsqDpAYnA6cP9IBKOUxlgVGfWopWOw10 P5aeh6/RTvLI80RgCHNX1KvCVGsrugrtrFctihiDChVxl6rvLuLpRze6e8A1+22ZrsGc AfsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:subject:cc:from:to :references:in-reply-to:content-transfer-encoding:mime-version :message-id:dkim-signature; bh=MPDWtahInu0EL/Ywfs85W/c8rw7VGUzH6mYW6IduHVo=; b=OnUK7ty6rAsK2DoO5pZ49kD85ApT+pE0g3ibAw9KcNSTBZapE8BX4FoGoXn9nn8j0K q+aRd/Pr/Iny+ViBNvjBIh4hq22hgAopEyWtSJxzsJAW3ndRFLLgI2SHX7C0xjlp4qvF LTvOda/oHwpIqPS1juAN/d+Cgvom8Gqf+WEDIxkJ+q3f+EO0UQuf2k33XV98x8e5RAEz QG4b5n1Ib26Nk2Xx0Kf5WjgyvZhMzs31cgkdolNiT+MPto5JsrxhX8vBWwPlMHOP1jdZ Jq8ZIyTaj/sFi6jPHaJN94GnAUxTKOqoK1uXHnBFZvS9e/8NpMp762/WH0UNXTLWxuz3 hM+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=StCAfb2A; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si3997123pgp.409.2019.09.06.03.06.45; Fri, 06 Sep 2019 03:07:02 -0700 (PDT) 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=@chromium.org header.s=google header.b=StCAfb2A; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391531AbfIFAWx (ORCPT + 99 others); Thu, 5 Sep 2019 20:22:53 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43166 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391513AbfIFAWw (ORCPT ); Thu, 5 Sep 2019 20:22:52 -0400 Received: by mail-pf1-f196.google.com with SMTP id d15so3037039pfo.10 for ; Thu, 05 Sep 2019 17:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=message-id:mime-version:content-transfer-encoding:in-reply-to :references:to:from:cc:subject:user-agent:date; bh=MPDWtahInu0EL/Ywfs85W/c8rw7VGUzH6mYW6IduHVo=; b=StCAfb2AiqD8Ue3i9/QI4bpVf/OWZ286AN1LOQL2HLVx0V3VRyFDprvRadL0U790Iy 4vGCpclo1d6hoYw8GYf8EGw8r7PCB9VLmNFaruJFxZLEht1Wfv1rij2uywO62jUbAu4K HO1r3hANXe6deztEoqZXXBxJ7mLDcjgE27KHc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version :content-transfer-encoding:in-reply-to:references:to:from:cc:subject :user-agent:date; bh=MPDWtahInu0EL/Ywfs85W/c8rw7VGUzH6mYW6IduHVo=; b=MPpDoLPNj8GHwzIx8LZ6VfiafRoUD+et+OvWqGH0D8Zp79bT7a5Qgo5ksIEjMRFz2s 5dWSGnOMkyAWhm0aclgJk6cWXFukk0izvco5QKxstdJRLAmwOmACD6/aIFBh3VieHDfC FwEDBTKMLNg0qqP7HIK7G3NbV7qYBJFyASOea7Gof07l9Aj5Q/GewlIZh1Sg06qpM2sT UrAK7v2ApWaYaTRZlEIW4mEMSIJX19JdBWJ7uKA1UJg/cngFX/Fk47x3hbUCgozgFEW+ 8rotzHnqQ5Fn520pbhObAqUvlv4TSYtEH2AcmRnU6Qc8SZYTfMBJghiOf1R3YPPQqjQa +tqQ== X-Gm-Message-State: APjAAAWVKaJDfx4wnfDI0NE3gOgNNTRMBtHWAIcgM1nlW8rzV/Y6YLTr vPpkz99nE5JMAiITrE1pl67Dxg== X-Received: by 2002:aa7:8219:: with SMTP id k25mr7365951pfi.72.1567729371874; Thu, 05 Sep 2019 17:22:51 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id k31sm3495752pjb.14.2019.09.05.17.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 17:22:51 -0700 (PDT) Message-ID: <5d71a6db.1c69fb81.1bc1c.9225@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190829181203.2660-7-ilina@codeaurora.org> References: <20190829181203.2660-1-ilina@codeaurora.org> <20190829181203.2660-7-ilina@codeaurora.org> To: Lina Iyer , evgreen@chromium.org, linus.walleij@linaro.org, marc.zyngier@arm.com From: Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, mkshah@codeaurora.org, linux-gpio@vger.kernel.org, rnayak@codeaurora.org, Lina Iyer Subject: Re: [PATCH RFC 06/14] drivers: irqchip: pdc: additionally set type in SPI config registers User-Agent: alot/0.8.1 Date: Thu, 05 Sep 2019 17:22:50 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Lina Iyer (2019-08-29 11:11:55) > diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c > index ad1faf634bcf..bf5f98bb4d2b 100644 > --- a/drivers/irqchip/qcom-pdc.c > +++ b/drivers/irqchip/qcom-pdc.c > @@ -100,6 +112,57 @@ static void qcom_pdc_gic_unmask(struct irq_data *d) > irq_chip_unmask_parent(d); > } > =20 > +static u32 __spi_pin_read(unsigned int pin) > +{ > + void __iomem *cfg_reg =3D spi_cfg->base + pin * 4; > + u64 scm_cfg_reg =3D spi_cfg->start + pin * 4; > + > + if (spi_cfg->scm_io) { > + unsigned int val; > + > + qcom_scm_io_readl(scm_cfg_reg, &val); > + return val; > + } else { > + return readl(cfg_reg); > + } Please remove the else and just return readl() result instead. > +} > + > +static void __spi_pin_write(unsigned int pin, unsigned int val) > +{ > + void __iomem *cfg_reg =3D spi_cfg->base + pin * 4; > + u64 scm_cfg_reg =3D spi_cfg->start + pin * 4; > + > + if (spi_cfg->scm_io) > + qcom_scm_io_writel(scm_cfg_reg, val); > + else > + writel(val, cfg_reg); > +} > + > +static int spi_configure_type(irq_hw_number_t hwirq, unsigned int type) > +{ > + int spi =3D hwirq - 32; > + u32 pin =3D spi / 32; > + u32 mask =3D BIT(spi % 32); > + u32 val; > + unsigned long flags; > + > + if (!spi_cfg) > + return 0; > + > + if (pin * 4 > spi_cfg->size) > + return -EFAULT; > + > + raw_spin_lock_irqsave(&pdc_lock, flags); Ah I don't think the regmap would use a raw spinlock, so that's another hurdle to get over here. > + val =3D __spi_pin_read(pin); > + val &=3D ~mask; > + if (type & IRQ_TYPE_LEVEL_MASK) > + val |=3D mask; > + __spi_pin_write(pin, val); Does monitoring level triggered interrupts matter? I'm asking if the whole thing can be configured to monitor for edges regardless of trigger type and then let the level handling be done by the GIC after the wakeup or when the device is active. > + raw_spin_unlock_irqrestore(&pdc_lock, flags); > + > + return 0; > +} > + > /* > * GIC does not handle falling edge or active low. To allow falling edge= and > * active low interrupts to be handled at GIC, PDC has an inverter that = inverts