Re: [PATCH v7 06/14] drm/mediatek: Add HDMI support
Am Dienstag, den 29.12.2015, 16:49 +0800 schrieb Yingjoe Chen: > On Mon, 2015-11-30 at 22:07 +0100, Philipp Zabel wrote: > > From: Jie Qiu> > > > This patch adds drivers for the HDMI bridge connected to the DPI0 > > display subsystem function block, for the HDMI DDC block, and for > > the HDMI PHY to support HDMI output. > > > > Signed-off-by: Jie Qiu > > Signed-off-by: Philipp Zabel > > --- > <...> > > +static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi, > > + struct drm_display_mode *mode) > > +{ > > + struct hdmi_avi_infoframe frame; > > + u8 buffer[17]; > > + ssize_t err; > > + > > + err = drm_hdmi_avi_infoframe_from_display_mode(, mode); > > + if (err < 0) { > > + dev_err(hdmi->dev, > > + "Failed to get AVI infoframe from mode: %ld\n", err); > > Please use %zd instead for ssize_t, otherwise you'll see warning message > when compile this on 32bits platform. > > Joe.C Ok, thanks. regards Philipp -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7 06/14] drm/mediatek: Add HDMI support
On Mon, 2015-11-30 at 22:07 +0100, Philipp Zabel wrote: > From: Jie Qiu> > This patch adds drivers for the HDMI bridge connected to the DPI0 > display subsystem function block, for the HDMI DDC block, and for > the HDMI PHY to support HDMI output. > > Signed-off-by: Jie Qiu > Signed-off-by: Philipp Zabel > --- <...> > +static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi, > + struct drm_display_mode *mode) > +{ > + struct hdmi_avi_infoframe frame; > + u8 buffer[17]; > + ssize_t err; > + > + err = drm_hdmi_avi_infoframe_from_display_mode(, mode); > + if (err < 0) { > + dev_err(hdmi->dev, > + "Failed to get AVI infoframe from mode: %ld\n", err); Please use %zd instead for ssize_t, otherwise you'll see warning message when compile this on 32bits platform. Joe.C > + return err; > + } > + > + err = hdmi_avi_infoframe_pack(, buffer, sizeof(buffer)); > + if (err < 0) { > + dev_err(hdmi->dev, "Failed to pack AVI infoframe: %ld\n", err); > + return err; > + } > + > + mtk_hdmi_hw_send_info_frame(hdmi, buffer, sizeof(buffer)); > + return 0; > +} > + -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 06/14] drm/mediatek: Add HDMI support
From: Jie QiuThis patch adds drivers for the HDMI bridge connected to the DPI0 display subsystem function block, for the HDMI DDC block, and for the HDMI PHY to support HDMI output. Signed-off-by: Jie Qiu Signed-off-by: Philipp Zabel --- Changes since v6: - Removed mtk_hdmi_audio_data / mtk-hdmi-codec platform device creation for now, this will be reworked. --- drivers/gpu/drm/mediatek/Kconfig | 6 + drivers/gpu/drm/mediatek/Makefile| 8 + drivers/gpu/drm/mediatek/mtk_cec.c | 245 + drivers/gpu/drm/mediatek/mtk_cec.h | 25 + drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_hdmi_drv.c | 609 + drivers/gpu/drm/mediatek/mtk_hdmi.c | 484 + drivers/gpu/drm/mediatek/mtk_hdmi.h | 113 drivers/gpu/drm/mediatek/mtk_hdmi_ddc_drv.c | 362 + drivers/gpu/drm/mediatek/mtk_hdmi_hw.c | 757 +++ drivers/gpu/drm/mediatek/mtk_hdmi_hw.h | 76 +++ drivers/gpu/drm/mediatek/mtk_hdmi_phy.c | 340 drivers/gpu/drm/mediatek/mtk_hdmi_phy.h | 20 + drivers/gpu/drm/mediatek/mtk_hdmi_phy_regs.h | 118 + drivers/gpu/drm/mediatek/mtk_hdmi_regs.h | 221 include/drm/mediatek/mtk_hdmi_audio.h| 137 + 16 files changed, 3522 insertions(+) create mode 100644 drivers/gpu/drm/mediatek/mtk_cec.c create mode 100644 drivers/gpu/drm/mediatek/mtk_cec.h create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_hdmi_drv.c create mode 100644 drivers/gpu/drm/mediatek/mtk_hdmi.c create mode 100644 drivers/gpu/drm/mediatek/mtk_hdmi.h create mode 100644 drivers/gpu/drm/mediatek/mtk_hdmi_ddc_drv.c create mode 100644 drivers/gpu/drm/mediatek/mtk_hdmi_hw.c create mode 100644 drivers/gpu/drm/mediatek/mtk_hdmi_hw.h create mode 100644 drivers/gpu/drm/mediatek/mtk_hdmi_phy.c create mode 100644 drivers/gpu/drm/mediatek/mtk_hdmi_phy.h create mode 100644 drivers/gpu/drm/mediatek/mtk_hdmi_phy_regs.h create mode 100644 drivers/gpu/drm/mediatek/mtk_hdmi_regs.h create mode 100644 include/drm/mediatek/mtk_hdmi_audio.h diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig index 5343cf1..85af51c 100644 --- a/drivers/gpu/drm/mediatek/Kconfig +++ b/drivers/gpu/drm/mediatek/Kconfig @@ -14,3 +14,9 @@ config DRM_MEDIATEK This driver provides kernel mode setting and buffer management to userspace. +config DRM_MEDIATEK_HDMI + tristate "DRM HDMI Support for Mediatek SoCs" + depends on DRM_MEDIATEK + select GENERIC_PHY + help + DRM/KMS HDMI driver for Mediatek SoCs diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index cee9b23..d02cc19 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -12,3 +12,11 @@ mediatek-drm-y := mtk_disp_ovl.o \ obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o +mediatek-drm-hdmi-objs := mtk_drm_hdmi_drv.o \ + mtk_cec.o \ + mtk_hdmi_ddc_drv.o \ + mtk_hdmi.o \ + mtk_hdmi_hw.o \ + mtk_hdmi_phy.o + +obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o diff --git a/drivers/gpu/drm/mediatek/mtk_cec.c b/drivers/gpu/drm/mediatek/mtk_cec.c new file mode 100644 index 000..c339d2f --- /dev/null +++ b/drivers/gpu/drm/mediatek/mtk_cec.c @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2014 MediaTek Inc. + * Author: Jie Qiu + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include +#include +#include +#include + +#include "mtk_cec.h" + +#define TR_CONFIG 0x00 +#define CLEAR_CEC_IRQ BIT(15) + +#define CEC_CKGEN 0x04 +#define CEC_32K_PDNBIT(19) +#define PDNBIT(16) + +#define RX_EVENT 0x54 +#define HDMI_PORD BIT(25) +#define HDMI_HTPLG BIT(24) +#define HDMI_PORD_INT_EN BIT(9) +#define HDMI_HTPLG_INT_EN BIT(8) + +#define RX_GEN_WD 0x58 +#define HDMI_PORD_INT_32K_STATUS BIT(26) +#define RX_RISC_INT_32K_STATUS BIT(25) +#define HDMI_HTPLG_INT_32K_STATUS BIT(24) +#define HDMI_PORD_INT_32K_CLR BIT(18) +#define RX_INT_32K_CLR BIT(17) +#define HDMI_HTPLG_INT_32K_CLR BIT(16) +#define