From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 9A6BA13BC0C for ; Tue, 21 Jan 2025 16:49:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737478157; cv=none; b=cq6osxFgruMfY7icRgKJOtCJ2mGvT7Z9k5UD0Ho2dTSK+kagHnNMp4jq8Cgi0LzjPTqDzMIf/7MK4f4yEelY3N8uEGjhmLuEQtkMHCtsM198lWZ7vzh3iebpK7DpC66c8VdGSOQklwLUyia1dXCQd8JcvhAMipyH6iO4Jb7NE2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737478157; c=relaxed/simple; bh=1By0wkw+dzUshvLJIh5rsJlTZ+ltYvC4hpRJFhieX18=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SXf9hMrgH+tcuBTWWk2ans9KH0X+bTXCqbLEt8iCOgxKfgw9F1xVOec2IcQDulHKVSatYkkVJe3xz+awAWtTdnjMxQnVAccQSI1q9eO9XmFJdFAa9QLSWtgeUKUsy2G7TqeAjkAKIX7J+wdaVz6Uc6WwJgHRU07VXjMG58+iUrs= 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=U9fSo8rQ; arc=none smtp.client-ip=205.220.168.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="U9fSo8rQ" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50LA3dZA017109 for ; Tue, 21 Jan 2025 16:49:14 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= X0Q/MFqhVulggWVInWU+fumi1mnX/CUvTS/GmzvH12Y=; b=U9fSo8rQHjNZ4hhh 1cGpVM7AULuoI2nbNabOO+HBA5DcfikH80/Bx58l6wXEkeNBk/UVtNnl+rpuwy4E AKzWskCvMkli/RYedYBVkGynfUXF/2nBIR6xeXJYKb4xJ6BMG4gi1Y76na0D0ZHY qGYug/ogqwcJhJ7F2NC+DiCIwL7AklGUtq6PKdmj0fvTynMADrnpc//TtDS1QwS/ znrcmlQObfygYPjWERt0nY6xV0G6rCnpq+20eRfBWHUZ2PzkizhD/6kKXlj7OGaj qOlGNB9GFdgf3a6kACHkOnxKT9jIkGVI9TLKyVXngPDii39p71DX8r6V+EW/uSG+ ODvufw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44a9gcs4nc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 16:49:14 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-21632eacb31so78176195ad.0 for ; Tue, 21 Jan 2025 08:49:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737478154; x=1738082954; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=X0Q/MFqhVulggWVInWU+fumi1mnX/CUvTS/GmzvH12Y=; b=sliov1C/bG/tJSo6hyFwY+nZmg9cAa0D5hSyH+DbVuaq8WoVAznoYyYfOp3sNLT4am 9a/QfhXyCzYZH8D20PcctF/5g3e9UZzg8ydab/M6WWhqJlFQq/mYHfPR8GMDQ8zrfphS UUaSTUsUNXLeo5XsgZAc/G0K8eKl0pANraQf6GWdlrjH0xZzqp96vGWfpV+mJhqZPcve C7UrLn2mIlaAqIlO5awtiYPx17iqUIfgq3+xwcINlMRmKv8CHlN76pjS6PZ4lr0IrBHl GhmDx6M98Z4IuACQ2/58vqmQcAzCTWTcOS1VaIAltf2VeUAe6pnchUtJGhaYvNGJLIol 4kUg== X-Forwarded-Encrypted: i=1; AJvYcCUO267M6JEMtwnpAvaryifRmF64BxBFh7IlQyUuar9tbgz4tLzUb13BhMzl5rtx2awo6hY6hpVKxdmJxGM=@vger.kernel.org X-Gm-Message-State: AOJu0YwdfH7dW1tOFq+zZikHpHtokOvMKNlwSfMVrubcSjUKJU5HdpDi em/Q4pWWuauveBVVffWqBJL6bgynTtb0dv6d5FrqZtCqhiUy9waryl8W5rqWaDzOFxb3W2fKRRN D+FngzeGbfDHRAYmrf1IzQJwBzZEDOTAeVzu1bOTJE+pZycuwjuwW/ro3inFceoo= X-Gm-Gg: ASbGnctRDL+QKV0PzeqR01KYZtrzjlcTO2pRnm6uw6bvMSm9GO+qu/zWbqZB4zi4bk6 xsQmCthBsSg5pC6sui0ccnrx6EDSlIP/1V0ziudOCUavjZhWeFW8zb/4L+3q4lD+ywQFfnQNAcb ztHJ5feHIu/pu560f1A2LxmJoLoF6UX5j4TmnX5zCtCxCa/MhxeNaNRqMQZvVfle75Sf2Vo3w1T rZ4GkSfl+ekxUWZIHcsUYOl0D3N9rO96MIZtNW1d6YurS9HjBiuRLOSzkUMkRf4QYxT1yf4YP9n Q8yV8MmkAeYsVcBdHqg8 X-Received: by 2002:a05:6a20:431c:b0:1e5:c43f:f36d with SMTP id adf61e73a8af0-1eb214983d0mr32096440637.18.1737478153661; Tue, 21 Jan 2025 08:49:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGK+10QZD8bhtsNoLF/s8bl0A0mZrtsRYjogaxzR5PSerPRw4ABtJcMzE+8Su4kjIZzNS0YtA== X-Received: by 2002:a05:6a20:431c:b0:1e5:c43f:f36d with SMTP id adf61e73a8af0-1eb214983d0mr32096402637.18.1737478153251; Tue, 21 Jan 2025 08:49:13 -0800 (PST) Received: from [192.168.29.15] ([49.37.131.186]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72dab7f2e73sm9314735b3a.32.2025.01.21.08.49.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Jan 2025 08:49:12 -0800 (PST) Message-ID: Date: Tue, 21 Jan 2025 22:19:08 +0530 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] usb: gadget: Increase the limit of USB_GADGET_VBUS_DRAW to 900mA To: Alan Stern Cc: Greg Kroah-Hartman , Simona Vetter , Takashi Iwai , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20250120111702.3738161-1-prashanth.k@oss.qualcomm.com> <894f42a7-50a5-401e-a705-a06eafd6161d@rowland.harvard.edu> <1b1587e8-5c38-4138-a27a-1de71ff07ce3@oss.qualcomm.com> Content-Language: en-US From: Prashanth K In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: RPxHfK6ZQ9h2CAkdUxh3dH70CYM8dopO X-Proofpoint-ORIG-GUID: RPxHfK6ZQ9h2CAkdUxh3dH70CYM8dopO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_07,2025-01-21_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 lowpriorityscore=1 suspectscore=0 phishscore=0 spamscore=0 mlxscore=0 bulkscore=1 clxscore=1015 adultscore=0 priorityscore=1501 mlxlogscore=606 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501210136 On 21-01-25 08:36 pm, Alan Stern wrote: > On Tue, Jan 21, 2025 at 09:50:08AM +0530, Prashanth K wrote: >> >> >> On 20-01-25 08:17 pm, Alan Stern wrote: >>> On Mon, Jan 20, 2025 at 04:47:02PM +0530, Prashanth K wrote: >>>> Currently CONFIG_USB_GADGET_VBUS_DRAW limits the maximum current >>>> drawn from Vbus to be up to 500mA. However USB gadget operating >>>> in SuperSpeed or higher can draw up to 900mA. Also, MaxPower in >>>> ConfigFS takes its default value from this config. Hence increase >>>> the allowed range of CONFIG_USB_GADGET_VBUS_DRAW to 900mA. >>> >>> Is this the sort of thing that really needs to be a Kconfig option? Why >>> not make the decision at runtime, based on the needs of the gadget or >>> function drivers and the connection speed? >>> >>> Alan Stern >>> >> >> Right, set_config() in composite.c does this in runtime based on the >> values of MaxPower (from configFS), VBUS_DRAW defconfig and speed. >> If we don't set MaxPower from configFS, this config helps to set it >> during compile time. In fact MaxPower in configFS takes its default >> value from CONFIG_USB_GADGET_VBUS_DRAW . Sent this patch because Kconfig >> has this limitation where it's only allowing values upto 500mA. > > Why does MaxPower need to be set at compile time? Why not set it at > runtime instead? > > If MaxPower gets set at runtime then it can take its default value to be > 500 mA or 900 mA depending on the connection speed. There will be no > need for CONFIG_USB_GAGDGET_VBUS_DRAW. > Yes, agreed. Can we mark CONFIG_USB_GAGDGET_VBUS_DRAW as legacy and maybe also avoid configfs/composite from using it? > You are trying to improve a compile-time limitation on a quantity which > isn't known until runtime. The whole idea of doing it that way is > fundamentally wrong. You shouldn't try to improve it a little, you > should fix the basic mistake by doing everything at runtime. > > Alan Stern > Regards, Prashanth K