Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

2014-10-13 Thread Vivek Gautam
Hi Felipe,


On Tue, Oct 14, 2014 at 4:14 AM, Felipe Balbi  wrote:
> Hi,
>
> On Mon, Oct 13, 2014 at 01:54:59PM +0900, Anton Tikhomirov wrote:
>> Hi Vivek,
>>
>> > Exynos7 also has a separate special gate clock going to the IP
>> > apart from the usual AHB clock. So add support for the same.
>>
>> As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
>> by the driver. Adding only sclk is not enough.
>>
>> >
>> > Signed-off-by: Vivek Gautam 
>> > ---
>> >  drivers/usb/dwc3/dwc3-exynos.c |   16 
>> >  1 file changed, 16 insertions(+)
>> >
>> > diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-
>> > exynos.c
>> > index 3951a65..7dc6a98 100644
>> > --- a/drivers/usb/dwc3/dwc3-exynos.c
>> > +++ b/drivers/usb/dwc3/dwc3-exynos.c
>> > @@ -35,6 +35,7 @@ struct dwc3_exynos {
>> > struct device   *dev;
>> >
>> > struct clk  *clk;
>>
>> The clock "clk" in Exynos5 just gated all that above 7 clocks, which
>> we should control separately now in Exynos7.
>>
>
> should I drop this patch for now ?

Yes, better to hold this for some time till we get more clarity
from our h/w team.


-- 
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

2014-10-13 Thread Vivek Gautam
Hi Tomasz,


On Tue, Oct 14, 2014 at 6:56 AM, Anton Tikhomirov
 wrote:
> Hello,
>
>> Hi Anton,
>>
>> On 13.10.2014 06:54, Anton Tikhomirov wrote:
>> > Hi Vivek,
>> >
>> >> Exynos7 also has a separate special gate clock going to the IP
>> >> apart from the usual AHB clock. So add support for the same.
>> >
>> > As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
>> > by the driver. Adding only sclk is not enough.
>> >
>>
>> I'm quite interested in this discussion. Has it happened on mailing
>> lists?
>
> No, we used company messenger for the discussion.

Yea, we head a round of discussion at our end regarding this, and we are
going to get more clarity on this from our H/W team too, this week.

>
>>
>> In general, previous SoCs also gave the possibility of controlling all
>> the bus clocks separately, in addition to bulk gates, but there was no
>
> correct
>
>> real advantage in using those, while burdening the clock tree with
>> numerous clocks. Isn't Exynos7 similar in this aspect?
>
> Exynos7 doesn't have "Gating all clocks for USBDRD30" bit. The clocks
> should be controlled separately.

true, on Exynos7 we have separate gates for the available clocks going to
USB-DRD block. So we will have to add these basic required number of
clocks.





-- 
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

2014-10-13 Thread Anton Tikhomirov
Hello,

> Hi Anton,
> 
> On 13.10.2014 06:54, Anton Tikhomirov wrote:
> > Hi Vivek,
> >
> >> Exynos7 also has a separate special gate clock going to the IP
> >> apart from the usual AHB clock. So add support for the same.
> >
> > As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
> > by the driver. Adding only sclk is not enough.
> >
> 
> I'm quite interested in this discussion. Has it happened on mailing
> lists?

No, we used company messenger for the discussion.

> 
> In general, previous SoCs also gave the possibility of controlling all
> the bus clocks separately, in addition to bulk gates, but there was no

correct

> real advantage in using those, while burdening the clock tree with
> numerous clocks. Isn't Exynos7 similar in this aspect?

Exynos7 doesn't have "Gating all clocks for USBDRD30" bit. The clocks
should be controlled separately.

> 
> Best regards,
> Tomasz
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

2014-10-13 Thread Tomasz Figa
Hi Anton,

On 13.10.2014 06:54, Anton Tikhomirov wrote:
> Hi Vivek,
> 
>> Exynos7 also has a separate special gate clock going to the IP
>> apart from the usual AHB clock. So add support for the same.
> 
> As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
> by the driver. Adding only sclk is not enough. 
> 

I'm quite interested in this discussion. Has it happened on mailing lists?

In general, previous SoCs also gave the possibility of controlling all
the bus clocks separately, in addition to bulk gates, but there was no
real advantage in using those, while burdening the clock tree with
numerous clocks. Isn't Exynos7 similar in this aspect?

Best regards,
Tomasz
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

2014-10-13 Thread Felipe Balbi
Hi,

On Mon, Oct 13, 2014 at 01:54:59PM +0900, Anton Tikhomirov wrote:
> Hi Vivek,
> 
> > Exynos7 also has a separate special gate clock going to the IP
> > apart from the usual AHB clock. So add support for the same.
> 
> As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
> by the driver. Adding only sclk is not enough. 
> 
> > 
> > Signed-off-by: Vivek Gautam 
> > ---
> >  drivers/usb/dwc3/dwc3-exynos.c |   16 
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-
> > exynos.c
> > index 3951a65..7dc6a98 100644
> > --- a/drivers/usb/dwc3/dwc3-exynos.c
> > +++ b/drivers/usb/dwc3/dwc3-exynos.c
> > @@ -35,6 +35,7 @@ struct dwc3_exynos {
> > struct device   *dev;
> > 
> > struct clk  *clk;
> 
> The clock "clk" in Exynos5 just gated all that above 7 clocks, which
> we should control separately now in Exynos7.
> 

should I drop this patch for now ?

-- 
balbi


signature.asc
Description: Digital signature


[PATCH v3 7/9] mmc: core: Attach PM domain prior probing of SDIO func driver

2014-10-13 Thread Ulf Hansson
Align the behvaior to how other buses are handling attachment of PM
domains. Additionally, let's add error handling.

Signed-off-by: Ulf Hansson 
---
 drivers/mmc/core/sdio_bus.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 65cf7a7..ba97779 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -313,13 +313,19 @@ int sdio_add_func(struct sdio_func *func)
dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num);
 
sdio_acpi_set_handle(func);
+
+   ret = dev_pm_domain_attach(&func->dev, false);
+   if (ret)
+   return ret;
+
ret = device_add(&func->dev);
-   if (ret == 0) {
-   sdio_func_set_present(func);
-   dev_pm_domain_attach(&func->dev, false);
+   if (ret) {
+   dev_pm_domain_detach(&func->dev, false);
+   return ret;
}
 
-   return ret;
+   sdio_func_set_present(func);
+   return 0;
 }
 
 /*
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 4/9] drivercore / platform: Keep PM domain powered during ->probe()

2014-10-13 Thread Ulf Hansson
To sucessfully probe some devices their corresponding PM domains may
need to be powered.

Use the dev_pm_domain_get|put() APIs, to control the behavior of the PM
domain.

Signed-off-by: Ulf Hansson 
---
 drivers/base/platform.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index b2afc29..43897ad 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -509,7 +509,14 @@ static int platform_drv_probe(struct device *_dev)
 
ret = dev_pm_domain_attach(_dev, true);
if (ret != -EPROBE_DEFER) {
+   ret = dev_pm_domain_get(_dev->pm_domain);
+   if (ret) {
+   dev_pm_domain_detach(_dev, true);
+   return ret;
+   }
+
ret = drv->probe(dev);
+   dev_pm_domain_put(_dev->pm_domain);
if (ret)
dev_pm_domain_detach(_dev, true);
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 6/9] spi: core: Keep PM domain powered during ->probe()

2014-10-13 Thread Ulf Hansson
To sucessfully probe some devices their corresponding PM domains may
need to be powered.

Use the dev_pm_domain_get|put() APIs, to control the behavior of the PM
domain.

Signed-off-by: Ulf Hansson 
---
 drivers/spi/spi.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 3907f14..ad1a6f3 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -267,7 +267,14 @@ static int spi_drv_probe(struct device *dev)
 
ret = dev_pm_domain_attach(dev, true);
if (ret != -EPROBE_DEFER) {
+   ret = dev_pm_domain_get(dev->pm_domain);
+   if (ret) {
+   dev_pm_domain_detach(dev, true);
+   return ret;
+   }
+
ret = sdrv->probe(to_spi_device(dev));
+   dev_pm_domain_put(dev->pm_domain);
if (ret)
dev_pm_domain_detach(dev, true);
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 9/9] PM / Domains: Remove pm_genpd_dev_need_restore() API

2014-10-13 Thread Ulf Hansson
There are currently no users of this API, let's remove it.

Additionally, if such feature would be needed future wise, a better
option is likely use pm_runtime_set_active|suspended() in some form.

Signed-off-by: Ulf Hansson 
Acked-by: Geert Uytterhoeven 
Acked-by: Kevin Hilman 
---
 drivers/base/power/domain.c | 20 
 include/linux/pm_domain.h   |  2 --
 2 files changed, 22 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 96fe72e..a717132 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1554,26 +1554,6 @@ int pm_genpd_remove_device(struct generic_pm_domain 
*genpd,
 }
 
 /**
- * pm_genpd_dev_need_restore - Set/unset the device's "need restore" flag.
- * @dev: Device to set/unset the flag for.
- * @val: The new value of the device's "need restore" flag.
- */
-void pm_genpd_dev_need_restore(struct device *dev, bool val)
-{
-   struct pm_subsys_data *psd;
-   unsigned long flags;
-
-   spin_lock_irqsave(&dev->power.lock, flags);
-
-   psd = dev_to_psd(dev);
-   if (psd && psd->domain_data)
-   to_gpd_data(psd->domain_data)->need_restore = val;
-
-   spin_unlock_irqrestore(&dev->power.lock, flags);
-}
-EXPORT_SYMBOL_GPL(pm_genpd_dev_need_restore);
-
-/**
  * pm_genpd_add_subdomain - Add a subdomain to an I/O PM domain.
  * @genpd: Master PM domain to add the subdomain to.
  * @subdomain: Subdomain to be added.
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 7b3cba2..d5df64e 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -130,7 +130,6 @@ extern int __pm_genpd_name_add_device(const char 
*domain_name,
 
 extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
  struct device *dev);
-extern void pm_genpd_dev_need_restore(struct device *dev, bool val);
 extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
  struct generic_pm_domain *new_subdomain);
 extern int pm_genpd_add_subdomain_names(const char *master_name,
@@ -176,7 +175,6 @@ static inline int pm_genpd_remove_device(struct 
generic_pm_domain *genpd,
 {
return -ENOSYS;
 }
-static inline void pm_genpd_dev_need_restore(struct device *dev, bool val) {}
 static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
 struct generic_pm_domain *new_sd)
 {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 5/9] i2c: core: Keep PM domain powered during ->probe()

2014-10-13 Thread Ulf Hansson
To sucessfully probe some devices their corresponding PM domains may
need to be powered.

Use the dev_pm_domain_get|put() APIs, to control the behavior of the PM
domain.

Signed-off-by: Ulf Hansson 
---
 drivers/i2c/i2c-core.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 2f90ac6..37a52c6 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -646,8 +646,15 @@ static int i2c_device_probe(struct device *dev)
 
status = dev_pm_domain_attach(&client->dev, true);
if (status != -EPROBE_DEFER) {
+   status = dev_pm_domain_get(client->dev.pm_domain);
+   if (status) {
+   dev_pm_domain_detach(&client->dev, true);
+   return status;
+   }
+
status = driver->probe(client, i2c_match_id(driver->id_table,
client));
+   dev_pm_domain_put(client->dev.pm_domain);
if (status)
dev_pm_domain_detach(&client->dev, true);
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 3/9] amba: Keep PM domain powered during ->probe()

2014-10-13 Thread Ulf Hansson
To sucessfully probe some devices their corresponding PM domains may
need to be powered.

Use the dev_pm_domain_get|put() APIs, to control the behavior of the PM
domain.

Signed-off-by: Ulf Hansson 
---
 drivers/amba/bus.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 47bbdc1..a8a8e13 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -187,8 +187,15 @@ static int amba_probe(struct device *dev)
if (ret == -EPROBE_DEFER)
break;
 
+   ret = dev_pm_domain_get(dev->pm_domain);
+   if (ret) {
+   dev_pm_domain_detach(dev, true);
+   break;
+   }
+
ret = amba_get_enable_pclk(pcdev);
if (ret) {
+   dev_pm_domain_put(dev->pm_domain);
dev_pm_domain_detach(dev, true);
break;
}
@@ -198,6 +205,7 @@ static int amba_probe(struct device *dev)
pm_runtime_enable(dev);
 
ret = pcdrv->probe(pcdev, id);
+   dev_pm_domain_put(dev->pm_domain);
if (ret == 0)
break;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 8/9] mmmc: core: Keep PM domain powered during ->probe() of SDIO func driver

2014-10-13 Thread Ulf Hansson
To sucessfully probe some devices their corresponding PM domains may
need to be powered.

Use the dev_pm_domain_get|put() APIs, to control the behavior of the PM
domain.

Signed-off-by: Ulf Hansson 
---
 drivers/mmc/core/sdio_bus.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index ba97779..83c8836 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -318,7 +318,14 @@ int sdio_add_func(struct sdio_func *func)
if (ret)
return ret;
 
+   ret = dev_pm_domain_get(func->dev.pm_domain);
+   if (ret) {
+   dev_pm_domain_detach(&func->dev, false);
+   return ret;
+   }
+
ret = device_add(&func->dev);
+   dev_pm_domain_put(func->dev.pm_domain);
if (ret) {
dev_pm_domain_detach(&func->dev, false);
return ret;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/9] PM / Domains: Enable genpd to support ->get|put() callbacks

2014-10-13 Thread Ulf Hansson
To provide users control over whether the power should be maintained,
implement the ->get|put() callbacks for genpd's PM domain.

A usage count variable keeps track of the number of users. A positive
value tells genpd to keep supplying power and also to power up if it's
the first user.

Do note, the above applies no matter of CONFIG_PM_RUNTIME. That's
because we allows a PM domain to be initialized in power off state and
thus we need a way to power it up.

Once the usage count reaches zero, genpd tries to power off its PM
domain. Although for !CONFIG_PM_RUNTIME we need to maintain the power
once it's been enabled, since drivers can't use runtime PM to restore
it dynamically.

Signed-off-by: Ulf Hansson 
---
 drivers/base/power/domain.c | 26 +-
 include/linux/pm_domain.h   |  1 +
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 40bc2f4..96fe72e 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -451,10 +451,12 @@ static int pm_genpd_poweroff(struct generic_pm_domain 
*genpd)
 * (2) The domain is waiting for its master to power up.
 * (3) One of the domain's devices is being resumed right now.
 * (4) System suspend is in progress.
+* (5) The usage_count > 0, since it tells us to stay powered.
 */
if (genpd->status == GPD_STATE_POWER_OFF
|| genpd->status == GPD_STATE_WAIT_MASTER
-   || genpd->resume_count > 0 || genpd->prepared_count > 0)
+   || genpd->resume_count > 0 || genpd->prepared_count > 0
+   || atomic_read(&genpd->usage_count) > 0)
return 0;
 
