From patchwork Thu Sep 20 12:40:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 10607607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37FDB6CB for ; Thu, 20 Sep 2018 12:45:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2696D2D3E5 for ; Thu, 20 Sep 2018 12:45:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19B372D3E9; Thu, 20 Sep 2018 12:45:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C0B142D3E5 for ; Thu, 20 Sep 2018 12:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=14aGYYvmZs3TbWCQsguCmxZv4pYr8sY3sOA7uhojhf4=; b=l+FpQuch/Vyvl8 YmOti0Z+T0XrvaRBZwfbjjke421O7dbTbFLemeD9HDCbqph8k+GqV1McwFod5VTNmqo+CkqnecAKe K/09qSkxoVwt2ipD3lP5BM38aoQd6Wch7CYOX8zf/XLRq3D0cJ/XRgyhNIzYqyQk2CZBKVNsnyiXn Q33cQ2WECxDSlFApr66PcJFJOHsoL75vncFLj5lScxFlPWw/JC4OlV0qmwMlu7YwXhy4HcGt13GRN Ot5nTwlo7ggDg6f3lDta9Yc1dMrDYssujFiZmcBIQpdDCKCS/VO8EknffV/Q/xNR3/i1uo7TVwKzY tvtjxUFj63OCBYgjuCDg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2yKc-0004cF-CR; Thu, 20 Sep 2018 12:45:18 +0000 Received: from esa1.microchip.iphmx.com ([68.232.147.91]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2yKX-0003qV-7Y for linux-arm-kernel@lists.infradead.org; Thu, 20 Sep 2018 12:45:14 +0000 X-IronPort-AV: E=Sophos;i="5.53,398,1531810800"; d="scan'208";a="21047112" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 20 Sep 2018 05:44:59 -0700 Received: from eh-station.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Thu, 20 Sep 2018 05:44:58 -0700 From: Eugen Hristev To: , , , , Subject: [PATCH 1/2] iio: adc: at91: fix acking DRDY irq on simple conversions Date: Thu, 20 Sep 2018 15:40:37 +0300 Message-ID: <1537447238-18674-1-git-send-email-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180920_054513_302526_CFAA14E0 X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxime Ripard , Eugen Hristev , stable@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When doing simple conversions, the driver did not acknowledge the DRDY irq. If this irq 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 irq has occurred because no channel is pending, and then we will have irq loop and board will hang. Fixes 0e589d5fb ("ARM: AT91: IIO: Add AT91 ADC driver.") Cc: Maxime Ripard Cc: Signed-off-by: Eugen Hristev --- drivers/iio/adc/at91_adc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 44b5168..e85f859 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -712,6 +712,11 @@ static int at91_adc_read_raw(struct iio_dev *idev, at91_adc_writel(st, AT91_ADC_CHDR, AT91_ADC_CH(chan->channel)); at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); + /* + * we need to ack the DRDY irq, otherwise it will be + * left pending and irq handler will be confused + */ + at91_adc_readl(st, AT91_ADC_LCDR); st->last_value = 0; st->done = false;