~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/video/sh_mobile_lcdcfb.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include <asm/atomic.h>
28
28
 
29
29
#include "sh_mobile_lcdcfb.h"
 
30
#include "sh_mobile_meram.h"
30
31
 
31
32
#define SIDE_B_OFFSET 0x1000
32
33
#define MIRROR_OFFSET 0x2000
143
144
        unsigned long saved_shared_regs[NR_SHARED_REGS];
144
145
        int started;
145
146
        int forced_bpp; /* 2 channel LCDC must share bpp setting */
 
147
        struct sh_mobile_meram_info *meram_dev;
146
148
};
147
149
 
148
150
static bool banked(int reg_nr)
468
470
        unsigned long tmp;
469
471
        int bpp = 0;
470
472
        unsigned long ldddsr;
471
 
        int k, m;
472
 
        int ret = 0;
 
473
        int k, m, ret;
473
474
 
474
475
        /* enable clocks before accessing the hardware */
475
476
        for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
538
539
                lcdc_write_chan(ch, LDPMR, 0);
539
540
 
540
541
                board_cfg = &ch->cfg.board_cfg;
541
 
                if (board_cfg->setup_sys)
542
 
                        ret = board_cfg->setup_sys(board_cfg->board_data, ch,
543
 
                                                   &sh_mobile_lcdc_sys_bus_ops);
544
 
                if (ret)
545
 
                        return ret;
 
542
                if (board_cfg->setup_sys) {
 
543
                        ret = board_cfg->setup_sys(board_cfg->board_data,
 
544
                                                ch, &sh_mobile_lcdc_sys_bus_ops);
 
545
                        if (ret)
 
546
                                return ret;
 
547
                }
546
548
        }
547
549
 
548
550
        /* word and long word swap */
564
566
        }
565
567
 
566
568
        for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
 
569
                unsigned long base_addr_y;
 
570
                unsigned long base_addr_c = 0;
 
571
                int pitch;
567
572
                ch = &priv->ch[k];
568
573
 
569
574
                if (!priv->ch[k].enabled)
598
603
                }
599
604
                lcdc_write_chan(ch, LDDFR, tmp);
600
605
 
 
606
                base_addr_y = ch->info->fix.smem_start;
 
607
                base_addr_c = base_addr_y +
 
608
                                ch->info->var.xres *
 
609
                                ch->info->var.yres_virtual;
 
610
                pitch = ch->info->fix.line_length;
 
611
 
 
612
                /* test if we can enable meram */
 
613
                if (ch->cfg.meram_cfg && priv->meram_dev &&
 
614
                                priv->meram_dev->ops) {
 
615
                        struct sh_mobile_meram_cfg *cfg;
 
616
                        struct sh_mobile_meram_info *mdev;
 
617
                        unsigned long icb_addr_y, icb_addr_c;
 
618
                        int icb_pitch;
 
619
                        int pf;
 
620
 
 
621
                        cfg = ch->cfg.meram_cfg;
 
622
                        mdev = priv->meram_dev;
 
623
                        /* we need to de-init configured ICBs before we
 
624
                         * we can re-initialize them.
 
625
                         */
 
626
                        if (ch->meram_enabled)
 
627
                                mdev->ops->meram_unregister(mdev, cfg);
 
628
 
 
629
                        ch->meram_enabled = 0;
 
630
 
 
631
                        if (ch->info->var.nonstd) {
 
632
                                if (ch->info->var.bits_per_pixel == 24)
 
633
                                        pf = SH_MOBILE_MERAM_PF_NV24;
 
634
                                else
 
635
                                        pf = SH_MOBILE_MERAM_PF_NV;
 
636
                        } else {
 
637
                                pf = SH_MOBILE_MERAM_PF_RGB;
 
638
                        }
 
639
 
 
640
                        ret = mdev->ops->meram_register(mdev, cfg, pitch,
 
641
                                                ch->info->var.yres,
 
642
                                                pf,
 
643
                                                base_addr_y,
 
644
                                                base_addr_c,
 
645
                                                &icb_addr_y,
 
646
                                                &icb_addr_c,
 
647
                                                &icb_pitch);
 
648
                        if (!ret)  {
 
649
                                /* set LDSA1R value */
 
650
                                base_addr_y = icb_addr_y;
 
651
                                pitch = icb_pitch;
 
652
 
 
653
                                /* set LDSA2R value if required */
 
654
                                if (base_addr_c)
 
655
                                        base_addr_c = icb_addr_c;
 
656
 
 
657
                                ch->meram_enabled = 1;
 
658
                        }
 
659
                }
 
