All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/5] phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs
Date: Wed, 26 Jun 2013 11:33:34 +0000	[thread overview]
Message-ID: <51CACEBE.9000505@ti.com> (raw)
In-Reply-To: <20130625205452.GC9748@arwen.pp.htv.fi>

Hi,

On Wednesday 26 June 2013 02:24 AM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Jun 25, 2013 at 07:44:52PM +0200, Sylwester Nawrocki wrote:
>>>> +struct exynos_video_phy {
>>>> +	spinlock_t slock;
>>>> +	struct phy *phys[NUM_PHYS];
>>>
>>> more than one phy ? This means you should instantiate driver multiple
>>> drivers. Each phy id should call probe again.
>>
>> Why ? This single PHY _provider_ can well handle multiple PHYs.
>> I don't see a good reason to further complicate this driver like
>> this. Please note that MIPI-CSIS 0 and MIPI DSIM 0 share MMIO
>> register, so does MIPI CSIS 1 and MIPI DSIM 1. There are only 2
>> registers for those 4 PHYs. I could have the involved object
>> multiplied, but it would have been just a waste of resources
>> with no difference to the PHY consumers.
>
> alright, I misunderstood your code then. When I looked over your id
> usage I missed the "/2" part and assumed that you would have separate
> EXYNOS_MIPI_PHY_CONTROL() register for each ;-)
>
> My bad, you can disregard the other comments.
>
>>>> +static int exynos_video_phy_probe(struct platform_device *pdev)
>>>> +{
>>>> +	struct exynos_video_phy *state;
>>>> +	struct device *dev = &pdev->dev;
>>>> +	struct resource *res;
>>>> +	struct phy_provider *phy_provider;
>>>> +	int i;
>>>> +
>>>> +	state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL);
>>>> +	if (!state)
>>>> +		return -ENOMEM;
>>>> +
>>>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>> +
>>>> +	state->regs = devm_ioremap_resource(dev, res);
>>>> +	if (IS_ERR(state->regs))
>>>> +		return PTR_ERR(state->regs);
>>>> +
>>>> +	dev_set_drvdata(dev, state);
>>>
>>> you can use platform_set_drvdata(pdev, state);
>>
>> I had it in the previous version, but changed for symmetry with
>> dev_set_drvdata(). I guess those could be replaced with
>> phy_{get, set}_drvdata as you suggested.

