21 #include <linux/module.h>
22 #include <linux/kernel.h>
23 #include <linux/errno.h>
24 #include <linux/string.h>
88 .modes = &am200_fb_mode_6inch,
95 #define LED_GPIO_PIN 51
96 #define STDBY_GPIO_PIN 48
97 #define RST_GPIO_PIN 49
98 #define RDY_GPIO_PIN 32
99 #define ERR_GPIO_PIN 17
100 #define PCBPWR_GPIO_PIN 16
103 static char *gpio_names[] = {
"LED" ,
"STDBY" ,
"RST",
"RDY",
"ERR",
"PCBPWR" };
113 dev_err(&am200_device->
dev,
"failed requesting "
114 "gpio %s, err=%d\n", gpio_names[i], err);
147 static int am200_share_video_mem(
struct fb_info *
info)
150 if ((info->
var.xres != am200_fb_info.
modes->xres)
151 || (info->
var.yres != am200_fb_info.
modes->yres))
156 am200_board.host_fbinfo =
info;
159 if (!try_module_get(info->
fbops->owner))
165 static int am200_unshare_video_mem(
struct fb_info *info)
167 dev_dbg(&am200_device->
dev,
"ENTER %s\n", __func__);
169 if (info != am200_board.host_fbinfo)
172 module_put(am200_board.host_fbinfo->fbops->owner);
176 static int am200_fb_notifier_callback(
struct notifier_block *
self,
182 dev_dbg(&am200_device->
dev,
"ENTER %s\n", __func__);
185 return am200_share_video_mem(info);
187 return am200_unshare_video_mem(info);
193 .notifier_call = am200_fb_notifier_callback,
198 static void __init am200_presetup_fb(
void)
207 am200_fb_info.
modes = &am200_fb_mode_6inch;
210 am200_fb_info.
modes = &am200_fb_mode_8inch;
213 am200_fb_info.
modes = &am200_fb_mode_9inch7;
216 dev_err(&am200_device->
dev,
"invalid panel_type selection,"
218 am200_fb_info.
modes = &am200_fb_mode_6inch;
228 fw = am200_fb_info.
modes->xres;
229 fh = am200_fb_info.
modes->yres;
232 am200_board.wfm_size =
roundup(16*1024 + 2, fw);
237 totalsize = fw + am200_board.wfm_size + padding_size + (fw*fh);
250 am200_fb_info.
modes->xres /= 2;
273 par->
metromem_dma = am200_board.host_fbinfo->fix.smem_start;
278 static int am200_get_panel_type(
void)
291 static int am200_setup_irq(
struct fb_info *info)
299 dev_err(&am200_device->
dev,
"request_irq failed: %d\n", ret);
327 .setup_irq = am200_setup_irq,
328 .setup_io = am200_init_gpio_regs,
329 .setup_fb = am200_setup_fb,
330 .set_rst = am200_set_rst,
331 .set_stdby = am200_set_stdby,
332 .met_wait_event = am200_wait_event,
333 .met_wait_event_intr = am200_wait_event_intr,
334 .get_panel_type = am200_get_panel_type,
335 .cleanup = am200_cleanup,
338 static unsigned long am200_pin_config[]
__initdata = {
358 request_module(
"metronomefb");
366 sizeof(am200_board));