Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH 2/9] HID: hyperv: Constify lowlevel HID driver
From: Thomas Weißschuh @ 2023-01-30  3:59 UTC (permalink / raw)
  To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Filipe Laíns, Srinivas Pandruvada, Maximilian Luz,
	Corentin Chary, Hans de Goede, Mark Gross, Viresh Kumar,
	Johan Hovold, Alex Elder, Greg Kroah-Hartman
  Cc: linux-input, linux-kernel, linux-hyperv, platform-driver-x86,
	acpi4asus-user, greybus-dev, linux-staging, Thomas Weißschuh
In-Reply-To: <20230130-hid-const-ll-driver-v1-0-3fc282b3b1d0@weissschuh.net>

Since commit 52d225346904 ("HID: Make lowlevel driver structs const")
the lowlevel HID drivers are only exposed as const.

Take advantage of this to constify the underlying structure, too.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/hid/hid-hyperv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
index cf12f17e6533..819eb38eb5df 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -424,7 +424,7 @@ static int mousevsc_hid_raw_request(struct hid_device *hid,
 	return 0;
 }
 
-static struct hid_ll_driver mousevsc_ll_driver = {
+static const struct hid_ll_driver mousevsc_ll_driver = {
 	.parse = mousevsc_hid_parse,
 	.open = mousevsc_hid_open,
 	.close = mousevsc_hid_close,

-- 
2.39.1


^ permalink raw reply related

* [PATCH 1/9] HID: amd_sfh: Constify lowlevel HID driver
From: Thomas Weißschuh @ 2023-01-30  3:59 UTC (permalink / raw)
  To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Filipe Laíns, Srinivas Pandruvada, Maximilian Luz,
	Corentin Chary, Hans de Goede, Mark Gross, Viresh Kumar,
	Johan Hovold, Alex Elder, Greg Kroah-Hartman
  Cc: linux-input, linux-kernel, linux-hyperv, platform-driver-x86,
	acpi4asus-user, greybus-dev, linux-staging, Thomas Weißschuh
In-Reply-To: <20230130-hid-const-ll-driver-v1-0-3fc282b3b1d0@weissschuh.net>

Since commit 52d225346904 ("HID: Make lowlevel driver structs const")
the lowlevel HID drivers are only exposed as const.

Take advantage of this to constify the underlying structure, too.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/hid/amd-sfh-hid/amd_sfh_hid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
index 1b18291fc5af..705b52337068 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
@@ -112,7 +112,7 @@ void amdtp_hid_wakeup(struct hid_device *hid)
 	}
 }
 
-static struct hid_ll_driver amdtp_hid_ll_driver = {
+static const struct hid_ll_driver amdtp_hid_ll_driver = {
 	.parse	=	amdtp_hid_parse,
 	.start	=	amdtp_hid_start,
 	.stop	=	amdtp_hid_stop,

-- 
2.39.1


^ permalink raw reply related

* [PATCH 3/9] HID: logitech-dj: Constify lowlevel HID driver
From: Thomas Weißschuh @ 2023-01-30  3:59 UTC (permalink / raw)
  To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Filipe Laíns, Srinivas Pandruvada, Maximilian Luz,
	Corentin Chary, Hans de Goede, Mark Gross, Viresh Kumar,
	Johan Hovold, Alex Elder, Greg Kroah-Hartman
  Cc: linux-input, linux-kernel, linux-hyperv, platform-driver-x86,
	acpi4asus-user, greybus-dev, linux-staging, Thomas Weißschuh
In-Reply-To: <20230130-hid-const-ll-driver-v1-0-3fc282b3b1d0@weissschuh.net>

Since commit 52d225346904 ("HID: Make lowlevel driver structs const")
the lowlevel HID drivers are only exposed as const.

Take advantage of this to constify the underlying structure, too.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/hid/hid-logitech-dj.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index c358778e070b..62180414efcc 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -554,7 +554,7 @@ static const u8 hid_reportid_size_map[NUMBER_OF_HID_REPORTS] = {
 
 #define LOGITECH_DJ_INTERFACE_NUMBER 0x02
 
-static struct hid_ll_driver logi_dj_ll_driver;
+static const struct hid_ll_driver logi_dj_ll_driver;
 
 static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev);
 static void delayedwork_callback(struct work_struct *work);
@@ -1506,7 +1506,7 @@ static bool logi_dj_ll_may_wakeup(struct hid_device *hid)
 	return hid_hw_may_wakeup(djrcv_dev->hidpp);
 }
 
-static struct hid_ll_driver logi_dj_ll_driver = {
+static const struct hid_ll_driver logi_dj_ll_driver = {
 	.parse = logi_dj_ll_parse,
 	.start = logi_dj_ll_start,
 	.stop = logi_dj_ll_stop,

-- 
2.39.1


^ permalink raw reply related

* [PATCH 0/9] HID: Constify lowlevel HID drivers
From: Thomas Weißschuh @ 2023-01-30  3:59 UTC (permalink / raw)
  To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Filipe Laíns, Srinivas Pandruvada, Maximilian Luz,
	Corentin Chary, Hans de Goede, Mark Gross, Viresh Kumar,
	Johan Hovold, Alex Elder, Greg Kroah-Hartman
  Cc: linux-input, linux-kernel, linux-hyperv, platform-driver-x86,
	acpi4asus-user, greybus-dev, linux-staging, Thomas Weißschuh

Since 52d225346904 ("HID: Make lowlevel driver structs const") the
lowlevel HID drivers are only exposed as const.

Take advantage of this to constify the underlying structures, too.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (9):
      HID: amd_sfh: Constify lowlevel HID driver
      HID: hyperv: Constify lowlevel HID driver
      HID: logitech-dj: Constify lowlevel HID driver
      HID: steam: Constify lowlevel HID driver
      HID: intel-ish-hid: Constify lowlevel HID driver
      HID: surface-hid: Constify lowlevel HID driver
      platform/x86: asus-tf103c-dock: Constify lowlevel HID driver
      platform/x86: asus-tf103c-dock: Constify toprow keymap
      staging: greybus: hid: Constify lowlevel HID driver

 drivers/hid/amd-sfh-hid/amd_sfh_hid.c      | 2 +-
 drivers/hid/hid-hyperv.c                   | 2 +-
 drivers/hid/hid-logitech-dj.c              | 4 ++--
 drivers/hid/hid-steam.c                    | 2 +-
 drivers/hid/intel-ish-hid/ishtp-hid.c      | 2 +-
 drivers/hid/surface-hid/surface_hid_core.c | 2 +-
 drivers/platform/x86/asus-tf103c-dock.c    | 4 ++--
 drivers/staging/greybus/hid.c              | 2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)
---
base-commit: e04955db6a7c3fc4a1e6978649b61a6f5f8028e3
change-id: 20230130-hid-const-ll-driver-fcfdd3af11b8

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply

* [PATCH 4/9] HID: steam: Constify lowlevel HID driver
From: Thomas Weißschuh @ 2023-01-30  3:59 UTC (permalink / raw)
  To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Filipe Laíns, Srinivas Pandruvada, Maximilian Luz,
	Corentin Chary, Hans de Goede, Mark Gross, Viresh Kumar,
	Johan Hovold, Alex Elder, Greg Kroah-Hartman
  Cc: linux-input, linux-kernel, linux-hyperv, platform-driver-x86,
	acpi4asus-user, greybus-dev, linux-staging, Thomas Weißschuh
In-Reply-To: <20230130-hid-const-ll-driver-v1-0-3fc282b3b1d0@weissschuh.net>

Since commit 52d225346904 ("HID: Make lowlevel driver structs const")
the lowlevel HID drivers are only exposed as const.

Take advantage of this to constify the underlying structure, too.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/hid/hid-steam.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
index 8ee43cb225fc..29ec8b34741a 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -674,7 +674,7 @@ static int steam_client_ll_raw_request(struct hid_device *hdev,
 			report_type, reqtype);
 }
 
-static struct hid_ll_driver steam_client_ll_driver = {
+static const struct hid_ll_driver steam_client_ll_driver = {
 	.parse = steam_client_ll_parse,
 	.start = steam_client_ll_start,
 	.stop = steam_client_ll_stop,

-- 
2.39.1


^ permalink raw reply related

* Re: [PATCH RESEND] Input: atmel_captouch - drop obsolete dependency on COMPILE_TEST
From: Dmitry Torokhov @ 2023-01-30  2:32 UTC (permalink / raw)
  To: Jean Delvare
  Cc: linux-input, LKML, Daniel Hung-yu Wu, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea
In-Reply-To: <20230127122816.02b6ea26@endymion.delvare>

Hi Jean,

On Fri, Jan 27, 2023 at 12:28:16PM +0100, Jean Delvare wrote:
> Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), it
> is possible to test-build any driver which depends on OF on any
> architecture by explicitly selecting OF. Therefore depending on
> COMPILE_TEST as an alternative is no longer needed.
> 
> As a nice side effect, dropping the alternative dependency on
> COMPILE_TEST allows removing preprocessor directives, which will
> speed up the build.

I believe I already have your patch in my "next" branch that is feeding
into linux-next.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] HID: use standard debug APIs
From: Thomas Weißschuh @ 2023-01-29 21:53 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: linux-input, linux-kernel
In-Reply-To: <20221223-hid-dbg-v1-1-5dcf8794f7f9@weissschuh.net>

Hi Jiri, hi Benjamin,

On Fri, Dec 23, 2022 at 09:30:19PM +0000, Thomas Weißschuh wrote:
> The custom "debug" module parameter is fairly inflexible.
> It can only manage debugging for all calls dbg_hid() at the same time.
> 
> Furthermore it creates a mismatch between calls to hid_dbg() which can
> be managed by CONFIG_DYNAMIC_DEBUG and dbg_hid() which is managed by the
> module parameter.
> 
> Furthermore the change to pr_debug() allows the debugging statements to
> be completely compiled-out if desired.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> 
> Note: This removes the possibility to enable debugging for the HID core
> and all drivers at the same time.
> If this is still desirable it could probably be implemented with the new
> DYNAMIC_DEBUG class feature.
> ---
>  drivers/hid/hid-core.c | 9 ---------
>  include/linux/hid.h    | 8 +-------
>  2 files changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index bd47628da6be..4facfb446986 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -41,11 +41,6 @@
>  
>  #define DRIVER_DESC "HID core driver"
>  
> -int hid_debug = 0;
> -module_param_named(debug, hid_debug, int, 0600);
> -MODULE_PARM_DESC(debug, "toggle HID debugging messages");
> -EXPORT_SYMBOL_GPL(hid_debug);
> -
>  static int hid_ignore_special_drivers = 0;
>  module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600);
>  MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle all devices by generic driver");
> @@ -2909,10 +2904,6 @@ static int __init hid_init(void)
>  {
>  	int ret;
>  
> -	if (hid_debug)
> -		pr_warn("hid_debug is now used solely for parser and driver debugging.\n"
> -			"debugfs is now used for inspecting the device (report descriptor, reports)\n");
> -
>  	ret = bus_register(&hid_bus_type);
>  	if (ret) {
>  		pr_err("can't register hid bus\n");
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index 8677ae38599e..676f501507aa 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -882,8 +882,6 @@ static inline bool hid_is_usb(struct hid_device *hdev)
>  
>  /* HID core API */
>  
> -extern int hid_debug;
> -
>  extern bool hid_ignore(struct hid_device *);
>  extern int hid_add_device(struct hid_device *);
>  extern void hid_destroy_device(struct hid_device *);
> @@ -1191,11 +1189,7 @@ int hid_pidff_init(struct hid_device *hid);
>  #define hid_pidff_init NULL
>  #endif
>  
> -#define dbg_hid(fmt, ...)						\
> -do {									\
> -	if (hid_debug)							\
> -		printk(KERN_DEBUG "%s: " fmt, __FILE__, ##__VA_ARGS__);	\
> -} while (0)
> +#define dbg_hid(fmt, ...) pr_debug("%s: " fmt, __FILE__, ##__VA_ARGS__)
>  
>  #define hid_err(hid, fmt, ...)				\
>  	dev_err(&(hid)->dev, fmt, ##__VA_ARGS__)

any feedback on this patch?

Please note that this is *not* the same as the already merged
34ba3657a503 ("HID: i2c-hid: switch to standard debugging APIs")

> ---
> base-commit: 51094a24b85e29138b7fa82ef1e1b4fe19c90046
> change-id: 20221223-hid-dbg-2f3eeddddd53
> 
> Best regards,
> -- 
> Thomas Weißschuh <linux@weissschuh.net>

Thanks,
Thomas

^ permalink raw reply

* Re: [git pull] Input updates for v6.2-rc5
From: pr-tracker-bot @ 2023-01-29 19:34 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Linus Torvalds, linux-kernel, linux-input
In-Reply-To: <Y9XAv4p0H9aU4+yz@google.com>

The pull request you sent on Sat, 28 Jan 2023 16:41:35 -0800:

> git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git tags/input-for-v6.2-rc5

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/80826e9020afc7b8243df302a13521e0020fa9d8

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply

* Re: [PATCH 1/4] dt-bindings: hid: Add CP2112 HID USB to SMBus Bridge
From: Krzysztof Kozlowski @ 2023-01-29 11:33 UTC (permalink / raw)
  To: Danny Kaehn, robh+dt, krzysztof.kozlowski+dt, jikos,
	benjamin.tissoires
  Cc: devicetree, linux-input, ethan.twardy
In-Reply-To: <fa320b2c-5cf5-c10a-ba63-17ccb5c992ad@linaro.org>

On 29/01/2023 12:05, Krzysztof Kozlowski wrote:
> On 28/01/2023 21:26, Danny Kaehn wrote:
>> This is a USB HID device which includes an I2C controller and 8 GPIO pins.
>>
> Thank you for your patch. There is something to discuss/improve.
> 
>> The binding allows describing the chip's gpio and i2c controller in DT
>> using the subnodes named "gpio" and "i2c", respectively. This is
>> intended to be used in configurations where the CP2112 is permanently
>> connected in hardware.
>>
>> Signed-off-by: Danny Kaehn <kaehndan@gmail.com>
>> ---
>>  .../bindings/hid/silabs,cp2112.yaml           | 82 +++++++++++++++++++
> 
> There is no "hid" directory, so I think such devices where going to
> different place, didn't they?
> 
>>  1 file changed, 82 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/hid/silabs,cp2112.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml b/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml
>> new file mode 100644
>> index 000000000000..49287927c63f
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml
>> @@ -0,0 +1,82 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/hid/silabs,cp2112.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: CP2112 HID USB to SMBus/I2C Bridge
>> +
>> +maintainers:
>> +  - Danny Kaehn <kaehndan@gmail.com>
>> +
>> +description:
>> +  This is a USB HID device which includes an I2C controller and 8 GPIO pins.
> 
> s/This is/CP2112 is/
> 
>> +  While USB devices typically aren't described in DeviceTree, doing so with the
>> +  CP2112 allows use of its i2c and gpio controllers with other DT nodes when
>> +  the chip is expected to be found on a USB port.
> 
> Drop these three and replace with description of the hardware.
> 
>> +
>> +properties:
>> +  compatible:
>> +    const: usb10c4,ea90
> 
> So this is an USB device, so I guess they all go to usb?
> 
> Missing blank line.
> 
>> +  reg:
>> +    maxItems: 1
>> +    description: The USB port number on the host controller
> 
> Blank line
> 
>> +  i2c:
>> +    $ref: /schemas/i2c/i2c-controller.yaml#
> 
> This is not specific enough. What controller is there?

OK, assuming this is tightly wired (with cp2112 I2C controller), then
the compatible could be skipped as it is inferred from parent one. Yet
still you need description and unevaluatedProperties.

> 
> Missing unevaluatedProperties: false, anyway.
> 
>> +  gpio:
>> +    $ref: /schemas/gpio/gpio.yaml#
> 
> Same comments.

Description, unevaluatedProperties and constraints on properties (line
names, reserved ranges, ranges).



> 
>> +
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/input/input.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +
>> +    usb1 {
>> +      #address-cells = <1>;
>> +      #size-cells = <0>;
> 
> Drop, not related.
> 
>> +
>> +      usb@1 {
>> +        compatible = "usb424,2514";
>> +        reg = <1>;
>> +
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +
>> +        device@1 {	/* CP2112 I2C Bridge */
>> +          compatible = "usb10c4,ea90";
>> +          reg = <1>;
>> +
>> +          cp2112_i2c0: i2c {
> 
> Drop unneeded labels.
> 
>> +            #address-cells = <1>;
>> +            #size-cells = <0>;
>> +            /* Child I2C Devices can be described as normal here */

Drop also this comment.

Best regards,
Krzysztof


^ permalink raw reply

* Re: [PATCH 4/4] CP2112 Devicetree Support
From: Krzysztof Kozlowski @ 2023-01-29 11:06 UTC (permalink / raw)
  To: Danny Kaehn, robh+dt, krzysztof.kozlowski+dt, jikos,
	benjamin.tissoires
  Cc: devicetree, linux-input, ethan.twardy
In-Reply-To: <20230128202622.12676-5-kaehndan@gmail.com>

On 28/01/2023 21:26, Danny Kaehn wrote:
> Bind i2c and gpio interfaces to subnodes with names
> "i2c" and "gpio" if they exist, respectively. This
> allows the gpio and i2c controllers to be described
> in DT as usual.
> 
> Signed-off-by: Danny Kaehn <kaehndan@gmail.com>
> ---
>  drivers/hid/hid-cp2112.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
> index 27cadadda7c9..99e8043e1c34 100644
> --- a/drivers/hid/hid-cp2112.c
> +++ b/drivers/hid/hid-cp2112.c
> @@ -1310,6 +1310,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  	dev->adap.algo		= &smbus_algorithm;
>  	dev->adap.algo_data	= dev;
>  	dev->adap.dev.parent	= &hdev->dev;
> +	dev->adap.dev.of_node   = of_get_child_by_name(hdev->dev.of_node, "i2c");
>  	snprintf(dev->adap.name, sizeof(dev->adap.name),
>  		 "CP2112 SMBus Bridge on hidraw%d",
>  		 ((struct hidraw *)hdev->hidraw)->minor);
> @@ -1336,6 +1337,9 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  	dev->gc.ngpio			= 8;
>  	dev->gc.can_sleep		= 1;
>  	dev->gc.parent			= &hdev->dev;
> +#if defined(CONFIG_OF_GPIO)

Don't use #if, but IS_ENABLED(). I think it should work here.

> +	dev->gc.of_node			= of_get_child_by_name(hdev->dev.of_node, "gpio");

You leak it now on error paths.

Best regards,
Krzysztof


^ permalink raw reply

* Re: [PATCH 2/4] Share USB device devicetree node with child HID device
From: Krzysztof Kozlowski @ 2023-01-29 11:05 UTC (permalink / raw)
  To: Danny Kaehn, robh+dt, krzysztof.kozlowski+dt, jikos,
	benjamin.tissoires
  Cc: devicetree, linux-input, ethan.twardy
In-Reply-To: <20230128202622.12676-3-kaehndan@gmail.com>

On 28/01/2023 21:26, Danny Kaehn wrote:
> USB HID core now shares its devicetree of_node with its child HID device.
> Since there can only be one HID device on a USB interface, it is redundant
> to specify a hid node under the USB device (and further, binding this way
> isn't currently possible, as hid_driver does not support of_match_table).
> 

Here and in other patches:

Use subject prefixes matching the subsystem (which you can get for
example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
your patch is touching).

Best regards,
Krzysztof


^ permalink raw reply

* Re: [PATCH 1/4] dt-bindings: hid: Add CP2112 HID USB to SMBus Bridge
From: Krzysztof Kozlowski @ 2023-01-29 11:05 UTC (permalink / raw)
  To: Danny Kaehn, robh+dt, krzysztof.kozlowski+dt, jikos,
	benjamin.tissoires
  Cc: devicetree, linux-input, ethan.twardy
In-Reply-To: <20230128202622.12676-2-kaehndan@gmail.com>

On 28/01/2023 21:26, Danny Kaehn wrote:
> This is a USB HID device which includes an I2C controller and 8 GPIO pins.
> 
Thank you for your patch. There is something to discuss/improve.

> The binding allows describing the chip's gpio and i2c controller in DT
> using the subnodes named "gpio" and "i2c", respectively. This is
> intended to be used in configurations where the CP2112 is permanently
> connected in hardware.
> 
> Signed-off-by: Danny Kaehn <kaehndan@gmail.com>
> ---
>  .../bindings/hid/silabs,cp2112.yaml           | 82 +++++++++++++++++++

There is no "hid" directory, so I think such devices where going to
different place, didn't they?

>  1 file changed, 82 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hid/silabs,cp2112.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml b/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml
> new file mode 100644
> index 000000000000..49287927c63f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml
> @@ -0,0 +1,82 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hid/silabs,cp2112.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: CP2112 HID USB to SMBus/I2C Bridge
> +
> +maintainers:
> +  - Danny Kaehn <kaehndan@gmail.com>
> +
> +description:
> +  This is a USB HID device which includes an I2C controller and 8 GPIO pins.

s/This is/CP2112 is/

> +  While USB devices typically aren't described in DeviceTree, doing so with the
> +  CP2112 allows use of its i2c and gpio controllers with other DT nodes when
> +  the chip is expected to be found on a USB port.

Drop these three and replace with description of the hardware.

> +
> +properties:
> +  compatible:
> +    const: usb10c4,ea90

So this is an USB device, so I guess they all go to usb?

Missing blank line.

> +  reg:
> +    maxItems: 1
> +    description: The USB port number on the host controller

Blank line

> +  i2c:
> +    $ref: /schemas/i2c/i2c-controller.yaml#

This is not specific enough. What controller is there?

Missing unevaluatedProperties: false, anyway.

> +  gpio:
> +    $ref: /schemas/gpio/gpio.yaml#

Same comments.

> +
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/input/input.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    usb1 {
> +      #address-cells = <1>;
> +      #size-cells = <0>;

Drop, not related.

> +
> +      usb@1 {
> +        compatible = "usb424,2514";
> +        reg = <1>;
> +
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        device@1 {	/* CP2112 I2C Bridge */
> +          compatible = "usb10c4,ea90";
> +          reg = <1>;
> +
> +          cp2112_i2c0: i2c {

Drop unneeded labels.

> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +            /* Child I2C Devices can be described as normal here */
> +            temp@48 {
> +              compatible = "national,lm75";
> +              reg = <0x48>;
> +            };
> +          };
> +
> +          cp2112_gpio0: gpio {
> +            gpio-controller;
> +            interrupt-controller;
> +            #gpio-cells = <2>;
> +            gpio-line-names =
> +              "TEST0",
> +              "TEST1",
> +              "TEST2",
> +              "TEST3",
> +              "TEST4",
> +              "TEST5",
> +              "TEST6",
> +              "TEST7";
> +          };
> +        };
> +      };
> +    };

Best regards,
Krzysztof


^ permalink raw reply

* [PATCH v4 4/4] arm64: dts: imx93: Add the bbnsm dts node
From: Jacky Bai @ 2023-01-29  7:08 UTC (permalink / raw)
  To: lee, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer,
	dmitry.torokhov, a.zummo, alexandre.belloni
  Cc: devicetree, linux-arm-kernel, linux-input, linux-rtc, kernel,
	linux-imx, festevam
In-Reply-To: <20230129070823.1945489-1-ping.bai@nxp.com>

Add the bbnsm node for RTC & ON/OFF button support

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
  - v2 changes:
    - update the regmap property to align with binding doc

  - v3 changes:
    - remove 'nxp,bbnsm-regmap' property to align with binding doc

  - v4 changes:
    - update the compatible string to align with binding file
---
 arch/arm64/boot/dts/freescale/imx93.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi
index 5d79663b3b84..36be18165d4b 100644
--- a/arch/arm64/boot/dts/freescale/imx93.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx93.dtsi
@@ -229,6 +229,22 @@ iomuxc: pinctrl@443c0000 {
 				status = "okay";
 			};
 
+			bbnsm: bbnsm@44440000 {
+				compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd";
+				reg = <0x44440000 0x10000>;
+
+				bbnsm_rtc: rtc {
+					compatible = "nxp,imx93-bbnsm-rtc";
+					interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+				};
+
+				bbnsm_pwrkey: pwrkey {
+					compatible = "nxp,imx93-bbnsm-pwrkey";
+					interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+					linux,code = <KEY_POWER>;
+				};
+			};
+
 			clk: clock-controller@44450000 {
 				compatible = "fsl,imx93-ccm";
 				reg = <0x44450000 0x10000>;
-- 
2.37.1


^ permalink raw reply related

* [PATCH v4 3/4] rtc: bbnsm: Add the bbnsm rtc support
From: Jacky Bai @ 2023-01-29  7:08 UTC (permalink / raw)
  To: lee, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer,
	dmitry.torokhov, a.zummo, alexandre.belloni
  Cc: devicetree, linux-arm-kernel, linux-input, linux-rtc, kernel,
	linux-imx, festevam
In-Reply-To: <20230129070823.1945489-1-ping.bai@nxp.com>

The BBNSM module includes a real time counter with alarm.
Add a RTC driver for this function.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
  - v2 changes:
    - sort the header file alphabetically
    - rename the file to add 'nxp' prefix
    - refine bbnsm_rtc_irq_handler function, remove the unnecessary
      event variable
    - add rtc enable check in .read_time, remove rtc enable in probe function
    - remove unnecessary dev_err log in probe function

  - v3 changes:
    - get the regmap directly from parent node
    - remove unnecessary dev_err log print

  - v4 changes:
    - update the compatible string to align with binding file
---
 drivers/rtc/Kconfig         |  12 ++
 drivers/rtc/Makefile        |   1 +
 drivers/rtc/rtc-nxp-bbnsm.c | 226 ++++++++++++++++++++++++++++++++++++
 3 files changed, 239 insertions(+)
 create mode 100644 drivers/rtc/rtc-nxp-bbnsm.c

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 677d2601d305..1b9e8395d118 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1786,6 +1786,18 @@ config RTC_DRV_SNVS
 	   This driver can also be built as a module, if so, the module
 	   will be called "rtc-snvs".
 
+config RTC_DRV_BBNSM
+	tristate "NXP BBNSM RTC support"
+	select REGMAP_MMIO
+	depends on ARCH_MXC || COMPILE_TEST
+	depends on HAS_IOMEM
+	depends on OF
+	help
+	   If you say yes here you get support for the NXP BBNSM RTC module.
+
+	   This driver can also be built as a module, if so, the module
+	   will be called "rtc-bbnsm".
+
 config RTC_DRV_IMX_SC
 	depends on IMX_SCU
 	depends on HAVE_ARM_SMCCC
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index d3c042dcbc73..0f11027a7388 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_RTC_DRV_ASPEED)	+= rtc-aspeed.o
 obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
 obj-$(CONFIG_RTC_DRV_AT91SAM9)	+= rtc-at91sam9.o
 obj-$(CONFIG_RTC_DRV_AU1XXX)	+= rtc-au1xxx.o
+obj-$(CONFIG_RTC_DRV_BBNSM)	+= rtc-nxp-bbnsm.o
 obj-$(CONFIG_RTC_DRV_BD70528)	+= rtc-bd70528.o
 obj-$(CONFIG_RTC_DRV_BQ32K)	+= rtc-bq32k.o
 obj-$(CONFIG_RTC_DRV_BQ4802)	+= rtc-bq4802.o
diff --git a/drivers/rtc/rtc-nxp-bbnsm.c b/drivers/rtc/rtc-nxp-bbnsm.c
new file mode 100644
index 000000000000..1009388b635e
--- /dev/null
+++ b/drivers/rtc/rtc-nxp-bbnsm.c
@@ -0,0 +1,226 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright 2022 NXP.
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm_wakeirq.h>
+#include <linux/regmap.h>
+#include <linux/rtc.h>
+
+#define BBNSM_CTRL	0x8
+#define BBNSM_INT_EN	0x10
+#define BBNSM_EVENTS	0x14
+#define BBNSM_RTC_LS	0x40
+#define BBNSM_RTC_MS	0x44
+#define BBNSM_TA	0x50
+
+#define RTC_EN		0x2
+#define RTC_EN_MSK	0x3
+#define TA_EN		(0x2 << 2)
+#define TA_DIS		(0x1 << 2)
+#define TA_EN_MSK	(0x3 << 2)
+#define RTC_INT_EN	0x2
+#define TA_INT_EN	(0x2 << 2)
+
+#define BBNSM_EVENT_TA	(0x2 << 2)
+
+#define CNTR_TO_SECS_SH	15
+
+struct bbnsm_rtc {
+	struct rtc_device *rtc;
+	struct regmap *regmap;
+	int irq;
+	struct clk *clk;
+};
+
+static u32 bbnsm_read_counter(struct bbnsm_rtc *bbnsm)
+{
+	u32 rtc_msb, rtc_lsb;
+	unsigned int timeout = 100;
+	u32 time;
+	u32 tmp = 0;
+
+	do {
+		time = tmp;
+		/* read the msb */
+		regmap_read(bbnsm->regmap, BBNSM_RTC_MS, &rtc_msb);
+		/* read the lsb */
+		regmap_read(bbnsm->regmap, BBNSM_RTC_LS, &rtc_lsb);
+		/* convert to seconds */
+		tmp = (rtc_msb << 17) | (rtc_lsb >> 15);
+	} while (tmp != time && --timeout);
+
+	return time;
+}
+
+static int bbnsm_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+	struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev);
+	unsigned long time;
+	u32 val;
+
+	regmap_read(bbnsm->regmap, BBNSM_CTRL, &val);
+	if ((val & RTC_EN_MSK) != RTC_EN)
+		return -EINVAL;
+
+	time = bbnsm_read_counter(bbnsm);
+	rtc_time64_to_tm(time, tm);
+
+	return 0;
+}
+
+static int bbnsm_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+	struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev);
+	unsigned long time = rtc_tm_to_time64(tm);
+
+	/* disable the RTC first */
+	regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, RTC_EN_MSK, 0);
+
+	/* write the 32bit sec time to 47 bit timer counter, leaving 15 LSBs blank */
+	regmap_write(bbnsm->regmap, BBNSM_RTC_LS, time << CNTR_TO_SECS_SH);
+	regmap_write(bbnsm->regmap, BBNSM_RTC_MS, time >> (32 - CNTR_TO_SECS_SH));
+
+	/* Enable the RTC again */
+	regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, RTC_EN_MSK, RTC_EN);
+
+	return 0;
+}
+
+static int bbnsm_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
+{
+	struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev);
+	u32 bbnsm_events, bbnsm_ta;
+
+	regmap_read(bbnsm->regmap, BBNSM_TA, &bbnsm_ta);
+	rtc_time64_to_tm(bbnsm_ta, &alrm->time);
+
+	regmap_read(bbnsm->regmap, BBNSM_EVENTS, &bbnsm_events);
+	alrm->pending = (bbnsm_events & BBNSM_EVENT_TA) ? 1 : 0;
+
+	return 0;
+}
+
+static int bbnsm_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
+{
+	struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev);
+
+	/* enable the alarm event */
+	regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, TA_EN_MSK, enable ? TA_EN : TA_DIS);
+	/* enable the alarm interrupt */
+	regmap_update_bits(bbnsm->regmap, BBNSM_INT_EN, TA_EN_MSK, enable ? TA_EN : TA_DIS);
+
+	return 0;
+}
+
+static int bbnsm_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
+{
+	struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev);
+	unsigned long time = rtc_tm_to_time64(&alrm->time);
+
+	/* disable the alarm */
+	regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, TA_EN, TA_EN);
+
+	/* write the seconds to TA */
+	regmap_write(bbnsm->regmap, BBNSM_TA, time);
+
+	return bbnsm_rtc_alarm_irq_enable(dev, alrm->enabled);
+}
+
+static const struct rtc_class_ops bbnsm_rtc_ops = {
+	.read_time = bbnsm_rtc_read_time,
+	.set_time = bbnsm_rtc_set_time,
+	.read_alarm = bbnsm_rtc_read_alarm,
+	.set_alarm = bbnsm_rtc_set_alarm,
+	.alarm_irq_enable = bbnsm_rtc_alarm_irq_enable,
+};
+
+static irqreturn_t bbnsm_rtc_irq_handler(int irq, void *dev_id)
+{
+	struct device *dev = dev_id;
+	struct bbnsm_rtc  *bbnsm = dev_get_drvdata(dev);
+	u32 val;
+
+	regmap_read(bbnsm->regmap, BBNSM_EVENTS, &val);
+	if (val & BBNSM_EVENT_TA) {
+		bbnsm_rtc_alarm_irq_enable(dev, false);
+		/* clear the alarm event */
+		regmap_write_bits(bbnsm->regmap, BBNSM_EVENTS, TA_EN_MSK, BBNSM_EVENT_TA);
+		rtc_update_irq(bbnsm->rtc, 1, RTC_AF | RTC_IRQF);
+
+		return IRQ_HANDLED;
+	}
+
+	return IRQ_NONE;
+}
+
+static int bbnsm_rtc_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct bbnsm_rtc *bbnsm;
+	int ret;
+
+	bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL);
+	if (!bbnsm)
+		return -ENOMEM;
+
+	bbnsm->rtc = devm_rtc_allocate_device(&pdev->dev);
+	if (IS_ERR(bbnsm->rtc))
+		return PTR_ERR(bbnsm->rtc);
+
+	bbnsm->regmap = syscon_node_to_regmap(np->parent);
+	if (IS_ERR(bbnsm->regmap)) {
+		dev_dbg(&pdev->dev, "bbnsm get regmap failed\n");
+		return PTR_ERR(bbnsm->regmap);
+	}
+
+	bbnsm->irq = platform_get_irq(pdev, 0);
+	if (bbnsm->irq < 0)
+		return bbnsm->irq;
+
+	platform_set_drvdata(pdev, bbnsm);
+
+	/* clear all the pending events */
+	regmap_write(bbnsm->regmap, BBNSM_EVENTS, 0x7A);
+
+	device_init_wakeup(&pdev->dev, true);
+	dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+
+	ret = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_rtc_irq_handler,
+			IRQF_SHARED, "rtc alarm", &pdev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to request irq %d: %d\n",
+			bbnsm->irq, ret);
+		return ret;
+	}
+
+	bbnsm->rtc->ops = &bbnsm_rtc_ops;
+	bbnsm->rtc->range_max = U32_MAX;
+
+	return devm_rtc_register_device(bbnsm->rtc);
+}
+
+static const struct of_device_id bbnsm_dt_ids[] = {
+	{ .compatible = "nxp,imx93-bbnsm-rtc" },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, bbnsm_dt_ids);
+
+static struct platform_driver bbnsm_rtc_driver = {
+	.driver = {
+		.name = "bbnsm_rtc",
+		.of_match_table = bbnsm_dt_ids,
+	},
+	.probe = bbnsm_rtc_probe,
+};
+module_platform_driver(bbnsm_rtc_driver);
+
+MODULE_AUTHOR("Jacky Bai <ping.bai@nxp.com>");
+MODULE_DESCRIPTION("NXP BBNSM RTC Driver");
+MODULE_LICENSE("GPL");
-- 
2.37.1


^ permalink raw reply related

* [PATCH v4 2/4] input: bbnsm_pwrkey: Add bbnsm power key support
From: Jacky Bai @ 2023-01-29  7:08 UTC (permalink / raw)
  To: lee, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer,
	dmitry.torokhov, a.zummo, alexandre.belloni
  Cc: devicetree, linux-arm-kernel, linux-input, linux-rtc, kernel,
	linux-imx, festevam
In-Reply-To: <20230129070823.1945489-1-ping.bai@nxp.com>

The ON/OFF logic inside the BBNSM allows for connecting directly
into a PMIC or other voltage regulator device. The module has an
button input signal and a wakeup request input signal. It also
has two interrupts (set_pwr_off_irq and set_pwr_on_irq) and an
active-low PMIC enable (pmic_en_b) output.

Add the power key support for the ON/OFF button function found in
BBNSM module.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
  - v2 changes:
    - use device_property_read_u32() to read the property
    - clean up the goto return, return directly
    - sort the header file alphabetically
    - rename the file to add 'nxp' prefix

  - v3 changes:
    - get the regmap directly from the parent node

  - v4 changes:
    - update the compatible string to align with binding file
    - fix the device_property_read_u32 as stated in v2.
    - add back the 'dev_warn' for 'dev_pm_set_wake_irq' return fail.