right. currently I was setting dev_set_drvdata of phy (core) device
in phy-core.c and the corresponding dev_get_drvdata in phy provider driver
which is little confusing.
So I'll add phy_set_drvdata and phy_get_drvdata in phy.h (as suggested by
Felipe) to be used by phy provider drivers. So after creating the PHY, the
phy provider should use phy_set_drvdata and in phy_ops, it can use
phy_get_drvdata. (I'll remove the dev_set_drvdata in phy_create).

This also means _void *priv_ in phy_create is useless. So I'll be removing
_priv_ from phy_create.

Thanks
Kishon

>
> hmm, you do need to set the drvdata() to the phy object, but also to the
> pdev object (should you need it on a suspend/resume callback, for
> instance). Those are separate struct device instances.


WARNING: multiple messages have this Message-ID (diff)
From: Kishon Vijay Abraham I <kishon@ti.com>
To: balbi@ti.com
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org,
	kyungmin.park@samsung.com, t.figa@samsung.com,
	devicetree-discuss@lists.ozlabs.org, kgene.kim@samsung.com,
	dh09.lee@samsung.com, jg1.han@samsung.com, inki.dae@samsung.com,
	plagnioj@jcrosoft.com, linux-fbdev@vger.kernel.org
Subject: Re: [PATCH v2 1/5] phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs
Date: Wed, 26 Jun 2013 16:51:34 +0530	[thread overview]
Message-ID: <51CACEBE.9000505@ti.com> (raw)
In-Reply-To: <20130625205452.GC9748@arwen.pp.htv.fi>

Hi,

On Wednesday 26 June 2013 02:24 AM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Jun 25, 2013 at 07:44:52PM +0200, Sylwester Nawrocki wrote:
>>>> +struct exynos_video_phy {
>>>> +	spinlock_t slock;
>>>> +	struct phy *phys[NUM_PHYS];
>>>
>>> more than one phy ? This means you should instantiate driver multiple
>>> drivers. Each phy id should call probe again.
>>
>> Why ? This single PHY _provider_ can well handle multiple PHYs.
>> I don't see a good reason to further complicate this driver like
>> this. Please note that MIPI-CSIS 0 and MIPI DSIM 0 share MMIO
>> register, so does MIPI CSIS 1 and MIPI DSIM 1. There are only 2
>> registers for those 4 PHYs. I could have the involved object
>> multiplied, but it would have been just a waste of resources
>> with no difference to the PHY consumers.
>
> alright, I misunderstood your code then. When I looked over your id
> usage I missed the "/2" part and assumed that you would have separate
> EXYNOS_MIPI_PHY_CONTROL() register for each ;-)
>
> My bad, you can disregard the other comments.
>
>>>> +static int exynos_video_phy_probe(struct platform_device *pdev)
>>>> +{
>>>> +	struct exynos_video_phy *state;
>>>> +	struct device *dev = &pdev->dev;
>>>> +	struct resource *res;
>>>> +	struct phy_provider *phy_provider;
>>>> +	int i;
>>>> +
>>>> +	state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL);
>>>> +	if (!state)
>>>> +		return -ENOMEM;
>>>> +
>>>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>> +
>>>> +	state->regs = devm_ioremap_resource(dev, res);
>>>> +	if (IS_ERR(state->regs))
>>>> +		return PTR_ERR(state->regs);
>>>> +
>>>> +	dev_set_drvdata(dev, state);
>>>
>>> you can use platform_set_drvdata(pdev, state);
>>
>> I had it in the previous version, but changed for symmetry with
>> dev_set_drvdata(). I guess those could be replaced with
>> phy_{get, set}_drvdata as you suggested.

right. currently I was setting dev_set_drvdata of phy (core) device
in phy-core.c and the corresponding dev_get_drvdata in phy provider driver
which is little confusing.
So I'll add phy_set_drvdata and phy_get_drvdata in phy.h (as suggested by
Felipe) to be used by phy provider drivers. So after creating the PHY, the
phy provider should use phy_set_drvdata and in phy_ops, it can use
phy_get_drvdata. (I'll remove the dev_set_drvdata in phy_create).

This also means _void *priv_ in phy_create is useless. So I'll be removing
_priv_ from phy_create.

Thanks
Kishon

>
> hmm, you do need to set the drvdata() to the phy object, but also to the
> pdev object (should you need it on a suspend/resume callback, for
> instance). Those are separate struct device instances.

WARNING: multiple messages have this Message-ID (diff)
From: kishon@ti.com (Kishon Vijay Abraham I)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/5] phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs
Date: Wed, 26 Jun 2013 16:51:34 +0530	[thread overview]
Message-ID: <51CACEBE.9000505@ti.com> (raw)
In-Reply-To: <20130625205452.GC9748@arwen.pp.htv.fi>

Hi,

