goldfish: add goldfish match node for dt driver probe
Subsystems (5)
PATCH v2 1/1 goldfish: add goldfish match node for dt driver probe
qemu use device tree to bootup linux kernel,
we need add device node match table to plaftorm driver, so that can probe the goldfish driver correctly.
test by this qemu:
git clone https://android.googlesource.com/platform/external/qemu
--- drivers/input/keyboard/goldfish_events.c | 9 +++++++++ drivers/platform/goldfish/goldfish_pipe.c | 11 ++++++++++- drivers/power/goldfish_battery.c | 11 ++++++++++- drivers/staging/goldfish/goldfish_audio.c | 11 ++++++++++- drivers/staging/goldfish/goldfish_nand.c | 11 ++++++++++- drivers/tty/goldfish.c | 11 ++++++++++- drivers/video/fbdev/goldfishfb.c | 10 +++++++++- 7 files changed, 68 insertions(+), 6 deletions(-)
drivers/input/keyboard/goldfish_events.c +9 -0
@@ -18,6 +18,7 @@#include <linux/types.h> #include <linux/input.h> #include <linux/kernel.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/irq.h>
@@ -178,10 +179,18 @@ static int events_probe(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id goldfish_events_match[] = { + { .compatible ="generic,goldfish-events-keypad" }, + { }, +}; +#endif +static struct platform_driver events_driver = { .probe = events_probe, .driver = { .name ="goldfish_events" , + .of_match_table =of_match_ptr (goldfish_events_match), }, };
drivers/platform/goldfish/goldfish_pipe.c +10 -1
@@ -50,6 +50,7 @@#include <linux/kernel.h> #include <linux/spinlock.h> #include <linux/miscdevice.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/poll.h> #include <linux/sched.h>
@@ -615,11 +616,19 @@ static int goldfish_pipe_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id goldfish_pipe_match[] = { + { .compatible ="generic,android-pipe" }, + { }, +}; +#endif +static struct platform_driver goldfish_pipe = { .probe = goldfish_pipe_probe, .remove = goldfish_pipe_remove, .driver = { - .name ="goldfish_pipe" + .name ="goldfish_pipe" , + .of_match_table =of_match_ptr (goldfish_pipe_match), } };
drivers/power/goldfish_battery.c +10 -1
@@ -18,6 +18,7 @@#include <linux/module.h> #include <linux/err.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/power_supply.h> #include <linux/types.h>
@@ -227,11 +228,19 @@ static int goldfish_battery_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id goldfish_battery_match[] = { + { .compatible ="generic,goldfish-battery" }, + { }, +}; +#endif +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 =of_match_ptr (goldfish_battery_match), } };module_platform_driver (goldfish_battery_device);
drivers/staging/goldfish/goldfish_audio.c +10 -1
@@ -18,6 +18,7 @@#include <linux/module.h> #include <linux/miscdevice.h> #include <linux/fs.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/types.h> #include <linux/pci.h>
@@ -344,11 +345,19 @@ static int goldfish_audio_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id goldfish_audio_match[] = { + { .compatible ="generic,goldfish-audio" }, + { }, +}; +#endif +static struct platform_driver goldfish_audio_driver = { .probe = goldfish_audio_probe, .remove = goldfish_audio_remove, .driver = { - .name ="goldfish_audio" + .name ="goldfish_audio" , + .of_match_table =of_match_ptr (goldfish_audio_match), } };
drivers/staging/goldfish/goldfish_nand.c +10 -1
@@ -23,6 +23,7 @@#include <linux/ioport.h> #include <linux/vmalloc.h> #include <linux/mtd/mtd.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/mutex.h> #include <linux/goldfish.h>
@@ -430,11 +431,19 @@ static int goldfish_nand_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id goldfish_nand_match[] = { + { .compatible ="generic,goldfish-nand" }, + { }, +}; +#endif +static struct platform_driver goldfish_nand_driver = { .probe = goldfish_nand_probe, .remove = goldfish_nand_remove, .driver = { - .name ="goldfish_nand" + .name ="goldfish_nand" , + .of_match_table =of_match_ptr (goldfish_nand_match), } };
drivers/tty/goldfish.c +10 -1
@@ -15,6 +15,7 @@#include <linux/console.h> #include <linux/interrupt.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/tty.h> #include <linux/tty_flip.h>
@@ -324,11 +325,19 @@ static int goldfish_tty_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id goldfish_tty_match[] = { + { .compatible ="generic,goldfish-tty" }, + { }, +}; +#endif +static struct platform_driver goldfish_tty_platform_driver = { .probe = goldfish_tty_probe, .remove = goldfish_tty_remove, .driver = { - .name ="goldfish_tty" + .name ="goldfish_tty" , + .of_match_table =of_match_ptr (goldfish_tty_match), } };
drivers/video/fbdev/goldfishfb.c +9 -1
@@ -25,6 +25,7 @@#include <linux/init.h> #include <linux/interrupt.h> #include <linux/ioport.h> +#include <linux/of.h> #include <linux/platform_device.h> enum {
@@ -304,12 +305,19 @@ static int goldfish_fb_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id goldfish_fb_match[] = { + { .compatible ="generic,goldfish-fb" }, + { }, +}; +#endif static struct platform_driver goldfish_fb_driver = { .probe = goldfish_fb_probe, .remove = goldfish_fb_remove, .driver = { - .name ="goldfish_fb" + .name ="goldfish_fb" , + .of_match_table =of_match_ptr (goldfish_fb_match), } };
Signature · 1 line
1.9.1
Hi,
Quoted 5 lines · yalin wang
qemu use device tree to bootup linux kernel,
we need add device node match table to plaftorm driver, so that can probe the goldfish driver correctly.
test by this qemu:
git clone https://android.googlesource.com/platform/external/qemu
Your patch is missing the DT binding documentation part and should be splitted into multiple patches, at least one per kernel subsystem. Please read Documentation/SubmittingPatches and Documentation/devicetree/bindings/submitting-patches.txt
-- Sebastian