tegra-cec: add interface to get post_recovery

Provide IOCTL interface for usersapce to get whether current boot is from
booting from recovery.

Bug 200394215

Change-Id: I45f492b766a75542ff470366001f92fa2fd65d23
Signed-off-by: Chun Xu <chunx@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1780659
(cherry picked from commit 8a4bda6d7e0904ce9c0cafabac4aefb49e879b8b)
Reviewed-on: https://git-master.nvidia.com/r/1792946
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Chun Xu
2018-07-18 15:19:06 +08:00
committed by Jon Hunter
parent 64d16c1ddf
commit 2efe0a33c4
2 changed files with 19 additions and 12 deletions

View File

@@ -57,7 +57,7 @@
*/ */
#define CEC_XFER_TIMEOUT_MS (5 * 400 + 100) #define CEC_XFER_TIMEOUT_MS (5 * 400 + 100)
static bool previous_reboot_reason_is_recovery, text_view_on_sent; static bool post_recovery, text_view_on_sent;
static u8 text_view_on_command[] = { static u8 text_view_on_command[] = {
LOGICAL_ADDRESS_RESERVED2 << 4 | LOGICAL_ADDRESS_TV, LOGICAL_ADDRESS_RESERVED2 << 4 | LOGICAL_ADDRESS_TV,
TEXT_VIEW_ON TEXT_VIEW_ON
@@ -400,6 +400,13 @@ static long tegra_cec_ioctl(struct file *file, unsigned int cmd,
return -EFAULT; return -EFAULT;
} }
break; break;
case TEGRA_CEC_IOCTL_GET_POST_RECOVERY:
err = !access_ok(VERIFY_WRITE, arg, sizeof(u32));
if (err)
return -EFAULT;
if (copy_to_user((bool *) arg, &post_recovery, sizeof(bool)))
return -EFAULT;
break;
default: default:
dev_err(cec->dev, "unsupported ioctl\n"); dev_err(cec->dev, "unsupported ioctl\n");
return -EINVAL; return -EINVAL;
@@ -531,7 +538,7 @@ static void tegra_cec_init(struct tegra_cec *cec)
atomic_set(&cec->init_done, 1); atomic_set(&cec->init_done, 1);
wake_up_interruptible(&cec->init_waitq); wake_up_interruptible(&cec->init_waitq);
if (!text_view_on_sent && !previous_reboot_reason_is_recovery) if (!text_view_on_sent && !post_recovery)
tegra_cec_send_one_touch_play(cec); tegra_cec_send_one_touch_play(cec);
dev_notice(cec->dev, "%s Done.\n", __func__); dev_notice(cec->dev, "%s Done.\n", __func__);
} }
@@ -803,17 +810,16 @@ static int tegra_cec_resume(struct platform_device *pdev)
} }
#endif #endif
static int __init check_previous_reboot_reason_is_recovery(char *options) static int __init check_post_recovery(char *options)
{ {
previous_reboot_reason_is_recovery = true; post_recovery = true;
pr_info("tegra_cec: the previous_reboot_reason is%s recovery.\n", pr_info("tegra_cec: the post_recovery is %d .\n", post_recovery);
previous_reboot_reason_is_recovery ? "" : " not");
return 0; return 0;
} }
early_param("post_recovery", check_previous_reboot_reason_is_recovery); early_param("post_recovery", check_post_recovery);
static struct tegra_cec_soc tegra210_soc_data = { static struct tegra_cec_soc tegra210_soc_data = {
.powergate_id = TEGRA210_POWER_DOMAIN_DISA, .powergate_id = TEGRA210_POWER_DOMAIN_DISA,

View File

@@ -77,7 +77,7 @@ static int tegra_cec_remove(struct platform_device *pdev);
#define TEGRA_CEC_INT_MASK 0X034 #define TEGRA_CEC_INT_MASK 0X034
#define TEGRA_CEC_HW_DEBUG_RX 0X038 #define TEGRA_CEC_HW_DEBUG_RX 0X038
#define TEGRA_CEC_HW_DEBUG_TX 0X03C #define TEGRA_CEC_HW_DEBUG_TX 0X03C
#define TEGRA_CEC_HW_SPARE 0X03C #define TEGRA_CEC_HW_SPARE 0X040
#define TEGRA_CEC_MAX_LOGICAL_ADDR 15 #define TEGRA_CEC_MAX_LOGICAL_ADDR 15
#define TEGRA_CEC_HWCTRL_RX_LADDR_UNREG 0x0 #define TEGRA_CEC_HWCTRL_RX_LADDR_UNREG 0x0
@@ -167,9 +167,10 @@ static int tegra_cec_remove(struct platform_device *pdev);
#define TEGRA_CEC_IOC_MAGIC 'C' #define TEGRA_CEC_IOC_MAGIC 'C'
#define TEGRA_CEC_IOCTL_ERROR_RECOVERY _IO(TEGRA_CEC_IOC_MAGIC, 1) #define TEGRA_CEC_IOCTL_ERROR_RECOVERY _IO(TEGRA_CEC_IOC_MAGIC, 1)
#define TEGRA_CEC_IOCTL_DUMP_REGISTERS _IO(TEGRA_CEC_IOC_MAGIC, 2) #define TEGRA_CEC_IOCTL_DUMP_REGISTERS _IO(TEGRA_CEC_IOC_MAGIC, 2)
#define TEGRA_CEC_IOCTL_SET_RX_SNOOP _IO(TEGRA_CEC_IOC_MAGIC, 3) #define TEGRA_CEC_IOCTL_SET_RX_SNOOP _IO(TEGRA_CEC_IOC_MAGIC, 3)
#define TEGRA_CEC_IOCTL_GET_RX_SNOOP _IO(TEGRA_CEC_IOC_MAGIC, 4) #define TEGRA_CEC_IOCTL_GET_RX_SNOOP _IO(TEGRA_CEC_IOC_MAGIC, 4)
#define TEGRA_CEC_IOCTL_GET_POST_RECOVERY _IO(TEGRA_CEC_IOC_MAGIC, 5)
#endif /* TEGRA_CEC_H */ #endif /* TEGRA_CEC_H */