From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F3873EF0A9 for ; Wed, 4 Feb 2026 13:29:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770211789; cv=none; b=LJJevQfVoYkzFukgTE3TIbpG0sVzPbFXxAM7HmOgDDgyViwr0ErCrZkMB0yqXTsJohFAMziuyttTEem3HEi85Med5rQPOugc8T2E8bDx/ixN1TFtt3KaQHntrK+VDCDZi7r4f+nkJUaOeVzfQvtkQlms2GRyKKw+lDiPyKLv060= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770211789; c=relaxed/simple; bh=nDewY4WzQzCloMBZYmckqmY2Z9yu54lji//8vuzks/w=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FPSs/5j7rTeN9w3CMsB6Ccvb1xAAd1eF6KDz0XHAWJ4/rBM0/TxjJzPsb5Z5DUsSIJtO92AeYZ8YlEuv5dyonrADiehj2Ejx8b/Yw5+yCkpIaUmhe/E+iaoAUr+m64stKOQ2x1AiQcL6GF8II9antAug6uHuzgy2cshu5C6NyjE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ENZkcVWi; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=R1wsbKht; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ENZkcVWi"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="R1wsbKht" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 614CISL51880669 for ; Wed, 4 Feb 2026 13:29:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 73AAjQUo5bvmWChu5cyasnPqzxqcFhKdIix+5otwegQ=; b=ENZkcVWizTO3Ygho eiDryvNlhEyONTN2gZf8d2WuTE2mYUhckgPKERhp/S6SP5zhc+PudSfJ0lGnakN4 SWbFdbCLG5MF5LEs30b+XzzPSWWMdVYhJLehWkccFhFpO5JvAfBwpg1Qjj5J4Ymd m0tQxhLvkY75ILby4xJzJPQOhPTMHYAmOEIrjsddQu7eV+EXi0P4IP/eKNCeq3Jq nQjhaGT70v7JBMH3lGbbO26/y8J8J2zLVBiz0VFydlMTCj4NKl+e/h0ZRt8yxaFv 75910OboTS8FotyjRQZRlk22KMIGMqAA0ThMlT9wuX7Swm448K3mEIF0LP4TV41v A2Vsew== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c43n9rknd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 04 Feb 2026 13:29:48 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8c522c44febso170418585a.0 for ; Wed, 04 Feb 2026 05:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770211788; x=1770816588; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=73AAjQUo5bvmWChu5cyasnPqzxqcFhKdIix+5otwegQ=; b=R1wsbKhtXmO05FrW4rFjZPqQZ4z/7czXK8GGnsKImTZpyqN7XSCspgqb/JsYHD1vPQ HD/6Ebhyq9spNfOiLmdFHKCRI4GhxRw8in54fabUsZdgUT0eYzyX0Sn2C5YN5lKLdejL nezmyNXocytwpQKkV32R+2KBE/54egDaknZNjWKAtoZhyLjeNvT9bdVie7L7rAY+CM/B CZSWEUWZTJ6Ty1WoTa+FUgfRONZEYwGl0LLKaLud+6zBnVlWBRm7RK3vkshlRKcQe5kj Ym4pj55zgnWDNGbjOPf9WAXlHgHU7J5DQCVoci/zr8eRR5X0Y8eqQRGg7kb4swFMYnFE +qVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770211788; x=1770816588; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=73AAjQUo5bvmWChu5cyasnPqzxqcFhKdIix+5otwegQ=; b=JDvWF2VrMoC+bo3HaP1IeU7kZ2me5ZydkOuHC6PQ+I9wP8dPyIzLtFTl0pFt0b3jFr BBEoHnqC0CVxpaNgInR2bd6eKUwvKEN2yLkbq0S7xBRAwPsFFZan6ixKjuJJqd9G37ti SywTVVGybDBFpiXxOxaZtKbeTC9WFeumL9pdJXBpKp/oTu5jo//u/Fp9l+A9dDl68AvO PY2PWQasX2kqCRtQTuB33FLP/4d4ikKWFnYg5vXXzJuOACivpBWbx77vWJ+slR2QhY5s B5hdnRHeV5bh5/h+5XLG7eEnXGdNTL8FTYXQ97IEh5YBrEGugmUJ8I/aYDaAcW6Kw36t ESDg== X-Forwarded-Encrypted: i=1; AJvYcCXuPo7Bj8/ATpyl3kfs0uluixvlrMYLBPbzbBr72vgLGAUndNbK69aOhpOAJ6ybdM5idK4c8FUhNxlNyI8=@vger.kernel.org X-Gm-Message-State: AOJu0YwWc9xg+IBfuwp8n6DhxOAENtCbaSsc/eBJY4XA3/8uANZONpIZ 0FWSkZu0Nz6oFJZwGsrCOLgjcXewzGXqNQyZjvUMmy4B+je31N7QBRu2yWj00V/PUMQSlnf2V/j z2t17MtB4mA36k47Y9TCJbR2WMWGoiqC7f2sKG0+QuHzS55fPharlzaw/BPMz1Vqf4Kg= X-Gm-Gg: AZuq6aK/V/rinNSx1bAXPpOPYXT0X01XuPCDGRq8wFQOl+5O/vAbMlkoCzYU/lPXL4L WXBKcCpNyHU1dpOZiA6ad/Fp3J6Q+bZZyTJZ1afcjY30lRUfCXT6JeR34g7ihJ3CvJJcX1H0tw/ Hg8xngtMf8bHNRjL2MlMPqyjh8KiR3INaAt6Sb+LXIOod6n+fSgqq1KBuLiUkP86SYaQODsa8/b wVVCxd+Pclev6pkj6XAKTBwMonNcGYV2kOcQEz9rhHzyu18kyReQ1bxKeFE8OO5Btt3ESYR8xeO pBYVmHoqaEB3ZpXcmQ3gLZGZwtopsKSUwONhm8oObfNIQYGlbXdBEEYNQyAKwrtAqyJvmtdldL2 IH4t48gBMqv7VdB7IubxvekBsgUTjrZSD9liOLIGs5rSXXFexZfbLQI6SKzEbcvPWFZM= X-Received: by 2002:a05:620a:178b:b0:8c7:1aea:53b7 with SMTP id af79cd13be357-8ca2f9ce21bmr259795185a.9.1770211787650; Wed, 04 Feb 2026 05:29:47 -0800 (PST) X-Received: by 2002:a05:620a:178b:b0:8c7:1aea:53b7 with SMTP id af79cd13be357-8ca2f9ce21bmr259792985a.9.1770211787189; Wed, 04 Feb 2026 05:29:47 -0800 (PST) Received: from [192.168.119.254] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-65949fd8721sm1123642a12.15.2026.02.04.05.29.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Feb 2026 05:29:46 -0800 (PST) Message-ID: Date: Wed, 4 Feb 2026 14:29:44 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 6/9] usb: misc: qcom_eud: add host mode coordination To: Elson Serrao , Greg Kroah-Hartman , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Souradeep Chowdhury Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260126233830.2193816-1-elson.serrao@oss.qualcomm.com> <20260126233830.2193816-7-elson.serrao@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20260126233830.2193816-7-elson.serrao@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA0MDEwMiBTYWx0ZWRfX6SZGpjZ3vUAt /3zaSxjt2ahagDqQABDw0IoxvzJPyfLifBbZUNuXNdJ8MhqQChbBObKLMO3vfG4hBxZuUzUju/U JA+uV5hOdukGTAFcSsdcHASuAwpu0LJkWtcmxr2OB95fOURj3nzA81tvG3Nl1gqsA36PNouRXb1 wFb977rONzEvbpNCjXG7L5lH2pUu2C4rAo6vKHjcp2oqHk/Yrq1vGt/4qPzt4T5ei/Ol5t7MCd8 /SpnLCVvZJ3MoQCrDMFyaA+vKFRwlnz1TCV1ioIL1ugxhP3/9RGUgLDLJISRn9nbwjLl67WjMh3 sub+YkqfcLgorxw8IzpUS2vAr3FZbyc5Ml0+SuM8LXBfqI1caPZgjWjWtqjJm+sFjPuKbfBUCkh i6K3HGsktyjEMPPAFvAyDUKEd/s0vEgIiPKF4lLRWAl80UpXldTrMydkgitY4UrLA+3/EMmHtiX dJt1suml391KJZZgx4g== X-Proofpoint-GUID: Y1y0mCEAOkMqZWAKxTbiwPt3_g8p8E8Z X-Proofpoint-ORIG-GUID: Y1y0mCEAOkMqZWAKxTbiwPt3_g8p8E8Z X-Authority-Analysis: v=2.4 cv=b42/I9Gx c=1 sm=1 tr=0 ts=698349cc cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=FpWmc02/iXfjRdCD7H54yg==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=q4T-x-_Nixh5at7Gwk8A:9 a=QEXdDO2ut3YA:10 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-04_04,2026-02-04_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 adultscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 spamscore=0 bulkscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602040102 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