Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [RFC/PATCH 2/5] device property: introduce notion of subnodes for legacy boards
From: Heikki Krogerus @ 2018-10-11  8:18 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Walleij, Rafael J . Wysocki, linux-input, linux-gpio,
	linux-kernel, Andy Shevchenko
In-Reply-To: <20181005214734.GC215120@dtor-ws>

Hi Dmitry,

Sorry for the late reply. I decided to give this a try myself, and
I've now prepared something (not for the gpio stuff!). I'll do a quick
internal review round, and send it to you guys as RFC after that..

On Fri, Oct 05, 2018 at 02:47:34PM -0700, Dmitry Torokhov wrote:
> Hi Heikki,
> 
> On Tue, Sep 25, 2018 at 03:19:27PM +0300, Heikki Krogerus wrote:
> > On Mon, Sep 24, 2018 at 11:45:43AM -0700, Dmitry Torokhov wrote:
> > > I think we are talking about totally different use cases and that is why
> > > we are having hard time coming to a mutually agreeable solution. Could
> > > you please describe in more detail what you would like to achieve,
> > > and preferably show how it is described now with DT and/or ACPI, so that
> > > I have a better frame of reference.
> > 
> > Yes, of course. Sorry.
> > 
> > USB ports are devices that usually the USB controller drivers register
> > (or actually the USB core code). They are represented in both ACPI and
> > DT as child nodes of the controller device node. The USB connector OF
> > node is defined in file
> > Documentation/devicetree/bindings/connector/usb-connector.txt
> > 
> > In short, the controller drivers will request handle to a child node
> > that represents a port, and only after that register the actual port
> > device.
> > 
> > The drivers I'm looking at currently are the USB Type-C port
> > controller drivers and the port manager (in Greg's usb-next or
> > linux-next):
> > 
> >         drivers/usb/typec/tcpm/tcpci.c
> >         drivers/usb/typec/tcpm/fusb302.c
> >         drivers/usb/typec/tcpm/tcpm.c
> > 
> > The goal is simply to get rid of the platform data as usual, and
> > ideally so that we don't need any extra code in order to support the
> > "legacy" platforms.
> 
> Are these actually used on any of the "legacy" platforms? I fetched
> linux-next today, but I do not actually see anything in
> drivers/usb/typec touching platform data...

It's not touching any platform data, and I would like to keep it that
way :-). The device for fusb302 is created for example in
drivers/platform/x86/intel_cht_int33fe.c.

The fusb302.c driver already tries to find that child node named
"connector" (and so do the other port drivers). I'm trying to supply
the driver that node here somehow so I can avoid quirks.

> In the context of the connector, even before we descend to child nodes
> details, how do you propose implementing references between fwnodes?
> Especially since the other node (in case you complementing existing
> topology) may be ACPI or DT instance?

The different fwnode types (ACPI, OF, etc.) must live in parallel,
i.e. you can not have something like ACPI parent node with
property_set children if that's what you mean. The "secondary" member
will link the different types of fwnodes together, but they will live
their separate lives. I'm not planning on changing that.

I'm just looking for a smooth way of describing the devices in
software when the firmware is not supplying the hardware description,
just like you. What I really need is separation of the fwnode
registration from device registration in those cases. For that I now
have a proposal, and I believe my proposal will work for you as a
baseline as well.


Thanks,

-- 
heikki

^ permalink raw reply

* [PATCH] HID: usbhid: Add quirk for Redragon/Dragonrise Seymur 2
From: Kai-Heng Feng @ 2018-10-11  7:56 UTC (permalink / raw)
  To: jikos; +Cc: benjamin.tissoires, linux-input, linux-kernel, Kai-Heng Feng

Redragon Seymur 2 stops working since commit 190d7f02ce8e ("HID: input:
do not increment usages when a duplicate is found").

Use quirk HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE suggested by the commit
can solve the issue.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200995
BugLink: https://bugs.launchpad.net/bugs/1793846
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/hid/hid-ids.h    | 1 +
 drivers/hid/hid-quirks.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index bc49909aba8e..0e0aa7f0e6fc 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -342,6 +342,7 @@
 #define USB_DEVICE_ID_DMI_ENC		0x5fab
 
 #define USB_VENDOR_ID_DRAGONRISE		0x0079
+#define USB_DEVICE_ID_REDRAGON_SEYMUR2		0x0006
 #define USB_DEVICE_ID_DRAGONRISE_WIIU		0x1800
 #define USB_DEVICE_ID_DRAGONRISE_PS3		0x1801
 #define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR	0x1803
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 249d49b6b16c..52c3b01917e7 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -70,6 +70,7 @@ static const struct hid_device_id hid_quirks[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC), HID_QUIRK_NOGET },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRACAL_RAPHNET, USB_DEVICE_ID_RAPHNET_2NES2SNES), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRACAL_RAPHNET, USB_DEVICE_ID_RAPHNET_4NES4SNES), HID_QUIRK_MULTI_INPUT },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_REDRAGON_SEYMUR2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3), HID_QUIRK_MULTI_INPUT },
-- 
2.17.1

^ permalink raw reply related

* Re: [PATCH v2] Input: elants_i2c - Use DMA safe i2c when possible
From: Wolfram Sang @ 2018-10-11  7:29 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Dmitry Torokhov, linux-kernel, linux-input
In-Reply-To: <20181010200017.255874-1-swboyd@chromium.org>

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

