pwm: Use conftest to find if pwm_ops has config

Use conftest to determine if pwm_ops struct has config
callback or not. This call back is deprecated from
commit 0829c35dc534 ("pwm: Drop support for legacy drivers")
in Linux 6.0.

Bug 4387902

Change-Id: Ic56d5955e5cfd15acb664fc11b549b9b91277182
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037039
Reviewed-by: Shardar Mohammed <smohammed@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-18 11:47:47 +00:00
committed by mobile promotions
parent 9974fda1d2
commit b7cbe748e1
3 changed files with 19 additions and 3 deletions

View File

@@ -16,7 +16,6 @@
#include <linux/io.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/version.h>
#define DRIVER_NAME "pwm_tach"
@@ -144,7 +143,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))
#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */
static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
int duty_ns, int period_ns)
{
@@ -310,7 +309,7 @@ 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))
#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */
.config = tegra_pwm_config,
.enable = tegra_pwm_enable,
.disable = tegra_pwm_disable,