From patchwork Sat Nov 25 17:46:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 169760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2074914vqx; Sat, 25 Nov 2023 09:46:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvuygT0jKUrAa6+nnZqsLsDoiMfDBCp30qXlV6OfesJUkXGn+wi+mh4WU8sonVpSXOTKdq X-Received: by 2002:a17:902:bb8c:b0:1cc:5ed4:7b4c with SMTP id m12-20020a170902bb8c00b001cc5ed47b4cmr6407422pls.35.1700934419703; Sat, 25 Nov 2023 09:46:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700934419; cv=none; d=google.com; s=arc-20160816; b=j2BGA78h+p8MhztlYQVj2wIx7Q/m8HT8k7/m248HWpwu56cPtJtRy7IeyzcQ8c/v+L Lmwlg9VHk+4zTLhdRnzxNq/EXs/JJ6jbsyyxFyvgPKwjFnPTGWXCRz7yM/Ywx6h5l/9e +lFAAY2r9ZcMNpypW9zoX0WFg31b0fS59hQl9mvbvP+qCZnho3+tOpNhDS5Z9Z0GRu76 d+O26V45EHj3UeLpP3AH6iUuQ0rZb7wDinCaa0ZSoU/gf4ZOwYNA6Dd5efGOetLDP1SY mkIn1cndl46s6h5OpcawMn1ChS1c/MQwn2iVRL6zGf++CkqvDUSOBU9eQkyN78CrVKVc A+Ew== 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=aTLsz+wArGB0INGdqAhMbgooD9eHhtJadYBh6bt/xeM=; fh=dvibKmYX+cOuI4ubVSvWtbpQ4kX7ETIy6lxhA5g/FmM=; b=N2FD45fAIgtbGLevZ4RiANflR2WLRBYhj3Yd8boW8mCqwnh3/KeLVVYVGiJEba/5rq foGGv5pR2u2y9Fmguqs0kEAbI+4sdrMQdjks7XzxPdTqU4llzK1a095FszMT0M9Spok7 AuVhvKjUHw6/Qq1GBxI/qg567Yrgfnpk2taGgA++xawYpAe1yiRkzvnThRravJpZ9zIv V+TE42kpfuwBCT+wI8S2vf0MXrC/itID+2K82swX7FU4MDE8PkPDRBqUWejJ+BlVHTlX k234LV/x0tp6E5BiWcx2Jpzt3r1qHK98ec9ffQ+Nekxbojtliow2mpK9s8jgSWoZsAVH +uZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=TJlK21z4; 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 u7-20020a17090341c700b001c73626a1ffsi6323728ple.412.2023.11.25.09.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 09:46:59 -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=TJlK21z4; 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 BCB86804C672; Sat, 25 Nov 2023 09:46:55 -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 S231697AbjKYRqj (ORCPT + 99 others); Sat, 25 Nov 2023 12:46:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbjKYRqh (ORCPT ); Sat, 25 Nov 2023 12:46:37 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B9C2FE; Sat, 25 Nov 2023 09:46:43 -0800 (PST) Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3APGHDVw019482; Sat, 25 Nov 2023 18:46:34 +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=aTLsz+wArGB0INGdqAhMbgooD9eHhtJadYBh6bt/xeM=; b=TJ lK21z42kW2RkyqqKs6FV2Z6AWnZCVyHD7krqZbm3qfX3/rO+N3MMVHnWl28GEJEe GEXlssB3rtlt3wu1YsA1PuXqDUyWF2o2YNt7vsp37gDOODFRvPkOptl3+ZsXGzVA jAEf/hf86mD+eKSz7peVjz7tEo5rnAVAPmQHejekD2r1aGHf/j7JIajCuZ81YEWi EzZhDPrgMgtIOFdA6V8GqxRuwrLmfPgevTH0nI8eoj4s/4YV5+Z/srw4UK+Ky39G vNRxc4FIUweZ/6v+mH3Nc6ULdB7/nc4oTGYOqUm7nCTisvTw+eeoCsCknhefWpP/ 9zGESZsdY1ARKeYGUUrQ== 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 3uhr8amubm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 18:46:34 +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 4C1B110002A; Sat, 25 Nov 2023 18:46:34 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 4378E23695B; Sat, 25 Nov 2023 18:46:34 +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; Sat, 25 Nov 2023 18:46:34 +0100 From: Alain Volmat To: Sakari Ailus , Benjamin Mugnier , Sylvain Petinot , Mauro Carvalho Chehab CC: Alain Volmat , , Subject: [PATCH 1/2] media: i2c: st-vgxy61: Add V4L2_SUBDEV_FL_HAS_EVENTS and subscribe hooks Date: Sat, 25 Nov 2023 18:46:02 +0100 Message-ID: <20231125174604.1378485-2-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231125174604.1378485-1-alain.volmat@foss.st.com> References: <20231125174604.1378485-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-25_17,2023-11-22_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]); Sat, 25 Nov 2023 09:46:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783559010334892020 X-GMAIL-MSGID: 1783559010334892020 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 507cd9661e9d..93885ed167cb 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, }; @@ -1478,6 +1484,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, }; @@ -1842,7 +1849,8 @@ static int vgxy61_probe(struct i2c_client *client) device_property_read_bool(dev, "st,strobe-gpios-polarity"); v4l2_i2c_subdev_init(&sensor->sd, client, &vgxy61_subdev_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 Sat Nov 25 17:46:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 169761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2075028vqx; Sat, 25 Nov 2023 09:47:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtQPgCP22Oy/D98r2thL6T+JAmfRAqifyTt2GCy2+lrCfSGqM4mODH15E30ZIi0to15iFw X-Received: by 2002:a17:902:efd4:b0:1cf:b547:19f1 with SMTP id ja20-20020a170902efd400b001cfb54719f1mr1799720plb.43.1700934431915; Sat, 25 Nov 2023 09:47:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700934431; cv=none; d=google.com; s=arc-20160816; b=hPv1wch4kzp7jMZQeAJlyFXVgW1yUi7ZzUGwzt5mBdlLzn/+fMe8bc8Qj7XW1FU5LY XlkkFGSIauhTLn9v+J9OjPdn4rZkXysuOQeOA5jN+HFcng4pkTWMIhtXqYU9AizoDJKX zki1HLKoHf390m1Q3YsBIfErsBodrq4NbuuBkC8WWmf57DpFgznNN+Y5291DCgeSCyTR rm61wTw7Z7Y4JqFmpvEBTOedCB/MNwIGHcNsSNnb+6vEjsS4Sc5t8+7FcewvoqScSCRr BVZ7LKCxyBnf+IEOLkDzWSERYgTREtxtLLATZF1Tjh1PouL043UBY+4ed/9ofFRa+B/i 1kFw== 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=YgwDhWRiHXXOSB0ComoQD4DlrpUixDI/UziY9MZKeIM=; fh=BxHfF2UDrFCvfdViTfHf9aSnaVPPddZPsK97tb04y2I=; b=D1K+iNcGtfKgC/T5phkBmJrQaLhWRSsksIZzVcPHqUlCRNnoe8NeDAaAPf4KkGI613 SnxZTjuysrQD6jb36XdMj/9JrXhJ8k7YXLxTWqucwKIAB3aoATZHCaqqKgCwA/xC1jQ8 /3/UgeXBwOCm7GswpRbXzMzxEdJEpgs05h7JvYh4fsKowfEtaTik+b0pBn90Bd0dDLwB SbnhN6J+DIPHzg3GgznSxqD5ps/+zitysRDJ1fjuivDP9C1tKJUMJzkyf2fgN50unwxQ 44wV+hZt0w2E8sP8nUT20uYWAS5SpKSeDq3VIgg5CiikKFVJ7uCLn4u+iyBYwMwjW2Xs iDYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=xcCp3+kL; 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 n17-20020a170903111100b001c0a165a219si6462931plh.134.2023.11.25.09.47.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 09:47:11 -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=xcCp3+kL; 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 07997804C664; Sat, 25 Nov 2023 09:47:09 -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 S232014AbjKYRqo (ORCPT + 99 others); Sat, 25 Nov 2023 12:46:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbjKYRqm (ORCPT ); Sat, 25 Nov 2023 12:46:42 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 925A6127; Sat, 25 Nov 2023 09:46:48 -0800 (PST) Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AP4ek2x032078; Sat, 25 Nov 2023 18:46:40 +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=YgwDhWRiHXXOSB0ComoQD4DlrpUixDI/UziY9MZKeIM=; b=xc Cp3+kLTmPPl7tn6XXuhabrMKkdZQEf2dgR6/hfBI5jMHJ9R6dQeSuf+96hEUDQk1 Tp0a25tgSoo2rAVcvgH9ixpDYwvAJ2gIBQss3Qlflwz4jDfPVkJs+lstFeekQSi+ W+05Qo/5O+lscQiNqeW/z0JAtPLBTBg51SRBSIjtUkmiS4tSuKafLIJgZBFDcuWe hEnB0myFFg9md6IyhSbJzdn/RpLr/5EjUTg5wV+yQfCA0UjisBe7aUL9Hnj09nTh 6DOUY/PtU6cXXBQrkQav7j9P4qZWGaumRdyoaPKnvfE4c9pUVJBuhQmE4DobkVtk 1yAYaho8Qjls+2H6gvJw== 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 3uhr8amubt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 18:46:40 +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 25E7710002A; Sat, 25 Nov 2023 18:46:40 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1839323695C; Sat, 25 Nov 2023 18:46:40 +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; Sat, 25 Nov 2023 18:46:40 +0100 From: Alain Volmat To: Benjamin Mugnier , Sylvain Petinot , Sakari Ailus , Mauro Carvalho Chehab CC: Alain Volmat , , Subject: [PATCH 2/2] media: i2c: st-vgxy61: add v4l2_fwnode ctrls parse and addition Date: Sat, 25 Nov 2023 18:46:03 +0100 Message-ID: <20231125174604.1378485-3-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231125174604.1378485-1-alain.volmat@foss.st.com> References: <20231125174604.1378485-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-25_17,2023-11-22_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]); Sat, 25 Nov 2023 09:47:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783559022768690523 X-GMAIL-MSGID: 1783559022768690523 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 93885ed167cb..d27a1bf7690a 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;