Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4888555ybv; Mon, 17 Feb 2020 07:52:54 -0800 (PST) X-Google-Smtp-Source: APXvYqzI1wqMochwwxoSWVQmmrSmtn0Uzpj0xcmbfgixvYEU/UJ6gxmTpUT1FiqeyUfZQp1PhMZD X-Received: by 2002:a05:6830:4b9:: with SMTP id l25mr13003135otd.266.1581954774126; Mon, 17 Feb 2020 07:52:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581954774; cv=none; d=google.com; s=arc-20160816; b=nROQZjLmn9Fk22xAB1y+7ule4XzUELcHHh0GKyFVaQWRy13gpZZLypCAQIcO4l3TAl l1yjp1Q9/P/wB30H6WfzTqgvgvebaM/lPo0cU4UMEIK5NtdE/hO40eadW2mUj3M3ztaS aJiSdoDC24GO9+Usx4kC5fLNVPHrg81m5bPVqVISlqIcXSA3Z7LkF9oGCZWDOU3znLOL e5Hc11yZ/n3lIkYuvy2125/eE0joHIA0NQmz+CnnjmWKpRMYW7xCVMeHX4pyd9CTvhBO gEL0KgfN6cOYzw/533vTg+BOR0i61l2et+38e8eUeXX8WuImJlr5pq4WdENBeJDx4yVS kaKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=g/Q/t/UtK7d6l7b2lEejgrmUWY9IR4eAhsVyc7VVcjU=; b=LTzWTyqkWG3x/Ni4THDWQnXLWQqorYxGspzhZfUH4KTxV4Nn302wIyY9piQnpOBvC2 zSD+SBikMBcZndckTPRpXlczk7s3metRWxafl6XOa8cfe9s4dSFo0XoLnYHsL1eA3CP+ HLmQyfEjwPJdtez1IxekzQMRbD90Sro21Bg4TCwcdVJM1xZ+qAByJPd6NKzVHjpCCbI9 8JgLmZXjjTdtr5lV87pONMCWaEOgkQEI4Fz5Fgo67/nIJ//ml4Eu8v0AQvwhkUGBFdU1 8wdQML7ze/+2yiaErqpt7sVU1JxHynvROkZnHqHmsDtkzQUFz4DrVfpRgr+ctTWfE94E vOVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s18si6532778oij.84.2020.02.17.07.52.41; Mon, 17 Feb 2020 07:52:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729453AbgBQPwK (ORCPT + 99 others); Mon, 17 Feb 2020 10:52:10 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:41878 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727553AbgBQPwK (ORCPT ); Mon, 17 Feb 2020 10:52:10 -0500 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 1FA3F293C88; Mon, 17 Feb 2020 15:52:08 +0000 (GMT) Date: Mon, 17 Feb 2020 16:52:04 +0100 From: Boris Brezillon To: Vitor Soares Cc: "linux-kernel@vger.kernel.org" , "linux-i3c@lists.infradead.org" , Jose Abreu , Joao Pinto , "arnd@arndb.de" , "wsa@the-dreams.de" , "gregkh@linuxfoundation.org" , "bbrezillon@kernel.org" , "broonie@kernel.org" Subject: Re: [RFC v2 0/4] Introduce i3c device userspace interface Message-ID: <20200217165204.7f2d2774@collabora.com> In-Reply-To: References: <20200217155141.08e87b3f@collabora.com> Organization: Collabora X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Feb 2020 15:32:55 +0000 Vitor Soares wrote: > Hi Boris, > > From: Boris Brezillon > Date: Mon, Feb 17, 2020 at 14:51:41 > > > Hello Vitor, > > > > Sorry for taking so long to reply, and thanks for working on that topic. > > > > On Wed, 29 Jan 2020 13:17:31 +0100 > > Vitor Soares wrote: > > > > > For today there is no way to use i3c devices from user space and > > > the introduction of such API will help developers during the i3c device > > > or i3c host controllers development. > > > > > > The i3cdev module is highly based on i2c-dev and yet I tried to address > > > the concerns raised in [1]. > > > > > > NOTES: > > > - The i3cdev dynamically request an unused major number. > > > > > > - The i3c devices are dynamically exposed/removed from dev/ folder based > > > on if they have a device driver bound to it. > > > > May I ask why you need to automatically bind devices to the i3cdev > > driver when they don't have a driver matching the device id > > loaded/compiled-in? If we get the i3c subsystem to generate proper > > uevents we should be able to load the i3cdev module and bind the device > > to this driver using a udev rule. > > My idea was to expose every device to user-space by default so we can > test them without a driver (more or less the i2c use case) but as we > agreed during the i3c subsystem only expose devices that doesn't have > device driver. Those that do not have a driver *yet*. What if i3cdev is compiled-in and other I3C drivers are enabled as modules? When the device is discovered at boot time is will be automatically bound to the i3cdev driver since no matching drivers are available at that point. But the end user probably expects this device to be attached to the in kernel driver. > I considered to have a uevent but to expose the devices by default it > would required something generic, what I didn't figure out and tend to > follow the i2c-dev module. Well, I3C and I2C/SPI are quite different in this regard. I2C dev exposes the whole bus, and SPI devs don't have a standard way to uniquely identify the device connected on the bus (unless it has a dedicated compatible for DT-based boards). In that case it might make sense to auto-bind all orphan devs to the default spidev driver, though I'm not entirely sure it's really necessary since that's probably a per-board decision, and having a udev rule matching the bus/CS would make sense too. > > With this current approach even if a device has a driver we can unbind it > through the Sysfs and have access from user space which I found useful > for debug. That's my point. We're making the default 'on-demand driver loading' use case more complicated to ease the less common 'userspace driver' use case.