Re: [PATCH v9 16/18] drm/exynos: split exynos_crtc->dpms in enable() and disable()

2015-05-28 Thread Joonyoung Shim
On 05/29/2015 06:42 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> To follow more closely the new atomic API we split the dpms()
> helper into the enable() and disable() helper to get exactly the
> same semantics.
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/exynos/exynos7_drm_decon.c | 31 +
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c   |  8 ++---
>  drivers/gpu/drm/exynos/exynos_drm_drv.h|  6 ++--
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 31 +
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c   | 55 
> --
>  drivers/gpu/drm/exynos/exynos_mixer.c  | 32 ++---
>  6 files changed, 56 insertions(+), 107 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
> b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> index 6714e5b..0008658 100644
> --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> @@ -603,8 +603,9 @@ static void decon_init(struct decon_context *ctx)
>   writel(VIDCON1_VCLK_HOLD, ctx->regs + VIDCON1(0));
>  }
>  
> -static int decon_poweron(struct decon_context *ctx)
> +static int decon_enable(struct exynos_drm_crtc *crtc)
>  {
> + struct decon_context *ctx = crtc->ctx;
>   int ret;
>  
>   if (!ctx->suspended)
> @@ -668,8 +669,10 @@ pclk_err:
>   return ret;
>  }
>  
> -static int decon_poweroff(struct decon_context *ctx)
> +static int decon_disable(struct exynos_drm_crtc *crtc)
>  {
> + struct decon_context *ctx = crtc->ctx;
> +
>   if (ctx->suspended)
>   return 0;
>  
> @@ -691,27 +694,9 @@ static int decon_poweroff(struct decon_context *ctx)
>   return 0;
>  }
>  
> -static void decon_dpms(struct exynos_drm_crtc *crtc, int mode)
> -{
> - DRM_DEBUG_KMS("%s, %d\n", __FILE__, mode);
> -
> - switch (mode) {
> - case DRM_MODE_DPMS_ON:
> - decon_poweron(crtc->ctx);
> - break;
> - case DRM_MODE_DPMS_STANDBY:
> - case DRM_MODE_DPMS_SUSPEND:
> - case DRM_MODE_DPMS_OFF:
> - decon_poweroff(crtc->ctx);
> - break;
> - default:
> - DRM_DEBUG_KMS("unspecified mode %d\n", mode);
> - break;
> - }
> -}
> -
>  static const struct exynos_drm_crtc_ops decon_crtc_ops = {
> - .dpms = decon_dpms,
> + .enable = decon_enable,
> + .disable = decon_disable,
>   .mode_fixup = decon_mode_fixup,
>   .commit = decon_commit,
>   .enable_vblank = decon_enable_vblank,
> @@ -796,7 +781,7 @@ static void decon_unbind(struct device *dev, struct 
> device *master,
>  {
>   struct decon_context *ctx = dev_get_drvdata(dev);
>  
> - decon_dpms(ctx->crtc, DRM_MODE_DPMS_OFF);
> + decon_disable(ctx->crtc);
>  
>   if (ctx->display)
>   exynos_dpi_remove(ctx->display);
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index b7c6d51..644b4b7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -29,8 +29,8 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
>   if (exynos_crtc->enabled)
>   return;
>  
> - if (exynos_crtc->ops->dpms)
> - exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);
> + if (exynos_crtc->ops->enable)
> + exynos_crtc->ops->enable(exynos_crtc);
>  
>   exynos_crtc->enabled = true;
>  
> @@ -51,8 +51,8 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
>  
>   drm_crtc_vblank_off(crtc);
>  
> - if (exynos_crtc->ops->dpms)
> - exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
> + if (exynos_crtc->ops->disable)
> + exynos_crtc->ops->disable(exynos_crtc);
>  
>   exynos_crtc->enabled = false;
>  }
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> index 86d6894..a3053a2 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> @@ -157,7 +157,8 @@ struct exynos_drm_display {
>  /*
>   * Exynos drm crtc ops
>   *
> - * @dpms: control device power.
> + * @enable: enable the device
> + * @disable: disable the device
>   * @mode_fixup: fix mode data before applying it
>   * @commit: set current hw specific display mode to hw.
>   * @enable_vblank: specific driver callback for enabling vblank interrupt.
> @@ -175,7 +176,8 @@ struct exynos_drm_display {
>   */
>  struct exynos_drm_crtc;
>  struct exynos_drm_crtc_ops {
> - void (*dpms)(struct exynos_drm_crtc *crtc, int mode);
> + int (*enable)(struct exynos_drm_crtc *crtc);
> + int (*disable)(struct exynos_drm_crtc *crtc);

Need return value for .enable and .disable? It's better to use void
because there is no any care about the result. It's possible to not
return .enable functions of fimd and decon driver.

Anyway, more patches including 17/18 can be difficult to merge atomic

Re: [PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-28 Thread Joonyoung Shim
On 05/29/2015 06:36 AM, Gustavo Padovan wrote:
> 2015-05-28 Joonyoung Shim :
> 
>> On 05/28/2015 05:24 PM, Joonyoung Shim wrote:
>>> On 05/28/2015 02:39 PM, Inki Dae wrote:
 Hi Gustavo,

 On 2015년 05월 28일 05:27, Gustavo Padovan wrote:
> Hi Inki,
>
> 2015-05-27 Inki Dae :
>
>> Hi Gustavo,
>>
>> On 2015년 05월 23일 00:40, Gustavo Padovan wrote:
>>> From: Gustavo Padovan 
>>>
>>> Run dpms operations through the atomic intefaces. This basically removes
>>> the .dpms() callback from econders and crtcs and use .disable() and
>>> .enable() to turn the crtc on and off.
>>>
>>> v2: Address comments by Joonyoung:
>>> - make hdmi code call ->disable() instead of ->dpms()
>>> - do not use WARN_ON on crtc enable/disable
>>>
>>> v3: - Fix build failure after the hdmi change in v2
>>> - Change dpms helper of ptn3460 bridge
>>>
>>> Signed-off-by: Gustavo Padovan 
>>> Reviewed-by: Joonyoung Shim 
>>> Tested-by: Tobias Jakobi 
>>> ---
>>>  drivers/gpu/drm/bridge/ps8622.c |  2 +-
>>>  drivers/gpu/drm/bridge/ptn3460.c|  2 +-
>>>  drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 
>>> -
>>>  drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
>>>  drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
>>>  drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
>>>  10 files changed, 69 insertions(+), 75 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/bridge/ps8622.c 
>>> b/drivers/gpu/drm/bridge/ps8622.c
>>> index b604326..d686235 100644
>>> --- a/drivers/gpu/drm/bridge/ps8622.c
>>> +++ b/drivers/gpu/drm/bridge/ps8622.c
>>> @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct 
>>> drm_connector *connector)
>>>  }
>>>  
>>>  static const struct drm_connector_funcs ps8622_connector_funcs = {
>>> -   .dpms = drm_helper_connector_dpms,
>>> +   .dpms = drm_atomic_helper_connector_dpms,
>>> .fill_modes = drm_helper_probe_single_connector_modes,
>>> .detect = ps8622_detect,
>>> .destroy = ps8622_connector_destroy,
>>> diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
>>> b/drivers/gpu/drm/bridge/ptn3460.c
>>> index 8ed3617..260bc9f 100644
>>> --- a/drivers/gpu/drm/bridge/ptn3460.c
>>> +++ b/drivers/gpu/drm/bridge/ptn3460.c
>>> @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
>>> drm_connector *connector)
>>>  }
>>>  
>>>  static struct drm_connector_funcs ptn3460_connector_funcs = {
>>> -   .dpms = drm_helper_connector_dpms,
>>> +   .dpms = drm_atomic_helper_connector_dpms,
>>> .fill_modes = drm_helper_probe_single_connector_modes,
>>> .detect = ptn3460_detect,
>>> .destroy = ptn3460_connector_destroy,
>>> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
>>> b/drivers/gpu/drm/exynos/exynos_dp_core.c
>>> index 195fe60..c9995b1 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
>>> @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
>>> drm_connector *connector)
>>>  }
>>>  
>>
>> [--snip--]
>>
>>>  
>>>  static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
>>> -   .dpms   = exynos_drm_crtc_dpms,
>>> -   .prepare= exynos_drm_crtc_prepare,
>>> -   .commit = exynos_drm_crtc_commit,
>>> +   .enable = exynos_drm_crtc_enable,
>>> +   .disable= exynos_drm_crtc_disable,
>>> .mode_fixup = exynos_drm_crtc_mode_fixup,
>>> .mode_set   = drm_helper_crtc_mode_set,
>>> .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
>>
>> I think it'd be better to use atomic_flush callback to enable global dma
>> like commit callback did. Is there any reason that you don't use
>> atomic_begin and atomic_flush callbacks?
>>
>> atomic relevant codes I looked into do as follows,
>>
>> atomic_begin();
>>
>> atomic_update();  /* this will call win_commit callback to set a overlay
>> relevant registers and enable its dma channel. */
>>
>> atomic_flush();
>>
>> So atomic overlay updating between atomic_begin() ~ atomic_flush() will
>> be guaranteed.
>
> I think we can go down that road, but I'd suggest we push the atomic
> patches v8 (with the lastest comments from Joonyoung fixed) and then 
> work on the change you are proposing as a follow-up together with the 
> other 

Re: [PATCH v8 04/14] drm/exynos: atomic phase 1: add .mode_set_nofb() callback

2015-05-28 Thread Joonyoung Shim
On 05/28/2015 05:24 PM, Joonyoung Shim wrote:
> On 05/28/2015 05:56 AM, Gustavo Padovan wrote:
>> From: Gustavo Padovan 
>>
>> The new atomic infrastructure needs the .mode_set_nofb() callback to
>> update CRTC timings before setting any plane.
>>
>> Signed-off-by: Gustavo Padovan 
>> Reviewed-by: Joonyoung Shim 
>> Tested-by: Tobias Jakobi 
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_crtc.c | 64 
>> +---
>>  1 file changed, 9 insertions(+), 55 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
>> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
>> index ba44c9b..c524f0c 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
>> @@ -62,9 +62,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
>>  
>>  if (exynos_crtc->ops->win_commit)
>>  exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
>> -
>> -if (exynos_crtc->ops->commit)
>> -exynos_crtc->ops->commit(exynos_crtc);
>>  }
>>  
>>  static bool
>> @@ -81,60 +78,16 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
>>  return true;
>>  }
>>  
>> -static int
>> -exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode 
>> *mode,
>> -  struct drm_display_mode *adjusted_mode, int x, int y,
>> -  struct drm_framebuffer *old_fb)
>> -{
>> -struct drm_framebuffer *fb = crtc->primary->fb;
>> -unsigned int crtc_w;
>> -unsigned int crtc_h;
>> -int ret;
>> -
>> -/*
>> - * copy the mode data adjusted by mode_fixup() into crtc->mode
>> - * so that hardware can be seet to proper mode.
>> - */
>> -memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));
> 
> Let's apply using crtc->state->adjusted_mode instead of crtc->mode on
> exynos drm.
> 

I will make a patch for this, could you rebase from 05/18 of your
patchset on the patch if no any problem?
--
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 v9 13/18] drm/exynos: add exynos specific .atomic_commit()

2015-05-28 Thread Joonyoung Shim
On 05/29/2015 06:42 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> exynos needs to update planes with the crtc enabled (mainly for the FIMD
> case) so this specific atomic commit changes the order of
> drm_atomic_helper_commit_modeset_enables() and
> drm_atomic_helper_commit_planes() to commit planes after we enable crtc
> and encoders.
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fb.c | 27 ++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> index 05d229c..b11047c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> @@ -16,6 +16,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -270,7 +271,31 @@ static int exynos_atomic_commit(struct drm_device *dev,
>   struct drm_atomic_state *state,
>   bool async)
>  {
> - return drm_atomic_helper_commit(dev, state, false);
> + int ret;
> +
> + ret = drm_atomic_helper_prepare_planes(dev, state);
> + if (ret)
> + return ret;
> +
> + /*
> +  * This is the point of no return
> +  */

Just oneline comment is enough.

> +
> + drm_atomic_helper_swap_state(dev, state);
> +
> + drm_atomic_helper_commit_modeset_disables(dev, state);
> +
> + drm_atomic_helper_commit_modeset_enables(dev, state);

Maybe need description as comments about why need to change operation
order.

> +
> + drm_atomic_helper_commit_planes(dev, state);
> +
> + drm_atomic_helper_wait_for_vblanks(dev, state);
> +
> + drm_atomic_helper_cleanup_planes(dev, state);
> +
> + drm_atomic_state_free(state);
> +
> + return 0;
>  }
>  
>  static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
> 
--
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: odroidxu3: Enable USB3 regulators

2015-05-28 Thread Krzysztof Kozlowski
On 28.05.2015 19:28, Anand Moon wrote:
> Hi Krzysztof,
> 
> I will take care of these issue in the future.

Thanks. I just found that prefix ">" was added by my email client so
never mind about that but still please write proper sentences (ending
with full stop). :)

Best regards,
Krzysztof

> 
> -Anand Moon
> 
> On 28 May 2015 at 14:49, Krzysztof Kozlowski  wrote:
>> On 28.05.2015 17:58, Anand Moon wrote:
>>> Enable regulator for usbdrd3_0 and usbdrd3_1
>>> >From the schematic pin diagram USB3_0 and USB3_1
>>> is regulated by LDO9 and LD011.
>>
>> Please reformat statement above to proper sentence(s) without ">" before
>> "From".
>>
>>>
>>> Fix the boot message of failed.
>>> [3.503539] exynos-dwc3 usb@1200: Looking up vdd33-supply from 
>>> device tree
>>> [3.503556] exynos-dwc3 usb@1200: Looking up vdd33-supply property 
>>> in node /usb@1200 failed
>>> [3.503568] usb@1200 supply vdd33 not found, using dummy regulator
>>> [3.509154] exynos-dwc3 usb@1200: Looking up vdd10-supply from 
>>> device tree
>>> [3.509170] exynos-dwc3 usb@1200: Looking up vdd10-supply property 
>>> in node /usb@1200 failed
>>> [3.509181] usb@1200 supply vdd10 not found, using dummy regulator
>>> [3.917548] exynos-dwc3 usb@1240: Looking up vdd33-supply from 
>>> device tree
>>> [3.917565] exynos-dwc3 usb@1240: Looking up vdd33-supply property 
>>> in node /usb@1240 failed
>>> [3.917578] usb@1240 supply vdd33 not found, using dummy regulator
>>> [3.922731] exynos-dwc3 usb@1240: Looking up vdd10-supply from 
>>> device tree
>>> [3.922747] exynos-dwc3 usb@1240: Looking up vdd10-supply property 
>>> in node /usb@1240 failed
>>>
>>> ---
>>> This patch is based on Krzysztof github branch 
>>> work-next/odroid-xu3-s2mps11-irq
>>> ---
>>
>> I mentioned this already on previous postings. Let's make an exercise.
>> Please:
>> 1. Save your email as mbox format (from mailer).
>> 2. Go to a GIT repo with kernel and checkout base branch.
>> 3. git am 0001-the-name-of-file.mbox
>> 4. git show
>>
>> Do you see the signed-off-by in commit?
>>
>> The patch itself looks good, thanks for fixing this. Just please fix the
>> issues with commit message.
>>
>> By the way:
>> 1. The always-on from LDO9 could be probably removed if the ehci-exynos
>> driver had regulator consumer implemented.
>> 2. The Documentation/devicetree/bindings/usb/exynos-usb.txt (or dwc.txt)
>> should proably mention the vdd-supply property.
>>
>> 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 v7 00/25] Exynos SYSMMU (IOMMU) integration with DT andDMA-mapping subsystem

2015-05-28 Thread Krzysztof Kozlowski
On 23.05.2015 12:56, Kukjin Kim wrote:
> On 05/20/15 16:31, Javier Martinez Canillas wrote:
>> Hello Marek,
>>
>> On Tue, May 19, 2015 at 3:20 PM, Marek Szyprowski
>>  wrote:
>>> Hello Everyone,
>>>
>>> This is yet another attempt to get Exynos SYSMMU driver with integrated
>>> with IOMMU & DMA-mapping subsystems. This version includes minor fixes
>>> suggested by Joerg Roedel, Cho KyongHo and Robin Murphy.
>>>
>>> All patches are also available in the following git repository:
>>> https://git.linaro.org/people/marek.szyprowski/linux-srpol.git
>>> branch v4.1-exynos-iommu-v7.
>>>
>>> My plan for merging this patchset is as follows:
>>> - DTS changes and power domain changes should go via Samsung tree to avoid
>>>   conflicts with other pending DTS patches
>>> - all exynos-iommu patches and dma-mapping/reserved iommu region should go
>>>   via IOMMU tree,
>>> - all Exynos DRM patches should go via DRM/Exynos tree.
>>>
>>> There are no build cross-subsystem dependencies and IOMMU on Exynos is
>>> already nonfunctional (and disabled in defconfig), so merging patches in
>>> parts doesn't break anything.
>>>
>>> There are knowns issues with Exynos DRM driver and IOMMU support
>>> (i.e. Xorg freeze reported by Javier Martinez Canillas:
>>> http://www.spinics.net/lists/linux-samsung-soc/msg44350.html ). They
>>> will be handled by a separate fixes to Exynos DRM drivers. This patchset
>>> fixes only those issues in Exynos DRM FIMD driver, which prevents
>>> booting to console.
>>>
>>
>> I tested your v7 using exynos_defconfig + CONFIG_EXYNOS_IOMMU on both
>> Exynos5250 Snow and Exynos5420 Peach Pit Chromebooks.
>>
>> I can only reproduce the complete system hang on Xorg if I use the
>> xf86-video-armsoc DDX. If I use the -fbdev DDX instead, X starts
>> correctly and the system does not freeze. Also, this only happens on
>> Exynos5420 Peach Pit, Exynos5250 Snow is working correctly even when
>> using the -armsoc DDX.
>>
>> So as you said, this is a separate issue with the Exynos DRM driver
>> IOMMU support and is not related to your series. For the whole series:
>>
>> Tested-by: Javier Martinez Canillas 
>>
> Thanks for your test on the boards.
> 
> I'll sort out the arch/ side changes into samsung tree in this weekend.

Hi Kukjin,

How is the progress of sorting out this patchset? There will be some
conflicts between this and DTS-label-rework so maybe you want something
to be rebased?

Best regards,
Krzysztpf

--
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: exynos: Fix wake-up interrupts for Exynos3250

2015-05-28 Thread Krzysztof Kozlowski
On 28.05.2015 18:55, Marc Zyngier wrote:
> On 27/04/15 01:53, Kukjin Kim wrote:
>> Krzysztof Kozlowski wrote:
>>>
>>> 2015-04-23 2:40 GMT+09:00 Marc Zyngier :
 Commit 8b283c025443 (ARM: exynos4/5: convert pmu wakeup to
 stacked domains) changed the Exynos PMU code to use stacked
 domains. This has led to a number of interrupt numbers to be
 fixed.

 In the meantime, support for Exynos 3250 was added, missing
 the required change to this platform. This amounts to revert
 ace283a04a4a (ARM: EXYNOS: Fix wrong hwirq of RTC interrupt
 for Exynos3250 SoC), as the initial patch was right, just a
 bit early...

 Cc: Chanwoo Choi 
 Cc: Kyungmin Park 
 Cc: Krzysztof Kozlowski 
 Cc: Kukjin Kim 
 Signed-off-by: Marc Zyngier 
 ---
  arch/arm/mach-exynos/suspend.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> Acked-by: Krzysztof Kozlowski 
>>>
>> Thanks and applied.
> 
> Looks like this fix never made it to mainline. What happened?

Indeed, good question - what happened? Anyway I applied this to my tree
so it won't get lost again. I will push it to Kukjin this weekend.

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 2/9] mm: Provide new get_vaddr_frames() helper

2015-05-28 Thread Andrew Morton
On Wed, 13 May 2015 15:08:08 +0200 Jan Kara  wrote:

> Provide new function get_vaddr_frames().  This function maps virtual
> addresses from given start and fills given array with page frame numbers of
> the corresponding pages. If given start belongs to a normal vma, the function
> grabs reference to each of the pages to pin them in memory. If start
> belongs to VM_IO | VM_PFNMAP vma, we don't touch page structures. Caller
> must make sure pfns aren't reused for anything else while he is using
> them.
> 
> This function is created for various drivers to simplify handling of
> their buffers.
> 
> Acked-by: Mel Gorman 
> Acked-by: Vlastimil Babka 
> Signed-off-by: Jan Kara 
> ---
>  include/linux/mm.h |  44 +++
>  mm/gup.c   | 226 
> +

That's a lump of new code which many kernels won't be needing.  Can we
put all this in a new .c file and select it within drivers/media
Kconfig?

--
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 v9 08/18] drm/exynos: atomic phase 3: use atomic .set_config helper

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Now that phase 1 and 2 are complete switch .set_config helper to
use the atomic one.

v2: also remove .prepare() callback

v3: remove .mode_set() and .mode_set_base() and encoder's
.prepare() callbacks

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 10 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  6 --
 2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index f782d1f..dd1ee7f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -50,11 +50,6 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int 
mode)
drm_crtc_vblank_on(crtc);
 }
 
-static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
-{
-   /* drm framework doesn't check NULL. */
-}
-
 static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -108,12 +103,9 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.dpms   = exynos_drm_crtc_dpms,
-   .prepare= exynos_drm_crtc_prepare,
.commit = exynos_drm_crtc_commit,
.mode_fixup = exynos_drm_crtc_mode_fixup,
-   .mode_set   = drm_helper_crtc_mode_set,
.mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
-   .mode_set_base  = drm_helper_crtc_mode_set_base,
.disable= exynos_drm_crtc_disable,
 };
 
@@ -190,7 +182,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 }
 
 static struct drm_crtc_funcs exynos_crtc_funcs = {
-   .set_config = drm_crtc_helper_set_config,
+   .set_config = drm_atomic_helper_set_config,
.page_flip  = exynos_drm_crtc_page_flip,
.destroy= exynos_drm_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 57de0bd..915de13 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -76,11 +76,6 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder 
*encoder,
display->ops->mode_set(display, adjusted_mode);
 }
 
-static void exynos_drm_encoder_prepare(struct drm_encoder *encoder)
-{
-   /* drm framework doesn't check NULL. */
-}
-
 static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
 {
struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
@@ -111,7 +106,6 @@ static struct drm_encoder_helper_funcs 
exynos_encoder_helper_funcs = {
.dpms   = exynos_drm_encoder_dpms,
.mode_fixup = exynos_drm_encoder_mode_fixup,
.mode_set   = exynos_drm_encoder_mode_set,
-   .prepare= exynos_drm_encoder_prepare,
.commit = exynos_drm_encoder_commit,
.disable= exynos_drm_encoder_disable,
 };
-- 
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 v9 15/18] drm/exynos: remove unnecessary calls to disable_plane()

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

The planes are already disabled by the drm_atomic_helper_commit() code
so we don't need to disable the in these two places.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 11 ---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  8 
 2 files changed, 19 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index dd8e454..b7c6d51 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -40,8 +40,6 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_plane *plane;
-   int ret;
 
if (!exynos_crtc->enabled)
return;
@@ -57,15 +55,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
 
exynos_crtc->enabled = false;
-
-   drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
-   if (plane->crtc != crtc)
-   continue;
-
-   ret = plane->funcs->disable_plane(plane);
-   if (ret)
-   DRM_ERROR("Failed to disable plane %d\n", ret);
-   }
 }
 
 static bool
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 0648ba4..7b89fd5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -81,17 +81,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder 
*encoder)
 {
struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
struct exynos_drm_display *display = exynos_encoder->display;
-   struct drm_plane *plane;
-   struct drm_device *dev = encoder->dev;
 
if (display->ops->dpms)
display->ops->dpms(display, DRM_MODE_DPMS_OFF);
-
-   /* all planes connected to this encoder should be also disabled. */
-   drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
-   if (plane->crtc && (plane->crtc == encoder->crtc))
-   plane->funcs->disable_plane(plane);
-   }
 }
 
 static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {
-- 
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 v9 05/18] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy()

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Set CRTC, planes and connectors to use the default implementations from
the atomic helper library. The helpers will work to keep track of state
for each DRM object.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/bridge/ps8622.c   | 4 
 drivers/gpu/drm/bridge/ptn3460.c  | 4 
 drivers/gpu/drm/exynos/exynos_dp_core.c   | 4 
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 5 +
 drivers/gpu/drm/exynos/exynos_drm_dpi.c   | 4 
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_dsi.c   | 4 
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 4 
 drivers/gpu/drm/exynos/exynos_hdmi.c  | 4 
 10 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
index e895aa7..b604326 100644
--- a/drivers/gpu/drm/bridge/ps8622.c
+++ b/drivers/gpu/drm/bridge/ps8622.c
@@ -31,6 +31,7 @@
 #include "drmP.h"
 #include "drm_crtc.h"
 #include "drm_crtc_helper.h"
+#include "drm_atomic_helper.h"
 
 /* Brightness scale on the Parade chip */
 #define PS8622_MAX_BRIGHTNESS 0xff
@@ -502,6 +503,9 @@ static const struct drm_connector_funcs 
ps8622_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ps8622_detect,
.destroy = ps8622_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int ps8622_attach(struct drm_bridge *bridge)
diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index 9d2f053..8ed3617 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -27,6 +27,7 @@
 
 #include "drm_crtc.h"
 #include "drm_crtc_helper.h"
+#include "drm_atomic_helper.h"
 #include "drm_edid.h"
 #include "drmP.h"
 
@@ -263,6 +264,9 @@ static struct drm_connector_funcs ptn3460_connector_funcs = 
{
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ptn3460_detect,
.destroy = ptn3460_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int ptn3460_bridge_attach(struct drm_bridge *bridge)
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 30feb7d..195fe60 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -957,6 +958,9 @@ static struct drm_connector_funcs exynos_dp_connector_funcs 
= {
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = exynos_dp_detect,
.destroy = exynos_dp_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int exynos_dp_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 75eb61b..73ccfa7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -14,6 +14,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 #include "exynos_drm_crtc.h"
 #include "exynos_drm_drv.h"
@@ -188,6 +190,9 @@ static struct drm_crtc_funcs exynos_crtc_funcs = {
.set_config = drm_crtc_helper_set_config,
.page_flip  = exynos_drm_crtc_page_flip,
.destroy= exynos_drm_crtc_destroy,
+   .reset = drm_atomic_helper_crtc_reset,
+   .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 };
 
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 37678cf..ced5c23 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -63,6 +64,9 @@ static struct drm_connector_funcs exynos_dpi_connector_funcs 
= {
.detect = exynos_dpi_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = exynos_dpi_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int exynos_dpi_get_modes(struct d

[PATCH v9 10/18] drm/exynos: remove exported functions from exynos_drm_plane

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Now that no one is using the functions exported by exynos_drm_plane due
to the atomic conversion we can make remove some of the them or make them
static.

v2: remove unused exynos_drm_crtc

v3: fix checkpatch error (reported by Joonyoung)

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 98 +--
 drivers/gpu/drm/exynos/exynos_drm_plane.h | 11 
 2 files changed, 42 insertions(+), 67 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index e5e4eb0..54a83ee 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -62,38 +62,13 @@ static int exynos_plane_get_size(int start, unsigned 
length, unsigned last)
return size;
 }
 
-int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)
-{
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   int nr;
-   int i;
-
-   if (!fb)
-   return 0;
-
-   nr = exynos_drm_fb_get_buf_cnt(fb);
-   for (i = 0; i < nr; i++) {
-   struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
-
-   if (!buffer) {
-   DRM_DEBUG_KMS("buffer is null\n");
-   return -EFAULT;
-   }
-
-   exynos_plane->dma_addr[i] = buffer->dma_addr + fb->offsets[i];
-
-   DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n",
-   i, (unsigned long)exynos_plane->dma_addr[i]);
-   }
-
-   return 0;
-}
-
-void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
- struct drm_framebuffer *fb, int crtc_x, int crtc_y,
- unsigned int crtc_w, unsigned int crtc_h,
- uint32_t src_x, uint32_t src_y,
- uint32_t src_w, uint32_t src_h)
+static void exynos_plane_mode_set(struct drm_plane *plane,
+ struct drm_crtc *crtc,
+ struct drm_framebuffer *fb,
+ int crtc_x, int crtc_y,
+ unsigned int crtc_w, unsigned int crtc_h,
+ uint32_t src_x, uint32_t src_y,
+ uint32_t src_w, uint32_t src_h)
 {
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
unsigned int actual_w;
@@ -148,24 +123,6 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct 
drm_crtc *crtc,
plane->crtc = crtc;
 }
 
-void
-exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
-struct drm_framebuffer *fb, int crtc_x, int crtc_y,
-unsigned int crtc_w, unsigned int crtc_h,
-uint32_t src_x, uint32_t src_y,
-uint32_t src_w, uint32_t src_h)
-{
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-
-   exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
- crtc_w, crtc_h, src_x >> 16, src_y >> 16,
- src_w >> 16, src_h >> 16);
-
-   if (exynos_crtc->ops->win_commit)
-   exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane   = drm_atomic_helper_update_plane,
.disable_plane  = drm_atomic_helper_disable_plane,
@@ -178,22 +135,51 @@ static struct drm_plane_funcs exynos_plane_funcs = {
 static int exynos_plane_atomic_check(struct drm_plane *plane,
 struct drm_plane_state *state)
 {
-   return exynos_check_plane(plane, state->fb);
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+   int nr;
+   int i;
+
+   if (!state->fb)
+   return 0;
+
+   nr = exynos_drm_fb_get_buf_cnt(state->fb);
+   for (i = 0; i < nr; i++) {
+   struct exynos_drm_gem_buf *buffer =
+   exynos_drm_fb_buffer(state->fb, i);
+
+   if (!buffer) {
+   DRM_DEBUG_KMS("buffer is null\n");
+   return -EFAULT;
+   }
+
+   exynos_plane->dma_addr[i] = buffer->dma_addr +
+   state->fb->offsets[i];
+
+   DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n",
+   i, (unsigned long)exynos_plane->dma_addr[i]);
+   }
+
+   return 0;
 }
 
 static void exynos_plane_atomic_update(struct drm_plane *plane,
   struct drm_plane_state *old_state)
 {
struct drm_plane_state *state = plane->state;
+   struct exynos_drm_crtc *exynos_crtc = t

[PATCH v9 14/18] drm/exynos: atomic dpms support

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Run dpms operations through the atomic intefaces. This basically removes
the .dpms() callback from econders and crtcs and use .disable() and
.enable() to turn the crtc on and off.

v2: Address comments by Joonyoung:
- make hdmi code call ->disable() instead of ->dpms()
- do not use WARN_ON on crtc enable/disable

v3: - Fix build failure after the hdmi change in v2
- Change dpms helper of ptn3460 bridge

v4: - remove win_commit() call from .enable()

v5: - move .atomic_check() to the atomic PageFlip patch, and transform it
in .atomic_begin()

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/bridge/ps8622.c |  2 +-
 drivers/gpu/drm/bridge/ptn3460.c|  2 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 58 -
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 21 +++
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +--
 10 files changed, 40 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
index b604326..d686235 100644
--- a/drivers/gpu/drm/bridge/ps8622.c
+++ b/drivers/gpu/drm/bridge/ps8622.c
@@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct drm_connector 
*connector)
 }
 
 static const struct drm_connector_funcs ps8622_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ps8622_detect,
.destroy = ps8622_connector_destroy,
diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index 8ed3617..260bc9f 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct drm_connector 
*connector)
 }
 
 static struct drm_connector_funcs ptn3460_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ptn3460_detect,
.destroy = ptn3460_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 195fe60..c9995b1 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_dp_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = exynos_dp_detect,
.destroy = exynos_dp_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 7125fbe..dd8e454 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -22,40 +22,41 @@
 #include "exynos_drm_encoder.h"
 #include "exynos_drm_plane.h"
 
-static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
+static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
-   DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
-
-   if (exynos_crtc->dpms == mode) {
-   DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
+   if (exynos_crtc->enabled)
return;
-   }
-
-   if (mode > DRM_MODE_DPMS_ON) {
-   /* wait for the completion of page flip. */
-   if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
-   (exynos_crtc->event == NULL), HZ/20))
-   exynos_crtc->event = NULL;
-   drm_crtc_vblank_off(crtc);
-   }
 
if (exynos_crtc->ops->dpms)
-   exynos_crtc->ops->dpms(exynos_crtc, mode);
+   exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);
 
-   exynos_crtc->dpms = mode;
+   exynos_crtc->enabled = true;
 
-   if (mode == DRM_MODE_DPMS_ON)
-   drm_crtc_vblank_on(crtc);
+   drm_crtc_vblank_on(crtc);
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct drm_plane *plane;
int ret;
 
-   exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
+   if (!exynos_crtc->enabled)
+   return;
+
+   /* wait for the completion of page flip. */
+   if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
+  

[PATCH v9 18/18] drm/exynos: don't disable planes already disabled

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

on resume (or enable()) do not call disable_plane() on planes that
are already disabled.

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

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index e55a8b0..7dae3a7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -786,23 +786,10 @@ static void fimd_window_resume(struct fimd_context *ctx)
plane = &ctx->planes[i];
plane->enabled = plane->resume;
plane->resume = false;
-   }
-}
 
-static void fimd_apply(struct fimd_context *ctx)
-{
-   struct exynos_drm_plane *plane;
-   int i;
-
-   for (i = 0; i < WINDOWS_NR; i++) {
-   plane = &ctx->planes[i];
if (plane->enabled)
fimd_update_plane(ctx->crtc, i);
-   else
-   fimd_disable_plane(ctx->crtc, i);
}
-
-   fimd_commit(ctx->crtc);
 }
 
 static int fimd_enable(struct exynos_drm_crtc *crtc)
@@ -840,7 +827,7 @@ static int fimd_enable(struct exynos_drm_crtc *crtc)
 
fimd_window_resume(ctx);
 
-   fimd_apply(ctx);
+   fimd_commit(ctx->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 v9 06/18] drm/exynos: atomic phase 2: keep track of framebuffer pointer

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Use drm_atomic_set_fb_for_plane() in the legacy page_flip path to keep
track of the framebuffer pointer and reference.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 73ccfa7..f782d1f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -168,6 +168,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
crtc_w << 16, crtc_h << 16);
 
+   if (crtc->primary->state)
+   drm_atomic_set_fb_for_plane(crtc->primary->state, fb);
+
return 0;
 
 out:
-- 
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 v9 17/18] drm/exynos: rename win_commit/disable to atomic-like names

2015-05-28 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/exynos7_drm_decon.c | 14 +++---
 drivers/gpu/drm/exynos/exynos_drm_drv.h|  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 14 +++---
 drivers/gpu/drm/exynos/exynos_drm_plane.c  | 10 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c   | 12 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c  | 12 ++--
 6 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 0008658..a2914dd 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -392,7 +392,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.mode;
@@ -510,7 +510,7 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, 
unsigned int win)
plane->enabled = true;
 }
 
-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;
@@ -554,7 +554,7 @@ static void decon_window_suspend(struct decon_context *ctx)
plane = &ctx->planes[i];
plane->resume = plane->enabled;
if (plane->enabled)
-   decon_win_disable(ctx->crtc, i);
+   decon_disable_plane(ctx->crtc, i);
}
 }
 
@@ -578,9 +578,9 @@ static void decon_apply(struct decon_context *ctx)
for (i = 0; i < WINDOWS_NR; i++) {
plane = &ctx->planes[i];
if (plane->enabled)
-   decon_win_commit(ctx->crtc, i);
+   decon_update_plane(ctx->crtc, i);
else
-   decon_win_disable(ctx->crtc, i);
+   decon_disable_plane(ctx->crtc, i);
}
 
decon_commit(ctx->crtc);
@@ -702,8 +702,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,
 };
 
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index a3053a2..dc89564 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -185,8 +185,8 @@ struct exynos_drm_crtc_ops {
int (*enable_vblank)(struct exynos_drm_crtc *crtc);
void (*disable_vblank)(struct exynos_drm_crtc *crtc);
void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
-   void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos);
-   void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos);
+   void (*update_plane)(struct exynos_drm_crtc *crtc, unsigned int zpos);
+   void (*disable_plane)(struct exynos_drm_crtc *crtc, unsigned int zpos);
void (*te_handler)(struct exynos_drm_crtc *crtc);
void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable);
 };
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 433c298..e55a8b0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -618,7 +618,7 @@ static void fimd_shadow_protect_win(struct fimd_context 
*ctx,
writel(val, ctx->regs + reg);
 }
 
-static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
+static void fimd_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
 {
struct fimd_context *ctx = crtc->ctx;
struct exynos_drm_plane *plane;
@@ -734,7 +734,7 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, 
unsigned int win)
atomic_set(&ctx->win_updated, 1);
 }
 
-static void fimd_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
+static void fimd_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
 {
struct fimd_context *ctx = crtc->ctx;
struct exynos_drm_plane *plane;
@@ -773,7 +773,7 @@ static void fimd_window_suspend(struct fimd_context *ctx)
plane = &ctx->planes[i];
plane->resume = plane->enabled;
if (plane->enabled)
-   fimd_win_disable(ctx->crtc, i);
+   fimd_disable_plane(c

[PATCH v9 12/18] drm/exynos: move exynos_drm_crtc_disable()

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

This is a preparation commit to move exynos_drm_crtc_disable() together
with the future exynos_drm_crtc_enable() that will come from the split of
exynos_drm_crtc_dpms() callback.

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

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index a137799..7125fbe 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -50,6 +50,23 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int 
mode)
drm_crtc_vblank_on(crtc);
 }
 
+static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
+{
+   struct drm_plane *plane;
+   int ret;
+
+   exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
+
+   drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
+   if (plane->crtc != crtc)
+   continue;
+
+   ret = plane->funcs->disable_plane(plane);
+   if (ret)
+   DRM_ERROR("Failed to disable plane %d\n", ret);
+   }
+}
+
 static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -84,23 +101,6 @@ exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
exynos_crtc->ops->commit(exynos_crtc);
 }
 
-static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
-{
-   struct drm_plane *plane;
-   int ret;
-
-   exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
-
-   drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
-   if (plane->crtc != crtc)
-   continue;
-
-   ret = plane->funcs->disable_plane(plane);
-   if (ret)
-   DRM_ERROR("Failed to disable plane %d\n", ret);
-   }
-}
-
 static void exynos_crtc_atomic_begin(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -117,10 +117,10 @@ static void exynos_crtc_atomic_flush(struct drm_crtc 
*crtc)
 
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.dpms   = exynos_drm_crtc_dpms,
+   .disable= exynos_drm_crtc_disable,
.commit = exynos_drm_crtc_commit,
.mode_fixup = exynos_drm_crtc_mode_fixup,
.mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
-   .disable= exynos_drm_crtc_disable,
.atomic_begin   = exynos_crtc_atomic_begin,
.atomic_flush   = exynos_crtc_atomic_flush,
 };
-- 
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 v9 07/18] drm/exynos: atomic phase 3: atomic updates of planes

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Now that phase 1 and 2 are complete we can switch the update/disable_plane
callbacks to their atomic version.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_fb.c| 3 +++
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 142eb4e..19c0642 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "exynos_drm_drv.h"
@@ -268,6 +269,8 @@ static void exynos_drm_output_poll_changed(struct 
drm_device *dev)
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
.fb_create = exynos_user_fb_create,
.output_poll_changed = exynos_drm_output_poll_changed,
+   .atomic_check = drm_atomic_helper_check,
+   .atomic_commit = drm_atomic_helper_commit,
 };
 
 void exynos_drm_mode_config_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index acefbca..e5e4eb0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -167,8 +167,8 @@ exynos_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
 }
 
 static struct drm_plane_funcs exynos_plane_funcs = {
-   .update_plane   = drm_plane_helper_update,
-   .disable_plane  = drm_plane_helper_disable,
+   .update_plane   = drm_atomic_helper_update_plane,
+   .disable_plane  = drm_atomic_helper_disable_plane,
.destroy= drm_plane_cleanup,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
-- 
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 v9 09/18] drm/exynos: atomic phase 3: convert page flips

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

PageFlips now use the atomic helper to work through the atomic modesetting
API. Async page flips are not supported yet.

v2: Add .atomic_begin() step to handle the vblank part we removed from
exynos page_flip code.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 79 +++-
 drivers/gpu/drm/exynos/exynos_drm_fb.c   |  9 +++-
 2 files changed, 25 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index dd1ee7f..a137799 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -101,75 +101,30 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
}
 }
 
+static void exynos_crtc_atomic_begin(struct drm_crtc *crtc)
+{
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+
+   if (crtc->state->event) {
+   WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+   exynos_crtc->event = crtc->state->event;
+   }
+}
+
+static void exynos_crtc_atomic_flush(struct drm_crtc *crtc)
+{
+}
+
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.dpms   = exynos_drm_crtc_dpms,
.commit = exynos_drm_crtc_commit,
.mode_fixup = exynos_drm_crtc_mode_fixup,
.mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
.disable= exynos_drm_crtc_disable,
+   .atomic_begin   = exynos_crtc_atomic_begin,
+   .atomic_flush   = exynos_crtc_atomic_flush,
 };
 
-static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
-struct drm_framebuffer *fb,
-struct drm_pending_vblank_event *event,
-uint32_t page_flip_flags)
-{
-   struct drm_device *dev = crtc->dev;
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   unsigned int crtc_w, crtc_h;
-   int ret;
-
-   /* when the page flip is requested, crtc's dpms should be on */
-   if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
-   DRM_ERROR("failed page flip request.\n");
-   return -EINVAL;
-   }
-
-   if (!event)
-   return -EINVAL;
-
-   spin_lock_irq(&dev->event_lock);
-   if (exynos_crtc->event) {
-   ret = -EBUSY;
-   goto out;
-   }
-
-   ret = exynos_check_plane(crtc->primary, fb);
-   if (ret)
-   goto out;
-
-   ret = drm_vblank_get(dev, exynos_crtc->pipe);
-   if (ret) {
-   DRM_DEBUG("failed to acquire vblank counter\n");
-   goto out;
-   }
-
-   exynos_crtc->event = event;
-   spin_unlock_irq(&dev->event_lock);
-
-   /*
-* the pipe from user always is 0 so we can set pipe number
-* of current owner to event.
-*/
-   event->pipe = exynos_crtc->pipe;
-
-   crtc->primary->fb = fb;
-   crtc_w = fb->width - crtc->x;
-   crtc_h = fb->height - crtc->y;
-   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-   crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
-   crtc_w << 16, crtc_h << 16);
-
-   if (crtc->primary->state)
-   drm_atomic_set_fb_for_plane(crtc->primary->state, fb);
-
-   return 0;
-
-out:
-   spin_unlock_irq(&dev->event_lock);
-   return ret;
-}
-
 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -183,7 +138,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 
 static struct drm_crtc_funcs exynos_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
-   .page_flip  = exynos_drm_crtc_page_flip,
+   .page_flip  = drm_atomic_helper_page_flip,
.destroy= exynos_drm_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 19c0642..05d229c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -266,11 +266,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)
+{
+   return drm_atomic_helper_commit(dev, state, false);
+}
+
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
.fb_create = exynos_user_fb_create,
.output_poll_changed = exynos_drm_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
-   .atomic_commit = drm_atomic_helper_commit,
+

[PATCH v9 13/18] drm/exynos: add exynos specific .atomic_commit()

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

exynos needs to update planes with the crtc enabled (mainly for the FIMD
case) so this specific atomic commit changes the order of
drm_atomic_helper_commit_modeset_enables() and
drm_atomic_helper_commit_planes() to commit planes after we enable crtc
and encoders.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_fb.c | 27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 05d229c..b11047c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -270,7 +271,31 @@ static int exynos_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state,
bool async)
 {
-   return drm_atomic_helper_commit(dev, state, false);
+   int ret;
+
+   ret = drm_atomic_helper_prepare_planes(dev, state);
+   if (ret)
+   return ret;
+
+   /*
+* This is the point of no return
+*/
+
+   drm_atomic_helper_swap_state(dev, state);
+
+   drm_atomic_helper_commit_modeset_disables(dev, state);
+
+   drm_atomic_helper_commit_modeset_enables(dev, state);
+
+   drm_atomic_helper_commit_planes(dev, state);
+
+   drm_atomic_helper_wait_for_vblanks(dev, state);
+
+   drm_atomic_helper_cleanup_planes(dev, state);
+
+   drm_atomic_state_free(state);
+
+   return 0;
 }
 
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
-- 
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 v9 04/18] drm/exynos: atomic phase 1: add .mode_set_nofb() callback

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

The new atomic infrastructure needs the .mode_set_nofb() callback to
update CRTC timings before setting any plane.

v2: remove WARN_ON(!crtc->state) from mode_set_nofb

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 63 
 1 file changed, 7 insertions(+), 56 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index ba44c9b..75eb61b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -62,9 +62,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
 
if (exynos_crtc->ops->win_commit)
exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
-
-   if (exynos_crtc->ops->commit)
-   exynos_crtc->ops->commit(exynos_crtc);
 }
 
 static bool
@@ -81,60 +78,13 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
return true;
 }
 
-static int
-exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode, int x, int y,
- struct drm_framebuffer *old_fb)
-{
-   struct drm_framebuffer *fb = crtc->primary->fb;
-   unsigned int crtc_w;
-   unsigned int crtc_h;
-   int ret;
-
-   /*
-* copy the mode data adjusted by mode_fixup() into crtc->mode
-* so that hardware can be seet to proper mode.
-*/
-   memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));
-
-   ret = exynos_check_plane(crtc->primary, fb);
-   if (ret < 0)
-   return ret;
-
-   crtc_w = fb->width - x;
-   crtc_h = fb->height - y;
-   exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, x, y, crtc_w, crtc_h);
-
-   return 0;
-}
-
-static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
- struct drm_framebuffer *old_fb)
+static void
+exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_framebuffer *fb = crtc->primary->fb;
-   unsigned int crtc_w;
-   unsigned int crtc_h;
-   int ret;
-
-   /* when framebuffer changing is requested, crtc's dpms should be on */
-   if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
-   DRM_ERROR("failed framebuffer changing request.\n");
-   return -EPERM;
-   }
 
-   ret = exynos_check_plane(crtc->primary, fb);
-   if (ret)
-   return ret;
-
-   crtc_w = fb->width - x;
-   crtc_h = fb->height - y;
-   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-   crtc_w, crtc_h, x << 16, y << 16,
-   crtc_w << 16, crtc_h << 16);
-
-   return 0;
+   if (exynos_crtc->ops->commit)
+   exynos_crtc->ops->commit(exynos_crtc);
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -159,8 +109,9 @@ static struct drm_crtc_helper_funcs 
exynos_crtc_helper_funcs = {
.prepare= exynos_drm_crtc_prepare,
.commit = exynos_drm_crtc_commit,
.mode_fixup = exynos_drm_crtc_mode_fixup,
-   .mode_set   = exynos_drm_crtc_mode_set,
-   .mode_set_base  = exynos_drm_crtc_mode_set_base,
+   .mode_set   = drm_helper_crtc_mode_set,
+   .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
+   .mode_set_base  = drm_helper_crtc_mode_set_base,
.disable= exynos_drm_crtc_disable,
 };
 
-- 
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 v9 11/18] drm/exynos: don't disable unused functions at init

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Everything starts disabled so we don't really need to disable anything.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index e71e331..e0b085b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -275,9 +275,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
 
}
 
-   /* disable all the possible outputs/crtcs before entering KMS mode */
-   drm_helper_disable_unused_functions(dev);
-
ret = drm_fb_helper_initial_config(helper, PREFERRED_BPP);
if (ret < 0) {
DRM_ERROR("failed to set up hw configuration.\n");
-- 
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 v9 16/18] drm/exynos: split exynos_crtc->dpms in enable() and disable()

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

To follow more closely the new atomic API we split the dpms()
helper into the enable() and disable() helper to get exactly the
same semantics.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c | 31 +
 drivers/gpu/drm/exynos/exynos_drm_crtc.c   |  8 ++---
 drivers/gpu/drm/exynos/exynos_drm_drv.h|  6 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 31 +
 drivers/gpu/drm/exynos/exynos_drm_vidi.c   | 55 --
 drivers/gpu/drm/exynos/exynos_mixer.c  | 32 ++---
 6 files changed, 56 insertions(+), 107 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 6714e5b..0008658 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -603,8 +603,9 @@ static void decon_init(struct decon_context *ctx)
writel(VIDCON1_VCLK_HOLD, ctx->regs + VIDCON1(0));
 }
 
-static int decon_poweron(struct decon_context *ctx)
+static int decon_enable(struct exynos_drm_crtc *crtc)
 {
+   struct decon_context *ctx = crtc->ctx;
int ret;
 
if (!ctx->suspended)
@@ -668,8 +669,10 @@ pclk_err:
return ret;
 }
 
-static int decon_poweroff(struct decon_context *ctx)
+static int decon_disable(struct exynos_drm_crtc *crtc)
 {
+   struct decon_context *ctx = crtc->ctx;
+
if (ctx->suspended)
return 0;
 
@@ -691,27 +694,9 @@ static int decon_poweroff(struct decon_context *ctx)
return 0;
 }
 
-static void decon_dpms(struct exynos_drm_crtc *crtc, int mode)
-{
-   DRM_DEBUG_KMS("%s, %d\n", __FILE__, mode);
-
-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   decon_poweron(crtc->ctx);
-   break;
-   case DRM_MODE_DPMS_STANDBY:
-   case DRM_MODE_DPMS_SUSPEND:
-   case DRM_MODE_DPMS_OFF:
-   decon_poweroff(crtc->ctx);
-   break;
-   default:
-   DRM_DEBUG_KMS("unspecified mode %d\n", mode);
-   break;
-   }
-}
-
 static const struct exynos_drm_crtc_ops decon_crtc_ops = {
-   .dpms = decon_dpms,
+   .enable = decon_enable,
+   .disable = decon_disable,
.mode_fixup = decon_mode_fixup,
.commit = decon_commit,
.enable_vblank = decon_enable_vblank,
@@ -796,7 +781,7 @@ static void decon_unbind(struct device *dev, struct device 
*master,
 {
struct decon_context *ctx = dev_get_drvdata(dev);
 
-   decon_dpms(ctx->crtc, DRM_MODE_DPMS_OFF);
+   decon_disable(ctx->crtc);
 
if (ctx->display)
exynos_dpi_remove(ctx->display);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index b7c6d51..644b4b7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -29,8 +29,8 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
if (exynos_crtc->enabled)
return;
 
-   if (exynos_crtc->ops->dpms)
-   exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);
+   if (exynos_crtc->ops->enable)
+   exynos_crtc->ops->enable(exynos_crtc);
 
exynos_crtc->enabled = true;
 
@@ -51,8 +51,8 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 
drm_crtc_vblank_off(crtc);
 
-   if (exynos_crtc->ops->dpms)
-   exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
+   if (exynos_crtc->ops->disable)
+   exynos_crtc->ops->disable(exynos_crtc);
 
exynos_crtc->enabled = false;
 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 86d6894..a3053a2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -157,7 +157,8 @@ struct exynos_drm_display {
 /*
  * Exynos drm crtc ops
  *
- * @dpms: control device power.
+ * @enable: enable the device
+ * @disable: disable the device
  * @mode_fixup: fix mode data before applying it
  * @commit: set current hw specific display mode to hw.
  * @enable_vblank: specific driver callback for enabling vblank interrupt.
@@ -175,7 +176,8 @@ struct exynos_drm_display {
  */
 struct exynos_drm_crtc;
 struct exynos_drm_crtc_ops {
-   void (*dpms)(struct exynos_drm_crtc *crtc, int mode);
+   int (*enable)(struct exynos_drm_crtc *crtc);
+   int (*disable)(struct exynos_drm_crtc *crtc);
bool (*mode_fixup)(struct exynos_drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index a0edab8..433c298 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -805,8 +805,9 @@ static void fimd_apply(struct fim

[PATCH v9 03/18] drm/exynos: atomic phase 1: use drm_plane_helper_disable()

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

The atomic helper to disable planes also uses the optional
.atomic_disable() helper. The unique operation it does is calling
.win_disable()

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 32 ++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 2aaed64..6e1341e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -67,6 +67,9 @@ int exynos_check_plane(struct drm_plane *plane, struct 
drm_framebuffer *fb)
int nr;
int i;
 
+   if (!fb)
+   return 0;
+
nr = exynos_drm_fb_get_buf_cnt(fb);
for (i = 0; i < nr; i++) {
struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
@@ -162,21 +165,9 @@ exynos_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
 }
 
-static int exynos_disable_plane(struct drm_plane *plane)
-{
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(plane->crtc);
-
-   if (exynos_crtc && exynos_crtc->ops->win_disable)
-   exynos_crtc->ops->win_disable(exynos_crtc,
- exynos_plane->zpos);
-
-   return 0;
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane   = drm_plane_helper_update,
-   .disable_plane  = exynos_disable_plane,
+   .disable_plane  = drm_plane_helper_disable,
.destroy= drm_plane_cleanup,
 };
 
@@ -201,9 +192,24 @@ static void exynos_plane_atomic_update(struct drm_plane 
*plane,
state->src_w, state->src_h);
 }
 
+static void exynos_plane_atomic_disable(struct drm_plane *plane,
+   struct drm_plane_state *old_state)
+{
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(old_state->crtc);
+
+   if (!old_state->crtc)
+   return;
+
+   if (exynos_crtc->ops->win_disable)
+   exynos_crtc->ops->win_disable(exynos_crtc,
+ exynos_plane->zpos);
+}
+
 static const struct drm_plane_helper_funcs plane_helper_funcs = {
.atomic_check = exynos_plane_atomic_check,
.atomic_update = exynos_plane_atomic_update,
+   .atomic_disable = exynos_plane_atomic_disable,
 };
 
 static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
-- 
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 v9 01/18] drm/exynos: fix source data argument for plane

2015-05-28 Thread Gustavo Padovan
From: Joonyoung Shim 

The exynos_update_plane function needs 16.16 fixed point source data.

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

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 9006b94..363b019 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -127,7 +127,8 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
*crtc, int x, int y,
crtc_h = fb->height - y;
 
return exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-  crtc_w, crtc_h, x, y, crtc_w, crtc_h);
+  crtc_w, crtc_h, x << 16, y << 16,
+  crtc_w << 16, crtc_h << 16);
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -202,8 +203,8 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc_w = fb->width - crtc->x;
crtc_h = fb->height - crtc->y;
ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, crtc->x, crtc->y,
- crtc_w, crtc_h);
+ crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
+ crtc_w << 16, crtc_h << 16);
if (ret) {
crtc->primary->fb = old_fb;
spin_lock_irq(&dev->event_lock);
-- 
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 v9 02/18] drm/exynos: atomic phase 1: use drm_plane_helper_update()

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Rip out the check from exynos_update_plane() and create
exynos_check_plane() for the check phase enabling use to use
the atomic helpers to call our check and update phases when updating
planes.

Update all users of exynos_update_plane() accordingly to call
exynos_check_plane() before.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi y
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 31 
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 40 +++
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 +-
 3 files changed, 47 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 363b019..ba44c9b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
*crtc, int x, int y,
struct drm_framebuffer *fb = crtc->primary->fb;
unsigned int crtc_w;
unsigned int crtc_h;
+   int ret;
 
/* when framebuffer changing is requested, crtc's dpms should be on */
if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
@@ -123,12 +124,17 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
*crtc, int x, int y,
return -EPERM;
}
 
+   ret = exynos_check_plane(crtc->primary, fb);
+   if (ret)
+   return ret;
+
crtc_w = fb->width - x;
crtc_h = fb->height - y;
+   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
+   crtc_w, crtc_h, x << 16, y << 16,
+   crtc_w << 16, crtc_h << 16);
 
-   return exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-  crtc_w, crtc_h, x << 16, y << 16,
-  crtc_w << 16, crtc_h << 16);
+   return 0;
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -165,7 +171,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 {
struct drm_device *dev = crtc->dev;
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_framebuffer *old_fb = crtc->primary->fb;
unsigned int crtc_w, crtc_h;
int ret;
 
@@ -184,6 +189,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
goto out;
}
 
+   ret = exynos_check_plane(crtc->primary, fb);
+   if (ret)
+   goto out;
+
ret = drm_vblank_get(dev, exynos_crtc->pipe);
if (ret) {
DRM_DEBUG("failed to acquire vblank counter\n");
@@ -202,17 +211,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc->primary->fb = fb;
crtc_w = fb->width - crtc->x;
crtc_h = fb->height - crtc->y;
-   ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
- crtc_w << 16, crtc_h << 16);
-   if (ret) {
-   crtc->primary->fb = old_fb;
-   spin_lock_irq(&dev->event_lock);
-   exynos_crtc->event = NULL;
-   drm_vblank_put(dev, exynos_crtc->pipe);
-   spin_unlock_irq(&dev->event_lock);
-   return ret;
-   }
+   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
+   crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
+   crtc_w << 16, crtc_h << 16);
 
return 0;
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index b1180fb..2aaed64 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -144,21 +144,15 @@ void exynos_plane_mode_set(struct drm_plane *plane, 
struct drm_crtc *crtc,
plane->crtc = crtc;
 }
 
-int
+void
 exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 struct drm_framebuffer *fb, int crtc_x, int crtc_y,
 unsigned int crtc_w, unsigned int crtc_h,
 uint32_t src_x, uint32_t src_y,
 uint32_t src_w, uint32_t src_h)
 {
-
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   int ret;
-
-   ret = exynos_check_plane(plane, fb);
-   if (ret < 0)
-   return ret;
 
exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
  crtc_w, crtc_h, src_x >> 16, src_y >> 16,
@@ -166,8 +160,6 @@ exynos_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
 
if (exynos_crtc->ops->win_commit)
exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
-
-   return 0;
 }
 
 static int exynos_disable_plane(struct drm_plane *plane)
@@ -183,11 +175,37 @@ static int exyno

[PATCH v9 00/18] drm/exynos: atomic modesetting support

2015-05-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Hi,

Here goes the full support for atomic modesetting on exynos. I've
split the patches in the various phases of atomic support.

v2: fixes comments by Joonyoung
- remove unused var in patch 09
- use ->disable instead of outdated ->dpms in hdmi code
- remove WARN_ON from crtc enable/disable

v3: fixes comment by Joonyoung
- move the removal of drm_helper_disable_unused_functions() to
separated patch

v4: add patches that remove unnecessary calls to disable_plane()

v5: fixes NULL CRTC crash on planes updates (reported by Inki and Tobias)

v6: rebase on latest exynos_drm_next

v7: fix comments by Joonyoung
- fix two checkpatch errors
- remove extra crtc->commit() call
- check for null fb on exynos_check_plane()

v8: fix comments by Joonyoung
- fix merge error
- move drm_crtc_vblank_get to the commit that introduces atomic pageflip
- remove .prepare() in the apropiated patch
- add a new patch to move exynos_drm_crtc_disable()

v9:  * fix comments by Joonyoung
- also remove encoder .prepare()
- do not shift exynos_update_plane() parameters
- remove unused .mode_set() and .mode_set_base()
 * add specific exynos .atomic_commit()
 * add split of exynos_crtc->ops->dpms() into enable() and disable()
 * add other atomic clean ups


Gustavo Padovan (17):
  drm/exynos: atomic phase 1: use drm_plane_helper_update()
  drm/exynos: atomic phase 1: use drm_plane_helper_disable()
  drm/exynos: atomic phase 1: add .mode_set_nofb() callback
  drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
destroy()
  drm/exynos: atomic phase 2: keep track of framebuffer pointer
  drm/exynos: atomic phase 3: atomic updates of planes
  drm/exynos: atomic phase 3: use atomic .set_config helper
  drm/exynos: atomic phase 3: convert page flips
  drm/exynos: remove exported functions from exynos_drm_plane
  drm/exynos: don't disable unused functions at init
  drm/exynos: move exynos_drm_crtc_disable()
  drm/exynos: add exynos specific .atomic_commit()
  drm/exynos: atomic dpms support
  drm/exynos: remove unnecessary calls to disable_plane()
  drm/exynos: split exynos_crtc->dpms in enable() and disable()
  drm/exynos: rename win_commit/disable to atomic-like names
  drm/exynos: don't disable planes already disabled

Joonyoung Shim (1):
  drm/exynos: fix source data argument for plane

 drivers/gpu/drm/bridge/ps8622.c |   6 +-
 drivers/gpu/drm/bridge/ptn3460.c|   6 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  |  45 +++
 drivers/gpu/drm/exynos/exynos_dp_core.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 201 ++--
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   2 +
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  14 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  35 +
 drivers/gpu/drm/exynos/exynos_drm_fb.c  |  35 +
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c   |   3 -
 drivers/gpu/drm/exynos/exynos_drm_fimd.c|  58 +++-
 drivers/gpu/drm/exynos/exynos_drm_plane.c   | 128 ++
 drivers/gpu/drm/exynos/exynos_drm_plane.h   |  11 --
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|  71 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  10 +-
 drivers/gpu/drm/exynos/exynos_mixer.c   |  44 +++---
 18 files changed, 276 insertions(+), 411 deletions(-)

