From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC13EC433EF for ; Thu, 30 Jun 2022 18:13:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236483AbiF3SNR (ORCPT ); Thu, 30 Jun 2022 14:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232771AbiF3SNP (ORCPT ); Thu, 30 Jun 2022 14:13:15 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9707810E0; Thu, 30 Jun 2022 11:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1656612794; x=1688148794; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=PEKZxYZlf0wcPMg3FnbHkkbDO5CYIxcaK6zhZdRvs6E=; b=CVcEjdAD/stI+71OPiaOFw3053D9mP5f9gO0aqBcMXKC330nm6L1gjwe 1MnAXeANF1MGjwhPhfUWJ6xFBktg+LwipR7q7Fc/AudYqOUAevrwesELO EOrUCgWBNgbRHbkI9pGspZhZebF47Qm4ufKMVZ04M2NPx57zM9sXTl+Sr s=; Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 30 Jun 2022 11:13:12 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2022 11:13:11 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 30 Jun 2022 11:13:11 -0700 Received: from [10.216.41.79] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 30 Jun 2022 11:13:05 -0700 Message-ID: Date: Thu, 30 Jun 2022 23:43:01 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v20 2/5] usb: dwc3: core: Host wake up support from system suspend Content-Language: en-US To: Stephen Boyd , Pavan Kondeti CC: Bjorn Andersson , Felipe Balbi , Matthias Kaehlcke , Krzysztof Kozlowski , Rob Herring , "Andy Gross" , Greg Kroah-Hartman , Doug Anderson , Mathias Nyman , , , , , , , References: <1654158277-12921-1-git-send-email-quic_kriskura@quicinc.com> <20220616091110.GA24114@hu-pkondeti-hyd.qualcomm.com> <20220620085415.GA13744@hu-pkondeti-hyd.qualcomm.com> <20220628053148.GA21797@hu-pkondeti-hyd.qualcomm.com> From: Krishna Kurapati PSSNV In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/30/2022 3:45 AM, Stephen Boyd wrote: > Quoting Pavan Kondeti (2022-06-27 22:31:48) >> On Mon, Jun 27, 2022 at 01:02:49PM -0700, Stephen Boyd wrote: >>> Quoting Pavan Kondeti (2022-06-20 01:54:15) >>>> Would like to hear other people thoughts on this. >>>> >>> I'm not following very closely but it sounds like a problem that may be >>> solved by using the component driver code (see >>> include/linux/component.h). That would let you move anything that needs >>> to be done once the child devices probe to the aggregate driver 'bind' >>> function (see struct component_master_ops::bind). >> Thanks Stephen for letting us know about the component device framework. >> >> IIUC, >> >> - dwc3-qcom (parent of the dwc3 core) registers as a component master by >> calling component_master_add_with_match() before calling >> of_platform_populate(). The match callback could be as simple as comparing >> the device against our child device. >> >> - The dwc3 core (child) at the end of its probe can add as a component by calling >> component_add(). >> >> - The above triggers the component_master_ops::bind callback implemented in >> dwc3-qcom driver which signals that we are good to go. >> >> - The dwc-qcom can call component_bind_all() to finish the formality i.e >> telling the dwc3 core that we are good to go. >> >> Is my understanding correct? This is what we are looking for i.e a way for >> the child device(s) to signal the parent when the former is bounded. > Sounds about right to me. > >> Also what happens when the child device probe fails for any reason. i.e >> component_add() would never be called so the master driver i.e dwc3-qcom would >> wait indefinitely. May be it needs to implement a timeout or runtime suspend >> etc should take care of keeping the resoures in suspend state. > When the child fails probe, it should return -EPROBE_DEFER if probe > needs to be deferred. Then the driver will attempt probe at a later > time. If probe fails without defer then it will never work and dwc3-qcom > will wait indefinitely. Not much we can do in that situation. Hi Stephen,   Thanks for the idea. But doesn't adding dwc3 as a component to an agg driver meanthat this change needs to be done on all glue drivers, as component_bind_all( ) from master componentis supposed to let the dwc3 core know that we are good to go ? > dwc3-qcom should wait for dwc3 core to call component_add() and then do > whatever needs to be done once the dwc3 core is registered in the > dwc3-qcom bind callback. Honestly this may all be a little overkill if > there's only two drivers here, dwc3-qcom and dwc3 core. It could > probably just be some callback from dwc3 core at the end of probe that > calls some function in dwc3-qcom. Since the issue we are facing is that the ssphy device links are not ready causing the dwc3 probe not being invoked, can we add an API as Pavan suggested to check if deferred_probe listfor dwc3 device is empty or not andbased on that we can choose to defer our qcomprobe ? In this case, we don't need to touch the dwc3 core driver and would be making changesonly in qcom glue driver.