[PATCH] drm/i2c: tda998x: Choose between atomic or non atomic dpms helper

2016-03-08 Thread Dave Airlie
On 8 March 2016 at 07:47, Jyri Sarha  wrote:
> Hi,
> Based on discussion around this patch:
>
> https://lists.freedesktop.org/archives/dri-devel/2016-February/100685.html
>
> I think the patch below should get into queued for v4.5 fixes as the
> Beaglebone-Black display is currently broken in linux-master and probably
> Armada is broken too. What should I do to get it there?

I've pushed this to drm-fixes.

Dave.


[PATCH] drm/i2c: tda998x: Choose between atomic or non atomic dpms helper

2016-03-07 Thread Jyri Sarha
Hi,
Based on discussion around this patch:

https://lists.freedesktop.org/archives/dri-devel/2016-February/100685.html

I think the patch below should get into queued for v4.5 fixes as the 
Beaglebone-Black display is currently broken in linux-master and 
probably Armada is broken too. What should I do to get it there?

Best regards,
Jyri

On 01/16/16 22:17, Jyri Sarha wrote:
> Choose between atomic or non atomic connector dpms helper. If tda998x
> is connected to a drm driver that does not support atomic modeset
> calling drm_atomic_helper_connector_dpms() causes a crash when the
> connectors atomic state is not initialized. The patch implements a
> driver specific connector dpms helper that calls
> drm_atomic_helper_connector_dpms() if driver supports DRIVER_ATOMIC
> and otherwise it calls the legacy drm_helper_connector_dpms().
>
> Fixes commit 9736e988d328 ("drm/i2c: tda998x: Add support for atomic
> modesetting").
>
> Signed-off-by: Jyri Sarha 
> ---
>
> Ok, so this is the second approach to solve this issue. The first
> attempt can be found here [1] with the follow from Liviu Dudau that
> suggested this approach.
>
> It just makes me wonder if drm_atomic_helper_connector_dpms() should
> call the legacy callback automatically if DRIVER_ATOMIC is not set or
> at least bail out gracefully with an error message. Then again it may
> be overkill if the tda998x is the only driver that need to support
> both situations.
>
> Best regards,
> Jyri
>
> [1] http://www.spinics.net/lists/dri-devel/msg98514.html
>
>   drivers/gpu/drm/i2c/tda998x_drv.c | 10 +-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
> b/drivers/gpu/drm/i2c/tda998x_drv.c
> index 012d36d..bb7d507 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -1382,8 +1382,16 @@ static void tda998x_connector_destroy(struct 
> drm_connector *connector)
>   drm_connector_cleanup(connector);
>   }
>
> +static int tda998x_connector_dpms(struct drm_connector *connector, int mode)
> +{
> + if (drm_core_check_feature(connector->dev, DRIVER_ATOMIC))
> + return drm_atomic_helper_connector_dpms(connector, mode);
> + else
> + return drm_helper_connector_dpms(connector, mode);
> +}
> +
>   static const struct drm_connector_funcs tda998x_connector_funcs = {
> - .dpms = drm_atomic_helper_connector_dpms,
> + .dpms = tda998x_connector_dpms,
>   .reset = drm_atomic_helper_connector_reset,
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = tda998x_connector_detect,
>



[PATCH] drm/i2c: tda998x: Choose between atomic or non atomic dpms helper

2016-02-25 Thread Jyri Sarha
Hi,
Based on discussion around this patch:

https://lists.freedesktop.org/archives/dri-devel/2016-February/100685.html

I think the patch below should be applied to tda988x development branch. 
Would you take it or do you prefer some other approach?

Best regards,
Jyri

On 01/16/16 22:17, Jyri Sarha wrote:
> Choose between atomic or non atomic connector dpms helper. If tda998x
> is connected to a drm driver that does not support atomic modeset
> calling drm_atomic_helper_connector_dpms() causes a crash when the
> connectors atomic state is not initialized. The patch implements a
> driver specific connector dpms helper that calls
> drm_atomic_helper_connector_dpms() if driver supports DRIVER_ATOMIC
> and otherwise it calls the legacy drm_helper_connector_dpms().
>
> Fixes commit 9736e988d328 ("drm/i2c: tda998x: Add support for atomic
> modesetting").
>
> Signed-off-by: Jyri Sarha 
> ---
>
> Ok, so this is the second approach to solve this issue. The first
> attempt can be found here [1] with the follow from Liviu Dudau that
> suggested this approach.
>
> It just makes me wonder if drm_atomic_helper_connector_dpms() should
> call the legacy callback automatically if DRIVER_ATOMIC is not set or
> at least bail out gracefully with an error message. Then again it may
> be overkill if the tda998x is the only driver that need to support
> both situations.
>
> Best regards,
> Jyri
>
> [1] http://www.spinics.net/lists/dri-devel/msg98514.html
>
>   drivers/gpu/drm/i2c/tda998x_drv.c | 10 +-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
> b/drivers/gpu/drm/i2c/tda998x_drv.c
> index 012d36d..bb7d507 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -1382,8 +1382,16 @@ static void tda998x_connector_destroy(struct 
> drm_connector *connector)
>   drm_connector_cleanup(connector);
>   }
>
> +static int tda998x_connector_dpms(struct drm_connector *connector, int mode)
> +{
> + if (drm_core_check_feature(connector->dev, DRIVER_ATOMIC))
> + return drm_atomic_helper_connector_dpms(connector, mode);
> + else
> + return drm_helper_connector_dpms(connector, mode);
> +}
> +
>   static const struct drm_connector_funcs tda998x_connector_funcs = {
> - .dpms = drm_atomic_helper_connector_dpms,
> + .dpms = tda998x_connector_dpms,
>   .reset = drm_atomic_helper_connector_reset,
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = tda998x_connector_detect,
>



[PATCH] drm/i2c: tda998x: Choose between atomic or non atomic dpms helper

2016-02-25 Thread liviu.du...@arm.com
On Thu, Feb 25, 2016 at 12:09:39PM +0200, Jyri Sarha wrote:
> Hi,
> Based on discussion around this patch:
> 
> https://lists.freedesktop.org/archives/dri-devel/2016-February/100685.html
> 
> I think the patch below should be applied to tda988x development branch.
> Would you take it or do you prefer some other approach?

You should send it to David Airlie after you get an Ack from Russell.

Best regards,
Liviu

> 
> Best regards,
> Jyri
> 
> On 01/16/16 22:17, Jyri Sarha wrote:
> >Choose between atomic or non atomic connector dpms helper. If tda998x
> >is connected to a drm driver that does not support atomic modeset
> >calling drm_atomic_helper_connector_dpms() causes a crash when the
> >connectors atomic state is not initialized. The patch implements a
> >driver specific connector dpms helper that calls
> >drm_atomic_helper_connector_dpms() if driver supports DRIVER_ATOMIC
> >and otherwise it calls the legacy drm_helper_connector_dpms().
> >
> >Fixes commit 9736e988d328 ("drm/i2c: tda998x: Add support for atomic
> >modesetting").
> >
> >Signed-off-by: Jyri Sarha 
> >---
> >
> >Ok, so this is the second approach to solve this issue. The first
> >attempt can be found here [1] with the follow from Liviu Dudau that
> >suggested this approach.
> >
> >It just makes me wonder if drm_atomic_helper_connector_dpms() should
> >call the legacy callback automatically if DRIVER_ATOMIC is not set or
> >at least bail out gracefully with an error message. Then again it may
> >be overkill if the tda998x is the only driver that need to support
> >both situations.
> >
> >Best regards,
> >Jyri
> >
> >[1] http://www.spinics.net/lists/dri-devel/msg98514.html
> >
> >  drivers/gpu/drm/i2c/tda998x_drv.c | 10 +-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >
> >diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
> >b/drivers/gpu/drm/i2c/tda998x_drv.c
> >index 012d36d..bb7d507 100644
> >--- a/drivers/gpu/drm/i2c/tda998x_drv.c
> >+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> >@@ -1382,8 +1382,16 @@ static void tda998x_connector_destroy(struct 
> >drm_connector *connector)
> > drm_connector_cleanup(connector);
> >  }
> >
> >+static int tda998x_connector_dpms(struct drm_connector *connector, int mode)
> >+{
> >+if (drm_core_check_feature(connector->dev, DRIVER_ATOMIC))
> >+return drm_atomic_helper_connector_dpms(connector, mode);
> >+else
> >+return drm_helper_connector_dpms(connector, mode);
> >+}
> >+
> >  static const struct drm_connector_funcs tda998x_connector_funcs = {
> >-.dpms = drm_atomic_helper_connector_dpms,
> >+.dpms = tda998x_connector_dpms,
> > .reset = drm_atomic_helper_connector_reset,
> > .fill_modes = drm_helper_probe_single_connector_modes,
> > .detect = tda998x_connector_detect,
> >
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 

| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---
¯\_(ツ)_/¯


[PATCH] drm/i2c: tda998x: Choose between atomic or non atomic dpms helper

2016-01-18 Thread Russell King - ARM Linux
On Mon, Jan 18, 2016 at 09:52:27AM +, Liviu.Dudau at arm.com wrote:
> On Sat, Jan 16, 2016 at 10:17:54PM +0200, Jyri Sarha wrote:
> > It just makes me wonder if drm_atomic_helper_connector_dpms() should
> > call the legacy callback automatically if DRIVER_ATOMIC is not set or
> > at least bail out gracefully with an error message. Then again it may
> > be overkill if the tda998x is the only driver that need to support
> > both situations.
> 
> I would guess that in general it makes sense for the core code to do what
> you suggest, but the idea is to try to encourage the drivers to convert
> to atomic ops rather than give them too many crutches. And the tda998x will
> need this for a short period of time until tilcdc converts as well.

It's not just tilcdc that this driver is used by.

I have no plans at present to convert armada to atomic mode setting,
although I occasionally push it (I hope) towards that goal.  This
isn't going to happen quickly, because I've other areas that need
work too.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


[PATCH] drm/i2c: tda998x: Choose between atomic or non atomic dpms helper

2016-01-18 Thread liviu.du...@arm.com
On Sat, Jan 16, 2016 at 10:17:54PM +0200, Jyri Sarha wrote:
> Choose between atomic or non atomic connector dpms helper. If tda998x
> is connected to a drm driver that does not support atomic modeset
> calling drm_atomic_helper_connector_dpms() causes a crash when the
> connectors atomic state is not initialized. The patch implements a
> driver specific connector dpms helper that calls
> drm_atomic_helper_connector_dpms() if driver supports DRIVER_ATOMIC
> and otherwise it calls the legacy drm_helper_connector_dpms().
> 
> Fixes commit 9736e988d328 ("drm/i2c: tda998x: Add support for atomic
> modesetting").
> 
> Signed-off-by: Jyri Sarha 

Looks much cleaner to me.

Acked-by: Liviu Dudau 

> ---
> 
> Ok, so this is the second approach to solve this issue. The first
> attempt can be found here [1] with the follow from Liviu Dudau that
> suggested this approach. 
> 
> It just makes me wonder if drm_atomic_helper_connector_dpms() should
> call the legacy callback automatically if DRIVER_ATOMIC is not set or
> at least bail out gracefully with an error message. Then again it may
> be overkill if the tda998x is the only driver that need to support
> both situations.

I would guess that in general it makes sense for the core code to do what
you suggest, but the idea is to try to encourage the drivers to convert
to atomic ops rather than give them too many crutches. And the tda998x will
need this for a short period of time until tilcdc converts as well.

Best regards,
Liviu

> 
> Best regards,
> Jyri
> 
> [1] http://www.spinics.net/lists/dri-devel/msg98514.html
> 
>  drivers/gpu/drm/i2c/tda998x_drv.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
> b/drivers/gpu/drm/i2c/tda998x_drv.c
> index 012d36d..bb7d507 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -1382,8 +1382,16 @@ static void tda998x_connector_destroy(struct 
> drm_connector *connector)
>   drm_connector_cleanup(connector);
>  }
>  
> +static int tda998x_connector_dpms(struct drm_connector *connector, int mode)
> +{
> + if (drm_core_check_feature(connector->dev, DRIVER_ATOMIC))
> + return drm_atomic_helper_connector_dpms(connector, mode);
> + else
> + return drm_helper_connector_dpms(connector, mode);
> +}
> +
>  static const struct drm_connector_funcs tda998x_connector_funcs = {
> - .dpms = drm_atomic_helper_connector_dpms,
> + .dpms = tda998x_connector_dpms,
>   .reset = drm_atomic_helper_connector_reset,
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = tda998x_connector_detect,
> -- 
> 1.9.1
> 

-- 

| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---
¯\_(ツ)_/¯


[PATCH] drm/i2c: tda998x: Choose between atomic or non atomic dpms helper

2016-01-16 Thread Jyri Sarha
Choose between atomic or non atomic connector dpms helper. If tda998x
is connected to a drm driver that does not support atomic modeset
calling drm_atomic_helper_connector_dpms() causes a crash when the
connectors atomic state is not initialized. The patch implements a
driver specific connector dpms helper that calls
drm_atomic_helper_connector_dpms() if driver supports DRIVER_ATOMIC
and otherwise it calls the legacy drm_helper_connector_dpms().

Fixes commit 9736e988d328 ("drm/i2c: tda998x: Add support for atomic
modesetting").

Signed-off-by: Jyri Sarha 
---

Ok, so this is the second approach to solve this issue. The first
attempt can be found here [1] with the follow from Liviu Dudau that
suggested this approach. 

It just makes me wonder if drm_atomic_helper_connector_dpms() should
call the legacy callback automatically if DRIVER_ATOMIC is not set or
at least bail out gracefully with an error message. Then again it may
be overkill if the tda998x is the only driver that need to support
both situations.

Best regards,
Jyri

[1] http://www.spinics.net/lists/dri-devel/msg98514.html

 drivers/gpu/drm/i2c/tda998x_drv.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 012d36d..bb7d507 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1382,8 +1382,16 @@ static void tda998x_connector_destroy(struct 
drm_connector *connector)
drm_connector_cleanup(connector);
 }

+static int tda998x_connector_dpms(struct drm_connector *connector, int mode)
+{
+   if (drm_core_check_feature(connector->dev, DRIVER_ATOMIC))
+   return drm_atomic_helper_connector_dpms(connector, mode);
+   else
+   return drm_helper_connector_dpms(connector, mode);
+}
+
 static const struct drm_connector_funcs tda998x_connector_funcs = {
-   .dpms = drm_atomic_helper_connector_dpms,
+   .dpms = tda998x_connector_dpms,
.reset = drm_atomic_helper_connector_reset,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = tda998x_connector_detect,
-- 
1.9.1