Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1975502pxb; Fri, 24 Sep 2021 16:51:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFBIRULaWG6IasMCsXWZrQYM45zGXlA1FS0CRpycohTF/dGXu/42hqApqDIhFMqxVLSX43 X-Received: by 2002:a05:6e02:110f:: with SMTP id u15mr10541080ilk.6.1632527515644; Fri, 24 Sep 2021 16:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632527515; cv=none; d=google.com; s=arc-20160816; b=i03VUPQOLmjcpeMKds06FB3UbFtZIXuPEwDXYpStmE2aC7DdqZaLIKyjta8pzvX9E6 2D9ACusGggljvGHf+/WxNgR5hpZl4wZ/eSmbWMtiLLWWpgccEEG5xM8A+3aPOOvyzfkj WaiANwjNJCBOFuPYgrAhjz95bA7UdHgEpEsyJ0ie7HVRb2lAahZwxm9tGIaPmc3KYCS1 u34fcAjIfKD6mpYyRq1J5a4VppHohoy1PHPBmqFgQ77ErQ+DG8LgtpEKSYw8DXDrP/SB j2ruRFsM4NkndLv+yRoHrcTrAp3P/vmLAFAofC+0vc+VMyRqATxATXq8psqFNIxFGflg o3Lg== 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=ODWwcp9dc3Rx2L9zFdDyrTu7n5EdIV9thpMDCNrjnQ0=; b=miYH9Ks2zNNGcxGrhwCXk72Jg3rIF+M9u7vrGFQLJ7qWSZwoEE8ZGIuSLhvo5JNOoM cF8D6wc7YWywVqgBluWqfZWQDgANaHcUZHgLOJq/D1N0PL3bj3ekNn3yh0jZl+mMjBRo Jwiq4EbysUxtV4koAtIkLULWtsLMg+PR4E2win6yrhZk0+kusAPB/iv7/9aqUmnARbzI 5lFJYL/az6Ehg582/8Emn5zvVfPg+wE5HuHUXduo0PiPHQn3r+MGdPI97a+PH4o23Z5a C/Yl/rmNoFdQDCc9XKqTgLuIT0GradgCNzTxa4EbZHe9zI/xeeR3JyEKJpTVbWSnosbH Yf/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a+DtypX7; 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 y12si13031583ilv.168.2021.09.24.16.51.35; Fri, 24 Sep 2021 16:51:55 -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=@linaro.org header.s=google header.b=a+DtypX7; 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 S239410AbhIXXtu (ORCPT + 99 others); Fri, 24 Sep 2021 19:49:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232572AbhIXXts (ORCPT ); Fri, 24 Sep 2021 19:49:48 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48ADDC0614ED for ; Fri, 24 Sep 2021 16:48:13 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id i4so46941707lfv.4 for ; Fri, 24 Sep 2021 16:48:13 -0700 (PDT) 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=ODWwcp9dc3Rx2L9zFdDyrTu7n5EdIV9thpMDCNrjnQ0=; b=a+DtypX7LrkejFRzAg1CkVLzp15SCgQJNOqziPoP8tVq2CTqkk7bCVXvLcPo89YS3E 4FZMyA1FWlLMmSAzGSt580gj3EAr77Bxq4i8TpeoD7CMdXoVuDUMO/ZO7ua24pN1vEJa zohVlCQ+LEOctOZk6LVJw5BQzc5g587LDy+FHNAo3SQ65qpoROpLrqnTiQILUzeEuC1f 8uwnODPDTVn53+78LeNNuHLDA+LXTuQtn99NlZoJjWMRZbocGTlXcqm51LC+9RTB8+xn kbHmsLTmGA64EHLkZuJF54m8lO3T6BMj28TsIt8HQa2TgOsHFZB9UyW5Q1SF+cbz+m2C 2adw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ODWwcp9dc3Rx2L9zFdDyrTu7n5EdIV9thpMDCNrjnQ0=; b=5wB+qu5zzcQez2pDHQyh9Xk2bTjX/Alhp2Yx1wcnrqDSDlFlN9Ca4r7ZaEWINWRdhA YtEAZOXP45lHOyKk+1bJoT3w6faxivAsldcitmbjbYfRw8cP7bryVikU2u5v8JxMERG9 1gwAwcYxMS1rZwzJBwQJeh1GetqXg64JJzxQ/4rHG1YC1shHcKZo6vJrasyiVgpZYAf0 +ZqaBPVu6cmMqfBELtsXchjeqVQCDs2W10YewMq0omv3GDmyadvPOQp4mih86jDmZyTy h3rMQHd37RFqoNvyscXacC+7FSMbbvWd/hYVRiEMRD4DgVE8JIAOGaW77HlitAfnhVsK hwUA== X-Gm-Message-State: AOAM5325zWiI4Jcb+Ti0SpYP1QN0+FE2aj68lR3V4wFNx8khqns80qDQ BPJiwm8nhBc5SmRl49Rancl70fSGPuu7RhtaKSh29w== X-Received: by 2002:ac2:4651:: with SMTP id s17mr11792264lfo.584.1632527291369; Fri, 24 Sep 2021 16:48:11 -0700 (PDT) MIME-Version: 1.0 References: <20210923202216.16091-1-asmaa@nvidia.com> <20210923202216.16091-2-asmaa@nvidia.com> In-Reply-To: From: Linus Walleij Date: Sat, 25 Sep 2021 01:48:00 +0200 Message-ID: Subject: Re: [PATCH v3 1/2] gpio: mlxbf2: Introduce IRQ support To: Andrew Lunn Cc: Asmaa Mnebhi , Andy Shevchenko , "open list:GPIO SUBSYSTEM" , netdev , linux-kernel , ACPI Devel Maling List , Jakub Kicinski , Bartosz Golaszewski , "David S. Miller" , "Rafael J. Wysocki" , David Thompson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 24, 2021 at 1:46 PM Andrew Lunn wrote: > > +static int > > +mlxbf2_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) > > +{ > > + struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); > > + struct mlxbf2_gpio_context *gs = gpiochip_get_data(gc); > > + int offset = irqd_to_hwirq(irqd); > > + unsigned long flags; > > + bool fall = false; > > + bool rise = false; > > + u32 val; > > + > > + switch (type & IRQ_TYPE_SENSE_MASK) { > > + case IRQ_TYPE_EDGE_BOTH: > > + case IRQ_TYPE_LEVEL_MASK: > > + fall = true; > > + rise = true; > > + break; > > + case IRQ_TYPE_EDGE_RISING: > > + case IRQ_TYPE_LEVEL_HIGH: > > + rise = true; > > + break; > > + case IRQ_TYPE_EDGE_FALLING: > > + case IRQ_TYPE_LEVEL_LOW: > > + fall = true; > > + break; > > + default: > > + return -EINVAL; > > + } > > I'm still not convinced this is correct. Rising edge is different to > high. Rising edge only ever interrupts once, level keeps interrupting > until the source is cleared. You cannot store the four different > options in two bits. > > Linus, have you seen anything like this before? No, and I agree it looks weird. There must be some explanation, what does the datasheet say? Yours, Linus Walleij