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>
(cherry picked from commit f777618023)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3050579
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 b27e2e49de
commit 82f8d2b998
3 changed files with 13 additions and 4 deletions

View File

@@ -10,8 +10,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

View File

@@ -3,6 +3,8 @@
#include <nvidia/conftest.h>
#include <nvidia/conftest.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
@@ -342,7 +344,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);
@@ -366,9 +370,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 =
@@ -381,7 +390,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) {

View File

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