From 9d165ba58657d3d2972b0d4f5424390e17b56fe3 Mon Sep 17 00:00:00 2001 From: Jiyoung Jeong Date: Thu, 26 Jul 2018 18:28:00 +0900 Subject: [PATCH] [9610] dirvers: modem_if: Handling dsds from persist.radio.multisim.config Change-Id: I2d7880bac84daa8b242d2eda4576e95a32d2152a Signed-off-by: Jiyoung Jeong --- drivers/misc/modem_if/modem_io_device.c | 9 +++++++++ drivers/misc/modem_if/modem_main.c | 1 + .../modem_if/modem_modemctl_device_sh333ap.c | 19 +++++++++++++------ drivers/misc/modem_if/modem_prj.h | 3 +++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/misc/modem_if/modem_io_device.c b/drivers/misc/modem_if/modem_io_device.c index 70d91f910b54..522be7613436 100644 --- a/drivers/misc/modem_if/modem_io_device.c +++ b/drivers/misc/modem_if/modem_io_device.c @@ -976,11 +976,20 @@ static long misc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) char *buff; void __user *user_buff; unsigned long size; + int val; switch (cmd) { case IOCTL_MODEM_ON: if (mc->ops.modem_on) { mif_err("%s: IOCTL_MODEM_ON\n", iod->name); + if (arg) { + user_buff = (void __user *)arg; + + if (copy_from_user(&val, user_buff, sizeof(val))) + return -EFAULT; + + mc->sim_slot_cnt = val; + } return mc->ops.modem_on(mc); } mif_err("%s: !mc->ops.modem_on\n", iod->name); diff --git a/drivers/misc/modem_if/modem_main.c b/drivers/misc/modem_if/modem_main.c index 5e2ce8e84172..17eca257304e 100644 --- a/drivers/misc/modem_if/modem_main.c +++ b/drivers/misc/modem_if/modem_main.c @@ -121,6 +121,7 @@ static struct modem_ctl *create_modemctl_device(struct platform_device *pdev, modemctl->msd = msd; modemctl->dev = dev; modemctl->phone_state = STATE_OFFLINE; + modemctl->sim_slot_cnt = 1; modemctl->mdm_data = pdata; modemctl->name = pdata->name; diff --git a/drivers/misc/modem_if/modem_modemctl_device_sh333ap.c b/drivers/misc/modem_if/modem_modemctl_device_sh333ap.c index a9f406a36fd3..d91cb63df3cb 100755 --- a/drivers/misc/modem_if/modem_modemctl_device_sh333ap.c +++ b/drivers/misc/modem_if/modem_modemctl_device_sh333ap.c @@ -326,16 +326,23 @@ static int sh333ap_on(struct modem_ctl *mc) mif_err("get_hw_rev() ERROR\n"); } - ds_det = get_sim_socket_detection(np); - if (ds_det >= 0) { - mbox_update_value(MCU_CP, mbx_ap_status, ds_det, - sbi_ds_det_mask, sbi_ds_det_pos); + if (mc->sim_slot_cnt > 0) { + mbox_update_value(MCU_CP, mbx_ap_status, mc->sim_slot_cnt, + sbi_ds_det_mask, sbi_ds_det_pos); + mif_err("System sim config: %d\n", mc->sim_slot_cnt); } else { - mif_err("get_sim_socket_detection() ERROR\n"); + ds_det = get_sim_socket_detection(np); + + if (ds_det >= 0) { + mbox_update_value(MCU_CP, mbx_ap_status, ds_det, + sbi_ds_det_mask, sbi_ds_det_pos); + mif_err("SIM Socket Detection %d\n", ds_det); + } else { + mif_err("get_sim_socket_detection() ERROR\n"); + } } mif_err("System Revision %d\n", sys_rev); - mif_err("SIM Socket Detection %d\n", ds_det); spin_unlock_irqrestore(&mc->ap_status_lock, flags); diff --git a/drivers/misc/modem_if/modem_prj.h b/drivers/misc/modem_if/modem_prj.h index c1315d68ae64..a4a769158af8 100644 --- a/drivers/misc/modem_if/modem_prj.h +++ b/drivers/misc/modem_if/modem_prj.h @@ -738,6 +738,9 @@ struct modem_ctl { unsigned int gpio_reset_req_n; unsigned int gpio_cp_reset; + /* for checking number of usim slot by rild*/ + int sim_slot_cnt; + /* for broadcasting AP's PM state (active or sleep) */ unsigned int gpio_pda_active; unsigned int mbx_pda_active; -- 2.20.1