On Wednesday 26 June 2013 02:24 AM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Jun 25, 2013 at 07:44:52PM +0200, Sylwester Nawrocki wrote:
>>>> +struct exynos_video_phy {
>>>> +	spinlock_t slock;
>>>> +	struct phy *phys[NUM_PHYS];
>>>
>>> more than one phy ? This means you should instantiate driver multiple
>>> drivers. Each phy id should call probe again.
>>
>> Why ? This single PHY _provider_ can well handle multiple PHYs.
>> I don't see a good reason to further complicate this driver like
>> this. Please note that MIPI-CSIS 0 and MIPI DSIM 0 share MMIO
>> register, so does MIPI CSIS 1 and MIPI DSIM 1. There are only 2
>> registers for those 4 PHYs. I could have the involved object
>> multiplied, but it would have been just a waste of resources
>> with no difference to the PHY consumers.
>
> alright, I misunderstood your code then. When I looked over your id
> usage I missed the "/2" part and assumed that you would have separate
> EXYNOS_MIPI_PHY_CONTROL() register for each ;-)
>
> My bad, you can disregard the other comments.
>
>>>> +static int exynos_video_phy_probe(struct platform_device *pdev)
>>>> +{
>>>> +	struct exynos_video_phy *state;
>>>> +	struct device *dev = &pdev->dev;
>>>> +	struct resource *res;
>>>> +	struct phy_provider *phy_provider;
>>>> +	int i;
>>>> +
>>>> +	state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL);
>>>> +	if (!state)
>>>> +		return -ENOMEM;
>>>> +
>>>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>> +
>>>> +	state->regs = devm_ioremap_resource(dev, res);
>>>> +	if (IS_ERR(state->regs))
>>>> +		return PTR_ERR(state->regs);
>>>> +
>>>> +	dev_set_drvdata(dev, state);
>>>
>>> you can use platform_set_drvdata(pdev, state);
>>
>> I had it in the previous version, but changed for symmetry with
>> dev_set_drvdata(). I guess those could be replaced with
>> phy_{get, set}_drvdata as you suggested.

