Re: [PATCH v5 27/29] drm/omap: dsi: remove ulps support

2020-12-14 Thread Tomi Valkeinen
On 14/12/2020 19:39, Sebastian Reichel wrote:
> Hi,
> 
> On Tue, Dec 08, 2020 at 02:28:53PM +0200, Tomi Valkeinen wrote:
>> ULPS doesn't work, and I have been unable to get it to work. As ULPS
>> is a minor power-saving feature which requires substantial amount of
>> non-trivial code, and we have trouble just getting and
>> keeping DSI working at all, remove ULPS support.
>>
>> When the DSI driver works reliably for command and video mode displays,
>> someone interested can add it back.
>>
>> Signed-off-by: Tomi Valkeinen 
>> Reviewed-by: Laurent Pinchart 
>> ---
> 
> Is it really 'minor power-saving'? If I search for DSI and ULPS among
> the first results is a TI datasheet for SN65DSI84, which claims device
> active current in the more than 100mA range and ULPS current in the
> less than 10mA range.

I don't have any numbers, just my guesses. For videomode displays or command 
mode displays in active
use, I don't think ULPS matters much. The link is mostly not in ULPS. And if 
the display is blanked,
things are off, so again not in ULPS.

It's only for command mode displays, when updated rarely, where I think ULPS 
matters. Which, of
course, is probably not unusual use case if you have a cmdmode display. But 
whether OMAP DSI power
savings matches SN65DSI84, I have no clue.

> Considering all known omapdrm DSI users are battery powered devices
> caring for saving as much power as possible, it might be good to just
> keep this until it is being fixed considering this is very close to
> the end of the series anyways?

I don't like to leave known to be broken code around, unless someone has plans 
to work on it. I
wouldn't be surprised to see ULPS still broken two years from now =). It should 
be trivial to add
the relevant bits back later.

But I can leave it here if you think it's better, presuming it doesn't have 
bigger conflicts with
the 29/29 or break anything. However, I have only a few days left in TI, which 
is why I'm rushing
here a bit (*). If I hit problems, I either have to drop the whole series, or 
push it in its current
form.

 Tomi

(*) But I will fix possible issues caused by my push, of course.

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 27/29] drm/omap: dsi: remove ulps support

2020-12-14 Thread Sebastian Reichel
Hi,

On Mon, Dec 14, 2020 at 08:55:36PM +0200, Tomi Valkeinen wrote:
> On 14/12/2020 19:39, Sebastian Reichel wrote:
> > Hi,
> > 
> > On Tue, Dec 08, 2020 at 02:28:53PM +0200, Tomi Valkeinen wrote:
> >> ULPS doesn't work, and I have been unable to get it to work. As ULPS
> >> is a minor power-saving feature which requires substantial amount of
> >> non-trivial code, and we have trouble just getting and
> >> keeping DSI working at all, remove ULPS support.
> >>
> >> When the DSI driver works reliably for command and video mode displays,
> >> someone interested can add it back.
> >>
> >> Signed-off-by: Tomi Valkeinen 
> >> Reviewed-by: Laurent Pinchart 
> >> ---
> > 
> > Is it really 'minor power-saving'? If I search for DSI and ULPS among
> > the first results is a TI datasheet for SN65DSI84, which claims device
> > active current in the more than 100mA range and ULPS current in the
> > less than 10mA range.
> 
> I don't have any numbers, just my guesses. For videomode displays
> or command mode displays in active use, I don't think ULPS matters
> much. The link is mostly not in ULPS. And if the display is
> blanked, things are off, so again not in ULPS.
> 
> It's only for command mode displays, when updated rarely, where I
> think ULPS matters. Which, of course, is probably not unusual use
> case if you have a cmdmode display. But whether OMAP DSI power
> savings matches SN65DSI84, I have no clue.

Right. FWIW I don't expect savings to be as big as this. The
comparision is not "active current", but "idle current" since
we do disable the clocks among other things. Considering the
amount of power-saving is pure guess-work I suggest to rephrase
the commit message to something like this:

