#include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include "mt_ppm_internal.h" static enum ppm_power_state ppm_ptpod_get_power_state_cb(enum ppm_power_state cur_state); static void ppm_ptpod_update_limit_cb(enum ppm_power_state new_state); static void ppm_ptpod_status_change_cb(bool enable); static void ppm_ptpod_mode_change_cb(enum ppm_mode mode); /* other members will init by ppm_main */ static struct ppm_policy_data ptpod_policy = { .name = __stringify(PPM_POLICY_PTPOD), .lock = __MUTEX_INITIALIZER(ptpod_policy.lock), .policy = PPM_POLICY_PTPOD, .priority = PPM_POLICY_PRIO_HIGHEST, .get_power_state_cb = ppm_ptpod_get_power_state_cb, .update_limit_cb = ppm_ptpod_update_limit_cb, .status_change_cb = ppm_ptpod_status_change_cb, .mode_change_cb = ppm_ptpod_mode_change_cb, }; void mt_ppm_ptpod_policy_activate(void) { unsigned int i; FUNC_ENTER(FUNC_LV_API);
#include <linux/mutex.h> #include <linux/security.h> #include <linux/user_namespace.h> #include <asm/uaccess.h> #include "internal.h" /* Session keyring create vs join semaphore */ static DEFINE_MUTEX(key_session_mutex); /* User keyring creation semaphore */ static DEFINE_MUTEX(key_user_keyring_mutex); /* The root user's tracking struct */ struct key_user root_key_user = { .usage = ATOMIC_INIT(3), .cons_lock = __MUTEX_INITIALIZER(root_key_user.cons_lock), .lock = __SPIN_LOCK_UNLOCKED(root_key_user.lock), .nkeys = ATOMIC_INIT(2), .nikeys = ATOMIC_INIT(2), .uid = 0, .user_ns = &init_user_ns, }; /* * Install the user and user session keyrings for the current process's UID. */ int install_user_keyrings(void) { struct user_struct *user; const struct cred *cred; struct key *uid_keyring, *session_keyring;
NULL }; //----------------------------------------------------------------- static struct config_item_type iio_root_group_type = { .ct_owner = THIS_MODULE, }; static struct configfs_subsystem iio_configfs_subsys = { .su_group = { .cg_item = { .ci_namebuf = "iio", .ci_type = &iio_root_group_type, }, .default_groups = iio_root_default_groups, }, .su_mutex = __MUTEX_INITIALIZER(iio_configfs_subsys.su_mutex), }; int iio_sw_trigger_type_configfs_register(struct iio_sw_trigger_type *tt) { config_group_init_type_name(&tt->group, tt->name, &iio_trigger_type_group_type); return configfs_register_group(&iio_triggers_group, &tt->group); } EXPORT_SYMBOL_GPL(iio_sw_trigger_type_configfs_register); void iio_sw_trigger_type_configfs_unregister(struct iio_sw_trigger_type *tt) { configfs_unregister_group(&tt->group); }
#include <linux/init.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> #include <asm/uaccess.h> #include "mt_ppm_internal.h" static void ppm_thermal_update_limit_cb(enum ppm_power_state new_state); static void ppm_thermal_status_change_cb(bool enable); static void ppm_thermal_mode_change_cb(enum ppm_mode mode); /* other members will init by ppm_main */ static struct ppm_policy_data thermal_policy = { .name = __stringify(PPM_POLICY_THERMAL), .lock = __MUTEX_INITIALIZER(thermal_policy.lock), .policy = PPM_POLICY_THERMAL, .priority = PPM_POLICY_PRIO_POWER_BUDGET_BASE, .get_power_state_cb = NULL, /* decide in ppm main via min power budget */ .update_limit_cb = ppm_thermal_update_limit_cb, .status_change_cb = ppm_thermal_status_change_cb, .mode_change_cb = ppm_thermal_mode_change_cb, }; void mt_ppm_cpu_thermal_protect(unsigned int limited_power) { FUNC_ENTER(FUNC_LV_POLICY); ppm_info("Get budget from thermal => limited_power = %d\n", limited_power); ppm_lock(&thermal_policy.lock);
//#define SHCAMLED_ENABLE_DEBUG #ifdef SHCAMLED_ENABLE_DEBUG #define SHCAMLED_INFO(fmt, args...) pr_err(fmt, ##args) #define SHCAMLED_TRACE(fmt, args...) pr_err(fmt, ##args) #define SHCAMLED_ERROR(fmt, args...) pr_err(fmt, ##args) #else #define SHCAMLED_INFO(x...) do {} while(0) #define SHCAMLED_TRACE(x...) do {} while(0) #define SHCAMLED_ERROR(fmt, args...) pr_err(fmt, ##args) #endif /* ------------------------------------------------------------------------- */ /* VARIABLES */ /* ------------------------------------------------------------------------- */ static struct mutex shcamled_mut = __MUTEX_INITIALIZER(shcamled_mut); struct task_struct *p_flash_off_thread = NULL; struct task_struct *p_flash_on_thread = NULL; wait_queue_head_t shcamled_msg_off_wait; wait_queue_head_t shcamled_msg_on_wait; static int flash_off_thread_active = 0; static int flash_on_thread_active = 0; static atomic_t flash_on_prepare; struct completion flash_on_complete; static struct platform_device shcamled_torch_dev = { .name = "shcamled_torch", }; static struct platform_driver shcamled_torch_driver = { .probe = shcamled_torch_probe,
.powersave_bias_target = generic_powersave_bias_target, .freq_increase = dbs_freq_increase, }; static struct common_dbs_data od_dbs_cdata = { .governor = GOV_ONDEMAND, .attr_group_gov_sys = &od_attr_group_gov_sys, .attr_group_gov_pol = &od_attr_group_gov_pol, .get_cpu_cdbs = get_cpu_cdbs, .get_cpu_dbs_info_s = get_cpu_dbs_info_s, .gov_dbs_timer = od_dbs_timer, .gov_check_cpu = od_check_cpu, .gov_ops = &od_ops, .init = od_init, .exit = od_exit, .mutex = __MUTEX_INITIALIZER(od_dbs_cdata.mutex), }; static void od_set_powersave_bias(unsigned int powersave_bias) { struct cpufreq_policy *policy; struct dbs_data *dbs_data; struct od_dbs_tuners *od_tuners; unsigned int cpu; cpumask_t done; default_powersave_bias = powersave_bias; cpumask_clear(&done); get_online_cpus(); for_each_online_cpu(cpu) {
#include <linux/notifier.h> #include <linux/fb.h> #endif #include "mt_ppm_internal.h" static enum ppm_power_state ppm_lcmoff_get_power_state_cb(enum ppm_power_state cur_state); static void ppm_lcmoff_update_limit_cb(enum ppm_power_state new_state); static void ppm_lcmoff_status_change_cb(bool enable); static void ppm_lcmoff_mode_change_cb(enum ppm_mode mode); /* other members will init by ppm_main */ static struct ppm_policy_data lcmoff_policy = { .name = __stringify(PPM_POLICY_LCM_OFF), .lock = __MUTEX_INITIALIZER(lcmoff_policy.lock), .policy = PPM_POLICY_LCM_OFF, .priority = PPM_POLICY_PRIO_USER_SPECIFY_BASE, .get_power_state_cb = ppm_lcmoff_get_power_state_cb, .update_limit_cb = ppm_lcmoff_update_limit_cb, .status_change_cb = ppm_lcmoff_status_change_cb, .mode_change_cb = ppm_lcmoff_mode_change_cb, }; static enum ppm_power_state ppm_lcmoff_get_power_state_cb(enum ppm_power_state cur_state) { return cur_state; } static void ppm_lcmoff_update_limit_cb(enum ppm_power_state new_state) {
#include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> #include "mt_ppm_internal.h" static enum ppm_power_state ppm_ut_get_power_state_cb(enum ppm_power_state cur_state); /* other members will init by ppm_main */ static struct ppm_policy_data ut_policy = { .name = __stringify(PPM_POLICY_UT), .lock = __MUTEX_INITIALIZER(ut_policy.lock), .policy = PPM_POLICY_UT, .priority = PPM_POLICY_PRIO_HIGHEST, .get_power_state_cb = ppm_ut_get_power_state_cb, .update_limit_cb = NULL, .status_change_cb = NULL, .mode_change_cb = NULL, }; struct ppm_ut_data { bool is_freq_idx_fixed; bool is_core_num_fixed; struct ppm_ut_limit { int freq_idx; int core_num; } *limit;
static size_t dp_get_packet_length(const unsigned char *hdr) { struct shm_psd_skhdr *skhdr = (struct shm_psd_skhdr *)hdr; return skhdr->length + sizeof(*skhdr); } struct shm_callback dp_shm_cb = { .get_packet_length = dp_get_packet_length, }; struct shm_rbctl psd_rbctl = { .name = "cp-psd", .cbs = &dp_shm_cb, .priv = &data_path, .va_lock = __MUTEX_INITIALIZER(psd_rbctl.va_lock), }; /* cp psd xmit stopped notify interrupt */ static u32 acipc_cb_psd_rb_stop(u32 status) { dp_rb_stop_cb(&psd_rbctl); return 0; } /* cp psd wakeup ap xmit interrupt */ static u32 acipc_cb_psd_rb_resume(u32 status) { dp_rb_resume_cb(&psd_rbctl); return 0; }
// Global variable definition /*============================================================================*/ hps_ctxt_t hps_ctxt = { //state .init_state = INIT_STATE_NOT_READY, .state = STATE_LATE_RESUME, //enabled .enabled = 0, /* don't allow hotplug so all cores are online */ .early_suspend_enabled = 1, .suspend_enabled = 1, .cur_dump_enabled = 0, .stats_dump_enabled = 0, //core .lock = __MUTEX_INITIALIZER(hps_ctxt.lock), /* Synchronizes accesses to loads statistics */ .tsk_struct_ptr = NULL, .wait_queue = __WAIT_QUEUE_HEAD_INITIALIZER(hps_ctxt.wait_queue), #ifdef CONFIG_HAS_EARLYSUSPEND .es_handler = { .level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 250, .suspend = hps_early_suspend, .resume = hps_late_resume, }, #endif //#ifdef CONFIG_HAS_EARLYSUSPEND .pdrv = { .remove = NULL, .shutdown = NULL, .probe = hps_probe, .driver = { .name = "hps",
int rpmsg_send_generic_raw_command(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out, u32 outlen, u32 dptr, u32 sptr) { struct rpmsg_instance *rpmsg_ipc_instance = rpmsg_ddata[RPMSG_IPC_RAW_COMMAND].rpmsg_instance; return rpmsg_send_raw_command(rpmsg_ipc_instance, cmd, sub, in, out, inlen, outlen, sptr, dptr); } EXPORT_SYMBOL(rpmsg_send_generic_raw_command); /* Global lock for rpmsg framework */ static struct rpmsg_lock global_lock = { .lock = __MUTEX_INITIALIZER(global_lock.lock), .locked_prev = 0, .pending = ATOMIC_INIT(0), }; #define is_global_locked_prev (global_lock.locked_prev) #define get_global_locked_prev() (global_lock.locked_prev++) #define put_global_locked_prev() (global_lock.locked_prev--) #define global_locked_by_current (global_lock.lock.owner == current) void rpmsg_global_lock(void) { atomic_inc(&global_lock.pending); mutex_lock(&global_lock.lock); } EXPORT_SYMBOL(rpmsg_global_lock);
#include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include "mt_ppm_internal.h" static enum ppm_power_state ppm_perfserv_get_power_state_cb(enum ppm_power_state cur_state); static void ppm_perfserv_update_limit_cb(enum ppm_power_state new_state); static void ppm_perfserv_status_change_cb(bool enable); static void ppm_perfserv_mode_change_cb(enum ppm_mode mode); /* other members will init by ppm_main */ static struct ppm_policy_data perfserv_policy = { .name = __stringify(PPM_POLICY_PERF_SERV), .lock = __MUTEX_INITIALIZER(perfserv_policy.lock), .policy = PPM_POLICY_PERF_SERV, .priority = PPM_POLICY_PRIO_PERFORMANCE_BASE, .get_power_state_cb = ppm_perfserv_get_power_state_cb, .update_limit_cb = ppm_perfserv_update_limit_cb, .status_change_cb = ppm_perfserv_status_change_cb, .mode_change_cb = ppm_perfserv_mode_change_cb, }; struct ppm_perfserv_data { int min_freq; int min_core_num; int max_available_freq; } perfserv_data = { .min_freq = -1, .min_core_num = -1,
.drop_item = gpiommc_drop_item, }; static struct config_item_type gpiommc_ci_type = { .ct_group_ops = &gpiommc_ct_group_ops, .ct_owner = THIS_MODULE, }; static struct configfs_subsystem gpiommc_subsys = { .su_group = { .cg_item = { .ci_namebuf = GPIOMMC_PLATDEV_NAME, .ci_type = &gpiommc_ci_type, }, }, .su_mutex = __MUTEX_INITIALIZER(gpiommc_subsys.su_mutex), }; #endif /* CONFIG_GPIOMMC_CONFIGFS */ static struct platform_driver gpiommc_plat_driver = { .probe = gpiommc_probe, .remove = gpiommc_remove, .driver = { .name = GPIOMMC_PLATDEV_NAME, .owner = THIS_MODULE, }, }; int gpiommc_next_id(void) {
static int lmdev_open(struct inode *inode, struct file *filp) { return 0; } static struct file_operations mdev_fops = { .owner = THIS_MODULE, .open = lmdev_open, .unlocked_ioctl = lmdev_ioctl, }; static struct lcd_mdevice lmdev = { .ops_lock = __MUTEX_INITIALIZER(lmdev.ops_lock), .mdev = { .minor = MISC_DYNAMIC_MINOR, .name = PRIMARY_LCD, .mode = 0600, .fops = &mdev_fops, }, }; struct lcd_tuning_dev *lcd_tuning_dev_register(struct lcd_properities *props, const struct lcd_tuning_ops *lcd_ops, void *devdata) { if(props) { lmdev.ltd.props = *props; } else /* Default to TFT with gamma2.5 */
.dma_dev = eAudioTx, }; static audio_stream_t input_stream = { .id = "TSC2101 in", .dma_dev = eAudioRx, }; static audio_state_t audio_state = { .output_stream = &output_stream, .input_stream = &input_stream, .need_tx_for_rx = 0, .hw_init = omap1610_audio_init, .hw_shutdown = omap1610_audio_shutdown, .client_ioctl = omap1610_audio_ioctl, .sem = __MUTEX_INITIALIZER(audio_state.sem), }; #define PAGE2_AUDIO_CODEC_REGISTERS 2 << 11 #define LEAVE_CS 0x80 #define REC_MASK (SOUND_MASK_LINE | SOUND_MASK_MIC) #define DEV_MASK (REC_MASK | SOUND_MASK_VOLUME) #define SET_VOLUME 1 #define SET_LINE 2 #define DEFAULT_VOLUME 100
.mh_intf_cfg1 = 0x00032f07, .mh_intf_cfg2 = 0x004b274f, /* turn off memory protection unit by setting acceptable physical address range to include all pages. */ .mpu_base = 0x00000000, .mpu_range = 0xFFFFF000, }, .mmu = { .config = Z180_MMU_CONFIG, }, .pwrctrl = { .regulator_name = "fs_gfx2d0", .irq_name = KGSL_2D0_IRQ, }, .mutex = __MUTEX_INITIALIZER(device_2d0.dev.mutex), .state = KGSL_STATE_INIT, .active_cnt = 0, .iomemname = KGSL_2D0_REG_MEMORY, .ftbl = &z180_functable, #if 0 #ifdef CONFIG_HAS_EARLYSUSPEND .display_off = { .level = EARLY_SUSPEND_LEVEL_STOP_DRAWING, .suspend = kgsl_early_suspend_driver, .resume = kgsl_late_resume_driver, }, #endif #endif }, };
/* empty - we don't allow anything to be created */ }; static struct config_item_type dtbocfg_root_type = { .ct_group_ops = &dtbocfg_root_ops, .ct_owner = THIS_MODULE, }; static struct configfs_subsystem dtbocfg_root_subsys = { .su_group = { .cg_item = { .ci_namebuf = "device-tree", .ci_type = &dtbocfg_root_type, }, }, .su_mutex = __MUTEX_INITIALIZER(dtbocfg_root_subsys.su_mutex), }; /** * dtbocfg_module_init() */ static int __init dtbocfg_module_init(void) { int retval = 0; pr_info("%s\n", __func__); config_group_init(&dtbocfg_root_subsys.su_group); config_group_init_type_name(&dtbocfg_overlay_group, "overlays", &dtbocfg_overlays_type); retval = configfs_register_subsystem(&dtbocfg_root_subsys);
*/ static int cpu_hotplug_disabled; #ifdef CONFIG_HOTPLUG_CPU static struct { struct task_struct *active_writer; struct mutex lock; /* Synchronizes accesses to refcount, */ /* * Also blocks the new readers during * an ongoing cpu hotplug operation. */ int refcount; } cpu_hotplug = { .active_writer = NULL, .lock = __MUTEX_INITIALIZER(cpu_hotplug.lock), .refcount = 0, }; void get_online_cpus(void) { might_sleep(); if (cpu_hotplug.active_writer == current) return; mutex_lock(&cpu_hotplug.lock); cpu_hotplug.refcount++; mutex_unlock(&cpu_hotplug.lock); } EXPORT_SYMBOL_GPL(get_online_cpus);
#include <linux/io.h> #include <linux/miscdevice.h> #include <linux/uaccess.h> #include <linux/device.h> #include "inputhub_route.h" #include "sensor_info.h" #include "sensor_debug.h" #include "rdr_sensorhub.h" #define MAX_STR_SIZE (1024) #define MAX_CMD_BUF_ARGC (64) static struct class *sensors_class = NULL; struct t_sensor_debug_operations_list sensor_debug_operations_list = { .mlock = __MUTEX_INITIALIZER(sensor_debug_operations_list.mlock), .head = LIST_HEAD_INIT(sensor_debug_operations_list.head), }; //to find tag by str static const struct sensor_debug_tag_map tag_map_tab[] = { {"accel", TAG_ACCEL}, {"magnitic", TAG_MAG}, {"gyro", TAG_GYRO}, {"als_light", TAG_ALS}, {"ps_promixy", TAG_PS}, {"linear_accel", TAG_LINEAR_ACCEL}, {"gravity", TAG_GRAVITY}, {"orientation", TAG_ORIENTATION}, {"rotationvector", TAG_ROTATION_VECTORS},