cdi_mgr: Enable build of cdi_mgr for Linux 6.2

The build of cdi_mgr driver was disabled for Linux 6.2
as there is change in API in core kernel.

Enable build of cdi_mgr driver with appropriate modification
in driver for Linux 6.2.

Bug 4346767

Change-Id: I6315482b593926e1382a0ffc9ca8aa9a27740d11
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031551
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-10 11:03:53 +00:00
committed by mobile promotions
parent 3e87d0a8ea
commit 9174561352
2 changed files with 11 additions and 1 deletions

View File

@@ -3,8 +3,8 @@
ifneq ($(CONFIG_TEGRA_GPIO_LEGACY_DISABLE),y)
obj-m += cdi_gpio.o
obj-m += cdi_mgr.o
endif
obj-m += cdi_mgr.o
obj-m += cdi_dev.o
obj-m += cdi_pwm.o
ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),)

View File

@@ -14,6 +14,7 @@
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/of_irq.h>
#include <linux/of.h>
#include <linux/interrupt.h>
#include <asm/siginfo.h>
#include <linux/rcupdate.h>
@@ -1330,13 +1331,22 @@ static int cdi_mgr_of_get_grp_gpio(
{
int num, i;
#if defined(NV_OF_GPIO_NAMED_COUNT_PRESENT) /* Linux 6.2 */
num = of_gpio_named_count(np, name);
#else
num = of_count_phandle_with_args(np, name, "#gpio-cells");
#endif
dev_dbg(dev, " num gpios of %s: %d\n", name, num);
if (num < 0)
return 0;
for (i = 0; (i < num) && (i < size); i++) {
#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */
grp[i] = of_get_named_gpio_flags(np, name, i, &flags[i]);
#else
grp[i] = of_get_named_gpio(np, name, i);
flags[i] = 0;
#endif
if ((int)grp[i] < 0) {
dev_err(dev, "%s: gpio[%d] invalid\n", __func__, i);
return -EINVAL;