Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 658C63C07A for ; Sun, 29 Mar 2026 12:55:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774788950; cv=none; b=asGEfKt/48pPSRIaGL0PXZNN/nQSX11GdGql+ImWRdVIn09cl6t8ri8jsfMBGPBLZlRs4L2v6th5OhkYXYcKm30Quvl4mRMG5SLywjJSdOuwRr+cdNIxaTvUR2NfqOUgMrZ1LNyqRFrVqeLYPb6P2UItAIHtgSaPYmi0TZu2LiA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774788950; c=relaxed/simple; bh=sKoHufaDhk7gJgh1/CK3Y3EEtOmQNbpIiSQ4UnHBjT4=; h=Subject:To:From:Date:Message-ID:MIME-Version:Content-Type; b=I2u2oVLF8ywOPT1BDo1DHxy3uGbtB4ckUsRSZL70u4NUJaDjJ+WY4leHQtVBtxP6Mesdzwp/dfdTMKeB24ARcrDC/kN8J7BQ0dmOl/mxd17b/4+ktEyuxS2NJytJ1BaD+t9naG1lpbHUlUr5NXgMlD5EQSBH+ed+LCLjhLEz3f8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JUQd2WUp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="JUQd2WUp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BABD6C116C6; Sun, 29 Mar 2026 12:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774788950; bh=sKoHufaDhk7gJgh1/CK3Y3EEtOmQNbpIiSQ4UnHBjT4=; h=Subject:To:From:Date:From; b=JUQd2WUpiNFm7KaCKBHoeEW8hJBk/FLXhX3q90DlO7vc0+Q2D4ECGywYHWxdNqnnI JRF1mwc13JMwpiuRRKAJzMbdlBHhGB+Ejx0HVejwGyksDvBIY/KD3CXN2XfVKuTtb/ SRnAmmIGZE1G/3JG8MY9yT9MUwveEeziVwCnIW8w= Subject: patch "iio: adc: ad7768-1: fix one-shot mode data acquisition" added to char-misc-testing To: Jonathan.Santos@analog.com,Jonathan.Cameron@huawei.com,Stable@vger.kernel.org,dlechner@baylibre.com From: Date: Sun, 29 Mar 2026 14:41:51 +0200 Message-ID: <2026032951-vividness-cytoplasm-294c@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit This is a note to let you know that I've just added the patch titled iio: adc: ad7768-1: fix one-shot mode data acquisition to my char-misc git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git in the char-misc-testing branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will be merged to the char-misc-next branch sometime soon, after it passes testing, and the merge window is open. If you have any questions about this process, please let me know. From 8be19e233744961db6069da9c9ab63eb085a0447 Mon Sep 17 00:00:00 2001 From: Jonathan Santos Date: Mon, 23 Feb 2026 08:59:26 -0300 Subject: iio: adc: ad7768-1: fix one-shot mode data acquisition According to the datasheet, one-shot mode requires a SYNC_IN pulse to trigger a new sample conversion. In the current implementation, No sync pulse was sent after switching to one-shot mode and reinit_completion() was called before mode switching, creating a race condition where spurious interrupts during mode change could trigger completion prematurely. Fix by sending a sync pulse after configuring one-shot mode and reinit_completion() to ensure it only waits for the actual conversion completion. Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support") Signed-off-by: Jonathan Santos Reviewed-by: David Lechner Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ad7768-1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c index fcd8aea7152e..4cb63ab4768a 100644 --- a/drivers/iio/adc/ad7768-1.c +++ b/drivers/iio/adc/ad7768-1.c @@ -463,12 +463,17 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) struct ad7768_state *st = iio_priv(indio_dev); int readval, ret; - reinit_completion(&st->completion); - ret = ad7768_set_mode(st, AD7768_ONE_SHOT); if (ret < 0) return ret; + reinit_completion(&st->completion); + + /* One-shot mode requires a SYNC pulse to generate a new sample */ + ret = ad7768_send_sync_pulse(st); + if (ret) + return ret; + ret = wait_for_completion_timeout(&st->completion, msecs_to_jiffies(1000)); if (!ret) -- 2.53.0