get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1288056/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1288056,
    "url": "http://patchwork.ozlabs.org/api/patches/1288056/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200511204146.19176-2-ranjani.sridharan@linux.intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20200511204146.19176-2-ranjani.sridharan@linux.intel.com>",
    "list_archive_url": null,
    "date": "2020-05-11T20:41:44",
    "name": "[1/3] ASoC: SOF: Introduce descriptors for SOF client",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "7ed8945d623854c4514e1e48cb14673fc0329e08",
    "submitter": {
        "id": 78604,
        "url": "http://patchwork.ozlabs.org/api/people/78604/?format=api",
        "name": "Ranjani Sridharan",
        "email": "ranjani.sridharan@linux.intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200511204146.19176-2-ranjani.sridharan@linux.intel.com/mbox/",
    "series": [
        {
            "id": 176214,
            "url": "http://patchwork.ozlabs.org/api/series/176214/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=176214",
            "date": "2020-05-11T20:41:43",
            "name": "Virtual bus usage in the audio driver",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/176214/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1288056/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1288056/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.136; helo=silver.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)",
            "ozlabs.org;\n dmarc=none (p=none dis=none) header.from=linux.intel.com"
        ],
        "Received": [
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49LXt0683Tz9sPF\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 12 May 2020 06:42:00 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 02A0125379;\n\tMon, 11 May 2020 20:41:58 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id Y+9eWeUE0iAm; Mon, 11 May 2020 20:41:52 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 0AAD520385;\n\tMon, 11 May 2020 20:41:52 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n by ash.osuosl.org (Postfix) with ESMTP id 306451BF396\n for <intel-wired-lan@osuosl.org>; Mon, 11 May 2020 20:41:49 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by hemlock.osuosl.org (Postfix) with ESMTP id 2CE5C882AF\n for <intel-wired-lan@osuosl.org>; Mon, 11 May 2020 20:41:49 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id QLivDzUQmVdK for <intel-wired-lan@osuosl.org>;\n Mon, 11 May 2020 20:41:47 +0000 (UTC)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by hemlock.osuosl.org (Postfix) with ESMTPS id 0F96E882B6\n for <intel-wired-lan@osuosl.org>; Mon, 11 May 2020 20:41:47 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 11 May 2020 13:41:46 -0700",
            "from ajgalle-mobl.amr.corp.intel.com (HELO localhost.localdomain)\n ([10.254.179.28])\n by FMSMGA003.fm.intel.com with ESMTP; 11 May 2020 13:41:46 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "IronPort-SDR": [
            "\n vK0GS82tLDyz93yDTlsDEaEORJXdCpY4lNtRF5m0IPFCFu1FgqSjM0COm4XvtbWGsF7ndu6mAs\n b8ht0vHQMLpw==",
            "\n 41AB1vVF69SOxQeo+is6JRf0OoH9+HwdWc113SpfsZzW3VkujtAZ5AMrExU54jiPOFTScFCp17\n +AKO0Mb1pRRg=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.73,381,1583222400\"; d=\"scan'208\";a=\"306281698\"",
        "From": "Ranjani Sridharan <ranjani.sridharan@linux.intel.com>",
        "To": "intel-wired-lan@osuosl.org",
        "Date": "Mon, 11 May 2020 13:41:44 -0700",
        "Message-Id": "<20200511204146.19176-2-ranjani.sridharan@linux.intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200511204146.19176-1-ranjani.sridharan@linux.intel.com>",
        "References": "<20200511204146.19176-1-ranjani.sridharan@linux.intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH 1/3] ASoC: SOF: Introduce descriptors for\n SOF client",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Fred Oh <fred.oh@linux.intel.com>, pierre-louis.bossart@linux.intel.com",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "A client in the SOF (Sound Open Firmware) context is a\ndevice that needs to communicate with the DSP via IPC\nmessages. The SOF core is responsible for serializing the\nIPC messages to the DSP from the different clients. One\nexample of an SOF client would be an IPC test client that\nfloods the DSP with test IPC messages to validate if the\nserialization works as expected. Multi-client support will\nalso add the ability to split the existing audio cards\ninto multiple ones, so as to e.g. to deal with HDMI with a\ndedicated client instead of adding HDMI to all cards.\n\nThis patch introduces descriptors for SOF client driver\nand SOF client device along with APIs for registering\nand unregistering a SOF client driver, sending IPCs from\na client device and accessing the SOF core debugfs root entry.\n\nAlong with this, add a couple of new members to struct\nsnd_sof_dev that will be used for maintaining the list of\nclients.\n\nSigned-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>\nSigned-off-by: Fred Oh <fred.oh@linux.intel.com>\nReviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>\n---\n sound/soc/sof/Kconfig      | 20 +++++++++\n sound/soc/sof/Makefile     |  1 +\n sound/soc/sof/core.c       |  2 +\n sound/soc/sof/sof-client.c | 91 ++++++++++++++++++++++++++++++++++++++\n sound/soc/sof/sof-client.h | 84 +++++++++++++++++++++++++++++++++++\n sound/soc/sof/sof-priv.h   |  6 +++\n 6 files changed, 204 insertions(+)\n create mode 100644 sound/soc/sof/sof-client.c\n create mode 100644 sound/soc/sof/sof-client.h",
    "diff": "diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig\nindex 4dda4b62509f..609989daf85b 100644\n--- a/sound/soc/sof/Kconfig\n+++ b/sound/soc/sof/Kconfig\n@@ -50,6 +50,25 @@ config SND_SOC_SOF_DEBUG_PROBES\n \t  Say Y if you want to enable probes.\n \t  If unsure, select \"N\".\n \n+config SND_SOC_SOF_CLIENT\n+\ttristate\n+\tselect VIRTUAL_BUS\n+\thelp\n+\t  This option is not user-selectable but automagically handled by\n+\t  'select' statements at a higher level\n+\n+config SND_SOC_SOF_CLIENT_SUPPORT\n+\tbool \"SOF enable clients\"\n+\tdepends on SND_SOC_SOF\n+\thelp\n+\t  This adds support for client support with Sound Open Firmware.\n+\t  The SOF driver adds the capability to separate out the debug\n+\t  functionality for IPC tests, probes etc. into separate client\n+\t  devices. This option would also allow adding client devices\n+\t  based on DSP FW capabilities and ACPI/OF device information.\n+\t  Say Y if you want to enable clients with SOF.\n+\t  If unsure select \"N\".\n+\n config SND_SOC_SOF_DEVELOPER_SUPPORT\n \tbool \"SOF developer options support\"\n \tdepends on EXPERT\n@@ -186,6 +205,7 @@ endif ## SND_SOC_SOF_DEVELOPER_SUPPORT\n \n config SND_SOC_SOF\n \ttristate\n+\tselect SND_SOC_SOF_CLIENT if SND_SOC_SOF_CLIENT_SUPPORT\n \tselect SND_SOC_TOPOLOGY\n \tselect SND_SOC_SOF_NOCODEC if SND_SOC_SOF_NOCODEC_SUPPORT\n \thelp\ndiff --git a/sound/soc/sof/Makefile b/sound/soc/sof/Makefile\nindex 05718dfe6cd2..19d996d78468 100644\n--- a/sound/soc/sof/Makefile\n+++ b/sound/soc/sof/Makefile\n@@ -2,6 +2,7 @@\n \n snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\\\n \t\tcontrol.o trace.o utils.o sof-audio.o\n+snd-sof-$(CONFIG_SND_SOC_SOF_CLIENT) += sof-client.o\n snd-sof-$(CONFIG_SND_SOC_SOF_DEBUG_PROBES) += probe.o compress.o\n \n snd-sof-pci-objs := sof-pci-dev.o\ndiff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c\nindex 94a2cb58ab9a..e2880b9264a6 100644\n--- a/sound/soc/sof/core.c\n+++ b/sound/soc/sof/core.c\n@@ -313,8 +313,10 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)\n \tINIT_LIST_HEAD(&sdev->widget_list);\n \tINIT_LIST_HEAD(&sdev->dai_list);\n \tINIT_LIST_HEAD(&sdev->route_list);\n+\tINIT_LIST_HEAD(&sdev->client_list);\n \tspin_lock_init(&sdev->ipc_lock);\n \tspin_lock_init(&sdev->hw_lock);\n+\tmutex_init(&sdev->client_mutex);\n \n \tif (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE))\n \t\tINIT_WORK(&sdev->probe_work, sof_probe_work);\ndiff --git a/sound/soc/sof/sof-client.c b/sound/soc/sof/sof-client.c\nnew file mode 100644\nindex 000000000000..cd1eb81ae6f3\n--- /dev/null\n+++ b/sound/soc/sof/sof-client.c\n@@ -0,0 +1,91 @@\n+// SPDX-License-Identifier: GPL-2.0-only\n+//\n+// Copyright(c) 2020 Intel Corporation. All rights reserved.\n+//\n+// Author: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>\n+//\n+\n+#include <linux/completion.h>\n+#include <linux/debugfs.h>\n+#include <linux/device.h>\n+#include <linux/errno.h>\n+#include <linux/jiffies.h>\n+#include <linux/list.h>\n+#include <linux/mutex.h>\n+#include <linux/module.h>\n+#include <linux/slab.h>\n+#include <linux/virtual_bus.h>\n+#include \"sof-client.h\"\n+#include \"sof-priv.h\"\n+\n+static void sof_client_virtdev_release(struct virtbus_device *vdev)\n+{\n+\tstruct sof_client_dev *cdev = virtbus_dev_to_sof_client_dev(vdev);\n+\n+\tkfree(cdev);\n+}\n+\n+int sof_client_dev_register(struct snd_sof_dev *sdev,\n+\t\t\t    const char *name)\n+{\n+\tstruct sof_client_dev *cdev;\n+\tstruct virtbus_device *vdev;\n+\tunsigned long time, timeout;\n+\tint ret;\n+\n+\tcdev = kzalloc(sizeof(*cdev), GFP_KERNEL);\n+\tif (!cdev)\n+\t\treturn -ENOMEM;\n+\n+\tcdev->sdev = sdev;\n+\tinit_completion(&cdev->probe_complete);\n+\tvdev = &cdev->vdev;\n+\tvdev->name = name;\n+\tvdev->dev.parent = sdev->dev;\n+\tvdev->release = sof_client_virtdev_release;\n+\n+\t/*\n+\t * Register virtbus device for the client.\n+\t * The error path in virtbus_register_device() calls put_device(),\n+\t * which will free cdev in the release callback.\n+\t */\n+\tret = virtbus_register_device(vdev);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\t/* make sure the probe is complete before updating client list */\n+\ttimeout = msecs_to_jiffies(SOF_CLIENT_PROBE_TIMEOUT_MS);\n+\ttime = wait_for_completion_timeout(&cdev->probe_complete, timeout);\n+\tif (!time) {\n+\t\tdev_err(sdev->dev, \"error: probe of virtbus dev %s timed out\\n\",\n+\t\t\tname);\n+\t\tvirtbus_unregister_device(vdev);\n+\t\treturn -ETIMEDOUT;\n+\t}\n+\n+\t/* add to list of SOF client devices */\n+\tmutex_lock(&sdev->client_mutex);\n+\tlist_add(&cdev->list, &sdev->client_list);\n+\tmutex_unlock(&sdev->client_mutex);\n+\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_NS_GPL(sof_client_dev_register, SND_SOC_SOF_CLIENT);\n+\n+int sof_client_ipc_tx_message(struct sof_client_dev *cdev, u32 header,\n+\t\t\t      void *msg_data, size_t msg_bytes,\n+\t\t\t      void *reply_data, size_t reply_bytes)\n+{\n+\treturn sof_ipc_tx_message(cdev->sdev->ipc, header, msg_data, msg_bytes,\n+\t\t\t\t  reply_data, reply_bytes);\n+}\n+EXPORT_SYMBOL_NS_GPL(sof_client_ipc_tx_message, SND_SOC_SOF_CLIENT);\n+\n+struct dentry *sof_client_get_debugfs_root(struct sof_client_dev *cdev)\n+{\n+\treturn cdev->sdev->debugfs_root;\n+}\n+EXPORT_SYMBOL_NS_GPL(sof_client_get_debugfs_root, SND_SOC_SOF_CLIENT);\n+\n+MODULE_AUTHOR(\"Ranjani Sridharan <ranjani.sridharan@linux.intel.com>\");\n+MODULE_LICENSE(\"GPL v2\");\ndiff --git a/sound/soc/sof/sof-client.h b/sound/soc/sof/sof-client.h\nnew file mode 100644\nindex 000000000000..fdc4b1511ffc\n--- /dev/null\n+++ b/sound/soc/sof/sof-client.h\n@@ -0,0 +1,84 @@\n+/* SPDX-License-Identifier: (GPL-2.0-only) */\n+\n+#ifndef __SOUND_SOC_SOF_CLIENT_H\n+#define __SOUND_SOC_SOF_CLIENT_H\n+\n+#include <linux/completion.h>\n+#include <linux/debugfs.h>\n+#include <linux/device.h>\n+#include <linux/device/driver.h>\n+#include <linux/kernel.h>\n+#include <linux/list.h>\n+#include <linux/virtual_bus.h>\n+\n+#define SOF_CLIENT_PROBE_TIMEOUT_MS 2000\n+\n+struct snd_sof_dev;\n+\n+enum sof_client_type {\n+\tSOF_CLIENT_AUDIO,\n+\tSOF_CLIENT_IPC,\n+};\n+\n+/* SOF client device */\n+struct sof_client_dev {\n+\tstruct virtbus_device vdev;\n+\tstruct snd_sof_dev *sdev;\n+\tstruct list_head list;\t/* item in SOF core client drv list */\n+\tstruct completion probe_complete;\n+\tvoid *data;\n+};\n+\n+/* client-specific ops, all optional */\n+struct sof_client_ops {\n+\tint (*client_ipc_rx)(struct sof_client_dev *cdev, u32 msg_cmd);\n+};\n+\n+struct sof_client_drv {\n+\tconst char *name;\n+\tenum sof_client_type type;\n+\tconst struct sof_client_ops ops;\n+\tstruct virtbus_driver virtbus_drv;\n+};\n+\n+#define virtbus_dev_to_sof_client_dev(virtbus_dev) \\\n+\tcontainer_of(virtbus_dev, struct sof_client_dev, vdev)\n+\n+static inline int sof_client_drv_register(struct sof_client_drv *drv)\n+{\n+\treturn virtbus_register_driver(&drv->virtbus_drv);\n+}\n+\n+static inline void sof_client_drv_unregister(struct sof_client_drv *drv)\n+{\n+\tvirtbus_unregister_driver(&drv->virtbus_drv);\n+}\n+\n+int sof_client_dev_register(struct snd_sof_dev *sdev,\n+\t\t\t    const char *name);\n+\n+static inline void sof_client_dev_unregister(struct sof_client_dev *cdev)\n+{\n+\tvirtbus_unregister_device(&cdev->vdev);\n+}\n+\n+int sof_client_ipc_tx_message(struct sof_client_dev *cdev, u32 header,\n+\t\t\t      void *msg_data, size_t msg_bytes,\n+\t\t\t      void *reply_data, size_t reply_bytes);\n+\n+struct dentry *sof_client_get_debugfs_root(struct sof_client_dev *cdev);\n+\n+/**\n+ * module_sof_client_driver() - Helper macro for registering an SOF Client\n+ * driver\n+ * @__sof_client_driver: SOF client driver struct\n+ *\n+ * Helper macro for SOF client drivers which do not do anything special in\n+ * module init/exit. This eliminates a lot of boilerplate. Each module may only\n+ * use this macro once, and calling it replaces module_init() and module_exit()\n+ */\n+#define module_sof_client_driver(__sof_client_driver) \\\n+\tmodule_driver(__sof_client_driver, sof_client_drv_register, \\\n+\t\t\tsof_client_drv_unregister)\n+\n+#endif\ndiff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h\nindex 71a3a61d3e67..bf16809539a8 100644\n--- a/sound/soc/sof/sof-priv.h\n+++ b/sound/soc/sof/sof-priv.h\n@@ -441,6 +441,12 @@ struct snd_sof_dev {\n \n \tbool msi_enabled;\n \n+\t/* list of client devices */\n+\tstruct list_head client_list;\n+\n+\t/* mutex to protect client list */\n+\tstruct mutex client_mutex;\n+\n \tvoid *private;\t\t\t/* core does not touch this */\n };\n \n",
    "prefixes": [
        "1/3"
    ]
}