---
 drivers/input/keyboard/Kconfig            |  11 ++
 drivers/input/keyboard/Makefile           |   1 +
 drivers/input/keyboard/nxp-bbnsm-pwrkey.c | 192 ++++++++++++++++++++++
 3 files changed, 204 insertions(+)
 create mode 100644 drivers/input/keyboard/nxp-bbnsm-pwrkey.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 84490915ae4d..43827e34f276 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -456,6 +456,17 @@ config KEYBOARD_SNVS_PWRKEY
 	  To compile this driver as a module, choose M here; the
 	  module will be called snvs_pwrkey.
 
+config KEYBOARD_BBNSM_PWRKEY
+	tristate "NXP BBNSM Power Key Driver"
+	depends on ARCH_MXC || COMPILE_TEST
+	depends on OF
+	help
+	  This is the bbnsm powerkey driver for the NXP i.MX application
+	  processors.
+
+	  To compile this driver as a module, choose M here; the
+	  module will be called bbnsm_pwrkey.
+
 config KEYBOARD_IMX
 	tristate "IMX keypad support"
 	depends on ARCH_MXC || COMPILE_TEST
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 5f67196bb2c1..e34dd65a34c3 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_KEYBOARD_AMIGA)		+= amikbd.o
 obj-$(CONFIG_KEYBOARD_APPLESPI)		+= applespi.o
 obj-$(CONFIG_KEYBOARD_ATARI)		+= atakbd.o
 obj-$(CONFIG_KEYBOARD_ATKBD)		+= atkbd.o
