From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796058441; b=a5KR+ZX2j4N2mr4GcojCGncwLOdnxVKJw13tOSI4LMHm0dZ57F3crznfvFC6UMX9I5qH ztl9uYbayPJcKbqCE2WhEwifIh+Vf3108VJ8myztmm/iH+nRf5D69ADCf6e1DnkzHdpGv C1mA+IMZFYXxckQ5OiG+keRZsiX1doEU0Q9/KI49daMd6bD3SLy0RpeZRXwB7LFe/g9aM BqFbH+LRLfzkW2rML04OUjUOosaWL6OjstUD8f/MebOvq8G5065aCagbmu8FiTKAV+Qoc LUJMOBXdNzm6lYEv05qCq4ckoKwf54bSslS/iEOn05sTARhBt6RZLQ2qx+h6MzvcdjQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796058441; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Message-ID: Date:MIME-Version:User-Agent:From:Subject:To:Cc:References: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Spam-Info:X-Proofpoint-GUID:X-Authority-Analysis: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=3YWgWJIeiQBE1IfyC0qXNm9nrev5TfAzCI3nBZ28EF4=; b=vFgbdA/Qeky+Wr6UFRYg6viLj6eu/WGzsrTlfTLdCjGifTL7ZwqIM6ve6MNGMIHRqWU4 7jA7ywqC6oivxXlqOlPX8cSV0Ef3cZNU31RApDaHKd7NB3nlUEiXf+FcFjsCOcu1bMGEb oZqVXKGaHZcmZ0mPadNtrSqxhpg7FjZrek61oXR0Bl7BzwgouJpTgQYj+mo1sT/zrohjr 63hVTpU8x/tniDHbBffY3IVVEfkPq19n5zVD2O6gXtYbb9p5kCfIS/6pmZMIHbXjZXzWM LKNYbRIlopi7Nt/rbsoAe9P6XfOWIc/E1n8qs+hZqasQxzqloL3/oVKI86dWxf6IHxw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=TCwJqi4D; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=iuWzaaFG; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD77B606A325 for ; Mon, 30 Nov 2026 17:07:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AD77B606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=TCwJqi4D; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=iuWzaaFG Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AUG8Dvn1251073 for ; Mon, 30 Nov 2026 17:07:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 3YWgWJIeiQBE1IfyC0qXNm9nrev5TfAzCI3nBZ28EF4=; b=TCwJqi4DX7KhMh1Z XPNXFb3lQ0XT58juqw1nPQQ/m+VIv41QVsR2YybMa84OBt786kIFzqaEfPPNe66H VgDE3xF2xhvh9NdKN7cn/5v1r9CJseQZyVM4CouUXeDJNXrI1khGTVPU1dNB3xcK CUb2mHZdyVqHVkUWxtVObe14m8B0GHLapo+VGUvp/K9R5gu8sewRiniL4DPqCKFk 2QtIB7b1prkXxRbQxjv38+oTI+8KtWIOw4g0SfqVxNjfeTfzzcyXiaCZfdEBnY3x 2EHuUFdjxnoGxfzwaWVN3MpMgSG/RfrTGdQMGuH7fU01TfzXuWvmenrMzPE8k/gM wXPpEQ== Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j9cd3g7w4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 30 Nov 2026 17:07:19 +0000 (GMT) Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-71adbbb6b26so11310736eaf.3 for ; Mon, 30 Nov 2026 09:07:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796058439; x=1796663239; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:subject:from:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=3YWgWJIeiQBE1IfyC0qXNm9nrev5TfAzCI3nBZ28EF4=; b=iuWzaaFGcLDRbjt8W7c4DN/dtkeXHUuZxDAUs4f/yEPn63wJADO3A5AR1rYxsvNTQO MCBIwCm0UHwTjknY1eYnaxTWRC6manttIn47XNVuttho37ODXv3+V6r7WupojbkREE31 5IKsv0swAmoS3C/rSUlR4ub9NV76SFtQGEzOHwzklZOgEMKGXraZVzfazfV0rhVUpX1V rufXCsS+q8Wt5VzCSdBKxTXFYH8TpRzC+yjkS8VGrizZiT8EbviXviX2wynnISIpNJFQ vq550RWAbvpqG7fkBFI/Ji+5CuUyvDlV+XQl3/OTY2MVP+sv0ykQDdySPNxm3H1YT/Zu a83w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796058439; x=1796663239; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:subject:from:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3YWgWJIeiQBE1IfyC0qXNm9nrev5TfAzCI3nBZ28EF4=; b=MJSqPBZU5jSQf8MwX/cyjr9EEcBbFd6vbGNchkA/VccsNM0uEMxylGvTcw/1rXopvZ vrBWCFxKqey9zoJQH1XWKcXicC11HDpLUDF54d+Lq3OuWKCOb4TEYBWDjv932L2gBfS3 EbH0suBPU1DvxqoaaXdFPu2zAOkTq4Sm2vXgRV9HIPxE5hVwE7C037zYnA2SzWax5k+Y Bf0PmXjcXjDpDFyjfB7pTuYkqBCgO7HnxqvgHnVzDKatE5Qx14+Nfo6ze6k6ptE+4i0Y z2C04GP692/dRC0GR2E8a9MY2pGJcllbOmW3bk7tgWJVfSPTKUl7DesoFRarWBkqG8dv zALg== X-Forwarded-Encrypted: i=1; AL+hErGUDPFSbAbDel1PK0+TVPIWIo1SpX++4BVq0v6zhSdKqWeRUXB9yy6hgrURANjX4tvCIv6N9p5hy5dDu1M=@vger.kernel.org X-Gm-Message-State: APuU4Z9PLXjlRyP+uhoF6+S+BKBWX25pFDLqbluuibVejFgUPud1YIfD kwd2a2eb1ZT5wwg9M/fyQuOu3PtqWdwUaDpsMbwaSq5v5yeeeioPzIdZ9aTueSRnHmUvxTtcgNz I+dvunawPWpv24QgZtMDScniNU8CgPTmoj27j2BL2OruFUVQBBYRnJ9eYh6cK+1gAPgo= X-Gm-Gg: AZFdTZeCGTCB/oz3ON7KPG+TyevI4g4ulRsNiQeogIoh1a6CQWwCW8bjB7+HMzAii3y FrF979gUvjnu6/NymBzrmEKiMlHfIbAWaTFF2zGG1Dcjdt7PKHX1EdrCu5fU3qMekK+dax8nx1v xqEeUKJreMcvM+X4IUUG/cP77DmKidYvuX1cBvsB49DIg8JI685DbObHZi62dvDXstbCpz+/MRU caCVh++AMmGY0UFEHAj5/dzBLMZ8FCsGFfHH/ZHBXx20y2V7XWOlCUy1QMFobqaeq9XzDAns1Kn fiS86iSuWxvYwZBPQ1nPE4y+bMU3nfd/7DpZxBIP4fib0mqQ9gfxT4ZvaaFITuMkv9xEWnBbJAO h5urUd+el/s94u2oWJ3vNNseiS4g+O1eNtKVZBZc6vNp4RXXv1O+vMhuCoNHlygdVCw3syhn8mf yNMNsxh93TKNt0xaQSbAc12MYVfzULxA4TUP76AkaHrD/YDD4a29/G3mofoRiRhM8G6NBTk6Pkw 8+wpG+hLvW0AcIcQLKkFGbxwtQww8UvrxUMj0IqqjA= X-Received: by 2002:a05:6820:570b:20b0:71a:d8a5:4d1b with SMTP id 006d021491bc7-71b3947aef8mr20312821eaf.36.1796058438636; Mon, 30 Nov 2026 09:07:18 -0800 (PST) X-Received: by 2002:a05:6820:570b:20b0:71a:d8a5:4d1b with SMTP id 006d021491bc7-71b3947aef8mr20312769eaf.36.1796058438073; Mon, 30 Nov 2026 09:07:18 -0800 (PST) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ad00232sm1202372366b.12.2026.11.30.09.07.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2026 09:07:17 -0800 (PST) Message-ID: <4ebba595-7343-4cab-9e78-7aa07535cbbd@oss.qualcomm.com> Date: Mon, 30 Nov 2026 18:07:15 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: johannes.goede@oss.qualcomm.com Subject: Re: [PATCH] media: v4l2-async: link ancillary device runtime PM to the sensor's To: Dave Stevenson , Sakari Ailus Cc: =?UTF-8?Q?C=C3=A9dric_Bellegarde?= , Kieran Bingham , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, Laurent Pinchart , Hans Verkuil References: <20260922-sensors_pm-v1-1-05adf2098b5e@adishatz.org> <179014670130.2497080.16248724869350735374@ping.linuxembedded.co.uk> <7e748fc5-43d1-4200-9ad4-45d43d659e47@adishatz.org> Content-Language: en-US, nl In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: o6Ti4X1y7beyJ083FoZjhm3cjk4q-dEo X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDA2OCBTYWx0ZWRfX26WUl8RN/pED +EjKcw38xl7VbYetDB12D8LsXgWjlC1PlhFzlFgyAglTN53rS/54odP/RaCh2yXzfwYVYWpYMky c3aceek7FcjOYfd/gqZXwtRksyY3ZpVuOHN68NvMIs35EJhIi0ehZI1hRYHthbi3UW4UzV8X6Mb 8CKIMbbj9A0nskM6X5EfBS1mfov2f1k7epbo2uEyrphOmRGynbAuRHRCSU9lt4+NRL2OM+i2g1P NhlqzX/fu08yw8P3kuUBC8BTWtCTj/huVzTMScIOF04kuG7bxH/RHtHuvh1gTt36JXc7kJ2jQ8y oawfXAVhRkEq8qx7TeYPPHP6j7hN1P5bNA4ocWzhGVKEIoNBzjNtnBcwqOXyOk/8QbuBQK7Royb 6WmVTRzy6YXYkXryY6eG3yiUbQ0ft1QTqzf/mUX5fT96QmiEbA7RmqpuUUFU7Q0ldnyMG4PVZxB C0OiLvxOWAYW8xFalHw== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDA2OCBTYWx0ZWRfX2F1F6IFxSr8U SzNmRNHXor5zq/GqQ8aqMo7Yuin6U4bo3aPfqwZC4UgFVr5c9+mIQhTDfn6pyesUt9drK3wiEWt g5U5nfTE2IGQhSlzZeY4C9yTJi57++A= X-Proofpoint-GUID: o6Ti4X1y7beyJ083FoZjhm3cjk4q-dEo X-Authority-Analysis: v=2.4 cv=HIhWhYtv c=1 sm=1 tr=0 ts=6b0dad47 cx=c_pps a=lkkFf9KBb43tY3aOjL++dA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=QyXUC8HyAAAA:8 a=gzZrYUWBj4t7OEho43cA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=k4UEASGLJojhI9HsvVT1:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-30_04,2026-11-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 phishscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611300068 Hi Dave, On 30-Nov-26 17:38, Dave Stevenson wrote: > Hi Sakari and others. > > On Fri, 27 Nov 2026 at 17:33, Sakari Ailus wrote: >> >> Hi Cédric, >> >> On Thu, Nov 26, 2026 at 07:23:32AM +0100, Cédric Bellegarde wrote: >>> Hello, >>> >>> Le 25/09/2026 à 13:15, Sakari Ailus a écrit : >>>> Hi Kieran, >>>> >>>> On Wed, Sep 23, 2026 at 07:58:21AM +0100, Kieran Bingham wrote: >>>>> Quoting Sakari Ailus (2026-09-23 07:34:54) >>>>>> Hi C�dric, >>>>>> >>>>>> On Tue, Sep 22, 2026 at 09:39:12PM +0200, C�dric Bellegarde wrote: >>>>>>> When a sensor's fwnode references an ancillary lens or flash device >>>>>>> (e.g. via the "lens-focus" or "flash-leds" properties), >>>>>>> v4l2_async_create_ancillary_links() already creates a media controller >>>>>>> link between the two entities, but their runtime PM states remain >>>>>>> independent. >>>>>>> >>>>>>> This is a problem for devices such as VCM lens actuators, which are >>>>>>> typically spring-loaded: holding a position away from the spring's >>>>>>> rest point requires continuous power, and the position is not retained >>>>>>> once power is cut. If such an actuator is allowed to runtime-suspend >>>>>>> independently of the sensor, the lens can drift back to its rest >>>>>>> position during an otherwise active capture session. >>>>>>> >>>>>>> Add V4L2_SUBDEV_FL_PM_LINK to allow an ancillary subdevice to request >>>>>>> that its runtime PM state be linked to the associated sensor. >>>>>> >>>>>> Interesting idea. >>>>>> >>>>>> The IPU bridge has created such a device link between the VCM and the >>>>>> sensor as on some ACPI systems the VCM is in fact relying on the power >>>>>> resources of the sensor. But to do this everywhere? >>>>> >>>>> Same on any Raspberry Pi camera module. The VCM is powered by the same >>>>> enable lines as the Sensor there I think which has made things >>>>> interesting in handling VCMs for those devices. >>>> >>>> Yes, this has been an issue in DT for a long time. :-( I'm not sure if this >>>> approach could extend into a solution for that though. > > It was a related issue that I've cheated on downstream. I added a > regulator notifier hook so that if the shared regulator is powered up > then the lens position is restored to the programmed position, so you > can capture in-focus images without worrying about the lens driver > subdev. > If only the lens driver subdev is opened then that will power up the > sensor as well, but normally it'll sit in standby mode until told to > do otherwise over I2C. > > I know it's not acceptable to mainline as I'm relying on there being a > common regulator, but it was a pragmatic solution for those not using > libcamera on the Pi. > > I'd not noticed that libcamera keeps the lens node open, so I guess we > will still get hit by that issue and it'll keep the regulators powered > up but the sensor in standby. > >>>>> >>>>> >>>>>> VCMs traditionally have been powered through opening their sub-device node >>>>>> and that hasn't been exactly neat API-wise. It has been practical still, >>>>>> AFAIK, as in order to control the VCM, you have to have a sub-device node >>>>>> open. >>>>> >>>>> This is an issue though, as libcamera opens the device nodes and holds >>>>> the file descriptor when it has a camera. This means that even if the >>>>> camera isn't streaming, the VCM is powered on and causes power >>>>> consumption on mobile devices which people then attribute to pipewire. >>>> >>>> A practical fix for that could be to set the current to 0 when streaming is >>>> off. >>> >>> For the zero-current route: lens subdevs have no s_stream, so how would the >>> VCM driver learn that streaming stopped? The device link gets this from >> >> libcamera would have to do that. I don't see why it couldn't. > > I'm going to play devil's advocate here. This is still "Video 4 Linux > 2", not "Video for Libcamera 2" (I'm waiting for the proposal of a > name change). > Mandating that the use of a VCM requires using libcamera would be quite a step. > Then again it's libcamera that is keeping the lens driver open and > causing problems in the first place, so fixing it there is likely > valid. > > It's worth noting that devices like DW9817 are bidirectional driver > ICs for +/-100mA drive. So the zero current V4L2_CID_FOCUS_ABSOLUTE > value would be 512 (of 0-1023) and not 0. > Is it better to add a new control to the VCM subdev that gives > userspace a device agnostic zero current power down? The driver can > then take whatever steps to adopt a minimal current state is > appropriate for the particular driver IC (probably with ramping to > avoid "ticks" as lenses hit endstops). Interesting timing on your reply, I just did a top-level reply today in this thread with what hopefully can be a solution which works for everyone: https://lore.kernel.org/linux-media/462ca475-5b95-4804-83b9-15e7040a9997@oss.qualcomm.com/ TL;DR: I believe that the sensor + VCM should be treated as a single entity from a power-management pov, with all power-management controlled by the sensor driver. The idea being that proper sensor drivers already turn the sensor on when streaming and off when they are done streaming and with a runtime-pm link we can simply make the runtime-pm framework turn on the VCM when ever the sensor runtime-resumes. See my reply for some more details. Regards, Hans