power: goldfish_battery: add devicetree bindings
PATCH 1/2 power: goldfish_battery: add devicetree bindings
From: Greg Hackmann <[email protected]>
Add device tree bindings to the Goldfish virtual platform battery drivers.
--- .../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
Documentation/devicetree/bindings/goldfish/battery.txt new file +17 -0
@@ -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>; + };
drivers/power/goldfish_battery.c +8 -1
@@ -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: Yu Ning <[email protected]>
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.
--- drivers/power/goldfish_battery.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/power/goldfish_battery.c +8 -0
@@ -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
Hi Alan,
Quoted 5 lines · Alan
From: Yu Ning <[email protected]>
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
Quoted 11 lines · Sebastian Reichel
Hi Alan,
Quoted 7 lines · Alan
From: Yu Ning <[email protected]>
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.
Quoted 3 lines
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
Hi,
Quoted 5 lines · Alan
Add device tree bindings to the Goldfish virtual platform battery drivers.
Signed-off-by Greg Hackmann <[email protected]>Signed-off-by Jin Qian <[email protected]>Signed-off-by Alan Cox <[email protected]>
Tanks, queued.
-- Sebastian