From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
pali.rohar@gmail.com
Subject: Re: [RFC 03/18] omap3isp: Separate external link creation from platform data parsing
Date: Sun, 08 Mar 2015 01:23:09 +0200 [thread overview]
Message-ID: <6824722.Hxqf1AYo4M@avalon> (raw)
In-Reply-To: <1425764475-27691-4-git-send-email-sakari.ailus@iki.fi>
Hi Sakari,
Thank you for the patch.
On Saturday 07 March 2015 23:41:00 Sakari Ailus wrote:
> Move the code which connects the external entity to an ISP entity into a
> separate function. This disconnects it from parsing the platform data.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
> ---
> drivers/media/platform/omap3isp/isp.c | 147 +++++++++++++++--------------
> 1 file changed, 74 insertions(+), 73 deletions(-)
>
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 4ab674d..a607f26 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -1832,6 +1832,77 @@ isp_register_subdev_group(struct isp_device *isp,
> return sensor;
> }
>
> +static int isp_link_entity(
> + struct isp_device *isp, struct media_entity *entity,
> + enum isp_interface_type interface)
> +{
> + struct media_entity *input;
> + unsigned int flags;
> + unsigned int pad;
> + unsigned int i;
> +
> + /* Connect the sensor to the correct interface module.
> + * Parallel sensors are connected directly to the CCDC, while
> + * serial sensors are connected to the CSI2a, CCP2b or CSI2c
> + * receiver through CSIPHY1 or CSIPHY2.
> + */
> + switch (interface) {
> + case ISP_INTERFACE_PARALLEL:
> + input = &isp->isp_ccdc.subdev.entity;
> + pad = CCDC_PAD_SINK;
> + flags = 0;
> + break;
> +
> + case ISP_INTERFACE_CSI2A_PHY2:
> + input = &isp->isp_csi2a.subdev.entity;
> + pad = CSI2_PAD_SINK;
> + flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED;
> + break;
> +
> + case ISP_INTERFACE_CCP2B_PHY1:
> + case ISP_INTERFACE_CCP2B_PHY2:
> + input = &isp->isp_ccp2.subdev.entity;
> + pad = CCP2_PAD_SINK;
> + flags = 0;
> + break;
> +
> + case ISP_INTERFACE_CSI2C_PHY1:
> + input = &isp->isp_csi2c.subdev.entity;
> + pad = CSI2_PAD_SINK;
> + flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED;
> + break;
> +
> + default:
> + dev_err(isp->dev, "%s: invalid interface type %u\n", __func__,
> + interface);
> + return -EINVAL;
> + }
> +
> + /*
> + * Not all interfaces are available on all revisions of the
> + * ISP. The sub-devices of those interfaces aren't initialised
> + * in such a case. Check this by ensuring the num_pads is
> + * non-zero.
> + */
> + if (!input->num_pads) {
> + dev_err(isp->dev, "%s: invalid input %u\n", entity->name,
> + interface);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < entity->num_pads; i++) {
> + if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE)
> + break;
> + }
> + if (i == entity->num_pads) {
> + dev_err(isp->dev, "%s: no source pad in external entity\n",
> + __func__);
> + return -EINVAL;
> + }
> +
> + return media_entity_create_link(entity, i, input, pad, flags);
> +}
> +
> static int isp_register_entities(struct isp_device *isp)
> {
> struct isp_platform_data *pdata = isp->pdata;
> @@ -1894,85 +1965,15 @@ static int isp_register_entities(struct isp_device
> *isp)
>
> /* Register external entities */
> for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) {
> - struct v4l2_subdev *sensor;
> - struct media_entity *input;
> - unsigned int flags;
> - unsigned int pad;
> - unsigned int i;
> + struct v4l2_subdev *sensor =
> + isp_register_subdev_group(isp, subdevs->subdevs);
>
> - sensor = isp_register_subdev_group(isp, subdevs->subdevs);
Nit-picking a bit, I'd keep the variable declaration and the function call
separate here, as isp_register_subdev_group() is much more than an
initializer. Apart from that,
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> if (sensor == NULL)
> continue;
>
> sensor->host_priv = subdevs;
>
> - /* Connect the sensor to the correct interface module. Parallel
> - * sensors are connected directly to the CCDC, while serial
> - * sensors are connected to the CSI2a, CCP2b or CSI2c receiver
> - * through CSIPHY1 or CSIPHY2.
> - */
> - switch (subdevs->interface) {
> - case ISP_INTERFACE_PARALLEL:
> - input = &isp->isp_ccdc.subdev.entity;
> - pad = CCDC_PAD_SINK;
> - flags = 0;
> - break;
> -
> - case ISP_INTERFACE_CSI2A_PHY2:
> - input = &isp->isp_csi2a.subdev.entity;
> - pad = CSI2_PAD_SINK;
> - flags = MEDIA_LNK_FL_IMMUTABLE
> - | MEDIA_LNK_FL_ENABLED;
> - break;
> -
> - case ISP_INTERFACE_CCP2B_PHY1:
> - case ISP_INTERFACE_CCP2B_PHY2:
> - input = &isp->isp_ccp2.subdev.entity;
> - pad = CCP2_PAD_SINK;
> - flags = 0;
> - break;
> -
> - case ISP_INTERFACE_CSI2C_PHY1:
> - input = &isp->isp_csi2c.subdev.entity;
> - pad = CSI2_PAD_SINK;
> - flags = MEDIA_LNK_FL_IMMUTABLE
> - | MEDIA_LNK_FL_ENABLED;
> - break;
> -
> - default:
> - dev_err(isp->dev, "%s: invalid interface type %u\n",
> - __func__, subdevs->interface);
> - ret = -EINVAL;
> - goto done;
> - }
> -
> - /*
> - * Not all interfaces are available on all revisions
> - * of the ISP. The sub-devices of those interfaces
> - * aren't initialised in such a case. Check this by
> - * ensuring the num_pads is non-zero.
> - */
> - if (!input->num_pads) {
> - dev_err(isp->dev, "%s: invalid input %u\n",
> - entity->name, subdevs->interface);
> - ret = -EINVAL;
> - goto done;
> - }
> -
> - for (i = 0; i < sensor->entity.num_pads; i++) {
> - if (sensor->entity.pads[i].flags & MEDIA_PAD_FL_SOURCE)
> - break;
> - }
> - if (i == sensor->entity.num_pads) {
> - dev_err(isp->dev,
> - "%s: no source pad in external entity\n",
> - __func__);
> - ret = -EINVAL;
> - goto done;
> - }
> -
> - ret = media_entity_create_link(&sensor->entity, i, input, pad,
> - flags);
> + ret = isp_link_entity(isp, &sensor->entity, subdevs->interface);
> if (ret < 0)
> goto done;
> }
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2015-03-07 23:23 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-07 21:40 [RFC 00/18] Device tree support for omap3isp, N9[50] primary camera Sakari Ailus
2015-03-07 21:40 ` [RFC 01/18] omap3isp: Fix error handling in probe Sakari Ailus
2015-03-07 23:17 ` Laurent Pinchart
2015-03-07 21:40 ` [RFC 02/18] omap3isp: Avoid a BUG_ON() in media_entity_create_link() Sakari Ailus
2015-03-07 23:19 ` Laurent Pinchart
2015-03-07 21:41 ` [RFC 03/18] omap3isp: Separate external link creation from platform data parsing Sakari Ailus
2015-03-07 23:23 ` Laurent Pinchart [this message]
2015-03-07 21:41 ` [RFC 04/18] omap3isp: DT support for clocks Sakari Ailus
2015-03-07 21:41 ` [RFC 05/18] omap3isp: Platform data could be NULL Sakari Ailus
2015-03-07 23:50 ` Laurent Pinchart
2015-03-07 21:41 ` [RFC 06/18] omap3isp: Refactor device configuration structs for Device Tree Sakari Ailus
2015-03-11 23:07 ` Laurent Pinchart
2015-03-07 21:41 ` [RFC 07/18] omap3isp: Rename regulators to better suit the " Sakari Ailus
2015-03-07 23:26 ` Laurent Pinchart
2015-03-07 21:41 ` [RFC 08/18] omap3isp: Calculate vpclk_div for CSI-2 Sakari Ailus
2015-03-07 23:27 ` Laurent Pinchart
2015-03-07 21:41 ` [RFC 09/18] omap3isp: Replace mmio_base_phys array with the histogram block base Sakari Ailus
2015-03-07 23:28 ` Laurent Pinchart
2015-03-07 21:41 ` [RFC 10/18] omap3isp: Move the syscon register out of the ISP register maps Sakari Ailus
2015-03-07 23:34 ` Laurent Pinchart
2015-03-07 23:43 ` Sakari Ailus
2015-03-09 15:20 ` Tony Lindgren
2015-03-14 15:00 ` Sakari Ailus
2015-03-16 0:19 ` Laurent Pinchart
2015-03-16 23:21 ` Sakari Ailus
2015-03-07 21:41 ` [RFC 11/18] omap3isp: Replace many MMIO regions by two Sakari Ailus
2015-03-07 23:43 ` Laurent Pinchart
2015-03-09 15:22 ` Tony Lindgren
2015-03-07 21:41 ` [RFC 12/18] dt: bindings: Add lane-polarity property to endpoint nodes Sakari Ailus
2015-03-07 23:46 ` Laurent Pinchart
2015-03-07 23:57 ` Sakari Ailus
2015-03-07 21:41 ` [RFC 13/18] v4l: of: Read lane-polarity endpoint property Sakari Ailus
2015-03-07 23:49 ` Laurent Pinchart
2015-03-12 22:23 ` Sakari Ailus
2015-03-12 22:25 ` Sakari Ailus
2015-03-07 21:41 ` [RFC 14/18] dt: bindings: Add bindings for omap3isp Sakari Ailus
2015-03-11 23:39 ` Laurent Pinchart
2015-03-12 23:03 ` Sakari Ailus
2015-03-12 23:11 ` Laurent Pinchart
2015-03-12 23:43 ` Sakari Ailus
2015-03-13 9:34 ` Sebastian Reichel
2015-03-14 0:33 ` Laurent Pinchart
2015-03-14 14:10 ` Sakari Ailus
2015-03-07 21:41 ` [RFC 15/18] omap3isp: Add support for the Device Tree Sakari Ailus
2015-03-11 23:48 ` Laurent Pinchart
2015-03-14 14:12 ` Sakari Ailus
2015-03-07 21:41 ` [RFC 16/18] arm: dts: omap3: Add DT entries for OMAP 3 Sakari Ailus
2015-03-07 23:51 ` Laurent Pinchart
2015-03-14 14:43 ` Sakari Ailus
2015-03-07 21:41 ` [RFC 17/18] arm: dts: n950, n9: Add primary camera support Sakari Ailus
2015-03-07 23:56 ` Laurent Pinchart
2015-03-08 0:03 ` Sakari Ailus
2015-03-07 21:41 ` [RFC 18/18] omap3isp: Deprecate platform data support Sakari Ailus
2015-03-07 23:35 ` Laurent Pinchart
2015-03-13 9:40 ` Sebastian Reichel
2015-03-13 16:43 ` Tony Lindgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6824722.Hxqf1AYo4M@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=pali.rohar@gmail.com \
--cc=sakari.ailus@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).