From f77761802398f95f73be07b7381625b56a781df4 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Sun, 10 Dec 2023 07:11:31 +0000 Subject: [PATCH] bludroid_pm: Enable build of driver with Linux6.2 The build of driver is disabled from Linux 6.2 due to changes in core kernel where API of_get_named_gpio_flags() has been removed. This APIS is removed in commit 40fc56ee608cdb ("gpiolib: of: remove of_get_gpio[_flags]() and of_get_named_gpio_flags()") in Linux 6.2. Add support to use the new APIs for Linux 6.2 onwards. Bug 4346767 Change-Id: I573c13398945db93d2a3a3db81bfd53f1be159f6 Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031550 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/misc/Makefile | 2 -- drivers/misc/bluedroid_pm.c | 13 +++++++++++++ scripts/conftest/conftest.sh | 2 -- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index edcd1e64..8395c70d 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -8,8 +8,6 @@ obj-m += nvsciipc/ ifdef CONFIG_PCI obj-m += tegra-pcie-dma-test.o endif -ifneq ($(CONFIG_TEGRA_GPIO_LEGACY_DISABLE),y) obj-m += bluedroid_pm.o -endif obj-m += nvscic2c-pcie/ obj-m += ioctl_example.o diff --git a/drivers/misc/bluedroid_pm.c b/drivers/misc/bluedroid_pm.c index 74390f07..09eca66c 100644 --- a/drivers/misc/bluedroid_pm.c +++ b/drivers/misc/bluedroid_pm.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved */ +#include + #include #include #include @@ -341,7 +343,9 @@ static int bluedroid_pm_probe(struct platform_device *pdev) int ret; bool enable = false; /* off */ struct device_node *node; +#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */ enum of_gpio_flags of_flags; +#endif unsigned long flags; bluedroid_pm = devm_kzalloc(&pdev->dev, sizeof(*bluedroid_pm), GFP_KERNEL); @@ -365,9 +369,14 @@ static int bluedroid_pm_probe(struct platform_device *pdev) } } +#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */ bluedroid_pm->gpio_reset = of_get_named_gpio_flags(node, "bluedroid_pm,reset-gpio", 0, &of_flags); +#else + bluedroid_pm->gpio_reset = + of_get_named_gpio(node, "bluedroid_pm,reset-gpio", 0); +#endif bluedroid_pm->gpio_shutdown = of_get_named_gpio(node, "bluedroid_pm,shutdown-gpio", 0); bluedroid_pm->host_wake = @@ -380,7 +389,11 @@ static int bluedroid_pm_probe(struct platform_device *pdev) &bluedroid_pm->resume_min_frequency); if (gpio_is_valid(bluedroid_pm->gpio_reset)) { +#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */ flags = (of_flags == OF_GPIO_ACTIVE_LOW) ? GPIOF_ACTIVE_LOW : 0; +#else + flags = 0; +#endif ret = gpio_request_one(bluedroid_pm->gpio_reset, flags, "reset_gpio"); if (ret) { diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index dc8fc6d0..460fbb95 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -5463,9 +5463,7 @@ compile_test() { # in Linux 6.2. # CODE=" - #if defined(NV_LINUX_OF_GPIO_H_PRESENT) #include - #endif void conftest_of_get_named_gpio_flags(void) { of_get_named_gpio_flags();