From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 28BC137E2F2 for ; Sat, 25 Apr 2026 12:54:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777121695; cv=none; b=HzpV0wSrSX4/MjwS5Vqvqfu3LUIPthuQRSjkWw6euXh5/HB3BSk3gxJGPBt3idT7vvAckwdc0+CHGL2ss7ErjkSFl7bU99/2ru0aRMbqXEfl2DLhg71jR5FoaSAf1L9pjeDdZDCweEHayIeUflKhiz8KAcbMjvsQOm0EJ6l7jYs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777121695; c=relaxed/simple; bh=os3bytxGw2AOC8T4LmbMOxb3v9WrfYXIrI2AmuC6D7g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Iv/C+whYXW5w+F96ezLVH7k6QBOqjTTV2ra8AUNoupQ1nbWp8Kw6CGsX1lQyYibLAXg6v8aiylW7ANRq/0XRNf4uGd/d8eGq/c2JF2ntAvanfqR6mbv6VssnAhF/EO1GoWfALKddeywWA2JjjyOZ9emI2rmLqIA7CAeyAMGU9Qc= 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=IiTns9ZR; arc=none smtp.client-ip=209.85.208.176 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="IiTns9ZR" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-38e7b0903cdso78094061fa.3 for ; Sat, 25 Apr 2026 05:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777121691; x=1777726491; 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=INZTHDtHLu0hLsiQAV4hWhdKZ29geUdagZMSnUDNr8g=; b=IiTns9ZRAfG3wTFDcgGbF3Zast0cvspVDYk1f/LThMDGDBrV+3iJHUZgDOpJ+TfHtl giSi2niMe3oBmvzvUeHA3julqD1x3j471i0i8x/WW6n7lSALRVUqmYQCjeeN9tCc+h9l GE4FPQDQI+GeQKmLr/zR8pjJOGTAPwtW67mj0Lm7Dsl/XjbcikBn4ifCDTbqbwWlyaaM Sl46Yr2/seaU4pOWTibQK/7Ux53YPPs35eeVWpF+ynZvlR4YbQWvB15EH/7NrqV6NhQN t+ic61PLvTrRbKuxakUMRoU0llkDVCHCAKBBuKtd5dknaephRgqNbgv8BPuVtNhCUo7E /fkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777121691; x=1777726491; 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=INZTHDtHLu0hLsiQAV4hWhdKZ29geUdagZMSnUDNr8g=; b=Tay7vlBdXAw4tBqr7vyxL7OuNB3lMAVuE/xmjrp9E6r6xqTkhbn88zQ65q7gNM5anS hLyjkaYUOyTK9Kmm6qo6ShWHmMf5vtSwLGhXVsUOc0uSGDxQo1GA/RUwfuvhKfUCPDej oKAQ37q8b+9qNq51rbBaNW9KKsCvd8GrsLbnrpTunQ3rCDX5mjcQuP5oHUI/G63plBDI jtZGZLPGaEMkOj1N0CnWgzWYJ6Pe7nU1yjp9wGZQl4LJbrpGr2NIRXuO2XnEPPh14YFf jli5ic5xE6BNgCHeB/mpq/3z2iG+OARdhMZEA6+CfI+BOVAU15RHrCtt5E764BZVJx0C eZcA== X-Forwarded-Encrypted: i=1; AFNElJ/2mJxF2Sji7aZbh4hSWPu8a3m/oSpNBnHYYidhEoHm5fEXJ+8ZDeON/GXb3m771g2Sy2nELjiCZd0jtk8=@vger.kernel.org X-Gm-Message-State: AOJu0YzoVQvMXS9GR+PdY1xuezZmewIZLU3p75OLP5z6NCeftI2fNCJT 8FkFP8POvM0lAC82EV5gkYMSb0RaYEBRVyjJl/t/fUxklAtobj2LSY4q X-Gm-Gg: AeBDies2TzZUtu7WpJBJzv7JEayoM24uHytvstaCFSf+yyCxeMF14nbziL4YBW7XLS8 7adJ2rD4hBNj/AiWhGMTDfJz9PLLvp1CcNyjBtw49CBoLsd40eG39y9Xj2n2GqnNx/Drz+lgs2v mcBwKVr0ajD4+L90UmotN+0CyQfvT/31OhmnEg6cxUtdT/G0WaqECUJ+PoTbSLQW5gk+G8c7KV0 SA1qxuEgxElJF84CIpewN9PoIeNkionEhpc0d+/kSybemHLaUT36XhVFUz/mc7+gzpQQMX9BWyQ CadCkmL7YkdS/MbnJ63VMNoukbpvGEPB6UQcBVVuBwoOHqtpPNqaZGIYdWhaw7AWwc0ZNQf0G1P eMCUUkyXYoA9f9XS9DOdcdkFXxZ/YPDRC2sYYsCQ4HbYKRLGdwuyQGpMOCGq8/BX3cYQEJGnpjm bQA6VZgEiDxr3umOP+VS4G791Jx5S/UAN7sg== X-Received: by 2002:a05:651c:420e:b0:38e:2aa7:3984 with SMTP id 38308e7fff4ca-38ec781824cmr101464481fa.11.1777121691174; Sat, 25 Apr 2026 05:54:51 -0700 (PDT) Received: from xeon ([188.163.112.56]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-38ecb5f6b20sm58334271fa.18.2026.04.25.05.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Apr 2026 05:54:50 -0700 (PDT) From: Svyatoslav Ryhel To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , Arnd Bergmann , Greg Kroah-Hartman , Svyatoslav Ryhel , Randy Dunlap Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v3 2/3] iio: tsl2772: Add support for Avago APDS9900/9901 ALS/Proximity sensor Date: Sat, 25 Apr 2026 15:54:28 +0300 Message-ID: <20260425125429.65154-3-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260425125429.65154-1-clamor95@gmail.com> References: <20260425125429.65154-1-clamor95@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 The Avago APDS9900/9901 has a similar register layout to the TAOS/AMS TSL2772 but features a unique set of configurations. Add support for the APDS9900/9901 into the TSL2772 driver by adding the required device-specific configurations. Signed-off-by: Svyatoslav Ryhel --- drivers/iio/light/tsl2772.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c index c8f15ba95267..9ba8140c8bc1 100644 --- a/drivers/iio/light/tsl2772.c +++ b/drivers/iio/light/tsl2772.c @@ -127,6 +127,7 @@ enum { tmd2672, tsl2772, tmd2772, + apds9900, apds9930, }; @@ -221,6 +222,12 @@ static const struct tsl2772_lux tmd2x72_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = { { 0, 0 }, }; +static const struct tsl2772_lux apds9900_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = { + { 52000, 115960 }, + { 36400, 73840 }, + { 0, 0 }, +}; + static const struct tsl2772_lux apds9930_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = { { 52000, 96824 }, { 38792, 67132 }, @@ -238,6 +245,7 @@ static const struct tsl2772_lux *tsl2772_default_lux_table_group[] = { [tmd2672] = tmd2x72_lux_table, [tsl2772] = tsl2x72_lux_table, [tmd2772] = tmd2x72_lux_table, + [apds9900] = apds9900_lux_table, [apds9930] = apds9930_lux_table, }; @@ -289,6 +297,7 @@ static const int tsl2772_int_time_avail[][6] = { [tmd2672] = { 0, 2730, 0, 2730, 0, 699000 }, [tsl2772] = { 0, 2730, 0, 2730, 0, 699000 }, [tmd2772] = { 0, 2730, 0, 2730, 0, 699000 }, + [apds9900] = { 0, 2720, 0, 2720, 0, 696000 }, [apds9930] = { 0, 2730, 0, 2730, 0, 699000 }, }; @@ -316,6 +325,7 @@ static const u8 device_channel_config[] = { [tmd2672] = PRX2, [tsl2772] = ALSPRX2, [tmd2772] = ALSPRX2, + [apds9900] = ALSPRX, [apds9930] = ALSPRX2, }; @@ -530,6 +540,7 @@ static int tsl2772_get_prox(struct iio_dev *indio_dev) case tmd2672: case tsl2772: case tmd2772: + case apds9900: case apds9930: if (!(ret & TSL2772_STA_PRX_VALID)) { ret = -EINVAL; @@ -1367,6 +1378,7 @@ static int tsl2772_device_id_verif(int id, int target) return (id & 0xf0) == TRITON_ID; case tmd2671: case tmd2771: + case apds9900: return (id & 0xf0) == HALIBUT_ID; case tsl2572: case tsl2672: @@ -1898,6 +1910,8 @@ static const struct i2c_device_id tsl2772_idtable[] = { { "tmd2672", tmd2672 }, { "tsl2772", tsl2772 }, { "tmd2772", tmd2772 }, + { "apds9900", apds9900 }, + { "apds9901", apds9900 }, { "apds9930", apds9930 }, { } }; @@ -1915,6 +1929,8 @@ static const struct of_device_id tsl2772_of_match[] = { { .compatible = "amstaos,tmd2672" }, { .compatible = "amstaos,tsl2772" }, { .compatible = "amstaos,tmd2772" }, + { .compatible = "avago,apds9900" }, + { .compatible = "avago,apds9901" }, { .compatible = "avago,apds9930" }, { } }; -- 2.51.0