On Wed, Oct 10, 2018 at 01:00:17PM -0700, Stephen Boyd wrote:
> This irq handler is always reading bytes from the device into a
> kmalloced buffer, so it's safe to mark this transaction as DMA safe.
> This avoids bouncing the buffer when an i2c controller decides to use
> DMA for a transaction.
> 
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

For the record:

Acked-by: Wolfram Sang <wsa@the-dreams.de>


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

^ permalink raw reply

* Re: [PATCH v2] Input: elants_i2c - Use DMA safe i2c when possible
From: Dmitry Torokhov @ 2018-10-11  0:11 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: linux-kernel, linux-input, Wolfram Sang
In-Reply-To: <20181010200017.255874-1-swboyd@chromium.org>

On Wed, Oct 10, 2018 at 01:00:17PM -0700, Stephen Boyd wrote:
> This irq handler is always reading bytes from the device into a
> kmalloced buffer, so it's safe to mark this transaction as DMA safe.
> This avoids bouncing the buffer when an i2c controller decides to use
> DMA for a transaction.
> 
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Changed patch description a bit (now that we are actually making the
buffer DMA-safe) and applied, thank you.

> ---
> 
> Changes from v1:
>  * Moved buf to end of structure to keep it cacheline aligned and DMA
>    safe
> 
>  drivers/input/touchscreen/elants_i2c.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index d21ca39b0fdb..f2cb23121833 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -147,10 +147,11 @@ struct elants_data {
>  	u8 cmd_resp[HEADER_SIZE];
>  	struct completion cmd_done;
>  
> -	u8 buf[MAX_PACKET_SIZE];
> -
>  	bool wake_irq_enabled;
>  	bool keep_power_in_suspend;
> +
> +	/* Must be last to be used for DMA operations */
> +	u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned;
>  };
>  
>  static int elants_i2c_send(struct i2c_client *client,
> @@ -863,7 +864,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev)
>  	int i;
>  	int len;
>  
> -	len = i2c_master_recv(client, ts->buf, sizeof(ts->buf));
> +	len = i2c_master_recv_dmasafe(client, ts->buf, sizeof(ts->buf));
>  	if (len < 0) {
>  		dev_err(&client->dev, "%s: failed to read data: %d\n",
>  			__func__, len);
> -- 
> Sent by a computer through tubes
> 

-- 
Dmitry

^ permalink raw reply

* [PATCH] HID: wacom: Work around HID descriptor bug in DTK-2451 and DTH-2452
From: Jason Gerecke @ 2018-10-10 20:40 UTC (permalink / raw)
  To: linux-input, Jiri Kosina, Benjamin Tissoires, Ping Cheng
  Cc: Jason Gerecke, Jason Gerecke, stable

The DTK-2451 and DTH-2452 have a buggy HID descriptor which incorrectly
contains a Cintiq-like report, complete with pen tilt, rotation, twist,
serial number, etc. The hardware doesn't actually support this data but
our driver duitifully sets up the device as though it does. To ensure
userspace has a correct view of devices without updated firmware, we clean
up this incorrect data in wacom_setup_device_quirks.

We're also careful to clear the WACOM_QUIRK_TOOLSERIAL flag since its
presence causes the driver to wait for serial number information (via
wacom_wac_pen_serial_enforce) that never comes, resulting in the pen
being non-responsive.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Fixes: 8341720642 ("HID: wacom: Queue events with missing type/serial data for later processing")
Cc: stable@vger.kernel.org # v4.16+
---
 drivers/hid/wacom_wac.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index e0a06be5ef5c..b4b4a30e3982 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -3335,6 +3335,7 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
 
 void wacom_setup_device_quirks(struct wacom *wacom)
 {
+	struct wacom_wac *wacom_wac = &wacom->wacom_wac;
 	struct wacom_features *features = &wacom->wacom_wac.features;
 
 	/* The pen and pad share the same interface on most devices */
@@ -3464,6 +3465,25 @@ void wacom_setup_device_quirks(struct wacom *wacom)
 
 	if (features->type == REMOTE)
 		features->device_type |= WACOM_DEVICETYPE_WL_MONITOR;
+
+	/* HID descriptor for DTK-2451 / DTH-2452 claims to report lots
+	 * of things it shouldn't. Lets fix up the damage...
+	 */
+	if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) {
+		features->quirks &= ~WACOM_QUIRK_TOOLSERIAL;
+		__clear_bit(BTN_TOOL_BRUSH, wacom_wac->pen_input->keybit);
+		__clear_bit(BTN_TOOL_PENCIL, wacom_wac->pen_input->keybit);
+		__clear_bit(BTN_TOOL_AIRBRUSH, wacom_wac->pen_input->keybit);
+		__clear_bit(ABS_Z, wacom_wac->pen_input->absbit);
+		__clear_bit(ABS_DISTANCE, wacom_wac->pen_input->absbit);
+		__clear_bit(ABS_TILT_X, wacom_wac->pen_input->absbit);
+		__clear_bit(ABS_TILT_Y, wacom_wac->pen_input->absbit);
+		__clear_bit(ABS_WHEEL, wacom_wac->pen_input->absbit);
+		__clear_bit(ABS_MISC, wacom_wac->pen_input->absbit);
+		__clear_bit(MSC_SERIAL, wacom_wac->pen_input->mscbit);
+		__clear_bit(EV_MSC, wacom_wac->pen_input->evbit);
+	}
 }
 
 int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
-- 
2.19.1

^ permalink raw reply related

