mtk: add FM350 specific MBIM implementation
Including logic to set low power mode during an EPS initial bearer settings update.
This commit is contained in:
+3
-1
@@ -311,9 +311,11 @@ plugins_shared_reqs = {
|
||||
|
||||
fibocom_shared_reqs = ['xmm']
|
||||
dell_shared_reqs = ['novatel', 'sierra', 'telit', 'xmm']
|
||||
mtk_shared_reqs = []
|
||||
if enable_mbim
|
||||
fibocom_shared_reqs += ['fibocom']
|
||||
dell_shared_reqs += ['foxconn']
|
||||
mtk_shared_reqs += ['fibocom']
|
||||
endif
|
||||
|
||||
plugins_options_reqs = {
|
||||
@@ -336,7 +338,7 @@ plugins_options_reqs = {
|
||||
'mbm': {'available': true, 'shared': []},
|
||||
'motorola': {'available': true, 'shared': []},
|
||||
'mtk-legacy': {'available': true, 'shared': []},
|
||||
'mtk': {'available': true, 'shared': []},
|
||||
'mtk': {'available': true, 'shared': mtk_shared_reqs},
|
||||
'nokia': {'available': true, 'shared': []},
|
||||
'nokia-icera': {'available': true, 'shared': ['icera']},
|
||||
'novatel': {'available': true, 'shared': ['novatel']},
|
||||
|
||||
@@ -643,19 +643,23 @@ endif
|
||||
if plugins_options['mtk']
|
||||
test_udev_rules_dir_c_args = ['-DTESTUDEVRULESDIR_MTK="@0@"'.format(plugins_dir / 'mtk')]
|
||||
plugins_test_udev_rules_dir_c_args += test_udev_rules_dir_c_args
|
||||
|
||||
incs = plugins_incs
|
||||
sources = files(
|
||||
'mtk/mm-plugin-mtk.c',
|
||||
)
|
||||
|
||||
if enable_mbim
|
||||
incs += [fibocom_inc]
|
||||
sources += files(
|
||||
'mtk/mm-broadband-modem-mbim-mtk.c'
|
||||
'mtk/mm-broadband-modem-mbim-mtk.c',
|
||||
'mtk/mm-broadband-modem-mbim-mtk-fibocom.c'
|
||||
)
|
||||
endif
|
||||
|
||||
plugins += {'plugin-mtk': {
|
||||
'plugin': true,
|
||||
'module': {'sources': sources, 'include_directories': plugins_incs, 'c_args': test_udev_rules_dir_c_args + ['-DMM_MODULE_NAME="mtk"']},
|
||||
'module': {'sources': sources, 'include_directories': incs, 'c_args': test_udev_rules_dir_c_args + ['-DMM_MODULE_NAME="mtk"']},
|
||||
}}
|
||||
|
||||
plugins_udev_rules += files('mtk/77-mm-mtk-port-types.rules')
|
||||
|
||||
@@ -5,6 +5,9 @@ GOTO="mm_mtk_port_types_end"
|
||||
|
||||
LABEL="mm_mtk_port_types"
|
||||
|
||||
# Fibocom FM350 attach APN with toggle modem power
|
||||
ATTRS{vendor}=="0x14c3", ATTRS{device}=="0x4d75", ENV{ID_MM_FIBOCOM_INITIAL_EPS_OFF_ON}="1"
|
||||
|
||||
# Fibocom FM350 doesn't correctly support multiplexing yet
|
||||
ATTRS{vendor}=="0x14c3", ATTRS{device}=="0x4d75", ENV{ID_MM_MAX_MULTIPLEXED_LINKS}="0"
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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:
|
||||
*
|
||||
* Copyright (C) 2023 Google, Inc.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ModemManager.h"
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-3gpp.h"
|
||||
#include "mm-broadband-modem-mbim-mtk-fibocom.h"
|
||||
#include "mm-shared-fibocom.h"
|
||||
|
||||
static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
|
||||
static void shared_fibocom_init (MMSharedFibocom *iface);
|
||||
static MMIfaceModem3gpp *iface_modem_3gpp_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbimMtkFibocom, mm_broadband_modem_mbim_mtk_fibocom, MM_TYPE_BROADBAND_MODEM_MBIM_MTK, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_FIBOCOM, shared_fibocom_init))
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
MMBroadbandModemMbimMtkFibocom *
|
||||
mm_broadband_modem_mbim_mtk_fibocom_new (const gchar *device,
|
||||
const gchar *physdev,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id)
|
||||
{
|
||||
return g_object_new (MM_TYPE_BROADBAND_MODEM_MBIM_MTK_FIBOCOM,
|
||||
MM_BASE_MODEM_DEVICE, device,
|
||||
MM_BASE_MODEM_PHYSDEV, physdev,
|
||||
MM_BASE_MODEM_DRIVERS, drivers,
|
||||
MM_BASE_MODEM_PLUGIN, plugin,
|
||||
MM_BASE_MODEM_VENDOR_ID, vendor_id,
|
||||
MM_BASE_MODEM_PRODUCT_ID, product_id,
|
||||
/* MBIM bearer supports NET only */
|
||||
MM_BASE_MODEM_DATA_NET_SUPPORTED, TRUE,
|
||||
MM_BASE_MODEM_DATA_TTY_SUPPORTED, FALSE,
|
||||
MM_IFACE_MODEM_SIM_HOT_SWAP_SUPPORTED, TRUE,
|
||||
MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, TRUE,
|
||||
#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
|
||||
MM_BROADBAND_MODEM_MBIM_QMI_UNSUPPORTED, TRUE,
|
||||
#endif
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_mbim_mtk_fibocom_init (MMBroadbandModemMbimMtkFibocom *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
|
||||
{
|
||||
iface_modem_3gpp_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->set_initial_eps_bearer_settings = mm_shared_fibocom_set_initial_eps_bearer_settings;
|
||||
iface->set_initial_eps_bearer_settings_finish = mm_shared_fibocom_set_initial_eps_bearer_settings_finish;
|
||||
}
|
||||
|
||||
static MMIfaceModem3gpp *
|
||||
peek_parent_3gpp_interface (MMSharedFibocom *self)
|
||||
{
|
||||
return iface_modem_3gpp_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
shared_fibocom_init (MMSharedFibocom *iface)
|
||||
{
|
||||
iface->peek_parent_3gpp_interface = peek_parent_3gpp_interface;
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_mbim_mtk_fibocom_class_init (MMBroadbandModemMbimMtkFibocomClass *klass)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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:
|
||||
*
|
||||
* Copyright (C) 2023 Google, Inc.
|
||||
*/
|
||||
|
||||
#ifndef MM_BROADBAND_MODEM_MBIM_MTK_FIBOCOM_H
|
||||
#define MM_BROADBAND_MODEM_MBIM_MTK_FIBOCOM_H
|
||||
|
||||
#include "mm-broadband-modem-mbim-mtk.h"
|
||||
|
||||
#define MM_TYPE_BROADBAND_MODEM_MBIM_MTK_FIBOCOM (mm_broadband_modem_mbim_mtk_fibocom_get_type ())
|
||||
#define MM_BROADBAND_MODEM_MBIM_MTK_FIBOCOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_MTK_FIBOCOM, MMBroadbandModemMbimMtkFibocom))
|
||||
#define MM_BROADBAND_MODEM_MBIM_MTK_FIBOCOM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_MTK_FIBOCOM, MMBroadbandModemMbimMtkFibocomClass))
|
||||
#define MM_IS_BROADBAND_MODEM_MBIM_MTK_FIBOCOM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_MTK_FIBOCOM))
|
||||
#define MM_IS_BROADBAND_MODEM_MBIM_MTK_FIBOCOM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_MTK_FIBOCOM))
|
||||
#define MM_BROADBAND_MODEM_MBIM_MTK_FIBOCOM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_MTK_FIBOCOM, MMBroadbandModemMbimMtkFibocomClass))
|
||||
|
||||
typedef struct _MMBroadbandModemMbimMtkFibocom MMBroadbandModemMbimMtkFibocom;
|
||||
typedef struct _MMBroadbandModemMbimMtkFibocomClass MMBroadbandModemMbimMtkFibocomClass;
|
||||
|
||||
struct _MMBroadbandModemMbimMtkFibocom {
|
||||
MMBroadbandModemMbimMtk parent;
|
||||
};
|
||||
|
||||
struct _MMBroadbandModemMbimMtkFibocomClass{
|
||||
MMBroadbandModemMbimMtkClass parent;
|
||||
};
|
||||
|
||||
GType mm_broadband_modem_mbim_mtk_fibocom_get_type (void);
|
||||
|
||||
MMBroadbandModemMbimMtkFibocom *mm_broadband_modem_mbim_mtk_fibocom_new (const gchar *device,
|
||||
const gchar *physdev,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id);
|
||||
|
||||
#endif /* MM_BROADBAND_MODEM_MBIM_MTK_FIBOCOM_H */
|
||||
@@ -24,6 +24,7 @@
|
||||
#if defined WITH_MBIM
|
||||
#include "mm-broadband-modem-mbim.h"
|
||||
#include "mm-broadband-modem-mbim-mtk.h"
|
||||
#include "mm-broadband-modem-mbim-mtk-fibocom.h"
|
||||
#endif
|
||||
#include "mm-log.h"
|
||||
|
||||
@@ -44,6 +45,16 @@ create_modem (MMPlugin *self,
|
||||
{
|
||||
#if defined WITH_MBIM
|
||||
if (mm_port_probe_list_has_mbim_port (probes)) {
|
||||
/* FM350 support with Fibocom-specific changes */
|
||||
if (vendor == 0x14c3 && product == 0x4d75) {
|
||||
mm_obj_dbg (self, "MBIM-powered MTK-based Fibocom modem found...");
|
||||
return MM_BASE_MODEM (mm_broadband_modem_mbim_mtk_fibocom_new (uid,
|
||||
physdev,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
mm_obj_dbg (self, "MBIM-powered MTK modem found...");
|
||||
return MM_BASE_MODEM (mm_broadband_modem_mbim_mtk_new (uid,
|
||||
physdev,
|
||||
|
||||
Reference in New Issue
Block a user