All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] nokia-modem: kernel based PM
@ 2016-01-31  1:19 Sebastian Reichel
  2016-01-31  1:19 ` [PATCH 1/5] HSI: nokia-modem: simplify kernel access to gpios Sebastian Reichel
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Sebastian Reichel @ 2016-01-31  1:19 UTC (permalink / raw)
  To: Sebastian Reichel, Tony Lindgren, Benoît Cousson, Aaro Koskinen
  Cc: Pali Rohár, Pavel Machek, linux-omap, linux-kernel

Hi,

Some may remember, that in-kernel modem PM was still on the
TODO list for the N9xx modem driver. This patchset adds this
by hooking to the phonet interface state. In other words:

'ifconfig phonet0 up' will enable the modem and 'ifconfig
phonet0 down' will disable the modem. The actual state is
mapped to the carrier state (which was more or less the
case already).

So using the modem can be done like this now:

0. nokia-modem should be loaded with pm=2
1. ifconfig phonet0 up
2. wait for carrier on phonet0
3. communicate with the modem via isi on phonet0
4. ifconfig phonet0 down

The old pm method (exporting the gpios) is still available
and still the default for now. The plan is to switch the default
pm method in some future kernel release (when support for
the simpler interface has been added to ofono).

-- Sebastian

Sebastian Reichel (5):
  HSI: nokia-modem: simplify kernel access to gpios
  HSI: nokia-modem: kernel based PM
  HSI: ssi-protocol: export modem info via sysfs
  HSI: nokia-modem: drop support for disabled pm
  HSI: ssi-protocol: clear carrier flag on open

 drivers/hsi/clients/nokia-modem.c  | 240 +++++++++++++++++++++++++++++++------
 drivers/hsi/clients/ssi_protocol.c |  56 ++++++++-
 include/linux/hsi/ssi_protocol.h   |  20 ++++
 3 files changed, 277 insertions(+), 39 deletions(-)

-- 
2.7.0.rc3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/5] HSI: nokia-modem: simplify kernel access to gpios
  2016-01-31  1:19 [PATCH 0/5] nokia-modem: kernel based PM Sebastian Reichel
@ 2016-01-31  1:19 ` Sebastian Reichel
  2016-01-31  1:19 ` [PATCH 2/5] HSI: nokia-modem: kernel based PM Sebastian Reichel
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2016-01-31  1:19 UTC (permalink / raw)
  To: Sebastian Reichel, Tony Lindgren, Benoît Cousson, Aaro Koskinen
  Cc: Pali Rohár, Pavel Machek, linux-omap, linux-kernel

For implementing kernel based modem power management, the
gpios should be accessible via name from the kernel. The
old code would require walking through the gpio array
comparing the name of each gpio. This is no longer needed
by the new code, which does the comparing once at probe
time. As a side effect the code now checks, that all
required gpios are provided.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/hsi/clients/nokia-modem.c | 115 ++++++++++++++++++++++++++++----------
 1 file changed, 85 insertions(+), 30 deletions(-)

diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c
index c000780d931f..f20ede611593 100644
--- a/drivers/hsi/clients/nokia-modem.c
+++ b/drivers/hsi/clients/nokia-modem.c
@@ -34,19 +34,23 @@ module_param(pm, int, 0400);
 MODULE_PARM_DESC(pm,
 	"Enable power management (0=disabled, 1=userland based [default])");
 
-struct nokia_modem_gpio {
-	struct gpio_desc	*gpio;
-	const char		*name;
+enum nokia_modem_type {
+	RAPUYAMA_V1,
+	RAPUYAMA_V2,
 };
 
 struct nokia_modem_device {
 	struct tasklet_struct	nokia_modem_rst_ind_tasklet;
 	int			nokia_modem_rst_ind_irq;
 	struct device		*device;
-	struct nokia_modem_gpio	*gpios;
-	int			gpio_amount;
 	struct hsi_client	*ssi_protocol;
 	struct hsi_client	*cmt_speech;
+	enum nokia_modem_type	type;
+	struct gpio_desc        *gpio_cmt_en;
+	struct gpio_desc	*gpio_cmt_apeslpx;
+	struct gpio_desc	*gpio_cmt_rst_rq;
+	struct gpio_desc	*gpio_cmt_rst;
+	struct gpio_desc	*gpio_cmt_bsi;
 };
 
 static void do_nokia_modem_rst_ind_tasklet(unsigned long data)
@@ -74,11 +78,33 @@ static irqreturn_t nokia_modem_rst_ind_isr(int irq, void *data)
 static void nokia_modem_gpio_unexport(struct device *dev)
 {
 	struct nokia_modem_device *modem = dev_get_drvdata(dev);
-	int i;
 
-	for (i = 0; i < modem->gpio_amount; i++) {
-		sysfs_remove_link(&dev->kobj, modem->gpios[i].name);
-		gpiod_unexport(modem->gpios[i].gpio);
+	if (pm != 1)
+		return;
+
+	if (modem->gpio_cmt_en) {
+		sysfs_remove_link(&dev->kobj, "cmt_en");
+		gpiod_unexport(modem->gpio_cmt_en);
+	}
+
+	if (modem->gpio_cmt_apeslpx) {
+		sysfs_remove_link(&dev->kobj, "cmt_apeslpx");
+		gpiod_unexport(modem->gpio_cmt_apeslpx);
+	}
+
+	if (modem->gpio_cmt_rst_rq) {
+		sysfs_remove_link(&dev->kobj, "cmt_rst_rq");
+		gpiod_unexport(modem->gpio_cmt_rst_rq);
+	}
+
+	if (modem->gpio_cmt_rst) {
+		sysfs_remove_link(&dev->kobj, "cmt_rst");
+		gpiod_unexport(modem->gpio_cmt_rst);
+	}
+
+	if (modem->gpio_cmt_bsi) {
+		sysfs_remove_link(&dev->kobj, "cmt_bsi");
+		gpiod_unexport(modem->gpio_cmt_bsi);
 	}
 }
 
@@ -102,38 +128,61 @@ static int nokia_modem_gpio_probe(struct device *dev)
 		return -EINVAL;
 	}
 
-	modem->gpios = devm_kzalloc(dev, gpio_count *
-				sizeof(struct nokia_modem_gpio), GFP_KERNEL);
-	if (!modem->gpios) {
-		dev_err(dev, "Could not allocate memory for gpios\n");
-		return -ENOMEM;
-	}
-
-	modem->gpio_amount = gpio_count;
-
 	for (i = 0; i < gpio_count; i++) {
-		modem->gpios[i].gpio = devm_gpiod_get_index(dev, NULL, i,
-							    GPIOD_OUT_LOW);
-		if (IS_ERR(modem->gpios[i].gpio)) {
+		const char *gpio_name;
+		struct gpio_desc *gpio_val;
+
+		gpio_val = devm_gpiod_get_index(dev, NULL, i, GPIOD_OUT_LOW);
+		if (IS_ERR(gpio_val)) {
 			dev_err(dev, "Could not get gpio %d\n", i);
-			return PTR_ERR(modem->gpios[i].gpio);
+			return PTR_ERR(gpio_val);
 		}
 
 		err = of_property_read_string_index(np, "gpio-names", i,
-						&(modem->gpios[i].name));
+						    &gpio_name);
 		if (err) {
 			dev_err(dev, "Could not get gpio name %d\n", i);
 			return err;
 		}
 
-		err = gpiod_export(modem->gpios[i].gpio, 0);
-		if (err)
-			return err;
+		if (strcmp(gpio_name, "cmt_en") == 0) {
+			modem->gpio_cmt_en = gpio_val;
+		} else if(strcmp(gpio_name, "cmt_apeslpx") == 0) {
+			modem->gpio_cmt_apeslpx = gpio_val;
+		} else if(strcmp(gpio_name, "cmt_rst_rq") == 0) {
+			modem->gpio_cmt_rst_rq = gpio_val;
+		} else if(strcmp(gpio_name, "cmt_rst") == 0) {
+			modem->gpio_cmt_rst = gpio_val;
+		} else if(strcmp(gpio_name, "cmt_bsi") == 0) {
+			modem->gpio_cmt_bsi = gpio_val;
+		} else {
+			dev_err(dev, "Unknown gpio '%s'\n", gpio_name);
+			return -EINVAL;
+		}
 
-		err = gpiod_export_link(dev, modem->gpios[i].name,
-							modem->gpios[i].gpio);
-		if (err)
-			return err;
+		if (pm == 1) {
+			err = gpiod_export(gpio_val, 0);
+			if (err)
+				return err;
+
+			err = gpiod_export_link(dev, gpio_name, gpio_val);
+			if (err)
+				return err;
+		}
+	}
+
+	/* gpios required by both generations */
+	if (!modem->gpio_cmt_en || !modem->gpio_cmt_apeslpx ||
+	    !modem->gpio_cmt_rst_rq) {
+		dev_err(dev, "missing gpio!");
+		return -ENXIO;
+	}
+
+	/* gpios required by first generations */
+	if (modem->type == RAPUYAMA_V1 &&
+	   (!modem->gpio_cmt_rst || !modem->gpio_cmt_bsi)) {
+		dev_err(dev, "missing gpio!");
+		return -ENXIO;
 	}
 
 	return 0;
@@ -163,6 +212,12 @@ static int nokia_modem_probe(struct device *dev)
 	dev_set_drvdata(dev, modem);
 	modem->device = dev;
 
+	if (of_device_is_compatible(np, "nokia,n900-modem")) {
+		modem->type = RAPUYAMA_V1;
+	} else {
+		modem->type = RAPUYAMA_V2;
+	}
+
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
 		dev_err(dev, "Invalid rst_ind interrupt (%d)\n", irq);
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/5] HSI: nokia-modem: kernel based PM
  2016-01-31  1:19 [PATCH 0/5] nokia-modem: kernel based PM Sebastian Reichel
  2016-01-31  1:19 ` [PATCH 1/5] HSI: nokia-modem: simplify kernel access to gpios Sebastian Reichel
