From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 6EA3A281525 for ; Wed, 13 May 2026 04:50:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778647814; cv=none; b=Mvb1h6GvZ10FsHWK9wGeghZP6qoN3CBnW65ZdGWhWl6tmydjTG7p1uhCBcxY3X9EJm1xZ82t/Qu2rPLfxIjU0pMfLNvFiOX93L+ZCQX3jeE3N3dbpFUqVWbtseJ6T3YayrnbmpuzjJ4+UgrwE/oa5cS+oOzzztjuYy9i2ypzQDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778647814; c=relaxed/simple; bh=tgUlyJjbrsKtJEn1UZKio0glqU4Bcdo3vZkqYUogHaA=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=p4fzilBRHA6V99gw3vlPrA/+MBmZnACD//mOTXaHc5j4CO004yHhMCQT/nySoJQqlOfQ/q1ARsLDttxGpWaj0K8m6sVN+Wgq54nto83Uu/IxP0C84cd4obHRZpXZgGu2qWv+fnTEaPS2WXl+slBbNY5AgmrdXJPvXK6VZ3SOPf8= 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=aSDLKxH2; arc=none smtp.client-ip=209.85.210.173 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="aSDLKxH2" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-824c9da9928so2961359b3a.3 for ; Tue, 12 May 2026 21:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778647810; x=1779252610; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=vhcAeUDFPuM5b+QyEqT1qFeyobx3xcRvN5AVcMGYpJE=; b=aSDLKxH2FExGDRQuMa7EOKiwm3gW13IYnqGEOUfr0Mdd5PGGDB3DxLbHAtJ6JVgX2e +WMR99mEjFnf3BiGxL+G7FHR0beS9Sp16CC3VtPC2vI2ogMN1cxCJDxbVeLWUxzs7Dwn FOUmhocpMZ2QLgm5G52L8/9XeoU+WRax7NHdV6rieJZRB9tAMTywoeeidT6psx4clU5i CDOi0GGiqCpWlS8wPs01vej/3vZZVM/7Fk9w1fIMR2eYZiSh/ferTU9lFjcNV3xzw60j s637Q3dTOdwW+QZBpWbfm/Rls1WfkdqwilaRCOoKYeFgl27TL3CKvbsoLJCUJmEA51t0 f/gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778647811; x=1779252611; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vhcAeUDFPuM5b+QyEqT1qFeyobx3xcRvN5AVcMGYpJE=; b=J82LejhYR2U+WdDX8LUwMZv4/VnhcysYmdZ6DVCnf7WRcvQOWfVGHNirWM9DgBRLim BN6bcnj0rRjManUb2qlGn67/T2n6lXtUyfbqH6tofmnsC+qank5OFb2/38+F5op4oslm jC8uU3Tcp7Yxdh7KIJrgOcfB9Hx1GH3puIyYnZZE66gPxVhafQw0AodiQNMw21TfHo/U rqaxVsRKkr8X5VHM34m7PCqQ7kPiQmZVppXXcVC/kkRVagl8CKEQlIjH19AJ7VUJP176 HmGfoVDqN2rqXd189YLyr6rEDbbJQyCNqGsBaLntKQmSo+axmwHUbY7hhYU8uXV1K9WV ljkA== X-Forwarded-Encrypted: i=1; AFNElJ99DWYu4AqSjUadl3c5Ll96u2qOvA1PlZpNV7Xd5/vaziOtD8wuZV9QkRlHbRcLv6ZzGgBBvzH0o9T95Jk=@vger.kernel.org X-Gm-Message-State: AOJu0YwkTZvgpFTCeaWLx7ibkm8vakrd5jyUMSyzqJuZdqvujfiR7tYi AN90UmLEF/nmvW1sc76Hln+qExWskeNtetAEEJE6UBxhy7uBAl+liNiR X-Gm-Gg: Acq92OHLpVJUfiRqavIx/v8KsF+5kbhsFKJHcUxQ2eEQ2Ggxn4BGfb1N14MTxHfQzLT l+nxymHl8o9vkBzIPC2EnTfgQkT2TfmWo4CMTJpDDMApJYwKbutZgUUvxl1pJhQhTKTHkJBR1UH 3NCYSjDiS5nmMF2PfEa47atk1rCRcjiVtoT85EwxUjOo4P8FlgDLIPngAGAGJ5Sd6pmuVj16KgP NhLrDOpGn2828CP2oNnUJtZo1wOYT976vjq6wbKkNSpiKtn0flN006glTm+eiaktIANcgSFHzWD rOWLwQx9hC8EB5suLpn1pruOmwsSj5Vi5cJIWZtQr4arnCNcRTpmDazCeD9kWMM3OiLUkToYBSA pUKwVIVXeBRDTnHAVEbLX+RU9coHAZmrDh4QjsQHX6PHJ3TIvuZVngA/V4bRxZUTNJTbEYWnfzz exjT9Vy6BxUhxVCprMM7YLUB0uF1pQkBJ2BN3O X-Received: by 2002:a05:6a00:4403:b0:837:6bb9:acb7 with SMTP id d2e1a72fcca58-83f03c496aemr1638691b3a.0.1778647810595; Tue, 12 May 2026 21:50:10 -0700 (PDT) Received: from [127.0.1.1] ([203.99.159.230]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83965c30ddasm32311914b3a.21.2026.05.12.21.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2026 21:50:10 -0700 (PDT) From: Javier Carrasco Subject: [PATCH v2 0/4] iio: light: add support for veml6031x00 ALS series Date: Wed, 13 May 2026 17:49:40 +1300 Message-Id: <20260513-veml6031x00-v2-0-4703ca661a1d@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIAOQCBGoC/1XMywqDMBCF4VeRWTdlEkPArvoexcVUJzrgpSQSL JJ3byrddPkfON8BkYNwhFt1QOAkUdalhLlU0I20DKykLw0GjdUaG5V4nhzWekdURI11dU/oLEF 5vAJ72U/t0ZYeJW5reJ940t/15xj35yStUFnynpx5evb9fZhJpmu3ztDmnD8yPoI3pgAAAA== To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rishi Gupta , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Matti Vaittinen Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco , Jonathan Cameron , Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778647803; l=4923; i=javier.carrasco.cruz@gmail.com; s=20260111; h=from:subject:message-id; bh=tgUlyJjbrsKtJEn1UZKio0glqU4Bcdo3vZkqYUogHaA=; b=rIk/cDRH4Eu/wfynMlGZz4CUMg3NrqGBNElLBkDCGsA4QpCWvYAildGD5cbEPDX2DJg/Kuunz 6OMyp2aqnV1CJcvwZpIMi22WRRmxMHcL1kri6j6Ex+7tsAwA1xwW6Dz X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=Lge8w8xidNSf/INy7JAIbAW+Hezkp3nsBh2OjKL7lLU= These ambient light sensors with I2C interface provide two light channels (ALS and IR), high/low threshold alarms with configurable persistence, and a data ready signal. The devices covered by this driver have the same resolution, and they share most of their functionality. These are the differences between them (note that the x belongs to their names, and it is not a wildcard): - Device ID: accessible via two 8-byte registers, different values for veml6031x00/veml6031x01 and veml60311x00/veml60311x01. - I2C address: same grouping, 0x29 and 0x10 I2C addresses. - AEC qualification: AEC-Q100 for veml6031x00/veml60311x00 and AEC-Q101 for veml6031x01/veml60311x01. The alarms and the data ready signals share the interrupt pin, and an interrupt status register must be accessed to identify the source. Such multiplexing is not new in IIO, and I have followed existing examples for it. The persistence setting (own attribute) to trigger the alarms uses the pattern that has already been used for the veml6030. The device configuration is in general documented in the datasheet and the application note. There is an exception, though: the activation of the "active force" mode that is required for the data ready signal must be carried out in two steps even though the affected bits are located in the same register: first ALS_AF (active force mode enable) must be set, and then ALS_TRIG (active force trigger setting) must be enabled. I have added a brief commentary in the code to explain this behavior, which has been confirmed by the manufacturer. The only functionality that has not been implemented yet is the x0.66 gain (and its x0.165 counterpart when PD_DIV=1), which makes the gts helpers less usable due to the conversions required. It is indeed an uncommon gain to use (there are x0.5 and x0.125 gains) with no known use-case at the moment that justifies making adjustments to the gts helpers or adding artificial conversions to make it work. This driver has been tested with the four supported devices separately as well as in pairs where the I2C addresses don't overlap. I found a couple of issues in veml6030.c while programming this new driver, which shares some functionality with the former, and I added to the patch stack. To: Jonathan Cameron To: Lars-Peter Clausen To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Rishi Gupta To: David Lechner To: Nuno Sá To: Andy Shevchenko To: Matti Vaittinen Cc: linux-iio@vger.kernel.org Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Jonathan Cameron Signed-off-by: Javier Carrasco Changes in v2: - Add commit to fix bug in veml6030.c (channel type when pushing events) and remove dead code. - Use gts helpers to simplify operations. - Drop unused gain_idx. - Build INT_MASK as an OR operation of the involved bits. - Format arrays to follow the desired standard for IIO. - Directly return function result as the last operation within another function instead of 'ret = x; if (ret) return ret; return 0;'. - Fix some spacing (double space, tab for alignemnt in info struct). - Use sizeof() for __le16 reg instead of 2. - Return an error if the part ID could not be read. - Spell out sd -> shutdown. - Use devm_mutex_init() instead of mutex_init(). - Avoid using conditional guard, use claim/release instead. - Access integration times from the global array to get and set the integration time instead of using a switch. - Simplify read of available periods (persistence). - Drop IRQF_TRIGGER_FALLING in the threaded irq request. - Add regmap ranges. - Link to v1: https://lore.kernel.org/r/20241126-veml6031x00-v1-0-4affa62bfefd@gmail.com --- Javier Carrasco (4): iio: light: veml6030: remove unnecessary read of IT index iio: light: veml6030: fix channel type when pushing events dt-bindings: iio: light: veml6030: add veml6031x00 ALS series iio: light: add support for veml6031x00 ALS series .../bindings/iio/light/vishay,veml6030.yaml | 23 +- MAINTAINERS | 6 + drivers/iio/light/Kconfig | 14 + drivers/iio/light/Makefile | 1 + drivers/iio/light/veml6030.c | 14 +- drivers/iio/light/veml6031x00.c | 1193 ++++++++++++++++++++ 6 files changed, 1242 insertions(+), 9 deletions(-) --- base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731 change-id: 20241109-veml6031x00-aa9463da064a Best regards, -- Javier Carrasco