aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Shields <simon@lineageos.org>2018-03-26 22:43:36 +0000
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2019-07-17 15:57:54 +0200
commitcee09b249afd19e15a2895dd311e112eea684787 (patch)
tree4590ee0e34570c7179c415e151ac5cb937247e4b
parent6f530eb4da3bb98cd67396e3b9156227dc2577ac (diff)
downloadhardware_replicant_libsamsung-ipc-cee09b249afd19e15a2895dd311e112eea684787.tar.gz
hardware_replicant_libsamsung-ipc-cee09b249afd19e15a2895dd311e112eea684787.tar.bz2
hardware_replicant_libsamsung-ipc-cee09b249afd19e15a2895dd311e112eea684787.zip
Add generic xmm626 modem for mainline Linux
TODO: - Refactor send_command to work with MIPI - More code cleanups GNUtoo@cyberdimension.org: [rebase, fixes and cleanups] Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--Android.mk3
-rw-r--r--samsung-ipc/Makefile.am9
-rw-r--r--samsung-ipc/ipc.c12
-rw-r--r--samsung-ipc/ipc.h8
-rw-r--r--samsung-ipc/modems/generic-xmm626/generic-xmm626_hsic.c127
-rw-r--r--samsung-ipc/modems/generic-xmm626/generic-xmm626_hsic.h31
-rw-r--r--samsung-ipc/modems/generic-xmm626/generic-xmm626_sec_modem.c258
-rw-r--r--samsung-ipc/modems/generic-xmm626/generic-xmm626_sec_modem.h52
-rw-r--r--samsung-ipc/modems/xmm626/xmm626_hsic.c22
-rw-r--r--samsung-ipc/modems/xmm626/xmm626_hsic.h3
-rw-r--r--samsung-ipc/modems/xmm626/xmm626_mipi.h2
11 files changed, 519 insertions, 8 deletions
diff --git a/Android.mk b/Android.mk
index 72bc510..c07789c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -53,6 +53,8 @@ libsamsung_ipc_local_src_files := \
samsung-ipc/ipc.c \
samsung-ipc/ipc_devices.c \
samsung-ipc/ipc_utils.c \
+ samsung-ipc/modems/generic-xmm626/generic-xmm626_hsic.c \
+ samsung-ipc/modems/generic-xmm626/generic-xmm626_sec_modem.c \
samsung-ipc/modems/xmm616/xmm616.c \
samsung-ipc/modems/xmm626/xmm626.c \
samsung-ipc/modems/xmm626/xmm626_hsic.c \
@@ -80,6 +82,7 @@ libsamsung_ipc_local_src_files := \
libsamsung_ipc_local_c_includes := \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/samsung-ipc \
+ $(LOCAL_PATH)/samsung-ipc/modems/generic-xmm626/ \
$(LOCAL_PATH)/samsung-ipc/modems/xmm616/ \
$(LOCAL_PATH)/samsung-ipc/modems/xmm626/ \
external/openssl/include
diff --git a/samsung-ipc/Makefile.am b/samsung-ipc/Makefile.am
index 6ab058d..def4a23 100644
--- a/samsung-ipc/Makefile.am
+++ b/samsung-ipc/Makefile.am
@@ -3,6 +3,7 @@ NULL =
AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/samsung-ipc \
+ -I$(top_srcdir)/samsung-ipc/modems/generic-xmm626 \
-I$(top_srcdir)/samsung-ipc/modems/xmm616 \
-I$(top_srcdir)/samsung-ipc/modems/xmm626 \
$(OPENSSL_CFLAGS) \
@@ -22,6 +23,14 @@ libsamsung_ipc_la_SOURCES = \
ipc_devices.c \
ipc_devices.h \
ipc_utils.c \
+ modems/generic-xmm626/generic-xmm626.h \
+ modems/generic-xmm626/generic-xmm626_hsic.c \
+ modems/generic-xmm626/generic-xmm626_hsic.h \
+ modems/generic-xmm626/generic-xmm626_sec_modem.c \
+ modems/generic-xmm626/generic-xmm626_sec_modem.h \
+ modems/generic-xmm626/modem.h \
+ modems/generic-xmm626/modem_link_device_hsic.h \
+ modems/generic-xmm626/modem_prj.h \
modems/xmm616/xmm616.c \
modems/xmm616/xmm616.h \
modems/xmm626/xmm626.c \
diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c
index f7e0379..9e786bd 100644
--- a/samsung-ipc/ipc.c
+++ b/samsung-ipc/ipc.c
@@ -365,6 +365,18 @@ int ipc_client_poll(struct ipc_client *client, struct ipc_poll_fds *fds, struct
return client->handlers->poll(client->handlers->transport_data, fds, timeout);
}
+int ipc_client_send_command(struct ipc_client *client, void *transport_data,
+ int device_fd, unsigned short code,
+ const void *data, size_t size,
+ size_t command_data_size, int ack)
+{
+ if (client == NULL || client->handlers == NULL || client->handlers->power_on == NULL)
+ return -1;
+
+ return client->handlers->send_command(transport_data, device_fd, code, data, size,
+ command_data_size, ack);
+}
+
int ipc_client_power_on(struct ipc_client *client)
{
if (client == NULL || client->handlers == NULL || client->handlers->power_on == NULL)
diff --git a/samsung-ipc/ipc.h b/samsung-ipc/ipc.h
index 60fca12..29681a8 100644
--- a/samsung-ipc/ipc.h
+++ b/samsung-ipc/ipc.h
@@ -44,6 +44,9 @@ struct ipc_client_handlers {
int (*read)(void *transport_data, void *buffer, size_t length);
int (*write)(void *transport_data, const void *buffer, size_t length);
int (*poll)(void *transport_data, struct ipc_poll_fds *fds, struct timeval *timeout);
+ int (*send_command)(void *transport_data,
+ int device_fd, unsigned short code,
+ const void *data, size_t size, size_t command_data_size, int ack);
void *transport_data;
@@ -95,6 +98,11 @@ struct ipc_client {
* Helpers
*/
+int ipc_client_send_command(struct ipc_client *client, void *transport_data,
+ int device_fd, unsigned short code,
+ const void *data, size_t size,
+ size_t command_data_size, int ack);
+
void ipc_client_log(struct ipc_client *client, const char *message, ...);
#endif
diff --git a/samsung-ipc/modems/generic-xmm626/generic-xmm626_hsic.c b/samsung-ipc/modems/generic-xmm626/generic-xmm626_hsic.c
new file mode 100644
index 0000000..b33a9e7
--- /dev/null
+++ b/samsung-ipc/modems/generic-xmm626/generic-xmm626_hsic.c
@@ -0,0 +1,127 @@
+/*
+ * This file is part of libsamsung-ipc.
+ *
+ * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * Based on the incomplete C++ implementation which is:
+ * Copyright (C) 2012 Sergey Gridasov <grindars@gmail.com>
+ *
+ * libsamsung-ipc is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libsamsung-ipc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/select.h>
+
+#include <samsung-ipc.h>
+
+#include "../xmm626/xmm626.h"
+#include "../xmm626/xmm626_hsic.h"
+
+int generic_xmm626_hsic_command_send(__attribute__((unused)) void *transport_data,
+ int device_fd, unsigned short code,
+ const void *data, size_t size,
+ size_t command_data_size, int ack)
+{
+ struct xmm626_hsic_command_header header;
+ void *buffer = NULL;
+ size_t length;
+ struct timeval timeout;
+ fd_set fds;
+ unsigned char *p;
+ int rc;
+ int i;
+
+ if (device_fd < 0 || data == NULL || size == 0 || command_data_size == 0 || command_data_size < size)
+ return -1;
+
+ header.checksum = (size & 0xffff) + code;
+ header.code = code;
+ header.data_size = size;
+
+ p = (unsigned char *) data;
+
+ for (i = 0; i < (int) size; i++)
+ header.checksum += *p++;
+
+ length = command_data_size + sizeof(header);
+ buffer = calloc(1, length);
+
+ memset(buffer, 0, length);
+ p = (unsigned char *) buffer;
+ memcpy(p, &header, sizeof(header));
+ p += sizeof(header);
+ memcpy(p, data, size);
+
+ rc = write(device_fd, buffer, length);
+ if (rc < (int) length)
+ goto error;
+
+ if (!ack) {
+ rc = 0;
+ goto complete;
+ }
+
+ memset(buffer, 0, length);
+
+ FD_ZERO(&fds);
+ FD_SET(device_fd, &fds);
+
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
+ if (rc <= 0)
+ goto error;
+
+ rc = read(device_fd, &header, sizeof(header));
+ if (rc < (int) sizeof(header)) {
+ printf("got no header\n");
+ goto error;
+ }
+
+ rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
+ if (rc <= 0) {
+ printf("select failed\n");
+ goto error;
+ }
+
+ rc = read(device_fd, buffer, command_data_size);
+ if (rc < (int) command_data_size) {
+ printf("not enough read\n");
+ goto error;
+ }
+
+ if (header.code != code) {
+ printf("header code mismatch");
+ goto error;
+ }
+
+ rc = 0;
+ goto complete;
+
+error:
+ rc = -1;
+
+complete:
+ if (buffer != NULL)
+ free(buffer);
+
+ return rc;
+}
+
+// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/modems/generic-xmm626/generic-xmm626_hsic.h b/samsung-ipc/modems/generic-xmm626/generic-xmm626_hsic.h
new file mode 100644
index 0000000..a31cf96
--- /dev/null
+++ b/samsung-ipc/modems/generic-xmm626/generic-xmm626_hsic.h
@@ -0,0 +1,31 @@
+/*
+ * This file is part of libsamsung-ipc.
+ *
+ * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * libsamsung-ipc is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libsamsung-ipc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GENERIC_XMM626_HSIC_H__
+#define __GENERIC_XMM626_HSIC_H__
+
+int generic_xmm626_hsic_command_send(
+ __attribute__((unused)) void *transport_data,
+ int device_fd, unsigned short code, const void *data, size_t size,
+ size_t command_data_size, int ack);
+
+#endif /* __GENERIC_XMM626_HSIC_H__ */
+
+// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/modems/generic-xmm626/generic-xmm626_sec_modem.c b/samsung-ipc/modems/generic-xmm626/generic-xmm626_sec_modem.c
new file mode 100644
index 0000000..b2dfc7c
--- /dev/null
+++ b/samsung-ipc/modems/generic-xmm626/generic-xmm626_sec_modem.c
@@ -0,0 +1,258 @@
+/*
+ * This file is part of libsamsung-ipc.
+ *
+ * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * libsamsung-ipc is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libsamsung-ipc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define _GNU_SOURCE
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/select.h>
+
+#include <samsung-ipc.h>
+#include <ipc.h>
+
+#include "../xmm626/modem.h"
+#include "../xmm626/modem_prj.h"
+#include "../xmm626/modem_link_device_hsic.h"
+#include "../xmm626/xmm626.h"
+
+#include "generic-xmm626_sec_modem.h"
+
+int generic_xmm626_sec_modem_power(__attribute__((unused)) int device_fd, int power)
+{
+ int rc;
+
+ rc = sysfs_value_write(GENERIC_XMM626_SEC_MODEM_POWER_PATH, !!power);
+ if (rc < 0)
+ return -1;
+
+ return 0;
+}
+
+int generic_xmm626_sec_modem_boot_power(int device_fd, int power)
+{
+ int rc;
+
+ if (device_fd < 0)
+ return -1;
+
+ rc = sysfs_value_write(GENERIC_XMM626_SEC_MODEM_POWER_PATH, !!power);
+ if (rc < 0)
+ return -1;
+
+ return 0;
+}
+
+int generic_xmm626_sec_modem_hci_power(int power)
+{
+ int ehci_rc, ohci_rc = -1;
+
+
+ /*ohci_rc = sysfs_value_write(XMM626_SEC_MODEM_OHCI_POWER_SYSFS, !!power);
+ if (ohci_rc >= 0)
+ usleep(50000);
+*/
+
+ if (!!power) {
+ ohci_rc = sysfs_value_write(GENERIC_XMM626_SEC_MODEM_PDA_ACTIVE_SYSFS, 1);
+ if (sysfs_value_read(GENERIC_XMM626_SEC_HOSTWAKE_PATH)) {
+ ohci_rc |= sysfs_value_write(GENERIC_XMM626_SEC_MODEM_SLAVEWAKE_SYSFS, 0);
+ usleep(10000);
+ ohci_rc |= sysfs_value_write(GENERIC_XMM626_SEC_MODEM_SLAVEWAKE_SYSFS, 1);
+ }
+ ehci_rc = sysfs_value_write(GENERIC_XMM626_SEC_MODEM_EHCI_POWER_SYSFS, !!power);
+ if (ehci_rc >= 0)
+ usleep(50000);
+
+ ohci_rc |= sysfs_value_write(GENERIC_XMM626_SEC_LINK_ACTIVE_PATH, 1);
+ } else {
+ ehci_rc = sysfs_value_write(GENERIC_XMM626_SEC_MODEM_EHCI_POWER_SYSFS, !!power);
+ if (ehci_rc >= 0)
+ usleep(50000);
+
+ //ohci_rc = sysfs_value_write(GENERIC_XMM626_SEC_MODEM_PDA_ACTIVE_SYSFS, 0);
+ ohci_rc = sysfs_value_write(GENERIC_XMM626_SEC_LINK_ACTIVE_PATH, 0);
+ }
+
+
+ if (ohci_rc < 0) {
+ printf("ohci_rc < 0\n");
+ }
+ if (ehci_rc < 0 && ohci_rc < 0)
+ return -1;
+
+ return 0;
+}
+
+int generic_xmm626_sec_modem_link_control_enable(__attribute__((unused)) int device_fd,
+ int enable)
+{
+ if (enable) {
+ }
+ return 0;
+}
+
+int generic_xmm626_sec_modem_link_control_active(__attribute__((unused)) int device_fd,
+ int active)
+{
+ int rc;
+
+ rc = sysfs_value_write(GENERIC_XMM626_SEC_LINK_ACTIVE_PATH, !!active);
+ if (rc < 0)
+ return -1;
+
+ return 0;
+}
+
+int generic_xmm626_sec_modem_link_connected_wait(__attribute__((unused)) int device_fd)
+{
+ int i;
+
+ i = 0;
+ for (i = 0; i < 10; i++) {
+
+ usleep(50000);
+ }
+
+ return 0;
+}
+
+int generic_xmm626_sec_modem_link_get_hostwake_wait(
+ __attribute__((unused)) int device_fd)
+{
+ int status;
+ int i;
+
+ i = 0;
+ for (i = 0; i < 10; i++) {
+ /* !gpio_get_value (hostwake) */
+ status = sysfs_value_read(GENERIC_XMM626_SEC_HOSTWAKE_PATH);
+ if (status == 0) /* invert: return true when hostwake is low */
+ return 0;
+
+ usleep(50000);
+ }
+
+ return -1;
+}
+
+int generic_xmm626_sec_modem_fmt_send(struct ipc_client *client,
+ struct ipc_message *message)
+{
+ struct ipc_fmt_header header;
+ void *buffer;
+ size_t length;
+ size_t count;
+ unsigned char *p;
+ int rc;
+
+ if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || message == NULL)
+ return -1;
+
+ ipc_fmt_header_setup(&header, message);
+
+ length = header.length;
+ buffer = calloc(1, length);
+
+ memcpy(buffer, &header, sizeof(struct ipc_fmt_header));
+ if (message->data != NULL && message->size > 0)
+ memcpy((void *) ((unsigned char *) buffer + sizeof(struct ipc_fmt_header)), message->data, message->size);
+
+ ipc_client_log_send(client, message, __func__);
+
+ p = (unsigned char *) buffer;
+
+ count = 0;
+ while (count < length) {
+ rc = client->handlers->write(client->handlers->transport_data, p, length - count);
+ if (rc <= 0) {
+ ipc_client_log(client, "Writing FMT data failed");
+ goto error;
+ }
+
+ count += rc;
+ p += rc;
+ }
+
+ rc = 0;
+ goto complete;
+
+error:
+ rc = -1;
+
+complete:
+ if (buffer != NULL)
+ free(buffer);
+
+ return rc;
+}
+
+int generic_xmm626_sec_modem_open(int type)
+{
+ int fd = -1;
+ int i = 0;
+
+ while (fd < 0 && i < 30) {
+ i++;
+ usleep(30000);
+ switch (type) {
+ case IPC_CLIENT_TYPE_FMT:
+ printf("%s: %d %d\n", GENERIC_XMM626_SEC_MODEM_IPC0_DEVICE, fd, errno);
+ fd = open(GENERIC_XMM626_SEC_MODEM_IPC0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
+ break;
+ case IPC_CLIENT_TYPE_RFS:
+ fd = open(GENERIC_XMM626_SEC_MODEM_RFS0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
+ printf("%s: %d %d\n", GENERIC_XMM626_SEC_MODEM_RFS0_DEVICE, fd, errno);
+ break;
+ default:
+ printf("unknown type\n");
+ return -1;
+ }
+ }
+
+ return fd;
+}
+
+int generic_xmm626_sec_modem_read(int fd, void *buffer, size_t length)
+{
+ int rc;
+
+ if (fd < 0 || buffer == NULL || length <= 0)
+ return -1;
+
+ rc = read(fd, buffer, length);
+
+ return rc;
+}
+
+int generic_xmm626_sec_modem_write(int fd, const void *buffer, size_t length)
+{
+ int rc;
+
+ if (fd < 0 || buffer == NULL || length <= 0)
+ return -1;
+
+ rc = write(fd, buffer, length);
+
+ return rc;
+}
diff --git a/samsung-ipc/modems/generic-xmm626/generic-xmm626_sec_modem.h b/samsung-ipc/modems/generic-xmm626/generic-xmm626_sec_modem.h
new file mode 100644
index 0000000..5360a14
--- /dev/null
+++ b/samsung-ipc/modems/generic-xmm626/generic-xmm626_sec_modem.h
@@ -0,0 +1,52 @@
+/*
+ * This file is part of libsamsung-ipc.
+ *
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * libsamsung-ipc is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libsamsung-ipc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GENERIC_XMM626_SEC_MODEM_H__
+#define __GENERIC_XMM626_SEC_MODEM_H__
+
+#define GENERIC_XMM626_SEC_MODEM_BOOT0_DEVICE "/dev/xmm6262_boot0"
+#define GENERIC_XMM626_SEC_MODEM_IPC0_DEVICE "/dev/umts_ipc"
+#define GENERIC_XMM626_SEC_MODEM_RFS0_DEVICE "/dev/umts_rfs"
+#define GENERIC_XMM626_SEC_MODEM_LINK_PM_DEVICE "/dev/link_pm"
+#define GENERIC_XMM626_SEC_MODEM_EHCI_POWER_SYSFS "/sys/devices/platform/soc/12580000.ehci/ehci_power"
+#define GENERIC_XMM626_SEC_HOSTWAKE_PATH "/sys/devices/platform/xmm6262/hostwake"
+#define GENERIC_XMM626_SEC_LINK_ACTIVE_PATH "/sys/devices/platform/xmm6262/link_active"
+#define GENERIC_XMM626_SEC_MODEM_POWER_PATH "/sys/devices/platform/xmm6262/modem_power"
+#define GENERIC_XMM626_SEC_MODEM_PDA_ACTIVE_SYSFS "/sys/devices/platform/xmm6262/pda_active"
+#define GENERIC_XMM626_SEC_MODEM_SLAVEWAKE_SYSFS "/sys/devices/platform/xmm6262/slavewake"
+//#define GENERIC_XMM626_SEC_MODEM_OHCI_POWER_SYSFS "/sys/devices/platform/s5p-ohci/ohci_power"
+
+int generic_xmm626_sec_modem_link_control_enable(int device_fd, int enable);
+int generic_xmm626_sec_modem_fmt_send(struct ipc_client *client,
+ struct ipc_message *message);
+int generic_xmm626_sec_modem_fmt_send(struct ipc_client *client,
+ struct ipc_message *message);
+int generic_xmm626_sec_modem_power(__attribute__((unused)) int device_fd, int power);
+int generic_xmm626_sec_modem_hci_power(int power);
+int generic_xmm626_sec_modem_link_connected_wait(__attribute__((unused)) int device_fd);
+int generic_xmm626_sec_modem_link_get_hostwake_wait(__attribute__((unused)) int device_fd);
+int generic_xmm626_sec_modem_link_control_active(__attribute__((unused)) int device_fd,
+ int active);
+int generic_xmm626_sec_modem_open(int type);
+int generic_xmm626_sec_modem_read(int fd, void *buffer, size_t length);
+int generic_xmm626_sec_modem_write(int fd, const void *buffer, size_t length);
+
+#endif /* __GENERIC_XMM626_SEC_MODEM_H__ */
+
+// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/modems/xmm626/xmm626_hsic.c b/samsung-ipc/modems/xmm626/xmm626_hsic.c
index 30ade46..446b9c6 100644
--- a/samsung-ipc/modems/xmm626/xmm626_hsic.c
+++ b/samsung-ipc/modems/xmm626/xmm626_hsic.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <sys/select.h>
+#include <ipc.h>
#include <samsung-ipc.h>
#include "xmm626.h"
@@ -302,8 +303,10 @@ complete:
return rc;
}
-int xmm626_hsic_command_send(int device_fd, unsigned short code,
- const void *data, size_t size, size_t command_data_size, int ack)
+int xmm626_hsic_command_send(__attribute__((unused)) void *transport_data,
+ int device_fd, unsigned short code,
+ const void *data, size_t size,
+ size_t command_data_size, int ack)
{
struct xmm626_hsic_command_header header;
void *buffer = NULL;
@@ -396,7 +399,8 @@ int xmm626_hsic_modem_data_send(int device_fd, const void *data, size_t size,
if (device_fd < 0 || data == NULL || size == 0)
return -1;
- rc = xmm626_hsic_command_send(device_fd, XMM626_COMMAND_FLASH_SET_ADDRESS, &address, sizeof(address), XMM626_HSIC_FLASH_SET_ADDRESS_SIZE, 1);
+ rc = ipc_client_send_command(NULL, NULL, device_fd, XMM626_COMMAND_FLASH_SET_ADDRESS,
+ &address, sizeof(address), XMM626_HSIC_FLASH_SET_ADDRESS_SIZE, 1);
if (rc < 0)
goto error;
@@ -407,7 +411,8 @@ int xmm626_hsic_modem_data_send(int device_fd, const void *data, size_t size,
while (c < size) {
count = chunk < size - c ? chunk : size - c;
- rc = xmm626_hsic_command_send(device_fd, XMM626_COMMAND_FLASH_WRITE_BLOCK, p, count, XMM626_HSIC_FLASH_WRITE_BLOCK_SIZE, 0);
+ rc = ipc_client_send_command(NULL, NULL, device_fd, XMM626_COMMAND_FLASH_WRITE_BLOCK,
+ p, count, XMM626_HSIC_FLASH_WRITE_BLOCK_SIZE, 0);
if (rc < 0)
goto error;
@@ -460,7 +465,8 @@ int xmm626_hsic_port_config_send(struct ipc_client *client, int device_fd)
}
ipc_client_log(client, "Read port config");
- rc = xmm626_hsic_command_send(device_fd, XMM626_COMMAND_SET_PORT_CONFIG, buffer, length, XMM626_HSIC_SET_PORT_CONFIG_SIZE, 1);
+ rc = ipc_client_send_command(NULL, NULL, device_fd, XMM626_COMMAND_SET_PORT_CONFIG,
+ buffer, length, XMM626_HSIC_SET_PORT_CONFIG_SIZE, 1);
if (rc < 0) {
ipc_client_log(client, "Sending port config command failed");
goto error;
@@ -487,7 +493,7 @@ int xmm626_hsic_sec_start_send(struct ipc_client *client, int device_fd,
if (client == NULL || device_fd < 0 || sec_data == NULL || sec_size == 0)
return -1;
- rc = xmm626_hsic_command_send(device_fd, XMM626_COMMAND_SEC_START, sec_data, sec_size, XMM626_HSIC_SEC_START_SIZE, 1);
+ rc = ipc_client_send_command(client, NULL, device_fd, XMM626_COMMAND_SEC_START, sec_data, sec_size, XMM626_HSIC_SEC_START_SIZE, 1);
if (rc < 0)
return -1;
@@ -506,7 +512,7 @@ int xmm626_hsic_sec_end_send(struct ipc_client *client, int device_fd)
sec_data = XMM626_SEC_END_MAGIC;
sec_size = sizeof(sec_data);
- rc = xmm626_hsic_command_send(device_fd, XMM626_COMMAND_SEC_END, &sec_data, sec_size, XMM626_HSIC_SEC_END_SIZE, 1);
+ rc = ipc_client_send_command(client, NULL, device_fd, XMM626_COMMAND_SEC_END, &sec_data, sec_size, XMM626_HSIC_SEC_END_SIZE, 1);
if (rc < 0)
return -1;
@@ -577,7 +583,7 @@ int xmm626_hsic_hw_reset_send(struct ipc_client *client, int device_fd)
hw_reset_data = XMM626_HW_RESET_MAGIC;
hw_reset_size = sizeof(hw_reset_data);
- rc = xmm626_hsic_command_send(device_fd, XMM626_COMMAND_HW_RESET, &hw_reset_data, hw_reset_size, XMM626_HSIC_HW_RESET_SIZE, 0);
+ rc = ipc_client_send_command(client, NULL, device_fd, XMM626_COMMAND_HW_RESET, &hw_reset_data, hw_reset_size, XMM626_HSIC_HW_RESET_SIZE, 0);
if (rc < 0)
return -1;
diff --git a/samsung-ipc/modems/xmm626/xmm626_hsic.h b/samsung-ipc/modems/xmm626/xmm626_hsic.h
index b35e1ba..f1fa3dc 100644
--- a/samsung-ipc/modems/xmm626/xmm626_hsic.h
+++ b/samsung-ipc/modems/xmm626/xmm626_hsic.h
@@ -50,6 +50,9 @@ struct xmm626_hsic_command_header {
unsigned int data_size;
} __attribute__((packed));
+int xmm626_hsic_command_send(__attribute__((unused)) void *transport_data,
+ int device_fd, unsigned short code,
+ const void *data, size_t size, size_t command_data_size, int ack);
int xmm626_hsic_psi_send(struct ipc_client *client, int device_fd,
const void *psi_data, unsigned short psi_size);
int xmm626_hsic_ebl_send(struct ipc_client *client, int device_fd,
diff --git a/samsung-ipc/modems/xmm626/xmm626_mipi.h b/samsung-ipc/modems/xmm626/xmm626_mipi.h
index 4d389df..ff6bede 100644
--- a/samsung-ipc/modems/xmm626/xmm626_mipi.h
+++ b/samsung-ipc/modems/xmm626/xmm626_mipi.h
@@ -52,6 +52,8 @@ struct xmm626_mipi_command_footer {
unsigned short unknown;
} __attribute__((packed));
+int xmm626_mipi_command_send(int device_fd, unsigned short code,
+ const void *data, size_t size, int ack, int short_footer);
int xmm626_mipi_psi_send(struct ipc_client *client, int device_fd,
const void *psi_data, unsigned short psi_size);
int xmm626_mipi_ebl_send(struct ipc_client *client, int device_fd,