sh_mobile_meram: Use direct function calls for the public API
There's no reason to use abstract operation pointers to implement the MERAM API. Replace them by direct function calls. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
4a23717721
commit
6e729b416b
@ -1115,13 +1115,12 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
|
|||||||
ch->line_size = ch->pitch;
|
ch->line_size = ch->pitch;
|
||||||
|
|
||||||
/* Enable MERAM if possible. */
|
/* Enable MERAM if possible. */
|
||||||
if (mdev == NULL || mdev->ops == NULL ||
|
if (mdev == NULL || ch->cfg->meram_cfg == NULL)
|
||||||
ch->cfg->meram_cfg == NULL)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Free the allocated MERAM cache. */
|
/* Free the allocated MERAM cache. */
|
||||||
if (ch->cache) {
|
if (ch->cache) {
|
||||||
mdev->ops->cache_free(mdev, ch->cache);
|
sh_mobile_meram_cache_free(mdev, ch->cache);
|
||||||
ch->cache = NULL;
|
ch->cache = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1144,11 +1143,11 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache = mdev->ops->cache_alloc(mdev, ch->cfg->meram_cfg,
|
cache = sh_mobile_meram_cache_alloc(mdev, ch->cfg->meram_cfg,
|
||||||
ch->pitch, ch->yres, pixelformat,
|
ch->pitch, ch->yres, pixelformat,
|
||||||
&ch->line_size);
|
&ch->line_size);
|
||||||
if (!IS_ERR(cache)) {
|
if (!IS_ERR(cache)) {
|
||||||
mdev->ops->cache_update(mdev, cache,
|
sh_mobile_meram_cache_update(mdev, cache,
|
||||||
ch->base_addr_y, ch->base_addr_c,
|
ch->base_addr_y, ch->base_addr_c,
|
||||||
&ch->base_addr_y, &ch->base_addr_c);
|
&ch->base_addr_y, &ch->base_addr_c);
|
||||||
ch->cache = cache;
|
ch->cache = cache;
|
||||||
@ -1223,9 +1222,7 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
|
|||||||
|
|
||||||
/* Free the MERAM cache. */
|
/* Free the MERAM cache. */
|
||||||
if (ch->cache) {
|
if (ch->cache) {
|
||||||
struct sh_mobile_meram_info *mdev;
|
sh_mobile_meram_cache_free(priv->meram_dev, ch->cache);
|
||||||
mdev = priv->meram_dev;
|
|
||||||
mdev->ops->cache_free(mdev, ch->cache);
|
|
||||||
ch->cache = 0;
|
ch->cache = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1808,7 +1805,7 @@ static int sh_mobile_lcdc_pan(struct fb_var_screeninfo *var,
|
|||||||
struct sh_mobile_lcdc_priv *priv = ch->lcdc;
|
struct sh_mobile_lcdc_priv *priv = ch->lcdc;
|
||||||
unsigned long ldrcntr;
|
unsigned long ldrcntr;
|
||||||
unsigned long new_pan_offset;
|
unsigned long new_pan_offset;
|
||||||
unsigned long base_addr_y, base_addr_c;
|
unsigned long base_addr_y, base_addr_c = 0;
|
||||||
unsigned long c_offset;
|
unsigned long c_offset;
|
||||||
|
|
||||||
if (!ch->format->yuv)
|
if (!ch->format->yuv)
|
||||||
@ -1837,14 +1834,10 @@ static int sh_mobile_lcdc_pan(struct fb_var_screeninfo *var,
|
|||||||
base_addr_c += var->xoffset;
|
base_addr_c += var->xoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch->cache) {
|
if (ch->cache)
|
||||||
struct sh_mobile_meram_info *mdev;
|
sh_mobile_meram_cache_update(priv->meram_dev, ch->cache,
|
||||||
|
|
||||||
mdev = priv->meram_dev;
|
|
||||||
mdev->ops->cache_update(mdev, ch->cache,
|
|
||||||
base_addr_y, base_addr_c,
|
base_addr_y, base_addr_c,
|
||||||
&base_addr_y, &base_addr_c);
|
&base_addr_y, &base_addr_c);
|
||||||
}
|
|
||||||
|
|
||||||
ch->base_addr_y = base_addr_y;
|
ch->base_addr_y = base_addr_y;
|
||||||
ch->base_addr_c = base_addr_c;
|
ch->base_addr_c = base_addr_c;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
|
#include <linux/export.h>
|
||||||
#include <linux/genalloc.h>
|
#include <linux/genalloc.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
@ -429,11 +430,10 @@ meram_cache_alloc(struct sh_mobile_meram_priv *priv,
|
|||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *sh_mobile_cache_alloc(struct sh_mobile_meram_info *pdata,
|
void *sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *pdata,
|
||||||
const struct sh_mobile_meram_cfg *cfg,
|
const struct sh_mobile_meram_cfg *cfg,
|
||||||
unsigned int xres, unsigned int yres,
|
unsigned int xres, unsigned int yres,
|
||||||
unsigned int pixelformat,
|
unsigned int pixelformat, unsigned int *pitch)
|
||||||
unsigned int *pitch)
|
|
||||||
{
|
{
|
||||||
struct sh_mobile_meram_fb_cache *cache;
|
struct sh_mobile_meram_fb_cache *cache;
|
||||||
struct sh_mobile_meram_priv *priv = pdata->priv;
|
struct sh_mobile_meram_priv *priv = pdata->priv;
|
||||||
@ -441,6 +441,9 @@ static void *sh_mobile_cache_alloc(struct sh_mobile_meram_info *pdata,
|
|||||||
unsigned int nplanes = is_nvcolor(pixelformat) ? 2 : 1;
|
unsigned int nplanes = is_nvcolor(pixelformat) ? 2 : 1;
|
||||||
unsigned int out_pitch;
|
unsigned int out_pitch;
|
||||||
|
|
||||||
|
if (priv == NULL)
|
||||||
|
return ERR_PTR(-ENODEV);
|
||||||
|
|
||||||
if (pixelformat != SH_MOBILE_MERAM_PF_NV &&
|
if (pixelformat != SH_MOBILE_MERAM_PF_NV &&
|
||||||
pixelformat != SH_MOBILE_MERAM_PF_NV24 &&
|
pixelformat != SH_MOBILE_MERAM_PF_NV24 &&
|
||||||
pixelformat != SH_MOBILE_MERAM_PF_RGB)
|
pixelformat != SH_MOBILE_MERAM_PF_RGB)
|
||||||
@ -485,9 +488,10 @@ static void *sh_mobile_cache_alloc(struct sh_mobile_meram_info *pdata,
|
|||||||
mutex_unlock(&priv->lock);
|
mutex_unlock(&priv->lock);
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_alloc);
|
||||||
|
|
||||||
static void
|
void
|
||||||
sh_mobile_cache_free(struct sh_mobile_meram_info *pdata, void *data)
|
sh_mobile_meram_cache_free(struct sh_mobile_meram_info *pdata, void *data)
|
||||||
{
|
{
|
||||||
struct sh_mobile_meram_fb_cache *cache = data;
|
struct sh_mobile_meram_fb_cache *cache = data;
|
||||||
struct sh_mobile_meram_priv *priv = pdata->priv;
|
struct sh_mobile_meram_priv *priv = pdata->priv;
|
||||||
@ -507,11 +511,14 @@ sh_mobile_cache_free(struct sh_mobile_meram_info *pdata, void *data)
|
|||||||
|
|
||||||
mutex_unlock(&priv->lock);
|
mutex_unlock(&priv->lock);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_free);
|
||||||
|
|
||||||
static void
|
void
|
||||||
sh_mobile_cache_update(struct sh_mobile_meram_info *pdata, void *data,
|
sh_mobile_meram_cache_update(struct sh_mobile_meram_info *pdata, void *data,
|
||||||
unsigned long base_addr_y, unsigned long base_addr_c,
|
unsigned long base_addr_y,
|
||||||
unsigned long *icb_addr_y, unsigned long *icb_addr_c)
|
unsigned long base_addr_c,
|
||||||
|
unsigned long *icb_addr_y,
|
||||||
|
unsigned long *icb_addr_c)
|
||||||
{
|
{
|
||||||
struct sh_mobile_meram_fb_cache *cache = data;
|
struct sh_mobile_meram_fb_cache *cache = data;
|
||||||
struct sh_mobile_meram_priv *priv = pdata->priv;
|
struct sh_mobile_meram_priv *priv = pdata->priv;
|
||||||
@ -523,13 +530,7 @@ sh_mobile_cache_update(struct sh_mobile_meram_info *pdata, void *data,
|
|||||||
|
|
||||||
mutex_unlock(&priv->lock);
|
mutex_unlock(&priv->lock);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_update);
|
||||||
static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
|
|
||||||
.module = THIS_MODULE,
|
|
||||||
.cache_alloc = sh_mobile_cache_alloc,
|
|
||||||
.cache_free = sh_mobile_cache_free,
|
|
||||||
.cache_update = sh_mobile_cache_update,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Power management
|
* Power management
|
||||||
@ -620,7 +621,6 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
|
|||||||
for (i = 0; i < MERAM_ICB_NUM; ++i)
|
for (i = 0; i < MERAM_ICB_NUM; ++i)
|
||||||
priv->icbs[i].index = i;
|
priv->icbs[i].index = i;
|
||||||
|
|
||||||
pdata->ops = &sh_mobile_meram_ops;
|
|
||||||
pdata->priv = priv;
|
pdata->priv = priv;
|
||||||
pdata->pdev = pdev;
|
pdata->pdev = pdev;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ enum {
|
|||||||
|
|
||||||
|
|
||||||
struct sh_mobile_meram_priv;
|
struct sh_mobile_meram_priv;
|
||||||
struct sh_mobile_meram_ops;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct sh_mobile_meram_info - MERAM platform data
|
* struct sh_mobile_meram_info - MERAM platform data
|
||||||
@ -24,7 +23,6 @@ struct sh_mobile_meram_ops;
|
|||||||
struct sh_mobile_meram_info {
|
struct sh_mobile_meram_info {
|
||||||
int addr_mode;
|
int addr_mode;
|
||||||
u32 reserved_icbs;
|
u32 reserved_icbs;
|
||||||
struct sh_mobile_meram_ops *ops;
|
|
||||||
struct sh_mobile_meram_priv *priv;
|
struct sh_mobile_meram_priv *priv;
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
};
|
};
|
||||||
@ -38,21 +36,43 @@ struct sh_mobile_meram_cfg {
|
|||||||
struct sh_mobile_meram_icb_cfg icb[2];
|
struct sh_mobile_meram_icb_cfg icb[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct module;
|
#if defined(CONFIG_FB_SH_MOBILE_MERAM) || \
|
||||||
struct sh_mobile_meram_ops {
|
defined(CONFIG_FB_SH_MOBILE_MERAM_MODULE)
|
||||||
struct module *module;
|
void *sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
|
||||||
|
|
||||||
/* LCDC cache management */
|
|
||||||
void *(*cache_alloc)(struct sh_mobile_meram_info *meram_dev,
|
|
||||||
const struct sh_mobile_meram_cfg *cfg,
|
const struct sh_mobile_meram_cfg *cfg,
|
||||||
unsigned int xres, unsigned int yres,
|
unsigned int xres, unsigned int yres,
|
||||||
unsigned int pixelformat, unsigned int *pitch);
|
unsigned int pixelformat,
|
||||||
void (*cache_free)(struct sh_mobile_meram_info *meram_dev, void *data);
|
unsigned int *pitch);
|
||||||
void (*cache_update)(struct sh_mobile_meram_info *meram_dev, void *data,
|
void sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data);
|
||||||
|
void sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
|
||||||
unsigned long base_addr_y,
|
unsigned long base_addr_y,
|
||||||
unsigned long base_addr_c,
|
unsigned long base_addr_c,
|
||||||
unsigned long *icb_addr_y,
|
unsigned long *icb_addr_y,
|
||||||
unsigned long *icb_addr_c);
|
unsigned long *icb_addr_c);
|
||||||
};
|
#else
|
||||||
|
static inline void *
|
||||||
|
sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
|
||||||
|
const struct sh_mobile_meram_cfg *cfg,
|
||||||
|
unsigned int xres, unsigned int yres,
|
||||||
|
unsigned int pixelformat,
|
||||||
|
unsigned int *pitch)
|
||||||
|
{
|
||||||
|
return ERR_PTR(-ENODEV);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
|
||||||
|
unsigned long base_addr_y,
|
||||||
|
unsigned long base_addr_c,
|
||||||
|
unsigned long *icb_addr_y,
|
||||||
|
unsigned long *icb_addr_c)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */
|
#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user