core/linux-imx6-cubox-dt cec fixes

This commit is contained in:
Dave Higham 2014-12-01 12:41:24 +00:00
parent 2301ca81e0
commit 7af209384c
4 changed files with 194 additions and 3 deletions

View file

@ -0,0 +1,85 @@
commit 7c545ae5467cca6ce537e213ecd647fcd4c3c4c0
Author: wolfgar <stephan.rafin@laposte.net>
Date: Fri Sep 12 01:42:52 2014 +0200
Remove superflous guards that could even break invocation from mxc-hdmi
diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c
index e53510f..88670bd 100644
--- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c
+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c
@@ -83,8 +83,6 @@ struct hdmi_cec_event {
static LIST_HEAD(head);
-static int hdmi_cec_ready = 0;
-static int hdmi_cec_started;
static int hdmi_cec_major;
static struct class *hdmi_cec_class;
static struct hdmi_cec_priv hdmi_cec_data;
@@ -315,7 +313,7 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf,
mutex_unlock(&hdmi_cec_data.lock);
return -EACCES;
}
- /* Ensure that there is only one writer who is the only listener of tx_cec_queue */
+ /* Ensure that there is only one writer who is the unique listener of tx_cec_queue */
if (hdmi_cec_data.tx_answer != CEC_TX_AVAIL) {
mutex_unlock(&hdmi_cec_data.lock);
return -EBUSY;
@@ -359,13 +357,11 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf,
return ret;
}
+
void hdmi_cec_start_device(void)
{
u8 val;
- if (!hdmi_cec_ready || hdmi_cec_started)
- return;
-
val = hdmi_readb(HDMI_MC_CLKDIS);
val &= ~HDMI_MC_CLKDIS_CECCLK_DISABLE;
hdmi_writeb(val, HDMI_MC_CLKDIS);
@@ -378,11 +374,7 @@ void hdmi_cec_start_device(void)
hdmi_writeb(val, HDMI_CEC_MASK);
hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0);
hdmi_cec_data.link_status = hdmi_readb(HDMI_PHY_STAT0) & 0x02;
- mutex_lock(&hdmi_cec_data.lock);
hdmi_cec_data.cec_state = true;
- mutex_unlock(&hdmi_cec_data.lock);
-
- hdmi_cec_started = 1;
}
EXPORT_SYMBOL(hdmi_cec_start_device);
@@ -390,9 +382,6 @@ void hdmi_cec_stop_device(void)
{
u8 val;
- if (!hdmi_cec_ready || !hdmi_cec_started)
- return;
-
hdmi_writeb(0x10, HDMI_CEC_CTRL);
val = HDMI_IH_CEC_STAT0_WAKEUP | HDMI_IH_CEC_STAT0_ERROR_FOLL | HDMI_IH_CEC_STAT0_ERROR_INIT | HDMI_IH_CEC_STAT0_ARB_LOST | \
HDMI_IH_CEC_STAT0_NACK | HDMI_IH_CEC_STAT0_EOM | HDMI_IH_CEC_STAT0_DONE;
@@ -402,11 +391,7 @@ void hdmi_cec_stop_device(void)
val = hdmi_readb(HDMI_MC_CLKDIS);
val |= HDMI_MC_CLKDIS_CECCLK_DISABLE;
hdmi_writeb(val, HDMI_MC_CLKDIS);
- mutex_lock(&hdmi_cec_data.lock);
hdmi_cec_data.cec_state = false;
- mutex_unlock(&hdmi_cec_data.lock);
-
- hdmi_cec_started = 0;
}
EXPORT_SYMBOL(hdmi_cec_stop_device);
@@ -580,7 +565,6 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&hdmi_cec_data.hdmi_cec_work, mxc_hdmi_cec_worker);
dev_info(&pdev->dev, "HDMI CEC initialized\n");
- hdmi_cec_ready = 1;
goto out;
err_out_class:

View file

