mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
misc: tegra_cec: add recover IOCTL
Provide error recovery from IOCTL to user space. Bug 1866338 Change-Id: I705ada6c8d4cb13f1c882993468f467da2908fdf Signed-off-by: Chun XU <chunx@nvidia.com> Reviewed-on: http://git-master/r/1300499 (cherry picked from commit a646f4903c8794641432fa838a27ee5584944eb5)
This commit is contained in:
@@ -304,12 +304,38 @@ out:
|
|||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static long tegra_cec_ioctl(struct file *file, unsigned int cmd,
|
||||||
|
unsigned long arg)
|
||||||
|
{
|
||||||
|
struct tegra_cec *cec = file->private_data;
|
||||||
|
|
||||||
|
if (_IOC_TYPE(cmd) != TEGRA_CEC_IOC_MAGIC)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
switch (cmd) {
|
||||||
|
case TEGRA_CEC_IOCTL_ERROR_RECOVERY:
|
||||||
|
mutex_lock(&cec->recovery_lock);
|
||||||
|
tegra_cec_error_recovery(cec);
|
||||||
|
mutex_unlock(&cec->recovery_lock);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dev_err(cec->dev, "unsupported ioctl\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct file_operations tegra_cec_fops = {
|
static const struct file_operations tegra_cec_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = tegra_cec_open,
|
.open = tegra_cec_open,
|
||||||
.release = tegra_cec_release,
|
.release = tegra_cec_release,
|
||||||
.read = tegra_cec_read,
|
.read = tegra_cec_read,
|
||||||
.write = tegra_cec_write,
|
.write = tegra_cec_write,
|
||||||
|
.unlocked_ioctl = tegra_cec_ioctl,
|
||||||
|
#ifdef CONFIG_COMPAT
|
||||||
|
.compat_ioctl = tegra_cec_ioctl,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static int tegra_cec_send_one_touch_play(struct tegra_cec *cec)
|
static int tegra_cec_send_one_touch_play(struct tegra_cec *cec)
|
||||||
@@ -534,6 +560,7 @@ static int tegra_cec_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
atomic_set(&cec->init_done, 0);
|
atomic_set(&cec->init_done, 0);
|
||||||
mutex_init(&cec->tx_lock);
|
mutex_init(&cec->tx_lock);
|
||||||
|
mutex_init(&cec->recovery_lock);
|
||||||
|
|
||||||
#if defined(CONFIG_TEGRA_NVDISPLAY) && defined(CONFIG_TEGRA_POWERGATE)
|
#if defined(CONFIG_TEGRA_NVDISPLAY) && defined(CONFIG_TEGRA_POWERGATE)
|
||||||
ret = tegra_nvdisp_unpowergate_partition(cec->soc->powergate_id);
|
ret = tegra_nvdisp_unpowergate_partition(cec->soc->powergate_id);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* drivers/misc/tegra-cec/tegra_cec.h
|
* drivers/misc/tegra-cec/tegra_cec.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2015, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2012-2017, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -31,6 +31,7 @@ struct tegra_cec {
|
|||||||
struct miscdevice misc_dev;
|
struct miscdevice misc_dev;
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
struct mutex tx_lock;
|
struct mutex tx_lock;
|
||||||
|
struct mutex recovery_lock;
|
||||||
void __iomem *cec_base;
|
void __iomem *cec_base;
|
||||||
int tegra_cec_irq;
|
int tegra_cec_irq;
|
||||||
wait_queue_head_t rx_waitq;
|
wait_queue_head_t rx_waitq;
|
||||||
@@ -163,4 +164,8 @@ static int tegra_cec_remove(struct platform_device *pdev);
|
|||||||
|
|
||||||
#define TEGRA_CEC_NAME "tegra_cec"
|
#define TEGRA_CEC_NAME "tegra_cec"
|
||||||
|
|
||||||
|
#define TEGRA_CEC_IOC_MAGIC 'C'
|
||||||
|
|
||||||
|
#define TEGRA_CEC_IOCTL_ERROR_RECOVERY _IO(TEGRA_CEC_IOC_MAGIC, 1)
|
||||||
|
|
||||||
#endif /* TEGRA_CEC_H */
|
#endif /* TEGRA_CEC_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user