MLK-18355-1: hdp-cec: Move imx8 hdp cec driver to mxc folder
Move iMX8 HDP CEC driver to MXC folder. Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>pull/10/head
parent
bd0a9b50e5
commit
a4e127a8db
|
@ -5,5 +5,3 @@ obj-$(CONFIG_DRM_IMX_HDP) += imx-hdp.o \
|
||||||
ss28fdsoi_hdmitx_table.o \
|
ss28fdsoi_hdmitx_table.o \
|
||||||
API_AFE_mcu1_dp.o \
|
API_AFE_mcu1_dp.o \
|
||||||
imx-hdp-audio.o
|
imx-hdp-audio.o
|
||||||
|
|
||||||
obj-$(CONFIG_IMX_HDP_CEC) += imx-cec.o \
|
|
||||||
|
|
|
@ -74,6 +74,21 @@ static void imx_hdp_state_init(struct imx_hdp *hdp)
|
||||||
state->rw = hdp->rw;
|
state->rw = hdp->rw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_IMX_HDP_CEC
|
||||||
|
static void imx_hdp_cec_init(struct imx_hdp *hdp)
|
||||||
|
{
|
||||||
|
struct imx_cec_dev *cec = &hdp->cec;
|
||||||
|
|
||||||
|
memset(cec, 0, sizeof(struct imx_cec_dev));
|
||||||
|
|
||||||
|
if (hdp->clks.clk_core)
|
||||||
|
cec->clk_core = hdp->clks.clk_core;
|
||||||
|
cec->dev = hdp->dev;
|
||||||
|
cec->mem = &hdp->mem;
|
||||||
|
cec->rw = hdp->rw;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void imx8qm_pixel_link_mux(state_struct *state, struct drm_display_mode *mode)
|
static void imx8qm_pixel_link_mux(state_struct *state, struct drm_display_mode *mode)
|
||||||
{
|
{
|
||||||
struct imx_hdp *hdp = state_to_imx_hdp(state);
|
struct imx_hdp *hdp = state_to_imx_hdp(state);
|
||||||
|
@ -1167,8 +1182,10 @@ static int imx_hdp_imx_bind(struct device *dev, struct device *master,
|
||||||
enable_irq(hdp->irq[HPD_IRQ_OUT]);
|
enable_irq(hdp->irq[HPD_IRQ_OUT]);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_IMX_HDP_CEC
|
#ifdef CONFIG_IMX_HDP_CEC
|
||||||
if (hdp->is_cec)
|
if (hdp->is_cec) {
|
||||||
|
imx_hdp_cec_init(hdp);
|
||||||
imx_cec_register(&hdp->cec);
|
imx_cec_register(&hdp->cec);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
imx_hdp_register_audio_driver(dev);
|
imx_hdp_register_audio_driver(dev);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include <drm/drm_dp_helper.h>
|
#include <drm/drm_dp_helper.h>
|
||||||
#include "../../../../mxc/hdp/all.h"
|
#include "../../../../mxc/hdp/all.h"
|
||||||
#include "imx-cec.h"
|
#include "../../../../mxc/hdp-cec/imx-hdp-cec.h"
|
||||||
|
|
||||||
/* For testing hdp firmware define DEBUG_FW_LOAD */
|
/* For testing hdp firmware define DEBUG_FW_LOAD */
|
||||||
#undef DEBUG_FW_LOAD
|
#undef DEBUG_FW_LOAD
|
||||||
|
|
|
@ -9,6 +9,7 @@ source "drivers/mxc/gpu-viv/Kconfig"
|
||||||
source "drivers/mxc/hantro/Kconfig"
|
source "drivers/mxc/hantro/Kconfig"
|
||||||
source "drivers/mxc/mlb/Kconfig"
|
source "drivers/mxc/mlb/Kconfig"
|
||||||
source "drivers/mxc/hdp/Kconfig"
|
source "drivers/mxc/hdp/Kconfig"
|
||||||
|
source "drivers/mxc/hdp-cec/Kconfig"
|
||||||
|
|
||||||
config MXC_SIM
|
config MXC_SIM
|
||||||
tristate "MXC SIM support"
|
tristate "MXC SIM support"
|
||||||
|
|
|
@ -10,5 +10,6 @@ obj-$(CONFIG_MXC_HANTRO_845) += hantro_845/
|
||||||
obj-$(CONFIG_MXC_HANTRO_845_H1) += hantro_845_h1/
|
obj-$(CONFIG_MXC_HANTRO_845_H1) += hantro_845_h1/
|
||||||
obj-$(CONFIG_MXC_VPU_MALONE) += vpu-malone/
|
obj-$(CONFIG_MXC_VPU_MALONE) += vpu-malone/
|
||||||
obj-$(CONFIG_MX8_HDP) += hdp/
|
obj-$(CONFIG_MX8_HDP) += hdp/
|
||||||
|
obj-$(CONFIG_IMX_HDP_CEC) += hdp-cec/
|
||||||
obj-$(CONFIG_MXC_VPU_DECODER) += vpu-decoder-b0/
|
obj-$(CONFIG_MXC_VPU_DECODER) += vpu-decoder-b0/
|
||||||
obj-$(CONFIG_MXC_VPU_ENCODER) += vpu-encoder-b0/
|
obj-$(CONFIG_MXC_VPU_ENCODER) += vpu-encoder-b0/
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
config IMX_HDP_CEC
|
||||||
|
bool "Enable IMX HDP CEC support"
|
||||||
|
depends on MEDIA_CEC
|
||||||
|
---help---
|
||||||
|
When selected the imx hdmi will support the optional HDMI CEC feature.
|
|
@ -0,0 +1 @@
|
||||||
|
obj-$(CONFIG_IMX_HDP_CEC) += imx-hdp-cec.o
|
|
@ -25,7 +25,7 @@
|
||||||
#include <media/cec.h>
|
#include <media/cec.h>
|
||||||
#include <soc/imx8/soc.h>
|
#include <soc/imx8/soc.h>
|
||||||
|
|
||||||
#include "imx-hdp.h"
|
#include "imx-hdp-cec.h"
|
||||||
|
|
||||||
#define CEC_NAME "hdp-cec"
|
#define CEC_NAME "hdp-cec"
|
||||||
|
|
||||||
|
@ -46,22 +46,18 @@
|
||||||
|
|
||||||
u32 cec_read(struct imx_cec_dev *cec, u32 offset)
|
u32 cec_read(struct imx_cec_dev *cec, u32 offset)
|
||||||
{
|
{
|
||||||
struct imx_hdp *hdp = container_of(cec, struct imx_hdp, cec);
|
|
||||||
struct hdp_mem *mem = &hdp->mem;
|
|
||||||
u32 addr = (offset << 2) + ADDR_HDP_CEC_BASE;
|
u32 addr = (offset << 2) + ADDR_HDP_CEC_BASE;
|
||||||
u32 value;
|
u32 value;
|
||||||
|
|
||||||
hdp->rw->read_reg(mem, addr, &value);
|
cec->rw->read_reg(cec->mem, addr, &value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cec_write(struct imx_cec_dev *cec, u32 offset, u32 value)
|
void cec_write(struct imx_cec_dev *cec, u32 offset, u32 value)
|
||||||
{
|
{
|
||||||
struct imx_hdp *hdp = container_of(cec, struct imx_hdp, cec);
|
|
||||||
struct hdp_mem *mem = &hdp->mem;
|
|
||||||
u32 addr = (offset << 2) + ADDR_HDP_CEC_BASE;
|
u32 addr = (offset << 2) + ADDR_HDP_CEC_BASE;
|
||||||
|
|
||||||
hdp->rw->write_reg(mem, addr, value);
|
cec->rw->write_reg(cec->mem, addr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cec_clear_rx_buffer(struct imx_cec_dev *cec)
|
void cec_clear_rx_buffer(struct imx_cec_dev *cec)
|
||||||
|
@ -143,7 +139,7 @@ u32 imx_cec_set_logical_addr(struct imx_cec_dev *cec, u32 la)
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 la_reg;
|
u8 la_reg;
|
||||||
|
|
||||||
if ((la >= MAX_LA_VAL)) {
|
if (la >= MAX_LA_VAL) {
|
||||||
dev_err(cec->dev, "Error logical Addr\n");
|
dev_err(cec->dev, "Error logical Addr\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -273,13 +269,12 @@ static const struct cec_adap_ops imx_cec_adap_ops = {
|
||||||
|
|
||||||
int imx_cec_register(struct imx_cec_dev *cec)
|
int imx_cec_register(struct imx_cec_dev *cec)
|
||||||
{
|
{
|
||||||
struct imx_hdp *hdp = container_of(cec, struct imx_hdp, cec);
|
struct device *dev = cec->dev;
|
||||||
struct device *dev = hdp->dev;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Set CEC clock divider */
|
/* Set CEC clock divider */
|
||||||
if (hdp->clks.clk_core)
|
if (cec->clk_core)
|
||||||
cec->clk_div = clk_get_rate(hdp->clks.clk_core) / 100000;
|
cec->clk_div = clk_get_rate(cec->clk_core) / 100000;
|
||||||
else
|
else
|
||||||
/* Default HDMI core clock rate 133MHz */
|
/* Default HDMI core clock rate 133MHz */
|
||||||
cec->clk_div = 1330;
|
cec->clk_div = 1330;
|
||||||
|
@ -301,9 +296,9 @@ int imx_cec_register(struct imx_cec_dev *cec)
|
||||||
cec->dev = dev;
|
cec->dev = dev;
|
||||||
|
|
||||||
cec->cec_worker = kthread_create(cec_poll_worker, cec, "hdp-cec");
|
cec->cec_worker = kthread_create(cec_poll_worker, cec, "hdp-cec");
|
||||||
if (IS_ERR(cec->cec_worker)) {
|
if (IS_ERR(cec->cec_worker))
|
||||||
dev_err(cec->dev, "failed create hdp cec thread\n");
|
dev_err(cec->dev, "failed create hdp cec thread\n");
|
||||||
}
|
|
||||||
wake_up_process(cec->cec_worker);
|
wake_up_process(cec->cec_worker);
|
||||||
|
|
||||||
dev_dbg(dev, "CEC successfuly probed\n");
|
dev_dbg(dev, "CEC successfuly probed\n");
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2017 NXP
|
* Copyright 2018 NXP
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -12,10 +12,12 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _IMX_CEC_H_
|
#ifndef _IMX_HDP_CEC_H_
|
||||||
#define _IMX_CEC_H_
|
#define _IMX_HDP_CEC_H_
|
||||||
|
|
||||||
#include <linux/cec.h>
|
#include <linux/cec.h>
|
||||||
|
#include "../hdp/util.h"
|
||||||
|
#include "../hdp/address.h"
|
||||||
|
|
||||||
/* regsiter define */
|
/* regsiter define */
|
||||||
/* register TX_MSG_HEADER */
|
/* register TX_MSG_HEADER */
|
||||||
|
@ -328,13 +330,18 @@ struct imx_cec_dev {
|
||||||
struct cec_adapter *adap;
|
struct cec_adapter *adap;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct mutex lock;
|
struct mutex lock;
|
||||||
void __iomem *reg_base;
|
|
||||||
|
|
||||||
struct cec_msg msg;
|
struct cec_msg msg;
|
||||||
u32 clk_div;
|
u32 clk_div;
|
||||||
struct task_struct *cec_worker;
|
struct task_struct *cec_worker;
|
||||||
|
|
||||||
|
/* inited by HDP controller driver */
|
||||||
|
struct clk *clk_core;
|
||||||
|
struct hdp_mem *mem;
|
||||||
|
struct hdp_rw_func *rw;
|
||||||
};
|
};
|
||||||
|
|
||||||
int imx_cec_register(struct imx_cec_dev *cec);
|
int imx_cec_register(struct imx_cec_dev *cec);
|
||||||
int imx_cec_unregister(struct imx_cec_dev *cec);
|
int imx_cec_unregister(struct imx_cec_dev *cec);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue