Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294263
b: refs/heads/master
c: 0543283
h: refs/heads/master
i:
  294261: 4c277bd
  294259: 7005118
  294255: d0967fb
v: v3
  • Loading branch information
Laurent Pinchart committed Mar 12, 2012
1 parent 9ffd2e9 commit e757f4a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d272f428fac77ec57049a3293583ab3353928b1c
refs/heads/master: 05432837ae0dfc6c7de93d081b1377ced4eb866b
80 changes: 43 additions & 37 deletions trunk/drivers/video/sh_mobile_meram.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct sh_mobile_meram_priv {
void __iomem *base;
struct mutex lock;
unsigned long used_icb;
int used_meram_cache_regions;
unsigned int used_meram_cache_regions;
unsigned long used_meram_cache[SH_MOBILE_MERAM_ICB_NUM];
unsigned long cmn_saved_regs[CMN_REGS_SIZE];
unsigned long icb_saved_regs[ICB_REGS_SIZE * SH_MOBILE_MERAM_ICB_NUM];
Expand All @@ -120,24 +120,25 @@ struct sh_mobile_meram_priv {

#define MERAM_ICB_OFFSET(base, idx, off) ((base) + (off) + (idx) * 0x20)

static inline void meram_write_icb(void __iomem *base, int idx, int off,
unsigned long val)
static inline void meram_write_icb(void __iomem *base, unsigned int idx,
unsigned int off, unsigned long val)
{
iowrite32(val, MERAM_ICB_OFFSET(base, idx, off));
}

static inline unsigned long meram_read_icb(void __iomem *base, int idx, int off)
static inline unsigned long meram_read_icb(void __iomem *base, unsigned int idx,
unsigned int off)
{
return ioread32(MERAM_ICB_OFFSET(base, idx, off));
}

static inline void meram_write_reg(void __iomem *base, int off,
unsigned long val)
static inline void meram_write_reg(void __iomem *base, unsigned int off,
unsigned long val)
{
iowrite32(val, base + off);
}

static inline unsigned long meram_read_reg(void __iomem *base, int off)
static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off)
{
return ioread32(base + off);
}
Expand All @@ -158,8 +159,8 @@ static inline unsigned long meram_read_reg(void __iomem *base, int off)
static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
struct sh_mobile_meram_icb_cfg *new)
{
int i;
int used_start, used_end, meram_start, meram_end;
unsigned int used_start, used_end, meram_start, meram_end;
unsigned int i;

/* valid ICB? */
if (new->marker_icb & ~0x1f || new->cache_icb & ~0x1f)
Expand Down Expand Up @@ -190,7 +191,7 @@ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
static inline void meram_mark(struct sh_mobile_meram_priv *priv,
struct sh_mobile_meram_icb_cfg *new)
{
int n;
unsigned int n;

if (new->marker_icb < 0 || new->cache_icb < 0)
return;
Expand All @@ -213,8 +214,8 @@ static inline void meram_mark(struct sh_mobile_meram_priv *priv,
static inline void meram_unmark(struct sh_mobile_meram_priv *priv,
struct sh_mobile_meram_icb_cfg *icb)
{
int i;
unsigned long pattern;
unsigned int i;

if (icb->marker_icb < 0 || icb->cache_icb < 0)
return;
Expand Down Expand Up @@ -304,12 +305,15 @@ static inline void meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,

static int meram_init(struct sh_mobile_meram_priv *priv,
struct sh_mobile_meram_icb_cfg *icb,
int xres, int yres, int *out_pitch)
unsigned int xres, unsigned int yres,
unsigned int *out_pitch)
{
unsigned long total_byte_count = MERAM_CALC_BYTECOUNT(xres, yres);
unsigned long bnm;
int lcdc_pitch, xpitch, line_cnt;
int save_lines;
unsigned int lcdc_pitch;
unsigned int xpitch;
unsigned int line_cnt;
unsigned int save_lines;

/* adjust pitch to 1024, 2048, 4096 or 8192 */
lcdc_pitch = (xres - 1) | 1023;
Expand Down Expand Up @@ -386,16 +390,18 @@ static void meram_deinit(struct sh_mobile_meram_priv *priv,

static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
struct sh_mobile_meram_cfg *cfg,
int xres, int yres, int pixelformat,
unsigned int xres, unsigned int yres,
unsigned int pixelformat,
unsigned long base_addr_y,
unsigned long base_addr_c,
unsigned long *icb_addr_y,
unsigned long *icb_addr_c,
int *pitch)
unsigned int *pitch)
{
struct platform_device *pdev;
struct sh_mobile_meram_priv *priv;
int n, out_pitch;
unsigned int out_pitch;
unsigned int n;
int error = 0;

if (!pdata || !pdata->priv || !pdata->pdev || !cfg)
Expand Down Expand Up @@ -538,21 +544,21 @@ static int sh_mobile_meram_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
int k, j;
unsigned int i, j;

for (k = 0; k < CMN_REGS_SIZE; k++)
priv->cmn_saved_regs[k] = meram_read_reg(priv->base,
common_regs[k]);
for (i = 0; i < CMN_REGS_SIZE; i++)
priv->cmn_saved_regs[i] = meram_read_reg(priv->base,
common_regs[i]);

for (j = 0; j < 32; j++) {
if (!test_bit(j, &priv->used_icb))
for (i = 0; i < 32; i++) {
if (!test_bit(i, &priv->used_icb))
continue;
for (k = 0; k < ICB_REGS_SIZE; k++) {
priv->icb_saved_regs[j * ICB_REGS_SIZE + k] =
meram_read_icb(priv->base, j, icb_regs[k]);
for (j = 0; j < ICB_REGS_SIZE; j++) {
priv->icb_saved_regs[i * ICB_REGS_SIZE + j] =
meram_read_icb(priv->base, i, icb_regs[j]);
/* Reset ICB on resume */
if (icb_regs[k] == MExxCTL)
priv->icb_saved_regs[j * ICB_REGS_SIZE + k] |=
if (icb_regs[j] == MExxCTL)
priv->icb_saved_regs[i * ICB_REGS_SIZE + j] |=
MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF;
}
}
Expand All @@ -563,20 +569,20 @@ static int sh_mobile_meram_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
int k, j;
unsigned int i, j;

for (j = 0; j < 32; j++) {
if (!test_bit(j, &priv->used_icb))
for (i = 0; i < 32; i++) {
if (!test_bit(i, &priv->used_icb))
continue;
for (k = 0; k < ICB_REGS_SIZE; k++) {
meram_write_icb(priv->base, j, icb_regs[k],
priv->icb_saved_regs[j * ICB_REGS_SIZE + k]);
for (j = 0; j < ICB_REGS_SIZE; j++) {
meram_write_icb(priv->base, i, icb_regs[j],
priv->icb_saved_regs[i * ICB_REGS_SIZE + j]);
}
}

for (k = 0; k < CMN_REGS_SIZE; k++)
meram_write_reg(priv->base, common_regs[k],
priv->cmn_saved_regs[k]);
for (i = 0; i < CMN_REGS_SIZE; i++)
meram_write_reg(priv->base, common_regs[i],
priv->cmn_saved_regs[i]);
return 0;
}

Expand Down
6 changes: 4 additions & 2 deletions trunk/include/video/sh_mobile_meram.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ struct sh_mobile_meram_ops {
/* register usage of meram */
int (*meram_register)(struct sh_mobile_meram_info *meram_dev,
struct sh_mobile_meram_cfg *cfg,
int xres, int yres, int pixelformat,
unsigned int xres, unsigned int yres,
unsigned int pixelformat,
unsigned long base_addr_y,
unsigned long base_addr_c,
unsigned long *icb_addr_y,
unsigned long *icb_addr_c, int *pitch);
unsigned long *icb_addr_c,
unsigned int *pitch);

/* unregister usage of meram */
int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
Expand Down

0 comments on commit e757f4a

Please sign in to comment.