660
 
601
661
                /* point out our frame buffer */
602
 
                lcdc_write_chan(ch, LDSA1R, ch->info->fix.smem_start);
 
662
                lcdc_write_chan(ch, LDSA1R, base_addr_y);
603
663
                if (ch->info->var.nonstd)
604
 
                        lcdc_write_chan(ch, LDSA2R,
605
 
                                ch->info->fix.smem_start +
606
 
                                ch->info->var.xres *
607
 
                                ch->info->var.yres_virtual);
 
664
                        lcdc_write_chan(ch, LDSA2R, base_addr_c);
608
665
 
609
666
                /* set line size */
610
 
                lcdc_write_chan(ch, LDMLSR, ch->info->fix.line_length);
 
667
                lcdc_write_chan(ch, LDMLSR, pitch);
611
668
 
612
669
                /* setup deferred io if SYS bus */
613
670
                tmp = ch->cfg.sys_bus_cfg.deferred_io_msec;
692
749
                        board_cfg->display_off(board_cfg->board_data);
693
750
                        module_put(board_cfg->owner);
694
751
                }
 
752
 
 
753
                /* disable the meram */
 
754
                if (ch->meram_enabled) {
 
755
                        struct sh_mobile_meram_cfg *cfg;
 
756
                        struct sh_mobile_meram_info *mdev;
 
757
                        cfg = ch->cfg.meram_cfg;
 
758
                        mdev = priv->meram_dev;
 
759
                        mdev->ops->meram_unregister(mdev, cfg);
 
760
                        ch->meram_enabled = 0;
 
761
                }
 
762
 
695
763
        }
696
764
 
697
765
        /* stop the lcdc */
875
943
        } else
876
944
                base_addr_c = 0;
877
945
 
878
 
        lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y);
879
 
        if (base_addr_c)
880
 
                lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c);
 
946
        if (!ch->meram_enabled) {
 
947
                lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y);
 
948
                if (base_addr_c)
 
949
                        lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c);
 
950
        } else {
 
951
                struct sh_mobile_meram_cfg *cfg;
 
952
                struct sh_mobile_meram_info *mdev;
 
953
                unsigned long icb_addr_y, icb_addr_c;
 
954
                int ret;
 
955
 
 
956
                cfg = ch->cfg.meram_cfg;
 
957
                mdev = priv->meram_dev;
 
958
                ret = mdev->ops->meram_update(mdev, cfg,
 
959
                                        base_addr_y, base_addr_c,
 
960
                                        &icb_addr_y, &icb_addr_c);
 
961
                if (ret)
 
962
                        return ret;
 
963
 
 
964
                lcdc_write_chan_mirror(ch, LDSA1R, icb_addr_y);
 
965
                if (icb_addr_c)
 
966
                        lcdc_write_chan_mirror(ch, LDSA2R, icb_addr_c);
 
967
 
 
968
        }
881
969
 
882
970
        if (lcdc_chan_is_sublcd(ch))
883
971
                lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_SRS);
1288
1376
        struct fb_info *info = event->info;
1289
1377
        struct sh_mobile_lcdc_chan *ch = info->par;
1290
1378
        struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
1291
 
        int ret;
1292
1379
 
1293
1380
        if (&ch->lcdc->notifier != nb)
1294
1381
                return NOTIFY_DONE;
1302
1389
                        board_cfg->display_off(board_cfg->board_data);
1303
1390
                        module_put(board_cfg->owner);
1304
1391
                }
1305
 
                pm_runtime_put(info->device);
1306
1392
                sh_mobile_lcdc_stop(ch->lcdc);
1307
1393
                break;
1308
1394
        case FB_EVENT_RESUME:
1316
1402
                        module_put(board_cfg->owner);
1317
1403
                }
1318
1404
 
1319
 
                ret = sh_mobile_lcdc_start(ch->lcdc);
1320
 
                if (!ret)
1321
 
                        pm_runtime_get_sync(info->device);
 
1405
                sh_mobile_lcdc_start(ch->lcdc);
1322
1406
        }
1323
1407
 
1324
1408
        return NOTIFY_OK;
1420
1504
                goto err1;
1421
1505
        }
1422
1506
 
 
1507
        priv->meram_dev = pdata->meram_dev;
 
1508
 
1423
1509
        for (i = 0; i < j; i++) {
1424
1510
                struct fb_var_screeninfo *var;
1425
1511
                const struct fb_videomode *lcd_cfg, *max_cfg = NULL;