From 913e17563bd652b3293f91633bc9918cd641ccf6 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Wed, 19 Jun 2024 16:25:50 +0100 Subject: [PATCH] media: camera: Use of_pwm_xlate_with_flags() In Linux v6.11, commit d6f66e292676 ("pwm: Make pwm_request_from_chip() private to the core") made the function pwm_request_from_chip() a private function to the PWM core driver. This function is used by both the CDI and ISC camera drivers and so these driver no longer build against Linux v6.11. Fix this by updating the CDI and ISC drivers to use the function of_pwm_xlate_with_flags() which has been supported since Linux v3.8. This function internally calls pwm_request_from_chip() and configures the pwm->args.period parameter and is therefore, equivalent to the existing code. Bug 4749580 Change-Id: Id1381ebc08730aaaa6c3591d90bcc4cc95a6c235 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3176063 (cherry picked from commit f3088071976193dbcfcb0db55d0ed745822ae433) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3178155 GVS: buildbot_gerritrpt Reviewed-by: Brad Griffis --- drivers/media/platform/tegra/cdi/cdi_pwm.c | 7 +++++-- drivers/media/platform/tegra/isc/isc_pwm.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/tegra/cdi/cdi_pwm.c b/drivers/media/platform/tegra/cdi/cdi_pwm.c index a6f22d34..08157ff2 100644 --- a/drivers/media/platform/tegra/cdi/cdi_pwm.c +++ b/drivers/media/platform/tegra/cdi/cdi_pwm.c @@ -106,8 +106,11 @@ static struct pwm_device *of_cdi_pwm_xlate(struct pwm_chip *pc, #endif int err = 0; - pwm = pwm_request_from_chip(pc, args->args[0], NULL); - if (!args->args[1]) { + pwm = of_pwm_xlate_with_flags(pc, args); + if (IS_ERR(pwm)) + return NULL; + + if (!pwm->args.period) { dev_err(dev, "Period should be larger than 0\n"); return NULL; } diff --git a/drivers/media/platform/tegra/isc/isc_pwm.c b/drivers/media/platform/tegra/isc/isc_pwm.c index ca39bae5..a75fb553 100644 --- a/drivers/media/platform/tegra/isc/isc_pwm.c +++ b/drivers/media/platform/tegra/isc/isc_pwm.c @@ -106,8 +106,11 @@ static struct pwm_device *of_isc_pwm_xlate(struct pwm_chip *pc, #endif int err = 0; - pwm = pwm_request_from_chip(pc, args->args[0], NULL); - if (!args->args[1]) { + pwm = of_pwm_xlate_with_flags(pc, args); + if (IS_ERR(pwm)) + return NULL; + + if (!pwm->args.period) { dev_err(dev, "Period should be larger than 0\n"); return NULL; }