diff options
author | Jiucheng Xu <Jiucheng.Xu@freescale.com> | 2012-08-28 15:34:14 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-04-05 15:59:25 (GMT) |
commit | 33cd3da5ada6f99ff03d707fe7f00732febc5b83 (patch) | |
tree | ada8fd0b2c9137d9ca3313437a4157790953c152 /drivers | |
parent | 1780a6268d407819c656cf8acf2d80d8aa0eaddb (diff) | |
download | linux-fsl-qoriq-33cd3da5ada6f99ff03d707fe7f00732febc5b83.tar.xz |
TDM: Add a directly R/W API for tdm core
Tdm core exported the simple function interfaces for user in kernel space.
Signed-off-by: Jiucheng Xu <Jiucheng.Xu@freescale.com>
Signed-off-by: Kai.Jiang <Kai.Jiang@freescale.com>
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
Change-Id: Ifc8ef6b14f7cbc3c88fcfc5e4a1afd59564d8059
Reviewed-on: http://git.am.freescale.net:8181/904
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tdm/tdm-core.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/drivers/tdm/tdm-core.c b/drivers/tdm/tdm-core.c index 666710a..3fd3242 100644 --- a/drivers/tdm/tdm-core.c +++ b/drivers/tdm/tdm-core.c @@ -1,6 +1,6 @@ /* driver/tdm/tdm-core.c * - * Copyright (C) 2012 Freescale Semiconductor, Inc, All rights reserved. + * Copyright 2012 Freescale Semiconductor, Inc. * * TDM core is the interface between TDM clients and TDM devices. * It is also intended to serve as an interface for line controld @@ -359,6 +359,54 @@ module_exit(tdm_exit); /* Interface to the tdm device/adapter */ +/* tdm_read_direct - issue a TDM read + * @adap: Handle to TDM device + * @buf: Data that will be read from the TDM device + * @len: How many bytes to read + * + * Returns negative errno, or else 0. + */ +int tdm_read_direct(struct tdm_adapter *adap, u8 *buf, u32 len) +{ + int res; + + if (adap->algo->tdm_read_simple) + res = adap->algo->tdm_read_simple(adap, buf, len); + else { + pr_err("TDM level read not supported\n"); + return -EOPNOTSUPP; + } + /* If everything went ok (i.e. frame received), return #bytes + transmitted, else error code. */ + + return res; + + +} +EXPORT_SYMBOL(tdm_read_direct); + +/* tdm_write_direct - issue a TDM write + * @adap: Handle to TDM device + * @buf: Data that will be written to the TDM device + * @len: How many bytes to write + * + * Returns negative errno, or else 0. + */ +int tdm_write_direct(struct tdm_adapter *adap, u8 *buf, u32 len) +{ + int res; + + if (adap->algo->tdm_write_simple) + res = adap->algo->tdm_write_simple(adap, buf, len); + else { + pr_err("TDM level write not supported\n"); + return -EOPNOTSUPP; + } + + return res; +} +EXPORT_SYMBOL(tdm_write_direct); + /* tdm_adap_send - issue a TDM write * @adap: Handle to TDM device * @buf: Data that will be written to the TDM device |