From patchwork Mon Nov 27 13:51:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 170140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3126287vqx; Mon, 27 Nov 2023 05:52:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNbR1sruFtQ9VYw/eGihDlfveoHNy3zqk40iAZLnr4Jh67ja+2mLB/LleTzuCdKll0rhbY X-Received: by 2002:a05:6a20:1614:b0:18b:f108:1595 with SMTP id l20-20020a056a20161400b0018bf1081595mr10588037pzj.53.1701093140654; Mon, 27 Nov 2023 05:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701093140; cv=none; d=google.com; s=arc-20160816; b=vNFFfaDdfoQHr0AKMTBK5Dm+xUnkH/1LNXajqHpp84Glmzow3yNKRY9EVtdQEoknWT GtybWtu3ovOe4ziA5h/LG6ffLpeiq5jk9sdprXScLm8SEIQCbKRErNImX6r/YeN3tHQ7 dTjlYXkv6DxkrhMYxpfouovwytS91gwMb9uomSWwfSzVNm919FIZ+jEjWiBdKg7/0UYL gh1m37Mgfi0b0Pr6yPCa0VZtM2rCsmQ/NFHRsV0iAifKNs/6EeBFXOiSKteGDfezSU// DJ5/ifYdBtoP+sP+8xA1Y1A72AFyy024BizV5tcepT2u+bMWN+XENHjUbrxbV6C8CmOb Ztxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O6LQdEvr7zQdDLFNs7fkq2PhCVX3l1VU2E90N6NZ87c=; fh=dvibKmYX+cOuI4ubVSvWtbpQ4kX7ETIy6lxhA5g/FmM=; b=jDjt9xekEOrTcTDBuZjNVqkWhv6jyJKV/pyCqB+scfpF919Vj79+VgCQ9x1Hvt2+AV 93BUZK8pRL3VkbECDWVDoShS/2UAQ7/bHxBA3YWR7egbnoEhLP6wWdhSrZn+F5ZYkYlb mFMbQ3rCiWpC9itfQH0uHi4BuWPmIUqyi5fw7TbXlP2k+nh0AEfa7VK/sPVGAxLi4sV7 xsrDWz6GyvYQvOyZvRY9cyyVTUH3PSPOK7cnhiIj64VChtkk6Eu5pz9TkdT9O249GmEd VWMIS5z7vzslM062yFQye5ecLJ9bFBWGHp0/LcaUXmlpzt8VuaHRm6LjLPrUlfrFaK/r 51vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=kZNt9EsU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id d4-20020a056a0010c400b0069026254582si9901794pfu.98.2023.11.27.05.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 05:52:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=kZNt9EsU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 47D94807D6B1; Mon, 27 Nov 2023 05:52:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233167AbjK0Nv4 (ORCPT + 99 others); Mon, 27 Nov 2023 08:51:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233160AbjK0Nvv (ORCPT ); Mon, 27 Nov 2023 08:51:51 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12778131; Mon, 27 Nov 2023 05:51:57 -0800 (PST) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3ARDVR9d017714; Mon, 27 Nov 2023 14:51:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=O6LQdEvr7zQdDLFNs7fkq2PhCVX3l1VU2E90N6NZ87c=; b=kZ Nt9EsUWJSN2qQaL2b79aIbZ0zJY/iRqHmt9JYFn2viTzAHHK6dKPwDtSbbKJP/3I JZb6TJMkUdB9aKW+1OE7Myh+NyhDc9HrBI4RJ8QDWAhmla/f2uYEJ7R44D9pwjrE KusZ8IbXMqzAi1zC/0KHZvyiDOrHcxGWlFdce4WAMAsAhmxtcU1QE5c/EpA3A5yq SIkQ+CamNg+4xX4+fpbFg+2ccNpnAYkS0xb6WOcN2I5FBb6XWWDQWSqlLP67GJLB H7NQiOb2VPuRldpeHXW831OmO8ygwFe2SzeghIOPxm3qC3YbRCcdSjTQqVHPsw09 MDgUZhHY2IhP86xGMiGA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uk77kr5cf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 14:51:49 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2E55310002A; Mon, 27 Nov 2023 14:51:49 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 25DE92291B9; Mon, 27 Nov 2023 14:51:49 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 27 Nov 2023 14:51:48 +0100 From: Alain Volmat To: Sakari Ailus , Benjamin Mugnier , Sylvain Petinot , Mauro Carvalho Chehab CC: Alain Volmat , , Subject: [PATCH v2 1/2] media: i2c: st-vgxy61: Add V4L2_SUBDEV_FL_HAS_EVENTS and subscribe hooks Date: Mon, 27 Nov 2023 14:51:11 +0100 Message-ID: <20231127135113.1424113-2-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231127135113.1424113-1-alain.volmat@foss.st.com> References: <20231127135113.1424113-1-alain.volmat@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-27_11,2023-11-27_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 27 Nov 2023 05:52:11 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783725441263573468 X-GMAIL-MSGID: 1783725441263573468 Any V4L2 subdevice that implements controls and declares V4L2_SUBDEV_FL_HAS_DEVNODE should also declare V4L2_SUBDEV_FL_HAS_EVENTS and implement subscribe_event and unsubscribe_event hooks. With that done, v4l2-compliance testing is now ok. Signed-off-by: Alain Volmat --- drivers/media/i2c/st-vgxy61.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/st-vgxy61.c b/drivers/media/i2c/st-vgxy61.c index 98d8975dcd67..c85fd580dcf4 100644 --- a/drivers/media/i2c/st-vgxy61.c +++ b/drivers/media/i2c/st-vgxy61.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -1464,6 +1465,11 @@ static int vgxy61_init_controls(struct vgxy61_dev *sensor) return ret; } +static const struct v4l2_subdev_core_ops vgxy61_core_ops = { + .subscribe_event = v4l2_ctrl_subdev_subscribe_event, + .unsubscribe_event = v4l2_event_subdev_unsubscribe, +}; + static const struct v4l2_subdev_video_ops vgxy61_video_ops = { .s_stream = vgxy61_s_stream, }; @@ -1477,6 +1483,7 @@ static const struct v4l2_subdev_pad_ops vgxy61_pad_ops = { }; static const struct v4l2_subdev_ops vgxy61_subdev_ops = { + .core = &vgxy61_core_ops, .video = &vgxy61_video_ops, .pad = &vgxy61_pad_ops, }; @@ -1846,7 +1853,8 @@ static int vgxy61_probe(struct i2c_client *client) v4l2_i2c_subdev_init(&sensor->sd, client, &vgxy61_subdev_ops); sensor->sd.internal_ops = &vgxy61_internal_ops; - sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; + sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | + V4L2_SUBDEV_FL_HAS_EVENTS; sensor->pad.flags = MEDIA_PAD_FL_SOURCE; sensor->sd.entity.ops = &vgxy61_subdev_entity_ops; sensor->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; From patchwork Mon Nov 27 13:51:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 170141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3126345vqx; Mon, 27 Nov 2023 05:52:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrDptp4x/o4sMEmh3wqJyLKJbgge55WB3TIIJxPkjRlhyrtJNpncwjQLiodF0MT0X0IkwG X-Received: by 2002:a17:90b:384a:b0:285:adbb:6ead with SMTP id nl10-20020a17090b384a00b00285adbb6eadmr8199922pjb.0.1701093145373; Mon, 27 Nov 2023 05:52:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701093145; cv=none; d=google.com; s=arc-20160816; b=oaHsT1jIR5OJCJsEN6wCSQwpUuaeHsEQQsL6Ep4cXVfK05zDfuCIDCWAkn/RfFylIv e9Q8i0K8kP9611zHw+OpYWTUNDzVG5tJVwwvy0GkN8DSJuYKFK2tz1TcRbhp0h8IOTfM Ev3POcJocFmMIaEmcz4ceoCuhirELf88ypSWYEy1nZ090txdKcdoLO14ilSqYTbkJeS7 Mye2vXaAtvOWxtrLqusGBziGyDQpvNHyJ6uj/coh4uKXzzNIrHyRaAV3jDpOCNVL0FR0 JkhfLBi8VhxTKrfXqYaaknf0qcmAL2kVDSFQ3AtB/2cEltA1x1b1vqEM1SA+VrXHhtRV SzAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xIN3FObmPABZ+ND/0Xa0Lyv0VrrGo4Q4SqRF8xhoZvI=; fh=dvibKmYX+cOuI4ubVSvWtbpQ4kX7ETIy6lxhA5g/FmM=; b=qoFoeJkzYpsl2PBtuPzBjT/wybS9NhGK+zo1l9nVAAwzjUkKsIVsHWcCck49vVYLo3 ZdvtxTspVzi7WtOxdJweS410i0jkFmTx/k/aWMyHV5mo/+umvauYqISpvvTJtqTOgChw /zEBjFACRgE1S/mHPf9/5qzaJfBjBVSPbYFwhNBWfGUWh8xMsA+sw3FhR9Ibz8Z5JoYn Qg0jrAOFW3A38wKMyqvpnlmZ15hFTG0VBpTEDDsH2xZ1wBqwSX7eggtMnuziiG8RJ/Qf ytbmuZebsTQCZDcXxwRVpeZlm2LXfInTvMXUIRk/rxD3mxMiWIlAOz+6otluX7Hk1kS5 HAfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=NIfE1I78; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id c7-20020a17090a8d0700b00283a18d5662si9891716pjo.80.2023.11.27.05.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 05:52:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=NIfE1I78; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 87D628095662; Mon, 27 Nov 2023 05:52:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233204AbjK0Nv7 (ORCPT + 99 others); Mon, 27 Nov 2023 08:51:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233190AbjK0Nvy (ORCPT ); Mon, 27 Nov 2023 08:51:54 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1716F191; Mon, 27 Nov 2023 05:51:59 -0800 (PST) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3ARDAPwO026752; Mon, 27 Nov 2023 14:51:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=xIN3FObmPABZ+ND/0Xa0Lyv0VrrGo4Q4SqRF8xhoZvI=; b=NI fE1I78/zxnAnmH2yZ4H/B7qNVf+s1j0TdBml/4V1r8JJM5y6ZTbtpKLLxOz5PFmW tmRS035vU5lbVGQtBz9Xsx3ELfMPzf8xbt1THD+dTDCCkcizylCLR0I9OVLGc+8K 5GzfLfdJDJQgLNhxvqXojTI/q8MkcAx1wCjgkVpzUPD5ueBRMfGmcSs7mAjrHE9/ s34/kCehFqZ3qmwMrgjDN9gKwN28uMor2Q1d2Cvn7n6NM4JzfpjNJJUneE3SkUn7 B+npPxNp6BS+PCBVPtHOQcDB8OcRNqABC8ujKK1UOllUPy7RLFizl7y93W+r0USX YgDzT7Ks5QenX1MrL8Pg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uk77kr5cj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 14:51:52 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BDDB510004B; Mon, 27 Nov 2023 14:51:51 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id B63DF2291BB; Mon, 27 Nov 2023 14:51:51 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 27 Nov 2023 14:51:51 +0100 From: Alain Volmat To: Sakari Ailus , Benjamin Mugnier , Sylvain Petinot , Mauro Carvalho Chehab CC: Alain Volmat , , Subject: [PATCH v2 2/2] media: i2c: st-vgxy61: add v4l2_fwnode ctrls parse and addition Date: Mon, 27 Nov 2023 14:51:12 +0100 Message-ID: <20231127135113.1424113-3-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231127135113.1424113-1-alain.volmat@foss.st.com> References: <20231127135113.1424113-1-alain.volmat@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-27_11,2023-11-27_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 27 Nov 2023 05:52:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783725445933918629 X-GMAIL-MSGID: 1783725445933918629 Allow parsing of the v4l2_fwnode properties from the DT and addition of those properties (such as orientation, rotation). Signed-off-by: Alain Volmat --- drivers/media/i2c/st-vgxy61.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/i2c/st-vgxy61.c b/drivers/media/i2c/st-vgxy61.c index c85fd580dcf4..e4d37a197724 100644 --- a/drivers/media/i2c/st-vgxy61.c +++ b/drivers/media/i2c/st-vgxy61.c @@ -1403,6 +1403,7 @@ static int vgxy61_init_controls(struct vgxy61_dev *sensor) const struct v4l2_ctrl_ops *ops = &vgxy61_ctrl_ops; struct v4l2_ctrl_handler *hdl = &sensor->ctrl_handler; const struct vgxy61_mode_info *cur_mode = sensor->current_mode; + struct v4l2_fwnode_device_properties props; struct v4l2_ctrl *ctrl; int ret; @@ -1457,6 +1458,14 @@ static int vgxy61_init_controls(struct vgxy61_dev *sensor) goto free_ctrls; } + ret = v4l2_fwnode_device_parse(&sensor->i2c_client->dev, &props); + if (ret) + goto free_ctrls; + + ret = v4l2_ctrl_new_fwnode_properties(hdl, ops, &props); + if (ret) + goto free_ctrls; + sensor->sd.ctrl_handler = hdl; return 0;