From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtp-4.sys.kth.se ([130.237.48.193]:57417 "EHLO smtp-4.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032505AbdD0Wm4 (ORCPT ); Thu, 27 Apr 2017 18:42:56 -0400 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: Laurent Pinchart , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, tomoharu.fukawa.eb@renesas.com, Sakari Ailus , Geert Uytterhoeven , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Kieran Bingham Subject: [PATCH v4 17/27] rcar-vin: prepare digital notifier for group notifier Date: Fri, 28 Apr 2017 00:41:53 +0200 Message-Id: <20170427224203.14611-18-niklas.soderlund+renesas@ragnatech.se> In-Reply-To: <20170427224203.14611-1-niklas.soderlund+renesas@ragnatech.se> References: <20170427224203.14611-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-media-owner@vger.kernel.org List-ID: The media bus parsing functions used by the digital subdevice V4L2 notifier can be shared with the upcoming CSI-2 notifier. To prepare for this move and rename the function to reflect it's generic. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-core.c | 70 +++++++++++++++-------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index ed99b1abb99e9ef9..adc38696a0ba70b9 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -45,6 +45,42 @@ static int rvin_find_pad(struct v4l2_subdev *sd, int direction) return -EINVAL; } +static int rvin_parse_v4l2(struct rvin_dev *vin, + struct device_node *ep, + struct v4l2_mbus_config *mbus_cfg) +{ + struct v4l2_of_endpoint v4l2_ep; + int ret; + + ret = v4l2_of_parse_endpoint(ep, &v4l2_ep); + if (ret) { + vin_err(vin, "Could not parse v4l2 endpoint\n"); + return -EINVAL; + } + + mbus_cfg->type = v4l2_ep.bus_type; + + switch (mbus_cfg->type) { + case V4L2_MBUS_PARALLEL: + vin_dbg(vin, "Found PARALLEL media bus\n"); + mbus_cfg->flags = v4l2_ep.bus.parallel.flags; + break; + case V4L2_MBUS_BT656: + vin_dbg(vin, "Found BT656 media bus\n"); + mbus_cfg->flags = 0; + break; + default: + vin_err(vin, "Unknown media bus type\n"); + return -EINVAL; + } + + return 0; +} + +/* ----------------------------------------------------------------------------- + * Digital async notifier + */ + static bool rvin_mbus_supported(struct rvin_dev *vin) { struct v4l2_subdev *sd = vin->digital.subdev; @@ -145,38 +181,6 @@ static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, return -EINVAL; } -static int rvin_digitial_parse_v4l2(struct rvin_dev *vin, - struct device_node *ep, - struct v4l2_mbus_config *mbus_cfg) -{ - struct v4l2_of_endpoint v4l2_ep; - int ret; - - ret = v4l2_of_parse_endpoint(ep, &v4l2_ep); - if (ret) { - vin_err(vin, "Could not parse v4l2 endpoint\n"); - return -EINVAL; - } - - mbus_cfg->type = v4l2_ep.bus_type; - - switch (mbus_cfg->type) { - case V4L2_MBUS_PARALLEL: - vin_dbg(vin, "Found PARALLEL media bus\n"); - mbus_cfg->flags = v4l2_ep.bus.parallel.flags; - break; - case V4L2_MBUS_BT656: - vin_dbg(vin, "Found BT656 media bus\n"); - mbus_cfg->flags = 0; - break; - default: - vin_err(vin, "Unknown media bus type\n"); - return -EINVAL; - } - - return 0; -} - static int rvin_digital_graph_parse(struct rvin_dev *vin) { struct device_node *ep, *np; @@ -201,7 +205,7 @@ static int rvin_digital_graph_parse(struct rvin_dev *vin) } of_node_put(np); - ret = rvin_digitial_parse_v4l2(vin, ep, &vin->mbus_cfg); + ret = rvin_parse_v4l2(vin, ep, &vin->mbus_cfg); of_node_put(ep); if (ret) return ret; -- 2.12.2