~ubuntu-branches/ubuntu/maverick/linux-fsl-imx51/maverick

« back to all changes in this revision

Viewing changes to arch/arm/plat-mxc/dvfs_per.c

  • Committer: Bazaar Package Importer
  • Author(s): Andy Whitcroft, Bryan Wu, Heiko Carstens, Kay Sievers, Upstream Kernel Changes
  • Date: 2010-01-27 10:30:45 UTC
  • Revision ID: james.westby@ubuntu.com-20100127103045-ocbuz94jsh104pgx
Tags: 2.6.31-603.5
[ Bryan Wu ]

* [Config] Enable devtmpfs for fsl-imx51 kernel
  - LP: #512321
* SAUCE: IMX51: only export NEON flag to userspace on Freescale iMX51
  rev3.x or later silicon
  - LP: #507416

[ Heiko Carstens ]

* (pre-stable) driver-core: fix devtmpfs crash on s390
  - LP: #512370

[ Kay Sievers ]

* (pre-stable) Driver-Core: devtmpfs - set root directory mode to 0755
  - LP: #512370

[ Upstream Kernel Changes ]

* ENGR00119069 V4L2 capture: Do not change current crop setting for tvin.
* ENGR00118830 Update NAND driver scan scheme to support new nand type
* ENGR00118946 imx23: enable wake up from USB 5V
* ENGR00119150 Bluetooth: Handsfree audio has noise
* ENGR00118610 MX23: Add double buffering for PXP
* ENGR00118872 Write bootstream to kernel by kobs with BCH ECC
* ENGR00119199: ipu: add clock nodes for pixel clocks
* ENGR00119202: Fix DVFS-PER related bugs.
* ENGR00119203 MX23: Correct VDDD value for CPU frequency 360 MHz
* ENGR00119004 v4l2 output: fix kernel dump
* ENGR00119242 Add wait timeout support to void dead loop in NAND driver
* ENGR00119263: MX51 : Fix pll_set_rate function
* ENGR00119075 fix iMX23 USB initialization cause wrong power status
* ENGR00118892 MX23: iMX233 disable lcd clock when LCD off
* ENGR00119063 MX23: fix system halt rather than reboot when watchdog
  timeout
* ENGR00119324 Put GPMI NAND flash scan scheme code to the common NAND
  directory
* ENGR00114151 800x600-16@60 video not play correctly
* ENGR00119275 ipuv3: dmfc size control
* ENGR00119443 [MX23_BSP] GPMI driver computes wrong block size for
  K9GAG08U0D
* ENGR00119136 ipuv3: support 720p for ipu lib
* ENGR00119274 TVE: HDTV can not work
* ENGR00119104 MX23 ALSA: Resolve the problem of record from line-in
* ENGR00119081 V4l2 capture:Support NV12 output pixel format for still
  capture
* ENGR00119179 TVE: fix system hang for tvout
* ENGR00119070 IPUv3 FB:Support DP local alpha in pixel
* ENGR00119432 MX35 system can't re-boot up when SD/MMC boot is used.
* ENGR00119296 Fix iMX23 display abnormal when change frequency
* ENGR00119484 Update NFC INT wait timeout value to 1s
* ENGR00119504 MX25: Change nand partition for bootloader to 3M byte
* ENGR00119532 MX35: Change nand partition for bootloader to 3M bytes
* ENGR00119305 imx23: fix ethernet standby issue
* ENGR00115370 ipuv3: add display control
* ENGR00119531 ipuv3: dmfc setting restore during resume
* Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev
  - LP: #512321

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
#include <mach/hardware.h>
46
46
#include <mach/mxc_dvfs.h>
47
47
#include <mach/sdram_autogating.h>
 
48
#include <mach/clock.h>
48
49
#if defined(CONFIG_ARCH_MX37)
49
50
#include <mach/mxc_dptc.h>
50
51
#endif
82
83
void stop_dvfs_per(void);
83
84
int dvfs_per_active(void);
84
85
int dvfs_per_divider_active(void);
85
 
