Commit db6e1fd2 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

greybus: hook up sdio, gpio, and tty into the greybus core.

parent 503c1cdb
greybus-y := core.o gbuf.o i2c-gb.o
greybus-y := core.o gbuf.o i2c-gb.o gpio-gb.o sdio-gb.o uart-gb.o
obj-m += greybus.o
obj-m += sdio-gb.o
obj-m += gpio-gb.o
obj-m += uart-gb.o
KERNELVER ?= $(shell uname -r)
KERNELDIR ?= /lib/modules/$(KERNELVER)/build
......
......@@ -157,17 +157,58 @@ static int new_device(struct greybus_device *gdev,
/* Allocate all of the different "sub device types" for this device */
retval = gb_i2c_probe(gdev, id);
if (retval)
goto error_i2c;
retval = gb_gpio_probe(gdev, id);
if (retval)
goto error_gpio;
retval = gb_sdio_probe(gdev, id);
if (retval)
goto error_sdio;
retval = gb_tty_probe(gdev, id);
if (retval)
goto error_tty;
return 0;
error_tty:
gb_sdio_disconnect(gdev);
error_sdio:
gb_gpio_disconnect(gdev);
error_gpio:
gb_i2c_disconnect(gdev);
error_i2c:
return retval;
}
static void remove_device(struct greybus_device *gdev)
{
/* tear down all of the "sub device types" for this device */
gb_i2c_disconnect(gdev);
gb_gpio_disconnect(gdev);
gb_sdio_disconnect(gdev);
gb_tty_disconnect(gdev);
}
static int __init gb_init(void)
{
int retval;
retval = gb_tty_init();
if (retval)
return retval;
return 0;
}
static void __exit gb_exit(void)
{
gb_tty_exit();
}
module_init(gb_init);
......
......@@ -51,7 +51,8 @@ static void gpio_set(struct gpio_chip *gpio, unsigned nr, int val)
return;
}
static int gpio_gb_probe(struct greybus_device *gdev, const struct greybus_device_id *id)
int gb_gpio_probe(struct greybus_device *gdev,
const struct greybus_device_id *id)
{
struct gb_gpio_device *gb_gpio;
struct gpio_chip *gpio;
......@@ -87,7 +88,7 @@ static int gpio_gb_probe(struct greybus_device *gdev, const struct greybus_devic
return 0;
}
static void gpio_gb_disconnect(struct greybus_device *gdev)
void gb_gpio_disconnect(struct greybus_device *gdev)
{
struct gb_gpio_device *gb_gpio_dev;
......@@ -96,9 +97,10 @@ static void gpio_gb_disconnect(struct greybus_device *gdev)
gpiochip_remove(&gb_gpio_dev->chip);
}
#if 0
static struct greybus_driver gpio_gb_driver = {
.probe = gpio_gb_probe,
.disconnect = gpio_gb_disconnect,
.probe = gb_gpio_probe,
.disconnect = gb_gpio_disconnect,
.id_table = id_table,
};
......@@ -106,3 +108,4 @@ module_greybus_driver(gpio_gb_driver);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Greybus GPIO driver");
MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org>");
#endif
......@@ -109,7 +109,15 @@ struct greybus_device {
*/
int gb_i2c_probe(struct greybus_device *gdev, const struct greybus_device_id *id);
void gb_i2c_disconnect(struct greybus_device *gdev);
int gb_gpio_probe(struct greybus_device *gdev, const struct greybus_device_id *id);
void gb_gpio_disconnect(struct greybus_device *gdev);
int gb_sdio_probe(struct greybus_device *gdev, const struct greybus_device_id *id);
void gb_sdio_disconnect(struct greybus_device *gdev);
int gb_tty_probe(struct greybus_device *gdev, const struct greybus_device_id *id);
void gb_tty_disconnect(struct greybus_device *gdev);
int gb_tty_init(void);
void gb_tty_exit(void);
struct gbuf *greybus_alloc_gbuf(struct greybus_device *gdev,
struct cport *cport,
......
......@@ -45,7 +45,8 @@ static const struct mmc_host_ops gb_sd_ops = {
.get_ro = gb_sd_get_ro,
};
static int sd_gb_probe(struct greybus_device *gdev, const struct greybus_device_id *id)
int gb_sdio_probe(struct greybus_device *gdev,
const struct greybus_device_id *id)
{
struct mmc_host *mmc;
struct gb_sdio_host *host;
......@@ -64,7 +65,7 @@ static int sd_gb_probe(struct greybus_device *gdev, const struct greybus_device_
return 0;
}
static void sd_gb_disconnect(struct greybus_device *gdev)
void gb_sdio_disconnect(struct greybus_device *gdev)
{
struct mmc_host *mmc;
struct gb_sdio_host *host;
......@@ -76,9 +77,10 @@ static void sd_gb_disconnect(struct greybus_device *gdev)
mmc_free_host(mmc);
}
#if 0
static struct greybus_driver sd_gb_driver = {
.probe = sd_gb_probe,
.disconnect = sd_gb_disconnect,
.probe = gb_sdio_probe,
.disconnect = gb_sdio_disconnect,
.id_table = id_table,
};
......@@ -86,3 +88,4 @@ module_greybus_driver(sd_gb_driver);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Greybus SD/MMC Host driver");
MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org>");
#endif
......@@ -382,7 +382,8 @@ static const struct tty_operations gb_ops = {
};
static int tty_gb_probe(struct greybus_device *gdev, const struct greybus_device_id *id)
int gb_tty_probe(struct greybus_device *gdev,
const struct greybus_device_id *id)
{
struct gb_tty *gb_tty;
struct device *tty_dev;
......@@ -427,7 +428,7 @@ static int tty_gb_probe(struct greybus_device *gdev, const struct greybus_device
return retval;
}
static void tty_gb_disconnect(struct greybus_device *gdev)
void gb_tty_disconnect(struct greybus_device *gdev)
{
struct gb_tty *gb_tty = greybus_get_drvdata(gdev);
struct tty_struct *tty;
......@@ -457,13 +458,13 @@ static void tty_gb_disconnect(struct greybus_device *gdev)
}
static struct greybus_driver tty_gb_driver = {
.probe = tty_gb_probe,
.disconnect = tty_gb_disconnect,
.probe = gb_tty_probe,
.disconnect = gb_tty_disconnect,
.id_table = id_table,
};
static int __init gb_tty_init(void)
int __init gb_tty_init(void)
{
int retval;
......@@ -496,14 +497,16 @@ static int __init gb_tty_init(void)
return retval;
}
static void __exit gb_tty_exit(void)
void __exit gb_tty_exit(void)
{
greybus_deregister(&tty_gb_driver);
tty_unregister_driver(gb_tty_driver);
put_tty_driver(gb_tty_driver);
}
#if 0
module_init(gb_tty_init);
module_exit(gb_tty_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org>");
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment