diff mbox

[2/4] drm/msm/hdmi: Use more DT friendly GPIO names

Message ID 1467957354-7620-3-git-send-email-architt@codeaurora.org (mailing list archive)
State New, archived
Headers show

Commit Message

Archit Taneja July 8, 2016, 5:55 a.m. UTC
Update the gpio name parsing code to try to search for without the
"qcom,hdmi-tx-" prefix. The older downstream bindings that expect
"qcom,hdmi-tx-xyz" or "qcom,hdmi-tx-xyz-gpio" would work as the
property name would work as before.

Update the binding doc. Add an entry for the missing hpd and lpm
gpios.

Cc: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org

Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
 Documentation/devicetree/bindings/display/msm/hdmi.txt |  6 ++++--
 drivers/gpu/drm/msm/hdmi/hdmi.c                        | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

Comments

Rob Herring July 13, 2016, 1:45 p.m. UTC | #1
On Fri, Jul 08, 2016 at 11:25:52AM +0530, Archit Taneja wrote:
> Update the gpio name parsing code to try to search for without the
> "qcom,hdmi-tx-" prefix. The older downstream bindings that expect
> "qcom,hdmi-tx-xyz" or "qcom,hdmi-tx-xyz-gpio" would work as the
> property name would work as before.

Why?

> Update the binding doc. Add an entry for the missing hpd and lpm
> gpios.
> 
> Cc: Rob Herring <robh@kernel.org>
> Cc: devicetree@vger.kernel.org
> 
> Signed-off-by: Archit Taneja <architt@codeaurora.org>
> ---
>  Documentation/devicetree/bindings/display/msm/hdmi.txt |  6 ++++--
>  drivers/gpu/drm/msm/hdmi/hdmi.c                        | 16 ++++++++++++++++
>  2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/display/msm/hdmi.txt b/Documentation/devicetree/bindings/display/msm/hdmi.txt
> index b63f614..4da1abd 100644
> --- a/Documentation/devicetree/bindings/display/msm/hdmi.txt
> +++ b/Documentation/devicetree/bindings/display/msm/hdmi.txt
> @@ -23,8 +23,10 @@ Required properties:
>  - phy-names: the name of the corresponding PHY device
>  
>  Optional properties:
> -- qcom,hdmi-tx-mux-en-gpio: hdmi mux enable pin
> -- qcom,hdmi-tx-mux-sel-gpio: hdmi mux select pin
> +- hpd-gpio: hdmi hpd pin

hpd-gpios is the somewhat standard name.

> +- mux-en-gpio: hdmi mux enable pin
> +- mux-sel-gpio: hdmi mux select pin
> +- mux-lpm-gpio: hdmi mux lpm pin

These look pretty QCom specific and should keep the vendor prefix.

I understand why you don't have '-gpios', but if we change these they 
should use the preferred form.

Rob
Archit Taneja July 14, 2016, 8:34 a.m. UTC | #2
On 07/13/2016 07:15 PM, Rob Herring wrote:
> On Fri, Jul 08, 2016 at 11:25:52AM +0530, Archit Taneja wrote:
>> Update the gpio name parsing code to try to search for without the
>> "qcom,hdmi-tx-" prefix. The older downstream bindings that expect
>> "qcom,hdmi-tx-xyz" or "qcom,hdmi-tx-xyz-gpio" would work as the
>> property name would work as before.
>
> Why?

Why we want the older names to work? Just to make life easier if
backporting the drm driver to a downstream msm kernel (like a 3.10,
or 3.18).

>
>> Update the binding doc. Add an entry for the missing hpd and lpm
>> gpios.
>>
>> Cc: Rob Herring <robh@kernel.org>
>> Cc: devicetree@vger.kernel.org
>>
>> Signed-off-by: Archit Taneja <architt@codeaurora.org>
>> ---
>>   Documentation/devicetree/bindings/display/msm/hdmi.txt |  6 ++++--
>>   drivers/gpu/drm/msm/hdmi/hdmi.c                        | 16 ++++++++++++++++
>>   2 files changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/display/msm/hdmi.txt b/Documentation/devicetree/bindings/display/msm/hdmi.txt
>> index b63f614..4da1abd 100644
>> --- a/Documentation/devicetree/bindings/display/msm/hdmi.txt
>> +++ b/Documentation/devicetree/bindings/display/msm/hdmi.txt
>> @@ -23,8 +23,10 @@ Required properties:
>>   - phy-names: the name of the corresponding PHY device
>>
>>   Optional properties:
>> -- qcom,hdmi-tx-mux-en-gpio: hdmi mux enable pin
>> -- qcom,hdmi-tx-mux-sel-gpio: hdmi mux select pin
>> +- hpd-gpio: hdmi hpd pin
>
> hpd-gpios is the somewhat standard name.
>
>> +- mux-en-gpio: hdmi mux enable pin
>> +- mux-sel-gpio: hdmi mux select pin
>> +- mux-lpm-gpio: hdmi mux lpm pin
>
> These look pretty QCom specific and should keep the vendor prefix.

Okay.

>
> I understand why you don't have '-gpios', but if we change these they
> should use the preferred form.


Sure, I'll update these to the preferred form.

Archit
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/display/msm/hdmi.txt b/Documentation/devicetree/bindings/display/msm/hdmi.txt
index b63f614..4da1abd 100644
--- a/Documentation/devicetree/bindings/display/msm/hdmi.txt
+++ b/Documentation/devicetree/bindings/display/msm/hdmi.txt
@@ -23,8 +23,10 @@  Required properties:
 - phy-names: the name of the corresponding PHY device
 
 Optional properties:
-- qcom,hdmi-tx-mux-en-gpio: hdmi mux enable pin
-- qcom,hdmi-tx-mux-sel-gpio: hdmi mux select pin
+- hpd-gpio: hdmi hpd pin
+- mux-en-gpio: hdmi mux enable pin
+- mux-sel-gpio: hdmi mux select pin
+- mux-lpm-gpio: hdmi mux lpm pin
 - power-domains: reference to the power domain(s), if available.
 - pinctrl-names: the pin control state names; should contain "default"
 - pinctrl-0: the default pinctrl state (active)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 51b9ea5..d48305f 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -422,11 +422,27 @@  static const struct {
 static int msm_hdmi_get_gpio(struct device_node *of_node, const char *name)
 {
 	int gpio = of_get_named_gpio(of_node, name, 0);
+
+	/*
+	 * This is complicated mainly because we want the downstream kernel
+	 * DT files working with the upstream kernel. We first try with the
+	 * names as listed above in the table. We then append "gpio" to it and
+	 * try again. We finally try the DT bindings as they would be in
+	 * upstream dtsi files by stripping off the "qcom,hdmi-tx-" prefix.
+	 * We'll get rid of this when we don't rely on downstream bindings.
+	 */
 	if (gpio < 0) {
 		char name2[32];
 		snprintf(name2, sizeof(name2), "%s-gpio", name);
 		gpio = of_get_named_gpio(of_node, name2, 0);
 		if (gpio < 0) {
+			char name3[32];
+
+			if (sscanf(name2, "qcom,hdmi-tx-%s", name3))
+				gpio = of_get_named_gpio(of_node, name3, 0);
+		}
+
+		if (gpio < 0) {
 			DBG("failed to get gpio: %s (%d)", name, gpio);
 			gpio = -1;
 		}