From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0CE33A2576 for ; Sat, 4 Jul 2026 11:53:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783166010; cv=none; b=QxrDRItNE1R07yXMtIzmKzKjMMc+pZzGCmoJhilsGinfOW8JlvwlXvY3mUu8TOLeAS5VsAlmG+fr7x7UIn5rRUUwKttalTMcnSVKX42Yd52vYCamhFKs/h0rmnkLCN6G4u9Sm7vQCIOtr3eRTvYcIQFAp6juNN8NsXhAywOapow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783166010; c=relaxed/simple; bh=ai4jZCdbrJPe7EUiAYRqiOCk3jA6QZQXOwe8vdOoInE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hvz2qKIwjz+AMQiggIe2du5vY5xA/bnLPjLw8xrPnhXTUSV2dI7kDGCmCBFvg3TP3+U4Z6WzQCAhBRE6Uns+FxtCWgR8fxMv/UClhKwwBCIGe3/1eZ6PRn2O4F93FTfno7ueB5CtdtHBFmak82YJT7V++qsWy1NI8dcU7Lx/NOI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LelzI2l7; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LelzI2l7" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-c85b73ffb52so680705a12.3 for ; Sat, 04 Jul 2026 04:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783166008; x=1783770808; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UsxMTdTxaGyKiRcEKAGvLn+sq4FSJrsqhtc2CDzMcoo=; b=LelzI2l7mZDui9oETlWsSJ9zfQHg6c3S3FIhmIWg71HO58PJK1g7cyL6Xs32/SC/Vy yI1EBqWn41YTDrCXmPLZr33Xhwmg29x2pqG9BMSuIJsXOT8sO8M8hTsTBFEdPO8ZzRoS AGUw9yZ9t70ne0k8BCLC9nFdoggkt3qa3gXucAi0SIEZ9h5g+/Y/siFBDOPfs81OE5Nt 6it2EC9lgpg8z3rlynYDhULEwIfYvqFf/1PuiG/OOBm6lBqzXLa5P/XEERTy5B8UPqc5 B/nppy4rUXLCRyvCA6JyVGOaSsUu1OhRYPIbjYc9L1GnE/UlpSgm7DU/4bYcfpqyWasd 7jmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783166008; x=1783770808; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UsxMTdTxaGyKiRcEKAGvLn+sq4FSJrsqhtc2CDzMcoo=; b=tL1gsrnoS29z/teoLu7MCfoPWHA+Biwr1ZIzhugwXzJn+XV2XHB7R61ZyPRTZKJxa4 kd2DNlWLdKfci3a8mpGgbEvXJroxvG3wu06tFuTomxrPNMXEM99+9EDyO5Ua2EasYN19 zl9nYJtAck1oEpbSrSsi1IdCgYfeNByLh2+mvGtqBVrlwmVNpkeBC/PjQOalsCrEEkKq sLp5fpNULMUUDjHohN0RSJOkyBlUk0Ykz+ICTN1WavxEmkQwbLp6NGwrcJwTDiguATmQ J2QBmnfK+VxmL1AeSk8eLxzz3Clt30m7dmtinGCMl6EGnf4i+6FNReRQsy+ly/LMjr7D oBJw== X-Forwarded-Encrypted: i=1; AFNElJ9r48Rca8Bpx/FHphW4WOG3YqFXNz++kNH2pB4IPJaS2EaIw/iCiqRT7Mbmp/L7O4c5nA3JMnicV+nb/zI=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4vn2bLWoNxv0NGzYHczN8C9yLuhI6NwozYN3J84P64KZ58Cst SUrRf/Xb++rxryd8Mtl1BYt4bSHXZegO+sHFmPT72IwoxXzjwR1GU8MZ X-Gm-Gg: AfdE7cmvrhXDjSSJnITvINJokLZzQOWcbw8PNWc9ivkyHb/qc2GpgAJnhTbb0HlM+Dd dNcjkspsMvQaIJMKecIiog07QKdycsklsZ3XzQk3Vxdwl8Vynbz+YNxK7dwUOLFv+qeaDYchWAK SMy6fsa6WO70UvFEjsHTlNLI8mQyxzkUInPGvDuPL+IScY1rUudRhcAikHdwL/ySgt4ZHhIx3o+ ShyydulYoTNpwXdctjJp8Debz+ZbZwn7YbXPd66GNFTz2jr14HTNJmhLpBTqpbH5KiUq02y65iG 0jpc+KrB4WkfEWk6PLU02DIiR6wZWT7ghvdP5kZecGCOxOP68iUEogYRSkQXU9A8QXBOdJphggK VitU9X0lQyoMls4Sy53hl8A0IwiPpx7V0LvYwSy4FdE1plCC4qu7kxVTRbA9h/WkDmdzDJwJKPb kL4/unHmhh5i9opO1h7nu2wmILHVRv62zB07tQUnBQYQ== X-Received: by 2002:a05:6a21:6e48:b0:3bf:6c04:a816 with SMTP id adf61e73a8af0-3c03e4da45cmr3219460637.55.1783166007775; Sat, 04 Jul 2026 04:53:27 -0700 (PDT) Received: from primary ([223.181.23.202]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13b3c85bde6sm49580285c88.9.2026.07.04.04.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2026 04:53:27 -0700 (PDT) From: Vidhu Sarwal To: jic23@kernel.org Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev, Vidhu Sarwal Subject: [PATCH v2] iio: light: al3010: fix incorrect scale for the highest gain range Date: Sat, 4 Jul 2026 17:22:45 +0530 Message-ID: <20260704115245.11167-1-vidhu.linux@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260702052913.114130-1-vidhu.linux@gmail.com> References: <20260702052913.114130-1-vidhu.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit al3010_scales[] encodes the highest gain range as {0, 1187200}. For IIO_VAL_INT_PLUS_MICRO, the fractional part must be less than 1000000, so the scale 1.1872 should instead be represented as { 1, 187200 }. Since write_raw() compares the value from userspace against this table, writing the advertised 1.1872 scale never matches the malformed entry and returns -EINVAL. As a result, the highest gain range cannot be selected. Reading the scale in that state also reports the malformed value. Fixes: c36b5195ab70 ("iio: light: add Dyna-Image AL3010 driver") Signed-off-by: Vidhu Sarwal --- v2: - Remove trailing whitespace in commit message and Add trailing comma after last array element (Andy) - Use IIO preferred brace spacing (Jonathan) drivers/iio/light/al3010.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/al3010.c b/drivers/iio/light/al3010.c index d603b4a6b8e8..ca1d7fd6defb 100644 --- a/drivers/iio/light/al3010.c +++ b/drivers/iio/light/al3010.c @@ -42,7 +42,7 @@ enum al3xxxx_range { }; static const int al3010_scales[][2] = { - {0, 1187200}, {0, 296800}, {0, 74200}, {0, 18600} + { 1, 187200 }, { 0, 296800 }, { 0, 74200 }, { 0, 18600 }, }; static const struct regmap_config al3010_regmap_config = { -- 2.53.0