From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 6E24A3E8C64 for ; Wed, 6 May 2026 09:43:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778060597; cv=none; b=qppVr5MtrD3BcHmoITN7ytKioWGctXN+iIw2Lu+/ihOL+wYvW+hSNEECTajVEjCIw/BwS+eLwAOonruFP0RGdyVpxSP8SRjm9E6hDpMEy8fsLNVYNLMqsxD2dTa+3TVryc9itjyuw4Hz4bjY+cOZhc6dxV8Wn2OzCCqRwtmXmy0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778060597; c=relaxed/simple; bh=Nv1xwcnvyqjs7pqTcxQ4zpMubfy5AOP7O2MfpHqK5jw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=L5GfLXcjNs5WYXrNTyD+mXucT3GQcTr3hSmwOduko0Om8PIGFNaM4pRm2wDAfX2wmm7h+431P7IG75p56/UEGK4WwxWCc1L9YYQv/jv60wHq7+OlS5PMkfTlw8o9e8gcHLycBqdSg3ov1V0pDksI2XzwLxgE+c9JKOnd6hna/VU= 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=oXh1VEKP; arc=none smtp.client-ip=209.85.221.47 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="oXh1VEKP" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-44ccbd3290aso3041752f8f.2 for ; Wed, 06 May 2026 02:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778060594; x=1778665394; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=GAOl0kR6W7sAznR0JiC5Bm1rQ3NPZN/T/tRfS2z1WJo=; b=oXh1VEKPEMf/S0c+WlHTYYQOw5wHAl4UoSDwFt+k7JPAFm53G2lC8pkRf+CFI7Svph nZ4kR9OrkOeJNQ1eYt1NuT71tRhSLR5l18WMYzBN3PzmTBkoOP12jhZazlQDN1untb/q yd5yavzWRrkmQgBeIGVP1e5pNFfV5igp2wEojbzokDM42GKf4e+JMfWYMv7+5VaLMwqO 6v/GL+ELEzyKNLL2XIBsaML1fW/OQOs0B+9DXEaLqfvfnQumngJVYVUTFkg22vjQLz/p /QgEG3HoCnFI56QvlYmNUiA7pdHjyAPLLBbVw0bhHz3OK16+XUFwUavhQOGUNccc4/FE CHMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778060594; x=1778665394; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GAOl0kR6W7sAznR0JiC5Bm1rQ3NPZN/T/tRfS2z1WJo=; b=DetV4l1x8UYGhm80+W4JudzdKdO9T23R+RRWHue8WuPuimWJzWTh7YzbuKclgPgrj3 bB/aiQ1CLwBL9DWKU3jK7cVPR9zACCbKF5rMSgrQx2LS6DVUVH6nqWPwPWUk1BRLMwga ujMz46u++Z07MTZtxXSXf9ySwyNxyOCqWrEQYpHD3OQvcgiRsrPnN6G/9Jb7HvNjxTzJ iHtIztW+/zLRvZecuEofnkp5Z31t3dUGfB87f7ttrevgX/5m0Abv33KDBQh8PmfGRn+e Un+r3HsLXD4+1GLJryQbaHKnDZigUTYKsAz4EhGD57TMN+VzQY+oLRxoXD6OgK79xo7b gRag== X-Forwarded-Encrypted: i=1; AFNElJ8zKqa08zY/pY9o88HrRtOwYLNlBZho0Q+WiSTgzCoEUtNJ4HEajpHG+KXQEPgGOpl6jC6tl9/JhX3MT+A=@vger.kernel.org X-Gm-Message-State: AOJu0YzlJGF7xk3SgH7X9VFW8Jsm0v1+Kf5yUQQ2wENTHOLBtcj4SQwH 6PntFxF+JGqSW5iUEgADgFxHTJK1VLV3nYBW31+4p+/rGDDLAk+UWU9v X-Gm-Gg: AeBDietgAi0n8n6cbhaVZaXdiMiLgHF0YOHekxlD4311HSgN8Mfp9bz5jNZCcEHyu9d PkY7hO9XbAp02mOcMdKYtgAoas3CeXPZaCznl2jtnLAr/Xe+/5HFtY93ywI+czHHLahWIssg7Vd K4ce2QpOuHYwSO2RUpLXc7+Ia8FmaAcxnSCx7OBi+GkyLXUhLDz4h/4Kp1HfSHHU7YPxeFI67hg h031JZvBWh1ukem8+pw9IGJ6tQgjt9x1lwc7Twxi9R4AxGCSsivw4CcHpcI4+AHoYxLTJuUjQwp rx3mVCiwZWY6BLcV5sjnlHG0vv9fr+CLfpsSsMmliRE/6E/USaamjvlzF04/M/UBwwOYVjmC8WV P0WWAoEpZ7O5CE4zrWbYGC2/0/baX13P47dM4DFwNrvnUEWxwDPPZTq1mW9miQ4PXifTh2CIXmm kmJOShbSxJmBAJTuO8ZTNAtsTWMctM/s0PFqR6BJwpAFke6xOgeKUc6om+JWbOFEA= X-Received: by 2002:a05:6000:2211:b0:43d:76d8:5794 with SMTP id ffacd0b85a97d-4515da95cbdmr4328563f8f.36.1778060593646; Wed, 06 May 2026 02:43:13 -0700 (PDT) Received: from aldo-conte-t14.tailf68ad9.ts.net ([217.61.173.50]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-450524831cdsm12362230f8f.5.2026.05.06.02.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2026 02:43:13 -0700 (PDT) From: Aldo Conte To: jic23@kernel.org Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, shuah@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linux.dev Subject: [PATCH 0/3] iio: light: tcs3472: devm conversion, wait time, locking cleanup Date: Wed, 6 May 2026 11:43:08 +0200 Message-ID: <20260506094311.222500-1-aldocontelk@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series of changes modernizes the tcs3472 driver by completing the devm conversion and updating the locking style to use an automatic guard (mutex). Furthermore, it implement control of the WAIT state, resolving a TODO. Patch1: Converts the driver to use device-managed resource allocation. This removes the need for an explicit remove() callback, since cleanup is now handled automatically. It also adds a new function called tcs3472_powerdown_action() that powers down the chip when the driver is unloaded, removed or when probe fails after the chip has been enabled. Patch2: adds support for the wait time resolving the old TODO comment. The user can control the WTIME indirectly by writing to the sampling_frequency attribute. Changing the sampling frequency attribute results in a change to the wtime while preserving the current integration time. Similarly, if the user has previously set a sampling frequency and then changes the integration time, the driver re-computes WTIME so the previous frequency is preserved. The patch also handles the deactivation of wtime when the requested frequency is very high, as well as the extension of wtime to its maximum values (by enabling the use of WLONG) when the requested frequency is very low. Patch3: converts the remaining mutex_lock()/mutex_unlock() pairs to guard(mutex). All patches have been tested on a Raspberry Pi 3B with a TCS3472 connected to I2C-1 at address 0x29. Sampling frequency and integration time changes have been exercised checking the value of WTIME and consequently WEN and WLONG. Raw RGBC reads, calibscale, integration_time and threshold events continue to work as before. Aldo Conte (3): iio: light: tcs3472: use devm for resource management iio: light: tcs3472: implement wait time and sampling frequency iio: light: tcs3472: Use guard(mutex)() family over manual locking drivers/iio/light/tcs3472.c | 287 ++++++++++++++++++++++++++---------- 1 file changed, 206 insertions(+), 81 deletions(-) -- 2.54.0