[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f8169943-f986-4e9d-9d3b-a470e57f5e6a@oss.qualcomm.com>
Date: Wed, 4 Feb 2026 14:29:44 +0100
From: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
To: Elson Serrao <elson.serrao@....qualcomm.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley
<conor+dt@...nel.org>,
Souradeep Chowdhury <quic_schowdhu@...cinc.com>
Cc: linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 6/9] usb: misc: qcom_eud: add host mode coordination
On 1/27/26 12:38 AM, Elson Serrao wrote:
> EUD functions by presenting itself as a USB device to the host PC for
> debugging, making it incompatible in USB host mode configurations.
> Enabling EUD, when in host mode can also cause the USB controller to
> misbehave as the EUD hub can only have one upstream facing port.
Perhaps that's a silly idea, but would the device itself see
the debug hub, being able to essentially self-debug in a way?
[...]
> @@ -162,32 +165,66 @@ static ssize_t enable_store(struct device *dev,
> const char *buf, size_t count)
> {
> struct eud_chip *chip = dev_get_drvdata(dev);
> + struct eud_path *path;
> bool enable;
> int ret;
>
> if (kstrtobool(buf, &enable))
> return -EINVAL;
>
> + mutex_lock(&chip->state_lock);
If you use guard(mutex)(&chip->state-lock), you can waive all these
conditional mutex_unlock additions
> +
> /* Skip operation if already in desired state */
> - if (chip->enabled == enable)
> + if (chip->enabled == enable) {
> + mutex_unlock(&chip->state_lock);
> return count;
> + }
> +
> + /*
> + * Handle double-disable scenario: User is disabling EUD that was already
> + * disabled due to host mode. Since the hardware is already disabled, we
> + * only need to clear the host-disabled flag to prevent unwanted re-enabling
> + * when exiting host mode. This respects the user's explicit disable request.
> + */
> + if (!enable && chip->eud_disabled_for_host) {
> + chip->eud_disabled_for_host = false;
> + chip->enabled = false;
> + mutex_unlock(&chip->state_lock);
> + return count;
> + }
>
> if (enable) {
> + /*
> + * EUD functions by presenting itself as a USB device to the host PC for
> + * debugging, making it incompatible in USB host mode configuration.
> + * Prevent enabling EUD in this configuration to avoid hardware conflicts.
> + */
> + path = chip->paths[chip->port_idx];
> + if (path && path->curr_role == USB_ROLE_HOST) {
> + dev_err(chip->dev, "EUD not usable in host mode configuration\n");
"in USB host mode"?
[...]
> + /*
> + * EUD must be disabled when USB operates in host mode. EUD functions by
> + * presenting itself as a USB device to the host PC for debugging, making
> + * it incompatible in host mode configuration.
^ with
Otherwise the logic looks good, I think this may be desired default
behavior (so that the user doesn't have to constantly keep re-enabling
EUD)
Konrad
Powered by blists - more mailing lists