From patchwork Wed Apr 20 09:41:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=cjz6aTJM; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KjwgD3psnz9sG0 for ; Wed, 20 Apr 2022 19:42:00 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qQ-0005H5-Ns; Wed, 20 Apr 2022 09:41:54 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qN-0005Fh-99 for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:41:51 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 2FA883F658 for ; Wed, 20 Apr 2022 09:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447711; bh=3regeHdLJLpcH2PaFis8JX8z36+CJG4IXD+HtxyIvuk=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cjz6aTJMy5TNCoou7rqxrvsRn2TLnwvYZt9+sJjSnC8ymdtEsncNV5EWUJP5h1Ugf 7Dgz8fiTtz7+KdF8FttxWebHv8fi34h1Z4IS9qypdgmBzRh9hiy4cSleytDw9Um+7i 6usa4dBT9AnwlZlmhGrEiqG4gaQY95ur32QxMXApwAU9niR3rLhUzKO6yMFZcPTRi8 cC0gXANimdibZrP2G9Bq6dHNu88z81s5baUi0V7Wt2gh9/nRNkRl4CAODsYIhe2m/C jLbXQajdpSZDvdFJsKKUbozKK8QNIc7iT3Qvy+2EqWJ4ZEloukR2tGognp11Fmym2l zZNn9YNEGzkOw== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 01/10] spi: Make spi_alloc_device and spi_add_device public again Date: Wed, 20 Apr 2022 17:41:23 +0800 Message-Id: <20220420094132.7732-2-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Stefan Binding BugLink: https://bugs.launchpad.net/bugs/1965496 This functions were previously made private since they were not used. However, these functions will be needed again. Partial revert of commit da21fde0fdb3 ("spi: Make several public functions private to spi.c") Signed-off-by: Stefan Binding Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20220121172431.6876-2-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit e3dc1399506f894110667ee5c66a6a70f06f3348) Signed-off-by: Hui Wang --- drivers/spi/spi.c | 6 ++++-- include/linux/spi/spi.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d96082dc3340..779df61bf71b 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -532,7 +532,7 @@ static DEFINE_MUTEX(board_lock); * * Return: a pointer to the new device, or NULL. */ -static struct spi_device *spi_alloc_device(struct spi_controller *ctlr) +struct spi_device *spi_alloc_device(struct spi_controller *ctlr) { struct spi_device *spi; @@ -557,6 +557,7 @@ static struct spi_device *spi_alloc_device(struct spi_controller *ctlr) device_initialize(&spi->dev); return spi; } +EXPORT_SYMBOL_GPL(spi_alloc_device); static void spi_dev_set_name(struct spi_device *spi) { @@ -652,7 +653,7 @@ static int __spi_add_device(struct spi_device *spi) * * Return: 0 on success; negative errno on failure */ -static int spi_add_device(struct spi_device *spi) +int spi_add_device(struct spi_device *spi) { struct spi_controller *ctlr = spi->controller; struct device *dev = ctlr->dev.parent; @@ -673,6 +674,7 @@ static int spi_add_device(struct spi_device *spi) mutex_unlock(&ctlr->add_lock); return status; } +EXPORT_SYMBOL_GPL(spi_add_device); static int spi_add_device_locked(struct spi_device *spi) { diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 7ab3fed7b804..0346a3ff27fd 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1452,7 +1452,19 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n) * use spi_new_device() to describe each device. You can also call * spi_unregister_device() to start making that device vanish, but * normally that would be handled by spi_unregister_controller(). + * + * You can also use spi_alloc_device() and spi_add_device() to use a two + * stage registration sequence for each spi_device. This gives the caller + * some more control over the spi_device structure before it is registered, + * but requires that caller to initialize fields that would otherwise + * be defined using the board info. */ +extern struct spi_device * +spi_alloc_device(struct spi_controller *ctlr); + +extern int +spi_add_device(struct spi_device *spi); + extern struct spi_device * spi_new_device(struct spi_controller *, struct spi_board_info *); From patchwork Wed Apr 20 09:41:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=KBnVq5rt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KjwgD4pyZz9sG2 for ; Wed, 20 Apr 2022 19:42:00 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qQ-0005HR-TP; Wed, 20 Apr 2022 09:41:54 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qP-0005GT-77 for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:41:53 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id CB8AF3F658 for ; Wed, 20 Apr 2022 09:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447713; bh=AB0OE4nLcEJ5crhXJuj2sCl8UoP2KjkoAWfF6JsZnlE=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KBnVq5rtqeYQGRpoyDX0ln58fUc4PUhD9rpXobar82bXwgh08h5sSedCtYEuq5+O7 94fpxBCkREYR3kEfvXAAs6OTaCsccYDZyIUf9/kpmSV5qgNWoAMC+rkDOUXDNo11sB 2jQ09T7F9gf2aDQHwpCzzzi9QU13IMjr2asBJfeOhGXPfbtytg1viPbtJPUNLhpVKW nlRJTc8ap64nQCDH0uhOLQCIM321rzcJeb3WjFrxasyDMQz0M69FVWYQf8avIFaaKI BldjHNVxEaigdL15hOhMiRB6F7wFFbOpL/pHbxEf1BORzk5iivfB+T65uJFxte0/Ws W60q8rQ7DNmoA== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 02/10] spi: Create helper API to lookup ACPI info for spi device Date: Wed, 20 Apr 2022 17:41:24 +0800 Message-Id: <20220420094132.7732-3-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Stefan Binding BugLink: https://bugs.launchpad.net/bugs/1965496 This can then be used to find a spi resource inside an ACPI node, and allocate a spi device. Signed-off-by: Stefan Binding Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20220121172431.6876-3-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 000bee0ed70af79e610444096fb453430220960f) Signed-off-by: Hui Wang --- drivers/spi/spi.c | 46 ++++++++++++++++++++++++++++++++--------- include/linux/spi/spi.h | 6 ++++++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 779df61bf71b..4ad7343ef2af 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2410,8 +2410,18 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data) return 1; } -static acpi_status acpi_register_spi_device(struct spi_controller *ctlr, - struct acpi_device *adev) +/** + * acpi_spi_device_alloc - Allocate a spi device, and fill it in with ACPI information + * @ctlr: controller to which the spi device belongs + * @adev: ACPI Device for the spi device + * + * This should be used to allocate a new spi device from and ACPI Node. + * The caller is responsible for calling spi_add_device to register the spi device. + * + * Return: a pointer to the new device, or ERR_PTR on error. + */ +struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, + struct acpi_device *adev) { acpi_handle parent_handle = NULL; struct list_head resource_list; @@ -2419,10 +2429,6 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr, struct spi_device *spi; int ret; - if (acpi_bus_get_status(adev) || !adev->status.present || - acpi_device_enumerated(adev)) - return AE_OK; - lookup.ctlr = ctlr; lookup.irq = -1; @@ -2433,7 +2439,7 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr, if (ret < 0) /* found SPI in _CRS but it points to another controller */ - return AE_OK; + return ERR_PTR(-ENODEV); if (!lookup.max_speed_hz && ACPI_SUCCESS(acpi_get_parent(adev->handle, &parent_handle)) && @@ -2443,16 +2449,15 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr, } if (!lookup.max_speed_hz) - return AE_OK; + return ERR_PTR(-ENODEV); spi = spi_alloc_device(ctlr); if (!spi) { dev_err(&ctlr->dev, "failed to allocate SPI device for %s\n", dev_name(&adev->dev)); - return AE_NO_MEMORY; + return ERR_PTR(-ENOMEM); } - ACPI_COMPANION_SET(&spi->dev, adev); spi->max_speed_hz = lookup.max_speed_hz; spi->mode |= lookup.mode; @@ -2460,6 +2465,27 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr, spi->bits_per_word = lookup.bits_per_word; spi->chip_select = lookup.chip_select; + return spi; +} +EXPORT_SYMBOL_GPL(acpi_spi_device_alloc); + +static acpi_status acpi_register_spi_device(struct spi_controller *ctlr, + struct acpi_device *adev) +{ + struct spi_device *spi; + + if (acpi_bus_get_status(adev) || !adev->status.present || + acpi_device_enumerated(adev)) + return AE_OK; + + spi = acpi_spi_device_alloc(ctlr, adev); + if (IS_ERR(spi)) { + if (PTR_ERR(spi) == -ENOMEM) + return AE_NO_MEMORY; + else + return AE_OK; + } + acpi_set_modalias(adev, acpi_device_hid(adev), spi->modalias, sizeof(spi->modalias)); diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 0346a3ff27fd..d159cef12f1a 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -16,6 +16,7 @@ #include #include +#include struct dma_chan; struct software_node; @@ -759,6 +760,11 @@ extern int devm_spi_register_controller(struct device *dev, struct spi_controller *ctlr); extern void spi_unregister_controller(struct spi_controller *ctlr); +#if IS_ENABLED(CONFIG_ACPI) +extern struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, + struct acpi_device *adev); +#endif + /* * SPI resource management while processing a SPI message */ From patchwork Wed Apr 20 09:41:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619432 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=HIxf42UP; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KjwgN3nBJz9sG0 for ; Wed, 20 Apr 2022 19:42:08 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qW-0005P6-Gt; Wed, 20 Apr 2022 09:42:00 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qR-0005IM-BK for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:41:55 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id EC2213F658 for ; Wed, 20 Apr 2022 09:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447715; bh=J89J55bwJ6j6/4xRUyk2uvpcJQsVAeaRegHdy08Jfho=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HIxf42UPZBKSuDMqpqqsBB8AHY943yX6R+d0fQW/tIlJuyUREnJMcbIl3arJ5VTf2 9Iv03Nko941mFu/9Nf+QIvTuRa2+/5d81V4jzISfftWxnc+XzF/OkZ7iWUbup0BTom Pqz+SFAiFc1jTyilZeiWPRraOqc1Nmlk37fcIJK0PWw7DSE6d8ucUme3BP9wd2dueV V1vmFo5JYXTemgmmv/JheHK+3FQcxZR6QlfbqRifVKZwbwNpciF2xwdv5G/q6DcEM7 fPmfDOZMBbwAjsDqUyUzdRCU9P7vd1UY6WJfKSr99YvKFCaxuLrN9T3IBObc5+T3sJ MRd8UU6LS2Jcw== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 03/10] spi: Support selection of the index of the ACPI Spi Resource before alloc Date: Wed, 20 Apr 2022 17:41:25 +0800 Message-Id: <20220420094132.7732-4-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Stefan Binding BugLink: https://bugs.launchpad.net/bugs/1965496 If a node contains more than one SPI resource it may be necessary to use an index to select which one you want to allocate a spi device for. Signed-off-by: Stefan Binding Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20220121172431.6876-4-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit 87e59b36e5e26122efd55d77adb9fac827987db0) Signed-off-by: Hui Wang --- drivers/spi/spi.c | 51 +++++++++++++++++++++++++++++++++++------ include/linux/spi/spi.h | 3 ++- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 4ad7343ef2af..e10da67ab00c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2320,6 +2320,8 @@ struct acpi_spi_lookup { int irq; u8 bits_per_word; u8 chip_select; + int n; + int index; }; static void acpi_spi_parse_apple_properties(struct acpi_device *dev, @@ -2351,6 +2353,8 @@ static void acpi_spi_parse_apple_properties(struct acpi_device *dev, lookup->mode |= SPI_CPHA; } +static struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev); + static int acpi_spi_add_resource(struct acpi_resource *ares, void *data) { struct acpi_spi_lookup *lookup = data; @@ -2364,14 +2368,35 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data) sb = &ares->data.spi_serial_bus; if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_SPI) { + if (lookup->index != -1 && lookup->n++ != lookup->index) + return 1; + + if (lookup->index == -1 && !ctlr) + return -ENODEV; + status = acpi_get_handle(NULL, sb->resource_source.string_ptr, &parent_handle); - if (ACPI_FAILURE(status) || - ACPI_HANDLE(ctlr->dev.parent) != parent_handle) + if (ACPI_FAILURE(status)) return -ENODEV; + if (ctlr) { + if (ACPI_HANDLE(ctlr->dev.parent) != parent_handle) + return -ENODEV; + } else { + struct acpi_device *adev; + + if (acpi_bus_get_device(parent_handle, &adev)) + return -ENODEV; + + ctlr = acpi_spi_find_controller_by_adev(adev); + if (!ctlr) + return -ENODEV; + + lookup->ctlr = ctlr; + } + /* * ACPI DeviceSelection numbering is handled by the * host controller driver in Windows and can vary @@ -2414,14 +2439,21 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data) * acpi_spi_device_alloc - Allocate a spi device, and fill it in with ACPI information * @ctlr: controller to which the spi device belongs * @adev: ACPI Device for the spi device + * @index: Index of the spi resource inside the ACPI Node * * This should be used to allocate a new spi device from and ACPI Node. * The caller is responsible for calling spi_add_device to register the spi device. * + * If ctlr is set to NULL, the Controller for the spi device will be looked up + * using the resource. + * If index is set to -1, index is not used. + * Note: If index is -1, ctlr must be set. + * * Return: a pointer to the new device, or ERR_PTR on error. */ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, - struct acpi_device *adev) + struct acpi_device *adev, + int index) { acpi_handle parent_handle = NULL; struct list_head resource_list; @@ -2429,8 +2461,13 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, struct spi_device *spi; int ret; + if (!ctlr && index == -1) + return ERR_PTR(-EINVAL); + lookup.ctlr = ctlr; lookup.irq = -1; + lookup.index = index; + lookup.n = 0; INIT_LIST_HEAD(&resource_list); ret = acpi_dev_get_resources(adev, &resource_list, @@ -2443,7 +2480,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, if (!lookup.max_speed_hz && ACPI_SUCCESS(acpi_get_parent(adev->handle, &parent_handle)) && - ACPI_HANDLE(ctlr->dev.parent) == parent_handle) { + ACPI_HANDLE(lookup.ctlr->dev.parent) == parent_handle) { /* Apple does not use _CRS but nested devices for SPI slaves */ acpi_spi_parse_apple_properties(adev, &lookup); } @@ -2451,9 +2488,9 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, if (!lookup.max_speed_hz) return ERR_PTR(-ENODEV); - spi = spi_alloc_device(ctlr); + spi = spi_alloc_device(lookup.ctlr); if (!spi) { - dev_err(&ctlr->dev, "failed to allocate SPI device for %s\n", + dev_err(&lookup.ctlr->dev, "failed to allocate SPI device for %s\n", dev_name(&adev->dev)); return ERR_PTR(-ENOMEM); } @@ -2478,7 +2515,7 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr, acpi_device_enumerated(adev)) return AE_OK; - spi = acpi_spi_device_alloc(ctlr, adev); + spi = acpi_spi_device_alloc(ctlr, adev, -1); if (IS_ERR(spi)) { if (PTR_ERR(spi) == -ENOMEM) return AE_NO_MEMORY; diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index d159cef12f1a..e5bbb9cbd3d7 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -762,7 +762,8 @@ extern void spi_unregister_controller(struct spi_controller *ctlr); #if IS_ENABLED(CONFIG_ACPI) extern struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, - struct acpi_device *adev); + struct acpi_device *adev, + int index); #endif /* From patchwork Wed Apr 20 09:41:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619431 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=NeaGYl1y; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KjwgL37V1z9sG0 for ; Wed, 20 Apr 2022 19:42:06 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qV-0005NE-3n; Wed, 20 Apr 2022 09:41:59 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qT-0005KL-5i for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:41:57 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 20AFB3F658 for ; Wed, 20 Apr 2022 09:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447717; bh=AP5uTdWF21EHwotMiNdJ8iO6xd9KuMc9JVvaU6/UriM=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NeaGYl1y3CWHcKsCOO7Gkt9UpqCmdA27RU/eHRMeSAzz+7l+8cqszYjGIu1CSvPYH vMKWW87RlcM6MdDteWVwsFD5jE9zeqfkKJnVoEy5Z8FSms9xXHJfnmseAvWOBozXQS RqPgFoYgh3lJt+VmCYDH+zwkRf/gEwBb3YjFDhE2IBJVsFy3KbQI45lcva/XbI1dQ0 VAoi8oxevY/8Uc68/4KCLLoYWYlFAG9G46ceDXnBNlV0zIemU8tPG9tTFrOjrz91Lr 9rDMYXTednGrHcY/WYks4gDI/ZnxFd4IzWNfVciInjJ3gnWQy+pauceZP3mG0XdjM9 1RF06PPHLUIeQ== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 04/10] spi: Add API to count spi acpi resources Date: Wed, 20 Apr 2022 17:41:26 +0800 Message-Id: <20220420094132.7732-5-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Stefan Binding BugLink: https://bugs.launchpad.net/bugs/1965496 Some ACPI nodes may have more than one Spi Resource. To be able to handle these case, its necessary to have a way of counting these resources. Signed-off-by: Stefan Binding Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20220121172431.6876-5-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit e612af7acef2459f1afd885f4107748995a05963) Signed-off-by: Hui Wang --- drivers/spi/spi.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/linux/spi/spi.h | 1 + 2 files changed, 41 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index e10da67ab00c..432d88662e62 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2324,6 +2324,46 @@ struct acpi_spi_lookup { int index; }; +static int acpi_spi_count(struct acpi_resource *ares, void *data) +{ + struct acpi_resource_spi_serialbus *sb; + int *count = data; + + if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) + return 1; + + sb = &ares->data.spi_serial_bus; + if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_SPI) + return 1; + + *count = *count + 1; + + return 1; +} + +/** + * acpi_spi_count_resources - Count the number of SpiSerialBus resources + * @adev: ACPI device + * + * Returns the number of SpiSerialBus resources in the ACPI-device's + * resource-list; or a negative error code. + */ +int acpi_spi_count_resources(struct acpi_device *adev) +{ + LIST_HEAD(r); + int count = 0; + int ret; + + ret = acpi_dev_get_resources(adev, &r, acpi_spi_count, &count); + if (ret < 0) + return ret; + + acpi_dev_free_resource_list(&r); + + return count; +} +EXPORT_SYMBOL_GPL(acpi_spi_count_resources); + static void acpi_spi_parse_apple_properties(struct acpi_device *dev, struct acpi_spi_lookup *lookup) { diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index e5bbb9cbd3d7..394b4241d989 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -764,6 +764,7 @@ extern void spi_unregister_controller(struct spi_controller *ctlr); extern struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, struct acpi_device *adev, int index); +int acpi_spi_count_resources(struct acpi_device *adev); #endif /* From patchwork Wed Apr 20 09:41:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619433 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=fszgD882; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KjwgS5zf8z9sG0 for ; Wed, 20 Apr 2022 19:42:12 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qa-0005UB-SO; Wed, 20 Apr 2022 09:42:04 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qU-0005Mg-W2 for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:41:59 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id BC8FE3F658 for ; Wed, 20 Apr 2022 09:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447718; bh=cxjHMGPCQHGK2156oemZ5yskHvpURqxiykVrXG+4Tys=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fszgD882kHZT0sROtKtiFoF3gd64JV3mtK8wiQyZXcmFWB3IfqNl+Hs3zimRCVSlj LMdulpEKG867+1y4fHf2jpa5CueMf2rR910whT4O00U/tsnQC4LEgN47l6xrcznPq9 olVwy0LnpxtYZ4hCT+Nh0JQ+QVrmQC3qqKL2sdornY3q6DxIYZOw0v2ZoPJHFeOduP lxL4PlOLU15dDCyAyNIgbuX6q9XTW81urFhFu/91EcbgvZpjam7h3jMwJzQ8l/8+If c8Jd5q8oNAWzNhz4UHl6zGo9UMcrtCnrPQmgDpnHw2n82qeuh+EniT7/4TSGiNjkkV Ptq2Wr4418YTQ== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 05/10] platform/x86: i2c-multi-instantiate: Rename it for a generic serial driver name Date: Wed, 20 Apr 2022 17:41:27 +0800 Message-Id: <20220420094132.7732-6-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Lucas Tanure BugLink: https://bugs.launchpad.net/bugs/1965496 Rename I2C multi instantiate driver to serial-multi-instantiate for upcoming addition of SPI support Signed-off-by: Lucas Tanure Signed-off-by: Stefan Binding Link: https://lore.kernel.org/r/20220121172431.6876-6-sbinding@opensource.cirrus.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede (cherry picked from commit 5e63b2ea3dfbab9307e197004a3c5ee4e1442582) Signed-off-by: Hui Wang --- MAINTAINERS | 4 +- drivers/acpi/scan.c | 13 +-- drivers/platform/x86/Kconfig | 10 +- drivers/platform/x86/Makefile | 2 +- ...stantiate.c => serial-multi-instantiate.c} | 91 +++++++++---------- 5 files changed, 60 insertions(+), 60 deletions(-) rename drivers/platform/x86/{i2c-multi-instantiate.c => serial-multi-instantiate.c} (51%) diff --git a/MAINTAINERS b/MAINTAINERS index 52ec8efef938..fc056d7f73fa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -401,11 +401,11 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained F: drivers/acpi/arm64 -ACPI I2C MULTI INSTANTIATE DRIVER +ACPI SERIAL MULTI INSTANTIATE DRIVER M: Hans de Goede L: platform-driver-x86@vger.kernel.org S: Maintained -F: drivers/platform/x86/i2c-multi-instantiate.c +F: drivers/platform/x86/serial-multi-instantiate.c ACPI PCC(Platform Communication Channel) MAILBOX DRIVER M: Sudeep Holla diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 8b2e5ef15559..96dbd47657f6 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1734,12 +1734,13 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) bool is_serial_bus_slave = false; static const struct acpi_device_id ignore_serial_bus_ids[] = { /* - * These devices have multiple I2cSerialBus resources and an i2c-client - * must be instantiated for each, each with its own i2c_device_id. - * Normally we only instantiate an i2c-client for the first resource, - * using the ACPI HID as id. These special cases are handled by the - * drivers/platform/x86/i2c-multi-instantiate.c driver, which knows - * which i2c_device_id to use for each resource. + * These devices have multiple SerialBus resources and a client + * device must be instantiated for each of them, each with + * its own device id. + * Normally we only instantiate one client device for the first + * resource, using the ACPI HID as id. These special cases are handled + * by the drivers/platform/x86/serial-multi-instantiate.c driver, which + * knows which client device id to use for each resource. */ {"BSG1160", }, {"BSG2150", }, diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index af453a5dbf0c..53c2cde229cf 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -1004,16 +1004,16 @@ config TOPSTAR_LAPTOP If you have a Topstar laptop, say Y or M here. -config I2C_MULTI_INSTANTIATE - tristate "I2C multi instantiate pseudo device driver" +config SERIAL_MULTI_INSTANTIATE + tristate "Serial bus multi instantiate pseudo device driver" depends on I2C && ACPI help - Some ACPI-based systems list multiple i2c-devices in a single ACPI - firmware-node. This driver will instantiate separate i2c-clients + Some ACPI-based systems list multiple devices in a single ACPI + firmware-node. This driver will instantiate separate clients for each device in the firmware-node. To compile this driver as a module, choose M here: the module - will be called i2c-multi-instantiate. + will be called serial-multi-instantiate. config MLX_PLATFORM tristate "Mellanox Technologies platform support" diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index c12a9b044fd8..9527088bba7f 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile @@ -110,7 +110,7 @@ obj-$(CONFIG_TOPSTAR_LAPTOP) += topstar-laptop.o # Platform drivers obj-$(CONFIG_FW_ATTR_CLASS) += firmware_attributes_class.o -obj-$(CONFIG_I2C_MULTI_INSTANTIATE) += i2c-multi-instantiate.o +obj-$(CONFIG_SERIAL_MULTI_INSTANTIATE) += serial-multi-instantiate.o obj-$(CONFIG_MLX_PLATFORM) += mlx-platform.o obj-$(CONFIG_TOUCHSCREEN_DMI) += touchscreen_dmi.o obj-$(CONFIG_WIRELESS_HOTKEY) += wireless-hotkey.o diff --git a/drivers/platform/x86/i2c-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c similarity index 51% rename from drivers/platform/x86/i2c-multi-instantiate.c rename to drivers/platform/x86/serial-multi-instantiate.c index 4956a1df5b90..9af5bcd466d1 100644 --- a/drivers/platform/x86/i2c-multi-instantiate.c +++ b/drivers/platform/x86/serial-multi-instantiate.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * I2C multi-instantiate driver, pseudo driver to instantiate multiple - * i2c-clients from a single fwnode. + * Serial multi-instantiate driver, pseudo driver to instantiate multiple + * client devices from a single fwnode. * * Copyright 2018 Hans de Goede */ @@ -21,29 +21,29 @@ #define IRQ_RESOURCE_GPIO 1 #define IRQ_RESOURCE_APIC 2 -struct i2c_inst_data { +struct smi_instance { const char *type; unsigned int flags; int irq_idx; }; -struct i2c_multi_inst_data { - int num_clients; - struct i2c_client *clients[]; +struct smi { + int i2c_num; + struct i2c_client *i2c_devs[]; }; -static int i2c_multi_inst_probe(struct platform_device *pdev) +static int smi_probe(struct platform_device *pdev) { - struct i2c_multi_inst_data *multi; - const struct i2c_inst_data *inst_data; struct i2c_board_info board_info = {}; + const struct smi_instance *inst; struct device *dev = &pdev->dev; struct acpi_device *adev; + struct smi *smi; char name[32]; int i, ret; - inst_data = device_get_match_data(dev); - if (!inst_data) { + inst = device_get_match_data(dev); + if (!inst) { dev_err(dev, "Error ACPI match data is missing\n"); return -ENODEV; } @@ -55,33 +55,32 @@ static int i2c_multi_inst_probe(struct platform_device *pdev) if (ret < 0) return ret; - multi = devm_kmalloc(dev, struct_size(multi, clients, ret), GFP_KERNEL); - if (!multi) + smi = devm_kmalloc(dev, struct_size(smi, i2c_devs, ret), GFP_KERNEL); + if (!smi) return -ENOMEM; - multi->num_clients = ret; + smi->i2c_num = ret; - for (i = 0; i < multi->num_clients && inst_data[i].type; i++) { + for (i = 0; i < smi->i2c_num && inst[i].type; i++) { memset(&board_info, 0, sizeof(board_info)); - strlcpy(board_info.type, inst_data[i].type, I2C_NAME_SIZE); - snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev), - inst_data[i].type, i); + strlcpy(board_info.type, inst[i].type, I2C_NAME_SIZE); + snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev), inst[i].type, i); board_info.dev_name = name; - switch (inst_data[i].flags & IRQ_RESOURCE_TYPE) { + switch (inst[i].flags & IRQ_RESOURCE_TYPE) { case IRQ_RESOURCE_GPIO: - ret = acpi_dev_gpio_irq_get(adev, inst_data[i].irq_idx); + ret = acpi_dev_gpio_irq_get(adev, inst[i].irq_idx); if (ret < 0) { dev_err(dev, "Error requesting irq at index %d: %d\n", - inst_data[i].irq_idx, ret); + inst[i].irq_idx, ret); goto error; } board_info.irq = ret; break; case IRQ_RESOURCE_APIC: - ret = platform_get_irq(pdev, inst_data[i].irq_idx); + ret = platform_get_irq(pdev, inst[i].irq_idx); if (ret < 0) { dev_dbg(dev, "Error requesting irq at index %d: %d\n", - inst_data[i].irq_idx, ret); + inst[i].irq_idx, ret); goto error; } board_info.irq = ret; @@ -90,48 +89,48 @@ static int i2c_multi_inst_probe(struct platform_device *pdev) board_info.irq = 0; break; } - multi->clients[i] = i2c_acpi_new_device(dev, i, &board_info); - if (IS_ERR(multi->clients[i])) { - ret = dev_err_probe(dev, PTR_ERR(multi->clients[i]), + smi->i2c_devs[i] = i2c_acpi_new_device(dev, i, &board_info); + if (IS_ERR(smi->i2c_devs[i])) { + ret = dev_err_probe(dev, PTR_ERR(smi->i2c_devs[i]), "Error creating i2c-client, idx %d\n", i); goto error; } } - if (i < multi->num_clients) { + if (i < smi->i2c_num) { dev_err(dev, "Error finding driver, idx %d\n", i); ret = -ENODEV; goto error; } - platform_set_drvdata(pdev, multi); + platform_set_drvdata(pdev, smi); return 0; error: while (--i >= 0) - i2c_unregister_device(multi->clients[i]); + i2c_unregister_device(smi->i2c_devs[i]); return ret; } -static int i2c_multi_inst_remove(struct platform_device *pdev) +static int smi_remove(struct platform_device *pdev) { - struct i2c_multi_inst_data *multi = platform_get_drvdata(pdev); + struct smi *smi = platform_get_drvdata(pdev); int i; - for (i = 0; i < multi->num_clients; i++) - i2c_unregister_device(multi->clients[i]); + for (i = 0; i < smi->i2c_num; i++) + i2c_unregister_device(smi->i2c_devs[i]); return 0; } -static const struct i2c_inst_data bsg1160_data[] = { +static const struct smi_instance bsg1160_data[] = { { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 }, { "bmc150_magn" }, { "bmg160" }, {} }; -static const struct i2c_inst_data bsg2150_data[] = { +static const struct smi_instance bsg2150_data[] = { { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 }, { "bmc150_magn" }, /* The resources describe a 3th client, but it is not really there. */ @@ -139,7 +138,7 @@ static const struct i2c_inst_data bsg2150_data[] = { {} }; -static const struct i2c_inst_data int3515_data[] = { +static const struct smi_instance int3515_data[] = { { "tps6598x", IRQ_RESOURCE_APIC, 0 }, { "tps6598x", IRQ_RESOURCE_APIC, 1 }, { "tps6598x", IRQ_RESOURCE_APIC, 2 }, @@ -148,27 +147,27 @@ static const struct i2c_inst_data int3515_data[] = { }; /* - * Note new device-ids must also be added to i2c_multi_instantiate_ids in + * Note new device-ids must also be added to ignore_serial_bus_ids in * drivers/acpi/scan.c: acpi_device_enumeration_by_parent(). */ -static const struct acpi_device_id i2c_multi_inst_acpi_ids[] = { +static const struct acpi_device_id smi_acpi_ids[] = { { "BSG1160", (unsigned long)bsg1160_data }, { "BSG2150", (unsigned long)bsg2150_data }, { "INT3515", (unsigned long)int3515_data }, { } }; -MODULE_DEVICE_TABLE(acpi, i2c_multi_inst_acpi_ids); +MODULE_DEVICE_TABLE(acpi, smi_acpi_ids); -static struct platform_driver i2c_multi_inst_driver = { +static struct platform_driver smi_driver = { .driver = { - .name = "I2C multi instantiate pseudo device driver", - .acpi_match_table = i2c_multi_inst_acpi_ids, + .name = "Serial bus multi instantiate pseudo device driver", + .acpi_match_table = smi_acpi_ids, }, - .probe = i2c_multi_inst_probe, - .remove = i2c_multi_inst_remove, + .probe = smi_probe, + .remove = smi_remove, }; -module_platform_driver(i2c_multi_inst_driver); +module_platform_driver(smi_driver); -MODULE_DESCRIPTION("I2C multi instantiate pseudo device driver"); +MODULE_DESCRIPTION("Serial multi instantiate pseudo device driver"); MODULE_AUTHOR("Hans de Goede "); MODULE_LICENSE("GPL"); From patchwork Wed Apr 20 09:41:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=eFor5/aF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KjwgV3M90z9sG0 for ; Wed, 20 Apr 2022 19:42:14 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qd-0005XW-Ab; Wed, 20 Apr 2022 09:42:07 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qX-0005PF-5D for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:42:01 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 645F23F658 for ; Wed, 20 Apr 2022 09:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447720; bh=W5/DFK/6TpryHu0A5FdLqGxJnppKcgOTGWDUYBsPXO8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eFor5/aFpMtJ0rciZv1PFM+QqBEewCPrkzhgBa8c8adBPbdnIqGP86YFbUPJgXS93 Jd2VXXwjJC8UutsGher4bM15NN01xA2bwCuVLTZ+BtnCaQ5kW4UZkpdEd/D73XAavF VUbiI58WfVNKiXFBkS056eom620fPsFQfYZMoY269bZGqyj7jPDVC4g6EdiIbRXqOL L8RiiZzjn2ykX1hNgQ03iyDFoyeEZ7WIAjWIrbGN72aa6hTt6/ue9kBDMX7F2Y5LNr cHPYBjwptoWOG5D+tIcGa4F+3QzrmAMLDTtKcLRSEI1ylxbH5jgShONMIxPX3tX6t2 fnvuumTtN0hKA== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 06/10] platform/x86: serial-multi-instantiate: Reorganize I2C functions Date: Wed, 20 Apr 2022 17:41:28 +0800 Message-Id: <20220420094132.7732-7-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Lucas Tanure BugLink: https://bugs.launchpad.net/bugs/1965496 Reorganize I2C functions to accommodate SPI support Split the probe and factor out parts of the code that will be used in the SPI support Also switched from strlcpy() to strscpy() Signed-off-by: Lucas Tanure Signed-off-by: Stefan Binding Link: https://lore.kernel.org/r/20220121172431.6876-7-sbinding@opensource.cirrus.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede (cherry picked from commit 35a36cbb7b1ce7596fc03962f7ce261b2e908d1f) Signed-off-by: Hui Wang --- .../platform/x86/serial-multi-instantiate.c | 144 +++++++++++------- 1 file changed, 90 insertions(+), 54 deletions(-) diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c index 9af5bcd466d1..1eb29bec405f 100644 --- a/drivers/platform/x86/serial-multi-instantiate.c +++ b/drivers/platform/x86/serial-multi-instantiate.c @@ -29,96 +29,132 @@ struct smi_instance { struct smi { int i2c_num; - struct i2c_client *i2c_devs[]; + struct i2c_client **i2c_devs; }; -static int smi_probe(struct platform_device *pdev) +static int smi_get_irq(struct platform_device *pdev, struct acpi_device *adev, + const struct smi_instance *inst) +{ + int ret; + + switch (inst->flags & IRQ_RESOURCE_TYPE) { + case IRQ_RESOURCE_GPIO: + ret = acpi_dev_gpio_irq_get(adev, inst->irq_idx); + break; + case IRQ_RESOURCE_APIC: + ret = platform_get_irq(pdev, inst->irq_idx); + break; + default: + return 0; + } + + if (ret < 0) + dev_err_probe(&pdev->dev, ret, "Error requesting irq at index %d: %d\n", + inst->irq_idx, ret); + + return ret; +} + +static void smi_devs_unregister(struct smi *smi) +{ + while (smi->i2c_num > 0) + i2c_unregister_device(smi->i2c_devs[--smi->i2c_num]); +} + +/** + * smi_i2c_probe - Instantiate multiple I2C devices from inst array + * @pdev: Platform device + * @adev: ACPI device + * @smi: Internal struct for Serial multi instantiate driver + * @inst_array: Array of instances to probe + * + * Returns the number of I2C devices instantiate, Zero if none is found or a negative error code. + */ +static int smi_i2c_probe(struct platform_device *pdev, struct acpi_device *adev, struct smi *smi, + const struct smi_instance *inst_array) { struct i2c_board_info board_info = {}; - const struct smi_instance *inst; struct device *dev = &pdev->dev; - struct acpi_device *adev; - struct smi *smi; char name[32]; - int i, ret; + int i, ret, count; - inst = device_get_match_data(dev); - if (!inst) { - dev_err(dev, "Error ACPI match data is missing\n"); - return -ENODEV; - } - - adev = ACPI_COMPANION(dev); - - /* Count number of clients to instantiate */ ret = i2c_acpi_client_count(adev); if (ret < 0) return ret; + else if (!ret) + return -ENODEV; - smi = devm_kmalloc(dev, struct_size(smi, i2c_devs, ret), GFP_KERNEL); - if (!smi) - return -ENOMEM; + count = ret; - smi->i2c_num = ret; + smi->i2c_devs = devm_kcalloc(dev, count, sizeof(*smi->i2c_devs), GFP_KERNEL); + if (!smi->i2c_devs) + return -ENOMEM; - for (i = 0; i < smi->i2c_num && inst[i].type; i++) { + for (i = 0; i < count && inst_array[i].type; i++) { memset(&board_info, 0, sizeof(board_info)); - strlcpy(board_info.type, inst[i].type, I2C_NAME_SIZE); - snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev), inst[i].type, i); + strscpy(board_info.type, inst_array[i].type, I2C_NAME_SIZE); + snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev), inst_array[i].type, i); board_info.dev_name = name; - switch (inst[i].flags & IRQ_RESOURCE_TYPE) { - case IRQ_RESOURCE_GPIO: - ret = acpi_dev_gpio_irq_get(adev, inst[i].irq_idx); - if (ret < 0) { - dev_err(dev, "Error requesting irq at index %d: %d\n", - inst[i].irq_idx, ret); - goto error; - } - board_info.irq = ret; - break; - case IRQ_RESOURCE_APIC: - ret = platform_get_irq(pdev, inst[i].irq_idx); - if (ret < 0) { - dev_dbg(dev, "Error requesting irq at index %d: %d\n", - inst[i].irq_idx, ret); - goto error; - } - board_info.irq = ret; - break; - default: - board_info.irq = 0; - break; - } + + ret = smi_get_irq(pdev, adev, &inst_array[i]); + if (ret < 0) + goto error; + board_info.irq = ret; + smi->i2c_devs[i] = i2c_acpi_new_device(dev, i, &board_info); if (IS_ERR(smi->i2c_devs[i])) { ret = dev_err_probe(dev, PTR_ERR(smi->i2c_devs[i]), "Error creating i2c-client, idx %d\n", i); goto error; } + smi->i2c_num++; } - if (i < smi->i2c_num) { - dev_err(dev, "Error finding driver, idx %d\n", i); + if (smi->i2c_num < count) { + dev_dbg(dev, "Error finding driver, idx %d\n", i); ret = -ENODEV; goto error; } - platform_set_drvdata(pdev, smi); - return 0; + dev_info(dev, "Instantiated %d I2C devices.\n", smi->i2c_num); + return 0; error: - while (--i >= 0) - i2c_unregister_device(smi->i2c_devs[i]); + smi_devs_unregister(smi); return ret; } +static int smi_probe(struct platform_device *pdev) +{ + const struct smi_instance *inst_array; + struct device *dev = &pdev->dev; + struct acpi_device *adev; + struct smi *smi; + + adev = ACPI_COMPANION(dev); + if (!adev) + return -ENODEV; + + inst_array = device_get_match_data(dev); + if (!inst_array) { + dev_dbg(dev, "Error ACPI match data is missing\n"); + return -ENODEV; + } + + smi = devm_kzalloc(dev, sizeof(*smi), GFP_KERNEL); + if (!smi) + return -ENOMEM; + + platform_set_drvdata(pdev, smi); + + return smi_i2c_probe(pdev, adev, smi, inst_array); +} + static int smi_remove(struct platform_device *pdev) { struct smi *smi = platform_get_drvdata(pdev); - int i; - for (i = 0; i < smi->i2c_num; i++) - i2c_unregister_device(smi->i2c_devs[i]); + smi_devs_unregister(smi); return 0; } From patchwork Wed Apr 20 09:41:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619435 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=UM9SOVwe; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KjwgZ0tTgz9sG0 for ; Wed, 20 Apr 2022 19:42:18 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qg-0005cF-CX; Wed, 20 Apr 2022 09:42:10 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qZ-0005RP-It for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:42:03 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 0C0883F66F for ; Wed, 20 Apr 2022 09:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447721; bh=YMgNdR0HHdzAntIduXBgNqZGF2FmD9c0hEiY828Aa9w=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UM9SOVweI1On4/FPsvJJLHcRAR4GXUNZ3KnIN2L+2gCr7JF1ZM51klKC2PGH8VL82 lNsyDpsrL67HuRWd6t9a+jrOP63FewgsSO32TvjLRRukNniMxB8J12e3ZdC1izYdl8 +l81xXFY0BLhIv9E65Fh4LbMrHpvXL6jzET8lVaHBP+f9PudZI+OADZiKgdAueVr+v PX1bslXTtmNjllK7tVz+u1yZ/A7yjegyZK8dgYQIDTiqzu5niA1hZNVCN/DBKwFvf3 qre5N+yZKAr8b0+ce4Y6ISNPFSqtmO9fVD7Dgu/gOr6AoSTcUm0Itadxli1ek5zAio CjjUhi62gU2ZA== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 07/10] platform/x86: serial-multi-instantiate: Add SPI support Date: Wed, 20 Apr 2022 17:41:29 +0800 Message-Id: <20220420094132.7732-8-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Stefan Binding BugLink: https://bugs.launchpad.net/bugs/1965496 Add support for spi bus in serial-multi-instantiate driver Some peripherals can have either a I2C or a SPI connection to the host (but not both) but use the same HID for both types. So it is not possible to use the HID to determine whether it is I2C or SPI. The driver must check the node to see if it contains I2cSerialBus or SpiSerialBus entries. For backwards-compatibility with the existing nodes I2C is checked first and if such entries are found ONLY I2C devices are created. Since some existing nodes that were already handled by this driver could also contain unrelated SpiSerialBus nodes that were previously ignored, and this preserves that behavior. If there is ever a need to handle a node where both I2C and SPI devices must be instantiated this can be added in future. Signed-off-by: Stefan Binding Link: https://lore.kernel.org/r/20220121172431.6876-8-sbinding@opensource.cirrus.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede (cherry picked from commit 68f201f9061c000d7a4a9f359f021b1cd535d62b) Signed-off-by: Hui Wang --- drivers/platform/x86/Kconfig | 2 +- .../platform/x86/serial-multi-instantiate.c | 173 +++++++++++++++--- 2 files changed, 150 insertions(+), 25 deletions(-) diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 53c2cde229cf..87ae55aed8df 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -1006,7 +1006,7 @@ config TOPSTAR_LAPTOP config SERIAL_MULTI_INSTANTIATE tristate "Serial bus multi instantiate pseudo device driver" - depends on I2C && ACPI + depends on I2C && SPI && ACPI help Some ACPI-based systems list multiple devices in a single ACPI firmware-node. This driver will instantiate separate clients diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c index 1eb29bec405f..e2fd73905312 100644 --- a/drivers/platform/x86/serial-multi-instantiate.c +++ b/drivers/platform/x86/serial-multi-instantiate.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #define IRQ_RESOURCE_TYPE GENMASK(1, 0) @@ -21,15 +22,28 @@ #define IRQ_RESOURCE_GPIO 1 #define IRQ_RESOURCE_APIC 2 +enum smi_bus_type { + SMI_I2C, + SMI_SPI, + SMI_AUTO_DETECT, +}; + struct smi_instance { const char *type; unsigned int flags; int irq_idx; }; +struct smi_node { + enum smi_bus_type bus_type; + struct smi_instance instances[]; +}; + struct smi { int i2c_num; + int spi_num; struct i2c_client **i2c_devs; + struct spi_device **spi_devs; }; static int smi_get_irq(struct platform_device *pdev, struct acpi_device *adev, @@ -59,6 +73,94 @@ static void smi_devs_unregister(struct smi *smi) { while (smi->i2c_num > 0) i2c_unregister_device(smi->i2c_devs[--smi->i2c_num]); + + while (smi->spi_num > 0) + spi_unregister_device(smi->spi_devs[--smi->spi_num]); +} + +/** + * smi_spi_probe - Instantiate multiple SPI devices from inst array + * @pdev: Platform device + * @adev: ACPI device + * @smi: Internal struct for Serial multi instantiate driver + * @inst_array: Array of instances to probe + * + * Returns the number of SPI devices instantiate, Zero if none is found or a negative error code. + */ +static int smi_spi_probe(struct platform_device *pdev, struct acpi_device *adev, struct smi *smi, + const struct smi_instance *inst_array) +{ + struct device *dev = &pdev->dev; + struct spi_controller *ctlr; + struct spi_device *spi_dev; + char name[50]; + int i, ret, count; + + ret = acpi_spi_count_resources(adev); + if (ret < 0) + return ret; + else if (!ret) + return -ENODEV; + + count = ret; + + smi->spi_devs = devm_kcalloc(dev, count, sizeof(*smi->spi_devs), GFP_KERNEL); + if (!smi->spi_devs) + return -ENOMEM; + + for (i = 0; i < count && inst_array[i].type; i++) { + + spi_dev = acpi_spi_device_alloc(NULL, adev, i); + if (IS_ERR(spi_dev)) { + ret = PTR_ERR(spi_dev); + dev_err_probe(dev, ret, "failed to allocate SPI device %s from ACPI: %d\n", + dev_name(&adev->dev), ret); + goto error; + } + + ctlr = spi_dev->controller; + + strscpy(spi_dev->modalias, inst_array[i].type, sizeof(spi_dev->modalias)); + + ret = smi_get_irq(pdev, adev, &inst_array[i]); + if (ret < 0) { + spi_dev_put(spi_dev); + goto error; + } + spi_dev->irq = ret; + + snprintf(name, sizeof(name), "%s-%s-%s.%d", dev_name(&ctlr->dev), dev_name(dev), + inst_array[i].type, i); + spi_dev->dev.init_name = name; + + ret = spi_add_device(spi_dev); + if (ret) { + dev_err_probe(&ctlr->dev, ret, + "failed to add SPI device %s from ACPI: %d\n", + dev_name(&adev->dev), ret); + spi_dev_put(spi_dev); + goto error; + } + + dev_dbg(dev, "SPI device %s using chip select %u", name, spi_dev->chip_select); + + smi->spi_devs[i] = spi_dev; + smi->spi_num++; + } + + if (smi->spi_num < count) { + dev_dbg(dev, "Error finding driver, idx %d\n", i); + ret = -ENODEV; + goto error; + } + + dev_info(dev, "Instantiated %d SPI devices.\n", smi->spi_num); + + return 0; +error: + smi_devs_unregister(smi); + + return ret; } /** @@ -126,8 +228,8 @@ static int smi_i2c_probe(struct platform_device *pdev, struct acpi_device *adev, static int smi_probe(struct platform_device *pdev) { - const struct smi_instance *inst_array; struct device *dev = &pdev->dev; + const struct smi_node *node; struct acpi_device *adev; struct smi *smi; @@ -135,8 +237,8 @@ static int smi_probe(struct platform_device *pdev) if (!adev) return -ENODEV; - inst_array = device_get_match_data(dev); - if (!inst_array) { + node = device_get_match_data(dev); + if (!node) { dev_dbg(dev, "Error ACPI match data is missing\n"); return -ENODEV; } @@ -147,7 +249,21 @@ static int smi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, smi); - return smi_i2c_probe(pdev, adev, smi, inst_array); + switch (node->bus_type) { + case SMI_I2C: + return smi_i2c_probe(pdev, adev, smi, node->instances); + case SMI_SPI: + return smi_spi_probe(pdev, adev, smi, node->instances); + case SMI_AUTO_DETECT: + if (i2c_acpi_client_count(adev) > 0) + return smi_i2c_probe(pdev, adev, smi, node->instances); + else + return smi_spi_probe(pdev, adev, smi, node->instances); + default: + return -EINVAL; + } + + return 0; /* never reached */ } static int smi_remove(struct platform_device *pdev) @@ -159,27 +275,36 @@ static int smi_remove(struct platform_device *pdev) return 0; } -static const struct smi_instance bsg1160_data[] = { - { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 }, - { "bmc150_magn" }, - { "bmg160" }, - {} +static const struct smi_node bsg1160_data = { + .instances = { + { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 }, + { "bmc150_magn" }, + { "bmg160" }, + {} + }, + .bus_type = SMI_I2C, }; -static const struct smi_instance bsg2150_data[] = { - { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 }, - { "bmc150_magn" }, - /* The resources describe a 3th client, but it is not really there. */ - { "bsg2150_dummy_dev" }, - {} +static const struct smi_node bsg2150_data = { + .instances = { + { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 }, + { "bmc150_magn" }, + /* The resources describe a 3th client, but it is not really there. */ + { "bsg2150_dummy_dev" }, + {} + }, + .bus_type = SMI_I2C, }; -static const struct smi_instance int3515_data[] = { - { "tps6598x", IRQ_RESOURCE_APIC, 0 }, - { "tps6598x", IRQ_RESOURCE_APIC, 1 }, - { "tps6598x", IRQ_RESOURCE_APIC, 2 }, - { "tps6598x", IRQ_RESOURCE_APIC, 3 }, - {} +static const struct smi_node int3515_data = { + .instances = { + { "tps6598x", IRQ_RESOURCE_APIC, 0 }, + { "tps6598x", IRQ_RESOURCE_APIC, 1 }, + { "tps6598x", IRQ_RESOURCE_APIC, 2 }, + { "tps6598x", IRQ_RESOURCE_APIC, 3 }, + {} + }, + .bus_type = SMI_I2C, }; /* @@ -187,9 +312,9 @@ static const struct smi_instance int3515_data[] = { * drivers/acpi/scan.c: acpi_device_enumeration_by_parent(). */ static const struct acpi_device_id smi_acpi_ids[] = { - { "BSG1160", (unsigned long)bsg1160_data }, - { "BSG2150", (unsigned long)bsg2150_data }, - { "INT3515", (unsigned long)int3515_data }, + { "BSG1160", (unsigned long)&bsg1160_data }, + { "BSG2150", (unsigned long)&bsg2150_data }, + { "INT3515", (unsigned long)&int3515_data }, { } }; MODULE_DEVICE_TABLE(acpi, smi_acpi_ids); From patchwork Wed Apr 20 09:41:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=creAVvP+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kjwgc1Fj2z9sG0 for ; Wed, 20 Apr 2022 19:42:20 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qi-0005f5-IW; Wed, 20 Apr 2022 09:42:12 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qb-0005T4-4V for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:42:05 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 999193F658 for ; Wed, 20 Apr 2022 09:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447723; bh=5Cm5eMtfcc6ZEHcb8+q+uzgbjn8I3r5hKNhUKcveNdg=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=creAVvP+yH4PKTG1ErMW2XmNGHZM3mix5XBw0eMg2EiFLJBXyMS7Co1XSa9rrAnRs MLAi4BcDV4QWrF2w+Ibknk1IL3WG8fqpv2nLcuFkCSfuo1wfxs425DXIrNYcLQb3MZ X7bF3TzxkumNJT2/HbU3ZhEwaXcjxOgJCT3mWR0AXCi52vrhV86OLzaYAFdcAzY+ER F9vfHyzFT5Trr3F2lwLdTYoac3SMiFJTHT0I1ZCcgnl23KXH1X19IuxIJgVhooKuXu 0xJSXW+PjNKxuWK+ytIoGP2fp226nQlx4ju3pT7AX4CsA4+Hbf0FTkX0agm20ci45M 68o4uECN7/2dQ== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 08/10] ALSA: hda/realtek: Add support for HP Laptops Date: Wed, 20 Apr 2022 17:41:30 +0800 Message-Id: <20220420094132.7732-9-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Lucas Tanure BugLink: https://bugs.launchpad.net/bugs/1965496 Add support for two and four CS35L41 using the component binding method Signed-off-by: Lucas Tanure Signed-off-by: Stefan Binding Reviewed-by: Takashi Iwai Link: https://lore.kernel.org/r/20220121172431.6876-9-sbinding@opensource.cirrus.com Signed-off-by: Hans de Goede (cherry picked from commit 07bcab93946cd9980f8eafe89afe991cd918acb0) Signed-off-by: Hui Wang --- sound/pci/hda/patch_realtek.c | 43 ++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 3a42457984e9..0ef70158f88c 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6662,6 +6662,16 @@ static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2); } +static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action) +{ + cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 2); +} + +static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action) +{ + cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 4); +} + static void alc287_legion_16achg6_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc, struct snd_pcm_substream *sub, int action) { @@ -6999,6 +7009,9 @@ enum { ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE, ALC287_FIXUP_LEGION_16ACHG6, ALC287_FIXUP_CS35L41_I2C_2, + ALC245_FIXUP_CS35L41_SPI_2, + ALC245_FIXUP_CS35L41_SPI_4, + ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED, ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED, }; @@ -8750,6 +8763,20 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = cs35l41_fixup_i2c_two, }, + [ALC245_FIXUP_CS35L41_SPI_2] = { + .type = HDA_FIXUP_FUNC, + .v.func = cs35l41_fixup_spi_two, + }, + [ALC245_FIXUP_CS35L41_SPI_4] = { + .type = HDA_FIXUP_FUNC, + .v.func = cs35l41_fixup_spi_four, + }, + [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc245_fixup_hp_gpio_led, + .chained = true, + .chain_id = ALC245_FIXUP_CS35L41_SPI_4, + }, [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = { .type = HDA_FIXUP_VERBS, .v.verbs = (const struct hda_verb[]) { @@ -8977,7 +9004,21 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED), - SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2), + SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2), + SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2), + SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2), + SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2), + SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2), + SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4), + SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2), + SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2), + SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2), + SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2), + SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2), + SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2), + SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2), SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF), SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), From patchwork Wed Apr 20 09:41:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619437 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=abXpZypA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kjwgd6n8Nz9sG0 for ; Wed, 20 Apr 2022 19:42:21 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qk-0005id-Va; Wed, 20 Apr 2022 09:42:15 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qc-0005Vl-Ad for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:42:06 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 36A833F66F for ; Wed, 20 Apr 2022 09:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447725; bh=8bZxJ+CD5XA3ERSoLb+Edk3D42YLpkKF/M4ptT51toY=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=abXpZypAzT5Zpe7GaZCcghNpcYb3bBejf14gxnhkG0ukySXcqqq5/EaufV3H7XNtT WlP25/j5AW+KqAmEslyZNyCdbnmxn7xKYgwqZ0EWglUbleQUB+DO7x1KXbMHQlkGes bxj3QqjAXXm95gib8sre+DNIC5Qvv/+EgPKFRf5V5ovn5Ez0nObyxk1rYupXdoMobo P/88sYDCpzA9YttK/O9hFgvgMUm8qBEaMv5YSFD1c/Zrq6I9XmE0fG2tn0IMGAji6u i4A4IduiySO7LrWsG2lcsKsMNoubQegvRKjt/TKv1akrLzpAL3YMoheq4SNzxIUwG1 M19DJhWgBlKCg== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 09/10] ACPI / scan: Create platform device for CS35L41 Date: Wed, 20 Apr 2022 17:41:31 +0800 Message-Id: <20220420094132.7732-10-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Lucas Tanure BugLink: https://bugs.launchpad.net/bugs/1965496 The ACPI device with CSC3551 or CLSA0100 are sound cards with multiple instances of CS35L41 connected by I2C or SPI to the main CPU. We add an ID to the ignore_serial_bus_ids list to enumerate all I2C or SPI devices correctly. The same IDs are also added into serial-multi-instantiate so that the driver can correctly enumerate the ACPI. Signed-off-by: Lucas Tanure Signed-off-by: Stefan Binding Link: https://lore.kernel.org/r/20220121172431.6876-10-sbinding@opensource.cirrus.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede (cherry picked from commit d9c01c530cc5e3b6d5bdfeae12c3d0f33fae7498) Signed-off-by: Hui Wang --- drivers/acpi/scan.c | 3 +++ drivers/platform/x86/serial-multi-instantiate.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 96dbd47657f6..34da4ad40d08 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1744,8 +1744,11 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) */ {"BSG1160", }, {"BSG2150", }, + {"CSC3551", }, {"INT33FE", }, {"INT3515", }, + /* Non-conforming _HID for Cirrus Logic already released */ + {"CLSA0100", }, /* * HIDs of device with an UartSerialBusV2 resource for which userspace * expects a regular tty cdev to be created (instead of the in kernel diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c index e2fd73905312..1e8063b7c169 100644 --- a/drivers/platform/x86/serial-multi-instantiate.c +++ b/drivers/platform/x86/serial-multi-instantiate.c @@ -307,6 +307,17 @@ static const struct smi_node int3515_data = { .bus_type = SMI_I2C, }; +static const struct smi_node cs35l41_hda = { + .instances = { + { "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 }, + { "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 }, + { "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 }, + { "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 }, + {} + }, + .bus_type = SMI_AUTO_DETECT, +}; + /* * Note new device-ids must also be added to ignore_serial_bus_ids in * drivers/acpi/scan.c: acpi_device_enumeration_by_parent(). @@ -315,6 +326,9 @@ static const struct acpi_device_id smi_acpi_ids[] = { { "BSG1160", (unsigned long)&bsg1160_data }, { "BSG2150", (unsigned long)&bsg2150_data }, { "INT3515", (unsigned long)&int3515_data }, + { "CSC3551", (unsigned long)&cs35l41_hda }, + /* Non-conforming _HID for Cirrus Logic already released */ + { "CLSA0100", (unsigned long)&cs35l41_hda }, { } }; MODULE_DEVICE_TABLE(acpi, smi_acpi_ids); From patchwork Wed Apr 20 09:41:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1619438 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=uxH8e0IW; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kjwgg3CP6z9sG0 for ; Wed, 20 Apr 2022 19:42:23 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nh6qm-0005ld-BV; Wed, 20 Apr 2022 09:42:16 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nh6qd-0005XU-Ex for kernel-team@lists.ubuntu.com; Wed, 20 Apr 2022 09:42:07 +0000 Received: from localhost.localdomain (unknown [123.112.71.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id D27E93F658 for ; Wed, 20 Apr 2022 09:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650447726; bh=A/Jmw9WU9/f+/Xzjn3nrwhN47oUcT2AN4hkQyh4tk5A=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uxH8e0IWXlEzEBbjUVbVd7ZaRJJ19p03fmKqdUwYHvMh+9D2aV8kHqXB/Uxysb3e8 CSJV8qXlnZKi71NXy3e/WCR/awR5t23iNFnatWbzgBrukD0MQaRRUM9TzZ6tUPjcKg SnPkGBJHfLhVxNknpolHlPSI7ezAaDv2V9Lc+jsvcTS6Wrk7zoivdLV4lmQ1otSxbG MDJZnV8jReHSmS8HX79yyTF69aIOaem0+E5XfL6Yfyn2SaOEwxpXMp8US2IGXwPoy/ 9XGTavGf+n/cDmwiKqHjmdC1ykDLYHjLsmyrIf79q8GNVBmMNmGWFPePG91RV+MOXL qALUIJDI9Qvfw== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.17][PATCH 10/10] UBUNTU: [Config]: enable SERIAL_MULTI_INSTANTIATE Date: Wed, 20 Apr 2022 17:41:32 +0800 Message-Id: <20220420094132.7732-11-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220420094132.7732-1-hui.wang@canonical.com> References: <20220420094132.7732-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1965496 Signed-off-by: Hui Wang --- debian.oem/abi/amd64/oem.modules | 1 - debian.oem/config/annotations | 5 ++++- debian.oem/config/config.common.ubuntu | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/debian.oem/abi/amd64/oem.modules b/debian.oem/abi/amd64/oem.modules index 8670234465fb..266cfc8e9de4 100644 --- a/debian.oem/abi/amd64/oem.modules +++ b/debian.oem/abi/amd64/oem.modules @@ -2005,7 +2005,6 @@ i2c-ismt i2c-kempld i2c-matroxfb i2c-mlxcpld -i2c-multi-instantiate i2c-mux i2c-mux-gpio i2c-mux-ltc4306 diff --git a/debian.oem/config/annotations b/debian.oem/config/annotations index f6ca5be14bf7..ac9cbb2aa024 100644 --- a/debian.oem/config/annotations +++ b/debian.oem/config/annotations @@ -10437,7 +10437,7 @@ CONFIG_SONY_LAPTOP policy<{'amd64': 'm'}> CONFIG_SONYPI_COMPAT policy<{'amd64': 'y'}> CONFIG_SYSTEM76_ACPI policy<{'amd64': 'm'}> CONFIG_TOPSTAR_LAPTOP policy<{'amd64': 'm'}> -CONFIG_I2C_MULTI_INSTANTIATE policy<{'amd64': 'm'}> +CONFIG_SERIAL_MULTI_INSTANTIATE policy<{'amd64': 'm'}> CONFIG_MLX_PLATFORM policy<{'amd64': 'm'}> CONFIG_TOUCHSCREEN_DMI policy<{'amd64': 'y'}> CONFIG_INTEL_IPS policy<{'amd64': 'm'}> @@ -10445,6 +10445,9 @@ CONFIG_INTEL_SCU_PCI policy<{'amd64': 'y'}> CONFIG_INTEL_SCU_PLATFORM policy<{'amd64': 'm'}> CONFIG_INTEL_SCU_IPC_UTIL policy<{'amd64': 'm'}> +# +CONFIG_SERIAL_MULTI_INSTANTIATE note + # Menu: Device Drivers >> X86 Platform Specific Device Drivers >> Dell X86 Platform Specific Device Drivers CONFIG_X86_PLATFORM_DRIVERS_DELL policy<{'amd64': 'y'}> CONFIG_ALIENWARE_WMI policy<{'amd64': 'm'}> diff --git a/debian.oem/config/config.common.ubuntu b/debian.oem/config/config.common.ubuntu index ff080aa2bcff..3b3cafb185fd 100644 --- a/debian.oem/config/config.common.ubuntu +++ b/debian.oem/config/config.common.ubuntu @@ -3239,7 +3239,6 @@ CONFIG_I2C_ISCH=m CONFIG_I2C_ISMT=m CONFIG_I2C_KEMPLD=m CONFIG_I2C_MLXCPLD=m -CONFIG_I2C_MULTI_INSTANTIATE=m CONFIG_I2C_MUX=m CONFIG_I2C_MUX_GPIO=m CONFIG_I2C_MUX_LTC4306=m @@ -7151,6 +7150,7 @@ CONFIG_SERIAL_MAX3100=m CONFIG_SERIAL_MAX310X=y CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_MEN_Z135=m +CONFIG_SERIAL_MULTI_INSTANTIATE=m CONFIG_SERIAL_NONSTANDARD=y CONFIG_SERIAL_RP2=m CONFIG_SERIAL_RP2_NR_UARTS=32