From patchwork Sun Jul 21 10:14:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaustabh Chakraborty X-Patchwork-Id: 13737993 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (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 8A226156885; Sun, 21 Jul 2024 10:16:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721556966; cv=none; b=UMQc0EHgmx5bEOiYIrP6NMOaZcTLVW0yLe3NsiKkPhaGWYLH+zw40iYpZp845v8Ab3KYy1Yvvm2jtJ5SQ/cAqcCf4mCcxhY1m/p/zL7GCOyQjSm7MNmHAKvqbPf0YFWvpPUxPCfDjJ/UNS6zLFiIfWr7jwmYfv/ZHWoPRVqjYuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721556966; c=relaxed/simple; bh=QsPikQLZceYAGuxVlGoupF72mEFVrVlCn8xSmyVaK5U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=USwFW06mabR4Qu25apsbfj0SfGSf82Pt0c2qofDfNAr9hj/xcuowsOumT8openy3wLT8oWVojBDiwt4AfoqDZBddxWYNkxWSL5qYGaQAlD4U91qHeMALYuD7dBOp9GJlSfy3p150SyXGCtOF8OW/2KhKjQcYmsSMPbOhz9syFOI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=EbJmTAhm; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="EbJmTAhm" Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id A183D41377; Sun, 21 Jul 2024 12:15:56 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IOf0iVq06uQf; Sun, 21 Jul 2024 12:15:56 +0200 (CEST) From: Kaustabh Chakraborty DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1721556955; bh=QsPikQLZceYAGuxVlGoupF72mEFVrVlCn8xSmyVaK5U=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=EbJmTAhm4mcSCitcrRpWJVSju4wRl34OjzfxYrD2WdqEsm235BcVwdkh140CRFe2l tr0tt5CpzkiPSYKgpr6SN8zZ+DxIXziwBMOCo1pDFF0nLyCkq2GUOGgh1dBbYv0DVV QigD5Tlw4IC8x5m8HPeONgrYVyhkhCUoVoCyUQ/MiJFT7sUMMEUyqgSHxSUYjgIm4I lBxt+G/zNvUyJ66w0lpiU6oFgs14YWQ8y+0lOfwDQznBWrba310ApqVXmfoqpQN8/R 4jowoum1A3ULavg5GXW0c9BM4leFeDdBWFdBljMoWYpB8rxtl2Hbr0d3uNBMHKQJUg bq1fnr5iIT0yg== Date: Sun, 21 Jul 2024 15:44:29 +0530 Subject: [PATCH v3 1/3] iio: light: stk3310: relax chipid check warning Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240721-stk3310-v3-1-98fcb6f551a1@disroot.org> References: <20240721-stk3310-v3-0-98fcb6f551a1@disroot.org> In-Reply-To: <20240721-stk3310-v3-0-98fcb6f551a1@disroot.org> To: Jonathan Cameron , Conor Dooley Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Kaustabh Chakraborty In order to allow newer devices which are compatible with existing sensors, issuing a warning for an unknown chipid indicates that something has gone wrong with the init process, which isn't ideal. Swap it with a friendlier info message to get things right. Suggested-by: Conor Dooley Signed-off-by: Kaustabh Chakraborty --- drivers/iio/light/stk3310.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index e3470d6743ef..48a971de6a04 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c @@ -496,7 +496,7 @@ static int stk3310_init(struct iio_dev *indio_dev) ret = stk3310_check_chip_id(chipid); if (ret < 0) - dev_warn(&client->dev, "unknown chip id: 0x%x\n", chipid); + dev_info(&client->dev, "new unknown chip id: 0x%x\n", chipid); state = STK3310_STATE_EN_ALS | STK3310_STATE_EN_PS; ret = stk3310_set_state(data, state); From patchwork Sun Jul 21 10:14:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaustabh Chakraborty X-Patchwork-Id: 13737994 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (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 19493156C72; Sun, 21 Jul 2024 10:16:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721556967; cv=none; b=vBDEWMdtj7v7j7bVSJ2p70ES/VbQzF5vGouVRt/YUavBAEO1qx1ACuvaE28XjSX/u8m9cavGUxRg2bMOAl8Bs1eVRpjS+EDtJFPbwCpauCfk8Fl7TJVGg5yHuNzbuvZgIURQD+aSeeF8Zdi1AnnVMXf2vbO2SFfkwTkHkJa3RjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721556967; c=relaxed/simple; bh=VbSZYwRv3jtpNXDiyhysm6/0+1x9p2kdZVp+aQs9vqw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tA24tkPjAfexDd/2hprnlIYNSrbASndNO8EOElHnAtHCAwTTnAwfZlgDf015BmmNK2v0DUb5mXeugpDfG77z7+aF+WfMK5mdMj9Xyyin5j52XZ40mT6pExnU3+15x7I6HyL9duROKzY+XhFCI8iV2ZyRN2qDzpcmlESc9kIvhoI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=MS6qEWPr; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="MS6qEWPr" Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 3C3C841805; Sun, 21 Jul 2024 12:15:59 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m1VOMynD1hsG; Sun, 21 Jul 2024 12:15:58 +0200 (CEST) From: Kaustabh Chakraborty DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1721556958; bh=VbSZYwRv3jtpNXDiyhysm6/0+1x9p2kdZVp+aQs9vqw=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=MS6qEWPrVL4eDaBDaedLGIFIxAPdpEuk8aim69gVyukw0ZY7FcC8l8SLsl64XfrJR 632jvmmnUd611oyAGMbPNjxr5wXgV4PzWAy82hoyYYvWhTeGZomjB1Zr5amgrBW0NR ZrXO+2gH2IVO0tg047wKe044tGeXOJs/NhNcrMyBRbBhgMA/TZ+5BvVNqnDnAjFvtX jXzJZY/9j4B/6uck2OBSUQ1BI/XaItgVMvNinbs+XUz3GPp/6l1q96FVjBQTdZB0vi Z/sjvgDVlXVrVKglnTHF2q6HbWQxlCxxWZ2fdO1+Dn5aAM5uRSd8KPwgAQRVPGO0/Z WNWFTBolFkm7w== Date: Sun, 21 Jul 2024 15:44:30 +0530 Subject: [PATCH v3 2/3] iio: light: stk3310: add support for stk3013 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240721-stk3310-v3-2-98fcb6f551a1@disroot.org> References: <20240721-stk3310-v3-0-98fcb6f551a1@disroot.org> In-Reply-To: <20240721-stk3310-v3-0-98fcb6f551a1@disroot.org> To: Jonathan Cameron , Conor Dooley Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Kaustabh Chakraborty Add support for Sensortek's STK3013 in the driver. The part bears the product ID 0x31. As seen in [1], Sensortek lists STK3013 as a proximity sensor. But it has been experimentally observed that they do have ambient light sensing capabilities. Furthermore, [2] implements a proximity and ambient light sensor driver for STK3x1x devices, which is also indicative of the fact that these parts are also ambient light sensors. [1] https://www.sensortek.com.tw/index.php/en/products/optical-sensor/ [2] https://android.googlesource.com/kernel/msm.git/+/e6dfa4641d88201e8019be19ff557e5d2cf4572f Signed-off-by: Kaustabh Chakraborty --- drivers/iio/light/stk3310.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index 48a971de6a04..ed20b6714546 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c @@ -35,6 +35,7 @@ #define STK3310_STATE_EN_ALS BIT(1) #define STK3310_STATE_STANDBY 0x00 +#define STK3013_CHIP_ID_VAL 0x31 #define STK3310_CHIP_ID_VAL 0x13 #define STK3311_CHIP_ID_VAL 0x1D #define STK3311A_CHIP_ID_VAL 0x15 @@ -84,6 +85,7 @@ static const struct reg_field stk3310_reg_field_flag_nf = REG_FIELD(STK3310_REG_FLAG, 0, 0); static const u8 stk3310_chip_ids[] = { + STK3013_CHIP_ID_VAL, STK3310_CHIP_ID_VAL, STK3311A_CHIP_ID_VAL, STK3311S34_CHIP_ID_VAL, @@ -700,6 +702,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend, stk3310_resume); static const struct i2c_device_id stk3310_i2c_id[] = { + { "STK3013" }, { "STK3310" }, { "STK3311" }, { "STK3335" }, @@ -708,6 +711,7 @@ static const struct i2c_device_id stk3310_i2c_id[] = { MODULE_DEVICE_TABLE(i2c, stk3310_i2c_id); static const struct acpi_device_id stk3310_acpi_id[] = { + {"STK3013", 0}, {"STK3310", 0}, {"STK3311", 0}, {} @@ -716,6 +720,7 @@ static const struct acpi_device_id stk3310_acpi_id[] = { MODULE_DEVICE_TABLE(acpi, stk3310_acpi_id); static const struct of_device_id stk3310_of_match[] = { + { .compatible = "sensortek,stk3013", }, { .compatible = "sensortek,stk3310", }, { .compatible = "sensortek,stk3311", }, { .compatible = "sensortek,stk3335", }, From patchwork Sun Jul 21 10:14:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaustabh Chakraborty X-Patchwork-Id: 13737992 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (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 7A82615687C; Sun, 21 Jul 2024 10:16:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721556965; cv=none; b=jxzCsDwmWbUTMTx5bmIjOMxkIOyIgA6XfUS6Of5TpUqmRCIng16wwNd1E+Ppiz269QwH0+FHMEDL8mkaRn3CZIAcHIj5Bs5miW3IVhFk7vIR5Ajl0wPyzgVFmx1gQo1hR6KNlu7ov6JYjWgcTueMH83P8dAU3+rkiw3AwL/1VOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721556965; c=relaxed/simple; bh=U4WEKP8OA3P3RwGwFW6NBkDsoThkdQYReyfDpw0XKf4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZRYQOwAsZ7pHvIxtby99p+6rgUfSG9UEVrRNHy22Yj3DqIb9k0X2xYiZimf30GtIjngigAySVo9IiG/hSHBwsQAqo8pKSLckdM5VjYudPYzwwlEc/6Qk1MvMRyv50gPFORrNHoewRvskw9bpapN5CjajHR29Yayu0mvb4qHkuSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=FyOonOGn; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="FyOonOGn" Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id EB9EC41A05; Sun, 21 Jul 2024 12:16:00 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cVJLL9jYySKI; Sun, 21 Jul 2024 12:16:00 +0200 (CEST) From: Kaustabh Chakraborty DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1721556960; bh=U4WEKP8OA3P3RwGwFW6NBkDsoThkdQYReyfDpw0XKf4=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=FyOonOGnF0euP02JumhAUimPFvUkUZ0fD149n0FK6+luaDZGr3nGyZ0DB1BDDCBv6 PePpy7odLEnkJ/hUAaanLkN6zKpXFJ0Ju4th/2SZqtfhJQyeBntsDn2fA14VCro0Kb IRMkkZv2ZOZ+NEBVW4VjirLqVIYxsfKConS90DJw+KN6kvmPHSZsKdsJxJsw+Faci6 BFu0nkOrm1mRSP3lh57IFlU+H9/402ql0J56Fu2f/UlPA17BPAKFE6ODDOHdlmy/0m VR/rQNJAhecVmhOvcFnkX/Un8tcWkpE2q2a1MtLU3JvMdZq0xldmLqyjUmfAOBmx8W P3XktJn8rrZZg== Date: Sun, 21 Jul 2024 15:44:31 +0530 Subject: [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible for stk3013 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240721-stk3310-v3-3-98fcb6f551a1@disroot.org> References: <20240721-stk3310-v3-0-98fcb6f551a1@disroot.org> In-Reply-To: <20240721-stk3310-v3-0-98fcb6f551a1@disroot.org> To: Jonathan Cameron , Conor Dooley Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Kaustabh Chakraborty STK3013 is a proximity sensor by Sensortek, bearing chipid of 0x31. Despite being marketed as a proximity sensor, it also appears to have ambient light sensing capabilities. The part is fully compatible with the existing implementation of the device driver. Add the compatible string of stk3013 to the existing list, with a fallback of stk3310. Signed-off-by: Kaustabh Chakraborty --- Documentation/devicetree/bindings/iio/light/stk33xx.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml index f6e22dc9814a..d5f6b622c8da 100644 --- a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml +++ b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml @@ -18,10 +18,15 @@ allOf: properties: compatible: - enum: - - sensortek,stk3310 - - sensortek,stk3311 - - sensortek,stk3335 + oneOf: + - enum: + - sensortek,stk3310 + - sensortek,stk3311 + - sensortek,stk3335 + - items: + - enum: + - sensortek,stk3013 + - const: sensortek,stk3310 reg: maxItems: 1