Lines Matching +full:wake +full:- +full:on +full:- +full:motion
2 * Silicon Motion SM7XX frame buffer device
4 * Copyright (C) 2006 Silicon Motion Technology Corp.
18 * Framebuffer driver for Silicon Motion SM710, SM712, SM721 and SM722 chips
69 .height = -1,
70 .width = -1,
883 chan >>= 16 - bf->length; in chan_to_field()
884 return chan << bf->offset; in chan_to_field()
889 struct smtcfb_info *sfb = info->par; in smtc_blank()
894 /* Screen On: HSync: On, VSync : On */ in smtc_blank()
896 switch (sfb->chip_id) { in smtc_blank()
916 /* Screen Off: HSync: On, VSync : On Soft blank */ in smtc_blank()
926 /* Screen On: HSync: On, VSync : Off */ in smtc_blank()
939 /* Screen On: HSync: Off, VSync : On */ in smtc_blank()
952 /* Screen On: HSync: Off, VSync : Off */ in smtc_blank()
965 return -EINVAL; in smtc_blank()
978 sfb = info->par; in smtc_setcolreg()
983 switch (sfb->fb->fix.visual) { in smtc_setcolreg()
987 * 16/32 bit true-colour, use pseudo-palette for 16 base color in smtc_setcolreg()
991 if (sfb->fb->var.bits_per_pixel == 16) { in smtc_setcolreg()
992 u32 *pal = sfb->fb->pseudo_palette; in smtc_setcolreg()
994 val = chan_to_field(red, &sfb->fb->var.red); in smtc_setcolreg()
995 val |= chan_to_field(green, &sfb->fb->var.green); in smtc_setcolreg()
996 val |= chan_to_field(blue, &sfb->fb->var.blue); in smtc_setcolreg()
999 u32 *pal = sfb->fb->pseudo_palette; in smtc_setcolreg()
1001 val = chan_to_field(red, &sfb->fb->var.red); in smtc_setcolreg()
1002 val |= chan_to_field(green, &sfb->fb->var.green); in smtc_setcolreg()
1003 val |= chan_to_field(blue, &sfb->fb->var.blue); in smtc_setcolreg()
1030 if (!info || !info->screen_base) in smtcfb_read()
1031 return -ENODEV; in smtcfb_read()
1033 if (info->state != FBINFO_STATE_RUNNING) in smtcfb_read()
1034 return -EPERM; in smtcfb_read()
1036 total_size = info->screen_size; in smtcfb_read()
1039 total_size = info->fix.smem_len; in smtcfb_read()
1048 count = total_size - p; in smtcfb_read()
1052 return -ENOMEM; in smtcfb_read()
1054 src = (u32 __iomem *)(info->screen_base + p); in smtcfb_read()
1056 if (info->fbops->fb_sync) in smtcfb_read()
1057 info->fbops->fb_sync(info); in smtcfb_read()
1062 for (i = (c + 3) >> 2; i--;) { in smtcfb_read()
1072 err = -EFAULT; in smtcfb_read()
1078 count -= c; in smtcfb_read()
1096 if (!info || !info->screen_base) in smtcfb_write()
1097 return -ENODEV; in smtcfb_write()
1099 if (info->state != FBINFO_STATE_RUNNING) in smtcfb_write()
1100 return -EPERM; in smtcfb_write()
1102 total_size = info->screen_size; in smtcfb_write()
1105 total_size = info->fix.smem_len; in smtcfb_write()
1108 return -EFBIG; in smtcfb_write()
1111 err = -EFBIG; in smtcfb_write()
1117 err = -ENOSPC; in smtcfb_write()
1119 count = total_size - p; in smtcfb_write()
1124 return -ENOMEM; in smtcfb_write()
1126 dst = (u32 __iomem *)(info->screen_base + p); in smtcfb_write()
1128 if (info->fbops->fb_sync) in smtcfb_write()
1129 info->fbops->fb_sync(info); in smtcfb_write()
1136 err = -EFAULT; in smtcfb_write()
1140 for (i = c >> 2; i--;) { in smtcfb_write()
1148 for (i = c & 3; i--;) { in smtcfb_write()
1152 fb_writeb(*src8++, --dst8); in smtcfb_write()
1162 count -= c; in smtcfb_write()
1175 dev_dbg(&sfb->pdev->dev, in sm7xx_set_timing()
1176 "sfb->width=%d sfb->height=%d sfb->fb->var.bits_per_pixel=%d sfb->hz=%d\n", in sm7xx_set_timing()
1177 sfb->width, sfb->height, sfb->fb->var.bits_per_pixel, sfb->hz); in sm7xx_set_timing()
1180 if (vgamode[j].mmsizex != sfb->width || in sm7xx_set_timing()
1181 vgamode[j].mmsizey != sfb->height || in sm7xx_set_timing()
1182 vgamode[j].bpp != sfb->fb->var.bits_per_pixel || in sm7xx_set_timing()
1183 vgamode[j].hz != sfb->hz) in sm7xx_set_timing()
1186 dev_dbg(&sfb->pdev->dev, in sm7xx_set_timing()
1191 dev_dbg(&sfb->pdev->dev, "vgamode index=%d\n", j); in sm7xx_set_timing()
1199 /* init SEQ register SR00 - SR04 */ in sm7xx_set_timing()
1203 /* init SEQ register SR10 - SR24 */ in sm7xx_set_timing()
1207 /* init SEQ register SR30 - SR75 */ in sm7xx_set_timing()
1216 /* init SEQ register SR80 - SR93 */ in sm7xx_set_timing()
1220 /* init SEQ register SRA0 - SRAF */ in sm7xx_set_timing()
1224 /* init Graphic register GR00 - GR08 */ in sm7xx_set_timing()
1228 /* init Attribute register AR00 - AR14 */ in sm7xx_set_timing()
1232 /* init CRTC register CR00 - CR18 */ in sm7xx_set_timing()
1236 /* init CRTC register CR30 - CR4D */ in sm7xx_set_timing()
1239 /* side-effect, don't write to CR3B-CR3F */ in sm7xx_set_timing()
1244 /* init CRTC register CR90 - CRA7 */ in sm7xx_set_timing()
1251 writel(0x0, sfb->vp_regs + 0x0C); in sm7xx_set_timing()
1252 writel(0x0, sfb->vp_regs + 0x40); in sm7xx_set_timing()
1255 m_nscreenstride = (sfb->width * sfb->fb->var.bits_per_pixel) / 64; in sm7xx_set_timing()
1256 switch (sfb->fb->var.bits_per_pixel) { in sm7xx_set_timing()
1258 writel(0x0, sfb->vp_regs + 0x0); in sm7xx_set_timing()
1261 writel(0x00020000, sfb->vp_regs + 0x0); in sm7xx_set_timing()
1264 writel(0x00040000, sfb->vp_regs + 0x0); in sm7xx_set_timing()
1267 writel(0x00030000, sfb->vp_regs + 0x0); in sm7xx_set_timing()
1271 sfb->vp_regs + 0x10); in sm7xx_set_timing()
1276 switch (sfb->chip_id) { in smtc_set_timing()
1287 switch (sfb->fb->var.bits_per_pixel) { in smtcfb_setmode()
1289 sfb->fb->fix.visual = FB_VISUAL_TRUECOLOR; in smtcfb_setmode()
1290 sfb->fb->fix.line_length = sfb->fb->var.xres * 4; in smtcfb_setmode()
1291 sfb->fb->var.red.length = 8; in smtcfb_setmode()
1292 sfb->fb->var.green.length = 8; in smtcfb_setmode()
1293 sfb->fb->var.blue.length = 8; in smtcfb_setmode()
1294 sfb->fb->var.red.offset = 16; in smtcfb_setmode()
1295 sfb->fb->var.green.offset = 8; in smtcfb_setmode()
1296 sfb->fb->var.blue.offset = 0; in smtcfb_setmode()
1299 sfb->fb->fix.visual = FB_VISUAL_TRUECOLOR; in smtcfb_setmode()
1300 sfb->fb->fix.line_length = sfb->fb->var.xres * 3; in smtcfb_setmode()
1301 sfb->fb->var.red.length = 8; in smtcfb_setmode()
1302 sfb->fb->var.green.length = 8; in smtcfb_setmode()
1303 sfb->fb->var.blue.length = 8; in smtcfb_setmode()
1304 sfb->fb->var.red.offset = 16; in smtcfb_setmode()
1305 sfb->fb->var.green.offset = 8; in smtcfb_setmode()
1306 sfb->fb->var.blue.offset = 0; in smtcfb_setmode()
1309 sfb->fb->fix.visual = FB_VISUAL_PSEUDOCOLOR; in smtcfb_setmode()
1310 sfb->fb->fix.line_length = sfb->fb->var.xres; in smtcfb_setmode()
1311 sfb->fb->var.red.length = 3; in smtcfb_setmode()
1312 sfb->fb->var.green.length = 3; in smtcfb_setmode()
1313 sfb->fb->var.blue.length = 2; in smtcfb_setmode()
1314 sfb->fb->var.red.offset = 5; in smtcfb_setmode()
1315 sfb->fb->var.green.offset = 2; in smtcfb_setmode()
1316 sfb->fb->var.blue.offset = 0; in smtcfb_setmode()
1320 sfb->fb->fix.visual = FB_VISUAL_TRUECOLOR; in smtcfb_setmode()
1321 sfb->fb->fix.line_length = sfb->fb->var.xres * 2; in smtcfb_setmode()
1322 sfb->fb->var.red.length = 5; in smtcfb_setmode()
1323 sfb->fb->var.green.length = 6; in smtcfb_setmode()
1324 sfb->fb->var.blue.length = 5; in smtcfb_setmode()
1325 sfb->fb->var.red.offset = 11; in smtcfb_setmode()
1326 sfb->fb->var.green.offset = 5; in smtcfb_setmode()
1327 sfb->fb->var.blue.offset = 0; in smtcfb_setmode()
1331 sfb->width = sfb->fb->var.xres; in smtcfb_setmode()
1332 sfb->height = sfb->fb->var.yres; in smtcfb_setmode()
1333 sfb->hz = 60; in smtcfb_setmode()
1340 if (var->xres_virtual < var->xres) in smtc_check_var()
1341 var->xres_virtual = var->xres; in smtc_check_var()
1343 if (var->yres_virtual < var->yres) in smtc_check_var()
1344 var->yres_virtual = var->yres; in smtc_check_var()
1347 if ((var->bits_per_pixel != 8) && (var->bits_per_pixel != 16) && in smtc_check_var()
1348 (var->bits_per_pixel != 24) && (var->bits_per_pixel != 32)) in smtc_check_var()
1349 var->bits_per_pixel = 16; in smtc_check_var()
1356 smtcfb_setmode(info->par); in smtc_set_par()
1391 sfb->fb->fix.smem_start = pci_resource_start(pdev, 0); in smtc_map_smem()
1393 if (sfb->chip_id == 0x720) in smtc_map_smem()
1394 /* on SM720, the framebuffer starts at the 1 MB offset */ in smtc_map_smem()
1395 sfb->fb->fix.smem_start += 0x00200000; in smtc_map_smem()
1397 /* XXX: is it safe for SM720 on Big-Endian? */ in smtc_map_smem()
1398 if (sfb->fb->var.bits_per_pixel == 32) in smtc_map_smem()
1399 sfb->fb->fix.smem_start += big_addr; in smtc_map_smem()
1401 sfb->fb->fix.smem_len = smem_len; in smtc_map_smem()
1403 sfb->fb->screen_base = sfb->lfb; in smtc_map_smem()
1405 if (!sfb->fb->screen_base) { in smtc_map_smem()
1406 dev_err(&pdev->dev, in smtc_map_smem()
1407 "%s: unable to map screen memory\n", sfb->fb->fix.id); in smtc_map_smem()
1408 return -ENOMEM; in smtc_map_smem()
1420 if (sfb && sfb->fb->screen_base) { in smtc_unmap_smem()
1421 if (sfb->chip_id == 0x720) in smtc_unmap_smem()
1422 sfb->fb->screen_base -= 0x00200000; in smtc_unmap_smem()
1423 iounmap(sfb->fb->screen_base); in smtc_unmap_smem()
1424 sfb->fb->screen_base = NULL; in smtc_unmap_smem()
1429 * We need to wake up the device and make sure its in linear memory mode.
1441 switch (sfb->chip_id) { in sm7xx_vram_probe()
1447 * FIXME: SM712 can have 2MB VRAM, which is used on earlier in sm7xx_vram_probe()
1449 * probably crash on those machines. If anyone gets one of in sm7xx_vram_probe()
1451 * an E-mail. in sm7xx_vram_probe()
1474 sfb->fb->var.xres = smtc_scr_info.lfb_width; in sm7xx_resolution_probe()
1475 sfb->fb->var.yres = smtc_scr_info.lfb_height; in sm7xx_resolution_probe()
1476 sfb->fb->var.bits_per_pixel = smtc_scr_info.lfb_depth; in sm7xx_resolution_probe()
1481 * No parameter, default resolution is 1024x768-16. in sm7xx_resolution_probe()
1486 sfb->fb->var.xres = SCREEN_X_RES; in sm7xx_resolution_probe()
1487 sfb->fb->var.yres = SCREEN_Y_RES_PC; in sm7xx_resolution_probe()
1488 sfb->fb->var.bits_per_pixel = SCREEN_BPP; in sm7xx_resolution_probe()
1498 * So we change the default to 768, but keep 600 as-is on MIPS. in sm7xx_resolution_probe()
1500 sfb->fb->var.yres = SCREEN_Y_RES_NETBOOK; in sm7xx_resolution_probe()
1504 big_pixel_depth(sfb->fb->var.bits_per_pixel, smtc_scr_info.lfb_depth); in sm7xx_resolution_probe()
1516 dev_info(&pdev->dev, "Silicon Motion display driver.\n"); in smtcfb_pci_probe()
1524 dev_err(&pdev->dev, "cannot reserve framebuffer region\n"); in smtcfb_pci_probe()
1528 sprintf(smtcfb_fix.id, "sm%Xfb", ent->device); in smtcfb_pci_probe()
1530 info = framebuffer_alloc(sizeof(*sfb), &pdev->dev); in smtcfb_pci_probe()
1532 err = -ENOMEM; in smtcfb_pci_probe()
1536 sfb = info->par; in smtcfb_pci_probe()
1537 sfb->fb = info; in smtcfb_pci_probe()
1538 sfb->chip_id = ent->device; in smtcfb_pci_probe()
1539 sfb->pdev = pdev; in smtcfb_pci_probe()
1540 info->flags = FBINFO_FLAG_DEFAULT; in smtcfb_pci_probe()
1541 info->fbops = &smtcfb_ops; in smtcfb_pci_probe()
1542 info->fix = smtcfb_fix; in smtcfb_pci_probe()
1543 info->var = smtcfb_var; in smtcfb_pci_probe()
1544 info->pseudo_palette = sfb->colreg; in smtcfb_pci_probe()
1545 info->par = sfb; in smtcfb_pci_probe()
1553 pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chip_rev_id); in smtcfb_pci_probe()
1556 dev_info(&pdev->dev, "%lu MiB of VRAM detected.\n", in smtcfb_pci_probe()
1559 switch (sfb->chip_id) { in smtcfb_pci_probe()
1562 sfb->fb->fix.mmio_start = mmio_base + 0x00400000; in smtcfb_pci_probe()
1563 sfb->fb->fix.mmio_len = 0x00400000; in smtcfb_pci_probe()
1564 sfb->lfb = ioremap(mmio_base, mmio_addr); in smtcfb_pci_probe()
1565 if (!sfb->lfb) { in smtcfb_pci_probe()
1566 dev_err(&pdev->dev, in smtcfb_pci_probe()
1568 sfb->fb->fix.id); in smtcfb_pci_probe()
1569 err = -ENOMEM; in smtcfb_pci_probe()
1573 sfb->mmio = (smtc_regbaseaddress = in smtcfb_pci_probe()
1574 sfb->lfb + 0x00700000); in smtcfb_pci_probe()
1575 sfb->dp_regs = sfb->lfb + 0x00408000; in smtcfb_pci_probe()
1576 sfb->vp_regs = sfb->lfb + 0x0040c000; in smtcfb_pci_probe()
1577 if (sfb->fb->var.bits_per_pixel == 32) { in smtcfb_pci_probe()
1578 sfb->lfb += big_addr; in smtcfb_pci_probe()
1579 dev_info(&pdev->dev, "sfb->lfb=%p\n", sfb->lfb); in smtcfb_pci_probe()
1589 if (sfb->fb->var.bits_per_pixel == 32) in smtcfb_pci_probe()
1593 sfb->fb->fix.mmio_start = mmio_base; in smtcfb_pci_probe()
1594 sfb->fb->fix.mmio_len = 0x00200000; in smtcfb_pci_probe()
1595 sfb->dp_regs = ioremap(mmio_base, 0x00200000 + smem_size); in smtcfb_pci_probe()
1596 if (!sfb->dp_regs) { in smtcfb_pci_probe()
1597 dev_err(&pdev->dev, in smtcfb_pci_probe()
1599 sfb->fb->fix.id); in smtcfb_pci_probe()
1600 err = -ENOMEM; in smtcfb_pci_probe()
1604 sfb->lfb = sfb->dp_regs + 0x00200000; in smtcfb_pci_probe()
1605 sfb->mmio = (smtc_regbaseaddress = in smtcfb_pci_probe()
1606 sfb->dp_regs + 0x000c0000); in smtcfb_pci_probe()
1607 sfb->vp_regs = sfb->dp_regs + 0x800; in smtcfb_pci_probe()
1614 dev_err(&pdev->dev, in smtcfb_pci_probe()
1615 "No valid Silicon Motion display chip was detected!\n"); in smtcfb_pci_probe()
1616 err = -ENODEV; in smtcfb_pci_probe()
1624 if (sfb->fb->var.bits_per_pixel == 15) in smtcfb_pci_probe()
1625 sfb->fb->var.bits_per_pixel = 16; in smtcfb_pci_probe()
1627 sfb->fb->var.xres_virtual = sfb->fb->var.xres; in smtcfb_pci_probe()
1628 sfb->fb->var.yres_virtual = sfb->fb->var.yres; in smtcfb_pci_probe()
1637 memset_io(sfb->lfb, 0, sfb->fb->fix.smem_len); in smtcfb_pci_probe()
1643 dev_info(&pdev->dev, in smtcfb_pci_probe()
1644 "Silicon Motion SM%X Rev%X primary display mode %dx%d-%d Init Complete.\n", in smtcfb_pci_probe()
1645 sfb->chip_id, sfb->chip_rev_id, sfb->fb->var.xres, in smtcfb_pci_probe()
1646 sfb->fb->var.yres, sfb->fb->var.bits_per_pixel); in smtcfb_pci_probe()
1651 dev_err(&pdev->dev, "Silicon Motion, Inc. primary display init fail.\n"); in smtcfb_pci_probe()
1688 unregister_framebuffer(sfb->fb); in smtcfb_pci_remove()
1689 framebuffer_release(sfb->fb); in smtcfb_pci_remove()
1700 * so that we can turn off internal PLLs later on in smtcfb_pci_suspend()
1706 fb_set_suspend(sfb->fb, 1); in smtcfb_pci_suspend()
1722 switch (sfb->chip_id) { in smtcfb_pci_resume()
1731 if (sfb->fb->var.bits_per_pixel == 32) in smtcfb_pci_resume()
1747 fb_set_suspend(sfb->fb, 0); in smtcfb_pci_resume()
1768 return -ENODEV; in sm712fb_init()