Re: [PATCHv5] ARM: dts: add exynos5422-cpus.dtsi to correct cpu order

2015-07-06 Thread Krzysztof Kozlowski
On 07.07.2015 10:44, Krzysztof Kozlowski wrote:
> On 06.07.2015 23:12, Chanho Park wrote:
>> The odroid-xu3 board which is based on exynos5422 not exynos5800 is
>> booted from cortex-a7 core unlike exynos5800. The odroid-xu3's cpu order
>> is quite strange. cpu0 and cpu5-7 are cortex-a7 cores and cpu1-4 are
>> cortex-a15 cores. To correct this mis-odering, I added exynos5422.dtsi
>> and reversing cpu orders from exynos5420. Now, cpu0-3 are cortex-a7 and
>> cpu4-7 are cortex-a15.
>>
>> Reviewed-by: Krzysztof Kozlowski 
>> Signed-off-by: Chanho Park 
>> ---
>> Changes from v4:
>>  - Remove temporal patch in e-mail body
>>
>> Changes from v3:
>>  - include this exynos5422-cpus.dtsi in the exynos5422-odroidxu3-common.dtsi
>>
>> Changes from v2:
>>  - drop inclusion of exynos5420.dtsi from exynos5422-cpus.dtsi
>>  - drop compatibles from exynos5422-cpus.dtsi
>>
>> Changes from v1:
>>  - rename exynos5422.dtsi to exynos5422-cpus.dtsi
>>  - include the dtsi file top of the exynos5422-odroidxu3.dts
>>
>> Secondary cpu booting problem[1] is not resolved yet. Need more 
>> investigations
>> to work booting 8 cores correctly.
>>
>> [1]: http://www.spinics.net/lists/linux-samsung-soc/msg45525.html
>>
>>  arch/arm/boot/dts/exynos5422-cpus.dtsi | 81 
>> ++
>>  arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi |  1 +
>>  2 files changed, 82 insertions(+)
>>  create mode 100644 arch/arm/boot/dts/exynos5422-cpus.dtsi
> 
> Thanks, applied to my tree. I'll sent it to Kukjin later for 4.3 unless
> he picks it up from LKML.
> 
> Best regards,
> Krzysztof

Un-applied. The signed-off-by does not match from.

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: [PATCHv5] ARM: dts: add exynos5422-cpus.dtsi to correct cpu order

2015-07-06 Thread Krzysztof Kozlowski
On 06.07.2015 23:12, Chanho Park wrote:
> The odroid-xu3 board which is based on exynos5422 not exynos5800 is
> booted from cortex-a7 core unlike exynos5800. The odroid-xu3's cpu order
> is quite strange. cpu0 and cpu5-7 are cortex-a7 cores and cpu1-4 are
> cortex-a15 cores. To correct this mis-odering, I added exynos5422.dtsi
> and reversing cpu orders from exynos5420. Now, cpu0-3 are cortex-a7 and
> cpu4-7 are cortex-a15.
> 
> Reviewed-by: Krzysztof Kozlowski 
> Signed-off-by: Chanho Park 
> ---
> Changes from v4:
>  - Remove temporal patch in e-mail body
> 
> Changes from v3:
>  - include this exynos5422-cpus.dtsi in the exynos5422-odroidxu3-common.dtsi
> 
> Changes from v2:
>  - drop inclusion of exynos5420.dtsi from exynos5422-cpus.dtsi
>  - drop compatibles from exynos5422-cpus.dtsi
> 
> Changes from v1:
>  - rename exynos5422.dtsi to exynos5422-cpus.dtsi
>  - include the dtsi file top of the exynos5422-odroidxu3.dts
> 
> Secondary cpu booting problem[1] is not resolved yet. Need more investigations
> to work booting 8 cores correctly.
> 
> [1]: http://www.spinics.net/lists/linux-samsung-soc/msg45525.html
> 
>  arch/arm/boot/dts/exynos5422-cpus.dtsi | 81 
> ++
>  arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi |  1 +
>  2 files changed, 82 insertions(+)
>  create mode 100644 arch/arm/boot/dts/exynos5422-cpus.dtsi

Thanks, applied to my tree. I'll sent it to Kukjin later for 4.3 unless
he picks it up from LKML.

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] ARM: dts: exynos4: add DMA support for serial ports

2015-07-06 Thread Krzysztof Kozlowski
2015-06-30 9:56 GMT+09:00 Krzysztof Kozlowski :
> On 29.06.2015 22:22, Robert Baldyga wrote:
>> Enable DMA transfers for serial ports.
>>
>> Signed-off-by: Robert Baldyga 
>> ---
>>  arch/arm/boot/dts/exynos4.dtsi | 8 
>>  1 file changed, 8 insertions(+)
>
> Reviewed-by: Krzysztof Kozlowski 

Unfortunately the commit (applied on 4.2-rc1) exposes lock-ups during
Trats2 boot.

Board: Trats2
Config: exynos
Tree: https://github.com/krzk/linux.git
branch: for-next (v4.2-rc1-29-g1ce41c343055)

Lockdep indicated issue in Samsung serial driver
(dma_async_issue_pending called while holding port->lock which leads
to calling back the driver's tx_dma_complete).

I tried to locate the dead lock. To me the excessive locking in serial
driver causes such recursive locking but I am not quite sure (I am not
familiar with the serial driver).

Anyway, till this get fixed I am dropping the patch from my tree.

Best regards,
Krzysztof


Bug (I hope line wrapping won't mess up with it...):

[   74.480535] BUG: spinlock recursion on CPU#1, systemd/1
[   74.484293]  lock: 0xeeb1a9f4, .magic: dead4ead, .owner: systemd/1,
.owner_cpu: 1
[   74.491756] CPU: 1 PID: 1 Comm: systemd Not tainted
4.2.0-rc1-00029-g1ce41c343055 #100
[   74.499649] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   74.505752] [] (unwind_backtrace) from []
(show_stack+0x10/0x14)
[   74.513461] [] (show_stack) from []
(dump_stack+0x70/0xbc)
[   74.520668] [] (dump_stack) from []
(do_raw_spin_lock+0x178/0x1a0)
[   74.528568] [] (do_raw_spin_lock) from []
(_raw_spin_lock_irqsave+0x20/0x28)
[   74.537330] [] (_raw_spin_lock_irqsave) from []
(dma_pl330_rqcb.isra.4+0x24/0x58)
[   74.546529] [] (dma_pl330_rqcb.isra.4) from []
(pl330_release_channel.part.5+0x38/0x98)
[   74.556249] [] (pl330_release_channel.part.5) from
[] (pl330_free_chan_resources+0x54/0xd8)
[   74.566324] [] (pl330_free_chan_resources) from
[] (dma_chan_put+0x88/0x8c)
[   74.575001] [] (dma_chan_put) from []
(dma_release_channel+0x24/0x94)
[   74.583163] [] (dma_release_channel) from []
(s3c24xx_serial_shutdown+0x18c/0x1d8)
[   74.592447] [] (s3c24xx_serial_shutdown) from
[] (uart_port_shutdown+0x2c/0x38)
[   74.601472] [] (uart_port_shutdown) from []
(uart_shutdown+0xac/0xec)
[   74.609630] [] (uart_shutdown) from []
(uart_close+0x64/0x1f0)
[   74.617184] [] (uart_close) from []
(tty_release+0xf0/0x464)
[   74.624566] [] (tty_release) from [] (__fput+0x80/0x1bc)
[   74.631594] [] (__fput) from [] (task_work_run+0xa8/0xdc)
[   74.638711] [] (task_work_run) from []
(do_work_pending+0x94/0xb4)
[   74.646610] [] (do_work_pending) from []
(work_pending+0xc/0x20)

Lockdep:

[  109.696678]  Requested RX ee0d4a2c@TX ee0d4ac4
[  109.701699]
[  109.701928] =
[  109.707310] [ INFO: possible recursive locking detected ]
[  109.712694] 4.2.0-rc1-00029-g1ce41c343055-dirty #111 Not tainted
[  109.718680] -
[  109.724063] swapper/0/0 is trying to acquire lock:
[  109.728836]  (&port_lock_key){-.-...}, at: []
s3c24xx_serial_tx_dma_complete+0x8c/0xfc
[  109.737603]
[  109.737603] but task is already holding lock:
[  109.743418]  (&port_lock_key){-.-...}, at: []
s3c24xx_serial_tx_chars+0x18/0x180
[  109.751664]
[  109.751664] other info that might help us debug this:
[  109.758174]  Possible unsafe locking scenario:
[  109.758174]
[  109.764076]CPU0
[  109.766507]
[  109.768936]   lock(&port_lock_key);
[  109.772408]   lock(&port_lock_key);
[  109.775881]
[  109.775881]  *** DEADLOCK ***
[  109.775881]
[  109.781784]  May be due to missing lock nesting notation
[  109.781784]
[  109.788556] 1 lock held by swapper/0/0:
[  109.792373]  #0:  (&port_lock_key){-.-...}, at: []
s3c24xx_serial_tx_chars+0x18/0x180
[  109.801053]
[  109.801053] stack backtrace:
[  109.805399] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
4.2.0-rc1-00029-g1ce41c343055-dirty #111
[  109.813988] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[  109.820084] [] (unwind_backtrace) from []
(show_stack+0x10/0x14)
[  109.827801] [] (show_stack) from []
(dump_stack+0x70/0xbc)
[  109.835003] [] (dump_stack) from []
(validate_chain.isra.24+0x7b4/0x8b8)
[  109.843419] [] (validate_chain.isra.24) from []
(__lock_acquire+0x464/0xb28)
[  109.852185] [] (__lock_acquire) from []
(lock_acquire+0x6c/0x8c)
[  109.859915] [] (lock_acquire) from []
(_raw_spin_lock_irqsave+0x48/0x5c)
[  109.868335] [] (_raw_spin_lock_irqsave) from []
(s3c24xx_serial_tx_dma_complete+0x8c/0xfc)
[  109.878322] [] (s3c24xx_serial_tx_dma_complete) from
[] (pl330_tasklet+0x16c/0x4cc)
[  109.887690] [] (pl330_tasklet) from []
(s3c24xx_serial_start_tx_dma+0x1a4/0x1f4)
[  109.896803] [] (s3c24xx_serial_start_tx_dma) from
[] (s3c24xx_serial_tx_chars+0x158/0x180)
[  109.906784] [] (s3c24xx_serial_tx_chars) from
[] (s3c64xx_serial_handle_irq+0x34/0x60)
[  109.916424] [] (s3c64xx_serial_handle_irq) from
[] (handle_irq_event_percpu+0x50/0x154)
[  109.926142] [] (handle

Re: [PATCH] thermal: consistently use int for temperatures

2015-07-06 Thread Heiko Stübner
Am Montag, 6. Juli 2015, 09:19:49 schrieb Sascha Hauer:
> The thermal code uses int, long and unsigned long for temperatures
> in different places.
> 
> Using an unsigned type limits the thermal framework to positive
> temperatures without need. Also several drivers currently will report
> temperatures near UINT_MAX for temperatures below 0°C. This will probably
> immediately shut the machine down due to overtemperature if started below
> 0°C.
> 
> 'long' is 64bit on several architectures. This is not needed since INT_MAX
> °mC is above the melting point of all known materials.
> 
> Consistently use a plain 'int' for temperatures throughout the thermal code
> and the drivers. This only changes the places in the drivers where the
> temperature is passed around as pointer, when drivers internally use
> another type this is not changed.
> 
> Signed-off-by: Sascha Hauer 
> Cc: Zhang Rui 
> Cc: Eduardo Valentin 
> Cc: linux...@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org
> Cc: Jean Delvare 
> Cc: Peter Feuerer 
> Cc: Heiko Stuebner 
> Cc: Lukasz Majewski 
> Cc: Stephen Warren 
> Cc: Thierry Reding 
> Cc: linux-a...@vger.kernel.org
> Cc: platform-driver-...@vger.kernel.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-o...@vger.kernel.org
> Cc: linux-samsung-soc@vger.kernel.org
> Cc: Guenter Roeck 
> Cc: Rafael J. Wysocki 
> Cc: Maxime Ripard 
> Cc: Darren Hart 
> Cc: lm-sens...@lm-sensors.org
> ---

For

>  drivers/thermal/rockchip_thermal.c | 10 

Reviewed-by: Heiko Stuebner 

--
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] thermal: consistently use int for temperatures

2015-07-06 Thread Darren Hart
On Mon, Jul 06, 2015 at 09:19:49AM +0200, Sascha Hauer wrote:
> The thermal code uses int, long and unsigned long for temperatures
> in different places.
> 
> Using an unsigned type limits the thermal framework to positive
> temperatures without need. Also several drivers currently will report
> temperatures near UINT_MAX for temperatures below 0°C. This will probably
> immediately shut the machine down due to overtemperature if started below
> 0°C.
> 
> 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
> is above the melting point of all known materials.
> 
> Consistently use a plain 'int' for temperatures throughout the thermal code 
> and
> the drivers. This only changes the places in the drivers where the temperature
> is passed around as pointer, when drivers internally use another type this is
> not changed.
> 
> Signed-off-by: Sascha Hauer 

...

>  drivers/platform/x86/acerhdf.c |  9 
>  drivers/platform/x86/intel_mid_thermal.c   |  9 

For these two:

Reviewed-by: Darren Hart 

-- 
Darren Hart
Intel Open Source Technology Center
--
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-06 Thread Daniel Vetter
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.
> 
> 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

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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/2] thermal: exynos: Fix minor issue

2015-07-06 Thread Lukasz Majewski
Hi Chanwoo,

> This patch fixes the two minor issue. The first patch add the
> CONFIG_THERMAL_OF dependency and second patch removes the unused code.
> 
> Chanwoo Choi (2):
>   thermal: exynos: Add the dependency of CONFIG_THERMAL_OF instead of
> CONFIG_OF thermal: exynos: Remove unused code related to
> platform_data on probe()
> 
>  drivers/thermal/samsung/Kconfig  | 2 +-
>  drivers/thermal/samsung/exynos_tmu.c | 3 ---
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 

Thanks for your work.

Applied to my tree: linux-samusng-thermal/fixes


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
--
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] thermal: exynos: Disable the regulator on probe failure

2015-07-06 Thread Lukasz Majewski
Hi Krzysztof,

> 2015-06-09 1:14 GMT+09:00 Lukasz Majewski :
> > Hi Krzysztof,
> >
> >> During probe the regulator (if present) was enabled but not
> >> disabled in case of failure. So an unsuccessful probe lead to
> >> enabling the regulator which was actually not needed because the
> >> device was not enabled.
> >>
> >> Additionally each deferred probe lead to increase of regulator
> >> enable count so it would not be effectively disabled during
> >> removal of the device.
> >
> > Thanks for catching this.
> >
> >>
> >> Signed-off-by: Krzysztof Kozlowski 
> >> Fixes: 498d22f616f6 ("thermal: exynos: Support for TMU regulator
> >> defined at device tree") Cc: 
> >>
> >> ---
> >>
> >> I am not entirely convinced that this should go to stable. Leaving
> >> a regulator enabled in case of probe failure (no exynos TMU
> >> device) or after deferred probe (regulator won't be disabled
> >> during device removal) is not a critical issue, just leaks power.
> >> ---
> >>  drivers/thermal/samsung/exynos_tmu.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> >> b/drivers/thermal/samsung/exynos_tmu.c index
> >> 531f4b179871..13c3aceed19d 100644 ---
> >> a/drivers/thermal/samsung/exynos_tmu.c +++
> >> b/drivers/thermal/samsung/exynos_tmu.c @@ -1392,6 +1392,8 @@
> >> err_clk_sec: if (!IS_ERR(data->clk_sec))
> >>   clk_unprepare(data->clk_sec);
> >>  err_sensor:
> >> + if (!IS_ERR_OR_NULL(data->regulator))
> >> + regulator_disable(data->regulator);
> >>   thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
> >>
> >>   return ret;
> >
> > Acked-by: Lukasz Majewski 
> >
> > I will test it and afterwards add to samsung-thermal tree.
> 
> Hi Łukasz,
> 
> I can't find this patch in v4.2-rc1 or your tree. What happened?
> 
> Best regards,
> Krzysztof

Applied to linux-samsung-thermal.git

Thanks for fix and sorry for the delay.
-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
--
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 05/23] drm/exynos: add atomic asynchronous commit

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

The atomic modesetting interfaces supports async commits that should be
implemented by the drivers. If drm core requests an async commit
exynos_atomic_commit() will schedule a work task to run the update later.

It also waits an update to finish before schedule a new one.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c |  6 
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  6 
 drivers/gpu/drm/exynos/exynos_drm_fb.c  | 51 ++---
 3 files changed, 52 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 63a68c6..3542f2c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -47,6 +47,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned 
long flags)
if (!private)
return -ENOMEM;
 
+   INIT_WORK(&private->work, exynos_drm_atomic_work);
+   private->dev = dev;
+
dev_set_drvdata(dev->dev, dev);
dev->dev_private = (void *)private;
 
@@ -127,6 +130,8 @@ err_free_private:
 
 static int exynos_drm_unload(struct drm_device *dev)
 {
+   struct exynos_drm_private *private = dev->dev_private;
+
exynos_drm_device_subdrv_remove(dev);
 
exynos_drm_fbdev_fini(dev);
@@ -137,6 +142,7 @@ static int exynos_drm_unload(struct drm_device *dev)
drm_mode_config_cleanup(dev);
drm_release_iommu_mapping(dev);
 
+   flush_work(&private->work);
kfree(dev->dev_private);
dev->dev_private = NULL;
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index dd00f16..d9fd8e1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -244,6 +244,10 @@ struct exynos_drm_private {
unsigned long da_space_size;
 
unsigned int pipe;
+
+   struct drm_device *dev;
+   struct work_struct work;
+   struct drm_atomic_state *state;
 };
 
 /*
@@ -296,6 +300,8 @@ static inline int exynos_dpi_remove(struct 
exynos_drm_display *display)
 }
 #endif
 
+void exynos_drm_atomic_work(struct work_struct *work);
+
 /* This function creates a encoder and a connector, and initializes them. */
 int exynos_drm_create_enc_conn(struct drm_device *dev,
struct exynos_drm_display *display);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 2b6320e..ad6b8ac 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -267,20 +267,18 @@ static void exynos_drm_output_poll_changed(struct 
drm_device *dev)
exynos_drm_fbdev_init(dev);
 }
 
-static int exynos_atomic_commit(struct drm_device *dev,
-   struct drm_atomic_state *state,
-   bool async)
+static void exynos_atomic_commit_schedule(struct drm_device *dev,
+   struct drm_atomic_state *state)
 {
-   int ret;
-
-   ret = drm_atomic_helper_prepare_planes(dev, state);
-   if (ret)
-   return ret;
-
-   /* This is the point of no return */
+   struct exynos_drm_private *private = dev->dev_private;
 
-   drm_atomic_helper_swap_state(dev, state);
+   private->state = state;
+   schedule_work(&private->work);
+}
 
+static void exynos_atomic_commit_complete(struct drm_device *dev,
+ struct drm_atomic_state *state)
+{
drm_atomic_helper_commit_modeset_disables(dev, state);
 
drm_atomic_helper_commit_modeset_enables(dev, state);
@@ -298,6 +296,37 @@ static int exynos_atomic_commit(struct drm_device *dev,
drm_atomic_helper_cleanup_planes(dev, state);
 
drm_atomic_state_free(state);
+}
+
+void exynos_drm_atomic_work(struct work_struct *work)
+{
+   struct exynos_drm_private *private = container_of(work,
+   struct exynos_drm_private, work);
+
+   exynos_atomic_commit_complete(private->dev, private->state);
+}
+
+static int exynos_atomic_commit(struct drm_device *dev,
+   struct drm_atomic_state *state,
+   bool async)
+{
+   struct exynos_drm_private *private = dev->dev_private;
+   int ret;
+
+   ret = drm_atomic_helper_prepare_planes(dev, state);
+   if (ret)
+   return ret;
+
+   /* This is the point of no return */
+
+   flush_work(&private->work);
+
+   drm_atomic_helper_swap_state(dev, state);
+
+   if (async)
+   exynos_atomic_commit_schedule(dev, state);
+   else
+   exynos_atomic_commit_complete(dev, state);
 
return 0;
 }
-- 
2.1.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://vg

[PATCH v2 18/23] drm/exynos: remove extra call to hdmi_commit()

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

hdmi_commit() was getting called twice by exynos encoder core, once inside
the .enable() call and another time by .commit() itself.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 17 +
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index a0443dc..1fc01fe 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2019,20 +2019,6 @@ static void hdmi_mode_set(struct exynos_drm_encoder 
*encoder,
hdmi_v14_mode_set(hdata, mode);
 }
 
-static void hdmi_commit(struct exynos_drm_encoder *encoder)
-{
-   struct hdmi_context *hdata = encoder_to_hdmi(encoder);
-
-   mutex_lock(&hdata->hdmi_mutex);
-   if (!hdata->powered) {
-   mutex_unlock(&hdata->hdmi_mutex);
-   return;
-   }
-   mutex_unlock(&hdata->hdmi_mutex);
-
-   hdmi_conf_apply(hdata);
-}
-
 static void hdmi_enable(struct exynos_drm_encoder *encoder)
 {
struct hdmi_context *hdata = encoder_to_hdmi(encoder);
@@ -2061,7 +2047,7 @@ static void hdmi_enable(struct exynos_drm_encoder 
*encoder)
clk_prepare_enable(res->sclk_hdmi);
 
hdmiphy_poweron(hdata);
-   hdmi_commit(encoder);
+   hdmi_conf_apply(hdata);
 }
 
 static void hdmi_disable(struct exynos_drm_encoder *encoder)
@@ -2121,7 +2107,6 @@ static struct exynos_drm_encoder_ops hdmi_encoder_ops = {
.mode_set   = hdmi_mode_set,
.enable = hdmi_enable,
.disable= hdmi_disable,
-   .commit = hdmi_commit,
 };
 
 static void hdmi_hotplug_work_func(struct work_struct *work)
-- 
2.1.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


[PATCH v2 06/23] drm/exynos: rename win_commit/disable to atomic-like names

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

Rename win_commit() helper to update_plane() and win_disable() to
disable_plane().

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 10 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 10 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  8 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 10 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 10 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  6 +++---
 drivers/gpu/drm/exynos/exynos_mixer.c | 10 +-
 7 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 61e6e4a..c7f3680 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -219,7 +219,7 @@ static void decon_shadow_protect_win(struct decon_context 
*ctx, int win,
writel(val, ctx->addr + DECON_SHADOWCON);
 }
 
-static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
 {
struct decon_context *ctx = crtc->ctx;
struct exynos_drm_plane *plane;
@@ -277,7 +277,7 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, 
unsigned int win)
atomic_set(&ctx->win_updated, 1);
 }
 
-static void decon_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
 {
struct decon_context *ctx = crtc->ctx;
struct exynos_drm_plane *plane;
@@ -378,7 +378,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
 * a destroyed buffer later.
 */
for (i = 0; i < WINDOWS_NR; i++)
-   decon_win_disable(crtc, i);
+   decon_disable_plane(crtc, i);
 
decon_swreset(ctx);
 
@@ -460,8 +460,8 @@ static struct exynos_drm_crtc_ops decon_crtc_ops = {
.enable_vblank  = decon_enable_vblank,
.disable_vblank = decon_disable_vblank,
.commit = decon_commit,
-   .win_commit = decon_win_commit,
-   .win_disable= decon_win_disable,
+   .update_plane   = decon_update_plane,
+   .disable_plane  = decon_disable_plane,
.te_handler = decon_te_irq_handler,
.clear_channels = decon_clear_channels,
 };
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index f720f2a..34da2a4 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -382,7 +382,7 @@ static void decon_shadow_protect_win(struct decon_context 
*ctx,
writel(val, ctx->regs + SHADOWCON);
 }
 
-static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
 {
struct decon_context *ctx = crtc->ctx;
struct drm_display_mode *mode = &crtc->base.state->adjusted_mode;
@@ -492,7 +492,7 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, 
unsigned int win)
writel(val, ctx->regs + DECON_UPDATE);
 }
 
-static void decon_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
 {
struct decon_context *ctx = crtc->ctx;
struct exynos_drm_plane *plane;
@@ -598,7 +598,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
 * a destroyed buffer later.
 */
for (i = 0; i < WINDOWS_NR; i++)
-   decon_win_disable(crtc, i);
+   decon_disable_plane(crtc, i);
 
clk_disable_unprepare(ctx->vclk);
clk_disable_unprepare(ctx->eclk);
@@ -618,8 +618,8 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = {
.enable_vblank = decon_enable_vblank,
.disable_vblank = decon_disable_vblank,
.wait_for_vblank = decon_wait_for_vblank,
-   .win_commit = decon_win_commit,
-   .win_disable = decon_win_disable,
+   .update_plane = decon_update_plane,
+   .disable_plane = decon_disable_plane,
.clear_channels = decon_clear_channels,
 };
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index d9fd8e1..e3f2f2f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -153,8 +153,8 @@ struct exynos_drm_display {
  * @disable_vblank: specific driver callback for disabling vblank interrupt.
  * @wait_for_vblank: wait for vblank interrupt to make sure that
  * hardware overlay is updated.
- * @win_commit: apply hardware specific overlay data to registers.
- * @win_disable: disable hardware specific overlay.
+ * @update_plane: apply hardware specific overlay data to registers.

[PATCH v2 04/23] drm/exynos: remove duplicated check for suspend

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

The same check is placed twice in fimd/decon_update_plane(), remove
one of them.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c | 3 ---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 5a1174a..f720f2a 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -400,9 +400,6 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, 
unsigned int win)
 
plane = &ctx->planes[win];
 
-   if (ctx->suspended)
-   return;
-
/*
 * SHADOWCON/PRTCON register is used for enabling timing.
 *
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index c69fa22..ba07051 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -630,9 +630,6 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, 
unsigned int win)
 
plane = &ctx->planes[win];
 
-   if (ctx->suspended)
-   return;
-
/*
 * SHADOWCON/PRTCON register is used for enabling timing.
 *
-- 
2.1.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


[PATCH v2 16/23] drm/exynos: simplify calculation of possible CRTCs

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

All CRTCs can only be LCD, HDMI or VIDI, so basically all CRTCs will be a
possible CRTCs. This patch removes an extra function with switch that was
only checking if the CRTC type was one of those three above.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 29 +
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 0aa4a58..7ba3a2d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -105,36 +105,17 @@ static struct drm_encoder_funcs exynos_encoder_funcs = {
.destroy = exynos_drm_encoder_destroy,
 };
 
-static unsigned int exynos_drm_encoder_clones(struct drm_encoder *encoder)
+void exynos_drm_encoder_setup(struct drm_device *dev)
 {
-   struct drm_encoder *clone;
-   struct drm_device *dev = encoder->dev;
-   struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
-   struct exynos_drm_display *display = exynos_encoder->display;
+   struct drm_encoder *encoder;
unsigned int clone_mask = 0;
int cnt = 0;
 
-   list_for_each_entry(clone, &dev->mode_config.encoder_list, head) {
-   switch (display->type) {
-   case EXYNOS_DISPLAY_TYPE_LCD:
-   case EXYNOS_DISPLAY_TYPE_HDMI:
-   case EXYNOS_DISPLAY_TYPE_VIDI:
-   clone_mask |= (1 << (cnt++));
-   break;
-   default:
-   continue;
-   }
-   }
-
-   return clone_mask;
-}
-
-void exynos_drm_encoder_setup(struct drm_device *dev)
-{
-   struct drm_encoder *encoder;
+   list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
+   clone_mask |= (1 << (cnt++));
 
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
-   encoder->possible_clones = exynos_drm_encoder_clones(encoder);
+   encoder->possible_clones = clone_mask;
 }
 
 struct drm_encoder *
-- 
2.1.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


[PATCH v2 11/23] drm/exynos: return return value of exynos_crtc->enable_vblank

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

Instead of blindly ignore the return value of enable_vblank return it
to the upper DRM layer for error handling.

Suggested-by: Joonyoung Shim 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index e9c291f..9bc2353 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -175,7 +175,7 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, 
int pipe)
return -EPERM;
 
if (exynos_crtc->ops->enable_vblank)
-   exynos_crtc->ops->enable_vblank(exynos_crtc);
+   return exynos_crtc->ops->enable_vblank(exynos_crtc);
 
return 0;
 }
-- 
2.1.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


[PATCH v2 01/23] drm/exynos: pass the correct pipe number

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

Instead of giving -1 to as arg to  drm_send_vblank_event() pass the
correct pipe number to it.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 644b4b7..22b9ca0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -203,7 +203,7 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device 
*dev, int pipe)
spin_lock_irqsave(&dev->event_lock, flags);
if (exynos_crtc->event) {
 
-   drm_send_vblank_event(dev, -1, exynos_crtc->event);
+   drm_send_vblank_event(dev, pipe, exynos_crtc->event);
drm_vblank_put(dev, pipe);
wake_up(&exynos_crtc->pending_flip_queue);
 
-- 
2.1.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


[PATCH v2 23/23] drm/exynos: remove struct exynos_drm_encoder layer

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

struct exynos_drm_encoder was justing wrapping struct drm_encoder, it had
only a drm_encoder member and the internal exynos_drm_encoders ops that
was directly mapped to the drm_encoder helper funcs.

So now exynos DRM uses struct drm_encoder directly, this removes
completely the struct exynos_drm_encoder.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/Makefile |   7 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  |   2 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c |  68 --
 drivers/gpu/drm/exynos/exynos_dp_core.h |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_core.c|   1 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c|   1 -
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |  51 --
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   1 -
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  47 ++---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |  80 +++--
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 105 
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  22 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c|   2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|  71 ++-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  90 ++--
 15 files changed, 238 insertions(+), 312 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h

diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile
index 7de0b10..61c2906 100644
--- a/drivers/gpu/drm/exynos/Makefile
+++ b/drivers/gpu/drm/exynos/Makefile
@@ -3,10 +3,9 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos
-exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \
-   exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \
-   exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \
-   exynos_drm_plane.o exynos_drm_dmabuf.o
+exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fbdev.o \
+   exynos_drm_fb.o exynos_drm_buf.o exynos_drm_gem.o \
+   exynos_drm_core.o exynos_drm_plane.o exynos_drm_dmabuf.o
 
 exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)+= exynos_drm_fimd.o
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 4bcc161..468c0dd 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -61,7 +61,7 @@ struct decon_context {
atomic_twait_vsync_event;
 
struct exynos_drm_panel_info panel;
-   struct exynos_drm_encoder *encoder;
+   struct drm_encoder *encoder;
 };
 
 static const struct of_device_id decon_driver_dt_match[] = {
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index a4a902a..19ed422 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -32,18 +32,18 @@
 #include 
 
 #include "exynos_dp_core.h"
-#include "exynos_drm_encoder.h"
+#include "exynos_drm_crtc.h"
 
 #define ctx_from_connector(c)  container_of(c, struct exynos_dp_device, \
connector)
 
 static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
 {
-   return to_exynos_crtc(dp->encoder.base.crtc);
+   return to_exynos_crtc(dp->encoder.crtc);
 }
 
 static inline struct exynos_dp_device *encoder_to_dp(
-   struct exynos_drm_encoder *e)
+   struct drm_encoder *e)
 {
return container_of(e, struct exynos_dp_device, encoder);
 }
@@ -889,7 +889,7 @@ static void exynos_dp_hotplug(struct work_struct *work)
drm_helper_hpd_irq_event(dp->drm_dev);
 }
 
-static void exynos_dp_commit(struct exynos_drm_encoder *encoder)
+static void exynos_dp_commit(struct drm_encoder *encoder)
 {
struct exynos_dp_device *dp = encoder_to_dp(encoder);
int ret;
@@ -995,7 +995,7 @@ static struct drm_encoder *exynos_dp_best_encoder(
 {
struct exynos_dp_device *dp = ctx_from_connector(connector);
 
-   return &dp->encoder.base;
+   return &dp->encoder;
 }
 
 static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
@@ -1020,10 +1020,9 @@ static int exynos_drm_attach_lcd_bridge(struct 
exynos_dp_device *dp,
return 0;
 }
 
-static int exynos_dp_create_connector(struct exynos_drm_encoder 
*exynos_encoder)
+static int exynos_dp_create_connector(struct drm_encoder *encoder)
 {
-   struct exynos_dp_device *dp = encoder_to_dp(exynos_encoder);
-   struct drm_encoder *encoder = &exynos_encoder->base;
+   struct exynos_dp_device *dp = encoder_to_dp(encoder);
struct drm_connector *connecto

[PATCH v2 12/23] drm/exynos: don't track enabled state at exynos_crtc

2015-07-06 Thread Gustavo Padovan
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.

Signed-off-by: Gustavo Padovan 
---
 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

--
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 22/23] drm/exynos: fold encoder setup into exynos_drm_load()

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

As we are removing the exynos encoder move the encoder setup operation
directly inside the exynos_drm_load()

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 12 ++--
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 13 -
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  1 -
 3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 3542f2c..f3fcc2a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -41,7 +41,9 @@
 static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 {
struct exynos_drm_private *private;
-   int ret;
+   struct drm_encoder *encoder;
+   unsigned int clone_mask;
+   int cnt, ret;
 
private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL);
if (!private)
@@ -70,7 +72,13 @@ static int exynos_drm_load(struct drm_device *dev, unsigned 
long flags)
exynos_drm_mode_config_init(dev);
 
/* setup possible_clones. */
-   exynos_drm_encoder_setup(dev);
+   cnt = 0;
+   clone_mask = 0;
+   list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
+   clone_mask |= (1 << (cnt++));
+
+   list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
+   encoder->possible_clones = clone_mask;
 
platform_set_drvdata(dev->platformdev, dev);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 4ed360b..d45a5c5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -78,19 +78,6 @@ static struct drm_encoder_funcs exynos_encoder_funcs = {
.destroy = drm_encoder_cleanup,
 };
 
-void exynos_drm_encoder_setup(struct drm_device *dev)
-{
-   struct drm_encoder *encoder;
-   unsigned int clone_mask = 0;
-   int cnt = 0;
-
-   list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
-   clone_mask |= (1 << (cnt++));
-
-   list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
-   encoder->possible_clones = clone_mask;
-}
-
 int exynos_drm_encoder_create(struct drm_device *dev,
  struct exynos_drm_encoder *exynos_encoder,
  enum exynos_drm_output_type type)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
index e998b82..6610dee 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
@@ -16,7 +16,6 @@
 
 #include "exynos_drm_drv.h"
 
-void exynos_drm_encoder_setup(struct drm_device *dev);
 int exynos_drm_encoder_create(struct drm_device *dev, struct exynos_drm_encoder
  *encoder, enum exynos_drm_output_type type);
 
-- 
2.1.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


[PATCH v2 19/23] drm/exynos: remove extra call to exynos_dp_commit()

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

exynos_dp_commit() was getting called twice by exynos encoder core, once
inside the .enable() call and another time by .commit() itself.

The remove of the second call caused the wake of a bug, the operations
orders inside exynos_dp_commit was wrong and we had to move
exynos_dp_start_video() to be the last operation in there.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index dd1809b..253f955 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -795,9 +795,6 @@ static int exynos_dp_config_video(struct exynos_dp_device 
*dp)
/* Configure video slave mode */
exynos_dp_enable_video_master(dp, 0);
 
-   /* Enable video */
-   exynos_dp_start_video(dp);
-
timeout_loop = 0;
 
for (;;) {
@@ -938,6 +935,9 @@ static void exynos_dp_commit(struct exynos_drm_encoder 
*encoder)
if (drm_panel_enable(dp->panel))
DRM_ERROR("failed to enable the panel\n");
}
+
+   /* Enable video */
+   exynos_dp_start_video(dp);
 }
 
 static enum drm_connector_status exynos_dp_detect(
@@ -1107,7 +1107,6 @@ static struct exynos_drm_encoder_ops 
exynos_dp_encoder_ops = {
.create_connector = exynos_dp_create_connector,
.enable = exynos_dp_enable,
.disable = exynos_dp_disable,
-   .commit = exynos_dp_commit,
 };
 
 static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
-- 
2.1.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


[PATCH v2 08/23] drm/exynos: use drm atomic state directly

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

For some fields the use of struct exynos_drm_plane filled with data from
the plane state just creates a source of duplicated information and
overhead.  Here we change the crtc drivers to access the plane state
directly simplifying the code by not relying on a exynos internal struct.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 21 +
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 23 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 29 ++--
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 12 -
 drivers/gpu/drm/exynos/exynos_mixer.c | 65 ++-
 5 files changed, 75 insertions(+), 75 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 6dc2be2..dd41390 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -152,15 +152,15 @@ static void decon_commit(struct exynos_drm_crtc *crtc)
 #define OFFSIZE(x) (((x) & 0x3fff) << 14)
 #define PAGEWIDTH(x)   ((x) & 0x3fff)
 
-static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win)
+static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
+struct drm_framebuffer *fb)
 {
-   struct exynos_drm_plane *plane = &ctx->planes[win];
unsigned long val;
 
val = readl(ctx->addr + DECON_WINCONx(win));
val &= ~WINCONx_BPPMODE_MASK;
 
-   switch (plane->pixel_format) {
+   switch (fb->pixel_format) {
case DRM_FORMAT_XRGB1555:
val |= WINCONx_BPPMODE_16BPP_I1555;
val |= WINCONx_HAWSWP_F;
@@ -186,7 +186,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, 
unsigned int win)
return;
}
 
-   DRM_DEBUG_KMS("bpp = %u\n", plane->bpp);
+   DRM_DEBUG_KMS("bpp = %u\n", fb->bits_per_pixel);
 
/*
 * In case of exynos, setting dma-burst to 16Word causes permanent
@@ -196,7 +196,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, 
unsigned int win)
 * movement causes unstable DMA which results into iommu crash/tear.
 */
 
-   if (plane->fb_width < MIN_FB_WIDTH_FOR_16WORD_BURST) {
+   if (fb->width < MIN_FB_WIDTH_FOR_16WORD_BURST) {
val &= ~WINCONx_BURSTLEN_MASK;
val |= WINCONx_BURSTLEN_8WORD;
}
@@ -223,7 +223,10 @@ static void decon_update_plane(struct exynos_drm_crtc 
*crtc,
   struct exynos_drm_plane *plane)
 {
struct decon_context *ctx = crtc->ctx;
+   struct drm_plane_state *state = plane->base.state;
unsigned int win = plane->zpos;
+   unsigned int bpp = state->fb->bits_per_pixel >> 3;
+   unsigned int pitch = state->fb->pitches[0];
u32 val;
 
if (ctx->suspended)
@@ -248,14 +251,14 @@ static void decon_update_plane(struct exynos_drm_crtc 
*crtc,
 
writel(plane->dma_addr[0], ctx->addr + DECON_VIDW0xADD0B0(win));
 
-   val = plane->dma_addr[0] + plane->pitch * plane->crtc_height;
+   val = plane->dma_addr[0] + pitch * plane->crtc_height;
writel(val, ctx->addr + DECON_VIDW0xADD1B0(win));
 
-   val = OFFSIZE(plane->pitch - plane->crtc_width * (plane->bpp >> 3))
-   | PAGEWIDTH(plane->crtc_width * (plane->bpp >> 3));
+   val = OFFSIZE(pitch - plane->crtc_width * bpp)
+   | PAGEWIDTH(plane->crtc_width * bpp);
writel(val, ctx->addr + DECON_VIDW0xADD2(win));
 
-   decon_win_set_pixfmt(ctx, win);
+   decon_win_set_pixfmt(ctx, win, state->fb);
 
/* window enable */
val = readl(ctx->addr + DECON_WINCONx(win));
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 79b74d2..7f00a20 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -271,16 +271,16 @@ static void decon_disable_vblank(struct exynos_drm_crtc 
*crtc)
}
 }
 
-static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win)
+static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
+struct drm_framebuffer *fb)
 {
-   struct exynos_drm_plane *plane = &ctx->planes[win];
unsigned long val;
int padding;
 
val = readl(ctx->regs + WINCON(win));
val &= ~WINCONx_BPPMODE_MASK;
 
-   switch (plane->pixel_format) {
+   switch (fb->pixel_format) {
case DRM_FORMAT_RGB565:
val |= WINCONx_BPPMODE_16BPP_565;
val |= WINCONx_BURSTLEN_16WORD;
@@ -329,7 +329,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, 
unsigned int win)
break;
}
 
-   DRM_DEBUG_KMS("bpp = %d\n", plane->bpp);
+   DRM_DEBUG_KMS("bpp = %d\n", fb->bits_per_pixel);
 
/*
  

[PATCH v2 21/23] drm/exynos: remove exynos_drm_create_enc_conn()

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

This functions was just hiding the encoder and connector creation in
a way that was less clean than if we get rid of it. For example,
exynos_encoder ops had .create_connector() defined only because we were
handing off the encoder and connector creation to
exynos_drm_create_enc_conn(). Without this function we can directly call
the create_connector function internally in the code, without the need of
any vtable access.

It also does some refactoring in the code like creating a bind function
for dpi devices.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  |  3 +--
 drivers/gpu/drm/exynos/exynos_dp_core.c | 20 ---
 drivers/gpu/drm/exynos/exynos_drm_core.c| 30 -
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 26 +++--
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 13 ++---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 20 ---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 11 +++
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  4 +++-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c|  3 +--
 drivers/gpu/drm/exynos/exynos_drm_vidi.c| 20 ++-
 drivers/gpu/drm/exynos/exynos_hdmi.c| 21 +---
 11 files changed, 101 insertions(+), 70 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index e9854d4..4bcc161 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -682,8 +682,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
}
 
if (ctx->encoder)
-   exynos_drm_create_enc_conn(drm_dev, ctx->encoder,
-  EXYNOS_DISPLAY_TYPE_LCD);
+   exynos_dpi_bind(drm_dev, ctx->encoder);
 
return 0;
 
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 253f955..a4a902a 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -32,6 +32,7 @@
 #include 
 
 #include "exynos_dp_core.h"
+#include "exynos_drm_encoder.h"
 
 #define ctx_from_connector(c)  container_of(c, struct exynos_dp_device, \
connector)
@@ -1104,7 +1105,6 @@ static void exynos_dp_disable(struct exynos_drm_encoder 
*encoder)
 }
 
 static struct exynos_drm_encoder_ops exynos_dp_encoder_ops = {
-   .create_connector = exynos_dp_create_connector,
.enable = exynos_dp_enable,
.disable = exynos_dp_disable,
 };
@@ -1185,6 +1185,7 @@ static int exynos_dp_bind(struct device *dev, struct 
device *master, void *data)
struct exynos_dp_device *dp = dev_get_drvdata(dev);
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm_dev = data;
+   struct exynos_drm_encoder *exynos_encoder = &dp->encoder;
struct resource *res;
unsigned int irq_flags;
int ret = 0;
@@ -1277,8 +1278,21 @@ static int exynos_dp_bind(struct device *dev, struct 
device *master, void *data)
 
dp->drm_dev = drm_dev;
 
-   return exynos_drm_create_enc_conn(drm_dev, &dp->encoder,
- EXYNOS_DISPLAY_TYPE_LCD);
+   ret = exynos_drm_encoder_create(drm_dev, exynos_encoder,
+   EXYNOS_DISPLAY_TYPE_LCD);
+   if (ret) {
+   DRM_ERROR("failed to create encoder\n");
+   return ret;
+   }
+
+   ret = exynos_dp_create_connector(exynos_encoder);
+   if (ret) {
+   DRM_ERROR("failed to create connector ret = %d\n", ret);
+   drm_encoder_cleanup(&exynos_encoder->base);
+   return ret;
+   }
+
+   return 0;
 }
 
 static void exynos_dp_unbind(struct device *dev, struct device *master,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c 
b/drivers/gpu/drm/exynos/exynos_drm_core.c
index e386452..1f38a44 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_core.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_core.c
@@ -20,36 +20,6 @@
 
 static LIST_HEAD(exynos_drm_subdrv_list);
 
-int exynos_drm_create_enc_conn(struct drm_device *dev,
-  struct exynos_drm_encoder *exynos_encoder,
-  enum exynos_drm_output_type type)
-{
-   int ret;
-   unsigned long possible_crtcs = 0;
-
-   ret = exynos_drm_crtc_get_pipe_from_type(dev, type);
-   if (ret < 0)
-   return ret;
-
-   possible_crtcs |= 1 << ret;
-
-   /* create and initialize a encoder for this sub driver. */
-   ret = exynos_drm_encoder_create(dev, exynos_encoder, possible_crtcs);
-   if (ret) {
-   DRM_ERROR("failed to create encoder\n");
-   return ret;
-   }
-
-   ret = exynos_encoder->ops->create_connector(exynos_encoder);
-   if (ret) {
-  

[PATCH v2 20/23] drm/exynos: remove exynos_encoder's .commit() op

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

.commit() is not used anymore, Exynos encoders now follow the
.enable()/.disable() semantics from drm atomic core, so remove this
callback.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 --
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 3 ---
 2 files changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 615b635..b940bcca 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -87,7 +87,6 @@ struct exynos_drm_plane {
  *   would be called by encoder->mode_set().
  * @enable: display device on.
  * @disable: display device off.
- * @commit: apply changes to hw
  */
 struct exynos_drm_encoder;
 struct exynos_drm_encoder_ops {
@@ -100,7 +99,6 @@ struct exynos_drm_encoder_ops {
struct drm_display_mode *mode);
void (*enable)(struct exynos_drm_encoder *encoder);
void (*disable)(struct exynos_drm_encoder *encoder);
-   void (*commit)(struct exynos_drm_encoder *encoder);
 };
 
 /*
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index b9a1c93..ce7b97e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -56,9 +56,6 @@ static void exynos_drm_encoder_enable(struct drm_encoder 
*encoder)
 
if (exynos_encoder->ops->enable)
exynos_encoder->ops->enable(exynos_encoder);
-
-   if (exynos_encoder->ops->commit)
-   exynos_encoder->ops->commit(exynos_encoder);
 }
 
 static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
-- 
2.1.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


[PATCH v2 14/23] drm/exynos: remove wrappers for phy_power_{on,off}

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

phy_power_on() and phy_power_off() already checks for NULL pointer.
This patch removes the wrappers exynos_dp_phy_init() and
exynos_dp_phy_exit() since the only think they were doing was a check for
NULL phy.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index f2cc8f1..fe38d6f 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1054,18 +1054,6 @@ static int exynos_dp_create_connector(struct 
exynos_drm_display *display,
return ret;
 }
 
-static void exynos_dp_phy_init(struct exynos_dp_device *dp)
-{
-   if (dp->phy)
-   phy_power_on(dp->phy);
-}
-
-static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
-{
-   if (dp->phy)
-   phy_power_off(dp->phy);
-}
-
 static void exynos_dp_enable(struct exynos_drm_display *display)
 {
struct exynos_dp_device *dp = display_to_dp(display);
@@ -1085,7 +1073,7 @@ static void exynos_dp_enable(struct exynos_drm_display 
*display)
crtc->ops->clock_enable(dp_to_crtc(dp), true);
 
clk_prepare_enable(dp->clock);
-   exynos_dp_phy_init(dp);
+   phy_power_on(dp->phy);
exynos_dp_init_dp(dp);
enable_irq(dp->irq);
exynos_dp_commit(&dp->display);
@@ -1105,7 +1093,7 @@ static void exynos_dp_disable(struct exynos_drm_display 
*display)
 
disable_irq(dp->irq);
flush_work(&dp->hotplug_work);
-   exynos_dp_phy_exit(dp);
+   phy_power_off(dp->phy);
clk_disable_unprepare(dp->clock);
 
if (crtc->ops->clock_enable)
@@ -1278,7 +1266,7 @@ static int exynos_dp_bind(struct device *dev, struct 
device *master, void *data)
 
INIT_WORK(&dp->hotplug_work, exynos_dp_hotplug);
 
-   exynos_dp_phy_init(dp);
+   phy_power_on(dp->phy);
 
exynos_dp_init_dp(dp);
 
-- 
2.1.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


[PATCH v2 15/23] drm/exynos: remove unused .remove() and .check_mode() ops from display

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

These two display_ops are not used anywhere, remove them.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 80ee5c5..4039ba8 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -81,11 +81,9 @@ struct exynos_drm_plane {
  * - this structure is common to analog tv, digital tv and lcd panel.
  *
  * @create_connector: initialize and register a new connector
- * @remove: cleans up the display for removal
  * @mode_fixup: fix mode data comparing to hw specific display mode.
  * @mode_set: convert drm_display_mode to hw specific display mode and
  *   would be called by encoder->mode_set().
- * @check_mode: check if mode is valid or not.
  * @enable: display device on.
  * @disable: display device off.
  * @commit: apply changes to hw
@@ -94,15 +92,12 @@ struct exynos_drm_display;
 struct exynos_drm_display_ops {
int (*create_connector)(struct exynos_drm_display *display,
struct drm_encoder *encoder);
-   void (*remove)(struct exynos_drm_display *display);
void (*mode_fixup)(struct exynos_drm_display *display,
struct drm_connector *connector,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
void (*mode_set)(struct exynos_drm_display *display,
struct drm_display_mode *mode);
-   int (*check_mode)(struct exynos_drm_display *display,
-   struct drm_display_mode *mode);
void (*enable)(struct exynos_drm_display *display);
void (*disable)(struct exynos_drm_display *display);
void (*commit)(struct exynos_drm_display *display);
-- 
2.1.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


[PATCH v2 07/23] drm/exynos: pass struct exynos_drm_plane in update/enable

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

We already have the plane pointer in before calling .update_plane() or
disable_plane() so pass it directly to those calls avoiding a new
conversion from zpos to struct exynos_drm_plane.

v2: don't remove check for suspended in FIMD (comment by Joonyoung)

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 22 +++---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 22 +++---
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  6 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 22 +++---
 drivers/gpu/drm/exynos/exynos_drm_plane.c |  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  9 ++---
 drivers/gpu/drm/exynos/exynos_mixer.c | 20 +++-
 7 files changed, 40 insertions(+), 65 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index c7f3680..6dc2be2 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -219,17 +219,13 @@ static void decon_shadow_protect_win(struct decon_context 
*ctx, int win,
writel(val, ctx->addr + DECON_SHADOWCON);
 }
 
-static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_update_plane(struct exynos_drm_crtc *crtc,
+  struct exynos_drm_plane *plane)
 {
struct decon_context *ctx = crtc->ctx;
-   struct exynos_drm_plane *plane;
+   unsigned int win = plane->zpos;
u32 val;
 
-   if (win < 0 || win >= WINDOWS_NR)
-   return;
-
-   plane = &ctx->planes[win];
-
if (ctx->suspended)
return;
 
@@ -277,17 +273,13 @@ static void decon_update_plane(struct exynos_drm_crtc 
*crtc, unsigned int win)
atomic_set(&ctx->win_updated, 1);
 }
 
-static void decon_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_disable_plane(struct exynos_drm_crtc *crtc,
+   struct exynos_drm_plane *plane)
 {
struct decon_context *ctx = crtc->ctx;
-   struct exynos_drm_plane *plane;
+   unsigned int win = plane->zpos;
u32 val;
 
-   if (win < 0 || win >= WINDOWS_NR)
-   return;
-
-   plane = &ctx->planes[win];
-
if (ctx->suspended)
return;
 
@@ -378,7 +370,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
 * a destroyed buffer later.
 */
for (i = 0; i < WINDOWS_NR; i++)
-   decon_disable_plane(crtc, i);
+   decon_disable_plane(crtc, &ctx->planes[i]);
 
decon_swreset(ctx);
 
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 34da2a4..79b74d2 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -382,24 +382,20 @@ static void decon_shadow_protect_win(struct decon_context 
*ctx,
writel(val, ctx->regs + SHADOWCON);
 }
 
-static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_update_plane(struct exynos_drm_crtc *crtc,
+  struct exynos_drm_plane *plane)
 {
struct decon_context *ctx = crtc->ctx;
struct drm_display_mode *mode = &crtc->base.state->adjusted_mode;
-   struct exynos_drm_plane *plane;
int padding;
unsigned long val, alpha;
unsigned int last_x;
unsigned int last_y;
+   unsigned int win = plane->zpos;
 
if (ctx->suspended)
return;
 
-   if (win < 0 || win >= WINDOWS_NR)
-   return;
-
-   plane = &ctx->planes[win];
-
/*
 * SHADOWCON/PRTCON register is used for enabling timing.
 *
@@ -492,17 +488,13 @@ static void decon_update_plane(struct exynos_drm_crtc 
*crtc, unsigned int win)
writel(val, ctx->regs + DECON_UPDATE);
 }
 
-static void decon_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_disable_plane(struct exynos_drm_crtc *crtc,
+   struct exynos_drm_plane *plane)
 {
struct decon_context *ctx = crtc->ctx;
-   struct exynos_drm_plane *plane;
+   unsigned int win = plane->zpos;
u32 val;
 
-   if (win < 0 || win >= WINDOWS_NR)
-   return;
-
-   plane = &ctx->planes[win];
-
if (ctx->suspended)
return;
 
@@ -598,7 +590,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
 * a destroyed buffer later.
 */
for (i = 0; i < WINDOWS_NR; i++)
-   decon_disable_plane(crtc, i);
+   decon_disable_plane(crtc, &ctx->planes[i]);
 
clk_disable_unprepare(ctx->vclk);
clk_disable_unprepare(ctx->eclk);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index e3f2

[PATCH v2 02/23] drm/exynos: calculate vrefresh instead of use a fixed value

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

When mode's vrefresh is zero we should ask DRM core to calculate vrefresh
for us so we can get the correct value instead of relying on fixed value
defined in a macro. But if vrefresh is still zero we should fail the
update.

v2: fix comment by Joonyoung
- assign vrefresh directly without checking for zero

Suggested-by: Daniel Stone 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 794e56c..51b6a27 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -41,7 +41,6 @@
  * CPU Interface.
  */
 
-#define FIMD_DEFAULT_FRAMERATE 60
 #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
 
 /* position control register for hardware window 0, 2 ~ 4.*/
@@ -379,8 +378,9 @@ static bool fimd_mode_fixup(struct exynos_drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
 {
+   adjusted_mode->vrefresh = drm_mode_vrefresh(mode);
if (adjusted_mode->vrefresh == 0)
-   adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE;
+   return false;
 
return true;
 }
-- 
2.1.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


[PATCH v2 09/23] drm/exynos: remove unused fields from struct exynos_drm_plane

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

Now after the move to use drm_plane_state directly struct drm_plane_state
has many unused fields, along with others that weren't used before the
plane state change. Thus remove them all.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 695f21b..bec388a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -46,21 +46,12 @@ enum exynos_drm_output_type {
  * - the unit is screen coordinates.
  * @src_width: width of a partial image to be displayed from framebuffer.
  * @src_height: height of a partial image to be displayed from framebuffer.
- * @fb_width: width of a framebuffer.
- * @fb_height: height of a framebuffer.
  * @crtc_x: offset x on hardware screen.
  * @crtc_y: offset y on hardware screen.
  * @crtc_width: window width to be displayed (hardware screen).
  * @crtc_height: window height to be displayed (hardware screen).
- * @mode_width: width of screen mode.
- * @mode_height: height of screen mode.
  * @h_ratio: horizontal scaling ratio, 16.16 fixed point
  * @v_ratio: vertical scaling ratio, 16.16 fixed point
- * @refresh: refresh rate.
- * @scan_flag: interlace or progressive way.
- * (it could be DRM_MODE_FLAG_*)
- * @bpp: pixel size.(in bit)
- * @pixel_format: fourcc pixel format of this overlay
  * @dma_addr: array of bus(accessed by dma) address to the memory region
  *   allocated for a overlay.
  * @zpos: order of overlay layer(z position).
@@ -75,21 +66,12 @@ struct exynos_drm_plane {
unsigned int src_y;
unsigned int src_width;
unsigned int src_height;
-   unsigned int fb_width;
-   unsigned int fb_height;
unsigned int crtc_x;
unsigned int crtc_y;
unsigned int crtc_width;
unsigned int crtc_height;
-   unsigned int mode_width;
-   unsigned int mode_height;
unsigned int h_ratio;
unsigned int v_ratio;
-   unsigned int refresh;
-   unsigned int scan_flag;
-   unsigned int bpp;
-   unsigned int pitch;
-   uint32_t pixel_format;
dma_addr_t dma_addr[MAX_FB_BUFFER];
unsigned int zpos;
 };
-- 
2.1.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


[PATCH v2 17/23] drm/exynos: remove struct exynos_drm_display

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

This struct was just representing encoder information, it was a member of
struct exynos_drm_encoder, so any code trying to access encoder data would
have to go through the encoder struct, get the display struct and then get
the data it want.

During this patchset we also realized that the only data
exynos_drm_encoder needs to store is the drm_encoder parent and the
exynos_drm_encoder_ops.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  | 17 ---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 46 +-
 drivers/gpu/drm/exynos/exynos_dp_core.h |  3 +-
 drivers/gpu/drm/exynos/exynos_drm_core.c| 23 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c|  2 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.h|  2 +-
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 41 
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 47 --
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 57 +++---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 75 -
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  6 +--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c| 18 +++
 drivers/gpu/drm/exynos/exynos_drm_vidi.c| 43 +
 drivers/gpu/drm/exynos/exynos_hdmi.c| 47 +-
 14 files changed, 176 insertions(+), 251 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 85657cf..e9854d4 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -61,7 +61,7 @@ struct decon_context {
atomic_twait_vsync_event;
 
struct exynos_drm_panel_info panel;
-   struct exynos_drm_display *display;
+   struct exynos_drm_encoder *encoder;
 };
 
 static const struct of_device_id decon_driver_dt_match[] = {
@@ -681,8 +681,9 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
return PTR_ERR(ctx->crtc);
}
 
-   if (ctx->display)
-   exynos_drm_create_enc_conn(drm_dev, ctx->display);
+   if (ctx->encoder)
+   exynos_drm_create_enc_conn(drm_dev, ctx->encoder,
+  EXYNOS_DISPLAY_TYPE_LCD);
 
return 0;
 
@@ -695,8 +696,8 @@ static void decon_unbind(struct device *dev, struct device 
*master,
 
decon_disable(ctx->crtc);
 
-   if (ctx->display)
-   exynos_dpi_remove(ctx->display);
+   if (ctx->encoder)
+   exynos_dpi_remove(ctx->encoder);
 
decon_ctx_remove(ctx);
 }
@@ -781,9 +782,9 @@ static int decon_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, ctx);
 
-   ctx->display = exynos_dpi_probe(dev);
-   if (IS_ERR(ctx->display)) {
-   ret = PTR_ERR(ctx->display);
+   ctx->encoder = exynos_dpi_probe(dev);
+   if (IS_ERR(ctx->encoder)) {
+   ret = PTR_ERR(ctx->encoder);
goto err_iounmap;
}
 
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index fe38d6f..dd1809b 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -38,13 +38,13 @@
 
 static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
 {
-   return to_exynos_crtc(dp->encoder->crtc);
+   return to_exynos_crtc(dp->encoder.base.crtc);
 }
 
-static inline struct exynos_dp_device *
-display_to_dp(struct exynos_drm_display *d)
+static inline struct exynos_dp_device *encoder_to_dp(
+   struct exynos_drm_encoder *e)
 {
-   return container_of(d, struct exynos_dp_device, display);
+   return container_of(e, struct exynos_dp_device, encoder);
 }
 
 struct bridge_init {
@@ -891,9 +891,9 @@ static void exynos_dp_hotplug(struct work_struct *work)
drm_helper_hpd_irq_event(dp->drm_dev);
 }
 
-static void exynos_dp_commit(struct exynos_drm_display *display)
+static void exynos_dp_commit(struct exynos_drm_encoder *encoder)
 {
-   struct exynos_dp_device *dp = display_to_dp(display);
+   struct exynos_dp_device *dp = encoder_to_dp(encoder);
int ret;
 
/* Keep the panel disabled while we configure video */
@@ -994,7 +994,7 @@ static struct drm_encoder *exynos_dp_best_encoder(
 {
struct exynos_dp_device *dp = ctx_from_connector(connector);
 
-   return dp->encoder;
+   return &dp->encoder.base;
 }
 
 static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
@@ -1019,15 +1019,13 @@ static int exynos_drm_attach_lcd_bridge(struct 
exynos_dp_device *dp,
return 0;
 }
 
-static int exynos_dp_create_connector(struct exynos_drm_display *display,
-   struct drm_encoder *encoder)
+static int exynos_dp_create_connector(struct exynos_drm_encoder 
*exynos_encoder)

[PATCH v2 03/23] drm/exynos: use KMS version of DRM vblanks functions

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

Get rid of legacy DRM vblank function that are less clear to use.
The new ones basically requires only the crtc as parameters.

It also clean ups exynos_drm_crtc_finish_pageflip() parameters as a
consequence.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  6 +++---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 14 ++
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  4 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c |  4 ++--
 7 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 8b1225f..61e6e4a 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -407,7 +407,7 @@ void decon_te_irq_handler(struct exynos_drm_crtc *crtc)
writel(val, ctx->addr + DECON_TRIGCON);
}
 
-   drm_handle_vblank(ctx->drm_dev, ctx->pipe);
+   drm_crtc_handle_vblank(&ctx->crtc->base);
 }
 
 static void decon_clear_channels(struct exynos_drm_crtc *crtc)
@@ -533,7 +533,7 @@ static irqreturn_t decon_vsync_irq_handler(int irq, void 
*dev_id)
 
val = readl(ctx->addr + DECON_VIDINTCON1);
if (val & VIDINTCON1_INTFRMPEND) {
-   drm_handle_vblank(ctx->drm_dev, ctx->pipe);
+   drm_crtc_handle_vblank(&ctx->crtc->base);
 
/* clear */
writel(VIDINTCON1_INTFRMPEND, ctx->addr + DECON_VIDINTCON1);
@@ -553,7 +553,7 @@ static irqreturn_t decon_lcd_sys_irq_handler(int irq, void 
*dev_id)
 
val = readl(ctx->addr + DECON_VIDINTCON1);
if (val & VIDINTCON1_INTFRMDONEPEND) {
-   exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
+   exynos_drm_crtc_finish_pageflip(ctx->crtc);
 
/* clear */
writel(VIDINTCON1_INTFRMDONEPEND,
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 362532a..5a1174a 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -643,8 +643,8 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
goto out;
 
if (!ctx->i80_if) {
-   drm_handle_vblank(ctx->drm_dev, ctx->pipe);
-   exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
+   drm_crtc_handle_vblank(&ctx->crtc->base);
+   exynos_drm_crtc_finish_pageflip(ctx->crtc);
 
/* set wait vsync event to zero and wake up queue. */
if (atomic_read(&ctx->wait_vsync_event)) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 22b9ca0..e9c291f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -193,24 +193,22 @@ void exynos_drm_crtc_disable_vblank(struct drm_device 
*dev, int pipe)
exynos_crtc->ops->disable_vblank(exynos_crtc);
 }
 
-void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe)
+void exynos_drm_crtc_finish_pageflip(struct exynos_drm_crtc *exynos_crtc)
 {
-   struct exynos_drm_private *dev_priv = dev->dev_private;
-   struct drm_crtc *drm_crtc = dev_priv->crtc[pipe];
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(drm_crtc);
+   struct drm_crtc *crtc = &exynos_crtc->base;
unsigned long flags;
 
-   spin_lock_irqsave(&dev->event_lock, flags);
+   spin_lock_irqsave(&crtc->dev->event_lock, flags);
if (exynos_crtc->event) {
 
-   drm_send_vblank_event(dev, pipe, exynos_crtc->event);
-   drm_vblank_put(dev, pipe);
+   drm_crtc_send_vblank_event(crtc, exynos_crtc->event);
+   drm_crtc_vblank_put(crtc);
wake_up(&exynos_crtc->pending_flip_queue);
 
}
 
exynos_crtc->event = NULL;
-   spin_unlock_irqrestore(&dev->event_lock, flags);
+   spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 }
 
 void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 0f3aa70..d01d49a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -25,7 +25,7 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
void *context);
 int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe);
 void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe);
-void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe);
+void exynos_drm_crtc_finish_pageflip(struct exynos_drm_crtc *exynos_crtc);
 

[PATCH v2 13/23] drm/exynos: split display's .dpms() into .enable() and .disable()

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

The DRM Core doesn't have a dpms() operation anymore, everything
now is enable() or disable().

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 37 
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 36 
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  6 ++-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 44 ++-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  8 ++--
 drivers/gpu/drm/exynos/exynos_hdmi.c| 65 ++---
 6 files changed, 62 insertions(+), 134 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 172b800..f2cc8f1 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1066,8 +1066,9 @@ static void exynos_dp_phy_exit(struct exynos_dp_device 
*dp)
phy_power_off(dp->phy);
 }
 
-static void exynos_dp_poweron(struct exynos_dp_device *dp)
+static void exynos_dp_enable(struct exynos_drm_display *display)
 {
+   struct exynos_dp_device *dp = display_to_dp(display);
struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
if (dp->dpms_mode == DRM_MODE_DPMS_ON)
@@ -1090,13 +1091,11 @@ static void exynos_dp_poweron(struct exynos_dp_device 
*dp)
exynos_dp_commit(&dp->display);
 }
 
-static void exynos_dp_poweroff(struct exynos_dp_device *dp)
+static void exynos_dp_disable(struct exynos_drm_display *display)
 {
+   struct exynos_dp_device *dp = display_to_dp(display);
struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
-   if (dp->dpms_mode != DRM_MODE_DPMS_ON)
-   return;
-
if (dp->panel) {
if (drm_panel_disable(dp->panel)) {
DRM_ERROR("failed to disable the panel\n");
@@ -1118,28 +1117,10 @@ static void exynos_dp_poweroff(struct exynos_dp_device 
*dp)
}
 }
 
-static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
-{
-   struct exynos_dp_device *dp = display_to_dp(display);
-
-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   exynos_dp_poweron(dp);
-   break;
-   case DRM_MODE_DPMS_STANDBY:
-   case DRM_MODE_DPMS_SUSPEND:
-   case DRM_MODE_DPMS_OFF:
-   exynos_dp_poweroff(dp);
-   break;
-   default:
-   break;
-   }
-   dp->dpms_mode = mode;
-}
-
 static struct exynos_drm_display_ops exynos_dp_display_ops = {
.create_connector = exynos_dp_create_connector,
-   .dpms = exynos_dp_dpms,
+   .enable = exynos_dp_enable,
+   .disable = exynos_dp_disable,
.commit = exynos_dp_commit,
 };
 
@@ -1319,7 +1300,7 @@ static void exynos_dp_unbind(struct device *dev, struct 
device *master,
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_dpms(&dp->display, DRM_MODE_DPMS_OFF);
+   exynos_dp_disable(&dp->display);
 }
 
 static const struct component_ops exynos_dp_ops = {
@@ -1377,7 +1358,7 @@ static int exynos_dp_suspend(struct device *dev)
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_dpms(&dp->display, DRM_MODE_DPMS_OFF);
+   exynos_dp_disable(&dp->display);
return 0;
 }
 
@@ -1385,7 +1366,7 @@ static int exynos_dp_resume(struct device *dev)
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_dpms(&dp->display, DRM_MODE_DPMS_ON);
+   exynos_dp_enable(&dp->display);
return 0;
 }
 #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 7cb6595..e042670 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -32,7 +32,6 @@ struct exynos_dpi {
struct drm_encoder *encoder;
 
struct videomode *vm;
-   int dpms_mode;
 };
 
 #define connector_to_dpi(c) container_of(c, struct exynos_dpi, connector)
@@ -133,46 +132,30 @@ static int exynos_dpi_create_connector(struct 
exynos_drm_display *display,
return 0;
 }
 
-static void exynos_dpi_poweron(struct exynos_dpi *ctx)
+static void exynos_dpi_enable(struct exynos_drm_display *display)
 {
+   struct exynos_dpi *ctx = display_to_dpi(display);
+
if (ctx->panel) {
drm_panel_prepare(ctx->panel);
drm_panel_enable(ctx->panel);
}
 }
 
-static void exynos_dpi_poweroff(struct exynos_dpi *ctx)
+static void exynos_dpi_disable(struct exynos_drm_display *display)
 {
+   struct exynos_dpi *ctx = display_to_dpi(display);
+
if (ctx->panel) {
drm_panel_disable(ctx->panel);
drm_panel_unprepare(ctx->panel);
}
 }
 
-static void exynos_dpi_dpms(struct exynos_drm_display *display, int mode)
-{
-   struct exynos_dpi *ctx = display_to_dpi(display);
-
-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   if (ctx->dpms_mode != DRM_MODE_DPMS_ON)
-  

[PATCH v2 10/23] drm/exynos: unify exynos_drm_plane names with drm core

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

Rename crtc_{widht,height} to crtc_{w,h} and src_{width,height} to
src_{w,h} to make it similar to the atomic state names.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 10 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 14 +++---
 drivers/gpu/drm/exynos/exynos_drm_drv.h   | 16 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 14 +++---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 ++-
 drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++---
 6 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index dd41390..e50e6bb 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -237,8 +237,8 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
val = COORDINATE_X(plane->crtc_x) | COORDINATE_Y(plane->crtc_y);
writel(val, ctx->addr + DECON_VIDOSDxA(win));
 
-   val = COORDINATE_X(plane->crtc_x + plane->crtc_width - 1) |
-   COORDINATE_Y(plane->crtc_y + plane->crtc_height - 1);
+   val = COORDINATE_X(plane->crtc_x + plane->crtc_w - 1) |
+   COORDINATE_Y(plane->crtc_y + plane->crtc_h - 1);
writel(val, ctx->addr + DECON_VIDOSDxB(win));
 
val = VIDOSD_Wx_ALPHA_R_F(0x0) | VIDOSD_Wx_ALPHA_G_F(0x0) |
@@ -251,11 +251,11 @@ static void decon_update_plane(struct exynos_drm_crtc 
*crtc,
 
writel(plane->dma_addr[0], ctx->addr + DECON_VIDW0xADD0B0(win));
 
-   val = plane->dma_addr[0] + pitch * plane->crtc_height;
+   val = plane->dma_addr[0] + pitch * plane->crtc_h;
writel(val, ctx->addr + DECON_VIDW0xADD1B0(win));
 
-   val = OFFSIZE(pitch - plane->crtc_width * bpp)
-   | PAGEWIDTH(plane->crtc_width * bpp);
+   val = OFFSIZE(pitch - plane->crtc_w * bpp)
+   | PAGEWIDTH(plane->crtc_w * bpp);
writel(val, ctx->addr + DECON_VIDW0xADD2(win));
 
decon_win_set_pixfmt(ctx, win, state->fb);
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 7f00a20..85657cf 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -429,25 +429,25 @@ static void decon_update_plane(struct exynos_drm_crtc 
*crtc,
DRM_DEBUG_KMS("start addr = 0x%lx\n",
(unsigned long)val);
DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
-   plane->crtc_width, plane->crtc_height);
+   plane->crtc_w, plane->crtc_h);
 
/*
 * OSD position.
 * In case the window layout goes of LCD layout, DECON fails.
 */
-   if ((plane->crtc_x + plane->crtc_width) > mode->hdisplay)
-   plane->crtc_x = mode->hdisplay - plane->crtc_width;
-   if ((plane->crtc_y + plane->crtc_height) > mode->vdisplay)
-   plane->crtc_y = mode->vdisplay - plane->crtc_height;
+   if ((plane->crtc_x + plane->crtc_w) > mode->hdisplay)
+   plane->crtc_x = mode->hdisplay - plane->crtc_w;
+   if ((plane->crtc_y + plane->crtc_h) > mode->vdisplay)
+   plane->crtc_y = mode->vdisplay - plane->crtc_h;
 
val = VIDOSDxA_TOPLEFT_X(plane->crtc_x) |
VIDOSDxA_TOPLEFT_Y(plane->crtc_y);
writel(val, ctx->regs + VIDOSD_A(win));
 
-   last_x = plane->crtc_x + plane->crtc_width;
+   last_x = plane->crtc_x + plane->crtc_w;
if (last_x)
last_x--;
-   last_y = plane->crtc_y + plane->crtc_height;
+   last_y = plane->crtc_y + plane->crtc_h;
if (last_y)
last_y--;
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index bec388a..5bd1d3c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -44,12 +44,12 @@ enum exynos_drm_output_type {
  * - the unit is screen coordinates.
  * @src_y: offset y on a framebuffer to be displayed.
  * - the unit is screen coordinates.
- * @src_width: width of a partial image to be displayed from framebuffer.
- * @src_height: height of a partial image to be displayed from framebuffer.
+ * @src_w: width of a partial image to be displayed from framebuffer.
+ * @src_h: height of a partial image to be displayed from framebuffer.
  * @crtc_x: offset x on hardware screen.
  * @crtc_y: offset y on hardware screen.
- * @crtc_width: window width to be displayed (hardware screen).
- * @crtc_height: window height to be displayed (hardware screen).
+ * @crtc_w: window width to be displayed (hardware screen).
+ * @crtc_h: window height to be displayed (hardware screen).
  * @h_ratio: horizontal scaling ratio, 16.16 fixed point
  * @v_ratio: vertical scaling ratio, 16.16 fixed point
  * @dma_addr: array of b

[PATCH v2 00/23] drm/exynos: atomic improvements + exynos_encoder removal

2015-07-06 Thread Gustavo Padovan
From: Gustavo Padovan 

Hi, 

This set improves exynos in a number of ways. The first five patches are
general clean up/fixes. 

Patches 06 to 12 are improvements on top of the newly added atomic modesetting  
support.

Patches 13-23 are a big journey to completely remove the internal   
exynos_drm_encoder struct. Now exynos encoders register themselves directly 
with the drm core.  

v2: Fix comments by Joonyoung   
- add an extra commit to check crtc->enable_vblank() value  
- directly assign the vrefresh without checking for zero
- don't remove FIMD ctc->suspended check

Please review!  

Gustavo

Gustavo Padovan (23):
  drm/exynos: pass the correct pipe number
  drm/exynos: calculate vrefresh instead of use a fixed value
  drm/exynos: use KMS version of DRM vblanks functions
  drm/exynos: remove duplicated check for suspend
  drm/exynos: add atomic asynchronous commit
  drm/exynos: rename win_commit/disable to atomic-like names
  drm/exynos: pass struct exynos_drm_plane in update/enable
  drm/exynos: use drm atomic state directly
  drm/exynos: remove unused fields from struct exynos_drm_plane
  drm/exynos: unify exynos_drm_plane names with drm core
  drm/exynos: return return value of exynos_crtc->enable_vblank
  drm/exynos: don't track enabled state at exynos_crtc
  drm/exynos: split display's .dpms() into .enable() and .disable()
  drm/exynos: remove wrappers for phy_power_{on,off}
  drm/exynos: remove unused .remove() and .check_mode() ops from display
  drm/exynos: simplify calculation of possible CRTCs
  drm/exynos: remove struct exynos_drm_display
  drm/exynos: remove extra call to hdmi_commit()
  drm/exynos: remove extra call to exynos_dp_commit()
  drm/exynos: remove exynos_encoder's .commit() op
  drm/exynos: remove exynos_drm_create_enc_conn()
  drm/exynos: fold encoder setup into exynos_drm_load()
  drm/exynos: remove struct exynos_drm_encoder layer

 drivers/gpu/drm/exynos/Makefile   |   7 +-
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  57 -
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  86 ++---
 drivers/gpu/drm/exynos/exynos_dp_core.c   | 122 +-
 drivers/gpu/drm/exynos/exynos_dp_core.h   |   3 +-
 drivers/gpu/drm/exynos/exynos_drm_core.c  |  36 --
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |  35 ++
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_dpi.c   |  96 +++---
 drivers/gpu/drm/exynos/exynos_drm_drv.c   |  19 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h   | 115 +
 drivers/gpu/drm/exynos/exynos_drm_dsi.c   | 129 ++-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 174 --
 drivers/gpu/drm/exynos/exynos_drm_encoder.h   |  23 
 drivers/gpu/drm/exynos/exynos_drm_fb.c|  51 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  95 +++---
 drivers/gpu/drm/exynos/exynos_drm_plane.c |  31 ++---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 107 +---
 drivers/gpu/drm/exynos/exynos_hdmi.c  | 168 -
 drivers/gpu/drm/exynos/exynos_mixer.c | 111 
 20 files changed, 595 insertions(+), 874 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h

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


[PATCHv5] ARM: dts: add exynos5422-cpus.dtsi to correct cpu order

2015-07-06 Thread Chanho Park
The odroid-xu3 board which is based on exynos5422 not exynos5800 is
booted from cortex-a7 core unlike exynos5800. The odroid-xu3's cpu order
is quite strange. cpu0 and cpu5-7 are cortex-a7 cores and cpu1-4 are
cortex-a15 cores. To correct this mis-odering, I added exynos5422.dtsi
and reversing cpu orders from exynos5420. Now, cpu0-3 are cortex-a7 and
cpu4-7 are cortex-a15.

Reviewed-by: Krzysztof Kozlowski 
Signed-off-by: Chanho Park 
---
Changes from v4:
 - Remove temporal patch in e-mail body

Changes from v3:
 - include this exynos5422-cpus.dtsi in the exynos5422-odroidxu3-common.dtsi

Changes from v2:
 - drop inclusion of exynos5420.dtsi from exynos5422-cpus.dtsi
 - drop compatibles from exynos5422-cpus.dtsi

Changes from v1:
 - rename exynos5422.dtsi to exynos5422-cpus.dtsi
 - include the dtsi file top of the exynos5422-odroidxu3.dts

Secondary cpu booting problem[1] is not resolved yet. Need more investigations
to work booting 8 cores correctly.

[1]: http://www.spinics.net/lists/linux-samsung-soc/msg45525.html

 arch/arm/boot/dts/exynos5422-cpus.dtsi | 81 ++
 arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi |  1 +
 2 files changed, 82 insertions(+)
 create mode 100644 arch/arm/boot/dts/exynos5422-cpus.dtsi

diff --git a/arch/arm/boot/dts/exynos5422-cpus.dtsi 
b/arch/arm/boot/dts/exynos5422-cpus.dtsi
new file mode 100644
index 000..b7f60c8
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5422-cpus.dtsi
@@ -0,0 +1,81 @@
+/*
+ * SAMSUNG EXYNOS5422 SoC cpu device tree source
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * The only difference between EXYNOS5422 and EXYNOS5800 is cpu ordering. The
+ * EXYNOS5422 is booting from Cortex-A7 core while the EXYNOS5800 is booting
+ * from Cortex-A15 core.
+ *
+ * EXYNOS5422 based board files can include this file to provide cpu ordering
+ * which could boot a cortex-a7 from cpu0.
+ *
+ * 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.
+ */
+
+&cpu0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a7";
+   reg = <0x100>;
+   clock-frequency = <10>;
+   cci-control-port = <&cci_control0>;
+};
+
+&cpu1 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a7";
+   reg = <0x101>;
+   clock-frequency = <10>;
+   cci-control-port = <&cci_control0>;
+};
+
+&cpu2 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a7";
+   reg = <0x102>;
+   clock-frequency = <10>;
+   cci-control-port = <&cci_control0>;
+};
+
+&cpu3 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a7";
+   reg = <0x103>;
+   clock-frequency = <10>;
+   cci-control-port = <&cci_control0>;
+};
+
+&cpu4 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <0x0>;
+   clock-frequency = <18>;
+   cci-control-port = <&cci_control1>;
+};
+
+&cpu5 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <0x1>;
+   clock-frequency = <18>;
+   cci-control-port = <&cci_control1>;
+};
+
+&cpu6 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <0x2>;
+   clock-frequency = <18>;
+   cci-control-port = <&cci_control1>;
+};
+
+&cpu7 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <0x3>;
+   clock-frequency = <18>;
+   cci-control-port = <&cci_control1>;
+};
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi 
b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
index 8adf455..f603133 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include "exynos5800.dtsi"
+#include "exynos5422-cpus.dtsi"
 
 / {
memory {
-- 
2.1.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: [PATCHv4] ARM: dts: add exynos5422-cpus.dtsi to correct cpu order

2015-07-06 Thread Chanho Park
Hi,

On Mon, Jul 6, 2015 at 9:52 AM, Krzysztof Kozlowski
 wrote:
> On 05.07.2015 23:29, Chanho Park wrote:
>> The odroid-xu3 board which is based on exynos5422 not exynos5800 is
>> booted from cortex-a7 core unlike exynos5800. The odroid-xu3's cpu order
>> is quite strange. cpu0 and cpu5-7 are cortex-a7 cores and cpu1-4 are
>> cortex-a15 cores. To correct this mis-odering, I added exynos5422.dtsi
>> and reversing cpu orders from exynos5420. Now, cpu0-3 are cortex-a7 and
>> cpu4-7 are cortex-a15.
>>
>> Reviewed-by: Krzysztof Kozlowski 
>> Signed-off-by: Chanho Park 
>> ---
>> Changes from v3:
>>  - include this exynos5422-cpus.dtsi in the exynos5422-odroidxu3-common.dtsi
>>
>> Changes from v2:
>>  - drop inclusion of exynos5420.dtsi from exynos5422-cpus.dtsi
>>  - drop compatibles from exynos5422-cpus.dtsi
>>
>> Changes from v1:
>>  - rename exynos5422.dtsi to exynos5422-cpus.dtsi
>>  - include the dtsi file top of the exynos5422-odroidxu3.dts
>>
>> Secondary cpu booting problem[1] is not resolved yet. Below temporal patch is
>> required to see 8 cores booting.
>>
>> --- a/arch/arm/mach-exynos/platsmp.c
>> +++ b/arch/arm/mach-exynos/platsmp.c
>> @@ -124,6 +124,7 @@ void exynos_cpu_power_up(int cpu)
>> if (soc_is_exynos3250())
>> core_conf |= S5P_CORE_AUTOWAKEUP_EN;
>>
>> +   pmu_raw_writel(1, S5P_PMU_SPARE2);
>> pmu_raw_writel(core_conf,
>> EXYNOS_ARM_CORE_CONFIGURATION(cpu));
>>  }
>>
>> [1]: http://www.spinics.net/lists/linux-samsung-soc/msg45525.html
>
> $ git am ...
> Applying: ARM: dts: add exynos5422-cpus.dtsi to correct cpu order
> error: patch failed: arch/arm/mach-exynos/platsmp.c:124
> error: arch/arm/mach-exynos/platsmp.c: patch does not apply
>
> The diff above confuses 'git am'.

Oops. I'll re-send patch without the codes.

-- 
Best Regards,
Chanho Park
--
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] thermal: consistently use int for temperatures

2015-07-06 Thread Lukasz Majewski
Hi Sascha,

> The thermal code uses int, long and unsigned long for temperatures
> in different places.
> 
> Using an unsigned type limits the thermal framework to positive
> temperatures without need. Also several drivers currently will report
> temperatures near UINT_MAX for temperatures below 0°C. This will
> probably immediately shut the machine down due to overtemperature if
> started below 0°C.
> 
> 'long' is 64bit on several architectures. This is not needed since
> INT_MAX °mC is above the melting point of all known materials.
> 
> Consistently use a plain 'int' for temperatures throughout the
> thermal code and the drivers. This only changes the places in the
> drivers where the temperature is passed around as pointer, when
> drivers internally use another type this is not changed.
> 
> Signed-off-by: Sascha Hauer 

Sascha, thanks for this cleanup work. 

Reviewed-by: Lukasz Majewski 

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
--
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] thermal: consistently use int for temperatures

2015-07-06 Thread Jean Delvare
On Mon,  6 Jul 2015 09:19:49 +0200, Sascha Hauer wrote:
> The thermal code uses int, long and unsigned long for temperatures
> in different places.
> 
> Using an unsigned type limits the thermal framework to positive
> temperatures without need. Also several drivers currently will report
> temperatures near UINT_MAX for temperatures below 0°C. This will probably
> immediately shut the machine down due to overtemperature if started below
> 0°C.
> 
> 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
> is above the melting point of all known materials.
> 
> Consistently use a plain 'int' for temperatures throughout the thermal code 
> and
> the drivers. This only changes the places in the drivers where the temperature
> is passed around as pointer, when drivers internally use another type this is
> not changed.
> 
> Signed-off-by: Sascha Hauer 
> Cc: Zhang Rui 
> Cc: Eduardo Valentin 
> Cc: linux...@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org
> Cc: Jean Delvare 
> Cc: Peter Feuerer 
> Cc: Heiko Stuebner 
> Cc: Lukasz Majewski 
> Cc: Stephen Warren 
> Cc: Thierry Reding 
> Cc: linux-a...@vger.kernel.org
> Cc: platform-driver-...@vger.kernel.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-o...@vger.kernel.org
> Cc: linux-samsung-soc@vger.kernel.org
> Cc: Guenter Roeck 
> Cc: Rafael J. Wysocki 
> Cc: Maxime Ripard 
> Cc: Darren Hart 
> Cc: lm-sens...@lm-sensors.org
> ---
>  drivers/acpi/thermal.c | 12 +-
>  drivers/hwmon/lm75.c   |  2 +-
>  drivers/hwmon/ntc_thermistor.c |  2 +-
>  drivers/hwmon/tmp102.c |  2 +-
>  drivers/input/touchscreen/sun4i-ts.c   |  8 +++
>  drivers/platform/x86/acerhdf.c |  9 
>  drivers/platform/x86/intel_mid_thermal.c   |  9 
>  drivers/power/power_supply_core.c  |  2 +-
>  drivers/thermal/armada_thermal.c   |  2 +-
>  drivers/thermal/db8500_thermal.c   |  7 +++---
>  drivers/thermal/dove_thermal.c |  2 +-
>  drivers/thermal/fair_share.c   |  2 +-
>  drivers/thermal/gov_bang_bang.c|  5 ++--
>  drivers/thermal/hisi_thermal.c |  4 ++--
>  drivers/thermal/imx_thermal.c  | 27 
> +++---
>  drivers/thermal/int340x_thermal/int3400_thermal.c  |  2 +-
>  .../thermal/int340x_thermal/int340x_thermal_zone.c | 10 
>  .../thermal/int340x_thermal/int340x_thermal_zone.h |  8 +++
>  .../int340x_thermal/processor_thermal_device.c |  4 ++--
>  drivers/thermal/intel_quark_dts_thermal.c  | 13 +--
>  drivers/thermal/intel_soc_dts_iosf.c   |  8 +++
>  drivers/thermal/kirkwood_thermal.c |  2 +-
>  drivers/thermal/of-thermal.c   | 14 +--
>  drivers/thermal/power_allocator.c  | 16 ++---
>  drivers/thermal/qcom-spmi-temp-alarm.c |  2 +-
>  drivers/thermal/rcar_thermal.c |  7 +++---
>  drivers/thermal/rockchip_thermal.c | 10 
>  drivers/thermal/samsung/exynos_tmu.c   | 23 +-
>  drivers/thermal/spear_thermal.c|  2 +-
>  drivers/thermal/st/st_thermal.c|  5 ++--
>  drivers/thermal/step_wise.c|  4 ++--
>  drivers/thermal/tegra_soctherm.c   |  4 ++--
>  drivers/thermal/thermal_core.c | 26 ++---
>  drivers/thermal/thermal_hwmon.c| 10 
>  drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 10 
>  drivers/thermal/x86_pkg_temp_thermal.c | 10 
>  include/linux/thermal.h| 26 +
>  37 files changed, 148 insertions(+), 163 deletions(-)
> (...)