@ 2016-01-31  1:19 ` Sebastian Reichel
  2016-01-31 17:29   ` Pavel Machek
  2016-01-31  1:19 ` [PATCH 3/5] HSI: ssi-protocol: export modem info via sysfs Sebastian Reichel
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Sebastian Reichel @ 2016-01-31  1:19 UTC (permalink / raw)
  To: Sebastian Reichel, Tony Lindgren, Benoît Cousson, Aaro Koskinen
  Cc: Pali Rohár, Pavel Machek, linux-omap, linux-kernel

So far power management had to be done in uerspace using exported GPIOs.
This patch adds kernel based power management, which will bind the
modem's power state to the state of the phonet network interface.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/hsi/clients/nokia-modem.c  | 116 +++++++++++++++++++++++++++++++++++--
 drivers/hsi/clients/ssi_protocol.c |  21 +++++++
 include/linux/hsi/ssi_protocol.h   |   9 +++
 3 files changed, 141 insertions(+), 5 deletions(-)

diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c
index f20ede611593..6485f4c61092 100644
--- a/drivers/hsi/clients/nokia-modem.c
+++ b/drivers/hsi/clients/nokia-modem.c
@@ -28,11 +28,12 @@
 #include <linux/of_irq.h>
 #include <linux/of_gpio.h>
 #include <linux/hsi/ssi_protocol.h>
+#include <linux/delay.h>
 
 static unsigned int pm = 1;
 module_param(pm, int, 0400);
 MODULE_PARM_DESC(pm,
-	"Enable power management (0=disabled, 1=userland based [default])");
+	"Enable power management (0=disabled, 1=userland based [default], 2=kernel based)");
 
 enum nokia_modem_type {
 	RAPUYAMA_V1,
@@ -51,6 +52,7 @@ struct nokia_modem_device {
 	struct gpio_desc	*gpio_cmt_rst_rq;
 	struct gpio_desc	*gpio_cmt_rst;
 	struct gpio_desc	*gpio_cmt_bsi;
+	struct notifier_block	nb;
 };
 
 static void do_nokia_modem_rst_ind_tasklet(unsigned long data)
@@ -75,6 +77,93 @@ static irqreturn_t nokia_modem_rst_ind_isr(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static void nokia_modem_power_boot(struct nokia_modem_device *modem)
+{
+	/* skip flash mode */
+	gpiod_set_value(modem->gpio_cmt_apeslpx, 0);
+	/* prevent current drain */
+	gpiod_set_value(modem->gpio_cmt_rst_rq, 0);
+
+	if (modem->type == RAPUYAMA_V1) {
+		gpiod_set_value(modem->gpio_cmt_en, 0);
+		/* toggle BSI visible to modem */
+		gpiod_set_value(modem->gpio_cmt_bsi, 0);
+		/* Assert PURX */
+		gpiod_set_value(modem->gpio_cmt_rst, 0);
+		/* Press "power key" */
+		gpiod_set_value(modem->gpio_cmt_en, 1);
+		/* Release CMT to boot */
+		gpiod_set_value(modem->gpio_cmt_rst, 1);
+	} else if(modem->type == RAPUYAMA_V2) {
+		gpiod_set_value(modem->gpio_cmt_en, 0);
+		/* 15 ms needed for ASIC poweroff */
+		usleep_range(15000, 25000);
+		gpiod_set_value(modem->gpio_cmt_en, 1);
+	}
+
+	gpiod_set_value(modem->gpio_cmt_rst_rq, 1);
+}
+
+static void nokia_modem_power_on(struct nokia_modem_device *modem)
+{
+	gpiod_set_value(modem->gpio_cmt_rst_rq, 0);
+
+	if (modem->type == RAPUYAMA_V1) {
+		/* release "power key" */
+		gpiod_set_value(modem->gpio_cmt_en, 0);
+	}
+}
+
+static void nokia_modem_power_off(struct nokia_modem_device *modem)
+{
+	/* skip flash mode */
+	gpiod_set_value(modem->gpio_cmt_apeslpx, 0);
+	/* prevent current drain */
+	gpiod_set_value(modem->gpio_cmt_rst_rq, 0);
+
+	if (modem->type == RAPUYAMA_V1) {
+		/* release "power key" */
+		gpiod_set_value(modem->gpio_cmt_en, 0);
+		/* force modem to reset state */
+		gpiod_set_value(modem->gpio_cmt_rst, 0);
+		/* release modem to be powered off by bootloader */
+		gpiod_set_value(modem->gpio_cmt_rst, 1);
+	} else if(modem->type == RAPUYAMA_V2) {
+		/* power off */
+		gpiod_set_value(modem->gpio_cmt_en, 0);
+	}
+}
+
+static int ssi_protocol_event(struct notifier_block *nb, unsigned long event,
+			      void *data __maybe_unused)
+{
+	struct nokia_modem_device *modem =
+		container_of(nb, struct nokia_modem_device, nb);
+
+	switch(event) {
+		/* called on interface up */
+		case STATE_BOOT:
+			dev_info(modem->device, "modem power state: boot");
+			nokia_modem_power_boot(modem);
+			break;
+		/* called on link up */
+		case STATE_ON:
+			dev_info(modem->device, "modem power state: enabled");
+			nokia_modem_power_on(modem);
+			break;
+		/* called on interface down */
+		case STATE_OFF:
+			dev_info(modem->device, "modem power state: disabled");
+			nokia_modem_power_off(modem);
+			break;
+		default:
+			dev_warn(modem->device, "unknown ssi-protocol event");
+			break;
+	}
+
+	return NOTIFY_DONE;
+}
+
 static void nokia_modem_gpio_unexport(struct device *dev)
 {
 	struct nokia_modem_device *modem = dev_get_drvdata(dev);
@@ -218,6 +307,9 @@ static int nokia_modem_probe(struct device *dev)
 		modem->type = RAPUYAMA_V2;
 	}
 
+	modem->nb.notifier_call = ssi_protocol_event;
+	modem->nb.priority = INT_MAX;
+
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
 		dev_err(dev, "Invalid rst_ind interrupt (%d)\n", irq);
@@ -268,6 +360,14 @@ static int nokia_modem_probe(struct device *dev)
 		goto error3;
 	}
 
+	if (pm == 2) {
+		err = ssip_notifier_register(modem->ssi_protocol, &modem->nb);
+		if (err < 0) {
+			dev_err(dev, "Could not register ssi-protocol notifier!");
+			goto error3;
+		}
+	}
+
 	cmtspeech.name = "cmt-speech";
 	cmtspeech.tx_cfg = cl->tx_cfg;
 	cmtspeech.rx_cfg = cl->rx_cfg;
@@ -278,25 +378,28 @@ static int nokia_modem_probe(struct device *dev)
 	if (!modem->cmt_speech) {
 		dev_err(dev, "Could not register cmt-speech device\n");
 		err = -ENOMEM;
-		goto error3;
+		goto error4;
 	}
 
 	err = device_attach(&modem->cmt_speech->device);
 	if (err == 0) {
 		dev_dbg(dev, "Missing cmt-speech driver\n");
 		err = -EPROBE_DEFER;
-		goto error4;
+		goto error5;
 	} else if (err < 0) {
 		dev_err(dev, "Could not load cmt-speech driver (%d)\n", err);
-		goto error4;
+		goto error5;
 	}
 
 	dev_info(dev, "Registered Nokia HSI modem\n");
 
 	return 0;
 
-error4:
+error5:
 	hsi_remove_client(&modem->cmt_speech->device, NULL);
+error4:
+	if (pm == 2)
+		ssip_notifier_unregister(modem->ssi_protocol, &modem->nb);
 error3:
 	hsi_remove_client(&modem->ssi_protocol->device, NULL);
 error2:
@@ -320,6 +423,9 @@ static int nokia_modem_remove(struct device *dev)
 		modem->cmt_speech = NULL;
 	}
 
+	if (pm == 2)
+		ssip_notifier_unregister(modem->ssi_protocol, &modem->nb);
+
 	if (modem->ssi_protocol) {
 		hsi_remove_client(&modem->ssi_protocol->device, NULL);
 		modem->ssi_protocol = NULL;
diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 6595d2091268..cee33cab889e 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -153,6 +153,7 @@ struct ssi_protocol {
 	atomic_t		tx_usecnt;
 	int			channel_id_cmd;
 	int			channel_id_data;
+	struct blocking_notifier_head	modem_state_notifier;
 };
 
 /* List of ssi protocol instances */
@@ -735,6 +736,7 @@ static void ssip_rx_waketest(struct hsi_client *cl, u32 cmd)
 	dev_dbg(&cl->device, "CMT is ONLINE\n");
 	netif_wake_queue(ssi->netdev);
 	netif_carrier_on(ssi->netdev);
+	blocking_notifier_call_chain(&ssi->modem_state_notifier, STATE_ON, NULL);
 }
 
 static void ssip_rx_ready(struct hsi_client *cl)
@@ -924,6 +926,7 @@ static int ssip_pn_open(struct net_device *dev)
 			err);
 		return err;
 	}
+	blocking_notifier_call_chain(&ssi->modem_state_notifier, STATE_BOOT, NULL);
 	dev_dbg(&cl->device, "Configuring SSI port\n");
 	hsi_setup(cl);
 	spin_lock_bh(&ssi->lock);
@@ -942,11 +945,14 @@ static int ssip_pn_open(struct net_device *dev)
 static int ssip_pn_stop(struct net_device *dev)
 {
 	struct hsi_client *cl = to_hsi_client(dev->dev.parent);
+	struct ssi_protocol *ssi = hsi_client_drvdata(cl);
 
 	ssip_reset(cl);
 	hsi_unregister_port_event(cl);
 	hsi_release_port(cl);
 
+	blocking_notifier_call_chain(&ssi->modem_state_notifier, STATE_OFF, NULL);
+
 	return 0;
 }
 
@@ -1037,6 +1043,20 @@ void ssip_reset_event(struct hsi_client *master)
 }
 EXPORT_SYMBOL_GPL(ssip_reset_event);
 
+int ssip_notifier_register(struct hsi_client *master, struct notifier_block *nb)
+{
+	struct ssi_protocol *ssi = hsi_client_drvdata(master);
+	return blocking_notifier_chain_register(&ssi->modem_state_notifier, nb);
+}
+EXPORT_SYMBOL_GPL(ssip_notifier_register);
+
+int ssip_notifier_unregister(struct hsi_client *master, struct notifier_block *nb)
+{
+	struct ssi_protocol *ssi = hsi_client_drvdata(master);
+	return blocking_notifier_chain_unregister(&ssi->modem_state_notifier, nb);
+}
+EXPORT_SYMBOL_GPL(ssip_notifier_unregister);
+
 static const struct net_device_ops ssip_pn_ops = {
 	.ndo_open	= ssip_pn_open,
 	.ndo_stop	= ssip_pn_stop,
@@ -1085,6 +1105,7 @@ static int ssi_protocol_probe(struct device *dev)
 	ssi->keep_alive.function = ssip_keep_alive;
 	INIT_LIST_HEAD(&ssi->txqueue);
 	INIT_LIST_HEAD(&ssi->cmdqueue);
+	BLOCKING_INIT_NOTIFIER_HEAD(&ssi->modem_state_notifier);
 	atomic_set(&ssi->tx_usecnt, 0);
 	hsi_client_set_drvdata(cl, ssi);
 	ssi->cl = cl;
diff --git a/include/linux/hsi/ssi_protocol.h b/include/linux/hsi/ssi_protocol.h
index 1433651be0dc..6b742e9368a7 100644
--- a/include/linux/hsi/ssi_protocol.h
+++ b/include/linux/hsi/ssi_protocol.h
@@ -27,6 +27,12 @@
 
 #include <linux/hsi/hsi.h>
 
+enum nokia_modem_state {
+	STATE_BOOT,
+	STATE_ON,
+	STATE_OFF,
+};
+
 static inline void ssip_slave_put_master(struct hsi_client *master)
 {
 }
@@ -36,6 +42,9 @@ int ssip_slave_start_tx(struct hsi_client *master);
 int ssip_slave_stop_tx(struct hsi_client *master);
 void ssip_reset_event(struct hsi_client *master);
 
+int ssip_notifier_register(struct hsi_client *master, struct notifier_block *nb);
+int ssip_notifier_unregister(struct hsi_client *master, struct notifier_block *nb);
+
 int ssip_slave_running(struct hsi_client *master);
 
 #endif /* __LINUX_SSIP_SLAVE_H__ */
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/5] HSI: ssi-protocol: export modem info via sysfs
  2016-01-31  1:19 [PATCH 0/5] nokia-modem: kernel based PM Sebastian Reichel
  2016-01-31  1:19 ` [PATCH 1/5] HSI: nokia-modem: simplify kernel access to gpios Sebastian Reichel
  2016-01-31  1:19 ` [PATCH 2/5] HSI: nokia-modem: kernel based PM Sebastian Reichel
@ 2016-01-31  1:19 ` Sebastian Reichel
  2016-01-31 17:36   ` Pavel Machek
  2016-01-31  1:19 ` [PATCH 4/5] HSI: nokia-modem: drop support for disabled pm Sebastian Reichel
  2016-01-31  1:19 ` [PATCH 5/5] HSI: ssi-protocol: clear carrier flag on open Sebastian Reichel
  4 siblings, 1 reply; 14+ messages in thread
From: Sebastian Reichel @ 2016-01-31  1:19 UTC (permalink / raw)
  To: Sebastian Reichel, Tony Lindgren, Benoît Cousson, Aaro Koskinen
  Cc: Pali Rohár, Pavel Machek, linux-omap, linux-kernel

Currently userspace knows about the rapuyama version by
checking, which gpios have been exported. This does no
longer work with kernel based power management, so export
a sysfs file, which provides the rapuyama generation. Also
export a link to the nokia-modem, so that userspace can
easily check if kernel based PM is used.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/hsi/clients/nokia-modem.c  | 10 ++++------
 drivers/hsi/clients/ssi_protocol.c | 33 ++++++++++++++++++++++++++++++++-
 include/linux/hsi/ssi_protocol.h   | 11 +++++++++++
 3 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c
index 6485f4c61092..1b4a250cf113 100644
--- a/drivers/hsi/clients/nokia-modem.c
+++ b/drivers/hsi/clients/nokia-modem.c
@@ -35,11 +35,6 @@ module_param(pm, int, 0400);
 MODULE_PARM_DESC(pm,
 	"Enable power management (0=disabled, 1=userland based [default], 2=kernel based)");
 
-enum nokia_modem_type {
-	RAPUYAMA_V1,
-	RAPUYAMA_V2,
-};
-
 struct nokia_modem_device {
 	struct tasklet_struct	nokia_modem_rst_ind_tasklet;
 	int			nokia_modem_rst_ind_irq;
@@ -285,6 +280,7 @@ static int nokia_modem_probe(struct device *dev)
 	struct hsi_port *port = hsi_get_port(cl);
 	int irq, pflags, err;
 	struct hsi_board_info ssip;
+	struct ssi_protocol_platform_data ssip_pdata;
 	struct hsi_board_info cmtspeech;
 
 	np = dev->of_node;
@@ -340,7 +336,9 @@ static int nokia_modem_probe(struct device *dev)
 	ssip.name = "ssi-protocol";
 	ssip.tx_cfg = cl->tx_cfg;
 	ssip.rx_cfg = cl->rx_cfg;
-	ssip.platform_data = NULL;
+	ssip_pdata.type = modem->type;
+	ssip_pdata.nokia_modem_dev = dev;
+	ssip.platform_data = &ssip_pdata;
 	ssip.archdata = NULL;
 
 	modem->ssi_protocol = hsi_new_client(port, &ssip);
diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index cee33cab889e..3fb5b98b2c63 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -154,6 +154,7 @@ struct ssi_protocol {
 	int			channel_id_cmd;
 	int			channel_id_data;
 	struct blocking_notifier_head	modem_state_notifier;
+	enum nokia_modem_type	modem_type;
 };
 
 /* List of ssi protocol instances */
@@ -1080,10 +1081,20 @@ static void ssip_pn_setup(struct net_device *dev)
 	dev->header_ops		= &phonet_header_ops;
 }
 
+static ssize_t show_rapuyama_version(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct hsi_client *cl = to_hsi_client(dev);
+	struct ssi_protocol *ssi = hsi_client_drvdata(cl);
+
+	return sprintf(buf, "%d", ssi->modem_type);
+}
+static DEVICE_ATTR(rapuyama_version, S_IRUGO, show_rapuyama_version, 0);
+
 static int ssi_protocol_probe(struct device *dev)
 {
 	static const char ifname[] = "phonet%d";
 	struct hsi_client *cl = to_hsi_client(dev);
+	struct ssi_protocol_platform_data *pdata = dev_get_platdata(dev);
 	struct ssi_protocol *ssi;
 	int err;
 
@@ -1093,6 +1104,8 @@ static int ssi_protocol_probe(struct device *dev)
 		return -ENOMEM;
 	}
 
+	ssi->modem_type = pdata->type;
+
 	spin_lock_init(&ssi->lock);
 	init_timer_deferrable(&ssi->rx_wd);
 	init_timer_deferrable(&ssi->tx_wd);
@@ -1137,12 +1150,24 @@ static int ssi_protocol_probe(struct device *dev)
 		goto out1;
 	}
 
+	err = device_create_file(dev, &dev_attr_rapuyama_version);
+	if (err < 0) {
+		dev_err(dev, "Could not create sysfs file for rapuyama version");
+		goto out2;
+	}
+
+	err = sysfs_create_link(&dev->kobj, &pdata->nokia_modem_dev->kobj, "nokia-modem");
+	if (err < 0) {
+		dev_err(dev, "Could not create sysfs symlink to nokia-modem");
+		goto out3;
+	}
+
 	SET_NETDEV_DEV(ssi->netdev, dev);
 	netif_carrier_off(ssi->netdev);
 	err = register_netdev(ssi->netdev);
 	if (err < 0) {
 		dev_err(dev, "Register netdev failed (%d)\n", err);
-		goto out2;
+		goto out4;
 	}
 
 	list_add(&ssi->link, &ssip_list);
@@ -1151,6 +1176,10 @@ static int ssi_protocol_probe(struct device *dev)
 		ssi->channel_id_cmd, ssi->channel_id_data);
 
 	return 0;
+out4:
+	sysfs_remove_link(&dev->kobj, "nokia-modem");
+out3:
+	device_remove_file(dev, &dev_attr_rapuyama_version);
 out2:
 	free_netdev(ssi->netdev);
 out1:
@@ -1167,6 +1196,8 @@ static int ssi_protocol_remove(struct device *dev)
 	struct ssi_protocol *ssi = hsi_client_drvdata(cl);
 
 	list_del(&ssi->link);
+	sysfs_remove_link(&dev->kobj, "nokia-modem");
+	device_remove_file(dev, &dev_attr_rapuyama_version);
 	unregister_netdev(ssi->netdev);
 	ssip_free_cmds(ssi);
 	hsi_client_set_drvdata(cl, NULL);
diff --git a/include/linux/hsi/ssi_protocol.h b/include/linux/hsi/ssi_protocol.h
index 6b742e9368a7..ba069812341b 100644
--- a/include/linux/hsi/ssi_protocol.h
+++ b/include/linux/hsi/ssi_protocol.h
@@ -33,6 +33,17 @@ enum nokia_modem_state {
 	STATE_OFF,
 };
 
+enum nokia_modem_type {
+	UNKNOWN = 0,
+	RAPUYAMA_V1,
+	RAPUYAMA_V2,
+};
+
+struct ssi_protocol_platform_data {
+	enum nokia_modem_type type;
+	struct device *nokia_modem_dev;
+};
+
 static inline void ssip_slave_put_master(struct hsi_client *master)
 {
 }
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/5] HSI: nokia-modem: drop support for disabled pm
  2016-01-31  1:19 [PATCH 0/5] nokia-modem: kernel based PM Sebastian Reichel
                   ` (2 preceding siblings ...)
  2016-01-31  1:19 ` [PATCH 3/5] HSI: ssi-protocol: export modem info via sysfs Sebastian Reichel
@ 2016-01-31  1:19 ` Sebastian Reichel
  2016-01-31 11:24   ` Pali Rohár
  2016-01-31  1:19 ` [PATCH 5/5] HSI: ssi-protocol: clear carrier flag on open Sebastian Reichel
  4 siblings, 1 reply; 14+ messages in thread