@ -0,0 +1,29 @@
commit b6b72f40ec3b9d7faa0e37e87c3509848928746c
Author: wolfgar <stephan.rafin@laposte.net>
Date: Fri Sep 12 03:05:22 2014 +0200
Flush pending events at close
diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c
index 88670bd..f8b3f7a 100644
--- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c
+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c
@@ -466,11 +466,18 @@ static long hdmi_cec_ioctl(struct file *filp, u_int cmd,
*/
static int hdmi_cec_release(struct inode *inode, struct file *filp)
{
+ struct hdmi_cec_event *event, *tmp_event;
mutex_lock(&hdmi_cec_data.lock);
if (open_count) {
open_count = 0;
hdmi_cec_data.cec_state = false;
hdmi_cec_data.Logical_address = 15;
+
+ /* Flush eventual events which have not been read by user space */
+ list_for_each_entry_safe(event, tmp_event, &head, list) {
+ list_del(&event->list);
+ vfree(event);
+ }
}
mutex_unlock(&hdmi_cec_data.lock);

View file

@ -0,0 +1,67 @@
commit 83ee92e168bc5d744f96961254ffac95a6260220
Author: wolfgar <stephan.rafin@laposte.net>
Date: Sat Sep 13 01:58:08 2014 +0200
No longer try to get link status directly in this driver
Only consume the event sent by mxc-hdmi driver
diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c
index f8b3f7a..c30237e 100644
--- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c
+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c
@@ -67,7 +67,6 @@ struct hdmi_cec_priv {
u8 msg_len;
int tx_answer;
u16 latest_cec_stat;
- u8 link_status;
spinlock_t irq_lock;
struct delayed_work hdmi_cec_work;
struct mutex lock;
@@ -96,7 +95,6 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data)
struct hdmi_cec_priv *hdmi_cec = data;
u16 cec_stat = 0;
unsigned long flags;
- u8 phy_stat0;
irqreturn_t ret = IRQ_HANDLED;
spin_lock_irqsave(&hdmi_cec->irq_lock, flags);
@@ -105,7 +103,6 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data)
cec_stat = hdmi_readb(HDMI_IH_CEC_STAT0);
hdmi_writeb(cec_stat, HDMI_IH_CEC_STAT0);
- phy_stat0 = hdmi_readb(HDMI_PHY_STAT0) & 0x02;
if ((cec_stat & (HDMI_IH_CEC_STAT0_ERROR_INIT | \
HDMI_IH_CEC_STAT0_NACK | HDMI_IH_CEC_STAT0_EOM | \
@@ -113,14 +110,7 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data)
ret = IRQ_NONE;
cec_stat = 0;
}
- if (hdmi_cec->link_status ^ phy_stat0) {
- /* HPD value changed */
- hdmi_cec->link_status = phy_stat0;
- if (hdmi_cec->link_status)
- cec_stat |= 0x80; /* Connected */
- else
- cec_stat |= 0x100; /* Disconnected */
- }
+
pr_debug("HDMI CEC interrupt received\n");
hdmi_cec->latest_cec_stat = cec_stat ;
@@ -357,7 +347,6 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf,
return ret;
}
-
void hdmi_cec_start_device(void)
{
u8 val;
@@ -373,7 +362,6 @@ void hdmi_cec_start_device(void)
val = HDMI_IH_CEC_STAT0_WAKEUP | HDMI_IH_CEC_STAT0_ERROR_FOLL | HDMI_IH_CEC_STAT0_ARB_LOST;
hdmi_writeb(val, HDMI_CEC_MASK);
hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0);
- hdmi_cec_data.link_status = hdmi_readb(HDMI_PHY_STAT0) & 0x02;
hdmi_cec_data.cec_state = true;
}
EXPORT_SYMBOL(hdmi_cec_start_device);

View file

@ -15,7 +15,7 @@ _srcname=linux-imx6-3.14-${_commit}
_kernelname=${pkgname#linux}
_basekernel=3.14
pkgver=${_basekernel}.25
pkgrel=1
pkgrel=2
cryptodev_commit=6aa62a2c320b04f55fdfe0ed015c3d9b48997239
arch=('arm')
url="http://www.kernel.org/"
@ -26,13 +26,19 @@ source=("https://github.com/moonman/linux-imx6-3.14/archive/${_commit}.tar.gz"
"cryptodev.tar.gz::https://github.com/cryptodev-linux/cryptodev-linux/archive/${cryptodev_commit}.tar.gz"
"git://git.code.sf.net/p/aufs/aufs3-standalone#branch=aufs${pkgver:0:4}.21+"
'0001-Bluetooth-allocate-static-minor-for-vhci.patch'
'config')
'config'
'001_cec.patch'
'002_cec.patch'
'003_cec.patch')
md5sums=('f6305a76135fa60e92a23296b40b288a'
'ddf7876487c876f6676ef0e050e9d204'
'SKIP'
'1b276abe16d14e133f3f28d9c9e6bd68'
'fda0ec1623bf300f32abef27bd56495a')
'fda0ec1623bf300f32abef27bd56495a'
'8bf79a580704e8dab806f58043720a90'
'6391a74bf1d451b74df6f189a25cf642'
'a70798b63a0e7c3fb50a57ea1815d353')
prepare() {
cd "${srcdir}/${_srcname}"
@ -52,6 +58,10 @@ msg2 "Applying aufs3 patches"
patch -Np1 -i ../aufs3-standalone/aufs3-mmap.patch
patch -Np1 -i ../aufs3-standalone/aufs3-standalone.patch
msg2 "CEC patches"
patch -Np1 -i ${srcdir}/001_cec.patch
patch -Np1 -i ${srcdir}/002_cec.patch
patch -Np1 -i ${srcdir}/003_cec.patch
cat "${srcdir}/config" > ./.config