diff options
author | Sandor Yu <Sandor.yu@nxp.com> | 2018-05-21 10:58:46 +0800 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 50449a1b98fbe6fbf447a89b66deefc625b214aa (patch) | |
tree | 27f47013693870d2ab4b41af72a2df3c394dac5a /drivers/media/platform | |
parent | 3178bc9b6087e56f40e1c4e7764815cb4dbeb606 (diff) |
MLK-18355-8: hdmi rx: Add HDMI RX CEC function
Add HDMI RX CEC function in hdmi rx driver.
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.c | 33 | ||||
-rw-r--r-- | drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.h | 5 |
2 files changed, 37 insertions, 1 deletions
diff --git a/drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.c b/drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.c index 844cb97e1eff..2ec13660c5cb 100644 --- a/drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.c +++ b/drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.c @@ -28,6 +28,8 @@ #define imx_sd_to_hdmi(sd) container_of(sd, struct mxc_hdmi_rx_dev, sd) +static void mxc_hdmi_cec_init(struct mxc_hdmi_rx_dev *hdmi_rx); + static const struct v4l2_dv_timings_cap mxc_hdmi_timings_cap = { .type = V4L2_DV_BT_656_1120, /* keep this initialization for compatibility with GCC < 4.4.6 */ @@ -625,6 +627,24 @@ static void mxc_hdmi_state_init(struct mxc_hdmi_rx_dev *hdmi_rx) state->rw = &imx8qm_rw; } +#ifdef CONFIG_IMX_HDP_CEC +static void mxc_hdmi_cec_init(struct mxc_hdmi_rx_dev *hdmi_rx) +{ + state_struct *state = &hdmi_rx->state; + struct imx_cec_dev *cec = &hdmi_rx->cec; + u32 clk_rate; + + memset(cec, 0, sizeof(struct imx_cec_dev)); + + CDN_API_GetClock(state, &clk_rate); + cec->clk_div = clk_rate * 10; + cec->dev = &hdmi_rx->pdev->dev; + cec->mem = &hdmi_rx->mem; + cec->rw = &imx8qm_rw; +} +#endif + + int mxc_hdmi_init(struct mxc_hdmi_rx_dev *hdmi_rx) { sc_err_t sciErr; @@ -730,6 +750,8 @@ static int mxc_hdmi_probe(struct platform_device *pdev) media_entity_cleanup(&hdmi_rx->sd.entity); } + hdmi_rx->is_cec = of_property_read_bool(pdev->dev.of_node, "fsl,cec"); + mxc_hdmi_clock_init(hdmi_rx); hdmi_rx->flags = MXC_HDMI_RX_PM_POWERED; @@ -748,6 +770,12 @@ static int mxc_hdmi_probe(struct platform_device *pdev) dev_info(dev, "mxc hdmi rx startup failed\n"); goto failed; } +#ifdef CONFIG_IMX_HDP_CEC + if (hdmi_rx->is_cec) { + mxc_hdmi_cec_init(hdmi_rx); + imx_cec_register(&hdmi_rx->cec); + } +#endif dev_info(dev, "mxc hdmi rx probe successfully\n"); @@ -773,6 +801,11 @@ static int mxc_hdmi_remove(struct platform_device *pdev) v4l2_async_unregister_subdev(&hdmi_rx->sd); media_entity_cleanup(&hdmi_rx->sd.entity); +#ifdef CONFIG_IMX_HDP_CEC + if (hdmi_rx->is_cec) + imx_cec_unregister(&hdmi_rx->cec); +#endif + /* Reset HDMI RX PHY */ CDN_API_HDMIRX_Stop_blocking(state); CDN_API_MainControl_blocking(state, 0, &sts); diff --git a/drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.h b/drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.h index 6f15f7bd89c3..777d6238190d 100644 --- a/drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.h +++ b/drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.h @@ -35,6 +35,7 @@ #include <uapi/linux/v4l2-dv-timings.h> #include "../../../../mxc/hdp/all.h" +#include "../../../../mxc/hdp-cec/imx-hdp-cec.h" #define state_to_mxc_hdmirx(env) \ container_of(env, struct mxc_hdmi_rx_dev, state) @@ -102,7 +103,6 @@ struct mxc_hdmi_rx_dev { struct clk *enc_clk; struct clk *spdif_clk; struct clk *pxl_link_clk; - struct hdp_rw_func *rw; struct hdp_mem mem; u32 flags; @@ -115,6 +115,9 @@ struct mxc_hdmi_rx_dev { u8 hdmi_vic; u8 pixel_encoding; u8 color_depth; + + u8 is_cec; + struct imx_cec_dev cec; }; enum mxc_hdmi_rx_power_state { |