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

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

parent 503c1cdb
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
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
+41 −0
Original line number Diff line number Diff line
@@ -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);
+7 −4
Original line number Diff line number Diff line
@@ -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
+9 −1
Original line number Diff line number Diff line
@@ -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,
+7 −4
Original line number Diff line number Diff line
@@ -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
Loading