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_sd_state[i].state = 0;
		cl_sd_state[i].sd_cnt = 0;
	}

	mtk_cooler_shutdown_dprintk("init\n");

#if defined(MTK_COOLER_SHUTDOWN_SIGNAL)
	{
		struct proc_dir_entry *entry = NULL;
		struct proc_dir_entry *dir_entry = mtk_thermal_get_proc_drv_therm_dir_entry();

		if (!dir_entry) {
			mtk_cooler_shutdown_dprintk("%s mkdir /proc/driver/thermal failed\n",
						    __func__);
			return 0;
		}

		entry =
		    proc_create("clsd_pid", S_IRUGO | S_IWUSR | S_IWGRP, dir_entry,
				&_cl_sd_pid_fops);
		if (!entry)
			mtk_cooler_shutdown_dprintk("%s clsd_pid creation failed\n", __func__);
		else
			proc_set_user(entry, uid, gid);

		entry =
		    proc_create("clsd_rst", S_IRUGO | S_IWUSR | S_IWGRP, dir_entry,
				&_cl_sd_rst_fops);
		if (!entry)
			mtk_cooler_shutdown_dprintk("%s clsd_rst creation failed\n", __func__);
		else
			proc_set_user(entry, uid, gid);

		entry =
		    proc_create("clsd_dbt", S_IRUGO | S_IWUSR | S_IWGRP, dir_entry,
				&_cl_sd_debouncet_fops);
		if (!entry)
			mtk_cooler_shutdown_dprintk("%s clsd_dbt creation failed\n", __func__);
		else
			proc_set_user(entry, uid, gid);
	}
#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_bcct_init(void)
{
  int err = 0;
  int i;

  for (i = MAX_NUM_INSTANCE_MTK_COOLER_BCCT; i-- > 0; )
  {
    cl_bcct_dev[i] = NULL;
    cl_bcct_state[i] = 0;
  }

  //cl_bcct_dev = NULL;

  mtk_cooler_bcct_dprintk("init\n");

  err = mtk_cooler_bcct_register_ltf();
  if (err)
    goto err_unreg;

  /* create a proc file */
  {
        struct proc_dir_entry *entry = NULL;
        struct proc_dir_entry *dir_entry = NULL;

        dir_entry = mtk_thermal_get_proc_drv_therm_dir_entry();
        if (!dir_entry) {
        	mtk_cooler_bcct_dprintk("[%s]: mkdir /proc/driver/thermal failed\n", __func__);
        }

        entry =
            proc_create("clbcct", S_IRUGO | S_IWUSR | S_IWGRP, dir_entry,
                &_cl_bcct_fops);
		if (!entry) {
			mtk_cooler_bcct_dprintk_always("%s clbcct creation failed\n",
						                   __func__);
		} else {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
            proc_set_user(entry, 0, 1000);
#else
            entry->gid = 1000;
#endif
        }
  }
  return 0;

err_unreg:
  mtk_cooler_bcct_unregister_ltf();
  return err;
}
static int __init tsallts_init(void)
{
	struct proc_dir_entry *entry = NULL;
	struct proc_dir_entry *tsallts_dir = NULL;

	tsallts_dprintk("[tsallts_init] ts2\n");

	tsallts_dir = mtk_thermal_get_proc_drv_therm_dir_entry();
	if (!tsallts_dir) {
		tsallts_dprintk("[%s]: mkdir /proc/driver/thermal failed\n", __func__);
	} else {
		entry =
		    proc_create("tzts2", S_IRUGO | S_IWUSR | S_IWGRP, tsallts_dir, &tsallts_fops);
		if (entry)
			proc_set_user(entry, uid, gid);
	}
	return 0;
}
static int amutt_proc_register(void)
{
    struct proc_dir_entry *entry = NULL;
    struct proc_dir_entry *amutt_proc_dir = NULL;

    mtk_cooler_amutt_dprintk("[%s]\n", __func__);

    amutt_proc_dir = mtk_thermal_get_proc_drv_therm_dir_entry();
    if (!amutt_proc_dir) {
        mtk_cooler_amutt_dprintk("[%s]: mkdir /proc/driver/thermal failed\n", __func__);
    } else {
        entry = proc_create("clamutt_param", S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, amutt_proc_dir, &amutt_param_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("clamutt_asparam", S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, amutt_proc_dir, &amutt_asparam_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("clamutt_dbg", S_IRUSR | S_IWUSR, amutt_proc_dir, &amutt_dbg_fops);
        if (entry) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
            proc_set_user(entry, 0, 1000);
#else
            entry->gid = 1000;
#endif
        }
    }
    return 0;
}
Exemple #5
0
static int __init mtktspa_init(void)
{
	int err = 0;
	struct proc_dir_entry *entry = NULL;
	struct proc_dir_entry *mtktspa_dir = NULL;

	mtktspa_dprintk("[%s]\n", __func__);

	err = mtktspa_register_cooler();
	if (err)
		return err;

	err = mtktspa_register_thermal();
	if (err)
		goto err_unreg;

	mtktspa_dir = mtk_thermal_get_proc_drv_therm_dir_entry();
	if (!mtktspa_dir) {
		mtktspa_dprintk("[%s]: mkdir /proc/driver/thermal failed\n", __func__);
	} else {
		entry =
		    proc_create("tzpa", S_IRUGO | S_IWUSR | S_IWGRP, mtktspa_dir, &mtktspa_fops);
		if (entry) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
			proc_set_user(entry, 0, 1000);
#else
			entry->gid = 1000;
#endif
		}
	}

	return 0;

err_unreg:
	mtktspa_unregister_cooler();
	return err;
}
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;
}
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;
}