+obj-$(CONFIG_KEYBOARD_BBNSM_PWRKEY)	+= nxp-bbnsm-pwrkey.o
 obj-$(CONFIG_KEYBOARD_BCM)		+= bcm-keypad.o
 obj-$(CONFIG_KEYBOARD_CAP11XX)		+= cap11xx.o
 obj-$(CONFIG_KEYBOARD_CLPS711X)		+= clps711x-keypad.o
diff --git a/drivers/input/keyboard/nxp-bbnsm-pwrkey.c b/drivers/input/keyboard/nxp-bbnsm-pwrkey.c
new file mode 100644
index 000000000000..154ce58b9d5a
--- /dev/null
+++ b/drivers/input/keyboard/nxp-bbnsm-pwrkey.c
@@ -0,0 +1,192 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright 2022 NXP.
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/pm_wakeirq.h>
+#include <linux/regmap.h>
+
+#define BBNSM_CTRL		0x8
+#define BBNSM_INT_EN		0x10
+#define BBNSM_EVENTS		0x14
+#define BBNSM_PAD_CTRL		0x24
+
+#define BBNSM_BTN_PRESSED	BIT(7)
+#define BBNSM_PWR_ON		BIT(6)
+#define BBNSM_BTN_OFF		BIT(5)
+#define BBNSM_EMG_OFF		BIT(4)
+#define BBNSM_PWRKEY_EVENTS	(BBNSM_PWR_ON | BBNSM_BTN_OFF | BBNSM_EMG_OFF)
+#define BBNSM_DP_EN		BIT(24)
+
+#define DEBOUNCE_TIME		30
+#define REPEAT_INTERVAL		60
+
+struct bbnsm_pwrkey {
+	struct regmap *regmap;
+	int irq;
+	int keycode;
+	int keystate;  /* 1:pressed */
+	struct timer_list check_timer;
+	struct input_dev *input;
+};
+
+static void bbnsm_pwrkey_check_for_events(struct timer_list *t)
+{
+	struct bbnsm_pwrkey *bbnsm = from_timer(bbnsm, t, check_timer);
+	struct input_dev *input = bbnsm->input;
+	u32 state;
+
+	regmap_read(bbnsm->regmap, BBNSM_EVENTS, &state);
+
+	state = state & BBNSM_BTN_PRESSED ? 1 : 0;
+
+	/* only report new event if status changed */
+	if (state ^ bbnsm->keystate) {
+		bbnsm->keystate = state;
+		input_event(input, EV_KEY, bbnsm->keycode, state);
+		input_sync(input);
+		pm_relax(bbnsm->input->dev.parent);
+	}
+
+	/* repeat check if pressed long */
+	if (state) {
+		mod_timer(&bbnsm->check_timer,
+			  jiffies + msecs_to_jiffies(REPEAT_INTERVAL));
+	}
+}
+
+static irqreturn_t bbnsm_pwrkey_interrupt(int irq, void *dev_id)
+{
+	struct platform_device *pdev = dev_id;
+	struct bbnsm_pwrkey *bbnsm = platform_get_drvdata(pdev);
+	struct input_dev *input = bbnsm->input;
+	u32 event;
+
+	regmap_read(bbnsm->regmap, BBNSM_EVENTS, &event);
+	if (event & BBNSM_BTN_OFF)
+		mod_timer(&bbnsm->check_timer, jiffies + msecs_to_jiffies(DEBOUNCE_TIME));
+	else
+		return IRQ_NONE;
+
+	pm_wakeup_event(input->dev.parent, 0);
+
+	/* clear PWR OFF */
+	regmap_write(bbnsm->regmap, BBNSM_EVENTS, BBNSM_BTN_OFF);
+
+	return IRQ_HANDLED;
+}
+
+static void bbnsm_pwrkey_act(void *pdata)
+{
+	struct bbnsm_pwrkey *bbnsm = pdata;
+
+	del_timer_sync(&bbnsm->check_timer);
+}
+
+static int bbnsm_pwrkey_probe(struct platform_device *pdev)
+{
+	struct bbnsm_pwrkey *bbnsm;
+	struct input_dev *input;
+	struct device_node *np = pdev->dev.of_node;
+	int error;
+
+	bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL);
+	if (!bbnsm)
+		return -ENOMEM;
+
+	bbnsm->regmap = syscon_node_to_regmap(np->parent);
+	if (IS_ERR(bbnsm->regmap)) {
+		dev_err(&pdev->dev, "bbnsm pwerkey get regmap failed\n");
+		return PTR_ERR(bbnsm->regmap);
+	}
+
+	if (device_property_read_u32(&pdev->dev, "linux,code", &bbnsm->keycode)) {
+		bbnsm->keycode = KEY_POWER;
+		dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n");
+	}
+
+	bbnsm->irq = platform_get_irq(pdev, 0);
+	if (bbnsm->irq < 0)
+		return -EINVAL;
+
+	/* config the BBNSM power related register */
+	regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, BBNSM_DP_EN, BBNSM_DP_EN);
+
+	/* clear the unexpected interrupt before driver ready */
+	regmap_write_bits(bbnsm->regmap, BBNSM_EVENTS, BBNSM_PWRKEY_EVENTS, BBNSM_PWRKEY_EVENTS);
+
+	timer_setup(&bbnsm->check_timer, bbnsm_pwrkey_check_for_events, 0);
+
+	input = devm_input_allocate_device(&pdev->dev);
+	if (!input) {
+		dev_err(&pdev->dev, "failed to allocate the input device\n");
+		return -ENOMEM;
+	}
+
+	input->name = pdev->name;
+	input->phys = "bbnsm-pwrkey/input0";
+	input->id.bustype = BUS_HOST;
+
+	input_set_capability(input, EV_KEY, bbnsm->keycode);
+
+	/* input customer action to cancel release timer */
+	error = devm_add_action(&pdev->dev, bbnsm_pwrkey_act, bbnsm);
+	if (error) {
+		dev_err(&pdev->dev, "failed to register remove action\n");
+		return error;
+	}
+
+	bbnsm->input = input;
+	platform_set_drvdata(pdev, bbnsm);
+
+	error = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_pwrkey_interrupt,
+			       IRQF_SHARED, pdev->name, pdev);
+	if (error) {
+		dev_err(&pdev->dev, "interrupt not available.\n");
+		return error;
+	}
+
+	error = input_register_device(input);
+	if (error < 0) {
+		dev_err(&pdev->dev, "failed to register input device\n");
+		return error;
+	}
+
+	device_init_wakeup(&pdev->dev, true);
+	error = dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+	if (error)
+		dev_warn(&pdev->dev, "irq wake enable failed.\n");
+
+	return 0;
+}
+
+static const struct of_device_id bbnsm_pwrkey_ids[] = {
+	{ .compatible = "nxp,imx93-bbnsm-pwrkey" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, bbnsm_pwrkey_ids);
+
+static struct platform_driver bbnsm_pwrkey_driver = {
+	.driver = {
+		.name = "bbnsm_pwrkey",
+		.of_match_table = bbnsm_pwrkey_ids,
+	},
+	.probe = bbnsm_pwrkey_probe,
+};
+module_platform_driver(bbnsm_pwrkey_driver);
+
+MODULE_AUTHOR("Jacky Bai <ping.bai@nxp.com>");
+MODULE_DESCRIPTION("NXP bbnsm power key Driver");
+MODULE_LICENSE("GPL");
-- 
2.37.1


^ permalink raw reply related

* [PATCH v4 1/4] dt-bindings: mfd: Add nxp bbnsm
From: Jacky Bai @ 2023-01-29  7:08 UTC (permalink / raw)
  To: lee, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer,
	dmitry.torokhov, a.zummo, alexandre.belloni
  Cc: devicetree, linux-arm-kernel, linux-input, linux-rtc, kernel,
	linux-imx, festevam
In-Reply-To: <20230129070823.1945489-1-ping.bai@nxp.com>

Add binding for NXP BBNSM(Battery-Backed Non-Secure Module).

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
  - v2 changes:
    - remove the redundant 'bindings' string
    - add ref to rtc.yaml
    - add start-year property
    - rename 'regmap' to 'nxp,bbnsm-regmap' and add description & type define
    - add header files including in the example and correct the indentation

  -v3 changes:
    - remove the 'nxp,bbnsm-regmap' property, get the regmap directly from the
      parent node in rtc/pwrkey driver

  - v4 changes:
    - update the compatible string to include the soc id as Rob suggested
---
 .../devicetree/bindings/mfd/nxp,bbnsm.yaml    | 101 ++++++++++++++++++
 1 file changed, 101 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml

diff --git a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
new file mode 100644
index 000000000000..b1ade64a1554
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/nxp,bbnsm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP Battery-Backed Non-Secure Module
+
+maintainers:
+  - Jacky Bai <ping.bai@nxp.com>
+
+description: |
+  NXP BBNSM serves as non-volatile logic and storage for the system.
+  it Intergrates RTC & ON/OFF control.
+  The RTC can retain its state and continues counting even when the
+  main chip is power down. A time alarm is generated once the most
+  significant 32 bits of the real-time counter match the value in the
+  Time Alarm register.
+  The ON/OFF logic inside the BBNSM allows for connecting directly to
+  a PMIC or other voltage regulator device. both smart PMIC mode and
+  Dumb PMIC mode supported.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - nxp,imx93-bbnsm
+      - const: syscon
+      - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  rtc:
+    type: object
+    $ref: /schemas/rtc/rtc.yaml#
+
+    properties:
+      compatible:
+        enum:
+          - nxp,imx93-bbnsm-rtc
+
+      interrupts:
+        maxItems: 1
+
+      start-year: true
+
+    required:
+      - compatible
+      - interrupts
+
+    additionalProperties: false
+
+  pwrkey:
+    type: object
+    $ref: /schemas/input/input.yaml#
+
+    properties:
+      compatible:
+        enum:
+          - nxp,imx93-bbnsm-pwrkey
+
+      interrupts:
+        maxItems: 1
+
+      linux,code: true
+
+    required:
+      - compatible
+      - interrupts
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - rtc
+  - pwrkey
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/input/linux-event-codes.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    bbnsm: bbnsm@44440000 {
+        compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd";
+        reg = <0x44440000 0x10000>;
+
+        bbnsm_rtc: rtc {
+            compatible = "nxp,imx93-bbnsm-rtc";
+            interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+        };
+
+        bbnsm_pwrkey: pwrkey {
+            compatible = "nxp,imx93-bbnsm-pwrkey";
+            interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+            linux,code = <KEY_POWER>;
+        };
+    };
-- 
2.37.1


^ permalink raw reply related

* [PATCH v4 0/4] Add nxp bbnsm module support
From: Jacky Bai @ 2023-01-29  7:08 UTC (permalink / raw)
  To: lee, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer,
	dmitry.torokhov, a.zummo, alexandre.belloni
  Cc: devicetree, linux-arm-kernel, linux-input, linux-rtc, kernel,
	linux-imx, festevam

NXP BBNSM (Battery-Backed Non-Secure Module) serves as non-volatile
logic and storage for the system. it provides some similar functions
like RTC and ON/OFF support as previous SNVS module found on legacy
i.MX SoCs. The BBNSM is replacement of previous SNVS module, and more
likely it will be used on all the future i.MX SoC or other SoCs from
NXP.

This patchset add the basic support for BBNSM that found on i.MX93.

Jacky Bai (4):
  dt-bindings: mfd: Add nxp bbnsm
  input: bbnsm_pwrkey: Add bbnsm power key support
  rtc: bbnsm: Add the bbnsm rtc support
  arm64: dts: imx93: Add the bbnsm dts node

 .../devicetree/bindings/mfd/nxp,bbnsm.yaml    | 101 ++++++++
 arch/arm64/boot/dts/freescale/imx93.dtsi      |  16 ++
 drivers/input/keyboard/Kconfig                |  11 +
 drivers/input/keyboard/Makefile               |   1 +
 drivers/input/keyboard/nxp-bbnsm-pwrkey.c     | 192 +++++++++++++++
 drivers/rtc/Kconfig                           |  12 +
 drivers/rtc/Makefile                          |   1 +
 drivers/rtc/rtc-nxp-bbnsm.c                   | 226 ++++++++++++++++++
 8 files changed, 560 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
 create mode 100644 drivers/input/keyboard/nxp-bbnsm-pwrkey.c
 create mode 100644 drivers/rtc/rtc-nxp-bbnsm.c

-- 
2.37.1


^ permalink raw reply

* Re: [PATCH] HID: add KEY_CAMERA_FOCUS event in HID
From: qi feng @ 2023-01-29  2:59 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, linux-kernel, fengqi, Benjamin Tissoires
In-Reply-To: <nycvar.YFH.7.76.2301201849090.1734@cbobk.fhfr.pm>

Hi,
Our Bluetooth Handle needs the focus function, which is missing in the
current map
If our setting is unreasonable, do you have other suggested values

thanks

Jiri Kosina <jikos@kernel.org> 于2023年1月21日周六 01:51写道:
>
> On Mon, 9 Jan 2023, Qi Feng wrote:
>
> > From: fengqi <fengqi@xiaomi.com>
> >
> > Our HID device need KEY_CAMERA_FOCUS event to control camera, but this
> > event is non-existent in current HID driver. So we add this event in
> > hid-input.c
> >
> > Signed-off-by: fengqi <fengqi@xiaomi.com>
> > ---
> >  drivers/hid/hid-input.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> > index 9b59e436df0a..22cca3406b5c 100644
> > --- a/drivers/hid/hid-input.c
> > +++ b/drivers/hid/hid-input.c
> > @@ -1105,6 +1105,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
> >               case 0x0e5: map_key_clear(KEY_BASSBOOST);       break;
> >               case 0x0e9: map_key_clear(KEY_VOLUMEUP);        break;
> >               case 0x0ea: map_key_clear(KEY_VOLUMEDOWN);      break;
> > +             case 0x0ee: map_key_clear(KEY_CAMERA_FOCUS);    break;
> >               case 0x0f5: map_key_clear(KEY_SLOW);            break;
> >
> >               case 0x181: map_key_clear(KEY_BUTTONCONFIG);    break;
>
> [ CCing Benjamin ]
>
> Hi,
>
> so according to HUT 1.3.0, 0xeb-0xef are Reserved for now, so I'd be a
> little bit hesitatnt to but this into the generic mapping, as later HUT
> revision might define this in a different way.
>
> Which devices are known to be producing this?
>
> --
> Jiri Kosina
> SUSE Labs
>

^ permalink raw reply

* RE: [PATCH v3 2/4] input: bbnsm_pwrkey: Add bbnsm power key support
From: Jacky Bai @ 2023-01-29  2:48 UTC (permalink / raw)
  To: Mattijs Korpershoek, lee@kernel.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, dmitry.torokhov@gmail.com,
	a.zummo@towertech.it, alexandre.belloni@bootlin.com
  Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-input@vger.kernel.org, linux-rtc@vger.kernel.org,
	kernel@pengutronix.de, dl-linux-imx, festevam@gmail.com
In-Reply-To: <87wn5c18q4.fsf@baylibre.com>

> Subject: Re: [PATCH v3 2/4] input: bbnsm_pwrkey: Add bbnsm power key
> support
> 
> On Tue, Jan 03, 2023 at 15:47, Jacky Bai <ping.bai@nxp.com> wrote:
> 
> > The ON/OFF logic inside the BBNSM allows for connecting directly into
> > a PMIC or other voltage regulator device. The module has an button
> > input signal and a wakeup request input signal. It also has two
> > interrupts (set_pwr_off_irq and set_pwr_on_irq) and an active-low PMIC
> > enable (pmic_en_b) output.
> >
> > Add the power key support for the ON/OFF button function found in
> > BBNSM module.
> >
> > Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> > Reviewed-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >   - v2 changes:
> >     - use device_property_read_u32() to read the property
> 
> We state this in the changelog
> 
> >     - clean up the goto return, return directly
> >     - sort the header file alphabetically
> >     - rename the file to add 'nxp' prefix
> >
> >   - v3 changes:
> >     - get the regmap directly from the parent node
> > ---

...

> > +	bbnsm->regmap = syscon_node_to_regmap(np->parent);
> > +	if (IS_ERR(bbnsm->regmap)) {
> > +		dev_err(&pdev->dev, "bbnsm pwerkey get regmap failed\n");
> > +		return PTR_ERR(bbnsm->regmap);
> > +	}
> > +
> > +	if (of_property_read_u32(np, "linux,code", &bbnsm->keycode)) {
> 
> But of_property_read_u32() is still used

Sorry, it is my fault, will fix it.

> 
> > +		bbnsm->keycode = KEY_POWER;
> > +		dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n");
> > +	}
> > +
> > +	bbnsm->irq = platform_get_irq(pdev, 0);
> > +	if (bbnsm->irq < 0)
> > +		return -EINVAL;
> > +
> > +	/* config the BBNSM power related register */
> > +	regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, BBNSM_DP_EN,
> > +BBNSM_DP_EN);
> > +
> > +	/* clear the unexpected interrupt before driver ready */
> > +	regmap_write_bits(bbnsm->regmap, BBNSM_EVENTS,
> BBNSM_PWRKEY_EVENTS,
> > +BBNSM_PWRKEY_EVENTS);
> > +
> > +	timer_setup(&bbnsm->check_timer, bbnsm_pwrkey_check_for_events,
> 0);
> > +
> > +	input = devm_input_allocate_device(&pdev->dev);
> > +	if (!input) {
> > +		dev_err(&pdev->dev, "failed to allocate the input device\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	input->name = pdev->name;
> > +	input->phys = "bbnsm-pwrkey/input0";
> > +	input->id.bustype = BUS_HOST;
> > +
> > +	input_set_capability(input, EV_KEY, bbnsm->keycode);
> > +
> > +	/* input customer action to cancel release timer */
> > +	error = devm_add_action(&pdev->dev, bbnsm_pwrkey_act, bbnsm);
> > +	if (error) {
> > +		dev_err(&pdev->dev, "failed to register remove action\n");
> > +		return error;
> > +	}
> > +
> > +	bbnsm->input = input;
> > +	platform_set_drvdata(pdev, bbnsm);
> > +
> > +	error = devm_request_irq(&pdev->dev, bbnsm->irq,
> bbnsm_pwrkey_interrupt,
> > +			       IRQF_SHARED, pdev->name, pdev);
> > +	if (error) {
> > +		dev_err(&pdev->dev, "interrupt not available.\n");
> > +		return error;
> > +	}
> > +
> > +	error = input_register_device(input);
> > +	if (error < 0) {
> > +		dev_err(&pdev->dev, "failed to register input device\n");
> > +		return error;
> > +	}
> > +
> > +	device_init_wakeup(&pdev->dev, true);
> > +	dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
> 
> Can we add some error handling here?
> The legacy driver (snvs_pwrkey), which looks a lot like this one, warns whne
> irq wake enabling fails, and so do the other drivers keyboard drivers that call
> dev_pm_set_wake_irq().
> 

The error warning removed after v2 based on Alexandre's concern in rtc driver,
I can add a dev_warn in v4. Thx.

BR
Jacky Bai
> > +
> > +	return 0;
> > +}
> > +
> > +static const struct of_device_id bbnsm_pwrkey_ids[] = {
> > +	{ .compatible = "nxp,bbnsm-pwrkey" },
> > +	{ /* sentinel */ }
> > +};
> > +MODULE_DEVICE_TABLE(of, bbnsm_pwrkey_ids);
> > +
> > +static struct platform_driver bbnsm_pwrkey_driver = {
> > +	.driver = {
> > +		.name = "bbnsm_pwrkey",
> > +		.of_match_table = bbnsm_pwrkey_ids,
> > +	},
> > +	.probe = bbnsm_pwrkey_probe,
> > +};
> > +module_platform_driver(bbnsm_pwrkey_driver);
> > +
> > +MODULE_AUTHOR("Jacky Bai <ping.bai@nxp.com>");
> > +MODULE_DESCRIPTION("NXP bbnsm power key Driver");
> > +MODULE_LICENSE("GPL");
> > --
> > 2.37.1

^ permalink raw reply

* [git pull] Input updates for v6.2-rc5
From: Dmitry Torokhov @ 2023-01-29  0:41 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, linux-input

Hi Linus,

Please pull from:

	git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git tags/input-for-v6.2-rc5

to receive updates for the input subsystem. You will get:

- a revert to Synaptics driver switching touchpad on HP 15-* laptops
  back to PS/2 emulation mode as native RMI4 causes loss of keyboard
  function on HP 15-da1xxx

- a quirk added to i8042 for Clevo PCX0DX/TUXEDO XP1511 to make sure
  keyboard is responding after resume

Changelog:
---------

Dmitry Torokhov (1):
      Revert "Input: synaptics - switch touchpad on HP Laptop 15-da3001TU to RMI mode"

Werner Sembach (1):
      Input: i8042 - add Clevo PCX0DX to i8042 quirk table

Diffstat:
--------

 drivers/input/mouse/synaptics.c       | 1 -
 drivers/input/serio/i8042-acpipnpio.h | 7 +++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 00/35] Documentation: correct lots of spelling errors (series 1)
