|
@@ -438,7 +438,7 @@ static unsigned long lcdc_sys_read_data(void *handle)
|
|
|
return lcdc_read(ch->lcdc, _LDDRDR) & LDDRDR_DRD_MASK;
|
|
|
}
|
|
|
|
|
|
-struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
|
|
|
+static struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
|
|
|
lcdc_sys_write_index,
|
|
|
lcdc_sys_write_data,
|
|
|
lcdc_sys_read_data,
|
|
@@ -586,8 +586,8 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
|
|
|
* Just turn on, if we run a resume here, the
|
|
|
* logo disappears.
|
|
|
*/
|
|
|
- info->var.width = monspec->max_x * 10;
|
|
|
- info->var.height = monspec->max_y * 10;
|
|
|
+ info->var.width = ch->display.width;
|
|
|
+ info->var.height = ch->display.height;
|
|
|
sh_mobile_lcdc_display_on(ch);
|
|
|
} else {
|
|
|
/* New monitor or have to wake up */
|
|
@@ -1614,6 +1614,15 @@ static int sh_mobile_lcdc_overlay_blank(int blank, struct fb_info *info)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+static int
|
|
|
+sh_mobile_lcdc_overlay_mmap(struct fb_info *info, struct vm_area_struct *vma)
|
|
|
+{
|
|
|
+ struct sh_mobile_lcdc_overlay *ovl = info->par;
|
|
|
+
|
|
|
+ return dma_mmap_coherent(ovl->channel->lcdc->dev, vma, ovl->fb_mem,
|
|
|
+ ovl->dma_handle, ovl->fb_size);
|
|
|
+}
|
|
|
+
|
|
|
static struct fb_ops sh_mobile_lcdc_overlay_ops = {
|
|
|
.owner = THIS_MODULE,
|
|
|
.fb_read = fb_sys_read,
|
|
@@ -1626,6 +1635,7 @@ static struct fb_ops sh_mobile_lcdc_overlay_ops = {
|
|
|
.fb_ioctl = sh_mobile_lcdc_overlay_ioctl,
|
|
|
.fb_check_var = sh_mobile_lcdc_overlay_check_var,
|
|
|
.fb_set_par = sh_mobile_lcdc_overlay_set_par,
|
|
|
+ .fb_mmap = sh_mobile_lcdc_overlay_mmap,
|
|
|
};
|
|
|
|
|
|
static void
|
|
@@ -2093,6 +2103,15 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static int
|
|
|
+sh_mobile_lcdc_mmap(struct fb_info *info, struct vm_area_struct *vma)
|
|
|
+{
|
|
|
+ struct sh_mobile_lcdc_chan *ch = info->par;
|
|
|
+
|
|
|
+ return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
|
|
|
+ ch->dma_handle, ch->fb_size);
|
|
|
+}
|
|
|
+
|
|
|
static struct fb_ops sh_mobile_lcdc_ops = {
|
|
|
.owner = THIS_MODULE,
|
|
|
.fb_setcolreg = sh_mobile_lcdc_setcolreg,
|
|
@@ -2108,6 +2127,7 @@ static struct fb_ops sh_mobile_lcdc_ops = {
|
|
|
.fb_release = sh_mobile_lcdc_release,
|
|
|
.fb_check_var = sh_mobile_lcdc_check_var,
|
|
|
.fb_set_par = sh_mobile_lcdc_set_par,
|
|
|
+ .fb_mmap = sh_mobile_lcdc_mmap,
|
|
|
};
|
|
|
|
|
|
static void
|
|
@@ -2167,7 +2187,7 @@ sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch)
|
|
|
|
|
|
static int __devinit
|
|
|
sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
|
|
|
- const struct fb_videomode *mode,
|
|
|
+ const struct fb_videomode *modes,
|
|
|
unsigned int num_modes)
|
|
|
{
|
|
|
struct sh_mobile_lcdc_priv *priv = ch->lcdc;
|
|
@@ -2193,7 +2213,7 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
|
|
|
info->pseudo_palette = &ch->pseudo_palette;
|
|
|
info->par = ch;
|
|
|
|
|
|
- fb_videomode_to_modelist(mode, num_modes, &info->modelist);
|
|
|
+ fb_videomode_to_modelist(modes, num_modes, &info->modelist);
|
|
|
|
|
|
ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
|
|
|
if (ret < 0) {
|
|
@@ -2227,9 +2247,9 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
|
|
|
* default.
|
|
|
*/
|
|
|
var = &info->var;
|
|
|
- fb_videomode_to_var(var, mode);
|
|
|
- var->width = ch->cfg->panel_cfg.width;
|
|
|
- var->height = ch->cfg->panel_cfg.height;
|
|
|
+ fb_videomode_to_var(var, modes);
|
|
|
+ var->width = ch->display.width;
|
|
|
+ var->height = ch->display.height;
|
|
|
var->xres_virtual = ch->xres_virtual;
|
|
|
var->yres_virtual = ch->yres_virtual;
|
|
|
var->activate = FB_ACTIVATE_NOW;
|
|
@@ -2262,6 +2282,7 @@ static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
|
|
|
bdev->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
|
|
|
brightness = 0;
|
|
|
|
|
|
+ ch->bl_brightness = brightness;
|
|
|
return ch->cfg->bl_info.set_brightness(brightness);
|
|
|
}
|
|
|
|
|
@@ -2269,7 +2290,7 @@ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
|
|
|
{
|
|
|
struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
|
|
|
|
|
|
- return ch->cfg->bl_info.get_brightness();
|
|
|
+ return ch->bl_brightness;
|
|
|
}
|
|
|
|
|
|
static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev,
|
|
@@ -2516,10 +2537,10 @@ static int __devinit sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *
|
|
|
}
|
|
|
|
|
|
static int __devinit
|
|
|
-sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
- struct sh_mobile_lcdc_overlay *ovl)
|
|
|
+sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl)
|
|
|
{
|
|
|
const struct sh_mobile_lcdc_format_info *format;
|
|
|
+ struct device *dev = ovl->channel->lcdc->dev;
|
|
|
int ret;
|
|
|
|
|
|
if (ovl->cfg->fourcc == 0)
|
|
@@ -2528,7 +2549,7 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
/* Validate the format. */
|
|
|
format = sh_mobile_format_info(ovl->cfg->fourcc);
|
|
|
if (format == NULL) {
|
|
|
- dev_err(priv->dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc);
|
|
|
+ dev_err(dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
@@ -2556,10 +2577,10 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
/* Allocate frame buffer memory. */
|
|
|
ovl->fb_size = ovl->cfg->max_xres * ovl->cfg->max_yres
|
|
|
* format->bpp / 8 * 2;
|
|
|
- ovl->fb_mem = dma_alloc_coherent(priv->dev, ovl->fb_size,
|
|
|
- &ovl->dma_handle, GFP_KERNEL);
|
|
|
+ ovl->fb_mem = dma_alloc_coherent(dev, ovl->fb_size, &ovl->dma_handle,
|
|
|
+ GFP_KERNEL);
|
|
|
if (!ovl->fb_mem) {
|
|
|
- dev_err(priv->dev, "unable to allocate buffer\n");
|
|
|
+ dev_err(dev, "unable to allocate buffer\n");
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
|
|
@@ -2571,11 +2592,11 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
}
|
|
|
|
|
|
static int __devinit
|
|
|
-sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
- struct sh_mobile_lcdc_chan *ch)
|
|
|
+sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch)
|
|
|
{
|
|
|
const struct sh_mobile_lcdc_format_info *format;
|
|
|
const struct sh_mobile_lcdc_chan_cfg *cfg = ch->cfg;
|
|
|
+ struct device *dev = ch->lcdc->dev;
|
|
|
const struct fb_videomode *max_mode;
|
|
|
const struct fb_videomode *mode;
|
|
|
unsigned int num_modes;
|
|
@@ -2588,7 +2609,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
/* Validate the format. */
|
|
|
format = sh_mobile_format_info(cfg->fourcc);
|
|
|
if (format == NULL) {
|
|
|
- dev_err(priv->dev, "Invalid FOURCC %08x.\n", cfg->fourcc);
|
|
|
+ dev_err(dev, "Invalid FOURCC %08x.\n", cfg->fourcc);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
@@ -2604,7 +2625,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
/* NV12/NV21 buffers must have even number of lines */
|
|
|
if ((cfg->fourcc == V4L2_PIX_FMT_NV12 ||
|
|
|
cfg->fourcc == V4L2_PIX_FMT_NV21) && (mode->yres & 0x1)) {
|
|
|
- dev_err(priv->dev, "yres must be multiple of 2 for "
|
|
|
+ dev_err(dev, "yres must be multiple of 2 for "
|
|
|
"YCbCr420 mode.\n");
|
|
|
return -EINVAL;
|
|
|
}
|
|
@@ -2618,7 +2639,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
if (!max_size)
|
|
|
max_size = MAX_XRES * MAX_YRES;
|
|
|
else
|
|
|
- dev_dbg(priv->dev, "Found largest videomode %ux%u\n",
|
|
|
+ dev_dbg(dev, "Found largest videomode %ux%u\n",
|
|
|
max_mode->xres, max_mode->yres);
|
|
|
|
|
|
if (cfg->lcd_modes == NULL) {
|
|
@@ -2652,10 +2673,10 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
|
|
|
/* Allocate frame buffer memory. */
|
|
|
ch->fb_size = max_size * format->bpp / 8 * 2;
|
|
|
- ch->fb_mem = dma_alloc_coherent(priv->dev, ch->fb_size, &ch->dma_handle,
|
|
|
+ ch->fb_mem = dma_alloc_coherent(dev, ch->fb_size, &ch->dma_handle,
|
|
|
GFP_KERNEL);
|
|
|
if (ch->fb_mem == NULL) {
|
|
|
- dev_err(priv->dev, "unable to allocate buffer\n");
|
|
|
+ dev_err(dev, "unable to allocate buffer\n");
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
|
|
@@ -2663,8 +2684,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
|
|
|
if (cfg->tx_dev) {
|
|
|
if (!cfg->tx_dev->dev.driver ||
|
|
|
!try_module_get(cfg->tx_dev->dev.driver->owner)) {
|
|
|
- dev_warn(priv->dev,
|
|
|
- "unable to get transmitter device\n");
|
|
|
+ dev_warn(dev, "unable to get transmitter device\n");
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
ch->tx_dev = platform_get_drvdata(cfg->tx_dev);
|
|
@@ -2772,9 +2792,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
|
|
|
pm_runtime_enable(&pdev->dev);
|
|
|
|
|
|
for (i = 0; i < num_channels; i++) {
|
|
|
- struct sh_mobile_lcdc_chan *ch = priv->ch + i;
|
|
|
+ struct sh_mobile_lcdc_chan *ch = &priv->ch[i];
|
|
|
|
|
|
- error = sh_mobile_lcdc_channel_init(priv, ch);
|
|
|
+ error = sh_mobile_lcdc_channel_init(ch);
|
|
|
if (error)
|
|
|
goto err1;
|
|
|
}
|
|
@@ -2785,7 +2805,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
|
|
|
ovl->cfg = &pdata->overlays[i];
|
|
|
ovl->channel = &priv->ch[0];
|
|
|
|
|
|
- error = sh_mobile_lcdc_overlay_init(priv, ovl);
|
|
|
+ error = sh_mobile_lcdc_overlay_init(ovl);
|
|
|
if (error)
|
|
|
goto err1;
|
|
|
}
|