Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2266456imm; Mon, 24 Sep 2018 00:57:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ5c06mbezJiyBHRm8L8mHHoGZrVzwSfslBvZsTlPZafIOxlgtRhoYzOIiHm1eHtElDcR6w X-Received: by 2002:a62:174a:: with SMTP id 71-v6mr9294597pfx.217.1537775873288; Mon, 24 Sep 2018 00:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537775873; cv=none; d=google.com; s=arc-20160816; b=UL27pPxjY77shnxDq2H7WYe2XmTY6MWwpgFOn1pXuNyOVbURKFyFyDHZv7iYz9aPdG vaIE788PyBsiBs7bxfJqaMzTPugrySA50tQF30+X2M47ju5sIU8jWOzo9vtP7vBCYSxT Ry7xqo7rSJbObTXz/C2roh52QRYee7aTl4Vwlvx7Jybx+kZXbzi0cV2w02IgchK1bvUU 5HrrRntUkJ/ugLYqa6WdKCd8s3EkLWaRCFTAm7uzll05f9XV6RdGjiVIdKLq1pxHUxYI zgESPC8PyiFg3KlXEK+VoUM3kpyMtbOp3pr1nuF4adBf3EJVHldqDxWxn0GRlO4O5NVJ SFeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=+XY589QJynH1tOShm7XJXALXZ+l5Aoee+XEXx6f4Xp4=; b=iUPk1ubEDARJQ0o4myDYDApohV5kmF7I0imuRvc7Fq0Rr3L7kZFKIXmaIwkbLbrXxx gECHSaf58H6p93u8uxI5kVmRjLQYjL5kspuesm5Zy5rgSCZouOT2ezP5k72mAUliCI/v N0pWq5VsoSNnLIz37h9B41dS15S3qYIMg+wkng19VEMWY8Es+iy21Mz0bgLdvoeG5K1s v5A01efWpve9uDJvHEx1YdpIQQirSF8DDsdF0MQ2TwjXlnGcY8scn21s5CSIyaCC9mmg C9SFQxg9KhmEhqRw6ui6COKBRt7z+LZqD3zpd/vWYnlFAJt3lzHsO5Rv7xru8/sCvooo YRcg== 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 k9-v6si1661926pgi.227.2018.09.24.00.57.38; Mon, 24 Sep 2018 00:57:53 -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; 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 S1727498AbeIXN6S (ORCPT + 99 others); Mon, 24 Sep 2018 09:58:18 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:38679 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725935AbeIXN6R (ORCPT ); Mon, 24 Sep 2018 09:58:17 -0400 X-IronPort-AV: E=Sophos;i="5.54,297,1534834800"; d="scan'208";a="18307557" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 Sep 2018 00:57:28 -0700 Received: from eh-station.microchip.com (10.10.76.4) by chn-sv-exch02.mchp-main.com (10.10.76.38) with Microsoft SMTP Server id 14.3.352.0; Mon, 24 Sep 2018 00:57:26 -0700 From: Eugen Hristev To: , , , , CC: , Eugen Hristev , Maxime Ripard Subject: [PATCH v2 1/2] iio: adc: at91: fix acking DRDY irq on simple conversions Date: Mon, 24 Sep 2018 10:51:43 +0300 Message-ID: <1537775504-7981-1-git-send-email-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When doing simple conversions, the driver did not acknowledge the DRDY irq. If this irq status is not acked, it will be left pending, and as soon as a trigger is enabled, the irq handler will be called, it doesn't know why this status has occurred because no channel is pending, and then it will go int a irq loop and board will hang. To avoid this situation, read the LCDR after a raw conversion is done. Fixes 0e589d5fb ("ARM: AT91: IIO: Add AT91 ADC driver.") Cc: Maxime Ripard Signed-off-by: Eugen Hristev --- Hello Jonathan, I moved this LCDR read/acknowledge into the IRQ handler after the conversion value is being read. Sorry about the noise to stable@vger, removed from message. Thanks, Eugen drivers/iio/adc/at91_adc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 44b5168..e3be88e 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -279,6 +279,8 @@ static void handle_adc_eoc_trigger(int irq, struct iio_dev *idev) iio_trigger_poll(idev->trig); } else { st->last_value = at91_adc_readl(st, AT91_ADC_CHAN(st, st->chnb)); + /* Needed to ACK the DRDY interruption */ + at91_adc_readl(st, AT91_ADC_LCDR); st->done = true; wake_up_interruptible(&st->wq_data_avail); } -- 2.7.4