From: patchwork-bot+netdevbpf @ 2023-01-28 20:30 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, corbet, catalin.marinas, will, linux, axboe, andrii,
	ast, daniel, olteanv, steffen.klassert, daniel.m.jordan,
	akinobu.mita, deller, rafael, jikos, benjamin.tissoires,
	srinivas.pandruvada, wsa, dmitry.torokhov, rydberg, isdn, pavel,
	lee, jpoimboe, mbenes, pmladek, peterz, mingo, jglisse,
	naoya.horiguchi, linmiaohe, jonas, stefan.kristiansson, shorne,
	bhelgaas, lpieralisi, maz, mpe, len.brown, hca, gor, agordeev,
	juri.lelli, vincent.guittot, dhowells, jarkko, paul, jmorris,
	serge, perex, tiwai, broonie, martin.petersen, bristot, rostedt,
	gregkh, mhiramat, mathieu.poirier, suzuki.poulose, zbr,
	fenghua.yu, reinette.chatre, tglx, bp, chris, jcmvbkbc,
	alsa-devel, coresight, bpf, dri-devel, isdn4linux, keyrings,
	linux-acpi, linux-block, linux-crypto, linux-doc, linux-fbdev,
	linux-i2c, linux-input, linux-leds, linux-pci, linux-s390,
	linux-scsi, linux-sgx, linux-spi, linux-trace-devel,
	linux-trace-kernel, live-patching, linux-pm,
	linux-security-module, linux-usb, netdev, target-devel, linux-mm,
	openrisc, linux-arm-kernel, linux-xtensa, linuxppc-dev, x86
