[PATCH 3/3] drm/bridge: Add ITE IT6251 bridge driver
Add driver for the ITE IT6251 LVDS-to-eDP bridge. Signed-off-by: Marek Vasut Cc: Daniel Vetter Cc: Sean Cross To: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/bridge/Kconfig | 9 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/ite-it6251.c | 582 3 files changed, 592 insertions(+) create mode 100644 drivers/gpu/drm/bridge/ite-it6251.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 0b9ca5862455..bebb78cf1ccf 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -35,6 +35,15 @@ config DRM_DUMB_VGA_DAC Support for non-programmable RGB to VGA DAC bridges, such as ADI ADV7123, TI THS8134 and THS8135 or passive resistor ladder DACs. +config DRM_ITE_IT6251 + tristate "ITE IT6251 LVDS/eDP bridge" + depends on OF + select DRM_KMS_HELPER + select DRM_PANEL + select REGMAP_I2C + help + ITE IT6251 LVDS-eDP bridge chip driver. + config DRM_LVDS_CODEC tristate "Transparent LVDS encoders and decoders support" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index cd16ce830270..b1af35c2151b 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o +obj-$(CONFIG_DRM_ITE_IT6251) += ite-it6251.o obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += megachips-stdp-ge-b850v3-fw.o obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o diff --git a/drivers/gpu/drm/bridge/ite-it6251.c b/drivers/gpu/drm/bridge/ite-it6251.c new file mode 100644 index ..78e86ebbad69 --- /dev/null +++ b/drivers/gpu/drm/bridge/ite-it6251.c @@ -0,0 +1,582 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2014 Sean Cross + * + * Rework for mainline: Marek Vasut + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +struct it6251_bridge { + struct i2c_client *client; + struct i2c_client *lvds_client; + struct regmap *regmap; + struct regmap *lvds_regmap; + struct regulator*regulator; + + struct drm_connectorconnector; + struct drm_bridge bridge; + struct drm_panel*panel; +}; + +/* Register definitions */ +#define IT6251_VENDOR_ID_LOW 0x00 +#define IT6251_VENDOR_ID_HIGH 0x01 +#define IT6251_DEVICE_ID_LOW 0x02 +#define IT6251_DEVICE_ID_HIGH 0x03 +#define IT6251_SYSTEM_STATUS 0x0d +#define IT6251_SYSTEM_STATUS_RINTSTATUSBIT(0) +#define IT6251_SYSTEM_STATUS_RHPDSTATUSBIT(1) +#define IT6251_SYSTEM_STATUS_RVIDEOSTABLE BIT(2) +#define IT6251_SYSTEM_STATUS_RPLL_IOLOCK BIT(3) +#define IT6251_SYSTEM_STATUS_RPLL_XPLOCK BIT(4) +#define IT6251_SYSTEM_STATUS_RPLL_SPLOCK BIT(5) +#define IT6251_SYSTEM_STATUS_RAUXFREQ_LOCK BIT(6) +#define IT6251_REF_STATE 0x0e +#define IT6251_REF_STATE_MAIN_LINK_DISABLEDBIT(0) +#define IT6251_REF_STATE_AUX_CHANNEL_READ BIT(1) +#define IT6251_REF_STATE_CR_PATTERNBIT(2) +#define IT6251_REF_STATE_EQ_PATTERNBIT(3) +#define IT6251_REF_STATE_NORMAL_OPERATION BIT(4) +#define IT6251_REF_STATE_MUTED BIT(5) +#define IT6251_RPCLK_CNT_LOW 0x13 +#define IT6251_RPCLK_CNT_HIGH 0x14 +#define IT6251_RPC_REQ 0x2b +#define IT6251_RPC_REQ_RPC_FIFOFULLBIT(6) +#define IT6251_RPC_REQ_RPC_FIFOEMPTY BIT(7) +#define IT6251_PCLK_CNT_LOW0x57 +#define IT6251_PCLK_CNT_HIGH 0x58 +#define IT6251_DPHDEW_LOW 0xa5 +#define IT6251_DPHDEW_HIGH 0xa6 +#define IT6251_DPVDEW_LOW 0xaf +#define IT6251_DPVDEW_HIGH 0xb0 +#define IT6251_LVDS_PORT_ADDR 0xfd +#define IT6251_LVDS_PORT_CTRL 0xfe +#define IT6251_LVDS_PORT_CTRL_EN BIT(0) + +/* + * Register programming sequences. + * NOTE: There is a lot of registers here which are completely undocumented + * and/or their meaning is not clear from the little documentation + * that is available for this chip. These values below just seem to + * work well enough. + */ +static const struct reg_sequence it6251_lvds_rx_sequence[] = { + { 0x05, 0x00 }, + + { 0x3b, 0x42 }, /* reset LVDSRX PLL */ + { 0x3b, 0x43 }, + + { 0x3c, 0x08 }, /* something with SSC PLL */ + { 0x0b, 0x88 }, /* don't swap links, wr
[PATCH 3/3] drm/bridge: Add ITE IT6251 bridge driver
Hi, On 10/17/2016 10:03 PM, Marek Vasut wrote: > Add driver for the ITE IT6251 LVDS-to-eDP bridge. > > Signed-off-by: Marek Vasut > Cc: Daniel Vetter > Cc: Sean Cross > --- > drivers/gpu/drm/bridge/Kconfig | 9 + > drivers/gpu/drm/bridge/Makefile | 1 + > drivers/gpu/drm/bridge/ite-it6251.c | 606 > > 3 files changed, 616 insertions(+) > create mode 100644 drivers/gpu/drm/bridge/ite-it6251.c > > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig > index 10e12e7..e9c96b9 100644 > --- a/drivers/gpu/drm/bridge/Kconfig > +++ b/drivers/gpu/drm/bridge/Kconfig > @@ -39,6 +39,15 @@ config DRM_DW_HDMI_AHB_AUDIO > Designware HDMI block. This is used in conjunction with > the i.MX6 HDMI driver. > > +config DRM_ITE_IT6251 > + tristate "ITE IT6251 LVDS/eDP bridge" > + depends on OF > + select DRM_KMS_HELPER > + select DRM_PANEL > + select REGMAP_I2C > + ---help--- > + ITE IT6251 LVDS-eDP bridge chip driver. > + > config DRM_NXP_PTN3460 > tristate "NXP PTN3460 DP/LVDS bridge" > depends on OF > diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile > index cdf3a3c..736dba7 100644 > --- a/drivers/gpu/drm/bridge/Makefile > +++ b/drivers/gpu/drm/bridge/Makefile > @@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o > obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o > obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o > obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o > +obj-$(CONFIG_DRM_ITE_IT6251) += ite-it6251.o > obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o > obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o > obj-$(CONFIG_DRM_SII902X) += sii902x.o > diff --git a/drivers/gpu/drm/bridge/ite-it6251.c > b/drivers/gpu/drm/bridge/ite-it6251.c > new file mode 100644 > index 000..a19bb4d > --- /dev/null > +++ b/drivers/gpu/drm/bridge/ite-it6251.c > @@ -0,0 +1,606 @@ > +/* We're trying to mention the bridge name, and what encoding it does for all bridge drivers. Could you describe it here too? Thanks. > + * Copyright (C) 2014 Sean Cross > + * > + * Rework for mainline: Marek Vasut > + * > + * This software is licensed under the terms of the GNU General Public > + * License version 2, as published by the Free Software Foundation, and > + * may be copied, distributed, and modified under those terms. > + * > + * 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 This shouldn't be needed. > +#include > +#include This too. > +#include > +#include > +#include > + > +#include "drmP.h" > +#include "drm_crtc.h" > +#include "drm_crtc_helper.h" > +#include "drm_atomic_helper.h" > + > +struct it6251_bridge { > + struct i2c_client *client; > + struct i2c_client *lvds_client; > + struct regmap *regmap; > + struct regmap *lvds_regmap; > + struct regulator*regulator; > + > + struct drm_connectorconnector; > + struct drm_bridge bridge; > + struct drm_panel*panel; > +}; > + > +/* Register definitions */ > +#define IT6251_VENDOR_ID_LOW 0x00 > +#define IT6251_VENDOR_ID_HIGH0x01 > +#define IT6251_DEVICE_ID_LOW 0x02 > +#define IT6251_DEVICE_ID_HIGH0x03 > +#define IT6251_SYSTEM_STATUS 0x0d > +#define IT6251_SYSTEM_STATUS_RINTSTATUS BIT(0) > +#define IT6251_SYSTEM_STATUS_RHPDSTATUS BIT(1) > +#define IT6251_SYSTEM_STATUS_RVIDEOSTABLEBIT(2) > +#define IT6251_SYSTEM_STATUS_RPLL_IOLOCK BIT(3) > +#define IT6251_SYSTEM_STATUS_RPLL_XPLOCK BIT(4) > +#define IT6251_SYSTEM_STATUS_RPLL_SPLOCK BIT(5) > +#define IT6251_SYSTEM_STATUS_RAUXFREQ_LOCK BIT(6) > +#define IT6251_REF_STATE 0x0e > +#define IT6251_REF_STATE_MAIN_LINK_DISABLED BIT(0) > +#define IT6251_REF_STATE_AUX_CHANNEL_READBIT(1) > +#define IT6251_REF_STATE_CR_PATTERN BIT(2) > +#define IT6251_REF_STATE_EQ_PATTERN BIT(3) > +#define IT6251_REF_STATE_NORMAL_OPERATIONBIT(4) > +#define IT6251_REF_STATE_MUTED BIT(5) > +#define IT6251_RPCLK_CNT_LOW 0x13 > +#define IT6251_RPCLK_CNT_HIGH0x14 > +#define IT6251_RPC_REQ 0x2b > +#define IT6251_RPC_REQ_RPC_FIFOFULL BIT(6) > +#define IT6251_RPC_REQ_RPC_FIFOEMPTY BIT(7) > +#define IT6251_PCLK_CNT_LOW 0x57 > +#define IT6251_PCLK_CNT_HIGH 0x58 > +#define IT6251_DPHDEW_LOW0xa5 > +#define IT6251_DPHDEW_HIGH 0xa6 > +#define IT6251_DPVDEW_LOW
[PATCH 3/3] drm/bridge: Add ITE IT6251 bridge driver
Add driver for the ITE IT6251 LVDS-to-eDP bridge. Signed-off-by: Marek Vasut Cc: Daniel Vetter Cc: Sean Cross --- drivers/gpu/drm/bridge/Kconfig | 9 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/ite-it6251.c | 606 3 files changed, 616 insertions(+) create mode 100644 drivers/gpu/drm/bridge/ite-it6251.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 10e12e7..e9c96b9 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -39,6 +39,15 @@ config DRM_DW_HDMI_AHB_AUDIO Designware HDMI block. This is used in conjunction with the i.MX6 HDMI driver. +config DRM_ITE_IT6251 + tristate "ITE IT6251 LVDS/eDP bridge" + depends on OF + select DRM_KMS_HELPER + select DRM_PANEL + select REGMAP_I2C + ---help--- + ITE IT6251 LVDS-eDP bridge chip driver. + config DRM_NXP_PTN3460 tristate "NXP PTN3460 DP/LVDS bridge" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index cdf3a3c..736dba7 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o +obj-$(CONFIG_DRM_ITE_IT6251) += ite-it6251.o obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o obj-$(CONFIG_DRM_SII902X) += sii902x.o diff --git a/drivers/gpu/drm/bridge/ite-it6251.c b/drivers/gpu/drm/bridge/ite-it6251.c new file mode 100644 index 000..a19bb4d --- /dev/null +++ b/drivers/gpu/drm/bridge/ite-it6251.c @@ -0,0 +1,606 @@ +/* + * Copyright (C) 2014 Sean Cross + * + * Rework for mainline: Marek Vasut + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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 +#include +#include +#include + +#include "drmP.h" +#include "drm_crtc.h" +#include "drm_crtc_helper.h" +#include "drm_atomic_helper.h" + +struct it6251_bridge { + struct i2c_client *client; + struct i2c_client *lvds_client; + struct regmap *regmap; + struct regmap *lvds_regmap; + struct regulator*regulator; + + struct drm_connectorconnector; + struct drm_bridge bridge; + struct drm_panel*panel; +}; + +/* Register definitions */ +#define IT6251_VENDOR_ID_LOW 0x00 +#define IT6251_VENDOR_ID_HIGH 0x01 +#define IT6251_DEVICE_ID_LOW 0x02 +#define IT6251_DEVICE_ID_HIGH 0x03 +#define IT6251_SYSTEM_STATUS 0x0d +#define IT6251_SYSTEM_STATUS_RINTSTATUSBIT(0) +#define IT6251_SYSTEM_STATUS_RHPDSTATUSBIT(1) +#define IT6251_SYSTEM_STATUS_RVIDEOSTABLE BIT(2) +#define IT6251_SYSTEM_STATUS_RPLL_IOLOCK BIT(3) +#define IT6251_SYSTEM_STATUS_RPLL_XPLOCK BIT(4) +#define IT6251_SYSTEM_STATUS_RPLL_SPLOCK BIT(5) +#define IT6251_SYSTEM_STATUS_RAUXFREQ_LOCK BIT(6) +#define IT6251_REF_STATE 0x0e +#define IT6251_REF_STATE_MAIN_LINK_DISABLEDBIT(0) +#define IT6251_REF_STATE_AUX_CHANNEL_READ BIT(1) +#define IT6251_REF_STATE_CR_PATTERNBIT(2) +#define IT6251_REF_STATE_EQ_PATTERNBIT(3) +#define IT6251_REF_STATE_NORMAL_OPERATION BIT(4) +#define IT6251_REF_STATE_MUTED BIT(5) +#define IT6251_RPCLK_CNT_LOW 0x13 +#define IT6251_RPCLK_CNT_HIGH 0x14 +#define IT6251_RPC_REQ 0x2b +#define IT6251_RPC_REQ_RPC_FIFOFULLBIT(6) +#define IT6251_RPC_REQ_RPC_FIFOEMPTY BIT(7) +#define IT6251_PCLK_CNT_LOW0x57 +#define IT6251_PCLK_CNT_HIGH 0x58 +#define IT6251_DPHDEW_LOW 0xa5 +#define IT6251_DPHDEW_HIGH 0xa6 +#define IT6251_DPVDEW_LOW 0xaf +#define IT6251_DPVDEW_HIGH 0xb0 +#define IT6251_LVDS_PORT_ADDR 0xfd +#define IT6251_LVDS_PORT_CTRL 0xfe +#define IT6251_LVDS_PORT_CTRL_EN BIT(0) + +/* + * Register programming sequences. + * NOTE: There is a lot of registers here which are completely undocumented + * and/or their meaning is not clear from the little documentation