* [PATCH v2] Input: elants_i2c - Use DMA safe i2c when possible
From: Stephen Boyd @ 2018-10-10 20:00 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-kernel, linux-input, Wolfram Sang

This irq handler is always reading bytes from the device into a
kmalloced buffer, so it's safe to mark this transaction as DMA safe.
This avoids bouncing the buffer when an i2c controller decides to use
DMA for a transaction.

Cc: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

Changes from v1:
 * Moved buf to end of structure to keep it cacheline aligned and DMA
   safe

 drivers/input/touchscreen/elants_i2c.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index d21ca39b0fdb..f2cb23121833 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -147,10 +147,11 @@ struct elants_data {
 	u8 cmd_resp[HEADER_SIZE];
 	struct completion cmd_done;
 
-	u8 buf[MAX_PACKET_SIZE];
-
 	bool wake_irq_enabled;
 	bool keep_power_in_suspend;
+
+	/* Must be last to be used for DMA operations */
+	u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned;
 };
 
 static int elants_i2c_send(struct i2c_client *client,
@@ -863,7 +864,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev)
 	int i;
 	int len;
 
-	len = i2c_master_recv(client, ts->buf, sizeof(ts->buf));
+	len = i2c_master_recv_dmasafe(client, ts->buf, sizeof(ts->buf));
 	if (len < 0) {
 		dev_err(&client->dev, "%s: failed to read data: %d\n",
 			__func__, len);
-- 
Sent by a computer through tubes

^ permalink raw reply related

* Re: [PATCH v2 5/8] Input: olpc_apsp: depend on CONFIG_OF
From: Dmitry Torokhov @ 2018-10-10 17:18 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk
In-Reply-To: <20181010142504.233467-6-lkundrak@v3.sk>

On Wed, Oct 10, 2018 at 04:25:01PM +0200, Lubomir Rintel wrote:
> This is a device-tree enabled driver. Moreover CONFIG_OLPC is specific
> to the x86 platform code, while the driver is for an ARM-based laptop.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---
>  drivers/input/serio/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
> index d90d9f1098ff..a4f70021b53e 100644
> --- a/drivers/input/serio/Kconfig
> +++ b/drivers/input/serio/Kconfig
> @@ -254,7 +254,7 @@ config SERIO_APBPS2
>  
>  config SERIO_OLPC_APSP
>  	tristate "OLPC AP-SP input support"
> -	depends on OLPC || COMPILE_TEST
> +	depends on OF

I do not see anything in the driver that depends on OF. If OLPC is not
right dependency, then let's drop the whole depends.

Are you going to be submitting DTS files for the platform?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v2 8/8] Input: olpc_apsp: allocate the GPIOs used
From: Dmitry Torokhov @ 2018-10-10 17:11 UTC (permalink / raw)
  To: Lubomir Rintel, Linus Walleij
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk
In-Reply-To: <20181010171013.GD47260@dtor-ws>

On Wed, Oct 10, 2018 at 10:10:13AM -0700, Dmitry Torokhov wrote:
> On Wed, Oct 10, 2018 at 04:25:04PM +0200, Lubomir Rintel wrote:
> > Take the GPIO lines are used by the SP. The driver doesn't touch the
> > lines -- this is done to disallow anything else from fiddling with
> > them because that would confuse the SP firmware.
> > 
> > Also, the lines are now nicely visible in /sys/kernel/debug/gpio.
> 
> Linus, is this something that should be handled by GPIO "hogs"?

Argh, meant to add Linus Walleij here.

> 
> > 
> > Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> > ---
> >  drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
> > index fe9e19014e70..287759c5f36d 100644
> > --- a/drivers/input/serio/olpc_apsp.c
> > +++ b/drivers/input/serio/olpc_apsp.c
> > @@ -24,6 +24,7 @@
> >  #include <linux/slab.h>
> >  #include <linux/delay.h>
> >  #include <linux/clk.h>
> > +#include <linux/gpio/consumer.h>
> >  
> >  /*
> >   * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
> > @@ -76,6 +77,8 @@ struct olpc_apsp {
> >  	struct serio *padio;
> >  	void __iomem *base;
> >  	struct clk *clk;
> > +	struct gpio_desc *clk_gpio;
> > +	struct gpio_desc *data_gpio;
> >  	int open_count;
> >  	int irq;
> >  };
> > @@ -211,6 +214,16 @@ static int olpc_apsp_probe(struct platform_device *pdev)
> >  	if (IS_ERR(priv->clk))
> >  		return PTR_ERR(priv->clk);
> >  
> > +	priv->clk_gpio = devm_gpiod_get_optional(&pdev->dev, "clk",
> > +							GPIOD_ASIS);
> > +	if (IS_ERR(priv->clk_gpio))
> > +		return PTR_ERR(priv->clk_gpio);
> > +
> > +	priv->data_gpio = devm_gpiod_get_optional(&pdev->dev, "data",
> > +							GPIOD_ASIS);
> > +	if (IS_ERR(priv->data_gpio))
> > +		return PTR_ERR(priv->data_gpio);
> > +
> >  	/* KEYBOARD */
> >  	kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
> >  	if (!kb_serio)
> > -- 
> > 2.19.0
> > 
> 
> -- 
> Dmitry

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v2 8/8] Input: olpc_apsp: allocate the GPIOs used
From: Dmitry Torokhov @ 2018-10-10 17:10 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk
In-Reply-To: <20181010142504.233467-9-lkundrak@v3.sk>

On Wed, Oct 10, 2018 at 04:25:04PM +0200, Lubomir Rintel wrote:
> Take the GPIO lines are used by the SP. The driver doesn't touch the
> lines -- this is done to disallow anything else from fiddling with
> them because that would confuse the SP firmware.
> 
> Also, the lines are now nicely visible in /sys/kernel/debug/gpio.

Linus, is this something that should be handled by GPIO "hogs"?

> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---
>  drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
> index fe9e19014e70..287759c5f36d 100644
> --- a/drivers/input/serio/olpc_apsp.c
> +++ b/drivers/input/serio/olpc_apsp.c
> @@ -24,6 +24,7 @@
>  #include <linux/slab.h>
>  #include <linux/delay.h>
>  #include <linux/clk.h>
> +#include <linux/gpio/consumer.h>
>  
>  /*
>   * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
> @@ -76,6 +77,8 @@ struct olpc_apsp {
>  	struct serio *padio;
>  	void __iomem *base;
>  	struct clk *clk;
> +	struct gpio_desc *clk_gpio;
> +	struct gpio_desc *data_gpio;
>  	int open_count;
>  	int irq;
>  };
> @@ -211,6 +214,16 @@ static int olpc_apsp_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv->clk))
>  		return PTR_ERR(priv->clk);
>  
> +	priv->clk_gpio = devm_gpiod_get_optional(&pdev->dev, "clk",
> +							GPIOD_ASIS);
> +	if (IS_ERR(priv->clk_gpio))
> +		return PTR_ERR(priv->clk_gpio);
> +
> +	priv->data_gpio = devm_gpiod_get_optional(&pdev->dev, "data",
> +							GPIOD_ASIS);
> +	if (IS_ERR(priv->data_gpio))
> +		return PTR_ERR(priv->data_gpio);
> +
>  	/* KEYBOARD */
>  	kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
>  	if (!kb_serio)
> -- 
> 2.19.0
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v2 7/8] Input: olpc_apsp: enable the SP clock
From: Dmitry Torokhov @ 2018-10-10 17:09 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk
In-Reply-To: <20181010142504.233467-8-lkundrak@v3.sk>

On Wed, Oct 10, 2018 at 04:25:03PM +0200, Lubomir Rintel wrote:
> Without the clock, the keyboard controller won't operate.
> Tested on an OLPC XO 1.75.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---
>  drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
> index 8b19a47dfa46..fe9e19014e70 100644
> --- a/drivers/input/serio/olpc_apsp.c
> +++ b/drivers/input/serio/olpc_apsp.c
> @@ -23,6 +23,7 @@
>  #include <linux/of.h>
>  #include <linux/slab.h>
>  #include <linux/delay.h>
> +#include <linux/clk.h>
>  
>  /*
>   * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
> @@ -74,6 +75,7 @@ struct olpc_apsp {
>  	struct serio *kbio;
>  	struct serio *padio;
>  	void __iomem *base;
> +	struct clk *clk;
>  	int open_count;
>  	int irq;
>  };
> @@ -146,8 +148,13 @@ static int olpc_apsp_open(struct serio *port)
>  	struct olpc_apsp *priv = port->port_data;
>  	unsigned int tmp;
>  	unsigned long l;
> +	int error;
>  
>  	if (priv->open_count++ == 0) {
> +		error = clk_prepare_enable(priv->clk);
> +		if (error)
> +			return error;
> +
>  		l = readl(priv->base + COMMAND_FIFO_STATUS);
>  		if (!(l & CMD_STS_MASK)) {
>  			dev_err(priv->dev, "SP cannot accept commands.\n");

I think you need to disable clock here.

> @@ -171,6 +178,8 @@ static void olpc_apsp_close(struct serio *port)
>  		/* Disable interrupt 0 */
>  		tmp = readl(priv->base + PJ_INTERRUPT_MASK);
>  		writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK);
> +
> +		clk_disable_unprepare(priv->clk);
>  	}
>  }
>  
> @@ -198,6 +207,10 @@ static int olpc_apsp_probe(struct platform_device *pdev)
>  	if (priv->irq < 0)
>  		return priv->irq;
>  
> +	priv->clk = devm_clk_get(&pdev->dev, "sp");
> +	if (IS_ERR(priv->clk))
> +		return PTR_ERR(priv->clk);
> +
>  	/* KEYBOARD */
>  	kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
>  	if (!kb_serio)
> -- 
> 2.19.0
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: elants_i2c - Use DMA safe i2c when possible
From: Dmitry Torokhov @ 2018-10-10 17:07 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: linux-kernel, linux-input, Wolfram Sang
In-Reply-To: <20181010165517.178545-1-swboyd@chromium.org>

On Wed, Oct 10, 2018 at 09:55:17AM -0700, Stephen Boyd wrote:
> This irq handler is always reading bytes from the device into a
> kmalloced buffer, so it's safe to mark this transaction as DMA safe.
> This avoids bouncing the buffer when an i2c controller decides to use
> DMA for a transaction.
> 
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

No, the buffer is in kmalloc()ed memory, but it is not DMA safe, as it
it not guaranteed to be aligned on cache line size. If you want to do
DMA to it, you need to change:

struct elants_data {

	...
	u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned;
};

i.e. mark it ____cacheline_aligned and move it to the very end (or mark
the next element in the structure cacheline aligned as well).

Otherwise DMA might smash nearby fileds in this structire.

