From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 C975C17597 for ; Wed, 13 Mar 2024 07:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710314759; cv=none; b=fr5P/e4YmLlB/QmCTSaL1EQEK5wSqseUJOeOln+URmQTOweAsNnTPBiqe+HtmYgdf+haEtNNyqQTv75A/gQFoYJn/lm2SonpEco5zxAQf+S224U9R1NZTuW5jwqPCwFs0J/fMho/mBUX3+wmx9EeaFy7slthGg2UCRBmeecIA3c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710314759; c=relaxed/simple; bh=HxhaggrMAMn2e4e1p9dHIqZU85hrH/quctyHIoPph0o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ps8IPZBph4qAIXD7EnPKgLJo676WV9J6/pKtAPyx/ek5+WcNBU+jBeja+VhtiKqI14muGP29agSgSDlOQJWemll5pbljyIPEwmauhHMS8lW14eV2lt8U1Ye8xib19RhX7Hoqt8PoCsoiGLQYRU9k+f631FI603ug88WettqsoZQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XDTQ0wPh; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XDTQ0wPh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710314758; x=1741850758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HxhaggrMAMn2e4e1p9dHIqZU85hrH/quctyHIoPph0o=; b=XDTQ0wPhiwQe1ivcAUN6lE8xnmR+kdAYyk3Nf/3cqbXN2QusHU7Y+AtE gLOhUIMI1T3m0+ntyQuB3kOAB04xRkvvYKWbYQuC4XG0bdi+PGVGguHUZ W2m1npVCpByvMGlhYHodEKUolmil4HaoGbXpJvwTJRLgpSP1mT3sYygvi ClZKJ+cHlErWovwfa5gGTg5V25+y3ieP1y4lulLsI40wfL3bX6ioDzJJv VkqRnapVFnB4w/xrBDiy/i7M+bbRl9KtzLqeFZ5MPrrcIxBtztnUUiHCV XV2hWzJF1+wNWvEwXS39mOtFwqJF+fN3+/kOhnLSaITR4bQxhQ0iCTUSx g==; X-IronPort-AV: E=McAfee;i="6600,9927,11011"; a="22575598" X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="22575598" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2024 00:25:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="42816434" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2024 00:25:43 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 5027E1203B3; Wed, 13 Mar 2024 09:25:40 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: Laurent Pinchart , tomi.valkeinen@ideasonboard.com, bingbu.cao@intel.com, hongju.wang@intel.com, hverkuil@xs4all.nl, Andrey Konovalov , Jacopo Mondi , Dmitry Perchanov , "Ng, Khai Wen" , Alain Volmat Subject: [PATCH v8 15/38] media: v4l: subdev: Return routes set using S_ROUTING Date: Wed, 13 Mar 2024 09:24:53 +0200 Message-Id: <20240313072516.241106-16-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240313072516.241106-1-sakari.ailus@linux.intel.com> References: <20240313072516.241106-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Return the routes set using S_ROUTING back to the user. Also reflect this in documentation. Signed-off-by: Sakari Ailus --- .../media/v4l/vidioc-subdev-g-routing.rst | 5 +++-- drivers/media/v4l2-core/v4l2-subdev.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst b/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst index 8f9aa83275c5..6eb6a59570dc 100644 --- a/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst +++ b/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst @@ -43,8 +43,9 @@ The routing configuration determines the flows of data inside an entity. Drivers report their current routing tables using the ``VIDIOC_SUBDEV_G_ROUTING`` ioctl and application may enable or disable routes with the ``VIDIOC_SUBDEV_S_ROUTING`` ioctl, by adding or removing routes and -setting or clearing flags of the ``flags`` field of a -struct :c:type:`v4l2_subdev_route`. +setting or clearing flags of the ``flags`` field of a struct +:c:type:`v4l2_subdev_route`. Similarly to ``VIDIOC_SUBDEV_G_ROUTING``, also +``VIDIOC_SUBDEV_S_ROUTING`` returns the routes back to the user. All stream configurations are reset when ``VIDIOC_SUBDEV_S_ROUTING`` is called. This means that the userspace must reconfigure all streams after calling diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 486a5c3016de..a357ce318192 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -957,8 +957,18 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg, krouting.len_routes = routing->len_routes; krouting.routes = routes; - return v4l2_subdev_call(sd, pad, set_routing, state, + rval = v4l2_subdev_call(sd, pad, set_routing, state, routing->which, &krouting); + if (rval < 0) + return rval; + + memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes, + state->routing.routes, + state->routing.num_routes * + sizeof(*state->routing.routes)); + routing->num_routes = state->routing.num_routes; + + return 0; } case VIDIOC_SUBDEV_G_ROUTING: { -- 2.39.2