From b268d2ef296a0ae9f9eb367fd345c70011f2906c Mon Sep 17 00:00:00 2001 From: Ankita Garg Date: Tue, 17 Sep 2013 14:29:09 -0700 Subject: [PATCH] misc: tegra-cec: Updates for T124 In T124, the RX_REGISTER_FULL interrupt is cleared by reading the RX_REGISTER instead of writing to the INT_STAT register as before. Bug 1364229 Change-Id: Ib080a48910304553b0752a3ede55ab0d7653dd77 Signed-off-by: Ankita Garg Reviewed-on: http://git-master/r/275982 Reviewed-on: http://git-master/r/1164137 (cherry picked from commit b890e7f50d3d032fc3ede4c4935fdf2c4501f063) --- drivers/misc/tegra-cec/tegra_cec.c | 8 +++----- drivers/misc/tegra-cec/tegra_cec.h | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/misc/tegra-cec/tegra_cec.c b/drivers/misc/tegra-cec/tegra_cec.c index a368a229..5b7a778e 100644 --- a/drivers/misc/tegra-cec/tegra_cec.c +++ b/drivers/misc/tegra-cec/tegra_cec.c @@ -100,7 +100,6 @@ ssize_t tegra_cec_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct tegra_cec *cec = file->private_data; - unsigned short rx_buffer; count = 2; if (cec->rx_wake == 0) @@ -109,12 +108,10 @@ ssize_t tegra_cec_read(struct file *file, char __user *buffer, wait_event_interruptible(cec->rx_waitq, cec->rx_wake == 1); - rx_buffer = readw(cec->cec_base + TEGRA_CEC_RX_REGISTER); - - if (copy_to_user(buffer, &rx_buffer, count)) + if (copy_to_user(buffer, &(cec->rx_buffer), count)) return -EFAULT; - rx_buffer = 0x0; + cec->rx_buffer = 0x0; cec->rx_wake = 0; return count; } @@ -142,6 +139,7 @@ static irqreturn_t tegra_cec_irq_handler(int irq, void *data) } else if (status & TEGRA_CEC_INT_STAT_RX_REGISTER_FULL) { writel((TEGRA_CEC_INT_STAT_RX_REGISTER_FULL), cec->cec_base + TEGRA_CEC_INT_STAT); + cec->rx_buffer = readw(cec->cec_base + TEGRA_CEC_RX_REGISTER); cec->rx_wake = 1; wake_up_interruptible(&cec->rx_waitq); } else if ((status & TEGRA_CEC_INT_STAT_TX_REGISTER_UNDERRUN) || diff --git a/drivers/misc/tegra-cec/tegra_cec.h b/drivers/misc/tegra-cec/tegra_cec.h index acc94dc6..4f908cc6 100644 --- a/drivers/misc/tegra-cec/tegra_cec.h +++ b/drivers/misc/tegra-cec/tegra_cec.h @@ -1,7 +1,7 @@ /* * drivers/misc/tegra-cec/tegra_cec.h * - * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -29,6 +29,7 @@ struct tegra_cec { wait_queue_head_t tx_waitq; unsigned int rx_wake; unsigned int tx_wake; + unsigned short rx_buffer; }; static int tegra_cec_remove(struct platform_device *pdev);