* Re: [PATCH 3/4] Input: pwm-vibra - add support for enable GPIO
From: Luca Weiss @ 2023-04-28 16:06 UTC (permalink / raw)
To: Brian Masney
Cc: ~postmarketos/upstreaming, phone-devel, Dmitry Torokhov,
Rob Herring, Krzysztof Kozlowski, Sebastian Reichel, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Brian Masney, linux-input,
devicetree, linux-kernel, linux-arm-msm
In-Reply-To: <ZEsFV6F4CEh2/av8@x1>
On Freitag, 28. April 2023 01:29:27 CEST Brian Masney wrote:
> On Thu, Apr 27, 2023 at 10:34:28PM +0200, Luca Weiss wrote:
> > Some pwm vibrators have a dedicated enable GPIO that needs to be set
> > high so that the vibrator works. Add support for that optionally.
> >
> > Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
>
> Hi Luca,
>
> Thank you for picking up this work!
>
> > + vibrator->enable_gpio = devm_gpiod_get_optional(&pdev->dev,
"enable",
> > +
GPIOD_OUT_LOW);
> > + err = PTR_ERR_OR_ZERO(vibrator->enable_gpio);
> > + if (err) {
> > + if (err != -EPROBE_DEFER)
> > + dev_err(&pdev->dev, "Failed to request enable
gpio: %d\n",
> > + err);
> > + return err;
> > + }
> > +
>
> Take a look at dev_err_probe() to remove the -EPROBE_DEFER check.
The input subsystem doesn't like dev_err_probe for some reason, you should
quickly find examples of that being rejected on the mailing list (or see
"git grep dev_err_probe drivers/input/")
>
> With that fixed:
>
> Reviewed-by: Brian Masney <bmasney@redhat.com>
Thanks for the reviews!
^ permalink raw reply
* Re: [PATCH 3/4] Input: pwm-vibra - add support for enable GPIO
From: Brian Masney @ 2023-04-28 16:11 UTC (permalink / raw)
To: Luca Weiss
Cc: ~postmarketos/upstreaming, phone-devel, Dmitry Torokhov,
Rob Herring, Krzysztof Kozlowski, Sebastian Reichel, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Brian Masney, linux-input,
devicetree, linux-kernel, linux-arm-msm
In-Reply-To: <8250064.NyiUUSuA9g@z3ntu.xyz>
On Fri, Apr 28, 2023 at 06:06:20PM +0200, Luca Weiss wrote:
> On Freitag, 28. April 2023 01:29:27 CEST Brian Masney wrote:
> > Take a look at dev_err_probe() to remove the -EPROBE_DEFER check.
>
> The input subsystem doesn't like dev_err_probe for some reason, you should
> quickly find examples of that being rejected on the mailing list (or see
> "git grep dev_err_probe drivers/input/")
OK, that's fine then. Feel free to include my Reviewed-by.
Brian
^ permalink raw reply
* Fwd: [PATCH 1/2] dt-bindings: input: microchip,cap11xx: add advanced sensitivity settings
From: Jiri Valek - 2N @ 2023-04-28 17:09 UTC (permalink / raw)
To: krzysztof.kozlowski
Cc: devicetree, dmitry.torokhov, jiriv, linux-input, linux-kernel,
robh+dt, u.kleine-koenig
In-Reply-To: <d7f77779-5d28-b78a-da4e-cc237b2a04b9@axis.com>
Hi Krzysztof,
and thanks for the review
On 4/15/23 11:10, Krzysztof Kozlowski wrote:
> On 15/04/2023 01:38, Jiri Valek - 2N wrote:
>> Add support for advanced sensitivity settings and signal guard feature.
>>
>> Signed-off-by: Jiri Valek - 2N <jiriv@axis.com>
>> ---
>> .../bindings/input/microchip,cap11xx.yaml | 64 ++++++++++++++++++-
>> 1 file changed, 61 insertions(+), 3 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml b/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml
>> index 5fa625b5c5fb..08e28226a164 100644
>> --- a/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml
>> +++ b/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml
>> @@ -45,13 +45,13 @@ properties:
>> Enables the Linux input system's autorepeat feature on the input device.
>>
>> linux,keycodes:
>> - minItems: 6
>> - maxItems: 6
>> + minItems: 3
>> + maxItems: 8
>> description: |
>> Specifies an array of numeric keycode values to
>> be used for the channels. If this property is
>> omitted, KEY_A, KEY_B, etc are used as defaults.
>> - The array must have exactly six entries.
>> + The number of entries must correspond to the number of channels.
>>
>> microchip,sensor-gain:
>> $ref: /schemas/types.yaml#/definitions/uint32
>> @@ -70,6 +70,58 @@ properties:
>> open drain. This property allows using the active
>> high push-pull output.
>>
>> + microchip,sensitivity-delta-sense:
>> + $ref: /schemas/types.yaml#/definitions/uint32
>> + default: 32
>> + enum: [1, 2, 4, 8, 16, 32, 64, 128]
>> + description: |
>
> Do not need '|' unless you need to preserve formatting.
OK. Will remove them.
>
>> + Optional parameter. Controls the sensitivity multiplier of a touch detection.
>> + At the more sensitive settings, touches are detected for a smaller delta
>> + capacitance corresponding to a “lighter” touch.
>> +
>> + microchip,sensitivity-base-shift:
>> + $ref: /schemas/types.yaml#/definitions/uint32
>> + default: 256
>> + enum: [1, 2, 4, 8, 16, 32, 64, 128, 256]
>> + description: |
>> + Optional parameter. Controls data scaling factor.
>> + The higher the value of these bits, the larger the range and the lower
>> + the resolution of the data presented. These settings will not affect
>> + touch detection or sensitivity.
>> +
>> + microchip,signal-guard:
>> + minItems: 3
>> + maxItems: 8
>> + enum: [0, 1]
>> + default: 0
>
> This was not really tested. Missing ref, mixing scalar and array
> properties. You want items with enum. And drop default.
Ack. I will fix it.
>
>
>> + description: |
>> + Optional parameter supported only for CAP129x.
>
> Then disallow it for others (allOf:if:then: ...
> microchip,signal-guard:false)
Ack. I will fix it.
>> + The signal guard isolates the signal from virtual grounds.
>> + If enabled then the behavior of the channel is changed to signal guard.
>> + The number of entries must correspond to the number of channels.
>> +
>> + microchip,input-treshold:
>> + minItems: 3
>> + maxItems: 8
>> + minimum: 0
>> + maximum: 127
>> + default: 64
>> + description: |
>> + Optional parameter. Specifies the delta threshold that is used to
>> + determine if a touch has been detected.
>> + The number of entries must correspond to the number of channels.
>> +
>> + microchip,calib-sensitivity:
>> + minItems: 3
>> + maxItems: 8
>> + enum: [1, 2, 4]
>> + default: 1
>> + description: |
>> + Optional parameter supported only for CAP129x. Specifies an array of
>> + numeric values that controls the gain used by the calibration routine to
>> + enable sensor inputs to be more sensitive for proximity detection.
>> + The number of entries must correspond to the number of channels.
>
> Most of these properties do not look like hardware properties. Policies
> and runtime configuration should not be put into DT. Explain please why
> these are board-specific thus suitable for DT.
All these parameters are intended to set HW properties of touch buttons.
Each button can have different PCB layout and when you start without
setting these parameters in DT, then touches won't be detected or you
will get false positive readings.
E.g. 'signal-guard' change property of analog input from button to some
type of shield.
I made all of them optional for backward compatibility.
Maybe 'sensitivity-base-shift' is really not necessary to have in DT.
I will remove it if you agree.
Best regards,
Jiri Valek
^ permalink raw reply
* Re: [RFC PATCH 3/3] Revert "input: gpio-keys - use device_pm_move_to_tail"
From: Doug Berger @ 2023-04-28 17:22 UTC (permalink / raw)
To: Rafael J. Wysocki, Greg Kroah-Hartman
Cc: Dmitry Torokhov, Lad Prabhakar, Gergo Koteles, Jonathan Cameron,
Andy Shevchenko, Dan Williams, Hans de Goede, Thomas Gleixner,
Kees Cook, Saravana Kannan, Florian Fainelli, linux-kernel,
linux-input
In-Reply-To: <CAJZ5v0jFAkBUAhNj8hbpM+6n1F3ETTtpxeP_QDsmKWdE=uueFw@mail.gmail.com>
On 4/28/2023 4:40 AM, Rafael J. Wysocki wrote:
> On Fri, Apr 28, 2023 at 6:47 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
>>
>> On Thu, Apr 27, 2023 at 03:16:25PM -0700, Doug Berger wrote:
>>> This reverts commit 2569873096f7eb1acf63624e9772d82b23923bf4.
>>
>> You have to give a reason why you are reverting it please...
>
> Also, the commit ID above doesn't match any commits in the mainline.
Apologies. I attempted to explain this in the cover letter, but as
anticipated it caused confusion. The relevant text was:
Both commits shouldn't really exist in the same kernel so the
third patch reverts the first in an attempt to make that clear
(though it may be a source of confusion for some).
This commit ID is the ID of the first patch of this set in my tree. It
slipped my mind that of course that wouldn't be conveyed through
send-mail :). D'oh!
To be clear, this is really a "straw man" request for comment with hope
of finding a more elegant solution to the issue.
Thanks,
Doug
^ permalink raw reply
* Re: [PATCH] HID: wacom: Check for string overflow from strscpy calls
From: Jason Gerecke @ 2023-04-28 17:32 UTC (permalink / raw)
To: linux-input, Benjamin Tissoires, Jiri Kosina
Cc: Ping Cheng, Aaron Armstrong Skomra, Joshua Dickens, Jason Gerecke,
Ping Cheng
In-Reply-To: <20230414182210.383218-1-jason.gerecke@wacom.com>
On Fri, Apr 14, 2023 at 11:22 AM Jason Gerecke <killertofu@gmail.com> wrote:
>
> From: Jason Gerecke <killertofu@gmail.com>
>
> The strscpy function is able to return an error code when a copy would
> overflow the size of the destination. The copy is stopped and the buffer
> terminated before overflow actually occurs so it is safe to continue
> execution, but we should still produce a warning should this occur.
>
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
> ---
> drivers/hid/wacom_sys.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 8214896adadad..7192970d199a0 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -2224,7 +2224,9 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
> } else if (strstr(product_name, "Wacom") ||
> strstr(product_name, "wacom") ||
> strstr(product_name, "WACOM")) {
> - strscpy(name, product_name, sizeof(name));
> + if (strscpy(name, product_name, sizeof(name)) < 0) {
> + hid_warn(wacom->hdev, "String overflow while assembling device name");
> + }
> } else {
> snprintf(name, sizeof(name), "Wacom %s", product_name);
> }
> @@ -2242,7 +2244,9 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
> if (name[strlen(name)-1] == ' ')
> name[strlen(name)-1] = '\0';
> } else {
> - strscpy(name, features->name, sizeof(name));
> + if (strscpy(name, features->name, sizeof(name)) < 0) {
> + hid_warn(wacom->hdev, "String overflow while assembling device name");
> + }
> }
>
> snprintf(wacom_wac->name, sizeof(wacom_wac->name), "%s%s",
> @@ -2500,8 +2504,10 @@ static void wacom_wireless_work(struct work_struct *work)
> goto fail;
> }
>
> - strscpy(wacom_wac->name, wacom_wac1->name,
> - sizeof(wacom_wac->name));
> + if (strscpy(wacom_wac->name, wacom_wac1->name,
> + sizeof(wacom_wac->name)) < 0) {
> + hid_warn(wacom->hdev, "String overflow while assembling device name");
> + }
> }
>
> return;
> --
> 2.40.0
>
Poking this thread again in case it got lost in the inbox...
Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....
^ permalink raw reply
* Re: [PATCH] Call input_set_timestamp for events injected using uinput
From: Siarhei Vishniakou @ 2023-04-28 18:38 UTC (permalink / raw)
To: Biswarup Pal; +Cc: Dmitry Torokhov, kernel-team, linux-input, linux-kernel
In-Reply-To: <20230427000152.1407471-1-biswarupp@google.com>
Thanks Biswarup!
Just to add a bit of context: we were concerned with breaking the
existing uinput usages where the caller might be setting an incorrect
value (since previously, that had no effect).
So the 10 second guard was added to fall back to the default behaviour
for those devices.
Reviewed-by: Siarhei Vishniakou <svv@google.com>
On Wed, Apr 26, 2023 at 5:03 PM Biswarup Pal <biswarupp@google.com> wrote:
>
> Currently, uinput doesn't use the input_set_timestamp API, so any
> event injected using uinput is not accurately timestamped in terms of
> measuring when the actual event happened. Hence, call the
> input_set_timestamp API from uinput in order to provide a more
> accurate sense of time for the event. Propagate only the timestamps
> which are a) positive, b) within a pre-defined offset (10 secs) from
> the current time, and c) not in the future.
>
> Signed-off-by: Biswarup Pal <biswarupp@google.com>
> ---
> drivers/input/misc/uinput.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
> index f2593133e524..d98212d55108 100644
> --- a/drivers/input/misc/uinput.c
> +++ b/drivers/input/misc/uinput.c
> @@ -33,6 +33,7 @@
> #define UINPUT_NAME "uinput"
> #define UINPUT_BUFFER_SIZE 16
> #define UINPUT_NUM_REQUESTS 16
> +#define UINPUT_TIMESTAMP_ALLOWED_OFFSET_SECS 10
>
> enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
>
> @@ -569,11 +570,40 @@ static int uinput_setup_device_legacy(struct uinput_device *udev,
> return retval;
> }
>
> +/*
> + * Returns true if the given timestamp is valid (i.e., if all the following
> + * conditions are satisfied), false otherwise.
> + * 1) given timestamp is positive
> + * 2) it's within the allowed offset before the current time
> + * 3) it's not in the future
> + */
> +static bool is_valid_timestamp(const ktime_t timestamp)
> +{
> + ktime_t zero_time;
> + ktime_t current_time;
> + ktime_t min_time;
> + ktime_t offset;
> +
> + zero_time = ktime_set(0, 0);
> + if (ktime_compare(zero_time, timestamp) >= 0)
> + return false;
> +
> + current_time = ktime_get();
> + offset = ktime_set(UINPUT_TIMESTAMP_ALLOWED_OFFSET_SECS, 0);
> + min_time = ktime_sub(current_time, offset);
> +
> + if (ktime_after(min_time, timestamp) || ktime_after(timestamp, current_time))
> + return false;
> +
> + return true;
> +}
> +
> static ssize_t uinput_inject_events(struct uinput_device *udev,
> const char __user *buffer, size_t count)
> {
> struct input_event ev;
> size_t bytes = 0;
> + ktime_t timestamp;
>
> if (count != 0 && count < input_event_size())
> return -EINVAL;
> @@ -588,6 +618,10 @@ static ssize_t uinput_inject_events(struct uinput_device *udev,
> if (input_event_from_user(buffer + bytes, &ev))
> return -EFAULT;
>
> + timestamp = ktime_set(ev.input_event_sec, ev.input_event_usec * NSEC_PER_USEC);
> + if (is_valid_timestamp(timestamp))
> + input_set_timestamp(udev->dev, timestamp);
> +
> input_event(udev->dev, ev.type, ev.code, ev.value);
> bytes += input_event_size();
> cond_resched();
> --
> 2.40.1.495.gc816e09b53d-goog
>
^ permalink raw reply
* Re: [PATCH] Call input_set_timestamp for events injected using uinput
From: Dmitry Torokhov @ 2023-04-28 19:52 UTC (permalink / raw)
To: Siarhei Vishniakou; +Cc: Biswarup Pal, kernel-team, linux-input, linux-kernel
In-Reply-To: <CAKF84v2Rw8xQv=m+ciL+n_uXhyAZWFmhYpgA63Q=DnVh5sbOsw@mail.gmail.com>
Hi,
On Fri, Apr 28, 2023 at 11:38:36AM -0700, Siarhei Vishniakou wrote:
> Thanks Biswarup!
Please avoid top posting.
>
> Just to add a bit of context: we were concerned with breaking the
> existing uinput usages where the caller might be setting an incorrect
> value (since previously, that had no effect).
> So the 10 second guard was added to fall back to the default behaviour
> for those devices.
What is the benefit of sending this in uinput? It is not much close
to the exact time the hardware generated the event than the timestamp
generated in the input core, so I do not see why it is needed in uinput.
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH] Call input_set_timestamp for events injected using uinput
From: Dmitry Torokhov @ 2023-04-28 19:54 UTC (permalink / raw)
To: Siarhei Vishniakou; +Cc: Biswarup Pal, kernel-team, linux-input, linux-kernel
In-Reply-To: <ZEwkC7BiUpq7kbjc@google.com>
On Fri, Apr 28, 2023 at 12:52:43PM -0700, Dmitry Torokhov wrote:
> Hi,
>
> On Fri, Apr 28, 2023 at 11:38:36AM -0700, Siarhei Vishniakou wrote:
> > Thanks Biswarup!
>
> Please avoid top posting.
>
> >
> > Just to add a bit of context: we were concerned with breaking the
> > existing uinput usages where the caller might be setting an incorrect
> > value (since previously, that had no effect).
> > So the 10 second guard was added to fall back to the default behaviour
> > for those devices.
>
> What is the benefit of sending this in uinput? It is not much close
> to the exact time the hardware generated the event than the timestamp
> generated in the input core, so I do not see why it is needed in uinput.
Ah, sorry, my apologies, I mis-parsed the code.
--
Dmitry
^ permalink raw reply
* Re: [PATCH] Input: xpad - Move Xbox 360 magic packet sending
From: Vicki Pfau @ 2023-04-28 23:15 UTC (permalink / raw)
To: Dan Carpenter, Dmitry Torokhov; +Cc: Dongliang Mu, linux-input
In-Reply-To: <facb01dd-e704-4900-8f4c-6d6972e75176@kili.mountain>
Hi Dmitry,
On 4/18/23 21:28, Dan Carpenter wrote:
> On Tue, Apr 18, 2023 at 07:24:14PM -0700, Vicki Pfau wrote:
>> This moves the sending of the magic packet introduced in db7220c48d8d from
>> xpad_probe to xpad_start_input to ensure that xpad->dev->dev exists in the
>> event that an error occurs. This should also fix issues with suspend that may
>> occur with some controllers.
>>
>> Fixes: db7220c48d8d ("Input: xpad - fix support for some third-party controllers")
>> Signed-off-by: Vicki Pfau <vi@endrift.com>
>
> Can you add the syzbot stuff as well and a Reported-by tag for
> Dongliang Mu as well.
>
> Reported-by: syzbot+a3f758b8d8cb7e49afec@syzkaller.appspotmail.com
> Reported-by: Dongliang Mu <dzm91@hust.edu.cn>
> Link: https://groups.google.com/g/syzkaller-bugs/c/iMhTgpGuIbM
Do I need to add these to the commit myself and resend, or, barring code revisions, can this be added when you cherry-pick into the tree?
>
> regards,
> dan carpenter
>
Vicki
^ permalink raw reply
* Quirks needed for Dell Inspiron 7415 2-in-1 touchscreen
From: Alexander E. Patrakov @ 2023-04-29 9:01 UTC (permalink / raw)
To: Benjamin Tissoires, linux-input
Hello,
A few days ago, I bought a new laptop, Dell Inspiron 7415 2-in-1. It
has a touchscreen that works out of the box - until you buy a stylus
recommended by Dell. The stylus is "Dell Active Pen PN350M", which
uses Microsoft Pen Protocol.
The problem is that, when I lift the pen off the screen, the touch
point remains active, but jumps into one of the corners. This
persists, and makes doing anything in the GUI impossible, until the
laptop is powered off.
I have looked into hid-multitouch.c, and found that there is a quirk
that might be relevant: MT_QUIRK_VALID_IS_INRANGE. Unfortunately, it
does not really help, see below.
The default quirks for this touchscreen are 0x51c10, which means
MT_QUIRK_ALWAYS_VALID | MT_QUIRK_IGNORE_DUPLICATES | MT_QUIRK_HOVERING
| MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_STICKY_FINGERS |
MT_QUIRK_WIN8_PTP_BUTTONS. So I guessed I should remove
MT_QUIRK_ALWAYS_VALID and add MT_QUIRK_VALID_IS_INRANGE, which results
in 0x51c20.
So:
echo 0x51c20 > /sys/devices/platform/AMDI0010:00/i2c-0/i2c-04F31234:00/0018:04F3:2C68.0004/quirks
Result: the touchscreen now tracks the stylus correctly, but does not
react to fingers anymore.
I am willing to try kernel patches, but have too much other work to
try writing myself a new quirk that applies the "in range means valid"
logic for stylus only.
If you need any other debug info, please tell me.
The /proc/bus/input/devices file contains:
============================
I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
U: Uniq=
H: Handlers=kbd event0
B: PROP=0
B: EV=3
B: KEY=10000000000000 0
I: Bus=0019 Vendor=0000 Product=0005 Version=0000
N: Name="Lid Switch"
P: Phys=PNP0C0D/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input1
U: Uniq=
H: Handlers=event1
B: PROP=0
B: EV=21
B: SW=1
I: Bus=0019 Vendor=0000 Product=0003 Version=0000
N: Name="Sleep Button"
P: Phys=PNP0C0E/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0E:00/input/input2
U: Uniq=
H: Handlers=kbd event2
B: PROP=0
B: EV=3
B: KEY=4000 0 0
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input3
U: Uniq=
H: Handlers=sysrq kbd leds event3
B: PROP=0
B: EV=120013
B: KEY=1100f02902000 8380307cf910f001 feffffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7
I: Bus=0019 Vendor=0000 Product=0006 Version=0000
N: Name="Video Bus"
P: Phys=LNXVIDEO/video/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:10/LNXVIDEO:00/input/input5
U: Uniq=
H: Handlers=kbd event4
B: PROP=0
B: EV=3
B: KEY=3e000b00000000 0 0 0
I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="DELL Wireless hotkeys"
P: Phys=dellabce/input0
S: Sysfs=/devices/virtual/input/input6
U: Uniq=
H: Handlers=kbd event5 rfkill
B: PROP=0
B: EV=3
B: KEY=80000000000000 0 0 0
I: Bus=0010 Vendor=001f Product=0001 Version=0100
N: Name="PC Speaker"
P: Phys=isa0061/input0
S: Sysfs=/devices/platform/pcspkr/input/input7
U: Uniq=
H: Handlers=kbd event6
B: PROP=0
B: EV=40001
B: SND=6
I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Dell WMI hotkeys"
P: Phys=
S: Sysfs=/devices/platform/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/9DBB5994-A997-11DA-B012-B622A1EF5492/input/input18
U: Uniq=
H: Handlers=kbd event7 rfkill
B: PROP=0
B: EV=13
B: KEY=800000000000 0 0 101500b00000c00 1200300000 e000000000000 0
B: MSC=10
I: Bus=0003 Vendor=0c45 Product=6a10 Version=0271
N: Name="Integrated_Webcam_HD: Integrate"
P: Phys=usb-0000:03:00.4-1/button
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:03:00.4/usb3/3-1/3-1:1.0/input/input19
U: Uniq=
H: Handlers=kbd event8
B: PROP=0
B: EV=3
B: KEY=100000 0 0 0
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HD-Audio Generic HDMI/DP,pcm=3"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:03:00.1/sound/card0/input20
U: Uniq=
H: Handlers=event9
B: PROP=0
B: EV=21
B: SW=140
I: Bus=0018 Vendor=06cb Product=ce26 Version=0100
N: Name="DELL0A8C:00 06CB:CE26 Mouse"
P: Phys=i2c-DELL0A8C:00
S: Sysfs=/devices/platform/AMDI0010:03/i2c-1/i2c-DELL0A8C:00/0018:06CB:CE26.0005/input/input22
U: Uniq=
H: Handlers=event11 mouse0
B: PROP=0
B: EV=17
B: KEY=30000 0 0 0 0
B: REL=3
B: MSC=10
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HD-Audio Generic HDMI/DP,pcm=7"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:03:00.1/sound/card0/input21
U: Uniq=
H: Handlers=event10
B: PROP=0
B: EV=21
B: SW=140
I: Bus=0018 Vendor=06cb Product=ce26 Version=0100
N: Name="DELL0A8C:00 06CB:CE26 Touchpad"
P: Phys=i2c-DELL0A8C:00
S: Sysfs=/devices/platform/AMDI0010:03/i2c-1/i2c-DELL0A8C:00/0018:06CB:CE26.0005/input/input23
U: Uniq=
H: Handlers=event12 mouse1
B: PROP=5
B: EV=1b
B: KEY=e520 10000 0 0 0 0
B: ABS=2e0800000000003
B: MSC=20
I: Bus=0018 Vendor=04f3 Product=2c68 Version=0100
N: Name="04F31234:00 04F3:2C68"
P: Phys=i2c-04F31234:00
S: Sysfs=/devices/platform/AMDI0010:00/i2c-0/i2c-04F31234:00/0018:04F3:2C68.0004/input/input25
U: Uniq=
H: Handlers=event13 mouse2
B: PROP=2
B: EV=1b
B: KEY=400 0 0 0 0 0
B: ABS=3273800000000003
B: MSC=20
I: Bus=0018 Vendor=04f3 Product=2c68 Version=0100
N: Name="04F31234:00 04F3:2C68 UNKNOWN"
P: Phys=i2c-04F31234:00
S: Sysfs=/devices/platform/AMDI0010:00/i2c-0/i2c-04F31234:00/0018:04F3:2C68.0004/input/input26
U: Uniq=
H: Handlers=event14
B: PROP=0
B: EV=9
B: ABS=10000000000
I: Bus=0018 Vendor=04f3 Product=2c68 Version=0100
N: Name="04F31234:00 04F3:2C68 UNKNOWN"
P: Phys=i2c-04F31234:00
S: Sysfs=/devices/platform/AMDI0010:00/i2c-0/i2c-04F31234:00/0018:04F3:2C68.0004/input/input27
U: Uniq=
H: Handlers=event15
B: PROP=0
B: EV=100001
I: Bus=0018 Vendor=04f3 Product=2c68 Version=0100
N: Name="04F31234:00 04F3:2C68 Stylus"
P: Phys=i2c-04F31234:00
S: Sysfs=/devices/platform/AMDI0010:00/i2c-0/i2c-04F31234:00/0018:04F3:2C68.0004/input/input28
U: Uniq=
H: Handlers=event16 mouse3
B: PROP=2
B: EV=1b
B: KEY=c03 0 0 0 0 0
B: ABS=1000d000003
B: MSC=10
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HD-Audio Generic Headphone Mic"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:03:00.6/sound/card1/input31
U: Uniq=
H: Handlers=event17
B: PROP=0
B: EV=21
B: SW=4
============================
Here is some udevadm info, just in case, too:
============================
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device
'/devices/platform/AMDI0010:00/i2c-0/i2c-04F31234:00/0018:04F3:2C68.0004/input/input28':
KERNEL=="input28"
SUBSYSTEM=="input"
DRIVER==""
ATTR{capabilities/abs}=="1000d000003"
ATTR{capabilities/ev}=="1b"
ATTR{capabilities/ff}=="0"
ATTR{capabilities/key}=="c03 0 0 0 0 0"
ATTR{capabilities/led}=="0"
ATTR{capabilities/msc}=="10"
ATTR{capabilities/rel}=="0"
ATTR{capabilities/snd}=="0"
ATTR{capabilities/sw}=="0"
ATTR{id/bustype}=="0018"
ATTR{id/product}=="2c68"
ATTR{id/vendor}=="04f3"
ATTR{id/version}=="0100"
ATTR{inhibited}=="0"
ATTR{name}=="04F31234:00 04F3:2C68 Stylus"
ATTR{phys}=="i2c-04F31234:00"
ATTR{power/control}=="auto"
ATTR{power/runtime_active_time}=="0"
ATTR{power/runtime_status}=="unsupported"
ATTR{power/runtime_suspended_time}=="0"
ATTR{properties}=="2"
ATTR{uniq}==""
looking at parent device
'/devices/platform/AMDI0010:00/i2c-0/i2c-04F31234:00/0018:04F3:2C68.0004':
KERNELS=="0018:04F3:2C68.0004"
SUBSYSTEMS=="hid"
DRIVERS=="hid-multitouch"
ATTRS{country}=="00"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{quirks}=="334880"
looking at parent device
'/devices/platform/AMDI0010:00/i2c-0/i2c-04F31234:00':
KERNELS=="i2c-04F31234:00"
SUBSYSTEMS=="i2c"
DRIVERS=="i2c_hid_acpi"
ATTRS{name}=="04F31234:00"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
looking at parent device '/devices/platform/AMDI0010:00/i2c-0':
KERNELS=="i2c-0"
SUBSYSTEMS=="i2c"
DRIVERS==""
ATTRS{delete_device}=="(not readable)"
ATTRS{name}=="Synopsys DesignWare I2C adapter"
ATTRS{new_device}=="(not readable)"
ATTRS{waiting_for_supplier}=="0"
looking at parent device '/devices/platform/AMDI0010:00':
KERNELS=="AMDI0010:00"
SUBSYSTEMS=="platform"
DRIVERS=="i2c_designware"
ATTRS{driver_override}=="(null)"
ATTRS{power/autosuspend_delay_ms}=="1000"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_time}=="1809937"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="74571"
looking at parent device '/devices/platform':
KERNELS=="platform"
SUBSYSTEMS==""
DRIVERS==""
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
============================
--
Alexander E. Patrakov
^ permalink raw reply
* Re: [syzbot] [usb?] general protection fault in xpad_probe
From: syzbot @ 2023-04-29 13:47 UTC (permalink / raw)
To: chaorace, dan.carpenter, dmitry.torokhov, dzm91, error27, gregkh,
hust-os-kernel-patches, kernel-janitors, linux-input,
linux-kernel, linux-usb, matthias.benkmann, mkorpershoek,
mudongliangabcd, nate, pgriffais, radon86dev, rafael, rojtberg,
s.demassari, syzkaller-bugs, vi
In-Reply-To: <00000000000083d76d05f909f716@google.com>
syzbot has found a reproducer for the following issue on:
HEAD commit: 92e815cf07ed Add linux-next specific files for 20230428
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=104cb844280000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8c8ae4d47d23592
dashboard link: https://syzkaller.appspot.com/bug?extid=a3f758b8d8cb7e49afec
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14a5408c280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10d3b0e4280000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c9e94856e6c9/disk-92e815cf.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4c1c05a548a7/vmlinux-92e815cf.xz
kernel image: https://storage.googleapis.com/syzbot-assets/2a1bff6a133b/bzImage-92e815cf.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+a3f758b8d8cb7e49afec@syzkaller.appspotmail.com
usb 1-1: config 0 has no interface number 0
usb 1-1: New USB device found, idVendor=1949, idProduct=5e70, bcdDevice=d7.a2
usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
usb 1-1: config 0 descriptor??
usb 1-1: string descriptor 0 read error: -71
general protection fault, probably for non-canonical address 0xdffffc0000000068: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000340-0x0000000000000347]
CPU: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.3.0-next-20230428-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Workqueue: usb_hub_wq hub_event
RIP: 0010:dev_name include/linux/device.h:706 [inline]
RIP: 0010:__dev_printk+0x3b/0x270 drivers/base/core.c:4863
Code: f5 53 e8 c8 c3 6b fc 48 85 ed 0f 84 cb 01 00 00 e8 ba c3 6b fc 48 8d 7d 50 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 d7 01 00 00 48 8b 5d 50 48 85 db 0f 84 b5 00 00
RSP: 0018:ffffc900000e6f70 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: fffff5200001cdf5 RCX: 0000000000000000
RDX: 0000000000000068 RSI: ffffffff85188a06 RDI: 0000000000000340
RBP: 00000000000002f0 R08: 0000000000000005 R09: 0000000000000000
R10: 00000000ffffffb9 R11: ffffffff81d6ff05 R12: ffffffff8ace98e0
R13: ffffc900000e6fc8 R14: ffff88801ed25a64 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1361dc1111 CR3: 00000000210fe000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
_dev_warn+0xdc/0x120 drivers/base/core.c:4907
xpad_probe+0x197e/0x2020 drivers/input/joystick/xpad.c:2053
usb_probe_interface+0x30f/0x960 drivers/usb/core/driver.c:396
call_driver_probe drivers/base/dd.c:579 [inline]
really_probe+0x240/0xca0 drivers/base/dd.c:658
__driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800
driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830
__device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958
bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457
__device_attach+0x1e4/0x4b0 drivers/base/dd.c:1030
bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532
device_add+0x112d/0x1a40 drivers/base/core.c:3625
usb_set_configuration+0x1196/0x1bc0 drivers/usb/core/message.c:2211
usb_generic_driver_probe+0xcf/0x130 drivers/usb/core/generic.c:238
usb_probe_device+0xd8/0x2c0 drivers/usb/core/driver.c:293
call_driver_probe drivers/base/dd.c:579 [inline]
really_probe+0x240/0xca0 drivers/base/dd.c:658
__driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800
driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830
__device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958
bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457
__device_attach+0x1e4/0x4b0 drivers/base/dd.c:1030
bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532
device_add+0x112d/0x1a40 drivers/base/core.c:3625
usb_new_device+0xcb2/0x19d0 drivers/usb/core/hub.c:2575
hub_port_connect drivers/usb/core/hub.c:5407 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5551 [inline]
port_event drivers/usb/core/hub.c:5711 [inline]
hub_event+0x2d9e/0x4e40 drivers/usb/core/hub.c:5793
process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405
worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552
kthread+0x344/0x440 kernel/kthread.c:379
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dev_name include/linux/device.h:706 [inline]
RIP: 0010:__dev_printk+0x3b/0x270 drivers/base/core.c:4863
Code: f5 53 e8 c8 c3 6b fc 48 85 ed 0f 84 cb 01 00 00 e8 ba c3 6b fc 48 8d 7d 50 48 b8 00 00 00 00 00 fc ff df 48 89
----------------
Code disassembly (best guess):
0: f5 cmc
1: 53 push %rbx
2: e8 c8 c3 6b fc callq 0xfc6bc3cf
7: 48 85 ed test %rbp,%rbp
a: 0f 84 cb 01 00 00 je 0x1db
10: e8 ba c3 6b fc callq 0xfc6bc3cf
15: 48 8d 7d 50 lea 0x50(%rbp),%rdi
19: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
20: fc ff df
23: 48 89 fa mov %rdi,%rdx
26: 48 c1 ea 03 shr $0x3,%rdx
* 2a: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2e: 0f 85 d7 01 00 00 jne 0x20b
34: 48 8b 5d 50 mov 0x50(%rbp),%rbx
38: 48 85 db test %rbx,%rbx
3b: 0f .byte 0xf
3c: 84 .byte 0x84
3d: b5 00 mov $0x0,%ch
---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
^ permalink raw reply
* Re: [syzbot] [usb?] general protection fault in xpad_probe
From: Alan Stern @ 2023-04-29 18:09 UTC (permalink / raw)
To: syzbot, dmitry.torokhov
Cc: chaorace, dan.carpenter, dzm91, error27, gregkh,
hust-os-kernel-patches, kernel-janitors, linux-input,
linux-kernel, linux-usb, matthias.benkmann, mkorpershoek,
mudongliangabcd, nate, pgriffais, radon86dev, rafael, rojtberg,
s.demassari, syzkaller-bugs, vi
In-Reply-To: <0000000000007c3e1f05fa79d594@google.com>
Dmitry:
On Sat, Apr 29, 2023 at 06:47:43AM -0700, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 92e815cf07ed Add linux-next specific files for 20230428
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=104cb844280000
> kernel config: https://syzkaller.appspot.com/x/.config?x=c8c8ae4d47d23592
> dashboard link: https://syzkaller.appspot.com/bug?extid=a3f758b8d8cb7e49afec
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14a5408c280000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10d3b0e4280000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/c9e94856e6c9/disk-92e815cf.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/4c1c05a548a7/vmlinux-92e815cf.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/2a1bff6a133b/bzImage-92e815cf.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+a3f758b8d8cb7e49afec@syzkaller.appspotmail.com
>
> usb 1-1: config 0 has no interface number 0
> usb 1-1: New USB device found, idVendor=1949, idProduct=5e70, bcdDevice=d7.a2
> usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> usb 1-1: config 0 descriptor??
> usb 1-1: string descriptor 0 read error: -71
> general protection fault, probably for non-canonical address 0xdffffc0000000068: 0000 [#1] PREEMPT SMP KASAN
> KASAN: null-ptr-deref in range [0x0000000000000340-0x0000000000000347]
> CPU: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.3.0-next-20230428-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
> Workqueue: usb_hub_wq hub_event
> RIP: 0010:dev_name include/linux/device.h:706 [inline]
> RIP: 0010:__dev_printk+0x3b/0x270 drivers/base/core.c:4863
> Code: f5 53 e8 c8 c3 6b fc 48 85 ed 0f 84 cb 01 00 00 e8 ba c3 6b fc 48 8d 7d 50 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 d7 01 00 00 48 8b 5d 50 48 85 db 0f 84 b5 00 00
> RSP: 0018:ffffc900000e6f70 EFLAGS: 00010202
> RAX: dffffc0000000000 RBX: fffff5200001cdf5 RCX: 0000000000000000
> RDX: 0000000000000068 RSI: ffffffff85188a06 RDI: 0000000000000340
> RBP: 00000000000002f0 R08: 0000000000000005 R09: 0000000000000000
> R10: 00000000ffffffb9 R11: ffffffff81d6ff05 R12: ffffffff8ace98e0
> R13: ffffc900000e6fc8 R14: ffff88801ed25a64 R15: 0000000000000000
> FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f1361dc1111 CR3: 00000000210fe000 CR4: 00000000003506f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> <TASK>
> _dev_warn+0xdc/0x120 drivers/base/core.c:4907
> xpad_probe+0x197e/0x2020 drivers/input/joystick/xpad.c:2053
> usb_probe_interface+0x30f/0x960 drivers/usb/core/driver.c:396
It looks like the problem is caused by commit db7220c48d8d ("Input:
xpad - fix support for some third-party controllers"). In the line
dev_warn(&xpad->dev->dev,
the xpad->dev ought to be xpad->udev.
Alan Stern
^ permalink raw reply
* [PATCH] Input: synaptics-rmi4: Use %pe for error codes.
From: Michał Mirosław @ 2023-04-29 18:41 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
Make the error messages a bit easier to understand by showing
error names where that's enabled.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/input/rmi4/rmi_driver.c | 66 +++++++++++++++++----------------
1 file changed, 34 insertions(+), 32 deletions(-)
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 258d5fe3d395..82d85c02a873 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -69,8 +69,8 @@ static int reset_one_function(struct rmi_function *fn)
if (fh->reset) {
retval = fh->reset(fn);
if (retval < 0)
- dev_err(&fn->dev, "Reset failed with code %d.\n",
- retval);
+ dev_err(&fn->dev, "Reset failed: %pe\n",
+ ERR_PTR(retval));
}
return retval;
@@ -88,8 +88,8 @@ static int configure_one_function(struct rmi_function *fn)
if (fh->config) {
retval = fh->config(fn);
if (retval < 0)
- dev_err(&fn->dev, "Config failed with code %d.\n",
- retval);
+ dev_err(&fn->dev, "Config failed: %pe\n",
+ ERR_PTR(retval));
}
return retval;
@@ -140,7 +140,7 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev)
data->f01_container->fd.data_base_addr + 1,
data->irq_status, data->num_of_irq_regs);
if (error < 0) {
- dev_err(dev, "Failed to read irqs, code=%d\n", error);
+ dev_err(dev, "Failed to read irqs: %pe\n", ERR_PTR(error));
return error;
}
}
@@ -201,7 +201,7 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
ret = rmi_process_interrupt_requests(rmi_dev);
if (ret)
rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
- "Failed to process interrupt request: %d\n", ret);
+ "Failed to process interrupt request: %pe\n", ERR_PTR(ret));
if (count) {
kfree(attn_data.data);
@@ -229,8 +229,8 @@ static int rmi_irq_init(struct rmi_device *rmi_dev)
dev_driver_string(rmi_dev->xport->dev),
rmi_dev);
if (ret < 0) {
- dev_err(&rmi_dev->dev, "Failed to register interrupt %d\n",
- pdata->irq);
+ dev_err(&rmi_dev->dev, "Failed to register interrupt %d: %pe\n",
+ pdata->irq, ERR_PTR(ret));
return ret;
}
@@ -265,8 +265,8 @@ static int suspend_one_function(struct rmi_function *fn)
if (fh->suspend) {
retval = fh->suspend(fn);
if (retval < 0)
- dev_err(&fn->dev, "Suspend failed with code %d.\n",
- retval);
+ dev_err(&fn->dev, "Suspend failed: %pe\n",
+ ERR_PTR(retval));
}
return retval;
@@ -299,8 +299,8 @@ static int resume_one_function(struct rmi_function *fn)
if (fh->resume) {
retval = fh->resume(fn);
if (retval < 0)
- dev_err(&fn->dev, "Resume failed with code %d.\n",
- retval);
+ dev_err(&fn->dev, "Resume failed: %pe\n",
+ ERR_PTR(retval));
}
return retval;
@@ -464,8 +464,8 @@ static int rmi_read_pdt_entry(struct rmi_device *rmi_dev,
error = rmi_read_block(rmi_dev, pdt_address, buf, RMI_PDT_ENTRY_SIZE);
if (error) {
- dev_err(&rmi_dev->dev, "Read PDT entry at %#06x failed, code: %d.\n",
- pdt_address, error);
+ dev_err(&rmi_dev->dev, "Read PDT entry at %#06x failed: %pe\n",
+ pdt_address, ERR_PTR(error));
return error;
}
@@ -752,7 +752,8 @@ static int rmi_check_bootloader_mode(struct rmi_device *rmi_dev,
ret = rmi_read(rmi_dev, pdt->data_base_addr, &status);
if (ret) {
dev_err(&rmi_dev->dev,
- "Failed to read F34 status: %d.\n", ret);
+ "Failed to read F34 status: %pe\n",
+ ERR_PTR(ret));
return ret;
}
@@ -762,7 +763,8 @@ static int rmi_check_bootloader_mode(struct rmi_device *rmi_dev,
ret = rmi_read(rmi_dev, pdt->data_base_addr, &status);
if (ret) {
dev_err(&rmi_dev->dev,
- "Failed to read F01 status: %d.\n", ret);
+ "Failed to read F01 status: %pe\n",
+ ERR_PTR(ret));
return ret;
}
@@ -812,7 +814,7 @@ int rmi_initial_reset(struct rmi_device *rmi_dev, void *ctx,
error = rmi_write_block(rmi_dev, cmd_addr, &cmd_buf, 1);
if (error) {
dev_err(&rmi_dev->dev,
- "Initial reset failed. Code = %d.\n", error);
+ "Initial reset failed: %pe\n", ERR_PTR(error));
return error;
}
@@ -892,8 +894,8 @@ void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake)
retval = disable_irq_wake(irq);
if (retval)
dev_warn(&rmi_dev->dev,
- "Failed to disable irq for wake: %d\n",
- retval);
+ "Failed to disable irq for wake: %pe\n",
+ ERR_PTR(retval));
}
/*
@@ -927,8 +929,8 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake)
retval = enable_irq_wake(irq);
if (retval)
dev_warn(&rmi_dev->dev,
- "Failed to enable irq for wake: %d\n",
- retval);
+ "Failed to enable irq for wake: %pe\n",
+ ERR_PTR(retval));
}
/* make sure the fifo is clean */
@@ -948,8 +950,8 @@ int rmi_driver_suspend(struct rmi_device *rmi_dev, bool enable_wake)
retval = rmi_suspend_functions(rmi_dev);
if (retval)
- dev_warn(&rmi_dev->dev, "Failed to suspend functions: %d\n",
- retval);
+ dev_warn(&rmi_dev->dev, "Failed to suspend functions: %pe\n",
+ ERR_PTR(retval));
rmi_disable_irq(rmi_dev, enable_wake);
return retval;
@@ -964,8 +966,8 @@ int rmi_driver_resume(struct rmi_device *rmi_dev, bool clear_wake)
retval = rmi_resume_functions(rmi_dev);
if (retval)
- dev_warn(&rmi_dev->dev, "Failed to suspend functions: %d\n",
- retval);
+ dev_warn(&rmi_dev->dev, "Failed to resume functions: %pe\n",
+ ERR_PTR(retval));
return retval;
}
@@ -1028,7 +1030,7 @@ int rmi_probe_interrupts(struct rmi_driver_data *data)
retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_count_irqs);
if (retval < 0) {
- dev_err(dev, "IRQ counting failed with code %d.\n", retval);
+ dev_err(dev, "IRQ counting failed: %pe\n", ERR_PTR(retval));
return retval;
}
@@ -1072,8 +1074,8 @@ int rmi_init_functions(struct rmi_driver_data *data)
rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Creating functions.\n", __func__);
retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_create_function);
if (retval < 0) {
- dev_err(dev, "Function creation failed with code %d.\n",
- retval);
+ dev_err(dev, "Function creation failed: %pe\n",
+ ERR_PTR(retval));
goto err_destroy_functions;
}
@@ -1166,8 +1168,8 @@ static int rmi_driver_probe(struct device *dev)
* we'll print out a warning and continue since
* failure to get the PDT properties is not a cause to fail
*/
- dev_warn(dev, "Could not read PDT properties from %#06x (code %d). Assuming 0x00.\n",
- PDT_PROPERTIES_LOCATION, retval);
+ dev_warn(dev, "Could not read PDT properties from %#06x (%pe). Assuming 0x00.\n",
+ PDT_PROPERTIES_LOCATION, ERR_PTR(retval));
}
mutex_init(&data->irq_mutex);
@@ -1265,8 +1267,8 @@ int __init rmi_register_physical_driver(void)
error = driver_register(&rmi_physical_driver.driver);
if (error) {
- pr_err("%s: driver register failed, code=%d.\n", __func__,
- error);
+ pr_err("%s: driver register failed: %pe\n", __func__,
+ ERR_PTR(error));
return error;
}
--
2.30.2
^ permalink raw reply related
* [PATCH] i8042: add missing include
From: Michał Mirosław @ 2023-04-29 19:06 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
<linux/i8042.h> include uses ENODEV when included with
!IS_ENABLED(CONFIG_SERIO_I8042) and so need to include it.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
include/linux/i8042.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 0261e2fb3636..95b07f8b77fe 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -3,6 +3,7 @@
#define _LINUX_I8042_H
+#include <linux/errno.h>
#include <linux/types.h>
/*
--
2.30.2
^ permalink raw reply related
* Re: [PATCH 1/4] dt-bindings: input: pwm-vibrator: Add enable-gpio
From: Sebastian Reichel @ 2023-04-29 19:44 UTC (permalink / raw)
To: Luca Weiss
Cc: ~postmarketos/upstreaming, phone-devel, Dmitry Torokhov,
Rob Herring, Krzysztof Kozlowski, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Brian Masney, linux-input, devicetree,
linux-kernel, linux-arm-msm
In-Reply-To: <20230427-hammerhead-vibra-v1-1-e87eeb94da51@z3ntu.xyz>
[-- Attachment #1: Type: text/plain, Size: 872 bytes --]
Hi,
On Thu, Apr 27, 2023 at 10:34:26PM +0200, Luca Weiss wrote:
> Some pwm vibrators have a dedicated enable GPIO that needs to be set
> high so that the vibrator works. Document that.
Reviewed-by: Sebastian Reichel <sre@kernel.org>
-- Sebastian
> Documentation/devicetree/bindings/input/pwm-vibrator.yaml | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/input/pwm-vibrator.yaml b/Documentation/devicetree/bindings/input/pwm-vibrator.yaml
> index d32716c604fe..6398534b43c3 100644
> --- a/Documentation/devicetree/bindings/input/pwm-vibrator.yaml
> +++ b/Documentation/devicetree/bindings/input/pwm-vibrator.yaml
> @@ -32,6 +32,8 @@ properties:
> minItems: 1
> maxItems: 2
>
> + enable-gpios: true
> +
> vcc-supply: true
>
> direction-duty-cycle-ns:
>
> --
> 2.40.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH 2/4] Input: pwm-vibra - add newline to dev_err prints
From: Sebastian Reichel @ 2023-04-29 19:45 UTC (permalink / raw)
To: Luca Weiss
Cc: ~postmarketos/upstreaming, phone-devel, Dmitry Torokhov,
Rob Herring, Krzysztof Kozlowski, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Brian Masney, linux-input, devicetree,
linux-kernel, linux-arm-msm
In-Reply-To: <20230427-hammerhead-vibra-v1-2-e87eeb94da51@z3ntu.xyz>
[-- Attachment #1: Type: text/plain, Size: 3896 bytes --]
Hi,
On Thu, Apr 27, 2023 at 10:34:27PM +0200, Luca Weiss wrote:
> Make sure all printed messages end with a newline.
>
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
Reviewed-by: Sebastian Reichel <sre@kernel.org>
-- Sebastian
> drivers/input/misc/pwm-vibra.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c
> index d0e58a7cdfa3..c08971c97ad6 100644
> --- a/drivers/input/misc/pwm-vibra.c
> +++ b/drivers/input/misc/pwm-vibra.c
> @@ -42,7 +42,7 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator)
> if (!vibrator->vcc_on) {
> err = regulator_enable(vibrator->vcc);
> if (err) {
> - dev_err(pdev, "failed to enable regulator: %d", err);
> + dev_err(pdev, "failed to enable regulator: %d\n", err);
> return err;
> }
> vibrator->vcc_on = true;
> @@ -54,7 +54,7 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator)
>
> err = pwm_apply_state(vibrator->pwm, &state);
> if (err) {
> - dev_err(pdev, "failed to apply pwm state: %d", err);
> + dev_err(pdev, "failed to apply pwm state: %d\n", err);
> return err;
> }
>
> @@ -65,7 +65,7 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator)
>
> err = pwm_apply_state(vibrator->pwm_dir, &state);
> if (err) {
> - dev_err(pdev, "failed to apply dir-pwm state: %d", err);
> + dev_err(pdev, "failed to apply dir-pwm state: %d\n", err);
> pwm_disable(vibrator->pwm);
> return err;
> }
> @@ -137,7 +137,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
> err = PTR_ERR_OR_ZERO(vibrator->vcc);
> if (err) {
> if (err != -EPROBE_DEFER)
> - dev_err(&pdev->dev, "Failed to request regulator: %d",
> + dev_err(&pdev->dev, "Failed to request regulator: %d\n",
> err);
> return err;
> }
> @@ -146,7 +146,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
> err = PTR_ERR_OR_ZERO(vibrator->pwm);
> if (err) {
> if (err != -EPROBE_DEFER)
> - dev_err(&pdev->dev, "Failed to request main pwm: %d",
> + dev_err(&pdev->dev, "Failed to request main pwm: %d\n",
> err);
> return err;
> }
> @@ -158,7 +158,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
> state.enabled = false;
> err = pwm_apply_state(vibrator->pwm, &state);
> if (err) {
> - dev_err(&pdev->dev, "failed to apply initial PWM state: %d",
> + dev_err(&pdev->dev, "failed to apply initial PWM state: %d\n",
> err);
> return err;
> }
> @@ -172,7 +172,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
> state.enabled = false;
> err = pwm_apply_state(vibrator->pwm_dir, &state);
> if (err) {
> - dev_err(&pdev->dev, "failed to apply initial PWM state: %d",
> + dev_err(&pdev->dev, "failed to apply initial PWM state: %d\n",
> err);
> return err;
> }
> @@ -189,7 +189,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
> break;
>
> default:
> - dev_err(&pdev->dev, "Failed to request direction pwm: %d", err);
> + dev_err(&pdev->dev, "Failed to request direction pwm: %d\n", err);
> fallthrough;
>
> case -EPROBE_DEFER:
> @@ -207,13 +207,13 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
> err = input_ff_create_memless(vibrator->input, NULL,
> pwm_vibrator_play_effect);
> if (err) {
> - dev_err(&pdev->dev, "Couldn't create FF dev: %d", err);
> + dev_err(&pdev->dev, "Couldn't create FF dev: %d\n", err);
> return err;
> }
>
> err = input_register_device(vibrator->input);
> if (err) {
> - dev_err(&pdev->dev, "Couldn't register input dev: %d", err);
> + dev_err(&pdev->dev, "Couldn't register input dev: %d\n", err);
> return err;
> }
>
>
> --
> 2.40.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH 3/4] Input: pwm-vibra - add support for enable GPIO
From: Sebastian Reichel @ 2023-04-29 19:47 UTC (permalink / raw)
To: Luca Weiss
Cc: ~postmarketos/upstreaming, phone-devel, Dmitry Torokhov,
Rob Herring, Krzysztof Kozlowski, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Brian Masney, linux-input, devicetree,
linux-kernel, linux-arm-msm
In-Reply-To: <20230427-hammerhead-vibra-v1-3-e87eeb94da51@z3ntu.xyz>
[-- Attachment #1: Type: text/plain, Size: 2280 bytes --]
Hi,
On Thu, Apr 27, 2023 at 10:34:28PM +0200, Luca Weiss wrote:
> Some pwm vibrators have a dedicated enable GPIO that needs to be set
> high so that the vibrator works. Add support for that optionally.
>
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
Reviewed-by: Sebastian Reichel <sre@kernel.org>
-- Sebastian
> drivers/input/misc/pwm-vibra.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c
> index c08971c97ad6..2ba035299db8 100644
> --- a/drivers/input/misc/pwm-vibra.c
> +++ b/drivers/input/misc/pwm-vibra.c
> @@ -11,6 +11,7 @@
> * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
> */
>
> +#include <linux/gpio/consumer.h>
> #include <linux/input.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> @@ -23,6 +24,7 @@
>
> struct pwm_vibrator {
> struct input_dev *input;
> + struct gpio_desc *enable_gpio;
> struct pwm_device *pwm;
> struct pwm_device *pwm_dir;
> struct regulator *vcc;
> @@ -48,6 +50,8 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator)
> vibrator->vcc_on = true;
> }
>
> + gpiod_set_value_cansleep(vibrator->enable_gpio, 1);
> +
> pwm_get_state(vibrator->pwm, &state);
> pwm_set_relative_duty_cycle(&state, vibrator->level, 0xffff);
> state.enabled = true;
> @@ -80,6 +84,8 @@ static void pwm_vibrator_stop(struct pwm_vibrator *vibrator)
> pwm_disable(vibrator->pwm_dir);
> pwm_disable(vibrator->pwm);
>
> + gpiod_set_value_cansleep(vibrator->enable_gpio, 0);
> +
> if (vibrator->vcc_on) {
> regulator_disable(vibrator->vcc);
> vibrator->vcc_on = false;
> @@ -142,6 +148,16 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
> return err;
> }
>
> + vibrator->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
> + GPIOD_OUT_LOW);
> + err = PTR_ERR_OR_ZERO(vibrator->enable_gpio);
> + if (err) {
> + if (err != -EPROBE_DEFER)
> + dev_err(&pdev->dev, "Failed to request enable gpio: %d\n",
> + err);
> + return err;
> + }
> +
> vibrator->pwm = devm_pwm_get(&pdev->dev, "enable");
> err = PTR_ERR_OR_ZERO(vibrator->pwm);
> if (err) {
>
> --
> 2.40.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [syzbot] [usb?] general protection fault in xpad_probe
From: Dongliang Mu @ 2023-04-29 23:49 UTC (permalink / raw)
To: Alan Stern, syzbot, dmitry.torokhov
Cc: chaorace, dan.carpenter, error27, gregkh, hust-os-kernel-patches,
kernel-janitors, linux-input, linux-kernel, linux-usb,
matthias.benkmann, mkorpershoek, mudongliangabcd, nate, pgriffais,
radon86dev, rafael, rojtberg, s.demassari, syzkaller-bugs, vi
In-Reply-To: <606e7f3a-8ad5-43b3-b3c9-e75aa0180e8a@rowland.harvard.edu>
On 2023/4/30 02:09, Alan Stern wrote:
> Dmitry:
>
> On Sat, Apr 29, 2023 at 06:47:43AM -0700, syzbot wrote:
>> syzbot has found a reproducer for the following issue on:
>>
>> HEAD commit: 92e815cf07ed Add linux-next specific files for 20230428
>> git tree: linux-next
>> console output: https://syzkaller.appspot.com/x/log.txt?x=104cb844280000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=c8c8ae4d47d23592
>> dashboard link: https://syzkaller.appspot.com/bug?extid=a3f758b8d8cb7e49afec
>> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
>> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14a5408c280000
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10d3b0e4280000
>>
>> Downloadable assets:
>> disk image: https://storage.googleapis.com/syzbot-assets/c9e94856e6c9/disk-92e815cf.raw.xz
>> vmlinux: https://storage.googleapis.com/syzbot-assets/4c1c05a548a7/vmlinux-92e815cf.xz
>> kernel image: https://storage.googleapis.com/syzbot-assets/2a1bff6a133b/bzImage-92e815cf.xz
>>
>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>> Reported-by: syzbot+a3f758b8d8cb7e49afec@syzkaller.appspotmail.com
>>
>> usb 1-1: config 0 has no interface number 0
>> usb 1-1: New USB device found, idVendor=1949, idProduct=5e70, bcdDevice=d7.a2
>> usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
>> usb 1-1: config 0 descriptor??
>> usb 1-1: string descriptor 0 read error: -71
>> general protection fault, probably for non-canonical address 0xdffffc0000000068: 0000 [#1] PREEMPT SMP KASAN
>> KASAN: null-ptr-deref in range [0x0000000000000340-0x0000000000000347]
>> CPU: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.3.0-next-20230428-syzkaller #0
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
>> Workqueue: usb_hub_wq hub_event
>> RIP: 0010:dev_name include/linux/device.h:706 [inline]
>> RIP: 0010:__dev_printk+0x3b/0x270 drivers/base/core.c:4863
>> Code: f5 53 e8 c8 c3 6b fc 48 85 ed 0f 84 cb 01 00 00 e8 ba c3 6b fc 48 8d 7d 50 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 d7 01 00 00 48 8b 5d 50 48 85 db 0f 84 b5 00 00
>> RSP: 0018:ffffc900000e6f70 EFLAGS: 00010202
>> RAX: dffffc0000000000 RBX: fffff5200001cdf5 RCX: 0000000000000000
>> RDX: 0000000000000068 RSI: ffffffff85188a06 RDI: 0000000000000340
>> RBP: 00000000000002f0 R08: 0000000000000005 R09: 0000000000000000
>> R10: 00000000ffffffb9 R11: ffffffff81d6ff05 R12: ffffffff8ace98e0
>> R13: ffffc900000e6fc8 R14: ffff88801ed25a64 R15: 0000000000000000
>> FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
>> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> CR2: 00007f1361dc1111 CR3: 00000000210fe000 CR4: 00000000003506f0
>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>> Call Trace:
>> <TASK>
>> _dev_warn+0xdc/0x120 drivers/base/core.c:4907
>> xpad_probe+0x197e/0x2020 drivers/input/joystick/xpad.c:2053
>> usb_probe_interface+0x30f/0x960 drivers/usb/core/driver.c:396
> It looks like the problem is caused by commit db7220c48d8d ("Input:
> xpad - fix support for some third-party controllers"). In the line
>
> dev_warn(&xpad->dev->dev,
Hi Alan,
Vicki had prepared and sent a patch to fix this kernel bug. Please take
a look at the following threads[1][2].
[1] https://www.spinics.net/lists/linux-input/msg84905.html
[2] https://groups.google.com/g/hust-os-kernel-patches/c/CQY-rdr4kqE
>
> the xpad->dev ought to be xpad->udev.
>
> Alan Stern
^ permalink raw reply
* Re: [syzbot] [usb?] general protection fault in xpad_probe
From: syzbot @ 2023-04-30 5:19 UTC (permalink / raw)
To: chaorace, dan.carpenter, dmitry.torokhov, dzm91, error27, gregkh,
hdanton, hust-os-kernel-patches, kernel-janitors, linux-input,
linux-kernel, linux-usb, matthias.benkmann, mkorpershoek,
mudongliangabcd, nate, pgriffais, radon86dev, rafael, rojtberg,
s.demassari, stern, syzkaller-bugs, vi
In-Reply-To: <00000000000083d76d05f909f716@google.com>
syzbot has bisected this issue to:
commit db7220c48d8d71476f881a7ae1285e1df4105409
Author: Vicki Pfau <vi@endrift.com>
Date: Fri Mar 24 17:42:27 2023 +0000
Input: xpad - fix support for some third-party controllers
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1028a1f8280000
start commit: 92e815cf07ed Add linux-next specific files for 20230428
git tree: linux-next
final oops: https://syzkaller.appspot.com/x/report.txt?x=1228a1f8280000
console output: https://syzkaller.appspot.com/x/log.txt?x=1428a1f8280000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8c8ae4d47d23592
dashboard link: https://syzkaller.appspot.com/bug?extid=a3f758b8d8cb7e49afec
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14a5408c280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10d3b0e4280000
Reported-by: syzbot+a3f758b8d8cb7e49afec@syzkaller.appspotmail.com
Fixes: db7220c48d8d ("Input: xpad - fix support for some third-party controllers")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply
* [PATCH] touchscreen_dmi: Add info for the Dexp Ursus KX210i
From: Andrey Avdeev @ 2023-04-30 8:01 UTC (permalink / raw)
To: linux-input
Add touchscreen info for the Dexp Ursus KX210i
Signed-off-by: Andrey Avdeev <jamesstoun@gmail.com>
---
drivers/platform/x86/touchscreen_dmi.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
index 13802a3c3591..0d3ac1e7a43c 100644
--- a/drivers/platform/x86/touchscreen_dmi.c
+++ b/drivers/platform/x86/touchscreen_dmi.c
@@ -336,6 +336,22 @@ static const struct ts_dmi_data dexp_ursus_7w_data = {
.properties = dexp_ursus_7w_props,
};
+static const struct property_entry dexp_ursus_kx210i_props[] = {
+ PROPERTY_ENTRY_U32("touchscreen-min-x", 5),
+ PROPERTY_ENTRY_U32("touchscreen-min-y", 2),
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1720),
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1137),
+ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-dexp-ursus-kx210i.fw"),
+ PROPERTY_ENTRY_U32("silead,max-fingers", 10),
+ PROPERTY_ENTRY_BOOL("silead,home-button"),
+ { }
+};
+
+static const struct ts_dmi_data dexp_ursus_kx210i_data = {
+ .acpi_name = "MSSL1680:00",
+ .properties = dexp_ursus_kx210i_props,
+};
+
static const struct property_entry digma_citi_e200_props[] = {
PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
@@ -1185,6 +1201,14 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "7W"),
},
},
+ {
+ /* DEXP Ursus KX210i */
+ .driver_data = (void *)&dexp_ursus_kx210i_data,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "INSYDE Corp."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "S107I"),
+ },
+ },
{
/* Digma Citi E200 */
.driver_data = (void *)&digma_citi_e200_data,
--
2.40.0
^ permalink raw reply related
* [PATCH 0/4] Fix up Nokia 770 regression
From: Linus Walleij @ 2023-04-30 9:22 UTC (permalink / raw)
To: Aaro Koskinen, Janusz Krzysztofik, Tony Lindgren, Russell King,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Thomas Bogendoerfer,
Dmitry Torokhov, Mark Brown, Bartosz Golaszewski, Andreas Kemnade,
Helge Deller, Ulf Hansson
Cc: linux-omap, linux-arm-kernel, linux-kernel, linux-mips,
linux-input, linux-spi, linux-fbdev, dri-devel, linux-mmc,
Linus Walleij
A recent change to use dynamic GPIO base allocation in the
OMAP GPIO driver caused a regression in some OMAP1 boards.
This series fixes up the Nokia 770 board from 2005:
https://en.wikipedia.org/wiki/Nokia_770_Internet_Tablet
I don't know how urgent the fix is, you decide. For me,
it is fair if fringe systems get fixed in due time, as
they are hardly anyones main development laptop.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Linus Walleij (4):
Input/ARM: ads7846: Get pendown IRQ from descriptors
fbdev/ARM: Fix up LCD MIPID GPIO usage
ARM/mmc: Convert old mmci-omap to GPIO descriptors
ARM: omap1: Fix up the Nokia 770 board device IRQs
arch/arm/mach-omap1/board-nokia770.c | 136 ++++++++++++++++++--------------
arch/arm/mach-omap1/board-sx1-mmc.c | 1 -
arch/arm/mach-omap2/board-n8x0.c | 85 ++++++--------------
arch/arm/mach-pxa/spitz.c | 11 ++-
arch/mips/alchemy/devboards/db1000.c | 11 ++-
drivers/input/touchscreen/ads7846.c | 32 ++------
drivers/mmc/host/omap.c | 46 ++++++++++-
drivers/video/fbdev/omap/lcd_mipid.c | 10 +++
include/linux/platform_data/lcd-mipid.h | 2 -
include/linux/platform_data/mmc-omap.h | 2 -
include/linux/spi/ads7846.h | 2 -
11 files changed, 186 insertions(+), 152 deletions(-)
---
base-commit: 825a0714d2b3883d4f8ff64f6933fb73ee3f1834
change-id: 20230430-nokia770-regression-2b5a07497ec9
Best regards,
--
Linus Walleij <linus.walleij@linaro.org>
^ permalink raw reply
* [PATCH 1/4] Input/ARM: ads7846: Get pendown IRQ from descriptors
From: Linus Walleij @ 2023-04-30 9:22 UTC (permalink / raw)
To: Aaro Koskinen, Janusz Krzysztofik, Tony Lindgren, Russell King,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Thomas Bogendoerfer,
Dmitry Torokhov, Mark Brown, Bartosz Golaszewski, Andreas Kemnade,
Helge Deller, Ulf Hansson
Cc: linux-omap, linux-arm-kernel, linux-kernel, linux-mips,
linux-input, linux-spi, linux-fbdev, dri-devel, linux-mmc,
Linus Walleij
In-Reply-To: <20230430-nokia770-regression-v1-0-97704e36b094@linaro.org>
The ADS7846 has some limited support for using GPIO descriptors,
let's convert it over completely and fix all users to provide
GPIOs in descriptor tables.
The Nokia 770 now has dynamic allocation of IRQ numbers, so this
needs to be fixed for it to work.
Fixes: 92bf78b33b0b ("gpio: omap: use dynamic allocation of base")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/mach-omap1/board-nokia770.c | 12 +++++++++++-
arch/arm/mach-pxa/spitz.c | 11 ++++++++++-
arch/mips/alchemy/devboards/db1000.c | 11 ++++++++++-
drivers/input/touchscreen/ads7846.c | 32 ++++++++------------------------
include/linux/spi/ads7846.h | 2 --
5 files changed, 39 insertions(+), 29 deletions(-)
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index a501a473ffd6..eb7652670447 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -118,7 +118,16 @@ static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata =
.debounce_max = 10,
.debounce_tol = 3,
.debounce_rep = 1,
- .gpio_pendown = ADS7846_PENDOWN_GPIO,
+};
+
+static struct gpiod_lookup_table nokia770_ads7846_gpio_table = {
+ /* SPI bus 2, device with chip select 0 */
+ .dev_id = "spi2.0",
+ .table = {
+ GPIO_LOOKUP("gpio-0-15", ADS7846_PENDOWN_GPIO,
+ "pendown", GPIO_ACTIVE_HIGH),
+ { }
+ },
};
static struct spi_board_info nokia770_spi_board_info[] __initdata = {
@@ -274,6 +283,7 @@ static void __init omap_nokia770_init(void)
omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
+ gpiod_add_lookup_table(&nokia770_ads7846_gpio_table);
nokia770_spi_board_info[1].irq = gpio_to_irq(15);
spi_register_board_info(nokia770_spi_board_info,
ARRAY_SIZE(nokia770_spi_board_info));
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 26f0ebc4d136..4d2a72804495 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -505,10 +505,18 @@ static struct ads7846_platform_data spitz_ads7846_info = {
.x_plate_ohms = 419,
.y_plate_ohms = 486,
.pressure_max = 1024,
- .gpio_pendown = SPITZ_GPIO_TP_INT,
.wait_for_sync = spitz_ads7846_wait_for_hsync,
};
+static struct gpiod_lookup_table spitz_ads7846_gpio_table = {
+ .dev_id = "spi2.0",
+ .table = {
+ GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_TP_INT,
+ "pendown", GPIO_ACTIVE_HIGH),
+ { },
+ },
+};
+
static void spitz_bl_kick_battery(void)
{
void (*kick_batt)(void);
@@ -593,6 +601,7 @@ static void __init spitz_spi_init(void)
else
gpiod_add_lookup_table(&spitz_lcdcon_gpio_table);
+ gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
gpiod_add_lookup_table(&spitz_spi_gpio_table);
pxa2xx_set_spi_info(2, &spitz_spi_info);
spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c
index 2c52ee27b4f2..f37644859f89 100644
--- a/arch/mips/alchemy/devboards/db1000.c
+++ b/arch/mips/alchemy/devboards/db1000.c
@@ -381,13 +381,21 @@ static struct platform_device db1100_mmc1_dev = {
static struct ads7846_platform_data db1100_touch_pd = {
.model = 7846,
.vref_mv = 3300,
- .gpio_pendown = 21,
};
static struct spi_gpio_platform_data db1100_spictl_pd = {
.num_chipselect = 1,
};
+static struct gpiod_lookup_table db1100_touch_gpio_table = {
+ .dev_id = "spi0.0",
+ .table = {
+ GPIO_LOOKUP("alchemy-gpio2", 21,
+ "pendown", GPIO_ACTIVE_HIGH),
+ { },
+ },
+};
+
static struct spi_board_info db1100_spi_info[] __initdata = {
[0] = {
.modalias = "ads7846",
@@ -474,6 +482,7 @@ int __init db1000_dev_setup(void)
pfc |= (1 << 0); /* SSI0 pins as GPIOs */
alchemy_wrsys(pfc, AU1000_SYS_PINFUNC);
+ gpiod_add_lookup_table(&db1100_touch_gpio_table);
spi_register_board_info(db1100_spi_info,
ARRAY_SIZE(db1100_spi_info));
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index bb1058b1e7fd..a3c623009247 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -25,10 +25,8 @@
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/of.h>
-#include <linux/of_gpio.h>
#include <linux/of_device.h>
#include <linux/gpio/consumer.h>
-#include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
#include <linux/regulator/consumer.h>
@@ -140,7 +138,7 @@ struct ads7846 {
int (*filter)(void *data, int data_idx, int *val);
void *filter_data;
int (*get_pendown_state)(void);
- int gpio_pendown;
+ struct gpio_desc *gpio_pendown;
void (*wait_for_sync)(void);
};
@@ -223,7 +221,7 @@ static int get_pendown_state(struct ads7846 *ts)
if (ts->get_pendown_state)
return ts->get_pendown_state();
- return !gpio_get_value(ts->gpio_pendown);
+ return !gpiod_get_value(ts->gpio_pendown);
}
static void ads7846_report_pen_up(struct ads7846 *ts)
@@ -989,8 +987,6 @@ static int ads7846_setup_pendown(struct spi_device *spi,
struct ads7846 *ts,
const struct ads7846_platform_data *pdata)
{
- int err;
-
/*
* REVISIT when the irq can be triggered active-low, or if for some
* reason the touchscreen isn't hooked up, we don't need to access
@@ -999,25 +995,15 @@ static int ads7846_setup_pendown(struct spi_device *spi,
if (pdata->get_pendown_state) {
ts->get_pendown_state = pdata->get_pendown_state;
- } else if (gpio_is_valid(pdata->gpio_pendown)) {
-
- err = devm_gpio_request_one(&spi->dev, pdata->gpio_pendown,
- GPIOF_IN, "ads7846_pendown");
- if (err) {
- dev_err(&spi->dev,
- "failed to request/setup pendown GPIO%d: %d\n",
- pdata->gpio_pendown, err);
- return err;
+ } else {
+ ts->gpio_pendown = gpiod_get(&spi->dev, "pendown", GPIOD_IN);
+ if (IS_ERR(ts->gpio_pendown)) {
+ dev_err(&spi->dev, "failed to request pendown GPIO\n");
+ return PTR_ERR(ts->gpio_pendown);
}
-
- ts->gpio_pendown = pdata->gpio_pendown;
-
if (pdata->gpio_pendown_debounce)
- gpiod_set_debounce(gpio_to_desc(ts->gpio_pendown),
+ gpiod_set_debounce(ts->gpio_pendown,
pdata->gpio_pendown_debounce);
- } else {
- dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
- return -EINVAL;
}
return 0;
@@ -1195,8 +1181,6 @@ static const struct ads7846_platform_data *ads7846_probe_dt(struct device *dev)
pdata->wakeup = of_property_read_bool(node, "wakeup-source") ||
of_property_read_bool(node, "linux,wakeup");
- pdata->gpio_pendown = of_get_named_gpio(dev->of_node, "pendown-gpio", 0);
-
return pdata;
}
#else
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index d424c1aadf38..a04c1c34c344 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -35,8 +35,6 @@ struct ads7846_platform_data {
u16 debounce_tol; /* tolerance used for filtering */
u16 debounce_rep; /* additional consecutive good readings
* required after the first two */
- int gpio_pendown; /* the GPIO used to decide the pendown
- * state if get_pendown_state == NULL */
int gpio_pendown_debounce; /* platform specific debounce time for
* the gpio_pendown */
int (*get_pendown_state)(void);
--
2.34.1
^ permalink raw reply related
* [PATCH 2/4] fbdev/ARM: Fix up LCD MIPID GPIO usage
From: Linus Walleij @ 2023-04-30 9:22 UTC (permalink / raw)
To: Aaro Koskinen, Janusz Krzysztofik, Tony Lindgren, Russell King,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Thomas Bogendoerfer,
Dmitry Torokhov, Mark Brown, Bartosz Golaszewski, Andreas Kemnade,
Helge Deller, Ulf Hansson
Cc: linux-omap, linux-arm-kernel, linux-kernel, linux-mips,
linux-input, linux-spi, linux-fbdev, dri-devel, linux-mmc,
Linus Walleij
In-Reply-To: <20230430-nokia770-regression-v1-0-97704e36b094@linaro.org>
The Nokia 770 is using GPIOs from the global numberspace to pass
down to the LCD controller. This regresses when we let the OMAP
GPIO driver use dynamic GPIO base.
As this is the only user of LCD MIPID we can easily augment the
driver to use a GPIO descriptor instead and resolve the issue.
The platform data .shutdown() callback wasn't even used in the
code, but we encode a shutdown asserting RESET in the remove()
callback for completeness sake.
Fixes: 92bf78b33b0b ("gpio: omap: use dynamic allocation of base")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/mach-omap1/board-nokia770.c | 23 ++++++++++-------------
drivers/video/fbdev/omap/lcd_mipid.c | 10 ++++++++++
include/linux/platform_data/lcd-mipid.h | 2 --
3 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index eb7652670447..509afcd42823 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -85,26 +85,23 @@ static struct platform_device *nokia770_devices[] __initdata = {
&nokia770_kp_device,
};
-static void mipid_shutdown(struct mipid_platform_data *pdata)
-{
- if (pdata->nreset_gpio != -1) {
- printk(KERN_INFO "shutdown LCD\n");
- gpio_set_value(pdata->nreset_gpio, 0);
- msleep(120);
- }
-}
-
-static struct mipid_platform_data nokia770_mipid_platform_data = {
- .shutdown = mipid_shutdown,
-};
+static struct mipid_platform_data nokia770_mipid_platform_data = { };
static const struct omap_lcd_config nokia770_lcd_config __initconst = {
.ctrl_name = "hwa742",
};
+static struct gpiod_lookup_table nokia770_lcd_gpio_table = {
+ .dev_id = "lcd_mipid",
+ .table = {
+ GPIO_LOOKUP("gpio-0-15", 13, "reset", GPIO_ACTIVE_LOW),
+ { }
+ },
+};
+
static void __init mipid_dev_init(void)
{
- nokia770_mipid_platform_data.nreset_gpio = 13;
+ gpiod_add_lookup_table(&nokia770_lcd_gpio_table);
nokia770_mipid_platform_data.data_lines = 16;
omapfb_set_lcd_config(&nokia770_lcd_config);
diff --git a/drivers/video/fbdev/omap/lcd_mipid.c b/drivers/video/fbdev/omap/lcd_mipid.c
index 03cff39d392d..e4a7f0b824ff 100644
--- a/drivers/video/fbdev/omap/lcd_mipid.c
+++ b/drivers/video/fbdev/omap/lcd_mipid.c
@@ -7,6 +7,7 @@
*/
#include <linux/device.h>
#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/spi/spi.h>
@@ -41,6 +42,7 @@ struct mipid_device {
when we can issue the
next sleep in/out command */
unsigned long hw_guard_wait; /* max guard time in jiffies */
+ struct gpio_desc *reset;
struct omapfb_device *fbdev;
struct spi_device *spi;
@@ -556,6 +558,12 @@ static int mipid_spi_probe(struct spi_device *spi)
return -ENOMEM;
}
+ /* This will de-assert RESET if active */
+ md->reset = gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(md->reset))
+ return dev_err_probe(&spi->dev, PTR_ERR(md->reset),
+ "no reset GPIO line\n");
+
spi->mode = SPI_MODE_0;
md->spi = spi;
dev_set_drvdata(&spi->dev, md);
@@ -574,6 +582,8 @@ static void mipid_spi_remove(struct spi_device *spi)
{
struct mipid_device *md = dev_get_drvdata(&spi->dev);
+ /* Asserts RESET */
+ gpiod_set_value(md->reset, 1);
mipid_disable(&md->panel);
kfree(md);
}
diff --git a/include/linux/platform_data/lcd-mipid.h b/include/linux/platform_data/lcd-mipid.h
index 63f05eb23827..4927cfc5158c 100644
--- a/include/linux/platform_data/lcd-mipid.h
+++ b/include/linux/platform_data/lcd-mipid.h
@@ -15,10 +15,8 @@ enum mipid_test_result {
#ifdef __KERNEL__
struct mipid_platform_data {
- int nreset_gpio;
int data_lines;
- void (*shutdown)(struct mipid_platform_data *pdata);
void (*set_bklight_level)(struct mipid_platform_data *pdata,
int level);
int (*get_bklight_level)(struct mipid_platform_data *pdata);
--
2.34.1
^ permalink raw reply related
* [PATCH 3/4] ARM/mmc: Convert old mmci-omap to GPIO descriptors
From: Linus Walleij @ 2023-04-30 9:22 UTC (permalink / raw)
To: Aaro Koskinen, Janusz Krzysztofik, Tony Lindgren, Russell King,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Thomas Bogendoerfer,
Dmitry Torokhov, Mark Brown, Bartosz Golaszewski, Andreas Kemnade,
Helge Deller, Ulf Hansson
Cc: linux-omap, linux-arm-kernel, linux-kernel, linux-mips,
linux-input, linux-spi, linux-fbdev, dri-devel, linux-mmc,
Linus Walleij
In-Reply-To: <20230430-nokia770-regression-v1-0-97704e36b094@linaro.org>
A recent change to the OMAP driver making it use a dynamic GPIO
base created problems with some old OMAP1 board files, among
them Nokia 770, SX1 and also the OMAP2 Nokia n8x0.
Fix up all instances of GPIOs being used for the MMC driver
by pushing the handling of power, slot selection and MMC
"cover" into the driver as optional GPIOs.
This is maybe not the most perfect solution as the MMC
framework have some central handlers for some of the
stuff, but it at least makes the situtation better and
solves the immediate issue.
Fixes: 92bf78b33b0b ("gpio: omap: use dynamic allocation of base")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/mach-omap1/board-nokia770.c | 43 ++++++-----------
arch/arm/mach-omap1/board-sx1-mmc.c | 1 -
arch/arm/mach-omap2/board-n8x0.c | 85 +++++++++++-----------------------
drivers/mmc/host/omap.c | 46 +++++++++++++++++-
include/linux/platform_data/mmc-omap.h | 2 -
5 files changed, 83 insertions(+), 94 deletions(-)
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 509afcd42823..53a4a44d5f4a 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -162,27 +162,23 @@ static struct omap_usb_config nokia770_usb_config __initdata = {
#if IS_ENABLED(CONFIG_MMC_OMAP)
-#define NOKIA770_GPIO_MMC_POWER 41
-#define NOKIA770_GPIO_MMC_SWITCH 23
-
-static int nokia770_mmc_set_power(struct device *dev, int slot, int power_on,
- int vdd)
-{
- gpio_set_value(NOKIA770_GPIO_MMC_POWER, power_on);
- return 0;
-}
-
-static int nokia770_mmc_get_cover_state(struct device *dev, int slot)
-{
- return gpio_get_value(NOKIA770_GPIO_MMC_SWITCH);
-}
+static struct gpiod_lookup_table nokia770_mmc_gpio_table = {
+ .dev_id = "mmci-omap",
+ .table = {
+ /* Slot index 0, VSD power, GPIO 41 */
+ GPIO_LOOKUP_IDX("gpio-32-47", 9,
+ "vsd", 0, GPIO_ACTIVE_HIGH),
+ /* Slot index 0, switch, GPIO 23 */
+ GPIO_LOOKUP_IDX("gpio-16-31", 7,
+ "cover", 0, GPIO_ACTIVE_HIGH),
+ { }
+ },
+};
static struct omap_mmc_platform_data nokia770_mmc2_data = {
.nr_slots = 1,
.max_freq = 12000000,
.slots[0] = {
- .set_power = nokia770_mmc_set_power,
- .get_cover_state = nokia770_mmc_get_cover_state,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.name = "mmcblk",
},
@@ -192,20 +188,7 @@ static struct omap_mmc_platform_data *nokia770_mmc_data[OMAP16XX_NR_MMC];
static void __init nokia770_mmc_init(void)
{
- int ret;
-
- ret = gpio_request(NOKIA770_GPIO_MMC_POWER, "MMC power");
- if (ret < 0)
- return;
- gpio_direction_output(NOKIA770_GPIO_MMC_POWER, 0);
-
- ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
- if (ret < 0) {
- gpio_free(NOKIA770_GPIO_MMC_POWER);
- return;
- }
- gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
-
+ gpiod_add_lookup_table(&nokia770_mmc_gpio_table);
/* Only the second MMC controller is used */
nokia770_mmc_data[1] = &nokia770_mmc2_data;
omap1_init_mmc(nokia770_mmc_data, OMAP16XX_NR_MMC);
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c
index f1c160924dfe..f183a8448a7b 100644
--- a/arch/arm/mach-omap1/board-sx1-mmc.c
+++ b/arch/arm/mach-omap1/board-sx1-mmc.c
@@ -9,7 +9,6 @@
* Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
*/
-#include <linux/gpio.h>
#include <linux/platform_device.h>
#include "hardware.h"
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 3353b0a923d9..baa2f0341aed 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -11,6 +11,7 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/irq.h>
@@ -170,22 +171,32 @@ static struct spi_board_info n800_spi_board_info[] __initdata = {
* GPIO23 and GPIO9 slot 2 EMMC on N810
*
*/
-#define N8X0_SLOT_SWITCH_GPIO 96
-#define N810_EMMC_VSD_GPIO 23
-#define N810_EMMC_VIO_GPIO 9
-
static int slot1_cover_open;
static int slot2_cover_open;
static struct device *mmc_device;
-static int n8x0_mmc_switch_slot(struct device *dev, int slot)
-{
-#ifdef CONFIG_MMC_DEBUG
- dev_dbg(dev, "Choose slot %d\n", slot + 1);
-#endif
- gpio_set_value(N8X0_SLOT_SWITCH_GPIO, slot);
- return 0;
-}
+static struct gpiod_lookup_table nokia8xx_mmc_gpio_table = {
+ .dev_id = "mmci-omap",
+ .table = {
+ /* Slot switch, GPIO 96 */
+ GPIO_LOOKUP("gpio-80-111", 16,
+ "switch", GPIO_ACTIVE_HIGH),
+ { }
+ },
+};
+
+static struct gpiod_lookup_table nokia810_mmc_gpio_table = {
+ .dev_id = "mmci-omap",
+ .table = {
+ /* Slot index 1, VSD power, GPIO 23 */
+ GPIO_LOOKUP_IDX("gpio-16-31", 7,
+ "vsd", 1, GPIO_ACTIVE_HIGH),
+ /* Slot index 1, VIO power, GPIO 9 */
+ GPIO_LOOKUP_IDX("gpio-0-15", 9,
+ "vsd", 1, GPIO_ACTIVE_HIGH),
+ { }
+ },
+};
static int n8x0_mmc_set_power_menelaus(struct device *dev, int slot,
int power_on, int vdd)
@@ -256,31 +267,13 @@ static int n8x0_mmc_set_power_menelaus(struct device *dev, int slot,
return 0;
}
-static void n810_set_power_emmc(struct device *dev,
- int power_on)
-{
- dev_dbg(dev, "Set EMMC power %s\n", power_on ? "on" : "off");
-
- if (power_on) {
- gpio_set_value(N810_EMMC_VSD_GPIO, 1);
- msleep(1);
- gpio_set_value(N810_EMMC_VIO_GPIO, 1);
- msleep(1);
- } else {
- gpio_set_value(N810_EMMC_VIO_GPIO, 0);
- msleep(50);
- gpio_set_value(N810_EMMC_VSD_GPIO, 0);
- msleep(50);
- }
-}
-
static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on,
int vdd)
{
if (board_is_n800() || slot == 0)
return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd);
- n810_set_power_emmc(dev, power_on);
+ /* The n810 power will be handled by GPIO code in the driver */
return 0;
}
@@ -418,13 +411,6 @@ static void n8x0_mmc_shutdown(struct device *dev)
static void n8x0_mmc_cleanup(struct device *dev)
{
menelaus_unregister_mmc_callback();
-
- gpio_free(N8X0_SLOT_SWITCH_GPIO);
-
- if (board_is_n810()) {
- gpio_free(N810_EMMC_VSD_GPIO);
- gpio_free(N810_EMMC_VIO_GPIO);
- }
}
/*
@@ -433,7 +419,6 @@ static void n8x0_mmc_cleanup(struct device *dev)
*/
static struct omap_mmc_platform_data mmc1_data = {
.nr_slots = 0,
- .switch_slot = n8x0_mmc_switch_slot,
.init = n8x0_mmc_late_init,
.cleanup = n8x0_mmc_cleanup,
.shutdown = n8x0_mmc_shutdown,
@@ -463,14 +448,9 @@ static struct omap_mmc_platform_data mmc1_data = {
static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
-static struct gpio n810_emmc_gpios[] __initdata = {
- { N810_EMMC_VSD_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vddf" },
- { N810_EMMC_VIO_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vdd" },
-};
-
static void __init n8x0_mmc_init(void)
{
- int err;
+ gpiod_add_lookup_table(&nokia8xx_mmc_gpio_table);
if (board_is_n810()) {
mmc1_data.slots[0].name = "external";
@@ -483,20 +463,7 @@ static void __init n8x0_mmc_init(void)
*/
mmc1_data.slots[1].name = "internal";
mmc1_data.slots[1].ban_openended = 1;
- }
-
- err = gpio_request_one(N8X0_SLOT_SWITCH_GPIO, GPIOF_OUT_INIT_LOW,
- "MMC slot switch");
- if (err)
- return;
-
- if (board_is_n810()) {
- err = gpio_request_array(n810_emmc_gpios,
- ARRAY_SIZE(n810_emmc_gpios));
- if (err) {
- gpio_free(N8X0_SLOT_SWITCH_GPIO);
- return;
- }
+ gpiod_add_lookup_table(&nokia810_mmc_gpio_table);
}
mmc1_data.nr_slots = 2;
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index ce78edfb402b..a14af21f12da 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -26,6 +26,7 @@
#include <linux/clk.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
+#include <linux/gpio/consumer.h>
#include <linux/platform_data/mmc-omap.h>
@@ -111,6 +112,9 @@ struct mmc_omap_slot {
struct mmc_request *mrq;
struct mmc_omap_host *host;
struct mmc_host *mmc;
+ struct gpio_desc *vsd;
+ struct gpio_desc *vio;
+ struct gpio_desc *cover;
struct omap_mmc_slot_data *pdata;
};
@@ -133,6 +137,7 @@ struct mmc_omap_host {
int irq;
unsigned char bus_mode;
unsigned int reg_shift;
+ struct gpio_desc *slot_switch;
struct work_struct cmd_abort_work;
unsigned abort:1;
@@ -216,8 +221,13 @@ static void mmc_omap_select_slot(struct mmc_omap_slot *slot, int claimed)
if (host->current_slot != slot) {
OMAP_MMC_WRITE(host, CON, slot->saved_con & 0xFC00);
- if (host->pdata->switch_slot != NULL)
- host->pdata->switch_slot(mmc_dev(slot->mmc), slot->id);
+ if (host->slot_switch)
+ /*
+ * With two slots and a simple GPIO switch, setting
+ * the GPIO to 0 selects slot ID 0, setting it to 1
+ * selects slot ID 1.
+ */
+ gpiod_set_value(host->slot_switch, slot->id);
host->current_slot = slot;
}
@@ -297,6 +307,9 @@ static void mmc_omap_release_slot(struct mmc_omap_slot *slot, int clk_enabled)
static inline
int mmc_omap_cover_is_open(struct mmc_omap_slot *slot)
{
+ /* If we have a GPIO then use that */
+ if (slot->cover)
+ return gpiod_get_value(slot->cover);
if (slot->pdata->get_cover_state)
return slot->pdata->get_cover_state(mmc_dev(slot->mmc),
slot->id);
@@ -1106,6 +1119,11 @@ static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,
host = slot->host;
+ if (slot->vsd)
+ gpiod_set_value(slot->vsd, power_on);
+ if (slot->vio)
+ gpiod_set_value(slot->vio, power_on);
+
if (slot->pdata->set_power != NULL)
slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on,
vdd);
@@ -1240,6 +1258,23 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
slot->power_mode = MMC_POWER_UNDEFINED;
slot->pdata = &host->pdata->slots[id];
+ /* Check for some optional GPIO controls */
+ slot->vsd = gpiod_get_index_optional(host->dev, "vsd",
+ id, GPIOD_OUT_LOW);
+ if (IS_ERR(slot->vsd))
+ return dev_err_probe(host->dev, PTR_ERR(slot->vsd),
+ "error looking up VSD GPIO\n");
+ slot->vio = gpiod_get_index_optional(host->dev, "vio",
+ id, GPIOD_OUT_LOW);
+ if (IS_ERR(slot->vio))
+ return dev_err_probe(host->dev, PTR_ERR(slot->vio),
+ "error looking up VIO GPIO\n");
+ slot->cover = gpiod_get_index_optional(host->dev, "cover",
+ id, GPIOD_IN);
+ if (IS_ERR(slot->cover))
+ return dev_err_probe(host->dev, PTR_ERR(slot->cover),
+ "error looking up cover switch GPIO\n");
+
host->slots[id] = slot;
mmc->caps = 0;
@@ -1349,6 +1384,13 @@ static int mmc_omap_probe(struct platform_device *pdev)
if (IS_ERR(host->virt_base))
return PTR_ERR(host->virt_base);
+ host->slot_switch = gpiod_get_optional(host->dev, "switch",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(host->slot_switch))
+ return dev_err_probe(host->dev, PTR_ERR(host->slot_switch),
+ "error looking up slot switch GPIO\n");
+
+
INIT_WORK(&host->slot_release_work, mmc_omap_slot_release_work);
INIT_WORK(&host->send_stop_work, mmc_omap_send_stop_work);
diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
index 91051e9907f3..054d0c3c5ec5 100644
--- a/include/linux/platform_data/mmc-omap.h
+++ b/include/linux/platform_data/mmc-omap.h
@@ -20,8 +20,6 @@ struct omap_mmc_platform_data {
* maximum frequency on the MMC bus */
unsigned int max_freq;
- /* switch the bus to a new slot */
- int (*switch_slot)(struct device *dev, int slot);
/* initialize board-specific MMC functionality, can be NULL if
* not supported */
int (*init)(struct device *dev);
--
2.34.1
^ permalink raw reply related
* [PATCH 4/4] ARM: omap1: Fix up the Nokia 770 board device IRQs
From: Linus Walleij @ 2023-04-30 9:22 UTC (permalink / raw)
To: Aaro Koskinen, Janusz Krzysztofik, Tony Lindgren, Russell King,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Thomas Bogendoerfer,
Dmitry Torokhov, Mark Brown, Bartosz Golaszewski, Andreas Kemnade,
Helge Deller, Ulf Hansson
Cc: linux-omap, linux-arm-kernel, linux-kernel, linux-mips,
linux-input, linux-spi, linux-fbdev, dri-devel, linux-mmc,
Linus Walleij
In-Reply-To: <20230430-nokia770-regression-v1-0-97704e36b094@linaro.org>
The platform devices on the Nokia 770 is using some
board-specific IRQs that get statically assigned to platform
devices in the boardfile.
This does not work with dynamic IRQ chip bases.
Utilize the NULL device to define some board-specific
GPIO lookups and use these to immediately look up the
same GPIOs, convert to IRQ numbers and pass as resources
to the devices. This is ugly but should work.
Fixes: 92bf78b33b0b ("gpio: omap: use dynamic allocation of base")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/mach-omap1/board-nokia770.c | 58 +++++++++++++++++++++++++++---------
1 file changed, 44 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 53a4a44d5f4a..18a63c5a3dee 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -6,8 +6,8 @@
*/
#include <linux/clkdev.h>
#include <linux/irq.h>
-#include <linux/gpio.h>
#include <linux/gpio/machine.h>
+#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/mutex.h>
@@ -227,21 +227,28 @@ static struct i2c_board_info nokia770_i2c_board_info_2[] __initdata = {
static void __init nokia770_cbus_init(void)
{
- const int retu_irq_gpio = 62;
- const int tahvo_irq_gpio = 40;
-
- if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ"))
- return;
- if (gpio_request_one(tahvo_irq_gpio, GPIOF_IN, "Tahvo IRQ")) {
- gpio_free(retu_irq_gpio);
- return;
+ struct gpio_desc *d;
+ int irq;
+
+ d = gpiod_get(NULL, "retu_irq", GPIOD_IN);
+ if (IS_ERR(d)) {
+ pr_err("Unable to get CBUS Retu IRQ GPIO descriptor\n");
+ } else {
+ irq = gpiod_to_irq(d);
+ irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
+ nokia770_i2c_board_info_2[0].irq = irq;
+ }
+ d = gpiod_get(NULL, "tahvo_irq", GPIOD_IN);
+ if (IS_ERR(d)) {
+ pr_err("Unable to get CBUS Tahvo IRQ GPIO descriptor\n");
+ } else {
+ irq = gpiod_to_irq(d);
+ irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
+ nokia770_i2c_board_info_2[1].irq = irq;
}
- irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING);
- irq_set_irq_type(gpio_to_irq(tahvo_irq_gpio), IRQ_TYPE_EDGE_RISING);
- nokia770_i2c_board_info_2[0].irq = gpio_to_irq(retu_irq_gpio);
- nokia770_i2c_board_info_2[1].irq = gpio_to_irq(tahvo_irq_gpio);
i2c_register_board_info(2, nokia770_i2c_board_info_2,
ARRAY_SIZE(nokia770_i2c_board_info_2));
+
gpiod_add_lookup_table(&nokia770_cbus_gpio_table);
platform_device_register(&nokia770_cbus_device);
}
@@ -251,8 +258,25 @@ static void __init nokia770_cbus_init(void)
}
#endif /* CONFIG_I2C_CBUS_GPIO */
+static struct gpiod_lookup_table nokia770_irq_gpio_table = {
+ .dev_id = NULL,
+ .table = {
+ /* GPIO used by SPI device 1 */
+ GPIO_LOOKUP("gpio-0-15", 15, "ads7846_irq",
+ GPIO_ACTIVE_HIGH),
+ /* GPIO used for retu IRQ */
+ GPIO_LOOKUP("gpio-48-63", 15, "retu_irq",
+ GPIO_ACTIVE_HIGH),
+ /* GPIO used for tahvo IRQ */
+ GPIO_LOOKUP("gpio-32-47", 8, "tahvo_irq",
+ GPIO_ACTIVE_HIGH),
+ },
+};
+
static void __init omap_nokia770_init(void)
{
+ struct gpio_desc *d;
+
/* On Nokia 770, the SleepX signal is masked with an
* MPUIO line by default. It has to be unmasked for it
* to become functional */
@@ -262,9 +286,15 @@ static void __init omap_nokia770_init(void)
/* Unmask SleepX signal */
omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
+ gpiod_add_lookup_table(&nokia770_irq_gpio_table);
platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
gpiod_add_lookup_table(&nokia770_ads7846_gpio_table);
- nokia770_spi_board_info[1].irq = gpio_to_irq(15);
+
+ d = gpiod_get(NULL, "ads7846_irq", GPIOD_IN);
+ if (IS_ERR(d))
+ pr_err("Unable to get ADS7846 IRQ GPIO descriptor\n");
+ else
+ nokia770_spi_board_info[1].irq = gpiod_to_irq(d);
spi_register_board_info(nokia770_spi_board_info,
ARRAY_SIZE(nokia770_spi_board_info));
omap_serial_init();
--
2.34.1
^ permalink raw reply related
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