-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/workqueue.h>
#include <linux/delay.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
#include <linux/errno.h>
+#include <linux/firmware.h>
+#include <linux/ioctl.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pagemap.h>
+#include <linux/slab.h>
#include <linux/string.h>
#include <linux/workqueue.h>
-#include <linux/firmware.h>
#include "rockchip-hdmi-cec.h"
-#include "linux/ioctl.h"
-#include "linux/pagemap.h"
static struct cec_device *cec_dev;
static int cecreadframe(struct cec_framedata *frame)
{
- if (!frame || !cec_dev || !cec_dev->readframe || !cec_dev->enable)
- return -1;
- else
- return cec_dev->readframe(cec_dev->hdmi, frame);
+ int ret = -1;
+
+ if (frame && cec_dev && cec_dev->readframe && cec_dev->enable) {
+ mutex_lock(&cec_dev->hdmi->pclk_lock);
+ ret = cec_dev->readframe(cec_dev->hdmi, frame);
+ mutex_unlock(&cec_dev->hdmi->pclk_lock);
+ }
+ return ret;
}
static int cecsendframe(struct cec_framedata *frame)
{
- if (!frame || !cec_dev || !cec_dev->readframe)
- return -1;
- else
- return cec_dev->sendframe(cec_dev->hdmi, frame);
+ int ret = -1;
+
+ if (frame && cec_dev && cec_dev->sendframe) {
+ mutex_lock(&cec_dev->hdmi->pclk_lock);
+ ret = cec_dev->sendframe(cec_dev->hdmi, frame);
+ mutex_unlock(&cec_dev->hdmi->pclk_lock);
+ }
+ return ret;
+}
+
+static void cecsetlogicaddr(int addr)
+{
+ if (cec_dev && cec_dev->setceclogicaddr) {
+ mutex_lock(&cec_dev->hdmi->pclk_lock);
+ cec_dev->setceclogicaddr(cec_dev->hdmi, addr);
+ mutex_unlock(&cec_dev->hdmi->pclk_lock);
+ }
}
static void cecworkfunc(struct work_struct *work)
case HDMI_IOCTL_CECSETLA:
ret = copy_from_user(&cec_dev->address_logic,
argp, sizeof(int));
- if (cec_dev->setceclogicaddr)
- cec_dev->setceclogicaddr(cec_dev->hdmi,
- cec_dev->address_logic);
+ cecsetlogicaddr(cec_dev->address_logic);
break;
case HDMI_IOCTL_CECSEND:
ret = copy_from_user(&cecsendtemp, argp,
0x1d);
}
-#define HDMI_PD_ON BIT(0)
-#define HDMI_PCLK_ON BIT(1)
-#define HDMI_HDCPCLK_ON BIT(2)
-#define HDMI_CECCLK_ON BIT(3)
-#define HDMI_EXT_PHY_CLK_ON BIT(4)
-
static int rockchip_hdmiv2_clk_enable(struct hdmi_dev *hdmi_dev)
{
if ((hdmi_dev->clk_on & HDMI_PD_ON) == 0) {
0, 1);
if (hdmi_dev->hdcp2_en)
hdmi_dev->hdcp2_en(0);
+ mutex_lock(&hdmi->pclk_lock);
rockchip_hdmiv2_clk_disable(hdmi_dev);
+ mutex_unlock(&hdmi->pclk_lock);
#ifdef CONFIG_PINCTRL
if (hdmi_dev->soctype == HDMI_SOC_RK3288)
gpio_state =
pinctrl_select_state(pins->p,
pins->default_state);
#endif
+ mutex_lock(&hdmi->pclk_lock);
rockchip_hdmiv2_clk_enable(hdmi_dev);
+ mutex_unlock(&hdmi->pclk_lock);
rockchip_hdmiv2_dev_initial(hdmi_dev);
if (hdmi->ops->hdcp_power_on_cb)
hdmi->ops->hdcp_power_on_cb();
int i, count;
char *data = (char *)frame;
- if (!frame)
+ if (((hdmi_dev->clk_on & HDMI_PCLK_ON) == 0) || !frame)
return -1;
count = hdmi_readl(hdmi_dev, CEC_RX_CNT);
CECDBG("%s count %d\n", __func__, count);
struct hdmi_dev *hdmi_dev = hdmi->property->priv;
short val;
+ if ((hdmi_dev->clk_on & HDMI_PCLK_ON) == 0)
+ return;
if (ceclgaddr < 0 || ceclgaddr > 16)
return;
val = 1 << ceclgaddr;
struct hdmi_dev *hdmi_dev = hdmi->property->priv;
int i, interrupt;
+ if ((hdmi_dev->clk_on & HDMI_PCLK_ON) == 0)
+ return CEC_SEND_NACK;
CECDBG("TX srcdestaddr %02x opcode %02x ",
frame->srcdestaddr, frame->opcode);
if (frame->argcount) {