From d9abb90f16d6a9453c42325c4deaf5f9d43b2ecb Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Thu, 8 Sep 2022 06:49:03 +0000 Subject: [PATCH] pwm: tachometer: Remove unused APIs From Linux kernel version 6.0, some of the callback ops are removed from pwm like config, enable, disable. Remove the implementation of these callbacks for Linux kernel version 6.0 and above. Add the required callback for version 6.0 Note: This change is not tested on V6.0. This is the compilation fix. Bug 3767126 Bug 3789780 Change-Id: If95ccf584208d351a5478c77a7d417fcd6cdbc21 Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2773474 Reviewed-by: Jonathan Hunter GVS: Gerrit_Virtual_Submit --- drivers/pwm/pwm-tegra-tachometer.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/pwm/pwm-tegra-tachometer.c b/drivers/pwm/pwm-tegra-tachometer.c index f5e38c72..3de12efb 100644 --- a/drivers/pwm/pwm-tegra-tachometer.c +++ b/drivers/pwm/pwm-tegra-tachometer.c @@ -14,6 +14,8 @@ #include #include #include +#include + #define DRIVER_NAME "pwm_tach" /* Since oscillator clock (38.4MHz) serves as a clock source for @@ -140,6 +142,7 @@ static inline void tachometer_writel(struct pwm_tegra_tach *ptt, u32 val, writel(val, ptt->regs + reg); } +#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)) static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, int duty_ns, int period_ns) { @@ -157,6 +160,14 @@ static void tegra_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) { /* Dummy implementation for avoiding error from core */ } +#else +static int tegra_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) +{ + /* Dummy implementation for avoiding error from core */ + return 0; +} +#endif static inline void tach_update_mask(struct pwm_tegra_tach *ptt, u32 val, u32 reg_offset, u32 mask, @@ -297,9 +308,13 @@ static irqreturn_t tegra_pwm_tach_irq(int irq, void *dev) } static const struct pwm_ops pwm_tegra_tach_ops = { +#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)) .config = tegra_pwm_config, .enable = tegra_pwm_enable, .disable = tegra_pwm_disable, +#else + .apply = tegra_pwm_apply, +#endif .capture = pwm_tegra_tacho_capture, .owner = THIS_MODULE, };