diff mbox

[2/3] drm/exynos: dp: Remove support for unused dptx-phy

Message ID 1410786785-9838-3-git-send-email-gautam.vivek@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vivek Gautam Sept. 15, 2014, 1:13 p.m. UTC
Now that we have moved to generic phy based bindings,
we don't need to have any code related to older dptx-phy.
Nobody is using this dptx-phy anymore, so removing the
same.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Jingoo Han <jg1.han@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
 drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
 2 files changed, 13 insertions(+), 47 deletions(-)

Comments

Vivek Gautam Oct. 8, 2014, 2:57 a.m. UTC | #1
Hi,


On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
> Now that we have moved to generic phy based bindings,
> we don't need to have any code related to older dptx-phy.
> Nobody is using this dptx-phy anymore, so removing the
> same.
>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> Cc: Jingoo Han <jg1.han@samsung.com>
> ---

Is someone taking care of this patch ? We already have got the corresponsding
dp-phy patch merged, so we should also get this patch in.

>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>  2 files changed, 13 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 4f3c7eb..5ffc1b2 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>
>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>  {
> -       if (dp->phy) {
> +       if (dp->phy)
>                 phy_power_on(dp->phy);
> -       } else if (dp->phy_addr) {
> -               u32 reg;
> -
> -               reg = __raw_readl(dp->phy_addr);
> -               reg |= dp->enable_mask;
> -               __raw_writel(reg, dp->phy_addr);
> -       }
>  }
>
>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>  {
> -       if (dp->phy) {
> +       if (dp->phy)
>                 phy_power_off(dp->phy);
> -       } else if (dp->phy_addr) {
> -               u32 reg;
> -
> -               reg = __raw_readl(dp->phy_addr);
> -               reg &= ~(dp->enable_mask);
> -               __raw_writel(reg, dp->phy_addr);
> -       }
>  }
>
>  static void exynos_dp_poweron(struct exynos_drm_display *display)
> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>
>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>  {
> -       struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
> -       u32 phy_base;
>         int ret = 0;
>
> -       dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
> -       if (!dp_phy_node) {
> -               dp->phy = devm_phy_get(dp->dev, "dp");
> -               return PTR_ERR_OR_ZERO(dp->phy);
> -       }
> -
> -       if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
> -               dev_err(dp->dev, "failed to get reg for dptx-phy\n");
> -               ret = -EINVAL;
> -               goto err;
> -       }
> -
> -       if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
> -                               &dp->enable_mask)) {
> -               dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
> -               ret = -EINVAL;
> -               goto err;
> -       }
> -
> -       dp->phy_addr = ioremap(phy_base, SZ_4);
> -       if (!dp->phy_addr) {
> -               dev_err(dp->dev, "failed to ioremap dp-phy\n");
> -               ret = -ENOMEM;
> -               goto err;
> +       dp->phy = devm_phy_get(dp->dev, "dp");
> +       if (IS_ERR(dp->phy)) {
> +               ret = PTR_ERR(dp->phy);
> +               if (ret == -ENOSYS || ret == -ENODEV) {
> +                       dp->phy = NULL;
> +               } else if (ret == -EPROBE_DEFER) {
> +                       return ret;
> +               } else {
> +                       dev_err(dp->dev, "no DP phy configured\n");
> +                       return ret;
> +               }
>         }
>
> -err:
> -       of_node_put(dp_phy_node);
> -
>         return ret;
>  }
>
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
> index a1aee69..6426201 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
> @@ -153,8 +153,6 @@ struct exynos_dp_device {
>         struct clk              *clock;
>         unsigned int            irq;
>         void __iomem            *reg_base;
> -       void __iomem            *phy_addr;
> -       unsigned int            enable_mask;
>
>         struct video_info       *video_info;
>         struct link_train       link_train;
> --
> 1.7.10.4
>
Vivek Gautam Oct. 8, 2014, 3 a.m. UTC | #2
Hi,


CC'ing Kukjin,
my bad, missed him while sending the patch. :-(

On Wed, Oct 8, 2014 at 8:27 AM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
> Hi,
>
>
> On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
>> Now that we have moved to generic phy based bindings,
>> we don't need to have any code related to older dptx-phy.
>> Nobody is using this dptx-phy anymore, so removing the
>> same.
>>
>> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>> Cc: Jingoo Han <jg1.han@samsung.com>
>> ---
>
> Is someone taking care of this patch ? We already have got the corresponsding
> dp-phy patch merged, so we should also get this patch in.
>
>>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>>  2 files changed, 13 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> index 4f3c7eb..5ffc1b2 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>>
>>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>>  {
>> -       if (dp->phy) {
>> +       if (dp->phy)
>>                 phy_power_on(dp->phy);
>> -       } else if (dp->phy_addr) {
>> -               u32 reg;
>> -
>> -               reg = __raw_readl(dp->phy_addr);
>> -               reg |= dp->enable_mask;
>> -               __raw_writel(reg, dp->phy_addr);
>> -       }
>>  }
>>
>>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>>  {
>> -       if (dp->phy) {
>> +       if (dp->phy)
>>                 phy_power_off(dp->phy);
>> -       } else if (dp->phy_addr) {
>> -               u32 reg;
>> -
>> -               reg = __raw_readl(dp->phy_addr);
>> -               reg &= ~(dp->enable_mask);
>> -               __raw_writel(reg, dp->phy_addr);
>> -       }
>>  }
>>
>>  static void exynos_dp_poweron(struct exynos_drm_display *display)
>> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>>
>>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>>  {
>> -       struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
>> -       u32 phy_base;
>>         int ret = 0;
>>
>> -       dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
>> -       if (!dp_phy_node) {
>> -               dp->phy = devm_phy_get(dp->dev, "dp");
>> -               return PTR_ERR_OR_ZERO(dp->phy);
>> -       }
>> -
>> -       if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
>> -               dev_err(dp->dev, "failed to get reg for dptx-phy\n");
>> -               ret = -EINVAL;
>> -               goto err;
>> -       }
>> -
>> -       if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
>> -                               &dp->enable_mask)) {
>> -               dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
>> -               ret = -EINVAL;
>> -               goto err;
>> -       }
>> -
>> -       dp->phy_addr = ioremap(phy_base, SZ_4);
>> -       if (!dp->phy_addr) {
>> -               dev_err(dp->dev, "failed to ioremap dp-phy\n");
>> -               ret = -ENOMEM;
>> -               goto err;
>> +       dp->phy = devm_phy_get(dp->dev, "dp");
>> +       if (IS_ERR(dp->phy)) {
>> +               ret = PTR_ERR(dp->phy);
>> +               if (ret == -ENOSYS || ret == -ENODEV) {
>> +                       dp->phy = NULL;
>> +               } else if (ret == -EPROBE_DEFER) {
>> +                       return ret;
>> +               } else {
>> +                       dev_err(dp->dev, "no DP phy configured\n");
>> +                       return ret;
>> +               }
>>         }
>>
>> -err:
>> -       of_node_put(dp_phy_node);
>> -
>>         return ret;
>>  }
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
>> index a1aee69..6426201 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
>> @@ -153,8 +153,6 @@ struct exynos_dp_device {
>>         struct clk              *clock;
>>         unsigned int            irq;
>>         void __iomem            *reg_base;
>> -       void __iomem            *phy_addr;
>> -       unsigned int            enable_mask;
>>
>>         struct video_info       *video_info;
>>         struct link_train       link_train;
>> --
>> 1.7.10.4
>>
>
>
>
> --
> Best Regards
> Vivek Gautam
> Samsung R&D Institute, Bangalore
> India
Inki Dae Oct. 8, 2014, 3:10 a.m. UTC | #3
On 2014? 10? 08? 11:57, Vivek Gautam wrote:
> Hi,
> 
> 
> On Mon, Sep 15, 2014 at 6:43 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
>> Now that we have moved to generic phy based bindings,
>> we don't need to have any code related to older dptx-phy.
>> Nobody is using this dptx-phy anymore, so removing the
>> same.
>>
>> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>> Cc: Jingoo Han <jg1.han@samsung.com>
>> ---
> 
> Is someone taking care of this patch ? We already have got the corresponsding
> dp-phy patch merged, so we should also get this patch in.
> 

Can anyone give me tested-by after test? I cannot test this module
because I have no any board equipped with dp panel.

Jingoo or other?

Thanks,
Inki Dae

>>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>>  2 files changed, 13 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> index 4f3c7eb..5ffc1b2 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>>
>>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>>  {
>> -       if (dp->phy) {
>> +       if (dp->phy)
>>                 phy_power_on(dp->phy);
>> -       } else if (dp->phy_addr) {
>> -               u32 reg;
>> -
>> -               reg = __raw_readl(dp->phy_addr);
>> -               reg |= dp->enable_mask;
>> -               __raw_writel(reg, dp->phy_addr);
>> -       }
>>  }
>>
>>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>>  {
>> -       if (dp->phy) {
>> +       if (dp->phy)
>>                 phy_power_off(dp->phy);
>> -       } else if (dp->phy_addr) {
>> -               u32 reg;
>> -
>> -               reg = __raw_readl(dp->phy_addr);
>> -               reg &= ~(dp->enable_mask);
>> -               __raw_writel(reg, dp->phy_addr);
>> -       }
>>  }
>>
>>  static void exynos_dp_poweron(struct exynos_drm_display *display)
>> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>>
>>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>>  {
>> -       struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
>> -       u32 phy_base;
>>         int ret = 0;
>>
>> -       dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
>> -       if (!dp_phy_node) {
>> -               dp->phy = devm_phy_get(dp->dev, "dp");
>> -               return PTR_ERR_OR_ZERO(dp->phy);
>> -       }
>> -
>> -       if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
>> -               dev_err(dp->dev, "failed to get reg for dptx-phy\n");
>> -               ret = -EINVAL;
>> -               goto err;
>> -       }
>> -
>> -       if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
>> -                               &dp->enable_mask)) {
>> -               dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
>> -               ret = -EINVAL;
>> -               goto err;
>> -       }
>> -
>> -       dp->phy_addr = ioremap(phy_base, SZ_4);
>> -       if (!dp->phy_addr) {
>> -               dev_err(dp->dev, "failed to ioremap dp-phy\n");
>> -               ret = -ENOMEM;
>> -               goto err;
>> +       dp->phy = devm_phy_get(dp->dev, "dp");
>> +       if (IS_ERR(dp->phy)) {
>> +               ret = PTR_ERR(dp->phy);
>> +               if (ret == -ENOSYS || ret == -ENODEV) {
>> +                       dp->phy = NULL;
>> +               } else if (ret == -EPROBE_DEFER) {
>> +                       return ret;
>> +               } else {
>> +                       dev_err(dp->dev, "no DP phy configured\n");
>> +                       return ret;
>> +               }
>>         }
>>
>> -err:
>> -       of_node_put(dp_phy_node);
>> -
>>         return ret;
>>  }
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
>> index a1aee69..6426201 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
>> @@ -153,8 +153,6 @@ struct exynos_dp_device {
>>         struct clk              *clock;
>>         unsigned int            irq;
>>         void __iomem            *reg_base;
>> -       void __iomem            *phy_addr;
>> -       unsigned int            enable_mask;
>>
>>         struct video_info       *video_info;
>>         struct link_train       link_train;
>> --
>> 1.7.10.4
>>
> 
> 
>
Inki Dae Oct. 30, 2014, 12:20 p.m. UTC | #4
Sorry for late. I missed this patch a little bit for long time.


On 2014? 09? 15? 22:13, Vivek Gautam wrote:
> Now that we have moved to generic phy based bindings,
> we don't need to have any code related to older dptx-phy.
> Nobody is using this dptx-phy anymore, so removing the
> same.
> 
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> Cc: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>  2 files changed, 13 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 4f3c7eb..5ffc1b2 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>  
>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>  {
> -	if (dp->phy) {
> +	if (dp->phy)
>  		phy_power_on(dp->phy);
> -	} else if (dp->phy_addr) {
> -		u32 reg;
> -
> -		reg = __raw_readl(dp->phy_addr);
> -		reg |= dp->enable_mask;
> -		__raw_writel(reg, dp->phy_addr);
> -	}
>  }
>  
>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>  {
> -	if (dp->phy) {
> +	if (dp->phy)
>  		phy_power_off(dp->phy);
> -	} else if (dp->phy_addr) {
> -		u32 reg;
> -
> -		reg = __raw_readl(dp->phy_addr);
> -		reg &= ~(dp->enable_mask);
> -		__raw_writel(reg, dp->phy_addr);
> -	}
>  }
>  
>  static void exynos_dp_poweron(struct exynos_drm_display *display)
> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>  
>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>  {
> -	struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
> -	u32 phy_base;
>  	int ret = 0;
>  
> -	dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
> -	if (!dp_phy_node) {
> -		dp->phy = devm_phy_get(dp->dev, "dp");
> -		return PTR_ERR_OR_ZERO(dp->phy);
> -	}
> -
> -	if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
> -		dev_err(dp->dev, "failed to get reg for dptx-phy\n");
> -		ret = -EINVAL;
> -		goto err;
> -	}
> -
> -	if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
> -				&dp->enable_mask)) {
> -		dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
> -		ret = -EINVAL;
> -		goto err;
> -	}
> -
> -	dp->phy_addr = ioremap(phy_base, SZ_4);
> -	if (!dp->phy_addr) {
> -		dev_err(dp->dev, "failed to ioremap dp-phy\n");
> -		ret = -ENOMEM;
> -		goto err;
> +	dp->phy = devm_phy_get(dp->dev, "dp");
> +	if (IS_ERR(dp->phy)) {
> +		ret = PTR_ERR(dp->phy);
> +		if (ret == -ENOSYS || ret == -ENODEV) {
> +			dp->phy = NULL;
> +		} else if (ret == -EPROBE_DEFER) {
> +			return ret;
> +		} else {

WARNING: else is not generally useful after a break or return
#146: FILE: drivers/gpu/drm/exynos/exynos_dp_core.c:1208:
+			return ret;
+		} else {

How about just returning ret like below?
		if (IS_ERR(dp->phy)) {
			dev_err(dp->dev, "no DP phy configured\n");
			return PTR_ERR(ret);
		}

And then you can handle the error at probe function properly.

Thanks,
Inki Dae


> +			dev_err(dp->dev, "no DP phy configured\n");
> +			return ret;
> +		}
>  	}
>  
> -err:
> -	of_node_put(dp_phy_node);
> -
>  	return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
> index a1aee69..6426201 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
> @@ -153,8 +153,6 @@ struct exynos_dp_device {
>  	struct clk		*clock;
>  	unsigned int		irq;
>  	void __iomem		*reg_base;
> -	void __iomem		*phy_addr;
> -	unsigned int		enable_mask;
>  
>  	struct video_info	*video_info;
>  	struct link_train	link_train;
>
Vivek Gautam Oct. 30, 2014, 1:19 p.m. UTC | #5
Hi Inki,


On Thu, Oct 30, 2014 at 5:50 PM, Inki Dae <inki.dae@samsung.com> wrote:
>
> Sorry for late. I missed this patch a little bit for long time.

Thanks for reviewing.

>
>
> On 2014? 09? 15? 22:13, Vivek Gautam wrote:
>> Now that we have moved to generic phy based bindings,
>> we don't need to have any code related to older dptx-phy.
>> Nobody is using this dptx-phy anymore, so removing the
>> same.
>>
>> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>> Cc: Jingoo Han <jg1.han@samsung.com>
>> ---
>>  drivers/gpu/drm/exynos/exynos_dp_core.c |   58 +++++++------------------------
>>  drivers/gpu/drm/exynos/exynos_dp_core.h |    2 --
>>  2 files changed, 13 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> index 4f3c7eb..5ffc1b2 100644
>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
>> @@ -1050,28 +1050,14 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>>
>>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>>  {
>> -     if (dp->phy) {
>> +     if (dp->phy)
>>               phy_power_on(dp->phy);
>> -     } else if (dp->phy_addr) {
>> -             u32 reg;
>> -
>> -             reg = __raw_readl(dp->phy_addr);
>> -             reg |= dp->enable_mask;
>> -             __raw_writel(reg, dp->phy_addr);
>> -     }
>>  }
>>
>>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>>  {
>> -     if (dp->phy) {
>> +     if (dp->phy)
>>               phy_power_off(dp->phy);
>> -     } else if (dp->phy_addr) {
>> -             u32 reg;
>> -
>> -             reg = __raw_readl(dp->phy_addr);
>> -             reg &= ~(dp->enable_mask);
>> -             __raw_writel(reg, dp->phy_addr);
>> -     }
>>  }
>>
>>  static void exynos_dp_poweron(struct exynos_drm_display *display)
>> @@ -1210,39 +1196,21 @@ static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
>>
>>  static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
>>  {
>> -     struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
>> -     u32 phy_base;
>>       int ret = 0;
>>
>> -     dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
>> -     if (!dp_phy_node) {
>> -             dp->phy = devm_phy_get(dp->dev, "dp");
>> -             return PTR_ERR_OR_ZERO(dp->phy);
>> -     }
>> -
>> -     if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
>> -             dev_err(dp->dev, "failed to get reg for dptx-phy\n");
>> -             ret = -EINVAL;
>> -             goto err;
>> -     }
>> -
>> -     if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
>> -                             &dp->enable_mask)) {
>> -             dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
>> -             ret = -EINVAL;
>> -             goto err;
>> -     }
>> -
>> -     dp->phy_addr = ioremap(phy_base, SZ_4);
>> -     if (!dp->phy_addr) {
>> -             dev_err(dp->dev, "failed to ioremap dp-phy\n");
>> -             ret = -ENOMEM;
>> -             goto err;
>> +     dp->phy = devm_phy_get(dp->dev, "dp");
>> +     if (IS_ERR(dp->phy)) {
>> +             ret = PTR_ERR(dp->phy);
>> +             if (ret == -ENOSYS || ret == -ENODEV) {
>> +                     dp->phy = NULL;
>> +             } else if (ret == -EPROBE_DEFER) {
>> +                     return ret;
>> +             } else {
>
> WARNING: else is not generally useful after a break or return
> #146: FILE: drivers/gpu/drm/exynos/exynos_dp_core.c:1208:
> +                       return ret;
> +               } else {
>
> How about just returning ret like below?
>                 if (IS_ERR(dp->phy)) {
>                         dev_err(dp->dev, "no DP phy configured\n");
>                         return PTR_ERR(ret);
>                 }
>
> And then you can handle the error at probe function properly.

Right, point taken. Will post the reworked patch.

[snip]
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 4f3c7eb..5ffc1b2 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1050,28 +1050,14 @@  static int exynos_dp_create_connector(struct exynos_drm_display *display,
 
 static void exynos_dp_phy_init(struct exynos_dp_device *dp)
 {
-	if (dp->phy) {
+	if (dp->phy)
 		phy_power_on(dp->phy);
-	} else if (dp->phy_addr) {
-		u32 reg;
-
-		reg = __raw_readl(dp->phy_addr);
-		reg |= dp->enable_mask;
-		__raw_writel(reg, dp->phy_addr);
-	}
 }
 
 static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
 {
-	if (dp->phy) {
+	if (dp->phy)
 		phy_power_off(dp->phy);
-	} else if (dp->phy_addr) {
-		u32 reg;
-
-		reg = __raw_readl(dp->phy_addr);
-		reg &= ~(dp->enable_mask);
-		__raw_writel(reg, dp->phy_addr);
-	}
 }
 
 static void exynos_dp_poweron(struct exynos_drm_display *display)
@@ -1210,39 +1196,21 @@  static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
 
 static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
 {
-	struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
-	u32 phy_base;
 	int ret = 0;
 
-	dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
-	if (!dp_phy_node) {
-		dp->phy = devm_phy_get(dp->dev, "dp");
-		return PTR_ERR_OR_ZERO(dp->phy);
-	}
-
-	if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
-		dev_err(dp->dev, "failed to get reg for dptx-phy\n");
-		ret = -EINVAL;
-		goto err;
-	}
-
-	if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
-				&dp->enable_mask)) {
-		dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
-		ret = -EINVAL;
-		goto err;
-	}
-
-	dp->phy_addr = ioremap(phy_base, SZ_4);
-	if (!dp->phy_addr) {
-		dev_err(dp->dev, "failed to ioremap dp-phy\n");
-		ret = -ENOMEM;
-		goto err;
+	dp->phy = devm_phy_get(dp->dev, "dp");
+	if (IS_ERR(dp->phy)) {
+		ret = PTR_ERR(dp->phy);
+		if (ret == -ENOSYS || ret == -ENODEV) {
+			dp->phy = NULL;
+		} else if (ret == -EPROBE_DEFER) {
+			return ret;
+		} else {
+			dev_err(dp->dev, "no DP phy configured\n");
+			return ret;
+		}
 	}
 
-err:
-	of_node_put(dp_phy_node);
-
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
index a1aee69..6426201 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.h
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
@@ -153,8 +153,6 @@  struct exynos_dp_device {
 	struct clk		*clock;
 	unsigned int		irq;
 	void __iomem		*reg_base;
-	void __iomem		*phy_addr;
-	unsigned int		enable_mask;
 
 	struct video_info	*video_info;
 	struct link_train	link_train;