diff mbox series

[1/2] ARM: dts: exynos: arndale: use i2c-gpio for HDMI-DDC

Message ID 20180726101228.14956-1-a.hajda@samsung.com (mailing list archive)
State Superseded
Headers show
Series [1/2] ARM: dts: exynos: arndale: use i2c-gpio for HDMI-DDC | expand

Commit Message

Andrzej Hajda July 26, 2018, 10:12 a.m. UTC
HDMI-DDC for unknown reasons doesn't work with Exynos I2C
controllers. Fortunately i2c-gpio comes to the rescue.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 arch/arm/boot/dts/exynos5250-arndale.dts  | 24 +++++++++++++++--------
 arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  6 ++++++
 2 files changed, 22 insertions(+), 8 deletions(-)

Comments

Krzysztof Kozlowski July 26, 2018, 10:23 a.m. UTC | #1
On 26 July 2018 at 12:12, Andrzej Hajda <a.hajda@samsung.com> wrote:
> HDMI-DDC for unknown reasons doesn't work with Exynos I2C
> controllers. Fortunately i2c-gpio comes to the rescue.

Wait... what? The I2C controller on SoC (or its driver) is buggy in
some way and we need to use these pins as GPIO to run i2c-gpio driver
there? It looks like workaround not a proper solution...

Best regards,
Krzysztof

> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  arch/arm/boot/dts/exynos5250-arndale.dts  | 24 +++++++++++++++--------
>  arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  6 ++++++
>  2 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
> index 816d89d4cefd..591023391f7d 100644
> --- a/arch/arm/boot/dts/exynos5250-arndale.dts
> +++ b/arch/arm/boot/dts/exynos5250-arndale.dts
> @@ -211,7 +211,7 @@
>
>  &hdmi {
>         status = "okay";
> -       ddc = <&i2c_2>;
> +       ddc = <&i2c_ddc>;
>         hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
>         vdd_osc-supply = <&ldo10_reg>;
>         vdd_pll-supply = <&ldo8_reg>;
> @@ -513,13 +513,6 @@
>         };
>  };
>
> -&i2c_2 {
> -       status = "okay";
> -       /* used by HDMI DDC */
> -       samsung,i2c-sda-delay = <100>;
> -       samsung,i2c-max-bus-freq = <66000>;
> -};
> -
>  &i2c_3 {
>         status = "okay";
>
> @@ -608,3 +601,18 @@
>         status = "okay";
>         samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
>  };
> +
> +&soc {
> +       i2c_ddc: i2c-gpio {
> +               pinctrl-names = "default";
> +               pinctrl-0 = <&i2c2_gpio_bus>;
> +               status = "okay";
> +               compatible = "i2c-gpio";
> +               gpios = <&gpa0 6 0 /* sda */
> +                        &gpa0 7 0 /* scl */
> +                       >;
> +               i2c-gpio,delay-us = <2>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +       };
> +};
> diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
> index 6ff6dea29d44..b25d520393b8 100644
> --- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
> +++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
> @@ -225,6 +225,12 @@
>                 samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
>         };
>
> +       i2c2_gpio_bus: i2c2-gpio-bus {
> +               samsung,pins = "gpa0-6", "gpa0-7";
> +               samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
> +               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
> +       };
> +
>         uart2_data: uart2-data {
>                 samsung,pins = "gpa1-0", "gpa1-1";
>                 samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
> --
> 2.18.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrzej Hajda July 26, 2018, 11:04 a.m. UTC | #2
On 26.07.2018 12:23, Krzysztof Kozlowski wrote:
> On 26 July 2018 at 12:12, Andrzej Hajda <a.hajda@samsung.com> wrote:
>> HDMI-DDC for unknown reasons doesn't work with Exynos I2C
>> controllers. Fortunately i2c-gpio comes to the rescue.
> Wait... what? The I2C controller on SoC (or its driver) is buggy in
> some way and we need to use these pins as GPIO to run i2c-gpio driver
> there? It looks like workaround not a proper solution...

But at least working one :) Better solutions are welcome.
This seems to be not uncommon issue, if you for example look into odroid
vendor kernel you can even find hardcoded EDIDs :)

Regards
Andrzej


>
> Best regards,
> Krzysztof
>
>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>> ---
>>  arch/arm/boot/dts/exynos5250-arndale.dts  | 24 +++++++++++++++--------
>>  arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  6 ++++++
>>  2 files changed, 22 insertions(+), 8 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
>> index 816d89d4cefd..591023391f7d 100644
>> --- a/arch/arm/boot/dts/exynos5250-arndale.dts
>> +++ b/arch/arm/boot/dts/exynos5250-arndale.dts
>> @@ -211,7 +211,7 @@
>>
>>  &hdmi {
>>         status = "okay";
>> -       ddc = <&i2c_2>;
>> +       ddc = <&i2c_ddc>;
>>         hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
>>         vdd_osc-supply = <&ldo10_reg>;
>>         vdd_pll-supply = <&ldo8_reg>;
>> @@ -513,13 +513,6 @@
>>         };
>>  };
>>
>> -&i2c_2 {
>> -       status = "okay";
>> -       /* used by HDMI DDC */
>> -       samsung,i2c-sda-delay = <100>;
>> -       samsung,i2c-max-bus-freq = <66000>;
>> -};
>> -
>>  &i2c_3 {
>>         status = "okay";
>>
>> @@ -608,3 +601,18 @@
>>         status = "okay";
>>         samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
>>  };
>> +
>> +&soc {
>> +       i2c_ddc: i2c-gpio {
>> +               pinctrl-names = "default";
>> +               pinctrl-0 = <&i2c2_gpio_bus>;
>> +               status = "okay";
>> +               compatible = "i2c-gpio";
>> +               gpios = <&gpa0 6 0 /* sda */
>> +                        &gpa0 7 0 /* scl */
>> +                       >;
>> +               i2c-gpio,delay-us = <2>;
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +       };
>> +};
>> diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
>> index 6ff6dea29d44..b25d520393b8 100644
>> --- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
>> +++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
>> @@ -225,6 +225,12 @@
>>                 samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
>>         };
>>
>> +       i2c2_gpio_bus: i2c2-gpio-bus {
>> +               samsung,pins = "gpa0-6", "gpa0-7";
>> +               samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
>> +               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
>> +       };
>> +
>>         uart2_data: uart2-data {
>>                 samsung,pins = "gpa1-0", "gpa1-1";
>>                 samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
>> --
>> 2.18.0
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Krzysztof Kozlowski July 26, 2018, 11:51 a.m. UTC | #3
On 26 July 2018 at 13:04, Andrzej Hajda <a.hajda@samsung.com> wrote:
> On 26.07.2018 12:23, Krzysztof Kozlowski wrote:
>> On 26 July 2018 at 12:12, Andrzej Hajda <a.hajda@samsung.com> wrote:
>>> HDMI-DDC for unknown reasons doesn't work with Exynos I2C
>>> controllers. Fortunately i2c-gpio comes to the rescue.
>> Wait... what? The I2C controller on SoC (or its driver) is buggy in
>> some way and we need to use these pins as GPIO to run i2c-gpio driver
>> there? It looks like workaround not a proper solution...
>
> But at least working one :) Better solutions are welcome.
> This seems to be not uncommon issue, if you for example look into odroid
> vendor kernel you can even find hardcoded EDIDs :)

I am not sure whether hardkernel's tree is a good argument. They took
vendor's tree and apply whatever patches/fixes are needed to bring it
up. They do not have time to look for correct (the "best") fixes. They
choose whatever is working now.
Better solution would be to spend months and fix the driver. :)

Can you at least mention next to i2c-gpio node that it replaces i2c_2
because of this?

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index 816d89d4cefd..591023391f7d 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -211,7 +211,7 @@ 
 
 &hdmi {
 	status = "okay";
-	ddc = <&i2c_2>;
+	ddc = <&i2c_ddc>;
 	hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
 	vdd_osc-supply = <&ldo10_reg>;
 	vdd_pll-supply = <&ldo8_reg>;
@@ -513,13 +513,6 @@ 
 	};
 };
 
-&i2c_2 {
-	status = "okay";
-	/* used by HDMI DDC */
-	samsung,i2c-sda-delay = <100>;
-	samsung,i2c-max-bus-freq = <66000>;
-};
-
 &i2c_3 {
 	status = "okay";
 
@@ -608,3 +601,18 @@ 
 	status = "okay";
 	samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
 };
+
+&soc {
+	i2c_ddc: i2c-gpio {
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c2_gpio_bus>;
+		status = "okay";
+		compatible = "i2c-gpio";
+		gpios = <&gpa0 6 0 /* sda */
+			 &gpa0 7 0 /* scl */
+			>;
+		i2c-gpio,delay-us = <2>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+};
diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
index 6ff6dea29d44..b25d520393b8 100644
--- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
@@ -225,6 +225,12 @@ 
 		samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
 	};
 
+	i2c2_gpio_bus: i2c2-gpio-bus {
+		samsung,pins = "gpa0-6", "gpa0-7";
+		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+		samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
+	};
+
 	uart2_data: uart2-data {
 		samsung,pins = "gpa1-0", "gpa1-1";
 		samsung,pin-function = <EXYNOS_PIN_FUNC_2>;