Index: kernel-source-rx-34-2.6.21.0/arch/arm/mach-omap2/board-n800-dvfs.c =================================================================== --- kernel-source-rx-34-2.6.21.0.orig/arch/arm/mach-omap2/board-n800-dvfs.c 2008-03-01 14:24:49.000000000 +0100 +++ kernel-source-rx-34-2.6.21.0/arch/arm/mach-omap2/board-n800-dvfs.c 2008-03-01 14:39:24.000000000 +0100 @@ -41,11 +41,12 @@ OP_3, NUM_OP, DEFAULT_OP = OP_1, - OP_DSP_H = OP_1, OP_CPU_H = OP_0, OP_CPU_ONDEMAND = 255, }; +static unsigned int op_dsp_h = OP_1; + static unsigned int op_list[NUM_OP][NUM_OP_PARMS] = { [OP_0] = { [_54M_SRC_CLK_KHZ] = 54000, @@ -177,9 +178,9 @@ } if (op_policy.task) - new_op = OP_DSP_H; + new_op = op_dsp_h; else if (op_policy.cam) - new_op = OP_DSP_H; + new_op = op_dsp_h; else if (op_policy.path) new_op = OP_CPU_H; else @@ -266,8 +267,47 @@ .notifier_call = op_policy_notifier, }; +static ssize_t op_dsp_show(struct subsystem * subsys, char *buf) +{ + return sprintf(buf, "%u\n", op_dsp_h); +} + +static ssize_t op_dsp_store(struct subsystem * subsys, + const char * buf, size_t n) +{ + unsigned value; + + if (sscanf(buf, "%u", &value) != 1 || (value > OP_1)) { + printk(KERN_ERR "OP: Invalid index\n"); + return -EINVAL; + } + + mutex_lock(&op_policy.lock); + if (op_policy.task) { + n = -EBUSY; + } else { + op_dsp_h = value; + } + mutex_unlock(&op_policy.lock); + + return n; +} + +static struct subsys_attribute op_dsp_attr = { + .attr = { + .name = __stringify(op_dsp), + .mode = 0644, + }, + .show = op_dsp_show, + .store = op_dsp_store, +}; + +extern struct subsystem power_subsys; + int __init n800_dvfs_init(void) { + int ret; + mutex_init(&op_policy.lock); op_policy.dvfs_wq = create_workqueue("dvfs"); INIT_WORK(&op_policy.update_policy_work, update_policy_work); @@ -278,5 +318,10 @@ NUM_OP, DEFAULT_OP); cpufreq_register_notifier(&dsp_state_change_block, CPUFREQ_POLICY_NOTIFIER); + + ret = subsys_create_file(&power_subsys, &op_dsp_attr); + if (ret) + printk(KERN_ERR "subsys_create_file failed: %d\n", ret); + return 0; }