From: Sebastian Reichel @ 2016-01-31  1:19 UTC (permalink / raw)
  To: Sebastian Reichel, Tony Lindgren, Benoît Cousson, Aaro Koskinen
  Cc: Pali Rohár, Pavel Machek, linux-omap, linux-kernel

Disabled power management means, that the driver can only be
used together with further out-of-tree kernel patches. There
is no reason to support this in the mainline kernel and not
having support for it means, that userspace can automatically
detect if we are running kernel based power management.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/hsi/clients/nokia-modem.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c
index 1b4a250cf113..5e333eb82912 100644
--- a/drivers/hsi/clients/nokia-modem.c
+++ b/drivers/hsi/clients/nokia-modem.c
@@ -33,7 +33,7 @@
 static unsigned int pm = 1;
 module_param(pm, int, 0400);
 MODULE_PARM_DESC(pm,
-	"Enable power management (0=disabled, 1=userland based [default], 2=kernel based)");
+	"Enable power management (1=userland based [default], 2=kernel based)");
 
 struct nokia_modem_device {
 	struct tasklet_struct	nokia_modem_rst_ind_tasklet;
@@ -198,6 +198,11 @@ static int nokia_modem_gpio_probe(struct device *dev)
 	struct nokia_modem_device *modem = dev_get_drvdata(dev);
 	int gpio_count, gpio_name_count, i, err;
 
+	if (pm != 1 && pm != 2) {
+		dev_err(dev, "invalid pm configuration!");
+		return -EINVAL;
+	}
+
 	gpio_count = of_gpio_count(np);
 
 	if (gpio_count < 0) {
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/5] HSI: ssi-protocol: clear carrier flag on open
  2016-01-31  1:19 [PATCH 0/5] nokia-modem: kernel based PM Sebastian Reichel
                   ` (3 preceding siblings ...)
  2016-01-31  1:19 ` [PATCH 4/5] HSI: nokia-modem: drop support for disabled pm Sebastian Reichel
@ 2016-01-31  1:19 ` Sebastian Reichel
  4 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2016-01-31  1:19 UTC (permalink / raw)
  To: Sebastian Reichel, Tony Lindgren, Benoît Cousson, Aaro Koskinen
  Cc: Pali Rohár, Pavel Machek, linux-omap, linux-kernel

If the interface is just being enabled, the modem is not
yet ready to be used, so clear the carrier flag (which is
e.g. set by ifconfig and ofono).

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/hsi/clients/ssi_protocol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 3fb5b98b2c63..264f81cfa095 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -916,6 +916,8 @@ static int ssip_pn_open(struct net_device *dev)
 	struct ssi_protocol *ssi = hsi_client_drvdata(cl);
 	int err;
 
+	netif_carrier_off(ssi->netdev);
+
 	err = hsi_claim_port(cl, 1);
 	if (err < 0) {
 		dev_err(&cl->device, "SSI port already claimed\n");
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] HSI: nokia-modem: drop support for disabled pm
  2016-01-31  1:19 ` [PATCH 4/5] HSI: nokia-modem: drop support for disabled pm Sebastian Reichel
@ 2016-01-31 11:24   ` Pali Rohár
  2016-01-31 16:10     ` Sebastian Reichel
  0 siblings, 1 reply; 14+ messages in thread
From: Pali Rohár @ 2016-01-31 11:24 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen, Pavel Machek,
	linux-omap, linux-kernel, Ivaylo Dimitrov

[-- Attachment #1: Type: Text/Plain, Size: 1868 bytes --]

On Sunday 31 January 2016 02:19:46 Sebastian Reichel wrote:
> Disabled power management means, that the driver can only be
> used together with further out-of-tree kernel patches. There
> is no reason to support this in the mainline kernel and not
> having support for it means, that userspace can automatically
> detect if we are running kernel based power management.

Hi!

I'm against this change. It will break support for (patched) Maemo and 
proprietary Nokia sscd modem daemon.

Also you can export GPIOs manually via sysfs and touch that state. Which 
means that you can do power management with mainline kernel even if you 
set nokia-modem.pm=0. So please drop this patch.

> Signed-off-by: Sebastian Reichel <sre@kernel.org>
> ---
>  drivers/hsi/clients/nokia-modem.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hsi/clients/nokia-modem.c
> b/drivers/hsi/clients/nokia-modem.c index 1b4a250cf113..5e333eb82912
> 100644
> --- a/drivers/hsi/clients/nokia-modem.c
> +++ b/drivers/hsi/clients/nokia-modem.c
> @@ -33,7 +33,7 @@
>  static unsigned int pm = 1;
>  module_param(pm, int, 0400);
>  MODULE_PARM_DESC(pm,
> -	"Enable power management (0=disabled, 1=userland based [default],
> 2=kernel based)"); +	"Enable power management (1=userland based
> [default], 2=kernel based)");
> 
>  struct nokia_modem_device {
>  	struct tasklet_struct	nokia_modem_rst_ind_tasklet;
> @@ -198,6 +198,11 @@ static int nokia_modem_gpio_probe(struct device
> *dev) struct nokia_modem_device *modem = dev_get_drvdata(dev);
>  	int gpio_count, gpio_name_count, i, err;
> 
> +	if (pm != 1 && pm != 2) {
> +		dev_err(dev, "invalid pm configuration!");
> +		return -EINVAL;
> +	}
> +
>  	gpio_count = of_gpio_count(np);
> 
>  	if (gpio_count < 0) {

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] HSI: nokia-modem: drop support for disabled pm
  2016-01-31 11:24   ` Pali Rohár
@ 2016-01-31 16:10     ` Sebastian Reichel
  2016-02-08  8:50       ` Pali Rohár
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Reichel @ 2016-01-31 16:10 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen, Pavel Machek,
	linux-omap, linux-kernel, Ivaylo Dimitrov

[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]

Hi,

On Sun, Jan 31, 2016 at 12:24:34PM +0100, Pali Rohár wrote:
> On Sunday 31 January 2016 02:19:46 Sebastian Reichel wrote:
> > Disabled power management means, that the driver can only be
> > used together with further out-of-tree kernel patches. There
> > is no reason to support this in the mainline kernel and not
> > having support for it means, that userspace can automatically
> > detect if we are running kernel based power management.
> 
> I'm against this change. It will break support for (patched) Maemo and 
> proprietary Nokia sscd modem daemon.

Do you have some links for this? So far my assumption was, that sscd
requires /sys/devices/platform/gpio-switch, so you either need to
patch sscd somehow, or patch the kernel to provide gpio-switch, or
provide some kind of userspace wrapper.

> Also you can export GPIOs manually via sysfs and touch that state. Which 
> means that you can do power management with mainline kernel even if you 
> set nokia-modem.pm=0.

Yeah... You export GPIOs manually. Did you actually try this? You
will end up with exactly the same result as nokia-modem.pm=1, just
with a few less symlinks. Also you have to make sure, that you
actually exported the right gpios, since the global gpio number is
dependent on the gpio-controller registration order.

> So please drop this patch.

Please provide facts, that Maemo can use pm=0 without additional
kernel patches and does not work with pm=1.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] HSI: nokia-modem: kernel based PM
  2016-01-31  1:19 ` [PATCH 2/5] HSI: nokia-modem: kernel based PM Sebastian Reichel
@ 2016-01-31 17:29   ` Pavel Machek
  2016-01-31 18:00     ` Sebastian Reichel
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2016-01-31 17:29 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen,
	Pali Rohár, linux-omap, linux-kernel

Hi!

> So far power management had to be done in uerspace using exported

"userspace"

> This patch adds kernel based power management, which will bind the
> modem's power state to the state of the phonet network interface.

Ok, so I have ofonod that already does power management in
userspace. What happens when power management is done twice?

Best regards,
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] HSI: ssi-protocol: export modem info via sysfs
  2016-01-31  1:19 ` [PATCH 3/5] HSI: ssi-protocol: export modem info via sysfs Sebastian Reichel
@ 2016-01-31 17:36   ` Pavel Machek
  2016-01-31 18:34     ` Sebastian Reichel
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2016-01-31 17:36 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen,
	Pali Rohár, linux-omap, linux-kernel

On Sun 2016-01-31 02:19:45, Sebastian Reichel wrote:
> Currently userspace knows about the rapuyama version by
> checking, which gpios have been exported. This does no
> longer work with kernel based power management, so export
> a sysfs file, which provides the rapuyama generation. Also

Umm. So patches 1-2 make it impossible for existing userspace to
detect modem version?

Even if we re-add the capability with this patch, that makes it bad
idea, no?
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] HSI: nokia-modem: kernel based PM
  2016-01-31 17:29   ` Pavel Machek
@ 2016-01-31 18:00     ` Sebastian Reichel
  2016-02-07 21:39       ` Pavel Machek
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Reichel @ 2016-01-31 18:00 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen,
	Pali Rohár, linux-omap, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

Hi,

On Sun, Jan 31, 2016 at 06:29:48PM +0100, Pavel Machek wrote:
> > So far power management had to be done in uerspace using exported
> 
> "userspace"

Right, thanks.

> > This patch adds kernel based power management, which will bind the
> > modem's power state to the state of the phonet network interface.
> 
> Ok, so I have ofonod that already does power management in
> userspace. What happens when power management is done twice?

I have patches for ofono, which add support for the in-kernel
power management. Currently ofono will not start with the new
method, since it wants the GPIOs for userspace based PM.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] HSI: ssi-protocol: export modem info via sysfs
  2016-01-31 17:36   ` Pavel Machek
@ 2016-01-31 18:34     ` Sebastian Reichel
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2016-01-31 18:34 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen,
	Pali Rohár, linux-omap, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2525 bytes --]

