Re: [PATCH] mfd: Drop owner assignment from i2c_drivers

2015-07-09 Thread Lee Jones
On Fri, 10 Jul 2015, Krzysztof Kozlowski wrote:

> i2c_driver does not need to set an owner because i2c_register_driver()
> will set it.
> 
> Signed-off-by: Krzysztof Kozlowski 
> 
> ---
> 
> The coccinelle script which generated the patch was sent here:
> http://www.spinics.net/lists/kernel/msg2029903.html
> ---
>  drivers/mfd/88pm800.c | 1 -
>  drivers/mfd/88pm805.c | 1 -
>  drivers/mfd/88pm860x-core.c   | 1 -
>  drivers/mfd/aat2870-core.c| 1 -
>  drivers/mfd/ab3100-core.c | 1 -
>  drivers/mfd/adp5520.c | 1 -
>  drivers/mfd/arizona-i2c.c | 1 -
>  drivers/mfd/as3711.c  | 1 -
>  drivers/mfd/as3722.c  | 1 -
>  drivers/mfd/axp20x.c  | 1 -
>  drivers/mfd/bcm590xx.c| 1 -
>  drivers/mfd/cros_ec_i2c.c | 1 -
>  drivers/mfd/da903x.c  | 1 -
>  drivers/mfd/da9052-i2c.c  | 1 -
>  drivers/mfd/da9055-i2c.c  | 1 -
>  drivers/mfd/da9063-i2c.c  | 1 -
>  drivers/mfd/intel_soc_pmic_core.c | 1 -
>  drivers/mfd/lm3533-core.c | 1 -
>  drivers/mfd/lp3943.c  | 1 -
>  drivers/mfd/lp8788.c  | 1 -
>  drivers/mfd/max14577.c| 1 -
>  drivers/mfd/max77686.c| 1 -
>  drivers/mfd/max77693.c| 1 -
>  drivers/mfd/max8907.c | 1 -
>  drivers/mfd/max8925-i2c.c | 1 -
>  drivers/mfd/max8997.c | 1 -
>  drivers/mfd/max8998.c | 1 -
>  drivers/mfd/mc13xxx-i2c.c | 1 -
>  drivers/mfd/palmas.c  | 1 -
>  drivers/mfd/rc5t583.c | 1 -
>  drivers/mfd/retu-mfd.c| 1 -
>  drivers/mfd/sec-core.c| 1 -
>  drivers/mfd/si476x-i2c.c  | 1 -
>  drivers/mfd/smsc-ece1099.c| 1 -
>  drivers/mfd/stmpe-i2c.c   | 1 -
>  drivers/mfd/tc3589x.c | 1 -
>  drivers/mfd/tps6507x.c| 1 -
>  drivers/mfd/tps65090.c| 1 -
>  drivers/mfd/tps65217.c| 1 -
>  drivers/mfd/tps65218.c| 1 -
>  drivers/mfd/tps6586x.c| 1 -
>  drivers/mfd/tps65910.c| 1 -
>  drivers/mfd/tps65912-i2c.c| 1 -
>  drivers/mfd/tps80031.c| 1 -
>  drivers/mfd/twl6040.c | 1 -
>  drivers/mfd/wm831x-i2c.c  | 1 -
>  drivers/mfd/wm8350-i2c.c  | 1 -
>  drivers/mfd/wm8400-core.c | 1 -
>  drivers/mfd/wm8994-core.c | 1 -
>  49 files changed, 49 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c
> index 841717a2842c..f2d9fb4c4e8e 100644
> --- a/drivers/mfd/88pm800.c
> +++ b/drivers/mfd/88pm800.c
> @@ -609,7 +609,6 @@ static int pm800_remove(struct i2c_client *client)
>  static struct i2c_driver pm800_driver = {
>   .driver = {
>   .name = "88PM800",
> - .owner = THIS_MODULE,
>   .pm = &pm80x_pm_ops,
>   },
>   .probe = pm800_probe,
> diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c
> index e9d50644660c..39f2302e137b 100644
> --- a/drivers/mfd/88pm805.c
> +++ b/drivers/mfd/88pm805.c
> @@ -267,7 +267,6 @@ static int pm805_remove(struct i2c_client *client)
>  static struct i2c_driver pm805_driver = {
>   .driver = {
>   .name = "88PM805",
> - .owner = THIS_MODULE,
>   .pm = &pm80x_pm_ops,
>   },
>   .probe = pm805_probe,
> diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
> index e03b7f45b8f7..cb47d6e00ebe 100644
> --- a/drivers/mfd/88pm860x-core.c
> +++ b/drivers/mfd/88pm860x-core.c
> @@ -1258,7 +1258,6 @@ MODULE_DEVICE_TABLE(of, pm860x_dt_ids);
>  static struct i2c_driver pm860x_driver = {
>   .driver = {
>   .name   = "88PM860x",
> - .owner  = THIS_MODULE,
>   .pm = &pm860x_pm_ops,
>   .of_match_table = pm860x_dt_ids,
>   },
> diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
> index 4e6e03d63e12..29b6a2d4ac72 100644
> --- a/drivers/mfd/aat2870-core.c
> +++ b/drivers/mfd/aat2870-core.c
> @@ -500,7 +500,6 @@ MODULE_DEVICE_TABLE(i2c, aat2870_i2c_id_table);
>  static struct i2c_driver aat2870_i2c_driver = {
>   .driver = {
>   .name   = "aat2870",
> - .owner  = THIS_MODULE,
>   .pm = &aat2870_pm_ops,
>   },
>   .probe  = aat2870_i2c_probe,
> diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
> index 4659ac1db039..f0afb44271f8 100644
> --- a/drivers/mfd/ab3100-core.c
> +++ b/drivers/mfd/ab3100-core.c
> @@ -972,7 +972,6 @@ MODULE_DEVICE_TABLE(i2c, ab3100_id);
>  static struct i2c_driver ab3100_driver = {
>   .driver = {
>   .name   = "ab3100",
> - .owner  = THIS_MODULE,
>   },
>   .id_table   = ab3100_id,
>   .probe  = ab3100_probe,
> diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
> index f495b8b57dd7..ae88654595dc 100644
> --- a/drivers/mfd/adp5520.c
> +++ 

[PATCH] Drop owner assignment from i2c_driver (and platform left-overs)

2015-07-09 Thread Krzysztof Kozlowski
Hi,


The i2c drivers also do not have to set 'owner' field because
i2c_register_driver() will do it instead.

'owner' is removed from i2c drivers, which I was able to compile
with allyesconfig (arm, arm64, i386, x86_64, ppc64).
Only compile-tested.

The coccinelle script which generated the patch was sent here:
http://www.spinics.net/lists/kernel/msg2029903.html


Best regards,
Krzysztof


Krzysztof Kozlowski (1):
  mfd: Drop owner assignment from i2c_drivers

 drivers/mfd/88pm800.c | 1 -
 drivers/mfd/88pm805.c | 1 -
 drivers/mfd/88pm860x-core.c   | 1 -
 drivers/mfd/aat2870-core.c| 1 -
 drivers/mfd/ab3100-core.c | 1 -
 drivers/mfd/adp5520.c | 1 -
 drivers/mfd/arizona-i2c.c | 1 -
 drivers/mfd/as3711.c  | 1 -
 drivers/mfd/as3722.c  | 1 -
 drivers/mfd/axp20x.c  | 1 -
 drivers/mfd/bcm590xx.c| 1 -
 drivers/mfd/cros_ec_i2c.c | 1 -
 drivers/mfd/da903x.c  | 1 -
 drivers/mfd/da9052-i2c.c  | 1 -
 drivers/mfd/da9055-i2c.c  | 1 -
 drivers/mfd/da9063-i2c.c  | 1 -
 drivers/mfd/intel_soc_pmic_core.c | 1 -
 drivers/mfd/lm3533-core.c | 1 -
 drivers/mfd/lp3943.c  | 1 -
 drivers/mfd/lp8788.c  | 1 -
 drivers/mfd/max14577.c| 1 -
 drivers/mfd/max77686.c| 1 -
 drivers/mfd/max77693.c| 1 -
 drivers/mfd/max8907.c | 1 -
 drivers/mfd/max8925-i2c.c | 1 -
 drivers/mfd/max8997.c | 1 -
 drivers/mfd/max8998.c | 1 -
 drivers/mfd/mc13xxx-i2c.c | 1 -
 drivers/mfd/palmas.c  | 1 -
 drivers/mfd/rc5t583.c | 1 -
 drivers/mfd/retu-mfd.c| 1 -
 drivers/mfd/sec-core.c| 1 -
 drivers/mfd/si476x-i2c.c  | 1 -
 drivers/mfd/smsc-ece1099.c| 1 -
 drivers/mfd/stmpe-i2c.c   | 1 -
 drivers/mfd/tc3589x.c | 1 -
 drivers/mfd/tps6507x.c| 1 -
 drivers/mfd/tps65090.c| 1 -
 drivers/mfd/tps65217.c| 1 -
 drivers/mfd/tps65218.c| 1 -
 drivers/mfd/tps6586x.c| 1 -
 drivers/mfd/tps65910.c| 1 -
 drivers/mfd/tps65912-i2c.c| 1 -
 drivers/mfd/tps80031.c| 1 -
 drivers/mfd/twl6040.c | 1 -
 drivers/mfd/wm831x-i2c.c  | 1 -
 drivers/mfd/wm8350-i2c.c  | 1 -
 drivers/mfd/wm8400-core.c | 1 -
 drivers/mfd/wm8994-core.c | 1 -
 49 files changed, 49 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


[PATCH] mfd: Drop owner assignment from i2c_drivers

2015-07-09 Thread Krzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski 

---

The coccinelle script which generated the patch was sent here:
http://www.spinics.net/lists/kernel/msg2029903.html
---
 drivers/mfd/88pm800.c | 1 -
 drivers/mfd/88pm805.c | 1 -
 drivers/mfd/88pm860x-core.c   | 1 -
 drivers/mfd/aat2870-core.c| 1 -
 drivers/mfd/ab3100-core.c | 1 -
 drivers/mfd/adp5520.c | 1 -
 drivers/mfd/arizona-i2c.c | 1 -
 drivers/mfd/as3711.c  | 1 -
 drivers/mfd/as3722.c  | 1 -
 drivers/mfd/axp20x.c  | 1 -
 drivers/mfd/bcm590xx.c| 1 -
 drivers/mfd/cros_ec_i2c.c | 1 -
 drivers/mfd/da903x.c  | 1 -
 drivers/mfd/da9052-i2c.c  | 1 -
 drivers/mfd/da9055-i2c.c  | 1 -
 drivers/mfd/da9063-i2c.c  | 1 -
 drivers/mfd/intel_soc_pmic_core.c | 1 -
 drivers/mfd/lm3533-core.c | 1 -
 drivers/mfd/lp3943.c  | 1 -
 drivers/mfd/lp8788.c  | 1 -
 drivers/mfd/max14577.c| 1 -
 drivers/mfd/max77686.c| 1 -
 drivers/mfd/max77693.c| 1 -
 drivers/mfd/max8907.c | 1 -
 drivers/mfd/max8925-i2c.c | 1 -
 drivers/mfd/max8997.c | 1 -
 drivers/mfd/max8998.c | 1 -
 drivers/mfd/mc13xxx-i2c.c | 1 -
 drivers/mfd/palmas.c  | 1 -
 drivers/mfd/rc5t583.c | 1 -
 drivers/mfd/retu-mfd.c| 1 -
 drivers/mfd/sec-core.c| 1 -
 drivers/mfd/si476x-i2c.c  | 1 -
 drivers/mfd/smsc-ece1099.c| 1 -
 drivers/mfd/stmpe-i2c.c   | 1 -
 drivers/mfd/tc3589x.c | 1 -
 drivers/mfd/tps6507x.c| 1 -
 drivers/mfd/tps65090.c| 1 -
 drivers/mfd/tps65217.c| 1 -
 drivers/mfd/tps65218.c| 1 -
 drivers/mfd/tps6586x.c| 1 -
 drivers/mfd/tps65910.c| 1 -
 drivers/mfd/tps65912-i2c.c| 1 -
 drivers/mfd/tps80031.c| 1 -
 drivers/mfd/twl6040.c | 1 -
 drivers/mfd/wm831x-i2c.c  | 1 -
 drivers/mfd/wm8350-i2c.c  | 1 -
 drivers/mfd/wm8400-core.c | 1 -
 drivers/mfd/wm8994-core.c | 1 -
 49 files changed, 49 deletions(-)

diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c
index 841717a2842c..f2d9fb4c4e8e 100644
--- a/drivers/mfd/88pm800.c
+++ b/drivers/mfd/88pm800.c
@@ -609,7 +609,6 @@ static int pm800_remove(struct i2c_client *client)
 static struct i2c_driver pm800_driver = {
.driver = {
.name = "88PM800",
-   .owner = THIS_MODULE,
.pm = &pm80x_pm_ops,
},
.probe = pm800_probe,
diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c
index e9d50644660c..39f2302e137b 100644
--- a/drivers/mfd/88pm805.c
+++ b/drivers/mfd/88pm805.c
@@ -267,7 +267,6 @@ static int pm805_remove(struct i2c_client *client)
 static struct i2c_driver pm805_driver = {
.driver = {
.name = "88PM805",
-   .owner = THIS_MODULE,
.pm = &pm80x_pm_ops,
},
.probe = pm805_probe,
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index e03b7f45b8f7..cb47d6e00ebe 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -1258,7 +1258,6 @@ MODULE_DEVICE_TABLE(of, pm860x_dt_ids);
 static struct i2c_driver pm860x_driver = {
.driver = {
.name   = "88PM860x",
-   .owner  = THIS_MODULE,
.pm = &pm860x_pm_ops,
.of_match_table = pm860x_dt_ids,
},
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
index 4e6e03d63e12..29b6a2d4ac72 100644
--- a/drivers/mfd/aat2870-core.c
+++ b/drivers/mfd/aat2870-core.c
@@ -500,7 +500,6 @@ MODULE_DEVICE_TABLE(i2c, aat2870_i2c_id_table);
 static struct i2c_driver aat2870_i2c_driver = {
.driver = {
.name   = "aat2870",
-   .owner  = THIS_MODULE,
.pm = &aat2870_pm_ops,
},
.probe  = aat2870_i2c_probe,
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index 4659ac1db039..f0afb44271f8 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -972,7 +972,6 @@ MODULE_DEVICE_TABLE(i2c, ab3100_id);
 static struct i2c_driver ab3100_driver = {
.driver = {
.name   = "ab3100",
-   .owner  = THIS_MODULE,
},
.id_table   = ab3100_id,
.probe  = ab3100_probe,
diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
index f495b8b57dd7..ae88654595dc 100644
--- a/drivers/mfd/adp5520.c
+++ b/drivers/mfd/adp5520.c
@@ -351,7 +351,6 @@ MODULE_DEVICE_TABLE(i2c, adp5520_id);
 static struct i2c_driver adp5520_driver = {
.driver = {
.name   = "adp5520",
-   .owner  = THIS_MODULE,
.pm = &adp55

[PATCH] ARM: EXYNOS: pmu: Drop owner assignment

2015-07-09 Thread Krzysztof Kozlowski
platform_driver does not need to set an owner because
platform_driver_register() will set it.

Signed-off-by: Krzysztof Kozlowski 

---

The coccinelle script which generated the patch was sent here:
http://www.spinics.net/lists/kernel/msg2029903.html
---
 arch/arm/mach-exynos/pmu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index e812c1c85624..960fc3510545 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -991,7 +991,6 @@ static int exynos_pmu_probe(struct platform_device *pdev)
 static struct platform_driver exynos_pmu_driver = {
.driver  = {
.name   = "exynos-pmu",
-   .owner  = THIS_MODULE,
.of_match_table = exynos_pmu_of_device_ids,
},
.probe = exynos_pmu_probe,
-- 
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] Drop owner assignment from i2c_driver (and platform left-overs)

2015-07-09 Thread Krzysztof Kozlowski
Hi,


The i2c drivers also do not have to set 'owner' field because
i2c_register_driver() will do it instead.

'owner' is removed from i2c drivers, which I was able to compile
with allyesconfig (arm, arm64, i386, x86_64, ppc64).
Only compile-tested.

The coccinelle script which generated the patch was sent here:
http://www.spinics.net/lists/kernel/msg2029903.html


Best regards,
Krzysztof

Krzysztof Kozlowski (1):
  ARM: EXYNOS: pmu: Drop owner assignment

 arch/arm/mach-exynos/pmu.c | 1 -
 1 file changed, 1 deletion(-)

-- 
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 v2 2/7] cpufreq: opp: fix handling of turbo modes

2015-07-09 Thread Krzysztof Kozlowski
On 10.07.2015 00:43, Bartlomiej Zolnierkiewicz wrote:
> Turbo modes should be marked with CPUFREQ_BOOST_FREQ flag in
> the frequency table entry.
> 
> Cc: Tomasz Figa 
> Cc: Michael Turquette 
> Cc: Javier Martinez Canillas 
> Cc: Thomas Abraham 
> Cc: Viresh Kumar 
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/cpufreq/cpufreq_opp.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Krzysztof Kozlowski 

Best regards,
Krzysztof

--
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/7] opp: add dev_pm_opp_get_turbo_mode_setting() helper

2015-07-09 Thread Krzysztof Kozlowski
On 10.07.2015 00:43, Bartlomiej Zolnierkiewicz wrote:
> Add dev_pm_opp_get_turbo_mode_setting() helper for getting turbo
> mode setting for a given opp.
> 
> Cc: Tomasz Figa 
> Cc: Michael Turquette 
> Cc: Javier Martinez Canillas 
> Cc: Thomas Abraham 
> Cc: Viresh Kumar 
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/base/power/opp.c | 31 +++
>  include/linux/pm_opp.h   |  7 +++
>  2 files changed, 38 insertions(+)
> 
> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> index e24502a2..6b34b2a 100644
> --- a/drivers/base/power/opp.c
> +++ b/drivers/base/power/opp.c
> @@ -287,6 +287,37 @@ unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
>  EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq);
>  
>  /**
> + * dev_pm_opp_get_turbo_mode_setting() - Gets the turbo setting
> + * @opp: opp for which turbo mode setting has to be returned for
> + *
> + * Return: turbo mode setting corresponding to the opp (true or false)
> + *
> + * Locking: This function must be called under rcu_read_lock(). opp is a rcu
> + * protected pointer. This means that opp which could have been fetched by
> + * opp_find_freq_{exact,ceil,floor} functions is valid as long as we are
> + * under RCU lock. The pointer returned by the opp_find_freq family must be
> + * used in the same section as the usage of this function with the pointer
> + * prior to unlocking with rcu_read_unlock() to maintain the integrity of the
> + * pointer.
> + */
> +bool dev_pm_opp_get_turbo_mode_setting(struct dev_pm_opp *opp)

It is just true or false, so maybe dev_pm_opp_is_turbo_mode()?

Everything else looks good to me.

Best regards,
Krzysztof

> +{
> + struct dev_pm_opp *tmp_opp;
> + bool f = false;
> +
> + opp_rcu_lockdep_assert();
> +
> + tmp_opp = rcu_dereference(opp);
> + if (unlikely(IS_ERR_OR_NULL(tmp_opp)) || !tmp_opp->available)
> + pr_err("%s: Invalid parameters\n", __func__);
> + else
> + f = tmp_opp->turbo;
> +
> + return f;
> +}
> +EXPORT_SYMBOL_GPL(dev_pm_opp_get_turbo_mode_setting);
> +
> +/**
>   * dev_pm_opp_get_max_clock_latency() - Get max clock latency in nanoseconds
>   * @dev: device for which we do this operation
>   *
> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
> index bb52fae..7856baf 100644
> --- a/include/linux/pm_opp.h
> +++ b/include/linux/pm_opp.h
> @@ -30,6 +30,8 @@ unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp 
> *opp);
>  
>  unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
>  
> +bool dev_pm_opp_get_turbo_mode_setting(struct dev_pm_opp *opp);
> +
>  int dev_pm_opp_get_opp_count(struct device *dev);
>  unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
>  
> @@ -63,6 +65,11 @@ static inline unsigned long dev_pm_opp_get_freq(struct 
> dev_pm_opp *opp)
>   return 0;
>  }
>  
> +static inline bool dev_pm_opp_get_turbo_mode_setting(struct dev_pm_opp *opp)
> +{
> + return false;
> +}
> +
>  static inline int dev_pm_opp_get_opp_count(struct device *dev)
>  {
>   return 0;
> 

--
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 12/23] drm/exynos: don't track enabled state at exynos_crtc

2015-07-09 Thread Joonyoung Shim
On 07/10/2015 07:56 AM, Gustavo Padovan wrote:
> 2015-07-09 Joonyoung Shim :
> 
>> +Cc Andrzej,
>>
>> On 07/07/2015 02:41 AM, Daniel Vetter wrote:
>>> On Mon, Jul 06, 2015 at 11:20:13AM -0300, Gustavo Padovan wrote:
 From: Gustavo Padovan 

 struct drm_crtc already stores the enabled state of the crtc
 thus we don't need to replicate enabled in exynos_drm_crtc.

>>
>> I think exynos_crtc->enabled can replace flags for power state of each
>> hw driver(e.g. "powered" of mixer driver, "suspended" of fimd driver).
>> Further, we can add other flag bit for instead of using special flag
>> in hw driver like vsync state("int_en" of mixer driver, "irq_flags" of
>> fimd driver.)
> 
> The reason I removed it is because crtc->state->active already stores
> the same information as exynos_crtc->enabled. I think we could rely
> on active as well for mixer powered and suspended.
> 

Then it may need another stuff on struct exynos_crtc if we try to
replace other hw flag like int_en or irq_flags.

Anyway, the reason that you remove it is ok to me now.

Thanks.
--
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 0/7] cpufreq: use generic cpufreq drivers for Exynos4x12 platform

2015-07-09 Thread Javier Martinez Canillas
Hello Bartlomiej,

On Thu, Jul 9, 2015 at 8:43 AM, Bartlomiej Zolnierkiewicz 
 wrote:
> Hi,
>
> This patch series removes the use of Exynos4x12 specific support
> from cpufreq-exynos driver and enables the use of cpufreq-dt driver
> for this platform.
>
> In order to preserve support for Exynos4x12 'boost' mode cpufreq-dt
> driver is made aware of cpufreq 'boost' mode infrastructure.  Once
> it is done (+ turbo modes handling is fixed, please see below for
> details) the driver starts to use turbo mode frequencies (defined
> using opp-v2 bindings) as 'boost' mode frequecies.
>
> Patches #1-2 are needed to fix handling of turbo modes in cpufreq
> core and without them cpufreq-dt treats turbo modes as normal modes
> (IOW they are used by default as normal modes even if they are defined
> in DTS file as turbo modes).  Ideally these patches should be added
> into "[PATCH 00/10] OPP: Add code to support operating-points-v2
> bindings" patch series before patch #10 ("[PATCH 10/10] cpufreq-dt:
> Add support for operating-points-v2 bindings").
>
> This patch series has been tested on Exynos4412 based Odroid-U3 and
> Trats2 boards.
>
> Depends on:
> - next-20150629 branch of linux-next kernel tree
> - "[PATCH v3 0/4] cpufreq: use generic cpufreq drivers for Exynos5250
>   platform" (http://lkml.org/lkml/2015/7/1/311)
> - "PATCH 00/10] OPP: Add code to support operating-points-v2 bindings"
>   (http://www.spinics.net/lists/arm-kernel/msg425517.html)
>
> Changes since v1
> (http://thread.gmane.org/gmane.linux.kernel.samsung-soc/44361):
> - rebased on top of next-20150629 branch of linux-next kernel tree
> - rebased on top of Exynos5250 cpufreq-dt support patch series
> - fixed if-statement in exynos4_clk_init() (noticed by Tobias Jakobi)
> - ported over opp-v2 bindings (requested by Viresh Kumar)
>
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
>
>
> Bartlomiej Zolnierkiewicz (7):
>   opp: add dev_pm_opp_get_turbo_mode_setting() helper
>   cpufreq: opp: fix handling of turbo modes
>   cpufreq-dt: add turbo modes support
>   clk: samsung: exynos4x12: add cpu clock configuration data and
> instantiate cpu clock
>   ARM: dts: Exynos4x12: add CPU OPP and regulator supply property
>   ARM: Exynos: switch to using generic cpufreq driver for Exynos4x12
>   cpufreq: exynos: remove Exynos4x12 specific cpufreq driver support
>

I don't have access to an Exynos4x12 board to test but I've reviewed
the patches and they look good to me. So for the complete series:

Reviewed-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Sr. Linux Kernel Developer
Open Source Group
Samsung Research America
--
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 12/23] drm/exynos: don't track enabled state at exynos_crtc

2015-07-09 Thread Gustavo Padovan
2015-07-09 Joonyoung Shim :

> +Cc Andrzej,
> 
> On 07/07/2015 02:41 AM, Daniel Vetter wrote:
> > On Mon, Jul 06, 2015 at 11:20:13AM -0300, Gustavo Padovan wrote:
> >> From: Gustavo Padovan 
> >>
> >> struct drm_crtc already stores the enabled state of the crtc
> >> thus we don't need to replicate enabled in exynos_drm_crtc.
> >>
> 
> I think exynos_crtc->enabled can replace flags for power state of each
> hw driver(e.g. "powered" of mixer driver, "suspended" of fimd driver).
> Further, we can add other flag bit for instead of using special flag
> in hw driver like vsync state("int_en" of mixer driver, "irq_flags" of
> fimd driver.)

The reason I removed it is because crtc->state->active already stores
the same information as exynos_crtc->enabled. I think we could rely
on active as well for mixer powered and suspended.

Gustavo
--
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] clk: exynos4: Fix wrong clock for Exynos4x12 ADC

2015-07-09 Thread Sylwester Nawrocki
On 09/07/15 02:23, Krzysztof Kozlowski wrote:
>  drivers/clk/samsung/clk-exynos4.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
 >>>
 >>> Patch looks good to me.
 >>>
 >>> Reviewed-by: Javier Martinez Canillas 
>>> >>
>>> >> Hi Tomasz and Sylwester,
>>> >>
>>> >> Any comments on this version of patch?
>>> >> Tomasz, you gave me comments on previous version. Are their satisfied?
>> >
>> > Acked-by: Tomasz Figa 
> Thanks for ack.
> 
> Sylwester, are you gonna to pick it up or this should go through other tree?

I've taken care of this citizen, thanks for the reminder and reviews.

-- 
Regards,
Sylwester
--
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 v2 5/7] ARM: dts: Exynos4x12: add CPU OPP and regulator supply property

2015-07-09 Thread Bartlomiej Zolnierkiewicz
For Exynos4x12 platforms, add CPU operating points (using
opp-v2 bindings) and CPU regulator supply properties for
migrating from Exynos specific cpufreq driver to using
generic cpufreq driver.

Based on the earlier work by Thomas Abraham.

Cc: Kukjin Kim 
Cc: Doug Anderson 
Cc: Javier Martinez Canillas 
Cc: Andreas Faerber 
Cc: Thomas Abraham 
Signed-off-by: Bartlomiej Zolnierkiewicz 
---
 arch/arm/boot/dts/exynos4212.dtsi   | 81 
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi |  4 ++
 arch/arm/boot/dts/exynos4412-origen.dts |  5 ++
 arch/arm/boot/dts/exynos4412-trats2.dts |  5 ++
 arch/arm/boot/dts/exynos4412.dtsi   | 83 +
 5 files changed, 178 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4212.dtsi 
b/arch/arm/boot/dts/exynos4212.dtsi
index d9c8efee..9dc40d5 100644
--- a/arch/arm/boot/dts/exynos4212.dtsi
+++ b/arch/arm/boot/dts/exynos4212.dtsi
@@ -30,6 +30,9 @@
device_type = "cpu";
compatible = "arm,cortex-a9";
reg = <0xA00>;
+   clocks = <&clock CLK_ARM_CLK>;
+   clock-names = "cpu";
+   operating-points-v2 = <&cpu0_opp_table>;
cooling-min-level = <13>;
cooling-max-level = <7>;
#cooling-cells = <2>; /* min followed by max */
@@ -39,6 +42,84 @@
device_type = "cpu";
compatible = "arm,cortex-a9";
reg = <0xA01>;
+   operating-points-v2 = <&cpu0_opp_table>;
+   };
+   };
+
+   cpu0_opp_table: opp_table0 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = <2>;
+   opp-microvolt = <90>;
+   clock-latency-ns = <20>;
+   };
+   opp01 {
+   opp-hz = <3>;
+   opp-microvolt = <90>;
+   clock-latency-ns = <20>;
+   };
+   opp02 {
+   opp-hz = <4>;
+   opp-microvolt = <925000>;
+   clock-latency-ns = <20>;
+   };
+   opp03 {
+   opp-hz = <5>;
+   opp-microvolt = <95>;
+   clock-latency-ns = <20>;
+   };
+   opp04 {
+   opp-hz = <6>;
+   opp-microvolt = <975000>;
+   clock-latency-ns = <20>;
+   };
+   opp05 {
+   opp-hz = <7>;
+   opp-microvolt = <987500>;
+   clock-latency-ns = <20>;
+   };
+   opp06 {
+   opp-hz = <8>;
+   opp-microvolt = <100>;
+   clock-latency-ns = <20>;
+   };
+   opp07 {
+   opp-hz = <9>;
+   opp-microvolt = <1037500>;
+   clock-latency-ns = <20>;
+   };
+   opp08 {
+   opp-hz = <10>;
+   opp-microvolt = <1087500>;
+   clock-latency-ns = <20>;
+   };
+   opp09 {
+   opp-hz = <11>;
+   opp-microvolt = <1137500>;
+   clock-latency-ns = <20>;
+   };
+   opp10 {
+   opp-hz = <12>;
+   opp-microvolt = <1187500>;
+   clock-latency-ns = <20>;
+   };
+   opp11 {
+   opp-hz = <13>;
+   opp-microvolt = <125>;
+   clock-latency-ns = <20>;
+   };
+   opp12 {
+   opp-hz = <14>;
+   opp-microvolt = <1287500>;
+   clock-latency-ns = <20>;
+   };
+   opp13 {
+   opp-hz = <15>;
+   opp-microvolt = <135>;
+   clock-latency-ns = <20>;
+   turbo-mode;
};
};
 };
diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi 
b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
index ca7d168..1c7811a 100644
--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -507,3 +507,7 @@
 &watchdog {
status = "okay";
 };
+
+&cpu0 {
+   cpu0-supply = <&buck2_reg>;
+};
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts 
b/arch/ar

[PATCH v2 7/7] cpufreq: exynos: remove Exynos4x12 specific cpufreq driver support

2015-07-09 Thread Bartlomiej Zolnierkiewicz
Exynos4x12 based platforms have switched over to use generic
cpufreq driver for cpufreq functionality.  So the Exynos
specific cpufreq support for these platforms can be removed.

Also once Exynos4x12 based platforms support have been removed
the shared exynos-cpufreq driver is no longer needed and can
be deleted.

Based on the earlier work by Thomas Abraham.

Cc: Viresh Kumar 
Cc: Javier Martinez Canillas 
Cc: Thomas Abraham 
Signed-off-by: Bartlomiej Zolnierkiewicz 
---
 drivers/cpufreq/Kconfig.arm  |  23 
 drivers/cpufreq/Makefile |   2 -
 drivers/cpufreq/exynos-cpufreq.c | 231 --
 drivers/cpufreq/exynos-cpufreq.h |  72 ---
 drivers/cpufreq/exynos4x12-cpufreq.c | 236 ---
 5 files changed, 564 deletions(-)
 delete mode 100644 drivers/cpufreq/exynos-cpufreq.c
 delete mode 100644 drivers/cpufreq/exynos-cpufreq.h
 delete mode 100644 drivers/cpufreq/exynos4x12-cpufreq.c

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 5f5a15a..7d7a815 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -24,29 +24,6 @@ config ARM_VEXPRESS_SPC_CPUFREQ
   This add the CPUfreq driver support for Versatile Express
  big.LITTLE platforms using SPC for power management.
 
-
-config ARM_EXYNOS_CPUFREQ
-   tristate "SAMSUNG EXYNOS CPUfreq Driver"
-   depends on CPU_EXYNOS4210 || SOC_EXYNOS4212 || SOC_EXYNOS4412 || 
SOC_EXYNOS5250
-   depends on THERMAL
-   help
- This adds the CPUFreq driver for Samsung EXYNOS platforms.
- Supported SoC versions are:
-Exynos4210, Exynos4212, Exynos4412, and Exynos5250.
-
- If in doubt, say N.
-
-config ARM_EXYNOS4X12_CPUFREQ
-   bool "SAMSUNG EXYNOS4x12"
-   depends on SOC_EXYNOS4212 || SOC_EXYNOS4412
-   depends on ARM_EXYNOS_CPUFREQ
-   default y
-   help
- This adds the CPUFreq driver for Samsung EXYNOS4X12
- SoC (EXYNOS4212 or EXYNOS4412).
-
- If in doubt, say N.
-
 config ARM_EXYNOS_CPU_FREQ_BOOST_SW
bool "EXYNOS Frequency Overclocking - Software"
depends on CPUFREQ_DT && THERMAL
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 6414958..bbc4a9f 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -53,8 +53,6 @@ obj-$(CONFIG_ARM_DT_BL_CPUFREQ)   += 
arm_big_little_dt.o
 obj-$(CONFIG_ARCH_DAVINCI) += davinci-cpufreq.o
 obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS_CPUFREQ)   += arm-exynos-cpufreq.o
-arm-exynos-cpufreq-y   := exynos-cpufreq.o
-arm-exynos-cpufreq-$(CONFIG_ARM_EXYNOS4X12_CPUFREQ)+= exynos4x12-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ)   += exynos5440-cpufreq.o
 obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ) += highbank-cpufreq.o
 obj-$(CONFIG_ARM_HISI_ACPU_CPUFREQ)+= hisi-acpu-cpufreq.o
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
deleted file mode 100644
index 89d252e..000
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * EXYNOS - CPU frequency scaling support for EXYNOS series
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "exynos-cpufreq.h"
-
-static struct exynos_dvfs_info *exynos_info;
-static struct thermal_cooling_device *cdev;
-static struct regulator *arm_regulator;
-static unsigned int locking_frequency;
-
-static int exynos_cpufreq_get_index(unsigned int freq)
-{
-   struct cpufreq_frequency_table *freq_table = exynos_info->freq_table;
-   struct cpufreq_frequency_table *pos;
-
-   cpufreq_for_each_entry(pos, freq_table)
-   if (pos->frequency == freq)
-   break;
-
-   if (pos->frequency == CPUFREQ_TABLE_END)
-   return -EINVAL;
-
-   return pos - freq_table;
-}
-
-static int exynos_cpufreq_scale(unsigned int target_freq)
-{
-   struct cpufreq_frequency_table *freq_table = exynos_info->freq_table;
-   unsigned int *volt_table = exynos_info->volt_table;
-   struct cpufreq_policy *policy = cpufreq_cpu_get(0);
-   unsigned int arm_volt, safe_arm_volt = 0;
-   unsigned int mpll_freq_khz = exynos_info->mpll_freq_khz;
-   struct device *dev = exynos_info->dev;
-   unsigned int old_freq;
-   int index, old_index;
-   int ret = 0;
-
-   old_freq = policy->cur;
-
-   /*
-* The policy max have been changed so that we cannot get proper
-* old_index with cpufreq_frequency_table_targ

[PATCH v2 6/7] ARM: Exynos: switch to using generic cpufreq driver for Exynos4x12

2015-07-09 Thread Bartlomiej Zolnierkiewicz
The new CPU clock type allows the use of generic CPUfreq driver.
Switch Exynos4x12 to using generic cpufreq driver.

This patch also takes care of making ARM_EXYNOS_CPU_FREQ_BOOST_SW
config option depend on cpufreq-dt driver instead of exynos-cpufreq
one and fixes the minor issue present with the old code (support
for 'boost' mode in the exynos-cpufreq driver was enabled for all
supported SoCs even though 'boost' frequency was provided only for
Exynos4x12 ones).

Cc: Tomasz Figa 
Cc: Kukjin Kim 
Cc: Javier Martinez Canillas 
Cc: Thomas Abraham 
Signed-off-by: Bartlomiej Zolnierkiewicz 
---
 arch/arm/mach-exynos/exynos.c| 14 ++
 drivers/cpufreq/Kconfig.arm  |  2 +-
 drivers/cpufreq/exynos-cpufreq.c |  3 ---
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 4015ec3..0c74e90 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -224,6 +225,12 @@ static void __init exynos_init_irq(void)
exynos_map_pmu();
 }
 
+struct cpufreq_dt_platform_data cpufreq_dt_pd = {
+#ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW
+   .boost_supported = true,
+#endif
+};
+
 static const struct of_device_id exynos_cpufreq_matches[] = {
{ .compatible = "samsung,exynos4210", .data = "cpufreq-dt" },
{ .compatible = "samsung,exynos5250", .data = "cpufreq-dt" },
@@ -235,6 +242,13 @@ static void __init exynos_cpufreq_init(void)
struct device_node *root = of_find_node_by_path("/");
const struct of_device_id *match;
 
+   if (of_machine_is_compatible("samsung,exynos4212") ||
+   of_machine_is_compatible("samsung,exynos4412")) {
+   platform_device_register_data(NULL, "cpufreq-dt", -1,
+   &cpufreq_dt_pd, sizeof(cpufreq_dt_pd));
+   return;
+   }
+
match = of_match_node(exynos_cpufreq_matches, root);
if (!match) {
platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 9ab6388c1..5f5a15a 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -49,7 +49,7 @@ config ARM_EXYNOS4X12_CPUFREQ
 
 config ARM_EXYNOS_CPU_FREQ_BOOST_SW
bool "EXYNOS Frequency Overclocking - Software"
-   depends on ARM_EXYNOS_CPUFREQ && THERMAL
+   depends on CPUFREQ_DT && THERMAL
select CPU_FREQ_BOOST_SW
select EXYNOS_THERMAL
help
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index 71d8891..89d252e 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -150,9 +150,6 @@ static struct cpufreq_driver exynos_driver = {
.init   = exynos_cpufreq_cpu_init,
.name   = "exynos_cpufreq",
.attr   = cpufreq_generic_attr,
-#ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW
-   .boost_supported = true,
-#endif
 #ifdef CONFIG_PM
.suspend= cpufreq_generic_suspend,
 #endif
-- 
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 v2 4/7] clk: samsung: exynos4x12: add cpu clock configuration data and instantiate cpu clock

2015-07-09 Thread Bartlomiej Zolnierkiewicz
With the addition of the new Samsung specific cpu-clock type, the
arm clock can be represented as a cpu-clock type. Add the CPU clock
configuration data and instantiate the CPU clock type for Exynos4x12.

Based on the earlier work by Thomas Abraham.

Cc: Tomasz Figa 
Cc: Michael Turquette 
Cc: Javier Martinez Canillas 
Cc: Thomas Abraham 
Signed-off-by: Bartlomiej Zolnierkiewicz 
---
 drivers/clk/samsung/clk-exynos4.c | 50 +++
 1 file changed, 50 insertions(+)

diff --git a/drivers/clk/samsung/clk-exynos4.c 
b/drivers/clk/samsung/clk-exynos4.c
index cae2c048..3071260 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -1396,6 +1396,45 @@ static const struct exynos_cpuclk_cfg_data 
e4210_armclk_d[] __initconst = {
{  0 },
 };
 
+static const struct exynos_cpuclk_cfg_data e4212_armclk_d[] __initconst = {
+   { 150, E4210_CPU_DIV0(2, 1, 6, 0, 7, 3), E4210_CPU_DIV1(2, 6), },
+   { 140, E4210_CPU_DIV0(2, 1, 6, 0, 7, 3), E4210_CPU_DIV1(2, 6), },
+   { 130, E4210_CPU_DIV0(2, 1, 5, 0, 7, 3), E4210_CPU_DIV1(2, 5), },
+   { 120, E4210_CPU_DIV0(2, 1, 5, 0, 7, 3), E4210_CPU_DIV1(2, 5), },
+   { 110, E4210_CPU_DIV0(2, 1, 4, 0, 6, 3), E4210_CPU_DIV1(2, 4), },
+   { 100, E4210_CPU_DIV0(1, 1, 4, 0, 5, 2), E4210_CPU_DIV1(2, 4), },
+   {  90, E4210_CPU_DIV0(1, 1, 3, 0, 5, 2), E4210_CPU_DIV1(2, 3), },
+   {  80, E4210_CPU_DIV0(1, 1, 3, 0, 5, 2), E4210_CPU_DIV1(2, 3), },
+   {  70, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4210_CPU_DIV1(2, 3), },
+   {  60, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4210_CPU_DIV1(2, 3), },
+   {  50, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4210_CPU_DIV1(2, 3), },
+   {  40, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4210_CPU_DIV1(2, 3), },
+   {  30, E4210_CPU_DIV0(1, 1, 2, 0, 4, 2), E4210_CPU_DIV1(2, 3), },
+   {  20, E4210_CPU_DIV0(1, 1, 1, 0, 3, 1), E4210_CPU_DIV1(2, 3), },
+   {  0 },
+};
+
+#define E4412_CPU_DIV1(cores, hpm, copy)   \
+   (((cores) << 8) | ((hpm) << 4) | ((copy) << 0))
+
+static const struct exynos_cpuclk_cfg_data e4412_armclk_d[] __initconst = {
+   { 150, E4210_CPU_DIV0(2, 1, 6, 0, 7, 3), E4412_CPU_DIV1(7, 0, 6), },
+   { 140, E4210_CPU_DIV0(2, 1, 6, 0, 7, 3), E4412_CPU_DIV1(6, 0, 6), },
+   { 130, E4210_CPU_DIV0(2, 1, 5, 0, 7, 3), E4412_CPU_DIV1(6, 0, 5), },
+   { 120, E4210_CPU_DIV0(2, 1, 5, 0, 7, 3), E4412_CPU_DIV1(5, 0, 5), },
+   { 110, E4210_CPU_DIV0(2, 1, 4, 0, 6, 3), E4412_CPU_DIV1(5, 0, 4), },
+   { 100, E4210_CPU_DIV0(1, 1, 4, 0, 5, 2), E4412_CPU_DIV1(4, 0, 4), },
+   {  90, E4210_CPU_DIV0(1, 1, 3, 0, 5, 2), E4412_CPU_DIV1(4, 0, 3), },
+   {  80, E4210_CPU_DIV0(1, 1, 3, 0, 5, 2), E4412_CPU_DIV1(3, 0, 3), },
+   {  70, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4412_CPU_DIV1(3, 0, 3), },
+   {  60, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4412_CPU_DIV1(2, 0, 3), },
+   {  50, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4412_CPU_DIV1(2, 0, 3), },
+   {  40, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4412_CPU_DIV1(1, 0, 3), },
+   {  30, E4210_CPU_DIV0(1, 1, 2, 0, 4, 2), E4412_CPU_DIV1(1, 0, 3), },
+   {  20, E4210_CPU_DIV0(1, 1, 1, 0, 3, 1), E4412_CPU_DIV1(0, 0, 3), },
+   {  0 },
+};
+
 /* register exynos4 clocks */
 static void __init exynos4_clk_init(struct device_node *np,
enum exynos4_soc soc)
@@ -1489,6 +1528,17 @@ static void __init exynos4_clk_init(struct device_node 
*np,
samsung_clk_register_fixed_factor(ctx,
exynos4x12_fixed_factor_clks,
ARRAY_SIZE(exynos4x12_fixed_factor_clks));
+   if (of_machine_is_compatible("samsung,exynos4412")) {
+   exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk",
+   mout_core_p4x12[0], mout_core_p4x12[1], 0x14200,
+   e4412_armclk_d, ARRAY_SIZE(e4412_armclk_d),
+   CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1);
+   } else {
+   exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk",
+   mout_core_p4x12[0], mout_core_p4x12[1], 0x14200,
+   e4212_armclk_d, ARRAY_SIZE(e4212_armclk_d),
+   CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1);
+   }
}
 
samsung_clk_register_alias(ctx, exynos4_aliases,
-- 
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 v2 3/7] cpufreq-dt: add turbo modes support

2015-07-09 Thread Bartlomiej Zolnierkiewicz
Add turbo modes (from opp-v2 bindings) support using
existing cpufreq 'boost' mode infrastructure:
- add boost_supported field to struct cpufreq_dt_platform_data
- set dt_cpufreq_driver.boost_supported in dt_cpufreq_probe()

Cc: Tomasz Figa 
Cc: Michael Turquette 
Cc: Javier Martinez Canillas 
Cc: Thomas Abraham 
Cc: Viresh Kumar 
Signed-off-by: Bartlomiej Zolnierkiewicz 
---
 drivers/cpufreq/cpufreq-dt.c | 7 ++-
 include/linux/cpufreq-dt.h   | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 60d98fb..9024205 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -408,6 +408,7 @@ static struct cpufreq_driver dt_cpufreq_driver = {
 
 static int dt_cpufreq_probe(struct platform_device *pdev)
 {
+   struct cpufreq_dt_platform_data *pd;
struct device *cpu_dev;
struct regulator *cpu_reg;
struct clk *cpu_clk;
@@ -428,7 +429,11 @@ static int dt_cpufreq_probe(struct platform_device *pdev)
if (!IS_ERR(cpu_reg))
regulator_put(cpu_reg);
 
-   dt_cpufreq_driver.driver_data = dev_get_platdata(&pdev->dev);
+   pd = dev_get_platdata(&pdev->dev);
+   dt_cpufreq_driver.driver_data = pd;
+
+   if (pd)
+   dt_cpufreq_driver.boost_supported = pd->boost_supported;
 
ret = cpufreq_register_driver(&dt_cpufreq_driver);
if (ret)
diff --git a/include/linux/cpufreq-dt.h b/include/linux/cpufreq-dt.h
index 0414009..483ca1b 100644
--- a/include/linux/cpufreq-dt.h
+++ b/include/linux/cpufreq-dt.h
@@ -17,6 +17,7 @@ struct cpufreq_dt_platform_data {
 * clock.
 */
bool independent_clocks;
+   bool boost_supported;
 };
 
 #endif /* __CPUFREQ_DT_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 v2 0/7] cpufreq: use generic cpufreq drivers for Exynos4x12 platform

2015-07-09 Thread Bartlomiej Zolnierkiewicz
Hi,

This patch series removes the use of Exynos4x12 specific support
from cpufreq-exynos driver and enables the use of cpufreq-dt driver
for this platform.

In order to preserve support for Exynos4x12 'boost' mode cpufreq-dt
driver is made aware of cpufreq 'boost' mode infrastructure.  Once
it is done (+ turbo modes handling is fixed, please see below for
details) the driver starts to use turbo mode frequencies (defined
using opp-v2 bindings) as 'boost' mode frequecies.

Patches #1-2 are needed to fix handling of turbo modes in cpufreq
core and without them cpufreq-dt treats turbo modes as normal modes
(IOW they are used by default as normal modes even if they are defined
in DTS file as turbo modes).  Ideally these patches should be added
into "[PATCH 00/10] OPP: Add code to support operating-points-v2
bindings" patch series before patch #10 ("[PATCH 10/10] cpufreq-dt:
Add support for operating-points-v2 bindings").

This patch series has been tested on Exynos4412 based Odroid-U3 and
Trats2 boards.

Depends on:
- next-20150629 branch of linux-next kernel tree
- "[PATCH v3 0/4] cpufreq: use generic cpufreq drivers for Exynos5250
  platform" (http://lkml.org/lkml/2015/7/1/311)
- "PATCH 00/10] OPP: Add code to support operating-points-v2 bindings"
  (http://www.spinics.net/lists/arm-kernel/msg425517.html)

Changes since v1
(http://thread.gmane.org/gmane.linux.kernel.samsung-soc/44361):
- rebased on top of next-20150629 branch of linux-next kernel tree
- rebased on top of Exynos5250 cpufreq-dt support patch series
- fixed if-statement in exynos4_clk_init() (noticed by Tobias Jakobi)
- ported over opp-v2 bindings (requested by Viresh Kumar)

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (7):
  opp: add dev_pm_opp_get_turbo_mode_setting() helper
  cpufreq: opp: fix handling of turbo modes
  cpufreq-dt: add turbo modes support
  clk: samsung: exynos4x12: add cpu clock configuration data and
instantiate cpu clock
  ARM: dts: Exynos4x12: add CPU OPP and regulator supply property
  ARM: Exynos: switch to using generic cpufreq driver for Exynos4x12
  cpufreq: exynos: remove Exynos4x12 specific cpufreq driver support

 arch/arm/boot/dts/exynos4212.dtsi   |  81 
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi |   4 +
 arch/arm/boot/dts/exynos4412-origen.dts |   5 +
 arch/arm/boot/dts/exynos4412-trats2.dts |   5 +
 arch/arm/boot/dts/exynos4412.dtsi   |  83 +
 arch/arm/mach-exynos/exynos.c   |  14 ++
 drivers/base/power/opp.c|  31 
 drivers/clk/samsung/clk-exynos4.c   |  50 +
 drivers/cpufreq/Kconfig.arm |  25 +--
 drivers/cpufreq/Makefile|   2 -
 drivers/cpufreq/cpufreq-dt.c|   7 +-
 drivers/cpufreq/cpufreq_opp.c   |   2 +
 drivers/cpufreq/exynos-cpufreq.c| 234 ---
 drivers/cpufreq/exynos-cpufreq.h|  72 
 drivers/cpufreq/exynos4x12-cpufreq.c| 236 
 include/linux/cpufreq-dt.h  |   1 +
 include/linux/pm_opp.h  |   7 +
 17 files changed, 290 insertions(+), 569 deletions(-)
 delete mode 100644 drivers/cpufreq/exynos-cpufreq.c
 delete mode 100644 drivers/cpufreq/exynos-cpufreq.h
 delete mode 100644 drivers/cpufreq/exynos4x12-cpufreq.c

-- 
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 v2 1/7] opp: add dev_pm_opp_get_turbo_mode_setting() helper

2015-07-09 Thread Bartlomiej Zolnierkiewicz
Add dev_pm_opp_get_turbo_mode_setting() helper for getting turbo
mode setting for a given opp.

Cc: Tomasz Figa 
Cc: Michael Turquette 
Cc: Javier Martinez Canillas 
Cc: Thomas Abraham 
Cc: Viresh Kumar 
Signed-off-by: Bartlomiej Zolnierkiewicz 
---
 drivers/base/power/opp.c | 31 +++
 include/linux/pm_opp.h   |  7 +++
 2 files changed, 38 insertions(+)

diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index e24502a2..6b34b2a 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -287,6 +287,37 @@ unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
 EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq);
 
 /**
+ * dev_pm_opp_get_turbo_mode_setting() - Gets the turbo setting
+ * @opp:   opp for which turbo mode setting has to be returned for
+ *
+ * Return: turbo mode setting corresponding to the opp (true or false)
+ *
+ * Locking: This function must be called under rcu_read_lock(). opp is a rcu
+ * protected pointer. This means that opp which could have been fetched by
+ * opp_find_freq_{exact,ceil,floor} functions is valid as long as we are
+ * under RCU lock. The pointer returned by the opp_find_freq family must be
+ * used in the same section as the usage of this function with the pointer
+ * prior to unlocking with rcu_read_unlock() to maintain the integrity of the
+ * pointer.
+ */
+bool dev_pm_opp_get_turbo_mode_setting(struct dev_pm_opp *opp)
+{
+   struct dev_pm_opp *tmp_opp;
+   bool f = false;
+
+   opp_rcu_lockdep_assert();
+
+   tmp_opp = rcu_dereference(opp);
+   if (unlikely(IS_ERR_OR_NULL(tmp_opp)) || !tmp_opp->available)
+   pr_err("%s: Invalid parameters\n", __func__);
+   else
+   f = tmp_opp->turbo;
+
+   return f;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_get_turbo_mode_setting);
+
+/**
  * dev_pm_opp_get_max_clock_latency() - Get max clock latency in nanoseconds
  * @dev:   device for which we do this operation
  *
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index bb52fae..7856baf 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -30,6 +30,8 @@ unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
 
 unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
 
+bool dev_pm_opp_get_turbo_mode_setting(struct dev_pm_opp *opp);
+
 int dev_pm_opp_get_opp_count(struct device *dev);
 unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
 
@@ -63,6 +65,11 @@ static inline unsigned long dev_pm_opp_get_freq(struct 
dev_pm_opp *opp)
return 0;
 }
 
+static inline bool dev_pm_opp_get_turbo_mode_setting(struct dev_pm_opp *opp)
+{
+   return false;
+}
+
 static inline int dev_pm_opp_get_opp_count(struct device *dev)
 {
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 v2 2/7] cpufreq: opp: fix handling of turbo modes

2015-07-09 Thread Bartlomiej Zolnierkiewicz
Turbo modes should be marked with CPUFREQ_BOOST_FREQ flag in
the frequency table entry.

Cc: Tomasz Figa 
Cc: Michael Turquette 
Cc: Javier Martinez Canillas 
Cc: Thomas Abraham 
Cc: Viresh Kumar 
Signed-off-by: Bartlomiej Zolnierkiewicz 
---
 drivers/cpufreq/cpufreq_opp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c
index 773bcde..f0cf502 100644
--- a/drivers/cpufreq/cpufreq_opp.c
+++ b/drivers/cpufreq/cpufreq_opp.c
@@ -75,6 +75,8 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
}
freq_table[i].driver_data = i;
freq_table[i].frequency = rate / 1000;
+   if (dev_pm_opp_get_turbo_mode_setting(opp) == true)
+   freq_table[i].flags |= CPUFREQ_BOOST_FREQ;
}
 
freq_table[i].driver_data = i;
-- 
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 5/7] drm/exynos/hdmi: remove redundant configuration fields

2015-07-09 Thread Andrzej Hajda
The patch removes redundant fields from hdmi_conf_regs. Their values
can be calculated from current_mode. This patch is the first step to remove
whole hdmi_conf_regs structure.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 68 +---
 1 file changed, 24 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index f9c4de1..a3fe2f0 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -169,14 +169,9 @@ struct hdmi_v14_conf {
struct hdmi_tg_regs tg;
 };
 
-struct hdmi_conf_regs {
-   int pixel_clock;
-   int cea_video_id;
-   enum hdmi_picture_aspect aspect_ratio;
-   union {
-   struct hdmi_v13_conf v13_conf;
-   struct hdmi_v14_conf v14_conf;
-   } conf;
+union hdmi_conf_regs {
+   struct hdmi_v13_conf v13_conf;
+   struct hdmi_v14_conf v14_conf;
 };
 
 struct hdmi_context {
@@ -197,7 +192,8 @@ struct hdmi_context {
 
/* current hdmiphy conf regs */
struct drm_display_mode current_mode;
-   struct hdmi_conf_regs   mode_conf;
+   u8  cea_video_id;
+   union hdmi_conf_regsmode_conf;
 
struct hdmi_resources   res;
const struct hdmi_driver_data   *drv_data;
@@ -951,7 +947,7 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,
u32 hdr_sum;
u8 chksum;
u32 mod;
-   u32 vic;
+   u8 ar;
 
mod = hdmi_reg_read(hdata, HDMI_MODE_SEL);
if (hdata->dvi_mode) {
@@ -982,27 +978,22 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,
 * Set the aspect ratio as per the mode, mentioned in
 * Table 9 AVI InfoFrame Data Byte 2 of CEA-861-D Standard
 */
-   switch (hdata->mode_conf.aspect_ratio) {
+   ar = hdata->current_mode.picture_aspect_ratio;
+   switch (ar) {
case HDMI_PICTURE_ASPECT_4_3:
-   hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2),
-   hdata->mode_conf.aspect_ratio |
-   AVI_4_3_CENTER_RATIO);
+   ar |= AVI_4_3_CENTER_RATIO;
break;
case HDMI_PICTURE_ASPECT_16_9:
-   hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2),
-   hdata->mode_conf.aspect_ratio |
-   AVI_16_9_CENTER_RATIO);
+   ar |= AVI_16_9_CENTER_RATIO;
break;
case HDMI_PICTURE_ASPECT_NONE:
default:
-   hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2),
-   hdata->mode_conf.aspect_ratio |
-   AVI_SAME_AS_PIC_ASPECT_RATIO);
+   ar |= AVI_SAME_AS_PIC_ASPECT_RATIO;
break;
}
+   hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), ar);
 
