summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/char/shrm_char.c21
-rw-r--r--drivers/modem/shrm/shrm_protocol.c4
-rw-r--r--include/linux/modem/shrm/shrm_driver.h2
-rw-r--r--include/linux/modem/shrm/shrm_private.h1
4 files changed, 23 insertions, 5 deletions
diff --git a/drivers/char/shrm_char.c b/drivers/char/shrm_char.c
index fa44b469b98..e8f350e5da8 100644
--- a/drivers/char/shrm_char.c
+++ b/drivers/char/shrm_char.c
@@ -25,8 +25,8 @@
#define NAME "IPC_ISA"
-/* L2 header for ciq device is 0xc3 and hence 0xc3+1 = 196*/
-#define MAX_L2_HEADERS 196
+/* L2 header for rtc_calibration device is 0xC8 and hence 0xC8 + 1 = 201 */
+#define MAX_L2_HEADERS 201
#define SIZE_OF_FIFO (512*1024)
@@ -35,6 +35,7 @@ static u8 message_fifo[ISA_DEVICES][SIZE_OF_FIFO];
static u8 wr_rpc_msg[10*1024];
static u8 wr_sec_msg[10*1024];
static u8 wr_audio_msg[10*1024];
+static u8 wr_rtc_cal_msg[100];
struct map_device {
u8 l2_header;
@@ -50,6 +51,7 @@ static struct map_device map_dev[] = {
{COMMON_LOOPBACK_MESSAGING, 4, "common_loopback"},
{AUDIO_LOOPBACK_MESSAGING, 5, "audio_loopback"},
{CIQ_MESSAGING, 6, "ciq"},
+ {RTC_CAL_MESSAGING, 7, "rtc_calibration"},
};
/*
@@ -488,6 +490,10 @@ ssize_t isa_write(struct file *filp, const char __user *buf,
dev_dbg(shrm->dev, "CIQ\n");
addr = isadev->addr;
break;
+ case RTC_CAL_MESSAGING:
+ dev_dbg(shrm->dev, "isa_write(): RTC Calibration\n");
+ addr = (void *)wr_rtc_cal_msg;
+ break;
default:
dev_dbg(shrm->dev, "Wrong device\n");
return -EFAULT;
@@ -612,6 +618,7 @@ static int isa_close(struct inode *inode, struct file *filp)
idx = shrm_get_cdev_index(m);
if (idx < 0) {
dev_err(shrm->dev, "failed to get index\n");
+ mutex_unlock(&isa_lock);
return idx;
}
dev_dbg(shrm->dev, "isa_close %d", m);
@@ -646,6 +653,9 @@ static int isa_close(struct inode *inode, struct file *filp)
kfree(isadev->addr);
dev_info(shrm->dev, "Close CIQ_MESSAGING Device\n");
break;
+ case RTC_CAL_MESSAGING:
+ dev_info(shrm->dev, "Close RTC_CAL_MESSAGING Device\n");
+ break;
default:
dev_info(shrm->dev, "No such device present\n");
mutex_unlock(&isa_lock);
@@ -693,7 +703,8 @@ static int isa_open(struct inode *inode, struct file *filp)
(m != COMMON_LOOPBACK_MESSAGING) &&
(m != AUDIO_MESSAGING) &&
(m != SECURITY_MESSAGING) &&
- (m != CIQ_MESSAGING)) {
+ (m != CIQ_MESSAGING) &&
+ (m != RTC_CAL_MESSAGING)) {
dev_err(shrm->dev, "No such device present\n");
mutex_unlock(&isa_lock);
return -ENODEV;
@@ -701,6 +712,7 @@ static int isa_open(struct inode *inode, struct file *filp)
idx = shrm_get_cdev_index(m);
if (idx < 0) {
dev_err(shrm->dev, "failed to get index\n");
+ mutex_unlock(&isa_lock);
return idx;
}
if (!atomic_dec_and_test(&isa_context->is_open[idx])) {
@@ -747,6 +759,9 @@ static int isa_open(struct inode *inode, struct file *filp)
}
dev_info(shrm->dev, "Open CIQ_MESSAGING Device\n");
break;
+ case RTC_CAL_MESSAGING:
+ dev_info(shrm->dev, "Open RTC_CAL_MESSAGING Device\n");
+ break;
};
mutex_unlock(&isa_lock);
diff --git a/drivers/modem/shrm/shrm_protocol.c b/drivers/modem/shrm/shrm_protocol.c
index 7f168ae278f..6cc6e347188 100644
--- a/drivers/modem/shrm/shrm_protocol.c
+++ b/drivers/modem/shrm/shrm_protocol.c
@@ -29,6 +29,7 @@
#define L2_HEADER_AUDIO_SIMPLE_LOOPBACK 0x80
#define L2_HEADER_AUDIO_ADVANCED_LOOPBACK 0x81
#define L2_HEADER_CIQ 0xC3
+#define L2_HEADER_RTC_CALIBRATION 0xC8
#define MAX_PAYLOAD 1024
#define PRCM_HOSTACCESS_REQ 0x334
@@ -1056,7 +1057,8 @@ int shm_write_msg(struct shrm_dev *shrm, u8 l2_header,
(l2_header == L2_HEADER_SECURITY) ||
(l2_header == L2_HEADER_COMMON_SIMPLE_LOOPBACK) ||
(l2_header == L2_HEADER_COMMON_ADVANCED_LOOPBACK) ||
- (l2_header == L2_HEADER_CIQ)) {
+ (l2_header == L2_HEADER_CIQ) ||
+ (l2_header == L2_HEADER_RTC_CALIBRATION)) {
channel = 0;
if (shrm_common_tx_state == SHRM_SLEEP_STATE)
shrm_common_tx_state = SHRM_PTR_FREE;
diff --git a/include/linux/modem/shrm/shrm_driver.h b/include/linux/modem/shrm/shrm_driver.h
index 081dfd111e4..96b5c594d34 100644
--- a/include/linux/modem/shrm/shrm_driver.h
+++ b/include/linux/modem/shrm/shrm_driver.h
@@ -25,7 +25,7 @@
#include <linux/cdev.h>
#include <linux/kthread.h>
-#define ISA_DEVICES 7
+#define ISA_DEVICES 8
#define BOOT_INIT (0)
#define BOOT_INFO_SYNC (1)
diff --git a/include/linux/modem/shrm/shrm_private.h b/include/linux/modem/shrm/shrm_private.h
index 888a7c200fd..23caabf5a06 100644
--- a/include/linux/modem/shrm/shrm_private.h
+++ b/include/linux/modem/shrm/shrm_private.h
@@ -47,6 +47,7 @@
#define COMMON_LOOPBACK_MESSAGING (0xC0)
#define AUDIO_LOOPBACK_MESSAGING (0x80)
#define CIQ_MESSAGING (0xC3)
+#define RTC_CAL_MESSAGING (0xC8)
#define COMMON_CHANNEL 0
#define AUDIO_CHANNEL 1