Skip to contentSkip to conversation

n_gsm serdev support and protocol driver for droid4 modem

PATCH Superseded Tony Lindgren 4 participants 19 messages Mar 19, 2020 – Apr 21, 2020

Subsystems (3)

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v5 cover n_gsm serdev support and protocol driver for droid4 modem

Hi all,

Here's v4 set of n_gsm serdev support patches, and the related protocol driver for the modem found on Motorola Mapphone phones and tablets like droid4.

This series only adds basic character device support for the serdev driver. Other serdev consumer drivers for specific devices will be posted separately.

The patches are against v5.6-rc series.

Regards,

Tony

Changes since v4:
- Use drivers/tty/serdev/protocol directory for the driver instead of drivers/mfd as discussed on the lists for v3 set of patches
- Fix remove to call kfree only after removing device from the list

Changes since v3:
- Update list of folks in Cc, looks like I sent v3 only to Lee and lkml
- Init privdata before motmdm_register_dlci calls gsm_serdev_register_dlci
- Update binding based on Rob's comments for license and "allOf"

Changes since v2:
- Drop useless send_command indirection, use static motmdm_send_command

Changes since v1:

- Simplified usage and got rid of few pointless inline functions
- Added consumer MFD driver, devicetree binding, and dts changes

Tony Lindgren (4):
tty: n_gsm: Add support for serdev drivers
serdev: ngsm-motmdm: Add Motorola TS 27.010 serdev modem driver for
droid4
dt-bindings: mfd: motmdm: Add binding for motorola-mdm
ARM: dts: omap4-droid4: Enable basic modem support

 .../serdev/motorola,mapphone-mdm6600.yaml     |   34 +
 .../boot/dts/motorola-mapphone-common.dtsi    |    6 +
 drivers/tty/n_gsm.c                           |  372 +++++
 drivers/tty/serdev/Kconfig                    |    3 +
 drivers/tty/serdev/Makefile                   |    2 +
 drivers/tty/serdev/protocol/Kconfig           |   14 +
 drivers/tty/serdev/protocol/Makefile          |    3 +
 .../tty/serdev/protocol/serdev-ngsm-motmdm.c  | 1200 +++++++++++++++++
 include/linux/serdev-gsm.h                    |  168 +++
 9 files changed, 1802 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serdev/motorola,mapphone-mdm6600.yaml
 create mode 100644 drivers/tty/serdev/protocol/Kconfig
 create mode 100644 drivers/tty/serdev/protocol/Makefile
 create mode 100644 drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c
 create mode 100644 include/linux/serdev-gsm.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH v5 1/4 tty: n_gsm: Add support for serdev drivers

We can make use of serdev drivers to do simple device drivers for TS 27.010 chanels, and we can handle vendor specific protocols on top of TS 27.010 with serdev drivers.

So far this has been tested with Motorola droid4 where there is a custom packet numbering protocol on top of TS 27.010 for the MDM6600 modem.

I initially though about adding the serdev support into a separate file, but that will take some refactoring of n_gsm.c. And I'd like to have things working first. Then later on we might want to consider splitting n_gsm.c into three pieces for core, tty and serdev parts. And then maybe the serdev related parts can be just moved to live under something like drivers/tty/serdev/protocol/ngsm.c.

---
 drivers/tty/n_gsm.c        | 372 +++++++++++++++++++++++++++++++++++++
 include/linux/serdev-gsm.h | 168 +++++++++++++++++
 2 files changed, 540 insertions(+)
 create mode 100644 include/linux/serdev-gsm.h
drivers/tty/n_gsm.c +372 -0
@@ -39,6 +39,7 @@
 #include <linux/file.h>
 #include <linux/uaccess.h>
 #include <linux/module.h>
+#include <linux/serdev.h>
 #include <linux/timer.h>
 #include <linux/tty_flip.h>
 #include <linux/tty_driver.h>
@@ -50,6 +51,7 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/gsmmux.h>
+#include <linux/serdev-gsm.h>
 
 static int debug;
 module_param(debug, int, 0600);
@@ -145,6 +147,7 @@ struct gsm_dlci {
 	/* Data handling callback */
 	void (*data)(struct gsm_dlci *dlci, const u8 *data, int len);
 	void (*prev_data)(struct gsm_dlci *dlci, const u8 *data, int len);
+	struct gsm_serdev_dlci *ops; /* serdev dlci ops, if used */
 	struct net_device *net; /* network interface, if created */
 };
 