if (atomic_read(&genpd->sd_count) > 0)
@@ -1358,6 +1360,25 @@ EXPORT_SYMBOL_GPL(pm_genpd_syscore_poweron);
 
 #endif /* CONFIG_PM_SLEEP */
 
+static int pm_genpd_get(struct dev_pm_domain *domain)
+{
+   struct generic_pm_domain *genpd = pd_to_genpd(domain);
+
+   atomic_inc(&genpd->usage_count);
+
+   return pm_genpd_poweron(genpd);
+}
+
+static void pm_genpd_put(struct dev_pm_domain *domain)
+{
+   struct generic_pm_domain *genpd = pd_to_genpd(domain);
+
+   if (!atomic_dec_and_test(&genpd->usage_count))
+   return;
+
+   genpd_queue_power_off_work(genpd);
+}
+
 static struct generic_pm_domain_data *__pm_genpd_alloc_dev_data(struct device 
*dev)
 {
struct generic_pm_domain_data *gpd_data;
@@ -1875,10 +1896,13 @@ void pm_genpd_init(struct generic_pm_domain *genpd,
genpd->status = is_off ? GPD_STATE_POWER_OFF : GPD_STATE_ACTIVE;
init_waitqueue_head(&genpd->status_wait_queue);
genpd->poweroff_task = NULL;
+   atomic_set(&genpd->usage_count, 0);
genpd->resume_count = 0;
genpd->device_count = 0;
genpd->max_off_time_ns = -1;
genpd->max_off_time_changed = true;
+   genpd->domain.get = pm_genpd_get;
+   genpd->domain.put = pm_genpd_put;
genpd->domain.ops.runtime_suspend = pm_genpd_runtime_suspend;
genpd->domain.ops.runtime_resume = pm_genpd_runtime_resume;
genpd->domain.ops.prepare = pm_genpd_prepare;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 8e2806f..7b3cba2 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -58,6 +58,7 @@ struct generic_pm_domain {
enum gpd_status status; /* Current state of the domain */
wait_queue_head_t status_wait_queue;
struct task_struct *poweroff_task;  /* Powering off task */
+   atomic_t usage_count;   /* Number of users of the domain */
unsigned int resume_count;  /* Number of devices being resumed */
unsigned int device_count;  /* Number of devices */
unsigned int suspended_count;   /* System suspend device counter */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/9] PM / Domains: Add dev_pm_domain_get|put() APIs

2014-10-13 Thread Ulf Hansson
There may be more than one device in a PM domain which then will be
probed at different points in time.

Depending on timing and runtime PM support, in for the device related
driver/subsystem, a PM domain may be advised to power off after a
successful probe sequence.

A general requirement for a device within a PM domain, is that the
PM domain must stay powered during the probe sequence. To cope with
such requirement, let's add the dev_pm_domain_get|put() APIs.

These APIs are intended to be invoked from subsystem-level code and the
calls between get/put needs to be balanced.

dev_pm_domain_get(), tells the PM domain that it needs to increase a
usage count and to keep supplying power. dev_pm_domain_put(), does the
opposite.

For a PM domain to support this feature, it must implement the optional
->get|put() callbacks.

Signed-off-by: Ulf Hansson 
---
 drivers/base/power/common.c | 40 
 include/linux/pm.h  |  2 ++
 include/linux/pm_domain.h   |  4 
 3 files changed, 46 insertions(+)

diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index b0f1388..b4f0c8c 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -134,3 +134,43 @@ void dev_pm_domain_detach(struct device *dev, bool 
power_off)
dev->pm_domain->detach(dev, power_off);
 }
 EXPORT_SYMBOL_GPL(dev_pm_domain_detach);
+
+/**
+ * dev_pm_domain_get - Increase usage count to keep a PM domain powered.
+ * @domain: The PM domain to operate on.
+ *
+ * This function will not by itself increase the usage count, that's up to each
+ * PM domain implementation to support. Typically it should be invoked from
+ * subsystem level code prior drivers starts probing.
+ *
+ * Do note, it's optional to implement the ->get() callback for a PM domain.
+ *
+ * Returns 0 on successfully increased usage count or negative error code.
+ */
+int dev_pm_domain_get(struct dev_pm_domain *domain)
+{
+   int ret = 0;
+
+   if (domain && domain->get)
+   ret = domain->get(domain);
+
+   return ret;
+}
+EXPORT_SYMBOL_GPL(dev_pm_domain_get);
+
+/**
+ * dev_pm_domain_put - Decrease usage count to allow a PM domain to power off.
+ * @domain: The PM domain to operate on.
+ *
+ * This function will not by itself decrease the usage count, that's up to each
+ * PM domain implementation to support. Typically it should be invoked from
+ * subsystem level code after drivers has finished probing.
+ *
+ * Do note, it's optional to implement the ->put() callback for a PM domain.
+ */
+void dev_pm_domain_put(struct dev_pm_domain *domain)
+{
+   if (domain && domain->put)
+   domain->put(domain);
+}
+EXPORT_SYMBOL_GPL(dev_pm_domain_put);
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 383fd68..f71900d 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -620,6 +620,8 @@ extern int dev_pm_put_subsys_data(struct device *dev);
 struct dev_pm_domain {
struct dev_pm_ops   ops;
void (*detach)(struct device *dev, bool power_off);
+   int (*get)(struct dev_pm_domain *domain);
+   void (*put)(struct dev_pm_domain *domain);
 };
 
 /*
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 73e938b..8e2806f 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -304,12 +304,16 @@ static inline int of_genpd_add_provider_onecell(struct 
device_node *np,
 #ifdef CONFIG_PM
 extern int dev_pm_domain_attach(struct device *dev, bool power_on);
 extern void dev_pm_domain_detach(struct device *dev, bool power_off);
+extern int dev_pm_domain_get(struct dev_pm_domain *domain);
+extern void dev_pm_domain_put(struct dev_pm_domain *domain);
 #else
 static inline int dev_pm_domain_attach(struct device *dev, bool power_on)
 {
return -ENODEV;
 }
 static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
+static inline int dev_pm_domain_get(struct dev_pm_domain *domain) { return 0; }
+static inline void dev_pm_domain_put(struct dev_pm_domain *domain) {}
 #endif
 
 #endif /* _LINUX_PM_DOMAIN_H */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/9] PM / Domains: Fix race conditions during boot

