linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Lu <aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jacob Pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: [PATCH 3/3] ACPI / pmic_opregion: AXP288: support virtual GPIO in ACPI table
Date: Fri, 31 Oct 2014 14:08:25 +0800	[thread overview]
Message-ID: <1414735705-18366-4-git-send-email-aaron.lu@intel.com> (raw)
In-Reply-To: <1414735705-18366-1-git-send-email-aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

The same virtual GPIO strategy is also used for the AXP288 PMIC in that
various control methods that are used to do power rail handling and
sensor reading/setting will touch GPIO fields defined under the PMIC
device. The GPIO fileds are only defined by the ACPI code while the
actual hardware doesn't really have a GPIO controller, but to make those
control method execution succeed, we have to install a GPIO handler for
the PMIC device handle. Since we do not need the virtual GPIO strategy,
we can simply do nothing in that handler.

Signed-off-by: Aaron Lu <aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 .../pmic_opregion/intel_soc_pmic_xpower_opregion.c | 27 ++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/pmic_opregion/intel_soc_pmic_xpower_opregion.c b/drivers/acpi/pmic_opregion/intel_soc_pmic_xpower_opregion.c
index ab462708aecf..e25c83da90a5 100644
--- a/drivers/acpi/pmic_opregion/intel_soc_pmic_xpower_opregion.c
+++ b/drivers/acpi/pmic_opregion/intel_soc_pmic_xpower_opregion.c
@@ -251,13 +251,32 @@ static struct intel_soc_pmic_opregion_data intel_xpower_pmic_opregion_data = {
 	.dptf_table_count = ARRAY_SIZE(dptf_table),
 };
 
+static acpi_status intel_xpower_pmic_gpio_handler(u32 function,
+		acpi_physical_address address, u32 bit_width, u64 *value,
+		void *handler_context, void *region_context)
+{
+	return AE_OK;
+}
 
 static int intel_xpower_pmic_opregion_probe(struct platform_device *pdev)
 {
-	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
-	return intel_soc_pmic_install_opregion_handler(&pdev->dev,
-			ACPI_HANDLE(pdev->dev.parent), axp20x->regmap,
-			&intel_xpower_pmic_opregion_data);
+	struct device *parent = pdev->dev.parent;
+	struct axp20x_dev *axp20x = dev_get_drvdata(parent);
+	acpi_status status;
+	int result;
+
+	result = intel_soc_pmic_install_opregion_handler(&pdev->dev,
+					ACPI_HANDLE(parent), axp20x->regmap,
+					&intel_xpower_pmic_opregion_data);
+	if (!result) {
+		status = acpi_install_address_space_handler(
+				ACPI_HANDLE(parent), ACPI_ADR_SPACE_GPIO,
+				intel_xpower_pmic_gpio_handler, NULL, NULL);
+		if (ACPI_FAILURE(status))
+			result = -ENODEV;
+	}
+
+	return result;
 }
 
 static struct platform_driver intel_xpower_pmic_opregion_driver = {
-- 
1.9.3

  parent reply	other threads:[~2014-10-31  6:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31  6:08 [PATCH 0/3] Support PMIC operation region for CrystalCove and XPower Aaron Lu
2014-10-31  6:08 ` [PATCH 1/3] ACPI / pmic_opregion: support PMIC operation region for CrystalCove Aaron Lu
2014-10-31  6:08 ` [PATCH 2/3] ACPI / pmic_opregion: support PMIC operation region for XPower AXP288 Aaron Lu
     [not found] ` <1414735705-18366-1-git-send-email-aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-31  6:08   ` Aaron Lu [this message]
2014-11-11  2:03 ` [PATCH 0/3] Support PMIC operation region for CrystalCove and XPower Aaron Lu
2014-11-11 11:11   ` Lee Jones
2014-11-11 23:35     ` Rafael J. Wysocki
2014-11-12  1:48       ` Aaron Lu
     [not found]         ` <5462BC5A.7070407-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-13  0:51           ` Rafael J. Wysocki
     [not found]             ` <1834078.D8VLOj1LAI-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2014-11-13  8:39               ` Aaron Lu
     [not found]       ` <3052882.EdcZmghHR3-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2014-11-12  9:44         ` Lee Jones
2014-11-13  0:53           ` Rafael J. Wysocki
     [not found]             ` <1668657.Fqph6NyFNz-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2014-11-13 10:41               ` Lee Jones

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=1414735705-18366-4-git-send-email-aaron.lu@intel.com \
    --to=aaron.lu-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).