No objection from me.

For the hwmon parts:

Reviewed-by: Jean Delvare 

-- 
Jean Delvare
SUSE L3 Support
--
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] thermal: consistently use int for temperatures

2015-07-06 Thread Geert Uytterhoeven
On Mon, Jul 6, 2015 at 9:19 AM, Sascha Hauer  wrote:
> The thermal code uses int, long and unsigned long for temperatures
> in different places.
>
> Using an unsigned type limits the thermal framework to positive
> temperatures without need. Also several drivers currently will report
> temperatures near UINT_MAX for temperatures below 0°C. This will probably
> immediately shut the machine down due to overtemperature if started below
> 0°C.
>
> 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
> is above the melting point of all known materials.
>
> Consistently use a plain 'int' for temperatures throughout the thermal code 
> and
> the drivers. This only changes the places in the drivers where the temperature
> is passed around as pointer, when drivers internally use another type this is
> not changed.
>
> Signed-off-by: Sascha Hauer 
> Cc: Zhang Rui 
> Cc: Eduardo Valentin 
> Cc: linux...@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org
> Cc: Jean Delvare 
> Cc: Peter Feuerer 
> Cc: Heiko Stuebner 
> Cc: Lukasz Majewski 
> Cc: Stephen Warren 
> Cc: Thierry Reding 
> Cc: linux-a...@vger.kernel.org
> Cc: platform-driver-...@vger.kernel.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-o...@vger.kernel.org
> Cc: linux-samsung-soc@vger.kernel.org
> Cc: Guenter Roeck 
> Cc: Rafael J. Wysocki 
> Cc: Maxime Ripard 
> Cc: Darren Hart 
> Cc: lm-sens...@lm-sensors.org

