blob: 5d921f5e18c42c4a5249049591e34d3adf7ca705 [file] [log] [blame]
Sjur Braendeland09009f32010-03-30 13:56:21 +00001/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFSRVL_H_
8#define CFSRVL_H_
9#include <linux/list.h>
10#include <linux/stddef.h>
11#include <linux/types.h>
Sjur Braendeland5b208652010-04-28 08:54:36 +000012#include <linux/kref.h>
13
Sjur Braendeland09009f32010-03-30 13:56:21 +000014struct cfsrvl {
15 struct cflayer layer;
16 bool open;
17 bool phy_flow_on;
18 bool modem_flow_on;
Sjur Braendelandb1c74242010-06-17 06:55:38 +000019 bool supports_flowctrl;
Sjur Braendeland09009f32010-03-30 13:56:21 +000020 struct dev_info dev_info;
Sjur Braendeland5b208652010-04-28 08:54:36 +000021 struct kref ref;
Sjur Braendeland09009f32010-03-30 13:56:21 +000022};
23
Sjur Braendeland5b208652010-04-28 08:54:36 +000024void cfsrvl_release(struct kref *kref);
Sjur Braendeland09009f32010-03-30 13:56:21 +000025struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
26struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
27struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
28struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
29struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info);
30struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
31bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
32void cfservl_destroy(struct cflayer *layer);
33void cfsrvl_init(struct cfsrvl *service,
Sjur Braendelandb1c74242010-06-17 06:55:38 +000034 u8 channel_id,
35 struct dev_info *dev_info,
36 bool supports_flowctrl);
Sjur Braendeland09009f32010-03-30 13:56:21 +000037bool cfsrvl_ready(struct cfsrvl *service, int *err);
38u8 cfsrvl_getphyid(struct cflayer *layer);
39
Sjur Braendeland5b208652010-04-28 08:54:36 +000040static inline void cfsrvl_get(struct cflayer *layr)
41{
42 struct cfsrvl *s;
43 if (layr == NULL)
44 return;
45 s = container_of(layr, struct cfsrvl, layer);
46 kref_get(&s->ref);
47}
48
49static inline void cfsrvl_put(struct cflayer *layr)
50{
51 struct cfsrvl *s;
52 if (layr == NULL)
53 return;
54 s = container_of(layr, struct cfsrvl, layer);
55 kref_put(&s->ref, cfsrvl_release);
56}
57
Sjur Braendeland09009f32010-03-30 13:56:21 +000058#endif /* CFSRVL_H_ */