Hi Pavel,

On Sun, Jan 31, 2016 at 06:36:05PM +0100, Pavel Machek wrote:
> On Sun 2016-01-31 02:19:45, Sebastian Reichel wrote:
> > Currently userspace knows about the rapuyama version by
> > checking, which gpios have been exported. This does no
> > longer work with kernel based power management, so export
> > a sysfs file, which provides the rapuyama generation. Also
> 
> Umm. So patches 1-2 make it impossible for existing userspace to
> detect modem version?
> 
> Even if we re-add the capability with this patch, that makes it bad
> idea, no?

Thanks for having a look at the patches :) Looks like my commit
messages are not verbose enough to show the whole thing. Let me
try a more verbose explanation:

The N900 and the N950 have more or less the same modem, but with
different GPIOs. That basically means, that the powerup/down
sequence works differently. OFono has code for supporting power
management of both modems by detecting, that some gpios have not
been exported. (So if, for some reason, you have not exported
some of the GPIOs it will also think, that you have an N950 modem)

For kernel based PM there won't be any GPIOs exported, so OFono
cannot derive modem generation information from them. OTOH it
no longer needs to, since the kernel will take care of the
difference between the power up/down sequence. OFono only uses
the derived modem generation information for the different power
sequence.

Unfortunately there is another difference between the N900 and N950
modem, that is not yet covered by OFono at all: The N950 has a
broken CBS interface. So the current OFono code base is broken for
the N950, even though it can power it up. The broken N950 CBS
interface is currently not handled by either ofono, fso-gsmd or
sscd. Thus using an explicit new interface is not a problem IMHO.

