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: 13536343 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 A777976031 for ; Mon, 29 Jan 2024 20:23:37 +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=1706559819; cv=none; b=aBMDu+DEPvamA+j/nOvZ2zIBZSsd0WM57R5rYod8p+ylwUtrGMpAGK3DIcGMxl+fSk2CRkIRMc4kd0zHyMAH52iDJyj6VVfuZ8QXkZzQc3bsD4QgQ2I4XktNiR9rCEbpN45ceud6+H3vO2Ls7SN8Xfv8ytuxzwDBEjVeIbi0V4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559819; c=relaxed/simple; bh=KhRCSmDF0oZ/OZvfrCn77tU3k7BRNvexFdBiP7k7Bpk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XJPT+pc0hiyxhgkaaVo+JSesBKzGyzb/3sDFEMjAFddkUJ8/zbYBAgPaoGItjHhhet3+yWmSBh4kp5xIJ7ZvgXaQQpZphKAHmRYn5Z4B+PoBJ4gcHk7g8xaottr4NSDqf269+XywKSzXpK5sh2bK1Hrg8Stg/BMJag0ZpjLqgZc= 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.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="XkUCb1fm" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a315f43ecc3so303985266b.0 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=s7+TUSD2Nt7GcRhEgYwEn7UwEzsi6R0+m81Dqcc+gRQTBkFuJu/Ur4VTmyCJ/Hlbe5 F/+CUtZkPlDM1AT1HaqZIHTF74mhfXGRRDZzrCahN4ZMVHsEay6zZ/EWr+T4HTGtul0o z5/fZIjKqhUIquLozt5TvsRKkA3XCU9khdrU8lT0FXVB5iXVppB2/FrL78ndjQ3RY85e 8vsolsUiXrgI1D6jF5tQ0SJ6/vrCQ7t0WcMa7wl/41bXn/l4RtoXnT6APMxzgLeId64J hkD15O8vofFPogubTmgQQGLvSZpWOzSercM6Ormgzm1mKGQt2nQ0HPEmy4zIah/4mxBG eWAQ== X-Gm-Message-State: AOJu0YwAnBe2G09A1Kz0ZVkiQFkLvubXM8lQtVa7zj55AQv9nDsHgWyC qRK47kp1GGyYGDwy0/efb4J9ljMciwJVS3dy2wryYPU5SL7zSliNG2iJ/2UDMjE= 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-media@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: 13536344 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 7D1A276048 for ; Mon, 29 Jan 2024 20:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559820; cv=none; b=dWdfFNmy3N695Yv2tT22oQ1NyIboTWcv+pu5er2Idj9NZI0LaIqB/ghWB0FkHz1spUqm+233hfHfSXFfkXPrWaix6Jok4hYeOAMLJYSrfFWbr1DJL91OmGcVEtkpaF/HhZ12LUn7Se/U18IJkO06GE60EO2jZHQQ1V6KjmBiD0Y= 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.43 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-f43.google.com with SMTP id 2adb3069b0e04-5101f2dfdadso5516214e87.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=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=LbhpeANX9I315+1sGOsorcCYX3X5YUCErX1rnlLup6pUbmocwd4VUgMQ/nX8I5EfHz gcFWcFw1PEpKrpopKGRkB5Y3xuqHSF5g+v9QGnrdFNhGMI467qFnG40XFfYHCm+SVX4P KeBASvQCvyOEqDybCirNrN1GMsvIHtni74GF8amvk6XUAnT6B6hjUctPTEBdr4cUMKxW Mmmgn3/jij9YbX8TZ64VcTV0H59MtDILVdKe5zsYTXlN+wKsjFbafMYAc+/492dGnc3x sE0+sryd8VHqxweozaaeuNIp6Qs065mTpHvhkGduHmZAcFLG/Fjo2cqpTqpc44quq/8g irzg== X-Gm-Message-State: AOJu0Ywr6q9Fjj89Y/Yi4djSKrl20Y0HgkgGGpCtJSq7gginUH7a65ZJ PBU370QSC4kx9YiBBGz7R5CW+awtDMU8Gl9dPUFTbty3zBxo2ZLzHzyAmyUlyOc= 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-media@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: 13536346 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 F030C2E3F2 for ; Mon, 29 Jan 2024 20:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559821; cv=none; b=AVvajnGkYerlPLMHucxdTyc5NHNlvmrUJ0suRzhXNp5I/M6jxUmsUqZ6uX5PlUYFrvIGQMteCMOGyqex0iUtNLAdzeBdbXzyo94Hhe0OyoR3losS78v+or6fwM1X+ttHKiBDzKKeFQne9wmvMaiBkVmD+JAdk3T5rRAwD8i97to= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559821; c=relaxed/simple; bh=iMlH79qYBNldFFv1Njqv0IFBn14F++he1X19oe3kb2I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GOpHE/x0XR2Gfw7b+WsXG3yPcvzVb2DFTRh1PljD074qibSK+QFlWpwpUPAMxZL0RGXxo1T6srsDh4SFICZGvmR3W13FHY7TzKrIgBzRNEgwHHg4bD1xdIPlxd0u0hrZyH0upIiamvtHYY/hjtFr54oSEBUM/KUIUzxnISyVoco= 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.46 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-f46.google.com with SMTP id a640c23a62f3a-a35c0ed672cso176886766b.1 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=ckkCTHz4fA+9ueNbxkNRU2qmLWWkZgZmfLJoxMM3PUb/VePIDQAykGQdeU0QFdN+9w N9K0ADfg2ApEELx1RVkhg0vykRp2GnUQwmDwxWLkuL16ufKR5A0hIhwUI/zL3tiViJAT Ngc0zyHBPi/pUTSkBYKZJgOTlrNMlpz7BtatfiHI/P6F8FR+fT85ThS29XZwz4FZNO0s 96pPG3h77NWuTBBee2Y++kRJ8iAGcCGBV92hBHXNde8AGEgYjrMlnjlxTdbVBwJ2YQPA FhYqcLfaoSXoawVJZ31dXXk+HFPkyWiiCKV2H0CA9II9IIi6Ik72THU/YT9SfefVaTPX 3v6w== X-Gm-Message-State: AOJu0Yy/J6IAU4qGXMTMnNlqbxxpi6dHCEn1iCTnKrsrFEcrJQ2WUdpj 3YFMFcYmzrM66HN0XfTHwXlrjYgLpoiva50r6SYbtC/bWWDaeALBBhv0dofrzGQcyqpc/sKEG6P A 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-media@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: 13536345 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 725D476053 for ; Mon, 29 Jan 2024 20:23:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559821; cv=none; b=gvpoMrIYPud0czAeOBdMgB9Y6xVH9XbcDtiYxW9gBd3defpaG1cUDiCZCldB0tY6VfLYcafvbdGkdoanB8iPde6djv9qDfoCjZf9FrlD2s21suW2YUNpRAdo+4DSPwfldzxEDSgcj7H2lBpiZaRlz7ODKJcHat3530qbabw6O84= 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.45 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-f45.google.com with SMTP id a640c23a62f3a-a293f2280c7so339635866b.1 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=Gst6yJ+92KEY6a99k2vIIVp9Y8trkWHDEkTxkJSvcxoZiZ3/kuZ6PMWObY6jYK9tpw JnltE/I9QE4q1xscdT6BXuYjc8qpuntFa4+UaZSwOAGVyqMuJIEH6hKecE6iYi5g/u8z qLgEW/TEO8df/DMtgHHrYSUjl19GnbmHz/vtmMXuaJPqDOjUTz0jZY0BQlZ0t8LS5MIz fLD7vowDDCr9j22ScHtXkfMR96y+aG5qFUBk+nWrnrHOpxK3X+EFciPSW8luwmvWqsmV Uhb5GyEg+iasl5VlosL1AuKfIfMfRiFIfwvO1fAo7pZf6nNCg3St3UiNOeETvwPlPAwd e/zg== X-Gm-Message-State: AOJu0YzVJFrqBs8hzmWKqGg5HEUTBLDi0g70WmJGvLvf1c6EzFT/R0Rc DfR6ZIPzOi837RTRP2nlOMK3foSYVSMwobjSWBp6IqVKdRC4UNfsX0O8Rxl8P5BFgglMQdgIh4n f 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-media@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: 13536348 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 8D030152E18 for ; Mon, 29 Jan 2024 20:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559823; cv=none; b=N4KRYo+H3YPDWlXBzlXISqEeX6ig111eG/sDGIy+dBh1zNN+qZ1D1C/OmKuEID6gOfDFLs/cYRImmoXobQ2QUZCDqVAmZam32a7mbE/1ykP4N+1LB+a5FOGawMhy0J76TtEjRffD9ddTFZLG1V0dfsGMUCzEmsK45PV2yueq7os= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559823; c=relaxed/simple; bh=w1rgm+8bn6ewhLDtOfMuk/lZnIHSpWMrmAeDlZO48Ok=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mVP3sPlK7GffAeqOip0HbLzZ7Ssch3MPpWcAsl6ZbpD7VnC3vBXUQkDzZr6R4Od4mpS7c9uGgb0HhFzkinWbbde43smCciLNrb1eNZoRcizTzkyAwBALmDNiF03fZbTFhOwb/T1HWPJIyqaOsl8fHI0T1yfxtXMbPU8DtVRCAYU= 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.48 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-f48.google.com with SMTP id a640c23a62f3a-a26ed1e05c7so371555466b.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=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=RlB0DUwg8oUdtMXMr0ztOBXLTTfmjsBmuh4HohBY/vdNED1aWnLHCWMRC+HCoF5igD RVr1e1Kj12DwMtPXwqiQPskpPRgMCUiNFHIGrenh5cMEiXuO0ZsW3JC2sHSxhvyJDz3Q mIN96u+6Q4I4H5aizqOimPl/s9ANmmMeIx9Wemzgli6O1uqnrvtwuRMQgq11beWrmb/b wvrGE6iwSv4HfIIQJCpcXh26b2mwl2dzfNRuR3qDQ/P8fYQszdsDaYGfb/O7MzI2li9F mGBKNQW+B4odvRk6zcggMT9FcIu/4A59QxcZujyryUEl0B+UTWfb2P8DPval+nx92IVZ sQsg== X-Gm-Message-State: AOJu0Yw6rFJSmkeyx3FqpterHhHo7cnrOu+qAVw4OH+kbKGaIcEJqekE DTyfHSSyYUg5/5ltusZKkJ+f7yDQNznx77wnhUTWWFUVK88vQp5NnsXK1cmGzJ0= 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-media@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: 13536347 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 251766F08E for ; Mon, 29 Jan 2024 20:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706559823; cv=none; b=R6MigrCPvoDO8nCQRFizuTH3/0eK/d8iiahXQwhu7CTXJXX5jrDKo8J3O81T1Hd0KsNjvdiFeEkKPg+sFz8LVYviC64Vh/SVclf4j9nifh1yLaqiawdkeZQ2Y5eQBWIL4r3R2AeJ8A101vclQuZthR0Ad/ruFrvP1qOMZqfqOBA= 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.218.43 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-ej1-f43.google.com with SMTP id a640c23a62f3a-a26f73732c5so364581266b.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=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=LCa3Mh0b/Kfpc3I2cfrv+x1BZHHI9OR3h6CwtSZ9Zofiu/eAgRmZmqcAp5WtfUREk1 czz7JmHTMVj5MgS56kJ/RbS/a6d9rbKiS5L0WFvxBOX8zhE9CrDLNxU1Mo5b0gsbc2q2 7Ah59GrfQyU08zAODwULUDLBRQw90hloY0cTXrGs1BRnTPpVLEsn5V2Amk4xBSPYNj8B Vjh0vG0zkC3c3XB79baUmb8ypOGuxGLkPGh5KsAsiAuvg31tJ7BD04CO/nYJ6qYlYJM5 iQnyF7W3JrK5dlXCKHd6EOho9LoOxrW0AfF+XgjC/g2VUtH/XPfregGZaJKyuTqMP4RV t8EQ== X-Gm-Message-State: AOJu0Yx+6CG0M9JS8gFRx/N2bDACopwJGdbC4DTei5cKnNz4qxlMmImt mjv8IPhvzIt97VW1bjUW/tDC/yO9orXcFFihExIu6dtV8fhXPedTsav39eiSMv4= 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-media@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;