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 870EB2E06ED for ; Wed, 19 Aug 2026 07:47:49 +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=1787125670; cv=none; b=OojNhpkKaTiTqh/2uIxtK2SW4jqH7es6xiq27XZbDdc9du0w9NUbwQDvqxwbuFxa6RNnDnNQdw5LY1wN+BCylmy32mocBMnYfZUmOLYXJ11NIjCtnENUMV2X+nVqim0j6a5NSJCnk3HX4vnRNB5b52zQrO2Q6cyphZTUN7eaWew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787125670; c=relaxed/simple; bh=5x44vgi52IYg0az/frUdCN2yddqlJSVvfOzUorHEBRM=; h=Subject:To:From:Date:Message-ID:MIME-Version:Content-Type; b=OVuhSrHzr0w+1rKDU5viPub7dgpyRykLkdgnDHVfQIj8Hu6bRY3tG9biBV2z4rmihRDh+aODOyPhAzknz3goipu+cekA6BpP7ypPaoZ5Jyj1COkDbIp0jepx/toxSLzkdirBzOjreJ9pXpFusRRF/oTYqdXstmc1wPK7Gnpj5cI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mF7Jaxt6; 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="mF7Jaxt6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CCD31F000E9; Wed, 19 Aug 2026 07:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787125669; bh=emIF/Cbtag2EtjVKh6veEkllQmpXKQQQaXY1xKeWkKk=; h=Subject:To:From:Date; b=mF7Jaxt6f4Bw9Iq5qkOaoVIID9bBiV9u8gbL9hl5ykbISl+rZCJA/+b4BHPgLtcm4 lTyr8qW/W/xoNm3GwkiiW459Jv+LIzFx4TvbVPmzhMGVYdIxWfmq+NKJ2MgHGOJ3dV 3WH1jYLX4gwI6UtCjpP+pCI/jNO2aGhSPpXdPPeE= Subject: patch "iio: light: opt4001: Fix power down clearing bits of the wrong" added to char-misc-next To: nikhilgtr@gmail.com,Stable@vger.kernel.org,andriy.shevchenko@intel.com,jic23@kernel.org,jonathan.cameron@oss.qualcomm.com From: Date: Wed, 19 Aug 2026 09:44:38 +0200 Message-ID: <2026081938-agony-overshoot-b00d@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: light: opt4001: Fix power down clearing bits of the wrong 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-next 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 also be merged in the next major kernel release during the merge window. If you have any questions about this process, please let me know. From 3b2cd82c524c75a2173f2e3f874652a75f81cd1d Mon Sep 17 00:00:00 2001 From: Nikhil Gautam Date: Tue, 14 Jul 2026 17:01:31 +0530 Subject: iio: light: opt4001: Fix power down clearing bits of the wrong register opt4001_power_down() intends to clear the operating mode bits in the CTRL register but reads OPT4001_DEVICE_ID instead of OPT4001_CTRL, so the value written back to CTRL contains device ID bits rather than the current configuration. Fix and simplify this by using regmap_clear_bits() on the CTRL register directly in the devm action, and drop opt4001_power_down() which has no other users. Suggested-by: Jonathan Cameron Fixes: 9a9608418292 ("iio: light: Add support for TI OPT4001 light sensor") Signed-off-by: Nikhil Gautam Reviewed-by: Andy Shevchenko Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/light/opt4001.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/iio/light/opt4001.c b/drivers/iio/light/opt4001.c index dd152d921b48..288e699734af 100644 --- a/drivers/iio/light/opt4001.c +++ b/drivers/iio/light/opt4001.c @@ -222,33 +222,14 @@ static int opt4001_set_conf(struct opt4001_chip *chip) return ret; } -static int opt4001_power_down(struct opt4001_chip *chip) -{ - struct device *dev = &chip->client->dev; - int ret; - unsigned int reg; - - ret = regmap_read(chip->regmap, OPT4001_DEVICE_ID, ®); - if (ret) { - dev_err(dev, "Failed to read configuration\n"); - return ret; - } - - /* MODE_OFF is 0x0 so just set bits to 0 */ - reg &= ~OPT4001_CTRL_OPER_MODE_MASK; - - ret = regmap_write(chip->regmap, OPT4001_CTRL, reg); - if (ret) - dev_err(dev, "Failed to set configuration to power down\n"); - - return ret; -} - static void opt4001_chip_off_action(void *data) { struct opt4001_chip *chip = data; + int ret; - opt4001_power_down(chip); + ret = regmap_clear_bits(chip->regmap, OPT4001_CTRL, OPT4001_CTRL_OPER_MODE_MASK); + if (ret) + dev_err(&chip->client->dev, "Failed to power down\n"); } static const struct iio_chan_spec opt4001_channels[] = { -- 2.55.0