Anyways, after this patchset you have the following methods for
using the modem:

1. The existing way using pm=1, which is still the default for now.
2. The existing way using pm=1 + rapuyama_version to check if all
   GPIOs are there.
3. The new way using pm=2. You can use rapuyama_version for avoiding
   the CBS interface on N950.

I don't think we can easily remove pm=1 support, since it will be
needed by existing userspace software. I do think though, that we
can change the default from pm=1 to pm=2 when support for the new
interface has been integrated into userspace software for some time
(e.g. 1 year after it has been merged).

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] HSI: nokia-modem: kernel based PM
  2016-01-31 18:00     ` Sebastian Reichel
@ 2016-02-07 21:39       ` Pavel Machek
  0 siblings, 0 replies; 14+ messages in thread
From: Pavel Machek @ 2016-02-07 21:39 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen,
	Pali Rohár, linux-omap, linux-kernel

On Sun 2016-01-31 19:00:09, Sebastian Reichel wrote:
> Hi,
> 
> On Sun, Jan 31, 2016 at 06:29:48PM +0100, Pavel Machek wrote:
> > > So far power management had to be done in uerspace using exported
> > 
> > "userspace"
> 
> Right, thanks.
> 
> > > This patch adds kernel based power management, which will bind the
> > > modem's power state to the state of the phonet network interface.
> > 
> > Ok, so I have ofonod that already does power management in
> > userspace. What happens when power management is done twice?
> 
> I have patches for ofono, which add support for the in-kernel
> power management. Currently ofono will not start with the new
> method, since it wants the GPIOs for userspace based PM.

Ok, but breaking userspace is a no-no, and stock ofono works well on
N900. So this should not go in as-is...?
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] HSI: nokia-modem: drop support for disabled pm
  2016-01-31 16:10     ` Sebastian Reichel
@ 2016-02-08  8:50       ` Pali Rohár
  0 siblings, 0 replies; 14+ messages in thread
From: Pali Rohár @ 2016-02-08  8:50 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen, Pavel Machek,
	linux-omap, linux-kernel, Ivaylo Dimitrov

On Sunday 31 January 2016 17:10:52 Sebastian Reichel wrote:
> Hi,
> 
> On Sun, Jan 31, 2016 at 12:24:34PM +0100, Pali Rohár wrote:
> > On Sunday 31 January 2016 02:19:46 Sebastian Reichel wrote:
> > > Disabled power management means, that the driver can only be
> > > used together with further out-of-tree kernel patches. There
> > > is no reason to support this in the mainline kernel and not
> > > having support for it means, that userspace can automatically
> > > detect if we are running kernel based power management.
> > 
> > I'm against this change. It will break support for (patched) Maemo and 
> > proprietary Nokia sscd modem daemon.
> 
> Do you have some links for this? So far my assumption was, that sscd
> requires /sys/devices/platform/gpio-switch, so you either need to
> patch sscd somehow, or patch the kernel to provide gpio-switch, or
> provide some kind of userspace wrapper.

