diff options
author | Kumar Sanghvi <kumar.sanghvi@stericsson.com> | 2011-05-16 21:00:49 +0530 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@linaro.org> | 2012-03-19 09:02:36 +0100 |
commit | 42a8e8c86534e138a235d7618bd365bebe6006f6 (patch) | |
tree | 75d96f1cde22d2ade3406a7ad8b7d5f014186ec4 /drivers/modem/modem_u8500.c | |
parent | 0493c81204260eed0b3f24ad4a10098e96355c83 (diff) |
drivers: modem: Add modem access driver for STE U8500
Adds platform driver which implements mechanism for accessing
modem on STE U8500 platform which uses Shared Memory for
communicating between Modem and Application processor.
The driver also registers itself with the Modem Access framework.
ST-Ericsson ID: CR329459
Change-Id: Id5bc18f6f974b026f9be2d3e2756e03417e01e07
Signed-off-by: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/23554
Reviewed-by: QATEST
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'drivers/modem/modem_u8500.c')
-rw-r--r-- | drivers/modem/modem_u8500.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/drivers/modem/modem_u8500.c b/drivers/modem/modem_u8500.c new file mode 100644 index 00000000000..20b5fe78ef7 --- /dev/null +++ b/drivers/modem/modem_u8500.c @@ -0,0 +1,94 @@ +/* + * Copyright (C) ST-Ericsson SA 2011 + * + * License Terms: GNU General Public License v2 + * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.com> + * + * Platform driver implementing access mechanisms to modem + * on U8500 which uses Shared Memroy as IPC between Application + * Processor and Modem processor. + */ +#include <linux/modem/modem.h> +#include <linux/platform_device.h> +#include <linux/err.h> +#include <mach/prcmu.h> + +static void u8500_modem_request(struct modem_dev *mdev) +{ + prcmu_ac_wake_req(); +} + +static void u8500_modem_release(struct modem_dev *mdev) +{ + prcmu_ac_sleep_req(); +} + +static int u8500_modem_is_requested(struct modem_dev *mdev) +{ + return prcmu_is_ac_wake_requested(); +} + +static struct modem_ops u8500_modem_ops = { + .request = u8500_modem_request, + .release = u8500_modem_release, + .is_requested = u8500_modem_is_requested, +}; + +static struct modem_desc u8500_modem_desc = { + .name = "u8500-shrm-modem", + .id = 0, + .ops = &u8500_modem_ops, + .owner = THIS_MODULE, +}; + + +static int __devinit u8500_modem_probe(struct platform_device *pdev) +{ + struct modem_dev *mdev; + int err; + + mdev = modem_register(&u8500_modem_desc, &pdev->dev, + NULL); + if (IS_ERR(mdev)) { + err = PTR_ERR(mdev); + pr_err("failed to register %s: err %i\n", + u8500_modem_desc.name, err); + } + + return 0; +} + +static int __devexit u8500_modem_remove(struct platform_device *pdev) +{ + + return 0; +} + +static struct platform_driver u8500_modem_driver = { + .driver = { + .name = "u8500-modem", + .owner = THIS_MODULE, + }, + .probe = u8500_modem_probe, + .remove = __devexit_p(u8500_modem_remove), +}; + +static int __init u8500_modem_init(void) +{ + int ret; + + ret = platform_driver_register(&u8500_modem_driver); + if (ret < 0) { + printk(KERN_ERR "u8500_modem: platform driver reg failed\n"); + return -ENODEV; + } + + return 0; +} + +static void __exit u8500_modem_exit(void) +{ + platform_driver_unregister(&u8500_modem_driver); +} + +arch_initcall(u8500_modem_init); |