From patchwork Mon Jan 29 20:22:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13536338 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAB7A76049 for ; Mon, 29 Jan 2024 20:23:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559821; cv=none; b=T4nVhCP207WrY7QFudc5EPxLy2xYP7oG0jWW4pK3bRU/nA03vJP7xeYkL5vXyhUIk+NgcGRKH6hzWYbyofIA1HCCZ1qPjOklFQqJfbBHbK82pLPAjX5uo159TvmeD7n2MKkMlMXWVocteL2hzQhoubeIWPyaFCtnRU0g7d1poAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559821; c=relaxed/simple; bh=KhRCSmDF0oZ/OZvfrCn77tU3k7BRNvexFdBiP7k7Bpk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L6FhfGkzdXTM96W0Rp91nh+yGn5AJ0raAgeDWBH+8P/oFwGCzyA1SOvmciyRRtm6/wAAJG+Bv75hpMCwPU/EgBSauYsIuykoSRcpZii5PHShEKdiCS+i6+vgfw7nmHmku4SraoekORWEaOWHu60v+99OclL2nquCiXpHJi7a5w8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=XkUCb1fm; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="XkUCb1fm" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a293f2280c7so339632966b.1 for ; Mon, 29 Jan 2024 12:23:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1706559816; x=1707164616; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D+Y8mddvkdiZ6ddfM24jx/NNgzjj0UT3L8rY/aNqpTU=; b=XkUCb1fmmGusey3mzxLlZiTr2+Wog2mFQW+ZHvm9nXYcdl0TjShkNzpBzFqhr8szTu FIKQQRqms9vV1vqTcO4Qp/0YGoPN1NGoYjIvYbG4byju8501O+MRCd9QOK5KcjGrYQao Ua/BxlHCDv7LWbQHjZl0Vy5wvoepCdoxFQDanbj+A3NTsH5njADrmIlH2txz28nXEhy5 BsUXVchTA7hJdW3hv1VRmYgS2NuzbLRaKvHNECsmVGiJSZCn2AGN5PlY9hL7nWsakDFV aN19ZM+TNW8QZsDuwxyuHKAhX91kTvy+72EbQTHVzd+g99l23k8Kv/+E0iQqf9udLn0R wa3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706559816; x=1707164616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D+Y8mddvkdiZ6ddfM24jx/NNgzjj0UT3L8rY/aNqpTU=; b=XS8L2VWh4aIVCFwCvptnbVjffhpGYuztN7hL4VTiPKCLjBOLV3Jnnb07pOl90iseGO ZrM6yR15yvQhCP1qmcTXP+NiQxCnCbU4IE5PrPM7R6+S29xnjnKFzYMoo74z6yLTqbxh ZobrpLVOE+yYR3oOtmF3ATGAMrWXYscqpj7z5uT5oNVgGThUuglwuTI9Eyr0LLYleVtQ RMQxv6GGjEMrf2NUREJddfWV9+b70GLd3LJhTH5XKDOI1CBKDcc299u2D0mw3Q1RaKfm Rx1MRDtIe4HkJ8jWOwT0czGrIN/xhfXg8ltbYtV8/M//GUDz3QWb1+RnA+j+vyVnABx+ 6u6A== X-Gm-Message-State: AOJu0YzUiuQiEwBz+x635tt3NA61eiOv9pZ3iHQmTyNan2lO9/mvFZms hXAgfbvFFHTWIIFFVw+w77SUZXqJyBrgRYZqErYf6emYtkrSJTLGnFcV2l0hajA= X-Google-Smtp-Source: AGHT+IGapPRO8e+yLEIHFwWVkv29hR7h5xLCR9o2yY2fGzh5Xqct7tJaJeRmPsM+e3utru9Zj6Z3OQ== X-Received: by 2002:a17:906:4708:b0:a35:de06:23fa with SMTP id y8-20020a170906470800b00a35de0623famr1897440ejq.6.1706559815710; Mon, 29 Jan 2024 12:23:35 -0800 (PST) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id mc4-20020a170906eb4400b00a338fedb9ebsm4316386ejb.54.2024.01.29.12.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 12:23:35 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 1/6] media: rcar-vin: Move media graph pointers to device info Date: Mon, 29 Jan 2024 21:22:49 +0100 Message-ID: <20240129202254.1126012-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> References: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of selecting the media graph link setup and media operations based on code paths store them in each SoC static information. This reduces complexity and makes it clear what set is used for each SoC. It also makes it easier to extend to new SoC with different link and media graph setups. Signed-off-by: Niklas Söderlund --- .../platform/renesas/rcar-vin/rcar-core.c | 38 ++++++++++++------- .../platform/renesas/rcar-vin/rcar-vin.h | 7 ++-- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index 809c3a38cc4a..47aeeeb4354e 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -64,9 +64,7 @@ static void rvin_group_cleanup(struct rvin_group *group) mutex_destroy(&group->lock); } -static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin, - int (*link_setup)(struct rvin_dev *), - const struct media_device_ops *ops) +static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin) { struct media_device *mdev = &group->mdev; const struct of_device_id *match; @@ -82,10 +80,8 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin, vin_dbg(vin, "found %u enabled VIN's in DT", group->count); - group->link_setup = link_setup; - mdev->dev = vin->dev; - mdev->ops = ops; + mdev->ops = vin->info->media_ops; match = of_match_node(vin->dev->driver->of_match_table, vin->dev->of_node); @@ -114,9 +110,7 @@ static void rvin_group_release(struct kref *kref) mutex_unlock(&rvin_group_lock); } -static int rvin_group_get(struct rvin_dev *vin, - int (*link_setup)(struct rvin_dev *), - const struct media_device_ops *ops) +static int rvin_group_get(struct rvin_dev *vin) { struct rvin_group *group; u32 id; @@ -148,7 +142,7 @@ static int rvin_group_get(struct rvin_dev *vin, goto err_group; } - ret = rvin_group_init(group, vin, link_setup, ops); + ret = rvin_group_init(group, vin); if (ret) { kfree(group); vin_err(vin, "Failed to initialize group\n"); @@ -246,7 +240,7 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier) } } - return vin->group->link_setup(vin); + return vin->info->link_setup(vin); } static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier, @@ -963,7 +957,7 @@ static int rvin_csi2_init(struct rvin_dev *vin) if (ret < 0) return ret; - ret = rvin_group_get(vin, rvin_csi2_setup_links, &rvin_csi2_media_ops); + ret = rvin_group_get(vin); if (ret) goto err_controls; @@ -1055,7 +1049,7 @@ static int rvin_isp_init(struct rvin_dev *vin) if (ret < 0) return ret; - ret = rvin_group_get(vin, rvin_isp_setup_links, NULL); + ret = rvin_group_get(vin); if (ret) goto err_controls; @@ -1161,6 +1155,8 @@ static const struct rvin_info rcar_info_r8a774e1 = { .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a774e1_routes, + .media_ops = &rvin_csi2_media_ops, + .link_setup = rvin_csi2_setup_links, }; static const struct rvin_group_route rcar_info_r8a7795_routes[] = { @@ -1178,6 +1174,8 @@ static const struct rvin_info rcar_info_r8a7795 = { .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a7795_routes, + .media_ops = &rvin_csi2_media_ops, + .link_setup = rvin_csi2_setup_links, .scaler = rvin_scaler_gen3, }; @@ -1196,6 +1194,8 @@ static const struct rvin_info rcar_info_r8a7796 = { .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a7796_routes, + .media_ops = &rvin_csi2_media_ops, + .link_setup = rvin_csi2_setup_links, .scaler = rvin_scaler_gen3, }; @@ -1214,6 +1214,8 @@ static const struct rvin_info rcar_info_r8a77965 = { .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a77965_routes, + .media_ops = &rvin_csi2_media_ops, + .link_setup = rvin_csi2_setup_links, .scaler = rvin_scaler_gen3, }; @@ -1227,6 +1229,8 @@ static const struct rvin_info rcar_info_r8a77970 = { .use_mc = true, .max_width = 4096, .max_height = 4096, + .media_ops = &rvin_csi2_media_ops, + .link_setup = rvin_csi2_setup_links, .routes = rcar_info_r8a77970_routes, }; @@ -1242,6 +1246,8 @@ static const struct rvin_info rcar_info_r8a77980 = { .nv12 = true, .max_width = 4096, .max_height = 4096, + .media_ops = &rvin_csi2_media_ops, + .link_setup = rvin_csi2_setup_links, .routes = rcar_info_r8a77980_routes, }; @@ -1257,6 +1263,8 @@ static const struct rvin_info rcar_info_r8a77990 = { .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a77990_routes, + .media_ops = &rvin_csi2_media_ops, + .link_setup = rvin_csi2_setup_links, .scaler = rvin_scaler_gen3, }; @@ -1271,6 +1279,8 @@ static const struct rvin_info rcar_info_r8a77995 = { .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a77995_routes, + .media_ops = &rvin_csi2_media_ops, + .link_setup = rvin_csi2_setup_links, .scaler = rvin_scaler_gen3, }; @@ -1281,6 +1291,7 @@ static const struct rvin_info rcar_info_r8a779a0 = { .nv12 = true, .max_width = 4096, .max_height = 4096, + .link_setup = rvin_isp_setup_links, }; static const struct rvin_info rcar_info_r8a779g0 = { @@ -1290,6 +1301,7 @@ static const struct rvin_info rcar_info_r8a779g0 = { .nv12 = true, .max_width = 4096, .max_height = 4096, + .link_setup = rvin_isp_setup_links, }; static const struct of_device_id rvin_of_id_table[] = { diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h index 792336dada44..ce5419818b36 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h @@ -156,6 +156,8 @@ struct rvin_group_route { * @max_height: max input height the VIN supports * @routes: list of possible routes from the CSI-2 recivers to * all VINs. The list mush be NULL terminated. + * @media_ops: Pointer to media device operation structure to use. + * @link_setup: Callback to create all links for the media graph * @scaler: Optional scaler */ struct rvin_info { @@ -167,6 +169,8 @@ struct rvin_info { unsigned int max_width; unsigned int max_height; const struct rvin_group_route *routes; + const struct media_device_ops *media_ops; + int (*link_setup)(struct rvin_dev *vin); void (*scaler)(struct rvin_dev *vin); }; @@ -274,7 +278,6 @@ struct rvin_dev { * @count: number of enabled VIN instances found in DT * @notifier: group notifier for CSI-2 async connections * @vin: VIN instances which are part of the group - * @link_setup: Callback to create all links for the media graph * @remotes: array of pairs of async connection and subdev pointers * to all remote subdevices. */ @@ -288,8 +291,6 @@ struct rvin_group { struct v4l2_async_notifier notifier; struct rvin_dev *vin[RCAR_VIN_NUM]; - int (*link_setup)(struct rvin_dev *vin); - struct { struct v4l2_async_connection *asc; struct v4l2_subdev *subdev; From patchwork Mon Jan 29 20:22:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13536335 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C2AE7603D for ; Mon, 29 Jan 2024 20:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559820; cv=none; b=VjM3NUTb51sa7aIWqQSfYe6LxxFyGIc1NFGenBhLfneQdo63Ku0VZAwfYSYbXRVX0I+0S33jUa6H2d0/JMNcuhbEWogyQsPfxLPMdEd/19DQOV/6a3hUzWhxNtqcZFOuu1+HnoWoPzt+njLbQ//gej3f4VRniyxIcSpfwWHzUe8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559820; c=relaxed/simple; bh=Ot4y9HFnz8lYhBsy6M1MCuYOQLMxiWhCczIycUYeTQU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Cky4OD9yFEcqRoTfUUnPZaA2tS/qWd0Kb+E7Wfl77YMGtagMkWvvogHR8EKOZmvsE2Ag2G0AG1pXvWyIGZGRfwqFGVuSWjuIm8vj/tcGguArFiGK7cuI8BzhECE0AyJNZCMvgcll6VLvvlySng1aUkUrFdgnaUjjDe+LqVFZrJs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=gxKLnpUX; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="gxKLnpUX" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-51028fadfe2so3595479e87.0 for ; Mon, 29 Jan 2024 12:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1706559816; x=1707164616; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g1EvAfIe+TWbdKFyLsQsg3/MhDZ+EgY9F19+VEh4ohk=; b=gxKLnpUX2FViPz+bwgFN0rMN7AFYbDe/Ne5luiMDUNwEcGrnhaaVSBj3/OH3IFk0qs iD/sFiCVKrN027K+XFN5mn4ITeXiNrigtYoKqLVWDIUpiZ02wCNAkE/cKcBIWZheFrQT 6UG33yI3NUn22ElU9dsz+uCTZVuMCJQLBypRBvNyNRBgjFC7qw3rTsvGVt9V97ksbsiP ZEl8lA38Or2YW10J4C+Y7So7gHHRkdnAWBh9frb9HMsYDVBqy8L6ffhw2hzNM5LOLezN LvWgKMs6BPBbAF2ix8/i8gz3UYqFanBiceq7Z89ewBnHA1OLs1zPa2m4CVjk/NZXAzID xjQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706559816; x=1707164616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g1EvAfIe+TWbdKFyLsQsg3/MhDZ+EgY9F19+VEh4ohk=; b=ZadAyWHfBlusT8jB5iN3GP0e8KZ71+EGgJ7DajjkY0iE1NDTXuuSscV8SV+8+FBGru cF60L5eBSZfbXRpyiIXvAehOtMSb7IbRRqrbqZoWfcmFC8vbf3AvV9rqBCJvfn3w7Lin iUx3aKvHn8jJC917pKebuxYmTAIHHi+Jcho4fLneq31JN3FkPIS/qTUEMYtZQ4ZKtB47 4CW8yY60X66fG3xpJbt7ZMPwhVV7LHX9vqEb4NjEAljrufy/MXC7DAPqtp2Qws24YO5J MYUy2kNzQ1eF67St+ok6uhpBQkY8CLAbG46QcRAJjKENtUnHy7UgqnLWIvIGZ8arAady q4mg== X-Gm-Message-State: AOJu0Yz5Rb+Wnxu3mec0h50hoynLj5NalzdMhxlpRWzOPWieAonF78dN tgLDXnEiRo9bjgZn1P3dWsORpuaZ0Q9hLeVLrLu5WeEzzjoPaMw3QaLD+cr1BFI= X-Google-Smtp-Source: AGHT+IHzvIBnuj+VZVntCxM65I+CUqxr8H86zD1M5FUds+0GiQqHbOUfp9qCBITF2QL9eJBjk4lEiw== X-Received: by 2002:ac2:5f0f:0:b0:511:17f1:8e09 with SMTP id 15-20020ac25f0f000000b0051117f18e09mr384810lfq.35.1706559816315; Mon, 29 Jan 2024 12:23:36 -0800 (PST) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id mc4-20020a170906eb4400b00a338fedb9ebsm4316386ejb.54.2024.01.29.12.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 12:23:36 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 2/6] media: rcar-vin: Simplify remote source type detection Date: Mon, 29 Jan 2024 21:22:50 +0100 Message-ID: <20240129202254.1126012-3-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> References: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The video source connected to a VIN instance can be either be a CSI-2 receiver, a CS-ISP or a parallel device. Each one requiring slightly different configuration, sometimes reusing the same registers with different meaning depending on what video source is used. The video source type can change at run-time using the media device API. This was introduced with R-Car Gen3 with two possible video sources and have since been extended with one more. Instead of adding more flags that needs to be set/cleared when changing links in the media graph add functionality to use the media device to determine the video source type. Signed-off-by: Niklas Söderlund --- .../platform/renesas/rcar-vin/rcar-core.c | 3 -- .../platform/renesas/rcar-vin/rcar-dma.c | 48 ++++++++++++++----- .../platform/renesas/rcar-vin/rcar-vin.h | 2 - 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index 47aeeeb4354e..8555fa446811 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -807,7 +807,6 @@ static int rvin_csi2_link_notify(struct media_link *link, u32 flags, for (i = 0; i < RCAR_VIN_NUM; i++) { if (group->vin[i] && group->vin[i]->parallel.subdev == sd) { - group->vin[i]->is_csi = false; ret = 0; goto out; } @@ -865,8 +864,6 @@ static int rvin_csi2_link_notify(struct media_link *link, u32 flags, ret = rvin_set_channel_routing(group->vin[master_id], chsel); if (ret) goto out; - - vin->is_csi = true; } out: mutex_unlock(&group->lock); diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c index e2c40abc6d3d..f392e177c59b 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -178,6 +178,28 @@ static bool rvin_scaler_needed(const struct rvin_dev *vin) vin->compose.height == vin->format.height); } +static struct v4l2_subdev *rvin_remote_subdev(const struct rvin_dev *vin) +{ + struct media_pad *pad; + + if (!vin->info->use_mc) + return vin->parallel.subdev; + + pad = media_pad_remote_pad_first(&vin->pad); + if (!pad) + return NULL; + + return media_entity_to_v4l2_subdev(pad->entity); +} + +static bool rvin_remote_is_parallel(const struct rvin_dev *vin) +{ + if (!vin->parallel.subdev) + return false; + + return rvin_remote_subdev(vin) == vin->parallel.subdev; +} + struct vin_coeff { unsigned short xs_value; u32 coeff_set[24]; @@ -752,7 +774,7 @@ static int rvin_setup(struct rvin_dev *vin) break; case MEDIA_BUS_FMT_UYVY8_2X8: /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */ - if (!vin->is_csi && + if (rvin_remote_is_parallel(vin) && vin->parallel.mbus_type == V4L2_MBUS_BT656) vnmc |= VNMC_INF_YUV8_BT656; else @@ -765,7 +787,7 @@ static int rvin_setup(struct rvin_dev *vin) break; case MEDIA_BUS_FMT_UYVY10_2X10: /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */ - if (!vin->is_csi && + if (rvin_remote_is_parallel(vin) && vin->parallel.mbus_type == V4L2_MBUS_BT656) vnmc |= VNMC_INF_YUV10_BT656; else @@ -791,13 +813,13 @@ static int rvin_setup(struct rvin_dev *vin) case VNMC_INF_YUV10_BT656: case VNMC_INF_YUV16: case VNMC_INF_RGB666: - if (vin->is_csi) { + if (!rvin_remote_is_parallel(vin)) { vin_err(vin, "Invalid setting in MIPI CSI2\n"); return -EINVAL; } break; case VNMC_INF_RAW8: - if (!vin->is_csi) { + if (rvin_remote_is_parallel(vin)) { vin_err(vin, "Invalid setting in Digital Pins\n"); return -EINVAL; } @@ -813,7 +835,7 @@ static int rvin_setup(struct rvin_dev *vin) else dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1); - if (!vin->is_csi) { + if (rvin_remote_is_parallel(vin)) { /* Hsync Signal Polarity Select */ if (!(vin->parallel.bus.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) dmr2 |= VNDMR2_HPS; @@ -904,10 +926,10 @@ static int rvin_setup(struct rvin_dev *vin) if (vin->info->model == RCAR_GEN3) { /* Select between CSI-2 and parallel input */ - if (vin->is_csi) - vnmc &= ~VNMC_DPINE; - else + if (rvin_remote_is_parallel(vin)) vnmc |= VNMC_DPINE; + else + vnmc &= ~VNMC_DPINE; } } @@ -1337,14 +1359,16 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, static int rvin_set_stream(struct rvin_dev *vin, int on) { - struct v4l2_subdev *sd; + struct v4l2_subdev *sd = rvin_remote_subdev(vin); struct media_pad *pad; int ret; + if (!sd) + return -EPIPE; + /* No media controller used, simply pass operation to subdevice. */ if (!vin->info->use_mc) { - ret = v4l2_subdev_call(vin->parallel.subdev, video, s_stream, - on); + ret = v4l2_subdev_call(sd, video, s_stream, on); return ret == -ENOIOCTLCMD ? 0 : ret; } @@ -1353,8 +1377,6 @@ static int rvin_set_stream(struct rvin_dev *vin, int on) if (!pad) return -EPIPE; - sd = media_entity_to_v4l2_subdev(pad->entity); - if (!on) { video_device_pipeline_stop(&vin->vdev); return v4l2_subdev_call(sd, video, s_stream, 0); diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h index ce5419818b36..4bfe8ea031c5 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h @@ -202,7 +202,6 @@ struct rvin_info { * @sequence: V4L2 buffers sequence number * @state: keeps track of operation state * - * @is_csi: flag to mark the VIN as using a CSI-2 subdevice * @chsel: Cached value of the current CSI-2 channel selection * * @mbus_code: media bus format code @@ -246,7 +245,6 @@ struct rvin_dev { unsigned int sequence; enum rvin_dma_state state; - bool is_csi; unsigned int chsel; u32 mbus_code; From patchwork Mon Jan 29 20:22:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13536336 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F053C6F08E for ; Mon, 29 Jan 2024 20:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559820; cv=none; b=Mxd4e1dgOTl9ON9bG7123jcOlwrU7JP10qOjFKiojiBi7xayfDnGCFIH/vOL3qByf/x0PKPgwftQKrUBn6rI6L/NUTrvfKoDJBru3iNKxatkT4DSEuqbWHA8Unjsh+hi9ELbwseY3k8wnUZogHo47B+uv4A++UCN5n4tFFxq0r8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559820; c=relaxed/simple; bh=iMlH79qYBNldFFv1Njqv0IFBn14F++he1X19oe3kb2I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jFp+KTiZ7B9UuJeZ4NqZaVeDUs/kExrL9q9nJ2n6b7dObTuHLjA1n7qmHrYVFgktJQb6dqDGoTSO8OWF/AMWSAuHmZGdbeLypx4Z3HUkT4BgoRfFcuErVej752DhoJWb4fz/QhC3n+QyexUd3LkIrtrPelAN2uMgiXFD3SF/G20= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=bokvl0Ff; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="bokvl0Ff" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a26ed1e05c7so371552066b.2 for ; Mon, 29 Jan 2024 12:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1706559817; x=1707164617; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IsKZI3XpF+N8SjQE4iiekcXHPqMgd276oSIsUuTPE94=; b=bokvl0FfyfVFASuSHk4y5Sd1Z09fRIlKpjDjLflVEHcBfHgUOVuDFhJD1yTtkracDo 8YxM+HG8naD/2wzcuihIUTWg04bHma8Iw2lahCORNGbJfP5uB9ltHy8vD0+CkgmJvLxm FUG33QfQCKtRiI0EWJ7RDEw+EslU9JgPvMY8nbKiOX0ahYYs4LfZn+X8SKamztiUWf2e 8tRdGKobCkJfzs2nDrRIiRgSFupjI66+X8A13bYVc5lDnbplhsJeIFrKVOyZTcuak3cV x8xQz/coY6vAp4Er0BlIH3EdqVkO4JxQFoW9jsewuDBN9AEOAexOjXjCbokcGJdXuTfJ zuug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706559817; x=1707164617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IsKZI3XpF+N8SjQE4iiekcXHPqMgd276oSIsUuTPE94=; b=XBWVOgGo4sFu7uwItX3F8/UfAW3Q/OPxROzqZiHOK5/YjeCEZsg8wvb1IwDam/5Q5G Yo6VjBb+NZwJpB/ELDCWt39iSaBhyPds+kdacmwBO+vOO5gbWbjVMFeH0q3ZBIZJLH5q zE290hksr4WtMxLR9GOpMGW0kVCiAayWaScpVUy2YmfNACt8jsdSwRbBWRXkQwSXnNFs /9cWdntabo9kKok019Bg21sk4ZYxClhLl+SyFeG7V5Q45W6TRSCrEzXG4j8flo5eNtGu HaJujOyM8I/VklstRoN3xe6QpEQA4KgNODcpHpMontfQNV578HL4oz7ZiRmxJ6jHOl7l JKlg== X-Gm-Message-State: AOJu0YxFTZ5qsIiZsz0+460d/fqx0nS0Q4PrqEond2l5t9V4wHYlqvbR rm3QWQ3Qo23Qnw6sf9gV+BeQjGFr6KPLhXgdquTf6wcGHf/48rl0SdCEIugDjpU= X-Google-Smtp-Source: AGHT+IHBrrjPFytBekLy/kVDe2ZVNPI83c4pp/h5GEOdIwRjRes3Octz7os4vo9YlvlezEsI6Lmf4A== X-Received: by 2002:a17:906:b195:b0:a35:9513:4081 with SMTP id w21-20020a170906b19500b00a3595134081mr3119544ejy.14.1706559816976; Mon, 29 Jan 2024 12:23:36 -0800 (PST) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id mc4-20020a170906eb4400b00a338fedb9ebsm4316386ejb.54.2024.01.29.12.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 12:23:36 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 3/6] media: rcar-vin: Fold simple functions into only caller Date: Mon, 29 Jan 2024 21:22:51 +0100 Message-ID: <20240129202254.1126012-4-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> References: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The two functions rvin_parallel_subdevice_detach() and rvin_group_cleanup() have been reworked over time and have become simpler and now only have one call site each. To make refactoring of the notifier code simpler fold them into their only call sites. Signed-off-by: Niklas Söderlund --- .../platform/renesas/rcar-vin/rcar-core.c | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index 8555fa446811..d8b9c3b991b1 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -58,12 +58,6 @@ static DEFINE_MUTEX(rvin_group_lock); static struct rvin_group *rvin_group_data; -static void rvin_group_cleanup(struct rvin_group *group) -{ - media_device_cleanup(&group->mdev); - mutex_destroy(&group->lock); -} - static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin) { struct media_device *mdev = &group->mdev; @@ -103,7 +97,8 @@ static void rvin_group_release(struct kref *kref) rvin_group_data = NULL; - rvin_group_cleanup(group); + media_device_cleanup(&group->mdev); + mutex_destroy(&group->lock); kfree(group); @@ -558,15 +553,6 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev *vin, return 0; } -static void rvin_parallel_subdevice_detach(struct rvin_dev *vin) -{ - rvin_v4l2_unregister(vin); - vin->parallel.subdev = NULL; - - if (!vin->info->use_mc) - rvin_free_controls(vin); -} - static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier) { struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); @@ -611,7 +597,11 @@ static void rvin_parallel_notify_unbind(struct v4l2_async_notifier *notifier, vin_dbg(vin, "unbind parallel subdev %s\n", subdev->name); mutex_lock(&vin->lock); - rvin_parallel_subdevice_detach(vin); + rvin_v4l2_unregister(vin); + vin->parallel.subdev = NULL; + + if (!vin->info->use_mc) + rvin_free_controls(vin); mutex_unlock(&vin->lock); } From patchwork Mon Jan 29 20:22:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13536337 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6447E76052 for ; Mon, 29 Jan 2024 20:23:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559821; cv=none; b=Qsqy3Lz3ewQwVESiM2LmahOtL/4k2UjIZjzeBMn2WINsr092ZUtZpEsm7gyMv2a5ka6gSxVXvu67Mjz+VxN5AUceWDwg2hyLpoqs7Irfw74s2x0n3GK6VHPBqfEOcaiNVklPe44p9ndaJ385h6jHM3F1jYKpeDY55bQTqNHU7EI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559821; c=relaxed/simple; bh=YWG8CmzKubJdFKXSw2HqQKL1M446C1ZATh7csfQ+A8k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E08xId+k27uZdfXXGCs64d8wX3GbCEW+DqjJD2F/P3+oy9Py8n4yDKW8Cw/ai/BbMmZmouPc9FVC8HTuNv844JozN5R8rIFi+owevBc71tvzbMoPPFA0iGBkEyUkr6pEOpImHwzb9K3bIwK4tuAwON/eWf0pUd8ryst/3H65zaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=jBPjWz2H; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="jBPjWz2H" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a36126e7459so12877666b.2 for ; Mon, 29 Jan 2024 12:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1706559817; x=1707164617; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oE6W35lEetVAB3eg8tehPOxi2QHoyhdMj4ExMler4UE=; b=jBPjWz2Hg+7hmt72dVvJDryMWDvVXyOHkUOuXmjSlSSZxSsZ1+jDkxiwmjV+56TBac CnrsTf+nCt96vcG5mxBNPESu/F3PD8s1zoARgbekLyrVogrgMLp34tkKk0/vz+6+FHd7 HV8VTB5ipOGrcEs6jTLDGLNoXx1MN7xW6v2mKugrd8bSNZZtvAk3DD38QScgDoLsxEgQ qfjWL6XK7hZG64b4RZzG2tUlJQ4Xznx6ALNMdM/8N71zwYcotZ5nlAB3qbJIEX0zUDyx VQjPL4SujCPCGbajqnXJB93V+FMYDwgaoRE+Tr1mYm2jbZ4+9gKDqOG5xdjOG639pysh ex4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706559817; x=1707164617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oE6W35lEetVAB3eg8tehPOxi2QHoyhdMj4ExMler4UE=; b=NaQGf34EO24pl8Cq/IH3STBQduzBz/gmnOu2qNROeadJzzjEhcI6ZWIZP9iCwFCO4S hxOJKWdHy13j8cEJXRUjZaZWwnVXEuOVUvn+iwRPqQLuht8TQP/1zf+Y1yfByS/KRWmM xJJ716hvyVusg61E5cmvEvQYZC2nGAsU5UQA64xQj7/nDuXr7Bhs3uF1G24pb2JeOldm lHOAguwYosN9iVLs1xHJc+UKD9xn7GN2P4upCiYicHMrB46YvKiM1/9gjGXXpZohy+Ni 9+PmL8uo+lBH/aYbchZbh2nVA7p+dV9nPyqulp0kSiPkwAmAW0vvYe6JMZmb8KbGrdMK lQtw== X-Gm-Message-State: AOJu0Yy+BIuJSPXwxo8ZxjAkWrIe+aFvk8MnASLioPVbIGf+ecp59VMX nIjR3LcHexa0O2G0D/lS9d1xycpLbTYtLFOg7WPd4utR0MiM17AhGPmjBHqF12Q= X-Google-Smtp-Source: AGHT+IFRd7Y8onCkOcHtW4j+5UkkKadTRq1UsjG2UtELDSqfo/CZHCAGZQNAuYMuTMu1jx3/tiF7rQ== X-Received: by 2002:a17:906:d7b2:b0:a31:6811:bf99 with SMTP id pk18-20020a170906d7b200b00a316811bf99mr5268746ejb.56.1706559817580; Mon, 29 Jan 2024 12:23:37 -0800 (PST) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id mc4-20020a170906eb4400b00a338fedb9ebsm4316386ejb.54.2024.01.29.12.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 12:23:37 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 4/6] media: rcar-vin: Register the media device together with the group Date: Mon, 29 Jan 2024 21:22:52 +0100 Message-ID: <20240129202254.1126012-5-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> References: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Prepare for replacing the shared group notifier with an individual notifier per VIN by moving the media device registration and un-registration to the group. This is needed as the media device will still be shared between all VIN:s. Signed-off-by: Niklas Söderlund --- drivers/media/platform/renesas/rcar-vin/rcar-core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index d8b9c3b991b1..ffc79c26a303 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -85,7 +85,7 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin) media_device_init(mdev); - return 0; + return media_device_register(mdev); } static void rvin_group_release(struct kref *kref) @@ -97,6 +97,7 @@ static void rvin_group_release(struct kref *kref) rvin_group_data = NULL; + media_device_unregister(&group->mdev); media_device_cleanup(&group->mdev); mutex_destroy(&group->lock); @@ -215,10 +216,6 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier) unsigned int i; int ret; - ret = media_device_register(&vin->group->mdev); - if (ret) - return ret; - ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); if (ret) { vin_err(vin, "Failed to register subdev nodes\n"); @@ -260,8 +257,6 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier, } mutex_unlock(&vin->group->lock); - - media_device_unregister(&vin->group->mdev); } static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier, From patchwork Mon Jan 29 20:22:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13536340 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D07A1534EB for ; Mon, 29 Jan 2024 20:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559824; cv=none; b=YSe9o0H8UPj9nBxabfoVY+54EN+J9YEQOMDcL80FF7Q5V+ctrQVrZkepGz7JSoewHUCuqfVq7YDFwgHtL6LWaneL31THcp6c54Lk32l98Lhz7ROCe8XMH2A3RzUdlULuQqlcdriVwwyk/P50Rwz12cK3o7RnxZt26MndYt9NgtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559824; c=relaxed/simple; bh=w1rgm+8bn6ewhLDtOfMuk/lZnIHSpWMrmAeDlZO48Ok=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WQd0Jj5LSFdEudJr49KjQ+fl0LtNJdW5CBNTQbna0np6utgDVbsGbNOvhDbLLHyKzVTHqAUcmNXx+m9nqxhVabhaWD2HTDCjnJpsMOQ6lw0mS6j88qhwIWpH4aet3jpYEF7YMAJH+V3u7goSorRAhTcFEZUVcNUjyTEMTHGyodI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=XAqyOuRQ; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="XAqyOuRQ" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a359446b57dso202087966b.3 for ; Mon, 29 Jan 2024 12:23:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1706559818; x=1707164618; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BQQ1hVp7NyJkoWfXBt9DQSLCSFrTcU53ZHxhAmbxAlA=; b=XAqyOuRQuqAexsZAzCk/QkIGZCjvXDmJC24VA5ne+sHS7eBPlVnlocd9phy9fEjeK8 K3p+Bg5qvrFTKDv6lnifbv0i1aQndBhaGDU1goVH3AMOmxw8b59HA+F//SHjwIsaauu3 A4BVCbTUcF1LMI/uklJXdwMwU9tDuun+zcT2FsYs1CUnZrF07reUq0TftNqCm5qFTT8+ 500Ag4pwfwtncBjkXAfjPgpCtYNhc3OCmYZtwOuCwiBy/9dOVbg0NmhEOnWxLpJY6wpY eO/SIrjfBvAPZLf0evcmXdERkokRnkPJ8E0JU/7vcPhOQobgvDnX6OIU0YKW+n7YK31C gw9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706559818; x=1707164618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BQQ1hVp7NyJkoWfXBt9DQSLCSFrTcU53ZHxhAmbxAlA=; b=chB/x71DOWp5y4AjVS1GL8pStiKE+dVOER5Isuz6mdYhgiW4MdA5rW9bMTFoNopOvv 9TcVlm/+6z0W9stuIhXVHoleWb8bhkn8LoUkhsUmNmEMbcBFhYyoo+ggNAj6f5VSvuNw 82R2A/PDvbhVgPSWp4DzS4NHDXccIskm1cUPo61Re/Umw8y6y1JsCeqc/fCAplET/Vh2 nss6C8afopb1RaTud74QKld88OGge7R73rZo6YoKn9tLZFUb29jq+qcj/a9wXXmxRBf7 AP2U7V4z1YULrrfIVgjj1scEClHNXEdZHkisOOVclXyCIsl+mzKWlzwnHG6DPovMWQWt PzHw== X-Gm-Message-State: AOJu0Yyn/yEKSgBIoYDFPs4UskDpzX5Ap7RZl2J5C67BAe5hT77qUQXb CYT/K2VOFKUEy9beE698gDCBzui++kQLSlMEQj3arHpS+iebwcmUMnUYURnd9Mk= X-Google-Smtp-Source: AGHT+IEVd7Au8unaq3yu/SGSI//ceLctgsaZ/eroaloMAa94CL7WmmRXegeAtc2G2HFq1jhNOi7itQ== X-Received: by 2002:a17:906:13da:b0:a29:11dc:8181 with SMTP id g26-20020a17090613da00b00a2911dc8181mr4382856ejc.50.1706559818607; Mon, 29 Jan 2024 12:23:38 -0800 (PST) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id mc4-20020a170906eb4400b00a338fedb9ebsm4316386ejb.54.2024.01.29.12.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 12:23:38 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 5/6] media: rcar-vin: Remove the shared group notifier Date: Mon, 29 Jan 2024 21:22:53 +0100 Message-ID: <20240129202254.1126012-6-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> References: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since the addition of Gen3 support to rcar-vin the driver have worked around the limitation in v4l-async that a subdevice could only be bound to one notifier. This was needed as each VIN instance can be connected to the same CSI-2 receiver and each capture a different virtual channel. The workaround was implemented as a single notifier that was registered by the last VIN driver instance to attach to the device, and unregistered by the last VIN driver instance to go away. This lead to a lot of complexities as the driver had to synchronize between them at different points in the life-cycle (probe, v4l-async complete, remove, etc). To complicate things even more some VIN instances had access to its own private parallel interface that also needed to be a part of the media graph. This lead to some VIN driver instances having to deal with one private notifier for the parallel interface and interacting with the shared group notifier. The limitation in v4l-async have now been addressed by [1]. This simplify things quiet a bit for drivers and this patch removes the concept of a shared group notifier and implements a single notifier for each VIN instance. This single notifier covers both the parallel interface for the VIN instances that have it and all shared subdevices that are readable for each VIN. This also simplify the media link creation. The group context is however retained for two reasons. - All VIN driver instances needs to be part of the same media graph. So the media device is still created by the first VIN driver to be probed and are deleted by the last VIN instance to be removed. - On Gen3 the hardware design requires the link notification implementation to access control registers only present in some VIN instances. These registers controls which VIN instances are connected to which CSI-2 receiver. This is controlled by the links in the media graph. There is no intentional functional change. This patch only removes a workaround for a functionality that now exists in v4l-async. 1. commit 28a1295795d8 ("media: v4l: async: Allow multiple connections between entities") Signed-off-by: Niklas Söderlund --- .../platform/renesas/rcar-vin/rcar-core.c | 457 ++++++------------ .../platform/renesas/rcar-vin/rcar-v4l2.c | 44 +- .../platform/renesas/rcar-vin/rcar-vin.h | 25 +- 3 files changed, 162 insertions(+), 364 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index ffc79c26a303..244ab1b3a8c0 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -43,16 +43,7 @@ #define v4l2_dev_to_vin(d) container_of(d, struct rvin_dev, v4l2_dev) /* ----------------------------------------------------------------------------- - * Gen3 Group Allocator - */ - -/* FIXME: This should if we find a system that supports more - * than one group for the whole system be replaced with a linked - * list of groups. And eventually all of this should be replaced - * with a global device allocator API. - * - * But for now this works as on all supported systems there will - * be only one group for all instances. + * Group Allocator */ static DEFINE_MUTEX(rvin_group_lock); @@ -62,18 +53,9 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin) { struct media_device *mdev = &group->mdev; const struct of_device_id *match; - struct device_node *np; mutex_init(&group->lock); - /* Count number of VINs in the system */ - group->count = 0; - for_each_matching_node(np, vin->dev->driver->of_match_table) - if (of_device_is_available(np)) - group->count++; - - vin_dbg(vin, "found %u enabled VIN's in DT", group->count); - mdev->dev = vin->dev; mdev->ops = vin->info->media_ops; @@ -194,8 +176,7 @@ static void rvin_group_put(struct rvin_dev *vin) kref_put(&group->refcount, rvin_group_release); } -/* group lock should be held when calling this function. */ -static int rvin_group_entity_to_remote_id(struct rvin_group *group, +static int rvin_group_entity_to_remote_id(struct rvin_dev *vin, struct media_entity *entity) { struct v4l2_subdev *sd; @@ -204,89 +185,12 @@ static int rvin_group_entity_to_remote_id(struct rvin_group *group, sd = media_entity_to_v4l2_subdev(entity); for (i = 0; i < RVIN_REMOTES_MAX; i++) - if (group->remotes[i].subdev == sd) + if (vin->remotes[i].subdev == sd) return i; return -ENODEV; } -static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier) -{ - struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); - unsigned int i; - int ret; - - ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); - if (ret) { - vin_err(vin, "Failed to register subdev nodes\n"); - return ret; - } - - /* Register all video nodes for the group. */ - for (i = 0; i < RCAR_VIN_NUM; i++) { - if (vin->group->vin[i] && - !video_is_registered(&vin->group->vin[i]->vdev)) { - ret = rvin_v4l2_register(vin->group->vin[i]); - if (ret) - return ret; - } - } - - return vin->info->link_setup(vin); -} - -static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier, - struct v4l2_subdev *subdev, - struct v4l2_async_connection *asc) -{ - struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); - unsigned int i; - - for (i = 0; i < RCAR_VIN_NUM; i++) - if (vin->group->vin[i]) - rvin_v4l2_unregister(vin->group->vin[i]); - - mutex_lock(&vin->group->lock); - - for (i = 0; i < RVIN_CSI_MAX; i++) { - if (vin->group->remotes[i].asc != asc) - continue; - vin->group->remotes[i].subdev = NULL; - vin_dbg(vin, "Unbind %s from slot %u\n", subdev->name, i); - break; - } - - mutex_unlock(&vin->group->lock); -} - -static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier, - struct v4l2_subdev *subdev, - struct v4l2_async_connection *asc) -{ - struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); - unsigned int i; - - mutex_lock(&vin->group->lock); - - for (i = 0; i < RVIN_CSI_MAX; i++) { - if (vin->group->remotes[i].asc != asc) - continue; - vin->group->remotes[i].subdev = subdev; - vin_dbg(vin, "Bound %s to slot %u\n", subdev->name, i); - break; - } - - mutex_unlock(&vin->group->lock); - - return 0; -} - -static const struct v4l2_async_notifier_operations rvin_group_notify_ops = { - .bound = rvin_group_notify_bound, - .unbind = rvin_group_notify_unbind, - .complete = rvin_group_notify_complete, -}; - static int rvin_group_parse_of(struct rvin_dev *vin, unsigned int port, unsigned int id) { @@ -310,16 +214,16 @@ static int rvin_group_parse_of(struct rvin_dev *vin, unsigned int port, goto out; } - asc = v4l2_async_nf_add_fwnode(&vin->group->notifier, fwnode, + asc = v4l2_async_nf_add_fwnode(&vin->notifier, fwnode, struct v4l2_async_connection); if (IS_ERR(asc)) { ret = PTR_ERR(asc); goto out; } - vin->group->remotes[vep.base.id].asc = asc; + vin->remotes[vep.base.id].asc = asc; - vin_dbg(vin, "Add group OF device %pOF to slot %u\n", + vin_dbg(vin, "Add device %pOF to slot %u\n", to_of_node(fwnode), vep.base.id); out: fwnode_handle_put(fwnode); @@ -327,70 +231,24 @@ static int rvin_group_parse_of(struct rvin_dev *vin, unsigned int port, return ret; } -static void rvin_group_notifier_cleanup(struct rvin_dev *vin) -{ - if (&vin->v4l2_dev == vin->group->notifier.v4l2_dev) { - v4l2_async_nf_unregister(&vin->group->notifier); - v4l2_async_nf_cleanup(&vin->group->notifier); - } -} - static int rvin_group_notifier_init(struct rvin_dev *vin, unsigned int port, unsigned int max_id) { - unsigned int count = 0, vin_mask = 0; - unsigned int i, id; + unsigned int id; int ret; - mutex_lock(&vin->group->lock); - - /* If not all VIN's are registered don't register the notifier. */ - for (i = 0; i < RCAR_VIN_NUM; i++) { - if (vin->group->vin[i]) { - count++; - vin_mask |= BIT(i); - } - } - - if (vin->group->count != count) { - mutex_unlock(&vin->group->lock); - return 0; + for (id = 0; id < max_id; id++) { + ret = rvin_group_parse_of(vin, port, id); + if (ret) + return ret; } - mutex_unlock(&vin->group->lock); - - v4l2_async_nf_init(&vin->group->notifier, &vin->v4l2_dev); - - /* - * Some subdevices may overlap but the parser function can handle it and - * each subdevice will only be registered once with the group notifier. - */ - for (i = 0; i < RCAR_VIN_NUM; i++) { - if (!(vin_mask & BIT(i))) - continue; - - for (id = 0; id < max_id; id++) { - if (vin->group->remotes[id].asc) - continue; - - ret = rvin_group_parse_of(vin->group->vin[i], port, id); - if (ret) - return ret; - } - } - - if (list_empty(&vin->group->notifier.waiting_list)) - return 0; - - vin->group->notifier.ops = &rvin_group_notify_ops; - ret = v4l2_async_nf_register(&vin->group->notifier); - if (ret < 0) { - vin_err(vin, "Notifier registration failed\n"); - v4l2_async_nf_cleanup(&vin->group->notifier); - return ret; - } + /* Make sure at least one remote was described. */ + for (id = 0; id < max_id; id++) + if (vin->remotes[id].asc) + return 0; - return 0; + return -ENODEV; } /* ----------------------------------------------------------------------------- @@ -472,10 +330,6 @@ static int rvin_find_pad(struct v4l2_subdev *sd, int direction) return -EINVAL; } -/* ----------------------------------------------------------------------------- - * Parallel async notifier - */ - /* The vin lock should be held when calling the subdevice attach and detach */ static int rvin_parallel_subdevice_attach(struct rvin_dev *vin, struct v4l2_subdev *subdev) @@ -494,10 +348,8 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev *vin, ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SINK); vin->parallel.sink_pad = ret < 0 ? 0 : ret; - if (vin->info->use_mc) { - vin->parallel.subdev = subdev; + if (vin->info->use_mc) return 0; - } /* Find compatible subdevices mbus format */ vin->mbus_code = 0; @@ -543,16 +395,48 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev *vin, if (ret < 0) return ret; - vin->parallel.subdev = subdev; - return 0; } -static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier) +static int rvin_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_connection *asc) +{ + struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); + unsigned int i; + int ret = 0; + + mutex_lock(&vin->lock); + + /* Parallel */ + if (vin->parallel.asc == asc) { + ret = rvin_parallel_subdevice_attach(vin, subdev); + if (ret) + goto out; + + vin->parallel.subdev = subdev; + + v4l2_set_subdev_hostdata(subdev, vin); + vin_dbg(vin, "Bound parallel subdev %su\n", subdev->name); + } + + /* CSI or ISP */ + for (i = 0; i < RVIN_REMOTES_MAX; i++) { + if (vin->remotes[i].asc != asc) + continue; + vin->remotes[i].subdev = subdev; + vin_dbg(vin, "Bound %s to slot %u\n", subdev->name, i); + break; + } +out: + mutex_unlock(&vin->lock); + + return ret; +} + +static int rvin_notify_complete(struct v4l2_async_notifier *notifier) { struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); - struct media_entity *source; - struct media_entity *sink; int ret; ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); @@ -570,64 +454,58 @@ static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier) if (!vin->info->use_mc) return 0; - /* If we're running with media-controller, link the subdevs. */ - source = &vin->parallel.subdev->entity; - sink = &vin->vdev.entity; - - ret = media_create_pad_link(source, vin->parallel.source_pad, - sink, vin->parallel.sink_pad, 0); - if (ret) - vin_err(vin, "Error adding link from %s to %s: %d\n", - source->name, sink->name, ret); - - return ret; + return vin->info->link_setup(vin); } -static void rvin_parallel_notify_unbind(struct v4l2_async_notifier *notifier, - struct v4l2_subdev *subdev, - struct v4l2_async_connection *asc) +static void rvin_notify_unbind(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_connection *asc) { struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); - - vin_dbg(vin, "unbind parallel subdev %s\n", subdev->name); + unsigned int i; mutex_lock(&vin->lock); + rvin_v4l2_unregister(vin); - vin->parallel.subdev = NULL; - if (!vin->info->use_mc) - rvin_free_controls(vin); - mutex_unlock(&vin->lock); -} + /* Parallel */ + if (vin->parallel.asc == asc) { + vin->parallel.subdev = NULL; + if (!vin->info->use_mc) + rvin_free_controls(vin); + vin_dbg(vin, "Unbind parallel subdev %s\n", subdev->name); + } -static int rvin_parallel_notify_bound(struct v4l2_async_notifier *notifier, - struct v4l2_subdev *subdev, - struct v4l2_async_connection *asc) -{ - struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); - int ret; + /* CSI or ISP */ + for (i = 0; i < RVIN_REMOTES_MAX; i++) { + if (vin->remotes[i].asc != asc) + continue; + vin->remotes[i].subdev = NULL; + vin_dbg(vin, "Unbind %s from slot %u\n", subdev->name, i); + break; + } - mutex_lock(&vin->lock); - ret = rvin_parallel_subdevice_attach(vin, subdev); mutex_unlock(&vin->lock); - if (ret) - return ret; - - v4l2_set_subdev_hostdata(subdev, vin); - - vin_dbg(vin, "bound subdev %s source pad: %u sink pad: %u\n", - subdev->name, vin->parallel.source_pad, - vin->parallel.sink_pad); - - return 0; } -static const struct v4l2_async_notifier_operations rvin_parallel_notify_ops = { - .bound = rvin_parallel_notify_bound, - .unbind = rvin_parallel_notify_unbind, - .complete = rvin_parallel_notify_complete, +static const struct v4l2_async_notifier_operations rvin_notify_ops = { + .bound = rvin_notify_bound, + .complete = rvin_notify_complete, + .unbind = rvin_notify_unbind, }; +/* ----------------------------------------------------------------------------- + * Parallel interface, found on Gen2 and some Gen3 + */ + +static int rvin_parallel_setup_link(struct rvin_dev *vin) +{ + struct media_entity *source = &vin->parallel.subdev->entity; + struct media_entity *sink = &vin->vdev.entity; + + return media_create_pad_link(source, vin->parallel.source_pad, sink, 0, 0); +} + static int rvin_parallel_parse_of(struct rvin_dev *vin) { struct fwnode_handle *ep, *fwnode; @@ -681,18 +559,10 @@ static int rvin_parallel_parse_of(struct rvin_dev *vin) return ret; } -static void rvin_parallel_cleanup(struct rvin_dev *vin) -{ - v4l2_async_nf_unregister(&vin->notifier); - v4l2_async_nf_cleanup(&vin->notifier); -} - static int rvin_parallel_init(struct rvin_dev *vin) { int ret; - v4l2_async_nf_init(&vin->notifier, &vin->v4l2_dev); - ret = rvin_parallel_parse_of(vin); if (ret) return ret; @@ -703,14 +573,6 @@ static int rvin_parallel_init(struct rvin_dev *vin) vin_dbg(vin, "Found parallel subdevice %pOF\n", to_of_node(vin->parallel.asc->match.fwnode)); - vin->notifier.ops = &rvin_parallel_notify_ops; - ret = v4l2_async_nf_register(&vin->notifier); - if (ret < 0) { - vin_err(vin, "Notifier registration failed\n"); - v4l2_async_nf_cleanup(&vin->notifier); - return ret; - } - return 0; } @@ -776,7 +638,7 @@ static int rvin_csi2_link_notify(struct media_link *link, u32 flags, mutex_lock(&group->lock); - csi_id = rvin_group_entity_to_remote_id(group, link->source->entity); + csi_id = rvin_group_entity_to_remote_id(vin, link->source->entity); if (csi_id == -ENODEV) { struct v4l2_subdev *sd; @@ -860,11 +722,11 @@ static const struct media_device_ops rvin_csi2_media_ops = { .link_notify = rvin_csi2_link_notify, }; -static int rvin_csi2_create_link(struct rvin_group *group, unsigned int id, +static int rvin_csi2_create_link(struct rvin_dev *vin, const struct rvin_group_route *route) { - struct media_entity *source = &group->remotes[route->csi].subdev->entity; - struct media_entity *sink = &group->vin[id]->vdev.entity; + struct media_entity *source = &vin->remotes[route->csi].subdev->entity; + struct media_entity *sink = &vin->vdev.entity; struct media_pad *sink_pad = &sink->pads[0]; unsigned int channel; int ret; @@ -888,29 +750,29 @@ static int rvin_csi2_create_link(struct rvin_group *group, unsigned int id, static int rvin_csi2_setup_links(struct rvin_dev *vin) { const struct rvin_group_route *route; - unsigned int id; int ret = -EINVAL; - /* Create all media device links between VINs and CSI-2's. */ + if (vin->parallel.subdev) { + ret = rvin_parallel_setup_link(vin); + if (ret) + return ret; + } + + /* Create all media device links between VIN and CSI-2's. */ mutex_lock(&vin->group->lock); for (route = vin->info->routes; route->chsel; route++) { - /* Check that VIN' master is part of the group. */ + /* Check that VIN's master is present. */ if (!vin->group->vin[route->master]) continue; - /* Check that CSI-2 is part of the group. */ - if (!vin->group->remotes[route->csi].subdev) + /* Check if remote is present. */ + if (!vin->remotes[route->csi].subdev) continue; - for (id = route->master; id < route->master + 4; id++) { - /* Check that VIN is part of the group. */ - if (!vin->group->vin[id]) - continue; - - ret = rvin_csi2_create_link(vin->group, id, route); - if (ret) - goto out; - } + /* Create links between VIN and CSI-2 source pads. */ + ret = rvin_csi2_create_link(vin, route); + if (ret) + goto out; } out: mutex_unlock(&vin->group->lock); @@ -918,17 +780,10 @@ static int rvin_csi2_setup_links(struct rvin_dev *vin) return ret; } -static void rvin_csi2_cleanup(struct rvin_dev *vin) -{ - rvin_parallel_cleanup(vin); - rvin_group_notifier_cleanup(vin); - rvin_group_put(vin); - rvin_free_controls(vin); -} - static int rvin_csi2_init(struct rvin_dev *vin) { int ret; + bool have_parallel, have_remote; vin->pad.flags = MEDIA_PAD_FL_SINK; ret = media_entity_pads_init(&vin->vdev.entity, 1, &vin->pad); @@ -943,18 +798,24 @@ static int rvin_csi2_init(struct rvin_dev *vin) if (ret) goto err_controls; - /* It's OK to not have a parallel subdevice. */ ret = rvin_parallel_init(vin); if (ret && ret != -ENODEV) goto err_group; + have_parallel = ret != -ENODEV; + ret = rvin_group_notifier_init(vin, 1, RVIN_CSI_MAX); - if (ret) - goto err_parallel; + if (ret && ret != -ENODEV) + goto err_group; + have_remote = ret != -ENODEV; + + /* One parallel or CSI-2 subdevice needed. */ + if (!have_parallel && !have_remote) { + ret = -ENODEV; + goto err_group; + } return 0; -err_parallel: - rvin_parallel_cleanup(vin); err_group: rvin_group_put(vin); err_controls: @@ -969,53 +830,16 @@ static int rvin_csi2_init(struct rvin_dev *vin) static int rvin_isp_setup_links(struct rvin_dev *vin) { - unsigned int i; - int ret = -EINVAL; + struct media_entity *source, *sink; + unsigned int source_slot = vin->id / 8; + unsigned int source_idx = vin->id % 8 + 1; - /* Create all media device links between VINs and ISP's. */ - mutex_lock(&vin->group->lock); - for (i = 0; i < RCAR_VIN_NUM; i++) { - struct media_pad *source_pad, *sink_pad; - struct media_entity *source, *sink; - unsigned int source_slot = i / 8; - unsigned int source_idx = i % 8 + 1; + source = &vin->remotes[source_slot].subdev->entity; + sink = &vin->vdev.entity; - if (!vin->group->vin[i]) - continue; - - /* Check that ISP is part of the group. */ - if (!vin->group->remotes[source_slot].subdev) - continue; - - source = &vin->group->remotes[source_slot].subdev->entity; - source_pad = &source->pads[source_idx]; - - sink = &vin->group->vin[i]->vdev.entity; - sink_pad = &sink->pads[0]; - - /* Skip if link already exists. */ - if (media_entity_find_link(source_pad, sink_pad)) - continue; - - ret = media_create_pad_link(source, source_idx, sink, 0, - MEDIA_LNK_FL_ENABLED | - MEDIA_LNK_FL_IMMUTABLE); - if (ret) { - vin_err(vin, "Error adding link from %s to %s\n", - source->name, sink->name); - break; - } - } - mutex_unlock(&vin->group->lock); - - return ret; -} - -static void rvin_isp_cleanup(struct rvin_dev *vin) -{ - rvin_group_notifier_cleanup(vin); - rvin_group_put(vin); - rvin_free_controls(vin); + return media_create_pad_link(source, source_idx, sink, 0, + MEDIA_LNK_FL_ENABLED | + MEDIA_LNK_FL_IMMUTABLE); } static int rvin_isp_init(struct rvin_dev *vin) @@ -1386,6 +1210,9 @@ static int rcar_vin_probe(struct platform_device *pdev) platform_set_drvdata(pdev, vin); + v4l2_async_nf_init(&vin->notifier, &vin->v4l2_dev); + vin->notifier.ops = &rvin_notify_ops; + if (vin->info->use_isp) { ret = rvin_isp_init(vin); } else if (vin->info->use_mc) { @@ -1406,6 +1233,13 @@ static int rcar_vin_probe(struct platform_device *pdev) return ret; } + ret = v4l2_async_nf_register(&vin->notifier); + if (ret < 0) { + vin_err(vin, "Notifier registration failed\n"); + v4l2_async_nf_cleanup(&vin->notifier); + return ret; + } + pm_suspend_ignore_children(&pdev->dev, true); pm_runtime_enable(&pdev->dev); @@ -1420,12 +1254,13 @@ static void rcar_vin_remove(struct platform_device *pdev) rvin_v4l2_unregister(vin); - if (vin->info->use_isp) - rvin_isp_cleanup(vin); - else if (vin->info->use_mc) - rvin_csi2_cleanup(vin); - else - rvin_parallel_cleanup(vin); + v4l2_async_nf_unregister(&vin->notifier); + v4l2_async_nf_cleanup(&vin->notifier); + + if (vin->info->use_isp || vin->info->use_mc) { + rvin_group_put(vin); + rvin_free_controls(vin); + } rvin_dma_unregister(vin); } diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c index 073f70c6ac68..9e166ee2d9a1 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c @@ -1052,50 +1052,18 @@ void rvin_v4l2_unregister(struct rvin_dev *vin) video_unregister_device(&vin->vdev); } -static void rvin_notify_video_device(struct rvin_dev *vin, - unsigned int notification, void *arg) -{ - switch (notification) { - case V4L2_DEVICE_NOTIFY_EVENT: - v4l2_event_queue(&vin->vdev, arg); - break; - default: - break; - } -} - static void rvin_notify(struct v4l2_subdev *sd, unsigned int notification, void *arg) { - struct v4l2_subdev *remote; - struct rvin_group *group; - struct media_pad *pad; struct rvin_dev *vin = container_of(sd->v4l2_dev, struct rvin_dev, v4l2_dev); - unsigned int i; - /* If no media controller, no need to route the event. */ - if (!vin->info->use_mc) { - rvin_notify_video_device(vin, notification, arg); - return; - } - - group = vin->group; - - for (i = 0; i < RCAR_VIN_NUM; i++) { - vin = group->vin[i]; - if (!vin) - continue; - - pad = media_pad_remote_pad_first(&vin->pad); - if (!pad) - continue; - - remote = media_entity_to_v4l2_subdev(pad->entity); - if (remote != sd) - continue; - - rvin_notify_video_device(vin, notification, arg); + switch (notification) { + case V4L2_DEVICE_NOTIFY_EVENT: + v4l2_event_queue(&vin->vdev, arg); + break; + default: + break; } } diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h index 4bfe8ea031c5..7810a1cbbc23 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h @@ -183,10 +183,12 @@ struct rvin_info { * @vdev: V4L2 video device associated with VIN * @v4l2_dev: V4L2 device * @ctrl_handler: V4L2 control handler + * + * @parallel: Parallel input subdevice descriptor + * @remotes: Array of pairs of async connection and subdev pointers + * to remote subdevices on CSI-2 or CS-ISP. * @notifier: V4L2 asynchronous subdevs notifier * - * @parallel: parallel input subdevice descriptor - * * @group: Gen3 CSI group * @id: Gen3 group id for this VIN * @pad: media pad for the video device entity @@ -222,9 +224,13 @@ struct rvin_dev { struct video_device vdev; struct v4l2_device v4l2_dev; struct v4l2_ctrl_handler ctrl_handler; - struct v4l2_async_notifier notifier; struct rvin_parallel_entity parallel; + struct { + struct v4l2_async_connection *asc; + struct v4l2_subdev *subdev; + } remotes[RVIN_REMOTES_MAX]; + struct v4l2_async_notifier notifier; struct rvin_group *group; unsigned int id; @@ -272,12 +278,8 @@ struct rvin_dev { * * @mdev: media device which represents the group * - * @lock: protects the count, notifier, vin and csi members - * @count: number of enabled VIN instances found in DT - * @notifier: group notifier for CSI-2 async connections + * @lock: Protects the vin member * @vin: VIN instances which are part of the group - * @remotes: array of pairs of async connection and subdev pointers - * to all remote subdevices. */ struct rvin_group { struct kref refcount; @@ -285,14 +287,7 @@ struct rvin_group { struct media_device mdev; struct mutex lock; - unsigned int count; - struct v4l2_async_notifier notifier; struct rvin_dev *vin[RCAR_VIN_NUM]; - - struct { - struct v4l2_async_connection *asc; - struct v4l2_subdev *subdev; - } remotes[RVIN_REMOTES_MAX]; }; int rvin_dma_register(struct rvin_dev *vin, int irq); From patchwork Mon Jan 29 20:22:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13536339 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 251E6152DFC for ; Mon, 29 Jan 2024 20:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559823; cv=none; b=CMuizJIVQ65yjNNlkgjKoHo8jDK4eFO9xjIm0flxIog0edXvAsAgx/4XUCy7JcRE+pI5NorZyuvV1r5R+VjThY+vUuuHtqrYp937RxY9eeChl91alzn1LtGCmu9HnxhvqQPNMNAPoVV6rhGbx6luxjCym6zyXDCkjUm6r3IjDZg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559823; c=relaxed/simple; bh=BQhNCcVevdHyPYz2HAdbLwYqHA8p888DFWtFjDtrd4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KQSfFsC9bTI5diQGBkpdoLGoYyH232rukMWBOCAbYOxAATDIfxYgqg4+thyk4Pci9fPXa2V3dLKFiyD/ZXEB5cgDS7zBlFfKmSZi9ggOyaWBsZkHKcDhkxsdqacGHE6Y+5sBw+2wNeyrpoDldm5hMmAtvIH7rO0dDs/66+lD6Xk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=hcCoAdJ9; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="hcCoAdJ9" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-55f1102b300so1402275a12.2 for ; Mon, 29 Jan 2024 12:23:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1706559819; x=1707164619; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=759t6dHKnm3zRPUWRD776/+JNdcD4djCnzhQxTJ2HXk=; b=hcCoAdJ94TyivSkoyZVQBsVF29m1PaOsXip4qg9ifcLZl2iwCrMwmht33qUZOQozti CBk+kxze7peI1nxXNIW31Sqv2zcynK5e+qadodX0ziP+ZDqzi7I1xf0d4Q6mB2IUuP6k pLsHAn15REX1l//uFvc42MHDiUT14lxm/1EqQLEA89Q61uQTHUgMu7C0RiseTWGOF5Ea FuvVqgdBfdBwQAky+rrNzG7NglNZbrGp09YaPJbXz0L/xkgIrPvA7nhLJl3UbS7+Dbw9 25SiMqESUuKRSTRmDsXfkW8E88R33jg6/6l+s6umnkLTrddBVP6sHv+Tg3NfNZKa+E+g 5IBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706559819; x=1707164619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=759t6dHKnm3zRPUWRD776/+JNdcD4djCnzhQxTJ2HXk=; b=PUicrUNJf6yPyr+RM6MqBWPFRK10zjNLAMO+/rC1W/O2YxvgZP1CTTKVSihy7aiXdB vgmDttpjGxuNFScFXBStWNmWSYj1nGJLmJ9V4OHpDvd5Yl56yB4YnUkihti/1b+Izrb3 h74QeN0uKDbvcr6JK+zvNP9dLPrJUica4nRNmlFOseURV+EvNAvycIpS8m89Gn02N8MJ HPDJuGGLjC5TUUc+MsmW0a8/cxSl/Aqbf81Veh3vrENmckeSOyAPVGlPDTrJKGZ5tk2S 8ulm5evs2gaPdPuGqovZ0A9lWAE/tbAoliz5N1JFy6EUsUuedpaP0kEpnP1e6xkcZSHJ 5Y6g== X-Gm-Message-State: AOJu0Ywmpx0TAd8nkS2Y37PKaor+EM/ID95NEnHIRD2Axs3cQXFKpYMM 7zE+MuPi/srUY/3erS1ziwwvId6OkCkWsRpaaSN7OP2pwJ4wMGDLQbtIyskhsBI= X-Google-Smtp-Source: AGHT+IFNKTNmcMIq+Bjzr513pjgOnzfHsHIp1+faYlQF/j2dAqDQgHSiG2CWMMO11G7J95Vp1jAhYA== X-Received: by 2002:a17:906:1406:b0:a2f:b9bf:3955 with SMTP id p6-20020a170906140600b00a2fb9bf3955mr4960091ejc.21.1706559819235; Mon, 29 Jan 2024 12:23:39 -0800 (PST) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id mc4-20020a170906eb4400b00a338fedb9ebsm4316386ejb.54.2024.01.29.12.23.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 12:23:38 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 6/6] media: rcar-vin Rename notifier helper functions Date: Mon, 29 Jan 2024 21:22:54 +0100 Message-ID: <20240129202254.1126012-7-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> References: <20240129202254.1126012-1-niklas.soderlund+renesas@ragnatech.se> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The helper functions to parse device tree and lookup information where previously targeting a shared notifier in the shared group. This have now been reworked to separate notifiers, one for each VIN. Rename and move the functions verbatim to make it clear they now are helpers for each VINs individual notifier instead of a shared one on the group level. Signed-off-by: Niklas Söderlund --- .../platform/renesas/rcar-vin/rcar-core.c | 156 +++++++++--------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index 244ab1b3a8c0..4c5ca4dff77b 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -176,81 +176,6 @@ static void rvin_group_put(struct rvin_dev *vin) kref_put(&group->refcount, rvin_group_release); } -static int rvin_group_entity_to_remote_id(struct rvin_dev *vin, - struct media_entity *entity) -{ - struct v4l2_subdev *sd; - unsigned int i; - - sd = media_entity_to_v4l2_subdev(entity); - - for (i = 0; i < RVIN_REMOTES_MAX; i++) - if (vin->remotes[i].subdev == sd) - return i; - - return -ENODEV; -} - -static int rvin_group_parse_of(struct rvin_dev *vin, unsigned int port, - unsigned int id) -{ - struct fwnode_handle *ep, *fwnode; - struct v4l2_fwnode_endpoint vep = { - .bus_type = V4L2_MBUS_CSI2_DPHY, - }; - struct v4l2_async_connection *asc; - int ret; - - ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(vin->dev), port, id, 0); - if (!ep) - return 0; - - fwnode = fwnode_graph_get_remote_endpoint(ep); - ret = v4l2_fwnode_endpoint_parse(ep, &vep); - fwnode_handle_put(ep); - if (ret) { - vin_err(vin, "Failed to parse %pOF\n", to_of_node(fwnode)); - ret = -EINVAL; - goto out; - } - - asc = v4l2_async_nf_add_fwnode(&vin->notifier, fwnode, - struct v4l2_async_connection); - if (IS_ERR(asc)) { - ret = PTR_ERR(asc); - goto out; - } - - vin->remotes[vep.base.id].asc = asc; - - vin_dbg(vin, "Add device %pOF to slot %u\n", - to_of_node(fwnode), vep.base.id); -out: - fwnode_handle_put(fwnode); - - return ret; -} - -static int rvin_group_notifier_init(struct rvin_dev *vin, unsigned int port, - unsigned int max_id) -{ - unsigned int id; - int ret; - - for (id = 0; id < max_id; id++) { - ret = rvin_group_parse_of(vin, port, id); - if (ret) - return ret; - } - - /* Make sure at least one remote was described. */ - for (id = 0; id < max_id; id++) - if (vin->remotes[id].asc) - return 0; - - return -ENODEV; -} - /* ----------------------------------------------------------------------------- * Controls */ @@ -316,6 +241,81 @@ static int rvin_create_controls(struct rvin_dev *vin, struct v4l2_subdev *subdev * Async notifier */ +static int rvin_remote_entity_to_id(struct rvin_dev *vin, + struct media_entity *entity) +{ + struct v4l2_subdev *sd; + unsigned int i; + + sd = media_entity_to_v4l2_subdev(entity); + + for (i = 0; i < RVIN_REMOTES_MAX; i++) + if (vin->remotes[i].subdev == sd) + return i; + + return -ENODEV; +} + +static int rvin_remote_parse_of(struct rvin_dev *vin, unsigned int port, + unsigned int id) +{ + struct fwnode_handle *ep, *fwnode; + struct v4l2_fwnode_endpoint vep = { + .bus_type = V4L2_MBUS_CSI2_DPHY, + }; + struct v4l2_async_connection *asc; + int ret; + + ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(vin->dev), port, id, 0); + if (!ep) + return 0; + + fwnode = fwnode_graph_get_remote_endpoint(ep); + ret = v4l2_fwnode_endpoint_parse(ep, &vep); + fwnode_handle_put(ep); + if (ret) { + vin_err(vin, "Failed to parse %pOF\n", to_of_node(fwnode)); + ret = -EINVAL; + goto out; + } + + asc = v4l2_async_nf_add_fwnode(&vin->notifier, fwnode, + struct v4l2_async_connection); + if (IS_ERR(asc)) { + ret = PTR_ERR(asc); + goto out; + } + + vin->remotes[vep.base.id].asc = asc; + + vin_dbg(vin, "Add device %pOF to slot %u\n", + to_of_node(fwnode), vep.base.id); +out: + fwnode_handle_put(fwnode); + + return ret; +} + +static int rvin_remote_notifier_init(struct rvin_dev *vin, unsigned int port, + unsigned int max_id) +{ + unsigned int id; + int ret; + + for (id = 0; id < max_id; id++) { + ret = rvin_remote_parse_of(vin, port, id); + if (ret) + return ret; + } + + /* Make sure at least one remote was described. */ + for (id = 0; id < max_id; id++) + if (vin->remotes[id].asc) + return 0; + + return -ENODEV; +} + static int rvin_find_pad(struct v4l2_subdev *sd, int direction) { unsigned int pad; @@ -638,7 +638,7 @@ static int rvin_csi2_link_notify(struct media_link *link, u32 flags, mutex_lock(&group->lock); - csi_id = rvin_group_entity_to_remote_id(vin, link->source->entity); + csi_id = rvin_remote_entity_to_id(vin, link->source->entity); if (csi_id == -ENODEV) { struct v4l2_subdev *sd; @@ -804,7 +804,7 @@ static int rvin_csi2_init(struct rvin_dev *vin) have_parallel = ret != -ENODEV; - ret = rvin_group_notifier_init(vin, 1, RVIN_CSI_MAX); + ret = rvin_remote_notifier_init(vin, 1, RVIN_CSI_MAX); if (ret && ret != -ENODEV) goto err_group; have_remote = ret != -ENODEV; @@ -859,7 +859,7 @@ static int rvin_isp_init(struct rvin_dev *vin) if (ret) goto err_controls; - ret = rvin_group_notifier_init(vin, 2, RVIN_ISP_MAX); + ret = rvin_remote_notifier_init(vin, 2, RVIN_ISP_MAX); if (ret) goto err_group;