All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: linux-mmc <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH 4/4] mmc: sdhci-acpi: Fix voltage switch for some Intel host controllers
Date: Fri, 20 Oct 2017 11:16:16 +0200	[thread overview]
Message-ID: <CAPDyKFr75-Z6pcRJQT3tiPfXniwX69O9j8ZSUyisAZbrvAbBJw@mail.gmail.com> (raw)
In-Reply-To: <1508409706-27026-5-git-send-email-adrian.hunter@intel.com>

On 19 October 2017 at 12:41, Adrian Hunter <adrian.hunter@intel.com> wrote:
> Some Intel host controllers use an ACPI device-specific method to ensure
> correct voltage switching. Fix voltage switch for those, by adding a call
> to the DSM.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  drivers/mmc/host/sdhci-acpi.c | 108 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 108 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index 5bb5880403b2..b988997a1e80 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -96,6 +96,105 @@ static inline bool sdhci_acpi_flag(struct sdhci_acpi_host *c, unsigned int flag)
>         return c->slot && (c->slot->flags & flag);
>  }
>
> +enum {
> +       INTEL_DSM_FNS           =  0,
> +       INTEL_DSM_V18_SWITCH    =  3,
> +       INTEL_DSM_V33_SWITCH    =  4,
> +};
> +
> +struct intel_host {
> +       u32     dsm_fns;
> +};
> +
> +static const guid_t intel_dsm_guid =
> +       GUID_INIT(0xF6C13EA5, 0x65CD, 0x461F,
> +                 0xAB, 0x7A, 0x29, 0xF7, 0xE8, 0xD5, 0xBD, 0x61);
> +
> +static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
> +                      unsigned int fn, u32 *result)
> +{
> +       union acpi_object *obj;
> +       int err = 0;
> +
> +       obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), &intel_dsm_guid, 0, fn, NULL);
> +       if (!obj)
> +               return -EOPNOTSUPP;
> +
> +       if (obj->type == ACPI_TYPE_INTEGER) {
> +               *result = obj->integer.value;
> +       } else if (obj->type == ACPI_TYPE_BUFFER && obj->buffer.length > 0) {
> +               size_t len = min_t(size_t, obj->buffer.length, 4);
> +
> +               *result = 0;
> +               memcpy(result, obj->buffer.pointer, len);
> +       } else {
> +               dev_err(dev, "%s DSM fn %u obj->type %d obj->buffer.length %d\n",
> +                       __func__, fn, obj->type, obj->buffer.length);
> +               err = -EINVAL;
> +       }
> +

This hole ACPI thing looks weird. Could perhaps the ACPI core, model
this a vqmmc regulator instead?

That would keep the ACPI specific part closer to ACPI and we can treat
this similar to other mmc host drivers.

> +       ACPI_FREE(obj);
> +
> +       return err;
> +}
> +

[...]

Kind regards
Uffe

  reply	other threads:[~2017-10-20  9:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 10:41 [PATCH 0/4] mmc: sdhci-acpi: Fix voltage switch for some Intel host controllers Adrian Hunter
2017-10-19 10:41 ` [PATCH 1/4] mmc: sdhci-acpi: Use helper function acpi_device_uid() Adrian Hunter
2017-10-20 10:03   ` Ulf Hansson
2017-10-19 10:41 ` [PATCH 2/4] mmc: sdhci-acpi: Tidy Intel slot probe functions into one Adrian Hunter
2017-10-20 10:03   ` Ulf Hansson
2017-10-19 10:41 ` [PATCH 3/4] mmc: sdhci-acpi: Let devices define their own private data Adrian Hunter
2017-10-30 11:40   ` Ulf Hansson
2017-10-19 10:41 ` [PATCH 4/4] mmc: sdhci-acpi: Fix voltage switch for some Intel host controllers Adrian Hunter
2017-10-20  9:16   ` Ulf Hansson [this message]
2017-10-20 11:11     ` Adrian Hunter
2017-10-30 11:40   ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPDyKFr75-Z6pcRJQT3tiPfXniwX69O9j8ZSUyisAZbrvAbBJw@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=linux-mmc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.