2014-10-13 Thread Ulf Hansson
Changes in v3:
-Rework the entire intermediate step which was suggested in v2.
 That means solving the race condition, but also cope with PM domains
 that are initialized in powered off state.

Changes in v2:
-Added some acks.
-Updated commit messages.
-Included a wider audience of the patchset. V1 was lacking SoC
 maintainers.

Here are link to the first patchset, were some discussion started.
http://marc.info/?l=linux-pm&m=141208104729597&w=2

There may be more than one device in a PM domain which then will be
probed at different points in time.

Depending on timing and runtime PM support, in for the device related
driver/subsystem, a PM domain may be advised to power off after a
successful probe sequence.

A general requirement for a device within a PM domain, is that the
PM domain must stay powered during the probe sequence. To cope with
such requirement, let's add two new APIs, dev_pm_domain_get|put().

These APIs are intended to be invoked from subsystem-level code and the
calls between get/put needs to be balanced.

dev_pm_domain_get(), tells the PM domain that it needs to increase a
usage count and to keep supplying power. dev_pm_domain_put(), does the
opposite.


Ulf Hansson (9):
  PM / Domains: Add dev_pm_domain_get|put() APIs
  PM / Domains: Enable genpd to support ->get|put() callbacks
  amba: Keep PM domain powered during ->probe()
  drivercore / platform: Keep PM domain powered during ->probe()
  i2c: core: Keep PM domain powered during ->probe()
  spi: core: Keep PM domain powered during ->probe()
  mmc: core: Attach PM domain prior probing of SDIO func driver
  mmmc: core: Keep PM domain powered during ->probe() of SDIO func
driver
  PM / Domains: Remove pm_genpd_dev_need_restore() API

 drivers/amba/bus.c  |  8 
 drivers/base/platform.c |  7 +++
 drivers/base/power/common.c | 40 +++
 drivers/base/power/domain.c | 46 -
 drivers/i2c/i2c-core.c  |  7 +++
 drivers/mmc/core/sdio_bus.c | 21 +
 drivers/spi/spi.c   |  7 +++
 include/linux/pm.h  |  2 ++
 include/linux/pm_domain.h   |  7 +--
 9 files changed, 118 insertions(+), 27 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/15] drm/dsi: Constify mipi_dsi_msg

2014-10-13 Thread Andrzej Hajda
On 10/13/2014 12:16 PM, Thierry Reding wrote:
> From: Thierry Reding 
> 
> struct mipi_dsi_msg is a read-only structure, drivers should never need
> to modify it. Make this explicit by making all references to the struct
> const.
> 
> Signed-off-by: Thierry Reding 

Acked-by: Andrzej Hajda 

--
Regards
Andrzej

> ---
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 2 +-
>  include/drm/drm_mipi_dsi.h  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
> b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index 24741d8758e8..c5f3c76bfac3 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -1236,7 +1236,7 @@ static bool exynos_dsi_is_short_dsi_type(u8 type)
>  }
>  
>  static ssize_t exynos_dsi_host_transfer(struct mipi_dsi_host *host,
> -struct mipi_dsi_msg *msg)
> + const struct mipi_dsi_msg *msg)
>  {
>   struct exynos_dsi *dsi = host_to_dsi(host);
>   struct exynos_dsi_transfer xfer;
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index ccc3869e137b..836cc2b677d0 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -56,7 +56,7 @@ struct mipi_dsi_host_ops {
>   int (*detach)(struct mipi_dsi_host *host,
> struct mipi_dsi_device *dsi);
>   ssize_t (*transfer)(struct mipi_dsi_host *host,
> - struct mipi_dsi_msg *msg);
> + const struct mipi_dsi_msg *msg);
>  };
>  
>  /**
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] ARM: dts: Add initial regulator mode on exynos Peach boards

2014-10-13 Thread Mark Brown
On Thu, Oct 09, 2014 at 11:40:17PM +0200, Javier Martinez Canillas wrote:
> On 10/09/2014 07:48 PM, Mark Brown wrote:
> > On Thu, Oct 09, 2014 at 04:27:37PM +0200, Javier Martinez Canillas wrote:

> >> only two modes: ON and OFF (and some of them have a third Low Power mode).

> > ...but let's be clear, only "on" (normal) and low power are modes here.
> > Like I keep saying please think things through - if modes also include
> > enable control why would they be treated separately in the API?

> Right, I got confused again by the terminology in the Maxim data-sheet that
> list output OFF as an opmode but I understand that OFF is not a mode and
> that the regulator API treats it separately.

OK, please do try to be careful with things like this - when there's
problems around confusion about concepts it's very important to make
sure that communication is clear.


signature.asc
Description: Digital signature


[PATCH 02/15] drm/dsi: Constify mipi_dsi_msg

2014-10-13 Thread Thierry Reding
From: Thierry Reding 

struct mipi_dsi_msg is a read-only structure, drivers should never need
to modify it. Make this explicit by making all references to the struct
const.

Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 2 +-
 include/drm/drm_mipi_dsi.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 24741d8758e8..c5f3c76bfac3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1236,7 +1236,7 @@ static bool exynos_dsi_is_short_dsi_type(u8 type)
 }
 
 static ssize_t exynos_dsi_host_transfer(struct mipi_dsi_host *host,
-  struct mipi_dsi_msg *msg)
+   const struct mipi_dsi_msg *msg)
 {
struct exynos_dsi *dsi = host_to_dsi(host);
struct exynos_dsi_transfer xfer;
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index ccc3869e137b..836cc2b677d0 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -56,7 +56,7 @@ struct mipi_dsi_host_ops {
int (*detach)(struct mipi_dsi_host *host,
  struct mipi_dsi_device *dsi);
ssize_t (*transfer)(struct mipi_dsi_host *host,
-   struct mipi_dsi_msg *msg);
+   const struct mipi_dsi_msg *msg);
 };
 
 /**
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html