Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp19770143ybl; Sat, 4 Jan 2020 08:45:34 -0800 (PST) X-Google-Smtp-Source: APXvYqy9qxe+f7v5XS0XRkdy2EYhieUgSp6zJoROXB0YoVojjjJS65MIplCzrU2xRdT8VemTywgj X-Received: by 2002:a9d:6441:: with SMTP id m1mr89911955otl.310.1578156334764; Sat, 04 Jan 2020 08:45:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578156334; cv=none; d=google.com; s=arc-20160816; b=Qcs7BdquhWVS4KY2P5BKITvexFtNxiQE/nVDuGzv7/ZZ01hRkOQC67+QSusrBomv5n Y8D5LdJBZsFar55nw1fi9xq4duwxXIAYaK6N++IjoSYQJSQD285T6EwGioDqca4oV5oX A3oEcGwG3Pjd6ThHMiXdDfXCvJ892a+8KW3uigD5OsnruVWBR5DcUMy4HiH0GvpRng79 Qmoh/ZA8sWPi2ghXnb+zqlgpbg+eD30konQnI3gLGCY25D1rvWlEsR7w2IqQSNiNHYut eK0Jls1SJpWdXgx5M6qD+wuvF/mx7VtxLQZQEVxG0NVixVWEZ4DzzwdXq0VdhlO0g19o +dpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:content-transfer-encoding :mime-version:subject:from:message-id:date:dkim-signature; bh=cT4s9X9W9acHg02TzcPKydH/gyHScYzZRpvSpRiXVZM=; b=AyKZL6mLGLiFsa4ADBl1k4Sto0WT2CB9o7XLQyNJVHsfzJbfxn8fiyb3BkJrkPacb5 8aDp2IybDcWLzk1BVIyrpP0+QpYfF56M2piD+i6lg6ZK3elDj9DUptswtwpH8fJL8Tcd UgokAdl7YwbzQfttYty4lonnCHbaQFKn8V60OmPHUXPm4lDWVNI3zkSx6kwGj3yKH9Nf kYjmHauZ1sQ7ICQAsGuUUoP2kntgDLmXchdIVm8q/XAD+EOeLptUTZMI4c4f04VafHII dzkqAqqy653xBLuflHpOV9GdsXMB5PPDM8d+Yh3XxB6AeBnCNtv7F27gfRFr3W9xAVY9 dWfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=Xw3cGGjv; 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 101si31386956otm.168.2020.01.04.08.45.22; Sat, 04 Jan 2020 08:45:34 -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; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=Xw3cGGjv; 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 S1726135AbgADQom (ORCPT + 99 others); Sat, 4 Jan 2020 11:44:42 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:61985 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726016AbgADQom (ORCPT ); Sat, 4 Jan 2020 11:44:42 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 47qngC2Jt5zGW; Sat, 4 Jan 2020 17:44:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1578156279; bh=oTvnASVeLN6WdH2UHyaweC1pw6TM7iWDLweJ8XiHgAc=; h=Date:From:Subject:To:Cc:From; b=Xw3cGGjvfEgmGqZp3vDZNApHr0TbrZigZU6Gly10uo78nzTE8oSDp6+EHSoDzd5nS NQeVgQe4JxUl+7afm9jBNMGZDclIULb0oxZTAzNbRRzqiQFFXvdc7vpxj3NiB6nOqj z8mUb2vZaAAHYMK7bCsMPtdeYoUJBwPJ7+/51/sPCAcPEKJ93FK7Kojvlg5U58W98E 3dyLGoBzpFMf4kWibRNLLHWMvg3htwg+c5GkwhtsTZJD6dxRO4D+Ho3dzEa+kfl8cC TShoNCwI5hK0vQITrP8fXOhwWGBpJzucnKI8mudM0SFmI1hg9eHDqdkmM23xJBEiM8 XDBkKWexha27A== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.101.4 at mail Date: Sat, 04 Jan 2020 17:44:39 +0100 Message-Id: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH] iio: imu/mpu6050: support dual-edge IRQ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make mpu6050 usable on platforms which provide only any-edge interrupts. Signed-off-by: Michał Mirosław --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 3 ++- drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 1 + drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 0686e41bb8a1..36b6a3922d15 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -1239,9 +1239,10 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, } irq_type = irqd_get_trigger_type(desc); + st->irq_ignore_spurious = irq_type == (IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING); if (!irq_type) irq_type = IRQF_TRIGGER_RISING; - if (irq_type == IRQF_TRIGGER_RISING) + if (irq_type == IRQF_TRIGGER_RISING || st->irq_ignore_spurious) st->irq_mask = INV_MPU6050_ACTIVE_HIGH; else if (irq_type == IRQF_TRIGGER_FALLING) st->irq_mask = INV_MPU6050_ACTIVE_LOW; diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h index b096e010d4ee..94ee7b18b198 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h @@ -158,6 +158,7 @@ struct inv_mpu6050_state { struct regmap *map; int irq; u8 irq_mask; + u8 irq_ignore_spurious; unsigned skip_samples; s64 chip_period; s64 it_timestamp; diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c index 10d16ec5104b..52f02de3d9b0 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c @@ -184,8 +184,10 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) goto flush_fifo; } if (!(int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT)) { - dev_warn(regmap_get_device(st->map), - "spurious interrupt with status 0x%x\n", int_status); + if (!st->irq_ignore_spurious) + dev_warn(regmap_get_device(st->map), + "spurious interrupt with status 0x%x\n", + int_status); goto end_session; } -- 2.20.1