Re: [PATCH 5/6 v2] drm/msm/hdmi: Bring up HDMI connector OFF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 23, 2019 at 12:35 AM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
>
> There is elaborate code in the HDMI connector handling to
> leave the connector in the state it was at power-on and
> only touch the GPIOs when the connector .enable() and
> .disable() callbacks are called.
>
> I don't think this is what we normally want, initialize
> the connector as OFF (possibly saving power?) using the
> appropriate GPIO descriptor flags. It will still be
> switched on/off in the enable()/disable() connector
> callback as before, but we can drop some strange surplus
> code.

I'm picking up the earlier patches in this series.. although I won't
have a good way to test on devices which use the hdmi block for a few
weeks (when I complete my move, and get back a bunch of boards that
are in boxes right now) so I'm going to wait on the last two I think.

When we get to dealing with devices with hdmi enabled by bootloader,
we may actually want to preserve the pre-probe state of the GPIOs.
Although maybe not worth worrying about until we can handle DSI
enabled at boot.

BR,
-R

>
> Cc: Rob Clark <robdclark@xxxxxxxxx>
> Cc: Sean Paul <sean@xxxxxxxxxx>
> Cc: linux-arm-msm@xxxxxxxxxxxxxxx
> Cc: freedreno@xxxxxxxxxxxxxxxxxxxxx
> Reviewed-by: Brian Masney <masneyb@xxxxxxxxxxxxx>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> ---
> ChangeLog v1->v2:
> - Rebased on v5.3-rc1
> - Collected review tag
> ---
>  drivers/gpu/drm/msm/hdmi/hdmi.c           | 19 ++++++++++++-----
>  drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 25 ++++++-----------------
>  2 files changed, 20 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index 355afb936401..5739eec65659 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -552,13 +552,22 @@ static int msm_hdmi_bind(struct device *dev, struct device *master, void *data)
>         for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) {
>                 const char *name = msm_hdmi_gpio_pdata[i].name;
>                 struct gpio_desc *gpiod;
> +               enum gpiod_flags flags;
>
>                 /*
> -                * We are fetching the GPIO lines "as is" since the connector
> -                * code is enabling and disabling the lines. Until that point
> -                * the power-on default value will be kept.
> +                * Notice the inverse set up here: we initialize the connector
> +                * to OFF state.
>                  */
> -               gpiod = devm_gpiod_get_optional(dev, name, GPIOD_ASIS);
> +               if (msm_hdmi_gpio_pdata[i].output) {
> +                       if (msm_hdmi_gpio_pdata[i].value)
> +                               flags = GPIOD_OUT_LOW;
> +                       else
> +                               flags = GPIOD_OUT_HIGH;
> +               } else {
> +                       flags = GPIOD_IN;
> +               }
> +
> +               gpiod = devm_gpiod_get_optional(dev, name, flags);
>                 /* This will catch e.g. -PROBE_DEFER */
>                 if (IS_ERR(gpiod))
>                         return PTR_ERR(gpiod);
> @@ -572,7 +581,7 @@ static int msm_hdmi_bind(struct device *dev, struct device *master, void *data)
>                          * in the upstream bindings.
>                          */
>                         if (sscanf(name, "qcom,hdmi-tx-%s", name3))
> -                               gpiod = devm_gpiod_get_optional(dev, name3, GPIOD_ASIS);
> +                               gpiod = devm_gpiod_get_optional(dev, name3, flags);
>                         if (IS_ERR(gpiod))
>                                 return PTR_ERR(gpiod);
>                         if (!gpiod)
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
> index d0575d4f747d..f006682935e9 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
> @@ -75,16 +75,9 @@ static int gpio_config(struct hdmi *hdmi, bool on)
>                 for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) {
>                         struct hdmi_gpio_data gpio = config->gpios[i];
>
> -                       if (gpio.gpiod) {
> -                               if (gpio.output) {
> -                                       gpiod_direction_output(gpio.gpiod,
> -                                                              gpio.value);
> -                               } else {
> -                                       gpiod_direction_input(gpio.gpiod);
> -                                       gpiod_set_value_cansleep(gpio.gpiod,
> -                                                                gpio.value);
> -                               }
> -                       }
> +                       /* The value indicates the value for turning things on */
> +                       if (gpio.gpiod)
> +                               gpiod_set_value_cansleep(gpio.gpiod, gpio.value);
>                 }
>
>                 DBG("gpio on");
> @@ -92,16 +85,10 @@ static int gpio_config(struct hdmi *hdmi, bool on)
>                 for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) {
>                         struct hdmi_gpio_data gpio = config->gpios[i];
>
> -                       if (!gpio.gpiod)
> -                               continue;
> -
> -                       if (gpio.output) {
> -                               int value = gpio.value ? 0 : 1;
> -
> -                               gpiod_set_value_cansleep(gpio.gpiod, value);
> -                       }
> +                       /* The inverse value turns stuff off */
> +                       if (gpio.gpiod && gpio.output)
> +                               gpiod_set_value_cansleep(gpio.gpiod, !gpio.value);
>                 };
> -
>                 DBG("gpio off");
>         }
>
> --
> 2.21.0
>
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux