mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
drivers:nvpps:Avoid freeing & re-request of PPS IRQ
Avoid freeing & re-requesting of PPS IRQ when switching between nvpps operating modes Bug 4007008 Bug 4079057 Change-Id: I193416b8cb37ed0d4fc5241e64d8109805bf330f Signed-off-by: Sheetal Tigadoli <stigadoli@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2914267 (cherry picked from commit ab9551812254c359dd6e5fd094b23fcfa921f67b) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3003992 Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
1267ce01fe
commit
3a40a01b9e
@@ -382,8 +382,14 @@ static irqreturn_t nvpps_gpio_isr(int irq, void *data)
|
|||||||
{
|
{
|
||||||
struct nvpps_device_data *pdev_data = (struct nvpps_device_data *)data;
|
struct nvpps_device_data *pdev_data = (struct nvpps_device_data *)data;
|
||||||
|
|
||||||
|
/* Incase, if an interrupt is generated
|
||||||
|
* then check current mode in use. Ignore the
|
||||||
|
* interrupt if current mode is TIMER mode
|
||||||
|
*/
|
||||||
|
if (!pdev_data->timer_inited) {
|
||||||
/* get timestamps for this event */
|
/* get timestamps for this event */
|
||||||
nvpps_get_ts(pdev_data, true);
|
nvpps_get_ts(pdev_data, true);
|
||||||
|
}
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
@@ -479,6 +485,8 @@ static int set_mode(struct nvpps_device_data *pdev_data, u32 mode)
|
|||||||
pdev_data->irq_registered = true;
|
pdev_data->irq_registered = true;
|
||||||
dev_info(pdev_data->dev, "Registered IRQ %d for nvpps\n", pdev_data->irq);
|
dev_info(pdev_data->dev, "Registered IRQ %d for nvpps\n", pdev_data->irq);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
dev_dbg(pdev_data->dev, "IRQ %d for nvpps is already registered\n", pdev_data->irq);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dev_err(pdev_data->dev, "unable to switch mode. Only timer mode is supported\n");
|
dev_err(pdev_data->dev, "unable to switch mode. Only timer mode is supported\n");
|
||||||
@@ -487,12 +495,14 @@ static int set_mode(struct nvpps_device_data *pdev_data, u32 mode)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NVPPS_MODE_TIMER:
|
case NVPPS_MODE_TIMER:
|
||||||
if (pdev_data->irq_registered) {
|
/* If GPIO mode is run and IRQ is registered previously,
|
||||||
/* unregister IRQ handler */
|
* then don't free the already requested IRQ. This is to
|
||||||
devm_free_irq(pdev_data->dev, pdev_data->irq, pdev_data);
|
* avoid free'ing and re-registering of the IRQ when
|
||||||
pdev_data->irq_registered = false;
|
* switching b/w the operating modes.
|
||||||
dev_info(pdev_data->dev, "removed IRQ %d for nvpps\n", pdev_data->irq);
|
*/
|
||||||
}
|
/* If TIMER mode is requested and not initialized
|
||||||
|
* already then initialize it
|
||||||
|
*/
|
||||||
if (!pdev_data->timer_inited) {
|
if (!pdev_data->timer_inited) {
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
|
||||||
setup_timer(&pdev_data->timer,
|
setup_timer(&pdev_data->timer,
|
||||||
|
|||||||
Reference in New Issue
Block a user