right. currently I was setting dev_set_drvdata of phy (core) device
in phy-core.c and the corresponding dev_get_drvdata in phy provider driver
which is little confusing.
So I'll add phy_set_drvdata and phy_get_drvdata in phy.h (as suggested by
Felipe) to be used by phy provider drivers. So after creating the PHY, the
phy provider should use phy_set_drvdata and in phy_ops, it can use
phy_get_drvdata. (I'll remove the dev_set_drvdata in phy_create).

This also means _void *priv_ in phy_create is useless. So I'll be removing
_priv_ from phy_create.

Thanks
Kishon

>
> hmm, you do need to set the drvdata() to the phy object, but also to the
> pdev object (should you need it on a suspend/resume callback, for
> instance). Those are separate struct device instances.

WARNING: multiple messages have this Message-ID (diff)
From: Kishon Vijay Abraham I <kishon@ti.com>
To: <balbi@ti.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-samsung-soc@vger.kernel.org>,
	<linux-media@vger.kernel.org>, <kyungmin.park@samsung.com>,
	<t.figa@samsung.com>, <devicetree-discuss@lists.ozlabs.org>,
	<kgene.kim@samsung.com>, <dh09.lee@samsung.com>,
	<jg1.han@samsung.com>, <inki.dae@samsung.com>,
	<plagnioj@jcrosoft.com>, <linux-fbdev@vger.kernel.org>
Subject: Re: [PATCH v2 1/5] phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs
Date: Wed, 26 Jun 2013 16:51:34 +0530	[thread overview]
Message-ID: <51CACEBE.9000505@ti.com> (raw)
In-Reply-To: <20130625205452.GC9748@arwen.pp.htv.fi>

Hi,

On Wednesday 26 June 2013 02:24 AM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Jun 25, 2013 at 07:44:52PM +0200, Sylwester Nawrocki wrote:
>>>> +struct exynos_video_phy {
>>>> +	spinlock_t slock;
>>>> +	struct phy *phys[NUM_PHYS];
>>>
>>> more than one phy ? This means you should instantiate driver multiple
>>> drivers. Each phy id should call probe again.
>>
>> Why ? This single PHY _provider_ can well handle multiple PHYs.
>> I don't see a good reason to further complicate this driver like
>> this. Please note that MIPI-CSIS 0 and MIPI DSIM 0 share MMIO
>> register, so does MIPI CSIS 1 and MIPI DSIM 1. There are only 2
>> registers for those 4 PHYs. I could have the involved object
>> multiplied, but it would have been just a waste of resources
>> with no difference to the PHY consumers.
>
> alright, I misunderstood your code then. When I looked over your id
> usage I missed the "/2" part and assumed that you would have separate
> EXYNOS_MIPI_PHY_CONTROL() register for each ;-)
>
> My bad, you can disregard the other comments.
>
>>>> +static int exynos_video_phy_probe(struct platform_device *pdev)
>>>> +{
>>>> +	struct exynos_video_phy *state;
>>>> +	struct device *dev = &pdev->dev;
>>>> +	struct resource *res;
>>>> +	struct phy_provider *phy_provider;
>>>> +	int i;
>>>> +
>>>> +	state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL);
>>>> +	if (!state)
>>>> +		return -ENOMEM;
>>>> +
>>>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>> +
>>>> +	state->regs = devm_ioremap_resource(dev, res);
>>>> +	if (IS_ERR(state->regs))
>>>> +		return PTR_ERR(state->regs);
>>>> +
>>>> +	dev_set_drvdata(dev, state);
>>>
>>> you can use platform_set_drvdata(pdev, state);
>>
>> I had it in the previous version, but changed for symmetry with
>> dev_set_drvdata(). I guess those could be replaced with
>> phy_{get, set}_drvdata as you suggested.

right. currently I was setting dev_set_drvdata of phy (core) device
in phy-core.c and the corresponding dev_get_drvdata in phy provider driver
which is little confusing.
So I'll add phy_set_drvdata and phy_get_drvdata in phy.h (as suggested by
Felipe) to be used by phy provider drivers. So after creating the PHY, the
phy provider should use phy_set_drvdata and in phy_ops, it can use
phy_get_drvdata. (I'll remove the dev_set_drvdata in phy_create).

This also means _void *priv_ in phy_create is useless. So I'll be removing
_priv_ from phy_create.

Thanks
Kishon

>
> hmm, you do need to set the drvdata() to the phy object, but also to the
> pdev object (should you need it on a suspend/resume callback, for
> instance). Those are separate struct device instances.


  parent reply	other threads:[~2013-06-26 11:33 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25 14:21 [PATCH v2 1/5] phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs Sylwester Nawrocki
2013-06-25 14:21 ` Sylwester Nawrocki
2013-06-25 14:21 ` Sylwester Nawrocki
2013-06-25 14:21 ` [PATCH v2 2/5] ARM: dts: Add MIPI PHY node to exynos4.dtsi Sylwester Nawrocki
2013-06-25 14:21   ` Sylwester Nawrocki
2013-06-25 14:21   ` Sylwester Nawrocki
2013-06-25 14:21 ` [PATCH v2 3/5] video: exynos_mipi_dsim: Use generic PHY driver Sylwester Nawrocki
2013-06-25 14:21   ` Sylwester Nawrocki
2013-06-25 14:21   ` Sylwester Nawrocki
2013-06-25 15:08   ` Felipe Balbi
2013-06-25 15:08     ` Felipe Balbi
2013-06-25 15:08     ` Felipe Balbi
2013-06-25 15:08     ` Felipe Balbi
2013-06-25 14:21 ` [PATCH v2 4/5] exynos4-is: Use generic MIPI CSIS " Sylwester Nawrocki
2013-06-25 14:21   ` Sylwester Nawrocki
2013-06-25 14:21   ` Sylwester Nawrocki
2013-06-25 15:09   ` Felipe Balbi
2013-06-25 15:09     ` Felipe Balbi
2013-06-25 15:09     ` Felipe Balbi
2013-06-25 15:09     ` Felipe Balbi
2013-06-25 14:21 ` [PATCH v2 5/5] ARM: Samsung: Remove MIPI PHY setup code Sylwester Nawrocki
2013-06-25 14:21   ` Sylwester Nawrocki
2013-06-25 14:21   ` Sylwester Nawrocki
2013-06-25 15:09   ` Felipe Balbi
2013-06-25 15:09     ` Felipe Balbi
2013-06-25 15:09     ` Felipe Balbi
2013-06-25 15:09     ` Felipe Balbi
2013-06-25 15:06 ` [PATCH v2 1/5] phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs Felipe Balbi
2013-06-25 15:06   ` Felipe Balbi
2013-06-25 15:06   ` Felipe Balbi
2013-06-25 15:06   ` Felipe Balbi
2013-06-25 17:44   ` Sylwester Nawrocki
2013-06-25 17:44     ` Sylwester Nawrocki
2013-06-25 17:44     ` Sylwester Nawrocki
2013-06-25 18:05     ` Tomasz Figa
2013-06-25 18:05       ` Tomasz Figa
2013-06-25 18:05       ` Tomasz Figa
2013-06-25 20:54     ` Felipe Balbi
2013-06-25 20:54       ` Felipe Balbi
2013-06-25 20:54       ` Felipe Balbi
2013-06-25 20:54       ` Felipe Balbi
2013-06-25 21:47       ` Sylwester Nawrocki
2013-06-25 21:47         ` Sylwester Nawrocki
2013-06-25 21:47         ` Sylwester Nawrocki
2013-06-26  5:23         ` Felipe Balbi
2013-06-26  5:23           ` Felipe Balbi
2013-06-26  5:23           ` Felipe Balbi
2013-06-26  5:23           ` Felipe Balbi
2013-06-26 11:21       ` Kishon Vijay Abraham I [this message]
2013-06-26 11:33         ` Kishon Vijay Abraham I
2013-06-26 11:21         ` Kishon Vijay Abraham I
2013-06-26 11:21         ` Kishon Vijay Abraham I
2013-06-26 12:03         ` Sylwester Nawrocki
2013-06-26 12:03           ` Sylwester Nawrocki
2013-06-26 12:03           ` Sylwester Nawrocki
2013-06-26 12:22           ` Felipe Balbi
2013-06-26 12:22             ` Felipe Balbi
2013-06-26 12:22             ` Felipe Balbi
2013-06-26 12:22             ` Felipe Balbi
2013-06-26 12:48             ` Kishon Vijay Abraham I
2013-06-26 12:49               ` Kishon Vijay Abraham I
2013-06-26 12:48               ` Kishon Vijay Abraham I
2013-06-26 12:48               ` Kishon Vijay Abraham I
2013-06-26 12:48           ` Kishon Vijay Abraham I
2013-06-26 12:49             ` Kishon Vijay Abraham I
2013-06-26 12:48             ` Kishon Vijay Abraham I
2013-06-26 12:48             ` Kishon Vijay Abraham I
2013-06-26 15:00   ` Sylwester Nawrocki
2013-06-26 15:00     ` Sylwester Nawrocki
2013-06-26 15:00     ` Sylwester Nawrocki
2013-06-27  6:17     ` Felipe Balbi
2013-06-27  6:17       ` Felipe Balbi
2013-06-27  6:17       ` Felipe Balbi
2013-06-27  6:17       ` Felipe Balbi
2013-06-27  7:47       ` Andrzej Hajda
2013-06-27  7:47         ` Andrzej Hajda
2013-06-27  7:47         ` Andrzej Hajda
2013-06-27  7:51         ` Felipe Balbi
2013-06-27  7:51           ` Felipe Balbi
2013-06-27  7:51           ` Felipe Balbi
2013-06-27  7:51           ` Felipe Balbi
2013-06-27  8:49       ` Russell King - ARM Linux
2013-06-27  8:49         ` Russell King - ARM Linux
2013-06-27  8:49         ` Russell King - ARM Linux

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=51CACEBE.9000505@ti.com \
    --to=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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.