[PATCH 1/2] power: goldfish_battery: add devicetree bindings

Subsystems: open firmware and flattened device tree bindings, the rest

STALE3835d

5 messages, 2 authors, 2016-03-03 · open the first message on its own page

[PATCH 1/2] power: goldfish_battery: add devicetree bindings

From: Alan <hidden>
Date: 2016-02-26 18:46:14

From: Greg Hackmann <redacted>

Add device tree bindings to the Goldfish virtual platform battery drivers.

Signed-off-by: Greg Hackmann <redacted>
Signed-off-by: Jin Qian <redacted>
Signed-off-by: Alan Cox <redacted>
---
 .../devicetree/bindings/goldfish/battery.txt       |   17 +++++++++++++++++
 drivers/power/goldfish_battery.c                   |    9 ++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/goldfish/battery.txt
diff --git a/Documentation/devicetree/bindings/goldfish/battery.txt b/Documentation/devicetree/bindings/goldfish/battery.txt
new file mode 100644
index 0000000..aa09cf8
--- /dev/null
+++ b/Documentation/devicetree/bindings/goldfish/battery.txt
@@ -0,0 +1,17 @@
+Android Goldfish Battery
+
+Android goldfish battery device generated by android emulator.
+
+Required properties:
+
+- compatible : should contain "google,goldfish-battery" to match emulator
+- reg        : <registers mapping>
+- interrupts : <interrupt mapping>
+
+Example:
+
+	goldfish_battery@9020000 {
+		compatible = "google,goldfish-battery";
+		reg = <0x9020000 0x1000>;
+		interrupts = <0x3>;
+	};
diff --git a/drivers/power/goldfish_battery.c b/drivers/power/goldfish_battery.c
index a50bb98..7510796 100644
--- a/drivers/power/goldfish_battery.c
+++ b/drivers/power/goldfish_battery.c
@@ -227,11 +227,18 @@ static int goldfish_battery_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id goldfish_battery_of_match[] = {
+	{ .compatible = "google,goldfish-battery", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, goldfish_battery_of_match);
+
 static struct platform_driver goldfish_battery_device = {
 	.probe		= goldfish_battery_probe,
 	.remove		= goldfish_battery_remove,
 	.driver = {
-		.name = "goldfish-battery"
+		.name = "goldfish-battery",
+		.of_match_table = goldfish_battery_of_match,
 	}
 };
 module_platform_driver(goldfish_battery_device);

[PATCH 2/2] goldfish: Enable ACPI-based enumeration for goldfish battery

From: Alan <hidden>
Date: 2016-02-26 18:46:19

From: Yu Ning <redacted>

Besides adding ACPI bindings to the goldfish battery driver, modify the
ACPI driver to inform it that goldfish battery is a platform device.
The latter step is necessary with kernel 3.16 or newer.

Signed-off-by: Yu Ning <redacted>
Signed-off-by: Jin Qian <redacted>
Signed-off-by: Alan <redacted>
---
 drivers/power/goldfish_battery.c |    8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/drivers/power/goldfish_battery.c b/drivers/power/goldfish_battery.c
index 7510796..f5c525e 100644
--- a/drivers/power/goldfish_battery.c
+++ b/drivers/power/goldfish_battery.c
@@ -24,6 +24,7 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/acpi.h>
 
 struct goldfish_battery_data {
 	void __iomem *reg_base;
@@ -233,12 +234,19 @@ static const struct of_device_id goldfish_battery_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, goldfish_battery_of_match);
 
+static const struct acpi_device_id goldfish_battery_acpi_match[] = {
+	{ "GFSH0001", 0 },
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, goldfish_battery_acpi_match);
+
 static struct platform_driver goldfish_battery_device = {
 	.probe		= goldfish_battery_probe,
 	.remove		= goldfish_battery_remove,
 	.driver = {
 		.name = "goldfish-battery",
 		.of_match_table = goldfish_battery_of_match,
+		.acpi_match_table = ACPI_PTR(goldfish_battery_acpi_match),
 	}
 };
 module_platform_driver(goldfish_battery_device);

Re: [PATCH 2/2] goldfish: Enable ACPI-based enumeration for goldfish battery

From: Sebastian Reichel <sre@kernel.org>
Date: 2016-02-26 20:03:32

Hi Alan,

On Fri, Feb 26, 2016 at 06:45:50PM +0000, Alan wrote:
From: Yu Ning <redacted>

Besides adding ACPI bindings to the goldfish battery driver, modify the
ACPI driver to inform it that goldfish battery is a platform device.
The latter step is necessary with kernel 3.16 or newer.
I don't understand the second part of the commit message. The patch
only seems to add ACPI bindings to the goldfish battery driver. Did
you forget to add something?

-- Sebastian

Re: [PATCH 2/2] goldfish: Enable ACPI-based enumeration for goldfish battery

From: Alan Cox <hidden>
Date: 2016-03-01 23:28:06

On Fri, 2016-02-26 at 21:03 +0100, Sebastian Reichel wrote:
Hi Alan,

On Fri, Feb 26, 2016 at 06:45:50PM +0000, Alan wrote:
quoted
From: Yu Ning <redacted>

Besides adding ACPI bindings to the goldfish battery driver, modify
the
ACPI driver to inform it that goldfish battery is a platform
device.
The latter step is necessary with kernel 3.16 or newer.
I don't understand the second part of the commit message. The patch
only seems to add ACPI bindings to the goldfish battery driver. Did
you forget to add something?
No I forgot to trim the message. Will revise and resend

Re: [PATCH 1/2] power: goldfish_battery: add devicetree bindings

From: Sebastian Reichel <sre@kernel.org>
Date: 2016-03-03 14:19:31

Hi,

On Fri, Feb 26, 2016 at 06:45:30PM +0000, Alan wrote:
Add device tree bindings to the Goldfish virtual platform battery drivers.

Signed-off-by: Greg Hackmann <redacted>
Signed-off-by: Jin Qian <redacted>
Signed-off-by: Alan Cox <redacted>
Tanks, queued.

-- Sebastian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help