static int __init mtk_cooler_shutdown_init(void) { int err = 0; int i; for (i = MAX_NUM_INSTANCE_MTK_COOLER_SHUTDOWN; i-- > 0; ) { cl_shutdown_dev[i] = NULL; cl_shutdown_state[i] = 0; } mtk_cooler_shutdown_dprintk("init\n"); #if defined(MTK_COOLER_SHUTDOWN_SIGNAL) { struct proc_dir_entry *entry; #if 0 entry = create_proc_entry("driver/mtk_cl_sd_pid", S_IRUGO | S_IWUSR, NULL); if (NULL != entry) { entry->read_proc = _mtk_cl_sd_pid_read; entry->write_proc = _mtk_cl_sd_pid_write; } #endif entry = proc_create("driver/mtk_cl_sd_pid", S_IRUGO | S_IWUSR | S_IWGRP, NULL, &_cl_sd_pid_fops); if (!entry) { xlog_printk(ANDROID_LOG_DEBUG, "thermal/cooler/shutdown", "mtk_cooler_shutdown_init driver/mtk_cl_sd_pid creation failed\n"); } else { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) proc_set_user(entry, 0, 1000); #else entry->gid = 1000; #endif } } { struct proc_dir_entry *entry; #if 0 entry = create_proc_entry("driver/mtk_cl_sd_rst", S_IRUGO | S_IWUSR | S_IWGRP, NULL); if (NULL != entry) { entry->write_proc = _mtk_cl_sd_rst_write; entry->gid = 1000; } #endif entry = proc_create("driver/mtk_cl_sd_rst", S_IRUGO | S_IWUSR | S_IWGRP, NULL, &_cl_sd_rst_fops); if (!entry) { xlog_printk(ANDROID_LOG_DEBUG, "thermal/cooler/shutdown", "mtk_cooler_shutdown_init driver/mtk_cl_sd_rst creation failed\n"); } else { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) proc_set_user(entry, 0, 1000); #else entry->gid = 1000; #endif } } { struct proc_dir_entry *entry; entry = proc_create("driver/mtk_cl_sd_dbt", S_IRUGO | S_IWUSR | S_IWGRP, NULL, &_cl_sd_debouncet_fops); if (!entry) { xlog_printk(ANDROID_LOG_DEBUG, "thermal/cooler/shutdown", "mtk_cooler_shutdown_init driver/mtk_cl_sd_dbt creation failed\n"); } else { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) proc_set_user(entry, 0, 1000); #else entry->gid = 1000; #endif } } #endif err = mtk_cooler_shutdown_register_ltf(); if (err) goto err_unreg; return 0; err_unreg: mtk_cooler_shutdown_unregister_ltf(); return err; }
static int __init mtk_cooler_fps_init(void) { int ret = 0; int err = 0; int i; for (i = MAX_NUM_INSTANCE_MTK_COOLER_FPS; i-- > 0; ) { cl_fps_dev[i] = NULL; cl_fps_state[i] = 0; } mtk_cooler_fps_dprintk("init\n"); err = mtk_cooler_fps_register_ltf(); if (err) goto err_unreg; /* switch device to sent the (fps limit)uevent */ fps_switch_data.name = "fps"; fps_switch_data.index = 0; fps_switch_data.state = 60; /* original 60 frames */ ret = switch_dev_register(&fps_switch_data); if (ret) mtk_cooler_fps_dprintk_always("[%s] switch_dev_register failed, returned:%d!\n", __func__, ret); /* create a proc file */ { struct proc_dir_entry *entry = NULL; struct proc_dir_entry *dir_entry = NULL; struct proc_dir_entry *fps_tm_proc_dir = NULL; fps_tm_proc_dir = proc_mkdir("fps_tm", NULL); if (!fps_tm_proc_dir) mtk_cooler_fps_dprintk_always("[%s]: mkdir /proc/fps_tm failed\n", __func__); else entry = proc_create("fps_count", S_IRWXUGO, fps_tm_proc_dir, &tm_fps_fops); dir_entry = mtk_thermal_get_proc_drv_therm_dir_entry(); if (!dir_entry) mtk_cooler_fps_dprintk_always("[%s]: mkdir /proc/driver/thermal failed\n", __func__); else { entry = proc_create("clfps", S_IRUGO | S_IWUSR | S_IWGRP, dir_entry, &cl_fps_fops); if (entry) proc_set_user(entry, uid, gid); } #if ADAPTIVE_FPS_COOLER reset_fps_level(); if (dir_entry) { entry = proc_create("clfps_adp", S_IRUGO | S_IWUSR | S_IWGRP, dir_entry, &clfps_adp_fops); if (entry) proc_set_user(entry, uid, gid); entry = proc_create("clfps_level", S_IRUGO | S_IWUSR | S_IWGRP, dir_entry, &clfps_level_fops); if (entry) proc_set_user(entry, uid, gid); } /* ===== debug only=== create_debugfs_entries(); ===== debug only === */ #endif return 0; } err_unreg: mtk_cooler_fps_unregister_ltf(); return err; }
static int _stp_create_procfs(const char *path, int num, const struct file_operations *fops, int perm, void *data) { const char *p; char *next; struct proc_dir_entry *last_dir, *de; if (num >= STP_MAX_PROCFS_FILES) { _stp_error("Requested file number %d is larger than max (%d)\n", num, STP_MAX_PROCFS_FILES); return -1; } last_dir = _stp_proc_root; /* if no path, use default one */ if (strlen(path) == 0) p = "command"; else p = path; #ifdef _STP_ALLOW_PROCFS_PATH_SUBDIRS while ((next = strchr(p, '/'))) { if (_stp_num_pde == STP_MAX_PROCFS_FILES) goto too_many; *next = 0; de = _stp_procfs_lookup(p, last_dir); if (de == NULL) { last_dir = proc_mkdir(p, last_dir); if (!last_dir) { _stp_error("Could not create directory \"%s\"\n", p); goto err; } _stp_pde[_stp_num_pde++] = last_dir; #ifdef STAPCONF_PROCFS_OWNER last_dir->owner = THIS_MODULE; #endif proc_set_user(last_dir, KUIDT_INIT(_stp_uid), KGIDT_INIT(_stp_gid)); } else { last_dir = de; } p = next + 1; } #else /* !_STP_ALLOW_PROCFS_PATH_SUBDIRS */ if (strchr(p, '/') != NULL) { _stp_error("Could not create path \"%s\"," " contains subdirectories\n", p); goto err; } #endif /* !_STP_ALLOW_PROCFS_PATH_SUBDIRS */ if (_stp_num_pde == STP_MAX_PROCFS_FILES) goto too_many; de = proc_create_data(p, perm, last_dir, fops, data); if (de == NULL) { _stp_error("Could not create file \"%s\" in path \"%s\"\n", p, path); goto err; } #ifdef STAPCONF_PROCFS_OWNER de->owner = THIS_MODULE; #endif proc_set_user(de, KUIDT_INIT(_stp_uid), KGIDT_INIT(_stp_gid)); _stp_pde[_stp_num_pde++] = de; return 0; too_many: _stp_error("Attempted to open too many procfs files. Maximum is %d\n", STP_MAX_PROCFS_FILES); err: _stp_close_procfs(); return -1; }
static int __init mtk_mdm_txpwr_init(void) { struct proc_dir_entry *entry = NULL; struct proc_dir_entry *mdtxpwr_dir = NULL; mtk_mdm_dprintk("[%s]\n", __func__); mdtxpwr_dir = mtk_thermal_get_proc_drv_therm_dir_entry(); if (!mdtxpwr_dir) { mtk_mdm_dprintk("[%s]: mkdir /driver/thermal failed\n", __func__); } else { entry = proc_create("mdm_sw", S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, mdtxpwr_dir, &mtk_mdm_sw_fops); entry = proc_create("mdm_value", S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, mdtxpwr_dir, &mtk_mdm_value_fops); entry = proc_create("mdm_timeout", S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, mdtxpwr_dir, &mtk_mdm_proc_timeout_fops); #if MTK_TS_PA_THPUT_VIA_ATCMD == 1 entry = proc_create("mdm_mdinfo", S_IRUGO | S_IWUSR | S_IWGRP, mdtxpwr_dir, &mtk_mdm_proc_mdinfo_fops); if (entry) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) proc_set_user(entry, 0, 1000); #else entry->gid = 1000; #endif } entry = proc_create("mdm_mdinfoex", S_IRUGO | S_IWUSR | S_IWGRP, mdtxpwr_dir, &mtk_mdm_proc_mdinfoex_fops); if (entry) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) proc_set_user(entry, 0, 1000); #else entry->gid = 1000; #endif } entry = proc_create("mdm_mdinfoex_thre", S_IRUGO, mdtxpwr_dir, &mtk_mdm_proc_mdinfoex_threshold_fops); if (entry) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) proc_set_user(entry, 0, 1000); #else entry->gid = 1000; #endif } #endif } /* Add for thermal all on scenary */ /* mtk_mdm_start_query(); */ return 0; }