-- 
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: [PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-28 Thread Gustavo Padovan
2015-05-28 Joonyoung Shim :

> On 05/28/2015 05:24 PM, Joonyoung Shim wrote:
> > On 05/28/2015 02:39 PM, Inki Dae wrote:
> >> Hi Gustavo,
> >>
> >> On 2015년 05월 28일 05:27, Gustavo Padovan wrote:
> >>> Hi Inki,
> >>>
> >>> 2015-05-27 Inki Dae :
> >>>
>  Hi Gustavo,
> 
>  On 2015년 05월 23일 00:40, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> >
> > Run dpms operations through the atomic intefaces. This basically removes
> > the .dpms() callback from econders and crtcs and use .disable() and
> > .enable() to turn the crtc on and off.
> >
> > v2: Address comments by Joonyoung:
> > - make hdmi code call ->disable() instead of ->dpms()
> > - do not use WARN_ON on crtc enable/disable
> >
> > v3: - Fix build failure after the hdmi change in v2
> > - Change dpms helper of ptn3460 bridge
> >
> > Signed-off-by: Gustavo Padovan 
> > Reviewed-by: Joonyoung Shim 
> > Tested-by: Tobias Jakobi 
> > ---
> >  drivers/gpu/drm/bridge/ps8622.c |  2 +-
> >  drivers/gpu/drm/bridge/ptn3460.c|  2 +-
> >  drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 
> > -
> >  drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
> >  drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
> >  drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
> >  drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
> >  10 files changed, 69 insertions(+), 75 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/ps8622.c 
> > b/drivers/gpu/drm/bridge/ps8622.c
> > index b604326..d686235 100644
> > --- a/drivers/gpu/drm/bridge/ps8622.c
> > +++ b/drivers/gpu/drm/bridge/ps8622.c
> > @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct 
> > drm_connector *connector)
> >  }
> >  
> >  static const struct drm_connector_funcs ps8622_connector_funcs = {
> > -   .dpms = drm_helper_connector_dpms,
> > +   .dpms = drm_atomic_helper_connector_dpms,
> > .fill_modes = drm_helper_probe_single_connector_modes,
> > .detect = ps8622_detect,
> > .destroy = ps8622_connector_destroy,
> > diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
> > b/drivers/gpu/drm/bridge/ptn3460.c
> > index 8ed3617..260bc9f 100644
> > --- a/drivers/gpu/drm/bridge/ptn3460.c
> > +++ b/drivers/gpu/drm/bridge/ptn3460.c
> > @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
> > drm_connector *connector)
> >  }
> >  
> >  static struct drm_connector_funcs ptn3460_connector_funcs = {
> > -   .dpms = drm_helper_connector_dpms,
> > +   .dpms = drm_atomic_helper_connector_dpms,
> > .fill_modes = drm_helper_probe_single_connector_modes,
> > .detect = ptn3460_detect,
> > .destroy = ptn3460_connector_destroy,
> > diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
> > b/drivers/gpu/drm/exynos/exynos_dp_core.c
> > index 195fe60..c9995b1 100644
> > --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> > +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> > @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
> > drm_connector *connector)
> >  }
> >  
> 
>  [--snip--]
> 
> >  
> >  static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
> > -   .dpms   = exynos_drm_crtc_dpms,
> > -   .prepare= exynos_drm_crtc_prepare,
> > -   .commit = exynos_drm_crtc_commit,
> > +   .enable = exynos_drm_crtc_enable,
> > +   .disable= exynos_drm_crtc_disable,
> > .mode_fixup = exynos_drm_crtc_mode_fixup,
> > .mode_set   = drm_helper_crtc_mode_set,
> > .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
> 
>  I think it'd be better to use atomic_flush callback to enable global dma
>  like commit callback did. Is there any reason that you don't use
>  atomic_begin and atomic_flush callbacks?
> 
>  atomic relevant codes I looked into do as follows,
> 
>  atomic_begin();
> 
>  atomic_update();  /* this will call win_commit callback to set a overlay
>  relevant registers and enable its dma channel. */
> 
>  atomic_flush();
> 
>  So atomic overlay updating between atomic_begin() ~ atomic_flush() will
>  be guaranteed.
> >>>
> >>> I think we can go down that road, but I'd suggest we push the atomic
> >>> patches v8 (with the lastest comments from Joonyoung fixed) and then 
> >>> work on the change you are proposing as a follow-up together with the 
> >>> other improvements for atomic I already have queued here. 

Re: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order

2015-05-28 Thread Kevin Hilman
Marek Szyprowski  writes:

> Hello,
>
> On 2015-05-28 06:00, Chanho Park wrote:
>>> -Original Message-
>>> From: Joonyoung Shim [mailto:jy0922.s...@samsung.com]
>>> Sent: Thursday, May 28, 2015 10:59 AM
>>> To: Chanho Park; kg...@kernel.org; k.kozlow...@samsung.com
>>> Cc: cw00.c...@samsung.com; linux-samsung-soc@vger.kernel.org;
>>> javier.marti...@collabora.co.uk; khil...@linaro.org;
>>> sjoerd.sim...@collabora.co.uk; heesub.s...@samsung.com
>>> Subject: Re: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order
>>>
>>> Hi Chanho,
>>>
>>> On 05/28/2015 12:15 AM, 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.
>>> The exynos5422 SoC can boot using cortex-a15 cpu depending on gpio
>>> GPG2CON[1],
>> Yes, But, the pin is not controllable because it's checked in  the iROM
>> area.
>>
>>> i think this is just Odroid-XU3 board problem. Is it
>>> possible to overwrite cpus information directly from
>>> exynos5422-odroidxu3.dts?
>> It's possible to override the info in the odroidxu3.dts. As you know,
>> however, a new exynos5422 board will be added soon. The board also has same
>> configuration of the gpio pin and booted cpu0 from a cortex-a7 core.
>>
>> BTW, booting of secondary cpus are still broken. Is there any progress of
>> the patch[1]?
>> This patch is also generated top of the patch with some fixes.

Note that even with that hack/patch from me, all cores may boot, but you
cannot let them hit deeper idle states with CPUidle.  This is because
the firmware appears to have configured CCI in secure mode, which mean
that the kernel cannot control CCI, which essentially breaks MCPM  and
everthing built on it (idle, suspend, etc.)

> Przemyslaw is checking how to solve this issue in the bootloader like it has
> been solved for Exynos 5800 based Chromebooks. The plan is to use the same
> SPL code as mentioned here:
> https://www.mail-archive.com/u-boot@lists.denx.de/msg159960.html

This is good news!   I'd be happy to test any work in progress on this.

We really need the other exynos platforms to follow the bootloader of
the chromebooks which includes a working CCI and thus kernel MCPM
functionality.

Kevin

--
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] clocksource: exynos_mct: fix for sleeping in atomic ctx handling cpu hotplug notif.

