From patchwork Thu Jun 9 08:32:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 12875002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF29DC43334 for ; Thu, 9 Jun 2022 08:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SufeY8MorLx0eqRbMOY5EDS7NxWqQlDRKmLMLUkxius=; b=S1x7bxbgaK+JzD VpbAC0efSobVl0JJprOoF967KtWSD8LzSvIczt+LXWgfTfmIDwXUASaI9KUoRsL9Fx91tB+01FAui DjzA1AYyVRXtyoCxWJPgH4yETr4Pz2jlzJaWsJvQyj4rt6l2X95D1bLqwsj843l0SNQtQbMgs4f7F dvWDIgx2jRWUrT8ScObjRUGWMKRSXVEZYGHzRZZPQKt38sUiFJMK1i9Dk4K/rvTEz1W2XI+Lb5O9g w8I5cE1fI9cXUtbrFhS94kj9yytrEm+DK4urwUM7pJHNUkcKIdvpAXoVq78LYL95Y08ZOxYhPs/Fw xBAKk9/B3ULhc07PDI3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzDZp-000Fz3-1N; Thu, 09 Jun 2022 08:31:37 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzDYQ-000FMU-7c for linux-arm-kernel@lists.infradead.org; Thu, 09 Jun 2022 08:30:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1654763410; x=1686299410; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=II/xZso6dN8sdPch+aiFaxqQHPNylrepcZwdGMZFBWE=; b=aDOBr99fKrjDJ+z1jvJ/YwP0jwnum+GWENOilYULmi/rKBTI7OBXD/en 1MMnTXb492y+otxU1goP0rOrepOeUxXxfPwik7YFKOKBGVerxpUXhFu0w kkU4g0aiJLQ9ZkpvQ+kWu16geIvSJoxQJ2Njh+bsqu0w8soloTRxAMEl2 FptKuynxde5BZiodpdumILb6oG6X5fWPsJ93oTj7ALZs7ObM+GLrbPmdZ 6l0dfEooLYLhYkt15VFDiJWNsWsOD4G1UOCtKb9QCqmYE4IbVfKDt8mW/ y9YGeRzoszU/4l4vwrgim95ImlzHzn77VCxuF1QWYXNj9bcItI8Jvbk5C g==; X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="99259897" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jun 2022 01:30:08 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Thu, 9 Jun 2022 01:30:03 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Thu, 9 Jun 2022 01:29:59 -0700 From: Claudiu Beznea To: , , , , , , , CC: , , , , Claudiu Beznea Subject: [PATCH 03/16] iio: adc: at91-sama5d2_adc: exit from write_raw() when buffers are enabled Date: Thu, 9 Jun 2022 11:32:00 +0300 Message-ID: <20220609083213.1795019-4-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220609083213.1795019-1-claudiu.beznea@microchip.com> References: <20220609083213.1795019-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220609_013010_419900_7FE9095A X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When buffers are enabled conversion may start asynchronously thus allowing changes on actual hardware could lead to bad behavior. Thus do not allow changing oversampling ratio and sample frequency when buffers are enabled. Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support") Signed-off-by: Claudiu Beznea --- drivers/iio/adc/at91-sama5d2_adc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index a672a520cdc0..b76328da0cb2 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1644,6 +1644,9 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev, { struct at91_adc_state *st = iio_priv(indio_dev); + if (iio_buffer_enabled(indio_dev)) + return -EBUSY; + switch (mask) { case IIO_CHAN_INFO_OVERSAMPLING_RATIO: if ((val != AT91_OSR_1SAMPLES) && (val != AT91_OSR_4SAMPLES) &&