-   vic = hdata->mode_conf.cea_video_id;
-   hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(4), vic);
+   hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(4), hdata->cea_video_id);
 
chksum = hdmi_chksum(hdata, HDMI_AVI_BYTE(1),
infoframe->any.length, hdr_sum);
@@ -1418,9 +1409,8 @@ static void hdmi_conf_init(struct hdmi_context *hdata)
 
 static void hdmi_v13_mode_apply(struct hdmi_context *hdata)
 {
-   const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v13_conf.tg;
-   const struct hdmi_v13_core_regs *core =
-   &hdata->mode_conf.conf.v13_conf.core;
+   const struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg;
+   const struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core;
int tries;
 
/* setting core registers */
@@ -1502,9 +1492,8 @@ static void hdmi_v13_mode_apply(struct hdmi_context 
*hdata)
 
 static void hdmi_v14_mode_apply(struct hdmi_context *hdata)
 {
-   const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v14_conf.tg;
-   const struct hdmi_v14_core_regs *core =
-   &hdata->mode_conf.conf.v14_conf.core;
+   const struct hdmi_tg_regs *tg = &hdata->mode_conf.v14_conf.tg;
+   const struct hdmi_v14_core_regs *core = &hdata->mode_conf.v14_conf.core;
int tries;
 
/* setting core registers */
@@ -1742,7 +1731,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata)
int i;
 
/* pixel clock */
-   i = hdmi_find_phy_conf(hdata, hdata->mode_conf.pixel_clock);
+   i = hdmi_find_phy_conf(hdata, hdata->current_mode.clock * 1000);
if (i < 0) {
DRM_ERROR("failed to find hdmiphy conf\n");
return;
@@ -1794,15 +1783,10 @@ static void hdmi_set_reg(u8 *reg_pair,

[PATCH 1/7] drm/exynos/hdmi: remove old platform data code

2015-07-09 Thread Andrzej Hajda
s5p_hdmi_platform_data were used before device tree introduction.
As HDMI driver is DT only we can drop this struct completely.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 36 +---
 1 file changed, 5 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 4a00990..3cf09bb 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -48,7 +48,6 @@
 #include "exynos_mixer.h"
 
 #include 
-#include 
 
 #define ctx_from_connector(c)  container_of(c, struct hdmi_context, connector)
 
@@ -2259,30 +2258,6 @@ fail:
return ret;
 }
 
-static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
-   (struct device *dev)
-{
-   struct device_node *np = dev->of_node;
-   struct s5p_hdmi_platform_data *pd;
-   u32 value;
-
-   pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
-   if (!pd)
-   goto err_data;
-
-   if (!of_find_property(np, "hpd-gpio", &value)) {
-   DRM_ERROR("no hpd gpio property found\n");
-   goto err_data;
-   }
-
-   pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
-
-   return pd;
-
-err_data:
-   return NULL;
-}
-
 static struct of_device_id hdmi_match_types[] = {
{
.compatible = "samsung,exynos5-hdmi",
@@ -2343,7 +2318,6 @@ static struct device_node 
*hdmi_legacy_phy_dt_binding(struct device *dev)
 static int hdmi_probe(struct platform_device *pdev)
 {
struct device_node *ddc_node, *phy_node;
-   struct s5p_hdmi_platform_data *pdata;
struct hdmi_driver_data *drv_data;
const struct of_device_id *match;
struct device *dev = &pdev->dev;
@@ -2354,10 +2328,6 @@ static int hdmi_probe(struct platform_device *pdev)
if (!dev->of_node)
return -ENODEV;
 
-   pdata = drm_hdmi_dt_parse_pdata(dev);
-   if (!pdata)
-   return -EINVAL;
-
hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
if (!hdata)
return -ENOMEM;
@@ -2378,8 +2348,12 @@ static int hdmi_probe(struct platform_device *pdev)
hdata->phy_confs = drv_data->phy_confs;
hdata->phy_conf_count = drv_data->phy_conf_count;
 
-   hdata->hpd_gpio = pdata->hpd_gpio;
hdata->dev = dev;
+   hdata->hpd_gpio = of_get_named_gpio(dev->of_node, "hpd-gpio", 0);
+   if (hdata->hpd_gpio < 0) {
+   DRM_ERROR("cannot get hpd gpio property\n");
+   return hdata->hpd_gpio;
+   }
 
ret = hdmi_resources_init(hdata);
if (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 6/7] drm/exynos/hdmi: remove hdmi_v13_conf struct

2015-07-09 Thread Andrzej Hajda
The patch removes intermediate struct for HDMIv13 register configuration,
instead registry values are calculated on the fly.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 280 +--
 1 file changed, 101 insertions(+), 179 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index a3fe2f0..60663ad 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -107,19 +107,6 @@ struct hdmi_tg_regs {
u8 tg_3d[1];
 };
 
-struct hdmi_v13_core_regs {
-   u8 h_blank[2];
-   u8 v_blank[3];
-   u8 h_v_line[3];
-   u8 vsync_pol[1];
-   u8 int_pro_mode[1];
-   u8 v_blank_f[3];
-   u8 h_sync_gen[3];
-   u8 v_sync_gen1[3];
-   u8 v_sync_gen2[3];
-   u8 v_sync_gen3[3];
-};
-
 struct hdmi_v14_core_regs {
u8 h_blank[2];
u8 v2_blank[2];
@@ -159,21 +146,11 @@ struct hdmi_v14_core_regs {
u8 vact_space_6[2];
 };
 
-struct hdmi_v13_conf {
-   struct hdmi_v13_core_regs core;
-   struct hdmi_tg_regs tg;
-};
-
 struct hdmi_v14_conf {
struct hdmi_v14_core_regs core;
struct hdmi_tg_regs tg;
 };
 
-union hdmi_conf_regs {
-   struct hdmi_v13_conf v13_conf;
-   struct hdmi_v14_conf v14_conf;
-};
-
 struct hdmi_context {
struct exynos_drm_display   display;
struct device   *dev;
@@ -193,7 +170,7 @@ struct hdmi_context {
/* current hdmiphy conf regs */
struct drm_display_mode current_mode;
u8  cea_video_id;
-   union hdmi_conf_regsmode_conf;
+   struct hdmi_v14_confmode_conf;
 
struct hdmi_resources   res;
const struct hdmi_driver_data   *drv_data;
@@ -614,6 +591,16 @@ static inline void hdmi_reg_writeb(struct hdmi_context 
*hdata,
writeb(value, hdata->regs + reg_id);
 }
 
+static inline void hdmi_reg_writev(struct hdmi_context *hdata, u32 reg_id,
+  int bytes, u32 val)
+{
+   while (--bytes >= 0) {
+   writeb(val & 0xff, hdata->regs + reg_id);
+   val >>= 8;
+   reg_id += 4;
+   }
+}
+
 static inline void hdmi_reg_writemask(struct hdmi_context *hdata,
 u32 reg_id, u32 value, u32 mask)
 {
@@ -1409,65 +1396,94 @@ static void hdmi_conf_init(struct hdmi_context *hdata)
 
 static void hdmi_v13_mode_apply(struct hdmi_context *hdata)
 {
-   const struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg;
-   const struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core;
+   struct drm_display_mode *m = &hdata->current_mode;
+   unsigned int val;
int tries;
 
-   /* setting core registers */
-   hdmi_reg_writeb(hdata, HDMI_H_BLANK_0, core->h_blank[0]);
-   hdmi_reg_writeb(hdata, HDMI_H_BLANK_1, core->h_blank[1]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_0, core->v_blank[0]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_1, core->v_blank[1]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_2, core->v_blank[2]);
-   hdmi_reg_writeb(hdata, HDMI_V13_H_V_LINE_0, core->h_v_line[0]);
-   hdmi_reg_writeb(hdata, HDMI_V13_H_V_LINE_1, core->h_v_line[1]);
-   hdmi_reg_writeb(hdata, HDMI_V13_H_V_LINE_2, core->h_v_line[2]);
-   hdmi_reg_writeb(hdata, HDMI_VSYNC_POL, core->vsync_pol[0]);
-   hdmi_reg_writeb(hdata, HDMI_INT_PRO_MODE, core->int_pro_mode[0]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_F_0, core->v_blank_f[0]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_F_1, core->v_blank_f[1]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_F_2, core->v_blank_f[2]);
-   hdmi_reg_writeb(hdata, HDMI_V13_H_SYNC_GEN_0, core->h_sync_gen[0]);
-   hdmi_reg_writeb(hdata, HDMI_V13_H_SYNC_GEN_1, core->h_sync_gen[1]);
-   hdmi_reg_writeb(hdata, HDMI_V13_H_SYNC_GEN_2, core->h_sync_gen[2]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_1_0, core->v_sync_gen1[0]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_1_1, core->v_sync_gen1[1]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_1_2, core->v_sync_gen1[2]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_2_0, core->v_sync_gen2[0]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_2_1, core->v_sync_gen2[1]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_2_2, core->v_sync_gen2[2]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_3_0, core->v_sync_gen3[0]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_3_1, core->v_sync_gen3[1]);
-   hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_3_2, core->v_sync_gen3[2]);
+   hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay);
+   hdmi_reg_writev(hdata, HDMI_V13_H_V_LINE_0, 3,
+   (m->htotal << 12) | m->vtotal);
+
+   val = (m->flags & DRM_MODE_FLAG_NVSYNC) ? 1 : 0;
+   hdmi_reg_writev(hdata, HDMI_VSYNC_POL, 

[PATCH 7/7] drm/exynos/hdmi: remove hdmi_v14_conf struct

2015-07-09 Thread Andrzej Hajda
The patch removes intermediate struct for HDMIv14 register configuration,
instead registry values are calculated on the fly.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 427 +--
 1 file changed, 109 insertions(+), 318 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 60663ad..448f534 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -86,71 +86,6 @@ struct hdmi_resources {
int regul_count;
 };
 
-struct hdmi_tg_regs {
-   u8 cmd[1];
-   u8 h_fsz[2];
-   u8 hact_st[2];
-   u8 hact_sz[2];
-   u8 v_fsz[2];
-   u8 vsync[2];
-   u8 vsync2[2];
-   u8 vact_st[2];
-   u8 vact_sz[2];
-   u8 field_chg[2];
-   u8 vact_st2[2];
-   u8 vact_st3[2];
-   u8 vact_st4[2];
-   u8 vsync_top_hdmi[2];
-   u8 vsync_bot_hdmi[2];
-   u8 field_top_hdmi[2];
-   u8 field_bot_hdmi[2];
-   u8 tg_3d[1];
-};
-
-struct hdmi_v14_core_regs {
-   u8 h_blank[2];
-   u8 v2_blank[2];
-   u8 v1_blank[2];
-   u8 v_line[2];
-   u8 h_line[2];
-   u8 hsync_pol[1];
-   u8 vsync_pol[1];
-   u8 int_pro_mode[1];
-   u8 v_blank_f0[2];
-   u8 v_blank_f1[2];
-   u8 h_sync_start[2];
-   u8 h_sync_end[2];
-   u8 v_sync_line_bef_2[2];
-   u8 v_sync_line_bef_1[2];
-   u8 v_sync_line_aft_2[2];
-   u8 v_sync_line_aft_1[2];
-   u8 v_sync_line_aft_pxl_2[2];
-   u8 v_sync_line_aft_pxl_1[2];
-   u8 v_blank_f2[2]; /* for 3D mode */
-   u8 v_blank_f3[2]; /* for 3D mode */
-   u8 v_blank_f4[2]; /* for 3D mode */
-   u8 v_blank_f5[2]; /* for 3D mode */
-   u8 v_sync_line_aft_3[2];
-   u8 v_sync_line_aft_4[2];
-   u8 v_sync_line_aft_5[2];
-   u8 v_sync_line_aft_6[2];
-   u8 v_sync_line_aft_pxl_3[2];
-   u8 v_sync_line_aft_pxl_4[2];
-   u8 v_sync_line_aft_pxl_5[2];
-   u8 v_sync_line_aft_pxl_6[2];
-   u8 vact_space_1[2];
-   u8 vact_space_2[2];
-   u8 vact_space_3[2];
-   u8 vact_space_4[2];
-   u8 vact_space_5[2];
-   u8 vact_space_6[2];
-};
-
-struct hdmi_v14_conf {
-   struct hdmi_v14_core_regs core;
-   struct hdmi_tg_regs tg;
-};
-
 struct hdmi_context {
struct exynos_drm_display   display;
struct device   *dev;
@@ -170,7 +105,6 @@ struct hdmi_context {
/* current hdmiphy conf regs */
struct drm_display_mode current_mode;
u8  cea_video_id;
-   struct hdmi_v14_confmode_conf;
 
struct hdmi_resources   res;
const struct hdmi_driver_data   *drv_data;
@@ -1508,143 +1442,119 @@ static void hdmi_v13_mode_apply(struct hdmi_context 
*hdata)
 
 static void hdmi_v14_mode_apply(struct hdmi_context *hdata)
 {
-   const struct hdmi_tg_regs *tg = &hdata->mode_conf.tg;
-   const struct hdmi_v14_core_regs *core = &hdata->mode_conf.core;
+   struct drm_display_mode *m = &hdata->current_mode;
int tries;
 
-   /* setting core registers */
-   hdmi_reg_writeb(hdata, HDMI_H_BLANK_0, core->h_blank[0]);
-   hdmi_reg_writeb(hdata, HDMI_H_BLANK_1, core->h_blank[1]);
-   hdmi_reg_writeb(hdata, HDMI_V2_BLANK_0, core->v2_blank[0]);
-   hdmi_reg_writeb(hdata, HDMI_V2_BLANK_1, core->v2_blank[1]);
-   hdmi_reg_writeb(hdata, HDMI_V1_BLANK_0, core->v1_blank[0]);
-   hdmi_reg_writeb(hdata, HDMI_V1_BLANK_1, core->v1_blank[1]);
-   hdmi_reg_writeb(hdata, HDMI_V_LINE_0, core->v_line[0]);
-   hdmi_reg_writeb(hdata, HDMI_V_LINE_1, core->v_line[1]);
-   hdmi_reg_writeb(hdata, HDMI_H_LINE_0, core->h_line[0]);
-   hdmi_reg_writeb(hdata, HDMI_H_LINE_1, core->h_line[1]);
-   hdmi_reg_writeb(hdata, HDMI_HSYNC_POL, core->hsync_pol[0]);
-   hdmi_reg_writeb(hdata, HDMI_VSYNC_POL, core->vsync_pol[0]);
-   hdmi_reg_writeb(hdata, HDMI_INT_PRO_MODE, core->int_pro_mode[0]);
-   hdmi_reg_writeb(hdata, HDMI_V_BLANK_F0_0, core->v_blank_f0[0]);
-   hdmi_reg_writeb(hdata, HDMI_V_BLANK_F0_1, core->v_blank_f0[1]);
-   hdmi_reg_writeb(hdata, HDMI_V_BLANK_F1_0, core->v_blank_f1[0]);
-   hdmi_reg_writeb(hdata, HDMI_V_BLANK_F1_1, core->v_blank_f1[1]);
-   hdmi_reg_writeb(hdata, HDMI_H_SYNC_START_0, core->h_sync_start[0]);
-   hdmi_reg_writeb(hdata, HDMI_H_SYNC_START_1, core->h_sync_start[1]);
-   hdmi_reg_writeb(hdata, HDMI_H_SYNC_END_0, core->h_sync_end[0]);
-   hdmi_reg_writeb(hdata, HDMI_H_SYNC_END_1, core->h_sync_end[1]);
-   hdmi_reg_writeb(hdata, HDMI_V_SYNC_LINE_BEF_2_0,
-   core->v_sync_line_bef_2[0]);
-   hdmi_reg_writeb(hdata, HDMI_V_SYNC_LINE_BEF_2_1,
-   core->v_sync_line_bef_2[1]);
-   hdmi_reg_writeb(hdata, HDMI_V_SYNC_LINE_BEF_1_0,
-   core->v_sync_line_bef_1[0]);
-   hdmi_reg_writeb

[PATCH 4/7] drm/exynos/hdmi: add driver data pointer to private context

2015-07-09 Thread Andrzej Hajda
The patch replaces duplicated driver data fields in private context with
pointer to driver data. It also simplifies driver data lookup code.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 49 +++-
 1 file changed, 20 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index f2e909d..f9c4de1 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -32,8 +32,8 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -200,14 +200,12 @@ struct hdmi_context {
struct hdmi_conf_regs   mode_conf;
 
struct hdmi_resources   res;
+   const struct hdmi_driver_data   *drv_data;
 
int hpd_gpio;
void __iomem*regs_hdmiphy;
-   const struct hdmiphy_config *phy_confs;
-   unsigned intphy_conf_count;
 
struct regmap   *pmureg;
-   enum hdmi_type  type;
 };
 
 static inline struct hdmi_context *display_to_hdmi(struct exynos_drm_display 
*d)
@@ -926,7 +924,7 @@ static void hdmi_v14_regs_dump(struct hdmi_context *hdata, 
char *prefix)
 
 static void hdmi_regs_dump(struct hdmi_context *hdata, char *prefix)
 {
-   if (hdata->type == HDMI_TYPE13)
+   if (hdata->drv_data->type == HDMI_TYPE13)
hdmi_v13_regs_dump(hdata, prefix);
else
hdmi_v14_regs_dump(hdata, prefix);
@@ -1087,8 +1085,8 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, 
u32 pixel_clock)
 {
int i;
 
-   for (i = 0; i < hdata->phy_conf_count; i++)
-   if (hdata->phy_confs[i].pixel_clock == pixel_clock)
+   for (i = 0; i < hdata->drv_data->phy_conf_count; i++)
+   if (hdata->drv_data->phy_confs[i].pixel_clock == pixel_clock)
return i;
 
DRM_DEBUG_KMS("Could not find phy config for %d\n", pixel_clock);
@@ -1253,7 +1251,7 @@ static void hdmi_reg_acr(struct hdmi_context *hdata, u8 
*acr)
hdmi_reg_writeb(hdata, HDMI_ACR_CTS1, acr[2]);
hdmi_reg_writeb(hdata, HDMI_ACR_CTS2, acr[1]);
 
-   if (hdata->type == HDMI_TYPE13)
+   if (hdata->drv_data->type == HDMI_TYPE13)
hdmi_reg_writeb(hdata, HDMI_V13_ACR_CON, 4);
else
hdmi_reg_writeb(hdata, HDMI_ACR_CON, 4);
@@ -1387,7 +1385,7 @@ static void hdmi_conf_init(struct hdmi_context *hdata)
HDMI_VID_PREAMBLE_DIS | HDMI_GUARD_BAND_DIS);
}
 
-   if (hdata->type == HDMI_TYPE13) {
+   if (hdata->drv_data->type == HDMI_TYPE13) {
/* choose bluescreen (fecal) color */
hdmi_reg_writeb(hdata, HDMI_V13_BLUE_SCREEN_0, 0x12);
hdmi_reg_writeb(hdata, HDMI_V13_BLUE_SCREEN_1, 0x34);
@@ -1666,7 +1664,7 @@ static void hdmi_v14_mode_apply(struct hdmi_context 
*hdata)
 
 static void hdmi_mode_apply(struct hdmi_context *hdata)
 {
-   if (hdata->type == HDMI_TYPE13)
+   if (hdata->drv_data->type == HDMI_TYPE13)
hdmi_v13_mode_apply(hdata);
else
hdmi_v14_mode_apply(hdata);
@@ -1684,7 +1682,7 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata)
hdmiphy_reg_writeb(hdata, HDMIPHY_MODE_SET_DONE,
HDMI_PHY_ENABLE_MODE_SET);
 
-   if (hdata->type == HDMI_TYPE13)
+   if (hdata->drv_data->type == HDMI_TYPE13)
reg = HDMI_V13_PHY_RSTOUT;
else
reg = HDMI_PHY_RSTOUT;
@@ -1698,7 +1696,7 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata)
 
 static void hdmiphy_poweron(struct hdmi_context *hdata)
 {
-   if (hdata->type != HDMI_TYPE14)
+   if (hdata->drv_data->type != HDMI_TYPE14)
return;
 
DRM_DEBUG_KMS("\n");
@@ -1718,7 +1716,7 @@ static void hdmiphy_poweron(struct hdmi_context *hdata)
 
 static void hdmiphy_poweroff(struct hdmi_context *hdata)
 {
-   if (hdata->type != HDMI_TYPE14)
+   if (hdata->drv_data->type != HDMI_TYPE14)
return;
 
DRM_DEBUG_KMS("\n");
@@ -1750,7 +1748,8 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata)
return;
}
 
-   ret = hdmiphy_reg_write_buf(hdata, 0, hdata->phy_confs[i].conf, 32);
+   ret = hdmiphy_reg_write_buf(hdata, 0,
+   hdata->drv_data->phy_confs[i].conf, 32);
if (ret) {
DRM_ERROR("failed to configure hdmiphy\n");
return;
@@ -2015,7 +2014,7 @@ static void hdmi_mode_set(struct exynos_drm_display 
*display,
/* preserve mode information for later use. */
drm_mode_copy(&hdata->current_mode, mode);
 
-   if (hdata->type == HDMI_TYPE13)
+   if (hdata->drv_data->type == HDMI_TYPE13)
hdmi_v13_mode_set(hdata, mode)

[PATCH 3/7] drm/exynos/hdmi: remove private lock code

2015-07-09 Thread Andrzej Hajda
Most of the code is called by drm core framework, so it is already synchronized.
The only async function is irq routine which only calls drm framework so it
does not need to be synchronized.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 27 +++
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 1d07bdf..f2e909d 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -22,7 +22,6 @@
 #include "regs-hdmi.h"
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -188,7 +187,6 @@ struct hdmi_context {
struct drm_encoder  *encoder;
boolpowered;
booldvi_mode;
-   struct mutexhdmi_mutex;
 
void __iomem*regs;
int irq;
@@ -1774,10 +1772,8 @@ static void hdmi_conf_apply(struct hdmi_context *hdata)
hdmiphy_conf_reset(hdata);
hdmiphy_conf_apply(hdata);
 
-   mutex_lock(&hdata->hdmi_mutex);
hdmi_start(hdata, false);
hdmi_conf_init(hdata);
-   mutex_unlock(&hdata->hdmi_mutex);
 
hdmi_audio_init(hdata);
 
@@ -2029,12 +2025,8 @@ static void hdmi_commit(struct exynos_drm_display 
*display)
 {
struct hdmi_context *hdata = display_to_hdmi(display);
 
-   mutex_lock(&hdata->hdmi_mutex);
-   if (!hdata->powered) {
-   mutex_unlock(&hdata->hdmi_mutex);
+   if (!hdata->powered)
return;
-   }
-   mutex_unlock(&hdata->hdmi_mutex);
 
hdmi_conf_apply(hdata);
 }
@@ -2043,16 +2035,11 @@ static void hdmi_poweron(struct hdmi_context *hdata)
 {
struct hdmi_resources *res = &hdata->res;
 
-   mutex_lock(&hdata->hdmi_mutex);
-   if (hdata->powered) {
-   mutex_unlock(&hdata->hdmi_mutex);
+   if (hdata->powered)
return;
-   }
 
hdata->powered = true;
 
-   mutex_unlock(&hdata->hdmi_mutex);
-
pm_runtime_get_sync(hdata->dev);
 
if (regulator_bulk_enable(res->regul_count, res->regul_bulk))
@@ -2073,10 +2060,8 @@ static void hdmi_poweroff(struct hdmi_context *hdata)
 {
struct hdmi_resources *res = &hdata->res;
 
-   mutex_lock(&hdata->hdmi_mutex);
if (!hdata->powered)
-   goto out;
-   mutex_unlock(&hdata->hdmi_mutex);
+   return;
 
/* HDMI System Disable */
hdmi_reg_writemask(hdata, HDMI_CON_0, 0, HDMI_EN);
@@ -2096,11 +2081,7 @@ static void hdmi_poweroff(struct hdmi_context *hdata)
 
pm_runtime_put_sync(hdata->dev);
 
-   mutex_lock(&hdata->hdmi_mutex);
hdata->powered = false;
-
-out:
-   mutex_unlock(&hdata->hdmi_mutex);
 }
 
 static void hdmi_dpms(struct exynos_drm_display *display, int mode)
@@ -2330,8 +2311,6 @@ static int hdmi_probe(struct platform_device *pdev)
hdata->display.type = EXYNOS_DISPLAY_TYPE_HDMI;
hdata->display.ops = &hdmi_display_ops;
 
-   mutex_init(&hdata->hdmi_mutex);
-
platform_set_drvdata(pdev, hdata);
 
match = of_match_node(hdmi_match_types, dev->of_node);
-- 
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 0/7] drm/exynos/hdmi: refactoring/cleanup patches

2015-07-09 Thread Andrzej Hajda
Hi Inki, Joonyoung,

These patches removes obsolete and old structures, to simplify further
development. They should not change behavior of the driver.

The patchset is based on exynos-drm-next plus my HDMI related fixes [1].

The patchset was tested on Universal and Odroid U3.

[1]: http://permalink.gmane.org/gmane.comp.video.dri.devel/132348

Regards
Andrzej


Andrzej Hajda (7):
  drm/exynos/hdmi: remove old platform data code
  drm/exynos/hdmi: Simplify HPD gpio handling
  drm/exynos/hdmi: remove private lock code
  drm/exynos/hdmi: add driver data pointer to private context
  drm/exynos/hdmi: remove redundant configuration fields
  drm/exynos/hdmi: remove hdmi_v13_conf struct
  drm/exynos/hdmi: remove hdmi_v14_conf struct

 drivers/gpu/drm/exynos/exynos_hdmi.c | 860 ++-
 1 file changed, 245 insertions(+), 615 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


[PATCH 2/7] drm/exynos/hdmi: Simplify HPD gpio handling

2015-07-09 Thread Andrzej Hajda
GPIO is tested only in hdmi_detect, so there is no reason to set it in
other places and to preserve its value in context.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 3cf09bb..1d07bdf 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -186,7 +186,6 @@ struct hdmi_context {
struct drm_device   *drm_dev;
struct drm_connectorconnector;
struct drm_encoder  *encoder;
-   boolhpd;
boolpowered;
booldvi_mode;
struct mutexhdmi_mutex;
@@ -1037,10 +1036,10 @@ static enum drm_connector_status hdmi_detect(struct 
drm_connector *connector,
 {
struct hdmi_context *hdata = ctx_from_connector(connector);
 
-   hdata->hpd = gpio_get_value(hdata->hpd_gpio);
+   if (gpio_get_value(hdata->hpd_gpio))
+   return connector_status_connected;
 
-   return hdata->hpd ? connector_status_connected :
-   connector_status_disconnected;
+   return connector_status_disconnected;
 }
 
 static void hdmi_connector_destroy(struct drm_connector *connector)
@@ -2156,10 +2155,6 @@ static void hdmi_hotplug_work_func(struct work_struct 
*work)
 
hdata = container_of(work, struct hdmi_context, hotplug_work.work);
 
-   mutex_lock(&hdata->hdmi_mutex);
-   hdata->hpd = gpio_get_value(hdata->hpd_gpio);
-   mutex_unlock(&hdata->hdmi_mutex);
-
if (hdata->drm_dev)
drm_helper_hpd_irq_event(hdata->drm_dev);
 }
@@ -2428,8 +2423,6 @@ out_get_phy_port:
goto err_hdmiphy;
}
 
-   hdata->hpd = gpio_get_value(hdata->hpd_gpio);
-
INIT_DELAYED_WORK(&hdata->hotplug_work, hdmi_hotplug_work_func);
 
ret = devm_request_threaded_irq(dev, hdata->irq, NULL,
-- 
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 0/10 v6] Helper to abstract vma handling in media layer

2015-07-09 Thread Hans Verkuil
On 07/09/2015 01:48 PM, Jan Kara wrote:
>   Hello,
> 
>   Hans, did you have a chance to look at these patches? I have tested them
> with the vivid driver but it would be good if you could run them through
> your standard testing procedure as well. Andrew has updated the patches in
> his tree but some ack from you would be welcome...

I've planned a 'patch day' for Monday. So hopefully you'll see a pull request
by then.

Regards,

Hans

> 
>   Honza
> On Thu 18-06-15 16:08:30, Jan Kara wrote:
>>   Hello,
>>
>> I'm sending the sixth version of my patch series to abstract vma handling 
>> from
>> the various media drivers. Since the previous version I have added a patch to
>> move mm helpers into a separate file and behind a config option. I also
>> changed patch pushing mmap_sem down in videobuf2 core to avoid lockdep 
>> warning
>> and NULL dereference Hans found in his testing. I've also included small
>> fixups Andrew was carrying.
>>
>> After this patch set drivers have to know much less details about vmas, their
>> types, and locking. Also quite some code is removed from them. As a bonus
>> drivers get automatically VM_FAULT_RETRY handling. The primary motivation for
>> this series is to remove knowledge about mmap_sem locking from as many 
>> places a
>> possible so that we can change it with reasonable effort.
>>
>> The core of the series is the new helper get_vaddr_frames() which is given a
>> virtual address and it fills in PFNs / struct page pointers (depending on VMA
>> type) into the provided array. If PFNs correspond to normal pages it also 
>> grabs
>> references to these pages. The difference from get_user_pages() is that this
>> function can also deal with pfnmap, and io mappings which is what the media
>> drivers need.
>>
>> I have tested the patches with vivid driver so at least vb2 code got some
>> exposure. Conversion of other drivers was just compile-tested (for x86 so 
>> e.g.
>> exynos driver which is only for Samsung platform is completely untested).
>>
>> Andrew, can you please update the patches in mm three? Thanks!
>>
>>  Honza
>>
>> Changes since v5:
>> * Moved mm helper into a separate file and behind a config option
>> * Changed the first patch pushing mmap_sem down in videobuf2 core to avoid
>>   possible deadlock
>>
>> Changes since v4:
>> * Minor cleanups and fixes pointed out by Mel and Vlasta
>> * Added Acked-by tags
>>
>> Changes since v3:
>> * Added include  into mm/gup.c as it's needed for some archs
>> * Fixed error path for exynos driver
>>
>> Changes since v2:
>> * Renamed functions and structures as Mel suggested
>> * Other minor changes suggested by Mel
>> * Rebased on top of 4.1-rc2
>> * Changed functions to get pointer to array of pages / pfns to perform
>>   conversion if necessary. This fixes possible issue in the omap I may have
>>   introduced in v2 and generally makes the API less errorprone.

--
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 0/10 v6] Helper to abstract vma handling in media layer

2015-07-09 Thread Jan Kara
  Hello,

  Hans, did you have a chance to look at these patches? I have tested them
with the vivid driver but it would be good if you could run them through
your standard testing procedure as well. Andrew has updated the patches in
his tree but some ack from you would be welcome...

Honza
On Thu 18-06-15 16:08:30, Jan Kara wrote:
>   Hello,
> 
> I'm sending the sixth version of my patch series to abstract vma handling from
> the various media drivers. Since the previous version I have added a patch to
> move mm helpers into a separate file and behind a config option. I also
> changed patch pushing mmap_sem down in videobuf2 core to avoid lockdep warning
> and NULL dereference Hans found in his testing. I've also included small
> fixups Andrew was carrying.
> 
> After this patch set drivers have to know much less details about vmas, their
> types, and locking. Also quite some code is removed from them. As a bonus
> drivers get automatically VM_FAULT_RETRY handling. The primary motivation for
> this series is to remove knowledge about mmap_sem locking from as many places 
> a
> possible so that we can change it with reasonable effort.
> 
> The core of the series is the new helper get_vaddr_frames() which is given a
> virtual address and it fills in PFNs / struct page pointers (depending on VMA
> type) into the provided array. If PFNs correspond to normal pages it also 
> grabs
> references to these pages. The difference from get_user_pages() is that this
> function can also deal with pfnmap, and io mappings which is what the media
> drivers need.
> 
> I have tested the patches with vivid driver so at least vb2 code got some
> exposure. Conversion of other drivers was just compile-tested (for x86 so e.g.
> exynos driver which is only for Samsung platform is completely untested).
> 
> Andrew, can you please update the patches in mm three? Thanks!
> 
>   Honza
> 
> Changes since v5:
> * Moved mm helper into a separate file and behind a config option
> * Changed the first patch pushing mmap_sem down in videobuf2 core to avoid
>   possible deadlock
> 
> Changes since v4:
> * Minor cleanups and fixes pointed out by Mel and Vlasta
> * Added Acked-by tags
> 
> Changes since v3:
> * Added include  into mm/gup.c as it's needed for some archs
> * Fixed error path for exynos driver
> 
> Changes since v2:
> * Renamed functions and structures as Mel suggested
> * Other minor changes suggested by Mel
> * Rebased on top of 4.1-rc2
> * Changed functions to get pointer to array of pages / pfns to perform
>   conversion if necessary. This fixes possible issue in the omap I may have
>   introduced in v2 and generally makes the API less errorprone.
-- 
Jan Kara 
SUSE Labs, CR
--
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 v3 0/4] cpufreq: use generic cpufreq drivers for Exynos5250 platform

2015-07-09 Thread Viresh Kumar
On 01-07-15, 15:10, Bartlomiej Zolnierkiewicz wrote:
> This patch series removes the use of Exynos5250 specific support
> from cpufreq-exynos driver and enables the use of cpufreq-dt driver
> for this platform.
> 
> This patch series has been tested on Exynos5250 based Arndale board.
> 
> Changes since v1 (http://lkml.org/lkml/2015/4/13/611):
> - rebased on top of next-20150629 branch of linux-next kernel tree
> - dropped dependency on "[PATCH 0/6] cpufreq: use generic cpufreq
>   drivers for Exynos4x12 platform" patch series as it needs more
>   work (Viresh has requested porting of cpufreq-dt's boost mode
>   support over opp-v2 patches)
> 
> Changes since v2 (http://lkml.org/lkml/2015/6/29/361):
> - put the new cpu nodes in alphabetical order
> - updated Javier's and Mike's e-mail adresses
> - removed Cc: tag with stale Sachin's e-mail adress
> - added Reviewed-by: tag from Krzysztof to patches #3 and #4

Acked-by: Viresh Kumar 

-- 
viresh
--
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 12/23] drm/exynos: don't track enabled state at exynos_crtc

2015-07-09 Thread Joonyoung Shim
+Cc Andrzej,

On 07/07/2015 02:41 AM, Daniel Vetter wrote:
> On Mon, Jul 06, 2015 at 11:20:13AM -0300, Gustavo Padovan wrote:
>> From: Gustavo Padovan 
>>
>> struct drm_crtc already stores the enabled state of the crtc
>> thus we don't need to replicate enabled in exynos_drm_crtc.
>>

I think exynos_crtc->enabled can replace flags for power state of each
hw driver(e.g. "powered" of mixer driver, "suspended" of fimd driver).
Further, we can add other flag bit for instead of using special flag
in hw driver like vsync state("int_en" of mixer driver, "irq_flags" of
fimd driver.)

>> Signed-off-by: Gustavo Padovan 
> 
> Note that exynos_crtc->enabled doesn't match drm_crtc->enabled perfectly
> since the exynos one reflect hw state (including dpms). You want to look
> at crtc->state->active instead on functions enabling stuff, and
> old_crtc_state->active on functions disabling stuff (we don't wire that
> through everywhere yet).
> -Daniel
> 
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_crtc.c | 16 
>>  drivers/gpu/drm/exynos/exynos_drm_drv.h  |  1 -
>>  2 files changed, 17 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
>> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
>> index 9bc2353..5ab8972 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
>> @@ -26,14 +26,9 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
>>  {
>>  struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
>>  
>> -if (exynos_crtc->enabled)
>> -return;
>> -
>>  if (exynos_crtc->ops->enable)
>>  exynos_crtc->ops->enable(exynos_crtc);
>>  
>> -exynos_crtc->enabled = true;
>> -
>>  drm_crtc_vblank_on(crtc);
>>  }
>>  
>> @@ -41,9 +36,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
>>  {
>>  struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
>>  
>> -if (!exynos_crtc->enabled)
>> -return;
>> -
>>  /* wait for the completion of page flip. */
>>  if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
>>  (exynos_crtc->event == NULL), HZ/20))
>> @@ -53,8 +45,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
>>  
>>  if (exynos_crtc->ops->disable)
>>  exynos_crtc->ops->disable(exynos_crtc);
>> -
>> -exynos_crtc->enabled = false;
>>  }
>>  
>>  static bool
>> @@ -171,9 +161,6 @@ int exynos_drm_crtc_enable_vblank(struct drm_device 
>> *dev, int pipe)
>>  struct exynos_drm_crtc *exynos_crtc =
>>  to_exynos_crtc(private->crtc[pipe]);
>>  
>> -if (!exynos_crtc->enabled)
>> -return -EPERM;
>> -
>>  if (exynos_crtc->ops->enable_vblank)
>>  return exynos_crtc->ops->enable_vblank(exynos_crtc);
>>  
>> @@ -186,9 +173,6 @@ void exynos_drm_crtc_disable_vblank(struct drm_device 
>> *dev, int pipe)
>>  struct exynos_drm_crtc *exynos_crtc =
>>  to_exynos_crtc(private->crtc[pipe]);
>>  
>> -if (!exynos_crtc->enabled)
>> -return;
>> -
>>  if (exynos_crtc->ops->disable_vblank)
>>  exynos_crtc->ops->disable_vblank(exynos_crtc);
>>  }
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
>> b/drivers/gpu/drm/exynos/exynos_drm_drv.h
>> index 5bd1d3c..d3a8f0a 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
>> @@ -185,7 +185,6 @@ struct exynos_drm_crtc {
>>  struct drm_crtc base;
>>  enum exynos_drm_output_type type;
>>  unsigned intpipe;
>> -boolenabled;
>>  wait_queue_head_t   pending_flip_queue;
>>  struct drm_pending_vblank_event *event;
>>  const struct exynos_drm_crtc_ops*ops;
>> -- 
>> 2.1.0
>>
>> ___
>> dri-devel mailing list
>> dri-de...@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

--
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