ULPS is a niche power-saving optimization feature only
affecting enabled command mode panels showing a static
picture. It never worked with the omapdrm driver and I have
been unable to get it working. Keeping DSI command mode panels
working is hard enough without this, so remove ULPS support.

FWIW I'm fine with this being removed:

Reviewed-by: Sebastian Reichel 

> > Considering all known omapdrm DSI users are battery powered devices
> > caring for saving as much power as possible, it might be good to just
> > keep this until it is being fixed considering this is very close to
> > the end of the series anyways?
> 
> I don't like to leave known to be broken code around, unless
> someone has plans to work on it. I wouldn't be surprised to see
> ULPS still broken two years from now =). It should be trivial to
> add the relevant bits back later.

Ack.

> But I can leave it here if you think it's better, presuming it
> doesn't have bigger conflicts with the 29/29 or break anything.
> However, I have only a few days left in TI, which is why I'm
> rushing here a bit (*). If I hit problems, I either have to drop
> the whole series, or push it in its current form.
> 
>  Tomi
> 
> (*) But I will fix possible issues caused by my push, of course.

Best of luck on whatever you do next!

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 27/29] drm/omap: dsi: remove ulps support

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:53PM +0200, Tomi Valkeinen wrote:
> ULPS doesn't work, and I have been unable to get it to work. As ULPS
> is a minor power-saving feature which requires substantial amount of
> non-trivial code, and we have trouble just getting and
> keeping DSI working at all, remove ULPS support.
>
> When the DSI driver works reliably for command and video mode displays,
> someone interested can add it back.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Is it really 'minor power-saving'? If I search for DSI and ULPS among
the first results is a TI datasheet for SN65DSI84, which claims device
active current in the more than 100mA range and ULPS current in the
less than 10mA range.

