Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp546159lqd; Wed, 24 Apr 2024 09:39:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkvaz5BGCl58FZulUIoZt6BkRSC11Y5Ni/ik6u76FeQg00zixomup4JInat1zz6jAEn+/GsqQbDbRFTV2G969MXrD/vGZpeczfc6Yrlw== X-Google-Smtp-Source: AGHT+IFidLPN6KYSrIGWtXaWhY3VBPFB+WDYDI4O6DU21ld4Bgxd2oIojBE0M22ROhqOcNXlQOvu X-Received: by 2002:a05:6870:f10c:b0:222:99cb:2215 with SMTP id k12-20020a056870f10c00b0022299cb2215mr3157432oac.28.1713976787727; Wed, 24 Apr 2024 09:39:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713976787; cv=pass; d=google.com; s=arc-20160816; b=xFe8pKPQdP/Mas+OGIP4DPQtra/kixolvRa8+OY6tatL0/Vtwnsi30FA7j2ZdOIzgz +USqLDUau6y41m0XQDRMx1MVxOwAkVjHF2Qfoym/KripEdB8FKNainhEUBvJV+15eD3Y 55wcDNlGJFFN1bfBDqmPY9yvXvC9S52EJwm64PY7JfyRUzKEl/WRRy5uMvejNa6FfHym 2U6etrlZs9VCeCmCGwjwtcFujqL8TcVA0sAUlwcCJmEwaWAFW9lu3xN5t71tKZFXxxF7 W7TlXQ9CC4Xe55raqFg/eLHDZowgoQ56l2/jt2K2G6a0nUsiNAAk4ckE0sPFSx8kE793 zooA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=vXTGtJaF82MopbOcq1RrUkH0PrbzAY+tUYIXzgeEF04=; fh=KsVfM5wJAwSmWlBDhQUIuzi3h8aTwgJEe33eqLJyRj0=; b=lkCfOCex3pP1lJ5gCs/gOOzWyDkB6yxx6f2C0wJKLO/O5dZDWOcTziHAFoN1ogJwU7 ItyE6vrNBjtJ++kVDD8J5qvtK7ds+E5+KuOMOCyeuZ4PPwtx1xfEGbbapZ8GQvQHBiO8 3Dcm/rvVt8Z7a+eeF4hogrwvh5DsgFIDCAhCZ9crjCr3D9ahgWgEZFavTzjogOYrb7QK mk2qhMfGrii6ANXUlDeaE1NnEjdO2/SGCAqiak6R4lkwdMgJWbqQNac8wqPGnuyAkUXG on7PNvKiIV63bGZmbFx+7zqoMUNSNl3o71CR6h0awX6p3EeylIVs+zBsKWDc+fXU1m1j oaFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="qC0uEe/J"; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-157227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157227-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z21-20020a637e15000000b005f804eaed01si8867913pgc.631.2024.04.24.09.39.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 09:39:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="qC0uEe/J"; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-157227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157227-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2B676291F4D for ; Wed, 24 Apr 2024 15:42:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B120B16D9CD; Wed, 24 Apr 2024 15:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qC0uEe/J" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 73E6516DEB4; Wed, 24 Apr 2024 15:39:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713973197; cv=none; b=V6i1D6qipDqEXGQ1GpRaxdIbLyQlabDsTMShG1Vua+t3syDWvjgxoRtr9W1jPf6UvheRKX2+jEZOOJtTB1MxsARQaN45XCrXybPJU4UuwtRcozBKal/Us9oyit+mkug2ZoeJUrNszgriyz/QgOMSlVFyWtbWgvxlTxgy3mNdk8A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713973197; c=relaxed/simple; bh=5DKjJyyR0OoaCs/8PCRwa3HDhSGZM6mtxvJpyyRJgCQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=frPGmn5VGD1vxHFTB5qiOvRKy2uCI+XVtcFSJ+YDZ5FtyVqbrEO+MXAco5GJdmw1XC6dfZhWN5HDYzlY3/4RmuiKVthxypNOphXGpVZg5ilMp70VnSqzOkc1lliHz8z3HyE8KigW3kunf/PpuocEsLNKx27aE5i/kiGaF/IG8HM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=qC0uEe/J; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from [127.0.1.1] (91-154-34-181.elisa-laajakaista.fi [91.154.34.181]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8CC4019A6; Wed, 24 Apr 2024 17:38:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713973133; bh=5DKjJyyR0OoaCs/8PCRwa3HDhSGZM6mtxvJpyyRJgCQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qC0uEe/JGyWd8Byx+e4HHemoiXipetI7Eak47eSvV748UUW6y7RsVIAlYvAmeyxoO ny1IwB1l62d2r1Num6vzmt9lknF0NUwTmMbHJZ+MN8cgcC2PuIfpvGUZE4eYLA220r 5n5FTnz8dNTmPDRJk2zcF4kzD2lZuPpVT1M+rl2Y= From: Tomi Valkeinen Date: Wed, 24 Apr 2024 18:39:13 +0300 Subject: [PATCH v6 10/11] media: subdev: Support non-routing subdevs in v4l2_subdev_s_stream_helper() 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: 7bit Message-Id: <20240424-enable-streams-impro-v6-10-5fb14c20147d@ideasonboard.com> References: <20240424-enable-streams-impro-v6-0-5fb14c20147d@ideasonboard.com> In-Reply-To: <20240424-enable-streams-impro-v6-0-5fb14c20147d@ideasonboard.com> To: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Sakari Ailus , Umang Jain Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1774; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=5DKjJyyR0OoaCs/8PCRwa3HDhSGZM6mtxvJpyyRJgCQ=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBmKSe7f3XINYH15cBKkGtiF2+EuMuX58KWA0gcw qpbFQnYvbKJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZiknuwAKCRD6PaqMvJYe 9WKHD/9J//5kHLUPZPHMsS8OJ8YPINRTfsoih5h6PuPBzrYjYnzTEVFqAL8gTBtYci5RfNTNQcE jYHVSWk5bRYh5LXH/HXrlhNsKfoW3T4v5ulaUMmVB8+U3+M6z/cIZGONsNW8ld+WkNDs3LZHIdz adIcAT+SCL/922dW797eryHl/q8C3bMQ9PEkhmTVL8lCulozKgEJUvOaCM0XzTxxGe8wqHSlvNv dfpvfeBFJEDecv6r1PgBdaltpv5/feByEg3gtaS13Gcm8JMiLtTzv4PpC9UEEpjYN4UtkLVAU/Z imjPq+/0N3g3yigDWi+N6IvwdyLdYWlFfLfe/dEeXzLcqOsIwfZO4zR2U5fIM6sSVmeSV1slRoY NCTNIGNPfHfiGZXWvSaOz1Cr7Sw8BH/ZqXNT4Bmjkr0KSIcydBV0+bFq7a63ySI/W1yTXpU0NOS 35vQaMlmQE2QT9MBzi+zfn03nwSzgSdVMxxRWKlX85k6/fC+QR54zGEs1lLtgZW6DBgVaemwgZQ O8oa5Wa1OxuhX0ZWfiWgmVM3jkLbBsI1eiUeW2DfYFEIfaoqn6w5mzj7CifPW97XjboiT8oTQfn CKFelE73TdDpvPpyUpnhFm4sVFCw9gkadl/xWfgm95RiIubkj8g6rWPyVQLkoWjmo3tWd56pgsO UTvsUfFX5PRXVYg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 At the moment v4l2_subdev_s_stream_helper() only works for subdevices that support routing. As enable/disable_streams now also works for subdevices without routing, improve v4l2_subdev_s_stream_helper() to do the same. Reviewed-by: Laurent Pinchart Tested-by: Umang Jain Signed-off-by: Tomi Valkeinen --- drivers/media/v4l2-core/v4l2-subdev.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 72085027e213..88cfa5e0157a 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -2402,15 +2402,24 @@ int v4l2_subdev_s_stream_helper(struct v4l2_subdev *sd, int enable) if (WARN_ON(pad_index == -1)) return -EINVAL; - /* - * As there's a single source pad, just collect all the source streams. - */ - state = v4l2_subdev_lock_and_get_active_state(sd); + if (sd->flags & V4L2_SUBDEV_FL_STREAMS) { + /* + * As there's a single source pad, just collect all the source + * streams. + */ + state = v4l2_subdev_lock_and_get_active_state(sd); - for_each_active_route(&state->routing, route) - source_mask |= BIT_ULL(route->source_stream); + for_each_active_route(&state->routing, route) + source_mask |= BIT_ULL(route->source_stream); - v4l2_subdev_unlock_state(state); + v4l2_subdev_unlock_state(state); + } else { + /* + * For non-streams subdevices, there's a single implicit stream + * per pad. + */ + source_mask = BIT_ULL(0); + } if (enable) return v4l2_subdev_enable_streams(sd, pad_index, source_mask); -- 2.34.1