In-Reply-To: <20230127064005.1558-1-rdunlap@infradead.org>

Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu, 26 Jan 2023 22:39:30 -0800 you wrote:
> Correct many spelling errors in Documentation/ as reported by codespell.
> 
> Maintainers of specific kernel subsystems are only Cc-ed on their
> respective patches, not the entire series. [if all goes well]
> 
> These patches are based on linux-next-20230125.
> 
> [...]

Here is the summary with links:
  - [04/35] Documentation: bpf: correct spelling
    https://git.kernel.org/bpf/bpf-next/c/1d3cab43f4c7
  - [05/35] Documentation: core-api: correct spelling
    (no matching commit)
  - [13/35] Documentation: isdn: correct spelling
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply

* [PATCH 4/4] CP2112 Devicetree Support
From: Danny Kaehn @ 2023-01-28 20:26 UTC (permalink / raw)
  To: robh+dt, krzysztof.kozlowski+dt, jikos, benjamin.tissoires
  Cc: devicetree, linux-input, ethan.twardy
In-Reply-To: <20230128202622.12676-1-kaehndan@gmail.com>

Bind i2c and gpio interfaces to subnodes with names
"i2c" and "gpio" if they exist, respectively. This
allows the gpio and i2c controllers to be described
in DT as usual.

Signed-off-by: Danny Kaehn <kaehndan@gmail.com>
---
 drivers/hid/hid-cp2112.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 27cadadda7c9..99e8043e1c34 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -1310,6 +1310,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	dev->adap.algo		= &smbus_algorithm;
 	dev->adap.algo_data	= dev;
 	dev->adap.dev.parent	= &hdev->dev;
+	dev->adap.dev.of_node   = of_get_child_by_name(hdev->dev.of_node, "i2c");
 	snprintf(dev->adap.name, sizeof(dev->adap.name),
 		 "CP2112 SMBus Bridge on hidraw%d",
 		 ((struct hidraw *)hdev->hidraw)->minor);
@@ -1336,6 +1337,9 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	dev->gc.ngpio			= 8;
 	dev->gc.can_sleep		= 1;
 	dev->gc.parent			= &hdev->dev;
+#if defined(CONFIG_OF_GPIO)
+	dev->gc.of_node			= of_get_child_by_name(hdev->dev.of_node, "gpio");
+#endif
 
 	dev->irq.name = "cp2112-gpio";
 	dev->irq.irq_startup = cp2112_gpio_irq_startup;
@@ -1391,6 +1395,11 @@ static void cp2112_remove(struct hid_device *hdev)
 	struct cp2112_device *dev = hid_get_drvdata(hdev);
 	int i;
 
+	of_node_put(dev->adap.dev.of_node);
+#if defined(CONFIG_OF_GPIO)
+	of_node_put(dev->gc.of_node);
+#endif
+
 	sysfs_remove_group(&hdev->dev.kobj, &cp2112_attr_group);
 	i2c_del_adapter(&dev->adap);
 
-- 
2.25.1


^ permalink raw reply related

* [PATCH 3/4] Fix CP2112 driver not registering GPIO IRQ chip as threaded
From: Danny Kaehn @ 2023-01-28 20:26 UTC (permalink / raw)
  To: robh+dt, krzysztof.kozlowski+dt, jikos, benjamin.tissoires
  Cc: devicetree, linux-input, ethan.twardy
In-Reply-To: <20230128202622.12676-1-kaehndan@gmail.com>

The CP2112 generates interrupts from a polling routine on a thread,
and can only support threaded interrupts. This patch configures the
gpiochip irq chip with this flag, disallowing consumers to request
a hard IRQ from this driver, which resulted in a segfault previously.

Signed-off-by: Danny Kaehn <kaehndan@gmail.com>
---
 drivers/hid/hid-cp2112.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 1e16b0fa310d..27cadadda7c9 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -1354,6 +1354,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	girq->parents = NULL;
 	girq->default_type = IRQ_TYPE_NONE;
 	girq->handler = handle_simple_irq;
+	girq->threaded = true;
 
 	ret = gpiochip_add_data(&dev->gc, dev);
 	if (ret < 0) {
-- 
2.25.1


^ permalink raw reply related

* [PATCH 2/4] Share USB device devicetree node with child HID device
From: Danny Kaehn @ 2023-01-28 20:26 UTC (permalink / raw)
  To: robh+dt, krzysztof.kozlowski+dt, jikos, benjamin.tissoires
  Cc: devicetree, linux-input, ethan.twardy
In-Reply-To: <20230128202622.12676-1-kaehndan@gmail.com>

USB HID core now shares its devicetree of_node with its child HID device.
Since there can only be one HID device on a USB interface, it is redundant
to specify a hid node under the USB device (and further, binding this way
isn't currently possible, as hid_driver does not support of_match_table).

Signed-off-by: Danny Kaehn <kaehndan@gmail.com>
---
 drivers/hid/usbhid/hid-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index be4c731aaa65..b6c968af258f 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -33,6 +33,7 @@
 #include <linux/hiddev.h>
 #include <linux/hid-debug.h>
 #include <linux/hidraw.h>
+#include <linux/device.h>
 #include "usbhid.h"
 
 /*
@@ -1369,6 +1370,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
 	hid->hiddev_report_event = hiddev_report_event;
 #endif
 	hid->dev.parent = &intf->dev;
+	device_set_of_node_from_dev(&hid->dev, &intf->dev);
 	hid->bus = BUS_USB;
 	hid->vendor = le16_to_cpu(dev->descriptor.idVendor);
 	hid->product = le16_to_cpu(dev->descriptor.idProduct);
-- 
2.25.1


^ permalink raw reply related

* [PATCH 1/4] dt-bindings: hid: Add CP2112 HID USB to SMBus Bridge
From: Danny Kaehn @ 2023-01-28 20:26 UTC (permalink / raw)
  To: robh+dt, krzysztof.kozlowski+dt, jikos, benjamin.tissoires
  Cc: devicetree, linux-input, ethan.twardy
In-Reply-To: <20230128202622.12676-1-kaehndan@gmail.com>

This is a USB HID device which includes an I2C controller and 8 GPIO pins.

The binding allows describing the chip's gpio and i2c controller in DT
using the subnodes named "gpio" and "i2c", respectively. This is
intended to be used in configurations where the CP2112 is permanently
connected in hardware.

Signed-off-by: Danny Kaehn <kaehndan@gmail.com>
---
 .../bindings/hid/silabs,cp2112.yaml           | 82 +++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hid/silabs,cp2112.yaml

diff --git a/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml b/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml
new file mode 100644
index 000000000000..49287927c63f
--- /dev/null
+++ b/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml
@@ -0,0 +1,82 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hid/silabs,cp2112.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CP2112 HID USB to SMBus/I2C Bridge
+
+maintainers:
+  - Danny Kaehn <kaehndan@gmail.com>
+
+description:
+  This is a USB HID device which includes an I2C controller and 8 GPIO pins.
+  While USB devices typically aren't described in DeviceTree, doing so with the
+  CP2112 allows use of its i2c and gpio controllers with other DT nodes when
+  the chip is expected to be found on a USB port.
+
+properties:
+  compatible:
+    const: usb10c4,ea90
+  reg:
+    maxItems: 1
+    description: The USB port number on the host controller
+  i2c:
+    $ref: /schemas/i2c/i2c-controller.yaml#
+  gpio:
+    $ref: /schemas/gpio/gpio.yaml#
+
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/input/input.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    usb1 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      usb@1 {
+        compatible = "usb424,2514";
+        reg = <1>;
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        device@1 {	/* CP2112 I2C Bridge */
+          compatible = "usb10c4,ea90";
+          reg = <1>;
+
+          cp2112_i2c0: i2c {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            /* Child I2C Devices can be described as normal here */
+            temp@48 {
+              compatible = "national,lm75";
+              reg = <0x48>;
+            };
+          };
+
+          cp2112_gpio0: gpio {
+            gpio-controller;
+            interrupt-controller;
+            #gpio-cells = <2>;
+            gpio-line-names =
+              "TEST0",
+              "TEST1",
+              "TEST2",
+              "TEST3",
+              "TEST4",
+              "TEST5",
+              "TEST6",
+              "TEST7";
+          };
+        };
+      };
+    };
-- 
2.25.1


^ permalink raw reply related


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