int dvfs_per_pixel_clk_limit(int pix_clk);
 
86
int dvfs_per_pixel_clk_limit();
86
87
 
87
88
extern int low_bus_freq_mode;
88
89
extern int bus_freq_scaling_is_active;
500
501
                return 0;
501
502
 
502
503
        if (bus_freq_scaling_is_active) {
 
504
                dvfs_per_is_paused = 1;
503
505
                printk(KERN_INFO "Cannot start DVFS-PER since bus_freq_scaling is active\n");
504
506
                return 0;
505
507
        }
506
508
 
507
 
        if (!ipu_freq_scaled) {
508
 
                printk(KERN_INFO "Cannot start DVFS-PER since pixel clock is above 60MHz\n");
 
509
        if (!dvfs_per_pixel_clk_limit()) {
 
510
                dvfs_per_is_paused = 1;
 
511
                printk(KERN_INFO "Cannot start DVFS-PER since pixel clock is\
 
512
                        above 60MHz or divider is not even\n");
509
513
                return 0;
510
514
        }
511
515
 
613
617
        return dvfs_per_low_freq;
614
618
}
615
619
 
616
 
int dvfs_per_pixel_clk_limit(int pix_clk)
 
620
int dvfs_per_pixel_clk_limit()
617
621
{
618
 
        if (pix_clk < DVFS_MAX_PIX_CLK && (!ipu_freq_scaled))
 
622
        struct clk *disp0_pixel_clk;
 
623
        struct clk *disp1_pixel_clk;
 
624
        int disp0_rate = 0;
 
625
        int disp1_rate = 0;
 
626
        int div1 = 0;
 
627
        int div2 = 0;
 
628
        int even_div1 = 1;
 
629
        int even_div2  = 1;
 
630
 
 
631
        disp0_pixel_clk = clk_get(NULL, "pixel_clk.0");
 
632
        disp1_pixel_clk = clk_get(NULL, "pixel_clk.1");
 
633
 
 
634
        if (disp0_pixel_clk != NULL)
 
635
                disp0_rate = clk_get_rate(disp0_pixel_clk);
 
636
 
 
637
        if (disp1_pixel_clk != NULL)
 
638
                disp1_rate = clk_get_rate(disp1_pixel_clk);
 
639
 
 
640
        /* DVFS-PER will not work if pixel clock divider is odd */
 
641
        if (disp0_rate != 0)
 
642
                div1  = (clk_get_rate(
 
643
                        clk_get_parent(disp0_pixel_clk)) * 10) / disp0_rate;
 
644
 
 
645
        if ((div1 % 2) || ((div1 / 10) % 2))
 
646
                even_div1 = 0;
 
647
 
 
648
        if ((div2 % 2) || ((div2 / 10) % 2))
 
649
                even_div2 = 0;
 
650
 
 
651
        if (disp1_rate != 0)
 
652
                div2  = (clk_get_rate(
 
653
                        clk_get_parent(disp1_pixel_clk)) * 10) / disp1_rate;
 
654
 
 
655
        if (((disp0_rate < DVFS_MAX_PIX_CLK && even_div1) ||
 
656
                !clk_get_usecount(disp0_pixel_clk)) &&
 
657
                ((disp1_rate < DVFS_MAX_PIX_CLK && even_div2) ||
 
658
                !clk_get_usecount(disp1_pixel_clk)))
619
659
                ipu_freq_scaled = 1;
620
660
        else
621
661
                ipu_freq_scaled = 0;
 
662
 
 
663
        clk_put(disp0_pixel_clk);
 
664
        clk_put(disp1_pixel_clk);
 
665
 
622
666
        return ipu_freq_scaled;
623
667
}
624
668
 
747
791
        cpu_clk = clk_get(NULL, "cpu_clk");
748
792
        ahb_clk = clk_get(NULL, "ahb_clk");
749
793
        axi_b_clk = clk_get(NULL, "axi_b_clk");
 
794
 
750
795
        if (cpu_is_mx51())
751
796
                ddr_hf_clk = clk_get(NULL, "ddr_hf_clk");
752
797