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 <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031550
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-10 07:11:31 +00:00
committed by mobile promotions
parent d5391a25ab
commit f777618023
3 changed files with 13 additions and 4 deletions

View File

@@ -8,8 +8,6 @@ obj-m += nvsciipc/
ifdef CONFIG_PCI ifdef CONFIG_PCI
obj-m += tegra-pcie-dma-test.o obj-m += tegra-pcie-dma-test.o
endif endif
ifneq ($(CONFIG_TEGRA_GPIO_LEGACY_DISABLE),y)
obj-m += bluedroid_pm.o obj-m += bluedroid_pm.o
endif
obj-m += nvscic2c-pcie/ obj-m += nvscic2c-pcie/
obj-m += ioctl_example.o obj-m += ioctl_example.o

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved */ /* Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved */
#include <nvidia/conftest.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
@@ -341,7 +343,9 @@ static int bluedroid_pm_probe(struct platform_device *pdev)
int ret; int ret;
bool enable = false; /* off */ bool enable = false; /* off */
struct device_node *node; struct device_node *node;
#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */
enum of_gpio_flags of_flags; enum of_gpio_flags of_flags;
#endif
unsigned long flags; unsigned long flags;
bluedroid_pm = devm_kzalloc(&pdev->dev, sizeof(*bluedroid_pm), GFP_KERNEL); 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 = bluedroid_pm->gpio_reset =
of_get_named_gpio_flags(node, "bluedroid_pm,reset-gpio", of_get_named_gpio_flags(node, "bluedroid_pm,reset-gpio",
0, &of_flags); 0, &of_flags);
#else
bluedroid_pm->gpio_reset =
of_get_named_gpio(node, "bluedroid_pm,reset-gpio", 0);
#endif
bluedroid_pm->gpio_shutdown = bluedroid_pm->gpio_shutdown =
of_get_named_gpio(node, "bluedroid_pm,shutdown-gpio", 0); of_get_named_gpio(node, "bluedroid_pm,shutdown-gpio", 0);
bluedroid_pm->host_wake = bluedroid_pm->host_wake =
@@ -380,7 +389,11 @@ static int bluedroid_pm_probe(struct platform_device *pdev)
&bluedroid_pm->resume_min_frequency); &bluedroid_pm->resume_min_frequency);
if (gpio_is_valid(bluedroid_pm->gpio_reset)) { 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; flags = (of_flags == OF_GPIO_ACTIVE_LOW) ? GPIOF_ACTIVE_LOW : 0;
#else
flags = 0;
#endif
ret = gpio_request_one(bluedroid_pm->gpio_reset, flags, ret = gpio_request_one(bluedroid_pm->gpio_reset, flags,
"reset_gpio"); "reset_gpio");
if (ret) { if (ret) {

View File

@@ -5463,9 +5463,7 @@ compile_test() {
# in Linux 6.2. # in Linux 6.2.
# #
CODE=" CODE="
#if defined(NV_LINUX_OF_GPIO_H_PRESENT)
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#endif
void conftest_of_get_named_gpio_flags(void) void conftest_of_get_named_gpio_flags(void)
{ {
of_get_named_gpio_flags(); of_get_named_gpio_flags();