From: 黄涛 Date: Thu, 21 Feb 2013 10:30:03 +0000 (+0800) Subject: rk: rm video_state.c which replace by ddr_freq.c X-Git-Tag: firefly_0821_release~7586 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=974cc09a3eb544bd8323eb0bafd55e7fe24855e9;p=firefly-linux-kernel-4.4.55.git rk: rm video_state.c which replace by ddr_freq.c --- diff --git a/arch/arm/plat-rk/video_state.c b/arch/arm/plat-rk/video_state.c deleted file mode 100644 index ebc70024695f..000000000000 --- a/arch/arm/plat-rk/video_state.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2012 ROCKCHIP, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_ARCH_RK2928 -#define VIDEO_DDR_RATE (300*1000*1000) -#else -#define VIDEO_DDR_RATE (300*1000*1000) -#endif - -static struct clk *ddr_clk; -static unsigned long ddr_rate; -static char video_state = '0'; - -static int video_state_open(struct inode *inode, struct file *file) -{ - ddr_rate = clk_get_rate(ddr_clk); - return 0; -} - -static int video_state_release(struct inode *inode, struct file *file) -{ - clk_set_rate(ddr_clk, ddr_rate); - return 0; -} - -static ssize_t video_state_read(struct file *file, char __user *buffer, - size_t count, loff_t *ppos) -{ - if (copy_to_user(buffer, &video_state, 1)) - return -EFAULT; - return 1; -} - -static ssize_t video_state_write(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos) -{ - unsigned long rate = 0; - - if (ddr_rate <= 333000000) - return count; - if (count < 1) - return count; - if (copy_from_user(&video_state, buffer, 1)) { - return -EFAULT; - } - - switch (video_state) { - case '0': - rate = ddr_rate; - break; - case '1': - rate = VIDEO_DDR_RATE; - break; - default: - return -EINVAL; - } - clk_set_rate(ddr_clk, rate); - return count; -} - -static const struct file_operations video_state_fops = { - .owner = THIS_MODULE, - .open = video_state_open, - .release= video_state_release, - .read = video_state_read, - .write = video_state_write, -}; - -static struct miscdevice video_state_dev = { - .fops = &video_state_fops, - .name = "video_state", - .minor = MISC_DYNAMIC_MINOR, -}; - -static int __init video_state_init(void) -{ - ddr_clk = clk_get(NULL, "ddr"); - if (IS_ERR(ddr_clk)) - return PTR_ERR(ddr_clk); - - return misc_register(&video_state_dev); -} - -static void __exit video_state_exit(void) -{ - misc_deregister(&video_state_dev); - clk_put(ddr_clk); -} - -module_init(video_state_init); -module_exit(video_state_exit); -MODULE_LICENSE("GPL");