From nobody Sat Feb 7 17:20:44 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E1F8726AEE; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; cv=none; b=s16YntpYuW7SYtnOaF17UA5p3kf+I/Mh6g2USzCJgz4LTNP2/3zFuB2MlHdoriqoNT18a1xEfUW/dKZfLLoluiXptQoxG6ZA2j+u4n16wlXtAZ8jMFEG3WJ7LLziPjolRSHbQfTf+8tsNk1vzZDj8+SSu/66g4hlf5mf2Oas52c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; c=relaxed/simple; bh=0nzpfTzsTCcWDqac7ZTk2BZgJrXNm8rZpSw6OMimBsU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HtoS0UXYZh29waIr9HIwaFGRYEtffTT9DX5KwK2b7LC+hvTrEl2RDLxXySwRjL09wJd4RFiDTPaomRQY3EzFvWLLrW8SSka1xpX4HtccjOej/MFCTC7d+k6Dkx94QMUUJukDAz4Gt+GU+OP/Casew0VrBmzWAZlRnbWvS76jKYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ay8TNfIJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ay8TNfIJ" Received: by smtp.kernel.org (Postfix) with ESMTPS id 55840C4AF0C; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1745931556; bh=0nzpfTzsTCcWDqac7ZTk2BZgJrXNm8rZpSw6OMimBsU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ay8TNfIJdHSpE+Ghmbsd+kSSO8m9juy6QZAkTgyzDv10MPyJ5iQ7TSDz8GNkIt5N0 MkJNf39g4/wXj9Ast1YYWXtr0Qdi+fY7YdepA3vKr2uoVxCt+7FDu/2qYy5g4Cdep0 HY8sIjyjhJVUIkfdzrmDerDpGZtvySSxdUoCB+2s= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3871AC3ABAC; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) From: Richard Leitner Date: Tue, 29 Apr 2025 14:59:06 +0200 Subject: [PATCH v3 1/9] media: v4l: ctrls: add a control for flash/strobe duration 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: quoted-printable Message-Id: <20250429-ov9282-flash-strobe-v3-1-2105ce179952@linux.dev> References: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> In-Reply-To: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> To: Sakari Ailus , Dave Stevenson , Mauro Carvalho Chehab , Lee Jones , Pavel Machek , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Richard Leitner X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745931554; l=1793; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=0nzpfTzsTCcWDqac7ZTk2BZgJrXNm8rZpSw6OMimBsU=; b=q0HdotQ1a3Lpu50SYXXrSIedy34zGRbVP85oeqT3uX74IjThduRjeyIdqv7WKOAQl3DpQ5spv a9RTte8pwtUAH8OaPV3ZJBAk66Dz2jwehtJHkJGzaBMI8/zwriVjhUX X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Add a control V4L2_CID_FLASH_DURATION to set the duration of a flash/strobe pulse. This is different to the V4L2_CID_FLASH_TIMEOUT control, as the timeout defines a limit after which the flash is "forcefully" turned off again. On the other hand the new V4L2_CID_FLASH_DURATION is the desired length of the flash/strobe pulse. Signed-off-by: Richard Leitner --- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 + include/uapi/linux/v4l2-controls.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2= -core/v4l2-ctrls-defs.c index 1ea52011247accc51d0261f56eab1cf13c0624a0..f9ed7273a9f3eafe01c31b638e1= c8d9fcf5424af 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -1135,6 +1135,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_FLASH_FAULT: return "Faults"; case V4L2_CID_FLASH_CHARGE: return "Charge"; case V4L2_CID_FLASH_READY: return "Ready to Strobe"; + case V4L2_CID_FLASH_DURATION: return "Strobe Duration"; =20 /* JPEG encoder controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-c= ontrols.h index 72e32814ea83dee5f1202c1249eac7cf3b85a22a..72c6bd26e2dfa23a0224e745e5c= d07c9fca0c8b5 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1180,6 +1180,7 @@ enum v4l2_flash_strobe_source { =20 #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) #define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) +#define V4L2_CID_FLASH_DURATION (V4L2_CID_FLASH_CLASS_BASE + 13) =20 =20 /* JPEG-class control IDs */ --=20 2.47.2 From nobody Sat Feb 7 17:20:44 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E20742C1784; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; cv=none; b=qUt5tvczxDWGtk/3gf5JJ8le45eJmsTBfnTHYZWYWZ929u9BIVu17kvXadJPu1J/8fhxkzoPnltrSwKJEzKxEIt6wJcW6egkZxRUNqYEQenAZtj0qCuRVI9AS1IkLoml3bpsxwzUmdlSVxIaFFYimqNfYgZjtTFvEgPKHCSrg8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; c=relaxed/simple; bh=HDEsgaluUKEPdxixqt/Aekf5T3lFNnaVwddtdEWptfw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ISuAEK80SB0eV5RHUvvDAZhCNVHetTHIjApx4Nif2iRwMBLuf79vu3SHq7y/Ph7UAk2oBQturo2/qahJwoTERMoDbQlIuUJJxg1NbHEiEtdr8zac58GDepCsvPbfD4N0/U9000fuWgP0+4etdFnaR/pCOPP3wUze4d1lafosai8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=EtxJBdET; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="EtxJBdET" Received: by smtp.kernel.org (Postfix) with ESMTPS id 5C2E0C4CEEB; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1745931556; bh=HDEsgaluUKEPdxixqt/Aekf5T3lFNnaVwddtdEWptfw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EtxJBdETblC80AUHOc6K/T3RWxhyzwH1JHkCdVlJN7/3VGTW4TOjhVDgwjaoRQxuP 244kQ8uJW0Nvay5XDj6VPpWBrowhmBNkWWoiAR7jdCsBawljFdMrJzOcLGXEF8mwV6 rEpKkGO5Vc1LyJbBRoKTkC+lDgxBqlj72PZUgcAU= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46D36C3ABB0; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) From: Richard Leitner Date: Tue, 29 Apr 2025 14:59:07 +0200 Subject: [PATCH v3 2/9] leds: flash: add support for flash/stobe duration 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: quoted-printable Message-Id: <20250429-ov9282-flash-strobe-v3-2-2105ce179952@linux.dev> References: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> In-Reply-To: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> To: Sakari Ailus , Dave Stevenson , Mauro Carvalho Chehab , Lee Jones , Pavel Machek , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Richard Leitner X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745931554; l=2827; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=HDEsgaluUKEPdxixqt/Aekf5T3lFNnaVwddtdEWptfw=; b=6M/61HmZntl6x9awtwRbQFDQpMX+zbdz7fFVJ+CjaQLXInH1bRos1VW9t5D31eRmSUYhwouXc Gn9Y9mGn5X2A1cPjJxiEGSaLbzsnf9Ob5ImmdvMY2IkG8hN1YC+O7L+ X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Add support for the new V4L2_CID_FLASH_DURATION control to the leds driver. Signed-off-by: Richard Leitner --- drivers/leds/led-class-flash.c | 15 +++++++++++++++ include/linux/led-class-flash.h | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c index f4e26ce84862c05092a9598e63ed301967852f13..165035a8826ca7d44a5cd265a51= 30a76c6e94347 100644 --- a/drivers/leds/led-class-flash.c +++ b/drivers/leds/led-class-flash.c @@ -440,6 +440,21 @@ int led_update_flash_brightness(struct led_classdev_fl= ash *fled_cdev) } EXPORT_SYMBOL_GPL(led_update_flash_brightness); =20 +int led_set_flash_duration(struct led_classdev_flash *fled_cdev, u32 durat= ion) +{ + struct led_classdev *led_cdev =3D &fled_cdev->led_cdev; + struct led_flash_setting *s =3D &fled_cdev->duration; + + s->val =3D duration; + led_clamp_align(s); + + if (!(led_cdev->flags & LED_SUSPENDED)) + return call_flash_op(fled_cdev, duration_set, s->val); + + return 0; +} +EXPORT_SYMBOL_GPL(led_set_flash_duration); + MODULE_AUTHOR("Jacek Anaszewski "); MODULE_DESCRIPTION("LED Flash class interface"); MODULE_LICENSE("GPL v2"); diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-flas= h.h index 36df927ec4b7dcaf9074c6ef32ac8ce83a87a79d..21ec856c36bc67decda46aa8ff1= c040ffdcf1181 100644 --- a/include/linux/led-class-flash.h +++ b/include/linux/led-class-flash.h @@ -45,6 +45,8 @@ struct led_flash_ops { int (*timeout_set)(struct led_classdev_flash *fled_cdev, u32 timeout); /* get the flash LED fault */ int (*fault_get)(struct led_classdev_flash *fled_cdev, u32 *fault); + /* set flash duration */ + int (*duration_set)(struct led_classdev_flash *fled_cdev, u32 duration); }; =20 /* @@ -75,6 +77,9 @@ struct led_classdev_flash { /* flash timeout value in microseconds along with its constraints */ struct led_flash_setting timeout; =20 + /* flash timeout value in microseconds along with its constraints */ + struct led_flash_setting duration; + /* LED Flash class sysfs groups */ const struct attribute_group *sysfs_groups[LED_FLASH_SYSFS_GROUPS_SIZE]; }; @@ -209,4 +214,15 @@ int led_set_flash_timeout(struct led_classdev_flash *f= led_cdev, u32 timeout); */ int led_get_flash_fault(struct led_classdev_flash *fled_cdev, u32 *fault); =20 +/** + * led_set_flash_duration - set flash LED duration + * @fled_cdev: the flash LED to set + * @timeout: the flash duration to set it to + * + * Set the flash strobe duration. + * + * Returns: 0 on success or negative error value on failure + */ +int led_set_flash_duration(struct led_classdev_flash *fled_cdev, u32 durat= ion); + #endif /* __LINUX_FLASH_LEDS_H_INCLUDED */ --=20 2.47.2 From nobody Sat Feb 7 17:20:44 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 19DA32C2ACB; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; cv=none; b=jNK00nGcxG/DwO9N1oxedV3Nxa7OQAhWD+GSBqBW/jA8C/zjzT+RhCw5jCULlBO7m2yWvowAdI59ufLoeDNqKMrz7oQC6d6wmTOOHUyKR4qlX/fqSn/II94zHIrrQXQ6Wb8+HqbOBh6wyhlyZ3DAnhxPY7KkxZbT8q2hcbDx+6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; c=relaxed/simple; bh=bHa9DyU5pY4KwqBVVlo7OhSDU5Z0nzs/MOBy8JAQCk8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=boNxrzcWmcbSrKGiRNN5VRc+fK4cc2OvRz9tn3cnq394emldX2PPelbJaEhSQlaf/dncb4Z0JV2acsqchjbszpQkhwQyjEhFfa376XAF3iJvLkodMEDN5BCHBiteTeyCGMcdY/k5H3IoUmgr+JKnONBGNuS3HF/WdC744XcassU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=I8Zlxolk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="I8Zlxolk" Received: by smtp.kernel.org (Postfix) with ESMTPS id 64F5FC4CEE3; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1745931556; bh=bHa9DyU5pY4KwqBVVlo7OhSDU5Z0nzs/MOBy8JAQCk8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=I8ZlxolkPmnlRxzBImS4gkvuuZmnKUH3pwE+WkEhyPd77vJKJ4p5ugmwxZRnItG5U qsnXgP8KZQZtRZa4PaSa6YrjLzSj0xVl5QgD8t3wp3GAQ3YCzkYVVxxFDhv/9hIauo NWb8NEuCJmcPZX9RMGgCbWzX9ECU97snYSq720ro= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56723C3ABAF; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) From: Richard Leitner Date: Tue, 29 Apr 2025 14:59:08 +0200 Subject: [PATCH v3 3/9] media: v4l2-flash: add support for flash/strobe duration 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: quoted-printable Message-Id: <20250429-ov9282-flash-strobe-v3-3-2105ce179952@linux.dev> References: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> In-Reply-To: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> To: Sakari Ailus , Dave Stevenson , Mauro Carvalho Chehab , Lee Jones , Pavel Machek , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Richard Leitner X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745931554; l=1581; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=bHa9DyU5pY4KwqBVVlo7OhSDU5Z0nzs/MOBy8JAQCk8=; b=hVLXrCC7H/khQgUUmgEY6fKTLCw2sfgTBSOK7fv5eNAhyCFTkDCcubJY6AF75MdxFRtdzZy2o yzE9BVZM+BTDwY3RokFPA6JAstT7f+XTi0dkNf5jgv//PoSkhrv764I X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Add support for the new V4L2_CID_FLASH_DURATION control to the v4l2 flash led class. Signed-off-by: Richard Leitner --- drivers/media/v4l2-core/v4l2-flash-led-class.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media= /v4l2-core/v4l2-flash-led-class.c index 355595a0fefac72c2f6941a30fa430d37dbdccfe..963b549480f6eb3b9eb0d80696a= 764de7ffcc1a2 100644 --- a/drivers/media/v4l2-core/v4l2-flash-led-class.c +++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c @@ -298,6 +298,12 @@ static int v4l2_flash_s_ctrl(struct v4l2_ctrl *c) * microamperes for flash intensity units. */ return led_set_flash_brightness(fled_cdev, c->val); + case V4L2_CID_FLASH_DURATION: + /* + * No conversion is needed as LED Flash class also uses + * microseconds for flash duration units. + */ + return led_set_flash_duration(fled_cdev, c->val); } =20 return -EINVAL; @@ -424,6 +430,13 @@ static void __fill_ctrl_init_data(struct v4l2_flash *v= 4l2_flash, ctrl_cfg->flags =3D V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_EXECUTE_ON_WRITE; } + + /* Init FLASH_DURATION ctrl data */ + if (has_flash_op(fled_cdev, timeout_set)) { + ctrl_init_data[FLASH_DURATION].cid =3D V4L2_CID_FLASH_DURATION; + ctrl_cfg =3D &ctrl_init_data[FLASH_DURATION].config; + __lfs_to_v4l2_ctrl_config(&fled_cdev->duration, ctrl_cfg); + ctrl_cfg->id =3D V4L2_CID_FLASH_DURATION; } =20 static int v4l2_flash_init_controls(struct v4l2_flash *v4l2_flash, --=20 2.47.2 From nobody Sat Feb 7 17:20:44 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 826AE2D0291; Tue, 29 Apr 2025 12:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; cv=none; b=iMFi/6BUk6XR1Jbmy84LUV0qMKT7Ff1Kf6vjDGw2PW9MYzfOnjhAa+nowqlLB6IP+zOcUDcQfLMhfh4YmOlc+4kDfbVDk3/pIuHv/ukRW+buxoLjUqXOtxTNWi949Cy1kacEYbaLiH2IKbuTwmv5Xv7ZrlZZZj1aFQgWTDo00Lo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; c=relaxed/simple; bh=8XoXfLI3glbsttjIv49MTkNU8w73Ts/XjbKrGmMzkd0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZsUDxYxYbN9F/AMQ8jmBm8ucCaeCw7F83NHKmRDE07jlBHUqeOz8SZkpxfQ8kd4LF3dC5SrdzPg86Ip5Vft7AMHN3auYXZ4uWcreqELPcb/aT619od7n2loxy7OAcbb8gMQJWhFRcdARLmlrzdGRsgdYHKjCr2D7uno8WL9BCjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=IO9CMbZJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="IO9CMbZJ" Received: by smtp.kernel.org (Postfix) with ESMTPS id 70CD8C113D0; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1745931556; bh=8XoXfLI3glbsttjIv49MTkNU8w73Ts/XjbKrGmMzkd0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=IO9CMbZJhk2C+zZaHkRnoUfv64mmmJJWv/w5SnS2Dsv7nF+vzxf2p6jy7ElPizJfp R4br8lWuwtYkkz/dP+pO3m6o8QjhSws1a7OchYXH5GXZQjENRO+2brN7VJDPeauoW1 c792UomRuYVRILHsOvzDR03zW5rm4uWzWPvfRcOE= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63503C3ABB3; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) From: Richard Leitner Date: Tue, 29 Apr 2025 14:59:09 +0200 Subject: [PATCH v3 4/9] media: v4l2-flash: fix flash_timeout comment 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: quoted-printable Message-Id: <20250429-ov9282-flash-strobe-v3-4-2105ce179952@linux.dev> References: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> In-Reply-To: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> To: Sakari Ailus , Dave Stevenson , Mauro Carvalho Chehab , Lee Jones , Pavel Machek , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Richard Leitner X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745931554; l=878; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=8XoXfLI3glbsttjIv49MTkNU8w73Ts/XjbKrGmMzkd0=; b=Vq8RYyKXTeDizbDIP7IUbAZFqHkLZBZKwFKb49hINPfxPyE8rYPfI2bTUFxoo8MoEliN3pWnG Fft5ZyMMDSPCKz+khm2gLoRnlV+FYf4fxgAgaVv5IJgEzrmHfWYSa9S X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 The comment for the flash_timeout setter mentioned it is the "flash duration". Fix this by changing it to "flash timeout". Signed-off-by: Richard Leitner --- include/linux/led-class-flash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-flas= h.h index 21ec856c36bc67decda46aa8ff1c040ffdcf1181..775a96217518936633541c7a5d3= 94502dbf04f83 100644 --- a/include/linux/led-class-flash.h +++ b/include/linux/led-class-flash.h @@ -197,7 +197,7 @@ int led_update_flash_brightness(struct led_classdev_fla= sh *fled_cdev); * @fled_cdev: the flash LED to set * @timeout: the flash timeout to set it to * - * Set the flash strobe duration. + * Set the flash strobe timeout. * * Returns: 0 on success or negative error value on failure */ --=20 2.47.2 From nobody Sat Feb 7 17:20:44 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 827822D029B; Tue, 29 Apr 2025 12:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; cv=none; b=QKSTVkyQvdPgLQS4pE4L08wJYZNDD8qUCK9rD1btLBrqSMyzqkrgwhsb8WVQAWjoatf7192r3yrJvpmSweecJ1VN+Gt9cWW+p6PY+csnJLzAwdi9QZX4Fp5KP4/pci87fs8wdV7ZtqVjr1vDC3bPkMSWDdMCrdrxgxQ95dZCfn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; c=relaxed/simple; bh=16N0ehkJWytFD5jx5wDbSTZhtNf5Qf6vx2SOhlkAC1Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BJEODbAoGqoS8SbZ6PL0zbvpUhV6AlkCGYy+Je5/VjIrom6HDwPsDxCgM/1xR54u46XCx/O+9Q+djcy+Ux0AqeTJIdFFTAiHRWAs+8U/fU0k/+cOIyaYWK7x3xhHfIMUKApR1Wl9Jc3fgrj7VaqXpuVldJklcExdV0NkpbLKkgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=JbekdOJw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="JbekdOJw" Received: by smtp.kernel.org (Postfix) with ESMTPS id 80DD3C19422; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1745931556; bh=16N0ehkJWytFD5jx5wDbSTZhtNf5Qf6vx2SOhlkAC1Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JbekdOJwB5KkfTAVZnMSOOO6KVy1H6HwF6VKcRVwVXOFunM+3RY6myhhlhg2hU/7F JdW4B/3S0cZC2c6ghkfiAaysIBglATaik/oewo6ILaWiGne7QN818AixQhkUM9h/+j BmkflqODYfw3m4/9Pajr0mRPMMWI+jE7VpODF8OQ= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7058EC3ABB2; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) From: Richard Leitner Date: Tue, 29 Apr 2025 14:59:10 +0200 Subject: [PATCH v3 5/9] Documentation: uAPI: media: add V4L2_CID_FLASH_DURATION 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: quoted-printable Message-Id: <20250429-ov9282-flash-strobe-v3-5-2105ce179952@linux.dev> References: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> In-Reply-To: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> To: Sakari Ailus , Dave Stevenson , Mauro Carvalho Chehab , Lee Jones , Pavel Machek , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Richard Leitner X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745931554; l=1038; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=16N0ehkJWytFD5jx5wDbSTZhtNf5Qf6vx2SOhlkAC1Y=; b=wDEuqGzuAzAKafp77XME7C+1i7hnGJTO89QyQhr8UWvQwj2gMhQE+C5LSPSBLXfqY3CEcJ1b8 ++BLABez+d7B93WWQ0NEdUvzpbCac5Zq0fkIRqX/GwSy7FYbxSW1P9d X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Add the new strobe_duration control to v4l uAPI documentation. Signed-off-by: Richard Leitner --- Documentation/userspace-api/media/v4l/ext-ctrls-flash.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-flash.rst b/Do= cumentation/userspace-api/media/v4l/ext-ctrls-flash.rst index d22c5efb806a183a3ad67ec3e6550b002a51659a..03a58ef94be7c870f55d5a9bb09= 503995dbfb402 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-flash.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-flash.rst @@ -186,3 +186,8 @@ Flash Control IDs charged before strobing. LED flashes often require a cooldown period after strobe during which another strobe will not be possible. This is a read-only control. + +``V4L2_CID_FLASH_DURATION (integer)`` + Duration the flash should be on when the flash LED is in flash mode + (V4L2_FLASH_LED_MODE_FLASH). The unit should be microseconds (=C2=B5s) + if possible. --=20 2.47.2 From nobody Sat Feb 7 17:20:44 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 82BE22D190B; Tue, 29 Apr 2025 12:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; cv=none; b=s/SPy3GKhiPYuZvbv7CHLAld0uwtddYCaRTrgGRcQybs9zoqmq7eSBSe+lug6Ek1bX0T5OOKlV6VMZC81NXpGgzf85RFdeKScQAWExdaFPSLgJschuhHIYfslc3rgtETu7LeO92PmoJELRQav3FzFETA+8orS8vWQ+9y6wPSTAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; c=relaxed/simple; bh=FNa/xvakH+OMufv25Oa47P8olVqt6It8kjPg/VhP/1A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TP2ftMmIHTy5T0amQeWVDGLDs+AIYK1vjmbiogfC1M+u8EtZECBGixiN402atZ8gClt+xhdU9v6tHveKbfVjvE0WuR54p7PDni9eyKxT4tmGO1uxZ6DfgaNOnSqcNBcigIgVc2aDvxkAQnauK87urOvKcdAgjQVT7dF0uqMuCDs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=mWRaizAB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mWRaizAB" Received: by smtp.kernel.org (Postfix) with ESMTPS id 95DD5C4AF10; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1745931556; bh=FNa/xvakH+OMufv25Oa47P8olVqt6It8kjPg/VhP/1A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mWRaizABdJXVNYkZRg2M5ObkpDSs3OnIn5CzlVJoGIMQEZDfBqAtV8OPCiDgakAHi prhPWnxp//CoaczxAIETGzG2ZQZvxMuKyNBZ5Jb0+DR8HS6LnhULH3ief3xQNCAJXK kwQZrS7WijJWvgsh+ZKNBCEXMrZ65wrzpAr1vdYk= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FD99C3ABAC; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) From: Richard Leitner Date: Tue, 29 Apr 2025 14:59:11 +0200 Subject: [PATCH v3 6/9] media: i2c: ov9282: add output enable register definitions 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: quoted-printable Message-Id: <20250429-ov9282-flash-strobe-v3-6-2105ce179952@linux.dev> References: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> In-Reply-To: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> To: Sakari Ailus , Dave Stevenson , Mauro Carvalho Chehab , Lee Jones , Pavel Machek , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Richard Leitner X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745931554; l=2191; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=FNa/xvakH+OMufv25Oa47P8olVqt6It8kjPg/VhP/1A=; b=EJZIEeoSCZK9JeBVkUd48ju6+zVRAJxQytJfBl7iON3HbipIeylHQb1s6eDD/IlzcKh4E2H/W Hx0iiTXKp06BqqVE1FgbQPLJDcWCroCezHAyeZjoV+A3xgFqPGcIF66 X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Add #define's for the output enable registers (0x3004, 0x3005, 0x3006), also known as SC_CTRL_04, SC_CTRL_05, SC_CTRL_04. Use those register definitions instead of the raw values in the `common_regs` struct. All values are based on the OV9281 datasheet v1.53 (january 2019). Reviewed-by: Dave Stevenson Signed-off-by: Richard Leitner --- drivers/media/i2c/ov9282.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index c882a021cf18852237bf9b9524d3de0c5b48cbcb..f42e0d439753e74d14e3a359202= 9e48f49234927 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -37,6 +37,29 @@ #define OV9282_REG_ID 0x300a #define OV9282_ID 0x9281 =20 +/* Output enable registers */ +#define OV9282_REG_OUTPUT_ENABLE4 0x3004 +#define OV9282_OUTPUT_ENABLE4_GPIO2 BIT(1) +#define OV9282_OUTPUT_ENABLE4_D9 BIT(0) + +#define OV9282_REG_OUTPUT_ENABLE5 0x3005 +#define OV9282_OUTPUT_ENABLE5_D8 BIT(7) +#define OV9282_OUTPUT_ENABLE5_D7 BIT(6) +#define OV9282_OUTPUT_ENABLE5_D6 BIT(5) +#define OV9282_OUTPUT_ENABLE5_D5 BIT(4) +#define OV9282_OUTPUT_ENABLE5_D4 BIT(3) +#define OV9282_OUTPUT_ENABLE5_D3 BIT(2) +#define OV9282_OUTPUT_ENABLE5_D2 BIT(1) +#define OV9282_OUTPUT_ENABLE5_D1 BIT(0) + +#define OV9282_REG_OUTPUT_ENABLE6 0x3006 +#define OV9282_OUTPUT_ENABLE6_D0 BIT(7) +#define OV9282_OUTPUT_ENABLE6_PCLK BIT(6) +#define OV9282_OUTPUT_ENABLE6_HREF BIT(5) +#define OV9282_OUTPUT_ENABLE6_STROBE BIT(3) +#define OV9282_OUTPUT_ENABLE6_ILPWM BIT(2) +#define OV9282_OUTPUT_ENABLE6_VSYNC BIT(1) + /* Exposure control */ #define OV9282_REG_EXPOSURE 0x3500 #define OV9282_EXPOSURE_MIN 1 @@ -213,9 +236,9 @@ static const struct ov9282_reg common_regs[] =3D { {0x0302, 0x32}, {0x030e, 0x02}, {0x3001, 0x00}, - {0x3004, 0x00}, - {0x3005, 0x00}, - {0x3006, 0x04}, + {OV9282_REG_OUTPUT_ENABLE4, 0x00}, + {OV9282_REG_OUTPUT_ENABLE5, 0x00}, + {OV9282_REG_OUTPUT_ENABLE6, OV9282_OUTPUT_ENABLE6_ILPWM}, {0x3011, 0x0a}, {0x3013, 0x18}, {0x301c, 0xf0}, --=20 2.47.2 From nobody Sat Feb 7 17:20:44 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8262A2D028F; Tue, 29 Apr 2025 12:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; cv=none; b=EeaVyNGRIMesEwclAAVG71PiXi91/t+o9X1+WJOG7nhkOS15nlm3PheaX96muIU/vmuKrZVjjFuZlpY6/pEDFgnOr4YftyC1bDT8Qqe64k6fiFyZHBz6ue6roEROdkrMytH9+/7+VW0AsELzO3r3B4+hKjy62grFBeF3m+n0A7Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; c=relaxed/simple; bh=oKJQ5VQHM2+qB3rpr3DelVSUTCUoAL8/eslJyAU327k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dHmN0aDYZT6sUwSSih36QE1+8rYFFrXzXKCvVqqwkt22RRek9avkXYgCDz6xzD2mQL8OvpZN78McIhrBRWFz5bgy+vSfbojSn+agxsKWMEh7bpx+r49eWY9iQ9hQK0I0QYr+tgkFS48tKDAFX4S5PKI8/5fjX81fU1VsBfHicWA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=i4K3eaSC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="i4K3eaSC" Received: by smtp.kernel.org (Postfix) with ESMTPS id 9A37EC4AF12; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1745931556; bh=oKJQ5VQHM2+qB3rpr3DelVSUTCUoAL8/eslJyAU327k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=i4K3eaSCoj9FV2GxMWIu7ZTA+1pdh03nxRZ6eGg6EPpsmG2YyMzt21lkgejwLgRUi 1Se4IF5jPHYWxnLkfxi+KxfbajH8onpuIrbLONULdldQ99llMOo0CSdZgrNMVYwFSK hEY2zIj5afWwbavdE8wvT5mOW7venQR597y4K4Xw= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C7F0C3ABAD; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) From: Richard Leitner Date: Tue, 29 Apr 2025 14:59:12 +0200 Subject: [PATCH v3 7/9] media: i2c: ov9282: add led_mode v4l2 control 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: quoted-printable Message-Id: <20250429-ov9282-flash-strobe-v3-7-2105ce179952@linux.dev> References: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> In-Reply-To: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> To: Sakari Ailus , Dave Stevenson , Mauro Carvalho Chehab , Lee Jones , Pavel Machek , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Richard Leitner X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745931554; l=2413; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=oKJQ5VQHM2+qB3rpr3DelVSUTCUoAL8/eslJyAU327k=; b=+5DoyV1QefEA1U/nkQQXrTqv+FLOFWDHcGLE4vhcXa2hD/d1A4QcRcx2LJecpRpwAPgZUBOPq ulk64EqLwZxCy/Z3RVJz72IjxQbZGQyAPDTMVWUNxsJaZoiV9HlYHuT X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Add V4L2_CID_FLASH_LED_MODE support using the "strobe output enable" feature of the sensor. This implements following modes: - V4L2_FLASH_LED_MODE_NONE, which disables the strobe output - V4L2_FLASH_LED_MODE_FLASH, which enables the strobe output All values are based on the OV9281 datasheet v1.53 (january 2019) and tested using an ov9281 VisionComponents module. Signed-off-by: Richard Leitner --- drivers/media/i2c/ov9282.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index f42e0d439753e74d14e3a3592029e48f49234927..35edbe1e0efb61a0e03da0ed817= c4c4ec0ae9c35 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -670,6 +670,23 @@ static int ov9282_set_ctrl_vflip(struct ov9282 *ov9282= , int value) current_val); } =20 +static int ov9282_set_ctrl_flash_led_mode(struct ov9282 *ov9282, int mode) +{ + u32 current_val; + int ret =3D ov9282_read_reg(ov9282, OV9282_REG_OUTPUT_ENABLE6, 1, + ¤t_val); + if (ret) + return ret; + + if (mode =3D=3D V4L2_FLASH_LED_MODE_FLASH) + current_val |=3D OV9282_OUTPUT_ENABLE6_STROBE; + else + current_val &=3D ~OV9282_OUTPUT_ENABLE6_STROBE; + + return ov9282_write_reg(ov9282, OV9282_REG_OUTPUT_ENABLE6, 1, + current_val); +} + /** * ov9282_set_ctrl() - Set subdevice control * @ctrl: pointer to v4l2_ctrl structure @@ -736,6 +753,9 @@ static int ov9282_set_ctrl(struct v4l2_ctrl *ctrl) ret =3D ov9282_write_reg(ov9282, OV9282_REG_TIMING_HTS, 2, (ctrl->val + ov9282->cur_mode->width) >> 1); break; + case V4L2_CID_FLASH_LED_MODE: + ret =3D ov9282_set_ctrl_flash_led_mode(ov9282, ctrl->val); + break; default: dev_err(ov9282->dev, "Invalid control %d", ctrl->id); ret =3D -EINVAL; @@ -1391,6 +1411,13 @@ static int ov9282_init_controls(struct ov9282 *ov928= 2) OV9282_TIMING_HTS_MAX - mode->width, 1, hblank_min); =20 + /* Flash/Strobe controls */ + v4l2_ctrl_new_std_menu(ctrl_hdlr, &ov9282_ctrl_ops, + V4L2_CID_FLASH_LED_MODE, + V4L2_FLASH_LED_MODE_TORCH, + (1 << V4L2_FLASH_LED_MODE_TORCH), + V4L2_FLASH_LED_MODE_NONE); + ret =3D v4l2_fwnode_device_parse(ov9282->dev, &props); if (!ret) { /* Failure sets ctrl_hdlr->error, which we check afterwards anyway */ --=20 2.47.2 From nobody Sat Feb 7 17:20:44 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 827152D029A; Tue, 29 Apr 2025 12:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; cv=none; b=QSbDMfSqMFfN68DKfwGv0uVTgMxaCtLGSFoSSPi0VQw9xLYPgk+xtD20Xnbicr/lsFomiBl48BgySG4nRit04ZLNisFzWtpDG/AdCJfyoyw54HcZMVhiwyE12B8BbU6Jv6NxAf+6+BIkdLIbttgGs30E8RltCsQGgP9Gx/txhDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; c=relaxed/simple; bh=KqwmKaB6GKLqmk1IDrdd2LBBIit07TUTil2D5DQEQVI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V4oAQI8/RB112qbvuuoQ3A/3tufKGXdPtbbLcHFzbi0rwDMhJl1pTcZ7I2bOY/hL0WHi+9BRhHm2kUyTSYS+vTPV1AR71mKziFHHccLT0vhzVvepYzks2W88iclF1dNDiIVSOVRU/UNGfkxbt559nAvFMuqQquBQBHZv38sww+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=zfSbCkQD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="zfSbCkQD" Received: by smtp.kernel.org (Postfix) with ESMTPS id B6A95C4CEFA; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1745931556; bh=KqwmKaB6GKLqmk1IDrdd2LBBIit07TUTil2D5DQEQVI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=zfSbCkQDRcCYWLTrAwEhYaRjSBSyhPO4R+tVKpqS/zZSJy8YVhPoEyelYvExXWdH+ AqmWkcBjA+Son8uu+NIfsqcYUYJPyJEcUECN3IhRI5uk1e4bZoHfvlzU6rPNyeS8+E AZS2CYA2r14Nzfpy3f8BYv8ugIz6bUu0n0naZrsQ= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98FC5C3ABB0; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) From: Richard Leitner Date: Tue, 29 Apr 2025 14:59:13 +0200 Subject: [PATCH v3 8/9] media: i2c: ov9282: add strobe_duration v4l2 control 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: quoted-printable Message-Id: <20250429-ov9282-flash-strobe-v3-8-2105ce179952@linux.dev> References: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> In-Reply-To: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> To: Sakari Ailus , Dave Stevenson , Mauro Carvalho Chehab , Lee Jones , Pavel Machek , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Richard Leitner X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745931554; l=3208; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=KqwmKaB6GKLqmk1IDrdd2LBBIit07TUTil2D5DQEQVI=; b=FPmrvZuqGWuVMzpzlDHRfMya1Rx5xlnOKZO9TUkY8yuQ9qHSX6Km1Qq3IAio8yucC5An7IwOk FejJiYmDfRRBagxQqj9gs7nihjc7S2m7SG09xoFc9TV/bIMCTc1hDXa X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Add V4L2_CID_FLASH_DURATION support using the "strobe_frame_span" feature of the sensor. This is implemented by transforming the given =C2=B5s value by an interpolated formula to a "span step width" value and writing it to register PWM_CTRL_25, PWM_CTRL_26, PWM_CTRL_27, PWM_CTRL_28 (0x3925, 0x3926, 0x3927, 0x3928). The maximum control value is set to the period of the current default framerate. All register values are based on the OV9281 datasheet v1.53 (jan 2019) and tested using an ov9281 VisionComponents module. Signed-off-by: Richard Leitner --- drivers/media/i2c/ov9282.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 35edbe1e0efb61a0e03da0ed817c4c4ec0ae9c35..5ddbfc51586111fbd2e17b739fb= 3d28bfb0aee1e 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -97,6 +97,10 @@ #define OV9282_REG_MIPI_CTRL00 0x4800 #define OV9282_GATED_CLOCK BIT(5) =20 +/* Flash/Strobe control registers */ +#define OV9282_REG_FLASH_DURATION 0x3925 +#define OV9282_FLASH_DURATION_DEFAULT 0x0000001A + /* Input clock rate */ #define OV9282_INCLK_RATE 24000000 =20 @@ -687,6 +691,24 @@ static int ov9282_set_ctrl_flash_led_mode(struct ov928= 2 *ov9282, int mode) current_val); } =20 +static int ov9282_set_ctrl_flash_duration(struct ov9282 *ov9282, int value) +{ + /* Calculate "strobe_frame_span" increments from a given value (=C2=B5s). + * This is quite tricky as "The step width of shift and span is + * programmable under system clock domain.", but it's not documented + * how to program this step width (at least in the datasheet available + * to the author at time of writing). + * The formula below is interpolated from different modes/framerates + * and should work quite well for most settings. + */ + u32 val =3D value * 192 / (ov9282->cur_mode->width + ov9282->hblank_ctrl-= >val); + + ov9282_write_reg(ov9282, OV9282_REG_FLASH_DURATION, 1, (val >> 24) & 0xff= ); + ov9282_write_reg(ov9282, OV9282_REG_FLASH_DURATION + 1, 1, (val >> 16) & = 0xff); + ov9282_write_reg(ov9282, OV9282_REG_FLASH_DURATION + 2, 1, (val >> 8) & 0= xff); + return ov9282_write_reg(ov9282, OV9282_REG_FLASH_DURATION + 3, 1, val & 0= xff); +} + /** * ov9282_set_ctrl() - Set subdevice control * @ctrl: pointer to v4l2_ctrl structure @@ -756,6 +778,9 @@ static int ov9282_set_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_FLASH_LED_MODE: ret =3D ov9282_set_ctrl_flash_led_mode(ov9282, ctrl->val); break; + case V4L2_CID_FLASH_DURATION: + ret =3D ov9282_set_ctrl_flash_duration(ov9282, ctrl->val); + break; default: dev_err(ov9282->dev, "Invalid control %d", ctrl->id); ret =3D -EINVAL; @@ -1418,6 +1443,9 @@ static int ov9282_init_controls(struct ov9282 *ov9282) (1 << V4L2_FLASH_LED_MODE_TORCH), V4L2_FLASH_LED_MODE_NONE); =20 + v4l2_ctrl_new_std(ctrl_hdlr, &ov9282_ctrl_ops, V4L2_CID_FLASH_DURATION, + 0, 13900, 1, 8); + ret =3D v4l2_fwnode_device_parse(ov9282->dev, &props); if (!ret) { /* Failure sets ctrl_hdlr->error, which we check afterwards anyway */ --=20 2.47.2 From nobody Sat Feb 7 17:20:44 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 827E72D1901; Tue, 29 Apr 2025 12:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; cv=none; b=UGmjACTVayfTfgDoFV/rsmS3uvEK3oAXk1krF6YUsC4oWEyhBoAtmz32DpcOUu5xxmOZxc5+JLQ7p9if2nfpvceTBzGb73clF39dhHaJZmLg+5IlAI3ZCkg7ziSqzj5FhV5BI1q+cuG/vyCtQxh9FiWtZinWfDkkPmJuxs86l8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745931557; c=relaxed/simple; bh=XEA7eOKnFQPnS5jigwSOQXrETAAO0hBpVmtM8cu5xnQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RhTQl7y8x+TUAeH6UytlT3HqbeJKugBwT8h1iVXBoG1/7Ifvy8DF/u0sPrbQP4gv7tD6IA+0/R537VVf2QBspOiO+01fz/rWozmTQ49GyYKiiybMaUbReqPPzEzKlHTSs/phw7uZewFHHeAiTimxxcv5UgF1DpI5gpttA17uJfI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=H5axyzlz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="H5axyzlz" Received: by smtp.kernel.org (Postfix) with ESMTPS id C1254C2BC9E; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1745931556; bh=XEA7eOKnFQPnS5jigwSOQXrETAAO0hBpVmtM8cu5xnQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=H5axyzlzhcx9TtD2sC3uKQcmAWsDcx2DxglLDHqdqr8XZVcQRDPGHtEnTGR+3MACi 0EuplDnN6ZYfiuoYFdl+E0eRQG8XliK2TBVP0nB0SCgBn9zRhYUWpa5fu71jr6BTgZ /5LueXIpzQpKcMnMM2Q3n/PLvslSYhxkPAXtU9Hk= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6B9EC3ABB5; Tue, 29 Apr 2025 12:59:16 +0000 (UTC) From: Richard Leitner Date: Tue, 29 Apr 2025 14:59:14 +0200 Subject: [PATCH v3 9/9] media: i2c: ov9282: add strobe_source v4l2 control 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: quoted-printable Message-Id: <20250429-ov9282-flash-strobe-v3-9-2105ce179952@linux.dev> References: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> In-Reply-To: <20250429-ov9282-flash-strobe-v3-0-2105ce179952@linux.dev> To: Sakari Ailus , Dave Stevenson , Mauro Carvalho Chehab , Lee Jones , Pavel Machek , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Richard Leitner X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1745931554; l=1520; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=XEA7eOKnFQPnS5jigwSOQXrETAAO0hBpVmtM8cu5xnQ=; b=G943Q5rMrjMVhETxHQsNfxhFguRPkjvBIpdTCRSMAOGxjlQcMv3+Boxr4o2GjWUhOBi9+5JZ6 Ltei845X9whB6qJ45gzW850L1g4sbaFIqm312RqHYxMIOgZdS6cl8hf X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Add read-only V4L2_CID_FLASH_STROBE_SOURCE control. Its value is fixed to V4L2_FLASH_STROBE_SOURCE_EXTERNAL as the camera sensor triggers the strobe based on its register settings. Signed-off-by: Richard Leitner --- drivers/media/i2c/ov9282.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 5ddbfc51586111fbd2e17b739fb3d28bfb0aee1e..34ea903a18dadeeebd497a4a885= 8abf12b598717 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -1367,6 +1367,7 @@ static int ov9282_init_controls(struct ov9282 *ov9282) struct v4l2_ctrl_handler *ctrl_hdlr =3D &ov9282->ctrl_handler; const struct ov9282_mode *mode =3D ov9282->cur_mode; struct v4l2_fwnode_device_properties props; + struct v4l2_ctrl *ctrl; u32 hblank_min; u32 lpfr; int ret; @@ -1446,6 +1447,13 @@ static int ov9282_init_controls(struct ov9282 *ov928= 2) v4l2_ctrl_new_std(ctrl_hdlr, &ov9282_ctrl_ops, V4L2_CID_FLASH_DURATION, 0, 13900, 1, 8); =20 + ctrl =3D v4l2_ctrl_new_std_menu(ctrl_hdlr, &ov9282_ctrl_ops, + V4L2_CID_FLASH_STROBE_SOURCE, + V4L2_FLASH_STROBE_SOURCE_EXTERNAL, + ~(1 << V4L2_FLASH_STROBE_SOURCE_EXTERNAL), + V4L2_FLASH_STROBE_SOURCE_EXTERNAL); + ctrl->flags |=3D V4L2_CTRL_FLAG_READ_ONLY; + ret =3D v4l2_fwnode_device_parse(ov9282->dev, &props); if (!ret) { /* Failure sets ctrl_hdlr->error, which we check afterwards anyway */ --=20 2.47.2