goldfish: still swimming
Subsystems (8)
cover goldfish: still swimming
This uses the newer macros and platform_driver stuff. The device registration is cleaned up as suggested by Arnd and it does indeed look better that way.
Alan
---
Arve Hjønnevåg (4):
goldfish: tty driver
goldfish: framebuffer
goldfish: real time clock
goldfish: NAND flash driver
Brian Swetland (1):
goldfish: virtual input event driver
David 'Digit' Turner (1):
goldfish: add QEMU pipe driver
Jun Nakajima (2):
goldfish: definitions for Goldfish on x86 platforms
goldfish: add the goldfish virtual bus
Mike Lockwood (2):
goldfish: emulated MMC device
goldfish: power device
arch/x86/Kconfig | 12 + arch/x86/platform/Makefile | 1 arch/x86/platform/goldfish/Makefile | 1 arch/x86/platform/goldfish/goldfish.c | 51 ++ drivers/input/keyboard/Kconfig | 11 + drivers/input/keyboard/Makefile | 1 drivers/input/keyboard/goldfish_events.c | 187 +++++++++ drivers/mmc/host/Kconfig | 7 drivers/mmc/host/Makefile | 1 drivers/mmc/host/goldfish.c | 566 +++++++++++++++++++++++++++ drivers/mtd/devices/Kconfig | 7 drivers/mtd/devices/Makefile | 3 drivers/mtd/devices/goldfish_nand.c | 464 ++++++++++++++++++++++ drivers/mtd/devices/goldfish_nand_reg.h | 72 +++ drivers/platform/Kconfig | 4 drivers/platform/Makefile | 1 drivers/platform/goldfish/Kconfig | 5 drivers/platform/goldfish/Makefile | 5 drivers/platform/goldfish/goldfish_pipe.c | 618 +++++++++++++++++++++++++++++ drivers/platform/goldfish/pdev_bus.c | 237 +++++++++++ drivers/power/Kconfig | 8 drivers/power/Makefile | 1 drivers/power/goldfish_battery.c | 251 ++++++++++++ drivers/rtc/Kconfig | 9 drivers/rtc/Makefile | 1 drivers/rtc/rtc-goldfish.c | 140 +++++++ drivers/tty/Kconfig | 6 drivers/tty/Makefile | 1 drivers/tty/goldfish.c | 332 ++++++++++++++++ drivers/video/Kconfig | 9 drivers/video/Makefile | 1 drivers/video/goldfishfb.c | 316 +++++++++++++++ 32 files changed, 3327 insertions(+), 2 deletions(-) create mode 100644 arch/x86/platform/goldfish/Makefile create mode 100644 arch/x86/platform/goldfish/goldfish.c create mode 100644 drivers/input/keyboard/goldfish_events.c create mode 100644 drivers/mmc/host/goldfish.c create mode 100644 drivers/mtd/devices/goldfish_nand.c create mode 100644 drivers/mtd/devices/goldfish_nand_reg.h create mode 100644 drivers/platform/goldfish/Kconfig create mode 100644 drivers/platform/goldfish/Makefile create mode 100644 drivers/platform/goldfish/goldfish_pipe.c create mode 100644 drivers/platform/goldfish/pdev_bus.c create mode 100644 drivers/power/goldfish_battery.c create mode 100644 drivers/rtc/rtc-goldfish.c create mode 100644 drivers/tty/goldfish.c create mode 100644 drivers/video/goldfishfb.c
Signature · 2 lines
What lives under the sea and carries a lot of people? An Octobus
PATCH 1/10 goldfish: definitions for Goldfish on x86 platforms
From: Jun Nakajima <[email protected]>
Based on code by Jun Nakajima but stripped of all the old x86 mach-foo stuff and turned into a single include file for the Goldfish virtual bus layer
[Ported to 3.7 and reorganised so that we can keep most of the code
shared properly]
---
arch/x86/Kconfig | 12 ++++++++ arch/x86/platform/Makefile | 1 + arch/x86/platform/goldfish/Makefile | 1 + arch/x86/platform/goldfish/goldfish.c | 51 +++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 arch/x86/platform/goldfish/Makefile create mode 100644 arch/x86/platform/goldfish/goldfish.c
arch/x86/Kconfig +12 -0
@@ -322,6 +322,10 @@ config X86_BIGSMP ---help--- This option is needed for the systems that have more than 8 CPUs +config GOLDFISH + def_bool y + depends on X86_GOLDFISH + if X86_32 config X86_EXTENDED_PLATFORM bool "Support for extended (non-PC) x86 platforms"
@@ -404,6 +408,14 @@ config X86_UV # Following is an alphabetically sorted list of 32 bit extended platforms # Please maintain the alphabetic order if and when there are additions +config X86_GOLDFISH + bool "Goldfish (Virtual Platform)" + depends on X86_32 + ---help--- + Enable support for the Goldfish virtual platform used primarily + for Android development. Unless you are building for the Android + Goldfish emulator say N here. + config X86_INTEL_CE bool "CE4100 TV platform" depends on PCI
arch/x86/platform/Makefile +1 -0
@@ -2,6 +2,7 @@ obj-y += ce4100/ obj-y += efi/ obj-y += geode/ +obj-y += goldfish/ obj-y += iris/ obj-y += mrst/ obj-y += olpc/
arch/x86/platform/goldfish/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_GOLDFISH) += goldfish.o
arch/x86/platform/goldfish/goldfish.c new file +51 -0
51 lines not on this page · raw message
PATCH 2/10 goldfish: add the goldfish virtual bus
In reply to Alan CoxFrom: Jun Nakajima <[email protected]>
This imports the current Google code and cleans it up slightly to use pr_ and to properly request its resources.
Goldfish is an emulator used for Android development. It has a virtual bus where the emulator passes platform device information to the guest which then creates the appropriate devices.
This part of the emulation is not architecture specific so should not be hiding in architecture trees as it does in the Google Android tree. The constants it uses do depend on the platform and so live in arch/goldfish.h
---
drivers/platform/Makefile | 1 drivers/platform/goldfish/Makefile | 4 + drivers/platform/goldfish/pdev_bus.c | 237 ++++++++++++++++++++++++++++++++++ 3 files changed, 242 insertions(+) create mode 100644 drivers/platform/goldfish/Makefile create mode 100644 drivers/platform/goldfish/pdev_bus.c
drivers/platform/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-$(CONFIG_X86) += x86/ obj-$(CONFIG_OLPC) += olpc/ +obj-$(CONFIG_GOLDFISH) += goldfish/
drivers/platform/goldfish/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# +# Makefile for Goldfish platform specific drivers +# +obj-$(CONFIG_GOLDFISH) += pdev_bus.o
drivers/platform/goldfish/pdev_bus.c new file +237 -0
237 lines not on this page · raw message
Re: [PATCH 02/10] goldfish: add the goldfish virtual bus
Hi,
Quoted 9 lines · Alan Cox
drivers/platform/goldfish/pdev_bus.c new file +9
-0+static irqreturn_t goldfish_pdev_bus_interrupt (int irq,void *dev_id) +{ +irqreturn_t ret =IRQ_NONE ; +while (1 ) { +u32 op =readl (pdev_bus_base +PDEV_BUS_OP ); +switch (op) { +case PDEV_BUS_OP_DONE : +return IRQ_NONE ; +
drivers/platform/goldfish/pdev_bus.c line 171
Quoted 10 lines
drivers/platform/goldfish/pdev_bus.c new file +10
-0+case PDEV_BUS_OP_REMOVE_DEV : +goldfish_pdev_remove (); +break ; + +case PDEV_BUS_OP_ADD_DEV : +goldfish_new_pdev (); +break ; + } + ret =IRQ_HANDLED ; + }
missing a return ret here ?
Quoted 10 lines
drivers/platform/goldfish/pdev_bus.c new file +10
-0+} + +static int goldfish_pdev_bus_probe (struct platform_device *pdev) +{ +int ret; +struct resource *r; + + r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (r ==NULL ) +return -EINVAL ;
drivers/platform/goldfish/pdev_bus.c line 191
Quoted 10 lines
drivers/platform/goldfish/pdev_bus.c new file +10
-0+ + pdev_bus_addr = r->start; + pdev_bus_len =resource_size (r); + +if (request_region (pdev_bus_addr, pdev_bus_len,"goldfish" )) { +pr_err ("unable to reserve Goldfish MMIO.\n" ); +return -EBUSY ; + } + + pdev_bus_base =ioremap (pdev_bus_addr, pdev_bus_len);
how about converting the two above to devm_request_and_ioremap() ?
Quoted 5 lines
drivers/platform/goldfish/pdev_bus.c new file +5
-0+if (pdev_bus_base ==NULL ) { + ret = -ENOMEM ; +pr_err ("unable to map Goldfish MMIO.\n" ); + goto free_resources; + }
drivers/platform/goldfish/pdev_bus.c line 206
Quoted 10 lines
drivers/platform/goldfish/pdev_bus.c new file +10
-0+ + r =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); +if (r ==NULL ) { + ret = -ENOENT ; + goto free_map; + } + + pdev_bus_irq = r->start; + + ret = request_irq(pdev_bus_irq, goldfish_pdev_bus_interrupt,
and here to devm_request_irq() ...
Quoted 9 lines
drivers/platform/goldfish/pdev_bus.c new file +9
-0+ IRQF_SHARED, "goldfish_pdev_bus", pdev); +if (ret) + goto free_map; + +writel (PDEV_BUS_OP_INIT , pdev_bus_base +PDEV_BUS_OP ); +return 0 ; + +free_map: +iounmap (pdev_bus_base);
drivers/platform/goldfish/pdev_bus.c line 225
Quoted 10 lines
drivers/platform/goldfish/pdev_bus.c new file +10
-0+free_resources: +release_region (pdev_bus_addr, pdev_bus_len); +return ret; +} + +static int goldfish_pdev_bus_remove (struct platform_device *pdev) +{ +iounmap (pdev_bus_base); +free_irq (pdev_bus_irq, pdev); +release_region (pdev_bus_addr, pdev_bus_len);
your remove would, then, be an empty function.
Signature · 1 line
balbi
PATCH 3/10 goldfish: tty driver
In reply to Alan CoxFrom: Arve Hjønnevåg <[email protected]>
This provides a console driver for the Goldfish virtual platform. The original is from Arve with changes from Jun Nakajima and Tom Keel. This has been then been ported to the current kernel and to the tty port mechanism by Alan Cox. In the process it gained proper POSIX semantics and vhangup works. The default name is not ttyS as this belongs to the 8250 driver. Instead ttyGFx is now used.
In the normal usage case the first port serves as a kernel logging console and the second one carries various other data streams for the emulation.
---
drivers/tty/Kconfig | 6 + drivers/tty/Makefile | 1 drivers/tty/goldfish.c | 332 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 339 insertions(+) create mode 100644 drivers/tty/goldfish.c
drivers/tty/Kconfig +6 -0
@@ -388,3 +388,9 @@ config PPC_EARLY_DEBUG_EHV_BC_HANDLE If the number you specify is not a valid byte channel handle, then there simply will be no early console output. This is true also if you don't boot under a hypervisor at all. + +config GOLDFISH_TTY + tristate "Goldfish TTY Driver" + depends on GOLDFISH + help + Console and system TTY driver for the Goldfish virtual platform.
drivers/tty/Makefile +1 -0
@@ -27,5 +27,6 @@ obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o obj-$(CONFIG_SYNCLINK) += synclink.o obj-$(CONFIG_PPC_EPAPR_HV_BYTECHAN) += ehv_bytechan.o +obj-$(CONFIG_GOLDFISH_TTY) += goldfish.o obj-y += ipwireless/
drivers/tty/goldfish.c new file +332 -0
332 lines not on this page · raw message
Re: [PATCH 03/10] goldfish: tty driver
Hi,
Quoted 5 lines · Alan Cox
drivers/tty/goldfish.c new file +5
-0+static int goldfish_tty_probe (struct platform_device *pdev) +{ +struct goldfish_tty *qtty; +int ret = -EINVAL ; +int i;
drivers/tty/goldfish.c line 237
Quoted 10 lines
drivers/tty/goldfish.c new file +10
-0+struct resource *r; +struct device *ttydev; +void __iomem *base; +u32 irq; + + r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (r ==NULL ) +return -EINVAL ; + + base =ioremap (r->start,0x1000 );
missing request_mem_region(), in fact you could just use devm_request_and_ioremap().
Quoted 20 lines
drivers/tty/goldfish.c new file +20
-0+if (base ==NULL ) +pr_err ("goldfish_tty: unable to remap base\n" ); + + r =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); +if (r ==NULL ) + goto err_unmap; + + irq = r->start; + +if (pdev->id >= goldfish_tty_line_count) + goto err_unmap; + +mutex_lock (&goldfish_tty_lock); +if (goldfish_tty_current_line_count ==0 ) { + ret =goldfish_tty_create_driver (); +if (ret) + goto err_create_driver_failed; + } + goldfish_tty_current_line_count++; +
drivers/tty/goldfish.c line 267
Quoted 10 lines
drivers/tty/goldfish.c new file +10
-0+ qtty = &goldfish_ttys[pdev->id]; +spin_lock_init (&qtty->lock); +tty_port_init (&qtty->port); + qtty->port.ops = &goldfish_port_ops; + qtty->base = base; + qtty->irq = irq; + +writel (GOLDFISH_TTY_CMD_INT_DISABLE , base +GOLDFISH_TTY_CMD ); + + ret =request_irq (irq, goldfish_tty_interrupt,IRQF_SHARED ,"goldfish_tty" , pdev);
this is way over 80-chars, also could use some devm_request_irq().
drivers/tty/goldfish.c line 272
Quoted 1 line
drivers/tty/goldfish.c new file +1
-0+ ttydev =tty_port_register_device (&qtty->port, goldfish_tty_driver, pdev->id, &pdev->dev);
over 80-chars.
Quoted 1 line
+MODULE_LICENSE("GPL");
the comment header in this file says it's GPL v2, so this should be:
MODULE_LICENSE("GPL v2");
Signature · 1 line
balbi
Re: [PATCH 03/10] goldfish: tty driver
Quoted 13 lines · On Wed, 16 Jan 2013 19:01:22 +0200 Felipe Balbi <[email protected]> wrote:
Hi,
Quoted 10 lines · Alan Cox
drivers/tty/goldfish.c new file +10
-0+static int goldfish_tty_probe (struct platform_device *pdev) +{ +struct goldfish_tty *qtty; +int ret = -EINVAL ; +int i; +struct resource *r; +struct device *ttydev; +void __iomem *base; +u32 irq; +
Quoted 8 lines
drivers/tty/goldfish.c line 237
Quoted 5 lines
drivers/tty/goldfish.c new file +5
-0+ r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (r ==NULL ) +return -EINVAL ; + + base =ioremap (r->start,0x1000 );missing
request_mem_region(), in fact you could just usedevm_request_and_ioremap().
Actually the reservation is already done by the bus driver. If it sees the goldfish interface it reserves the entire chunk and the emulator then tells it which is in each chunk of that range.
It's reserving it as the wrong type however so I do need to fix that.
Alan
Re: [PATCH 03/10] goldfish: tty driver
Hi,
Quoted 25 lines · Alan Cox
Quoted 13 lines · On Wed, 16 Jan 2013 19:01:22 +0200 Felipe Balbi <[email protected]> wrote:
Hi,
Quoted 10 lines · Alan Cox
drivers/tty/goldfish.c new file +10
-0+static int goldfish_tty_probe (struct platform_device *pdev) +{ +struct goldfish_tty *qtty; +int ret = -EINVAL ; +int i; +struct resource *r; +struct device *ttydev; +void __iomem *base; +u32 irq; +Quoted 8 lines
drivers/tty/goldfish.c line 237
Quoted 5 lines
drivers/tty/goldfish.c new file +5
-0+ r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (r ==NULL ) +return -EINVAL ; + + base =ioremap (r->start,0x1000 );missing
request_mem_region(), in fact you could just usedevm_request_and_ioremap().
Quoted 3 lines
Actually the reservation is already done by the bus driver. If it sees the goldfish interface it reserves the entire chunk and the emulator then tells it which is in each chunk of that range.
a bit unusual, but fair enough.
cheers
Signature · 1 line
balbi
PATCH 4/10 goldfish: virtual input event driver
In reply to Alan CoxFrom: Brian Swetland <[email protected]>
This device is a direct pipe from "hardware" to the input event subsystem, allowing us to avoid having to route "keypad" style events through an AT keyboard driver (gross!)
As with the other submissions this driver is cross architecture.
---
drivers/input/keyboard/Kconfig | 11 ++ drivers/input/keyboard/Makefile | 1 drivers/input/keyboard/goldfish_events.c | 187 ++++++++++++++++++++++++++++++ 3 files changed, 199 insertions(+) create mode 100644 drivers/input/keyboard/goldfish_events.c
drivers/input/keyboard/Kconfig +11 -0
@@ -479,6 +479,17 @@ config KEYBOARD_SAMSUNG To compile this driver as a module, choose M here: the module will be called samsung-keypad. +config KEYBOARD_GOLDFISH_EVENTS + depends on GOLDFISH + tristate "Generic Input Event device for Goldfish" + help + Say Y here to get an input event device for the Goldfish virtual + device emulator. + + To compile this driver as a module, choose M here: the + module will be called goldfish-events. + + config KEYBOARD_STOWAWAY tristate "Stowaway keyboard" select SERIO
drivers/input/keyboard/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o +obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS) += goldfish_events.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o
drivers/input/keyboard/goldfish_events.c new file +187 -0
187 lines not on this page · raw message
Re: [PATCH 04/10] goldfish: virtual input event driver
Hi,
Quoted 135 lines · Alan Cox
From: Brian Swetland <[email protected]>
This device is a direct pipe from "hardware" to the input event subsystem, allowing us to avoid having to route "keypad" style events through an AT keyboard driver (gross!)
As with the other submissions this driver is cross architecture.
Signed-off-by Mike A. Chan <[email protected]>[Tided up to work on x86]Signed-off-by Sheng Yang <[email protected]>Signed-off-by Yunhong Jiang <[email protected]>Signed-off-by Xiaohui Xin <[email protected]>Signed-off-by Jun Nakajima <[email protected]>Signed-off-by Bruce Beare <[email protected]>[Ported to 3.4]Signed-off-by Tom Keel <[email protected]>[Cleaned up for 3.7 and submission]Signed-off-by Alan Cox <[email protected]>---
drivers/input/keyboard/Kconfig | 11 ++ drivers/input/keyboard/Makefile | 1 drivers/input/keyboard/goldfish_events.c | 187 ++++++++++++++++++++++++++++++ 3 files changed, 199 insertions(+) create mode 100644 drivers/input/keyboard/goldfish_events.cdrivers/input/keyboard/Kconfig +11
-0@@ -479,6 +479,17 @@ config KEYBOARD_SAMSUNG To compile this driver as a module, choose M here: the module will be called samsung-keypad. +config KEYBOARD_GOLDFISH_EVENTS + depends on GOLDFISH + tristate "Generic Input Event device for Goldfish" + help + Say Y here to get an input event device for the Goldfish virtual + device emulator. + + To compile this driver as a module, choose M here: the + module will be called goldfish-events. + + config KEYBOARD_STOWAWAY tristate "Stowaway keyboard" select SERIOdrivers/input/keyboard/Makefile +1
-0@@ -13,6 +13,7 @@ obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o +obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS) += goldfish_events.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.odrivers/input/keyboard/goldfish_events.c new file +67
-0@@ -0,0 +1,187 @@ +/* +* Copyright (C) 2007 Google, Inc. +* Copyright (C) 2012 Intel, Inc. +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#include <linux/module.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/types.h> +#include <linux/input.h> +#include <linux/kernel.h> +#include <linux/platform_device.h> +#include <linux/slab.h> +#include <linux/irq.h> +#include <linux/io.h> + +enum { +REG_READ =0x00 , +REG_SET_PAGE =0x00 , +REG_LEN =0x04 , +REG_DATA =0x08 , + +PAGE_NAME =0x00000 , +PAGE_EVBITS =0x10000 , +PAGE_ABSDATA =0x20000 |EV_ABS , +}; + +struct event_dev { +struct input_dev *input; +int irq; +void __iomem *addr; +char name[0 ]; +}; + +static irqreturn_t events_interrupt (int irq,void *dev_id) +{ +struct event_dev *edev = dev_id; +unsigned type, code, value; + + type =__raw_readl (edev->addr +REG_READ ); + code =__raw_readl (edev->addr +REG_READ ); + value =__raw_readl (edev->addr +REG_READ ); + +input_event (edev->input, type, code, value); +if (type ==EV_KEY ) +input_sync (edev->input); +return IRQ_HANDLED ; +} + +static void events_import_bits (struct event_dev *edev, +unsigned long bits[],unsigned type,size_t count) +{ +int i, j; +size_t size; +uint8_t val; +void __iomem *addr = edev->addr; +__raw_writel (PAGE_EVBITS | type, addr +REG_SET_PAGE );
drivers/input/keyboard/goldfish_events.c line 77
Quoted 10 lines
drivers/input/keyboard/goldfish_events.c new file +10
-0+ size =__raw_readl (addr +REG_LEN ) *8 ; +if (size < count) + count = size; + addr = addr +REG_DATA ; +for (i =0 ; i < count; i +=8 ) { + val =__raw_readb (addr++); +for (j =0 ; j <8 ; j++) +if (val &1 << j) +set_bit (i + j, bits); + }
I guess something like below would be better ?
for (i = 0; i < count; i += 8) {
val = readb(addr++);
while (val) {
unsigned long j = __ffs(val);
unsigned int bit = i + j;
val &= ~BIT(j);
set_bit(bit, bits);
}
}guess I wrote it correctly, not even compile tested however.
drivers/input/keyboard/goldfish_events.c line 92
Quoted 13 lines
drivers/input/keyboard/goldfish_events.c new file +13
-0+static int events_probe (struct platform_device *pdev) +{ +struct input_dev *input_dev; +struct event_dev *edev =NULL ; +struct resource *res; +unsigned keymapnamelen; +int i; +int count; +int irq; +void __iomem *addr; +int ret; + +pr_debug ("*** events probe ***\n" );
looks unnecessary to me. Also, you have a struct device * inside your pdev, so if you really wanna keep these debugging messages, it might be better to make use of dev_dbg(&pdev->dev, ....) instead.
drivers/input/keyboard/goldfish_events.c line 94
Quoted 1 line
drivers/input/keyboard/goldfish_events.c new file +1
-0+ input_dev =input_allocate_device ();
devm_input_allocate_device()
drivers/input/keyboard/goldfish_events.c line 99
Quoted 5 lines
drivers/input/keyboard/goldfish_events.c new file +5
-0+ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!input_dev || !res) + goto fail; + + addr =ioremap (res->start,4096 );
missing request_mem_region(), 4096 has a define in <linux/sizes.h> SZ_4K. As said before, this could be converted to devm_request_and_ioremap()
Quoted 4 lines
drivers/input/keyboard/goldfish_events.c new file +4
-0+ irq =platform_get_irq (pdev,0 ); + +pr_debug ("events_probe() addr=%p irq=%d\n" , addr, irq); +
drivers/input/keyboard/goldfish_events.c line 113
Quoted 10 lines
drivers/input/keyboard/goldfish_events.c new file +10
-0+if (!addr) + goto fail; +if (irq <0 ) + goto fail; + +__raw_writel (PAGE_NAME , addr +REG_SET_PAGE ); + keymapnamelen =__raw_readl (addr +REG_LEN ); + + edev =kzalloc (sizeof (struct event_dev ) + keymapnamelen +1 , +GFP_KERNEL );
devm_kzalloc()
Quoted 38 lines
drivers/input/keyboard/goldfish_events.c new file +38
-0+if (!edev) + goto fail; + + edev->input = input_dev; + edev->addr = addr; + edev->irq = irq; + +for (i =0 ; i < keymapnamelen; i++) + edev->name[i] =__raw_readb (edev->addr +REG_DATA + i); + +pr_debug ("events_probe() keymap=%s\n" , edev->name); + +events_import_bits (edev, input_dev->evbit,EV_SYN ,EV_MAX ); +events_import_bits (edev, input_dev->keybit,EV_KEY ,KEY_MAX ); +events_import_bits (edev, input_dev->relbit,EV_REL ,REL_MAX ); +events_import_bits (edev, input_dev->absbit,EV_ABS ,ABS_MAX ); +events_import_bits (edev, input_dev->mscbit,EV_MSC ,MSC_MAX ); +events_import_bits (edev, input_dev->ledbit,EV_LED ,LED_MAX ); +events_import_bits (edev, input_dev->sndbit,EV_SND ,SND_MAX ); +events_import_bits (edev, input_dev->ffbit,EV_FF ,FF_MAX ); +events_import_bits (edev, input_dev->swbit,EV_SW ,SW_MAX ); + +__raw_writel (PAGE_ABSDATA , addr +REG_SET_PAGE ); + count =__raw_readl (addr +REG_LEN ) / (4 *4 ); +if (count >ABS_MAX ) + count =ABS_MAX ; +for (i =0 ; i < count; i++) { +int val[4 ]; +int j; +if (!test_bit (i, input_dev->absbit)) +continue ; +for (j =0 ; j <ARRAY_SIZE (val); j++) + val[j] =__raw_readl (edev->addr +REG_DATA + (i *ARRAY_SIZE (val) + j) *4 ); +input_set_abs_params (input_dev, i, val[0 ], val[1 ], + val[2 ], val[3 ]); + } + +platform_set_drvdata (pdev, edev);
drivers/input/keyboard/goldfish_events.c line 161
Quoted 10 lines
drivers/input/keyboard/goldfish_events.c new file +10
-0+ + input_dev->name = edev->name; +input_set_drvdata (input_dev, edev); + + ret =input_register_device (input_dev); +if (ret) + goto fail; + +if (request_irq (edev->irq, events_interrupt,0 , +"goldfish-events-keypad" , edev) <0 ) {
devm_request_irq()
Quoted 6 lines
drivers/input/keyboard/goldfish_events.c new file +6
-0+input_unregister_device (input_dev); +kfree (edev); +return -EINVAL ; + } + +return 0 ;
drivers/input/keyboard/goldfish_events.c line 177
Quoted 10 lines
drivers/input/keyboard/goldfish_events.c new file +10
-0+ +fail: +kfree (edev); +input_free_device (input_dev); + +return -EINVAL ; +} + +static struct platform_driver events_driver = { + .probe = events_probe,
no remove ?
Signature · 1 line
balbi
PATCH 5/10 goldfish: framebuffer
In reply to Alan CoxFrom: Arve Hjønnevåg <[email protected]>
Framebuffer support for the Goldfish emulator. This takes the Google emulator and applies the x86 cleanups as well as moving the blank methods to the usual Linux place and dropping the Android early suspend logic (for now at least, that can be looked at as Android and upstream converge). Dropped various oddities like setting MTRRs on a virtual frame buffer emulation...
With the drivers so far you can now boot a Linux initrd and have fun.
---
drivers/video/Kconfig | 9 + drivers/video/Makefile | 1 drivers/video/goldfishfb.c | 316 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 326 insertions(+) create mode 100644 drivers/video/goldfishfb.c
drivers/video/Kconfig +9 -0
@@ -2183,6 +2183,15 @@ config FB_XILINX framebuffer. ML300 carries a 640*480 LCD display on the board, ML403 uses a standard DB15 VGA connector. +config FB_GOLDFISH + tristate "Goldfish Framebuffer" + depends on FB + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + ---help--- + Framebuffer driver for Goldfish Virtual Platform + config FB_COBALT tristate "Cobalt server LCD frame buffer support" depends on FB && (MIPS_COBALT || MIPS_SEAD3)
drivers/video/Makefile +1 -0
@@ -98,6 +98,7 @@ obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o obj-$(CONFIG_FB_VOODOO1) += sstfb.o obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o +obj-$(CONFIG_FB_GOLDFISH) += goldfishfb.o obj-$(CONFIG_FB_68328) += 68328fb.o obj-$(CONFIG_FB_GBE) += gbefb.o obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o
drivers/video/goldfishfb.c new file +316 -0
316 lines not on this page · raw message
PATCH 6/10 goldfish: emulated MMC device
In reply to Alan CoxFrom: Mike Lockwood <[email protected]>
This driver handles the virtual MMC device present in the Goldfish emulator. The patch folds together initial work from Mike Lockwood and patches by San Mehat, Jun Nakajima and Tom Keel <[email protected]> plus cleanups by Alan Cox to get it all into 3.6 shape.
---
drivers/mmc/host/Kconfig | 7 + drivers/mmc/host/Makefile | 1 drivers/mmc/host/goldfish.c | 566 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 574 insertions(+) create mode 100644 drivers/mmc/host/goldfish.c
drivers/mmc/host/Kconfig +7 -0
@@ -372,6 +372,13 @@ config MMC_DAVINCI If you have an DAVINCI board with a Multimedia Card slot, say Y or M here. If unsure, say N. +config MMC_GOLDFISH + tristate "goldfish qemu Multimedia Card Interface support" + depends on GOLDFISH + help + This selects the Goldfish Multimedia card Interface emulation + found on the Goldfish Android virtual device emulation. + config MMC_SPI tristate "MMC/SD/SDIO over SPI" depends on SPI_MASTER && !HIGHMEM && HAS_DMA
drivers/mmc/host/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o obj-$(CONFIG_MMC_MSM) += msm_sdcc.o obj-$(CONFIG_MMC_MVSDIO) += mvsdio.o obj-$(CONFIG_MMC_DAVINCI) += davinci_mmc.o +obj-$(CONFIG_MMC_GOLDFISH) += goldfish.o obj-$(CONFIG_MMC_SPI) += mmc_spi.o ifeq ($(CONFIG_OF),y) obj-$(CONFIG_MMC_SPI) += of_mmc_spi.o
drivers/mmc/host/goldfish.c new file +566 -0
566 lines not on this page · raw message
Re: [PATCH 06/10] goldfish: emulated MMC device
Hi,
drivers/mmc/host/goldfish.c line 112
Quoted 4 lines · Alan Cox
drivers/mmc/host/goldfish.c new file +4
-0+#define OMAP_MMC_CMDTYPE_BC 0 +#define OMAP_MMC_CMDTYPE_BCR 1 +#define OMAP_MMC_CMDTYPE_AC 2 +#define OMAP_MMC_CMDTYPE_ADTC 3
OMAP ?? :-) If you guys are emulating an OMAP mmc controller, why don't you just re-use the omap mmc driver instead of duplicating the code ?
same comments about devm_* and the GPL license
Signature · 1 line
balbi
Re: [PATCH 06/10] goldfish: emulated MMC device
Quoted 10 lines · On Wed, 16 Jan 2013 19:18:39 +0200 Felipe Balbi <[email protected]> wrote:
Hi,
drivers/mmc/host/goldfish.c line 112
Quoted 4 lines · Alan Cox
drivers/mmc/host/goldfish.c new file +4
-0+#define OMAP_MMC_CMDTYPE_BC 0 +#define OMAP_MMC_CMDTYPE_BCR 1 +#define OMAP_MMC_CMDTYPE_AC 2 +#define OMAP_MMC_CMDTYPE_ADTC 3OMAP ?? :-) If you guys are emulating an OMAP mmc controller, why don't you just re-use the omap mmc driver instead of duplicating the code ?
It's not an OMAP controller, it just has some similar behaviours. I guess that's because the original Google emulation target was entirely ARM based.
Alan
Re: [PATCH 06/10] goldfish: emulated MMC device
Quoted 14 lines · Alan Cox
Quoted 10 lines · On Wed, 16 Jan 2013 19:18:39 +0200 Felipe Balbi <[email protected]> wrote:
Hi,
drivers/mmc/host/goldfish.c line 112
Quoted 4 lines · Alan Cox
drivers/mmc/host/goldfish.c new file +4
-0+#define OMAP_MMC_CMDTYPE_BC 0 +#define OMAP_MMC_CMDTYPE_BCR 1 +#define OMAP_MMC_CMDTYPE_AC 2 +#define OMAP_MMC_CMDTYPE_ADTC 3OMAP ?? :-) If you guys are emulating an OMAP mmc controller, why don't you just re-use the omap mmc driver instead of duplicating the code ?
Quoted 3 lines
It's not an OMAP controller, it just has some similar behaviours. I guess that's because the original Google emulation target was entirely ARM based.
fair enough, cheers
Signature · 1 line
balbi
PATCH 7/10 goldfish: power device
In reply to Alan CoxFrom: Mike Lockwood <[email protected]>
Add the emulated power driver for the Goldfish platform.
This folds together the code from the Google tree, Jun Nakajima's cleanups and x86 porting work, and then a tidy up to pass checkpatch.
---
drivers/power/Kconfig | 8 + drivers/power/Makefile | 1 drivers/power/goldfish_battery.c | 251 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 drivers/power/goldfish_battery.c
drivers/power/Kconfig +7 -1
@@ -346,8 +346,14 @@ config AB8500_BM help Say Y to include support for AB8500 battery management. -source "drivers/power/reset/Kconfig" +config BATTERY_GOLDFISH + tristate "Goldfish battery driver" + depends on GOLDFISH + help + Say Y to enable support for the battery and AC power in the + Goldfish emulator. +source "drivers/power/reset/Kconfig" endif # POWER_SUPPLY source "drivers/power/avs/Kconfig"
drivers/power/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o obj-$(CONFIG_BATTERY_DS2780) += ds2780_battery.o obj-$(CONFIG_BATTERY_DS2781) += ds2781_battery.o obj-$(CONFIG_BATTERY_DS2782) += ds2782_battery.o +obj-$(CONFIG_BATTERY_GOLDFISH) += goldfish_battery.o obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o
drivers/power/goldfish_battery.c new file +251 -0
251 lines not on this page · raw message
PATCH 8/10 goldfish: real time clock
In reply to Alan CoxFrom: Arve Hjønnevåg <[email protected]>
Gets the current time from the host. Alarms are not supported yet.
---
drivers/rtc/Kconfig | 9 +++ drivers/rtc/Makefile | 1 drivers/rtc/rtc-goldfish.c | 140 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 drivers/rtc/rtc-goldfish.c
drivers/rtc/Kconfig +9 -0
@@ -998,6 +998,15 @@ config RTC_DRV_BFIN This driver can also be built as a module. If so, the module will be called rtc-bfin. +config RTC_DRV_GOLDFISH + tristate "GOLDFISH" + depends on GOLDFISH + help + RTC driver for Goldfish Virtual Platform + + This driver can also be built as a module. If so, the module + will be called rtc-goldfish. + config RTC_DRV_RS5C313 tristate "Ricoh RS5C313" depends on SH_LANDISK
drivers/rtc/Makefile +1 -0
@@ -52,6 +52,7 @@ obj-$(CONFIG_RTC_DRV_EM3027) += rtc-em3027.o obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o obj-$(CONFIG_RTC_DRV_FM3130) += rtc-fm3130.o obj-$(CONFIG_RTC_DRV_GENERIC) += rtc-generic.o +obj-$(CONFIG_RTC_DRV_GOLDFISH) += rtc-goldfish.o obj-$(CONFIG_RTC_DRV_HID_SENSOR_TIME) += rtc-hid-sensor-time.o obj-$(CONFIG_RTC_DRV_IMXDI) += rtc-imxdi.o obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o
drivers/rtc/rtc-goldfish.c new file +140 -0
140 lines not on this page · raw message
PATCH 9/10 goldfish: add QEMU pipe driver
In reply to Alan CoxFrom: David 'Digit' Turner <[email protected]>
A QEMU pipe is a very fast communication channel between the guest system and the emulator. Usage from the guest is simply something like;
// connect to special device
fd = open("/dev/qemu_pipe", O_RDWR); // tell which service we want to talk to (must be zero-terminated) write(fd, "pipeName", strlen("pipeName")+1);
// do read()/write() through fd now
...
// close channel close(fd);
---
drivers/platform/Kconfig | 4 drivers/platform/goldfish/Kconfig | 5 drivers/platform/goldfish/Makefile | 1 drivers/platform/goldfish/goldfish_pipe.c | 618 +++++++++++++++++++++++++++++ 4 files changed, 628 insertions(+) create mode 100644 drivers/platform/goldfish/Kconfig create mode 100644 drivers/platform/goldfish/goldfish_pipe.c
drivers/platform/Kconfig +4 -0
@@ -1,3 +1,7 @@ if X86 source "drivers/platform/x86/Kconfig" endif +if GOLDFISH +source "drivers/platform/goldfish/Kconfig" +endif +
drivers/platform/goldfish/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +config GOLDFISH_PIPE + tristate "Goldfish virtual device for QEMU pipes" + ---help--- + This is a virtual device to drive the QEMU pipe interface used by + the Goldfish Android Virtual Device.
drivers/platform/goldfish/Makefile +1 -0
@@ -2,3 +2,4 @@ # Makefile for Goldfish platform specific drivers # obj-$(CONFIG_GOLDFISH) += pdev_bus.o +obj-$(CONFIG_GOLDFISH_PIPE) += goldfish_pipe.o
drivers/platform/goldfish/goldfish_pipe.c new file +618 -0
618 lines not on this page · raw message
PATCH 10/10 goldfish: NAND flash driver
In reply to Alan CoxFrom: Arve Hjønnevåg <[email protected]>
Fold together the NAND driver for Goldfish from Arve with cleanups by Jun Nakajima and a tidy up to 3.7 and checkpatch.
---
drivers/mtd/devices/Kconfig | 7 drivers/mtd/devices/Makefile | 3 drivers/mtd/devices/goldfish_nand.c | 464 +++++++++++++++++++++++++++++++ drivers/mtd/devices/goldfish_nand_reg.h | 72 +++++ 4 files changed, 545 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/devices/goldfish_nand.c create mode 100644 drivers/mtd/devices/goldfish_nand_reg.h
drivers/mtd/devices/Kconfig +7 -0
@@ -343,4 +343,11 @@ config MTD_DOCPROBE_55AA LinuxBIOS or if you need to recover a DiskOnChip Millennium on which you have managed to wipe the first block. +config MTD_GOLDFISH_NAND + tristate "Goldfish NAND device" + depends on GOLDFISH + help + Drives the emulated NAND flash device on the Google Goldfish + Android virtual device. + endmenu
drivers/mtd/devices/Makefile +2 -1
@@ -20,5 +20,6 @@ obj-$(CONFIG_MTD_M25P80) += m25p80.o obj-$(CONFIG_MTD_SPEAR_SMI) += spear_smi.o obj-$(CONFIG_MTD_SST25L) += sst25l.o obj-$(CONFIG_MTD_BCM47XXSFLASH) += bcm47xxsflash.o +obj-$(CONFIG_MTD_GOLDFISH_NAND) += goldfish_nand.o -CFLAGS_docg3.o += -I$(src) +CFLAGS_docg3.o += -I$(src)
drivers/mtd/devices/goldfish_nand.c new file +464 -0
464 lines not on this page · raw message
drivers/mtd/devices/goldfish_nand_reg.h new file +72 -0
72 lines not on this page · raw message