2015-05-28 Thread Damian Eppel
On Thu, 2015-05-28 at 11:47 +0200, Marek Szyprowski wrote:
> Hello,
> 
> On 2015-03-12 10:11, Damian Eppel wrote:
> > This is to fix an issue of sleeping in atomic context when processing
> > hotplug notifications in Exynos MCT(Multi-Core Timer).
> > The issue was reproducible on Exynos 3250 (Rinato board) and Exynos 5420
> > (Arndale Octa board).
> >
> > Whilst testing cpu hotplug events on kernel configured with DEBUG_PREEMPT
> > and DEBUG_ATOMIC_SLEEP we get following BUG message, caused by calling
> > request_irq() and free_irq() in the context of hotplug notification
> > (which is in this case atomic context).
> >
> > root@target:~# echo 0 > /sys/devices/system/cpu/cpu1/online
> >
> > [   25.157867] IRQ18 no longer affine to CPU1
> > ...
> > [   25.158445] CPU1: shutdown
> >
> > root@target:~# echo 1 > /sys/devices/system/cpu/cpu1/online
> >
> > [   40.785859] CPU1: Software reset
> > [   40.786660] BUG: sleeping function called from invalid context at 
> > mm/slub.c:1241
> > [   40.786668] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/1
> > [   40.786678] Preemption disabled at:[<  (null)>]   (null)
> > [   40.786681]
> > [   40.786692] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 
> > 3.19.0-rc4-00024-g7dca860 #36
> > [   40.786698] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> > [   40.786728] [] (unwind_backtrace) from [] 
> > (show_stack+0x10/0x14)
> > [   40.786747] [] (show_stack) from [] 
> > (dump_stack+0x70/0xbc)
> > [   40.786767] [] (dump_stack) from [] 
> > (kmem_cache_alloc+0xd8/0x170)
> > [   40.786785] [] (kmem_cache_alloc) from [] 
> > (request_threaded_irq+0x64/0x128)
> > [   40.786804] [] (request_threaded_irq) from [] 
> > (exynos4_local_timer_setup+0xc0/0x13c)
> > [   40.786820] [] (exynos4_local_timer_setup) from [] 
> > (exynos4_mct_cpu_notify+0x30/0xa8)
> > [   40.786838] [] (exynos4_mct_cpu_notify) from [] 
> > (notifier_call_chain+0x44/0x84)
> > [   40.786857] [] (notifier_call_chain) from [] 
> > (__cpu_notify+0x28/0x44)
> > [   40.786873] [] (__cpu_notify) from [] 
> > (secondary_start_kernel+0xec/0x150)
> > [   40.786886] [] (secondary_start_kernel) from [<40008764>] 
> > (0x40008764)
> >
> > Solution:
> > Clockevent irqs cannot be requested/freed every time cpu is
> > hot-plugged/unplugged as CPU_STARTING/CPU_DYING notifications
> > that signals hotplug or unplug events are sent with both preemption
> > and local interrupts disabled. Since request_irq() may sleep it is
> > moved to the initialization stage and performed for all possible
> > cpus prior putting them online. Then, in the case of hotplug event
> > the irq asociated with the given cpu will simply be enabled.
> > Similarly on cpu unplug event the interrupt is not freed but just
> > disabled.
> >
> > Note that after successful request_irq() call for a clockevent device
> > associated to given cpu the requested irq is disabled (via disable_irq()).
> > That is to make things symmetric as we expect hotplug event as a next
> > thing (which will enable irq again). This should not pose any problems
> > because at the time of requesting irq the clockevent device is not
> > fully initialized yet, therefore should not produce interrupts at that 
> > point.
> >
> > For disabling an irq at cpu unplug notification disable_irq_nosync() is
> > chosen which is a non-blocking function. This again shouldn't be a problem 
> > as
> > prior sending CPU_DYING notification interrupts are migrated away
> > from the cpu.
> >
> > Fixes: 7114cd749a12 ("clocksource: exynos_mct: use (request/free)_irq calls 
> > for local timer registration")
> > Signed-off-by: Damian Eppel 
> > Cc: 
> > Reported-by: Krzysztof Kozlowski 
> > Reviewed-by: Krzysztof Kozlowski 
> > Tested-by: Krzysztof Kozlowski 
> > (Tested on Arndale Octa Board)
> > Tested-by: Marcin Jabrzyk 
> > (Tested on Rinato B2 (Exynos 3250) board)
> > ---
> >
> > Notes:
> >  Changes since v1:
> >  o added Krzysztof's and Marcin's Reviewed-by / Tested-by
> >with information about the test HW.
> >
> >   drivers/clocksource/exynos_mct.c | 45 
> > 
> >   1 file changed, 32 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/clocksource/exynos_mct.c 
> > b/drivers/clocksource/exynos_mct.c
> > index 83564c9..9beca58 100644
> > --- a/drivers/clocksource/exynos_mct.c
> > +++ b/drivers/clocksource/exynos_mct.c
> > @@ -466,15 +466,12 @@ static int exynos4_local_timer_setup(struct 
> > clock_event_device *evt)
> > exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET);
> >   
> > if (mct_int_type == MCT_INT_SPI) {
> > -   evt->irq = mct_irqs[MCT_L0_IRQ + cpu];
> > -   if (request_irq(evt->irq, exynos4_mct_tick_isr,
> > -   IRQF_TIMER | IRQF_NOBALANCING,
> > -   evt->name, mevt)) {
> > -   pr_err("exynos-mct: cannot register IRQ %d\n",
> > -   evt->irq);
> > +
> > +  

Re: [PATCH] regulator: s2mps11: Fix GPIO suspend enable shift wrapping bug

2015-05-28 Thread Mark Brown
On Wed, May 27, 2015 at 12:22:08PM +0900, Krzysztof Kozlowski wrote:
> Status of enabling suspend mode for regulator was stored in bitmap-like
> long integer.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH v3 6/7] mfd: cros_ec: Support multiple EC in a system

2015-05-28 Thread Javier Martinez Canillas
Hello Lee,

[...]

On 05/28/2015 04:26 PM, Lee Jones wrote:
>> >>  
>> >> + if (ec_dev->max_passthru) {
>> >> + /*
>> >> +  * Register a PD device as well on top of this device.
>> >> +  * We make the following assumptions:
>> >> +  * - behind an EC, we have a pd
>> >> +  * - only one device added.
>> >> +  * - the EC is responsive at init time (it is not true for a
>> >> +  *   sensor hub.
>> >> +  */
>> >> + err = cros_ec_dev_register(ec_dev, dev_id++, 1);
>> > 
>> > I don't really like this devidx business.  Just keep it simple and
>> > define more than one mfd_cell structure.
>> 
>> I explained to you that this is done because the number of cells depends on
>> the system. I can have an array of mfd_cell structures and use the index to
>> register but I don't think that is easier to understand.
> 
> Keep it simple.  Create a static struct for each and:
> 
> mfd_add_devices(ec_cell)
> 
> if (ec_dev->max_passthru)
>mfd_add_devices(ec_pd_cell)
>

Ok, will do.

Thanks a lot for your feedback.

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


Re: [PATCH v3 6/7] mfd: cros_ec: Support multiple EC in a system

2015-05-28 Thread Lee Jones
On Thu, 28 May 2015, Javier Martinez Canillas wrote:

> Hello Lee,
> 
> Thanks a lot for your feedback.
> 
> On 05/27/2015 11:11 AM, Lee Jones wrote:
> > On Fri, 22 May 2015, Javier Martinez Canillas wrote:
> > 
> >> From: Gwendal Grignou 
> >> 
> >> Chromebooks can have more than one Embedded Controller so the
> >> cros_ec device id has to be incremented for each EC registered.
> >> 
> >> Add code to handle multiple EC. First ec found is cros-ec0,
> >> second cros-ec1 and so on.
> >> 
> >> Add a new structure to represent multiple EC as different char
> >> devices (e.g: /dev/cros_ec, /dev/cros_pd). It connects to
> >> cros_ec_device and allows sysfs inferface for cros_pd.
> >> 
> >> Also reduce number of allocated objects, make chromeos sysfs
> >> class object a static and add refcounting to prevent object
> >> deletion while command is in progress.
> >> 
> >> Signed-off-by: Gwendal Grignou 
> >> Reviewed-by: Dmitry Torokhov 
> >> Signed-off-by: Javier Martinez Canillas 
> >> ---
> >> 
> >> Changes since v2: None
> >> 
> >> Changes since v1:
> >>   - Squash patch that adds support to represent EC's as different
> >> char devices (e.g: /dev/cros_ec, /dev/cros_pd):
> >> https://chromium-review.googlesource.com/#/c/217297/
> >> Suggested by Gwendal Grignou
> >>   - Use cros_ec instead of cros-ec in the subject line to be consistent.
> >> Suggested by Gwendal Grignou
> >> ---
> >>  drivers/input/keyboard/cros_ec_keyb.c  |   2 +-
> >>  drivers/mfd/cros_ec.c  |  66 +--
> >>  drivers/mfd/cros_ec_i2c.c  |   1 -
> >>  drivers/mfd/cros_ec_spi.c  |   1 -
> >>  drivers/platform/chrome/cros_ec_dev.c  | 128 
> >> -
> >>  drivers/platform/chrome/cros_ec_dev.h  |   7 --
> >>  drivers/platform/chrome/cros_ec_lightbar.c |  75 +
> >>  drivers/platform/chrome/cros_ec_lpc.c  |   1 -
> >>  drivers/platform/chrome/cros_ec_sysfs.c|  48 +--
> >>  include/linux/mfd/cros_ec.h|  44 --
> >>  10 files changed, 247 insertions(+), 126 deletions(-)

[...]

> >> @@ -52,14 +88,28 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
> >>  
> >>cros_ec_query_all(ec_dev);
> >>  
> >> -  err = mfd_add_devices(dev, 0, cros_devs,
> >> -ARRAY_SIZE(cros_devs),
> >> -NULL, ec_dev->irq, NULL);
> >> +  err = cros_ec_dev_register(ec_dev, dev_id++, 0);
> >>if (err) {
> >> -  dev_err(dev, "failed to add mfd devices\n");
> >> +  dev_err(dev, "failed to add ec\n");
> >>return err;
> >>}
> >>  
> >> +  if (ec_dev->max_passthru) {
> >> +  /*
> >> +   * Register a PD device as well on top of this device.
> >> +   * We make the following assumptions:
> >> +   * - behind an EC, we have a pd
> >> +   * - only one device added.
> >> +   * - the EC is responsive at init time (it is not true for a
> >> +   *   sensor hub.
> >> +   */
> >> +  err = cros_ec_dev_register(ec_dev, dev_id++, 1);
> > 
> > I don't really like this devidx business.  Just keep it simple and
> > define more than one mfd_cell structure.
> 
> I explained to you that this is done because the number of cells depends on
> the system. I can have an array of mfd_cell structures and use the index to
> register but I don't think that is easier to understand.

Keep it simple.  Create a static struct for each and:

mfd_add_devices(ec_cell)

if (ec_dev->max_passthru)
   mfd_add_devices(ec_pd_cell)

> >> +  if (err) {
> >> +  dev_err(dev, "failed to add additional ec\n");
> >> +  return err;
> >> +  }
> >> +  }
> >> +
> >>if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
> >>err = of_platform_populate(dev->of_node, NULL, NULL, dev);
> >>if (err) {
> > 
> 
> Best regards,
> Javier

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 6/7] mfd: cros_ec: Support multiple EC in a system

2015-05-28 Thread Javier Martinez Canillas
Hello Lee,

Thanks a lot for your feedback.

On 05/27/2015 11:11 AM, Lee Jones wrote:
> On Fri, 22 May 2015, Javier Martinez Canillas wrote:
> 
>> From: Gwendal Grignou 
>> 
>> Chromebooks can have more than one Embedded Controller so the
>> cros_ec device id has to be incremented for each EC registered.
>> 
>> Add code to handle multiple EC. First ec found is cros-ec0,
>> second cros-ec1 and so on.
>> 
>> Add a new structure to represent multiple EC as different char
>> devices (e.g: /dev/cros_ec, /dev/cros_pd). It connects to
>> cros_ec_device and allows sysfs inferface for cros_pd.
>> 
>> Also reduce number of allocated objects, make chromeos sysfs
>> class object a static and add refcounting to prevent object
>> deletion while command is in progress.
>> 
>> Signed-off-by: Gwendal Grignou 
>> Reviewed-by: Dmitry Torokhov 
>> Signed-off-by: Javier Martinez Canillas 
>> ---
>> 
>> Changes since v2: None
>> 
>> Changes since v1:
>>   - Squash patch that adds support to represent EC's as different
>> char devices (e.g: /dev/cros_ec, /dev/cros_pd):
>> https://chromium-review.googlesource.com/#/c/217297/
>> Suggested by Gwendal Grignou
>>   - Use cros_ec instead of cros-ec in the subject line to be consistent.
>> Suggested by Gwendal Grignou
>> ---
>>  drivers/input/keyboard/cros_ec_keyb.c  |   2 +-
>>  drivers/mfd/cros_ec.c  |  66 +--
>>  drivers/mfd/cros_ec_i2c.c  |   1 -
>>  drivers/mfd/cros_ec_spi.c  |   1 -
>>  drivers/platform/chrome/cros_ec_dev.c  | 128 
>> -
>>  drivers/platform/chrome/cros_ec_dev.h  |   7 --
>>  drivers/platform/chrome/cros_ec_lightbar.c |  75 +
>>  drivers/platform/chrome/cros_ec_lpc.c  |   1 -
>>  drivers/platform/chrome/cros_ec_sysfs.c|  48 +--
>>  include/linux/mfd/cros_ec.h|  44 --
>>  10 files changed, 247 insertions(+), 126 deletions(-)
>> 
>> diff --git a/drivers/input/keyboard/cros_ec_keyb.c 
>> b/drivers/input/keyboard/cros_ec_keyb.c
>> index 974154a74505..b01966dc7eb3 100644
>> --- a/drivers/input/keyboard/cros_ec_keyb.c
>> +++ b/drivers/input/keyboard/cros_ec_keyb.c
>> @@ -275,7 +275,7 @@ static int cros_ec_keyb_probe(struct platform_device 
>> *pdev)
>>  ckdev->dev = dev;
>>  dev_set_drvdata(&pdev->dev, ckdev);
>>  
>> -idev->name = ec->ec_name;
>> +idev->name = CROS_EC_DEV_NAME;
>>  idev->phys = ec->phys_name;
>>  __set_bit(EV_REP, idev->evbit);
>>  
>> diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
>> index 08d82bfc5268..99292bc2fe5f 100644
>> --- a/drivers/mfd/cros_ec.c
>> +++ b/drivers/mfd/cros_ec.c
>> @@ -24,12 +24,48 @@
>>  #include 
>>  #include 
>>  
>> -static const struct mfd_cell cros_devs[] = {
>> -{
>> +static int dev_id;
>> +
>> +static int cros_ec_dev_register(struct cros_ec_device *ec_dev,
>> +int dev_id, int devidx)
> 
> What's the difference between dev_id and devidx.
> 
> Confusing don't you think?

dev_id is the id that mfd_add_devices() expects and devidx is the ChromeOS
EC device index. Since the first EC is called "cros_ec" and the second one
is called "cros_pd".

I'll rename devidx to ec_dev_index to make it more clear.

> 
>> +{
>> +struct device *dev = ec_dev->dev;
>> +struct cros_ec_platform ec_p = {
>> +.cmd_offset = 0,
>> +};
>> +
>> +struct mfd_cell ec_cell = {
>>  .name = "cros-ec-ctl",
>>  .id = PLATFORM_DEVID_AUTO,
>> -},
>> -};
>> +.platform_data = &ec_p,
>> +.pdata_size = sizeof(ec_p),
>> +};
> 
> Why have you bought this into here?  The convention is usually to have
> this at the top of the file, outside any functions.  Declaring and
> initialising structs inside functions makes things looks messy IMHO.
>

The problem is that not all ChromeOS EC have a chained Power Delivery (PD)
EC so on runtime the Application Processor (AP) asks the host EC if there
is a PD and only in that case calls cros_ec_dev_register() for the PD EC.

That's why the struct mfd_cell is allocated inside the function as a stack
local variable and is not declared as a static mfd cells array at the top
as it is in other MFD drivers.

> 
> 
>> +switch (devidx) {
>> +case 0:
> 
> Please define these.  I have no idea what devidx 0 or 1 is.
>

Ok, those are just a device index but I'll define it as CROS_EC_DEV_EC_INDEX
and CROS_EC_DEV_PD_INDEX to make it more readable.

>> +if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
>> +ec_p.ec_name = of_get_property(dev->of_node, "devname",
>> +   NULL);
>> +if (ec_p.ec_name == NULL) {
> 
> if (!ec_p.ec_name)
>

Ok.

>> +dev_dbg(dev,
>> +"Device name not found, using default");
>> +ec_p.ec_name = CROS_EC_DEV_NAME;
>

Re: [PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-28 Thread Joonyoung Shim
On 05/28/2015 05:24 PM, Joonyoung Shim wrote:
> On 05/28/2015 02:39 PM, Inki Dae wrote:
>> Hi Gustavo,
>>
>> On 2015년 05월 28일 05:27, Gustavo Padovan wrote:
>>> Hi Inki,
>>>
>>> 2015-05-27 Inki Dae :
>>>
 Hi Gustavo,

 On 2015년 05월 23일 00:40, Gustavo Padovan wrote:
> From: Gustavo Padovan 
>
> Run dpms operations through the atomic intefaces. This basically removes
> the .dpms() callback from econders and crtcs and use .disable() and
> .enable() to turn the crtc on and off.
>
> v2: Address comments by Joonyoung:
>   - make hdmi code call ->disable() instead of ->dpms()
>   - do not use WARN_ON on crtc enable/disable
>
> v3: - Fix build failure after the hdmi change in v2
> - Change dpms helper of ptn3460 bridge
>
> Signed-off-by: Gustavo Padovan 
> Reviewed-by: Joonyoung Shim 
> Tested-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/bridge/ps8622.c |  2 +-
>  drivers/gpu/drm/bridge/ptn3460.c|  2 +-
>  drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 
> -
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
>  drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
>  10 files changed, 69 insertions(+), 75 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ps8622.c 
> b/drivers/gpu/drm/bridge/ps8622.c
> index b604326..d686235 100644
> --- a/drivers/gpu/drm/bridge/ps8622.c
> +++ b/drivers/gpu/drm/bridge/ps8622.c
> @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct 
> drm_connector *connector)
>  }
>  
>  static const struct drm_connector_funcs ps8622_connector_funcs = {
> - .dpms = drm_helper_connector_dpms,
> + .dpms = drm_atomic_helper_connector_dpms,
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = ps8622_detect,
>   .destroy = ps8622_connector_destroy,
> diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
> b/drivers/gpu/drm/bridge/ptn3460.c
> index 8ed3617..260bc9f 100644
> --- a/drivers/gpu/drm/bridge/ptn3460.c
> +++ b/drivers/gpu/drm/bridge/ptn3460.c
> @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
> drm_connector *connector)
>  }
>  
>  static struct drm_connector_funcs ptn3460_connector_funcs = {
> - .dpms = drm_helper_connector_dpms,
> + .dpms = drm_atomic_helper_connector_dpms,
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = ptn3460_detect,
>   .destroy = ptn3460_connector_destroy,
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
> b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 195fe60..c9995b1 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
> drm_connector *connector)
>  }
>  

 [--snip--]

>  
>  static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
> - .dpms   = exynos_drm_crtc_dpms,
> - .prepare= exynos_drm_crtc_prepare,
> - .commit = exynos_drm_crtc_commit,
> + .enable = exynos_drm_crtc_enable,
> + .disable= exynos_drm_crtc_disable,
>   .mode_fixup = exynos_drm_crtc_mode_fixup,
>   .mode_set   = drm_helper_crtc_mode_set,
>   .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,

 I think it'd be better to use atomic_flush callback to enable global dma
 like commit callback did. Is there any reason that you don't use
 atomic_begin and atomic_flush callbacks?

 atomic relevant codes I looked into do as follows,

 atomic_begin();

 atomic_update();  /* this will call win_commit callback to set a overlay
 relevant registers and enable its dma channel. */

 atomic_flush();

 So atomic overlay updating between atomic_begin() ~ atomic_flush() will
 be guaranteed.
>>>
>>> I think we can go down that road, but I'd suggest we push the atomic
>>> patches v8 (with the lastest comments from Joonyoung fixed) and then 
>>> work on the change you are proposing as a follow-up together with the 
>>> other improvements for atomic I already have queued here. This way
>>> we don't take the risk of missing one more merge window.
>>
>> We(I and Joonyoung) will have discussion about this patch series. For
>> this, we have already started to analyze entire atomic features
>> including your patch set so I'd merge it at end of next week according
>> to the discussion. I'm not kind of sure yet but I will merge it as long
>> as there is no

Re: [PATCH] clk: make several parent names const

2015-05-28 Thread Heiko Stuebner
Am Donnerstag, 28. Mai 2015, 10:45:51 schrieb Uwe Kleine-König:
> Since commit 2893c379461a ("clk: make strings in parent name arrays
> const") the name of parent clocks can be const. So add more const in
> several clock drivers.
> 
> Signed-off-by: Uwe Kleine-König 


Acked-by: Heiko Stuebner 

> ---
> Hello,
> 
> commit 2893c379461a isn't in Linus Torvald's tree yet, so the commit
> message needs adaption if clk-next is rewritten.
> 
> Should I split this patch per subdir?

I don't have any Rockchip-related clock changes for 4.2, so for me it's not 
important if you split it or keep it together.


Thanks
Heiko
--
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: odroidxu3: Enable USB3 regulators

2015-05-28 Thread Anand Moon
Hi Krzysztof,

I will take care of these issue in the future.

-Anand Moon

On 28 May 2015 at 14:49, Krzysztof Kozlowski  wrote:
> On 28.05.2015 17:58, Anand Moon wrote:
>> Enable regulator for usbdrd3_0 and usbdrd3_1
>>>From the schematic pin diagram USB3_0 and USB3_1
>> is regulated by LDO9 and LD011.
>
> Please reformat statement above to proper sentence(s) without ">" before
> "From".
>
>>
>> Fix the boot message of failed.
>> [3.503539] exynos-dwc3 usb@1200: Looking up vdd33-supply from device 
>> tree
>> [3.503556] exynos-dwc3 usb@1200: Looking up vdd33-supply property in 
>> node /usb@1200 failed
>> [3.503568] usb@1200 supply vdd33 not found, using dummy regulator
>> [3.509154] exynos-dwc3 usb@1200: Looking up vdd10-supply from device 
>> tree
>> [3.509170] exynos-dwc3 usb@1200: Looking up vdd10-supply property in 
>> node /usb@1200 failed
>> [3.509181] usb@1200 supply vdd10 not found, using dummy regulator
>> [3.917548] exynos-dwc3 usb@1240: Looking up vdd33-supply from device 
>> tree
>> [3.917565] exynos-dwc3 usb@1240: Looking up vdd33-supply property in 
>> node /usb@1240 failed
>> [3.917578] usb@1240 supply vdd33 not found, using dummy regulator
>> [3.922731] exynos-dwc3 usb@1240: Looking up vdd10-supply from device 
>> tree
>> [3.922747] exynos-dwc3 usb@1240: Looking up vdd10-supply property in 
>> node /usb@1240 failed
>>
>> ---
>> This patch is based on Krzysztof github branch 
>> work-next/odroid-xu3-s2mps11-irq
>> ---
>
> I mentioned this already on previous postings. Let's make an exercise.
> Please:
> 1. Save your email as mbox format (from mailer).
> 2. Go to a GIT repo with kernel and checkout base branch.
> 3. git am 0001-the-name-of-file.mbox
> 4. git show
>
> Do you see the signed-off-by in commit?
>
> The patch itself looks good, thanks for fixing this. Just please fix the
> issues with commit message.
>
> By the way:
> 1. The always-on from LDO9 could be probably removed if the ehci-exynos
> driver had regulator consumer implemented.
> 2. The Documentation/devicetree/bindings/usb/exynos-usb.txt (or dwc.txt)
> should proably mention the vdd-supply property.
>
> 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: exynos: Fix wake-up interrupts for Exynos3250

2015-05-28 Thread Marc Zyngier
On 27/04/15 01:53, Kukjin Kim wrote:
> Krzysztof Kozlowski wrote:
>>
>> 2015-04-23 2:40 GMT+09:00 Marc Zyngier :
>>> Commit 8b283c025443 (ARM: exynos4/5: convert pmu wakeup to
>>> stacked domains) changed the Exynos PMU code to use stacked
>>> domains. This has led to a number of interrupt numbers to be
>>> fixed.
>>>
>>> In the meantime, support for Exynos 3250 was added, missing
>>> the required change to this platform. This amounts to revert
>>> ace283a04a4a (ARM: EXYNOS: Fix wrong hwirq of RTC interrupt
>>> for Exynos3250 SoC), as the initial patch was right, just a
>>> bit early...
>>>
>>> Cc: Chanwoo Choi 
>>> Cc: Kyungmin Park 
>>> Cc: Krzysztof Kozlowski 
>>> Cc: Kukjin Kim 
>>> Signed-off-by: Marc Zyngier 
>>> ---
>>>  arch/arm/mach-exynos/suspend.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> Acked-by: Krzysztof Kozlowski 
>>
> Thanks and applied.

Looks like this fix never made it to mainline. What happened?

Thanks,

M.
-- 
Jazz is not dead. It just smells funny...
--
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] clocksource: exynos_mct: fix for sleeping in atomic ctx handling cpu hotplug notif.

2015-05-28 Thread Marek Szyprowski

Hello,

On 2015-03-12 10:11, Damian Eppel wrote:

This is to fix an issue of sleeping in atomic context when processing
hotplug notifications in Exynos MCT(Multi-Core Timer).
The issue was reproducible on Exynos 3250 (Rinato board) and Exynos 5420
(Arndale Octa board).

Whilst testing cpu hotplug events on kernel configured with DEBUG_PREEMPT
and DEBUG_ATOMIC_SLEEP we get following BUG message, caused by calling
request_irq() and free_irq() in the context of hotplug notification
(which is in this case atomic context).

root@target:~# echo 0 > /sys/devices/system/cpu/cpu1/online

[   25.157867] IRQ18 no longer affine to CPU1
...
[   25.158445] CPU1: shutdown

root@target:~# echo 1 > /sys/devices/system/cpu/cpu1/online

[   40.785859] CPU1: Software reset
[   40.786660] BUG: sleeping function called from invalid context at 
mm/slub.c:1241
[   40.786668] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/1
[   40.786678] Preemption disabled at:[<  (null)>]   (null)
[   40.786681]
[   40.786692] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 
3.19.0-rc4-00024-g7dca860 #36
[   40.786698] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   40.786728] [] (unwind_backtrace) from [] 
(show_stack+0x10/0x14)
[   40.786747] [] (show_stack) from [] 
(dump_stack+0x70/0xbc)
[   40.786767] [] (dump_stack) from [] 
(kmem_cache_alloc+0xd8/0x170)
[   40.786785] [] (kmem_cache_alloc) from [] 
(request_threaded_irq+0x64/0x128)
[   40.786804] [] (request_threaded_irq) from [] 
(exynos4_local_timer_setup+0xc0/0x13c)
[   40.786820] [] (exynos4_local_timer_setup) from [] 
(exynos4_mct_cpu_notify+0x30/0xa8)
[   40.786838] [] (exynos4_mct_cpu_notify) from [] 
(notifier_call_chain+0x44/0x84)
[   40.786857] [] (notifier_call_chain) from [] 
(__cpu_notify+0x28/0x44)
[   40.786873] [] (__cpu_notify) from [] 
(secondary_start_kernel+0xec/0x150)
[   40.786886] [] (secondary_start_kernel) from [<40008764>] 
(0x40008764)

Solution:
Clockevent irqs cannot be requested/freed every time cpu is
hot-plugged/unplugged as CPU_STARTING/CPU_DYING notifications
that signals hotplug or unplug events are sent with both preemption
and local interrupts disabled. Since request_irq() may sleep it is
moved to the initialization stage and performed for all possible
cpus prior putting them online. Then, in the case of hotplug event
the irq asociated with the given cpu will simply be enabled.
Similarly on cpu unplug event the interrupt is not freed but just
disabled.

Note that after successful request_irq() call for a clockevent device
associated to given cpu the requested irq is disabled (via disable_irq()).
That is to make things symmetric as we expect hotplug event as a next
thing (which will enable irq again). This should not pose any problems
because at the time of requesting irq the clockevent device is not
fully initialized yet, therefore should not produce interrupts at that point.

For disabling an irq at cpu unplug notification disable_irq_nosync() is
chosen which is a non-blocking function. This again shouldn't be a problem as
prior sending CPU_DYING notification interrupts are migrated away
from the cpu.

Fixes: 7114cd749a12 ("clocksource: exynos_mct: use (request/free)_irq calls for 
local timer registration")
Signed-off-by: Damian Eppel 
Cc: 
Reported-by: Krzysztof Kozlowski 
Reviewed-by: Krzysztof Kozlowski 
Tested-by: Krzysztof Kozlowski 
(Tested on Arndale Octa Board)
Tested-by: Marcin Jabrzyk 
(Tested on Rinato B2 (Exynos 3250) board)
---

Notes:
 Changes since v1:
 o added Krzysztof's and Marcin's Reviewed-by / Tested-by
   with information about the test HW.

  drivers/clocksource/exynos_mct.c | 45 
  1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index 83564c9..9beca58 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -466,15 +466,12 @@ static int exynos4_local_timer_setup(struct 
clock_event_device *evt)
exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET);
  
  	if (mct_int_type == MCT_INT_SPI) {

-   evt->irq = mct_irqs[MCT_L0_IRQ + cpu];
-   if (request_irq(evt->irq, exynos4_mct_tick_isr,
-   IRQF_TIMER | IRQF_NOBALANCING,
-   evt->name, mevt)) {
-   pr_err("exynos-mct: cannot register IRQ %d\n",
-   evt->irq);
+
+   if (evt->irq == -1)
return -EIO;
-   }
-   irq_force_affinity(mct_irqs[MCT_L0_IRQ + cpu], cpumask_of(cpu));
+
+   irq_force_affinity(evt->irq, cpumask_of(cpu));
+   enable_irq(evt->irq);
} else {
enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0);
}
@@ -487,10 +484,12 @@ static int exynos4_local_timer_setup(struct 
clock_event_device *evt)
  static void exynos4_local_time

