* Re: [PATCH] input: cpcap-pwrbutton: remove initial kernel-doc notation
From: Mattijs Korpershoek @ 2023-01-24 9:47 UTC (permalink / raw)
To: Randy Dunlap, linux-kernel
Cc: Randy Dunlap, Sebastian Reichel, Dmitry Torokhov, linux-input
In-Reply-To: <20230113063831.16469-1-rdunlap@infradead.org>
On Thu, Jan 12, 2023 at 22:38, Randy Dunlap <rdunlap@infradead.org> wrote:
> Change the beginning "/**" in the file to "/*" since it is not a
> kernel-doc comment. This prevents a kernel-doc warning:
>
> drivers/input/misc/cpcap-pwrbutton.c:2: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
> * CPCAP Power Button Input Driver
>
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> drivers/input/misc/cpcap-pwrbutton.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff -- a/drivers/input/misc/cpcap-pwrbutton.c b/drivers/input/misc/cpcap-pwrbutton.c
> --- a/drivers/input/misc/cpcap-pwrbutton.c
> +++ b/drivers/input/misc/cpcap-pwrbutton.c
> @@ -1,4 +1,4 @@
> -/**
> +/*
> * CPCAP Power Button Input Driver
> *
> * Copyright (C) 2017 Sebastian Reichel <sre@kernel.org>
^ permalink raw reply
* Re: [PATCH] Input: synaptics-rmi4: Fix SPI device ID
From: Mattijs Korpershoek @ 2023-01-24 10:07 UTC (permalink / raw)
To: Rayyan Ansari, linux-input
Cc: ~postmarketos/upstreaming, Rayyan Ansari, Dmitry Torokhov,
linux-kernel
In-Reply-To: <20221219133717.1638496-1-rayyan@ansari.sh>
On Mon, Dec 19, 2022 at 13:37, Rayyan Ansari <rayyan@ansari.sh> wrote:
> Currently, the ID being set to "rmi4_spi" causes this warning:
> "SPI driver rmi4_spi has no spi_device_id for syna,rmi4-spi"
>
> Change the ID to rmi4-spi to stop this warning.
>
> Signed-off-by: Rayyan Ansari <rayyan@ansari.sh>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> drivers/input/rmi4/rmi_spi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/rmi4/rmi_spi.c b/drivers/input/rmi4/rmi_spi.c
> index c82edda66b23..aa3a6a8544d4 100644
> --- a/drivers/input/rmi4/rmi_spi.c
> +++ b/drivers/input/rmi4/rmi_spi.c
> @@ -510,7 +510,7 @@ static const struct dev_pm_ops rmi_spi_pm = {
> };
>
> static const struct spi_device_id rmi_id[] = {
> - { "rmi4_spi", 0 },
> + { "rmi4-spi", 0 },
> { }
> };
> MODULE_DEVICE_TABLE(spi, rmi_id);
> --
> 2.39.0
^ permalink raw reply
* Re: [PATCH v2] input: raspberrypi-ts: Fix refcount leak in rpi_ts_probe
From: Mattijs Korpershoek @ 2023-01-24 10:15 UTC (permalink / raw)
To: Miaoqian Lin, Dmitry Torokhov, Florian Fainelli,
Broadcom internal kernel review list, Miaoqian Lin, Rob Herring,
Eric Anholt, Nicolas Saenz Julienne, linux-input,
linux-rpi-kernel, linux-arm-kernel, linux-kernel
In-Reply-To: <20221223074657.810346-1-linmq006@gmail.com>
On Fri, Dec 23, 2022 at 11:46, Miaoqian Lin <linmq006@gmail.com> wrote:
> rpi_firmware_get() take reference, we need to release it in error paths
> as well. Use devm_rpi_firmware_get() helper to handling the resources.
> Also remove the existing rpi_firmware_put().
>
> Fixes: 0b9f28fed3f7 ("Input: add official Raspberry Pi's touchscreen driver")
> Fixes: 3b8ddff780b7 ("input: raspberrypi-ts: Release firmware handle when not needed")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> changes in v2:
> - use devm_rpi_firmware_get().
> - remove rpi_firmware_put().
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> drivers/input/touchscreen/raspberrypi-ts.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/input/touchscreen/raspberrypi-ts.c b/drivers/input/touchscreen/raspberrypi-ts.c
> index 5000f5fd9ec3..45c575df994e 100644
> --- a/drivers/input/touchscreen/raspberrypi-ts.c
> +++ b/drivers/input/touchscreen/raspberrypi-ts.c
> @@ -134,7 +134,7 @@ static int rpi_ts_probe(struct platform_device *pdev)
> return -ENOENT;
> }
>
> - fw = rpi_firmware_get(fw_node);
> + fw = devm_rpi_firmware_get(&pdev->dev, fw_node);
> of_node_put(fw_node);
> if (!fw)
> return -EPROBE_DEFER;
> @@ -160,7 +160,6 @@ static int rpi_ts_probe(struct platform_device *pdev)
> touchbuf = (u32)ts->fw_regs_phys;
> error = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF,
> &touchbuf, sizeof(touchbuf));
> - rpi_firmware_put(fw);
> if (error || touchbuf != 0) {
> dev_warn(dev, "Failed to set touchbuf, %d\n", error);
> return error;
> --
> 2.25.1
^ permalink raw reply
* [PATCH 0/3 v6] input: pwm-beeper: add feature to set volume level
From: Manuel Traut @ 2023-01-24 11:11 UTC (permalink / raw)
To: linux-kernel; +Cc: manuel.traut, Dmitry Torokhov, Frieder Schrempf, linux-input
Hi,
I found an old patchset on the ML that enables setting the volume of a
pwm-beeper via sysfs here [0].
This is an updated version of the patches that they apply to the current
version of the driver.
[0] https://lore.kernel.org/all/cover.1487323753.git.frieder.schrempf@exceet.de/
^ permalink raw reply
* [PATCH 1/3 v6] input: pwm-beeper: add feature to set volume level
From: Manuel Traut @ 2023-01-24 11:12 UTC (permalink / raw)
To: linux-kernel; +Cc: Dmitry Torokhov, Frieder Schrempf, linux-input
In-Reply-To: <Y8+8824hy/fWkpEk@mt.com>
Make the driver accept switching volume levels via sysfs.
This can be helpful if the beep/bell sound intensity needs
to be adapted to the environment of the device.
The volume adjustment is done by changing the duty cycle of
the pwm signal.
This patch adds the sysfs interface with 5 default volume
levels (0 - mute, 4 - max. volume).
Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de>
---
.../ABI/testing/sysfs-devices-pwm-beeper | 17 ++++
drivers/input/misc/pwm-beeper.c | 83 ++++++++++++++++++-
2 files changed, 99 insertions(+), 1 deletion(-)
create mode 100644 Documentation/ABI/testing/sysfs-devices-pwm-beeper
diff --git a/Documentation/ABI/testing/sysfs-devices-pwm-beeper b/Documentation/ABI/testing/sysfs-devices-pwm-beeper
new file mode 100644
index 000000000000..d068c5814f48
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-devices-pwm-beeper
@@ -0,0 +1,17 @@
+What: /sys/devices/.../pwm-beeper/volume
+Date: February 2017
+KernelVersion:
+Contact: Frieder Schrempf <frieder.schrempf@exceet.de>
+Description:
+ Control the volume of this pwm-beeper. Values
+ are between 0 and max_volume. This file will also
+ show the current volume level stored in the driver.
+
+What: /sys/devices/.../pwm-beeper/max_volume
+Date: February 2017
+KernelVersion:
+Contact: Frieder Schrempf <frieder.schrempf@exceet.de>
+Description:
+ This file shows the maximum volume level that can be
+ assigned to volume.
+
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index d6b12477748a..fadc73e1c89a 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -1,6 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
+ *
+ * Copyright (C) 2016, Frieder Schrempf <frieder.schrempf@exceet.de>
+ * (volume support)
+ *
* PWM beeper driver
*/
@@ -24,10 +28,61 @@ struct pwm_beeper {
unsigned int bell_frequency;
bool suspended;
bool amplifier_on;
+ unsigned int volume;
+ unsigned int *volume_levels;
+ unsigned int max_volume;
};
#define HZ_TO_NANOSECONDS(x) (1000000000UL/(x))
+static ssize_t volume_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct pwm_beeper *beeper = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%d\n", beeper->volume);
+}
+
+static ssize_t max_volume_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct pwm_beeper *beeper = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%d\n", beeper->max_volume);
+}
+
+static ssize_t volume_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ int rc;
+ struct pwm_beeper *beeper = dev_get_drvdata(dev);
+ unsigned int volume;
+
+ rc = kstrtouint(buf, 0, &volume);
+ if (rc)
+ return rc;
+
+ if (volume > beeper->max_volume)
+ return -EINVAL;
+ pr_debug("set volume to %u\n", volume);
+ beeper->volume = volume;
+
+ return count;
+}
+
+static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store);
+static DEVICE_ATTR(max_volume, 0644, max_volume_show, NULL);
+
+static struct attribute *pwm_beeper_attributes[] = {
+ &dev_attr_volume.attr,
+ &dev_attr_max_volume.attr,
+ NULL,
+};
+
+static struct attribute_group pwm_beeper_attribute_group = {
+ .attrs = pwm_beeper_attributes,
+};
+
static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period)
{
struct pwm_state state;
@@ -37,7 +92,8 @@ static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period)
state.enabled = true;
state.period = period;
- pwm_set_relative_duty_cycle(&state, 50, 100);
+
+ pwm_set_relative_duty_cycle(&state, beeper->volume_levels[beeper->volume], 1000);
error = pwm_apply_state(beeper->pwm, &state);
if (error)
@@ -126,6 +182,7 @@ static int pwm_beeper_probe(struct platform_device *pdev)
struct pwm_state state;
u32 bell_frequency;
int error;
+ size_t size;
beeper = devm_kzalloc(dev, sizeof(*beeper), GFP_KERNEL);
if (!beeper)
@@ -171,6 +228,24 @@ static int pwm_beeper_probe(struct platform_device *pdev)
beeper->bell_frequency = bell_frequency;
+ beeper->max_volume = 4;
+
+ size = sizeof(*beeper->volume_levels) *
+ (beeper->max_volume + 1);
+
+ beeper->volume_levels = devm_kzalloc(&(pdev->dev), size,
+ GFP_KERNEL);
+ if (!beeper->volume_levels)
+ return -ENOMEM;
+
+ beeper->volume_levels[0] = 0;
+ beeper->volume_levels[1] = 8;
+ beeper->volume_levels[2] = 20;
+ beeper->volume_levels[3] = 40;
+ beeper->volume_levels[4] = 500;
+
+ beeper->volume = beeper->max_volume;
+
beeper->input = devm_input_allocate_device(dev);
if (!beeper->input) {
dev_err(dev, "Failed to allocate input device\n");
@@ -192,6 +267,12 @@ static int pwm_beeper_probe(struct platform_device *pdev)
input_set_drvdata(beeper->input, beeper);
+ error = sysfs_create_group(&pdev->dev.kobj, &pwm_beeper_attribute_group);
+ if (error) {
+ dev_err(&pdev->dev, "Failed to create sysfs group: %d\n", error);
+ return error;
+ }
+
error = input_register_device(beeper->input);
if (error) {
dev_err(dev, "Failed to register input device: %d\n", error);
--
2.39.0
^ permalink raw reply related
* [PATCH 2/3 v6] input: pwm-beeper: add feature to set volume level
From: Manuel Traut @ 2023-01-24 11:13 UTC (permalink / raw)
To: linux-kernel; +Cc: Dmitry Torokhov, Frieder Schrempf, linux-input
In-Reply-To: <Y8+8824hy/fWkpEk@mt.com>
This patch adds the documentation for the devicetree bindings to set
the volume levels.
Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de>
Acked-by: Rob Herring <robh@kernel.org>
---
.../devicetree/bindings/input/pwm-beeper.txt | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.txt b/Documentation/devicetree/bindings/input/pwm-beeper.txt
index 8fc0e48c20db..93cab5eee9f2 100644
--- a/Documentation/devicetree/bindings/input/pwm-beeper.txt
+++ b/Documentation/devicetree/bindings/input/pwm-beeper.txt
@@ -9,6 +9,15 @@ Required properties:
Optional properties:
- amp-supply: phandle to a regulator that acts as an amplifier for the beeper
- beeper-hz: bell frequency in Hz
+- volume-levels: Array of PWM duty cycle values that correspond to
+ linear volume levels. These need to be in the range of 0 to 500,
+ while 0 means 0% duty cycle (mute) and 500 means 50% duty cycle
+ (max volume).
+ Please note that the actual volume of most beepers is highly
+ non-linear, which means that low volume levels are probably somewhere
+ in the range of 1 to 30 (0.1-3% duty cycle).
+- default-volume-level: the default volume level (index into the
+ array defined by the "volume-levels" property)
Example:
@@ -21,4 +30,6 @@ beeper {
compatible = "pwm-beeper";
pwms = <&pwm0>;
amp-supply = <&beeper_amp>;
+ volume-levels = <0 8 20 40 500>;
+ default-volume-level = <4>;
};
--
2.39.0
^ permalink raw reply related
* [PATCH 3/3 v6] input: pwm-beeper: add feature to set volume level
From: Manuel Traut @ 2023-01-24 11:14 UTC (permalink / raw)
To: linux-kernel; +Cc: Dmitry Torokhov, Frieder Schrempf, linux-input
In-Reply-To: <Y8+8824hy/fWkpEk@mt.com>
This patch adds the devicetree bindings to set the volume levels
and the default volume level.
Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de>
---
drivers/input/misc/pwm-beeper.c | 58 +++++++++++++++++++++++----------
1 file changed, 41 insertions(+), 17 deletions(-)
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index fadc73e1c89a..f95d6b5899c7 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -181,8 +181,9 @@ static int pwm_beeper_probe(struct platform_device *pdev)
struct pwm_beeper *beeper;
struct pwm_state state;
u32 bell_frequency;
- int error;
+ int error, length;
size_t size;
+ u32 value;
beeper = devm_kzalloc(dev, sizeof(*beeper), GFP_KERNEL);
if (!beeper)
@@ -228,23 +229,46 @@ static int pwm_beeper_probe(struct platform_device *pdev)
beeper->bell_frequency = bell_frequency;
- beeper->max_volume = 4;
-
- size = sizeof(*beeper->volume_levels) *
- (beeper->max_volume + 1);
-
- beeper->volume_levels = devm_kzalloc(&(pdev->dev), size,
- GFP_KERNEL);
- if (!beeper->volume_levels)
- return -ENOMEM;
-
- beeper->volume_levels[0] = 0;
- beeper->volume_levels[1] = 8;
- beeper->volume_levels[2] = 20;
- beeper->volume_levels[3] = 40;
- beeper->volume_levels[4] = 500;
+ /* determine the number of volume levels */
+ length = device_property_read_u32_array(&pdev->dev, "volume-levels", NULL, 0);
+ if (length <= 0) {
+ dev_dbg(&pdev->dev, "no volume levels specified, using max volume\n");
+ beeper->max_volume = 1;
+ } else
+ beeper->max_volume = length;
+
+ /* read volume levels from DT property */
+ if (beeper->max_volume > 0) {
+ size = sizeof(*beeper->volume_levels) * beeper->max_volume;
+
+ beeper->volume_levels = devm_kzalloc(&(pdev->dev), size,
+ GFP_KERNEL);
+ if (!beeper->volume_levels)
+ return -ENOMEM;
+
+ if (length > 0) {
+ error = device_property_read_u32_array(&pdev->dev, "volume-levels",
+ beeper->volume_levels,
+ beeper->max_volume);
+
+ if (error < 0)
+ return error;
+
+ error = device_property_read_u32(&pdev->dev, "default-volume-level",
+ &value);
+
+ if (error < 0) {
+ dev_dbg(&pdev->dev, "no default volume specified, using max volume\n");
+ value = beeper->max_volume - 1;
+ }
+ } else {
+ beeper->volume_levels[0] = 500;
+ value = 0;
+ }
- beeper->volume = beeper->max_volume;
+ beeper->volume = value;
+ beeper->max_volume--;
+ }
beeper->input = devm_input_allocate_device(dev);
if (!beeper->input) {
--
2.39.0
^ permalink raw reply related
* Re: [PATCH v3 2/4] input: bbnsm_pwrkey: Add bbnsm power key support
From: Mattijs Korpershoek @ 2023-01-24 11:18 UTC (permalink / raw)
To: Jacky Bai, 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: <20230103074742.2324924-3-ping.bai@nxp.com>
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
> ---
> drivers/input/keyboard/Kconfig | 11 ++
> drivers/input/keyboard/Makefile | 1 +
> drivers/input/keyboard/nxp-bbnsm-pwrkey.c | 190 ++++++++++++++++++++++
> 3 files changed, 202 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..dc937036c952
> --- /dev/null
> +++ b/drivers/input/keyboard/nxp-bbnsm-pwrkey.c
> @@ -0,0 +1,190 @@
> +// 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 (of_property_read_u32(np, "linux,code", &bbnsm->keycode)) {
But of_property_read_u32() is still used
> + 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().
> +
> + 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
* Re: [PATCH 2/3 v6] input: pwm-beeper: add feature to set volume level
From: Krzysztof Kozlowski @ 2023-01-24 11:29 UTC (permalink / raw)
To: Manuel Traut, linux-kernel; +Cc: Dmitry Torokhov, Frieder Schrempf, linux-input
In-Reply-To: <Y8+9WRP51u+dof8p@mt.com>
On 24/01/2023 12:13, Manuel Traut wrote:
> This patch adds the documentation for the devicetree bindings to set
> the volume levels.
Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC. It might happen, that command when run on an older
kernel, gives you outdated entries. Therefore please be sure you base
your patches on recent Linux kernel.
>
> Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de>
I think it is kontron.de now.
> Acked-by: Rob Herring <robh@kernel.org>
This misses your SoB.
> ---
> .../devicetree/bindings/input/pwm-beeper.txt | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.txt b/Documentation/devicetree/bindings/input/pwm-beeper.txt
> index 8fc0e48c20db..93cab5eee9f2 100644
> --- a/Documentation/devicetree/bindings/input/pwm-beeper.txt
> +++ b/Documentation/devicetree/bindings/input/pwm-beeper.txt
> @@ -9,6 +9,15 @@ Required properties:
> Optional properties:
> - amp-supply: phandle to a regulator that acts as an amplifier for the beeper
> - beeper-hz: bell frequency in Hz
> +- volume-levels: Array of PWM duty cycle values that correspond to
> + linear volume levels. These need to be in the range of 0 to 500,
> + while 0 means 0% duty cycle (mute) and 500 means 50% duty cycle
> + (max volume).
> + Please note that the actual volume of most beepers is highly
> + non-linear, which means that low volume levels are probably somewhere
> + in the range of 1 to 30 (0.1-3% duty cycle).
> +- default-volume-level: the default volume level (index into the
> + array defined by the "volume-levels" property)
The bindings should be converted to DT schema first and then new
properties added.
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH 2/3 v6] input: pwm-beeper: add feature to set volume level
From: Krzysztof Kozlowski @ 2023-01-24 11:29 UTC (permalink / raw)
To: Manuel Traut, linux-kernel; +Cc: Dmitry Torokhov, Frieder Schrempf, linux-input
In-Reply-To: <Y8+9WRP51u+dof8p@mt.com>
On 24/01/2023 12:13, Manuel Traut wrote:
> This patch adds the documentation for the devicetree bindings to set
> the volume levels.
>
> Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de>
> Acked-by: Rob Herring <robh@kernel.org>
> ---
One more:
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/3 v6] input: pwm-beeper: add feature to set volume level
From: kernel test robot @ 2023-01-24 13:18 UTC (permalink / raw)
To: Manuel Traut, linux-kernel
Cc: oe-kbuild-all, Dmitry Torokhov, Frieder Schrempf, linux-input
In-Reply-To: <Y8+9L7UincSjIaD9@mt.com>
Hi Manuel,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on dtor-input/next]
[also build test ERROR on dtor-input/for-linus linus/master v6.2-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Manuel-Traut/input-pwm-beeper-add-feature-to-set-volume-level/20230124-191549
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link: https://lore.kernel.org/r/Y8%2B9L7UincSjIaD9%40mt.com
patch subject: [PATCH 1/3 v6] input: pwm-beeper: add feature to set volume level
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20230124/202301242124.R5AWMFJb-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3468440a8e674e649dcf11e23f3fb3d229555e7c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Manuel-Traut/input-pwm-beeper-add-feature-to-set-volume-level/20230124-191549
git checkout 3468440a8e674e649dcf11e23f3fb3d229555e7c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/input/misc/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/input/misc/pwm-beeper.c:73:62: error: macro "DEVICE_ATTR_RW" passed 4 arguments, but takes just 1
73 | static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store);
| ^
In file included from include/linux/input.h:19,
from drivers/input/misc/pwm-beeper.c:11:
include/linux/device.h:131: note: macro "DEVICE_ATTR_RW" defined here
131 | #define DEVICE_ATTR_RW(_name) \
|
>> drivers/input/misc/pwm-beeper.c:73:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RW' [-Werror=implicit-int]
73 | static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store);
| ^~~~~~~~~~~~~~
>> drivers/input/misc/pwm-beeper.c:77:10: error: 'dev_attr_volume' undeclared here (not in a function); did you mean 'dev_attr_max_volume'?
77 | &dev_attr_volume.attr,
| ^~~~~~~~~~~~~~~
| dev_attr_max_volume
drivers/input/misc/pwm-beeper.c:73:8: warning: 'DEVICE_ATTR_RW' defined but not used [-Wunused-variable]
73 | static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store);
| ^~~~~~~~~~~~~~
drivers/input/misc/pwm-beeper.c:54:16: warning: 'volume_store' defined but not used [-Wunused-function]
54 | static ssize_t volume_store(struct device *dev,
| ^~~~~~~~~~~~
drivers/input/misc/pwm-beeper.c:38:16: warning: 'volume_show' defined but not used [-Wunused-function]
38 | static ssize_t volume_show(struct device *dev,
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/DEVICE_ATTR_RW +73 drivers/input/misc/pwm-beeper.c
> 11 #include <linux/input.h>
12 #include <linux/regulator/consumer.h>
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/of.h>
16 #include <linux/platform_device.h>
17 #include <linux/property.h>
18 #include <linux/pwm.h>
19 #include <linux/slab.h>
20 #include <linux/workqueue.h>
21
22 struct pwm_beeper {
23 struct input_dev *input;
24 struct pwm_device *pwm;
25 struct regulator *amplifier;
26 struct work_struct work;
27 unsigned long period;
28 unsigned int bell_frequency;
29 bool suspended;
30 bool amplifier_on;
31 unsigned int volume;
32 unsigned int *volume_levels;
33 unsigned int max_volume;
34 };
35
36 #define HZ_TO_NANOSECONDS(x) (1000000000UL/(x))
37
38 static ssize_t volume_show(struct device *dev,
39 struct device_attribute *attr, char *buf)
40 {
41 struct pwm_beeper *beeper = dev_get_drvdata(dev);
42
43 return sprintf(buf, "%d\n", beeper->volume);
44 }
45
46 static ssize_t max_volume_show(struct device *dev,
47 struct device_attribute *attr, char *buf)
48 {
49 struct pwm_beeper *beeper = dev_get_drvdata(dev);
50
51 return sprintf(buf, "%d\n", beeper->max_volume);
52 }
53
54 static ssize_t volume_store(struct device *dev,
55 struct device_attribute *attr, const char *buf, size_t count)
56 {
57 int rc;
58 struct pwm_beeper *beeper = dev_get_drvdata(dev);
59 unsigned int volume;
60
61 rc = kstrtouint(buf, 0, &volume);
62 if (rc)
63 return rc;
64
65 if (volume > beeper->max_volume)
66 return -EINVAL;
67 pr_debug("set volume to %u\n", volume);
68 beeper->volume = volume;
69
70 return count;
71 }
72
> 73 static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store);
74 static DEVICE_ATTR(max_volume, 0644, max_volume_show, NULL);
75
76 static struct attribute *pwm_beeper_attributes[] = {
> 77 &dev_attr_volume.attr,
78 &dev_attr_max_volume.attr,
79 NULL,
80 };
81
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply
* [PATCH AUTOSEL 6.1 21/35] HID: uclogic: Add support for XP-PEN Deco 01 V2
From: Sasha Levin @ 2023-01-24 13:41 UTC (permalink / raw)
To: linux-kernel, stable
Cc: José Expósito, Mark Waddoups, Jiri Kosina, Sasha Levin,
jikos, benjamin.tissoires, linux-input
In-Reply-To: <20230124134131.637036-1-sashal@kernel.org>
From: José Expósito <jose.exposito89@gmail.com>
[ Upstream commit febb2c0d7c69c0396aa32d5ab425a4163473961a ]
The XP-PEN Deco 01 V2 is a UGEE v2 device with a frame with 8 buttons.
Its pen has 2 buttons, supports tilt and pressure.
Add its ID in order to support the device.
Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/839
Tested-by: Mark Waddoups <mwaddoups@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-uclogic-core.c | 2 ++
drivers/hid/hid-uclogic-params.c | 2 ++
3 files changed, 5 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 82713ef3aaa6..9ca471faab65 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1295,6 +1295,7 @@
#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540 0x0075
#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640 0x0094
#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01 0x0042
+#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01_V2 0x0905
#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L 0x0935
#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S 0x0909
#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06 0x0078
diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index 7fa6fe04f1b2..cfbbc39807a6 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -525,6 +525,8 @@ static const struct hid_device_id uclogic_devices[] = {
USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640) },
{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
+ USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01_V2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L) },
{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c
index cd1233d7e253..3c5eea3df328 100644
--- a/drivers/hid/hid-uclogic-params.c
+++ b/drivers/hid/hid-uclogic-params.c
@@ -1655,6 +1655,8 @@ int uclogic_params_init(struct uclogic_params *params,
break;
case VID_PID(USB_VENDOR_ID_UGEE,
USB_DEVICE_ID_UGEE_PARBLO_A610_PRO):
+ case VID_PID(USB_VENDOR_ID_UGEE,
+ USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01_V2):
case VID_PID(USB_VENDOR_ID_UGEE,
USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L):
case VID_PID(USB_VENDOR_ID_UGEE,
--
2.39.0
^ permalink raw reply related
* [PATCH AUTOSEL 6.1 22/35] HID: playstation: sanity check DualSense calibration data.
From: Sasha Levin @ 2023-01-24 13:41 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Roderick Colenbrander, Roderick Colenbrander, Jiri Kosina,
Sasha Levin, jikos, benjamin.tissoires, linux-input
In-Reply-To: <20230124134131.637036-1-sashal@kernel.org>
From: Roderick Colenbrander <roderick@gaikai.com>
[ Upstream commit ccf1e1626d37745d0a697db67407beec9ae9d4b8 ]
Make sure calibration values are defined to prevent potential kernel
crashes. This fixes a hypothetical issue for virtual or clone devices
inspired by a similar fix for DS4.
Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-playstation.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index 0b58763bfd30..2228f6e4ba23 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -712,6 +712,7 @@ ATTRIBUTE_GROUPS(ps_device);
static int dualsense_get_calibration_data(struct dualsense *ds)
{
+ struct hid_device *hdev = ds->base.hdev;
short gyro_pitch_bias, gyro_pitch_plus, gyro_pitch_minus;
short gyro_yaw_bias, gyro_yaw_plus, gyro_yaw_minus;
short gyro_roll_bias, gyro_roll_plus, gyro_roll_minus;
@@ -722,6 +723,7 @@ static int dualsense_get_calibration_data(struct dualsense *ds)
int speed_2x;
int range_2g;
int ret = 0;
+ int i;
uint8_t *buf;
buf = kzalloc(DS_FEATURE_REPORT_CALIBRATION_SIZE, GFP_KERNEL);
@@ -773,6 +775,21 @@ static int dualsense_get_calibration_data(struct dualsense *ds)
ds->gyro_calib_data[2].sens_numer = speed_2x*DS_GYRO_RES_PER_DEG_S;
ds->gyro_calib_data[2].sens_denom = gyro_roll_plus - gyro_roll_minus;
+ /*
+ * Sanity check gyro calibration data. This is needed to prevent crashes
+ * during report handling of virtual, clone or broken devices not implementing
+ * calibration data properly.
+ */
+ for (i = 0; i < ARRAY_SIZE(ds->gyro_calib_data); i++) {
+ if (ds->gyro_calib_data[i].sens_denom == 0) {
+ hid_warn(hdev, "Invalid gyro calibration data for axis (%d), disabling calibration.",
+ ds->gyro_calib_data[i].abs_code);
+ ds->gyro_calib_data[i].bias = 0;
+ ds->gyro_calib_data[i].sens_numer = DS_GYRO_RANGE;
+ ds->gyro_calib_data[i].sens_denom = S16_MAX;
+ }
+ }
+
/*
* Set accelerometer calibration and normalization parameters.
* Data values will be normalized to 1/DS_ACC_RES_PER_G g.
@@ -795,6 +812,21 @@ static int dualsense_get_calibration_data(struct dualsense *ds)
ds->accel_calib_data[2].sens_numer = 2*DS_ACC_RES_PER_G;
ds->accel_calib_data[2].sens_denom = range_2g;
+ /*
+ * Sanity check accelerometer calibration data. This is needed to prevent crashes
+ * during report handling of virtual, clone or broken devices not implementing calibration
+ * data properly.
+ */
+ for (i = 0; i < ARRAY_SIZE(ds->accel_calib_data); i++) {
+ if (ds->accel_calib_data[i].sens_denom == 0) {
+ hid_warn(hdev, "Invalid accelerometer calibration data for axis (%d), disabling calibration.",
+ ds->accel_calib_data[i].abs_code);
+ ds->accel_calib_data[i].bias = 0;
+ ds->accel_calib_data[i].sens_numer = DS_ACC_RANGE;
+ ds->accel_calib_data[i].sens_denom = S16_MAX;
+ }
+ }
+
err_free:
kfree(buf);
return ret;
--
2.39.0
^ permalink raw reply related
* [PATCH AUTOSEL 5.15 11/14] HID: playstation: sanity check DualSense calibration data.
From: Sasha Levin @ 2023-01-24 13:42 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Roderick Colenbrander, Roderick Colenbrander, Jiri Kosina,
Sasha Levin, jikos, benjamin.tissoires, linux-input
In-Reply-To: <20230124134257.637523-1-sashal@kernel.org>
From: Roderick Colenbrander <roderick@gaikai.com>
[ Upstream commit ccf1e1626d37745d0a697db67407beec9ae9d4b8 ]
Make sure calibration values are defined to prevent potential kernel
crashes. This fixes a hypothetical issue for virtual or clone devices
inspired by a similar fix for DS4.
Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-playstation.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index bd0e0fe2f627..944e5e5ff134 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -626,6 +626,7 @@ static const struct attribute_group ps_device_attribute_group = {
static int dualsense_get_calibration_data(struct dualsense *ds)
{
+ struct hid_device *hdev = ds->base.hdev;
short gyro_pitch_bias, gyro_pitch_plus, gyro_pitch_minus;
short gyro_yaw_bias, gyro_yaw_plus, gyro_yaw_minus;
short gyro_roll_bias, gyro_roll_plus, gyro_roll_minus;
@@ -636,6 +637,7 @@ static int dualsense_get_calibration_data(struct dualsense *ds)
int speed_2x;
int range_2g;
int ret = 0;
+ int i;
uint8_t *buf;
buf = kzalloc(DS_FEATURE_REPORT_CALIBRATION_SIZE, GFP_KERNEL);
@@ -687,6 +689,21 @@ static int dualsense_get_calibration_data(struct dualsense *ds)
ds->gyro_calib_data[2].sens_numer = speed_2x*DS_GYRO_RES_PER_DEG_S;
ds->gyro_calib_data[2].sens_denom = gyro_roll_plus - gyro_roll_minus;
+ /*
+ * Sanity check gyro calibration data. This is needed to prevent crashes
+ * during report handling of virtual, clone or broken devices not implementing
+ * calibration data properly.
+ */
+ for (i = 0; i < ARRAY_SIZE(ds->gyro_calib_data); i++) {
+ if (ds->gyro_calib_data[i].sens_denom == 0) {
+ hid_warn(hdev, "Invalid gyro calibration data for axis (%d), disabling calibration.",
+ ds->gyro_calib_data[i].abs_code);
+ ds->gyro_calib_data[i].bias = 0;
+ ds->gyro_calib_data[i].sens_numer = DS_GYRO_RANGE;
+ ds->gyro_calib_data[i].sens_denom = S16_MAX;
+ }
+ }
+
/*
* Set accelerometer calibration and normalization parameters.
* Data values will be normalized to 1/DS_ACC_RES_PER_G g.
@@ -709,6 +726,21 @@ static int dualsense_get_calibration_data(struct dualsense *ds)
ds->accel_calib_data[2].sens_numer = 2*DS_ACC_RES_PER_G;
ds->accel_calib_data[2].sens_denom = range_2g;
+ /*
+ * Sanity check accelerometer calibration data. This is needed to prevent crashes
+ * during report handling of virtual, clone or broken devices not implementing calibration
+ * data properly.
+ */
+ for (i = 0; i < ARRAY_SIZE(ds->accel_calib_data); i++) {
+ if (ds->accel_calib_data[i].sens_denom == 0) {
+ hid_warn(hdev, "Invalid accelerometer calibration data for axis (%d), disabling calibration.",
+ ds->accel_calib_data[i].abs_code);
+ ds->accel_calib_data[i].bias = 0;
+ ds->accel_calib_data[i].sens_numer = DS_ACC_RANGE;
+ ds->accel_calib_data[i].sens_denom = S16_MAX;
+ }
+ }
+
err_free:
kfree(buf);
return ret;
--
2.39.0
^ permalink raw reply related
* Re: [PATCH 1/3 v6] input: pwm-beeper: add feature to set volume level
From: kernel test robot @ 2023-01-24 14:40 UTC (permalink / raw)
To: Manuel Traut, linux-kernel
Cc: oe-kbuild-all, Dmitry Torokhov, Frieder Schrempf, linux-input
In-Reply-To: <Y8+9L7UincSjIaD9@mt.com>
Hi Manuel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on dtor-input/next]
[also build test WARNING on dtor-input/for-linus linus/master v6.2-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Manuel-Traut/input-pwm-beeper-add-feature-to-set-volume-level/20230124-191549
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link: https://lore.kernel.org/r/Y8%2B9L7UincSjIaD9%40mt.com
patch subject: [PATCH 1/3 v6] input: pwm-beeper: add feature to set volume level
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230124/202301242226.E9z7kZKT-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/3468440a8e674e649dcf11e23f3fb3d229555e7c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Manuel-Traut/input-pwm-beeper-add-feature-to-set-volume-level/20230124-191549
git checkout 3468440a8e674e649dcf11e23f3fb3d229555e7c
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/input/misc/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/input/misc/pwm-beeper.c:73:62: error: macro "DEVICE_ATTR_RW" passed 4 arguments, but takes just 1
73 | static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store);
| ^
In file included from include/linux/input.h:19,
from drivers/input/misc/pwm-beeper.c:11:
include/linux/device.h:131: note: macro "DEVICE_ATTR_RW" defined here
131 | #define DEVICE_ATTR_RW(_name) \
|
drivers/input/misc/pwm-beeper.c:73:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RW' [-Werror=implicit-int]
73 | static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store);
| ^~~~~~~~~~~~~~
drivers/input/misc/pwm-beeper.c:77:10: error: 'dev_attr_volume' undeclared here (not in a function); did you mean 'dev_attr_max_volume'?
77 | &dev_attr_volume.attr,
| ^~~~~~~~~~~~~~~
| dev_attr_max_volume
>> drivers/input/misc/pwm-beeper.c:73:8: warning: 'DEVICE_ATTR_RW' defined but not used [-Wunused-variable]
73 | static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store);
| ^~~~~~~~~~~~~~
drivers/input/misc/pwm-beeper.c:54:16: warning: 'volume_store' defined but not used [-Wunused-function]
54 | static ssize_t volume_store(struct device *dev,
| ^~~~~~~~~~~~
drivers/input/misc/pwm-beeper.c:38:16: warning: 'volume_show' defined but not used [-Wunused-function]
38 | static ssize_t volume_show(struct device *dev,
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/DEVICE_ATTR_RW +73 drivers/input/misc/pwm-beeper.c
72
> 73 static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store);
74 static DEVICE_ATTR(max_volume, 0644, max_volume_show, NULL);
75
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply
* Re: EXTERNAL - [PATCH 2/3 v6] input: pwm-beeper: add feature to set volume level
From: Manuel Traut @ 2023-01-24 16:11 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: linux-kernel, Dmitry Torokhov, Frieder Schrempf, linux-input
In-Reply-To: <907da24c-1619-a75b-b6b6-66c8ae86df6d@kernel.org>
Hi Krzysztof,
Am 24.01.2023 um 12:29 hat Krzysztof Kozlowski geschrieben:
> On 24/01/2023 12:13, Manuel Traut wrote:
> > This patch adds the documentation for the devicetree bindings to set
> > the volume levels.
> >
> > Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de>
> > Acked-by: Rob Herring <robh@kernel.org>
> > ---
>
> One more:
>
> 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).
Thanks for your feedback. I will post a v7 soon that includes your
feedback, the findings from the kernelbot and a fix that allows
unloading and loading of the module.
Best regards
Manuel
^ permalink raw reply
* [PATCH 0/5 v7] input: pwm-beeper: add feature to set volume
From: Manuel Traut @ 2023-01-24 16:34 UTC (permalink / raw)
To: linux-kernel
Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Frieder Schrempf, linux-input, devicetree, krzk
This series implements volume control for the pwm-beeper via sysfs.
The first patch changes the devicetree documentation from txt to yaml.
The original author of the following patches is Frieder Schrempf.
I picked them from this [0] LKML thread from 2017. Since it looks like
his email address changed in the meantime I changed it in the Author
and Signed-off-by, as well as in the copyright statements.
I did some minor changes on the patches that they apply and work with
the current kernel.
The last patch was added to fix loading/unloading of the driver.
I recently posted a v6 [1], changes since v6:
* Convert devicetree binding documentation from txt to yaml
* Use DEVICE_ATTR_[RO|RW] properly
* Change Frieders Mail address
* Added Signed-off and Tested-by statements
* Fix module unloading
Regards
Manuel
[0] https://lore.kernel.org/all/cover.1487323753.git.frieder.schrempf@exceet.de/
[1] https://lkml.org/lkml/2023/1/24/379
^ permalink raw reply
* [PATCH 1/5 v7] dt-bindings: input: pwm-beeper: Convert txt bindings to yaml
From: Manuel Traut @ 2023-01-24 16:39 UTC (permalink / raw)
To: linux-kernel
Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Frieder Schrempf, linux-input, devicetree
Converts txt binding to new YAML format.
Signed-off-by: Manuel Traut <manuel.traut@mt.com>
---
.../devicetree/bindings/input/pwm-beeper.txt | 24 ----------
.../devicetree/bindings/input/pwm-beeper.yaml | 48 +++++++++++++++++++
2 files changed, 48 insertions(+), 24 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/input/pwm-beeper.txt
create mode 100644 Documentation/devicetree/bindings/input/pwm-beeper.yaml
diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.txt b/Documentation/devicetree/bindings/input/pwm-beeper.txt
deleted file mode 100644
index 8fc0e48c20db..000000000000
--- a/Documentation/devicetree/bindings/input/pwm-beeper.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-* PWM beeper device tree bindings
-
-Registers a PWM device as beeper.
-
-Required properties:
-- compatible: should be "pwm-beeper"
-- pwms: phandle to the physical PWM device
-
-Optional properties:
-- amp-supply: phandle to a regulator that acts as an amplifier for the beeper
-- beeper-hz: bell frequency in Hz
-
-Example:
-
-beeper_amp: amplifier {
- compatible = "fixed-regulator";
- gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
-};
-
-beeper {
- compatible = "pwm-beeper";
- pwms = <&pwm0>;
- amp-supply = <&beeper_amp>;
-};
diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.yaml b/Documentation/devicetree/bindings/input/pwm-beeper.yaml
new file mode 100644
index 000000000000..24a40f0f77c1
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/pwm-beeper.yaml
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/input/pwm-beeper.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: PWM beeper device tree bindings
+
+maintainers:
+ - Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+description: Registers a PWM device as beeper.
+
+properties:
+ compatible:
+ const: pwm-beeper
+
+ pwms:
+ description: phandle to the physical PWM device
+ minItems: 1
+ maxItems: 1
+
+ amp-supply:
+ description: >
+ phandle to a regulator that acts as an amplifier for
+ the beeper
+
+ beeper-hz:
+ description: bell frequency in Hz
+
+required:
+ - compatible
+ - pwms
+
+additionalProperties: false
+
+examples:
+ - |
+ beeper_amp: amplifier {
+ compatible = "fixed-regulator";
+ gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
+ };
+
+ beeper {
+ compatible = "pwm-beeper";
+ pwms = <&pwm0>;
+ amp-supply = <&beeper_amp>;
+ };
--
2.39.0
^ permalink raw reply related
* [PATCH 5/5 v7] input: pwm-beeper: handle module unloading properly
From: Manuel Traut @ 2023-01-24 16:44 UTC (permalink / raw)
To: linux-kernel
Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Frieder Schrempf, linux-input, devicetree
'input: pwm-beeper: add feature to set volume via sysfs' adds device
attributes without removing them on error or if the module is unloaded.
This change removes the device attributes on module unloading or if
registering on the input subsystem fails.
If the module will be unloaded and loaded again it fails:
[ 1007.918180] sysfs: cannot create duplicate filename '/devices/platform/buzzer/volume'
Signed-off-by: Manuel Traut <manuel.traut@mt.com>
---
drivers/input/misc/pwm-beeper.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index fe543c4151d6..8ef2937e8f21 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -300,6 +300,7 @@ static int pwm_beeper_probe(struct platform_device *pdev)
error = input_register_device(beeper->input);
if (error) {
+ sysfs_remove_group(&pdev->dev.kobj, &pwm_beeper_attribute_group);
dev_err(dev, "Failed to register input device: %d\n", error);
return error;
}
@@ -309,6 +310,17 @@ static int pwm_beeper_probe(struct platform_device *pdev)
return 0;
}
+static int pwm_beeper_remove(struct platform_device *pdev)
+{
+ struct pwm_beeper *beeper;
+
+ beeper = platform_get_drvdata(pdev);
+ input_unregister_device(beeper->input);
+ sysfs_remove_group(&pdev->dev.kobj, &pwm_beeper_attribute_group);
+
+ return 0;
+}
+
static int __maybe_unused pwm_beeper_suspend(struct device *dev)
{
struct pwm_beeper *beeper = dev_get_drvdata(dev);
@@ -354,6 +366,7 @@ MODULE_DEVICE_TABLE(of, pwm_beeper_match);
static struct platform_driver pwm_beeper_driver = {
.probe = pwm_beeper_probe,
+ .remove = pwm_beeper_remove,
.driver = {
.name = "pwm-beeper",
.pm = &pwm_beeper_pm_ops,
--
2.39.0
^ permalink raw reply related
* Re: [PATCH 0/5 v7] input: pwm-beeper: add feature to set volume
From: Krzysztof Kozlowski @ 2023-01-24 16:56 UTC (permalink / raw)
To: Manuel Traut, linux-kernel
Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Frieder Schrempf, linux-input, devicetree, krzk
In-Reply-To: <Y9AIq3cSNzI9T/dU@mt.com>
On 24/01/2023 17:34, Manuel Traut wrote:
> This series implements volume control for the pwm-beeper via sysfs.
>
> The first patch changes the devicetree documentation from txt to yaml.
Your emails are:
1. Not properly threaded which messes inboxes.
2. Not cc-ed proper people (just use get_maintainers.pl).
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH 1/5 v7] dt-bindings: input: pwm-beeper: Convert txt bindings to yaml
From: Krzysztof Kozlowski @ 2023-01-24 16:58 UTC (permalink / raw)
To: Manuel Traut, linux-kernel
Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Frieder Schrempf, linux-input, devicetree
In-Reply-To: <Y9AJ07zT1lpBLhPk@mt.com>
On 24/01/2023 17:39, Manuel Traut wrote:
> Converts txt binding to new YAML format.
>
> Signed-off-by: Manuel Traut <manuel.traut@mt.com>
> ---
> .../devicetree/bindings/input/pwm-beeper.txt | 24 ----------
> .../devicetree/bindings/input/pwm-beeper.yaml | 48 +++++++++++++++++++
> 2 files changed, 48 insertions(+), 24 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/input/pwm-beeper.txt
> create mode 100644 Documentation/devicetree/bindings/input/pwm-beeper.yaml
>
> diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.txt b/Documentation/devicetree/bindings/input/pwm-beeper.txt
> deleted file mode 100644
> index 8fc0e48c20db..000000000000
> --- a/Documentation/devicetree/bindings/input/pwm-beeper.txt
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -* PWM beeper device tree bindings
> -
> -Registers a PWM device as beeper.
> -
> -Required properties:
> -- compatible: should be "pwm-beeper"
> -- pwms: phandle to the physical PWM device
> -
> -Optional properties:
> -- amp-supply: phandle to a regulator that acts as an amplifier for the beeper
> -- beeper-hz: bell frequency in Hz
> -
> -Example:
> -
> -beeper_amp: amplifier {
> - compatible = "fixed-regulator";
> - gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
> -};
> -
> -beeper {
> - compatible = "pwm-beeper";
> - pwms = <&pwm0>;
> - amp-supply = <&beeper_amp>;
> -};
> diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.yaml b/Documentation/devicetree/bindings/input/pwm-beeper.yaml
> new file mode 100644
> index 000000000000..24a40f0f77c1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/pwm-beeper.yaml
> @@ -0,0 +1,48 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2Does not look like you tested the bindings. Please run `make dt_binding_check` (see Documentation/devicetree/bindings/writing-schema.rst for instructions).
> +---
> +$id: "http://devicetree.org/schemas/input/pwm-beeper.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: PWM beeper device tree bindings
Drop: device tree bindings
> +
> +maintainers:
> + - Dmitry Torokhov <dmitry.torokhov@gmail.com>
> +
> +description: Registers a PWM device as beeper.
> +
> +properties:
> + compatible:
> + const: pwm-beeper
Does not look like you tested the bindings. Please run `make
dt_binding_check` (see
Documentation/devicetree/bindings/writing-schema.rst for instructions).
Start from scratch from example-schema. There are so many mistakes here
it should be seriously rework.
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH 5/5 v7] input: pwm-beeper: handle module unloading properly
From: Krzysztof Kozlowski @ 2023-01-24 17:00 UTC (permalink / raw)
To: Manuel Traut, linux-kernel
Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Frieder Schrempf, linux-input, devicetree
In-Reply-To: <Y9AK71Q7X4d+1E4f@mt.com>
On 24/01/2023 17:44, Manuel Traut wrote:
> 'input: pwm-beeper: add feature to set volume via sysfs' adds device
> attributes without removing them on error or if the module is unloaded.
>
> This change removes the device attributes on module unloading or if
Do not use "This commit/patch".
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95
> registering on the input subsystem fails.
>
> If the module will be unloaded and loaded again it fails:
> [ 1007.918180] sysfs: cannot create duplicate filename '/devices/platform/buzzer/volume'
>
> Signed-off-by: Manuel Traut <manuel.traut@mt.com>
> ---
> drivers/input/misc/pwm-beeper.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
> index fe543c4151d6..8ef2937e8f21 100644
> --- a/drivers/input/misc/pwm-beeper.c
> +++ b/drivers/input/misc/pwm-beeper.c
> @@ -300,6 +300,7 @@ static int pwm_beeper_probe(struct platform_device *pdev)
>
> error = input_register_device(beeper->input);
> if (error) {
> + sysfs_remove_group(&pdev->dev.kobj, &pwm_beeper_attribute_group);
> dev_err(dev, "Failed to register input device: %d\n", error);
> return error;
> }
> @@ -309,6 +310,17 @@ static int pwm_beeper_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static int pwm_beeper_remove(struct platform_device *pdev)
> +{
> + struct pwm_beeper *beeper;
> +
> + beeper = platform_get_drvdata(pdev);
Wrong indentation.
Please run scripts/checkpatch.pl and fix reported warnings.
> + input_unregister_device(beeper->input);
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH 2/3] HID: logitech-hidpp: Don't restart communication if not necessary
From: Bastien Nocera @ 2023-01-24 17:20 UTC (permalink / raw)
To: linux-input
Cc: linux-kernel, Jiri Kosina, Benjamin Tissoires,
Peter F . Patel-Schneider, Filipe Laíns, Nestor Lopez Casado
In-Reply-To: <20221220092207.428640-2-hadess@hadess.net>
On Tue, 2022-12-20 at 10:22 +0100, Bastien Nocera wrote:
> Don't stop and restart communication with the device unless we need
> to
> modify the connect flags used because of a device quirk.
FIWW, Andreas Bergmeier told me off-list that this fixed their problem
with the Litra Glow not connecting properly.
Would be great to have reviews on this and my other HID++ patches.
Cheers
> ---
> drivers/hid/hid-logitech-hidpp.c | 31 +++++++++++++++++++-----------
> -
> 1 file changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-
> logitech-hidpp.c
> index 7f9187201913..b4e4a8c79c75 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -4310,6 +4310,7 @@ static int hidpp_probe(struct hid_device *hdev,
> const struct hid_device_id *id)
> bool connected;
> unsigned int connect_mask = HID_CONNECT_DEFAULT;
> struct hidpp_ff_private_data data;
> + bool will_restart = false;
>
> /* report_fixup needs drvdata to be set before we call
> hid_parse */
> hidpp = devm_kzalloc(&hdev->dev, sizeof(*hidpp), GFP_KERNEL);
> @@ -4360,6 +4361,9 @@ static int hidpp_probe(struct hid_device *hdev,
> const struct hid_device_id *id)
> return ret;
> }
>
> + if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT)
> + will_restart = true;
> +
> INIT_WORK(&hidpp->work, delayed_work_cb);
> mutex_init(&hidpp->send_mutex);
> init_waitqueue_head(&hidpp->wait);
> @@ -4374,7 +4378,7 @@ static int hidpp_probe(struct hid_device *hdev,
> const struct hid_device_id *id)
> * Plain USB connections need to actually call start and open
> * on the transport driver to allow incoming data.
> */
> - ret = hid_hw_start(hdev, 0);
> + ret = hid_hw_start(hdev, will_restart ? 0 : connect_mask);
> if (ret) {
> hid_err(hdev, "hw start failed\n");
> goto hid_hw_start_fail;
> @@ -4411,6 +4415,7 @@ static int hidpp_probe(struct hid_device *hdev,
> const struct hid_device_id *id)
> hidpp->wireless_feature_index = 0;
> else if (ret)
> goto hid_hw_init_fail;
> + ret = 0;
> }
>
> if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP)) {
> @@ -4425,19 +4430,21 @@ static int hidpp_probe(struct hid_device
> *hdev, const struct hid_device_id *id)
>
> hidpp_connect_event(hidpp);
>
> - /* Reset the HID node state */
> - hid_device_io_stop(hdev);
> - hid_hw_close(hdev);
> - hid_hw_stop(hdev);
> + if (will_restart) {
> + /* Reset the HID node state */
> + hid_device_io_stop(hdev);
> + hid_hw_close(hdev);
> + hid_hw_stop(hdev);
>
> - if (hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT)
> - connect_mask &= ~HID_CONNECT_HIDINPUT;
> + if (hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT)
> + connect_mask &= ~HID_CONNECT_HIDINPUT;
>
> - /* Now export the actual inputs and hidraw nodes to the world
> */
> - ret = hid_hw_start(hdev, connect_mask);
> - if (ret) {
> - hid_err(hdev, "%s:hid_hw_start returned error\n",
> __func__);
> - goto hid_hw_start_fail;
> + /* Now export the actual inputs and hidraw nodes to
> the world */
> + ret = hid_hw_start(hdev, connect_mask);
> + if (ret) {
> + hid_err(hdev, "%s:hid_hw_start returned
> error\n", __func__);
> + goto hid_hw_start_fail;
> + }
> }
>
> if (hidpp->quirks & HIDPP_QUIRK_CLASS_G920) {
^ permalink raw reply
* Re: [PATCH 1/5 v7] dt-bindings: input: pwm-beeper: Convert txt bindings to yaml
From: Rob Herring @ 2023-01-24 19:06 UTC (permalink / raw)
To: Manuel Traut
Cc: devicetree, Krzysztof Kozlowski, linux-input, linux-kernel,
Rob Herring, Frieder Schrempf, Dmitry Torokhov
In-Reply-To: <Y9AJ07zT1lpBLhPk@mt.com>
On Tue, 24 Jan 2023 17:39:47 +0100, Manuel Traut wrote:
> Converts txt binding to new YAML format.
>
> Signed-off-by: Manuel Traut <manuel.traut@mt.com>
> ---
> .../devicetree/bindings/input/pwm-beeper.txt | 24 ----------
> .../devicetree/bindings/input/pwm-beeper.yaml | 48 +++++++++++++++++++
> 2 files changed, 48 insertions(+), 24 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/input/pwm-beeper.txt
> create mode 100644 Documentation/devicetree/bindings/input/pwm-beeper.yaml
>
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
./Documentation/devicetree/bindings/input/pwm-beeper.yaml:10:1: [error] syntax error: found character '\t' that cannot start any token (syntax)
dtschema/dtc warnings/errors:
make[1]: *** Deleting file 'Documentation/devicetree/bindings/input/pwm-beeper.example.dts'
Documentation/devicetree/bindings/input/pwm-beeper.yaml:10:1: found character '\t' that cannot start any token
make[1]: *** [Documentation/devicetree/bindings/Makefile:26: Documentation/devicetree/bindings/input/pwm-beeper.example.dts] Error 1
make[1]: *** Waiting for unfinished jobs....
./Documentation/devicetree/bindings/input/pwm-beeper.yaml:10:1: found character '\t' that cannot start any token
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/input/pwm-beeper.yaml: ignoring, error parsing file
make: *** [Makefile:1508: dt_binding_check] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/Y9AJ07zT1lpBLhPk@mt.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply
* Re: [PATCH v2 1/1] Docs/subsystem-apis: Remove '[The ]Linux' prefixes from titles of listed documents
From: Jonathan Corbet @ 2023-01-24 22:27 UTC (permalink / raw)
To: SeongJae Park
Cc: SeongJae Park, Andrew Morton, Bjorn Helgaas, Rafael J. Wysocki,
Viresh Kumar, Herbert Xu, David S. Miller, David Airlie,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Jean Delvare, Guenter Roeck, Dmitry Torokhov,
Iwona Winiarska, Jaroslav Kysela, Takashi Iwai, Wim Van Sebroeck,
linux-pci, linux-doc, linux-kernel, linux-pm, linux-crypto,
linux-mm, dri-devel, linux-hwmon, linux-input, openbmc,
alsa-devel, linux-watchdog
In-Reply-To: <20230122184834.181977-1-sj@kernel.org>
SeongJae Park <sj@kernel.org> writes:
> Some documents that listed on subsystem-apis have 'Linux' or 'The Linux'
> title prefixes. It's duplicated information, and makes finding the
> document of interest with human eyes not easy. Remove the prefixes from
> the titles.
>
> Signed-off-by: SeongJae Park <sj@kernel.org>
> ---
> Changes from v1
> (https://lore.kernel.org/lkml/20230114194741.115855-1-sj@kernel.org/)
> - Drop second patch (will post later for each subsystem)
>
> Documentation/PCI/index.rst | 6 +++---
> Documentation/cpu-freq/index.rst | 6 +++---
> Documentation/crypto/index.rst | 6 +++---
> Documentation/driver-api/index.rst | 6 +++---
> Documentation/gpu/index.rst | 6 +++---
> Documentation/hwmon/index.rst | 6 +++---
> Documentation/input/index.rst | 6 +++---
> Documentation/mm/index.rst | 6 +++---
> Documentation/peci/index.rst | 6 +++---
> Documentation/scheduler/index.rst | 6 +++---
> Documentation/scsi/index.rst | 6 +++---
> Documentation/sound/index.rst | 6 +++---
> Documentation/virt/index.rst | 6 +++---
> Documentation/watchdog/index.rst | 6 +++---
> 14 files changed, 42 insertions(+), 42 deletions(-)
Applied, thanks.
jon
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox