#include <linux/amlogic/pm.h>
#include <linux/amlogic/cpu_version.h>
#include <linux/amlogic/jtag.h>
+#include <linux/amlogic/scpi_protocol.h>
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
/* default enable all function*/
cec_config(CEC_FUNC_CFG_ALL, 1);
queue_delayed_work(cec_dev->cec_thread, &cec_dev->cec_work, 0);
- CEC_ERR("boot:%#x;%#x\n", *((unsigned int *)&cec_dev->wakup_data),
- cec_dev->wakeup_reason);
+ scpi_get_wakeup_reason(&cec_dev->wakeup_reason);
+ CEC_ERR("wakeup_reason:0x%x\n", cec_dev->wakeup_reason);
+ scpi_get_cec_val(SCPI_CMD_GET_CEC1,
+ (unsigned int *)&cec_dev->wakup_data);
+ scpi_get_cec_val(SCPI_CMD_GET_CEC2, &r);
+ CEC_ERR("cev val1: %#x;val2: %#x\n",
+ *((unsigned int *)&cec_dev->wakup_data), r);
CEC_ERR("%s success end\n", __func__);
return 0;
static int aml_cec_resume_noirq(struct device *dev)
{
int ret = 0;
+ unsigned int temp;
CEC_INFO("cec resume noirq!\n");
+
+ cec_dev->cec_info.power_status = TRANS_STANDBY_TO_ON;
+
+ scpi_get_wakeup_reason(&cec_dev->wakeup_reason);
+ CEC_ERR("wakeup_reason:0x%x\n", cec_dev->wakeup_reason);
+
+ scpi_get_cec_val(SCPI_CMD_GET_CEC1,
+ (unsigned int *)&cec_dev->wakup_data);
+ scpi_get_cec_val(SCPI_CMD_GET_CEC2, &temp);
+ CEC_ERR("cev val1: %#x;val2: %#x\n",
+ *((unsigned int *)&cec_dev->wakup_data),
+ temp);
+
cec_dev->cec_info.power_status = TRANS_STANDBY_TO_ON;
cec_dev->cec_suspend = CEC_POWER_RESUME;
if (!IS_ERR(cec_dev->dbg_dev->pins->default_state))
SCPI_CMD_GET_PSU,
SCPI_CMD_SENSOR_CFG_PERIODIC,
SCPI_CMD_SENSOR_CFG_BOUNDS,
+ SCPI_CMD_WAKEUP_REASON_GET,
+ SCPI_CMD_WAKEUP_REASON_CLR,
};
static struct scpi_dvfs_info *scpi_opps[MAX_DVFS_DOMAINS];
return ret;
}
EXPORT_SYMBOL_GPL(scpi_get_ring_value);
+
+int scpi_get_wakeup_reason(u32 *wakeup_reason)
+{
+ struct scpi_data_buf sdata;
+ struct mhu_data_buf mdata;
+ u32 temp = 0;
+ struct __packed {
+ u32 status;
+ u32 reason;
+ } buf;
+
+ SCPI_SETUP_DBUF(sdata, mdata, SCPI_CL_NONE,
+ SCPI_CMD_WAKEUP_REASON_GET, temp, buf);
+ if (scpi_execute_cmd(&sdata))
+ return -EPERM;
+
+ *wakeup_reason = buf.reason;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(scpi_get_wakeup_reason);
+
+int scpi_clr_wakeup_reason(void)
+{
+ struct scpi_data_buf sdata;
+ struct mhu_data_buf mdata;
+ u32 temp = 0, state;
+
+ SCPI_SETUP_DBUF(sdata, mdata, SCPI_CL_NONE,
+ SCPI_CMD_WAKEUP_REASON_CLR, temp, state);
+ if (scpi_execute_cmd(&sdata))
+ return -EPERM;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(scpi_clr_wakeup_reason);
+
+int scpi_get_cec_val(enum scpi_std_cmd index, u32 *p_cec)
+{
+ struct scpi_data_buf sdata;
+ struct mhu_data_buf mdata;
+ u32 temp = 0;
+ struct __packed {
+ u32 status;
+ u32 cec_val;
+ } buf;
+
+ SCPI_SETUP_DBUF(sdata, mdata, SCPI_CL_NONE,
+ index, temp, buf);
+ if (scpi_execute_cmd(&sdata))
+ return -EPERM;
+
+ *p_cec = buf.cec_val;
+ return 0;
+
+}
+EXPORT_SYMBOL_GPL(scpi_get_cec_val);
+
SCPI_CMD_SENSOR_ASYNC_VALUE = 0x1f,
SCPI_CMD_SET_USR_DATA = 0x20,
SCPI_CMD_OSCRING_VALUE = 0x43,
+ SCPI_CMD_WAKEUP_REASON_GET = 0x30,
+ SCPI_CMD_WAKEUP_REASON_CLR = 0X31,
+ SCPI_CMD_GET_CEC1 = 0xB4,
+ SCPI_CMD_GET_CEC2 = 0xB5,
SCPI_CMD_COUNT
};
int scpi_get_vrtc(u32 *p_vrtc);
int scpi_set_vrtc(u32 vrtc_val);
int scpi_get_ring_value(unsigned char *val);
+int scpi_get_wakeup_reason(u32 *wakeup_reason);
+int scpi_clr_wakeup_reason(void);
+int scpi_get_cec_val(enum scpi_std_cmd index, u32 *p_cec);
#endif /*_SCPI_PROTOCOL_H_*/