Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp326279rdb; Wed, 17 Jan 2024 03:19:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFE1rn3ts7V0LktPTW895u1+y9c/egKXPQ1rr2MmAGvpL5ybH/nR9D8cb91jz4OHcxl/amo X-Received: by 2002:a17:906:6582:b0:a2c:a0dd:a9d1 with SMTP id x2-20020a170906658200b00a2ca0dda9d1mr588079ejn.24.1705490384174; Wed, 17 Jan 2024 03:19:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705490384; cv=pass; d=google.com; s=arc-20160816; b=JuPB5jb0nTDgzcm0baOoa4pkijTpuFfHkuzrSpfmdSsCvwQsshVw0HhyGsLQprDvnT 3X9V1muJOD3eQztRzIslKW/lEhmX0TpVdGyq+LpfMpmulPN462enZaqg16BcmsKQ1Z6r U6h7y8ur67z/JJxC44hJhuJlPDD02JWXx/vK7FKNf8Af56UYv8idM2nGNNh9i4Ww1i3S mJy/eOSAaWh7RPTi3DcQIzgHcxLInKAEkAFj6M7WA5fR5ad9g584bzdD9XbluedDHiYq /f5D9Le05KmcNIR0C4y1m3//UkVAmYpzZuBs109Hc5zh2kHbZcioLOY/k46+ya6cE1QX X4pw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OaVpQxU9tuOaCurGuNd34rO9GrjjPTEuMDV5HDmI4uI=; fh=iDuPPILtdHdmOuKlSxueiz+GUAQuqf60Mt8K0fhQmHg=; b=yn+To4z3AFpOWxKutBo4sqNhuknEE0d0pHjPMp/qgS9QIdoR0mvoFNVQs4IRsOGI1H lQDi+aitPj9F+VCC0yX8a+hFRKOc35yNbQ+ANLCLjoSO1vAUsUw3tbuX0nG0QoLO7ybh 5lJVEsA5VaTsFMMyRuACCK6DuZtmXNqZlL1XayR4VmmF4op2fl+qwmQJlrKO18cM9py4 s12xxkX7fzw7b1Av9N2zg/tTqCzcrs+R5ohLVCx5VfFvib6BTURJWjkup3mTLlLfUt7G Yy8EaM+J6rbFeXNmPKpVzBhrdoxttHSPDlMf7qIMo+Bso255U+9ZFlSrBv8nYuZ+TSEf rRgQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dolcini.it header.s=default header.b=yLzhjQc6; arc=pass (i=1 spf=pass spfdomain=dolcini.it dkim=pass dkdomain=dolcini.it dmarc=pass fromdomain=dolcini.it); spf=pass (google.com: domain of linux-bluetooth+bounces-1165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dolcini.it Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fi10-20020a170906da0a00b00a2adba36504si5657688ejb.927.2024.01.17.03.19.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 03:19:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@dolcini.it header.s=default header.b=yLzhjQc6; arc=pass (i=1 spf=pass spfdomain=dolcini.it dkim=pass dkdomain=dolcini.it dmarc=pass fromdomain=dolcini.it); spf=pass (google.com: domain of linux-bluetooth+bounces-1165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dolcini.it Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E45B61F24273 for ; Wed, 17 Jan 2024 11:19:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CC4A1DDD5; Wed, 17 Jan 2024 11:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dolcini.it header.i=@dolcini.it header.b="yLzhjQc6" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B030314009; Wed, 17 Jan 2024 11:19:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.194.8.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705490378; cv=none; b=d0sWoRSBWJVe3AkelyKytK26Is7XOoVGUcfH1k8844x7EPUqQmmhUC+HuHCJnRbnMnPYqVgUc4beIw5AcNa60PFxU6HxY5wKbQwsCVTK5tS3K2Ti2e35ttPdOOA4EkqDaHwvFElqOcnPBcg6jVj6DANhXVce6Utfqhg6pF3FAo8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705490378; c=relaxed/simple; bh=DFR5q08xfazOTnbgRWb+uSdJGoNugFRnE0ltvreNM8I=; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=lSvSCCABy1hy2TrmAqqk+hXD3ezMEkmXFXqrOzmCcgZOrVZ5DQng0VVS+VhXRzgtDm6XM1hcOXL6oKXnlHRPuYWAPBSXvUssRNZ1Q5J34ZbpfX8DWIFXVVATDd/DdW0cmGg0rHN89LU/6m+p4HrLU3JS9abJb/84PFy6ZR9QEdM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dolcini.it; spf=pass smtp.mailfrom=dolcini.it; dkim=pass (2048-bit key) header.d=dolcini.it header.i=@dolcini.it header.b=yLzhjQc6; arc=none smtp.client-ip=217.194.8.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dolcini.it Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dolcini.it Received: from francesco-nb (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 493CB2033B; Wed, 17 Jan 2024 12:19:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1705490372; bh=OaVpQxU9tuOaCurGuNd34rO9GrjjPTEuMDV5HDmI4uI=; h=From:To:Subject; b=yLzhjQc6AlHnKFBwuXI8+/2I56RJjxUp9P3H4clkgSJrEHOyzbyRlrMZ/WVP2ih+V CNG7IQF3HswUZNZAqAmFUOX6zOBCbsQh0rMJOxkmFen3XDzQBkkgKH0ZoKeohzyztk 4jIcyHUcSg4QTtmtzw1qZrIrJ2Fb7KMPWrus0qdGBYSAW8gbxGynYkVFU4fLqqB9y4 XZBtNo8hc5i34koCK6ZRF7G5lTbb8LtnhqN3DwqTkwmbR/7a1SktrdRKiW1bAGe/LW vWSCXDX8NivPnubWa3oNX1aWXsB1eR5IxeYpfdszmn5grclUdmRPp9rHf6xH+wFAyp EKfM0fCuK1qwg== Date: Wed, 17 Jan 2024 12:19:27 +0100 From: Francesco Dolcini To: Neeraj Sanjay Kale Cc: Francesco Dolcini , "marcel@holtmann.org" , "johan.hedberg@gmail.com" , "luiz.dentz@gmail.com" , Marcel Ziswiler , Amitkumar Karwar , "linux-bluetooth@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Sherry Sun , Rohit Fule Subject: Re: [RFC PATCH] Bluetooth: btnxpuart: Fix nxp_setup in case chip is powered on late Message-ID: <20240117111927.GA8616@francesco-nb> References: <20240117030501.149114-1-neeraj.sanjaykale@nxp.com> <20240117090932.GA3787@francesco-nb> <20240117104917.GA6138@francesco-nb> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Jan 17, 2024 at 11:11:44AM +0000, Neeraj Sanjay Kale wrote: > > > Here, the driver probe registers an hci interface > > > (hci_register_dev()), and returns success to kernel. > > > > > > The hci_register_dev() queues hdev->power_on work at the end, which > > > opens the hci dev, and ultimately calls this setup function. > > > > > > In this patch, we are queueing the same work from the delayed > > > setup_retry_work(). > > > > > > Returning -ENODEV (or -EPROBE_DEFER) would only affect hci_dev_open(), > > > which is in power_on work context, and not driver probe context. > > > > > > Perhaps, we should call it hci_retry_power_on() work or something > > > similar? > > > > > > Please let me know your thoughts on this. > > > > Do you see any way to get rid of this complexity? Maybe having this check > > done during probe, deferring there till we know the device is in a suitable > > state (e.g. either you received the bootloader signature, you know the device > > is powered or that the firmware is loaded and ready?). > > > > In other words returning EPROBE_DEFER before calling hci_register_dev()? > > > Unfortunately no. To read any bootloader signatures, or read CTS line, > we need serdev device opened, which is done only after > hci_register_dev() -> power_on work -> hci_dev_open()->serdev_open(). Ok, thanks, it makes sense and it's clear. > We could simplify this by only returning -ENODEV, without the > delayed_work handling, but then user would have to remove and > re-insert the btnxpuart driver after mwifiex driver is loaded > successfully. > > This may not seam like a user-friendly approach. I think that something like that is pretty much useless, manual reloading is already possible, and this can also be solved "artificially" serializing loading the wifi driver and the bt one (the latter is what we are currently doing to overcome this limitation). Francesco