static ssize_t max77663_rtc_store_enablesmpl(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct max77663_rtc *rtc = dev_get_drvdata(dev); unsigned long val = simple_strtoul(buf, NULL, 10); int ret; char smplenable = 0; if(val == 0) //disable { smplenable = 1; } else //enable { smplenable = 0; } #ifdef CONFIG_MFD_MAX77663_SMPL_DEFAULT_ENABLE max77663_rtc_enable_smpl(rtc, !smplenable); #else max77663_rtc_enable_smpl(rtc, smplenable); #endif lge_nvdata_write(LGE_NVDATA_SMPL_EN_OFFSET, &smplenable,1); return count; }
static ssize_t max77663_rtc_store_smplcount(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned long val = simple_strtoul(buf, NULL, 10); int ret; if(val == 0) { char smplcount = 0; lge_nvdata_write(LGE_NVDATA_SMPL_COUNT_OFFSET, &smplcount,1); } return count; }
static ssize_t muic_proc_write(struct file *filp, const char *buf, size_t len, loff_t *off) { #if defined (CONFIG_MACH_BSSQ)|| defined (CONFIG_MACH_STAR) char nv_msg[1]; #endif #if 0 //[email protected] for Fixed char cmd; char nv_msg[1]; len = sscanf(buf, "%c", &cmd/*, &dummy*/); //[[email protected]] - what is dummy ? #else char messages[10]; s8 reg, val; char cmd; if (len > 12) len = 12; if (copy_from_user(messages, buf, len)) return -EFAULT; sscanf(buf, "%c %x %x", &cmd, ®, &val); #endif #if defined(CONFIG_LU6500) //port open for TI gpio_set_value(GPIO_CP_UART_SW, 0); gpio_set_value(GPIO_CP_USB_VBUS_EN, 0); muic_i2c_write_byte(SW_CONTROL, DP_OPEN | DM_OPEN); muic_i2c_write_byte(CONTROL_1, ID_200 | SEMREN | CP_EN); mdelay(1); #endif switch (cmd) { /* AP_UART mode*/ case '6' : retain_mode = RETAIN_AP_UART; muic_proc_set_ap_uart(); break; /* CP_UART mode*/ case '7' : retain_mode = RETAIN_CP_UART; muic_proc_set_cp_uart(); break; /* AP_USB mode*/ case '8' : retain_mode = RETAIN_AP_USB; boot_retain_mode = RETAIN_NO; muic_proc_set_ap_usb(); break; /* CP_USB mode*/ case '9' : retain_mode = RETAIN_CP_USB; muic_proc_set_cp_usb(); mdelay(20); break; #ifndef CP_RESET_TEST /* CP_DOWNLOAD mode*/ case '0' : retain_mode = RETAIN_CP_USB; case 'c' : muic_proc_set_cp_usb(); mdelay(1000); muic_cp_reset(); //mdelay(400); break; case 'q' : muic_cp_request(); break; case 'r' : muic_cp_reset(); break; #endif// #if defined(CONFIG_MUIC_RETAIN) /* Rebooting should be performed by HiddenMenu Application. */ case '1': retain_mode = RETAIN_NO; /* NO retain mode after reboot */ //set_misc_msg(msg_type_muic_path,retain_mode_str[NO_RETAIN], RETAIN_MODE_STR_LENGTH+1); nv_msg[0] = RETAIN_NO; #ifdef CONFIG_MACH_STAR lge_nvdata_write(LGE_NVDATA_MUIC_RETENTION_OFFSET, nv_msg, 1); #else lge_nvdata_write(LGE_NVDATA_MUIC_PATH_STR_OFFSET, "muic-path-none", 32); #endif break; case 'a' : /* AP USB retain mode after reboot */ //set_misc_msg(msg_type_muic_path,retain_mode_str[BOOT_AP_USB], RETAIN_MODE_STR_LENGTH+1); nv_msg[0] = RETAIN_AP_USB; #ifdef CONFIG_MACH_STAR lge_nvdata_write(LGE_NVDATA_MUIC_RETENTION_OFFSET, nv_msg, 1); #else lge_nvdata_write(LGE_NVDATA_MUIC_PATH_STR_OFFSET, "muic-path-ap", 32); #endif break; case 'b' : /* CP USB retain mode after reboot */ //set_misc_msg(msg_type_muic_path,retain_mode_str[BOOT_CP_USB], RETAIN_MODE_STR_LENGTH+1); nv_msg[0] = RETAIN_CP_USB; #ifdef CONFIG_MACH_STAR lge_nvdata_write(LGE_NVDATA_MUIC_RETENTION_OFFSET, nv_msg, 1); #else lge_nvdata_write(LGE_NVDATA_MUIC_PATH_STR_OFFSET,"muic-path-cp", 32); #endif break; #endif// #if defined (MUIC_SLEEP) case 'u': /* Just unlock the wakelock ! */ wake_lock_enable = 0; muic_wakeup_lock(); break; case 'l': /* Just lock the wakelock ! */ wake_lock_enable = 1; muic_wakeup_lock(); break; #endif #ifdef CONFIG_MACH_STAR #if defined (CONFIG_USIF) case 'y': //NvOdmGpioSetState(s_hMuicHandle.hGpio, s_hMuicHandle.h_USIF1_SW, DISABLE); printk("AP <==> CP uart connection\n"); gpio_set_value(USIF_IN_1_GPIO, 0); break; case 'x': //NvOdmGpioSetState(s_hMuicHandle.hGpio, s_hMuicHandle.h_USIF1_SW, ENABLE); printk("AP =\\= CP uart disconnection\n"); gpio_set_value(USIF_IN_1_GPIO, 1); break; #endif case 'n': printk("TA <==> DEVICE charger connection [%d] [%d]\n",g_half_charging_control,charging_mode); switch (g_half_charging_control) { case CHARGING_USB: charger_ic_set_mode_for_muic(CHARGER_USB500); break; case CHARGING_NA_TA: case CHARGING_LG_TA: case CHARGING_TA_1A: charger_ic_set_mode_for_muic(CHARGER_ISET); break; case CHARGING_FACTORY: // charger_ic_set_mode(CHARGER_FACTORY); break; case CHARGING_NONE: charger_ic_disable_for_muic(); break; default: charger_ic_disable_for_muic(); break; } break; case 'd': printk("TA =\\= DEVICE charger disconnection %d\n",charging_mode); g_half_charging_control=charging_mode; charger_ic_disable_for_muic(); break; case 'k': printk("######[MUIC] Boot complete check charger cable and update charging_mode %d\n",charging_mode); muic_send_charger_type(charging_mode); break; #endif default : DBG("[MUIC] LGE: ap20 MUIC invalid command: [cmd=%c] 6=AP_UART, 7=CP_UART, 8=AP_USB, 9=CP_USB\n", cmd); break; } check_charging_mode(); //check the charging mode, but NOT send to charger !!! return len; }