]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/openzaurus-pxa27x-2.4.20-rmk2-embedix20050602/P02-C3000-voltage_050221.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / openzaurus-pxa27x-2.4.20-rmk2-embedix20050602 / P02-C3000-voltage_050221.patch
1 diff -Nur c3000_pre/linux/arch/arm/config.in c3000_work/linux/arch/arm/config.in
2 --- c3000_pre/linux/arch/arm/config.in  2005-02-21 21:41:40.000000000 +0900
3 +++ c3000_work/linux/arch/arm/config.in 2005-02-21 22:25:37.000000000 +0900
4 @@ -478,6 +478,9 @@
5     if [ "$CONFIG_ARCH_PXA_SPITZ" = "y" ]; then
6        bool 'Use clock change(cccr_change) enable (EXPERIMENTAL)' CONFIG_SL_CCCR_CHANGE
7     fi
8 +   if [ "$CONFIG_SL_CCCR_CHANGE" = "y" ]; then
9 +      bool 'Core voltage change enable (EXPERIMENTAL)' CONFIG_CHANGE_CORE_VOLT
10 +   fi
11     if [ "$CONFIG_ARCH_SHARP_SL" = "y" ]; then
12        define_bool CONFIG_BATT y
13     fi
14 diff -Nur c3000_pre/linux/arch/arm/mach-pxa/pxa27x_power.c c3000_work/linux/arch/arm/mach-pxa/pxa27x_power.c
15 --- c3000_pre/linux/arch/arm/mach-pxa/pxa27x_power.c    2004-11-04 14:13:54.000000000 +0900
16 +++ c3000_work/linux/arch/arm/mach-pxa/pxa27x_power.c   2005-02-21 22:25:37.000000000 +0900
17 @@ -150,6 +150,10 @@
18  extern int sharpsl_main_bk_flag;
19  int sharpsl_request_off = 0;
20  
21 +#if defined(CONFIG_CHANGE_CORE_VOLT)
22 +static unsigned char current_core_voltage = 0x1a;
23 +#endif
24 +
25  void PrintParamTable(void);
26  
27  int sharpsl_restart(void)
28 @@ -324,7 +328,7 @@
29    return -1;
30  }
31  
32 -#ifdef DEBUG
33 +#if defined(DEBUG) || defined(CONFIG_CHANGE_CORE_VOLT)
34  int pwr_i2c_read( unsigned char device, unsigned char *value )
35  {
36    unsigned long        r;
37 @@ -405,12 +409,33 @@
38  static void cpu_xscale_voltage_high(void)
39  {
40    pwr_i2c_open();
41 +#if defined(CONFIG_CHANGE_CORE_VOLT)
42 +  pwr_i2c_write( 0x0c, current_core_voltage );
43 +  pwr_i2c_close();
44 +  printk("current voltage %x\n", current_core_voltage );
45 +#else
46    pwr_i2c_write( 0x0c, 0x1a );  // 1.35V - SlewRate 1
47    pwr_i2c_close();
48 +#endif
49 +}
50 +
51 +#if defined(CONFIG_CHANGE_CORE_VOLT)
52 +void cpu_xscale_voltage_write(unsigned char value)
53 +{
54 +  if (value > 0x10 )
55 +    return;
56 +  value += 0x10;
57 +  pwr_i2c_open();
58 +  pwr_i2c_write( 0x0c, value );
59 +  pwr_i2c_close();
60 +  current_core_voltage = value;
61 +  printk("current voltage %x\n", current_core_voltage );
62 +
63  }
64 +#endif
65  
66 -#ifdef DEBUG
67 -static unsigned char cpu_xscale_voltage_read(void)
68 +#if defined(DEBUG) || defined(CONFIG_CHANGE_CORE_VOLT)
69 +unsigned char cpu_xscale_voltage_read(void)
70  {
71    unsigned char value=0xff;
72    pwr_i2c_open();
73 @@ -418,7 +443,9 @@
74    pwr_i2c_close();
75    return value;
76  }
77 +#endif
78  
79 +#if defined(DEBUG)
80  #define CLKCFG(a)      asm("mrc p14, 0, %0, C6, C0, 0" : "=r"(a))
81  static void __debug_printk(void)
82  {
83 diff -Nur c3000_pre/linux/arch/arm/mach-pxa/sharpsl_apm.c c3000_work/linux/arch/arm/mach-pxa/sharpsl_apm.c
84 --- c3000_pre/linux/arch/arm/mach-pxa/sharpsl_apm.c     2005-02-21 21:44:13.000000000 +0900
85 +++ c3000_work/linux/arch/arm/mach-pxa/sharpsl_apm.c    2005-02-21 22:29:17.000000000 +0900
86 @@ -135,6 +135,11 @@
87  struct proc_dir_entry *proc_zaurus;
88  #endif
89  
90 +#if defined(CONFIG_CHANGE_CORE_VOLT)
91 +extern unsigned char cpu_xscale_voltage_read(void);
92 +extern void cpu_xscale_voltage_write(unsigned char);
93 +#endif
94 +
95  #if defined(CONFIG_SABINAL_DISCOVERY)
96  #define SHARPSL_AC_LINE_STATUS (( ASIC3_GPIO_PSTS_D & AC_IN )? APM_AC_OFFLINE : APM_AC_ONLINE)
97  #define BACKPACK_IN_DETECT()   ( ASIC3_GPIO_PSTS_D & BACKPACK_DETECT ) /* 0: exist , 1: not in */
98 @@ -1036,6 +1041,58 @@
99  EXPORT_SYMBOL(write_cccr);
100  #endif
101  
102 +#if defined(CONFIG_CHANGE_CORE_VOLT)
103 +
104 +void write_vcore(int vcore)
105 +{
106 +    printk("Change Core voltage = %x.\n", vcore);
107 +    cpu_xscale_voltage_write(vcore);
108 +    return;
109 +}
110 +
111 +int read_vcore(void)
112 +{
113 +    return cpu_xscale_voltage_read();
114 +}
115 +
116 +static ssize_t core_volt_read_params(struct file *file, char *buf,
117 +                                      size_t nbytes, loff_t *ppos)
118 +{
119 +        char outputbuf[32];
120 +       int count;
121 +       
122 +       if (*ppos>0) /* Assume reading completed in previous read*/
123 +               return 0;
124 +       count = sprintf(outputbuf, "0x%02X\n", (unsigned int) cpu_xscale_voltage_read() );
125 +       count++;
126 +       *ppos += count;
127 +       if (count>nbytes)/* Assume output can be read at one time */
128 +               return -EINVAL;
129 +       if (copy_to_user(buf, outputbuf, count+1))
130 +               return -EFAULT;
131 +       return count;
132 +}
133 +
134 +static ssize_t core_volt_write_params(struct file *file, const char *buf,
135 +                                       size_t nbytes, loff_t *ppos)
136 +{
137 +        unsigned int param=0;
138 +    
139 +       sscanf(buf,"%x",&param);
140 +       if (param) {
141 +           write_vcore(param);
142 +       }
143 +       return nbytes;
144 +}
145 +
146 +static struct file_operations proc_core_volt_params_operations = {
147 +        read:core_volt_read_params,
148 +        write:core_volt_write_params,
149 +};
150 +EXPORT_SYMBOL(read_vcore);
151 +EXPORT_SYMBOL(write_vcore);
152 +#endif
153 +
154  #ifdef CONFIG_APM_CPU_IDLE
155  #ifdef SHARPSL_NEW_IDLE
156  static int save_icmr;
157 @@ -2849,6 +2906,7 @@
158         struct proc_dir_entry *lock_fcs_proc;
159         struct proc_dir_entry *power_mode_proc;
160         struct proc_dir_entry *cccr_change_proc;
161 +       struct proc_dir_entry *core_volt_proc;
162  
163         apm_info.bios = apm_bios_info;
164         if (apm_info.bios.version == 0) {
165 @@ -2981,6 +3039,14 @@
166                 cccr_change_proc->proc_fops = &proc_cccr_change_params_operations;
167         }
168  #endif
169 +
170 +#if defined(CONFIG_CHANGE_CORE_VOLT)
171 +       core_volt_proc = create_proc_entry("zaurus/VCORE", 0, NULL);
172 +       if (core_volt_proc) {
173 +               core_volt_proc->proc_fops = &proc_core_volt_params_operations;
174 +       }
175 +#endif
176 +
177         kernel_thread(apm_thread, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
178         
179  #if defined(CONFIG_SABINAL_DISCOVERY) || defined(CONFIG_ARCH_PXA_TOSA)