@@ -179,6 +182,7 @@ struct gsm_control {
  */
 
 struct gsm_mux {
+	struct gsm_serdev *gsd;		/* Serial device bus data */
 	struct tty_struct *tty;		/* The tty our ldisc is bound to */
 	spinlock_t lock;
 	struct mutex mutex;
@@ -2326,6 +2330,374 @@ static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c)
 	return 0;
 }
 
+#ifdef CONFIG_SERIAL_DEV_BUS
+
+/**
+ * gsm_serdev_get_config - read ts 27.010 config
+ * @gsd:	serdev-gsm instance
+ * @c:		ts 27.010 config data
+ *
+ * See gsm_copy_config_values() for more information.
+ */
+int gsm_serdev_get_config(struct gsm_serdev *gsd, struct gsm_config *c)
+{
+	struct gsm_mux *gsm;
+
+	if (!gsd || !gsd->gsm)
+		return -ENODEV;
+
+	gsm = gsd->gsm;
+
+	if (!c)
+		return -EINVAL;
+
+	gsm_copy_config_values(gsm, c);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_get_config);
+
+/**
+ * gsm_serdev_set_config - set ts 27.010 config
+ * @gsd:	serdev-gsm instance
+ * @c:		ts 27.010 config data
+ *
+ * See gsm_config() for more information.
+ */
+int gsm_serdev_set_config(struct gsm_serdev *gsd, struct gsm_config *c)
+{
+	struct gsm_mux *gsm;
+
+	if (!gsd || !gsd->serdev || !gsd->gsm)
+		return -ENODEV;
+
+	gsm = gsd->gsm;
+
+	if (!c)
+		return -EINVAL;
+
+	return gsm_config(gsm, c);
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_set_config);
+
+static struct gsm_dlci *gsd_dlci_get(struct gsm_serdev *gsd, int line,
+				     bool allocate)
+{
+	struct gsm_mux *gsm;
+	struct gsm_dlci *dlci;
+
+	if (!gsd || !gsd->gsm)
+		return ERR_PTR(-ENODEV);
+
+	gsm = gsd->gsm;
+
+	if (line < 1 || line >= 63)
+		return ERR_PTR(-EINVAL);
+
+	mutex_lock(&gsm->mutex);
+
+	if (gsm->dlci[line]) {
+		dlci = gsm->dlci[line];
+		goto unlock;
+	} else if (!allocate) {
+		dlci = ERR_PTR(-ENODEV);
+		goto unlock;
+	}
+
+	dlci = gsm_dlci_alloc(gsm, line);
+	if (!dlci) {
+		gsm = ERR_PTR(-ENOMEM);
+		goto unlock;
+	}
+
+	gsm->dlci[line] = dlci;
+
+unlock:
+	mutex_unlock(&gsm->mutex);
+
+	return dlci;
+}
+
+static void gsd_dlci_data(struct gsm_dlci *dlci, const u8 *buf, int len)
+{
+	struct gsm_mux *gsm = dlci->gsm;
+	struct gsm_serdev *gsd = gsm->gsd;
+
+	if (!gsd || !dlci->ops)
+		return;
+
+	switch (dlci->adaption) {
+	case 0:
+	case 1:
+		if (dlci->ops->receive_buf)
+			dlci->ops->receive_buf(dlci->ops, buf, len);
+		break;
+	default:
+		pr_warn("dlci%i adaption %i not yet implemented\n",
+			dlci->addr, dlci->adaption);
+		break;
+	}
+}
+
+/**
+ * gsm_serdev_write - write data to a ts 27.010 channel
+ * @gsd:	serdev-gsm instance
+ * @ops:	channel ops
+ * @buf:	write buffer
+ * @len:	buffer length
+ */
+int gsm_serdev_write(struct gsm_serdev *gsd, struct gsm_serdev_dlci *ops,
+		     const u8 *buf, int len)
+{
+	struct gsm_mux *gsm;
+	struct gsm_dlci *dlci;
+	struct gsm_msg *msg;
+	int h, size, total_size = 0;
+	u8 *dp;
+
+	if (!gsd || !gsd->gsm)
+		return -ENODEV;
+
+	gsm = gsd->gsm;
+
+	dlci = gsd_dlci_get(gsd, ops->line, false);
+	if (IS_ERR(dlci))
+		return PTR_ERR(dlci);
+
+	h = dlci->adaption - 1;
+
+	if (len > gsm->mtu)
+		len = gsm->mtu;
+
+	size = len + h;
+
+	msg = gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype);
+	if (!msg)
+		return -ENOMEM;
+
+	dp = msg->data;
+	switch (dlci->adaption) {
+	case 1:
+		break;
+	case 2:
+		*dp++ = gsm_encode_modem(dlci);
+		break;
+	}
+	memcpy(dp, buf, len);
+	gsm_data_queue(dlci, msg);
+	total_size += size;
+
+	return total_size;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_write);
+
+/**
+ * gsm_serdev_data_kick - indicate more data can be transmitted
+ * @gsd:	serdev-gsm instance
+ *
+ * See gsm_data_kick() for more information.
+ */
+void gsm_serdev_data_kick(struct gsm_serdev *gsd)
+{
+	struct gsm_mux *gsm;
+	unsigned long flags;
+
+	if (!gsd || !gsd->gsm)
+		return;
+
+	gsm = gsd->gsm;
+
+	spin_lock_irqsave(&gsm->tx_lock, flags);
+	gsm_data_kick(gsm);
+	spin_unlock_irqrestore(&gsm->tx_lock, flags);
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_data_kick);
+
+/**
+ * gsm_serdev_register_dlci - register a ts 27.010 channel
+ * @gsd:	serdev-gsm instance
+ * @ops:	channel ops
+ */
+int gsm_serdev_register_dlci(struct gsm_serdev *gsd,
+			     struct gsm_serdev_dlci *ops)
+{
+	struct gsm_dlci *dlci;
+	struct gsm_mux *gsm;
+	int retries;
+
+	if (!gsd || !gsd->gsm || !gsd->serdev)
+		return -ENODEV;
+
+	gsm = gsd->gsm;
+
+	if (!ops || !ops->line || !ops->receive_buf)
+		return -EINVAL;
+
+	dlci = gsd_dlci_get(gsd, ops->line, true);
+	if (IS_ERR(dlci))
+		return PTR_ERR(dlci);
+
+	if (dlci->state == DLCI_OPENING || dlci->state == DLCI_OPEN ||
+	    dlci->state == DLCI_CLOSING)
+		return -EBUSY;
+
+	mutex_lock(&dlci->mutex);
+	dlci->ops = ops;
+	dlci->modem_rx = 0;
+	dlci->prev_data = dlci->data;
+	dlci->data = gsd_dlci_data;
+	mutex_unlock(&dlci->mutex);
+
+	gsm_dlci_begin_open(dlci);
+
+	/*
+	 * Allow some time for dlci to move to DLCI_OPEN state. Otherwise
+	 * the serdev consumer driver can start sending data too early during
+	 * the setup, and the response will be missed by gms_queue() if we
+	 * still have DLCI_CLOSED state.
+	 */
+	for (retries = 10; retries > 0; retries--) {
+		if (dlci->state == DLCI_OPEN)
+			break;
+		msleep(100);
+	}
+
+	if (!retries)
+		dev_dbg(&gsd->serdev->dev, "dlci%i not currently active\n",
+			dlci->addr);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_register_dlci);
+
+/**
+ * gsm_serdev_unregister_dlci - unregister a ts 27.010 channel
+ * @gsd:	serdev-gsm instance
+ * @ops:	channel ops
+ */
+void gsm_serdev_unregister_dlci(struct gsm_serdev *gsd,
+				struct gsm_serdev_dlci *ops)
+{
+	struct gsm_mux *gsm;
+	struct gsm_dlci *dlci;
+
+	if (!gsd || !gsd->gsm || !gsd->serdev)
+		return;
+
+	gsm = gsd->gsm;
+
+	if (!ops || !ops->line)
+		return;
+
+	dlci = gsd_dlci_get(gsd, ops->line, false);
+	if (IS_ERR(dlci))
+		return;
+
+	mutex_lock(&dlci->mutex);
+	gsm_destroy_network(dlci);
+	dlci->data = dlci->prev_data;
+	dlci->ops = NULL;
+	mutex_unlock(&dlci->mutex);
+
+	gsm_dlci_begin_close(dlci);
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_unregister_dlci);
+
+static int gsm_serdev_output(struct gsm_mux *gsm, u8 *data, int len)
+{
+	struct gsm_serdev *gsd = gsm->gsd;
+	struct serdev_device *serdev = gsm->gsd->serdev;
+	bool asleep;
+
+	asleep = atomic_read(&gsd->asleep);
+	if (asleep)
+		return -ENOSPC;
+
+	if (gsm->gsd->output)
+		return gsm->gsd->output(gsm->gsd, data, len);
+	else
+		return serdev_device_write_buf(serdev, data, len);
+}
+
+static int gsd_receive_buf(struct serdev_device *serdev, const u8 *data,
+			   size_t count)
+{
+	struct gsm_serdev *gsd = serdev_device_get_drvdata(serdev);
+	struct gsm_mux *gsm;
+	const unsigned char *dp;
+	int i;
+
+	if (WARN_ON(!gsd))
+		return 0;
+
+	gsm = gsd->gsm;
+
+	if (debug & 4)
+		print_hex_dump_bytes("gsd_receive_buf: ",
+				     DUMP_PREFIX_OFFSET,
+				     data, count);
+
+	for (i = count, dp = data; i; i--, dp++)
+		gsm->receive(gsm, *dp);
+
+	return count;
+}
+
+static void gsd_write_wakeup(struct serdev_device *serdev)
+{
+	serdev_device_write_wakeup(serdev);
+}
+
+static struct serdev_device_ops gsd_client_ops = {
+	.receive_buf = gsd_receive_buf,
+	.write_wakeup = gsd_write_wakeup,
+};
+
+int gsm_serdev_register_device(struct gsm_serdev *gsd)
+{
+	struct gsm_mux *gsm;
+	int error;
+
+	if (WARN(!gsd || !gsd->serdev || !gsd->output,
+		 "serdev and output must be initialized\n"))
+		return -EINVAL;
+
+	serdev_device_set_client_ops(gsd->serdev, &gsd_client_ops);
+
+	gsm = gsm_alloc_mux();
+	if (!gsm)
+		return -ENOMEM;
+
+	gsm->encoding = 1;
+	gsm->tty = NULL;
+	gsm->gsd = gsd;
+	gsm->output = gsm_serdev_output;
+	atomic_set(&gsd->asleep, 0);
+	gsd->gsm = gsm;
+	mux_get(gsd->gsm);
+
+	error = gsm_activate_mux(gsd->gsm);
+	if (error) {
+		gsm_cleanup_mux(gsd->gsm);
+		mux_put(gsd->gsm);
+
+		return error;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_register_device);
+
+void gsm_serdev_unregister_device(struct gsm_serdev *gsd)
+{
+	gsm_cleanup_mux(gsd->gsm);
+	mux_put(gsd->gsm);
+	gsd->gsm = NULL;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_unregister_device);
+
+#endif	/* CONFIG_SERIAL_DEV_BUS */
+
 /**
  *	gsmld_output		-	write to link
  *	@gsm: our mux
include/linux/serdev-gsm.h new file +168 -0

168 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

Droid 4 in -next -- still no backlight was Re: [PATCH 1/4] tty: n_gsm: Add support for serdev drivers

Hi!

Quoted 3 lines

We can make use of serdev drivers to do simple device drivers for TS 27.010 chanels, and we can handle vendor specific protocols on top of TS 27.010 with serdev drivers.

I took all three series (

[PATCHv3 0/3] Lost key-up interrupt handling for omap4-keypa [PATCH 1/3] Input: atmel_mxt_ts - use runtime PM instead of [PATCHv5 0/4] n_gsm serdev support and protocol driver for d

) and applied them on top of next-20200320.

Good news is that result boots. (So I did partial testing of the patches).

Bad news is that I still don't have working backlight. I do have LED and there's backlight device connected to the LED, so I can't control the LED directly, but the screen is black (and I don't see boot messages either).

Before I start debugging, does screen work for you in -next, or do you have some fixes I could try?

Thanks and best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw

Re: Droid 4 in -next -- still no backlight was Re: [PATCH 1/4] tty: n_gsm: Add support for serdev drivers

Quoted 16 lines · Pavel Machek

Hi!

Quoted 3 lines

We can make use of serdev drivers to do simple device drivers for TS 27.010 chanels, and we can handle vendor specific protocols on top of TS 27.010 with serdev drivers.

I took all three series (

[PATCHv3 0/3] Lost key-up interrupt handling for omap4-keypa [PATCH 1/3] Input: atmel_mxt_ts - use runtime PM instead of [PATCHv5 0/4] n_gsm serdev support and protocol driver for d

) and applied them on top of next-20200320.

Good news is that result boots. (So I did partial testing of the patches).

Quoted 7 lines

Bad news is that I still don't have working backlight. I do have LED and there's backlight device connected to the LED, so I can't control the LED directly, but the screen is black (and I don't see boot messages either).

Before I start debugging, does screen work for you in -next, or do you have some fixes I could try?

Yes the backlight works for me now just fine with current v5.6-rc.

But yeah, looks like LCD is again broken in current Linux next, maybe Laurent and Sebastian have some clues?

Regards,

Tony

#4 lore raw

Re: Droid 4 in -next -- still no backlight was Re: [PATCH 1/4] tty: n_gsm: Add support for serdev drivers

Quoted 8 lines · Tony Lindgren
Quoted 2 lines · Pavel Machek

Before I start debugging, does screen work for you in -next, or do you have some fixes I could try?

Yes the backlight works for me now just fine with current v5.6-rc.

But yeah, looks like LCD is again broken in current Linux next, maybe Laurent and Sebastian have some clues?

Oh it's just that now display-connector needs to be loaded instead of the old omap specific hdmi connector :)

See commit e7e67d9a2f1d ("drm/omap: Switch the HDMI and VENC outputs to drm_bridge") and check that you have the .config options enabled in that patch also in your custom .config.

Regards,

Tony

Reviewed-by on v5 1/4
#5 lore raw

Re: [PATCH 1/4] tty: n_gsm: Add support for serdev drivers

In reply to Tony Lindgren
Quoted 7 lines · Tony Lindgren

We can make use of serdev drivers to do simple device drivers for TS 27.010 chanels, and we can handle vendor specific protocols on top of TS 27.010 with serdev drivers.

So far this has been tested with Motorola droid4 where there is a custom packet numbering protocol on top of TS 27.010 for the MDM6600 modem.

Quoted 8 lines

I initially though about adding the serdev support into a separate file, but that will take some refactoring of n_gsm.c. And I'd like to have things working first. Then later on we might want to consider splitting n_gsm.c into three pieces for core, tty and serdev parts. And then maybe the serdev related parts can be just moved to live under something like drivers/tty/serdev/protocol/ngsm.c.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#6 lore raw

PATCH v5 2/4 serdev: ngsm-motmdm: Add Motorola TS 27.010 serdev modem driver for droid4

In reply to Tony Lindgren

Many Motorola phones are controlling the modem using a custom variant of TS 27.010 serial line discipline. Devices on these modems have a dedicated TS 27.010 channel for features like audio mixer, GNSS, voice modem, SIM card reader and so on.

This serdev protocol driver allows using various devices on the modem. In order to do that, we need to take care of the following three things:

1. Provide /dev/motmdm* character devices for apps to use for talking to the various devices on the modem

2. Handle Motorola custom protocol over TS 27.010 to make the channels usable for userspace

3. Coordinate PM runtime with the USB PHY because of shared GPIO pins with the USB PHY

With this patch, folks with droid4 can place a voice call with just:

$ printf "ATD%s,0\r" "${phone_number}" > /dev/motmdm1
D:OK
~+CIEV=1,1,0
...
$ printf "ATH\r" > /dev/motmdm1
H:OK

Also SMS can be sent with this patch using /dev/motmdm3 for sending, and /dev/motmdm9 for receiving messages, and /dev/motmdm10 can be used for SIM access.

Note that the audio mixer needs additional patches though. I will be sending those as a separate series of patches.

---
 drivers/tty/serdev/Kconfig                    |    3 +
 drivers/tty/serdev/Makefile                   |    2 +
 drivers/tty/serdev/protocol/Kconfig           |   14 +
 drivers/tty/serdev/protocol/Makefile          |    3 +
 .../tty/serdev/protocol/serdev-ngsm-motmdm.c  | 1200 +++++++++++++++++
 5 files changed, 1222 insertions(+)
 create mode 100644 drivers/tty/serdev/protocol/Kconfig
 create mode 100644 drivers/tty/serdev/protocol/Makefile
 create mode 100644 drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c
drivers/tty/serdev/Kconfig +3 -0
@@ -22,4 +22,7 @@ config SERIAL_DEV_CTRL_TTYPORT
 	depends on SERIAL_DEV_BUS != m
 	default y
 
+source "drivers/tty/serdev/protocol/Kconfig"
+
 endif
+
drivers/tty/serdev/Makefile +2 -0
@@ -4,3 +4,5 @@ serdev-objs := core.o
 obj-$(CONFIG_SERIAL_DEV_BUS) += serdev.o
 
 obj-$(CONFIG_SERIAL_DEV_CTRL_TTYPORT) += serdev-ttyport.o
+
+obj-y += protocol/
drivers/tty/serdev/protocol/Kconfig new file +14 -0
new file mode 100644
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Serial bus device driver protocol specific configuration
+#
+
+config SERIAL_DEV_NGSM_MOTMDM
+	tristate "Motorola Modem TS 27.010 Serdev Protocol Driver"
+	depends on N_GSM && PHY_MAPPHONE_MDM6600
+	help
+	  Select this for Motorola modems using TS 27.010 serial line
+	  discipline such as MDM6600 modem found on Motorola Mapphone
+	  devices like Droid4
+
+	  If unsure, say N.
drivers/tty/serdev/protocol/Makefile new file +3 -0
new file mode 100644
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_SERIAL_DEV_NGSM_MOTMDM) += serdev-ngsm-motmdm.o
drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c new file +1200 -0

1,200 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

Re: [PATCH 2/4] serdev: ngsm-motmdm: Add Motorola TS 27.010 serdev modem driver for droid4

Hi!

Quoted 4 lines

Many Motorola phones are controlling the modem using a custom variant of TS 27.010 serial line discipline. Devices on these modems have a dedicated TS 27.010 channel for features like audio mixer, GNSS, voice modem, SIM card reader and so on.

I get warning here while applying:

Applying: serdev: ngsm-motmdm: Add Motorola TS 27.010 serdev modem driver for droid4
.git/rebase-apply/patch:22: new blank line at EOF.
+

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#8 lore raw

Re: [PATCH 2/4] serdev: ngsm-motmdm: Add Motorola TS 27.010 serdev modem driver for droid4

Quoted 7 lines · Pavel Machek

Hi!

Quoted 4 lines

Many Motorola phones are controlling the modem using a custom variant of TS 27.010 serial line discipline. Devices on these modems have a dedicated TS 27.010 channel for features like audio mixer, GNSS, voice modem, SIM card reader and so on.

Quoted 6 lines

I get warning here while applying:

Applying: serdev: ngsm-motmdm: Add Motorola TS 27.010 serdev modem driver for droid4
.git/rebase-apply/patch:22: new blank line at EOF.
+

Thanks yes looks like an extra empty line added to Kconfig.

Regards,

Tony

Reviewed-by on v5 2/4
#9 lore raw

Re: [PATCH 2/4] serdev: ngsm-motmdm: Add Motorola TS 27.010 serdev modem driver for droid4

In reply to Tony Lindgren

Hi!

Quoted 11 lines
$ printf "ATH\r" > /dev/motmdm1
H:OK

Also SMS can be sent with this patch using /dev/motmdm3 for sending, and /dev/motmdm9 for receiving messages, and /dev/motmdm10 can be used for SIM access.

Note that the audio mixer needs additional patches though. I will be sending those as a separate series of patches.

Some minor comments are below.

Quoted 4 lines

+++ b/drivers/tty/serdev/protocol/Kconfig

drivers/tty/serdev/protocol/Kconfig new file +2 -0
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0
+#

drivers/tty/serdev/protocol/Kconfig line 12

Quoted 10 lines
drivers/tty/serdev/protocol/Kconfig new file +10 -0
+# Serial bus device driver protocol specific configuration
+#
+
+config SERIAL_DEV_NGSM_MOTMDM
+	tristate "Motorola Modem TS 27.010 Serdev Protocol Driver"
+	depends on N_GSM && PHY_MAPPHONE_MDM6600
+	help
+	  Select this for Motorola modems using TS 27.010 serial line
+	  discipline such as MDM6600 modem found on Motorola Mapphone
+	  devices like Droid4

I'd add "." at the end of sentence.

Quoted 11 lines
drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c new file +11 -0
+/*
+ * Character devices for DLCI channels with no serdev drivers
+ */
+static int motmdm_cdev_open(struct inode *inode, struct file *file)
+{
+	struct motmdm_cdev *cdata;
+	int ret = 0;
+
+	cdata = container_of(inode->i_cdev, struct motmdm_cdev, cdev);
+	get_device(cdata->dev);
+	nonseekable_open(inode, file);

drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c line 581

Quoted 10 lines
drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c new file +10 -0
+	file->private_data = cdata;
+
+	down_write(&cdata->rwsem);
+	if (cdata->disconnected) {
+		ret = -ENODEV;
+		goto unlock;
+	}
+
+unlock:
+	up_write(&cdata->rwsem);

You can delete goto and the label here.

drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c line 598

Quoted 10 lines
drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c new file +10 -0
+static int motmdm_cdev_release(struct inode *inode, struct file *file)
+{
+	struct motmdm_cdev *cdata = file->private_data;
+
+	down_write(&cdata->rwsem);
+	if (cdata->disconnected)
+		goto unlock;
+
+unlock:
+	up_write(&cdata->rwsem);

And here... unless it is some kind of preparation for next patch?

drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c line 1199

Quoted 2 lines
drivers/tty/serdev/protocol/serdev-ngsm-motmdm.c new file +2 -0
+MODULE_DESCRIPTION("Motorola Modem TS 27.010 serdev driver");
+MODULE_AUTHOR("Tony Lindgren <[email protected]");

Missing ">" at the end of email address.

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#10 lore raw

PATCH v5 3/4 dt-bindings: mfd: motmdm: Add binding for motorola-mdm

In reply to Tony Lindgren

Add a binding document for Motorola modems controllable by TS 27.010 UART line discipline using serdev drivers.

[[email protected]: moved to live under bindings/serdev]
---
 .../serdev/motorola,mapphone-mdm6600.yaml     | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serdev/motorola,mapphone-mdm6600.yaml
Documentation/devicetree/bindings/serdev/motorola,mapphone-mdm6600.yaml new file +34 -0
new file mode 100644
@@ -0,0 +1,34 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serdev/motorola,mapphone-mdm6600.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Motorola Mapphone MDM6600 Modem
+
+maintainers:
+  - Tony Lindgren <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - const: motorola,mapphone-mdm6600-serial
+
+  phys:
+    maxItems: 1
+
+  phy-names:
+    const: usb
+
+required:
+  - compatible
+  - phys
+  - phy-names
+
+examples:
+  - |
+    modem {
+        compatible = "motorola,mapphone-mdm6600-serial";
+        phys = <&fsusb1_phy>;
+        phy-names = "usb";
+    };
Signature · 1 line
2.25.1
#11 lore raw

Re: [PATCH 3/4] dt-bindings: mfd: motmdm: Add binding for motorola-mdm

Quoted 10 lines

Add a binding document for Motorola modems controllable by TS 27.010 UART line discipline using serdev drivers.

[[email protected]: moved to live under bindings/serdev]
---
 .../serdev/motorola,mapphone-mdm6600.yaml     | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serdev/motorola,mapphone-mdm6600.yaml

Nit: subject line is out of date.

Quoted 39 lines
Documentation/devicetree/bindings/serdev/motorola,mapphone-mdm6600.yaml new file +34 -0
new file mode 100644
@@ -0,0 +1,34 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serdev/motorola,mapphone-mdm6600.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Motorola Mapphone MDM6600 Modem
+
+maintainers:
+  - Tony Lindgren <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - const: motorola,mapphone-mdm6600-serial
+
+  phys:
+    maxItems: 1
+
+  phy-names:
+    const: usb
+
+required:
+  - compatible
+  - phys
+  - phy-names
+
+examples:
+  - |
+    modem {
+        compatible = "motorola,mapphone-mdm6600-serial";
+        phys = <&fsusb1_phy>;
+        phy-names = "usb";
+    };
Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#12 lore raw

Re: [PATCH 3/4] dt-bindings: mfd: motmdm: Add binding for motorola-mdm

Quoted 11 lines · Lee Jones
Quoted 10 lines

Add a binding document for Motorola modems controllable by TS 27.010 UART line discipline using serdev drivers.

[[email protected]: moved to live under bindings/serdev]
---
 .../serdev/motorola,mapphone-mdm6600.yaml     | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serdev/motorola,mapphone-mdm6600.yaml
Quoted 1 line

Nit: subject line is out of date.

Thanks for spotting that, will change it to use the following:

dt-bindings: serdev: motmdm: Add binding for motorola-mdm

Regards,

Tony

#13 lore raw

PATCH v5 4/4 ARM: dts: omap4-droid4: Enable basic modem support

In reply to Tony Lindgren

This allows apps to use /dev/motmdm1 for voice call AT commands, /dev/motmdm3 for sending SMS, and /dev/motmdm9 for reading SMS.

Voice call audio mixer and GNSS are not yet supported.

---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/motorola-mapphone-common.dtsi +6 -0
@@ -698,6 +698,12 @@ &uart1 {
 	pinctrl-0 = <&uart1_pins>;
 	interrupts-extended = <&wakeupgen GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH
 			       &omap4_pmx_core 0xfc>;
+
+	modem {
+		compatible = "motorola,mapphone-mdm6600-serial";
+		phys = <&fsusb1_phy>;
+		phy-names = "usb";
+	};
 };
 
 &uart3 {
Signature · 1 line
2.25.1
#14 lore raw

Re: [PATCH 4/4] ARM: dts: omap4-droid4: Enable basic modem support

Quoted 6 lines · Tony Lindgren

This allows apps to use /dev/motmdm1 for voice call AT commands, /dev/motmdm3 for sending SMS, and /dev/motmdm9 for reading SMS.

Voice call audio mixer and GNSS are not yet supported.

3,4: Reviewed-by: Pavel Machek <[email protected]>

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Tested-by on the v5 series
#15 lore raw
In reply to Tony Lindgren

Hi!

Quoted 9 lines

Here's v4 set of n_gsm serdev support patches, and the related protocol driver for the modem found on Motorola Mapphone phones and tablets like droid4.

This series only adds basic character device support for the serdev driver. Other serdev consumer drivers for specific devices will be posted separately.

The patches are against v5.6-rc series.

And it would be good to get them into v5.7... pretty please :-).

It seems to work for me... mostly. I checked out your ofono branch. Calls seem okay, but two smses arrived, but now phone does not seem to be logged into GSM network. Weird.

Anyway, likely not a kernel problem.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#16 lore raw
Quoted 6 lines · Pavel Machek

Hi!

Quoted 4 lines

Here's v4 set of n_gsm serdev support patches, and the related protocol driver for the modem found on Motorola Mapphone phones and tablets like droid4.

Quoted 7 lines
Quoted 5 lines

This series only adds basic character device support for the serdev driver. Other serdev consumer drivers for specific devices will be posted separately.

The patches are against v5.6-rc series.

And it would be good to get them into v5.7... pretty please :-).

No, 5.7 is not ok for this, and i think it already needs a respin as this is not in my patch queue anymore.

thanks,

greg k-h

#17 lore raw
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Pavel Machek

Hi!

Quoted 8 lines

Here's v4 set of n_gsm serdev support patches, and the related protocol driver for the modem found on Motorola Mapphone phones and tablets like droid4.

This series only adds basic character device support for the serdev driver. Other serdev consumer drivers for specific devices will be posted separately.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

The patches are against v5.6-rc series.

And it would be good to get them into v5.7... pretty please :-).

No, 5.7 is not ok for this, and i think it already needs a respin as this is not in my patch queue anymore.

I'll send out an updated series.

Thanks,

Tony

#18 lore raw
In reply to Greg Kroah-Hartman
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Pavel Machek

Hi!

Quoted 8 lines

Here's v4 set of n_gsm serdev support patches, and the related protocol driver for the modem found on Motorola Mapphone phones and tablets like droid4.

This series only adds basic character device support for the serdev driver. Other serdev consumer drivers for specific devices will be posted separately.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

The patches are against v5.6-rc series.

And it would be good to get them into v5.7... pretty please :-).

No, 5.7 is not ok for this, and i think it already needs a respin as this is not in my patch queue anymore.

Umm, I meant v5.8. OTOH it is new hardware support, and phone without modem is pretty much useless, so ... v5.7-rc3 should not be _completely_ out of question ;-).
Pavel

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany