Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 52B5E22425B for ; Tue, 6 Oct 2026 07:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791272685; cv=none; b=n/ylYt3tOcOUauVfXHH44YcJ+jXsUK1CylzcQm4jsZWfDKs/DGBFVxWP9B0g20v/kM94mI6wTSIRFINTa0cu2FseTi0/r8lKKradCszmOsW3budGG/g7Unz37spnC9cPA5/GIgNDimQj5G5+qwyeyezv8L5xPMh8t3c1QY2gvAw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791272685; c=relaxed/simple; bh=indiz4ZfZqyKSsLH6dDYR1Dp74gXWRkl21jqMCBLOco=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=OC1wmQdPHqYPDIOxWLXMtfFl7mh+kXkEdxfiZOHMqrIpIFVnmq06OWym63NfnYAqordX8w1OKgjVzcNCOX3P4zlnhjsdV6Uv9N27DF6OOvNNcwj6tmwji4+Y5Unjl5Orv6p4MkSpijD1v/Q63Ap0prA+nItub2eZaVKzTeYbFVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OUuxU2EK; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OUuxU2EK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D4D91F000FF; Tue, 6 Oct 2026 07:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791272684; bh=NHRZ0jew/ssR67aKOgH1B8UmBdJx6ZK9D3PZCx9Me+0=; h=Subject:To:Cc:From:Date; b=OUuxU2EKv5MVakD98PgKiIoGswCpIv2EgQZ77muQv6Y1AIEcBr4N+0KQrt6DawnTD qWfKMJAe3Uuk5XcMYqyULOn6Kof35Ep02Su/HN7//yGwamRRHpOeU8f63CggEvS78N GLP00CsEBabpX4VJE68RF6c0P1vksgfv7gys8qAE= Subject: FAILED: patch "[PATCH] iio: adc: max1363: sign-extend bipolar differential channel" failed to apply to 6.6-stable tree To: congnt264@gmail.com,andriy.shevchenko@intel.com,jonathan.cameron@oss.qualcomm.com Cc: From: Date: Tue, 06 Oct 2026 09:44:24 +0200 Message-ID: <2026100624-payback-oval-084c@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 The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 91908c0a78baddc8572aa3ab69e62ee2eb496ba4 # git commit -s git send-email --to '' --in-reply-to '2026100624-payback-oval-084c@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 91908c0a78baddc8572aa3ab69e62ee2eb496ba4 Mon Sep 17 00:00:00 2001 From: Cong Nguyen Date: Mon, 10 Aug 2026 23:44:46 +0700 Subject: [PATCH] iio: adc: max1363: sign-extend bipolar differential channel reads MAX1363 differential channels are bipolar, but max1363_read_single_chan() masks the raw value to the ADC resolution without sign-extending it. Negative differential readings are therefore reported to userspace as large positive values (e.g. -1 as 4095 on a 12-bit part). Sign-extend the masked value from the resolution bit for differential channels. Single-ended channels are unipolar and are left unchanged. Fixes: d1325cf45077 ("Staging: IIO: max1363 ADC driver") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4 Signed-off-by: Cong Nguyen Reviewed-by: Andy Shevchenko Signed-off-by: Jonathan Cameron diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c index 65a2d92bb112..629c53af6472 100644 --- a/drivers/iio/adc/max1363.c +++ b/drivers/iio/adc/max1363.c @@ -404,6 +404,14 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev, data = rxbuf[0]; } + + /* + * Differential channels are bipolar and the device returns the sample + * in two's complement, so sign-extend it from the resolution bit. + */ + if (chan->differential) + data = sign_extend32(data, st->chip_info->bits - 1); + *val = data; return 0;