All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Stanislawski <t.stanislaws@samsung.com>
To: Karol Lewandowski <k.lewandowsk@samsung.com>
Cc: linux-samsung-soc@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org, thomas.abraham@linaro.org,
	m.szyprowski@samsung.com, kyungmin.park@samsung.com,
	linux-kernel@vger.kernel.org, olof@lixom.net,
	kgene.kim@samsung.com
Subject: Re: [PATCH 09/13] s5p-tv: Move HDMIPHY and MHL subdev probing to dedicated function
Date: Fri, 13 Apr 2012 08:42:44 +0200	[thread overview]
Message-ID: <4F87CAE4.80305@samsung.com> (raw)
In-Reply-To: <1334256332-29867-10-git-send-email-k.lewandowsk@samsung.com>

Hi Karol,
Thank you for the patch.

On 04/12/2012 08:45 PM, Karol Lewandowski wrote:
> Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
> Cc: Tomasz Stanislawski <t.stanislaws@samsung.com>
> ---
>  drivers/media/video/s5p-tv/hdmi_drv.c |   90 ++++++++++++++++++---------------
>  1 files changed, 49 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/media/video/s5p-tv/hdmi_drv.c b/drivers/media/video/s5p-tv/hdmi_drv.c
> index 4865d25..fff3cab 100644
> --- a/drivers/media/video/s5p-tv/hdmi_drv.c
> +++ b/drivers/media/video/s5p-tv/hdmi_drv.c
> @@ -865,11 +865,47 @@ fail:
>  	return -ENODEV;
>  }
>  
> +static struct v4l2_subdev *hdmi_get_subdev(
> +	struct hdmi_device *hdmi_dev,
> +	struct i2c_board_info *bdinfo,
> +	int bus,
> +	const char *propname)
> +{
> +	struct v4l2_subdev *sd = NULL;
> +	struct i2c_adapter *adapter;
> +	struct device *dev = hdmi_dev->dev;
> +
> +	if (!bdinfo) {
> +		dev_err(dev, "%s info is missing in platform data\n",
> +			propname);
> +		return ERR_PTR(-ENXIO);
> +	}
> +
> +	adapter = i2c_get_adapter(bus);
> +	if (adapter == NULL) {
> +		dev_err(dev, "%s adapter request failed, name\n",
> +			propname);
> +		return ERR_PTR(-ENXIO);
> +	}
> +
> +	sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev,
> +				       adapter, bdinfo, NULL);
> +
> +	/* on failure or not adapter is no longer useful */
> +	i2c_put_adapter(adapter);
> +
> +	if (sd == NULL) {
> +		dev_err(dev, "missing subdev for %s\n", propname);
> +		return ERR_PTR(-ENODEV);
> +	}
> +
> +	return sd;
> +}
> +
>  static int __devinit hdmi_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct resource *res;
> -	struct i2c_adapter *adapter;
>  	struct v4l2_subdev *sd;
>  	struct hdmi_device *hdmi_dev = NULL;
>  	struct s5p_hdmi_platform_data *pdata = dev->platform_data;
> @@ -937,51 +973,23 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
>  		goto fail_init;
>  	}
>  
> -	/* testing if hdmiphy info is present */
> -	if (!pdata->hdmiphy_info) {
> -		dev_err(dev, "hdmiphy info is missing in platform data\n");
> -		ret = -ENXIO;
> +	hdmi_dev->phy_sd = hdmi_get_subdev(hdmi_dev,

If we know that plat data is missing so what is the purpose of calling
hdmi_get_subdev while we know that this function is going to fail?

> +					   pdata ? pdata->hdmiphy_info : NULL,
> +					   pdata ? pdata->hdmiphy_bus : -1,
> +					   "phy");
> +	if (IS_ERR_OR_NULL(hdmi_dev->phy_sd)) {
> +		ret = PTR_ERR(hdmi_dev->phy_sd);
>  		goto fail_vdev;
>  	}
> -
> -	adapter = i2c_get_adapter(pdata->hdmiphy_bus);
> -	if (adapter == NULL) {
> -		dev_err(dev, "hdmiphy adapter request failed\n");
> -		ret = -ENXIO;
> +	hdmi_dev->mhl_sd = hdmi_get_subdev(hdmi_dev,
> +					   pdata ? pdata->mhl_info : NULL ,
> +					   pdata ? pdata->mhl_bus : -1,
> +					   "mhl");
> +	if (IS_ERR_OR_NULL(hdmi_dev->mhl_sd)) {
> +		ret = PTR_ERR(hdmi_dev->mhl_sd)

The MHL is an optional subdev. There are platforms that support HDMI but does
not have MHL "on board" like Universal C210. Failing due to a lack of
MHL plat data will break HDMI support on Universal.

;
>  		goto fail_vdev;
>  	}
>  
> -	hdmi_dev->phy_sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev,
> -		adapter, pdata->hdmiphy_info, NULL);
> -	/* on failure or not adapter is no longer useful */
> -	i2c_put_adapter(adapter);
> -	if (hdmi_dev->phy_sd == NULL) {
> -		dev_err(dev, "missing subdev for hdmiphy\n");
> -		ret = -ENODEV;
> -		goto fail_vdev;
> -	}
> -
> -	/* initialization of MHL interface if present */
> -	if (pdata->mhl_info) {
> -		adapter = i2c_get_adapter(pdata->mhl_bus);
> -		if (adapter == NULL) {
> -			dev_err(dev, "MHL adapter request failed\n");
> -			ret = -ENXIO;
> -			goto fail_vdev;
> -		}
> -
> -		hdmi_dev->mhl_sd = v4l2_i2c_new_subdev_board(
> -			&hdmi_dev->v4l2_dev, adapter,
> -			pdata->mhl_info, NULL);
> -		/* on failure or not adapter is no longer useful */
> -		i2c_put_adapter(adapter);
> -		if (hdmi_dev->mhl_sd == NULL) {
> -			dev_err(dev, "missing subdev for MHL\n");
> -			ret = -ENODEV;
> -			goto fail_vdev;
> -		}
> -	}
> -
>  	clk_enable(hdmi_dev->res.hdmi);
>  
>  	pm_runtime_enable(dev);

Regards,
Tomasz Stanislawski

  reply	other threads:[~2012-04-13  6:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12 18:45 [RFC/PATCH 00/13] ARM: Exynos4: Add DTS for Samsung's Nuri board Karol Lewandowski
2012-04-12 18:45 ` [PATCH 01/13] regulator: Fix DT node name checking in max8997-pmic Karol Lewandowski
2012-04-24 22:56   ` Olof Johansson
2012-04-24 22:56     ` Olof Johansson
2012-04-24 22:57     ` Olof Johansson
2012-04-12 18:45 ` [PATCH 02/13] ARM: Add document to list devices with trivial DT description Karol Lewandowski
2012-04-12 18:45 ` [PATCH 03/13] s5p-g2d: Make it possible to instantiate driver from DT Karol Lewandowski
2012-04-12 18:45   ` Karol Lewandowski
2012-04-12 18:45 ` [PATCH 04/13] i2c-pxa: Drop leftover comment Karol Lewandowski
2012-04-12 18:45 ` [PATCH 05/13] i2c: Dynamically assign adapter id if it wasn't explictly specified Karol Lewandowski
2012-04-12 18:45 ` [PATCH 06/13] s5p-tv: Add initial DT-support for SiI9234 Karol Lewandowski
2012-04-12 18:45   ` Karol Lewandowski
2012-04-12 18:45 ` [PATCH 07/13] s5p-tv: Add initial DT-support for TV mixer Karol Lewandowski
2012-04-12 18:45 ` [PATCH 08/13] s5p-tv: Add initial DT-support for HDMIPHY Karol Lewandowski
2012-04-12 18:45 ` [PATCH 09/13] s5p-tv: Move HDMIPHY and MHL subdev probing to dedicated function Karol Lewandowski
2012-04-13  6:42   ` Tomasz Stanislawski [this message]
2012-04-12 18:45 ` [PATCH 10/13] s5p-tv: Add DT-support for HDMI driver Karol Lewandowski
2012-04-13  7:21   ` Tomasz Stanislawski
2012-04-12 18:45 ` [PATCH 11/13] ARM: Exynos4: dts: Specify address and size cells for i2c controllers Karol Lewandowski
2012-04-12 18:45 ` [PATCH 12/13] ARM: Exynos4: Add few more i2c OF compat definitions Karol Lewandowski
2012-04-12 18:45 ` [PATCH 13/13] ARM: dts: Add initial dts for Samsung's NURI board based on Exynos4210 Karol Lewandowski

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=4F87CAE4.80305@samsung.com \
    --to=t.stanislaws@samsung.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=k.lewandowsk@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=olof@lixom.net \
    --cc=thomas.abraham@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.