> ---
>  drivers/input/touchscreen/elants_i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index d21ca39b0fdb..be44abb8de33 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -863,7 +863,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev)
>  	int i;
>  	int len;
>  
> -	len = i2c_master_recv(client, ts->buf, sizeof(ts->buf));
> +	len = i2c_master_recv_dmasafe(client, ts->buf, sizeof(ts->buf));
>  	if (len < 0) {
>  		dev_err(&client->dev, "%s: failed to read data: %d\n",
>  			__func__, len);
> -- 
> Sent by a computer through tubes
> 

Thanks.

-- 
Dmitry

^ permalink raw reply

* [PATCH] Input: elants_i2c - Use DMA safe i2c when possible
From: Stephen Boyd @ 2018-10-10 16:55 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-kernel, linux-input, Wolfram Sang

This irq handler is always reading bytes from the device into a
kmalloced buffer, so it's safe to mark this transaction as DMA safe.
This avoids bouncing the buffer when an i2c controller decides to use
DMA for a transaction.

Cc: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/input/touchscreen/elants_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index d21ca39b0fdb..be44abb8de33 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -863,7 +863,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev)
 	int i;
 	int len;
 
-	len = i2c_master_recv(client, ts->buf, sizeof(ts->buf));
+	len = i2c_master_recv_dmasafe(client, ts->buf, sizeof(ts->buf));
 	if (len < 0) {
 		dev_err(&client->dev, "%s: failed to read data: %d\n",
 			__func__, len);
-- 
Sent by a computer through tubes

^ permalink raw reply related

* [PATCH v2 8/8] Input: olpc_apsp: allocate the GPIOs used
From: Lubomir Rintel @ 2018-10-10 14:25 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk,
	Lubomir Rintel
In-Reply-To: <20181010142504.233467-1-lkundrak@v3.sk>

Take the GPIO lines are used by the SP. The driver doesn't touch the
lines -- this is done to disallow anything else from fiddling with
them because that would confuse the SP firmware.

Also, the lines are now nicely visible in /sys/kernel/debug/gpio.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
index fe9e19014e70..287759c5f36d 100644
--- a/drivers/input/serio/olpc_apsp.c
+++ b/drivers/input/serio/olpc_apsp.c
@@ -24,6 +24,7 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
+#include <linux/gpio/consumer.h>
 
 /*
  * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
@@ -76,6 +77,8 @@ struct olpc_apsp {
 	struct serio *padio;
 	void __iomem *base;
 	struct clk *clk;
+	struct gpio_desc *clk_gpio;
+	struct gpio_desc *data_gpio;
 	int open_count;
 	int irq;
 };
@@ -211,6 +214,16 @@ static int olpc_apsp_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->clk))
 		return PTR_ERR(priv->clk);
 
+	priv->clk_gpio = devm_gpiod_get_optional(&pdev->dev, "clk",
+							GPIOD_ASIS);
+	if (IS_ERR(priv->clk_gpio))
+		return PTR_ERR(priv->clk_gpio);
+
+	priv->data_gpio = devm_gpiod_get_optional(&pdev->dev, "data",
+							GPIOD_ASIS);
+	if (IS_ERR(priv->data_gpio))
+		return PTR_ERR(priv->data_gpio);
+
 	/* KEYBOARD */
 	kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
 	if (!kb_serio)
-- 
2.19.0

^ permalink raw reply related

* [PATCH v2 7/8] Input: olpc_apsp: enable the SP clock
From: Lubomir Rintel @ 2018-10-10 14:25 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk,
	Lubomir Rintel
In-Reply-To: <20181010142504.233467-1-lkundrak@v3.sk>

Without the clock, the keyboard controller won't operate.
Tested on an OLPC XO 1.75.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
index 8b19a47dfa46..fe9e19014e70 100644
--- a/drivers/input/serio/olpc_apsp.c
+++ b/drivers/input/serio/olpc_apsp.c
@@ -23,6 +23,7 @@
 #include <linux/of.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/clk.h>
 
 /*
  * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
@@ -74,6 +75,7 @@ struct olpc_apsp {
 	struct serio *kbio;
 	struct serio *padio;
 	void __iomem *base;
+	struct clk *clk;
 	int open_count;
 	int irq;
 };
@@ -146,8 +148,13 @@ static int olpc_apsp_open(struct serio *port)
 	struct olpc_apsp *priv = port->port_data;
 	unsigned int tmp;
 	unsigned long l;
+	int error;
 
 	if (priv->open_count++ == 0) {
+		error = clk_prepare_enable(priv->clk);
+		if (error)
+			return error;
+
 		l = readl(priv->base + COMMAND_FIFO_STATUS);
 		if (!(l & CMD_STS_MASK)) {
 			dev_err(priv->dev, "SP cannot accept commands.\n");
@@ -171,6 +178,8 @@ static void olpc_apsp_close(struct serio *port)
 		/* Disable interrupt 0 */
 		tmp = readl(priv->base + PJ_INTERRUPT_MASK);
 		writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK);
+
+		clk_disable_unprepare(priv->clk);
 	}
 }
 
@@ -198,6 +207,10 @@ static int olpc_apsp_probe(struct platform_device *pdev)
 	if (priv->irq < 0)
 		return priv->irq;
 
+	priv->clk = devm_clk_get(&pdev->dev, "sp");
+	if (IS_ERR(priv->clk))
+		return PTR_ERR(priv->clk);
+
 	/* KEYBOARD */
 	kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
 	if (!kb_serio)
-- 
2.19.0

^ permalink raw reply related

* [PATCH v2 6/8] Input: olpc_apsp: check FIFO status on open(), not probe()
From: Lubomir Rintel @ 2018-10-10 14:25 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk,
	Lubomir Rintel
In-Reply-To: <20181010142504.233467-1-lkundrak@v3.sk>

Let's defer the FIFO status checking until open().

When we'll get a clk handle, this will allow us to defer clock enablement
until the device is actually used.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/input/serio/olpc_apsp.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
index 8e9a4209fcad..8b19a47dfa46 100644
--- a/drivers/input/serio/olpc_apsp.c
+++ b/drivers/input/serio/olpc_apsp.c
@@ -145,8 +145,15 @@ static int olpc_apsp_open(struct serio *port)
 {
 	struct olpc_apsp *priv = port->port_data;
 	unsigned int tmp;
+	unsigned long l;
 
 	if (priv->open_count++ == 0) {
+		l = readl(priv->base + COMMAND_FIFO_STATUS);
+		if (!(l & CMD_STS_MASK)) {
+			dev_err(priv->dev, "SP cannot accept commands.\n");
+			return -EIO;
+		}
+
 		/* Enable interrupt 0 by clearing its bit */
 		tmp = readl(priv->base + PJ_INTERRUPT_MASK);
 		writel(tmp & ~INT_0, priv->base + PJ_INTERRUPT_MASK);
@@ -173,7 +180,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
 	struct olpc_apsp *priv;
 	struct resource *res;
 	struct device_node *np;
-	unsigned long l;
 	int error;
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL);
@@ -192,12 +198,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
 	if (priv->irq < 0)
 		return priv->irq;
 
-	l = readl(priv->base + COMMAND_FIFO_STATUS);
-	if (!(l & CMD_STS_MASK)) {
-		dev_err(&pdev->dev, "SP cannot accept commands.\n");
-		return -EIO;
-	}
-
 	/* KEYBOARD */
 	kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
 	if (!kb_serio)
-- 
2.19.0

^ permalink raw reply related

* [PATCH v2 5/8] Input: olpc_apsp: depend on CONFIG_OF
From: Lubomir Rintel @ 2018-10-10 14:25 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk,
	Lubomir Rintel
In-Reply-To: <20181010142504.233467-1-lkundrak@v3.sk>

This is a device-tree enabled driver. Moreover CONFIG_OLPC is specific
to the x86 platform code, while the driver is for an ARM-based laptop.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/input/serio/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index d90d9f1098ff..a4f70021b53e 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -254,7 +254,7 @@ config SERIO_APBPS2
 
 config SERIO_OLPC_APSP
 	tristate "OLPC AP-SP input support"
-	depends on OLPC || COMPILE_TEST
+	depends on OF
 	help
 	  Say Y here if you want support for the keyboard and touchpad included
 	  in the OLPC XO-1.75 and XO-4 laptops.
-- 
2.19.0

^ permalink raw reply related

* [PATCH v2 4/8] clk: mmp2: add SP clock
From: Lubomir Rintel @ 2018-10-10 14:25 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk,
	Lubomir Rintel
In-Reply-To: <20181010142504.233467-1-lkundrak@v3.sk>

The "security processor", sometimes referred to as "wireless trusted
module" or "generic encrypt unit" is a low-power core present on MMP2,
that has nothing to do with security, wireless, trust or encryption.

On an OLPC machine it runs CForth and serves as a keyboard controller:
http://dev.laptop.org/git/users/wmb/cforth/tree/src/app/arm-xo-1.75/ps2.fth

The register address was obtained from the OLPC kernel, since the
datasheet seems to be the Marvell's most important business secret.

Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/clk/mmp/clk-of-mmp2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 0fc75c395957..1da50f827a15 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -53,6 +53,7 @@
 #define APMU_DISP1	0x110
 #define APMU_CCIC0	0x50
 #define APMU_CCIC1	0xf4
+#define APMU_SP		0x68
 #define MPMU_UART_PLL	0x14
 
 struct mmp2_clk_unit {
@@ -209,6 +210,8 @@ static struct mmp_clk_mix_config ccic1_mix_config = {
 	.reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32),
 };
 
+static DEFINE_SPINLOCK(sp_lock);
+
 static struct mmp_param_mux_clk apmu_mux_clks[] = {
 	{MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock},
 	{MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock},
@@ -239,6 +242,7 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {
 	{MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock},
 	{MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock},
 	{MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock},
+	{MMP2_CLK_SP, "sp_clk", NULL, CLK_SET_RATE_PARENT, APMU_SP, 0x1b, 0x1b, 0x0, 0, &sp_lock},
 };
 
 static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
-- 
2.19.0

^ permalink raw reply related

* [PATCH v2 3/8] dt-bindings: marvell,mmp2: Add clock id for the SP clock
From: Lubomir Rintel @ 2018-10-10 14:24 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk,
	Lubomir Rintel
In-Reply-To: <20181010142504.233467-1-lkundrak@v3.sk>

This is the clock for the "security processor" core.

Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 include/dt-bindings/clock/marvell,mmp2.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/clock/marvell,mmp2.h b/include/dt-bindings/clock/marvell,mmp2.h
index 228a5e234af0..7b24fc791146 100644
--- a/include/dt-bindings/clock/marvell,mmp2.h
+++ b/include/dt-bindings/clock/marvell,mmp2.h
@@ -71,6 +71,7 @@
 #define MMP2_CLK_CCIC1_MIX		117
 #define MMP2_CLK_CCIC1_PHY		118
 #define MMP2_CLK_CCIC1_SPHY		119
+#define MMP2_CLK_SP			120
 
 #define MMP2_NR_CLKS			200
 #endif
-- 
2.19.0

^ permalink raw reply related

* [PATCH v2 2/8] dt-bindings: olpc,ap-sp: add GPIO lines
From: Lubomir Rintel @ 2018-10-10 14:24 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk,
	Lubomir Rintel
In-Reply-To: <20181010142504.233467-1-lkundrak@v3.sk>

Add properties describing the GPIO lines used by the keyboard controller.
The olpc-apsp driver will do happily without them, but they are still part
of the hardware description. The driver could still reserve the lines,
so that nothing else touches them.

This makes the device node almost compatible with "ps2-gpio". I'm not
adding a compatible property, because ps2-gpio would use a different
interrupt, so that we'd need to name it. And I haven't actually tried it.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 Documentation/devicetree/bindings/serio/olpc,ap-sp.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
index 36603419d6f8..2b1b1dbb54c1 100644
--- a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
+++ b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
@@ -7,6 +7,10 @@ Required properties:
 - clocks : phandle + clock-specifier for the clock that drives the WTM
 - clock-names:  should be "sp"
 
+Optional properties:
+- data-gpios : GPIO line used for PS/2 interface data
+- clk-gpios : GPIO line used for PS/2 interface clock
+
 Example:
 	ap-sp@d4290000 {
 		compatible = "olpc,ap-sp";
@@ -14,4 +18,6 @@ Example:
 		interrupts = <40>;
 		clocks = <&soc_clocks MMP2_CLK_SP>;
 		clock-names = "sp";
+		data-gpios = <&gpio 72 GPIO_ACTIVE_HIGH>;
+		clk-gpios = <&gpio 71 GPIO_ACTIVE_HIGH>;
 	}
-- 
2.19.0

^ permalink raw reply related

* [PATCH v2 1/8] dt-bindings: olpc,ap-sp: add clock
From: Lubomir Rintel @ 2018-10-10 14:24 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk,
	Lubomir Rintel
In-Reply-To: <20181010142504.233467-1-lkundrak@v3.sk>

The clock is necessary for the device operation, hence it's required.
Its name, "sp", stands for "Security Processor". It is one of several
names that are used for the processor that serves as the keyboard
controller on an OLPC and is consistent with the node name.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 Documentation/devicetree/bindings/serio/olpc,ap-sp.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
index 0e72183f52bc..36603419d6f8 100644
--- a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
+++ b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
@@ -4,10 +4,14 @@ Required properties:
 - compatible : "olpc,ap-sp"
 - reg : base address and length of SoC's WTM registers
 - interrupts : SP-AP interrupt
+- clocks : phandle + clock-specifier for the clock that drives the WTM
+- clock-names:  should be "sp"
 
 Example:
 	ap-sp@d4290000 {
 		compatible = "olpc,ap-sp";
 		reg = <0xd4290000 0x1000>;
 		interrupts = <40>;
+		clocks = <&soc_clocks MMP2_CLK_SP>;
+		clock-names = "sp";
 	}
-- 
2.19.0

^ permalink raw reply related

* [PATCH v2 0/8] OLPC 1.75 Keyboard/Touchpad fixes
From: Lubomir Rintel @ 2018-10-10 14:24 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Michael Turquette, Rob Herring, Mark Rutland, Stephen Boyd,
	James Cameron, linux-input, devicetree, linux-kernel, linux-clk

This makes keyboard/touchpad work on a DT MMP2 platform.

I believe that it would be a good idea if this, once reviewed, went in
via the input tree. The DT and CLK parts got reviews/acks.

Changes from v1:
- Basically none, just re-send, including Ack and Review tags in patches
  that received them. Plus an extra Cc.
  I'd be very thankful for reviews.

Lubi

^ permalink raw reply

* Re: [PATCH v3 8/8] watchdog: stpmic1: add stpmic1 watchdog driver
From: Guenter Roeck @ 2018-10-09 21:44 UTC (permalink / raw)
  To: Pascal PAILLET-LME
  Cc: kbuild-all, dmitry.torokhov@gmail.com, robh+dt@kernel.org,
	mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com,
	broonie@kernel.org, wim@linux-watchdog.org,
	linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
	benjamin.gaignard@linaro.org, eballetbo@gmail.com
In-Reply-To: <201810090846.it9ed9td%fengguang.wu@intel.com>

On Tue, Oct 09, 2018 at 08:47:26AM +0800, kbuild test robot wrote:
> Hi pascal,
> 
> Thank you for the patch! Perhaps something to improve:
> 

[ ... ]

>     42	
>     43	static int pmic_wdt_stop(struct watchdog_device *wdd)
>     44	{
>     45		struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd);
>     46	
>     47		return regmap_update_bits(wdt->pmic->regmap,
>   > 48					  WCHDG_CR, WDT_START_MASK, ~WDT_START);

Maybe use

#define WDT_STOP	0

instead, or just write 0. ~WDT_START may be convenient but not really correct.

Guenter

^ permalink raw reply

* Re: [PATCH] HID: google: drop superfluous const before SIMPLE_DEV_PM_OPS()
From: Dmitry Torokhov @ 2018-10-09 17:34 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: open list:HID CORE LAYER, lkml
In-Reply-To: <nycvar.YFH.7.76.1810091046050.14430@cbobk.fhfr.pm>

On Tue, Oct 9, 2018 at 1:48 AM Jiri Kosina <jikos@kernel.org> wrote:
>
> From: Jiri Kosina <jkosina@suse.cz>
>
> SIMPLE_DEV_PM_OPS() already implies const for the type; drop the extra
> modifier.
>
> Fixes: eb1aac4c8744f75460c34d71b0c73bebf3e8ee5c ("HID: google: add support tablet mode switch for Whiskers")
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>

FWIW

Acked-by: Dmitry Torokhov <dtor@chromium.org>

> ---
>
> In hid.git#for-4.20/google
>
>  drivers/hid/hid-google-hammer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
> index de3e7d055ca4..ee5e0bdcf078 100644
> --- a/drivers/hid/hid-google-hammer.c
> +++ b/drivers/hid/hid-google-hammer.c
> @@ -161,7 +161,7 @@ static __maybe_unused int cbas_ec_resume(struct device *dev)
>         return 0;
>  }
>
> -static const SIMPLE_DEV_PM_OPS(cbas_ec_pm_ops, NULL, cbas_ec_resume);
> +static SIMPLE_DEV_PM_OPS(cbas_ec_pm_ops, NULL, cbas_ec_resume);
>
>  static void cbas_ec_set_input(struct input_dev *input)
>  {
>
> --
> Jiri Kosina
> SUSE Labs

^ permalink raw reply

* Re: [PATCH v3 5/8] dt-bindings: input: document stpmic1 pmic onkey
From: Pascal PAILLET-LME @ 2018-10-09 13:52 UTC (permalink / raw)
  To: dmitry.torokhov@gmail.com, robh+dt@kernel.org,
	mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com,
	broonie@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net,
	linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
	benjamin.gaignard@linaro.org, eballetbo@gmail.com
In-Reply-To: <1539016176-4072-6-git-send-email-p.paillet@st.com>

Le 10/08/2018 06:29 PM, Pascal PAILLET-LME a écrit :
> From: pascal paillet <p.paillet@st.com>
>
> The stpmic1 pmic is able to manage an onkey button. It can be configured
> to shut-down the power supplies on a long key-press with an adjustable
> duration.
>
> Signed-off-by: pascal paillet <p.paillet@st.com>
> ---
> changes in v3:
> * Replace st,onkey-long-press-seconds and st,onkey-pwroff-enabled by
> power-off-time-sec.
>
>   .../devicetree/bindings/input/st,stpmic1-onkey.txt | 30 ++++++++++++++++++++++
>   1 file changed, 30 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/input/st,stpmic1-onkey.txt
>
> diff --git a/Documentation/devicetree/bindings/input/st,stpmic1-onkey.txt b/Documentation/devicetree/bindings/input/st,stpmic1-onkey.txt
> new file mode 100644
> index 0000000..8c58186
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/st,stpmic1-onkey.txt
> @@ -0,0 +1,30 @@
> +STMicroelectronics STPMIC1 Onkey
> +
> +Required properties:
> +
> +- compatible = "st,stpmic1-onkey";
> +- interrupt-parent: phandle to the parent interrupt controller
> +- interrupts: interrupt line to use
> +- interrupt-names = "onkey-falling", "onkey-rising"
> +	onkey-falling: happens when onkey is pressed; IT_PONKEY_F of pmic
> +	onkey-rising: happens when onkey is released; IT_PONKEY_R of pmic
> +
> +Optional properties:
> +
> +- st,onkey-clear-cc-flag: onkey is able power on after an
> +  over-current shutdown event.
> +- st,onkey-pu-inactive: onkey pull up is not active
> +- power-off-time-sec: Duration in seconds which the key should be kept
> +        pressed for device to power off automatically (from 1 to 16 seconds).
> +        see See Documentation/devicetree/bindings/input/keys.txt
> +
> +Example:
> +
> +onkey {
> +	compatible = "st,stpmic1-onkey";
> +	interrupt-parent = <&pmic>;
> +	interrupts = <IT_PONKEY_F 0>,<IT_PONKEY_R 1>;
> +	interrupt-names = "onkey-falling", "onkey-rising";
> +	st,onkey-pwroff-enabled;
> +	st,onkey-long-press-seconds = <10>;
st,onkey-pwroff-enabled and st,onkey-long-press-seconds to be replaced 
by power-off-time-sec

> +};

^ permalink raw reply

* Re: [PATCH] HID: elan: fix spelling mistake "registred" -> "registered"
From: Jiri Kosina @ 2018-10-09 11:32 UTC (permalink / raw)
  To: Colin King; +Cc: Benjamin Tissoires, linux-input, kernel-janitors, linux-kernel
In-Reply-To: <20180927140052.28166-1-colin.king@canonical.com>

On Thu, 27 Sep 2018, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Trivial fix to spelling mistake in hid_err error message
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/hid/hid-elan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c
> index 07e26c3567eb..0bfd6d1b44c1 100644
> --- a/drivers/hid/hid-elan.c
> +++ b/drivers/hid/hid-elan.c
> @@ -497,7 +497,7 @@ static int elan_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  		return 0;
>  
>  	if (!drvdata->input) {
> -		hid_err(hdev, "Input device is not registred\n");
> +		hid_err(hdev, "Input device is not registered\n");

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox