Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
9c8d3afd
Commit
9c8d3afd
authored
Sep 13, 2014
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greybus: es1: handle cport data in and out
parent
0dad95dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
5 deletions
+71
-5
drivers/staging/greybus/ap.c
drivers/staging/greybus/ap.c
+6
-0
drivers/staging/greybus/es1-ap-usb.c
drivers/staging/greybus/es1-ap-usb.c
+53
-5
drivers/staging/greybus/gbuf.c
drivers/staging/greybus/gbuf.c
+9
-0
drivers/staging/greybus/greybus.h
drivers/staging/greybus/greybus.h
+3
-0
No files found.
drivers/staging/greybus/ap.c
View file @
9c8d3afd
...
...
@@ -298,6 +298,12 @@ int gb_new_ap_msg(u8 *data, int size, struct greybus_host_device *hd)
}
EXPORT_SYMBOL_GPL
(
gb_new_ap_msg
);
void
greybus_cport_in_data
(
struct
greybus_host_device
*
hd
,
int
cport
,
u8
*
data
,
size_t
length
)
{
// FIXME - implement...
}
EXPORT_SYMBOL_GPL
(
greybus_cport_in_data
);
int
gb_thread_init
(
void
)
{
...
...
drivers/staging/greybus/es1-ap-usb.c
View file @
9c8d3afd
...
...
@@ -233,7 +233,11 @@ static void svc_callback(struct urb *urb)
static
void
cport_in_callback
(
struct
urb
*
urb
)
{
struct
device
*
dev
=
&
urb
->
dev
->
dev
;
struct
es1_ap_dev
*
es1
=
urb
->
context
;
int
status
=
urb
->
status
;
int
retval
;
u8
cport
;
u8
*
data
;
switch
(
status
)
{
case
0
:
...
...
@@ -252,15 +256,40 @@ static void cport_in_callback(struct urb *urb)
goto
exit
;
}
// FIXME - handle the CPort in data
/* The size has to be more then just an "empty" transfer */
if
(
urb
->
actual_length
<=
2
)
{
dev_err
(
dev
,
"%s:
\"
short
\"
cport in transfer of %d bytes?
\n
"
,
__func__
,
urb
->
actual_length
);
goto
exit
;
}
/*
* The CPort number is the first byte of the data stream, the rest of
* the stream is "real" data
*/
data
=
urb
->
transfer_buffer
;
cport
=
data
[
0
];
data
=
&
data
[
1
];
/* Pass this data to the greybus core */
greybus_cport_in_data
(
es1
->
hd
,
cport
,
data
,
urb
->
actual_length
-
1
);
exit:
return
;
/* put our urb back in the request pool */
retval
=
usb_submit_urb
(
urb
,
GFP_ATOMIC
);
if
(
retval
)
dev_err
(
dev
,
"%s: error %d in submitting urb.
\n
"
,
__func__
,
retval
);
}
static
void
cport_out_callback
(
struct
urb
*
urb
)
{
struct
device
*
dev
=
&
urb
->
dev
->
dev
;
struct
gbuf
*
gbuf
=
urb
->
context
;
struct
es1_ap_dev
*
es1
=
gbuf
->
hdpriv
;
unsigned
long
flags
;
int
status
=
urb
->
status
;
int
i
;
switch
(
status
)
{
case
0
:
...
...
@@ -273,15 +302,34 @@ static void cport_out_callback(struct urb *urb)
case
-
ESHUTDOWN
:
case
-
EILSEQ
:
/* device is gone, stop sending */
return
;
goto
exit
;
default:
dev_err
(
dev
,
"%s: unknown status %d
\n
"
,
__func__
,
status
);
goto
exit
;
}
// FIXME - handle the CPort out data callback
// FIXME - do we care about errors going back up?
/* Tell the core the gbuf is properly sent */
greybus_gbuf_finished
(
gbuf
);
exit:
return
;
/*
* See if this was an urb in our pool, if so mark it "free", otherwise we
* need to free it ourselves.
*/
spin_lock_irqsave
(
&
es1
->
cport_out_urb_lock
,
flags
);
for
(
i
=
0
;
i
<
NUM_CPORT_OUT_URB
;
++
i
)
{
if
(
urb
==
es1
->
cport_out_urb
[
i
])
{
es1
->
cport_out_urb_busy
[
i
]
=
false
;
urb
=
NULL
;
break
;
}
}
spin_unlock_irqrestore
(
&
es1
->
cport_out_urb_lock
,
flags
);
if
(
urb
)
usb_free_urb
(
urb
);
}
/*
...
...
drivers/staging/greybus/gbuf.c
View file @
9c8d3afd
...
...
@@ -98,10 +98,19 @@ EXPORT_SYMBOL_GPL(greybus_get_gbuf);
int
greybus_submit_gbuf
(
struct
gbuf
*
gbuf
,
gfp_t
mem_flags
)
{
// FIXME - implement
return
-
ENOMEM
;
}
int
greybus_kill_gbuf
(
struct
gbuf
*
gbuf
)
{
// FIXME - implement
return
-
ENOMEM
;
}
/* Can be called in interrupt context, do the work and get out of here */
void
greybus_gbuf_finished
(
struct
gbuf
*
gbuf
)
{
// FIXME - implement
}
EXPORT_SYMBOL_GPL
(
greybus_gbuf_finished
);
drivers/staging/greybus/greybus.h
View file @
9c8d3afd
...
...
@@ -126,6 +126,9 @@ struct greybus_host_device {
struct
greybus_host_device
*
greybus_create_hd
(
struct
greybus_host_driver
*
host_driver
,
struct
device
*
parent
);
void
greybus_remove_hd
(
struct
greybus_host_device
*
hd
);
void
greybus_cport_in_data
(
struct
greybus_host_device
*
hd
,
int
cport
,
u8
*
data
,
size_t
length
);
void
greybus_gbuf_finished
(
struct
gbuf
*
gbuf
);
/* Increase these values if needed */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment