X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/fb189822fcab111e55d1c7e83c482dc2c144500a..49662300d85d67ae95f60752f3391fa17aae5ea8:/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-spi-gpio.c diff --git a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-spi-gpio.c b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-spi-gpio.c index b92e48a17..6316b85d0 100644 --- a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-spi-gpio.c +++ b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-spi-gpio.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -38,8 +37,7 @@ struct glamo_spigpio { struct spi_bitbang bitbang; struct spi_master *master; - struct glamo_spigpio_info *info; - struct glamo_core *glamo; + struct glamo_spigpio_platform_data *info; }; static inline struct glamo_spigpio *to_sg(struct spi_device *spi) @@ -50,20 +48,20 @@ static inline struct glamo_spigpio *to_sg(struct spi_device *spi) static inline void setsck(struct spi_device *dev, int on) { struct glamo_spigpio *sg = to_sg(dev); - glamo_gpio_setpin(sg->glamo, sg->info->pin_clk, on ? 1 : 0); + glamo_gpio_setpin(sg->info->core, sg->info->pin_clk, on ? 1 : 0); } static inline void setmosi(struct spi_device *dev, int on) { struct glamo_spigpio *sg = to_sg(dev); - glamo_gpio_setpin(sg->glamo, sg->info->pin_mosi, on ? 1 : 0); + glamo_gpio_setpin(sg->info->core, sg->info->pin_mosi, on ? 1 : 0); } static inline u32 getmiso(struct spi_device *dev) { struct glamo_spigpio *sg = to_sg(dev); if (sg->info->pin_miso) - return glamo_gpio_getpin(sg->glamo, sg->info->pin_miso) ? 1 : 0; + return glamo_gpio_getpin(sg->info->core, sg->info->pin_miso) ? 1 : 0; else return 0; } @@ -123,7 +121,7 @@ static void glamo_spigpio_chipsel(struct spi_device *spi, int value) dev_dbg(&spi->dev, "chipsel %d: spi=%p, gs=%p, info=%p, handle=%p\n", value, spi, gs, gs->info, gs->info->glamo); #endif - glamo_gpio_setpin(gs->glamo, gs->info->pin_cs, value ? 0 : 1); + glamo_gpio_setpin(gs->info->core, gs->info->pin_cs, value ? 0 : 1); } @@ -153,7 +151,6 @@ static int glamo_spigpio_probe(struct platform_device *pdev) master->bus_num = 2; /* FIXME: use dynamic number */ sp->master = spi_master_get(master); - sp->glamo = sp->info->glamo; sp->bitbang.master = sp->master; sp->bitbang.chipselect = glamo_spigpio_chipsel; @@ -163,20 +160,20 @@ static int glamo_spigpio_probe(struct platform_device *pdev) sp->bitbang.txrx_word[SPI_MODE_3] = glamo_spigpio_txrx_mode3; /* set state of spi pins */ - glamo_gpio_setpin(sp->glamo, sp->info->pin_clk, 0); - glamo_gpio_setpin(sp->glamo, sp->info->pin_mosi, 0); - glamo_gpio_setpin(sp->glamo, sp->info->pin_cs, 1); + glamo_gpio_setpin(sp->info->core, sp->info->pin_clk, 0); + glamo_gpio_setpin(sp->info->core, sp->info->pin_mosi, 0); + glamo_gpio_setpin(sp->info->core, sp->info->pin_cs, 1); - glamo_gpio_cfgpin(sp->glamo, sp->info->pin_clk); - glamo_gpio_cfgpin(sp->glamo, sp->info->pin_mosi); - glamo_gpio_cfgpin(sp->glamo, sp->info->pin_cs); + glamo_gpio_cfgpin(sp->info->core, sp->info->pin_clk); + glamo_gpio_cfgpin(sp->info->core, sp->info->pin_mosi); + glamo_gpio_cfgpin(sp->info->core, sp->info->pin_cs); if (sp->info->pin_miso) - glamo_gpio_cfgpin(sp->glamo, sp->info->pin_miso); + glamo_gpio_cfgpin(sp->info->core, sp->info->pin_miso); /* bring the LCM panel out of reset if it isn't already */ - glamo_gpio_setpin(sp->glamo, GLAMO_GPIO4, 1); - glamo_gpio_cfgpin(sp->glamo, GLAMO_GPIO4_OUTPUT); + glamo_gpio_setpin(sp->info->core, GLAMO_GPIO4, 1); + glamo_gpio_cfgpin(sp->info->core, GLAMO_GPIO4_OUTPUT); msleep(90); #if 0 @@ -214,49 +211,52 @@ static int glamo_spigpio_remove(struct platform_device *pdev) return 0; } -/*#define glamo_spigpio_suspend NULL -#define glamo_spigpio_resume NULL -*/ - #ifdef CONFIG_PM -static int glamo_spigpio_suspend(struct platform_device *pdev, pm_message_t state) +/*static int glamo_spigpio_suspend(struct device *dev) { return 0; -} +}*/ -static int glamo_spigpio_resume(struct platform_device *pdev) +static int glamo_spigpio_resume(struct device *dev) { - struct glamo_spigpio *sp = platform_get_drvdata(pdev); + struct glamo_spigpio *sp = dev_get_drvdata(dev); if (!sp) return 0; /* set state of spi pins */ - glamo_gpio_setpin(sp->glamo, sp->info->pin_clk, 0); - glamo_gpio_setpin(sp->glamo, sp->info->pin_mosi, 0); - glamo_gpio_setpin(sp->glamo, sp->info->pin_cs, 1); + glamo_gpio_setpin(sp->info->core, sp->info->pin_clk, 0); + glamo_gpio_setpin(sp->info->core, sp->info->pin_mosi, 0); + glamo_gpio_setpin(sp->info->core, sp->info->pin_cs, 1); - glamo_gpio_cfgpin(sp->glamo, sp->info->pin_clk); - glamo_gpio_cfgpin(sp->glamo, sp->info->pin_mosi); - glamo_gpio_cfgpin(sp->glamo, sp->info->pin_cs); + glamo_gpio_cfgpin(sp->info->core, sp->info->pin_clk); + glamo_gpio_cfgpin(sp->info->core, sp->info->pin_mosi); + glamo_gpio_cfgpin(sp->info->core, sp->info->pin_cs); if (sp->info->pin_miso) - glamo_gpio_cfgpin(sp->glamo, sp->info->pin_miso); + glamo_gpio_cfgpin(sp->info->core, sp->info->pin_miso); return 0; } + +static struct dev_pm_ops glamo_spigpio_pm_ops = { +/* .suspend = glamo_spiogpio_suspend,*/ + .resume_noirq = glamo_spigpio_resume, +}; + +#define GLAMO_SPIGPIO_PM_OPS (&glamo_spigpio_pm_ops) + +#else +#define GLAMO_SPIGPIO_PM_OPS NULL #endif static struct platform_driver glamo_spi_drv = { .probe = glamo_spigpio_probe, .remove = glamo_spigpio_remove, -#ifdef CONFIG_PM - .suspend_late = glamo_spigpio_suspend, - .resume_early = glamo_spigpio_resume, -#endif .driver = { .name = "glamo-spi-gpio", .owner = THIS_MODULE, + .pm = GLAMO_SPIGPIO_PM_OPS, }, };