I can either patch kernel to provide gpio-switch interface or use some
kind of user space hacks to provide this interface (e.g mount bind or
fuse fs mounted to that location).

> > Also you can export GPIOs manually via sysfs and touch that state. Which 
> > means that you can do power management with mainline kernel even if you 
> > set nokia-modem.pm=0.
> 
> Yeah... You export GPIOs manually. Did you actually try this? You

Yes, this is what preinit script is doing.

> will end up with exactly the same result as nokia-modem.pm=1, just
> with a few less symlinks. Also you have to make sure, that you
> actually exported the right gpios, since the global gpio number is
> dependent on the gpio-controller registration order.
> 
> > So please drop this patch.
> 
> Please provide facts, that Maemo can use pm=0 without additional
> kernel patches and does not work with pm=1.

Currently we use simple kernel driver which register gpio-switch
interface. Why to remove something which is 1) working and is 2) useful
for users & developers?

-- 
Pali Rohár
pali.rohar@gmail.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-02-08  8:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-31  1:19 [PATCH 0/5] nokia-modem: kernel based PM Sebastian Reichel
2016-01-31  1:19 ` [PATCH 1/5] HSI: nokia-modem: simplify kernel access to gpios Sebastian Reichel
2016-01-31  1:19 ` [PATCH 2/5] HSI: nokia-modem: kernel based PM Sebastian Reichel
2016-01-31 17:29   ` Pavel Machek
2016-01-31 18:00     ` Sebastian Reichel
2016-02-07 21:39       ` Pavel Machek
2016-01-31  1:19 ` [PATCH 3/5] HSI: ssi-protocol: export modem info via sysfs Sebastian Reichel
2016-01-31 17:36   ` Pavel Machek
2016-01-31 18:34     ` Sebastian Reichel
2016-01-31  1:19 ` [PATCH 4/5] HSI: nokia-modem: drop support for disabled pm Sebastian Reichel
2016-01-31 11:24   ` Pali Rohár
2016-01-31 16:10     ` Sebastian Reichel
2016-02-08  8:50       ` Pali Rohár
2016-01-31  1:19 ` [PATCH 5/5] HSI: ssi-protocol: clear carrier flag on open Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.