From: Michael Bode <michael@bumbleB.de>
To: dri-devel@lists.freedesktop.org
Subject: TILCDC driver - Array to keep register values during PM suspend is too small
Date: Wed, 01 Jul 2015 22:18:46 +0200 [thread overview]
Message-ID: <55944B26.3010806@bumbleB.de> (raw)
In-Reply-To: <55930EEB.5050602@bumbleB.de>
Hi,
i currently try to write a LIDD version of the TILCDC driver in
driver/gpu/drm.
During my investigations I found the function "tilcdc_pm_suspend" in
tilcdc_drv.c:
#ifdef CONFIG_PM_SLEEP
static int tilcdc_pm_suspend(struct device *dev)
{
.....
/* Save register state: */
for (i = 0; i < ARRAY_SIZE(registers); i++)
if (registers[i].save && (priv->rev >= registers[i].rev))
priv->saved_register[n++] = tilcdc_read(ddev,
registers[i].reg);
priv->ctx_valid = true;
return 0;
}
The member "saved_register" that is filled with register values here is
an array defined in tilcdc_drv.h:
struct tilcdc_drm_private {
.....
/* register contents saved across suspend/resume: */
u32 saved_register[12];
bool ctx_valid;
.....
As you can see the size of that array is 12 times u32, so it can keep 12
register values.
But if you have a look at the register list to be saved, you will find:
#if defined(CONFIG_DEBUG_FS) || defined(CONFIG_PM_SLEEP)
static const struct {
const char *name;
uint8_t rev;
uint8_t save;
uint32_t reg;
} registers[] = {
#define REG(rev, save, reg) { #reg, rev, save, reg }
/* exists in revision 1: */
REG(1, false, LCDC_PID_REG),
REG(1, true, LCDC_CTRL_REG),
REG(1, false, LCDC_STAT_REG),
REG(1, true, LCDC_RASTER_CTRL_REG),
REG(1, true, LCDC_RASTER_TIMING_0_REG),
REG(1, true, LCDC_RASTER_TIMING_1_REG),
REG(1, true, LCDC_RASTER_TIMING_2_REG),
REG(1, true, LCDC_DMA_CTRL_REG),
REG(1, true, LCDC_DMA_FB_BASE_ADDR_0_REG),
REG(1, true, LCDC_DMA_FB_CEILING_ADDR_0_REG),
REG(1, true, LCDC_DMA_FB_BASE_ADDR_1_REG),
REG(1, true, LCDC_DMA_FB_CEILING_ADDR_1_REG),
/* new in revision 2: */
REG(2, false, LCDC_RAW_STAT_REG),
REG(2, false, LCDC_MASKED_STAT_REG),
REG(2, false, LCDC_INT_ENABLE_SET_REG),
REG(2, false, LCDC_INT_ENABLE_CLR_REG),
REG(2, false, LCDC_END_OF_INT_IND_REG),
REG(2, true, LCDC_CLK_ENABLE_REG),
REG(2, true, LCDC_INT_ENABLE_SET_REG),
#undef REG
};
#endif
And if I count correctly in case you have an LCDC Revision 2, there will
be 19 registers saved to the array.
So probably you will write over the end of that array.
I hope the form of my post fits the posting rules of this forum. If not,
sorry. It is my very first post!
Br,
Michael
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2015-07-01 20:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 21:49 TILCDC driver - Array to keep register values during PM suspend is too small Michael Bode
2015-07-01 20:18 ` Michael Bode [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55944B26.3010806@bumbleB.de \
--to=michael@bumbleb.de \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.