From 113ff6615d9302ccc8d4295f6b76f7e2875a2b02 Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Wed, 9 Aug 2017 12:13:07 +0300 Subject: KF: ADV7511 edid fixes, i2c2 speed 400khz, hsusb ws2.0 enable 1) fix edid get via adv7511 2) increase i2c2 speed from 100 to 400khz sine #1 fixed 3) enable hsusb for H3 ws2.0 --- .../0040-arm64-dts-renesas-add-ADAS-boards.patch | 48 ++++++++++++-------- ...68-drm-adv7511-use-smbus-to-retrieve-edid.patch | 53 ++++++++++++++++++++++ .../linux/linux-renesas_4.9.bbappend | 1 + 3 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0068-drm-adv7511-use-smbus-to-retrieve-edid.patch (limited to 'meta-rcar-gen3-adas') diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0040-arm64-dts-renesas-add-ADAS-boards.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0040-arm64-dts-renesas-add-ADAS-boards.patch index b55b066..2c2d7cc 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0040-arm64-dts-renesas-add-ADAS-boards.patch +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0040-arm64-dts-renesas-add-ADAS-boards.patch @@ -514,7 +514,7 @@ index 0000000..b3ac95aa4 +}; + +&i2c2 { -+ clock-frequency = <100000>; ++ clock-frequency = <400000>; + + gpio_ext_20: pca9535@20 { + compatible = "nxp,pca9535"; @@ -2123,8 +2123,8 @@ index 0000000..1672384 + hdmi@3d { + compatible = "adi,adv7511w"; + reg = <0x3d>; -+ interrupt-parent = <&gpio2>; -+ interrupts = <0 IRQ_TYPE_EDGE_BOTH>; ++// interrupt-parent = <&gpio2>; ++// interrupts = <0 IRQ_TYPE_EDGE_BOTH>; + pd-gpios = <&gpio_ext_75 5 GPIO_ACTIVE_LOW>; + + adi,input-depth = <8>; @@ -2288,7 +2288,7 @@ new file mode 100644 index 0000000..2a7ded7 --- /dev/null +++ b/arch/arm64/boot/dts/renesas/legacy/r8a7795-h3ulcb-kf-v0.dts -@@ -0,0 +1,1720 @@ +@@ -0,0 +1,1724 @@ +/* + * Device Tree Source for the H3ULCB Kingfisher V0 board on r8a7795 + * @@ -2683,7 +2683,7 @@ index 0000000..2a7ded7 +}; + +&i2c2 { -+ clock-frequency = <100000>; ++ clock-frequency = <400000>; + + gpio_ext_20: pca9535@20 { + compatible = "nxp,pca9535"; @@ -3953,6 +3953,10 @@ index 0000000..2a7ded7 + status = "okay"; +}; + ++&hsusb0 { ++ status = "okay"; ++}; ++ +&ehci0 { + status = "okay"; +}; @@ -4314,8 +4318,8 @@ index 0000000..119f58c + hdmi@3d { + compatible = "adi,adv7511w"; + reg = <0x3d>; -+ interrupt-parent = <&gpio2>; -+ interrupts = <0 IRQ_TYPE_EDGE_BOTH>; ++// interrupt-parent = <&gpio2>; ++// interrupts = <0 IRQ_TYPE_EDGE_BOTH>; + pd-gpios = <&gpio_ext_75 5 GPIO_ACTIVE_LOW>; + + adi,input-depth = <8>; @@ -4879,7 +4883,7 @@ index 0000000..0ac577a +}; + +&i2c2 { -+ clock-frequency = <100000>; ++ clock-frequency = <400000>; + + gpio_ext_20: pca9535@20 { + compatible = "nxp,pca9535"; @@ -6004,8 +6008,8 @@ index 0000000..1344152 + hdmi@3d { + compatible = "adi,adv7511w"; + reg = <0x3d>; -+ interrupt-parent = <&gpio2>; -+ interrupts = <0 IRQ_TYPE_EDGE_BOTH>; ++// interrupt-parent = <&gpio2>; ++// interrupts = <0 IRQ_TYPE_EDGE_BOTH>; + pd-gpios = <&gpio_ext_75 5 GPIO_ACTIVE_LOW>; + + adi,input-depth = <8>; @@ -6870,7 +6874,7 @@ index 0000000..f117af0 +}; + +&i2c2 { -+ clock-frequency = <100000>; ++ clock-frequency = <400000>; + + gpio_ext_74: pca9539@74 { + compatible = "nxp,pca9539"; @@ -6985,8 +6989,8 @@ index 0000000..f117af0 + hdmi@3d { + compatible = "adi,adv7511w"; + reg = <0x3d>; -+ interrupt-parent = <&gpio2>; -+ interrupts = <0 IRQ_TYPE_EDGE_BOTH>; ++// interrupt-parent = <&gpio2>; ++// interrupts = <0 IRQ_TYPE_EDGE_BOTH>; + pd-gpios = <&gpio_ext_75 5 GPIO_ACTIVE_LOW>; + + adi,input-depth = <8>; @@ -11563,7 +11567,7 @@ new file mode 100644 index 0000000..5b61059 --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts -@@ -0,0 +1,1906 @@ +@@ -0,0 +1,1910 @@ +/* + * Device Tree Source for the H3ULCB Kingfisher board on r8a7795 + * @@ -11971,7 +11975,7 @@ index 0000000..5b61059 +}; + +&i2c2 { -+ clock-frequency = <100000>; ++ clock-frequency = <400000>; + + gpio_ext_74: pca9539@74 { + compatible = "nxp,pca9539"; @@ -12086,8 +12090,8 @@ index 0000000..5b61059 + hdmi@3d { + compatible = "adi,adv7511w"; + reg = <0x3d>; -+ interrupt-parent = <&gpio2>; -+ interrupts = <0 IRQ_TYPE_EDGE_BOTH>; ++// interrupt-parent = <&gpio2>; ++// interrupts = <0 IRQ_TYPE_EDGE_BOTH>; + pd-gpios = <&gpio_ext_75 5 GPIO_ACTIVE_LOW>; + + adi,input-depth = <8>; @@ -13409,6 +13413,10 @@ index 0000000..5b61059 + status = "okay"; +}; + ++&hsusb0 { ++ status = "okay"; ++}; ++ +&ehci0 { + status = "okay"; +}; @@ -16786,7 +16794,7 @@ index 0000000..a037f16 +}; + +&i2c2 { -+ clock-frequency = <100000>; ++ clock-frequency = <400000>; + + gpio_ext_74: pca9539@74 { + compatible = "nxp,pca9539"; @@ -16901,8 +16909,8 @@ index 0000000..a037f16 + hdmi@3d { + compatible = "adi,adv7511w"; + reg = <0x3d>; -+ interrupt-parent = <&gpio2>; -+ interrupts = <0 IRQ_TYPE_EDGE_BOTH>; ++// interrupt-parent = <&gpio2>; ++// interrupts = <0 IRQ_TYPE_EDGE_BOTH>; + pd-gpios = <&gpio_ext_75 5 GPIO_ACTIVE_LOW>; + + adi,input-depth = <8>; diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0068-drm-adv7511-use-smbus-to-retrieve-edid.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0068-drm-adv7511-use-smbus-to-retrieve-edid.patch new file mode 100644 index 0000000..1b4dbd8 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0068-drm-adv7511-use-smbus-to-retrieve-edid.patch @@ -0,0 +1,53 @@ +From 2e2b673a2a47e8358ef92ec4019be87552949304 Mon Sep 17 00:00:00 2001 +From: Vladimir Barinov +Date: Wed, 9 Aug 2017 11:52:22 +0300 +Subject: [PATCH] drm: adv7511: use smbus to retrieve edid + +Get EDID using smbus protocol instead block i2c transfer +This fixes often checksum errors while retriving EDID at 400kHz bus speed + +Signed-off-by: Vladimir Barinov +--- + drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +index d3ece87..b2e1b58 100644 +--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c ++++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +@@ -500,18 +500,19 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, + * support 64 byte transfers than 256 byte transfers + */ + ++#define CHUNK_SIZE 1 + xfer[0].addr = adv7511->i2c_edid->addr; + xfer[0].flags = 0; + xfer[0].len = 1; + xfer[0].buf = &offset; + xfer[1].addr = adv7511->i2c_edid->addr; + xfer[1].flags = I2C_M_RD; +- xfer[1].len = 64; ++ xfer[1].len = CHUNK_SIZE; + xfer[1].buf = adv7511->edid_buf; + + offset = 0; + +- for (i = 0; i < 4; ++i) { ++ for (i = 0; i < 256/CHUNK_SIZE; ++i) { + ret = i2c_transfer(adv7511->i2c_edid->adapter, xfer, + ARRAY_SIZE(xfer)); + if (ret < 0) +@@ -519,8 +520,8 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, + else if (ret != 2) + return -EIO; + +- xfer[1].buf += 64; +- offset += 64; ++ xfer[1].buf += CHUNK_SIZE; ++ offset += CHUNK_SIZE; + } + + adv7511->current_edid_segment = block / 2; +-- +1.9.1 + diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend index 5384298..89ee785 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend @@ -50,6 +50,7 @@ SRC_URI_append = " \ file://0065-gpio-max732x-set-gpio-ouput-low-at-init.patch \ file://0066-pci-pcie-rcar-add-regulators-support.patch \ file://0067-ti-st-use-proper-way-to-get-shutdown-gpio.patch \ + file://0068-drm-adv7511-use-smbus-to-retrieve-edid.patch \ " SRC_URI_append_h3ulcb = " file://ulcb.cfg" -- cgit 1.2.3-korg