Considering all known omapdrm DSI users are battery powered devices
caring for saving as much power as possible, it might be good to just
keep this until it is being fixed considering this is very close to
the end of the series anyways?

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 297 +-
>  drivers/gpu/drm/omapdrm/dss/dsi.h |   4 -
>  2 files changed, 8 insertions(+), 293 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index cc8b169b2223..b2aa07a09dcd 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -53,8 +53,6 @@
>  #define REG_FLD_MOD(dsi, idx, val, start, end) \
>   dsi_write_reg(dsi, idx, FLD_MOD(dsi_read_reg(dsi, idx), val, start, 
> end))
>  
> -static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
> -
>  static int dsi_init_dispc(struct dsi_data *dsi);
>  static void dsi_uninit_dispc(struct dsi_data *dsi);
>  
> @@ -688,44 +686,6 @@ static int dsi_unregister_isr_vc(struct dsi_data *dsi, 
> int vc,
>   return r;
>  }
>  
> -static int dsi_register_isr_cio(struct dsi_data *dsi, omap_dsi_isr_t isr,
> - void *arg, u32 mask)
> -{
> - unsigned long flags;
> - int r;
> -
> - spin_lock_irqsave(&dsi->irq_lock, flags);
> -
> - r = _dsi_register_isr(isr, arg, mask, dsi->isr_tables.isr_table_cio,
> - ARRAY_SIZE(dsi->isr_tables.isr_table_cio));
> -
> - if (r == 0)
> - _omap_dsi_set_irqs_cio(dsi);
> -
> - spin_unlock_irqrestore(&dsi->irq_lock, flags);
> -
> - return r;
> -}
> -
> -static int dsi_unregister_isr_cio(struct dsi_data *dsi, omap_dsi_isr_t isr,
> -   void *arg, u32 mask)
> -{
> - unsigned long flags;
> - int r;
> -
> - spin_lock_irqsave(&dsi->irq_lock, flags);
> -
> - r = _dsi_unregister_isr(isr, arg, mask, dsi->isr_tables.isr_table_cio,
> - ARRAY_SIZE(dsi->isr_tables.isr_table_cio));
> -
> - if (r == 0)
> - _omap_dsi_set_irqs_cio(dsi);
> -
> - spin_unlock_irqrestore(&dsi->irq_lock, flags);
> -
> - return r;
> -}
> -
>  static u32 dsi_get_errors(struct dsi_data *dsi)
>  {
>   unsigned long flags;
> @@ -1450,56 +1410,6 @@ static void dsi_cio_timings(struct dsi_data *dsi)
>   dsi_write_reg(dsi, DSI_DSIPHY_CFG2, r);
>  }
>  
> -/* lane masks have lane 0 at lsb. mask_p for positive lines, n for negative 
> */
> -static void dsi_cio_enable_lane_override(struct dsi_data *dsi,
> -  unsigned int mask_p,
> -  unsigned int mask_n)
> -{
> - int i;
> - u32 l;
> - u8 lptxscp_start = dsi->num_lanes_supported == 3 ? 22 : 26;
> -
> - l = 0;
> -
> - for (i = 0; i < dsi->num_lanes_supported; ++i) {
> - unsigned int p = dsi->lanes[i].polarity;
> -
> - if (mask_p & (1 << i))
> - l |= 1 << (i * 2 + (p ? 0 : 1));
> -
> - if (mask_n & (1 << i))
> - l |= 1 << (i * 2 + (p ? 1 : 0));
> - }
> -
> - /*
> -  * Bits in REGLPTXSCPDAT4TO0DXDY:
> -  * 17: DY0 18: DX0
> -  * 19: DY1 20: DX1
> -  * 21: DY2 22: DX2
> -  * 23: DY3 24: DX3
> -  * 25: DY4 26: DX4
> -  */
> -
> - /* Set the lane override configuration */
> -
> - /* REGLPTXSCPDAT4TO0DXDY */
> - REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, l, lptxscp_start, 17);
> -
> - /* Enable lane override */
> -
> - /* ENLPTXSCPDAT */
> - REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, 1, 27, 27);
> -}
> -
> -static void dsi_cio_disable_lane_override(struct dsi_data *dsi)
> -{
> - /* Disable lane override */
> - REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, 0, 27, 27); /* ENLPTXSCPDAT */
> - /* Reset the lane override configuration */
> - /* REGLPTXSCPDAT4TO0DXDY */
> - REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, 0, 22, 17);
> -}
> -
>  static int dsi_cio_wait_tx_clk_esc_reset(struct dsi_data *dsi)
>  {
>   int t, i;
> @@ -1674,32 +1584,6 @@ static int dsi_cio_init(struct dsi_data *dsi)
>   l = FLD_MOD(l, 0x1fff, 12, 0);  /* STOP_STATE_COUNTER_IO */
>   dsi_write_reg(dsi, DSI_TIMING1, l);
>  
> - if (dsi->

[PATCH v5 27/29] drm/omap: dsi: remove ulps support

2020-12-08 Thread Tomi Valkeinen
ULPS doesn't work, and I have been unable to get it to work. As ULPS is
a minor power-saving feature which requires substantial amount of
non-trivial code, and we have trouble just getting and
keeping DSI working at all, remove ULPS support.

When the DSI driver works reliably for command and video mode displays,
someone interested can add it back.

Signed-off-by: Tomi Valkeinen 
Reviewed-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 297 +-
 drivers/gpu/drm/omapdrm/dss/dsi.h |   4 -
 2 files changed, 8 insertions(+), 293 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index cc8b169b2223..b2aa07a09dcd 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -53,8 +53,6 @@
 #define REG_FLD_MOD(dsi, idx, val, start, end) \
dsi_write_reg(dsi, idx, FLD_MOD(dsi_read_reg(dsi, idx), val, start, 
end))
 
-static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
-
 static int dsi_init_dispc(struct dsi_data *dsi);
 static void dsi_uninit_dispc(struct dsi_data *dsi);
 
@@ -688,44 +686,6 @@ static int dsi_unregister_isr_vc(struct dsi_data *dsi, int 
vc,
return r;
 }
 
-static int dsi_register_isr_cio(struct dsi_data *dsi, omap_dsi_isr_t isr,
-   void *arg, u32 mask)
-{
-   unsigned long flags;
-   int r;
-
-   spin_lock_irqsave(&dsi->irq_lock, flags);
-
-   r = _dsi_register_isr(isr, arg, mask, dsi->isr_tables.isr_table_cio,
-   ARRAY_SIZE(dsi->isr_tables.isr_table_cio));
-
-   if (r == 0)
-   _omap_dsi_set_irqs_cio(dsi);
-
-   spin_unlock_irqrestore(&dsi->irq_lock, flags);
-
-   return r;
-}
-
-static int dsi_unregister_isr_cio(struct dsi_data *dsi, omap_dsi_isr_t isr,
- void *arg, u32 mask)
-{
-   unsigned long flags;
-   int r;
-
-   spin_lock_irqsave(&dsi->irq_lock, flags);
-
-   r = _dsi_unregister_isr(isr, arg, mask, dsi->isr_tables.isr_table_cio,
-   ARRAY_SIZE(dsi->isr_tables.isr_table_cio));
-
-   if (r == 0)
-   _omap_dsi_set_irqs_cio(dsi);
-
-   spin_unlock_irqrestore(&dsi->irq_lock, flags);
-
-   return r;
-}
-
 static u32 dsi_get_errors(struct dsi_data *dsi)
 {
unsigned long flags;
@@ -1450,56 +1410,6 @@ static void dsi_cio_timings(struct dsi_data *dsi)
dsi_write_reg(dsi, DSI_DSIPHY_CFG2, r);
 }
 
-/* lane masks have lane 0 at lsb. mask_p for positive lines, n for negative */
-static void dsi_cio_enable_lane_override(struct dsi_data *dsi,
-unsigned int mask_p,
-unsigned int mask_n)
-{
-   int i;
-   u32 l;
-   u8 lptxscp_start = dsi->num_lanes_supported == 3 ? 22 : 26;
-
-   l = 0;
-
-   for (i = 0; i < dsi->num_lanes_supported; ++i) {
-   unsigned int p = dsi->lanes[i].polarity;
-
-   if (mask_p & (1 << i))
-   l |= 1 << (i * 2 + (p ? 0 : 1));
-
-   if (mask_n & (1 << i))
-   l |= 1 << (i * 2 + (p ? 1 : 0));
-   }
-
-   /*
-* Bits in REGLPTXSCPDAT4TO0DXDY:
-* 17: DY0 18: DX0
-* 19: DY1 20: DX1
-* 21: DY2 22: DX2
-* 23: DY3 24: DX3
-* 25: DY4 26: DX4
-*/
-
-   /* Set the lane override configuration */
-
-   /* REGLPTXSCPDAT4TO0DXDY */
-   REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, l, lptxscp_start, 17);
-
-   /* Enable lane override */
-
-   /* ENLPTXSCPDAT */
-   REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, 1, 27, 27);
-}
-
-static void dsi_cio_disable_lane_override(struct dsi_data *dsi)
-{
-   /* Disable lane override */
-   REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, 0, 27, 27); /* ENLPTXSCPDAT */
-   /* Reset the lane override configuration */
-   /* REGLPTXSCPDAT4TO0DXDY */
-   REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, 0, 22, 17);
-}
-
 static int dsi_cio_wait_tx_clk_esc_reset(struct dsi_data *dsi)
 {
int t, i;
@@ -1674,32 +1584,6 @@ static int dsi_cio_init(struct dsi_data *dsi)
l = FLD_MOD(l, 0x1fff, 12, 0);  /* STOP_STATE_COUNTER_IO */
dsi_write_reg(dsi, DSI_TIMING1, l);
 
-   if (dsi->ulps_enabled) {
-   unsigned int mask_p;
-   int i;
-
-   DSSDBG("manual ulps exit\n");
-
-   /* ULPS is exited by Mark-1 state for 1ms, followed by
-* stop state. DSS HW cannot do this via the normal
-* ULPS exit sequence, as after reset the DSS HW thinks
-* that we are not in ULPS mode, and refuses to send the
-* sequence. So we need to send the ULPS exit sequence
-* manually by setting positive lines high and negative lines
-* low for 1ms.
-*/
-
-   mask_p = 0;
-
-   for (i = 0; i < dsi->num_lanes_supported; ++i) {
-