Re: Re: [RFCv4 06/11] misc: Introduce Nokia CMT driver

From: Ivajlo Dimitrov
Date: Tue Dec 17 2013 - 13:00:08 EST



On 16.12.2013 20:34, Sebastian Reichel wrote:
Hi,

On Mon, Dec 16, 2013 at 02:31:53PM +0100, Linus Walleij wrote:
I am very reluctant in letting device trees specify exports of GPIOs
to userspace, not so much because it's Linux-specific but for
the fact that people are doing things in userspace that should not
be done in userspace.

Last time it was proposed I asked to the specific usecase,
exactly why userspace needed this handle on a physical
GPIO line, and why it can't use another userspace interface
(example: leds, keys etc.)
There are a couple of lines ("cmt_apeslpx", "cmt_rst_rq", "cmt_en",
"cmt_rst", "cmt_bsi"), which are handled by ofono to do the correct
power sequence for the modem. The relevant ofono code is here:

https://git.kernel.org/cgit/network/ofono/ofono.git/tree/plugins/nokia-gpio.c

In MeeGo etc. they have a little board specific init script, which
exports the gpio lines and setups some symlinks. IMHO at least the
board specific stuff should be handled by the kernel, thus I added
this code to the driver. I guess you prefer to move the power
sequencing completly to the kernel?

Don't forget there is not only ofono, but rtcom-call-ui and all the telephony stack in Maemo 5 :). However, power sequencing and control is specific not only to the modem model, but to the firmware version the modem is running as well (afaik). IMO you can't simply move the modem power/reset/sleep control to the kernel and hope for the best, I am not sure there is enough documentation (if any) for this to be done reliably, esp on n900 with its BB5 modem. The point is that those gpios are used not only for the initial power-up, but for control of the modem state and reset (if needed) during normal usage. The APE reset line is an example of stuff that can't be moved to the kernel without providing some interface/feedback to/from the userspace IMO - what if she is dialing 112 at the moment the modem decides it is too hot and wants a device reset (or whatever reason there could be for a modem to request a device reset)? The same goes for the APE sleep request line (cmt_apeslpx) - based on what should the kernel decide whether to put the modem in sleep?

Sure, exporting gpios to userspace might not be the best way to achieve the required functionality, but every way could be argued if it is the best. And for sure labeling a modem "LED" won't make it such.

Regards,
Ivo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/