Skip to contentSkip to conversation

OMAP: DSS2: RFBI driver update

PATCH In review Mikkel Christensen 3 participants 7 messages Oct 9, 2009 – Oct 13, 2009 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP: DSS2: RFBI driver update

This patch adds suspend / resume functionality to the RFBI driver along with missing callback functions needed by OMAP Frame buffer.

---
 drivers/video/omap2/dss/rfbi.c |   76 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)
drivers/video/omap2/dss/rfbi.c +76 -0
index 9dd2349..ddfc472 100644
@@ -1181,6 +1181,7 @@ int rfbi_init(void)
 
 	/* Enable autoidle and smart-idle */
 	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~((0x03 << 3)|(0x01 << 0));
 	l |= (1 << 0) | (2 << 3);
 	rfbi_write_reg(RFBI_SYSCONFIG, l);
 
@@ -1208,6 +1209,9 @@ static int rfbi_display_update(struct omap_dss_device *dssdev,
 {
 	int rfbi_module;
 
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	if (w == 0 || h == 0)
 		return 0;
 
@@ -1239,6 +1243,18 @@ static int rfbi_display_enable_te(struct omap_dss_device *dssdev, bool enable)
 	return 0;
 }
 
+static enum omap_dss_update_mode rfbi_display_get_update_mode(
+	struct omap_dss_device *dssdev)
+{
+	return OMAP_DSS_UPDATE_MANUAL;
+}
+
+static int rfbi_display_set_update_mode(struct omap_dss_device *dssdev,
+		enum omap_dss_update_mode mode)
+{
+	return 0;
+}
+
 static int rfbi_display_enable(struct omap_dss_device *dssdev)
 {
 	int r;
@@ -1269,6 +1285,7 @@ static int rfbi_display_enable(struct omap_dss_device *dssdev)
 	rfbi_set_timings(dssdev->phy.rfbi.channel,
 			 &dssdev->ctrl.rfbi_timings);
 
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
 	if (dssdev->driver->enable) {
 		r = dssdev->driver->enable(dssdev);
@@ -1288,12 +1305,67 @@ err0:
 
 static void rfbi_display_disable(struct omap_dss_device *dssdev)
 {
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+
 	dssdev->driver->disable(dssdev);
 	omap_dispc_unregister_isr(framedone_callback, NULL,
 			DISPC_IRQ_FRAMEDONE);
 	omap_dss_stop_device(dssdev);
 }
 
+static int rfbi_display_suspend(struct omap_dss_device *dssdev)
+{
+	unsigned long l;
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return -EINVAL;
+
+	DSSDBG("rfbi_display_suspend\n");
+
+	if (dssdev->driver->suspend)
+		dssdev->driver->suspend(dssdev);
+
+	dispc_enable_lcd_out(0);
+
+	/* Force idle */
+	rfbi_enable_clocks(1);
+	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~(0x03 << 3);
+	rfbi_write_reg(RFBI_SYSCONFIG, l);
+	rfbi_enable_clocks(0);
+
+	dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
+
+	return 0;
+}
+
+static int rfbi_display_resume(struct omap_dss_device *dssdev)
+{
+	unsigned long l;
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED)
+		return -EINVAL;
+
+	DSSDBG("rfbi_display_resume\n");
+
+	/* Re-enable autoidle */
+	rfbi_enable_clocks(1);
+	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~(0x03 << 3);
+	l |=  (0x02 << 3);
+	rfbi_write_reg(RFBI_SYSCONFIG, l);
+	rfbi_enable_clocks(0);
+
+	dispc_enable_lcd_out(1);
+
+	if (dssdev->driver->resume)
+		dssdev->driver->resume(dssdev);
+
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+
+	return 0;
+}
+
 int rfbi_init_display(struct omap_dss_device *dssdev)
 {
 	dssdev->enable = rfbi_display_enable;
@@ -1301,6 +1373,10 @@ int rfbi_init_display(struct omap_dss_device *dssdev)
 	dssdev->update = rfbi_display_update;
 	dssdev->sync = rfbi_display_sync;
 	dssdev->enable_te = rfbi_display_enable_te;
+	dssdev->get_update_mode = rfbi_display_get_update_mode;
+	dssdev->set_update_mode = rfbi_display_set_update_mode;
+	dssdev->suspend = rfbi_display_suspend;
+	dssdev->resume = rfbi_display_resume;
 
 	rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev;
 
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 71 lines · ext Mikkel Christensen

This patch adds suspend / resume functionality to the RFBI driver along with missing callback functions needed by OMAP Frame buffer.

---
 drivers/video/omap2/dss/rfbi.c |   76 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)
drivers/video/omap2/dss/rfbi.c +22 -0
index 9dd2349..ddfc472 100644
@@ -1181,6 +1181,7 @@ int rfbi_init(void)
 
 	/* Enable autoidle and smart-idle */
 	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~((0x03 << 3)|(0x01 << 0));
 	l |= (1 << 0) | (2 << 3);
 	rfbi_write_reg(RFBI_SYSCONFIG, l);
 
@@ -1208,6 +1209,9 @@ static int rfbi_display_update(struct omap_dss_device *dssdev,
 {
 	int rfbi_module;
 
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	if (w == 0 || h == 0)
 		return 0;
 
@@ -1239,6 +1243,18 @@ static int rfbi_display_enable_te(struct omap_dss_device *dssdev, bool enable)
 	return 0;
 }
 
+static enum omap_dss_update_mode rfbi_display_get_update_mode(
+	struct omap_dss_device *dssdev)
+{
+	return OMAP_DSS_UPDATE_MANUAL;
+}
+
+static int rfbi_display_set_update_mode(struct omap_dss_device *dssdev,
+		enum omap_dss_update_mode mode)
+{
+	return 0;
+}
+
 static int rfbi_display_enable(struct omap_dss_device *dssdev)
 {
 	int r;
@@ -1269,6 +1285,7 @@ static int rfbi_display_enable(struct omap_dss_device *dssdev)
 	rfbi_set_timings(dssdev->phy.rfbi.channel,
 			 &dssdev->ctrl.rfbi_timings);
 
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
 	if (dssdev->driver->enable) {
 		r = dssdev->driver->enable(dssdev);
@@ -1288,12 +1305,67 @@ err0:
 
 static void rfbi_display_disable(struct omap_dss_device *dssdev)
 {
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+
 	dssdev->driver->disable(dssdev);
 	omap_dispc_unregister_isr(framedone_callback, NULL,
 			DISPC_IRQ_FRAMEDONE);
 	omap_dss_stop_device(dssdev);
 }
 
+static int rfbi_display_suspend(struct omap_dss_device *dssdev)
+{
+	unsigned long l;

drivers/video/omap2/dss/rfbi.c err0: · line 1328

Quoted 10 lines
drivers/video/omap2/dss/rfbi.c +10 -0
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return -EINVAL;
+
+	DSSDBG("rfbi_display_suspend\n");
+
+	if (dssdev->driver->suspend)
+		dssdev->driver->suspend(dssdev);
+
+	dispc_enable_lcd_out(0);

I don't think this is needed. DSS hardware disables lcd_out when the transfer has finished. Although for correct operation suspend() should wait until the last transfer has been done before disabling clocks, which is something it currently doesn't.

drivers/video/omap2/dss/rfbi.c err0: · line 1335

Quoted 7 lines
drivers/video/omap2/dss/rfbi.c +7 -0
+
+	/* Force idle */
+	rfbi_enable_clocks(1);
+	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~(0x03 << 3);
+	rfbi_write_reg(RFBI_SYSCONFIG, l);
+	rfbi_enable_clocks(0);

Why force idle?

Quoted 14 lines
drivers/video/omap2/dss/rfbi.c +14 -0
+
+	dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
+
+	return 0;
+}
+
+static int rfbi_display_resume(struct omap_dss_device *dssdev)
+{
+	unsigned long l;
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED)
+		return -EINVAL;
+
+	DSSDBG("rfbi_display_resume\n");

drivers/video/omap2/dss/rfbi.c err0: · line 1359

Quoted 10 lines
drivers/video/omap2/dss/rfbi.c +10 -0
+
+	/* Re-enable autoidle */
+	rfbi_enable_clocks(1);
+	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~(0x03 << 3);
+	l |=  (0x02 << 3);
+	rfbi_write_reg(RFBI_SYSCONFIG, l);
+	rfbi_enable_clocks(0);
+
+	dispc_enable_lcd_out(1);

This is not needed. lcd_out is enabled when the transfer is started.

Quoted 23 lines
drivers/video/omap2/dss/rfbi.c +13 -0
+
+	if (dssdev->driver->resume)
+		dssdev->driver->resume(dssdev);
+
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+
+	return 0;
+}
+
 int rfbi_init_display(struct omap_dss_device *dssdev)
 {
 	dssdev->enable = rfbi_display_enable;
@@ -1301,6 +1373,10 @@ int rfbi_init_display(struct omap_dss_device *dssdev)
 	dssdev->update = rfbi_display_update;
 	dssdev->sync = rfbi_display_sync;
 	dssdev->enable_te = rfbi_display_enable_te;
+	dssdev->get_update_mode = rfbi_display_get_update_mode;
+	dssdev->set_update_mode = rfbi_display_set_update_mode;
+	dssdev->suspend = rfbi_display_suspend;
+	dssdev->resume = rfbi_display_resume;
 
 	rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev;
 
#2 lore raw
Quoted 84 lines · Tomi Valkeinen

Subject: Re: [PATCH 1/1] OMAP: DSS2: RFBI driver update

Quoted 1 line · ext Mikkel Christensen

This patch adds suspend / resume functionality to the RFBI

driver along with missing callback functions needed by OMAP Frame buffer.

Quoted 4 lines
---
 drivers/video/omap2/dss/rfbi.c |   76 

++++++++++++++++++++++++++++++++++++++++

drivers/video/omap2/dss/rfbi.c static int

Quoted 25 lines
 1 files changed, 76 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/drivers/video/omap2/dss/rfbi.c index 9dd2349..ddfc472 100644

drivers/video/omap2/dss/rfbi.c +4 -0
@@ -1181,6 +1181,7 @@ int rfbi_init(void)
 
 	/* Enable autoidle and smart-idle */
 	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~((0x03 << 3)|(0x01 << 0));
 	l |= (1 << 0) | (2 << 3);
 	rfbi_write_reg(RFBI_SYSCONFIG, l);
 
@@ -1208,6 +1209,9 @@ static int rfbi_display_update(struct 
 omap_dss_device *dssdev,  {
 	int rfbi_module;
 
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	if (w == 0 || h == 0)
 		return 0;
 
@@ -1239,6 +1243,18 @@ static int

rfbi_display_enable_te(struct omap_dss_device *dssdev, bool enable)

drivers/video/omap2/dss/rfbi.c static int rfbi_display_enable_te(struct omap_dss_device *dssdev, bool enable)

Quoted 10 lines
drivers/video/omap2/dss/rfbi.c +7 -0
 	return 0;
 }
 
+static enum omap_dss_update_mode rfbi_display_get_update_mode(
+	struct omap_dss_device *dssdev)
+{
+	return OMAP_DSS_UPDATE_MANUAL;
+}
+
+static int rfbi_display_set_update_mode(struct

omap_dss_device *dssdev,

drivers/video/omap2/dss/rfbi.c static int rfbi_display_enable(struct

Quoted 8 lines
drivers/video/omap2/dss/rfbi.c +5 -0
+		enum omap_dss_update_mode mode)
+{
+	return 0;
+}
+
 static int rfbi_display_enable(struct omap_dss_device *dssdev)  {
 	int r;
@@ -1269,6 +1285,7 @@ static int rfbi_display_enable(struct

omap_dss_device *dssdev)

drivers/video/omap2/dss/rfbi.c static int rfbi_display_enable(struct omap_dss_device *dssdev)

Quoted 7 lines
drivers/video/omap2/dss/rfbi.c +1 -0
 	rfbi_set_timings(dssdev->phy.rfbi.channel,
 			 &dssdev->ctrl.rfbi_timings);
 
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
 	if (dssdev->driver->enable) {
 		r = dssdev->driver->enable(dssdev); @@ -1288,12

+1305,67 @@ err0:

Quoted 19 lines

static void rfbi_display_disable(struct omap_dss_device *dssdev) {

drivers/video/omap2/dss/rfbi.c +11 -0
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+
 	dssdev->driver->disable(dssdev);
 	omap_dispc_unregister_isr(framedone_callback, NULL,
 			DISPC_IRQ_FRAMEDONE);
 	omap_dss_stop_device(dssdev);
 }
 
+static int rfbi_display_suspend(struct omap_dss_device *dssdev) {
+	unsigned long l;
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return -EINVAL;
+
+	DSSDBG("rfbi_display_suspend\n");
+
+	if (dssdev->driver->suspend)
Quoted 8 lines

drivers/video/omap2/dss/rfbi.c err0: · line 1328

Quoted 3 lines
drivers/video/omap2/dss/rfbi.c +3 -0
+		dssdev->driver->suspend(dssdev);
+
+	dispc_enable_lcd_out(0);

I don't think this is needed. DSS hardware disables lcd_out when the transfer has finished. Although for correct operation suspend() should wait until the last transfer has been done before disabling clocks, which is something it currently doesn't.

This was done with reference to the DPI and SDI files that do the same thing. It can be removed if not necessary.

Quoted 9 lines

drivers/video/omap2/dss/rfbi.c err0: · line 1335

Quoted 7 lines
drivers/video/omap2/dss/rfbi.c +7 -0
+
+	/* Force idle */
+	rfbi_enable_clocks(1);
+	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~(0x03 << 3);
+	rfbi_write_reg(RFBI_SYSCONFIG, l);
+	rfbi_enable_clocks(0);

Why force idle?

The RFBI module must be forced to idle on suspend to allow for the DSS module to idle. The CM_CLKSTST_DSS[CLKACTIVITY_DSS] bit does not change if the RFBI module was configured to autoidle, preventing DSS from entering retention or off.

Quoted 17 lines
Quoted 17 lines
drivers/video/omap2/dss/rfbi.c +17 -0
+
+	dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
+
+	return 0;
+}
+
+static int rfbi_display_resume(struct omap_dss_device *dssdev) {
+	unsigned long l;
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED)
+		return -EINVAL;
+
+	DSSDBG("rfbi_display_resume\n");
+
+	/* Re-enable autoidle */
+	rfbi_enable_clocks(1);
+	l = rfbi_read_reg(RFBI_SYSCONFIG);
Quoted 8 lines

drivers/video/omap2/dss/rfbi.c err0: · line 1359

Quoted 6 lines
drivers/video/omap2/dss/rfbi.c +6 -0
+	l &= ~(0x03 << 3);
+	l |=  (0x02 << 3);
+	rfbi_write_reg(RFBI_SYSCONFIG, l);
+	rfbi_enable_clocks(0);
+
+	dispc_enable_lcd_out(1);

This is not needed. lcd_out is enabled when the transfer is started.

This was done with reference to the DPI and SDI files that do the same thing. It can be removed if not necessary.

Quoted 26 lines

drivers/video/omap2/dss/rfbi.c err0:

Quoted 11 lines
drivers/video/omap2/dss/rfbi.c +9 -0
+
+	if (dssdev->driver->resume)
+		dssdev->driver->resume(dssdev);
+
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+
+	return 0;
+}
+
 int rfbi_init_display(struct omap_dss_device *dssdev)  {
 	dssdev->enable = rfbi_display_enable; @@ -1301,6

+1373,10 @@ int

Quoted 11 lines

rfbi_init_display(struct omap_dss_device *dssdev)

drivers/video/omap2/dss/rfbi.c +4 -0
 	dssdev->update = rfbi_display_update;
 	dssdev->sync = rfbi_display_sync;
 	dssdev->enable_te = rfbi_display_enable_te;
+	dssdev->get_update_mode = rfbi_display_get_update_mode;
+	dssdev->set_update_mode = rfbi_display_set_update_mode;
+	dssdev->suspend = rfbi_display_suspend;
+	dssdev->resume = rfbi_display_resume;
 
 	rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev;
#3 lore raw
Quoted 14 lines · Mikkel
Quoted 13 lines · Tomi Valkeinen

Subject: Re: [PATCH 1/1] OMAP: DSS2: RFBI driver update

Quoted 1 line · ext Mikkel Christensen

This patch adds suspend / resume functionality to the RFBI

driver along with missing callback functions needed by OMAP Frame buffer.

Quoted 4 lines
---
 drivers/video/omap2/dss/rfbi.c |   76 

++++++++++++++++++++++++++++++++++++++++

Quoted 2 lines
 1 files changed, 76 insertions(+), 0 deletions(-)

snip

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
drivers/video/omap2/dss/rfbi.c +9 -0
+static int rfbi_display_suspend(struct omap_dss_device *dssdev) {
+	unsigned long l;
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return -EINVAL;
+
+	DSSDBG("rfbi_display_suspend\n");
+
+	if (dssdev->driver->suspend)
Quoted 8 lines

drivers/video/omap2/dss/rfbi.c err0: · line 1328

Quoted 3 lines
drivers/video/omap2/dss/rfbi.c +3 -0
+		dssdev->driver->suspend(dssdev);
+
+	dispc_enable_lcd_out(0);

I don't think this is needed. DSS hardware disables lcd_out when the transfer has finished. Although for correct operation suspend() should wait until the last transfer has been done before disabling clocks, which is something it currently doesn't.

Quoted 1 line

This was done with reference to the DPI and SDI files that do the same thing. It can be removed if not necessary.

DPI and SDI work quite differently than RFBI, you can't just copy their functionality =).

It is more correct without disable/enable_lcd_out, but it's not correct as there may be a transfer ongoing when suspend call comes. That's why there should be some mechanism to wait until the transfer has been done. DSI tries to do this (and hopefully correctly does =).

Quoted 11 lines
Quoted 10 lines

drivers/video/omap2/dss/rfbi.c err0: · line 1335

Quoted 8 lines
drivers/video/omap2/dss/rfbi.c +7 -0
+
+	/* Force idle */
+	rfbi_enable_clocks(1);
+	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~(0x03 << 3);
+	rfbi_write_reg(RFBI_SYSCONFIG, l);
+	rfbi_enable_clocks(0);

Why force idle?

Quoted 1 line

The RFBI module must be forced to idle on suspend to allow for the DSS module to idle. The CM_CLKSTST_DSS[CLKACTIVITY_DSS] bit does not change if the RFBI module was configured to autoidle, preventing DSS from entering retention or off.

Why must it? Is there a hardware bug (what errata number?)?

Tomi

#4 lore raw
Quoted 44 lines · Tomi Valkeinen

Subject: RE: [PATCH 1/1] OMAP: DSS2: RFBI driver update

Quoted 14 lines · Mikkel
Quoted 13 lines · Tomi Valkeinen

Subject: Re: [PATCH 1/1] OMAP: DSS2: RFBI driver update

Quoted 1 line · ext Mikkel Christensen

This patch adds suspend / resume functionality to the RFBI

driver along with missing callback functions needed by OMAP Frame buffer.

Quoted 4 lines
---
 drivers/video/omap2/dss/rfbi.c |   76 

++++++++++++++++++++++++++++++++++++++++

Quoted 2 lines
 1 files changed, 76 insertions(+), 0 deletions(-)

snip

Quoted 1 line
Quoted 1 line
Quoted 1 line

+static int rfbi_display_suspend(struct omap_dss_device

*dssdev) {

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/video/omap2/dss/rfbi.c +5 -0
+	unsigned long l;
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return -EINVAL;
+
Quoted 8 lines
Quoted 8 lines

drivers/video/omap2/dss/rfbi.c err0: · line 1328

Quoted 6 lines
drivers/video/omap2/dss/rfbi.c +6 -0
+	DSSDBG("rfbi_display_suspend\n");
+
+	if (dssdev->driver->suspend)
+		dssdev->driver->suspend(dssdev);
+
+	dispc_enable_lcd_out(0);

I don't think this is needed. DSS hardware disables

lcd_out when the

Quoted 2 lines
Quoted 2 lines

transfer has finished. Although for correct operation suspend() should wait until the last transfer has been done before

disabling

Quoted 3 lines
Quoted 1 line

clocks, which is something it currently doesn't.

This was done with reference to the DPI and SDI files that

do the same thing. It can be removed if not necessary.

Quoted 8 lines

DPI and SDI work quite differently than RFBI, you can't just copy their functionality =).

It is more correct without disable/enable_lcd_out, but it's not correct as there may be a transfer ongoing when suspend call comes. That's why there should be some mechanism to wait until the transfer has been done.
DSI tries to do this (and hopefully correctly does =).

OK. Thanks I will try to incorporate this. Where in the DSI driver is this mechanism implemented?

Quoted 24 lines
Quoted 11 lines
Quoted 10 lines

drivers/video/omap2/dss/rfbi.c err0: · line 1335

Quoted 8 lines
drivers/video/omap2/dss/rfbi.c +7 -0
+
+	/* Force idle */
+	rfbi_enable_clocks(1);
+	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~(0x03 << 3);
+	rfbi_write_reg(RFBI_SYSCONFIG, l);
+	rfbi_enable_clocks(0);

Why force idle?

Quoted 1 line

The RFBI module must be forced to idle on suspend to allow

for the DSS module to idle. The CM_CLKSTST_DSS[CLKACTIVITY_DSS] bit does not change if the RFBI module was configured to autoidle, preventing DSS from entering retention or off.

Why must it? Is there a hardware bug (what errata number?)?

Tomi

#5 lore raw
Quoted 48 lines · Mikkel
Quoted 47 lines · Tomi Valkeinen

Subject: RE: [PATCH 1/1] OMAP: DSS2: RFBI driver update

Quoted 14 lines · Mikkel
Quoted 13 lines · Tomi Valkeinen

Subject: Re: [PATCH 1/1] OMAP: DSS2: RFBI driver update

Quoted 1 line · ext Mikkel Christensen

This patch adds suspend / resume functionality to the RFBI

driver along with missing callback functions needed by OMAP Frame buffer.

Quoted 4 lines
---
 drivers/video/omap2/dss/rfbi.c |   76 

++++++++++++++++++++++++++++++++++++++++

Quoted 2 lines
 1 files changed, 76 insertions(+), 0 deletions(-)

snip

Quoted 1 line
Quoted 1 line
Quoted 1 line

+static int rfbi_display_suspend(struct omap_dss_device

*dssdev) {

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/video/omap2/dss/rfbi.c +5 -0
+	unsigned long l;
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return -EINVAL;
+
Quoted 8 lines
Quoted 8 lines

drivers/video/omap2/dss/rfbi.c err0: · line 1328

Quoted 6 lines
drivers/video/omap2/dss/rfbi.c +6 -0
+	DSSDBG("rfbi_display_suspend\n");
+
+	if (dssdev->driver->suspend)
+		dssdev->driver->suspend(dssdev);
+
+	dispc_enable_lcd_out(0);

I don't think this is needed. DSS hardware disables

lcd_out when the

Quoted 2 lines
Quoted 2 lines

transfer has finished. Although for correct operation suspend() should wait until the last transfer has been done before

disabling

Quoted 3 lines
Quoted 1 line

clocks, which is something it currently doesn't.

This was done with reference to the DPI and SDI files that

do the same thing. It can be removed if not necessary.

DPI and SDI work quite differently than RFBI, you can't just copy their functionality =).

Quoted 7 lines
Quoted 5 lines

It is more correct without disable/enable_lcd_out, but it's not correct as there may be a transfer ongoing when suspend call comes. That's why there should be some mechanism to wait until the transfer has been done.
DSI tries to do this (and hopefully correctly does =).

OK. Thanks I will try to incorporate this. Where in the DSI driver is this mechanism implemented?

It's the dsi_bus_lock mechanism. But it doesn't work as such for RFBI, because the DSI uses a bit different mechanism for updates. But somehow the suspend function needs to wait until the transfer has been completed, and suspend only after that (and also make sure that no new transfer starts before the suspend).

Tomi

#6 lore raw
In reply to Mikkel Christensen
Quoted 12 lines · Mikkel Christensen

This patch adds suspend / resume functionality to the RFBI driver along with missing callback functions needed by OMAP Frame buffer.

---
 drivers/video/omap2/dss/rfbi.c |   76 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)
drivers/video/omap2/dss/rfbi.c +0 -0
index 9dd2349..ddfc472 100644

drivers/video/omap2/dss/rfbi.c int rfbi_init(void) · line 1184

Quoted 4 lines
drivers/video/omap2/dss/rfbi.c +1 -0
@@ -1181,6 +1181,7 @@ int rfbi_init(void)
 
 	/* Enable autoidle and smart-idle */
 	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~((0x03 << 3)|(0x01 << 0));

Please use symbolic names for these SYSCONFIG values. I realize you inherited this from other drivers, but it should be fixed.

While you're at it, fixing the others would be nice too. You could do a cleanup patch before your actual driver update.

Ideally, DSS needs to create an omap_hwmod, but in the meantime you could use the defines from <mach/omap_hwmod.h>

Quoted 60 lines
drivers/video/omap2/dss/rfbi.c +26 -0
 	l |= (1 << 0) | (2 << 3);
 	rfbi_write_reg(RFBI_SYSCONFIG, l);
 
@@ -1208,6 +1209,9 @@ static int rfbi_display_update(struct omap_dss_device *dssdev,
 {
 	int rfbi_module;
 
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	if (w == 0 || h == 0)
 		return 0;
 
@@ -1239,6 +1243,18 @@ static int rfbi_display_enable_te(struct omap_dss_device *dssdev, bool enable)
 	return 0;
 }
 
+static enum omap_dss_update_mode rfbi_display_get_update_mode(
+	struct omap_dss_device *dssdev)
+{
+	return OMAP_DSS_UPDATE_MANUAL;
+}
+
+static int rfbi_display_set_update_mode(struct omap_dss_device *dssdev,
+		enum omap_dss_update_mode mode)
+{
+	return 0;
+}
+
 static int rfbi_display_enable(struct omap_dss_device *dssdev)
 {
 	int r;
@@ -1269,6 +1285,7 @@ static int rfbi_display_enable(struct omap_dss_device *dssdev)
 	rfbi_set_timings(dssdev->phy.rfbi.channel,
 			 &dssdev->ctrl.rfbi_timings);
 
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
 	if (dssdev->driver->enable) {
 		r = dssdev->driver->enable(dssdev);
@@ -1288,12 +1305,67 @@ err0:
 
 static void rfbi_display_disable(struct omap_dss_device *dssdev)
 {
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+
 	dssdev->driver->disable(dssdev);
 	omap_dispc_unregister_isr(framedone_callback, NULL,
 			DISPC_IRQ_FRAMEDONE);
 	omap_dss_stop_device(dssdev);
 }
 
+static int rfbi_display_suspend(struct omap_dss_device *dssdev)
+{
+	unsigned long l;
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return -EINVAL;
+
+	DSSDBG("rfbi_display_suspend\n");

drivers/video/omap2/dss/rfbi.c err0: · line 1333

Quoted 10 lines
drivers/video/omap2/dss/rfbi.c +10 -0
+
+	if (dssdev->driver->suspend)
+		dssdev->driver->suspend(dssdev);
+
+	dispc_enable_lcd_out(0);
+
+	/* Force idle */
+	rfbi_enable_clocks(1);
+	l = rfbi_read_reg(RFBI_SYSCONFIG);
+	l &= ~(0x03 << 3);

Again, use SYSC_SIDLEMODE_SHIFT, SYSC_SIDLEMODE_MASK.

More of these follow.

Kevin