static ssize_t max77663_rtc_show_smplcount(struct device *dev, struct device_attribute *attr, char *buf) { char smplcount = 0; lge_nvdata_read(LGE_NVDATA_SMPL_COUNT_OFFSET, &smplcount,1); return sprintf(buf, "%d\n", smplcount); }
//RIP-73256 : [X3] CTS issue : permission error - byeonggeun.kim [START] static int lge_is_ril_recovery_mode_enabled() { char data[2] = {0x00,0x00}; lge_nvdata_read(LGE_NVDATA_RIL_RECOVERY_MODE_OFFSET,data,1); msleep(100); if(data[0] == 0x01) return 1; else return 0; }
static int lge_is_crash_dump_enabled() { char data[2] = {0x00,0x00}; lge_nvdata_read(LGE_NVDATA_CRASH_DUMP_OFFSET,data,1); msleep(100); if(data[0] == LGE_NDATA_CRASH_DUMP_ENABLE_VALUE) return 1; else return 0; }
static ssize_t max77663_rtc_show_enablesmpl(struct device *dev, struct device_attribute *attr, char *buf) { char smplenable = 0; lge_nvdata_read(LGE_NVDATA_SMPL_EN_OFFSET, &smplenable,1); if(smplenable == 0) //enable { smplenable = 1; } else //disable { smplenable = 0; } return sprintf(buf, "%d\n", smplenable); }
static int max77663_rtc_preinit(struct max77663_rtc *rtc) { struct device *parent = _to_parent(rtc); u8 val; int ret; /* Mask all interrupts */ #ifdef CONFIG_MFD_MAX77663_SMPL u8 smpl_enable = 0; #if 1 smpl_enable = max77663_smpl_status; #else lge_nvdata_read(LGE_NVDATA_SMPL_EN_OFFSET, &smpl_enable,1); #endif #ifdef CONFIG_MFD_MAX77663_SMPL_DEFAULT_ENABLE if(!smpl_enable) #else if(smpl_enable) #endif { rtc->irq_mask = 0xF7; } else { rtc->irq_mask = 0xFF; } #endif //rtc->irq_mask = 0x1C; //0x1D; // max77663_rtc_do_irq RTCA1M ret = max77663_rtc_write(rtc, MAX77663_RTC_IRQ_MASK, &rtc->irq_mask, 1, 0); if (ret < 0) { dev_err(rtc->dev, "preinit: Failed to set rtc irq mask\n"); return ret; } /* Configure Binary mode and 24hour mode */ val = HR_MODE_MASK; ret = max77663_rtc_write(rtc, MAX77663_RTC_CTRL, &val, 1, 0); if (ret < 0) { dev_err(rtc->dev, "preinit: Failed to set rtc control\n"); return ret; } #ifdef CONFIG_MFD_MAX77663_SMPL #ifdef CONFIG_MFD_MAX77663_SMPL_DEFAULT_ENABLE max77663_rtc_enable_smpl(rtc, !smpl_enable); #else max77663_rtc_enable_smpl(rtc, smpl_enable); #endif #endif /* It should be disabled alarm wakeup to wakeup from sleep * by EN1 input signal */ ret = max77663_set_bits(parent, MAX77663_REG_ONOFF_CFG2, ONOFF_WK_ALARM1_MASK, 0, 0); if (ret < 0) { dev_err(rtc->dev, "preinit: Failed to set onoff cfg2\n"); return ret; } return 0; }