Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5538979ybl; Tue, 10 Dec 2019 07:38:32 -0800 (PST) X-Google-Smtp-Source: APXvYqzBaF2I7PLG0u2AXuQimajxy35jZnUslY/BPP8Ya/mf0XrzXVQ9WglcIMpAWzkudW6P8rJ1 X-Received: by 2002:aca:917:: with SMTP id 23mr4302762oij.178.1575992312335; Tue, 10 Dec 2019 07:38:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575992312; cv=none; d=google.com; s=arc-20160816; b=1ARmXLlV/DvJ/Nzg0Sn1m/L3ku86Om+6spL3fmG7uK+jx2F7a/xCqnihBN/LOUVwCi 67sXrD9sZfybu75NDB5B0hlY7/BtG5AHCttKQxYpZlzy2kHpyCAt6YM0u4/zDI9oP0XC Pjb9qMSUUt6ZN+UU9ds6ivGBeywvzSZpRPX6YQzzHJ8fxf5GjEU3i3qRkdqdBYGIQtjw rqYEEnY99m271Kojf7oXDaK0ooSXYMV6JCET3QSsygg9r7n7OV/bhzdmF9MKSQLpmuQE d8WhZJaTEPC1El79IppIzT+LRUoXXgh3IlL8HuS4DSMWxlhU5SQS3pt+inD+JjYqpX+7 nYNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=de6mNOOwMOAEWeDGVvnI/M5bFc0CAPc63osF6qFct/A=; b=FLbTGeOOwsU4P85cIabrnuc1kZz6jAWVSOYFjcikATY9bTaZba287trb/vSGz5wHRx 5pB2h1KNcXlzkDQJBHvd+DtAjxV3dn9HyaH8F6RBOiyJhRNnsfx+4xYwlnKlV+EmM71Z btEnFi9d8E+PTrULZ8mlGKa0488qVATydk37u0z7b1gjSKbcHCIj5+UKOqcbaRQ8FNqS jecDNRCX2aC5ghMayPqfbnEPrWZRxZPrJBeJzLZkQ/wIn4/iw2TSdKq/eUb6kl+Px/BL c+vxRUhpalgx2gvgjyr+a6K1+muZ+V2wvl3bb1lP09oR+uZVM6Fl4sHQE+ZUJ1AVwUVE 5blw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=bE8Cvb50; 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=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u125si2020563oif.130.2019.12.10.07.38.19; Tue, 10 Dec 2019 07:38:32 -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; dkim=pass header.i=@synopsys.com header.s=mail header.b=bE8Cvb50; 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=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727637AbfLJPhm (ORCPT + 99 others); Tue, 10 Dec 2019 10:37:42 -0500 Received: from sv2-smtprelay2.synopsys.com ([149.117.73.133]:53730 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727411AbfLJPhk (ORCPT ); Tue, 10 Dec 2019 10:37:40 -0500 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 21414405E0; Tue, 10 Dec 2019 15:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1575992259; bh=fYuY0lyYqVPq+/KbacWe8P4uzxJ1IsIgZmjZKUwsUeo=; h=From:To:Cc:Subject:Date:From; b=bE8Cvb50ctNvJTv8ONaR0ziSsoWGdFlr4d0SeLDUx/4mQ3Ilmc5iXrEYAVNHQweog p0ntUaFjRp3ft9wkJBVkxMzPvKz1pqYRgkufGMWCbwkZ9NXYahiIGpJUYSEa3MsLx5 dXAhg+bRyviaj8e27S+X92G+9Q3jKys2PYiITdTiX0HQ63AicK680Y+8jUXtxAFKul oacBoagqV0+wbwg8wsOdPqTzbe5npiUcD5GcOqmPRsHc2Ac9zunPWnadZFIzVBlCQQ tmG3QQSpw2xQzKKbchFJCgFdqQjK6/qaSkL3MQ5S2K0ZlawvtAmMx+VBOOHguMzItY UcK9HmM5/MldA== Received: from de02.synopsys.com (de02.internal.synopsys.com [10.225.17.21]) by mailhost.synopsys.com (Postfix) with ESMTP id 9AAA5A005D; Tue, 10 Dec 2019 15:37:36 +0000 (UTC) Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by de02.synopsys.com (Postfix) with ESMTP id 691303E2CC; Tue, 10 Dec 2019 16:37:36 +0100 (CET) From: Vitor Soares To: linux-kernel@vger.kernel.org, linux-i3c@lists.infradead.org Cc: Joao.Pinto@synopsys.com, bbrezillon@kernel.org, gregkh@linuxfoundation.org, wsa@the-dreams.de, arnd@arndb.de, broonie@kernel.org, Vitor Soares Subject: [RFC 0/5] Introduce i3c device userspace interface Date: Tue, 10 Dec 2019 16:37:28 +0100 Message-Id: X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. - For now, the module exposes i3c devices without device driver on dev/i3c--, but we can change the path to dev/bus/i3c/- or dev/i3c/-. - As in the i2c subsystem, here it is exposed the i3c_priv_xfer to userspace. I tried to use a dedicated structure as in spidev but I don't see any obvious advantage. - Since the i3c API only exposes i3c_priv_xfer to devices, for now, the module just makes use of one ioctl(). This can change in the future with the introduction hdr commands or by the need of exposing some CCC commands to the device API (private contract between master-slave). Regarding the i3c device info, some information is already available through sysfs. We can add more device attributes to expose more information or add a dedicated ioctl() request for that purpose or both. - Similar to i2c, I have also created a tool that you can find in [2] for testing purposes. If you have some time available I would appreciate your feedback about it as well. [1] https://lkml.org/lkml/2018/11/15/853 [2] https://github.com/vitor-soares-snps/i3c-tools.git Vitor Soares (5): i3c: master: export i3c_masterdev_type i3c: master: export i3c_bus_type symbol i3c: device: expose transfer strutures to uapi i3c: master: add i3c_for_each_dev helper i3c: add i3cdev module to expose i3c dev in /dev drivers/i3c/Kconfig | 15 ++ drivers/i3c/Makefile | 1 + drivers/i3c/i3cdev.c | 438 ++++++++++++++++++++++++++++++++++++++++ drivers/i3c/internals.h | 2 + drivers/i3c/master.c | 16 +- include/linux/i3c/device.h | 54 +---- include/uapi/linux/i3c/device.h | 66 ++++++ include/uapi/linux/i3c/i3cdev.h | 27 +++ 8 files changed, 565 insertions(+), 54 deletions(-) create mode 100644 drivers/i3c/i3cdev.c create mode 100644 include/uapi/linux/i3c/device.h create mode 100644 include/uapi/linux/i3c/i3cdev.h -- 2.7.4