Re: [PATCH] ARM: dts: odroidxu3: Enable USB3 regulators

2015-05-28 Thread Krzysztof Kozlowski
On 28.05.2015 17:58, Anand Moon wrote:
> Enable regulator for usbdrd3_0 and usbdrd3_1
>>From the schematic pin diagram USB3_0 and USB3_1
> is regulated by LDO9 and LD011.

Please reformat statement above to proper sentence(s) without ">" before
"From".

> 
> Fix the boot message of failed.
> [3.503539] exynos-dwc3 usb@1200: Looking up vdd33-supply from device 
> tree
> [3.503556] exynos-dwc3 usb@1200: Looking up vdd33-supply property in 
> node /usb@1200 failed
> [3.503568] usb@1200 supply vdd33 not found, using dummy regulator
> [3.509154] exynos-dwc3 usb@1200: Looking up vdd10-supply from device 
> tree
> [3.509170] exynos-dwc3 usb@1200: Looking up vdd10-supply property in 
> node /usb@1200 failed
> [3.509181] usb@1200 supply vdd10 not found, using dummy regulator
> [3.917548] exynos-dwc3 usb@1240: Looking up vdd33-supply from device 
> tree
> [3.917565] exynos-dwc3 usb@1240: Looking up vdd33-supply property in 
> node /usb@1240 failed
> [3.917578] usb@1240 supply vdd33 not found, using dummy regulator
> [3.922731] exynos-dwc3 usb@1240: Looking up vdd10-supply from device 
> tree
> [3.922747] exynos-dwc3 usb@1240: Looking up vdd10-supply property in 
> node /usb@1240 failed
> 
> ---
> This patch is based on Krzysztof github branch 
> work-next/odroid-xu3-s2mps11-irq
> ---

I mentioned this already on previous postings. Let's make an exercise.
Please:
1. Save your email as mbox format (from mailer).
2. Go to a GIT repo with kernel and checkout base branch.
3. git am 0001-the-name-of-file.mbox
4. git show

Do you see the signed-off-by in commit?

The patch itself looks good, thanks for fixing this. Just please fix the
issues with commit message.

By the way:
1. The always-on from LDO9 could be probably removed if the ehci-exynos
driver had regulator consumer implemented.
2. The Documentation/devicetree/bindings/usb/exynos-usb.txt (or dwc.txt)
should proably mention the vdd-supply property.

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] clk: make several parent names const

2015-05-28 Thread Sylwester Nawrocki
On 28/05/15 10:45, Uwe Kleine-König wrote:
> Since commit 2893c379461a ("clk: make strings in parent name arrays
> const") the name of parent clocks can be const. So add more const in
> several clock drivers.
> 
> Signed-off-by: Uwe Kleine-König 

Thanks for the patch,
Acked-by: Sylwester Nawrocki 

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


[PATCH] ARM: dts: odroidxu3: Enable USB3 regulators

2015-05-28 Thread Anand Moon
Enable regulator for usbdrd3_0 and usbdrd3_1
>From the schematic pin diagram USB3_0 and USB3_1
is regulated by LDO9 and LD011.

Fix the boot message of failed.
[3.503539] exynos-dwc3 usb@1200: Looking up vdd33-supply from device 
tree
[3.503556] exynos-dwc3 usb@1200: Looking up vdd33-supply property in 
node /usb@1200 failed
[3.503568] usb@1200 supply vdd33 not found, using dummy regulator
[3.509154] exynos-dwc3 usb@1200: Looking up vdd10-supply from device 
tree
[3.509170] exynos-dwc3 usb@1200: Looking up vdd10-supply property in 
node /usb@1200 failed
[3.509181] usb@1200 supply vdd10 not found, using dummy regulator
[3.917548] exynos-dwc3 usb@1240: Looking up vdd33-supply from device 
tree
[3.917565] exynos-dwc3 usb@1240: Looking up vdd33-supply property in 
node /usb@1240 failed
[3.917578] usb@1240 supply vdd33 not found, using dummy regulator
[3.922731] exynos-dwc3 usb@1240: Looking up vdd10-supply from device 
tree
[3.922747] exynos-dwc3 usb@1240: Looking up vdd10-supply property in 
node /usb@1240 failed

---
This patch is based on Krzysztof github branch work-next/odroid-xu3-s2mps11-irq
---

Signed-off-by: Anand Moon 
---
 arch/arm/boot/dts/exynos5422-odroidxu3.dts | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts 
b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
index 27014bb..a353a58 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
@@ -513,3 +513,13 @@
 &usbdrd_dwc3_1 {
dr_mode = "otg";
 };
+
+&usbdrd3_0 {
+   vdd33-supply = <&ldo9_reg>;
+   vdd10-supply = <&ldo11_reg>;
+};
+
+&usbdrd3_1 {
+   vdd33-supply = <&ldo9_reg>;
+   vdd10-supply = <&ldo11_reg>;
+};
-- 
1.9.1

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


Re: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order

2015-05-28 Thread Marek Szyprowski

Hello,

On 2015-05-28 06:00, Chanho Park wrote:

-Original Message-
From: Joonyoung Shim [mailto:jy0922.s...@samsung.com]
Sent: Thursday, May 28, 2015 10:59 AM
To: Chanho Park; kg...@kernel.org; k.kozlow...@samsung.com
Cc: cw00.c...@samsung.com; linux-samsung-soc@vger.kernel.org;
javier.marti...@collabora.co.uk; khil...@linaro.org;
sjoerd.sim...@collabora.co.uk; heesub.s...@samsung.com
Subject: Re: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order

Hi Chanho,

On 05/28/2015 12:15 AM, 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.

The exynos5422 SoC can boot using cortex-a15 cpu depending on gpio
GPG2CON[1],

Yes, But, the pin is not controllable because it's checked in  the iROM
area.


i think this is just Odroid-XU3 board problem. Is it
possible to overwrite cpus information directly from
exynos5422-odroidxu3.dts?

It's possible to override the info in the odroidxu3.dts. As you know,
however, a new exynos5422 board will be added soon. The board also has same
configuration of the gpio pin and booted cpu0 from a cortex-a7 core.

BTW, booting of secondary cpus are still broken. Is there any progress of
the patch[1]?
This patch is also generated top of the patch with some fixes.


Przemyslaw is checking how to solve this issue in the bootloader like it has
been solved for Exynos 5800 based Chromebooks. The plan is to use the same
SPL code as mentioned here:
https://www.mail-archive.com/u-boot@lists.denx.de/msg159960.html

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

--
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] clk: make several parent names const

2015-05-28 Thread Uwe Kleine-König
Since commit 2893c379461a ("clk: make strings in parent name arrays
const") the name of parent clocks can be const. So add more const in
several clock drivers.

Signed-off-by: Uwe Kleine-König 
---
Hello,

commit 2893c379461a isn't in Linus Torvald's tree yet, so the commit
message needs adaption if clk-next is rewritten.

Should I split this patch per subdir?

Best regards
Uwe

 drivers/clk/hisilicon/clk-hi3620.c   | 70 ++--
 drivers/clk/hisilicon/clk-hix5hd2.c  |  6 +--
 drivers/clk/hisilicon/clk.h  |  2 +-
 drivers/clk/mxs/clk-imx23.c  | 12 ++---
 drivers/clk/mxs/clk-imx28.c  | 18 
 drivers/clk/mxs/clk.h|  2 +-
 drivers/clk/pxa/clk-pxa.h|  2 +-
 drivers/clk/rockchip/clk-cpu.c   |  2 +-
 drivers/clk/rockchip/clk-mmc-phase.c |  2 +-
 drivers/clk/rockchip/clk-pll.c   |  8 ++--
 drivers/clk/rockchip/clk.c   |  8 ++--
 drivers/clk/rockchip/clk.h   | 20 
 drivers/clk/samsung/clk-pll.c|  4 +-
 drivers/clk/samsung/clk-s5pv210.c| 88 ++--
 drivers/clk/samsung/clk.c| 13 +++---
 drivers/clk/samsung/clk.h| 18 
 drivers/clk/zynq/clkc.c  | 25 ++
 17 files changed, 154 insertions(+), 146 deletions(-)

diff --git a/drivers/clk/hisilicon/clk-hi3620.c 
b/drivers/clk/hisilicon/clk-hi3620.c
index 472dd2cb10b3..715d34a5ef9b 100644
--- a/drivers/clk/hisilicon/clk-hi3620.c
+++ b/drivers/clk/hisilicon/clk-hi3620.c
@@ -38,44 +38,44 @@
 #include "clk.h"
 
 /* clock parent list */
-static const char *timer0_mux_p[] __initdata = { "osc32k", "timerclk01", };
-static const char *timer1_mux_p[] __initdata = { "osc32k", "timerclk01", };
-static const char *timer2_mux_p[] __initdata = { "osc32k", "timerclk23", };
-static const char *timer3_mux_p[] __initdata = { "osc32k", "timerclk23", };
-static const char *timer4_mux_p[] __initdata = { "osc32k", "timerclk45", };
-static const char *timer5_mux_p[] __initdata = { "osc32k", "timerclk45", };
-static const char *timer6_mux_p[] __initdata = { "osc32k", "timerclk67", };
-static const char *timer7_mux_p[] __initdata = { "osc32k", "timerclk67", };
-static const char *timer8_mux_p[] __initdata = { "osc32k", "timerclk89", };
-static const char *timer9_mux_p[] __initdata = { "osc32k", "timerclk89", };
-static const char *uart0_mux_p[] __initdata = { "osc26m", "pclk", };
-static const char *uart1_mux_p[] __initdata = { "osc26m", "pclk", };
-static const char *uart2_mux_p[] __initdata = { "osc26m", "pclk", };
-static const char *uart3_mux_p[] __initdata = { "osc26m", "pclk", };
-static const char *uart4_mux_p[] __initdata = { "osc26m", "pclk", };
-static const char *spi0_mux_p[] __initdata = { "osc26m", "rclk_cfgaxi", };
-static const char *spi1_mux_p[] __initdata = { "osc26m", "rclk_cfgaxi", };
-static const char *spi2_mux_p[] __initdata = { "osc26m", "rclk_cfgaxi", };
+static const char *const timer0_mux_p[] __initconst = { "osc32k", 
"timerclk01", };
+static const char *const timer1_mux_p[] __initconst = { "osc32k", 
"timerclk01", };
+static const char *const timer2_mux_p[] __initconst = { "osc32k", 
"timerclk23", };
+static const char *const timer3_mux_p[] __initconst = { "osc32k", 
"timerclk23", };
+static const char *const timer4_mux_p[] __initconst = { "osc32k", 
"timerclk45", };
+static const char *const timer5_mux_p[] __initconst = { "osc32k", 
"timerclk45", };
+static const char *const timer6_mux_p[] __initconst = { "osc32k", 
"timerclk67", };
+static const char *const timer7_mux_p[] __initconst = { "osc32k", 
"timerclk67", };
+static const char *const timer8_mux_p[] __initconst = { "osc32k", 
"timerclk89", };
+static const char *const timer9_mux_p[] __initconst = { "osc32k", 
"timerclk89", };
+static const char *const uart0_mux_p[] __initconst = { "osc26m", "pclk", };
+static const char *const uart1_mux_p[] __initconst = { "osc26m", "pclk", };
+static const char *const uart2_mux_p[] __initconst = { "osc26m", "pclk", };
+static const char *const uart3_mux_p[] __initconst = { "osc26m", "pclk", };
+static const char *const uart4_mux_p[] __initconst = { "osc26m", "pclk", };
+static const char *const spi0_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", 
};
+static const char *const spi1_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", 
};
+static const char *const spi2_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", 
};
 /* share axi parent */
-static const char *saxi_mux_p[] __initdata = { "armpll3", "armpll2", };
-static const char *pwm0_mux_p[] __initdata = { "osc32k", "osc26m", };
-static const char *pwm1_mux_p[] __initdata = { "osc32k", "osc26m", };
-static const char *sd_mux_p[] __initdata = { "armpll2", "armpll3", };
-static const char *mmc1_mux_p[] __initdata = { "armpll2", "armpll3", };
-static const char *mmc1_mux2_p[] __initdata = { "osc26m", "mmc1_div", };
-static const char *g2d_mux_p[] __initdata = { "armpll2", "armpll3", };
-static const char *venc_mux_p[] __initdata 

RE: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order

2015-05-28 Thread Chanho Park
Hi,

> When adding new 5422 board we can split out CPU configuration to
> separate DTSI file. I already posted patches for Odroid XU3-family
> common DTSI file for XU3 Lite board:
> http://www.spinics.net/lists/linux-samsung-soc/msg44868.html

IMHO, all of the exynos5422 boards will be same cpu configurations. That's
why I added new exynos5422.dtsi.

> 
> > BTW, booting of secondary cpus are still broken. Is there any progress
> of
> > the patch[1]?
> > This patch is also generated top of the patch with some fixes.
> >
> > [1]. http://www.spinics.net/lists/linux-samsung-soc/msg39523.html
> 
> No progress so far. Apparently nobody knows why this works and what to
> do with it. I would suspect booted CPUs stuck somewhere in BL1 or BL2
> and writing to PMU_SPARE2 kicks them. However this is just a guess.
> 
> Kukjin which could be the closest person to the real knowledge (LSI) did
> not gave his feedback.
> 
> We have a lot of such hacks and undocumented interfaces between kernel
> and bootloaders. IMHO it would be good to start documenting them.

Good. But, who can do it?

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 v8 04/14] drm/exynos: atomic phase 1: add .mode_set_nofb() callback

2015-05-28 Thread Joonyoung Shim
On 05/28/2015 05:56 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> The new atomic infrastructure needs the .mode_set_nofb() callback to
> update CRTC timings before setting any plane.
> 
> Signed-off-by: Gustavo Padovan 
> Reviewed-by: Joonyoung Shim 
> Tested-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c | 64 
> +---
>  1 file changed, 9 insertions(+), 55 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index ba44c9b..c524f0c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -62,9 +62,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
>  
>   if (exynos_crtc->ops->win_commit)
>   exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
> -
> - if (exynos_crtc->ops->commit)
> - exynos_crtc->ops->commit(exynos_crtc);
>  }
>  
>  static bool
> @@ -81,60 +78,16 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
>   return true;
>  }
>  
> -static int
> -exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode 
> *mode,
> -   struct drm_display_mode *adjusted_mode, int x, int y,
> -   struct drm_framebuffer *old_fb)
> -{
> - struct drm_framebuffer *fb = crtc->primary->fb;
> - unsigned int crtc_w;
> - unsigned int crtc_h;
> - int ret;
> -
> - /*
> -  * copy the mode data adjusted by mode_fixup() into crtc->mode
> -  * so that hardware can be seet to proper mode.
> -  */
> - memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));

Let's apply using crtc->state->adjusted_mode instead of crtc->mode on
exynos drm.

> -
> - ret = exynos_check_plane(crtc->primary, fb);
> - if (ret < 0)
> - return ret;
> -
> - crtc_w = fb->width - x;
> - crtc_h = fb->height - y;
> - exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
> -   crtc_w, crtc_h, x, y, crtc_w, crtc_h);
> -
> - return 0;
> -}
> -
> -static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
> -   struct drm_framebuffer *old_fb)
> +static void
> +exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
>  {
>   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> - struct drm_framebuffer *fb = crtc->primary->fb;
> - unsigned int crtc_w;
> - unsigned int crtc_h;
> - int ret;
> -
> - /* when framebuffer changing is requested, crtc's dpms should be on */
> - if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
> - DRM_ERROR("failed framebuffer changing request.\n");
> - return -EPERM;
> - }
>  
> - ret = exynos_check_plane(crtc->primary, fb);
> - if (ret)
> - return ret;
> -
> - crtc_w = fb->width - x;
> - crtc_h = fb->height - y;
> - exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> - crtc_w, crtc_h, x << 16, y << 16,
> - crtc_w << 16, crtc_h << 16);
> + if (WARN_ON(!crtc->state))
> + return;

crtc->state cannot be NULL if we use drm_helper_crtc_mode_set.

>  
> - return 0;
> + if (exynos_crtc->ops->commit)
> + exynos_crtc->ops->commit(exynos_crtc);
>  }
>  
>  static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
> @@ -159,8 +112,9 @@ static struct drm_crtc_helper_funcs 
> exynos_crtc_helper_funcs = {
>   .prepare= exynos_drm_crtc_prepare,
>   .commit = exynos_drm_crtc_commit,
>   .mode_fixup = exynos_drm_crtc_mode_fixup,
> - .mode_set   = exynos_drm_crtc_mode_set,
> - .mode_set_base  = exynos_drm_crtc_mode_set_base,
> + .mode_set   = drm_helper_crtc_mode_set,
> + .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
> + .mode_set_base  = drm_helper_crtc_mode_set_base,
>   .disable= exynos_drm_crtc_disable,
>  };
>  
> 

--
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 v8 08/14] drm/exynos: atomic phase 3: use atomic .set_config helper

2015-05-28 Thread Joonyoung Shim
On 05/28/2015 05:56 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Now that phase 1 and 2 are complete switch .set_config helper to
> use the atomic one.
> 
> v2: also remove .prepare() callback
> 
> Signed-off-by: Gustavo Padovan 
> Reviewed-by: Joonyoung Shim 
> Tested-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 +---
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index fe77516..c490064 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -50,11 +50,6 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, 
> int mode)
>   drm_crtc_vblank_on(crtc);
>  }
>  
> -static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
> -{
> - /* drm framework doesn't check NULL. */
> -}
> -
>  static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
>  {
>   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> @@ -111,7 +106,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
>  
>  static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
>   .dpms   = exynos_drm_crtc_dpms,
> - .prepare= exynos_drm_crtc_prepare,

As i said, can remove .prepare of drm_encoder_helper_funcs also.

>   .commit = exynos_drm_crtc_commit,
>   .mode_fixup = exynos_drm_crtc_mode_fixup,
>   .mode_set   = drm_helper_crtc_mode_set,

Also, can remove .mode_set and .mode_set_base because we use
drm_atomic_helper_set_config.

> @@ -193,7 +187,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
>  }
>  
>  static struct drm_crtc_funcs exynos_crtc_funcs = {
> - .set_config = drm_crtc_helper_set_config,
> + .set_config = drm_atomic_helper_set_config,
>   .page_flip  = exynos_drm_crtc_page_flip,
>   .destroy= exynos_drm_crtc_destroy,
>   .reset = drm_atomic_helper_crtc_reset,
> 

--
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 v8 02/14] drm/exynos: atomic phase 1: use drm_plane_helper_update()

2015-05-28 Thread Joonyoung Shim
On 05/28/2015 05:56 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Rip out the check from exynos_update_plane() and create
> exynos_check_plane() for the check phase enabling use to use
> the atomic helpers to call our check and update phases when updating
> planes.
> 
> Update all users of exynos_update_plane() accordingly to call
> exynos_check_plane() before.
> 
> Signed-off-by: Gustavo Padovan 
> Reviewed-by: Joonyoung Shim 
> Tested-by: Tobias Jakobi y
> ---
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 31 
>  drivers/gpu/drm/exynos/exynos_drm_plane.c | 40 
> +++
>  drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 +-
>  3 files changed, 47 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 363b019..ba44c9b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
> *crtc, int x, int y,
>   struct drm_framebuffer *fb = crtc->primary->fb;
>   unsigned int crtc_w;
>   unsigned int crtc_h;
> + int ret;
>  
>   /* when framebuffer changing is requested, crtc's dpms should be on */
>   if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
> @@ -123,12 +124,17 @@ static int exynos_drm_crtc_mode_set_base(struct 
> drm_crtc *crtc, int x, int y,
>   return -EPERM;
>   }
>  
> + ret = exynos_check_plane(crtc->primary, fb);
> + if (ret)
> + return ret;
> +
>   crtc_w = fb->width - x;
>   crtc_h = fb->height - y;
> + exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> + crtc_w, crtc_h, x << 16, y << 16,
> + crtc_w << 16, crtc_h << 16);
>  
> - return exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> -crtc_w, crtc_h, x << 16, y << 16,
> -crtc_w << 16, crtc_h << 16);
> + return 0;
>  }
>  
>  static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
> @@ -165,7 +171,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
> *crtc,
>  {
>   struct drm_device *dev = crtc->dev;
>   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> - struct drm_framebuffer *old_fb = crtc->primary->fb;
>   unsigned int crtc_w, crtc_h;
>   int ret;
>  
> @@ -184,6 +189,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
> *crtc,
>   goto out;
>   }
>  
> + ret = exynos_check_plane(crtc->primary, fb);
> + if (ret)
> + goto out;
> +
>   ret = drm_vblank_get(dev, exynos_crtc->pipe);
>   if (ret) {
>   DRM_DEBUG("failed to acquire vblank counter\n");
> @@ -202,17 +211,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
> *crtc,
>   crtc->primary->fb = fb;
>   crtc_w = fb->width - crtc->x;
>   crtc_h = fb->height - crtc->y;
> - ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> -   crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
> -   crtc_w << 16, crtc_h << 16);
> - if (ret) {
> - crtc->primary->fb = old_fb;
> - spin_lock_irq(&dev->event_lock);
> - exynos_crtc->event = NULL;
> - drm_vblank_put(dev, exynos_crtc->pipe);
> - spin_unlock_irq(&dev->event_lock);
> - return ret;
> - }
> + exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> + crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
> + crtc_w << 16, crtc_h << 16);
>  
>   return 0;
>  
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
> b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> index b1180fb..b218b7a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> @@ -144,21 +144,15 @@ void exynos_plane_mode_set(struct drm_plane *plane, 
> struct drm_crtc *crtc,
>   plane->crtc = crtc;
>  }
>  
> -int
> +void
>  exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
>struct drm_framebuffer *fb, int crtc_x, int crtc_y,
>unsigned int crtc_w, unsigned int crtc_h,
>uint32_t src_x, uint32_t src_y,
>uint32_t src_w, uint32_t src_h)
>  {
> -
>   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
>   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
> - int ret;
> -
> - ret = exynos_check_plane(plane, fb);
> - if (ret < 0)
> - return ret;
>  
>   exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
> crtc_w, crtc_h, src_x >> 16, src_y >> 16,
> @@ -166,8 +160,6 @@ exynos_update_plane(struct drm_plane *plane, struct 
> drm_crtc *crtc,
>  
>   if (exynos_crtc->ops->win_commit)
>  

Re: [PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-28 Thread Joonyoung Shim
On 05/28/2015 02:39 PM, Inki Dae wrote:
> Hi Gustavo,
> 
> On 2015년 05월 28일 05:27, Gustavo Padovan wrote:
>> Hi Inki,
>>
>> 2015-05-27 Inki Dae :
>>
>>> Hi Gustavo,
>>>
>>> On 2015년 05월 23일 00:40, Gustavo Padovan wrote:
 From: Gustavo Padovan 

 Run dpms operations through the atomic intefaces. This basically removes
 the .dpms() callback from econders and crtcs and use .disable() and
 .enable() to turn the crtc on and off.

 v2: Address comments by Joonyoung:
- make hdmi code call ->disable() instead of ->dpms()
- do not use WARN_ON on crtc enable/disable

 v3: - Fix build failure after the hdmi change in v2
 - Change dpms helper of ptn3460 bridge

 Signed-off-by: Gustavo Padovan 
 Reviewed-by: Joonyoung Shim 
 Tested-by: Tobias Jakobi 
 ---
  drivers/gpu/drm/bridge/ps8622.c |  2 +-
  drivers/gpu/drm/bridge/ptn3460.c|  2 +-
  drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 
 -
  drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
  drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
  drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
  drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
  10 files changed, 69 insertions(+), 75 deletions(-)

 diff --git a/drivers/gpu/drm/bridge/ps8622.c 
 b/drivers/gpu/drm/bridge/ps8622.c
 index b604326..d686235 100644
 --- a/drivers/gpu/drm/bridge/ps8622.c
 +++ b/drivers/gpu/drm/bridge/ps8622.c
 @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct 
 drm_connector *connector)
  }
  
  static const struct drm_connector_funcs ps8622_connector_funcs = {
 -  .dpms = drm_helper_connector_dpms,
 +  .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ps8622_detect,
.destroy = ps8622_connector_destroy,
 diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
 b/drivers/gpu/drm/bridge/ptn3460.c
 index 8ed3617..260bc9f 100644
 --- a/drivers/gpu/drm/bridge/ptn3460.c
 +++ b/drivers/gpu/drm/bridge/ptn3460.c
 @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
 drm_connector *connector)
  }
  
  static struct drm_connector_funcs ptn3460_connector_funcs = {
 -  .dpms = drm_helper_connector_dpms,
 +  .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ptn3460_detect,
.destroy = ptn3460_connector_destroy,
 diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
 b/drivers/gpu/drm/exynos/exynos_dp_core.c
 index 195fe60..c9995b1 100644
 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
 +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
 @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
 drm_connector *connector)
  }
  
>>>
>>> [--snip--]
>>>
  
  static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
 -  .dpms   = exynos_drm_crtc_dpms,
 -  .prepare= exynos_drm_crtc_prepare,
 -  .commit = exynos_drm_crtc_commit,
 +  .enable = exynos_drm_crtc_enable,
 +  .disable= exynos_drm_crtc_disable,
.mode_fixup = exynos_drm_crtc_mode_fixup,
.mode_set   = drm_helper_crtc_mode_set,
.mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
>>>
>>> I think it'd be better to use atomic_flush callback to enable global dma
>>> like commit callback did. Is there any reason that you don't use
>>> atomic_begin and atomic_flush callbacks?
>>>
>>> atomic relevant codes I looked into do as follows,
>>>
>>> atomic_begin();
>>>
>>> atomic_update();  /* this will call win_commit callback to set a overlay
>>> relevant registers and enable its dma channel. */
>>>
>>> atomic_flush();
>>>
>>> So atomic overlay updating between atomic_begin() ~ atomic_flush() will
>>> be guaranteed.
>>
>> I think we can go down that road, but I'd suggest we push the atomic
>> patches v8 (with the lastest comments from Joonyoung fixed) and then 
>> work on the change you are proposing as a follow-up together with the 
>> other improvements for atomic I already have queued here. This way
>> we don't take the risk of missing one more merge window.
> 
> We(I and Joonyoung) will have discussion about this patch series. For
> this, we have already started to analyze entire atomic features
> including your patch set so I'd merge it at end of next week according
> to the discussion. I'm not kind of sure yet but I will merge it as long
> as there is no big problem.
> 

Actually i agree to opinion of Gustavo and will repost the patchset of
Gustavo with some patches fixed by me.

Thanks.
--
To uns