For rcar-thermal:
Acked-by: Geert Uytterhoeven 

> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index fe4e767..5d4ae7d 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -200,8 +200,7 @@ err_out_unlock:
> return ret;
>  }
>
> -static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
> -unsigned long *temp)
> +static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
>  {
> struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
>
> @@ -235,7 +234,7 @@ static int rcar_thermal_get_trip_type(struct 
> thermal_zone_device *zone,
>  }
>
>  static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone,
> - int trip, unsigned long *temp)
> + int trip, int *temp)
>  {
> struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> struct device *dev = rcar_priv_to_dev(priv);
> @@ -299,7 +298,7 @@ static void _rcar_thermal_irq_ctrl(struct 
> rcar_thermal_priv *priv, int enable)
>  static void rcar_thermal_work(struct work_struct *work)
>  {
> struct rcar_thermal_priv *priv;
> -   unsigned long cctemp, nctemp;
> +   int cctemp, nctemp;
>
> priv = container_of(work, struct rcar_thermal_priv, work.work);
>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] thermal: consistently use int for temperatures

2015-07-06 Thread Sascha Hauer
The thermal code uses int, long and unsigned long for temperatures
in different places.

Using an unsigned type limits the thermal framework to positive
temperatures without need. Also several drivers currently will report
temperatures near UINT_MAX for temperatures below 0°C. This will probably
immediately shut the machine down due to overtemperature if started below
0°C.

'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
is above the melting point of all known materials.

Consistently use a plain 'int' for temperatures throughout the thermal code and
the drivers. This only changes the places in the drivers where the temperature
is passed around as pointer, when drivers internally use another type this is
not changed.

Signed-off-by: Sascha Hauer 
Cc: Zhang Rui 
Cc: Eduardo Valentin 
Cc: linux...@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
Cc: Jean Delvare 
Cc: Peter Feuerer 
Cc: Heiko Stuebner 
Cc: Lukasz Majewski 
Cc: Stephen Warren 
Cc: Thierry Reding 
Cc: linux-a...@vger.kernel.org
Cc: platform-driver-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-o...@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: Guenter Roeck 
Cc: Rafael J. Wysocki 
Cc: Maxime Ripard 
Cc: Darren Hart 
Cc: lm-sens...@lm-sensors.org
---
 drivers/acpi/thermal.c | 12 +-
 drivers/hwmon/lm75.c   |  2 +-
 drivers/hwmon/ntc_thermistor.c |  2 +-
 drivers/hwmon/tmp102.c |  2 +-
 drivers/input/touchscreen/sun4i-ts.c   |  8 +++
 drivers/platform/x86/acerhdf.c |  9 
 drivers/platform/x86/intel_mid_thermal.c   |  9 
 drivers/power/power_supply_core.c  |  2 +-
 drivers/thermal/armada_thermal.c   |  2 +-
 drivers/thermal/db8500_thermal.c   |  7 +++---
 drivers/thermal/dove_thermal.c |  2 +-
 drivers/thermal/fair_share.c   |  2 +-
 drivers/thermal/gov_bang_bang.c|  5 ++--
 drivers/thermal/hisi_thermal.c |  4 ++--
 drivers/thermal/imx_thermal.c  | 27 +++---
 drivers/thermal/int340x_thermal/int3400_thermal.c  |  2 +-
 .../thermal/int340x_thermal/int340x_thermal_zone.c | 10 
 .../thermal/int340x_thermal/int340x_thermal_zone.h |  8 +++
 .../int340x_thermal/processor_thermal_device.c |  4 ++--
 drivers/thermal/intel_quark_dts_thermal.c  | 13 +--
 drivers/thermal/intel_soc_dts_iosf.c   |  8 +++
 drivers/thermal/kirkwood_thermal.c |  2 +-
 drivers/thermal/of-thermal.c   | 14 +--
 drivers/thermal/power_allocator.c  | 16 ++---
 drivers/thermal/qcom-spmi-temp-alarm.c |  2 +-
 drivers/thermal/rcar_thermal.c |  7 +++---
 drivers/thermal/rockchip_thermal.c | 10 
 drivers/thermal/samsung/exynos_tmu.c   | 23 +-
 drivers/thermal/spear_thermal.c|  2 +-
 drivers/thermal/st/st_thermal.c|  5 ++--
 drivers/thermal/step_wise.c|  4 ++--
 drivers/thermal/tegra_soctherm.c   |  4 ++--
 drivers/thermal/thermal_core.c | 26 ++---
 drivers/thermal/thermal_hwmon.c| 10 
 drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 10 
 drivers/thermal/x86_pkg_temp_thermal.c | 10 
 include/linux/thermal.h| 26 +
 37 files changed, 148 insertions(+), 163 deletions(-)

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 6d4e44e..e66ad25 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -529,8 +529,7 @@ static void acpi_thermal_check(void *data)
 
 /* sys I/F for generic thermal sysfs support */
 
-static int thermal_get_temp(struct thermal_zone_device *thermal,
-   unsigned long *temp)
+static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
 {
struct acpi_thermal *tz = thermal->devdata;
int result;
@@ -637,7 +636,7 @@ static int thermal_get_trip_type(struct thermal_zone_device 
*thermal,
 }
 
 static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
-int trip, unsigned long *temp)
+int trip, int *temp)
 {
struct acpi_thermal *tz = thermal->devdata;
int i;
@@ -690,7 +689,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device 
*thermal,
 }
 
 static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
-   unsigned long *temperature) {
+   int *temperature)
+{
struct acpi_thermal *tz = thermal->devdata;
 
if (tz

Re: [PATCH] thermal: exynos: Disable the regulator on probe failure

2015-07-06 Thread Lukasz Majewski
Hi Krzysztof,

> 2015-06-09 1:14 GMT+09:00 Lukasz Majewski :
> > Hi Krzysztof,
> >
> >> During probe the regulator (if present) was enabled but not
> >> disabled in case of failure. So an unsuccessful probe lead to
> >> enabling the regulator which was actually not needed because the
> >> device was not enabled.
> >>
> >> Additionally each deferred probe lead to increase of regulator
> >> enable count so it would not be effectively disabled during
> >> removal of the device.
> >
> > Thanks for catching this.
> >
> >>
> >> Signed-off-by: Krzysztof Kozlowski 
> >> Fixes: 498d22f616f6 ("thermal: exynos: Support for TMU regulator
> >> defined at device tree") Cc: 
> >>
> >> ---
> >>
> >> I am not entirely convinced that this should go to stable. Leaving
> >> a regulator enabled in case of probe failure (no exynos TMU
> >> device) or after deferred probe (regulator won't be disabled
> >> during device removal) is not a critical issue, just leaks power.
> >> ---
> >>  drivers/thermal/samsung/exynos_tmu.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> >> b/drivers/thermal/samsung/exynos_tmu.c index
> >> 531f4b179871..13c3aceed19d 100644 ---
> >> a/drivers/thermal/samsung/exynos_tmu.c +++
> >> b/drivers/thermal/samsung/exynos_tmu.c @@ -1392,6 +1392,8 @@
> >> err_clk_sec: if (!IS_ERR(data->clk_sec))
> >>   clk_unprepare(data->clk_sec);
> >>  err_sensor:
> >> + if (!IS_ERR_OR_NULL(data->regulator))
> >> + regulator_disable(data->regulator);
> >>   thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
> >>
> >>   return ret;
> >
> > Acked-by: Lukasz Majewski 
> >
> > I will test it and afterwards add to samsung-thermal tree.
> 
> Hi Łukasz,
> 
> I can't find this patch in v4.2-rc1 or your tree. What happened?

I will got together with Chanowoo patches. I will send PR today to
Eduardo.

> 
> Best regards,
> Krzysztof



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
--
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] thermal: exynos: Disable the regulator on probe failure

2015-07-06 Thread Krzysztof Kozlowski
On 06.07.2015 16:01, Lukasz Majewski wrote:
> Hi Krzysztof,
> 
>> 2015-06-09 1:14 GMT+09:00 Lukasz Majewski :
>>> Hi Krzysztof,
>>>
 During probe the regulator (if present) was enabled but not
 disabled in case of failure. So an unsuccessful probe lead to
 enabling the regulator which was actually not needed because the
 device was not enabled.

 Additionally each deferred probe lead to increase of regulator
 enable count so it would not be effectively disabled during
 removal of the device.
>>>
>>> Thanks for catching this.
>>>

 Signed-off-by: Krzysztof Kozlowski 
 Fixes: 498d22f616f6 ("thermal: exynos: Support for TMU regulator
 defined at device tree") Cc: 

 ---

 I am not entirely convinced that this should go to stable. Leaving
 a regulator enabled in case of probe failure (no exynos TMU
 device) or after deferred probe (regulator won't be disabled
 during device removal) is not a critical issue, just leaks power.
 ---
  drivers/thermal/samsung/exynos_tmu.c | 2 ++
  1 file changed, 2 insertions(+)

 diff --git a/drivers/thermal/samsung/exynos_tmu.c
 b/drivers/thermal/samsung/exynos_tmu.c index
 531f4b179871..13c3aceed19d 100644 ---
 a/drivers/thermal/samsung/exynos_tmu.c +++
 b/drivers/thermal/samsung/exynos_tmu.c @@ -1392,6 +1392,8 @@
 err_clk_sec: if (!IS_ERR(data->clk_sec))
   clk_unprepare(data->clk_sec);
  err_sensor:
 + if (!IS_ERR_OR_NULL(data->regulator))
 + regulator_disable(data->regulator);
   thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);

   return ret;
>>>
>>> Acked-by: Lukasz Majewski 
>>>
>>> I will test it and afterwards add to samsung-thermal tree.
>>
>> Hi Łukasz,
>>
>> I can't find this patch in v4.2-rc1 or your tree. What happened?
> 
> I will got together with Chanowoo patches. I will send PR today to
> Eduardo.

Thanks!

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